@nocobase/portal-template-default 1.0.9 → 1.0.10
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/.env.example +5 -0
- package/.github/workflows/publish.yml +106 -0
- package/.gitignore +33 -0
- package/AGENTS.md +19 -0
- package/README.MD +61 -180
- package/package.json +3 -5
- package/scripts/build-html.mjs +12 -0
- package/src/App.css +2 -0
- package/src/App.tsx +35 -186
- package/src/app/development.tsx +154 -0
- package/src/app/extension.ts +5 -0
- package/src/app/extensions.tsx +18 -4
- package/src/app/routes.tsx +65 -0
- package/src/components/access-control/acl-bootstrap.tsx +11 -3
- package/src/components/access-control/acl-gate.tsx +7 -6
- package/src/components/access-control/can-access.tsx +17 -0
- package/src/components/access-control/navigate-to-accessible-resource.tsx +8 -3
- package/src/components/app-shell/sidebar.tsx +21 -5
- package/src/components/auth/auto-redirect-provider.tsx +2 -1
- package/src/extensions/nocobase-acl/README.md +74 -0
- package/{registry → src/extensions}/nocobase-acl/components/acl-boundary.tsx +22 -25
- package/{registry → src/extensions}/nocobase-acl/components/role-switcher.tsx +26 -23
- package/src/extensions/nocobase-acl/demo/acl-preview-provider.tsx +81 -0
- package/{registry → src/extensions}/nocobase-acl/demo/boundary-api.tsx +58 -0
- package/{registry → src/extensions}/nocobase-acl/demo/index.tsx +243 -105
- package/{registry → src/extensions}/nocobase-acl/demo/prompt-generator.tsx +3 -1
- package/src/extensions/nocobase-acl/extension.tsx +73 -0
- package/{registry → src/extensions}/nocobase-ai/README.md +21 -5
- package/{registry → src/extensions}/nocobase-ai/components/chat/chat-composer.tsx +3 -1
- package/{registry → src/extensions}/nocobase-ai/components/chat/chat-messages.tsx +38 -3
- package/{registry → src/extensions}/nocobase-ai/components/chat/tool-call-card.tsx +1 -9
- package/{registry → src/extensions}/nocobase-ai/components/index.ts +5 -0
- package/src/extensions/nocobase-ai/components/surfaces/chat-dialog.tsx +17 -0
- package/src/extensions/nocobase-ai/components/surfaces/chat-side-panel.tsx +35 -0
- package/src/extensions/nocobase-ai/components/surfaces/chat-surface.tsx +108 -0
- package/{registry → src/extensions}/nocobase-ai/components/triggers/ai-chat-floating-trigger.tsx +2 -2
- package/{registry → src/extensions}/nocobase-ai/demo/configuration-gate.tsx +4 -1
- package/{registry → src/extensions}/nocobase-ai/demo/container-showcase.tsx +2 -2
- package/{registry → src/extensions}/nocobase-ai/demo/floating.tsx +45 -15
- package/{registry → src/extensions}/nocobase-ai/demo/index.tsx +116 -74
- package/{registry → src/extensions}/nocobase-ai/demo/prompt-generator.tsx +3 -3
- package/{registry → src/extensions}/nocobase-ai/demo/tool-cards.tsx +2 -3
- package/src/extensions/nocobase-ai/extension.tsx +160 -0
- package/{registry → src/extensions}/nocobase-ai/global-ai-chat.tsx +12 -28
- package/{registry → src/extensions}/nocobase-ai/providers/ai-provider.tsx +14 -1
- package/{registry → src/extensions}/nocobase-ai/providers/chat-context.tsx +1 -0
- package/{registry → src/extensions}/nocobase-ai/providers/chat-provider.tsx +29 -8
- package/{registry → src/extensions}/nocobase-ai/providers/use-chat-attachments.ts +6 -1
- package/{registry → src/extensions}/nocobase-ai/providers/use-chat-work-context.ts +4 -1
- package/{registry → src/extensions}/nocobase-route-surfaces/README.md +2 -1
- package/{registry → src/extensions}/nocobase-route-surfaces/demo/index.tsx +33 -7
- package/{registry → src/extensions}/nocobase-route-surfaces/demo/scenarios.ts +20 -14
- package/{registry → src/extensions}/nocobase-route-surfaces/extension.tsx +55 -52
- package/src/{pages/users → extensions/nocobase-users-example}/create.tsx +4 -4
- package/src/{pages/users → extensions/nocobase-users-example}/edit.tsx +5 -9
- package/src/extensions/nocobase-users-example/extension.tsx +109 -0
- package/src/{pages/users → extensions/nocobase-users-example}/form-context.ts +11 -9
- package/src/extensions/nocobase-users-example/layout.tsx +16 -0
- package/src/{pages/users → extensions/nocobase-users-example}/list.tsx +1 -1
- package/src/extensions/nocobase-users-example/locales/en-US.ts +77 -0
- package/src/extensions/nocobase-users-example/locales/index.ts +8 -0
- package/src/extensions/nocobase-users-example/locales/zh-CN.ts +73 -0
- package/src/extensions/nocobase-users-example/optional-ai.ts +67 -0
- package/src/{pages/users → extensions/nocobase-users-example}/role-detail.tsx +4 -15
- package/src/{pages/users → extensions/nocobase-users-example}/routes.ts +1 -4
- package/src/extensions/nocobase-users-example/show.tsx +266 -0
- package/src/lib/nocobase/acl/context.ts +32 -0
- package/src/lib/nocobase/acl/evaluator.ts +186 -0
- package/src/lib/nocobase/acl/hooks.ts +40 -0
- package/src/lib/nocobase/acl/index.ts +4 -1
- package/src/lib/nocobase/acl/menu.ts +6 -6
- package/src/lib/nocobase/acl/record-permissions.ts +37 -7
- package/src/lib/nocobase/acl/store-provider.tsx +14 -0
- package/src/lib/nocobase/acl/store.ts +92 -86
- package/src/lib/nocobase/acl/types.ts +52 -32
- package/src/lib/nocobase/auth-session.ts +128 -0
- package/src/lib/nocobase/client.ts +48 -50
- package/src/locales/en-US.ts +0 -78
- package/src/locales/index.ts +2 -7
- package/src/locales/zh-CN.ts +0 -74
- package/src/providers/access-control.ts +43 -8
- package/src/providers/auth-callback.ts +1 -0
- package/src/providers/auth.ts +24 -26
- package/src/providers/constants.ts +0 -4
- package/src/providers/data.ts +14 -26
- package/src/providers/runtime-config.ts +40 -0
- package/src/vite-env.d.ts +9 -0
- package/tests/auth-session-regression.mjs +101 -0
- package/tsconfig.json +2 -1
- package/vite.config.ts +9 -1
- package/dist/assets/CoordinateSystem-C8P-Cleg.js +0 -1
- package/dist/assets/LegendVisualProvider-Bdgkckq-.js +0 -1
- package/dist/assets/LineDraw-C0m1GONT.js +0 -1
- package/dist/assets/SymbolDraw-CCospe5G.js +0 -1
- package/dist/assets/VisualMapping-Cbv1v7Cd.js +0 -1
- package/dist/assets/ai-employee-shortcut-B253WWow.js +0 -1
- package/dist/assets/calendar-B3dXXyIv.js +0 -1
- package/dist/assets/chat-inline-xpQ9iq4p.js +0 -1
- package/dist/assets/chat-side-panel-layout-BVWsp5rr.js +0 -1
- package/dist/assets/components-ChhJaNRc.js +0 -20
- package/dist/assets/configuration-gate-Dwdq_lxf.js +0 -1
- package/dist/assets/createClipPathFromCoordSys-uEftn1Mq.js +0 -1
- package/dist/assets/createSeriesDataSimply-CI7l7Ufv.js +0 -1
- package/dist/assets/customGraphicKeyframeAnimation-DE3jSfMd.js +0 -3
- package/dist/assets/echarts-preview-C-cNUtJF.js +0 -1
- package/dist/assets/echarts-runtime-CEgJbv68.js +0 -58
- package/dist/assets/echarts-runtime-advanced-Buhm2BHz.js +0 -1
- package/dist/assets/echarts-runtime-common-DLAdBAIa.js +0 -1
- package/dist/assets/echarts-runtime-components-ypnyLkYx.js +0 -1
- package/dist/assets/echarts-runtime-hierarchy-ClStquCF.js +0 -1
- package/dist/assets/floating-BarTmn-b.js +0 -13
- package/dist/assets/index-BJIcYTdc.js +0 -53
- package/dist/assets/index-C6xNKxpg.js +0 -656
- package/dist/assets/index-D4JQi1TM.js +0 -54
- package/dist/assets/index-YA7-AUO8.css +0 -1
- package/dist/assets/index-g8zWVpP9.js +0 -23
- package/dist/assets/labelHelper-C137W5gU.js +0 -1
- package/dist/assets/nocobase-ai-chat-VTMaZFQB.svg +0 -50
- package/dist/assets/page-context-Cxx11gzg.js +0 -73
- package/dist/assets/prompt-card-BsYMW_rq.js +0 -1
- package/dist/assets/sectorHelper-Fqgz3uEk.js +0 -1
- package/dist/assets/shortcut-xtghDP63.js +0 -47
- package/dist/assets/static.browser-CfQQzERe.js +0 -30
- package/dist/assets/switch-DrxImI8F.js +0 -1
- package/dist/assets/tool-cards-BGfsY8JF.js +0 -41
- package/dist/favicon.ico +0 -0
- package/dist/index.html +0 -40
- package/dist/index.raw.html +0 -46
- package/dist/logo-dark.png +0 -0
- package/dist/logo-mark-dark.png +0 -0
- package/dist/logo-mark.png +0 -0
- package/dist/logo.png +0 -0
- package/registry/nocobase-acl/README.md +0 -19
- package/registry/nocobase-acl/extension.tsx +0 -71
- package/registry/nocobase-acl/tests/acl-regression.mjs +0 -314
- package/registry/nocobase-ai/components/surfaces/chat-dialog.tsx +0 -31
- package/registry/nocobase-ai/components/surfaces/chat-side-panel.tsx +0 -74
- package/registry/nocobase-ai/extension.tsx +0 -158
- package/registry/nocobase-ai/tests/business-report-regression.mjs +0 -70
- package/registry/nocobase-ai/tests/form-filler-regression.mjs +0 -129
- package/registry/nocobase-ai/tests/frontend-tool-regression.mjs +0 -128
- package/registry/nocobase-ai/tests/page-context-regression.mjs +0 -48
- package/registry/nocobase-ai/tests/stream-regression.mjs +0 -207
- package/registry/nocobase-auth-cas/README.md +0 -6
- package/registry/nocobase-auth-cas/cas-sign-in-button.tsx +0 -41
- package/registry/nocobase-auth-cas/demo.tsx +0 -20
- package/registry/nocobase-auth-cas/extension.tsx +0 -46
- package/registry/nocobase-auth-cas/index.ts +0 -1
- package/registry/nocobase-auth-cas/use-cas-sign-in.ts +0 -29
- package/registry/nocobase-auth-dingtalk/README.md +0 -7
- package/registry/nocobase-auth-dingtalk/auto-login-provider.tsx +0 -154
- package/registry/nocobase-auth-dingtalk/demo.tsx +0 -23
- package/registry/nocobase-auth-dingtalk/dingtalk-sign-in-button.tsx +0 -45
- package/registry/nocobase-auth-dingtalk/extension.tsx +0 -55
- package/registry/nocobase-auth-dingtalk/index.ts +0 -4
- package/registry/nocobase-auth-dingtalk/use-dingtalk-sign-in.ts +0 -64
- package/registry/nocobase-auth-ldap/README.md +0 -6
- package/registry/nocobase-auth-ldap/demo.tsx +0 -21
- package/registry/nocobase-auth-ldap/extension.tsx +0 -46
- package/registry/nocobase-auth-ldap/index.ts +0 -1
- package/registry/nocobase-auth-ldap/ldap-sign-in-form.tsx +0 -69
- package/registry/nocobase-auth-ldap/use-ldap-sign-in.ts +0 -5
- package/registry/nocobase-auth-oidc/README.md +0 -11
- package/registry/nocobase-auth-oidc/auto-redirect-provider.tsx +0 -13
- package/registry/nocobase-auth-oidc/demo.tsx +0 -20
- package/registry/nocobase-auth-oidc/extension.tsx +0 -51
- package/registry/nocobase-auth-oidc/index.ts +0 -1
- package/registry/nocobase-auth-oidc/oidc-sign-in-button.tsx +0 -44
- package/registry/nocobase-auth-oidc/use-oidc-sign-in.ts +0 -58
- package/registry/nocobase-auth-saml/README.md +0 -6
- package/registry/nocobase-auth-saml/auto-redirect-provider.tsx +0 -13
- package/registry/nocobase-auth-saml/demo.tsx +0 -20
- package/registry/nocobase-auth-saml/extension.tsx +0 -51
- package/registry/nocobase-auth-saml/index.ts +0 -1
- package/registry/nocobase-auth-saml/saml-sign-in-button.tsx +0 -43
- package/registry/nocobase-auth-saml/use-saml-sign-in.ts +0 -51
- package/registry/nocobase-auth-sms/README.md +0 -7
- package/registry/nocobase-auth-sms/demo.tsx +0 -25
- package/registry/nocobase-auth-sms/extension.tsx +0 -46
- package/registry/nocobase-auth-sms/index.ts +0 -1
- package/registry/nocobase-auth-sms/sms-sign-in-form.tsx +0 -107
- package/registry/nocobase-auth-sms/use-sms-sign-in.ts +0 -88
- package/registry/nocobase-auth-wecom/README.md +0 -6
- package/registry/nocobase-auth-wecom/auto-login-provider.tsx +0 -21
- package/registry/nocobase-auth-wecom/demo.tsx +0 -23
- package/registry/nocobase-auth-wecom/extension.tsx +0 -49
- package/registry/nocobase-auth-wecom/index.ts +0 -1
- package/registry/nocobase-auth-wecom/use-wecom-sign-in.ts +0 -62
- package/registry/nocobase-auth-wecom/wecom-sign-in-button.tsx +0 -70
- package/registry/nocobase-i18n/README.md +0 -44
- package/registry/nocobase-i18n/components/index.ts +0 -1
- package/registry/nocobase-i18n/components/language-switcher.tsx +0 -138
- package/registry/nocobase-i18n/demo/index.tsx +0 -209
- package/registry/nocobase-i18n/demo/prompt-generator.tsx +0 -132
- package/registry/nocobase-i18n/extension.tsx +0 -45
- package/registry/nocobase-i18n/index.ts +0 -7
- package/registry/nocobase-i18n/locales/en-US.ts +0 -39
- package/registry/nocobase-i18n/locales/index.ts +0 -8
- package/registry/nocobase-i18n/locales/zh-CN.ts +0 -35
- package/registry/nocobase-i18n/provider.tsx +0 -44
- package/registry/nocobase-i18n/server-resources.ts +0 -166
- package/registry/nocobase-i18n/tests/i18n-regression.mjs +0 -51
- package/registry.config.json +0 -302
- package/scripts/registry.mjs +0 -164
- package/src/components/access-control/resource-access-guard.tsx +0 -21
- package/src/components/access-control/use-acl-runtime.ts +0 -28
- package/src/lib/nocobase/acl/action.ts +0 -147
- package/src/pages/users/layout.tsx +0 -15
- package/src/pages/users/show.tsx +0 -278
- /package/{registry → src/extensions}/nocobase-acl/components/index.ts +0 -0
- /package/{registry → src/extensions}/nocobase-acl/components/role-options.ts +0 -0
- /package/{registry → src/extensions}/nocobase-acl/demo/components.tsx +0 -0
- /package/{registry → src/extensions}/nocobase-acl/demo/lazy-route.tsx +0 -0
- /package/{registry → src/extensions}/nocobase-acl/demo/role-switcher-prompt-generator.tsx +0 -0
- /package/{registry → src/extensions}/nocobase-acl/demo/scenario-section.tsx +0 -0
- /package/{registry → src/extensions}/nocobase-acl/index.ts +0 -0
- /package/{registry → src/extensions}/nocobase-ai/adapters/react-hook-form.ts +0 -0
- /package/{registry → src/extensions}/nocobase-ai/assets/nocobase-ai-chat.svg +0 -0
- /package/{registry → src/extensions}/nocobase-ai/components/ai-root-provider.tsx +0 -0
- /package/{registry → src/extensions}/nocobase-ai/components/chat/ai-employee-avatar.tsx +0 -0
- /package/{registry → src/extensions}/nocobase-ai/components/chat/chat-attachment.tsx +0 -0
- /package/{registry → src/extensions}/nocobase-ai/components/chat/chat-compact.tsx +0 -0
- /package/{registry → src/extensions}/nocobase-ai/components/chat/chat-empty-state.tsx +0 -0
- /package/{registry → src/extensions}/nocobase-ai/components/chat/chat-header.tsx +0 -0
- /package/{registry → src/extensions}/nocobase-ai/components/chat/chat-history-dialog.tsx +0 -0
- /package/{registry → src/extensions}/nocobase-ai/components/chat/chat-message.tsx +0 -0
- /package/{registry → src/extensions}/nocobase-ai/components/chat/chat-window.tsx +0 -0
- /package/{registry → src/extensions}/nocobase-ai/components/chat/conversation-list.tsx +0 -0
- /package/{registry → src/extensions}/nocobase-ai/components/chat/markdown-message.tsx +0 -0
- /package/{registry → src/extensions}/nocobase-ai/components/chat/model-select-options.tsx +0 -0
- /package/{registry → src/extensions}/nocobase-ai/components/chat/reasoning-panel.tsx +0 -0
- /package/{registry → src/extensions}/nocobase-ai/components/chat/sub-agent-conversation.tsx +0 -0
- /package/{registry → src/extensions}/nocobase-ai/components/chat/user-prompt-editor.tsx +0 -0
- /package/{registry → src/extensions}/nocobase-ai/components/chat/work-context-chip.tsx +0 -0
- /package/{registry → src/extensions}/nocobase-ai/components/page-elements/ai-form.tsx +0 -0
- /package/{registry → src/extensions}/nocobase-ai/components/page-elements/page-element-provider.tsx +0 -0
- /package/{registry → src/extensions}/nocobase-ai/components/surfaces/chat-inline.tsx +0 -0
- /package/{registry → src/extensions}/nocobase-ai/components/surfaces/chat-page.tsx +0 -0
- /package/{registry → src/extensions}/nocobase-ai/components/surfaces/chat-side-panel-layout.tsx +0 -0
- /package/{registry → src/extensions}/nocobase-ai/components/surfaces/chat-surface-actions.tsx +0 -0
- /package/{registry → src/extensions}/nocobase-ai/components/tools/builtin-tool-renderers.tsx +0 -0
- /package/{registry → src/extensions}/nocobase-ai/components/tools/business-report-dialog.tsx +0 -0
- /package/{registry → src/extensions}/nocobase-ai/components/tools/business-report-renderer.tsx +0 -0
- /package/{registry → src/extensions}/nocobase-ai/components/tools/business-report-utils.tsx +0 -0
- /package/{registry → src/extensions}/nocobase-ai/components/tools/chart-renderer.tsx +0 -0
- /package/{registry → src/extensions}/nocobase-ai/components/tools/echarts-preview.tsx +0 -0
- /package/{registry → src/extensions}/nocobase-ai/components/tools/echarts-runtime-advanced.ts +0 -0
- /package/{registry → src/extensions}/nocobase-ai/components/tools/echarts-runtime-common.ts +0 -0
- /package/{registry → src/extensions}/nocobase-ai/components/tools/echarts-runtime-components.ts +0 -0
- /package/{registry → src/extensions}/nocobase-ai/components/tools/echarts-runtime-hierarchy.ts +0 -0
- /package/{registry → src/extensions}/nocobase-ai/components/tools/echarts-runtime.ts +0 -0
- /package/{registry → src/extensions}/nocobase-ai/components/tools/sub-agent-renderer.tsx +0 -0
- /package/{registry → src/extensions}/nocobase-ai/components/tools/suggestions-renderer.tsx +0 -0
- /package/{registry → src/extensions}/nocobase-ai/components/tools/tool-renderer-provider.tsx +0 -0
- /package/{registry → src/extensions}/nocobase-ai/components/tools/tool-renderer-utils.ts +0 -0
- /package/{registry → src/extensions}/nocobase-ai/components/tools/workflow-renderer.tsx +0 -0
- /package/{registry → src/extensions}/nocobase-ai/components/triggers/ai-employee-shortcut.tsx +0 -0
- /package/{registry → src/extensions}/nocobase-ai/demo/interaction-showcase.tsx +0 -0
- /package/{registry → src/extensions}/nocobase-ai/demo/page-context-prompt-generator.tsx +0 -0
- /package/{registry → src/extensions}/nocobase-ai/demo/page-context.tsx +0 -0
- /package/{registry → src/extensions}/nocobase-ai/demo/page-element-showcase.tsx +0 -0
- /package/{registry → src/extensions}/nocobase-ai/demo/prompt-card.tsx +0 -0
- /package/{registry → src/extensions}/nocobase-ai/demo/shortcut.tsx +0 -0
- /package/{registry → src/extensions}/nocobase-ai/index.ts +0 -0
- /package/{registry → src/extensions}/nocobase-ai/providers/avatars.ts +0 -0
- /package/{registry → src/extensions}/nocobase-ai/providers/chat-controller.ts +0 -0
- /package/{registry → src/extensions}/nocobase-ai/providers/chat-message-utils.ts +0 -0
- /package/{registry → src/extensions}/nocobase-ai/providers/chat-reducer.ts +0 -0
- /package/{registry → src/extensions}/nocobase-ai/providers/chat-task-utils.ts +0 -0
- /package/{registry → src/extensions}/nocobase-ai/providers/chat-transport.ts +0 -0
- /package/{registry → src/extensions}/nocobase-ai/providers/form-registry.tsx +0 -0
- /package/{registry → src/extensions}/nocobase-ai/providers/frontend-tool-registry.tsx +0 -0
- /package/{registry → src/extensions}/nocobase-ai/providers/index.ts +0 -0
- /package/{registry → src/extensions}/nocobase-ai/providers/model.ts +0 -0
- /package/{registry → src/extensions}/nocobase-ai/providers/page-context.tsx +0 -0
- /package/{registry → src/extensions}/nocobase-ai/providers/stream-coalescer.ts +0 -0
- /package/{registry → src/extensions}/nocobase-ai/providers/stream-event-utils.ts +0 -0
- /package/{registry → src/extensions}/nocobase-ai/providers/stream-parser.ts +0 -0
- /package/{registry → src/extensions}/nocobase-ai/providers/sub-agent-stream.ts +0 -0
- /package/{registry → src/extensions}/nocobase-ai/providers/types.ts +0 -0
- /package/{registry → src/extensions}/nocobase-ai/providers/ui-message-stream.ts +0 -0
- /package/{registry → src/extensions}/nocobase-ai/providers/use-automatic-tool-approval.ts +0 -0
- /package/{registry → src/extensions}/nocobase-ai/providers/use-chat-message-actions.ts +0 -0
- /package/{registry → src/extensions}/nocobase-ai/providers/use-chat-runtime.ts +0 -0
- /package/{registry → src/extensions}/nocobase-ai/providers/use-conversation-catalog.ts +0 -0
- /package/{registry → src/extensions}/nocobase-ai/providers/use-conversation-history.ts +0 -0
- /package/{registry → src/extensions}/nocobase-ai/services/index.ts +0 -0
- /package/{registry → src/extensions}/nocobase-ai/services/nocobase-ai-service.ts +0 -0
- /package/{registry → src/extensions}/nocobase-ai/services/types.ts +0 -0
- /package/{registry → src/extensions}/nocobase-route-surfaces/demo/lazy-route.tsx +0 -0
- /package/{registry → src/extensions}/nocobase-route-surfaces/demo/prompt-generator.tsx +0 -0
- /package/{registry → src/extensions}/nocobase-route-surfaces/index.ts +0 -0
- /package/{registry → src/extensions}/nocobase-route-surfaces/route-dialog.tsx +0 -0
- /package/{registry → src/extensions}/nocobase-route-surfaces/route-drawer.tsx +0 -0
- /package/{registry → src/extensions}/nocobase-route-surfaces/route-page.tsx +0 -0
- /package/{registry → src/extensions}/nocobase-route-surfaces/route-surface-context.ts +0 -0
- /package/{registry → src/extensions}/nocobase-route-surfaces/use-refine-unsaved-changes.tsx +0 -0
- /package/{registry → src/extensions}/nocobase-route-surfaces/use-route-surface-close.ts +0 -0
- /package/{registry → src/extensions}/nocobase-route-surfaces/use-route-surface-state.ts +0 -0
- /package/src/{pages/users → extensions/nocobase-users-example}/form-fields.tsx +0 -0
- /package/src/{pages/users → extensions/nocobase-users-example}/index.ts +0 -0
- /package/src/{pages/users → extensions/nocobase-users-example}/role-badges.tsx +0 -0
- /package/src/{pages/users → extensions/nocobase-users-example}/role-utils.ts +0 -0
- /package/src/{pages/users → extensions/nocobase-users-example}/types.ts +0 -0
package/.env.example
CHANGED
|
@@ -6,5 +6,10 @@ NOCOBASE_AUTHENTICATOR=basic
|
|
|
6
6
|
# Use / for root-local development, or /x/admin/ when building for storage/dist-client/x/admin.
|
|
7
7
|
NOCOBASE_PORTAL_BASE=/x/admin/
|
|
8
8
|
|
|
9
|
+
# Keep these aligned with the main NocoBase frontend when customized.
|
|
10
|
+
# API_CLIENT_STORAGE_PREFIX=NOCOBASE_
|
|
11
|
+
# API_CLIENT_STORAGE_TYPE=localStorage
|
|
12
|
+
# API_CLIENT_SHARE_TOKEN=false
|
|
13
|
+
|
|
9
14
|
# Optional for local development. Do not commit real access tokens.
|
|
10
15
|
# NOCOBASE_API_TOKEN=
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
name: Publish npm package
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
workflow_dispatch:
|
|
5
|
+
inputs:
|
|
6
|
+
version:
|
|
7
|
+
description: Exact version (leave blank to increment patch)
|
|
8
|
+
required: false
|
|
9
|
+
type: string
|
|
10
|
+
tag:
|
|
11
|
+
description: npm distribution tag
|
|
12
|
+
required: true
|
|
13
|
+
default: latest
|
|
14
|
+
type: choice
|
|
15
|
+
options:
|
|
16
|
+
- latest
|
|
17
|
+
- next
|
|
18
|
+
|
|
19
|
+
permissions:
|
|
20
|
+
contents: write
|
|
21
|
+
id-token: write
|
|
22
|
+
|
|
23
|
+
concurrency:
|
|
24
|
+
group: publish-npm-package
|
|
25
|
+
cancel-in-progress: false
|
|
26
|
+
|
|
27
|
+
jobs:
|
|
28
|
+
publish:
|
|
29
|
+
runs-on: ubuntu-latest
|
|
30
|
+
steps:
|
|
31
|
+
- name: Checkout
|
|
32
|
+
uses: actions/checkout@v4
|
|
33
|
+
with:
|
|
34
|
+
fetch-depth: 0
|
|
35
|
+
|
|
36
|
+
- name: Set up pnpm
|
|
37
|
+
uses: pnpm/action-setup@v4
|
|
38
|
+
with:
|
|
39
|
+
run_install: false
|
|
40
|
+
|
|
41
|
+
- name: Set up Node.js
|
|
42
|
+
uses: actions/setup-node@v4
|
|
43
|
+
with:
|
|
44
|
+
node-version: 24
|
|
45
|
+
cache: pnpm
|
|
46
|
+
registry-url: https://registry.npmjs.org
|
|
47
|
+
|
|
48
|
+
- name: Update npm
|
|
49
|
+
run: npm install -g npm@latest
|
|
50
|
+
|
|
51
|
+
- name: Print tool versions
|
|
52
|
+
run: |
|
|
53
|
+
node --version
|
|
54
|
+
npm --version
|
|
55
|
+
pnpm --version
|
|
56
|
+
|
|
57
|
+
- name: Install dependencies
|
|
58
|
+
run: pnpm install --frozen-lockfile
|
|
59
|
+
|
|
60
|
+
- name: Resolve release version
|
|
61
|
+
id: release
|
|
62
|
+
env:
|
|
63
|
+
REF_TYPE: ${{ github.ref_type }}
|
|
64
|
+
REQUESTED_VERSION: ${{ inputs.version }}
|
|
65
|
+
run: |
|
|
66
|
+
if [ "$REF_TYPE" != "branch" ]; then
|
|
67
|
+
echo "Run this workflow from a branch, not a tag."
|
|
68
|
+
exit 1
|
|
69
|
+
fi
|
|
70
|
+
|
|
71
|
+
if [ -n "$REQUESTED_VERSION" ]; then
|
|
72
|
+
npm version "$REQUESTED_VERSION" --no-git-tag-version
|
|
73
|
+
else
|
|
74
|
+
npm version patch --no-git-tag-version
|
|
75
|
+
fi
|
|
76
|
+
|
|
77
|
+
VERSION=$(node -p "require('./package.json').version")
|
|
78
|
+
if git rev-parse --verify --quiet "refs/tags/v${VERSION}"; then
|
|
79
|
+
echo "Git tag v${VERSION} already exists."
|
|
80
|
+
exit 1
|
|
81
|
+
fi
|
|
82
|
+
echo "version=${VERSION}" >> "$GITHUB_OUTPUT"
|
|
83
|
+
|
|
84
|
+
- name: Materialize default extensions
|
|
85
|
+
run: node scripts/registry.mjs materialize
|
|
86
|
+
|
|
87
|
+
- name: Inspect package
|
|
88
|
+
run: npm pack --dry-run
|
|
89
|
+
|
|
90
|
+
- name: Build
|
|
91
|
+
run: pnpm build
|
|
92
|
+
|
|
93
|
+
- name: Publish package
|
|
94
|
+
run: npm publish --access public --tag "${{ inputs.tag }}" --loglevel verbose
|
|
95
|
+
|
|
96
|
+
- name: Commit and tag release
|
|
97
|
+
env:
|
|
98
|
+
TARGET_BRANCH: ${{ github.ref_name }}
|
|
99
|
+
VERSION: ${{ steps.release.outputs.version }}
|
|
100
|
+
run: |
|
|
101
|
+
git config user.name "github-actions[bot]"
|
|
102
|
+
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
|
|
103
|
+
git add package.json
|
|
104
|
+
git commit -m "chore(release): v${VERSION}"
|
|
105
|
+
git tag -a "v${VERSION}" -m "v${VERSION}"
|
|
106
|
+
git push --atomic origin "HEAD:refs/heads/${TARGET_BRANCH}" "refs/tags/v${VERSION}"
|
package/.gitignore
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# Logs
|
|
2
|
+
|
|
3
|
+
logs
|
|
4
|
+
_.log
|
|
5
|
+
npm-debug.log_
|
|
6
|
+
yarn-debug.log*
|
|
7
|
+
yarn-error.log*
|
|
8
|
+
pnpm-debug.log*
|
|
9
|
+
lerna-debug.log*
|
|
10
|
+
|
|
11
|
+
node_modules
|
|
12
|
+
dist
|
|
13
|
+
dist-ssr
|
|
14
|
+
*.local
|
|
15
|
+
/.extension-state/
|
|
16
|
+
/registry.json
|
|
17
|
+
/public/r/
|
|
18
|
+
|
|
19
|
+
# Environment variables
|
|
20
|
+
.env
|
|
21
|
+
.env.local
|
|
22
|
+
|
|
23
|
+
# Editor directories and files
|
|
24
|
+
|
|
25
|
+
.vscode/_
|
|
26
|
+
!.vscode/extensions.json
|
|
27
|
+
.idea
|
|
28
|
+
.DS_Store
|
|
29
|
+
_.suo
|
|
30
|
+
_.ntvs_
|
|
31
|
+
_.njsproj
|
|
32
|
+
_.sln
|
|
33
|
+
\*.sw?
|
package/AGENTS.md
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# Application Development Guidelines
|
|
2
|
+
|
|
3
|
+
This repository is a starter for building a NocoBase-powered application. Keep changes focused on the application being built and follow these guidelines before introducing new abstractions.
|
|
4
|
+
|
|
5
|
+
## Reuse existing extensions
|
|
6
|
+
|
|
7
|
+
Before writing new code, inspect `registry` in the Registry source repository or `src/extensions` in a published template for similar pages, hooks, components, and integration patterns. Reuse an existing implementation directly when it already fits the requirement, and extend or compose it when only a small adaptation is needed.
|
|
8
|
+
|
|
9
|
+
## Customize UI components through composition
|
|
10
|
+
|
|
11
|
+
Treat `src/components/ui` as the project's shadcn/ui foundation. When application-specific behavior or styling is needed, prefer wrapping, pre-composing, or re-exporting the base component from a feature-level component instead of editing the base component directly. This keeps the base components replaceable and makes future updates easier to review.
|
|
12
|
+
|
|
13
|
+
Components copied from shadcn/ui are owned and maintained by this project; upstream changes are not applied automatically. If a base component must be changed or updated, compare it with the upstream version first, then selectively merge bug fixes and improvements while preserving intentional local behavior. Do not blindly overwrite customized components.
|
|
14
|
+
|
|
15
|
+
## Develop Portal Registry items
|
|
16
|
+
|
|
17
|
+
Canonical NocoBase Registry source lives under `registry/`. In this source repository, normal development and builds load it directly; do not copy it into `src/extensions` for preview. Imports from a Registry item to the host application must use the `@/` alias. Relative imports must stay within that Registry item's own root so the item remains portable after installation. Registry items target this Portal Template's React, shadcn Base UI, and pnpm toolchain. They must never import Ant Design or NocoBase's Ant Design-based client components.
|
|
18
|
+
|
|
19
|
+
Keep Registry items portable and focused on reusable API adapters, hooks, components, and small demos. Update `registry.config.json` whenever an item's files, dependencies, or installation target changes. Validate Registry changes with the normal application build and the relevant regression scripts.
|
package/README.MD
CHANGED
|
@@ -1,220 +1,101 @@
|
|
|
1
|
-
#
|
|
1
|
+
# NocoBase Portal Template
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
A React and shadcn/ui template for building standalone frontends backed by
|
|
4
|
+
NocoBase.
|
|
4
5
|
|
|
5
|
-
|
|
6
|
+

