@microi.net/cli 5.8.5 → 5.8.6
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/.codebuddy-plugin/marketplace.json +2 -2
- package/.codebuddy-plugin/plugin.json +1 -1
- package/.codex-plugin/plugin.json +1 -1
- package/.mcp.json +1 -1
- package/.workbuddy-plugin/marketplace.json +2 -2
- package/.workbuddy-plugin/plugin.json +1 -1
- package/LICENSE +21 -21
- package/README.md +71 -71
- package/assets/build-meta.json +6 -6
- package/assets/feature-matrix.json +138 -138
- package/assets/logo.svg +4 -4
- package/cordis.patch.yml +1 -1
- package/package.json +1 -1
- package/scripts/codex-marketplace.json +20 -20
- package/scripts/mcp-codex-stdio-adapter.js +189 -189
- package/scripts/mcp-trae-windows-launcher.cmd +21 -21
- package/scripts/microi-cli-mcp.js +7 -7
- package/scripts/microi-cli.js +66 -65
- package/scripts/microi-codex-broker.js +450 -450
- package/scripts/microi-codex-router.js +618 -618
- package/scripts/microi-skills.meta.json +384 -384
- package/skills/.microi-skills-version.json +2 -2
- package/skills/.progressive-disclosure-manifest.json +3566 -3566
- package/skills/README.md +287 -287
- package/skills/ai-engine/SKILL.md +269 -265
- package/skills/ai-engine/agents/openai.yaml +4 -4
- package/skills/ai-engine/references/ai-employees.md +48 -48
- package/skills/ai-engine/references/self-hosted-digital-human.md +59 -59
- package/skills/ai-platform-governance/SKILL.md +177 -177
- package/skills/ai-platform-governance/references/progressive-01-/345/212/237/350/203/275/345/274/200/345/205/263.md +190 -190
- package/skills/app-store/SKILL.md +525 -525
- package/skills/app-store/agents/openai.yaml +4 -4
- package/skills/business-blueprint/SKILL.md +193 -193
- package/skills/datasource-engine/SKILL.md +93 -93
- package/skills/datasource-engine/agents/openai.yaml +4 -4
- package/skills/dos-orm/SKILL.md +97 -97
- package/skills/dos-orm/references/api-reference.md +229 -229
- package/skills/email-engine/SKILL.md +81 -81
- package/skills/email-engine/references/v8-email.md +34 -34
- package/skills/job-engine/SKILL.md +176 -176
- package/skills/job-engine/agents/openai.yaml +4 -4
- package/skills/message-notification/SKILL.md +156 -156
- package/skills/message-notification/agents/openai.yaml +5 -5
- package/skills/message-notification/references/contracts.md +102 -102
- package/skills/microi/SKILL.md +14 -14
- package/skills/microi-ai-app-auth.js +652 -652
- package/skills/microi-ai-application/SKILL.md +115 -115
- package/skills/microi-ai-application/agents/openai.yaml +4 -4
- package/skills/microi-ai-application/references/frontend-baseline.md +164 -164
- package/skills/microi-client-frontend/SKILL.md +244 -244
- package/skills/microi-client-frontend/references/progressive-01-3-/345/212/250/346/200/201/346/214/211/351/222/256/347/263/273/347/273/237.md +144 -144
- package/skills/microi-client-frontend/references/progressive-02-8-/350/277/220/350/241/214/346/227/266/351/253/230/351/242/221/345/235/221/345/244/215/347/233/230.md +196 -196
- package/skills/microi-client-frontend/references/progressive-03-vue3-/345/211/215/347/253/257/345/276/256/346/234/215/345/212/241/345/256/277/344/270/273/350/247/204/345/210/231.md +167 -167
- package/skills/microi-codex/SKILL.md +102 -102
- package/skills/microi-codex-installer/SKILL.md +231 -231
- package/skills/microi-codex-installer/agents/openai.yaml +7 -7
- package/skills/microi-datasource-mapping/SKILL.md +122 -122
- package/skills/microi-db-schema/SKILL.md +175 -175
- package/skills/microi-db-schema/agents/openai.yaml +4 -4
- package/skills/microi-db-schema/references/core-tables.md +695 -695
- package/skills/microi-db-schema/references/form-component-options.md +256 -256
- package/skills/microi-db-schema/references/schema-overview.md +202 -202
- package/skills/microi-db-schema/references/schema.md +646 -646
- package/skills/microi-db-schema/references/table-catalog.md +1599 -1599
- package/skills/microi-deployment/SKILL.md +221 -221
- package/skills/microi-deployment/references/deployment-matrix.md +109 -109
- package/skills/microi-docs-coverage/SKILL.md +133 -133
- package/skills/microi-docs-coverage/references/capability-map.md +91 -91
- package/skills/microi-docs-coverage/scripts/audit-doc-skill-coverage.mjs +894 -894
- package/skills/microi-form-engine/SKILL.md +333 -333
- package/skills/microi-form-engine/references/component-catalog.md +218 -218
- package/skills/microi-form-engine/references/data-source-events.md +124 -124
- package/skills/microi-form-layout/SKILL.md +205 -205
- package/skills/microi-form-layout/references/progressive-01-3-/344/270/211/347/247/215/345/210/206/347/273/204/347/232/204/345/255/230/345/202/250/344/270/216/351/205/215/347/275/256.md +235 -235
- package/skills/microi-frontend-sdk/SKILL.md +194 -194
- package/skills/microi-frontend-sdk/references/progressive-01-token-/345/275/223/345/211/215/347/231/273/345/275/225/347/224/250/346/210/267/344/270/216/345/275/223/345/211/215/347/273/210/347/253/257/347/231/273/345/275/225/345/215/217/350/256/256.md +176 -176
- package/skills/microi-left-right-layout/SKILL.md +141 -141
- package/skills/microi-microservice/SKILL.md +326 -324
- package/skills/microi-microservice/references/runtime-delivery.md +278 -278
- package/skills/microi-mobile-app-quality/SKILL.md +185 -185
- package/skills/microi-mobile-app-quality/references/progressive-01-4-/351/207/215/350/246/201/346/214/211/351/222/256/345/277/205/351/241/273/345/270/246/345/233/276/346/240/207.md +213 -213
- package/skills/microi-mobile-app-quality/references/progressive-02-9-/344/270/273/351/242/230/345/210/207/346/215/242/345/277/205/351/241/273/347/234/237/345/256/236/344/270/224/345/205/250/345/261/200/347/224/237/346/225/210.md +128 -128
- package/skills/microi-solution-quotation/SKILL.md +78 -78
- package/skills/microi-solution-quotation/agents/openai.yaml +4 -4
- package/skills/microi-solution-quotation/scripts/build_solution_quote.py +296 -296
- package/skills/microi-sso/SKILL.md +92 -92
- package/skills/microi-sso/references/acceptance.md +49 -49
- package/skills/microi-sso/references/configuration-and-security.md +53 -53
- package/skills/microi-sso/references/inbound.md +53 -53
- package/skills/microi-sso/references/outbound.md +39 -39
- package/skills/microi-system-delivery/SKILL.md +137 -137
- package/skills/microi-system-delivery/references/progressive-01-/346/240/207/345/207/206/345/267/245/344/275/234/346/265/201.md +193 -193
- package/skills/microi-system-delivery/references/progressive-02-/350/207/252/345/212/250/345/214/226/346/265/213/350/257/225/345/277/205/351/241/273/350/246/206/347/233/226/347/232/204/345/235/221.md +217 -217
- package/skills/microi-ui/SKILL.md +192 -192
- package/skills/microi-ui/references/progressive-01-/347/247/273/345/212/250/347/253/257/345/234/272/346/231/257/350/223/235/345/233/276.md +183 -183
- package/skills/microi-uniapp-frontend/SKILL.md +193 -193
- package/skills/microi-uniapp-frontend/references/progressive-01-/347/247/273/345/212/250/347/253/257/345/210/206/347/261/273-/345/217/214/346/240/217/345/210/227/350/241/250/347/213/254/347/253/213/346/273/232/345/212/250.md +225 -225
- package/skills/microi-uniapp-frontend/references/progressive-02-/345/205/263/351/224/256/344/270/232/345/212/241/350/265/204/344/272/247/344/270/215/345/276/227/351/273/230/350/256/244/351/200/211/344/270/255.md +154 -154
- package/skills/microi.v8.js +1921 -1921
- package/skills/module-engine/SKILL.md +255 -255
- package/skills/module-engine/references/module-config.md +204 -204
- package/skills/ocr-engine/SKILL.md +113 -113
- package/skills/ocr-engine/agents/openai.yaml +4 -4
- package/skills/page-engine/SKILL.md +206 -206
- package/skills/page-engine/examples/compact-dashboard.json +1444 -1444
- package/skills/page-engine/references/progressive-01-/346/211/200/346/234/211/347/273/204/344/273/266/347/261/273/345/236/213.md +234 -234
- package/skills/page-engine/references/progressive-02-/347/211/210/346/234/254/345/216/206/345/217/262-/345/271/266/345/217/221/344/277/235/345/255/230/344/270/216/345/233/236/346/273/232.md +60 -60
- package/skills/performance-testing/SKILL.md +221 -221
- package/skills/playwright-e2e/SKILL.md +196 -196
- package/skills/playwright-e2e/references/progressive-01-/345/205/250/350/207/252/345/212/250/347/231/273/345/275/225-/345/205/215/351/252/214/350/257/201/347/240/201-/344/275/206/344/270/215/345/205/215/345/257/206/347/240/201-/345/277/205/350/257/273.md +173 -173
- package/skills/playwright-e2e/references/progressive-02-/346/226/207/345/255/227/345/257/271/346/257/224/345/272/246/344/270/216/345/217/257/350/257/273/346/200/247/350/207/252/345/212/250/345/214/226/346/243/200/346/237/245-/345/277/205/345/201/232.md +183 -183
- package/skills/playwright-e2e/references/progressive-03-microi-helper-/346/250/241/346/235/277.md +221 -221
- package/skills/playwright-e2e/references/progressive-04-ci-/345/273/272/350/256/256.md +115 -115
- package/skills/print-engine/SKILL.md +259 -259
- package/skills/production-readonly-audit/SKILL.md +41 -41
- package/skills/report-engine/SKILL.md +71 -71
- package/skills/report-engine/agents/openai.yaml +4 -4
- package/skills/scripts/optimize-progressive-disclosure.mjs +204 -204
- package/skills/scripts/refresh-progressive-disclosure.mjs +64 -64
- package/skills/scripts/sync-embedded-skills.mjs +46 -46
- package/skills/scripts/validate-progressive-disclosure.mjs +57 -57
- package/skills/search-engine/SKILL.md +75 -75
- package/skills/search-engine/agents/openai.yaml +4 -4
- package/skills/spider-engine/SKILL.md +190 -190
- package/skills/system-observability/SKILL.md +248 -248
- package/skills/system-observability/references/memory-incident-triage.md +77 -77
- package/skills/translate-engine/SKILL.md +140 -140
- package/skills/translate-engine/agents/openai.yaml +4 -4
- package/skills/ui-design/SKILL.md +223 -223
- package/skills/ui-design/assets/pattern-showcase/app.js +54 -54
- package/skills/ui-design/assets/pattern-showcase/index.html +163 -163
- package/skills/ui-design/assets/pattern-showcase/styles.css +311 -311
- package/skills/ui-design/assets/templates/MCI-DESIGN.md +206 -206
- package/skills/ui-design/references/design-pattern-library.md +184 -184
- package/skills/ui-design/references/mci-design-contract.md +163 -163
- package/skills/ui-design/references/motion-and-media.md +78 -78
- package/skills/ui-design/references/product-flow-recipes.md +94 -94
- package/skills/ui-design/references/progressive-01-/351/242/234/350/211/262/344/275/223/347/263/273-css-variables-/346/224/257/346/214/201/344/270/273/351/242/230/345/210/207/346/215/242.md +218 -218
- package/skills/ui-design/references/progressive-02-/345/255/227/344/275/223.md +164 -164
- package/skills/ui-design/references/progressive-03-/345/212/250/346/225/210/350/247/204/350/214/203-/344/270/260/345/257/214/344/275/206/344/270/215/345/215/241.md +235 -235
- package/skills/ui-design/references/progressive-04-/347/273/204/344/273/266/351/243/216/346/240/274/351/200/237/346/237/245.md +152 -152
- package/skills/ui-design/references/progressive-05-/347/247/273/345/212/250/347/253/257/344/270/223/347/224/250/350/247/204/350/214/203.md +238 -238
- package/skills/ui-design/references/progressive-06-/344/270/273/351/242/230/345/210/207/346/215/242/345/256/236/347/216/260.md +194 -194
- package/skills/ui-design/references/progressive-07-/351/200/237/346/237/245-/344/273/216/345/244/264/346/220/255/345/273/272/344/270/200/344/270/252/347/247/273/345/212/250/347/253/257/351/241/265/351/235/242.md +207 -207
- package/skills/ui-design/references/progressive-08-/350/241/250/345/215/225/345/210/206/347/273/204/350/247/204/350/214/203-tabs-vs-collapsegroup-/345/274/272/345/210/266.md +142 -142
- package/skills/uniapp-mall-assets/SKILL.md +176 -176
- package/skills/unity-integration/SKILL.md +171 -171
- package/skills/unity-integration/agents/openai.yaml +4 -4
- package/skills/unity-integration/references/ai-app-delivery.md +119 -119
- package/skills/unity-integration/references/sdk-api.md +82 -82
- package/skills/unity-integration/references/toolbox-migration.md +66 -66
- package/skills/unity-integration/references/webgl-hosting.md +57 -57
- package/skills/v8-api-config/SKILL.md +388 -388
- package/skills/v8-cache-pattern/SKILL.md +312 -312
- package/skills/v8-crud-api/SKILL.md +178 -178
- package/skills/v8-crud-api/references/progressive-01-/346/237/245/350/257/242/345/210/227/350/241/250-/345/210/206/351/241/265.md +226 -226
- package/skills/v8-crud-api/references/progressive-02-where-/346/235/241/344/273/266/350/257/255/346/263/225/351/200/237/346/237/245.md +49 -49
- package/skills/v8-debugging/SKILL.md +284 -284
- package/skills/v8-explorer-tree/SKILL.md +228 -228
- package/skills/v8-export-import/SKILL.md +219 -219
- package/skills/v8-export-import/references/progressive-01-excellayout-/351/253/230/347/272/247/350/207/252/347/224/261/345/270/203/345/261/200.md +211 -211
- package/skills/v8-export-import/references/progressive-02-powerpoint-/345/257/274/345/207/272.md +202 -202
- package/skills/v8-export-import/references/progressive-03-/345/256/211/345/205/250-/346/200/247/350/203/275/346/263/250/346/204/217.md +42 -42
- package/skills/v8-file-upload/SKILL.md +284 -284
- package/skills/v8-file-upload/references/progressive-01-/345/205/254/346/234/211/346/241/266-vs-/347/247/201/346/234/211/346/241/266.md +263 -263
- package/skills/v8-file-upload/references/progressive-02-office-/346/226/207/344/273/266/345/234/250/347/272/277/347/274/226/350/276/221/347/211/210/346/234/254/345/217/267/350/247/204/345/210/231.md +161 -161
- package/skills/v8-formengine-http/SKILL.md +238 -238
- package/skills/v8-frontend-events/SKILL.md +180 -180
- package/skills/v8-frontend-events/references/bluetooth-print-api.md +135 -135
- package/skills/v8-frontend-events/references/bluetooth-print.md +258 -258
- package/skills/v8-frontend-events/references/progressive-01-/345/210/227/350/241/250/344/272/213/344/273/266.md +219 -219
- package/skills/v8-http-integration/SKILL.md +182 -182
- package/skills/v8-http-integration/references/progressive-01-get-/350/257/267/346/261/202.md +220 -220
- package/skills/v8-http-integration/references/progressive-02-/351/224/231/350/257/257/345/244/204/347/220/206/346/250/241/345/274/217.md +44 -44
- package/skills/v8-image-processing/SKILL.md +190 -190
- package/skills/v8-image-processing/agents/openai.yaml +4 -4
- package/skills/v8-image-processing/references/api-reference.md +623 -623
- package/skills/v8-menu-buttons/SKILL.md +186 -186
- package/skills/v8-menu-buttons/references/progressive-01-2-/346/214/211/351/222/256/345/257/271/350/261/241-schema.md +222 -222
- package/skills/v8-menu-buttons/references/progressive-02-8-/346/250/241/345/274/217-f-/345/220/216/345/217/260/344/273/273/345/212/241/346/214/211/351/222/256-/351/225/277/344/273/273/345/212/241.md +228 -228
- package/skills/v8-menu-buttons/references/progressive-03-10-/345/217/215/346/250/241/345/274/217-/351/201/277/345/205/215.md +104 -104
- package/skills/v8-mongodb/SKILL.md +200 -200
- package/skills/v8-mq-mqtt/SKILL.md +176 -176
- package/skills/v8-mq-mqtt/references/mqtt-production.md +342 -342
- package/skills/v8-mq-mqtt/references/progressive-01-v8-mqtt-iot-/347/211/251/350/201/224/347/275/221.md +181 -181
- package/skills/v8-mq-mqtt/scripts/check-mqtt-skill-coverage.mjs +203 -203
- package/skills/v8-saas-multi-tenant/SKILL.md +305 -305
- package/skills/v8-security/SKILL.md +210 -210
- package/skills/v8-security/references/progressive-01-2-/346/235/203/351/231/220/346/240/241/351/252/214.md +200 -200
- package/skills/v8-security/references/progressive-02-7-/346/227/245/345/277/227/350/256/260/345/275/225.md +160 -160
- package/skills/v8-sql-query/SKILL.md +302 -302
- package/skills/v8-table-event/SKILL.md +176 -176
- package/skills/v8-table-event/references/progressive-01-informv8-js-/350/241/250/345/215/225/346/211/223/345/274/200/344/272/213/344/273/266.md +216 -216
- package/skills/v8-table-event/references/progressive-02-/345/211/215/347/253/257/344/272/213/344/273/266/345/220/215-v8-eventname-/345/217/257/350/203/275/347/232/204/345/200/274.md +46 -46
- package/skills/v8-tcp-integration/SKILL.md +147 -147
- package/skills/v8-tcp-integration/agents/openai.yaml +4 -4
- package/skills/v8-template-engine/SKILL.md +167 -167
- package/skills/v8-utilities/SKILL.md +104 -104
- package/skills/v8-utilities/references/client-api-index.md +143 -143
- package/skills/v8-utilities/references/platform-http-routes.md +83 -83
- package/skills/v8-utilities/references/server-api-index.md +188 -188
- package/skills/v8-workflow/SKILL.md +252 -252
- package/skills/v8-workflow/references/progressive-01-/350/212/202/347/202/271/345/274/200/345/247/213-v8-/344/272/213/344/273/266.md +180 -180
- package/skills/v8-workflow/references/workflow-configuration.md +49 -49
- package/skills/vision-engine/SKILL.md +160 -160
- package/skills/vision-engine/agents/openai.yaml +4 -4
- package/skills/vision-engine/references/architecture-and-acceptance.md +194 -194
- package/skills/workspace-conventions/SKILL.md +273 -273
- package/skills/workspace-conventions/references/progressive-01-/347/211/210/346/234/254/346/233/264/346/226/260/346/227/245/345/277/227/344/277/235/346/212/244/350/247/204/345/210/231-/345/274/272/345/210/266.md +209 -209
- package/skills/workspace-conventions/references/progressive-02-microi-net-api-/346/234/254/345/234/260/345/220/257/345/212/250/347/272/246/345/256/232.md +217 -217
- package/skills/workspace-conventions/references/progressive-03-cli-/344/270/216-ide-/346/217/222/344/273/266/351/224/231/347/211/210/345/205/261/345/255/230/347/272/246/345/256/232.md +27 -27
|
@@ -1,278 +1,278 @@
|
|
|
1
|
-
# MicroService 运行与交付参考
|
|
2
|
-
|
|
3
|
-
## 数据流
|
|
4
|
-
|
|
5
|
-
```text
|
|
6
|
-
在线 AI / MCP / VS Code
|
|
7
|
-
├─ 应用主数据 -> sys_microistore
|
|
8
|
-
├─ 私有源码 -> mci_ai_app_file -> 私有 HDFS
|
|
9
|
-
└─ 构建发布 -> sys_microiservice + sys_microiservice_page
|
|
10
|
-
└-> 公有构建产物
|
|
11
|
-
后台菜单 / 表单 DevComponent / V8.OpenAppDialog -> 微应用宿主
|
|
12
|
-
```
|
|
13
|
-
|
|
14
|
-
`ApplicationType=MicroService` 表示运行类型;官方/社区来源是独立字段,不能混用。
|
|
15
|
-
|
|
16
|
-
## 清单
|
|
17
|
-
|
|
18
|
-
`.microi-micro-app.json` 核心字段:
|
|
19
|
-
|
|
20
|
-
- `schemaVersion`
|
|
21
|
-
- `runtime`
|
|
22
|
-
- `appKey`
|
|
23
|
-
- `name`
|
|
24
|
-
- `osClient`
|
|
25
|
-
- `apiBaseUrl`
|
|
26
|
-
- `entry`
|
|
27
|
-
- `distDir`
|
|
28
|
-
- `routeManifest`
|
|
29
|
-
- `version`
|
|
30
|
-
|
|
31
|
-
不要将本地项目的 AppKey 改成另一个已存在应用 Key。
|
|
32
|
-
|
|
33
|
-
## 线上运行目标与本地宿主复现
|
|
34
|
-
|
|
35
|
-
收到线上微服务 URL 时,先在一次性独立浏览器上下文等待主框架初始化,并读取
|
|
36
|
-
`window.__MICROI_RUNTIME_ENDPOINT__` 中的 `apiBase`、`osClient` 和 `webBase`。旧版主框架没有该
|
|
37
|
-
对象时,依次检查 URL 参数、`window.ApiBase/window.OsClient`、同源 `microi.net` 持久化状态;
|
|
38
|
-
OsClient 仍为空时调用域名租户解析接口或从已经成功的请求确认,禁止按域名猜测。
|
|
39
|
-
|
|
40
|
-
确认后用本地 `Microi.Client` 宿主复现,查询参数位于 `#` 之前并具有最高优先级:
|
|
41
|
-
|
|
42
|
-
```text
|
|
43
|
-
http://localhost:61500/?OsClient=tenant-a&ApiBase=https%3A%2F%2Fapi.example.com#/micro-app/example-app/projects
|
|
44
|
-
```
|
|
45
|
-
|
|
46
|
-
同源页面会共享 Pinia/localStorage、Token、CurrentUser、ApiBase 和 OsClient。每组不同的
|
|
47
|
-
`ApiBase + OsClient` 必须使用独立浏览器 Profile/进程或 Playwright `browser.newContext()`;人工
|
|
48
|
-
第二组至少使用无痕窗口,但多个 Chrome 无痕窗口仍可能共享同一临时会话,不能作为多组并发的
|
|
49
|
-
强隔离。只切 URL 不等于隔离登录态,也不能绕过 CORS、菜单、角色或数据权限。
|
|
50
|
-
|
|
51
|
-
`microi.routes.json`:
|
|
52
|
-
|
|
53
|
-
```json
|
|
54
|
-
[
|
|
55
|
-
{
|
|
56
|
-
"path": "/",
|
|
57
|
-
"name": "home",
|
|
58
|
-
"title": "首页",
|
|
59
|
-
"sort": 0,
|
|
60
|
-
"isHome": true
|
|
61
|
-
},
|
|
62
|
-
{
|
|
63
|
-
"path": "/order/edit",
|
|
64
|
-
"name": "order-edit",
|
|
65
|
-
"title": "订单编辑",
|
|
66
|
-
"sort": 10
|
|
67
|
-
}
|
|
68
|
-
]
|
|
69
|
-
```
|
|
70
|
-
|
|
71
|
-
路径必须稳定并以 `/` 开头。迁移历史内置页面时可维护
|
|
72
|
-
`LegacyMenuUrls/LegacyComponentPaths`,让新旧书签在过渡期共存;
|
|
73
|
-
`LegacyComponentPaths` 也作为表单 `DevComponentPath` 到微服务页面 RoutePath 的稳定别名。
|
|
74
|
-
|
|
75
|
-
## MCP 读取/写入
|
|
76
|
-
|
|
77
|
-
| 工具 | 作用 |
|
|
78
|
-
|---|---|
|
|
79
|
-
| `microi_list_applications` | 列出应用与文件 |
|
|
80
|
-
| `microi_get_application_context` | 默认读取元数据、哈希、运行时和页面;按需显式读取内容 |
|
|
81
|
-
| `microi_get_application_file` | 读取单文件 |
|
|
82
|
-
| `microi_get_microservice` | 回读已发布运行时 |
|
|
83
|
-
| `microi_create_microservice` | dry-run/创建运行元数据 |
|
|
84
|
-
| `microi_sync_microservice_source` | 同步私有源码;本地工程首选绝对路径 `directory` |
|
|
85
|
-
| `microi_publish_application_directory_stream` | 流式发布真实构建目录 |
|
|
86
|
-
| `microi_publish_microservice` | 小产物兼容发布 |
|
|
87
|
-
|
|
88
|
-
`replace=true` 会清理源码清单外的旧元数据,属于覆盖性写入;必须先展示文件差异并
|
|
89
|
-
获得明确确认。超时先回读,不重复发布。
|
|
90
|
-
|
|
91
|
-
本地源码目录由 MCP 进程直接扫描和读取,AI 只看路径、大小、哈希与清单;禁止生成
|
|
92
|
-
`.sync-seg-*`、`sync-source-files.json` 或手工 Base64 分段。单个源码超过模型读取上限时仍保持
|
|
93
|
-
一个真实文件。`sourceFiles` 只保留没有本地目录时的旧调用兼容。
|
|
94
|
-
|
|
95
|
-
真实构建目录一律使用逐文件 multipart 流:默认/硬上限为 20,000 文件、总计 20GB,
|
|
96
|
-
文件体不进入 JSON、Base64 或 Jint。`StorageMode=db` 的 256 文件/5MB 仅用于小型
|
|
97
|
-
应急恢复,不能作为大项目发布器。发布器必须持久化同一交付批次的
|
|
98
|
-
`DeliveryBatchId`、`SourceManifestHash`、`RuntimeManifestHash`。
|
|
99
|
-
|
|
100
|
-
## 菜单路由
|
|
101
|
-
|
|
102
|
-
友好路由:
|
|
103
|
-
|
|
104
|
-
```text
|
|
105
|
-
/micro-app/{MsKey}/{RoutePath}
|
|
106
|
-
```
|
|
107
|
-
|
|
108
|
-
菜单配置:
|
|
109
|
-
|
|
110
|
-
- `OpenType=MicroService`
|
|
111
|
-
- `MicroServiceId`
|
|
112
|
-
- `MicroServicePageId`
|
|
113
|
-
- `MicroServiceRoutePath`
|
|
114
|
-
- `MicroServiceKey`
|
|
115
|
-
- `ComponentPath=/micro-app/host`
|
|
116
|
-
- `ModuleEngineKey`(宿主权限上下文)
|
|
117
|
-
|
|
118
|
-
无需导航的内部页面直接在 `sys_microiservice_page.RouteMetaJson` 设置
|
|
119
|
-
`InternalOnly=true`;不再依赖伪造的隐藏 `sys_menu` 才能刷新友好路由。真正需要菜单
|
|
120
|
-
导航的页面再创建 `sys_menu`,错误设置 `HasChild` 会让菜单只展开不打开。
|
|
121
|
-
|
|
122
|
-
## OpenAppDialog
|
|
123
|
-
|
|
124
|
-
```javascript
|
|
125
|
-
V8.OpenAppDialog({
|
|
126
|
-
AppKey: 'order-app',
|
|
127
|
-
RoutePath: '/order/edit',
|
|
128
|
-
Title: '编辑订单',
|
|
129
|
-
Width: 'min(960px, calc(100vw - 32px))',
|
|
130
|
-
OpenType: 'Drawer',
|
|
131
|
-
Data: { Id: V8.Form.Id },
|
|
132
|
-
ModuleEngineKey: 'authorized-module-key',
|
|
133
|
-
OnSuccess: function (data) {
|
|
134
|
-
V8.RefreshTable({ _PageIndex: -1 });
|
|
135
|
-
},
|
|
136
|
-
OnCancel: function () {},
|
|
137
|
-
OnError: function (error) {
|
|
138
|
-
V8.Tips(error.message || '应用加载失败', false);
|
|
139
|
-
}
|
|
140
|
-
});
|
|
141
|
-
```
|
|
142
|
-
|
|
143
|
-
回调函数必须在顶层,不放 `Data`。`OpenAppDialog` 只加载已发布 MicroService;
|
|
144
|
-
`OpenDialog` 加载主前端注册组件。
|
|
145
|
-
|
|
146
|
-
## 表单引擎定制组件
|
|
147
|
-
|
|
148
|
-
需要把复杂区域固定嵌入表单时,字段使用 `Component=DevComponent`,并让
|
|
149
|
-
`Config.DevComponentPath` 匹配目标页面 `RouteMetaJson.LegacyComponentPaths`。主前端能找到
|
|
150
|
-
同路径 Vue 文件时仍加载本地组件;找不到时才查询启用的 `sys_microiservice_page` 并由
|
|
151
|
-
`micro-app/dev-component.vue` 加载该页面 `RoutePath`。新项目应使用不会与 `/src/views` 真实文件
|
|
152
|
-
冲突的虚拟路径。
|
|
153
|
-
|
|
154
|
-
组件宿主下发 `componentMode=true`、`componentData`、`microRoute`、当前 Token/OsClient 和
|
|
155
|
-
`permissionContext`。`componentData` 仅包含可序列化表单上下文,不传函数、Vue 实例、循环引用或
|
|
156
|
-
`ParentV8`。子应用使用:
|
|
157
|
-
|
|
158
|
-
```javascript
|
|
159
|
-
window.microApp.dispatch({ type: 'dev-component:resize', height: 520 });
|
|
160
|
-
window.microApp.dispatch({
|
|
161
|
-
type: 'dev-component:event',
|
|
162
|
-
event: 'update:modelValue',
|
|
163
|
-
args: [{ status: 'passed' }]
|
|
164
|
-
});
|
|
165
|
-
```
|
|
166
|
-
|
|
167
|
-
高度限制为 80~1600px;表单联动还可上报 `CallbackFormValueChange`、`FormSet`、
|
|
168
|
-
`ParentFormSet`。验收覆盖 Add/Edit/View/只读、字段值回写、窄屏/暗色以及有权/无权账号。
|
|
169
|
-
|
|
170
|
-
## 子应用宿主数据
|
|
171
|
-
|
|
172
|
-
```javascript
|
|
173
|
-
const host = window.microApp?.getData?.() || {};
|
|
174
|
-
```
|
|
175
|
-
|
|
176
|
-
常见字段:`apiBase`、`osClient`、`token`、`menuId`、`moduleEngineKey`、`diyTableId`、
|
|
177
|
-
`permissionContext`、`appKey`、`version`、`microRoute`、`dialog`、`dialogData`、
|
|
178
|
-
`componentMode`、`componentData`、`cache`、`hostCapabilities.lifecycle`。只在内存中使用 Token。
|
|
179
|
-
|
|
180
|
-
独立访问时没有宿主 Token:先配置清单中的 `apiBase/osClient`,读取 `V8.GetSysConfig(true)`,
|
|
181
|
-
没有有效本地 Token 才显示吾码帐号密码登录;按 `EnableCaptcha` 动态请求验证码并向 `V8.Login`
|
|
182
|
-
提交 `_CaptchaId/_CaptchaValue`。嵌入菜单、表单定制组件或弹层时复用宿主身份,不显示第二套登录。
|
|
183
|
-
|
|
184
|
-
`permissionContext={sysMenuId,moduleEngineKey,diyTableId}` 只帮助子应用选择正确的 FormEngine
|
|
185
|
-
模块上下文,不能授予权限。无权限时依次核对 Token/OsClient、模块 Key、宿主上下文和角色授权;
|
|
186
|
-
禁止去掉权限参数、改匿名接口或硬编码管理员 Token。
|
|
187
|
-
|
|
188
|
-
页面根容器使用 `min-height: var(--micro-app-available-height, 100vh)`,让后台菜单、弹窗和
|
|
189
|
-
移动端共享宿主实测高度;不要在嵌入模式直接固定 `100vh`。宿主高度变化时还会通过
|
|
190
|
-
`host:resize` 数据事件下发 `hostViewport`,画布、图表等需精确像素的组件据此重新布局。
|
|
191
|
-
|
|
192
|
-
菜单页采用单一纵向滚动所有者:自然增高的长页面由 `<micro-app>` 边界兜底滚动;需要内部
|
|
193
|
-
sticky/虚拟列表时,子应用以宿主可用高度约束自己的滚动容器并设置 `overflow-y:auto`,框架边界
|
|
194
|
-
因不再发生内容溢出而不显示滚动条。不要同时让宿主外层、微服务边界和自动高度根节点都承担滚动。
|
|
195
|
-
|
|
196
|
-
菜单页签还采用单一缓存所有者:主框架 Vue 宿主不进入 `KeepAlive`,由 `<micro-app keep-alive>`
|
|
197
|
-
保存子应用状态。宿主按租户、AppKey、主框架 `fullPath`、版本和入口生成稳定指纹,菜单 Id 只进入权限上下文、不参与实例名,避免首屏动态菜单元数据尚未补齐时产生第二个运行时;最多保留
|
|
198
|
-
5 个运行时;超过上限时只按 LRU 销毁隐藏实例。关闭当前/其它/全部 Tab、访问记录淘汰、退出登录、
|
|
199
|
-
Token 重置、角色变化、同一路由版本或入口变化时,使用 `destroy:true,clearData:true` 精确销毁。
|
|
200
|
-
弹窗和表单组件不承诺页签缓存,禁止套用菜单规则。
|
|
201
|
-
|
|
202
|
-
隐藏/恢复由子应用原生事件通知:
|
|
203
|
-
|
|
204
|
-
```javascript
|
|
205
|
-
window.addEventListener('appstate-change', function (event) {
|
|
206
|
-
var state = event.detail && event.detail.appState;
|
|
207
|
-
if (state === 'afterhidden') pauseBackgroundWork();
|
|
208
|
-
if (state === 'aftershow') {
|
|
209
|
-
configureMicroiV8(getMicroiContext());
|
|
210
|
-
resumeBackgroundWorkOnce();
|
|
211
|
-
requestAnimationFrame(resizeChartsAndVirtualLists);
|
|
212
|
-
}
|
|
213
|
-
});
|
|
214
|
-
```
|
|
215
|
-
|
|
216
|
-
`pause/resume` 必须幂等,分别处理轮询、WebSocket、观察器、图表和虚拟列表;隐藏时不得清空用户
|
|
217
|
-
输入、筛选、滚动或内部路由。恢复时宿主会以 `host:resume` 强制同步当前 Token、OsClient、权限、
|
|
218
|
-
主题、路由和视口,然后复核真实可见 DOM;子应用也应重新读取宿主上下文。AI 生成菜单微服务时
|
|
219
|
-
必须包含此生命周期适配,不能只实现首次 `mount`。
|
|
220
|
-
|
|
221
|
-
子应用通过模板 SDK 调用接口,不自行发明认证协议。关闭/结果使用宿主约定的
|
|
222
|
-
success、cancel、error/close 事件;业务写入成功后再报告 success。
|
|
223
|
-
|
|
224
|
-
## 微服务调用平台普通打印
|
|
225
|
-
|
|
226
|
-
菜单微服务需要增加“普通打印”时,使用 `microi.host.v1` 的 `openPlatformPrint` 动作打开
|
|
227
|
-
吾码 Print Engine 预览。不要跨 iframe 调 `window.parent.V8`、Vue 实例或打印组件,也不要
|
|
228
|
-
把平台打印弹窗复制进每个子应用。
|
|
229
|
-
|
|
230
|
-
```javascript
|
|
231
|
-
function openPlatformPrint(printId, businessId) {
|
|
232
|
-
const host = window.microApp?.getData?.() || {};
|
|
233
|
-
const capabilities = host.hostCapabilities;
|
|
234
|
-
if (capabilities?.protocol !== 'microi.host.v1'
|
|
235
|
-
|| !capabilities?.actions?.includes('openPlatformPrint')) {
|
|
236
|
-
throw new Error('当前吾码宿主不支持平台普通打印');
|
|
237
|
-
}
|
|
238
|
-
|
|
239
|
-
const dataApi = new URL('/apiengine/get-print-data', host.apiBase);
|
|
240
|
-
dataApi.searchParams.set('OsClient', host.osClient);
|
|
241
|
-
dataApi.searchParams.set('Id', businessId);
|
|
242
|
-
const requestId = `print-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`;
|
|
243
|
-
|
|
244
|
-
window.microApp.dispatch({
|
|
245
|
-
type: capabilities.requestType || 'micro-app:host-action',
|
|
246
|
-
action: 'openPlatformPrint',
|
|
247
|
-
requestId,
|
|
248
|
-
data: {
|
|
249
|
-
printId, // mic_print.Id
|
|
250
|
-
dataApi: dataApi.toString(),
|
|
251
|
-
title: '普通打印'
|
|
252
|
-
}
|
|
253
|
-
});
|
|
254
|
-
return requestId;
|
|
255
|
-
}
|
|
256
|
-
```
|
|
257
|
-
|
|
258
|
-
参数与失败语义:
|
|
259
|
-
|
|
260
|
-
- `printId` 只接受 1~128 位字母、数字、下划线或连字符,对应当前租户可读的
|
|
261
|
-
`mic_print.Id`。
|
|
262
|
-
- `dataApi` 必须是绝对 HTTP(S) 地址,与宿主当前 `apiBase` 同源,路径以
|
|
263
|
-
`/apiengine/` 开头,并明确携带大小写不敏感匹配的 `OsClient`;禁止 URL 凭据和片段。
|
|
264
|
-
- 宿主通过 `micro-app:host-action-result` 回传同一个 `requestId`。成功数据
|
|
265
|
-
`{ accepted:true, printId }` 只说明预览弹层已打开,不证明浏览器打印或物理出纸。
|
|
266
|
-
- 独立运行没有 `hostCapabilities`;应隐藏/禁用按钮或使用应用自己的独立预览方案。
|
|
267
|
-
- 该动作不是蓝牙代理。平台前端 V8 的 TSPL/CPCL/ESC-POS 与 BLE/SPP 继续使用
|
|
268
|
-
`V8.Print`,不能把原生命令字节传给 `openPlatformPrint`。
|
|
269
|
-
|
|
270
|
-
## 版本与回滚
|
|
271
|
-
|
|
272
|
-
- 每个发布版本保存入口、文件清单、哈希和页面清单。
|
|
273
|
-
- 新旧版本资源路径可共存,运行时切换版本后再清理旧产物。
|
|
274
|
-
- 发布失败不能覆盖最后一个可运行版本。
|
|
275
|
-
- 回滚同时恢复运行版本和页面路由,不只改版本文本。
|
|
276
|
-
- 切换前由当前 Token 的 OsClient 解析子租户 HDFS,并逐文件读回校验大小、SHA-256、入口完整 HTML;主租户默认配置不能作为回退。
|
|
277
|
-
- 状态按 `Staged -> Verified -> Published` 推进,只有稳定入口 HTTP 200、HTML Content-Type 且含 `<head>/<body>` 才能报告成功。
|
|
278
|
-
- 商城/离线包需明确是否包含私有源码;只有公有构建文件的包可以运行但不能拉回源码继续开发。
|
|
1
|
+
# MicroService 运行与交付参考
|
|
2
|
+
|
|
3
|
+
## 数据流
|
|
4
|
+
|
|
5
|
+
```text
|
|
6
|
+
在线 AI / MCP / VS Code
|
|
7
|
+
├─ 应用主数据 -> sys_microistore
|
|
8
|
+
├─ 私有源码 -> mci_ai_app_file -> 私有 HDFS
|
|
9
|
+
└─ 构建发布 -> sys_microiservice + sys_microiservice_page
|
|
10
|
+
└-> 公有构建产物
|
|
11
|
+
后台菜单 / 表单 DevComponent / V8.OpenAppDialog -> 微应用宿主
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
`ApplicationType=MicroService` 表示运行类型;官方/社区来源是独立字段,不能混用。
|
|
15
|
+
|
|
16
|
+
## 清单
|
|
17
|
+
|
|
18
|
+
`.microi-micro-app.json` 核心字段:
|
|
19
|
+
|
|
20
|
+
- `schemaVersion`
|
|
21
|
+
- `runtime`
|
|
22
|
+
- `appKey`
|
|
23
|
+
- `name`
|
|
24
|
+
- `osClient`
|
|
25
|
+
- `apiBaseUrl`
|
|
26
|
+
- `entry`
|
|
27
|
+
- `distDir`
|
|
28
|
+
- `routeManifest`
|
|
29
|
+
- `version`
|
|
30
|
+
|
|
31
|
+
不要将本地项目的 AppKey 改成另一个已存在应用 Key。
|
|
32
|
+
|
|
33
|
+
## 线上运行目标与本地宿主复现
|
|
34
|
+
|
|
35
|
+
收到线上微服务 URL 时,先在一次性独立浏览器上下文等待主框架初始化,并读取
|
|
36
|
+
`window.__MICROI_RUNTIME_ENDPOINT__` 中的 `apiBase`、`osClient` 和 `webBase`。旧版主框架没有该
|
|
37
|
+
对象时,依次检查 URL 参数、`window.ApiBase/window.OsClient`、同源 `microi.net` 持久化状态;
|
|
38
|
+
OsClient 仍为空时调用域名租户解析接口或从已经成功的请求确认,禁止按域名猜测。
|
|
39
|
+
|
|
40
|
+
确认后用本地 `Microi.Client` 宿主复现,查询参数位于 `#` 之前并具有最高优先级:
|
|
41
|
+
|
|
42
|
+
```text
|
|
43
|
+
http://localhost:61500/?OsClient=tenant-a&ApiBase=https%3A%2F%2Fapi.example.com#/micro-app/example-app/projects
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
同源页面会共享 Pinia/localStorage、Token、CurrentUser、ApiBase 和 OsClient。每组不同的
|
|
47
|
+
`ApiBase + OsClient` 必须使用独立浏览器 Profile/进程或 Playwright `browser.newContext()`;人工
|
|
48
|
+
第二组至少使用无痕窗口,但多个 Chrome 无痕窗口仍可能共享同一临时会话,不能作为多组并发的
|
|
49
|
+
强隔离。只切 URL 不等于隔离登录态,也不能绕过 CORS、菜单、角色或数据权限。
|
|
50
|
+
|
|
51
|
+
`microi.routes.json`:
|
|
52
|
+
|
|
53
|
+
```json
|
|
54
|
+
[
|
|
55
|
+
{
|
|
56
|
+
"path": "/",
|
|
57
|
+
"name": "home",
|
|
58
|
+
"title": "首页",
|
|
59
|
+
"sort": 0,
|
|
60
|
+
"isHome": true
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
"path": "/order/edit",
|
|
64
|
+
"name": "order-edit",
|
|
65
|
+
"title": "订单编辑",
|
|
66
|
+
"sort": 10
|
|
67
|
+
}
|
|
68
|
+
]
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
路径必须稳定并以 `/` 开头。迁移历史内置页面时可维护
|
|
72
|
+
`LegacyMenuUrls/LegacyComponentPaths`,让新旧书签在过渡期共存;
|
|
73
|
+
`LegacyComponentPaths` 也作为表单 `DevComponentPath` 到微服务页面 RoutePath 的稳定别名。
|
|
74
|
+
|
|
75
|
+
## MCP 读取/写入
|
|
76
|
+
|
|
77
|
+
| 工具 | 作用 |
|
|
78
|
+
|---|---|
|
|
79
|
+
| `microi_list_applications` | 列出应用与文件 |
|
|
80
|
+
| `microi_get_application_context` | 默认读取元数据、哈希、运行时和页面;按需显式读取内容 |
|
|
81
|
+
| `microi_get_application_file` | 读取单文件 |
|
|
82
|
+
| `microi_get_microservice` | 回读已发布运行时 |
|
|
83
|
+
| `microi_create_microservice` | dry-run/创建运行元数据 |
|
|
84
|
+
| `microi_sync_microservice_source` | 同步私有源码;本地工程首选绝对路径 `directory` |
|
|
85
|
+
| `microi_publish_application_directory_stream` | 流式发布真实构建目录 |
|
|
86
|
+
| `microi_publish_microservice` | 小产物兼容发布 |
|
|
87
|
+
|
|
88
|
+
`replace=true` 会清理源码清单外的旧元数据,属于覆盖性写入;必须先展示文件差异并
|
|
89
|
+
获得明确确认。超时先回读,不重复发布。
|
|
90
|
+
|
|
91
|
+
本地源码目录由 MCP 进程直接扫描和读取,AI 只看路径、大小、哈希与清单;禁止生成
|
|
92
|
+
`.sync-seg-*`、`sync-source-files.json` 或手工 Base64 分段。单个源码超过模型读取上限时仍保持
|
|
93
|
+
一个真实文件。`sourceFiles` 只保留没有本地目录时的旧调用兼容。
|
|
94
|
+
|
|
95
|
+
真实构建目录一律使用逐文件 multipart 流:默认/硬上限为 20,000 文件、总计 20GB,
|
|
96
|
+
文件体不进入 JSON、Base64 或 Jint。`StorageMode=db` 的 256 文件/5MB 仅用于小型
|
|
97
|
+
应急恢复,不能作为大项目发布器。发布器必须持久化同一交付批次的
|
|
98
|
+
`DeliveryBatchId`、`SourceManifestHash`、`RuntimeManifestHash`。
|
|
99
|
+
|
|
100
|
+
## 菜单路由
|
|
101
|
+
|
|
102
|
+
友好路由:
|
|
103
|
+
|
|
104
|
+
```text
|
|
105
|
+
/micro-app/{MsKey}/{RoutePath}
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
菜单配置:
|
|
109
|
+
|
|
110
|
+
- `OpenType=MicroService`
|
|
111
|
+
- `MicroServiceId`
|
|
112
|
+
- `MicroServicePageId`
|
|
113
|
+
- `MicroServiceRoutePath`
|
|
114
|
+
- `MicroServiceKey`
|
|
115
|
+
- `ComponentPath=/micro-app/host`
|
|
116
|
+
- `ModuleEngineKey`(宿主权限上下文)
|
|
117
|
+
|
|
118
|
+
无需导航的内部页面直接在 `sys_microiservice_page.RouteMetaJson` 设置
|
|
119
|
+
`InternalOnly=true`;不再依赖伪造的隐藏 `sys_menu` 才能刷新友好路由。真正需要菜单
|
|
120
|
+
导航的页面再创建 `sys_menu`,错误设置 `HasChild` 会让菜单只展开不打开。
|
|
121
|
+
|
|
122
|
+
## OpenAppDialog
|
|
123
|
+
|
|
124
|
+
```javascript
|
|
125
|
+
V8.OpenAppDialog({
|
|
126
|
+
AppKey: 'order-app',
|
|
127
|
+
RoutePath: '/order/edit',
|
|
128
|
+
Title: '编辑订单',
|
|
129
|
+
Width: 'min(960px, calc(100vw - 32px))',
|
|
130
|
+
OpenType: 'Drawer',
|
|
131
|
+
Data: { Id: V8.Form.Id },
|
|
132
|
+
ModuleEngineKey: 'authorized-module-key',
|
|
133
|
+
OnSuccess: function (data) {
|
|
134
|
+
V8.RefreshTable({ _PageIndex: -1 });
|
|
135
|
+
},
|
|
136
|
+
OnCancel: function () {},
|
|
137
|
+
OnError: function (error) {
|
|
138
|
+
V8.Tips(error.message || '应用加载失败', false);
|
|
139
|
+
}
|
|
140
|
+
});
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
回调函数必须在顶层,不放 `Data`。`OpenAppDialog` 只加载已发布 MicroService;
|
|
144
|
+
`OpenDialog` 加载主前端注册组件。
|
|
145
|
+
|
|
146
|
+
## 表单引擎定制组件
|
|
147
|
+
|
|
148
|
+
需要把复杂区域固定嵌入表单时,字段使用 `Component=DevComponent`,并让
|
|
149
|
+
`Config.DevComponentPath` 匹配目标页面 `RouteMetaJson.LegacyComponentPaths`。主前端能找到
|
|
150
|
+
同路径 Vue 文件时仍加载本地组件;找不到时才查询启用的 `sys_microiservice_page` 并由
|
|
151
|
+
`micro-app/dev-component.vue` 加载该页面 `RoutePath`。新项目应使用不会与 `/src/views` 真实文件
|
|
152
|
+
冲突的虚拟路径。
|
|
153
|
+
|
|
154
|
+
组件宿主下发 `componentMode=true`、`componentData`、`microRoute`、当前 Token/OsClient 和
|
|
155
|
+
`permissionContext`。`componentData` 仅包含可序列化表单上下文,不传函数、Vue 实例、循环引用或
|
|
156
|
+
`ParentV8`。子应用使用:
|
|
157
|
+
|
|
158
|
+
```javascript
|
|
159
|
+
window.microApp.dispatch({ type: 'dev-component:resize', height: 520 });
|
|
160
|
+
window.microApp.dispatch({
|
|
161
|
+
type: 'dev-component:event',
|
|
162
|
+
event: 'update:modelValue',
|
|
163
|
+
args: [{ status: 'passed' }]
|
|
164
|
+
});
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
高度限制为 80~1600px;表单联动还可上报 `CallbackFormValueChange`、`FormSet`、
|
|
168
|
+
`ParentFormSet`。验收覆盖 Add/Edit/View/只读、字段值回写、窄屏/暗色以及有权/无权账号。
|
|
169
|
+
|
|
170
|
+
## 子应用宿主数据
|
|
171
|
+
|
|
172
|
+
```javascript
|
|
173
|
+
const host = window.microApp?.getData?.() || {};
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
常见字段:`apiBase`、`osClient`、`token`、`menuId`、`moduleEngineKey`、`diyTableId`、
|
|
177
|
+
`permissionContext`、`appKey`、`version`、`microRoute`、`dialog`、`dialogData`、
|
|
178
|
+
`componentMode`、`componentData`、`cache`、`hostCapabilities.lifecycle`。只在内存中使用 Token。
|
|
179
|
+
|
|
180
|
+
独立访问时没有宿主 Token:先配置清单中的 `apiBase/osClient`,读取 `V8.GetSysConfig(true)`,
|
|
181
|
+
没有有效本地 Token 才显示吾码帐号密码登录;按 `EnableCaptcha` 动态请求验证码并向 `V8.Login`
|
|
182
|
+
提交 `_CaptchaId/_CaptchaValue`。嵌入菜单、表单定制组件或弹层时复用宿主身份,不显示第二套登录。
|
|
183
|
+
|
|
184
|
+
`permissionContext={sysMenuId,moduleEngineKey,diyTableId}` 只帮助子应用选择正确的 FormEngine
|
|
185
|
+
模块上下文,不能授予权限。无权限时依次核对 Token/OsClient、模块 Key、宿主上下文和角色授权;
|
|
186
|
+
禁止去掉权限参数、改匿名接口或硬编码管理员 Token。
|
|
187
|
+
|
|
188
|
+
页面根容器使用 `min-height: var(--micro-app-available-height, 100vh)`,让后台菜单、弹窗和
|
|
189
|
+
移动端共享宿主实测高度;不要在嵌入模式直接固定 `100vh`。宿主高度变化时还会通过
|
|
190
|
+
`host:resize` 数据事件下发 `hostViewport`,画布、图表等需精确像素的组件据此重新布局。
|
|
191
|
+
|
|
192
|
+
菜单页采用单一纵向滚动所有者:自然增高的长页面由 `<micro-app>` 边界兜底滚动;需要内部
|
|
193
|
+
sticky/虚拟列表时,子应用以宿主可用高度约束自己的滚动容器并设置 `overflow-y:auto`,框架边界
|
|
194
|
+
因不再发生内容溢出而不显示滚动条。不要同时让宿主外层、微服务边界和自动高度根节点都承担滚动。
|
|
195
|
+
|
|
196
|
+
菜单页签还采用单一缓存所有者:主框架 Vue 宿主不进入 `KeepAlive`,由 `<micro-app keep-alive>`
|
|
197
|
+
保存子应用状态。宿主按租户、AppKey、主框架 `fullPath`、版本和入口生成稳定指纹,菜单 Id 只进入权限上下文、不参与实例名,避免首屏动态菜单元数据尚未补齐时产生第二个运行时;最多保留
|
|
198
|
+
5 个运行时;超过上限时只按 LRU 销毁隐藏实例。关闭当前/其它/全部 Tab、访问记录淘汰、退出登录、
|
|
199
|
+
Token 重置、角色变化、同一路由版本或入口变化时,使用 `destroy:true,clearData:true` 精确销毁。
|
|
200
|
+
弹窗和表单组件不承诺页签缓存,禁止套用菜单规则。
|
|
201
|
+
|
|
202
|
+
隐藏/恢复由子应用原生事件通知:
|
|
203
|
+
|
|
204
|
+
```javascript
|
|
205
|
+
window.addEventListener('appstate-change', function (event) {
|
|
206
|
+
var state = event.detail && event.detail.appState;
|
|
207
|
+
if (state === 'afterhidden') pauseBackgroundWork();
|
|
208
|
+
if (state === 'aftershow') {
|
|
209
|
+
configureMicroiV8(getMicroiContext());
|
|
210
|
+
resumeBackgroundWorkOnce();
|
|
211
|
+
requestAnimationFrame(resizeChartsAndVirtualLists);
|
|
212
|
+
}
|
|
213
|
+
});
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
`pause/resume` 必须幂等,分别处理轮询、WebSocket、观察器、图表和虚拟列表;隐藏时不得清空用户
|
|
217
|
+
输入、筛选、滚动或内部路由。恢复时宿主会以 `host:resume` 强制同步当前 Token、OsClient、权限、
|
|
218
|
+
主题、路由和视口,然后复核真实可见 DOM;子应用也应重新读取宿主上下文。AI 生成菜单微服务时
|
|
219
|
+
必须包含此生命周期适配,不能只实现首次 `mount`。
|
|
220
|
+
|
|
221
|
+
子应用通过模板 SDK 调用接口,不自行发明认证协议。关闭/结果使用宿主约定的
|
|
222
|
+
success、cancel、error/close 事件;业务写入成功后再报告 success。
|
|
223
|
+
|
|
224
|
+
## 微服务调用平台普通打印
|
|
225
|
+
|
|
226
|
+
菜单微服务需要增加“普通打印”时,使用 `microi.host.v1` 的 `openPlatformPrint` 动作打开
|
|
227
|
+
吾码 Print Engine 预览。不要跨 iframe 调 `window.parent.V8`、Vue 实例或打印组件,也不要
|
|
228
|
+
把平台打印弹窗复制进每个子应用。
|
|
229
|
+
|
|
230
|
+
```javascript
|
|
231
|
+
function openPlatformPrint(printId, businessId) {
|
|
232
|
+
const host = window.microApp?.getData?.() || {};
|
|
233
|
+
const capabilities = host.hostCapabilities;
|
|
234
|
+
if (capabilities?.protocol !== 'microi.host.v1'
|
|
235
|
+
|| !capabilities?.actions?.includes('openPlatformPrint')) {
|
|
236
|
+
throw new Error('当前吾码宿主不支持平台普通打印');
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
const dataApi = new URL('/apiengine/get-print-data', host.apiBase);
|
|
240
|
+
dataApi.searchParams.set('OsClient', host.osClient);
|
|
241
|
+
dataApi.searchParams.set('Id', businessId);
|
|
242
|
+
const requestId = `print-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`;
|
|
243
|
+
|
|
244
|
+
window.microApp.dispatch({
|
|
245
|
+
type: capabilities.requestType || 'micro-app:host-action',
|
|
246
|
+
action: 'openPlatformPrint',
|
|
247
|
+
requestId,
|
|
248
|
+
data: {
|
|
249
|
+
printId, // mic_print.Id
|
|
250
|
+
dataApi: dataApi.toString(),
|
|
251
|
+
title: '普通打印'
|
|
252
|
+
}
|
|
253
|
+
});
|
|
254
|
+
return requestId;
|
|
255
|
+
}
|
|
256
|
+
```
|
|
257
|
+
|
|
258
|
+
参数与失败语义:
|
|
259
|
+
|
|
260
|
+
- `printId` 只接受 1~128 位字母、数字、下划线或连字符,对应当前租户可读的
|
|
261
|
+
`mic_print.Id`。
|
|
262
|
+
- `dataApi` 必须是绝对 HTTP(S) 地址,与宿主当前 `apiBase` 同源,路径以
|
|
263
|
+
`/apiengine/` 开头,并明确携带大小写不敏感匹配的 `OsClient`;禁止 URL 凭据和片段。
|
|
264
|
+
- 宿主通过 `micro-app:host-action-result` 回传同一个 `requestId`。成功数据
|
|
265
|
+
`{ accepted:true, printId }` 只说明预览弹层已打开,不证明浏览器打印或物理出纸。
|
|
266
|
+
- 独立运行没有 `hostCapabilities`;应隐藏/禁用按钮或使用应用自己的独立预览方案。
|
|
267
|
+
- 该动作不是蓝牙代理。平台前端 V8 的 TSPL/CPCL/ESC-POS 与 BLE/SPP 继续使用
|
|
268
|
+
`V8.Print`,不能把原生命令字节传给 `openPlatformPrint`。
|
|
269
|
+
|
|
270
|
+
## 版本与回滚
|
|
271
|
+
|
|
272
|
+
- 每个发布版本保存入口、文件清单、哈希和页面清单。
|
|
273
|
+
- 新旧版本资源路径可共存,运行时切换版本后再清理旧产物。
|
|
274
|
+
- 发布失败不能覆盖最后一个可运行版本。
|
|
275
|
+
- 回滚同时恢复运行版本和页面路由,不只改版本文本。
|
|
276
|
+
- 切换前由当前 Token 的 OsClient 解析子租户 HDFS,并逐文件读回校验大小、SHA-256、入口完整 HTML;主租户默认配置不能作为回退。
|
|
277
|
+
- 状态按 `Staged -> Verified -> Published` 推进,只有稳定入口 HTTP 200、HTML Content-Type 且含 `<head>/<body>` 才能报告成功。
|
|
278
|
+
- 商城/离线包需明确是否包含私有源码;只有公有构建文件的包可以运行但不能拉回源码继续开发。
|