@_tc/template-core 0.3.2 → 0.4.1
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/.skills/tc-component-usage-skills/SKILL.md +46 -121
- package/.skills/tc-component-usage-skills/reference/component-api.md +58 -25
- package/.skills/tc-component-usage-skills/reference/examples.md +30 -12
- package/.skills/tc-component-usage-skills/reference/patterns.md +45 -27
- package/.skills/tc-component-usage-skills/reference/template-core-frontend.md +27 -9
- package/.skills/tc-generator/SKILL.md +51 -69
- package/.skills/tc-generator/reference/example.md +150 -99
- package/.skills/tc-generator/reference/model-schema.md +4 -4
- package/.skills/tc-generator/reference/project-template/backend/business.module.ts +9 -0
- package/.skills/tc-generator/reference/project-template/backend/product.controller.ts +71 -0
- package/.skills/tc-generator/reference/project-template/backend/product.service.ts +58 -0
- package/.skills/tc-generator/reference/project-template/backend/product.types.ts +15 -0
- package/.skills/tc-generator/reference/project-template/index.js +32 -13
- package/.skills/tc-generator/reference/project-template/package.json +20 -3
- package/.skills/tc-generator/reference/project-template/scripts/build-backend.mjs +12 -0
- package/.skills/tc-generator/reference/project-template/scripts/build-frontend.mjs +7 -0
- package/.skills/tc-generator/reference/project-template/scripts/build-ssr.mjs +7 -0
- package/.skills/tc-generator/reference/project-template/ssr/apps/hello/hello.entry.tsx +44 -0
- package/.skills/tc-generator/reference/project-template/tsconfig.json +14 -0
- package/.skills/tc-generator/reference/runtime-extensions.md +142 -89
- package/AGENT_README.md +69 -156
- package/CHANGE.md +31 -12
- package/README.md +383 -357
- package/cjs/app/ai/agent/agent-scanner.service.js +1 -0
- package/cjs/app/ai/agent/agent.module.js +1 -0
- package/cjs/app/ai/ai-config.module.js +1 -0
- package/cjs/app/ai/ai-config.service.js +1 -0
- package/cjs/app/ai/ai.controller.js +1 -0
- package/cjs/app/ai/ai.module.js +1 -0
- package/cjs/app/ai/declaration-paths.js +1 -0
- package/cjs/app/ai/eval/assertions.js +1 -0
- package/cjs/app/ai/guardrail/guardrail.module.js +1 -0
- package/cjs/app/ai/guardrail/guardrail.service.js +1 -0
- package/cjs/app/ai/guardrail/internal/load-guardrail-config.js +1 -0
- package/cjs/app/ai/index.js +1 -0
- package/cjs/app/ai/mcp/internal/load-mcp-config.js +1 -0
- package/cjs/app/ai/mcp/internal/read-sse-response.js +2 -0
- package/cjs/app/ai/mcp/internal/stdio-process.js +1 -0
- package/cjs/app/ai/mcp/mcp-registry.service.js +2 -0
- package/cjs/app/ai/mcp/mcp.client.js +3 -0
- package/cjs/app/ai/mcp/mcp.loader.js +1 -0
- package/cjs/app/ai/mcp/mcp.module.js +1 -0
- package/cjs/app/ai/mcp/mcp.types.js +1 -0
- package/cjs/app/ai/memory/checkpoint.service.js +1 -0
- package/cjs/app/ai/memory/internal/load-memory-config.js +1 -0
- package/cjs/app/ai/memory/memory.module.js +1 -0
- package/cjs/app/ai/memory/thread.service.js +1 -0
- package/cjs/app/ai/models/chat-sse.js +4 -0
- package/cjs/app/ai/models/chat.js +1 -0
- package/cjs/app/ai/models/http.js +1 -0
- package/cjs/app/ai/models/image.js +1 -0
- package/cjs/app/ai/models/video.js +1 -0
- package/cjs/app/ai/nest-service-provider.js +1 -0
- package/cjs/app/ai/rag/chunker.js +2 -0
- package/cjs/app/ai/rag/internal/load-embedding-config.js +1 -0
- package/cjs/app/ai/rag/internal/load-rag-config.js +1 -0
- package/cjs/app/ai/rag/rag.interface.js +1 -0
- package/cjs/app/ai/rag/rag.module.js +1 -0
- package/cjs/app/ai/rag/retriever.service.js +1 -0
- package/cjs/app/ai/retention/conversation-retention.service.js +1 -0
- package/cjs/app/ai/retention/retention-policy.js +1 -0
- package/cjs/app/ai/runtime/ai-runtime-startup.validator.js +1 -0
- package/cjs/app/ai/runtime/ai-runtime.js +1 -0
- package/cjs/app/ai/runtime/internal/agent-run-context.js +1 -0
- package/cjs/app/ai/runtime/internal/compact-tool-result.js +1 -0
- package/cjs/app/ai/runtime/internal/context-compaction.service.js +4 -0
- package/cjs/app/ai/runtime/internal/declaration-snapshot.js +1 -0
- package/cjs/app/ai/runtime/internal/load-llm-config.js +1 -0
- package/cjs/app/ai/runtime/internal/load-runtime-config.js +1 -0
- package/cjs/app/ai/runtime/internal/owned-runtime-resources.js +1 -0
- package/cjs/app/ai/runtime/internal/request-budget.js +1 -0
- package/cjs/app/ai/runtime/internal/run-event-queue.js +1 -0
- package/cjs/app/ai/runtime/langchain/langchain-planner.service.js +1 -0
- package/cjs/app/ai/runtime/langchain/skill-tool.adapter.js +1 -0
- package/cjs/app/ai/runtime/langgraph/agent.graph.js +1 -0
- package/cjs/app/ai/runtime/langgraph/agent.state.js +1 -0
- package/cjs/app/ai/runtime/langgraph/langgraph-orchestrator.service.js +1 -0
- package/cjs/app/ai/runtime/runtime.module.js +1 -0
- package/cjs/app/ai/runtime/thread-execution-coordinator.js +1 -0
- package/cjs/app/ai/skill/skill-scanner.service.js +1 -0
- package/cjs/app/ai/skill/skill.module.js +1 -0
- package/cjs/app/ai/snapshot-data.js +1 -0
- package/cjs/app/ai/store/internal/archive-id.js +1 -0
- package/cjs/app/ai/store/internal/create-vector-store.js +1 -0
- package/cjs/app/ai/store/internal/load-store-config.js +1 -0
- package/cjs/app/ai/store/internal/load-thread-state-store.js +1 -0
- package/cjs/app/ai/store/reference/file-memory.store.js +1 -0
- package/cjs/app/ai/store/reference/file-trace.store.js +1 -0
- package/cjs/app/ai/store/reference/file-vector.store.js +1 -0
- package/cjs/app/ai/store/reference/qdrant-vector.store.js +1 -0
- package/cjs/app/ai/store/store.interface.js +1 -0
- package/cjs/app/ai/store/store.module.js +1 -0
- package/cjs/app/ai/tool/builtin/index.js +1 -0
- package/cjs/app/ai/tool/builtin/invoke-agent.tool.js +1 -0
- package/cjs/app/ai/tool/builtin/retrieve.tool.js +1 -0
- package/cjs/app/ai/tool/executor.service.js +1 -0
- package/cjs/app/ai/tool/tool-registry.service.js +1 -0
- package/cjs/app/ai/tool/tool.module.js +1 -0
- package/cjs/app/ai/trace/trace.service.js +1 -0
- package/cjs/app/csr/controller.js +1 -0
- package/cjs/app/extends/$fetch.js +1 -1
- package/cjs/app/extends/crypto.js +1 -1
- package/cjs/app/extends/db.js +4 -4
- package/cjs/app/extends/logger.js +1 -1
- package/cjs/app/frontend-development.js +1 -0
- package/cjs/app/html/browser-options.js +1 -0
- package/cjs/app/html/shell.js +31 -16
- package/cjs/app/http/api-signing.js +1 -0
- package/cjs/app/http/body-parser.middleware.js +1 -0
- package/cjs/app/http/compression.middleware.js +1 -0
- package/cjs/app/http/context.js +1 -0
- package/cjs/app/http/controller.js +1 -0
- package/cjs/app/http/csp-nonce.js +1 -0
- package/cjs/app/http/error-response.js +1 -0
- package/cjs/app/http/errors.js +1 -0
- package/cjs/app/http/exception-filter.js +1 -0
- package/cjs/app/http/request-body-parser-policy.js +1 -0
- package/cjs/app/http/request-data.js +1 -0
- package/cjs/app/http/request-schema.pipe.js +1 -0
- package/cjs/app/http/response.interceptor.js +1 -0
- package/cjs/app/http/response.js +1 -0
- package/cjs/app/http/security.guard.js +1 -0
- package/cjs/app/project/controller.js +1 -0
- package/cjs/app/project/service.js +1 -0
- package/cjs/app/providers/csr.js +1 -0
- package/cjs/app/providers/foundation.js +1 -0
- package/cjs/app/ssr/artifacts.js +1 -0
- package/cjs/app/ssr/controller.js +1 -0
- package/cjs/app/ssr/html.js +19 -11
- package/cjs/app/ssr/manifest.js +2 -2
- package/cjs/app/ssr/session.js +1 -0
- package/cjs/app/ssr/stream.js +1 -0
- package/cjs/app/ssr/streaming-request-cache.js +1 -0
- package/cjs/app/static-assets.middleware.js +1 -0
- package/cjs/app/template-core.module.js +1 -0
- package/cjs/app/view/entry.tpl +2 -2
- package/cjs/bundler/buildBE.js +1 -1
- package/cjs/bundler/buildFE.js +1 -1
- package/cjs/bundler/buildSSR.js +1 -1
- package/cjs/bundler/dev-session.js +1 -0
- package/cjs/bundler/dev.js +1 -1
- package/cjs/bundler/entryCollect.js +1 -1
- package/cjs/bundler/feSharedConfig.js +1 -1
- package/cjs/bundler/index.js +1 -1
- package/cjs/bundler/prod.js +1 -1
- package/cjs/bundler/ssrClientManifest.js +1 -1
- package/cjs/bundler/ssrEntries.js +1 -1
- package/cjs/bundler/state.js +1 -1
- package/cjs/bundler/utils.js +3 -3
- package/cjs/config/config.default.js +1 -1
- package/cjs/index.js +1 -1
- package/cjs/package.json +1 -0
- package/cjs/packages/common/index.js +1 -1
- package/cjs/packages/core/bootstrap.js +1 -0
- package/cjs/packages/core/config-service.js +1 -0
- package/cjs/packages/core/duplicate-route-checking-adapter.js +1 -0
- package/cjs/packages/core/index.js +1 -1
- package/cjs/packages/core/legacy-factory-diagnostics.js +1 -0
- package/cjs/packages/core/loader/model.js +1 -1
- package/cjs/packages/core/paths.js +1 -1
- package/cjs/packages/core/resource-lifecycle.js +1 -0
- package/cjs/packages/core/startup.js +1 -0
- package/cjs/packages/core/tokens.js +1 -0
- package/cjs/packages/utils/runFileFn.js +1 -1
- package/cjs/scripts/vite-build/build.js +2 -1
- package/esm/app/ai/agent/agent-scanner.service.js +88 -0
- package/esm/app/ai/agent/agent.interface.js +0 -0
- package/esm/app/ai/agent/agent.module.js +13 -0
- package/esm/app/ai/ai-config.module.js +24 -0
- package/esm/app/ai/ai-config.service.js +42 -0
- package/esm/app/ai/ai.controller.js +162 -0
- package/esm/app/ai/ai.module.js +48 -0
- package/esm/app/ai/contracts/index.js +0 -0
- package/esm/app/ai/declaration-paths.js +28 -0
- package/esm/app/ai/eval/assertions.js +49 -0
- package/esm/app/ai/guardrail/guardrail.interface.js +0 -0
- package/esm/app/ai/guardrail/guardrail.module.js +13 -0
- package/esm/app/ai/guardrail/guardrail.service.js +30 -0
- package/esm/app/ai/guardrail/internal/load-guardrail-config.js +17 -0
- package/esm/app/ai/index.js +2 -0
- package/esm/app/ai/mcp/internal/load-mcp-config.js +50 -0
- package/esm/app/ai/mcp/internal/read-sse-response.js +35 -0
- package/esm/app/ai/mcp/internal/stdio-process.js +59 -0
- package/esm/app/ai/mcp/mcp-registry.service.js +20 -0
- package/esm/app/ai/mcp/mcp.client.js +198 -0
- package/esm/app/ai/mcp/mcp.loader.js +85 -0
- package/esm/app/ai/mcp/mcp.module.js +70 -0
- package/esm/app/ai/mcp/mcp.types.js +4 -0
- package/esm/app/ai/memory/checkpoint.service.js +79 -0
- package/esm/app/ai/memory/internal/load-memory-config.js +15 -0
- package/esm/app/ai/memory/memory.module.js +17 -0
- package/esm/app/ai/memory/thread.service.js +75 -0
- package/esm/app/ai/models/chat-sse.js +44 -0
- package/esm/app/ai/models/chat.js +60 -0
- package/esm/app/ai/models/http.js +52 -0
- package/esm/app/ai/models/image.js +37 -0
- package/esm/app/ai/models/video.js +32 -0
- package/esm/app/ai/nest-service-provider.js +10 -0
- package/esm/app/ai/rag/chunker.js +23 -0
- package/esm/app/ai/rag/internal/load-embedding-config.js +44 -0
- package/esm/app/ai/rag/internal/load-rag-config.js +35 -0
- package/esm/app/ai/rag/rag.interface.js +4 -0
- package/esm/app/ai/rag/rag.module.js +30 -0
- package/esm/app/ai/rag/retriever.service.js +62 -0
- package/esm/app/ai/retention/conversation-retention.service.js +48 -0
- package/esm/app/ai/retention/retention-policy.js +14 -0
- package/esm/app/ai/runtime/ai-runtime-startup.validator.js +15 -0
- package/esm/app/ai/runtime/ai-runtime.js +104 -0
- package/esm/app/ai/runtime/internal/agent-run-context.js +5 -0
- package/esm/app/ai/runtime/internal/compact-tool-result.js +94 -0
- package/esm/app/ai/runtime/internal/context-compaction.service.js +346 -0
- package/esm/app/ai/runtime/internal/declaration-snapshot.js +32 -0
- package/esm/app/ai/runtime/internal/load-llm-config.js +52 -0
- package/esm/app/ai/runtime/internal/load-runtime-config.js +12 -0
- package/esm/app/ai/runtime/internal/owned-runtime-resources.js +21 -0
- package/esm/app/ai/runtime/internal/request-budget.js +152 -0
- package/esm/app/ai/runtime/internal/run-event-queue.js +23 -0
- package/esm/app/ai/runtime/langchain/langchain-planner.service.js +189 -0
- package/esm/app/ai/runtime/langchain/skill-tool.adapter.js +29 -0
- package/esm/app/ai/runtime/langgraph/agent.graph.js +157 -0
- package/esm/app/ai/runtime/langgraph/agent.state.js +37 -0
- package/esm/app/ai/runtime/langgraph/langgraph-orchestrator.service.js +404 -0
- package/esm/app/ai/runtime/runtime.module.js +65 -0
- package/esm/app/ai/runtime/thread-execution-coordinator.js +27 -0
- package/esm/app/ai/skill/skill-scanner.service.js +66 -0
- package/esm/app/ai/skill/skill.interface.js +0 -0
- package/esm/app/ai/skill/skill.module.js +13 -0
- package/esm/app/ai/snapshot-data.js +24 -0
- package/esm/app/ai/store/internal/archive-id.js +11 -0
- package/esm/app/ai/store/internal/create-vector-store.js +10 -0
- package/esm/app/ai/store/internal/load-store-config.js +27 -0
- package/esm/app/ai/store/internal/load-thread-state-store.js +17 -0
- package/esm/app/ai/store/reference/file-memory.store.js +279 -0
- package/esm/app/ai/store/reference/file-trace.store.js +44 -0
- package/esm/app/ai/store/reference/file-vector.store.js +41 -0
- package/esm/app/ai/store/reference/qdrant-vector.store.js +65 -0
- package/esm/app/ai/store/store.interface.js +4 -0
- package/esm/app/ai/store/store.module.js +36 -0
- package/esm/app/ai/tool/builtin/index.js +18 -0
- package/esm/app/ai/tool/builtin/invoke-agent.tool.js +82 -0
- package/esm/app/ai/tool/builtin/retrieve.tool.js +27 -0
- package/esm/app/ai/tool/executor.service.js +71 -0
- package/esm/app/ai/tool/tool-registry.service.js +23 -0
- package/esm/app/ai/tool/tool.interface.js +0 -0
- package/esm/app/ai/tool/tool.module.js +28 -0
- package/esm/app/ai/trace/trace.service.js +80 -0
- package/esm/app/csr/controller.js +187 -0
- package/esm/app/csr/types.js +0 -0
- package/esm/app/extends/$fetch.js +6 -6
- package/esm/app/extends/crypto.js +4 -3
- package/esm/app/extends/db.js +65 -65
- package/esm/app/extends/logger.js +73 -12
- package/esm/app/frontend-development.js +24 -0
- package/esm/app/html/browser-options.js +7 -0
- package/esm/app/html/shell.js +173 -32
- package/esm/app/http/api-signing.js +13 -0
- package/esm/app/http/body-parser.middleware.js +73 -0
- package/esm/app/http/compression.middleware.js +13 -0
- package/esm/app/http/context.js +21 -0
- package/esm/app/http/controller.js +9 -0
- package/esm/app/http/csp-nonce.js +13 -0
- package/esm/app/http/error-response.js +39 -0
- package/esm/app/http/errors.js +24 -0
- package/esm/app/http/exception-filter.js +52 -0
- package/esm/app/http/request-body-parser-policy.js +46 -0
- package/esm/app/http/request-data.js +17 -0
- package/esm/app/http/request-schema.pipe.js +40 -0
- package/esm/app/http/response.interceptor.js +26 -0
- package/esm/app/http/response.js +23 -0
- package/esm/app/http/security.guard.js +53 -0
- package/esm/app/project/controller.js +81 -0
- package/esm/app/project/service.js +35 -0
- package/esm/app/providers/csr.js +65 -0
- package/esm/app/providers/foundation.js +158 -0
- package/esm/app/ssr/artifacts.js +70 -0
- package/esm/app/ssr/controller.js +193 -0
- package/esm/app/ssr/html.js +67 -53
- package/esm/app/ssr/manifest.js +24 -10
- package/esm/app/ssr/session.js +91 -0
- package/esm/app/ssr/stream.js +51 -0
- package/esm/app/ssr/streaming-request-cache.js +30 -0
- package/esm/app/ssr/types.js +0 -0
- package/esm/app/static-assets.middleware.js +68 -0
- package/esm/app/template-core.module.js +97 -0
- package/esm/app/view/entry.tpl +2 -2
- package/esm/bundler/buildBE.js +1 -0
- package/esm/bundler/buildFE.js +11 -11
- package/esm/bundler/buildSSR.js +61 -63
- package/esm/bundler/dev-session.js +145 -0
- package/esm/bundler/dev.js +8 -9
- package/esm/bundler/entryCollect.js +9 -9
- package/esm/bundler/feSharedConfig.js +41 -11
- package/esm/bundler/index.js +2 -1
- package/esm/bundler/prod.js +7 -11
- package/esm/bundler/ssrClientManifest.js +5 -5
- package/esm/bundler/ssrEntries.js +5 -5
- package/esm/bundler/state.js +5 -7
- package/esm/bundler/utils.js +171 -161
- package/esm/config/config.default.js +4 -3
- package/esm/index.js +29 -12
- package/esm/package.json +1 -0
- package/esm/packages/common/index.js +5 -5
- package/esm/packages/core/bootstrap.js +82 -0
- package/esm/packages/core/config-service.js +46 -0
- package/esm/packages/core/duplicate-route-checking-adapter.js +106 -0
- package/esm/packages/core/index.js +7 -60
- package/esm/packages/core/legacy-factory-diagnostics.js +74 -0
- package/esm/packages/core/loader/model.js +6 -1
- package/esm/packages/core/paths.js +5 -11
- package/esm/packages/core/resource-lifecycle.js +83 -0
- package/esm/packages/core/startup.js +256 -0
- package/esm/packages/core/tokens.js +4 -0
- package/esm/packages/utils/runFileFn.js +19 -35
- package/esm/scripts/vite-build/build.js +29 -22
- package/fe/frontend/apps/dash/Dashboard.js +3 -3
- package/fe/frontend/apps/ui-components/UiComponentsPreview.d.ts +2 -0
- package/fe/frontend/apps/ui-components/UiComponentsPreview.js +182 -0
- package/fe/frontend/apps/ui-components/index.d.ts +1 -2
- package/fe/frontend/apps/ui-components/index.js +2 -8
- package/fe/frontend/apps/ui-components/ui-components.entry.js +3 -2
- package/fe/frontend/src/common/fetchErrorShow.js +1 -1
- package/fe/frontend/src/common/importComponent.js +1 -1
- package/fe/frontend/src/common/language.d.ts +1 -1
- package/fe/frontend/src/common/language.js +2 -2
- package/fe/frontend/src/common/request.d.ts +2 -0
- package/fe/frontend/src/common/request.js +19 -5
- package/fe/frontend/src/common/schemaForm.js +2 -2
- package/fe/frontend/src/components/AsyncSelect/AsyncSelect.d.ts +1 -1
- package/fe/frontend/src/components/AsyncSelect/AsyncSelect.js +3 -3
- package/fe/frontend/src/components/BasePage/HeaderView.js +1 -2
- package/fe/frontend/src/components/LanguageSwitch/LanguageSwitch.d.ts +1 -1
- package/fe/frontend/src/components/LanguageSwitch/LanguageSwitch.js +7 -7
- package/fe/frontend/src/components/ThemeSwitch/ThemeSwitch.js +14 -8
- package/fe/frontend/src/defaultPages/SchemaPage/components/CallCom/DetailPanel.js +3 -3
- package/fe/frontend/src/defaultPages/SchemaPage/components/CallCom/PopFrom.js +4 -4
- package/fe/frontend/src/defaultPages/SchemaPage/components/SchemaSearch/index.js +2 -2
- package/fe/frontend/src/defaultPages/SchemaPage/components/SchemaTable/PreviewImage.d.ts +1 -1
- package/fe/frontend/src/defaultPages/SchemaPage/components/SchemaTable/PreviewImage.js +1 -1
- package/fe/frontend/src/defaultPages/SchemaPage/components/SchemaTable/index.js +7 -7
- package/fe/frontend/src/defaultPages/SchemaPage/index.js +2 -2
- package/fe/frontend/src/defaultPages/SidebarSlotPage/SidebarSlotContainer.js +2 -2
- package/fe/frontend/src/hooks/useRouterParams.d.ts +4 -2
- package/fe/frontend/src/hooks/useText.d.ts +1 -1
- package/fe/frontend/src/hooks/useText.js +2 -2
- package/fe/frontend/src/index.d.ts +4 -4
- package/fe/frontend/src/index.js +4 -4
- package/fe/frontend/src/language/resources.d.ts +1 -1
- package/fe/frontend/src/main.css +1 -1
- package/fe/frontend/src/stores/apiFreezer.d.ts +1 -1
- package/fe/frontend/src/stores/apiFreezer.js +2 -2
- package/fe/frontend/src/stores/mode.js +1 -2
- package/fe/frontend/src/stores/schemaStore.d.ts +2 -2
- package/fe/frontend/src/stores/schemaStore.js +1 -2
- package/fe/frontend/src/typing/scalability.d.ts +2 -2
- package/fe/models/types/data/button.d.ts +1 -1
- package/fe/models/types/data/component.d.ts +1 -1
- package/fe/models/types/data/schema.d.ts +1 -1
- package/fe/models/types/data/search.d.ts +1 -1
- package/fe/packages/common/index.js +4 -4
- package/fe/packages/common/ssr/hydration.d.ts +9 -0
- package/fe/packages/react/core/Button/Button.js +88 -0
- package/fe/packages/react/core/Button/SubmitButton.d.ts +8 -0
- package/fe/packages/react/core/Button/SubmitButton.js +31 -0
- package/fe/packages/react/core/Button/index.js +3 -0
- package/fe/packages/react/core/Card/Card.js +31 -0
- package/fe/packages/react/core/Card/index.js +2 -0
- package/fe/packages/react/core/Checkbox/Checkbox.js +52 -0
- package/fe/packages/react/core/Checkbox/index.js +2 -0
- package/fe/packages/react/core/Label/Label.d.ts +22 -0
- package/fe/packages/react/core/Label/Label.js +60 -0
- package/fe/packages/react/core/Label/index.js +2 -0
- package/fe/packages/react/core/Layout/Layout.js +33 -0
- package/fe/packages/react/core/Layout/index.js +2 -0
- package/fe/packages/react/core/Loading/Loading.js +48 -0
- package/fe/packages/react/core/Loading/index.js +2 -0
- package/fe/packages/react/core/Skeleton/Skeleton.js +101 -0
- package/fe/packages/react/core/Skeleton/index.js +2 -0
- package/fe/packages/react/core/breadcrumb/breadcrumb.js +155 -0
- package/fe/packages/react/core/breadcrumb/index.js +2 -0
- package/fe/packages/react/core/hooks/index.d.ts +12 -0
- package/fe/packages/react/core/hooks/index.js +13 -0
- package/fe/packages/react/core/hooks/useBreadcrumb.d.ts +9 -0
- package/fe/packages/react/core/hooks/useBreadcrumb.js +5 -0
- package/fe/packages/react/core/hooks/useDropdownPositioning.js +122 -0
- package/fe/packages/react/core/hooks/useExecuteOnce.js +47 -0
- package/fe/packages/react/core/hooks/useHydrationData.d.ts +2 -0
- package/fe/packages/react/core/hooks/useHydrationData.js +23 -0
- package/fe/packages/react/core/hooks/useInit.js +11 -0
- package/fe/packages/react/core/hooks/useInputController.js +39 -0
- package/fe/packages/react/core/hooks/useLanguage.d.ts +1 -0
- package/fe/packages/react/core/hooks/useLanguage.js +8 -0
- package/fe/packages/react/core/hooks/usePagination.js +30 -0
- package/fe/packages/react/core/hooks/useRefState.js +45 -0
- package/fe/packages/react/core/hooks/useSSR.js +46 -0
- package/fe/packages/react/core/hooks/useTableState.d.ts +22 -0
- package/fe/packages/react/core/hooks/useTableState.js +22 -0
- package/fe/packages/react/core/hooks/useWatch.js +60 -0
- package/fe/packages/react/core/index.d.ts +12 -0
- package/fe/packages/react/core/index.js +37 -0
- package/fe/packages/react/core/internal/hydration.d.ts +12 -0
- package/fe/packages/react/core/internal/hydration.js +17 -0
- package/fe/packages/react/core/internal/i18n/default.d.ts +99 -0
- package/fe/packages/react/core/internal/i18n/default.js +111 -0
- package/fe/packages/react/core/internal/i18n/en-US.d.ts +99 -0
- package/fe/packages/react/core/internal/i18n/en-US.js +111 -0
- package/fe/packages/react/core/internal/i18n/index.d.ts +18 -0
- package/fe/packages/react/core/internal/i18n/index.js +179 -0
- package/fe/packages/react/core/internal/i18n/locales.d.ts +7 -0
- package/fe/packages/react/core/internal/i18n/locales.js +18 -0
- package/fe/packages/react/core/internal/i18n/types.d.ts +47 -0
- package/fe/packages/react/core/internal/i18n/types.js +0 -0
- package/fe/packages/react/core/internal/raf-timeout.d.ts +2 -0
- package/fe/packages/react/core/internal/raf-timeout.js +54 -0
- package/fe/packages/react/core/internal/react19-compat.d.ts +15 -0
- package/fe/packages/react/core/internal/react19-compat.js +0 -0
- package/fe/packages/react/core/lib/createStoreHook.js +9 -0
- package/fe/packages/react/core/lib/dataTableWidth.js +33 -0
- package/fe/packages/react/core/lib/export.d.ts +21 -0
- package/fe/packages/react/core/lib/export.js +112 -0
- package/fe/packages/react/core/lib/index.d.ts +4 -0
- package/fe/packages/react/core/lib/index.js +5 -0
- package/fe/packages/react/core/lib/utils.d.ts +10 -0
- package/fe/packages/react/core/lib/utils.js +64 -0
- package/fe/packages/react/core/stores/breadcrumb.d.ts +14 -0
- package/fe/packages/react/core/stores/breadcrumb.js +52 -0
- package/fe/packages/react/core/stores/index.d.ts +2 -0
- package/fe/packages/react/core/stores/index.js +5 -0
- package/fe/packages/react/core/stores/language.d.ts +3 -0
- package/fe/packages/react/core/stores/language.js +3 -0
- package/fe/packages/react/core/types/baseType.js +0 -0
- package/fe/packages/react/core/types/index.js +0 -0
- package/fe/packages/react/dev/preview/DemoSection.d.ts +12 -0
- package/fe/packages/react/dev/preview/demoRegistry.d.ts +8 -0
- package/fe/packages/react/dev/preview/demos/core/ButtonDemo.d.ts +3 -0
- package/fe/packages/react/dev/preview/demos/forms/InputDemo.d.ts +3 -0
- package/fe/packages/react/dev/preview/demos/overlays/ModalDemo.d.ts +3 -0
- package/fe/packages/react/dev/preview/index.d.ts +2 -0
- package/fe/packages/react/forms/DataTable/ActionBtn.d.ts +7 -0
- package/fe/packages/react/forms/DataTable/ActionBtn.js +116 -0
- package/fe/packages/react/forms/DataTable/index.d.ts +34 -0
- package/fe/packages/react/forms/DataTable/index.js +230 -0
- package/fe/packages/react/forms/Date/Calendar.js +351 -0
- package/fe/packages/react/forms/Date/Date.js +210 -0
- package/fe/packages/react/forms/Date/LocaleContext.js +27 -0
- package/fe/packages/react/forms/Date/LocaleProvider.js +22 -0
- package/fe/packages/react/forms/Date/TimePicker.js +136 -0
- package/fe/packages/react/forms/Date/data.js +7 -0
- package/fe/packages/react/forms/Date/dateLocaleStore.js +14 -0
- package/fe/packages/react/forms/Date/dropdownPositioning.d.ts +2 -0
- package/fe/packages/react/forms/Date/dropdownPositioning.js +12 -0
- package/fe/packages/react/forms/Date/index.js +6 -0
- package/fe/packages/react/forms/Date/locales.d.ts +30 -0
- package/fe/packages/react/forms/Date/locales.js +58 -0
- package/fe/packages/react/forms/Form/Form.js +15 -0
- package/fe/packages/react/forms/Form/FormItem.d.ts +19 -0
- package/fe/packages/react/forms/Form/FormItem.js +87 -0
- package/fe/packages/react/forms/Form/SchemaForm/data.d.ts +40 -0
- package/fe/packages/react/forms/Form/SchemaForm/data.js +15 -0
- package/fe/packages/react/forms/Form/SchemaForm/defaultComponentsMap.js +4 -0
- package/fe/packages/react/forms/Form/SchemaForm/index.d.ts +60 -0
- package/fe/packages/react/forms/Form/SchemaForm/index.js +119 -0
- package/fe/packages/react/forms/Form/index.d.ts +5 -0
- package/fe/packages/react/forms/Form/index.js +6 -0
- package/fe/packages/react/forms/Input/Input.js +146 -0
- package/fe/packages/react/forms/Input/index.js +2 -0
- package/fe/packages/react/forms/InputNumber/InputNumber.d.ts +25 -0
- package/fe/packages/react/forms/InputNumber/InputNumber.js +207 -0
- package/fe/packages/react/forms/InputNumber/index.js +2 -0
- package/fe/packages/react/forms/InputNumber/inputNumberUtils.js +45 -0
- package/fe/packages/react/forms/MultiSelect/MultiSelect.d.ts +26 -0
- package/fe/packages/react/forms/MultiSelect/MultiSelect.js +218 -0
- package/fe/packages/react/forms/MultiSelect/index.d.ts +1 -0
- package/fe/packages/react/forms/MultiSelect/index.js +2 -0
- package/fe/packages/react/forms/Pagination/Pagination.d.ts +15 -0
- package/fe/packages/react/forms/Pagination/Pagination.js +124 -0
- package/fe/packages/react/forms/Pagination/index.js +2 -0
- package/fe/packages/react/forms/Radio/Radio.js +36 -0
- package/fe/packages/react/forms/Radio/RadioGroup.js +33 -0
- package/fe/packages/react/forms/Radio/index.js +3 -0
- package/fe/packages/react/forms/Search/Search.d.ts +13 -0
- package/fe/packages/react/forms/Search/Search.js +24 -0
- package/fe/packages/react/forms/Search/index.js +2 -0
- package/fe/packages/react/forms/Select/Select.d.ts +32 -0
- package/fe/packages/react/forms/Select/Select.js +295 -0
- package/fe/packages/react/forms/Select/dropdownPositioning.d.ts +2 -0
- package/fe/packages/react/forms/Select/dropdownPositioning.js +16 -0
- package/fe/packages/react/forms/Select/index.js +2 -0
- package/fe/packages/react/forms/Switch/Switch.js +28 -0
- package/fe/packages/react/forms/Switch/index.js +2 -0
- package/fe/packages/react/forms/TableSearch/TableSearch.d.ts +30 -0
- package/fe/packages/react/forms/TableSearch/TableSearch.js +154 -0
- package/fe/packages/react/forms/TableSearch/index.js +2 -0
- package/fe/packages/react/forms/TableSearch/lang.d.ts +16 -0
- package/fe/packages/react/forms/TableSearch/lang.js +25 -0
- package/fe/packages/react/forms/TableSearch/tableSearchLocaleStore.js +10 -0
- package/fe/packages/react/forms/Textarea/Textarea.js +58 -0
- package/fe/packages/react/forms/Textarea/index.js +2 -0
- package/fe/packages/react/forms/TreeSelect/TreeSelect.js +190 -0
- package/fe/packages/react/forms/TreeSelect/index.js +2 -0
- package/fe/packages/react/forms/Upload/ImageUpload.js +101 -0
- package/fe/packages/react/forms/Upload/Upload.js +29 -0
- package/fe/packages/react/forms/Upload/index.js +3 -0
- package/fe/packages/react/forms/index.d.ts +16 -0
- package/fe/packages/react/forms/index.js +43 -0
- package/fe/packages/react/forms/table/index.js +2 -0
- package/fe/packages/react/forms/table/table.js +166 -0
- package/fe/packages/react/i18n/I18nContext.d.ts +6 -0
- package/fe/packages/react/i18n/I18nContext.js +5 -0
- package/fe/packages/react/i18n/I18nProvider.d.ts +6 -0
- package/fe/packages/react/i18n/I18nProvider.js +19 -0
- package/fe/packages/react/i18n/getUiReactLocale.d.ts +202 -0
- package/fe/packages/react/i18n/getUiReactLocale.js +13 -0
- package/fe/packages/react/i18n/index.d.ts +5 -0
- package/fe/packages/react/i18n/index.js +7 -0
- package/fe/packages/react/i18n/legacy.d.ts +9 -0
- package/fe/packages/react/i18n/legacy.js +12 -0
- package/fe/packages/react/i18n/locales/en-US.d.ts +1 -0
- package/fe/packages/react/i18n/locales/en-US.js +2 -0
- package/fe/packages/react/i18n/locales/zh-CN.d.ts +1 -0
- package/fe/packages/react/i18n/locales/zh-CN.js +2 -0
- package/fe/packages/react/i18n/useI18n.d.ts +2 -0
- package/fe/packages/react/i18n/useI18n.js +15 -0
- package/fe/packages/react/i18n/useI18nState.d.ts +3 -0
- package/fe/packages/react/i18n/useI18nState.js +24 -0
- package/fe/packages/react/index.d.ts +6 -0
- package/fe/packages/react/index.js +81 -0
- package/fe/packages/react/overlays/Dialog/ConfirmDialog.js +41 -0
- package/fe/packages/react/overlays/Dialog/index.js +2 -0
- package/fe/packages/react/overlays/Drawer/Drawer.d.ts +23 -0
- package/fe/packages/react/overlays/Drawer/Drawer.js +165 -0
- package/fe/packages/react/overlays/Drawer/index.js +2 -0
- package/fe/packages/react/overlays/Dropdown/Dropdown.d.ts +34 -0
- package/fe/packages/react/overlays/Dropdown/Dropdown.js +118 -0
- package/fe/packages/react/overlays/Dropdown/index.js +2 -0
- package/fe/packages/react/overlays/DropdownMenu/Menu.js +147 -0
- package/fe/packages/react/overlays/DropdownMenu/MenuContext.js +88 -0
- package/fe/packages/react/overlays/DropdownMenu/MenuItem.js +78 -0
- package/fe/packages/react/overlays/DropdownMenu/SubMenu.js +207 -0
- package/fe/packages/react/overlays/DropdownMenu/index.js +5 -0
- package/fe/packages/react/overlays/DropdownMenu/menuTypes.js +0 -0
- package/fe/packages/react/overlays/DropdownMenu/utils.js +8 -0
- package/fe/packages/react/overlays/Message/Message.js +76 -0
- package/fe/packages/react/overlays/Message/MessageManager.js +104 -0
- package/fe/packages/react/overlays/Message/data.js +4 -0
- package/fe/packages/react/overlays/Message/index.js +2 -0
- package/fe/packages/react/overlays/Modal/Modal.d.ts +28 -0
- package/fe/packages/react/overlays/Modal/Modal.js +83 -0
- package/fe/packages/react/overlays/Modal/ModalManager.d.ts +47 -0
- package/fe/packages/react/overlays/Modal/ModalManager.js +116 -0
- package/fe/packages/react/overlays/Modal/index.d.ts +4 -0
- package/fe/packages/react/overlays/Modal/index.js +3 -0
- package/fe/packages/react/overlays/Overlay/Overlay.d.ts +23 -0
- package/fe/packages/react/overlays/Overlay/Overlay.js +78 -0
- package/fe/packages/react/overlays/Overlay/focusTypes.d.ts +8 -0
- package/fe/packages/react/overlays/Overlay/focusTypes.js +0 -0
- package/fe/packages/react/overlays/Overlay/index.d.ts +3 -0
- package/fe/packages/react/overlays/Overlay/index.js +2 -0
- package/fe/packages/react/overlays/Overlay/overlayStack.d.ts +16 -0
- package/fe/packages/react/overlays/Overlay/overlayStack.js +290 -0
- package/fe/packages/react/overlays/Popover/Notification.js +56 -0
- package/fe/packages/react/overlays/Popover/index.js +2 -0
- package/fe/packages/react/overlays/Popup/Popup.d.ts +26 -0
- package/fe/packages/react/overlays/Popup/Popup.js +108 -0
- package/fe/packages/react/overlays/Popup/index.js +2 -0
- package/fe/packages/react/overlays/Tooltip/Tooltip.js +88 -0
- package/fe/packages/react/overlays/Tooltip/index.js +2 -0
- package/fe/packages/react/overlays/index.d.ts +10 -0
- package/fe/packages/react/overlays/index.js +25 -0
- package/fe/packages/react/styles.css +299 -0
- package/fe/packages/react/ui/components/Button/index.d.ts +1 -3
- package/fe/packages/react/ui/components/Button/index.js +3 -2
- package/fe/packages/react/ui/components/Card/index.d.ts +1 -1
- package/fe/packages/react/ui/components/Card/index.js +2 -1
- package/fe/packages/react/ui/components/Checkbox/index.d.ts +1 -1
- package/fe/packages/react/ui/components/Checkbox/index.js +2 -1
- package/fe/packages/react/ui/components/ConfirmDialog/index.d.ts +1 -1
- package/fe/packages/react/ui/components/ConfirmDialog/index.js +2 -1
- package/fe/packages/react/ui/components/DataTable/index.d.ts +1 -32
- package/fe/packages/react/ui/components/DataTable/index.js +2 -215
- package/fe/packages/react/ui/components/Date/index.d.ts +1 -5
- package/fe/packages/react/ui/components/Date/index.js +6 -5
- package/fe/packages/react/ui/components/Drawer/index.d.ts +1 -2
- package/fe/packages/react/ui/components/Drawer/index.js +2 -1
- package/fe/packages/react/ui/components/Dropdown/index.d.ts +1 -1
- package/fe/packages/react/ui/components/Dropdown/index.js +2 -1
- package/fe/packages/react/ui/components/Form/index.d.ts +1 -4
- package/fe/packages/react/ui/components/Form/index.js +6 -5
- package/fe/packages/react/ui/components/ImagePreview/ImagePreview.js +9 -5
- package/fe/packages/react/ui/components/ImagePreview/PreviewImage.d.ts +1 -1
- package/fe/packages/react/ui/components/ImagePreview/PreviewImage.js +4 -4
- package/fe/packages/react/ui/components/Input/index.d.ts +1 -1
- package/fe/packages/react/ui/components/Input/index.js +2 -1
- package/fe/packages/react/ui/components/InputNumber/index.d.ts +1 -1
- package/fe/packages/react/ui/components/InputNumber/index.js +2 -1
- package/fe/packages/react/ui/components/Label/index.d.ts +1 -2
- package/fe/packages/react/ui/components/Label/index.js +3 -2
- package/fe/packages/react/ui/components/Layout/index.d.ts +1 -1
- package/fe/packages/react/ui/components/Layout/index.js +2 -1
- package/fe/packages/react/ui/components/Loading/index.d.ts +1 -1
- package/fe/packages/react/ui/components/Loading/index.js +2 -1
- package/fe/packages/react/ui/components/Menu/index.d.ts +1 -8
- package/fe/packages/react/ui/components/Menu/index.js +5 -4
- package/fe/packages/react/ui/components/Message/index.d.ts +1 -2
- package/fe/packages/react/ui/components/Message/index.js +2 -1
- package/fe/packages/react/ui/components/Modal/index.d.ts +1 -3
- package/fe/packages/react/ui/components/Modal/index.js +3 -2
- package/fe/packages/react/ui/components/Notification/index.d.ts +1 -1
- package/fe/packages/react/ui/components/Notification/index.js +2 -1
- package/fe/packages/react/ui/components/Overlay/Overlay.js +1 -1
- package/fe/packages/react/ui/components/Overlay/index.d.ts +1 -2
- package/fe/packages/react/ui/components/Overlay/index.js +2 -1
- package/fe/packages/react/ui/components/Pagination/index.d.ts +1 -1
- package/fe/packages/react/ui/components/Pagination/index.js +2 -1
- package/fe/packages/react/ui/components/Popup/index.d.ts +1 -1
- package/fe/packages/react/ui/components/Popup/index.js +2 -1
- package/fe/packages/react/ui/components/Radio/index.d.ts +1 -2
- package/fe/packages/react/ui/components/Radio/index.js +3 -2
- package/fe/packages/react/ui/components/Search/index.d.ts +1 -1
- package/fe/packages/react/ui/components/Search/index.js +2 -1
- package/fe/packages/react/ui/components/Select/index.d.ts +1 -1
- package/fe/packages/react/ui/components/Select/index.js +2 -1
- package/fe/packages/react/ui/components/Skeleton/index.d.ts +1 -2
- package/fe/packages/react/ui/components/Skeleton/index.js +2 -1
- package/fe/packages/react/ui/components/Switch/index.d.ts +1 -1
- package/fe/packages/react/ui/components/Switch/index.js +2 -1
- package/fe/packages/react/ui/components/TableSearch/index.d.ts +1 -2
- package/fe/packages/react/ui/components/TableSearch/index.js +2 -1
- package/fe/packages/react/ui/components/Tabs/Tabs.js +1 -1
- package/fe/packages/react/ui/components/Textarea/index.d.ts +1 -1
- package/fe/packages/react/ui/components/Textarea/index.js +2 -1
- package/fe/packages/react/ui/components/Tooltip/index.d.ts +1 -1
- package/fe/packages/react/ui/components/Tooltip/index.js +2 -1
- package/fe/packages/react/ui/components/TreeSelect/index.d.ts +1 -1
- package/fe/packages/react/ui/components/TreeSelect/index.js +2 -1
- package/fe/packages/react/ui/components/Upload/index.d.ts +1 -2
- package/fe/packages/react/ui/components/Upload/index.js +3 -2
- package/fe/packages/react/ui/components/breadcrumb/index.d.ts +1 -1
- package/fe/packages/react/ui/components/breadcrumb/index.js +2 -1
- package/fe/packages/react/ui/components/index.d.ts +3 -33
- package/fe/packages/react/ui/components/index.js +70 -77
- package/fe/packages/react/ui/components/table/index.d.ts +1 -1
- package/fe/packages/react/ui/components/table/index.js +2 -1
- package/fe/packages/react/ui/i18n/I18nProvider.d.ts +1 -1
- package/fe/packages/react/ui/i18n/I18nProvider.js +2 -1
- package/fe/packages/react/ui/i18n/index.d.ts +1 -3
- package/fe/packages/react/ui/i18n/index.js +8 -7
- package/fe/packages/react/ui/i18n/useI18n.d.ts +6 -6
- package/fe/packages/react/ui/i18n/useI18n.js +2 -2
- package/fe/packages/react/ui/index.css +2 -299
- package/fe/packages/react/ui/index.d.ts +0 -2
- package/fe/packages/react/ui/index.js +73 -55
- package/fe/ssr/apps/dash/dash.entry.js +7 -3
- package/fe/ssr/apps/ui-components/ui-components.entry.js +3 -2
- package/fe/ssr/components/StreamingRender/StreamingCache.d.ts +1 -0
- package/fe/ssr/components/StreamingRender/StreamingCache.js +11 -1
- package/fe/ssr/components/StreamingRender/StreamingRender.d.ts +1 -1
- package/fe/ssr/components/StreamingRender/StreamingRender.js +29 -23
- package/fe/ssr/components/StreamingRender/StreamingScript.d.ts +3 -0
- package/fe/ssr/components/StreamingRender/StreamingScript.js +47 -1
- package/fe/ssr/createSSREntry.d.ts +9 -3
- package/fe/ssr/createSSREntry.js +43 -19
- package/fe/ssr/index.d.ts +4 -1
- package/fe/ssr/index.js +2 -1
- package/fe/ssr/router.d.ts +76 -0
- package/fe/ssr/router.js +349 -0
- package/fe/ssr/types.d.ts +1 -13
- package/models/frontend/src/common/language.d.ts +1 -1
- package/models/frontend/src/common/request.d.ts +2 -0
- package/models/frontend/src/components/AsyncSelect/AsyncSelect.d.ts +1 -1
- package/models/frontend/src/hooks/useText.d.ts +1 -1
- package/models/frontend/src/language/resources.d.ts +1 -1
- package/models/frontend/src/stores/apiFreezer.d.ts +1 -1
- package/models/frontend/src/stores/schemaStore.d.ts +2 -2
- package/models/frontend/src/typing/scalability.d.ts +2 -2
- package/models/models/types/data/button.d.ts +1 -1
- package/models/models/types/data/component.d.ts +1 -1
- package/models/models/types/data/schema.d.ts +1 -1
- package/models/models/types/data/search.d.ts +1 -1
- package/models/packages/common/ssr/hydration.d.ts +9 -0
- package/models/packages/react/core/Button/SubmitButton.d.ts +8 -0
- package/models/packages/react/core/Button/index.d.ts +3 -0
- package/models/packages/react/core/Card/index.d.ts +1 -0
- package/models/packages/react/core/Checkbox/index.d.ts +1 -0
- package/models/packages/react/core/Label/Label.d.ts +22 -0
- package/models/packages/react/core/Label/index.d.ts +2 -0
- package/models/packages/react/core/Layout/index.d.ts +1 -0
- package/models/packages/react/core/Loading/index.d.ts +1 -0
- package/models/packages/react/core/Skeleton/index.d.ts +2 -0
- package/models/packages/react/core/breadcrumb/index.d.ts +1 -0
- package/models/packages/react/core/hooks/index.d.ts +12 -0
- package/models/packages/react/core/hooks/useBreadcrumb.d.ts +9 -0
- package/models/packages/react/core/hooks/useHydrationData.d.ts +2 -0
- package/models/packages/react/core/hooks/useInit.d.ts +2 -0
- package/models/packages/react/core/hooks/useLanguage.d.ts +1 -0
- package/models/packages/react/core/hooks/usePagination.d.ts +15 -0
- package/models/packages/react/core/hooks/useRefState.d.ts +9 -0
- package/models/packages/react/core/hooks/useSSR.d.ts +6 -0
- package/models/packages/react/core/hooks/useTableState.d.ts +22 -0
- package/models/packages/react/core/hooks/useWatch.d.ts +14 -0
- package/models/packages/react/core/index.d.ts +12 -0
- package/models/packages/react/core/internal/hydration.d.ts +12 -0
- package/models/packages/react/core/internal/i18n/default.d.ts +99 -0
- package/models/packages/react/core/internal/i18n/en-US.d.ts +99 -0
- package/models/packages/react/core/internal/i18n/index.d.ts +18 -0
- package/models/packages/react/core/internal/i18n/locales.d.ts +7 -0
- package/models/packages/react/core/internal/i18n/types.d.ts +47 -0
- package/models/packages/react/core/internal/raf-timeout.d.ts +2 -0
- package/models/packages/react/core/internal/react19-compat.d.ts +15 -0
- package/models/packages/react/core/lib/export.d.ts +21 -0
- package/models/packages/react/core/lib/index.d.ts +4 -0
- package/models/packages/react/core/lib/utils.d.ts +10 -0
- package/models/packages/react/core/stores/breadcrumb.d.ts +14 -0
- package/models/packages/react/core/stores/index.d.ts +2 -0
- package/models/packages/react/core/stores/language.d.ts +3 -0
- package/models/packages/react/core/types/baseType.d.ts +21 -0
- package/models/packages/react/forms/DataTable/ActionBtn.d.ts +7 -0
- package/models/packages/react/forms/DataTable/index.d.ts +34 -0
- package/models/packages/react/forms/Date/dropdownPositioning.d.ts +2 -0
- package/models/packages/react/forms/Date/index.d.ts +5 -0
- package/models/packages/react/forms/Date/locales.d.ts +30 -0
- package/models/packages/react/forms/Form/FormItem.d.ts +19 -0
- package/models/packages/react/forms/Form/SchemaForm/data.d.ts +40 -0
- package/models/packages/react/forms/Form/SchemaForm/index.d.ts +60 -0
- package/models/packages/react/forms/Form/index.d.ts +5 -0
- package/models/packages/react/forms/Input/index.d.ts +1 -0
- package/models/packages/react/forms/InputNumber/InputNumber.d.ts +25 -0
- package/models/packages/react/forms/InputNumber/index.d.ts +1 -0
- package/models/packages/react/forms/MultiSelect/MultiSelect.d.ts +26 -0
- package/models/packages/react/forms/MultiSelect/index.d.ts +1 -0
- package/models/packages/react/forms/Pagination/Pagination.d.ts +15 -0
- package/models/packages/react/forms/Pagination/index.d.ts +1 -0
- package/models/packages/react/forms/Radio/index.d.ts +2 -0
- package/models/packages/react/forms/Search/Search.d.ts +13 -0
- package/models/packages/react/forms/Search/index.d.ts +1 -0
- package/models/packages/react/forms/Select/Select.d.ts +32 -0
- package/models/packages/react/forms/Select/dropdownPositioning.d.ts +2 -0
- package/models/packages/react/forms/Select/index.d.ts +1 -0
- package/models/packages/react/forms/Switch/index.d.ts +1 -0
- package/models/packages/react/forms/TableSearch/TableSearch.d.ts +30 -0
- package/models/packages/react/forms/TableSearch/index.d.ts +2 -0
- package/models/packages/react/forms/TableSearch/lang.d.ts +16 -0
- package/models/packages/react/forms/Textarea/index.d.ts +1 -0
- package/models/packages/react/forms/TreeSelect/index.d.ts +1 -0
- package/models/packages/react/forms/Upload/index.d.ts +2 -0
- package/models/packages/react/forms/index.d.ts +16 -0
- package/models/packages/react/forms/table/index.d.ts +1 -0
- package/models/packages/react/i18n/I18nContext.d.ts +6 -0
- package/models/packages/react/i18n/I18nProvider.d.ts +6 -0
- package/models/packages/react/i18n/getUiReactLocale.d.ts +202 -0
- package/models/packages/react/i18n/index.d.ts +5 -0
- package/models/packages/react/i18n/legacy.d.ts +9 -0
- package/models/packages/react/i18n/locales/en-US.d.ts +1 -0
- package/models/packages/react/i18n/locales/zh-CN.d.ts +1 -0
- package/models/packages/react/i18n/useI18n.d.ts +2 -0
- package/models/packages/react/i18n/useI18nState.d.ts +3 -0
- package/models/packages/react/index.d.ts +6 -0
- package/models/packages/react/overlays/Dialog/index.d.ts +1 -0
- package/models/packages/react/overlays/Drawer/Drawer.d.ts +23 -0
- package/models/packages/react/overlays/Drawer/index.d.ts +2 -0
- package/models/packages/react/overlays/Dropdown/Dropdown.d.ts +34 -0
- package/models/packages/react/overlays/Dropdown/index.d.ts +1 -0
- package/models/packages/react/overlays/DropdownMenu/index.d.ts +8 -0
- package/models/packages/react/overlays/Message/index.d.ts +2 -0
- package/models/packages/react/overlays/Modal/Modal.d.ts +28 -0
- package/models/packages/react/overlays/Modal/ModalManager.d.ts +47 -0
- package/models/packages/react/overlays/Modal/index.d.ts +4 -0
- package/models/packages/react/overlays/Overlay/Overlay.d.ts +23 -0
- package/models/packages/react/overlays/Overlay/focusTypes.d.ts +8 -0
- package/models/packages/react/overlays/Overlay/index.d.ts +3 -0
- package/models/packages/react/overlays/Overlay/overlayStack.d.ts +16 -0
- package/models/packages/react/overlays/Popover/index.d.ts +1 -0
- package/models/packages/react/overlays/Popup/Popup.d.ts +26 -0
- package/models/packages/react/overlays/Popup/index.d.ts +1 -0
- package/models/packages/react/overlays/Tooltip/index.d.ts +1 -0
- package/models/packages/react/overlays/index.d.ts +10 -0
- package/models/packages/react/ui/components/ImagePreview/PreviewImage.d.ts +1 -1
- package/models/packages/react/ui/components/index.d.ts +3 -33
- package/models/packages/react/ui/i18n/useI18n.d.ts +6 -6
- package/package.json +129 -22
- package/ssr/STREAMING_BOOTSTRAP.md +360 -0
- package/types/app/ai/agent/agent-run.dto.d.ts +7 -0
- package/types/app/ai/agent/agent-scanner.service.d.ts +16 -0
- package/types/app/ai/agent/agent.interface.d.ts +13 -0
- package/types/app/ai/agent/agent.module.d.ts +2 -0
- package/types/app/ai/ai-config.module.d.ts +4 -0
- package/types/app/ai/ai-config.service.d.ts +14 -0
- package/types/app/ai/ai.controller.d.ts +3 -0
- package/types/app/ai/ai.module.d.ts +4 -0
- package/types/app/ai/contracts/index.d.ts +129 -0
- package/types/app/ai/declaration-paths.d.ts +3 -0
- package/types/app/ai/eval/assertions.d.ts +26 -0
- package/types/app/ai/guardrail/guardrail.interface.d.ts +10 -0
- package/types/app/ai/guardrail/guardrail.module.d.ts +2 -0
- package/types/app/ai/guardrail/guardrail.service.d.ts +11 -0
- package/types/app/ai/guardrail/internal/load-guardrail-config.d.ts +4 -0
- package/types/app/ai/index.d.ts +9 -0
- package/types/app/ai/mcp/internal/load-mcp-config.d.ts +7 -0
- package/types/app/ai/mcp/internal/read-sse-response.d.ts +2 -0
- package/types/app/ai/mcp/internal/stdio-process.d.ts +5 -0
- package/types/app/ai/mcp/mcp-registry.service.d.ts +13 -0
- package/types/app/ai/mcp/mcp.client.d.ts +44 -0
- package/types/app/ai/mcp/mcp.loader.d.ts +26 -0
- package/types/app/ai/mcp/mcp.module.d.ts +14 -0
- package/types/app/ai/mcp/mcp.types.d.ts +51 -0
- package/types/app/ai/memory/checkpoint.service.d.ts +15 -0
- package/types/app/ai/memory/internal/load-memory-config.d.ts +9 -0
- package/types/app/ai/memory/memory.module.d.ts +2 -0
- package/types/app/ai/memory/thread.service.d.ts +34 -0
- package/types/app/ai/models/chat-sse.d.ts +5 -0
- package/types/app/ai/models/chat.d.ts +22 -0
- package/types/app/ai/models/http.d.ts +20 -0
- package/types/app/ai/models/image.d.ts +69 -0
- package/types/app/ai/models/video.d.ts +99 -0
- package/types/app/ai/nest-service-provider.d.ts +6 -0
- package/types/app/ai/rag/chunker.d.ts +14 -0
- package/types/app/ai/rag/internal/load-embedding-config.d.ts +11 -0
- package/types/app/ai/rag/internal/load-rag-config.d.ts +16 -0
- package/types/app/ai/rag/rag.interface.d.ts +57 -0
- package/types/app/ai/rag/rag.module.d.ts +2 -0
- package/types/app/ai/rag/retriever.service.d.ts +18 -0
- package/types/app/ai/retention/conversation-retention.service.d.ts +19 -0
- package/types/app/ai/retention/retention-policy.d.ts +5 -0
- package/types/app/ai/runtime/ai-runtime-startup.validator.d.ts +10 -0
- package/types/app/ai/runtime/ai-runtime.d.ts +46 -0
- package/types/app/ai/runtime/internal/agent-run-context.d.ts +16 -0
- package/types/app/ai/runtime/internal/compact-tool-result.d.ts +21 -0
- package/types/app/ai/runtime/internal/context-compaction.service.d.ts +33 -0
- package/types/app/ai/runtime/internal/declaration-snapshot.d.ts +8 -0
- package/types/app/ai/runtime/internal/load-llm-config.d.ts +26 -0
- package/types/app/ai/runtime/internal/load-runtime-config.d.ts +13 -0
- package/types/app/ai/runtime/internal/owned-runtime-resources.d.ts +5 -0
- package/types/app/ai/runtime/internal/request-budget.d.ts +44 -0
- package/types/app/ai/runtime/internal/run-event-queue.d.ts +11 -0
- package/types/app/ai/runtime/langchain/langchain-planner.service.d.ts +49 -0
- package/types/app/ai/runtime/langchain/skill-tool.adapter.d.ts +9 -0
- package/types/app/ai/runtime/langgraph/agent.graph.d.ts +130 -0
- package/types/app/ai/runtime/langgraph/agent.state.d.ts +43 -0
- package/types/app/ai/runtime/langgraph/langgraph-orchestrator.service.d.ts +104 -0
- package/types/app/ai/runtime/runtime.module.d.ts +7 -0
- package/types/app/ai/runtime/thread-execution-coordinator.d.ts +21 -0
- package/types/app/ai/skill/skill-scanner.service.d.ts +16 -0
- package/types/app/ai/skill/skill.interface.d.ts +9 -0
- package/types/app/ai/skill/skill.module.d.ts +2 -0
- package/types/app/ai/snapshot-data.d.ts +1 -0
- package/types/app/ai/store/internal/archive-id.d.ts +1 -0
- package/types/app/ai/store/internal/create-vector-store.d.ts +4 -0
- package/types/app/ai/store/internal/load-store-config.d.ts +22 -0
- package/types/app/ai/store/internal/load-thread-state-store.d.ts +4 -0
- package/types/app/ai/store/reference/file-memory.store.d.ts +33 -0
- package/types/app/ai/store/reference/file-trace.store.d.ts +14 -0
- package/types/app/ai/store/reference/file-vector.store.d.ts +12 -0
- package/types/app/ai/store/reference/qdrant-vector.store.d.ts +9 -0
- package/types/app/ai/store/store.interface.d.ts +141 -0
- package/types/app/ai/store/store.module.d.ts +2 -0
- package/types/app/ai/tool/builtin/index.d.ts +6 -0
- package/types/app/ai/tool/builtin/invoke-agent.tool.d.ts +11 -0
- package/types/app/ai/tool/builtin/retrieve.tool.d.ts +8 -0
- package/types/app/ai/tool/executor.service.d.ts +14 -0
- package/types/app/ai/tool/tool-registry.service.d.ts +13 -0
- package/types/app/ai/tool/tool.interface.d.ts +33 -0
- package/types/app/ai/tool/tool.module.d.ts +9 -0
- package/types/app/ai/trace/trace.service.d.ts +32 -0
- package/types/app/csr/controller.d.ts +3 -0
- package/types/app/csr/types.d.ts +10 -0
- package/types/app/extends/$fetch.d.ts +1 -3
- package/types/app/extends/crypto.d.ts +3 -5
- package/types/app/extends/db.d.ts +5 -3
- package/types/app/extends/logger.d.ts +16 -10
- package/types/app/frontend-development.d.ts +14 -0
- package/types/app/html/browser-options.d.ts +3 -0
- package/types/app/html/shell.d.ts +37 -10
- package/types/app/http/api-signing.d.ts +16 -0
- package/types/app/http/body-parser.middleware.d.ts +13 -0
- package/types/app/http/compression.middleware.d.ts +7 -0
- package/types/app/http/context.d.ts +11 -0
- package/types/app/http/controller.d.ts +7 -0
- package/types/app/http/csp-nonce.d.ts +3 -0
- package/types/app/http/error-response.d.ts +4 -0
- package/types/app/http/errors.d.ts +25 -0
- package/types/app/http/exception-filter.d.ts +11 -0
- package/types/app/http/request-body-parser-policy.d.ts +8 -0
- package/types/app/http/request-data.d.ts +9 -0
- package/types/app/http/request-schema.pipe.d.ts +18 -0
- package/types/app/http/response.d.ts +10 -0
- package/types/app/http/response.interceptor.d.ts +5 -0
- package/types/app/http/security.guard.d.ts +14 -0
- package/types/app/project/controller.d.ts +3 -0
- package/types/app/project/service.d.ts +19 -0
- package/types/app/providers/csr.d.ts +21 -0
- package/types/app/providers/foundation.d.ts +8 -0
- package/types/app/ssr/artifacts.d.ts +28 -0
- package/types/app/ssr/controller.d.ts +3 -0
- package/types/app/ssr/html.d.ts +37 -10
- package/types/app/ssr/session.d.ts +44 -0
- package/types/app/ssr/stream.d.ts +5 -0
- package/types/app/ssr/streaming-request-cache.d.ts +10 -0
- package/types/app/ssr/types.d.ts +70 -0
- package/types/app/static-assets.middleware.d.ts +10 -0
- package/types/app/template-core.module.d.ts +12 -0
- package/types/app/utils/i18n.d.ts +7 -4
- package/types/bundler/buildFE.d.ts +4 -1
- package/types/bundler/buildSSR.d.ts +3 -2
- package/types/bundler/dev-session.d.ts +23 -0
- package/types/bundler/dev.d.ts +4 -1
- package/types/bundler/feSharedConfig.d.ts +3 -1
- package/types/bundler/index.d.ts +4 -0
- package/types/bundler/prod.d.ts +2 -1
- package/types/bundler/state.d.ts +16 -5
- package/types/bundler/utils.d.ts +18 -18
- package/types/config/config.default.d.ts +19 -3
- package/types/index.d.ts +48 -29
- package/types/packages/common/ssr/hydration.d.ts +13 -0
- package/types/packages/core/bootstrap.d.ts +5 -0
- package/types/packages/core/config-service.d.ts +13 -0
- package/types/packages/core/duplicate-route-checking-adapter.d.ts +23 -0
- package/types/packages/core/index.d.ts +8 -6
- package/types/packages/core/legacy-factory-diagnostics.d.ts +2 -0
- package/types/packages/core/loader/model.d.ts +14 -10
- package/types/packages/core/paths.d.ts +0 -14
- package/types/packages/core/resource-lifecycle.d.ts +7 -0
- package/types/packages/core/startup.d.ts +111 -0
- package/types/packages/core/tokens.d.ts +8 -0
- package/types/scripts/vite-build/types.d.ts +3 -0
- package/types/ssrSharedData/outputPaths.d.ts +2 -2
- package/.skills/tc-generator/reference/project-template/app/controller/product.js +0 -73
- package/.skills/tc-generator/reference/project-template/app/router/product.js +0 -9
- package/cjs/app/controller/base.js +0 -1
- package/cjs/app/controller/project.js +0 -1
- package/cjs/app/controller/ssr.js +0 -1
- package/cjs/app/controller/view.js +0 -1
- package/cjs/app/extends/generateErrorMessage.js +0 -1
- package/cjs/app/extends/localCacheHtmlEtag.js +0 -1
- package/cjs/app/extends/parsingParamsOnUrl.js +0 -1
- package/cjs/app/extends/render-view.js +0 -1
- package/cjs/app/middleware.js +0 -1
- package/cjs/app/middlewares/api-params-verify.js +0 -1
- package/cjs/app/middlewares/api-sign-verify.js +0 -1
- package/cjs/app/middlewares/error-handle.js +0 -1
- package/cjs/app/middlewares/project-handler.js +0 -1
- package/cjs/app/middlewares/request-parameter-parsing.js +0 -1
- package/cjs/app/router/project.js +0 -1
- package/cjs/app/router/ssr.js +0 -1
- package/cjs/app/router/view.js +0 -1
- package/cjs/app/router-schema/project.js +0 -1
- package/cjs/app/service/base.js +0 -1
- package/cjs/app/service/project.js +0 -1
- package/cjs/packages/core/env.js +0 -1
- package/cjs/packages/core/loader/config.js +0 -1
- package/cjs/packages/core/loader/controller.js +0 -1
- package/cjs/packages/core/loader/extend.js +0 -1
- package/cjs/packages/core/loader/merge.js +0 -1
- package/cjs/packages/core/loader/middleware.js +0 -1
- package/cjs/packages/core/loader/router-schema.js +0 -1
- package/cjs/packages/core/loader/router.js +0 -1
- package/cjs/packages/core/loader/service.js +0 -1
- package/esm/_virtual/_rolldown/runtime.js +0 -7
- package/esm/app/controller/base.js +0 -26
- package/esm/app/controller/project.js +0 -58
- package/esm/app/controller/ssr.js +0 -215
- package/esm/app/controller/view.js +0 -43
- package/esm/app/extends/generateErrorMessage.js +0 -7
- package/esm/app/extends/localCacheHtmlEtag.js +0 -41
- package/esm/app/extends/parsingParamsOnUrl.js +0 -14
- package/esm/app/extends/render-view.js +0 -18
- package/esm/app/middleware.js +0 -31
- package/esm/app/middlewares/api-params-verify.js +0 -56
- package/esm/app/middlewares/api-sign-verify.js +0 -16
- package/esm/app/middlewares/error-handle.js +0 -25
- package/esm/app/middlewares/project-handler.js +0 -16
- package/esm/app/middlewares/request-parameter-parsing.js +0 -18
- package/esm/app/router/project.js +0 -7
- package/esm/app/router/ssr.js +0 -8
- package/esm/app/router/view.js +0 -8
- package/esm/app/router-schema/project.js +0 -15
- package/esm/app/service/base.js +0 -14
- package/esm/app/service/project.js +0 -23
- package/esm/packages/core/env.js +0 -24
- package/esm/packages/core/loader/config.js +0 -29
- package/esm/packages/core/loader/controller.js +0 -15
- package/esm/packages/core/loader/extend.js +0 -32
- package/esm/packages/core/loader/merge.js +0 -7
- package/esm/packages/core/loader/middleware.js +0 -15
- package/esm/packages/core/loader/router-schema.js +0 -26
- package/esm/packages/core/loader/router.js +0 -45
- package/esm/packages/core/loader/service.js +0 -15
- package/fe/_virtual/_rolldown/runtime.js +0 -13
- package/fe/packages/react/hooks/index.d.ts +0 -11
- package/fe/packages/react/hooks/index.js +0 -10
- package/fe/packages/react/hooks/useBreadcrumb.d.ts +0 -9
- package/fe/packages/react/hooks/useBreadcrumb.js +0 -5
- package/fe/packages/react/hooks/useExecuteOnce.js +0 -47
- package/fe/packages/react/hooks/useHydrationData.d.ts +0 -2
- package/fe/packages/react/hooks/useHydrationData.js +0 -23
- package/fe/packages/react/hooks/useInit.js +0 -11
- package/fe/packages/react/hooks/useLanguage.d.ts +0 -1
- package/fe/packages/react/hooks/useLanguage.js +0 -8
- package/fe/packages/react/hooks/usePagination.js +0 -30
- package/fe/packages/react/hooks/useRefState.js +0 -45
- package/fe/packages/react/hooks/useSSR.js +0 -46
- package/fe/packages/react/hooks/useWatch.js +0 -60
- package/fe/packages/react/ui/components/Button/Button.js +0 -88
- package/fe/packages/react/ui/components/Button/SubmitButton.d.ts +0 -8
- package/fe/packages/react/ui/components/Button/SubmitButton.js +0 -30
- package/fe/packages/react/ui/components/Card/Card.js +0 -31
- package/fe/packages/react/ui/components/Checkbox/Checkbox.js +0 -52
- package/fe/packages/react/ui/components/ConfirmDialog/ConfirmDialog.js +0 -41
- package/fe/packages/react/ui/components/DataTable/ActionBtn.d.ts +0 -7
- package/fe/packages/react/ui/components/DataTable/ActionBtn.js +0 -116
- package/fe/packages/react/ui/components/DataTable/dataTableWidth.js +0 -33
- package/fe/packages/react/ui/components/Date/Calendar.js +0 -351
- package/fe/packages/react/ui/components/Date/Date.js +0 -210
- package/fe/packages/react/ui/components/Date/DateTestPage.d.ts +0 -1
- package/fe/packages/react/ui/components/Date/DateTestPage.js +0 -24
- package/fe/packages/react/ui/components/Date/LocaleContext.js +0 -36
- package/fe/packages/react/ui/components/Date/LocaleProvider.js +0 -22
- package/fe/packages/react/ui/components/Date/TimePicker.js +0 -136
- package/fe/packages/react/ui/components/Date/data.js +0 -7
- package/fe/packages/react/ui/components/Date/dateLocaleStore.js +0 -14
- package/fe/packages/react/ui/components/Date/dropdownPositioning.d.ts +0 -2
- package/fe/packages/react/ui/components/Date/dropdownPositioning.js +0 -12
- package/fe/packages/react/ui/components/Date/locales.d.ts +0 -30
- package/fe/packages/react/ui/components/Date/locales.js +0 -56
- package/fe/packages/react/ui/components/Drawer/Drawer.d.ts +0 -22
- package/fe/packages/react/ui/components/Drawer/Drawer.js +0 -151
- package/fe/packages/react/ui/components/Dropdown/Dropdown.d.ts +0 -24
- package/fe/packages/react/ui/components/Dropdown/Dropdown.js +0 -105
- package/fe/packages/react/ui/components/Form/Form.js +0 -15
- package/fe/packages/react/ui/components/Form/FormItem.d.ts +0 -19
- package/fe/packages/react/ui/components/Form/FormItem.js +0 -60
- package/fe/packages/react/ui/components/Form/SchemaForm/data.d.ts +0 -40
- package/fe/packages/react/ui/components/Form/SchemaForm/data.js +0 -15
- package/fe/packages/react/ui/components/Form/SchemaForm/defaultComponentsMap.js +0 -4
- package/fe/packages/react/ui/components/Form/SchemaForm/index.d.ts +0 -60
- package/fe/packages/react/ui/components/Form/SchemaForm/index.js +0 -119
- package/fe/packages/react/ui/components/Input/Input.js +0 -146
- package/fe/packages/react/ui/components/InputNumber/InputNumber.d.ts +0 -25
- package/fe/packages/react/ui/components/InputNumber/InputNumber.js +0 -207
- package/fe/packages/react/ui/components/InputNumber/inputNumberUtils.js +0 -45
- package/fe/packages/react/ui/components/Label/Label.d.ts +0 -21
- package/fe/packages/react/ui/components/Label/Label.js +0 -58
- package/fe/packages/react/ui/components/Layout/Layout.js +0 -33
- package/fe/packages/react/ui/components/Loading/Loading.js +0 -48
- package/fe/packages/react/ui/components/Menu/Menu.js +0 -147
- package/fe/packages/react/ui/components/Menu/MenuContext.js +0 -88
- package/fe/packages/react/ui/components/Menu/MenuItem.js +0 -78
- package/fe/packages/react/ui/components/Menu/SubMenu.js +0 -207
- package/fe/packages/react/ui/components/Menu/utils.js +0 -8
- package/fe/packages/react/ui/components/Message/Message.js +0 -76
- package/fe/packages/react/ui/components/Message/MessageManager.js +0 -104
- package/fe/packages/react/ui/components/Message/data.js +0 -4
- package/fe/packages/react/ui/components/Modal/Modal.d.ts +0 -20
- package/fe/packages/react/ui/components/Modal/Modal.js +0 -59
- package/fe/packages/react/ui/components/Modal/ModalManager.d.ts +0 -46
- package/fe/packages/react/ui/components/Modal/ModalManager.js +0 -106
- package/fe/packages/react/ui/components/Notification/Notification.js +0 -56
- package/fe/packages/react/ui/components/Pagination/Pagination.d.ts +0 -10
- package/fe/packages/react/ui/components/Pagination/Pagination.js +0 -115
- package/fe/packages/react/ui/components/Popup/Popup.d.ts +0 -25
- package/fe/packages/react/ui/components/Popup/Popup.js +0 -91
- package/fe/packages/react/ui/components/Radio/Radio.js +0 -36
- package/fe/packages/react/ui/components/Radio/RadioGroup.js +0 -33
- package/fe/packages/react/ui/components/Search/Search.d.ts +0 -13
- package/fe/packages/react/ui/components/Search/Search.js +0 -24
- package/fe/packages/react/ui/components/Select/Select.d.ts +0 -21
- package/fe/packages/react/ui/components/Select/Select.js +0 -282
- package/fe/packages/react/ui/components/Select/dropdownPositioning.d.ts +0 -2
- package/fe/packages/react/ui/components/Select/dropdownPositioning.js +0 -16
- package/fe/packages/react/ui/components/Skeleton/Skeleton.js +0 -101
- package/fe/packages/react/ui/components/Switch/Switch.js +0 -28
- package/fe/packages/react/ui/components/TableSearch/TableSearch.d.ts +0 -30
- package/fe/packages/react/ui/components/TableSearch/TableSearch.js +0 -166
- package/fe/packages/react/ui/components/TableSearch/lang.d.ts +0 -16
- package/fe/packages/react/ui/components/TableSearch/lang.js +0 -25
- package/fe/packages/react/ui/components/TableSearch/tableSearchLocaleStore.js +0 -10
- package/fe/packages/react/ui/components/Textarea/Textarea.js +0 -58
- package/fe/packages/react/ui/components/Tooltip/Tooltip.js +0 -77
- package/fe/packages/react/ui/components/TreeSelect/TreeSelect.js +0 -190
- package/fe/packages/react/ui/components/Upload/ImageUpload.js +0 -101
- package/fe/packages/react/ui/components/Upload/Upload.js +0 -29
- package/fe/packages/react/ui/components/breadcrumb/breadcrumb.js +0 -155
- package/fe/packages/react/ui/components/hooks/useDropdownPositioning.js +0 -121
- package/fe/packages/react/ui/components/hooks/useInputController.js +0 -39
- package/fe/packages/react/ui/components/table/table.js +0 -166
- package/fe/packages/react/ui/components/testPage/DemoSection.d.ts +0 -10
- package/fe/packages/react/ui/components/testPage/DemoSection.js +0 -73
- package/fe/packages/react/ui/components/testPage/MenuTestPage.js +0 -24
- package/fe/packages/react/ui/components/testPage/demoRegistry.d.ts +0 -4
- package/fe/packages/react/ui/components/testPage/demoRegistry.js +0 -217
- package/fe/packages/react/ui/components/testPage/demos/core/BreadcrumbDemo.d.ts +0 -6
- package/fe/packages/react/ui/components/testPage/demos/core/BreadcrumbDemo.js +0 -44
- package/fe/packages/react/ui/components/testPage/demos/core/BreadcrumbDemo2.js +0 -4
- package/fe/packages/react/ui/components/testPage/demos/core/ButtonDemo.d.ts +0 -6
- package/fe/packages/react/ui/components/testPage/demos/core/ButtonDemo.js +0 -85
- package/fe/packages/react/ui/components/testPage/demos/core/ButtonDemo2.js +0 -4
- package/fe/packages/react/ui/components/testPage/demos/core/CardDemo.d.ts +0 -6
- package/fe/packages/react/ui/components/testPage/demos/core/CardDemo.js +0 -52
- package/fe/packages/react/ui/components/testPage/demos/core/CardDemo2.js +0 -4
- package/fe/packages/react/ui/components/testPage/demos/core/CheckboxDemo.d.ts +0 -6
- package/fe/packages/react/ui/components/testPage/demos/core/CheckboxDemo.js +0 -41
- package/fe/packages/react/ui/components/testPage/demos/core/CheckboxDemo2.js +0 -4
- package/fe/packages/react/ui/components/testPage/demos/core/ConfirmDialogDemo.d.ts +0 -6
- package/fe/packages/react/ui/components/testPage/demos/core/ConfirmDialogDemo.js +0 -35
- package/fe/packages/react/ui/components/testPage/demos/core/ConfirmDialogDemo2.js +0 -4
- package/fe/packages/react/ui/components/testPage/demos/core/DataTableDemo.d.ts +0 -6
- package/fe/packages/react/ui/components/testPage/demos/core/DataTableDemo.js +0 -273
- package/fe/packages/react/ui/components/testPage/demos/core/DataTableDemo2.js +0 -4
- package/fe/packages/react/ui/components/testPage/demos/core/DrawerDemo.d.ts +0 -6
- package/fe/packages/react/ui/components/testPage/demos/core/DrawerDemo.js +0 -105
- package/fe/packages/react/ui/components/testPage/demos/core/DrawerDemo2.js +0 -4
- package/fe/packages/react/ui/components/testPage/demos/core/DropdownDemo.d.ts +0 -6
- package/fe/packages/react/ui/components/testPage/demos/core/DropdownDemo.js +0 -48
- package/fe/packages/react/ui/components/testPage/demos/core/DropdownDemo2.js +0 -4
- package/fe/packages/react/ui/components/testPage/demos/core/FormDemo.d.ts +0 -6
- package/fe/packages/react/ui/components/testPage/demos/core/FormDemo.js +0 -56
- package/fe/packages/react/ui/components/testPage/demos/core/FormDemo2.js +0 -4
- package/fe/packages/react/ui/components/testPage/demos/core/ImageUploadDemo.d.ts +0 -6
- package/fe/packages/react/ui/components/testPage/demos/core/ImageUploadDemo.js +0 -26
- package/fe/packages/react/ui/components/testPage/demos/core/ImageUploadDemo2.js +0 -4
- package/fe/packages/react/ui/components/testPage/demos/core/InputDemo.d.ts +0 -6
- package/fe/packages/react/ui/components/testPage/demos/core/InputDemo.js +0 -55
- package/fe/packages/react/ui/components/testPage/demos/core/InputDemo2.js +0 -4
- package/fe/packages/react/ui/components/testPage/demos/core/InputNumberDemo.d.ts +0 -6
- package/fe/packages/react/ui/components/testPage/demos/core/InputNumberDemo.js +0 -65
- package/fe/packages/react/ui/components/testPage/demos/core/InputNumberDemo2.js +0 -4
- package/fe/packages/react/ui/components/testPage/demos/core/LabelDemo.d.ts +0 -6
- package/fe/packages/react/ui/components/testPage/demos/core/LabelDemo.js +0 -33
- package/fe/packages/react/ui/components/testPage/demos/core/LabelDemo2.js +0 -4
- package/fe/packages/react/ui/components/testPage/demos/core/LayoutDemo.d.ts +0 -6
- package/fe/packages/react/ui/components/testPage/demos/core/LayoutDemo.js +0 -64
- package/fe/packages/react/ui/components/testPage/demos/core/LayoutDemo2.js +0 -4
- package/fe/packages/react/ui/components/testPage/demos/core/LoadingDemo.d.ts +0 -6
- package/fe/packages/react/ui/components/testPage/demos/core/LoadingDemo.js +0 -32
- package/fe/packages/react/ui/components/testPage/demos/core/LoadingDemo2.js +0 -4
- package/fe/packages/react/ui/components/testPage/demos/core/MessageDemo.d.ts +0 -6
- package/fe/packages/react/ui/components/testPage/demos/core/MessageDemo.js +0 -44
- package/fe/packages/react/ui/components/testPage/demos/core/MessageDemo2.js +0 -4
- package/fe/packages/react/ui/components/testPage/demos/core/ModalDemo.d.ts +0 -6
- package/fe/packages/react/ui/components/testPage/demos/core/ModalDemo.js +0 -61
- package/fe/packages/react/ui/components/testPage/demos/core/ModalDemo2.js +0 -4
- package/fe/packages/react/ui/components/testPage/demos/core/NotificationDemo.d.ts +0 -6
- package/fe/packages/react/ui/components/testPage/demos/core/NotificationDemo.js +0 -50
- package/fe/packages/react/ui/components/testPage/demos/core/NotificationDemo2.js +0 -4
- package/fe/packages/react/ui/components/testPage/demos/core/PaginationDemo.d.ts +0 -6
- package/fe/packages/react/ui/components/testPage/demos/core/PaginationDemo.js +0 -39
- package/fe/packages/react/ui/components/testPage/demos/core/PaginationDemo2.js +0 -4
- package/fe/packages/react/ui/components/testPage/demos/core/PreviewImageDemo.d.ts +0 -6
- package/fe/packages/react/ui/components/testPage/demos/core/PreviewImageDemo.js +0 -22
- package/fe/packages/react/ui/components/testPage/demos/core/PreviewImageDemo2.js +0 -4
- package/fe/packages/react/ui/components/testPage/demos/core/RadioDemo.d.ts +0 -6
- package/fe/packages/react/ui/components/testPage/demos/core/RadioDemo.js +0 -129
- package/fe/packages/react/ui/components/testPage/demos/core/RadioDemo2.js +0 -4
- package/fe/packages/react/ui/components/testPage/demos/core/SchemaFormDemo.d.ts +0 -6
- package/fe/packages/react/ui/components/testPage/demos/core/SchemaFormDemo.js +0 -52
- package/fe/packages/react/ui/components/testPage/demos/core/SchemaFormDemo2.js +0 -4
- package/fe/packages/react/ui/components/testPage/demos/core/SearchDemo.d.ts +0 -6
- package/fe/packages/react/ui/components/testPage/demos/core/SearchDemo.js +0 -52
- package/fe/packages/react/ui/components/testPage/demos/core/SearchDemo2.js +0 -4
- package/fe/packages/react/ui/components/testPage/demos/core/SelectDemo.d.ts +0 -6
- package/fe/packages/react/ui/components/testPage/demos/core/SelectDemo.js +0 -73
- package/fe/packages/react/ui/components/testPage/demos/core/SelectDemo2.js +0 -4
- package/fe/packages/react/ui/components/testPage/demos/core/SkeletonDemo.d.ts +0 -6
- package/fe/packages/react/ui/components/testPage/demos/core/SkeletonDemo.js +0 -46
- package/fe/packages/react/ui/components/testPage/demos/core/SkeletonDemo2.js +0 -4
- package/fe/packages/react/ui/components/testPage/demos/core/SwitchDemo.d.ts +0 -6
- package/fe/packages/react/ui/components/testPage/demos/core/SwitchDemo.js +0 -36
- package/fe/packages/react/ui/components/testPage/demos/core/SwitchDemo2.js +0 -4
- package/fe/packages/react/ui/components/testPage/demos/core/TableDemo.d.ts +0 -6
- package/fe/packages/react/ui/components/testPage/demos/core/TableDemo.js +0 -64
- package/fe/packages/react/ui/components/testPage/demos/core/TableDemo2.js +0 -4
- package/fe/packages/react/ui/components/testPage/demos/core/TableSearchDemo.d.ts +0 -6
- package/fe/packages/react/ui/components/testPage/demos/core/TableSearchDemo.js +0 -74
- package/fe/packages/react/ui/components/testPage/demos/core/TableSearchDemo2.js +0 -4
- package/fe/packages/react/ui/components/testPage/demos/core/TabsDemo.d.ts +0 -6
- package/fe/packages/react/ui/components/testPage/demos/core/TabsDemo.js +0 -56
- package/fe/packages/react/ui/components/testPage/demos/core/TabsDemo2.js +0 -4
- package/fe/packages/react/ui/components/testPage/demos/core/TextareaDemo.d.ts +0 -6
- package/fe/packages/react/ui/components/testPage/demos/core/TextareaDemo.js +0 -30
- package/fe/packages/react/ui/components/testPage/demos/core/TextareaDemo2.js +0 -4
- package/fe/packages/react/ui/components/testPage/demos/core/ThemeSwitcher.d.ts +0 -6
- package/fe/packages/react/ui/components/testPage/demos/core/ThemeSwitcher.js +0 -96
- package/fe/packages/react/ui/components/testPage/demos/core/ThemeSwitcher2.js +0 -4
- package/fe/packages/react/ui/components/testPage/demos/core/TooltipDemo.d.ts +0 -6
- package/fe/packages/react/ui/components/testPage/demos/core/TooltipDemo.js +0 -29
- package/fe/packages/react/ui/components/testPage/demos/core/TooltipDemo2.js +0 -4
- package/fe/packages/react/ui/components/testPage/demos/core/TreeSelectDemo.d.ts +0 -6
- package/fe/packages/react/ui/components/testPage/demos/core/TreeSelectDemo.js +0 -66
- package/fe/packages/react/ui/components/testPage/demos/core/TreeSelectDemo2.js +0 -4
- package/fe/packages/react/ui/components/testPage/demos/date/DateBasicDemo.d.ts +0 -6
- package/fe/packages/react/ui/components/testPage/demos/date/DateBasicDemo.js +0 -31
- package/fe/packages/react/ui/components/testPage/demos/date/DateBasicDemo2.js +0 -4
- package/fe/packages/react/ui/components/testPage/demos/date/DateControlledDemo.d.ts +0 -6
- package/fe/packages/react/ui/components/testPage/demos/date/DateControlledDemo.js +0 -67
- package/fe/packages/react/ui/components/testPage/demos/date/DateControlledDemo2.js +0 -4
- package/fe/packages/react/ui/components/testPage/demos/date/DateDisabledDateDemo.d.ts +0 -6
- package/fe/packages/react/ui/components/testPage/demos/date/DateDisabledDateDemo.js +0 -36
- package/fe/packages/react/ui/components/testPage/demos/date/DateDisabledDateDemo2.js +0 -4
- package/fe/packages/react/ui/components/testPage/demos/date/DateDisabledDemo.d.ts +0 -6
- package/fe/packages/react/ui/components/testPage/demos/date/DateDisabledDemo.js +0 -35
- package/fe/packages/react/ui/components/testPage/demos/date/DateDisabledDemo2.js +0 -4
- package/fe/packages/react/ui/components/testPage/demos/date/DateFormatDemo.d.ts +0 -6
- package/fe/packages/react/ui/components/testPage/demos/date/DateFormatDemo.js +0 -35
- package/fe/packages/react/ui/components/testPage/demos/date/DateFormatDemo2.js +0 -4
- package/fe/packages/react/ui/components/testPage/demos/date/DateRangeDemo.d.ts +0 -6
- package/fe/packages/react/ui/components/testPage/demos/date/DateRangeDemo.js +0 -76
- package/fe/packages/react/ui/components/testPage/demos/date/DateRangeDemo2.js +0 -4
- package/fe/packages/react/ui/components/testPage/demos/date/DateTimeDemo.d.ts +0 -7
- package/fe/packages/react/ui/components/testPage/demos/date/DateTimeDemo.js +0 -60
- package/fe/packages/react/ui/components/testPage/demos/date/DateTimeDemo2.js +0 -4
- package/fe/packages/react/ui/components/testPage/demos/menu/MenuAccordionDemo.d.ts +0 -7
- package/fe/packages/react/ui/components/testPage/demos/menu/MenuAccordionDemo.js +0 -78
- package/fe/packages/react/ui/components/testPage/demos/menu/MenuAccordionDemo2.js +0 -4
- package/fe/packages/react/ui/components/testPage/demos/menu/MenuClickTriggerDemo.d.ts +0 -7
- package/fe/packages/react/ui/components/testPage/demos/menu/MenuClickTriggerDemo.js +0 -79
- package/fe/packages/react/ui/components/testPage/demos/menu/MenuClickTriggerDemo2.js +0 -4
- package/fe/packages/react/ui/components/testPage/demos/menu/MenuCollapsedDemo.d.ts +0 -7
- package/fe/packages/react/ui/components/testPage/demos/menu/MenuCollapsedDemo.js +0 -82
- package/fe/packages/react/ui/components/testPage/demos/menu/MenuCollapsedDemo2.js +0 -4
- package/fe/packages/react/ui/components/testPage/demos/menu/MenuCollapsedNoIconDemo.d.ts +0 -7
- package/fe/packages/react/ui/components/testPage/demos/menu/MenuCollapsedNoIconDemo.js +0 -44
- package/fe/packages/react/ui/components/testPage/demos/menu/MenuCollapsedNoIconDemo2.js +0 -4
- package/fe/packages/react/ui/components/testPage/demos/menu/MenuJsxDemo.d.ts +0 -7
- package/fe/packages/react/ui/components/testPage/demos/menu/MenuJsxDemo.js +0 -64
- package/fe/packages/react/ui/components/testPage/demos/menu/MenuJsxDemo2.js +0 -4
- package/fe/packages/react/ui/components/testPage/demos/menu/MenuLeftMultipleDemo.d.ts +0 -7
- package/fe/packages/react/ui/components/testPage/demos/menu/MenuLeftMultipleDemo.js +0 -81
- package/fe/packages/react/ui/components/testPage/demos/menu/MenuLeftMultipleDemo2.js +0 -4
- package/fe/packages/react/ui/components/testPage/demos/menu/MenuPopupDemo.d.ts +0 -7
- package/fe/packages/react/ui/components/testPage/demos/menu/MenuPopupDemo.js +0 -56
- package/fe/packages/react/ui/components/testPage/demos/menu/MenuPopupDemo2.js +0 -4
- package/fe/packages/react/ui/components/testPage/demos/menu/MenuStateDemo.d.ts +0 -7
- package/fe/packages/react/ui/components/testPage/demos/menu/MenuStateDemo.js +0 -67
- package/fe/packages/react/ui/components/testPage/demos/menu/MenuStateDemo2.js +0 -4
- package/fe/packages/react/ui/components/testPage/demos/menu/MenuTopDemo.d.ts +0 -7
- package/fe/packages/react/ui/components/testPage/demos/menu/MenuTopDemo.js +0 -55
- package/fe/packages/react/ui/components/testPage/demos/menu/MenuTopDemo2.js +0 -4
- package/fe/packages/react/ui/components/testPage/index.d.ts +0 -2
- package/fe/packages/react/ui/components/testPage/index.js +0 -45
- package/fe/packages/react/ui/components/testPage/types.d.ts +0 -17
- package/fe/packages/react/ui/lib/createStoreHook.js +0 -9
- package/fe/packages/react/ui/lib/export.d.ts +0 -21
- package/fe/packages/react/ui/lib/export.js +0 -112
- package/fe/packages/react/ui/lib/utils.d.ts +0 -9
- package/fe/packages/react/ui/lib/utils.js +0 -64
- package/fe/packages/react/ui/stores/breadcrumb.d.ts +0 -14
- package/fe/packages/react/ui/stores/breadcrumb.js +0 -52
- package/fe/packages/react/ui/stores/language.d.ts +0 -3
- package/fe/packages/react/ui/stores/language.js +0 -4
- package/models/packages/react/hooks/useBreadcrumb.d.ts +0 -9
- package/models/packages/react/hooks/useLanguage.d.ts +0 -1
- package/models/packages/react/ui/components/Button/SubmitButton.d.ts +0 -8
- package/models/packages/react/ui/components/DataTable/ActionBtn.d.ts +0 -7
- package/models/packages/react/ui/components/DataTable/index.d.ts +0 -32
- package/models/packages/react/ui/components/Date/dropdownPositioning.d.ts +0 -2
- package/models/packages/react/ui/components/Date/locales.d.ts +0 -30
- package/models/packages/react/ui/components/Drawer/Drawer.d.ts +0 -22
- package/models/packages/react/ui/components/Dropdown/Dropdown.d.ts +0 -24
- package/models/packages/react/ui/components/Form/FormItem.d.ts +0 -19
- package/models/packages/react/ui/components/Form/SchemaForm/data.d.ts +0 -40
- package/models/packages/react/ui/components/Form/SchemaForm/index.d.ts +0 -60
- package/models/packages/react/ui/components/Form/index.d.ts +0 -4
- package/models/packages/react/ui/components/InputNumber/InputNumber.d.ts +0 -25
- package/models/packages/react/ui/components/Label/Label.d.ts +0 -21
- package/models/packages/react/ui/components/Modal/Modal.d.ts +0 -20
- package/models/packages/react/ui/components/Modal/ModalManager.d.ts +0 -46
- package/models/packages/react/ui/components/Modal/index.d.ts +0 -3
- package/models/packages/react/ui/components/Overlay/Overlay.d.ts +0 -19
- package/models/packages/react/ui/components/Overlay/index.d.ts +0 -2
- package/models/packages/react/ui/components/Pagination/Pagination.d.ts +0 -10
- package/models/packages/react/ui/components/Popup/Popup.d.ts +0 -25
- package/models/packages/react/ui/components/Search/Search.d.ts +0 -13
- package/models/packages/react/ui/components/Select/Select.d.ts +0 -21
- package/models/packages/react/ui/components/Select/dropdownPositioning.d.ts +0 -2
- package/models/packages/react/ui/components/TableSearch/TableSearch.d.ts +0 -30
- package/models/packages/react/ui/components/TableSearch/lang.d.ts +0 -16
- package/models/packages/react/ui/i18n/I18nProvider.d.ts +0 -12
- package/models/packages/react/ui/i18n/index.d.ts +0 -3
- package/models/packages/react/ui/index.d.ts +0 -4
- package/models/packages/react/ui/lib/export.d.ts +0 -21
- package/models/packages/react/ui/lib/utils.d.ts +0 -9
- package/models/packages/react/ui/stores/breadcrumb.d.ts +0 -14
- package/models/packages/react/ui/stores/language.d.ts +0 -3
- package/types/app/controller/base.d.ts +0 -12
- package/types/app/controller/project.d.ts +0 -22
- package/types/app/controller/ssr.d.ts +0 -14
- package/types/app/controller/view.d.ts +0 -8
- package/types/app/extends/generateErrorMessage.d.ts +0 -7
- package/types/app/extends/localCacheHtmlEtag.d.ts +0 -10
- package/types/app/extends/parsingParamsOnUrl.d.ts +0 -2
- package/types/app/extends/render-view.d.ts +0 -7
- package/types/app/middleware.d.ts +0 -3
- package/types/app/middlewares/api-params-verify.d.ts +0 -4
- package/types/app/middlewares/api-sign-verify.d.ts +0 -4
- package/types/app/middlewares/error-handle.d.ts +0 -4
- package/types/app/middlewares/project-handler.d.ts +0 -4
- package/types/app/middlewares/request-parameter-parsing.d.ts +0 -7
- package/types/app/router/project.d.ts +0 -4
- package/types/app/router/ssr.d.ts +0 -6
- package/types/app/router/view.d.ts +0 -3
- package/types/app/router-schema/project.d.ts +0 -3
- package/types/app/service/base.d.ts +0 -9
- package/types/app/service/project.d.ts +0 -57
- package/types/app/type.d.ts +0 -35
- package/types/app/typings.d.ts +0 -50
- package/types/packages/core/env.d.ts +0 -15
- package/types/packages/core/loader/config.d.ts +0 -9
- package/types/packages/core/loader/controller.d.ts +0 -17
- package/types/packages/core/loader/extend.d.ts +0 -8
- package/types/packages/core/loader/merge.d.ts +0 -3
- package/types/packages/core/loader/middleware.d.ts +0 -11
- package/types/packages/core/loader/router-schema.d.ts +0 -18
- package/types/packages/core/loader/router.d.ts +0 -8
- package/types/packages/core/loader/service.d.ts +0 -17
- package/types/packages/core/types.d.ts +0 -158
- /package/cjs/app/{type.js → ai/agent/agent-run.dto.js} +0 -0
- /package/cjs/app/{typings.js → ai/agent/agent.interface.js} +0 -0
- /package/{fe/packages/react/ui/types → cjs/app/ai/contracts}/index.js +0 -0
- /package/cjs/{packages/core/types.js → app/ai/guardrail/guardrail.interface.js} +0 -0
- /package/{esm/app/type.js → cjs/app/ai/skill/skill.interface.js} +0 -0
- /package/{esm/app/typings.js → cjs/app/ai/tool/tool.interface.js} +0 -0
- /package/{esm/packages/core → cjs/app/csr}/types.js +0 -0
- /package/{fe/packages/react/ui/components/testPage → cjs/app/ssr}/types.js +0 -0
- /package/{fe/packages/react/ui/components/Menu/menuTypes.js → esm/app/ai/agent/agent-run.dto.js} +0 -0
- /package/fe/packages/react/{ui/assets → assets}/table/no-result.svg +0 -0
- /package/fe/packages/react/{ui/components → core}/Button/Button.d.ts +0 -0
- /package/{models/packages/react/ui/components → fe/packages/react/core}/Button/index.d.ts +0 -0
- /package/fe/packages/react/{ui/components → core}/Card/Card.d.ts +0 -0
- /package/{models/packages/react/ui/components → fe/packages/react/core}/Card/index.d.ts +0 -0
- /package/fe/packages/react/{ui/components → core}/Checkbox/Checkbox.d.ts +0 -0
- /package/{models/packages/react/ui/components → fe/packages/react/core}/Checkbox/index.d.ts +0 -0
- /package/{models/packages/react/ui/components → fe/packages/react/core}/Label/index.d.ts +0 -0
- /package/fe/packages/react/{ui/components → core}/Layout/Layout.d.ts +0 -0
- /package/{models/packages/react/ui/components → fe/packages/react/core}/Layout/index.d.ts +0 -0
- /package/fe/packages/react/{ui/components → core}/Loading/Loading.d.ts +0 -0
- /package/{models/packages/react/ui/components → fe/packages/react/core}/Loading/index.d.ts +0 -0
- /package/fe/packages/react/{ui/components → core}/Skeleton/Skeleton.d.ts +0 -0
- /package/{models/packages/react/ui/components → fe/packages/react/core}/Skeleton/index.d.ts +0 -0
- /package/fe/packages/react/{ui/components → core}/breadcrumb/breadcrumb.d.ts +0 -0
- /package/{models/packages/react/ui/components → fe/packages/react/core}/breadcrumb/index.d.ts +0 -0
- /package/fe/packages/react/{ui/components → core}/hooks/useDropdownPositioning.d.ts +0 -0
- /package/fe/packages/react/{hooks → core/hooks}/useExecuteOnce.d.ts +0 -0
- /package/fe/packages/react/{hooks → core/hooks}/useInit.d.ts +0 -0
- /package/fe/packages/react/{ui/components → core}/hooks/useInputController.d.ts +0 -0
- /package/fe/packages/react/{hooks → core/hooks}/usePagination.d.ts +0 -0
- /package/fe/packages/react/{hooks → core/hooks}/useRefState.d.ts +0 -0
- /package/fe/packages/react/{hooks → core/hooks}/useSSR.d.ts +0 -0
- /package/fe/packages/react/{hooks → core/hooks}/useWatch.d.ts +0 -0
- /package/fe/packages/react/{ui → core}/lib/createStoreHook.d.ts +0 -0
- /package/fe/packages/react/{ui/components/DataTable → core/lib}/dataTableWidth.d.ts +0 -0
- /package/{models/packages/react/ui/components → fe/packages/react/core}/types/baseType.d.ts +0 -0
- /package/fe/packages/react/{ui → core}/types/index.d.ts +0 -0
- /package/fe/packages/react/{ui/components/testPage → dev/preview}/MenuTestPage.d.ts +0 -0
- /package/fe/packages/react/{ui/components → forms}/Date/Calendar.d.ts +0 -0
- /package/fe/packages/react/{ui/components → forms}/Date/Date.d.ts +0 -0
- /package/fe/packages/react/{ui/components → forms}/Date/LocaleContext.d.ts +0 -0
- /package/fe/packages/react/{ui/components → forms}/Date/LocaleProvider.d.ts +0 -0
- /package/fe/packages/react/{ui/components → forms}/Date/TimePicker.d.ts +0 -0
- /package/fe/packages/react/{ui/components → forms}/Date/data.d.ts +0 -0
- /package/fe/packages/react/{ui/components → forms}/Date/dateLocaleStore.d.ts +0 -0
- /package/{models/packages/react/ui/components → fe/packages/react/forms}/Date/index.d.ts +0 -0
- /package/fe/packages/react/{ui/components → forms}/Form/Form.d.ts +0 -0
- /package/fe/packages/react/{ui/components → forms}/Form/SchemaForm/defaultComponentsMap.d.ts +0 -0
- /package/fe/packages/react/{ui/components → forms}/Form/useForm.d.ts +0 -0
- /package/fe/packages/react/{ui/components → forms}/Form/useForm.js +0 -0
- /package/fe/packages/react/{ui/components → forms}/Input/Input.d.ts +0 -0
- /package/{models/packages/react/ui/components → fe/packages/react/forms}/Input/index.d.ts +0 -0
- /package/{models/packages/react/ui/components → fe/packages/react/forms}/InputNumber/index.d.ts +0 -0
- /package/fe/packages/react/{ui/components → forms}/InputNumber/inputNumberUtils.d.ts +0 -0
- /package/{models/packages/react/ui/components → fe/packages/react/forms}/Pagination/index.d.ts +0 -0
- /package/fe/packages/react/{ui/components → forms}/Radio/Radio.d.ts +0 -0
- /package/fe/packages/react/{ui/components → forms}/Radio/RadioGroup.d.ts +0 -0
- /package/{models/packages/react/ui/components → fe/packages/react/forms}/Radio/index.d.ts +0 -0
- /package/{models/packages/react/ui/components → fe/packages/react/forms}/Search/index.d.ts +0 -0
- /package/{models/packages/react/ui/components → fe/packages/react/forms}/Select/index.d.ts +0 -0
- /package/fe/packages/react/{ui/components → forms}/Switch/Switch.d.ts +0 -0
- /package/{models/packages/react/ui/components → fe/packages/react/forms}/Switch/index.d.ts +0 -0
- /package/{models/packages/react/ui/components → fe/packages/react/forms}/TableSearch/index.d.ts +0 -0
- /package/fe/packages/react/{ui/components → forms}/TableSearch/tableSearchLocaleStore.d.ts +0 -0
- /package/fe/packages/react/{ui/components → forms}/Textarea/Textarea.d.ts +0 -0
- /package/{models/packages/react/ui/components → fe/packages/react/forms}/Textarea/index.d.ts +0 -0
- /package/fe/packages/react/{ui/components → forms}/TreeSelect/TreeSelect.d.ts +0 -0
- /package/{models/packages/react/ui/components → fe/packages/react/forms}/TreeSelect/index.d.ts +0 -0
- /package/fe/packages/react/{ui/components → forms}/Upload/ImageUpload.d.ts +0 -0
- /package/fe/packages/react/{ui/components → forms}/Upload/Upload.d.ts +0 -0
- /package/{models/packages/react/ui/components → fe/packages/react/forms}/Upload/index.d.ts +0 -0
- /package/{models/packages/react/ui/components → fe/packages/react/forms}/table/index.d.ts +0 -0
- /package/fe/packages/react/{ui/components → forms}/table/table.d.ts +0 -0
- /package/fe/packages/react/{ui/components/ConfirmDialog → overlays/Dialog}/ConfirmDialog.d.ts +0 -0
- /package/{models/packages/react/ui/components/ConfirmDialog → fe/packages/react/overlays/Dialog}/index.d.ts +0 -0
- /package/{models/packages/react/ui/components → fe/packages/react/overlays}/Drawer/index.d.ts +0 -0
- /package/{models/packages/react/ui/components → fe/packages/react/overlays}/Dropdown/index.d.ts +0 -0
- /package/fe/packages/react/{ui/components/Menu → overlays/DropdownMenu}/Menu.d.ts +0 -0
- /package/fe/packages/react/{ui/components/Menu → overlays/DropdownMenu}/MenuContext.d.ts +0 -0
- /package/fe/packages/react/{ui/components/Menu → overlays/DropdownMenu}/MenuItem.d.ts +0 -0
- /package/fe/packages/react/{ui/components/Menu → overlays/DropdownMenu}/SubMenu.d.ts +0 -0
- /package/{models/packages/react/ui/components/Menu → fe/packages/react/overlays/DropdownMenu}/index.d.ts +0 -0
- /package/fe/packages/react/{ui/components/Menu → overlays/DropdownMenu}/menuTypes.d.ts +0 -0
- /package/fe/packages/react/{ui/components/Menu → overlays/DropdownMenu}/utils.d.ts +0 -0
- /package/fe/packages/react/{ui/components → overlays}/Message/Message.d.ts +0 -0
- /package/fe/packages/react/{ui/components → overlays}/Message/MessageManager.d.ts +0 -0
- /package/fe/packages/react/{ui/components → overlays}/Message/data.d.ts +0 -0
- /package/{models/packages/react/ui/components → fe/packages/react/overlays}/Message/index.d.ts +0 -0
- /package/fe/packages/react/{ui/components/Notification → overlays/Popover}/Notification.d.ts +0 -0
- /package/{models/packages/react/ui/components/Notification → fe/packages/react/overlays/Popover}/index.d.ts +0 -0
- /package/{models/packages/react/ui/components → fe/packages/react/overlays}/Popup/index.d.ts +0 -0
- /package/fe/packages/react/{ui/components → overlays}/Tooltip/Tooltip.d.ts +0 -0
- /package/{models/packages/react/ui/components → fe/packages/react/overlays}/Tooltip/index.d.ts +0 -0
- /package/models/packages/react/{ui/components → core}/Button/Button.d.ts +0 -0
- /package/models/packages/react/{ui/components → core}/Card/Card.d.ts +0 -0
- /package/models/packages/react/{ui/components → core}/Checkbox/Checkbox.d.ts +0 -0
- /package/models/packages/react/{ui/components → core}/Layout/Layout.d.ts +0 -0
- /package/models/packages/react/{ui/components → core}/Loading/Loading.d.ts +0 -0
- /package/models/packages/react/{ui/components → core}/Skeleton/Skeleton.d.ts +0 -0
- /package/models/packages/react/{ui/components → core}/breadcrumb/breadcrumb.d.ts +0 -0
- /package/models/packages/react/{ui/components → core}/hooks/useDropdownPositioning.d.ts +0 -0
- /package/models/packages/react/{hooks → core/hooks}/useExecuteOnce.d.ts +0 -0
- /package/models/packages/react/{ui/components → core}/hooks/useInputController.d.ts +0 -0
- /package/models/packages/react/{ui → core}/lib/createStoreHook.d.ts +0 -0
- /package/models/packages/react/{ui/components/DataTable → core/lib}/dataTableWidth.d.ts +0 -0
- /package/models/packages/react/{ui → core}/types/index.d.ts +0 -0
- /package/models/packages/react/{ui/components → forms}/Date/Calendar.d.ts +0 -0
- /package/models/packages/react/{ui/components → forms}/Date/Date.d.ts +0 -0
- /package/models/packages/react/{ui/components → forms}/Date/LocaleContext.d.ts +0 -0
- /package/models/packages/react/{ui/components → forms}/Date/LocaleProvider.d.ts +0 -0
- /package/models/packages/react/{ui/components → forms}/Date/TimePicker.d.ts +0 -0
- /package/models/packages/react/{ui/components → forms}/Date/data.d.ts +0 -0
- /package/models/packages/react/{ui/components → forms}/Date/dateLocaleStore.d.ts +0 -0
- /package/models/packages/react/{ui/components → forms}/Form/Form.d.ts +0 -0
- /package/models/packages/react/{ui/components → forms}/Form/useForm.d.ts +0 -0
- /package/models/packages/react/{ui/components → forms}/Input/Input.d.ts +0 -0
- /package/models/packages/react/{ui/components → forms}/InputNumber/inputNumberUtils.d.ts +0 -0
- /package/models/packages/react/{ui/components → forms}/Radio/Radio.d.ts +0 -0
- /package/models/packages/react/{ui/components → forms}/Radio/RadioGroup.d.ts +0 -0
- /package/models/packages/react/{ui/components → forms}/Switch/Switch.d.ts +0 -0
- /package/models/packages/react/{ui/components → forms}/TableSearch/tableSearchLocaleStore.d.ts +0 -0
- /package/models/packages/react/{ui/components → forms}/Textarea/Textarea.d.ts +0 -0
- /package/models/packages/react/{ui/components → forms}/TreeSelect/TreeSelect.d.ts +0 -0
- /package/models/packages/react/{ui/components → forms}/Upload/ImageUpload.d.ts +0 -0
- /package/models/packages/react/{ui/components → forms}/Upload/Upload.d.ts +0 -0
- /package/models/packages/react/{ui/components → forms}/table/table.d.ts +0 -0
- /package/models/packages/react/{ui/components/ConfirmDialog → overlays/Dialog}/ConfirmDialog.d.ts +0 -0
- /package/models/packages/react/{ui/components/Menu → overlays/DropdownMenu}/Menu.d.ts +0 -0
- /package/models/packages/react/{ui/components/Menu → overlays/DropdownMenu}/MenuContext.d.ts +0 -0
- /package/models/packages/react/{ui/components/Menu → overlays/DropdownMenu}/MenuItem.d.ts +0 -0
- /package/models/packages/react/{ui/components/Menu → overlays/DropdownMenu}/SubMenu.d.ts +0 -0
- /package/models/packages/react/{ui/components/Menu → overlays/DropdownMenu}/menuTypes.d.ts +0 -0
- /package/models/packages/react/{ui/components/Menu → overlays/DropdownMenu}/utils.d.ts +0 -0
- /package/models/packages/react/{ui/components → overlays}/Message/Message.d.ts +0 -0
- /package/models/packages/react/{ui/components → overlays}/Message/MessageManager.d.ts +0 -0
- /package/models/packages/react/{ui/components → overlays}/Message/data.d.ts +0 -0
- /package/models/packages/react/{ui/components/Notification → overlays/Popover}/Notification.d.ts +0 -0
- /package/models/packages/react/{ui/components → overlays}/Tooltip/Tooltip.d.ts +0 -0
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @_tc/template-core
|
|
2
2
|
|
|
3
|
-
TemplateCore 是一个基于 TypeScript、
|
|
3
|
+
TemplateCore 是一个基于 TypeScript、NestJS、React 的后台框架包。它把 Nest 后端运行时、前端 Dashboard、Schema CRUD 页面、models 类型和类型扩展放到同一个 npm 包里,项目通过显式业务 Module 与 `models/`、`frontend/` 配置接入。
|
|
4
4
|
|
|
5
5
|
预览 & 文档地址:https://t-c-s-p.allomg.qzz.io/preview
|
|
6
6
|
|
|
@@ -14,7 +14,21 @@ pnpm add @_tc/template-core
|
|
|
14
14
|
|
|
15
15
|
- Node.js >= 22.13.0
|
|
16
16
|
- pnpm >= 8
|
|
17
|
-
-
|
|
17
|
+
- Nest/Express 运行时属于框架的 `dependencies`;消费方业务源码直接导入的 Nest 包也应在业务项目的 `dependencies` 中声明。使用内置前端时按包内 `peerDependencies` 安装所需 React、Vite、路由、状态、表单、UI 和类型依赖。
|
|
18
|
+
|
|
19
|
+
## 在 Node 中直接调用模型
|
|
20
|
+
|
|
21
|
+
按需要的能力导入子路径。每个实例接收业务方自己的模型、凭据和可选 `baseURL`。例如,下面的函数既能由画布节点调用,也能用作 Agent Tool 的 `execute`。
|
|
22
|
+
|
|
23
|
+
```js
|
|
24
|
+
import { createChatModel } from '@_tc/template-core/ai/chat'
|
|
25
|
+
|
|
26
|
+
const chat = createChatModel({ model: process.env.CHAT_MODEL, apiKey: process.env.OPENAI_API_KEY })
|
|
27
|
+
const summarize = ({ text }) => chat.generate({ messages: [{ role: 'user', content: text }] })
|
|
28
|
+
const summary = await summarize({ text: '用一句话介绍水循环。' })
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
`chat.stream(request)` 返回可用 `for await...of` 消费的有序文本增量。`@_tc/template-core/ai/image` 的 `createImageModel` 使用 OpenAI 图片协议,`@_tc/template-core/ai/video` 的 `createVideoModel` 使用方舟视频任务协议。业务方保存 `submit()` 返回的 `id`,后续使用 `get(id)` 查询,并在结果 URL 有效期内转存素材。使用独立 Agent 时从 `@_tc/template-core/ai` 导入 `createAiRuntime`。密钥和调用代码均留在 Node 后端。
|
|
18
32
|
|
|
19
33
|
## 快速使用
|
|
20
34
|
|
|
@@ -22,12 +36,10 @@ pnpm add @_tc/template-core
|
|
|
22
36
|
|
|
23
37
|
```text
|
|
24
38
|
my-admin/
|
|
25
|
-
├──
|
|
26
|
-
│ ├──
|
|
27
|
-
│
|
|
28
|
-
│
|
|
29
|
-
│ │ └── product.ts
|
|
30
|
-
│ └── service/
|
|
39
|
+
├── backend/
|
|
40
|
+
│ ├── business.module.ts
|
|
41
|
+
│ ├── product.controller.ts
|
|
42
|
+
│ └── product.service.ts
|
|
31
43
|
├── config/
|
|
32
44
|
│ └── config.default.ts
|
|
33
45
|
├── frontend/
|
|
@@ -43,25 +55,40 @@ my-admin/
|
|
|
43
55
|
│ └── demo.ts
|
|
44
56
|
├── typing/
|
|
45
57
|
│ └── template-core.d.ts
|
|
46
|
-
|
|
58
|
+
├── scripts/
|
|
59
|
+
│ └── build-be.mjs
|
|
60
|
+
└── index.js
|
|
47
61
|
```
|
|
48
62
|
|
|
49
|
-
|
|
63
|
+
先通过公开 `buildBE()` 编译 Nest 后端,再由 JavaScript 启动器加载编译产物。
|
|
50
64
|
|
|
51
|
-
```
|
|
52
|
-
|
|
53
|
-
import {
|
|
54
|
-
|
|
65
|
+
```js
|
|
66
|
+
// scripts/build-be.mjs
|
|
67
|
+
import { buildBE } from '@_tc/template-core/bundler'
|
|
68
|
+
|
|
69
|
+
await buildBE({
|
|
70
|
+
rootDir: process.cwd(),
|
|
71
|
+
input: ['backend'],
|
|
72
|
+
format: ['cjs'],
|
|
73
|
+
})
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
```js
|
|
77
|
+
// index.js
|
|
78
|
+
const { join } = require('node:path')
|
|
79
|
+
const { serverStart } = require('@_tc/template-core')
|
|
80
|
+
const { BusinessModule } = require('./dist/cjs/backend/business.module.js')
|
|
55
81
|
|
|
56
82
|
async function main() {
|
|
57
|
-
await serverStart({
|
|
83
|
+
const app = await serverStart({
|
|
58
84
|
name: 'my-admin',
|
|
59
85
|
baseDir: join(__dirname, '.'),
|
|
60
|
-
|
|
61
|
-
additionalPublicPaths: [join(__dirname, 'dist/public')],
|
|
86
|
+
businessModules: [BusinessModule],
|
|
62
87
|
})
|
|
63
88
|
|
|
64
|
-
|
|
89
|
+
const close = () => app.close()
|
|
90
|
+
process.once('SIGINT', close)
|
|
91
|
+
process.once('SIGTERM', close)
|
|
65
92
|
}
|
|
66
93
|
|
|
67
94
|
main().catch((error) => {
|
|
@@ -70,7 +97,7 @@ main().catch((error) => {
|
|
|
70
97
|
})
|
|
71
98
|
```
|
|
72
99
|
|
|
73
|
-
|
|
100
|
+
`serverStart()` 在 Nest 初始化并开始监听后返回 `INestApplication`。启动失败会 reject;应用关闭使用 `await app.close()`。开发内置前端时,在启动参数中加入 `frontendDev: true`,开启同源 Vite、React Fast Refresh 和实时 SSR,无需预构建 FE/SSR。修改 backend/config/models 后需按需重新编译并重启应用。
|
|
74
101
|
|
|
75
102
|
### serverStart 参数说明
|
|
76
103
|
|
|
@@ -78,13 +105,52 @@ main().catch((error) => {
|
|
|
78
105
|
| --- | --- | --- | --- | --- |
|
|
79
106
|
| `name` | `string` | 否 | - | 应用名称 |
|
|
80
107
|
| `baseDir` | `string` | 否 | - | 项目根目录,通常为 `join(__dirname, '.')` |
|
|
108
|
+
| `businessModules` | `Array<Type<unknown> \| DynamicModule>` | 否 | `[]` | 显式接入的 Nest 业务模块 |
|
|
109
|
+
| `providerOverrides` | `ProviderOverride[]` | 否 | `[]` | 对允许替换的公开框架 token 提供 Nest Provider 声明 |
|
|
110
|
+
| `requestBodyParser` | `RequestBodyParserOptions` | 否 | - | 按 HTTP method + 完整请求路径覆盖 malformed JSON 的响应策略 |
|
|
111
|
+
| `frontendDev` | `boolean \| FrontendDevOptions` | 否 | `false` | 开启同源 Vite/React Fast Refresh 和实时 SSR;随 `app.close()` 释放 |
|
|
81
112
|
| `pageBasePath` | `string` | 否 | `'/'` | 页面访问前缀,所有前端页面路由的基础路径 |
|
|
82
113
|
| `ssrPageBasePath` | `string` | 否 | `'/fessr'` | SSR 页面访问前缀,如 `/tssr` 会让 SSR 页面路由变成 `/tssr/:page` |
|
|
114
|
+
| `html` | `HtmlShellOptions` | 否 | - | SSR/CSR HTML 外壳的语言、主题、head 标签和 body 属性配置 |
|
|
83
115
|
| `homePage` | `string` | 否 | - | 应用首页路径 |
|
|
84
116
|
| `additionalPublicPaths` | `string | string[]` | 否 | - | 追加静态资源目录;如需同时作为 Nunjucks 模板查找目录,建议传绝对路径数组 |
|
|
85
117
|
|
|
86
118
|
框架会自动读取 `config/config.default.ts` 中的配置(如 `port`、`env`、`auth`、`resourceCacheTimeMs` 等)。
|
|
87
119
|
|
|
120
|
+
`html` 同时作用于 SSR 和 CSR 外壳。未配置 `lang` 时使用当前请求语言,主题默认保持 `dark`,存储键默认是 `tc_theme`。`viewportContent`、`meta`、`link` 和 `body.class/style` 可配置文档外壳。配置的 viewport、icon 等标签会替换同类默认标签。`storageValuePath` 用于读取 JSON 持久化值,例如 zustand persist 的 `state.theme`:
|
|
121
|
+
|
|
122
|
+
```ts
|
|
123
|
+
await serverStart({
|
|
124
|
+
html: {
|
|
125
|
+
theme: {
|
|
126
|
+
default: 'system',
|
|
127
|
+
storageKey: 'elf-easel:theme_store',
|
|
128
|
+
storageValuePath: 'state.theme',
|
|
129
|
+
},
|
|
130
|
+
},
|
|
131
|
+
})
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
同样的结构可以放在 `config/config.default.ts` 的 `html` 字段中。`serverStart().html` 的字段优先于配置文件值。
|
|
135
|
+
|
|
136
|
+
CSR 文档可在 `config/config.default.ts` 中通过 `csr.head(request)` 解析请求相关的标题、描述、meta、link 和 JSON-LD。该 resolver 生成的 HTML 使用 `private, no-store`,并沿用当前请求的 CSP nonce:
|
|
137
|
+
|
|
138
|
+
```ts
|
|
139
|
+
import type { CSRPageHeadResolver } from '@_tc/template-core'
|
|
140
|
+
|
|
141
|
+
const head: CSRPageHeadResolver = (request) => ({
|
|
142
|
+
title: `Dashboard ${String(request.query.project ?? '')}`,
|
|
143
|
+
description: 'Project dashboard',
|
|
144
|
+
meta: [{ name: 'robots', content: 'noindex' }],
|
|
145
|
+
link: [{ rel: 'canonical', href: `https://example.test${request.path}` }],
|
|
146
|
+
jsonLd: [{ '@context': 'https://schema.org', name: 'Dashboard' }],
|
|
147
|
+
})
|
|
148
|
+
|
|
149
|
+
export default {
|
|
150
|
+
csr: { head },
|
|
151
|
+
}
|
|
152
|
+
```
|
|
153
|
+
|
|
88
154
|
常用默认配置示例:
|
|
89
155
|
|
|
90
156
|
```ts
|
|
@@ -103,9 +169,27 @@ export default {
|
|
|
103
169
|
|
|
104
170
|
`resourceCacheTimeMs` 控制生产环境静态资源缓存时间,单位是 ms,默认 5 分钟。
|
|
105
171
|
|
|
172
|
+
#### malformed JSON 的按路由策略
|
|
173
|
+
|
|
174
|
+
`requestBodyParser.policies` 使用公开类型配置按 method 和完整请求路径 pattern 覆盖 malformed JSON 的默认响应。例如:
|
|
175
|
+
|
|
176
|
+
```ts
|
|
177
|
+
const app = await serverStart({
|
|
178
|
+
requestBodyParser: {
|
|
179
|
+
policies: [{
|
|
180
|
+
method: 'POST',
|
|
181
|
+
path: '/api/public/works/:slug/community/like',
|
|
182
|
+
onMalformedJson: 'status-500-empty',
|
|
183
|
+
}],
|
|
184
|
+
},
|
|
185
|
+
})
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
策略路径包含最终 `apiPrefix`,使用 `path-to-regexp` pattern;默认大小写不敏感、允许可选尾斜杠,查询字符串不参与匹配。策略按声明顺序匹配,首个命中的策略拥有响应;`apiPrefix: '/v2'` 时应配置 `/v2/...`。`status-500-empty` 只处理 JSON parser 的 `malformed-json`(语法错误或 strict JSON value 拒绝),返回 HTTP 500、空 body、无 `Content-Type`,且不会调用 Controller。`body-size`(超出 parser 限制)及其他 parser failures 仍使用默认 HTTP 200 + `{ code: 50000, message: 'Network error' }` 响应;form、text、multipart、raw 和 JSON media type 的解析行为不因策略改变。该服务器端配置不会注入 CSR/SSR 浏览器选项。
|
|
189
|
+
|
|
106
190
|
服务端返回给前端的错误消息会按请求头里的语种翻译。当前优先读取 `x-tc-language`,也兼容 `tc_language`、`tc-language`、`language`、`lang`、`locale` 和 `accept-language`;如果没取到,默认按英文 `en-US` 处理。
|
|
107
191
|
|
|
108
|
-
静态资源挂载顺序为:项目 `app/public`、框架 `app/public`、`additionalPublicPaths`。Nunjucks 模板查找顺序为:项目 `app/public/dist`、框架 `app/public/dist`、`additionalPublicPaths/dist
|
|
192
|
+
静态资源挂载顺序为:项目 `app/public`、框架 `app/public`、`additionalPublicPaths`。Nunjucks 模板查找顺序为:项目 `app/public/dist`、框架 `app/public/dist`、`additionalPublicPaths/dist`。当 `buildFE` 输出到自定义目录时,可以用 `additionalPublicPaths` 把该目录交给 Nest 运行时提供静态资源访问和模板渲染;追加目录必须是绝对路径。
|
|
109
193
|
|
|
110
194
|
### buildFE 参数说明
|
|
111
195
|
|
|
@@ -129,8 +213,8 @@ buildFE(mode: 'dev' | 'prod', options?: BuildFEOptions)
|
|
|
129
213
|
示例:
|
|
130
214
|
|
|
131
215
|
```ts
|
|
132
|
-
//
|
|
133
|
-
await buildFE('dev')
|
|
216
|
+
// 需要磁盘产物时的构建监听;退出时 await watcher.close()
|
|
217
|
+
const watcher = await buildFE('dev', { baseDir, output: 'run' })
|
|
134
218
|
|
|
135
219
|
// 生产模式,输出到项目目录
|
|
136
220
|
await buildFE('prod', { output: 'run' })
|
|
@@ -158,7 +242,7 @@ my-admin/
|
|
|
158
242
|
|
|
159
243
|
```tsx
|
|
160
244
|
import { createSSREntry } from '@_tc/template-core/ssr/createSSREntry'
|
|
161
|
-
import type { SSRPageMetaResolver, SSRPropsContext } from '@_tc/template-core/ssr'
|
|
245
|
+
import type { SSRPageHeadResolver, SSRPageMetaResolver, SSRPageResult, SSRPropsContext } from '@_tc/template-core/ssr'
|
|
162
246
|
|
|
163
247
|
interface HelloProps {
|
|
164
248
|
name: string
|
|
@@ -174,6 +258,11 @@ export async function getServerProps(context: SSRPropsContext) {
|
|
|
174
258
|
|
|
175
259
|
export const pageTitle: SSRPageMetaResolver<HelloProps> = ({ props }) => `Hello, ${props.name}`
|
|
176
260
|
export const pageDescription: SSRPageMetaResolver<HelloProps> = ({ path }) => `SSR hello page at ${path}`
|
|
261
|
+
export const pageHead: SSRPageHeadResolver<HelloProps> = ({ props }) => ({
|
|
262
|
+
meta: [{ property: 'og:title', content: props.name }],
|
|
263
|
+
link: [{ rel: 'canonical', href: 'https://example.test/products' }],
|
|
264
|
+
jsonLd: [{ '@context': 'https://schema.org', name: props.name }],
|
|
265
|
+
})
|
|
177
266
|
|
|
178
267
|
export default HelloPage
|
|
179
268
|
|
|
@@ -182,7 +271,9 @@ createSSREntry(HelloPage)
|
|
|
182
271
|
|
|
183
272
|
SSR 运行时会通过 React streaming bootstrap 动态 import 客户端入口。页面包含 `Suspense` 边界时,服务端可以先输出 shell / fallback,浏览器侧先启动 hydration,pending 内容后续继续 stream;如果页面没有 `Suspense` 边界,hydration 时机通常会接近完整 root HTML 到达之后。完整机制见 [Streaming Bootstrap 说明](./ssr/STREAMING_BOOTSTRAP.md)。
|
|
184
273
|
|
|
185
|
-
`pageTitle` / `pageDescription`
|
|
274
|
+
`pageTitle` / `pageDescription` 可以导出字符串,也可以导出同步或异步函数。页面也可以导出 `pageHead` 生成按请求的 meta、link 和 JSON-LD。`getServerProps()` 可以返回 `{ type: 'status', status, props }` 设置状态码,或 `{ type: 'redirect', redirect: { location, status } }` 在 shell 输出前跳转。函数会在 `getServerProps()` 之后执行,入参包含 `params`、`query`、`path`、`app`、`ctx` 和 `props`。请求级 CSP nonce 可由 `response.locals.cspNonce` 或 `config.ssr.cspNonce(request, response)` 提供。
|
|
275
|
+
|
|
276
|
+
其中 `app` 是 `serverStart()` 返回的同一个 `INestApplication`,通过 `app.get(token)` 获取 Provider;`ctx` 是 `TemplateCoreHttpContext`,包含原始 Express `request` / `response`、可选 `projectKey` 和 `language`。旧 `app.service` / `app.extends` 与 Koa `ctx` 调用需要迁移。只把允许浏览器读取的可序列化业务数据返回为 props,不返回应用、上下文或 Provider。
|
|
186
277
|
|
|
187
278
|
组件级流式异步数据可以使用 `StreamingRender`。它会在服务端 Suspense 中等待 `getData()`,把结果 JSON 序列化后转成 base64,再随 HTML 片段写入 script;客户端 hydration 时会先解码并复用这份数据。
|
|
188
279
|
|
|
@@ -213,13 +304,14 @@ import { buildSSR, watchSSRFiles } from '@_tc/template-core/bundler'
|
|
|
213
304
|
|
|
214
305
|
const baseDir = join(__dirname, '.')
|
|
215
306
|
|
|
307
|
+
await buildSSR({ baseDir, output: 'run' })
|
|
308
|
+
|
|
216
309
|
await serverStart({
|
|
217
310
|
name: 'my-admin',
|
|
218
311
|
baseDir,
|
|
219
312
|
ssrPageBasePath: '/fessr',
|
|
220
313
|
})
|
|
221
314
|
|
|
222
|
-
await buildSSR({ baseDir, output: 'run' })
|
|
223
315
|
await watchSSRFiles({ baseDir, output: 'run' })
|
|
224
316
|
```
|
|
225
317
|
|
|
@@ -230,7 +322,7 @@ http://localhost:9000/fessr/hello
|
|
|
230
322
|
http://localhost:9000/fessr/hello?name=TemplateCore
|
|
231
323
|
```
|
|
232
324
|
|
|
233
|
-
`buildSSR()` 会构建私有 `{ssrPrivateRoot}/ssr-server/{page}.mjs`、私有 `{ssrPrivateRoot}/ssr-manifest/manifest.json`,并把 SSR hydration 入口并入 FE browser build。浏览器侧静态资源走普通 `/dist/assets/*`,可与 CSR 入口共享 chunk;SSR HTML 会根据 manifest 生成 preload,并通过 React bootstrap dynamic import 启动对应客户端入口。服务端会从 `{publicPath}/../.tc/ssr` 查找 server bundle 和 manifest。`/dist/ssr-server/*` 和 `/dist/.vite/*` 会被拦截为 404,避免私有产物或误放文件直连暴露。如果 `output` 使用自定义目录,需要把对应 public 根目录加入 `additionalPublicPaths`。
|
|
325
|
+
`buildSSR()` 会构建私有 `{ssrPrivateRoot}/ssr-server/{page}.mjs`、私有 `{ssrPrivateRoot}/ssr-manifest/manifest.json`,并把 SSR hydration 入口并入 FE browser build。浏览器侧静态资源走普通 `/dist/assets/*`,可与 CSR 入口共享 chunk;SSR HTML 会根据 manifest 生成 preload,并通过 React bootstrap dynamic import 启动对应客户端入口。服务端会从 `{publicPath}/../.tc/ssr` 查找 server bundle 和 manifest。构建会把 `baseDir` 作为 Vite 根目录,因此从任意当前工作目录调用时仍按消费方依赖解析 SSR server bundle。`/dist/ssr-server/*` 和 `/dist/.vite/*` 会被拦截为 404,避免私有产物或误放文件直连暴露。如果 `output` 使用自定义目录,需要把对应 public 根目录加入 `additionalPublicPaths`。
|
|
234
326
|
|
|
235
327
|
`*.entry.tsx` 会被 server/client 两次构建处理,顶层代码需要同时兼容 Node 和浏览器。Node-only 逻辑建议放到 `*.server.ts`,并在 `getServerProps()` 内动态导入;浏览器 API 需要放到 `useEffect` 或 `typeof window !== 'undefined'` 守卫之后。`getServerProps()` 运行在 Node 侧,不要直接复用依赖 `window` / `localStorage` 签名上下文的前端 API 层。
|
|
236
328
|
|
|
@@ -258,9 +350,9 @@ http://localhost:9000/dash?projk=demo
|
|
|
258
350
|
|
|
259
351
|
## 内置功能
|
|
260
352
|
|
|
261
|
-
-
|
|
262
|
-
-
|
|
263
|
-
-
|
|
353
|
+
- Nest 服务启动:`serverStart(options)`,成功后返回 `INestApplication`。
|
|
354
|
+
- 业务模块:通过 `businessModules` 显式装配 Controller 和 Provider。
|
|
355
|
+
- 配置与模型:保留 `config/` 与 `models/` 的 loader 约定;业务后端使用 Nest DI 和公开 Provider tokens。
|
|
264
356
|
- 默认项目接口:
|
|
265
357
|
- `GET /api/project/model_list`
|
|
266
358
|
- `GET /api/project/list`
|
|
@@ -273,25 +365,26 @@ http://localhost:9000/dash?projk=demo
|
|
|
273
365
|
- API 中间件:错误处理、静态资源、body parser、项目上下文、接口签名、参数校验。
|
|
274
366
|
- 前端构建:扫描框架和项目的 `frontend/**/*.entry.{ts,tsx,js,jsx}`,输出服务端可渲染的 `.entry.tpl`,并写入 `FEBuildKey` 供 HTML ETag 缓存失效使用。
|
|
275
367
|
- SSR 页面:扫描框架和项目的 `ssr/apps/**/*.entry.{ts,tsx,js,jsx}`,输出 server/client 双产物并通过 `/fessr/:page` 服务端渲染。
|
|
276
|
-
- 类型扩展:支持扩展 SchemaForm、SchemaTable
|
|
368
|
+
- 类型扩展:支持扩展 SchemaForm、SchemaTable 单元格渲染组件和 CallCom。
|
|
277
369
|
|
|
278
370
|
## 常用公开入口
|
|
279
371
|
|
|
280
|
-
完整 exports 以发布包内 `package.json` 为准,除下表外还包含 `./fe/main`、`./fe/common/request`、`./ssr`、`./ssr/createSSREntry`、`./ssr/components`、`./ssr/components/StreamingRender`、`./ssr/hooks`、`./ssr/hooks/useSuspensePromise`、`./fe/*`、`./fe/rc/*`、`./fe/rc/hooks` 等子路径。
|
|
372
|
+
完整 exports 以发布包内 `package.json` 为准,除下表外还包含 `./fe/main`、`./fe/common/request`、`./ssr`、`./ssr/createSSREntry`、`./ssr/router`、`./ssr/components`、`./ssr/components/StreamingRender`、`./ssr/hooks`、`./ssr/hooks/useSuspensePromise`、`./fe/*`、`./fe/rc/*`、`./fe/rc/hooks` 等子路径。
|
|
281
373
|
|
|
282
374
|
| 入口 | 用途 |
|
|
283
375
|
| --- | --- |
|
|
284
|
-
| `@_tc/template-core` |
|
|
376
|
+
| `@_tc/template-core` | 服务启动、Nest 请求/响应 helpers、Provider tokens、model loader 与公开类型 |
|
|
285
377
|
| `@_tc/template-core/bundler` | 构建入口,提供 `buildFE`、`buildBE`、`buildSSR`、`watchSSRFiles` |
|
|
286
|
-
| `@_tc/template-core/ssr` | SSR 类型与运行时辅助,导出 `SSRPropsContext`、`SSRPageMetaResolver`、`StreamingRender`、`useSuspensePromise` |
|
|
378
|
+
| `@_tc/template-core/ssr` | SSR 类型与运行时辅助,导出 `SSRPropsContext`、`SSRPageMetaResolver`、`SSRPageHeadResolver`、`SSRPageResult`、`StreamingRender`、`useSuspensePromise` |
|
|
287
379
|
| `@_tc/template-core/ssr/createSSREntry` | SSR 页面客户端 hydration 工厂 |
|
|
380
|
+
| `@_tc/template-core/ssr/router` | SSR 页面客户端 `Link`、`navigate` 和路由类型 |
|
|
288
381
|
| `@_tc/template-core/ssr/components` | SSR 组件汇总入口,导出 `StreamingRender` |
|
|
289
382
|
| `@_tc/template-core/ssr/components/StreamingRender` | `StreamingRender` 显式子路径 |
|
|
290
383
|
| `@_tc/template-core/ssr/hooks` | SSR hooks 汇总入口,导出 `useSuspensePromise` |
|
|
291
384
|
| `@_tc/template-core/ssr/hooks/useSuspensePromise` | `useSuspensePromise` 显式子路径 |
|
|
292
385
|
| `@_tc/template-core/fe` | 前端初始化、动态组件渲染辅助、Dash 路由扩展、请求方法、SchemaPage 事件、token 工具、共享状态和内置前端组件 |
|
|
293
386
|
| `@_tc/template-core/fe/main` | 前端初始化入口 |
|
|
294
|
-
| `@_tc/template-core/fe/common/request` |
|
|
387
|
+
| `@_tc/template-core/fe/common/request` | 请求实例、请求方法、请求类型和 HTTP 401 handler 配置的显式子路径 |
|
|
295
388
|
| `@_tc/template-core/fe/rc` | UI/SchemaForm 组件和类型 |
|
|
296
389
|
| `@_tc/template-core/fe/rc/hooks` | React hooks 汇总入口 |
|
|
297
390
|
| `@_tc/template-core/fe/tailwind_ui.css` | 前端全局样式入口,源码对应 `frontend/src/main.css` |
|
|
@@ -299,45 +392,34 @@ http://localhost:9000/dash?projk=demo
|
|
|
299
392
|
|
|
300
393
|
### 后端类型
|
|
301
394
|
|
|
302
|
-
`@_tc/template-core`
|
|
395
|
+
`@_tc/template-core` 导出消费方 Nest 接入需要的 Node 类型和 helpers。业务类使用 Nest 提供的装饰器,通过显式 Module 注册。
|
|
303
396
|
|
|
304
397
|
| 类型 | 使用场景 |
|
|
305
398
|
| --- | --- |
|
|
306
|
-
| `
|
|
307
|
-
| `
|
|
308
|
-
| `
|
|
309
|
-
| `
|
|
310
|
-
| `
|
|
399
|
+
| `INestApplication` | `serverStart()` 成功后的应用返回值;使用 `close()` 释放资源。 |
|
|
400
|
+
| `StartOptions` | 业务 Module、Provider override 和启动路径配置。 |
|
|
401
|
+
| `TemplateCoreController` | 可选 Nest Controller 基类,提供 `this.success`、`this.fail`、`this.sendData`,不持有请求状态。 |
|
|
402
|
+
| `TemplateCoreRequestData` | `RequestData()` 的 headers/body/query/data 参数形状。 |
|
|
403
|
+
| `TemplateCoreHttpContext` | SSR 与框架请求上下文,包含原生 request/response、可选 projectKey 和 language。 |
|
|
404
|
+
| `FrameworkDB`、`CryptoExtend`、`FrameworkLogger` | 公开 Provider token 对应的能力接口。 |
|
|
311
405
|
|
|
312
406
|
示例:
|
|
313
407
|
|
|
314
408
|
```ts
|
|
315
|
-
import {
|
|
409
|
+
import { Controller, Get, Module } from '@nestjs/common'
|
|
410
|
+
import { RequestData, success } from '@_tc/template-core'
|
|
411
|
+
import type { TemplateCoreRequestData } from '@_tc/template-core'
|
|
316
412
|
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
this.success(ctx, ctx.reqData?.data ?? {})
|
|
323
|
-
}
|
|
324
|
-
}
|
|
325
|
-
}) satisfies ControllerFN
|
|
326
|
-
|
|
327
|
-
export const getDemoService = ((app) => {
|
|
328
|
-
return class DemoService {
|
|
329
|
-
readonly app = app
|
|
413
|
+
@Controller('api/demo')
|
|
414
|
+
class DemoController {
|
|
415
|
+
@Get('list')
|
|
416
|
+
list(@RequestData() request: TemplateCoreRequestData) {
|
|
417
|
+
return success(request.data)
|
|
330
418
|
}
|
|
331
|
-
}
|
|
332
|
-
|
|
333
|
-
export const demoMiddleware = ((app) => async (ctx, next) => {
|
|
334
|
-
app.extends.logger?.info(ctx.path)
|
|
335
|
-
await next()
|
|
336
|
-
}) satisfies MiddlewareFN
|
|
419
|
+
}
|
|
337
420
|
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
}) satisfies RouterFN
|
|
421
|
+
@Module({ controllers: [DemoController] })
|
|
422
|
+
export class BusinessModule {}
|
|
341
423
|
```
|
|
342
424
|
|
|
343
425
|
## model 数据如何配置
|
|
@@ -586,14 +668,13 @@ export default {
|
|
|
586
668
|
后端可以直接调用 loader:
|
|
587
669
|
|
|
588
670
|
```ts
|
|
589
|
-
import { modelLoader
|
|
671
|
+
import { modelLoader } from '@_tc/template-core'
|
|
590
672
|
|
|
591
|
-
|
|
592
|
-
const modelList = modelLoader(app)
|
|
593
|
-
return modelList
|
|
594
|
-
}
|
|
673
|
+
const modelList = modelLoader({ baseDir: process.cwd() })
|
|
595
674
|
```
|
|
596
675
|
|
|
676
|
+
`modelLoader` 的唯一参数是含 `baseDir: string` 的选项对象;`ModelLoaderOptions`、`ModelItem`、`ModelConfig` 类型也从根入口导出。内置 Nest Project Service 使用当前应用的 `baseDir` 调用同一 loader。
|
|
677
|
+
|
|
597
678
|
前端默认不直接读文件,而是通过内置接口获取:
|
|
598
679
|
|
|
599
680
|
```text
|
|
@@ -616,87 +697,98 @@ DELETE {api} -> 删除
|
|
|
616
697
|
|
|
617
698
|
`$schema::字段名` 表示从当前表格行读取字段值,常用于删除按钮参数。
|
|
618
699
|
|
|
619
|
-
###
|
|
700
|
+
### 服务端兜底路由
|
|
701
|
+
|
|
702
|
+
Nest 业务路由由 Controller 明确声明。未匹配的 TemplateCore API 请求保留框架的兜底协议;项目需要处理其他兜底行为时,按职责使用 Nest `ExceptionFilter`、`Guard` 或显式 Controller 路由。旧 `app/router-guard` 工厂返回字符串或 `{ status, body }` 的约定不再执行。
|
|
703
|
+
|
|
704
|
+
## 后端接入
|
|
705
|
+
|
|
706
|
+
消费方业务代码用 Nest `Module`、`Controller` 和 injectable `Provider` 组织,并通过 `serverStart({ businessModules })` 显式注册。不要依赖目录扫描来注册业务类。完整生成结构和 CRUD 示例见包内 `.skills/tc-generator/reference/project-template/` 与 `example.md`。
|
|
707
|
+
|
|
708
|
+
配置文件和模型文件仍由 TemplateCore loaders 读取。`config/` 与 `models/` 中的 `.js` / `.ts` 文件按 CommonJS 语义同步加载;`.ts` 文件使用 `export default`。Nest 业务源码放在独立目录(推荐 `backend/`),使用公开 `buildBE()` 编译,再由 JavaScript 启动器加载编译产物。若项目设置 `"type": "module"` 并使用 `.js` loader 文件,可在对应目录添加 `{ "type": "commonjs" }` 的局部 `package.json`。
|
|
709
|
+
|
|
710
|
+
### 请求与响应
|
|
620
711
|
|
|
621
|
-
|
|
712
|
+
`RequestData()` 注入 `headers`、解析后的 `body`、`query` 和 `data` 合并视图。`data` 按 query 后 body 合并,字段冲突时 body 优先;URL 参数使用 Nest `@Param()`。`RequestSchema()` 只验证显式标注的来源,不隐式转换或删除字段。JSON Controller 使用 `success(data)`、`fail(code, message)` 或 `sendData(data, code, message, status)` 返回 TemplateCore 协议;HTML、文件和 stream 由对应的 Nest 响应方式处理。
|
|
622
713
|
|
|
623
714
|
```ts
|
|
624
|
-
import
|
|
715
|
+
import { Body, Controller, Get, Post } from '@nestjs/common'
|
|
716
|
+
import { RequestData, success } from '@_tc/template-core'
|
|
717
|
+
import type { TemplateCoreRequestData } from '@_tc/template-core'
|
|
625
718
|
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
}
|
|
633
|
-
}
|
|
719
|
+
@Controller('api/setting')
|
|
720
|
+
export class SettingController {
|
|
721
|
+
@Get()
|
|
722
|
+
detail(@RequestData() request: TemplateCoreRequestData) {
|
|
723
|
+
return success({ language: request.headers['x-tc-language'] ?? 'en-US' })
|
|
724
|
+
}
|
|
634
725
|
|
|
635
|
-
|
|
726
|
+
@Post()
|
|
727
|
+
save(@Body() body: unknown) {
|
|
728
|
+
return success(body)
|
|
636
729
|
}
|
|
637
730
|
}
|
|
638
731
|
```
|
|
639
732
|
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
## 后端约定
|
|
733
|
+
#### JSON 代理如何转发请求体
|
|
643
734
|
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
```text
|
|
647
|
-
app/controller/**/*.(js|ts) -> app.controller
|
|
648
|
-
app/service/**/*.(js|ts) -> app.service
|
|
649
|
-
app/middlewares/**/*.(js|ts) -> app.middlewares
|
|
650
|
-
app/middleware.(js|ts) -> 全局中间件编排,按框架 -> 项目顺序执行
|
|
651
|
-
app/router/**/*.(js|ts) -> Koa router
|
|
652
|
-
app/router-schema/**/*.(js|ts) -> app.routerSchema
|
|
653
|
-
app/extends/*.(js|ts) -> app.extends
|
|
654
|
-
config/config.default.(js|ts) -> app.config
|
|
655
|
-
config/config.{env}.(js|ts) -> app.config
|
|
656
|
-
models/**/*.(js|ts) -> 内置 project service 按需读取的项目模型配置
|
|
657
|
-
```
|
|
735
|
+
`@RequestData()` 提供解析后的 `body`。没有请求体的 `DELETE` 和显式发送 JSON `{}` 的 `DELETE` 都可能得到 `{}`。下面的代理只接受 JSON,目标地址由服务端配置。Controller 可以调用 `forwardJson(target, 'DELETE', request)`,用原始请求头决定是否向上游发送 JSON。
|
|
658
736
|
|
|
659
|
-
|
|
737
|
+
```ts
|
|
738
|
+
import { createTemplateCoreError, type TemplateCoreRequestData } from '@_tc/template-core'
|
|
660
739
|
|
|
661
|
-
|
|
740
|
+
export function forwardJson(
|
|
741
|
+
target: URL,
|
|
742
|
+
method: 'POST' | 'PUT' | 'PATCH' | 'DELETE',
|
|
743
|
+
{ headers, body }: TemplateCoreRequestData
|
|
744
|
+
) {
|
|
745
|
+
const declaresBody = Number(headers['content-length'] ?? 0) > 0 || headers['transfer-encoding'] !== undefined
|
|
746
|
+
if (!declaresBody) return fetch(target, { method })
|
|
662
747
|
|
|
663
|
-
|
|
748
|
+
const mediaType = headers['content-type']?.split(';', 1)[0].trim().toLowerCase()
|
|
749
|
+
if (mediaType !== 'application/json') {
|
|
750
|
+
throw createTemplateCoreError('Expected application/json', { status: 415, code: 415 })
|
|
751
|
+
}
|
|
664
752
|
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
753
|
+
return fetch(target, {
|
|
754
|
+
method,
|
|
755
|
+
headers: { 'content-type': 'application/json' },
|
|
756
|
+
body: JSON.stringify(body),
|
|
757
|
+
})
|
|
758
|
+
}
|
|
759
|
+
```
|
|
670
760
|
|
|
671
|
-
|
|
761
|
+
没有 `Content-Length` 和 `Transfer-Encoding`,或只有 `Content-Length: 0` 时,上游收到零字节,代理也不添加 JSON `Content-Type`。长度大于零时,显式 `{}` 会作为 `{}` 转发,其他 JSON 对象或数组也保留其值。`fetch` 会按重新序列化后的内容设置长度。
|
|
672
762
|
|
|
673
|
-
|
|
763
|
+
`Transfer-Encoding: chunked` 只声明分块传输,实际内容可能是零字节。本例转发分块 JSON 时,零字节流和显式 `{}` 都可能向上游发送 `{}`。如果业务必须区分两者,需要在解析器消费请求流时记录实际读到的字节数。
|
|
674
764
|
|
|
675
|
-
|
|
676
|
-
- `app.extends.crypto`:Node 侧加密辅助方法,支持 base64url 编解码、HMAC 签名、签名 payload 和常量时间比较。
|
|
677
|
-
- `app.extends.db`:默认 SQLite 框架数据库,提供 `getDBData/setDBData` 等通用数据方法。
|
|
765
|
+
### 框架 Provider
|
|
678
766
|
|
|
679
|
-
|
|
767
|
+
框架默认能力通过公开 `TC_*` token 注入。`providerOverrides` 支持 Nest 的 value、class、factory、existing provider 声明;`TC_CONFIG` 只读。比如替换 logger:
|
|
680
768
|
|
|
681
769
|
```ts
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
770
|
+
import { TC_LOGGER, serverStart } from '@_tc/template-core'
|
|
771
|
+
|
|
772
|
+
const logger = {
|
|
773
|
+
log: console.log,
|
|
774
|
+
info: console.info,
|
|
775
|
+
warn: console.warn,
|
|
776
|
+
error: console.error,
|
|
777
|
+
debug: console.debug,
|
|
778
|
+
trace: console.trace,
|
|
687
779
|
}
|
|
688
|
-
```
|
|
689
780
|
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
781
|
+
const app = await serverStart({
|
|
782
|
+
businessModules: [BusinessModule],
|
|
783
|
+
providerOverrides: [{ provide: TC_LOGGER, useValue: logger }],
|
|
784
|
+
})
|
|
785
|
+
```
|
|
694
786
|
|
|
695
|
-
`
|
|
787
|
+
将旧 Controller/Service 工厂迁移为 Nest 类及 constructor injection;将 Router 注册函数迁移为装饰器路由;将 Middleware、schema 校验和 `router-guard` 分别迁移到 Middleware、Guard、Pipe、Interceptor、Exception Filter 或显式 Controller 路由;将 `app.extends` 能力改为 `TC_*` Provider 注入及 `providerOverrides`。`baseFn` 的继承与 `this.success(ctx, ...)` 调用改为直接返回公开响应 helper,或继承 `TemplateCoreController` 并使用不带 `ctx` 参数的同名方法。旧 Koa 工厂和注册表不保证源码兼容。
|
|
696
788
|
|
|
697
789
|
### 数据库扩展
|
|
698
790
|
|
|
699
|
-
默认 `
|
|
791
|
+
默认 `TC_DATABASE` Provider 使用 SQLite 保存数据,数据库文件位于项目根目录 `.template-core/template-core.sqlite`。可以在配置中调整路径:
|
|
700
792
|
|
|
701
793
|
```ts
|
|
702
794
|
// config/config.default.ts
|
|
@@ -707,36 +799,29 @@ export default {
|
|
|
707
799
|
}
|
|
708
800
|
```
|
|
709
801
|
|
|
710
|
-
|
|
802
|
+
在 Nest Provider 中通过公开 token 使用:
|
|
711
803
|
|
|
712
804
|
```ts
|
|
713
|
-
import {
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
const BaseController = baseFn.baseControllerFn(app)
|
|
717
|
-
|
|
718
|
-
return class SettingController extends BaseController {
|
|
719
|
-
detail = async (ctx: Ctx) => {
|
|
720
|
-
const data = app.extends.db.getDBData('site-setting', {
|
|
721
|
-
namespace: 'setting',
|
|
722
|
-
})
|
|
723
|
-
|
|
724
|
-
this.success(ctx, data ?? {})
|
|
725
|
-
}
|
|
805
|
+
import { Inject, Injectable } from '@nestjs/common'
|
|
806
|
+
import { TC_DATABASE } from '@_tc/template-core'
|
|
807
|
+
import type { FrameworkDB } from '@_tc/template-core'
|
|
726
808
|
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
})
|
|
809
|
+
@Injectable()
|
|
810
|
+
export class SettingService {
|
|
811
|
+
constructor(@Inject(TC_DATABASE) private readonly db: FrameworkDB) {}
|
|
731
812
|
|
|
732
|
-
|
|
733
|
-
}
|
|
813
|
+
detail() {
|
|
814
|
+
return this.db.getDBData('site-setting', { namespace: 'setting' }) ?? {}
|
|
734
815
|
}
|
|
735
|
-
}) satisfies ControllerFN
|
|
736
816
|
|
|
737
|
-
|
|
817
|
+
save(value: unknown) {
|
|
818
|
+
this.db.setDBData('site-setting', value, { namespace: 'setting' })
|
|
819
|
+
}
|
|
820
|
+
}
|
|
738
821
|
```
|
|
739
822
|
|
|
823
|
+
在 `BusinessModule` 的 `providers` 中注册 `SettingService`,再由 Controller 注入并返回 `success(service.detail())` 等响应结果。
|
|
824
|
+
|
|
740
825
|
常用方法:
|
|
741
826
|
|
|
742
827
|
- `getDBData(key, options)`:读取 JSON 数据。
|
|
@@ -757,7 +842,7 @@ SQL 注入边界:
|
|
|
757
842
|
|
|
758
843
|
### 加密扩展
|
|
759
844
|
|
|
760
|
-
`
|
|
845
|
+
`TC_CRYPTO` 默认使用应用配置中的 `signKey` 作为签名密钥,适合生成登录 token、接口签名和安全比较。Nest Provider 可通过构造函数注入:
|
|
761
846
|
|
|
762
847
|
常用方法:
|
|
763
848
|
|
|
@@ -770,159 +855,51 @@ SQL 注入边界:
|
|
|
770
855
|
- `verifySignedPayload(token, options)`:验证并解析签名串,失败返回 `null`。
|
|
771
856
|
|
|
772
857
|
```ts
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
iat: Date.now(),
|
|
777
|
-
})
|
|
858
|
+
import { Inject, Injectable } from '@nestjs/common'
|
|
859
|
+
import { TC_CRYPTO } from '@_tc/template-core'
|
|
860
|
+
import type { CryptoExtend } from '@_tc/template-core'
|
|
778
861
|
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
iat: number
|
|
783
|
-
}>(token)
|
|
862
|
+
@Injectable()
|
|
863
|
+
export class AuthService {
|
|
864
|
+
constructor(@Inject(TC_CRYPTO) private readonly crypto: CryptoExtend) {}
|
|
784
865
|
|
|
785
|
-
|
|
866
|
+
createToken(account: string) {
|
|
867
|
+
const now = Date.now()
|
|
868
|
+
return this.crypto.createSignedPayload({
|
|
869
|
+
account,
|
|
870
|
+
exp: now + 1000 * 60 * 60 * 24 * 7,
|
|
871
|
+
iat: now,
|
|
872
|
+
})
|
|
873
|
+
}
|
|
874
|
+
|
|
875
|
+
verifyToken(token: string) {
|
|
876
|
+
return this.crypto.verifySignedPayload<{ account: string; exp: number; iat: number }>(token)
|
|
877
|
+
}
|
|
878
|
+
}
|
|
786
879
|
```
|
|
787
880
|
|
|
788
881
|
```ts
|
|
789
882
|
// 推荐:参数绑定
|
|
790
|
-
const users =
|
|
883
|
+
const users = db.queryDB(
|
|
791
884
|
'SELECT * FROM user WHERE name = ?',
|
|
792
|
-
[
|
|
885
|
+
[userName]
|
|
793
886
|
)
|
|
794
887
|
|
|
795
888
|
// 不推荐:拼接用户输入,有 SQL 注入风险
|
|
796
|
-
const unsafeUsers =
|
|
797
|
-
`SELECT * FROM user WHERE name = '${
|
|
889
|
+
const unsafeUsers = db.queryDB(
|
|
890
|
+
`SELECT * FROM user WHERE name = '${userName}'`
|
|
798
891
|
)
|
|
799
892
|
```
|
|
800
893
|
|
|
801
|
-
|
|
894
|
+
项目可以通过 `providerOverrides` 替换默认数据库;自定义实现应满足公开 `FrameworkDB` 接口,并在业务 Module 中通过 `TC_DATABASE` 注入。
|
|
802
895
|
|
|
803
896
|
```ts
|
|
804
|
-
|
|
805
|
-
import type { DB, DBFactory } from '@_tc/template-core'
|
|
806
|
-
|
|
807
|
-
interface DataOptions {
|
|
808
|
-
namespace?: string
|
|
809
|
-
}
|
|
897
|
+
import { TC_DATABASE, serverStart } from '@_tc/template-core'
|
|
810
898
|
|
|
811
|
-
const
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
const db = {
|
|
817
|
-
dbPath: 'memory',
|
|
818
|
-
getDBConnection: () => {
|
|
819
|
-
throw new Error('memory db 没有底层 SQLite connection')
|
|
820
|
-
},
|
|
821
|
-
execDB: () => undefined,
|
|
822
|
-
runDB: () => ({ changes: 0, lastInsertRowid: 0 }),
|
|
823
|
-
queryDB: <T extends object = Record<string, unknown>>() => [] as T[],
|
|
824
|
-
getDBFirst: <T extends object = Record<string, unknown>>() => undefined as T | undefined,
|
|
825
|
-
transactionDB: <T>(handler: (db: DB) => T) => handler(db),
|
|
826
|
-
getDBData: <T = unknown>(key: string, options?: DataOptions) => {
|
|
827
|
-
return store.get(toKey(key, options?.namespace)) as T | undefined
|
|
828
|
-
},
|
|
829
|
-
getDBDataRecord: <T = unknown>(key: string, options?: DataOptions) => {
|
|
830
|
-
const value = store.get(toKey(key, options?.namespace)) as T | undefined
|
|
831
|
-
if (value === undefined) return undefined
|
|
832
|
-
|
|
833
|
-
return {
|
|
834
|
-
key,
|
|
835
|
-
value,
|
|
836
|
-
namespace: options?.namespace ?? 'framework',
|
|
837
|
-
createdAt: '',
|
|
838
|
-
updatedAt: '',
|
|
839
|
-
}
|
|
840
|
-
},
|
|
841
|
-
setDBData: <T = unknown>(key: string, value: T, options?: DataOptions) => {
|
|
842
|
-
store.set(toKey(key, options?.namespace), value)
|
|
843
|
-
return { changes: 1, lastInsertRowid: 0 }
|
|
844
|
-
},
|
|
845
|
-
hasDBData: (key: string, options?: DataOptions) => {
|
|
846
|
-
return store.has(toKey(key, options?.namespace))
|
|
847
|
-
},
|
|
848
|
-
deleteDBData: (key: string, options?: DataOptions) => {
|
|
849
|
-
return store.delete(toKey(key, options?.namespace))
|
|
850
|
-
},
|
|
851
|
-
listDBData: <T = unknown>(options?: DataOptions) => {
|
|
852
|
-
const namespace = options?.namespace ?? 'framework'
|
|
853
|
-
|
|
854
|
-
return Array.from(store.entries())
|
|
855
|
-
.filter(([key]) => key.startsWith(`${namespace}:`))
|
|
856
|
-
.map(([key, value]) => ({
|
|
857
|
-
key: key.slice(namespace.length + 1),
|
|
858
|
-
value: value as T,
|
|
859
|
-
namespace,
|
|
860
|
-
createdAt: '',
|
|
861
|
-
updatedAt: '',
|
|
862
|
-
}))
|
|
863
|
-
},
|
|
864
|
-
countDBData: () => store.size,
|
|
865
|
-
clearDBData: () => {
|
|
866
|
-
const size = store.size
|
|
867
|
-
store.clear()
|
|
868
|
-
return size
|
|
869
|
-
},
|
|
870
|
-
closeDB: () => undefined,
|
|
871
|
-
} satisfies DB
|
|
872
|
-
|
|
873
|
-
return db
|
|
874
|
-
}) satisfies DBFactory
|
|
875
|
-
|
|
876
|
-
export default getDB
|
|
877
|
-
```
|
|
878
|
-
|
|
879
|
-
Controller 示例:
|
|
880
|
-
|
|
881
|
-
```ts
|
|
882
|
-
import { baseFn, type ControllerFN, type Ctx } from '@_tc/template-core'
|
|
883
|
-
|
|
884
|
-
const getProductController = ((app) => {
|
|
885
|
-
const BaseController = baseFn.baseControllerFn(app)
|
|
886
|
-
|
|
887
|
-
return class ProductController extends BaseController {
|
|
888
|
-
list = async (ctx: Ctx) => {
|
|
889
|
-
this.success(ctx, {
|
|
890
|
-
data: [],
|
|
891
|
-
page: 1,
|
|
892
|
-
pageSize: 10,
|
|
893
|
-
total: 0,
|
|
894
|
-
})
|
|
895
|
-
}
|
|
896
|
-
}
|
|
897
|
-
}) satisfies ControllerFN
|
|
898
|
-
|
|
899
|
-
export default getProductController
|
|
900
|
-
```
|
|
901
|
-
|
|
902
|
-
Router 示例:
|
|
903
|
-
|
|
904
|
-
```ts
|
|
905
|
-
import type { KoaApp, Router } from '@_tc/template-core'
|
|
906
|
-
|
|
907
|
-
export default (app: KoaApp, router: Router) => {
|
|
908
|
-
router.get('/api/product/list', app.controller.product.list)
|
|
909
|
-
}
|
|
910
|
-
```
|
|
911
|
-
|
|
912
|
-
路由挂载顺序:
|
|
913
|
-
|
|
914
|
-
- 每个 `app/router/*.ts` 文件都会获得独立的 `koa-router` 实例。
|
|
915
|
-
- 可以通过 `router.level = number` 控制挂载顺序,数值越小越早挂载。
|
|
916
|
-
- 默认 `level` 是 `0`,框架兜底 router 是 `99`。
|
|
917
|
-
- 通配、兜底、重定向类路由建议设置较大的 `level`,避免抢先匹配项目 API。
|
|
918
|
-
|
|
919
|
-
```ts
|
|
920
|
-
import type { KoaApp, Router } from '@_tc/template-core'
|
|
921
|
-
|
|
922
|
-
export default (app: KoaApp, router: Router) => {
|
|
923
|
-
router.level = 10
|
|
924
|
-
router.get('/api/fallback/:id', app.controller.fallback.detail)
|
|
925
|
-
}
|
|
899
|
+
const app = await serverStart({
|
|
900
|
+
businessModules: [BusinessModule],
|
|
901
|
+
providerOverrides: [{ provide: TC_DATABASE, useClass: CustomDatabase }],
|
|
902
|
+
})
|
|
926
903
|
```
|
|
927
904
|
|
|
928
905
|
## 前端公共能力
|
|
@@ -957,6 +934,7 @@ import {
|
|
|
957
934
|
setLanguage,
|
|
958
935
|
setResources,
|
|
959
936
|
setAuthToken,
|
|
937
|
+
setUnauthorizedHandler,
|
|
960
938
|
ThemeSwitch,
|
|
961
939
|
t,
|
|
962
940
|
useApiFreezer,
|
|
@@ -983,6 +961,7 @@ import type {
|
|
|
983
961
|
SchemaFormComponentsMap,
|
|
984
962
|
SchemaFormNamespace,
|
|
985
963
|
SelectProps,
|
|
964
|
+
UnauthorizedHandler,
|
|
986
965
|
} from '@_tc/template-core/fe'
|
|
987
966
|
```
|
|
988
967
|
|
|
@@ -997,6 +976,7 @@ import type {
|
|
|
997
976
|
| SchemaPage 类型 | `CallComComponentsMap`、`CallComRenderer`、`SchemaTableRenderComponent`、`SchemaTableRenderComponentsMap` |
|
|
998
977
|
| SchemaForm 类型 | `FormFieldSchema`、`SchemaFormComponentsMap`、`SchemaFormNamespace`、`SelectProps` |
|
|
999
978
|
| 请求方法 | `api`、`request`、`get`、`post`、`put`、`patch`、`del` |
|
|
979
|
+
| HTTP 401 处理 | `setUnauthorizedHandler`、`UnauthorizedHandler` |
|
|
1000
980
|
| 请求类型 | `BaseResponse`、`PageParams`、`PageResponse`、`RequestConfig`、`ResponseConfig`、`AxiosError` |
|
|
1001
981
|
| RAF 风格计时器 | `rafSetTimeout`、`rafSetInterval`、`rafClearTimeout`、`rafClearInterval`、`clearRafTimer`、`RafTimerId`、`RafTimerCallback` |
|
|
1002
982
|
| Token 工具 | `getAuthToken`、`setAuthToken`、`clearAuthToken`、`localKeyMap` |
|
|
@@ -1009,7 +989,7 @@ import type {
|
|
|
1009
989
|
|
|
1010
990
|
`renderImportComponent` 封装了 `React.lazy` + `Suspense`,默认会用页面骨架屏作为 fallback。`getAuthToken()`、`setAuthToken()` 和 `clearAuthToken()` 用于读写或清理本地短 token,`localKeyMap` 暴露对应的本地存储 key 常量。
|
|
1011
991
|
|
|
1012
|
-
只使用请求层时,也可以从 `@_tc/template-core/fe/common/request` 导入 `api
|
|
992
|
+
只使用请求层时,也可以从 `@_tc/template-core/fe/common/request` 导入 `api`、请求方法、请求类型及 `setUnauthorizedHandler` / `UnauthorizedHandler`;这是发布包显式子路径,不要下钻到 `frontend/src/common/request`。
|
|
1013
993
|
|
|
1014
994
|
### 前端多语言
|
|
1015
995
|
|
|
@@ -1268,12 +1248,12 @@ RAF 风格计时器通过 `@_tc/template-core/fe` 对外提供,浏览器优先
|
|
|
1268
1248
|
- `BASE_URL`:固定为 `/api`
|
|
1269
1249
|
- `timeout`:15000ms(15秒)
|
|
1270
1250
|
- `credentials`:`'include'`,支持跨域携带 cookie
|
|
1271
|
-
- `window._signKey
|
|
1251
|
+
- `window._signKey`:默认共享模式从应用配置的 `signKey` 注入;私有模式注入空字符串
|
|
1272
1252
|
- 默认会先设置 `Content-Type: application/json`;如果是上传文件、`FormData` 或其他内容类型,请在请求配置里显式覆盖
|
|
1273
1253
|
|
|
1274
1254
|
**请求拦截器**:
|
|
1275
1255
|
|
|
1276
|
-
|
|
1256
|
+
默认共享模式下,每个请求会自动添加以下 headers(浏览器没有非空签名 key 时,不自动添加 `s_t` / `s_sign`):
|
|
1277
1257
|
|
|
1278
1258
|
```ts
|
|
1279
1259
|
{
|
|
@@ -1287,17 +1267,107 @@ RAF 风格计时器通过 `@_tc/template-core/fe` 对外提供,浏览器优先
|
|
|
1287
1267
|
`Authorization` 默认对应服务端配置 `config.auth.ATKey`。前端本地 token 存在 `localStorage.auth_token`,项目 key 存在 `localStorage.p_J_k`;刷新 token header 名预留为 `config.auth.RTKey`,默认是 `RT`。
|
|
1288
1268
|
|
|
1289
1269
|
**签名机制**:
|
|
1290
|
-
-
|
|
1270
|
+
- 签名密钥:服务端从应用配置的 `signKey` 读取;仅共享模式将它注入为 `window._signKey`
|
|
1291
1271
|
- 签名算法:`md5(签名密钥_${时间戳})`
|
|
1292
|
-
-
|
|
1272
|
+
- 共享模式在非 local 环境校验签名和时间戳;私有模式在所有环境校验,包括 local
|
|
1273
|
+
|
|
1274
|
+
#### 私有服务端签名与 cookie-session
|
|
1275
|
+
|
|
1276
|
+
`apiSignVerify.mode` 支持 `'shared'`(默认)和 `'private'`。共享模式保留浏览器自动签名,key 对页面访问者公开,不能作为可信服务端或用户身份的证明。私有模式适用于浏览器携带 cookie-session、由可信服务端边界为内部 API 添加签名的部署。
|
|
1277
|
+
|
|
1278
|
+
在消费项目的服务端环境配置中开启私有模式,例如 `config/config.production.js`:
|
|
1279
|
+
|
|
1280
|
+
```js
|
|
1281
|
+
module.exports = {
|
|
1282
|
+
signKey: process.env.TC_INTERNAL_SIGN_KEY,
|
|
1283
|
+
apiSignVerify: {
|
|
1284
|
+
mode: 'private',
|
|
1285
|
+
whiteList: [],
|
|
1286
|
+
},
|
|
1287
|
+
}
|
|
1288
|
+
```
|
|
1289
|
+
|
|
1290
|
+
`ApiSignVerifyOptions` 类型从 `@_tc/template-core` 根入口导出,可用于 TypeScript 配置。私有模式要求提供非空、非框架默认的 `signKey`;不合法的 mode 或私有 key 会使启动失败。key 在运行时通过服务端 secret/environment 注入,不写入镜像、前端环境变量、浏览器 bundle 或公开静态文件。
|
|
1291
|
+
|
|
1292
|
+
私有模式下的行为:
|
|
1293
|
+
|
|
1294
|
+
- CSR、SSR 成功页、SSR 404/500 错误页的 `window._signKey` 均为空字符串;服务端 `config.signKey` 保持原值供验签使用。
|
|
1295
|
+
- 框架不把该配置 key 放入 `window.appOptions` 或 hydration 数据。业务代码仍不能自行将 secrets 放入 `getServerProps()` 返回值、`StreamingRender` 数据、公开启动选项或 HTML head。
|
|
1296
|
+
- 内置浏览器请求仍保留 `credentials: 'include'`、cookie、Authorization、项目和语言 headers,但不自动添加 `s_t` / `s_sign`。使用自有 cookie-session fetch 的消费方无需改写框架 HTML。
|
|
1297
|
+
- 可信服务端先完成 session、权限及适用的 CSRF 检查,再为允许的内部请求生成签名。丢弃或覆盖浏览器传入的 `s_t` / `s_sign`,不要提供无鉴权的通用签名或转发接口。
|
|
1298
|
+
- 内部 API 按原协议校验 `s_t` / `s_sign`;缺失、错误或超时仍返回 HTTP 200、业务码 `100014`。私有模式在 local 环境也执行检查;`whiteList` 仍只按完整路径精确匹配,仅用于明确公开的端点。
|
|
1299
|
+
|
|
1300
|
+
可信服务端添加签名时使用现有协议,不能用 `TC_CRYPTO.hmacSign()` 的 HMAC 结果替代:
|
|
1301
|
+
|
|
1302
|
+
```ts
|
|
1303
|
+
import { createHash } from 'node:crypto'
|
|
1304
|
+
|
|
1305
|
+
// 仅在受信任的服务端、完成调用者鉴权之后执行。
|
|
1306
|
+
const key = process.env.TC_INTERNAL_SIGN_KEY
|
|
1307
|
+
if (!key) throw new Error('Missing internal signing key')
|
|
1308
|
+
const timestamp = String(Date.now())
|
|
1309
|
+
const signatureHeaders = {
|
|
1310
|
+
s_t: timestamp,
|
|
1311
|
+
s_sign: createHash('md5').update(`${key}_${timestamp}`).digest('hex'),
|
|
1312
|
+
}
|
|
1313
|
+
```
|
|
1314
|
+
|
|
1315
|
+
从共享模式迁移时使用新的私有 key,并清除此前含共享 key 的页面缓存;不能把已经公开过的 key 继续当作私有凭证。若用 `TC_CRYPTO` 签发登录 token 等可信凭证,应启用私有模式或显式传入独立的服务端 `secret`。
|
|
1293
1316
|
|
|
1294
1317
|
**响应拦截器**:
|
|
1295
1318
|
|
|
1296
|
-
- **401 处理**:自动清空 token
|
|
1319
|
+
- **401 处理**:自动清空 token,默认跳转到 `/login`;可注册 `setUnauthorizedHandler` 接管跳转
|
|
1297
1320
|
- **错误提取**:自动从响应中提取 `message`、`msg` 或 `errors` 字段
|
|
1298
1321
|
- **超时处理**:请求超时会返回当前语言的超时提示
|
|
1299
1322
|
- **网络错误**:网络异常会返回当前语言的网络错误提示
|
|
1300
1323
|
|
|
1324
|
+
#### 自定义 HTTP 401 处理
|
|
1325
|
+
|
|
1326
|
+
`setUnauthorizedHandler(handler?: UnauthorizedHandler): void` 与 `UnauthorizedHandler` 均从
|
|
1327
|
+
`@_tc/template-core/fe`、`@_tc/template-core/fe/common/request` 导出。回调类型为
|
|
1328
|
+
`(error: AxiosError) => void | Promise<void>`,可执行同步或异步业务处理。
|
|
1329
|
+
|
|
1330
|
+
HTTP 401 时框架先清理 token,再调用当前 handler,handler 仅接管默认跳转。后一次注册替换前一次注册;调用 `setUnauthorizedHandler()` 或传入 `undefined` 恢复 `/login`,空函数则接管且不跳转。handler 完成、抛出或拒绝后,框架仍提取并记录原请求错误,请求仍以原错误拒绝。非 401 处理不变。
|
|
1331
|
+
|
|
1332
|
+
在 `frontend/extended/dash/init.ts` 的首次请求前注册。内置 Dashboard 等待 init 完成后才渲染并请求模型;独立前端入口则在自身首次请求前注册。仅修改登录地址时保留默认响应拦截器,业务登录地址可与页面守卫共享:
|
|
1333
|
+
|
|
1334
|
+
```ts
|
|
1335
|
+
// frontend/src/login.ts
|
|
1336
|
+
export const loginUrl = '/admin/login'
|
|
1337
|
+
```
|
|
1338
|
+
|
|
1339
|
+
```ts
|
|
1340
|
+
// frontend/extended/dash/init.ts
|
|
1341
|
+
import { setUnauthorizedHandler } from '@_tc/template-core/fe/common/request'
|
|
1342
|
+
import type { UnauthorizedHandler } from '@_tc/template-core/fe/common/request'
|
|
1343
|
+
import type { DashInit } from '@_tc/template-core/fe'
|
|
1344
|
+
import { loginUrl } from '../../src/login'
|
|
1345
|
+
|
|
1346
|
+
const onUnauthorized: UnauthorizedHandler = () => {
|
|
1347
|
+
if (typeof window !== 'undefined') window.location.assign(loginUrl)
|
|
1348
|
+
}
|
|
1349
|
+
|
|
1350
|
+
const initDash: DashInit = () => {
|
|
1351
|
+
setUnauthorizedHandler(onUnauthorized)
|
|
1352
|
+
}
|
|
1353
|
+
|
|
1354
|
+
export default initDash
|
|
1355
|
+
```
|
|
1356
|
+
|
|
1357
|
+
```ts
|
|
1358
|
+
// frontend/extended/dash/routeGuard.ts
|
|
1359
|
+
import type { DashRouteGuard } from '@_tc/template-core/fe'
|
|
1360
|
+
import { loginUrl } from '../../src/login'
|
|
1361
|
+
|
|
1362
|
+
const dashRouteGuard: DashRouteGuard = ({ isLoggedIn }) => {
|
|
1363
|
+
if (!isLoggedIn) return loginUrl
|
|
1364
|
+
}
|
|
1365
|
+
|
|
1366
|
+
export default dashRouteGuard
|
|
1367
|
+
```
|
|
1368
|
+
|
|
1369
|
+
HTTP handler 与页面守卫分别处理请求失败和 Dashboard 初始化,互不覆盖、互不调用;框架不按 `pageBasePath` 推导登录地址。已有 `routeGuard` 返回 `undefined` 时中断内置重定向的语义保持不变。
|
|
1370
|
+
|
|
1301
1371
|
**使用示例**:
|
|
1302
1372
|
|
|
1303
1373
|
```ts
|
|
@@ -1641,12 +1711,12 @@ model 中用 `custom` 菜单指向自定义路径:
|
|
|
1641
1711
|
|
|
1642
1712
|
## 前端构建 buildFE
|
|
1643
1713
|
|
|
1644
|
-
|
|
1714
|
+
日常前端开发使用 `serverStart({ baseDir, businessModules, frontendDev: true })`。仅需要磁盘构建产物时使用以下监听方式,并在退出时关闭 watcher:
|
|
1645
1715
|
|
|
1646
1716
|
```ts
|
|
1647
1717
|
import { buildFE } from '@_tc/template-core/bundler'
|
|
1648
1718
|
|
|
1649
|
-
await buildFE('dev')
|
|
1719
|
+
const watcher = await buildFE('dev', { baseDir, output: 'run' })
|
|
1650
1720
|
```
|
|
1651
1721
|
|
|
1652
1722
|
生产构建:
|
|
@@ -1685,7 +1755,7 @@ import { buildBE } from '@_tc/template-core/bundler'
|
|
|
1685
1755
|
await buildBE()
|
|
1686
1756
|
```
|
|
1687
1757
|
|
|
1688
|
-
|
|
1758
|
+
消费方脚本示例(推荐的 `backend/` 必须显式加入 `input`):
|
|
1689
1759
|
|
|
1690
1760
|
```js
|
|
1691
1761
|
// scripts/build-be.mjs
|
|
@@ -1693,11 +1763,11 @@ import { buildBE } from '@_tc/template-core/bundler'
|
|
|
1693
1763
|
|
|
1694
1764
|
await buildBE({
|
|
1695
1765
|
rootDir: process.cwd(),
|
|
1696
|
-
input: ['
|
|
1766
|
+
input: ['backend'],
|
|
1697
1767
|
outDir: 'dist',
|
|
1698
1768
|
format: 'cjs',
|
|
1699
1769
|
alias: {
|
|
1700
|
-
'@
|
|
1770
|
+
'@backend': './backend',
|
|
1701
1771
|
'@model': './models',
|
|
1702
1772
|
},
|
|
1703
1773
|
})
|
|
@@ -1718,7 +1788,7 @@ await buildBE({
|
|
|
1718
1788
|
import chokidar from 'chokidar'
|
|
1719
1789
|
import { buildBE } from '@_tc/template-core/bundler'
|
|
1720
1790
|
|
|
1721
|
-
const input = ['
|
|
1791
|
+
const input = ['backend']
|
|
1722
1792
|
|
|
1723
1793
|
let building = false
|
|
1724
1794
|
let pending = false
|
|
@@ -1739,7 +1809,7 @@ async function runBuild() {
|
|
|
1739
1809
|
outDir: 'dist',
|
|
1740
1810
|
format: 'cjs',
|
|
1741
1811
|
alias: {
|
|
1742
|
-
'@
|
|
1812
|
+
'@backend': './backend',
|
|
1743
1813
|
'@model': './models',
|
|
1744
1814
|
},
|
|
1745
1815
|
})
|
|
@@ -1794,11 +1864,11 @@ chokidar
|
|
|
1794
1864
|
|
|
1795
1865
|
```ts
|
|
1796
1866
|
await buildBE({
|
|
1797
|
-
input: ['
|
|
1867
|
+
input: ['backend', 'config', 'models'],
|
|
1798
1868
|
outDir: 'dist',
|
|
1799
1869
|
format: ['es', 'cjs'],
|
|
1800
1870
|
alias: {
|
|
1801
|
-
'@
|
|
1871
|
+
'@backend': './backend',
|
|
1802
1872
|
'@model': './models',
|
|
1803
1873
|
},
|
|
1804
1874
|
})
|
|
@@ -1821,7 +1891,7 @@ await buildBE({
|
|
|
1821
1891
|
|
|
1822
1892
|
```ts
|
|
1823
1893
|
await buildBE({
|
|
1824
|
-
input: ['
|
|
1894
|
+
input: ['backend', 'config', 'models'],
|
|
1825
1895
|
allowMissingInput: true,
|
|
1826
1896
|
})
|
|
1827
1897
|
```
|
|
@@ -2151,7 +2221,7 @@ declare module '@_tc/template-core/fe/rc' {
|
|
|
2151
2221
|
|
|
2152
2222
|
- `FieldTypes` 用来增加字段类型名。
|
|
2153
2223
|
- `PropsMap` 用来绑定该字段的 props 类型。
|
|
2154
|
-
- 类型声明只负责 TS
|
|
2224
|
+
- 类型声明只负责 TS 校验。运行时可将组件 map 放在 `frontend/extended/SchemaForm/data.ts`,并在 `dash/init.ts` 或 `initApp()` 的 `beforeRender` 中调用公开的 `registerSchemaFormComponents(map)`(来自 `@_tc/template-core/fe/rc/forms`)。文件存在不会自动完成注册;框架的 `registerFrontendSchemaFormComponents()` 只注册框架字段。完整例子见包内 `.skills/tc-component-usage-skills/reference/patterns.md`。
|
|
2155
2225
|
|
|
2156
2226
|
### Model mode 类型扩展
|
|
2157
2227
|
|
|
@@ -2239,59 +2309,9 @@ declare module '@_tc/template-core/models' {
|
|
|
2239
2309
|
- 运行时组件注册在 `frontend/extended/SchemaPage/SchemaTable/data.ts`。
|
|
2240
2310
|
- 组件运行时会自动收到 `value`、`record`、`rowIndex`、`fieldKey`;`renderComponentProps` 只配置自定义参数。
|
|
2241
2311
|
|
|
2242
|
-
###
|
|
2243
|
-
|
|
2244
|
-
使用方推荐增强根包 `@_tc/template-core`:
|
|
2312
|
+
### 后端业务类型
|
|
2245
2313
|
|
|
2246
|
-
|
|
2247
|
-
// typing/template-core.d.ts
|
|
2248
|
-
import '@_tc/template-core'
|
|
2249
|
-
|
|
2250
|
-
declare module '@_tc/template-core' {
|
|
2251
|
-
namespace FrameworkAugment {
|
|
2252
|
-
interface IServiceAugmented {
|
|
2253
|
-
product: {
|
|
2254
|
-
list(): Promise<unknown[]>
|
|
2255
|
-
}
|
|
2256
|
-
}
|
|
2257
|
-
|
|
2258
|
-
interface IControllerAugmented {
|
|
2259
|
-
product: {
|
|
2260
|
-
list(ctx: import('@_tc/template-core').Ctx): Promise<void>
|
|
2261
|
-
}
|
|
2262
|
-
}
|
|
2263
|
-
|
|
2264
|
-
interface IExtendsAugmented {
|
|
2265
|
-
redis: {
|
|
2266
|
-
get(key: string): Promise<string | null>
|
|
2267
|
-
}
|
|
2268
|
-
}
|
|
2269
|
-
|
|
2270
|
-
interface IMiddlewaresAugmented {
|
|
2271
|
-
auth: import('koa').Middleware
|
|
2272
|
-
}
|
|
2273
|
-
|
|
2274
|
-
interface AppConfigAugmented {
|
|
2275
|
-
authSecret: string
|
|
2276
|
-
}
|
|
2277
|
-
}
|
|
2278
|
-
}
|
|
2279
|
-
```
|
|
2280
|
-
|
|
2281
|
-
使用:
|
|
2282
|
-
|
|
2283
|
-
```ts
|
|
2284
|
-
import type { KoaApp } from '@_tc/template-core'
|
|
2285
|
-
|
|
2286
|
-
export default (app: KoaApp) => {
|
|
2287
|
-
app.config.authSecret
|
|
2288
|
-
app.service.product.list()
|
|
2289
|
-
app.extends.$fetch.get('https://example.com/api')
|
|
2290
|
-
app.extends.redis.get('token')
|
|
2291
|
-
}
|
|
2292
|
-
```
|
|
2293
|
-
|
|
2294
|
-
如果在 TemplateCore 仓库源码内部扩展,声明目标通常是内部别名 `@tc/core`;npm 使用方不要依赖 `@tc/*` 内部路径。
|
|
2314
|
+
Nest 业务 Service、Controller 与自定义 Provider 使用普通 TypeScript 类型和 constructor injection,注册在消费方 Module 的 `providers` / `controllers` 中。旧 `FrameworkAugment` 下的 app 注册表增强不再用于业务依赖;自定义配置通过只读 `ConfigService` 或 `TC_CONFIG` 获取。框架默认能力使用公开 token 与相应接口,不从 `@tc/*` 内部路径导入。
|
|
2295
2315
|
|
|
2296
2316
|
## 可选:给项目 AI 助手的文档与 Skill
|
|
2297
2317
|
|
|
@@ -2301,21 +2321,23 @@ export default (app: KoaApp) => {
|
|
|
2301
2321
|
|
|
2302
2322
|
| Skill | 用途 |
|
|
2303
2323
|
| --- | --- |
|
|
2304
|
-
| `tc-generator` |
|
|
2324
|
+
| `tc-generator` | 生成显式 Nest 业务模块、model 配置、Schema CRUD、前端扩展和 SSR 页面。 |
|
|
2305
2325
|
| `tc-component-usage-skills` | 指导 Agent 选用和正确使用内置 React 组件库(Button、Form、DataTable、Modal 等)。 |
|
|
2306
2326
|
|
|
2307
2327
|
如果你的 Agent 支持本地 skills 目录,可以从已安装的 npm 包复制安装。以 Codex 为例:
|
|
2308
2328
|
|
|
2309
2329
|
```bash
|
|
2310
|
-
mkdir -p "$
|
|
2311
|
-
cp -R node_modules/@_tc/template-core/.skills/tc-generator "$
|
|
2312
|
-
cp -R node_modules/@_tc/template-core/.skills/tc-component-usage-skills "$
|
|
2330
|
+
mkdir -p "$HOME/.agents/skills"
|
|
2331
|
+
cp -R node_modules/@_tc/template-core/.skills/tc-generator "$HOME/.agents/skills/"
|
|
2332
|
+
cp -R node_modules/@_tc/template-core/.skills/tc-component-usage-skills "$HOME/.agents/skills/"
|
|
2313
2333
|
```
|
|
2314
2334
|
|
|
2315
2335
|
安装后重启对应 Agent,让新 skill 生效。使用时可以直接说”用 tc-generator 生成一个商品管理模块”或”用 tc-component-usage-skills 帮我写一个带搜索的分页表格”。
|
|
2316
2336
|
|
|
2317
2337
|
其他 Agent 如果不支持自动安装 skill,也可以直接读取 `.skills/tc-generator/SKILL.md` 或 `.skills/tc-component-usage-skills/SKILL.md`,再按需读取 `reference/` 下的参考文件。
|
|
2318
2338
|
|
|
2339
|
+
升级 TemplateCore 后同步更新复制安装的 Skill 与其整个 `reference/` 目录。先备份并移走旧 Skill 目录,再按上述命令复制,避免目录合并留下已删除的旧模板;自行定制的内容按需合并。使用项目模板时,保留现有项目的 registry/版本选择;新项目将模板里的 `latest` 替换为提供该 Skill 的已安装包版本或指定 tag,私有 `beta` 不会由 `latest` 选中。
|
|
2340
|
+
|
|
2319
2341
|
## 注意事项
|
|
2320
2342
|
|
|
2321
2343
|
- 不要在项目代码里引用 `dist/fe/*`、`dist/models/*` 这类构建产物路径。
|
|
@@ -2324,6 +2346,10 @@ cp -R node_modules/@_tc/template-core/.skills/tc-component-usage-skills "${CODEX
|
|
|
2324
2346
|
- `model` 数组合并依赖稳定 `key`。
|
|
2325
2347
|
- Dashboard 默认需要 URL 带 `?projk=项目key`。
|
|
2326
2348
|
- Dashboard 登录守卫放在 `frontend/extended/dash/routeGuard.ts`;登录页通常不在 Dash 路由下,返回登录页 URL 即可。
|
|
2327
|
-
-
|
|
2349
|
+
- 服务端自定义鉴权和兜底行为使用 Nest Guard、Exception Filter 或显式 Controller 路由。
|
|
2328
2350
|
- 前端入口必须命名为 `.entry.tsx`、`.entry.ts`、`.entry.jsx` 或 `.entry.js`。
|
|
2329
2351
|
- 入口同目录的 `.html` 只能作为插槽文件使用,不能写完整 HTML 文档;页面外壳始终由 `app/view/entry.tpl` 生成。
|
|
2352
|
+
|
|
2353
|
+
## Vite 开发模式
|
|
2354
|
+
|
|
2355
|
+
编译 Nest 后端后,使用 `serverStart({ baseDir, businessModules, frontendDev: true })` 开启同源 Vite、React Fast Refresh 和实时 SSR,无需先构建 FE/SSR。生成项目使用 `pnpm dev`。关闭时等待 `app.close()`;生产不传 `frontendDev`,继续使用已构建的模板和私有 SSR 产物。`buildFE('dev')` 是磁盘构建监听,返回的 watcher 需要 `await watcher.close()`。
|