|
|
6
7
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
If you call a remote NocoBase instance from `http://localhost:*`, the browser may block `auth:signIn` because NocoBase requires the `X-Authenticator` request header and the remote server must explicitly allow it in CORS preflight responses. In local Vite development, prefer using the built-in dev proxy:
|
|
10
|
-
|
|
11
|
-
```env
|
|
12
|
-
NOCOBASE_API_URL=https://develop.v2.test.nocobase.com/nocobase/api/__app/cms
|
|
13
|
-
```
|
|
14
|
-
|
|
15
|
-
In development, the app auto-detects the proxy target from `NOCOBASE_API_URL` when that value is an absolute URL. The configured API URL can stay on the original sub-app path such as `/nocobase/api/__app/cms`.
|
|
16
|
-
|
|
17
|
-
Application resource names must match NocoBase collection names. The included
|
|
18
|
-
Users example targets the default `users` collection, so it works without a
|
|
19
|
-
project-specific business collection.
|
|
20
|
-
|
|
21
|
-
Application-owned React translations live in `src/locales`. The entry registers
|
|
22
|
-
an `app` namespace for business pages and augments the default `starter`
|
|
23
|
-
namespace for shared controls. Feature-specific Registry translations remain
|
|
24
|
-
inside their own extension namespace and are not mixed into application locale
|
|
25
|
-
files.
|
|
26
|
-
|
|
27
|
-
### Authentication UI
|
|
28
|
-
|
|
29
|
-
The default login page calls `authenticators:publicList` and renders every
|
|
30
|
-
enabled NocoBase authenticator that has a frontend adapter installed. Basic
|
|
31
|
-
username/password authentication is built into the Starter. Optional methods
|
|
32
|
-
are installed independently:
|
|
8
|
+
## Quick start
|
|
33
9
|
|
|
34
10
|
```bash
|
|
35
|
-
pnpm
|
|
36
|
-
|
|
37
|
-
pnpm
|
|
38
|
-
pnpm exec shadcn add @nocobase/auth-saml
|
|
39
|
-
pnpm exec shadcn add @nocobase/auth-cas
|
|
40
|
-
pnpm exec shadcn add @nocobase/auth-wecom
|
|
41
|
-
pnpm exec shadcn add @nocobase/auth-dingtalk
|
|
11
|
+
pnpm install
|
|
12
|
+
cp .env.example .env.local
|
|
13
|
+
pnpm dev
|
|
42
14
|
```
|
|
43
15
|
|
|
44
|
-
The
|
|
45
|
-
boundaries below. Each optional authentication Registry adds its own component
|
|
46
|
-
Demo under the same Authentication menu when installed.
|
|
16
|
+
The development server starts at `http://localhost:5173` by default.
|
|
47
17
|
|
|
48
|
-
|
|
49
|
-
default dynamic page with:
|
|
18
|
+
## Configuration
|
|
50
19
|
|
|
51
|
-
|
|
52
|
-
import { DefaultSignInPage } from "@/components/auth/default-sign-in-page"
|
|
20
|
+
The minimum local configuration is:
|
|
53
21
|
|
|
54
|
-
|
|
22
|
+
```env
|
|
23
|
+
NOCOBASE_API_URL=/api
|
|
24
|
+
NOCOBASE_PORTAL_BASE=/
|
|
55
25
|
```
|
|
56
26
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
function CompanyOidcButton({ authenticator }) {
|
|
66
|
-
const oidc = useOidcSignIn(authenticator)
|
|
67
|
-
return <Button onClick={oidc.signIn}>Company SSO</Button>
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
export const Login = () => (
|
|
71
|
-
<DefaultSignInPage
|
|
72
|
-
renderAuthenticator={({ authenticator, defaultElement }) =>
|
|
73
|
-
authenticator.name === "company-oidc" ? (
|
|
74
|
-
<CompanyOidcButton authenticator={authenticator} />
|
|
75
|
-
) : (
|
|
76
|
-
defaultElement
|
|
77
|
-
)
|
|
78
|
-
}
|
|
79
|
-
/>
|
|
80
|
-
)
|
|
81
|
-
```
|
|
27
|
+
- `NOCOBASE_API_URL` is the NocoBase REST API root and must include `/api`.
|
|
28
|
+
Same-origin deployments normally use `/api`. During local development, an
|
|
29
|
+
absolute URL is handled through the Vite proxy.
|
|
30
|
+
- `NOCOBASE_PORTAL_BASE` is the public path where the Portal is mounted. Use
|
|
31
|
+
`/` for root development or set the deployment path before building.
|
|
32
|
+
- `NOCOBASE_API_TOKEN` can provide a temporary development token. Never commit
|
|
33
|
+
real tokens.
|
|
82
34
|
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
do not depend on `DefaultSignInPage`.
|
|
87
|
-
|
|
88
|
-
```tsx
|
|
89
|
-
import { AuthLayout } from "@/components/auth/auth-layout"
|
|
90
|
-
import { BasicSignInForm } from "@/components/auth"
|
|
91
|
-
|
|
92
|
-
export const Login = () => (
|
|
93
|
-
<AuthLayout title="Sign in" description="Continue to your workspace.">
|
|
94
|
-
<BasicSignInForm
|
|
95
|
-
authenticator={{
|
|
96
|
-
name: "basic",
|
|
97
|
-
authType: "Email/Password",
|
|
98
|
-
}}
|
|
99
|
-
/>
|
|
100
|
-
</AuthLayout>
|
|
101
|
-
)
|
|
102
|
-
```
|
|
35
|
+
The Portal uses the same authentication storage convention as NocoBase. If the
|
|
36
|
+
server customizes it, keep `API_CLIENT_STORAGE_PREFIX`,
|
|
37
|
+
`API_CLIENT_STORAGE_TYPE`, and `API_CLIENT_SHARE_TOKEN` aligned with the server.
|
|
103
38
|
|
|
104
|
-
##
|
|
105
|
-
|
|
106
|
-
### Running the development server.
|
|
39
|
+
## Development
|
|
107
40
|
|
|
108
41
|
```bash
|
|
42
|
+
# Start the Vite development server
|
|
109
43
|
pnpm dev
|
|
110
|
-
```
|
|
111
44
|
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
```bash
|
|
45
|
+
# Build the production assets
|
|
115
46
|
pnpm build
|
|
116
|
-
```
|
|
117
|
-
|
|
118
|
-
### Extensions and the NocoBase Shadcn Registry
|
|
119
|
-
|
|
120
|
-
The starter separates framework-owned extension support from installed Registry
|
|
121
|
-
source:
|
|
122
47
|
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
its providers, Refine resources, and routes to the app.
|
|
126
|
-
- `registry/<name>` contains the canonical authoring source for a Registry
|
|
127
|
-
package while it is developed in this repository.
|
|
128
|
-
- `src/extensions/<name>` contains installed, application-owned source.
|
|
129
|
-
Downstream applications can commit this directory like any other source code.
|
|
130
|
-
|
|
131
|
-
`registry.config.json` is the only authoring manifest. In addition to standard
|
|
132
|
-
Shadcn Registry item fields, each item has a local `source` mapping used to
|
|
133
|
-
generate its standard `files` array. The same mapping lets the starter's
|
|
134
|
-
`postinstall` hook copy a locally authored extension only when its target is
|
|
135
|
-
missing. Existing installed source is never compared, updated, or overwritten.
|
|
136
|
-
Optional entries can set `source.install` to `false`; they remain available to
|
|
137
|
-
Registry builds and local previews but are not added by `postinstall`.
|
|
138
|
-
|
|
139
|
-
You can run the same missing-only installation explicitly with:
|
|
140
|
-
|
|
141
|
-
```bash
|
|
142
|
-
pnpm registry:install
|
|
143
|
-
```
|
|
144
|
-
|
|
145
|
-
This repository authors optional NocoBase integration entries. Internationalization
|
|
146
|
-
is delivered as one cohesive Registry entry:
|
|
147
|
-
|
|
148
|
-
- `i18n` extends the Starter's built-in translation provider and shared System
|
|
149
|
-
Settings bootstrap with selected server-generated namespaces such as
|
|
150
|
-
`lm-collections`, user locale persistence, the language switcher, and the
|
|
151
|
-
lazy-loaded showcase with its prompt generator.
|
|
152
|
-
|
|
153
|
-
The AI integration is available through four incremental entries:
|
|
154
|
-
|
|
155
|
-
- `ai-runtime` provides AI services, providers, transports, and
|
|
156
|
-
controllers. Its NocoBase requests use the starter's shared
|
|
157
|
-
`src/lib/nocobase/client.ts` client.
|
|
158
|
-
- `ai-chat` adds the reusable chat components and depends on the
|
|
159
|
-
runtime entry.
|
|
160
|
-
- `ai-react-hook-form` adds the optional React Hook Form adapter for the fixed
|
|
161
|
-
Form filler Tool.
|
|
162
|
-
- `ai` adds the application extension integration and Demo pages and depends on the
|
|
163
|
-
chat entry.
|
|
164
|
-
|
|
165
|
-
To refresh the local preview from the canonical Registry source, run:
|
|
48
|
+
# Serve a production build
|
|
49
|
+
pnpm start
|
|
166
50
|
|
|
167
|
-
|
|
168
|
-
pnpm
|
|
51
|
+
# Build a standalone HTML artifact
|
|
52
|
+
pnpm build:html
|
|
169
53
|
```
|
|
170
54
|
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
`pnpm registry:install` do not overwrite an installed extension.
|
|
55
|
+
Application pages and resources live under `src`. The included Users page is a
|
|
56
|
+
working example based on the standard NocoBase `users` collection.
|
|
174
57
|
|
|
175
|
-
|
|
58
|
+
Application translations live in `src/locales`. Shared UI components live in
|
|
59
|
+
`src/components/ui` and follow the shadcn Base UI conventions.
|
|
176
60
|
|
|
177
|
-
|
|
178
|
-
pnpm registry:build
|
|
179
|
-
```
|
|
61
|
+
## Extensions
|
|
180
62
|
|
|
181
|
-
|
|
182
|
-
|
|
63
|
+
Installed extensions live in `src/extensions` and are ordinary
|
|
64
|
+
application-owned source files. Their providers, resources, routes, login
|
|
65
|
+
adapters, and user-menu items are discovered automatically.
|
|
183
66
|
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
67
|
+
Optional NocoBase integrations, including authentication methods and i18n, can
|
|
68
|
+
be installed from the `@nocobase` Registry configured in `components.json`.
|
|
69
|
+
After installation, the generated source can be customized and committed with
|
|
70
|
+
the application.
|
|
187
71
|
|
|
188
|
-
|
|
72
|
+
In this Registry source repository, canonical extension source lives in
|
|
73
|
+
`registry` and is loaded directly by `pnpm dev` and `pnpm build`. The published
|
|
74
|
+
npm template contains the default extensions under `src/extensions` instead.
|
|
189
75
|
|
|
190
|
-
|
|
191
|
-
pnpm dlx shadcn@latest add @nocobase/i18n
|
|
192
|
-
```
|
|
76
|
+
## Authentication
|
|
193
77
|
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
to accept the Registry version explicitly.
|
|
78
|
+
Basic username or email and password login is built in. The default login page
|
|
79
|
+
also renders enabled NocoBase authentication methods when their frontend
|
|
80
|
+
Registry adapters are installed.
|
|
198
81
|
|
|
199
|
-
|
|
200
|
-
`
|
|
201
|
-
|
|
202
|
-
packages without adding package-specific logic to `App.tsx` or the installer.
|
|
82
|
+
Customize `src/pages/login/index.tsx` to replace the whole login page, or use
|
|
83
|
+
`DefaultSignInPage` to keep dynamic authentication while overriding individual
|
|
84
|
+
authenticator UI.
|
|
203
85
|
|
|
204
|
-
|
|
86
|
+
## Tests
|
|
205
87
|
|
|
206
88
|
```bash
|
|
207
|
-
pnpm
|
|
89
|
+
pnpm test:auth
|
|
90
|
+
pnpm test:acl
|
|
91
|
+
pnpm test:i18n
|
|
208
92
|
```
|
|
209
93
|
|
|
210
|
-
## Learn
|
|
211
|
-
|
|
212
|
-
To learn more about **Refine**, please check out the [Documentation](https://refine.dev/docs)
|
|
94
|
+
## Learn more
|
|
213
95
|
|
|
214
|
-
-
|
|
215
|
-
-
|
|
216
|
-
-
|
|
217
|
-
- **Custom Auth Provider** [Docs](https://refine.dev/docs/core/providers/auth-provider/)
|
|
96
|
+
- [NocoBase documentation](https://docs.nocobase.com/)
|
|
97
|
+
- [Refine documentation](https://refine.dev/docs/)
|
|
98
|
+
- [shadcn/ui documentation](https://ui.shadcn.com/)
|
|
218
99
|
|
|
219
100
|
## License
|
|
220
101
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nocobase/portal-template-default",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.10",
|
|
4
|
+
"packageManager": "pnpm@10.28.0",
|
|
4
5
|
"type": "module",
|
|
5
6
|
"devDependencies": {
|
|
6
7
|
"@ai-sdk/react": "2.0.0",
|
|
@@ -77,13 +78,10 @@
|
|
|
77
78
|
"url": "git+https://github.com/nocobase/portal-template-default.git"
|
|
78
79
|
},
|
|
79
80
|
"scripts": {
|
|
80
|
-
"postinstall": "node ./scripts/registry.mjs install-missing",
|
|
81
81
|
"dev": "vite",
|
|
82
82
|
"build": "tsc && refine build",
|
|
83
83
|
"build:html": "node ./scripts/build-html.mjs",
|
|
84
|
-
"
|
|
85
|
-
"registry:preview": "node ./scripts/registry.mjs preview",
|
|
86
|
-
"registry:build": "node ./scripts/registry.mjs build && shadcn build ./registry.json -o ./public/r",
|
|
84
|
+
"test:auth": "node tests/auth-session-regression.mjs",
|
|
87
85
|
"test:acl": "node registry/nocobase-acl/tests/acl-regression.mjs",
|
|
88
86
|
"test:i18n": "node registry/nocobase-i18n/tests/i18n-regression.mjs",
|
|
89
87
|
"start": "refine start",
|
package/scripts/build-html.mjs
CHANGED
|
@@ -65,6 +65,15 @@ const stripExistingRuntimeConfig = (html) => {
|
|
|
65
65
|
|
|
66
66
|
const portalBase = normalizePortalBase(process.env.NOCOBASE_PORTAL_BASE);
|
|
67
67
|
const apiUrl = String(process.env.NOCOBASE_API_URL || "/api").trim() || "/api";
|
|
68
|
+
const storagePrefix =
|
|
69
|
+
String(process.env.API_CLIENT_STORAGE_PREFIX || "NOCOBASE_").trim() ||
|
|
70
|
+
"NOCOBASE_";
|
|
71
|
+
const storageType =
|
|
72
|
+
String(process.env.API_CLIENT_STORAGE_TYPE || "localStorage").trim() ||
|
|
73
|
+
"localStorage";
|
|
74
|
+
const shareToken = /^true$/i.test(
|
|
75
|
+
String(process.env.API_CLIENT_SHARE_TOKEN || "false").trim()
|
|
76
|
+
);
|
|
68
77
|
|
|
69
78
|
if (!fs.existsSync(rawIndexPath)) {
|
|
70
79
|
throw new Error(
|
|
@@ -76,6 +85,9 @@ const runtimeConfig = `${startMarker}
|
|
|
76
85
|
<script>
|
|
77
86
|
window.NOCOBASE_PORTAL_BASE = ${JSON.stringify(portalBase)};
|
|
78
87
|
window.NOCOBASE_API_URL = ${JSON.stringify(apiUrl)};
|
|
88
|
+
window.__nocobase_api_client_storage_prefix__ = ${JSON.stringify(storagePrefix)};
|
|
89
|
+
window.__nocobase_api_client_storage_type__ = ${JSON.stringify(storageType)};
|
|
90
|
+
window.__nocobase_api_client_share_token__ = ${JSON.stringify(shareToken)};
|
|
79
91
|
</script>
|
|
80
92
|
${endMarker}
|
|
81
93
|
`;
|