create-windy 0.2.33 → 0.3.0
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/dist/cli.js +173 -17
- package/package.json +1 -1
- package/template/.agents/skills/windy-business-module/SKILL.md +10 -1
- package/template/.windy-template.json +2 -2
- package/template/AGENTS.md +9 -0
- package/template/README.md +3 -1
- package/template/apps/agent-server/Dockerfile +1 -0
- package/template/apps/agent-server/README.md +28 -5
- package/template/apps/agent-server/adk_web_agents/__init__.py +1 -0
- package/template/apps/agent-server/adk_web_agents/safe_debug/__init__.py +3 -0
- package/template/apps/agent-server/adk_web_agents/safe_debug/agent.py +40 -0
- package/template/apps/agent-server/pyproject.toml +1 -1
- package/template/apps/agent-server/src/southwind_agent_server/adk_adapter.py +191 -16
- package/template/apps/agent-server/src/southwind_agent_server/adk_failure.py +13 -0
- package/template/apps/agent-server/src/southwind_agent_server/adk_model.py +225 -0
- package/template/apps/agent-server/src/southwind_agent_server/adk_tools.py +76 -0
- package/template/apps/agent-server/src/southwind_agent_server/app.py +63 -3
- package/template/apps/agent-server/src/southwind_agent_server/contracts.py +35 -0
- package/template/apps/agent-server/src/southwind_agent_server/engine.py +2 -0
- package/template/apps/agent-server/src/southwind_agent_server/openai_engine.py +31 -3
- package/template/apps/agent-server/src/southwind_agent_server/openai_provider.py +22 -9
- package/template/apps/agent-server/src/southwind_agent_server/provider_audit.py +144 -0
- package/template/apps/agent-server/src/southwind_agent_server/provider_governance.py +227 -0
- package/template/apps/agent-server/src/southwind_agent_server/service.py +1 -0
- package/template/apps/agent-server/tests/test_adk_adapter.py +305 -0
- package/template/apps/agent-server/tests/test_adk_web_agent.py +12 -0
- package/template/apps/agent-server/tests/test_api.py +16 -1
- package/template/apps/agent-server/tests/test_openai_provider.py +79 -0
- package/template/apps/agent-server/tests/test_provider_governance.py +215 -0
- package/template/apps/server/package.json +4 -1
- package/template/apps/server/src/agent/provider-input-governance.test.ts +82 -0
- package/template/apps/server/src/agent/provider-input-governance.ts +140 -0
- package/template/apps/server/src/agent/remote-runtime.test.ts +22 -0
- package/template/apps/server/src/agent/remote-runtime.ts +1 -0
- package/template/apps/server/src/agent/run-contracts.ts +2 -0
- package/template/apps/server/src/agent/run-facade.test.ts +52 -2
- package/template/apps/server/src/agent/run-facade.ts +38 -9
- package/template/apps/server/src/agent/tool-registry.ts +2 -6
- package/template/apps/server/src/application-services.ts +50 -0
- package/template/apps/server/src/audit/drizzle-log-store.ts +25 -0
- package/template/apps/server/src/audit/search-summary.ts +2 -6
- package/template/apps/server/src/auth/credential-restriction.ts +1 -0
- package/template/apps/server/src/auth/password.ts +30 -21
- package/template/apps/server/src/auth/routes.test.ts +44 -3
- package/template/apps/server/src/auth/routes.ts +6 -1
- package/template/apps/server/src/auth/runtime.ts +4 -1
- package/template/apps/server/src/auth/service.ts +25 -7
- package/template/apps/server/src/configuration/bootstrap.ts +20 -1
- package/template/apps/server/src/configuration/definition.test.ts +71 -0
- package/template/apps/server/src/configuration/definition.ts +242 -12
- package/template/apps/server/src/configuration/drizzle-repository.ts +36 -2
- package/template/apps/server/src/configuration/repository.ts +27 -2
- package/template/apps/server/src/configuration/routes.ts +4 -1
- package/template/apps/server/src/configuration/service.test.ts +100 -0
- package/template/apps/server/src/configuration/service.ts +50 -10
- package/template/apps/server/src/data-access/scoped-repository.integration.test.ts +3 -2
- package/template/apps/server/src/data-governance/export/service.ts +2 -6
- package/template/apps/server/src/example-modules.ts +4 -1
- package/template/apps/server/src/guards.ts +18 -5
- package/template/apps/server/src/http/request-source.test.ts +85 -0
- package/template/apps/server/src/http/request-source.ts +90 -0
- package/template/apps/server/src/index.ts +45 -45
- package/template/apps/server/src/license/routes.ts +2 -0
- package/template/apps/server/src/license/runtime-service.ts +10 -11
- package/template/apps/server/src/module-bootstrap.ts +2 -2
- package/template/apps/server/src/module-host/initialize-contracts.ts +6 -0
- package/template/apps/server/src/module-host/initialize.ts +30 -44
- package/template/apps/server/src/module-host/request-context.ts +29 -23
- package/template/apps/server/src/module-host/resource-file-policies.test.ts +197 -0
- package/template/apps/server/src/module-host/resource-file-policies.ts +108 -0
- package/template/apps/server/src/module-host/route-declaration.ts +45 -0
- package/template/apps/server/src/module-host/route-installer.ts +27 -3
- package/template/apps/server/src/module-host/storage-port.test.ts +170 -1
- package/template/apps/server/src/module-host/storage-port.ts +134 -1
- package/template/apps/server/src/module-host/storage-scope.ts +89 -0
- package/template/apps/server/src/module-host/tool-handlers.test.ts +305 -0
- package/template/apps/server/src/module-host/tool-handlers.ts +38 -4
- package/template/apps/server/src/module-host/user-directory-composition.test.ts +126 -0
- package/template/apps/server/src/module-host/user-directory-port.test.ts +238 -0
- package/template/apps/server/src/module-host/user-directory-port.ts +139 -0
- package/template/apps/server/src/module-host.ts +4 -0
- package/template/apps/server/src/notification/channel-adapter.ts +46 -0
- package/template/apps/server/src/notification/delivery-policy.test.ts +59 -0
- package/template/apps/server/src/notification/delivery-policy.ts +37 -0
- package/template/apps/server/src/notification/delivery-repository.ts +198 -0
- package/template/apps/server/src/notification/delivery-worker.test.ts +87 -0
- package/template/apps/server/src/notification/delivery-worker.ts +88 -0
- package/template/apps/server/src/notification/drizzle-management.ts +180 -0
- package/template/apps/server/src/notification/drizzle-query.ts +160 -0
- package/template/apps/server/src/notification/drizzle-repository.integration.test.ts +301 -0
- package/template/apps/server/src/notification/drizzle-repository.ts +156 -90
- package/template/apps/server/src/notification/extension-routes.test.ts +119 -0
- package/template/apps/server/src/notification/extension-routes.ts +111 -0
- package/template/apps/server/src/notification/memory-delivery-repository.ts +137 -0
- package/template/apps/server/src/notification/memory-support.ts +72 -0
- package/template/apps/server/src/notification/preference-repository.ts +95 -0
- package/template/apps/server/src/notification/recipient-directory.ts +104 -0
- package/template/apps/server/src/notification/repository.test.ts +171 -0
- package/template/apps/server/src/notification/repository.ts +179 -32
- package/template/apps/server/src/notification/revision-routes.test.ts +186 -0
- package/template/apps/server/src/notification/route-support.ts +225 -0
- package/template/apps/server/src/notification/routes.test.ts +182 -0
- package/template/apps/server/src/notification/routes.ts +225 -132
- package/template/apps/server/src/notification/service.test.ts +104 -0
- package/template/apps/server/src/notification/service.ts +140 -0
- package/template/apps/server/src/notification/smtp-adapter.test.ts +65 -0
- package/template/apps/server/src/notification/smtp-adapter.ts +68 -0
- package/template/apps/server/src/persistence.integration.test.ts +41 -2
- package/template/apps/server/src/route-guards.ts +1 -0
- package/template/apps/server/src/runtime-audit-list.test.ts +39 -0
- package/template/apps/server/src/runtime-development.ts +2 -0
- package/template/apps/server/src/runtime.test.ts +23 -9
- package/template/apps/server/src/runtime.ts +39 -2
- package/template/apps/server/src/scheduler/audit.ts +2 -11
- package/template/apps/server/src/scheduler/definitions.test.ts +6 -0
- package/template/apps/server/src/scheduler/definitions.ts +7 -0
- package/template/apps/server/src/scheduler/recovery-service.ts +2 -11
- package/template/apps/server/src/scheduler/routes.ts +2 -7
- package/template/apps/server/src/search/opensearch-client.test.ts +45 -0
- package/template/apps/server/src/search/opensearch-client.ts +145 -0
- package/template/apps/server/src/search/service.ts +2 -6
- package/template/apps/server/src/settings/routes.ts +15 -3
- package/template/apps/server/src/settings/runtime.ts +10 -1
- package/template/apps/server/src/storage/runtime.ts +13 -0
- package/template/apps/server/src/system/audit-query.ts +33 -4
- package/template/apps/server/src/system/audit-routes.test.ts +58 -4
- package/template/apps/server/src/system/audit-routes.ts +6 -5
- package/template/apps/server/src/system/built-in-roles.ts +1 -0
- package/template/apps/server/src/system/department-organization.ts +320 -0
- package/template/apps/server/src/system/department-routes.test.ts +207 -48
- package/template/apps/server/src/system/department-routes.ts +114 -33
- package/template/apps/server/src/system/drizzle-repository.ts +15 -7
- package/template/apps/server/src/system/drizzle-scoped-repository.ts +5 -3
- package/template/apps/server/src/system/drizzle-system.ts +37 -9
- package/template/apps/server/src/system/drizzle-transaction-context.ts +14 -0
- package/template/apps/server/src/system/identity-route-config.ts +7 -2
- package/template/apps/server/src/system/mutation-runner.ts +23 -0
- package/template/apps/server/src/system/organization-postgres.integration.test.ts +176 -0
- package/template/apps/server/src/system/resource-access-response.ts +12 -6
- package/template/apps/server/src/system/role-department-scope-policy.ts +55 -0
- package/template/apps/server/src/system/route-helpers.ts +2 -5
- package/template/apps/server/src/system/route-types.ts +12 -3
- package/template/apps/server/src/system/routes-validation.test.ts +26 -0
- package/template/apps/server/src/system/routes.test.ts +10 -2
- package/template/apps/server/src/system/routes.ts +70 -36
- package/template/apps/server/src/system/seed.ts +7 -0
- package/template/apps/server/src/work-order/data-scope.integration.test.ts +9 -2
- package/template/apps/server/src/work-order/opensearch-index.test.ts +97 -0
- package/template/apps/server/src/work-order/opensearch-index.ts +313 -0
- package/template/apps/server/src/work-order/search-provider.ts +60 -1
- package/template/apps/server/src/work-order/service.ts +42 -10
- package/template/apps/web/src/app/error-pages.ts +9 -0
- package/template/apps/web/src/components/auth/PasswordChangeForm.vue +16 -11
- package/template/apps/web/src/components/auth/PasswordChangeForm.webtest.ts +14 -0
- package/template/apps/web/src/components/common/FormDialog.vue +16 -2
- package/template/apps/web/src/components/common/ModalLayout.webtest.ts +20 -1
- package/template/apps/web/src/composables/useGlobalSearch.ts +68 -0
- package/template/apps/web/src/composables/usePlatformSettings.ts +8 -7
- package/template/apps/web/src/layout/GlobalSearchResults.vue +58 -0
- package/template/apps/web/src/layout/NavigationSearchDialog.vue +42 -6
- package/template/apps/web/src/layout/NavigationSearchDialog.webtest.ts +71 -0
- package/template/apps/web/src/layout/NotificationMenu.vue +73 -31
- package/template/apps/web/src/layout/NotificationMenu.webtest.ts +44 -1
- package/template/apps/web/src/layout/NotificationMenuItem.vue +61 -0
- package/template/apps/web/src/layout/NotificationPreferencesDialog.vue +181 -0
- package/template/apps/web/src/layout/NotificationPreferencesDialog.webtest.ts +80 -0
- package/template/apps/web/src/lib/date-time.ts +22 -10
- package/template/apps/web/src/lib/date-time.webtest.ts +9 -1
- package/template/apps/web/src/main.ts +14 -1
- package/template/apps/web/src/pages/auth/ChangePasswordPage.vue +16 -1
- package/template/apps/web/src/pages/configuration/components/ModuleConfigVersionList.vue +1 -0
- package/template/apps/web/src/pages/configuration/components/ModuleConfigurationEditor.vue +10 -0
- package/template/apps/web/src/pages/configuration/components/ModuleConfigurationWorkbench.vue +37 -6
- package/template/apps/web/src/pages/errors/PlatformErrorPage.vue +115 -0
- package/template/apps/web/src/pages/errors/PlatformErrorPage.webtest.ts +44 -0
- package/template/apps/web/src/pages/errors/error-page-extension.ts +26 -0
- package/template/apps/web/src/pages/system/SystemNotificationsPage.vue +136 -68
- package/template/apps/web/src/pages/system/SystemNotificationsPage.webtest.ts +224 -12
- package/template/apps/web/src/pages/system/audit-log-presenter.ts +86 -0
- package/template/apps/web/src/pages/system/audit-time-range.ts +28 -0
- package/template/apps/web/src/pages/system/components/AuditActionCell.vue +10 -69
- package/template/apps/web/src/pages/system/components/AuditActionCell.webtest.ts +20 -27
- package/template/apps/web/src/pages/system/components/AuditLogDetailDialog.vue +134 -0
- package/template/apps/web/src/pages/system/components/AuditLogDetailDialog.webtest.ts +76 -0
- package/template/apps/web/src/pages/system/components/AuditLogFilters.vue +116 -52
- package/template/apps/web/src/pages/system/components/AuditLogFilters.webtest.ts +52 -15
- package/template/apps/web/src/pages/system/components/NotificationHistoryDialog.vue +129 -0
- package/template/apps/web/src/pages/system/components/NotificationManagementCard.vue +91 -0
- package/template/apps/web/src/pages/system/components/NotificationPublishDialog.vue +121 -0
- package/template/apps/web/src/pages/system/components/NotificationPublishForm.vue +162 -1
- package/template/apps/web/src/pages/system/components/SystemResourceActions.vue +68 -0
- package/template/apps/web/src/pages/system/components/SystemResourceEditor.vue +74 -0
- package/template/apps/web/src/pages/system/components/SystemResourceFilters.vue +3 -4
- package/template/apps/web/src/pages/system/components/SystemResourcePage.vue +91 -98
- package/template/apps/web/src/pages/system/components/SystemResourcePage.webtest.ts +68 -0
- package/template/apps/web/src/pages/system/components/SystemResourceTable.vue +20 -1
- package/template/apps/web/src/pages/system/components/SystemResourceTable.webtest.ts +28 -7
- package/template/apps/web/src/pages/system/components/department/DepartmentOrganizationForm.vue +210 -0
- package/template/apps/web/src/pages/system/components/department/DepartmentTransitionDialog.vue +112 -0
- package/template/apps/web/src/pages/system/components/user-account/UserAccountForm.vue +17 -4
- package/template/apps/web/src/pages/system/composables/useDepartmentTransitions.ts +79 -0
- package/template/apps/web/src/pages/system/composables/useNotificationPermissions.ts +14 -0
- package/template/apps/web/src/pages/system/composables/useSystemResource.ts +2 -0
- package/template/apps/web/src/pages/system/composables/useSystemResource.webtest.ts +15 -2
- package/template/apps/web/src/pages/system/resource-config.ts +12 -4
- package/template/apps/web/src/router/error-navigation.ts +50 -0
- package/template/apps/web/src/router/error-navigation.webtest.ts +106 -0
- package/template/apps/web/src/router/index.ts +71 -0
- package/template/apps/web/src/router/index.webtest.ts +29 -0
- package/template/apps/web/src/router/manifest-routes.webtest.ts +4 -0
- package/template/apps/web/src/router/shared-scaffold-neutrality.webtest.ts +12 -0
- package/template/apps/web/src/services/auth-api.ts +5 -0
- package/template/apps/web/src/services/http.ts +43 -6
- package/template/apps/web/src/services/http.webtest.ts +70 -0
- package/template/apps/web/src/services/notification-api.ts +85 -2
- package/template/apps/web/src/services/notification-api.webtest.ts +110 -0
- package/template/apps/web/src/services/search-api.ts +39 -0
- package/template/apps/web/src/services/system-api.ts +18 -0
- package/template/apps/web/vitest.config.ts +1 -0
- package/template/docker-compose.yml +68 -0
- package/template/docs/architecture/ai-egress.md +49 -7
- package/template/docs/architecture/ai-runtime.md +34 -6
- package/template/docs/architecture/data-scope-query-enforcement.md +4 -0
- package/template/docs/architecture/object-storage.md +22 -2
- package/template/docs/architecture/search-provider-protocol.md +38 -2
- package/template/docs/development/custom-error-pages.md +78 -0
- package/template/docs/development/custom-login-page.md +3 -3
- package/template/docs/platform/agent-runtime.md +76 -7
- package/template/docs/platform/audit-reliability.md +46 -2
- package/template/docs/platform/business-user-directory.md +82 -0
- package/template/docs/platform/module-configuration.md +13 -4
- package/template/docs/platform/notifications.md +67 -11
- package/template/docs/platform/organization-membership.md +17 -3
- package/template/docs/platform/system-crud-api.md +16 -0
- package/template/docs/platform/web-system-crud.md +6 -2
- package/template/package.json +4 -0
- package/template/packages/config/index.test.ts +45 -0
- package/template/packages/config/package.json +1 -1
- package/template/packages/config/src/platform.ts +169 -48
- package/template/packages/database/drizzle/0035_material_nightshade.sql +10 -0
- package/template/packages/database/drizzle/0036_hesitant_speed.sql +35 -0
- package/template/packages/database/drizzle/0037_absent_nick_fury.sql +2 -0
- package/template/packages/database/drizzle/0038_uneven_wasp.sql +38 -0
- package/template/packages/database/drizzle/meta/0035_snapshot.json +7331 -0
- package/template/packages/database/drizzle/meta/0036_snapshot.json +7436 -0
- package/template/packages/database/drizzle/meta/0037_snapshot.json +7457 -0
- package/template/packages/database/drizzle/meta/0038_snapshot.json +7749 -0
- package/template/packages/database/drizzle/meta/_journal.json +28 -0
- package/template/packages/database/package.json +1 -1
- package/template/packages/database/src/schema/identity.ts +7 -0
- package/template/packages/database/src/schema/notifications.ts +135 -0
- package/template/packages/database/src/schema-notification-delivery.test.ts +54 -0
- package/template/packages/database/src/schema-workflow-notification.test.ts +40 -1
- package/template/packages/modules/package.json +1 -1
- package/template/packages/modules/src/ai-operation-composition.test.ts +68 -0
- package/template/packages/modules/src/ai-operation-composition.ts +115 -0
- package/template/packages/modules/src/manifest.ts +26 -0
- package/template/packages/modules/src/provider-data-policy-composition.test.ts +74 -0
- package/template/packages/modules/src/system-api-permissions.ts +54 -0
- package/template/packages/modules/src/system-audit-actions.ts +15 -0
- package/template/packages/modules/src/system-features.ts +6 -1
- package/template/packages/modules/src/system-module-catalog.test.ts +16 -0
- package/template/packages/modules/src/system-module-catalog.ts +28 -4
- package/template/packages/modules/src/system-modules.test.ts +13 -1
- package/template/packages/modules/src/system-modules.ts +12 -0
- package/template/packages/modules/src/system-permissions.ts +11 -5
- package/template/packages/server-sdk/index.ts +11 -0
- package/template/packages/server-sdk/package.json +3 -2
- package/template/packages/server-sdk/src/ai-operation-registration.ts +2 -1
- package/template/packages/server-sdk/src/module-host.ts +8 -0
- package/template/packages/server-sdk/src/request-context.ts +2 -0
- package/template/packages/server-sdk/src/storage-port.ts +66 -0
- package/template/packages/server-sdk/src/tool-registration.ts +6 -0
- package/template/packages/server-sdk/src/user-directory-port.ts +42 -0
- package/template/packages/shared/package.json +1 -1
- package/template/packages/shared/src/audit.ts +25 -0
- package/template/packages/shared/src/module-configuration.ts +5 -0
- package/template/packages/shared/src/notification.ts +92 -1
- package/template/packages/shared/src/password.ts +7 -2
- package/template/packages/shared/src/platform-settings.ts +2 -0
- package/template/packages/storage/package.json +1 -1
- package/template/packages/storage/src/upload-service.test.ts +16 -0
- package/template/packages/storage/src/upload-service.ts +5 -1
- package/template/scripts/notification-postgres-regression.ts +27 -0
|
@@ -29,6 +29,51 @@ test("平台 Redis 与 RuoYi 旧 Redis 使用独立 SecretResolver 配置", () =
|
|
|
29
29
|
);
|
|
30
30
|
});
|
|
31
31
|
|
|
32
|
+
test("平台设置提供类型化默认值并校验 IANA 时区", () => {
|
|
33
|
+
const config = loadPlatformConfig({});
|
|
34
|
+
|
|
35
|
+
expect(config.security).toMatchObject({
|
|
36
|
+
sessionTtlSeconds: 28_800,
|
|
37
|
+
passwordMinLength: 12,
|
|
38
|
+
passwordMaxLength: 128,
|
|
39
|
+
});
|
|
40
|
+
expect(config.storage).toEqual({
|
|
41
|
+
bulkDataMaxByteSize: 512 * 1024 * 1024,
|
|
42
|
+
brandingLogoMaxByteSize: 5 * 1024 * 1024,
|
|
43
|
+
});
|
|
44
|
+
expect(config.mail).toMatchObject({
|
|
45
|
+
enabled: false,
|
|
46
|
+
port: 587,
|
|
47
|
+
secure: false,
|
|
48
|
+
});
|
|
49
|
+
expect(config.regional.timeZone).toBe("Asia/Shanghai");
|
|
50
|
+
expect(() =>
|
|
51
|
+
loadPlatformConfig({ REGIONAL_TIME_ZONE: "Invalid/Timezone" }),
|
|
52
|
+
).toThrow(
|
|
53
|
+
expect.objectContaining<Partial<ConfigLoadError>>({
|
|
54
|
+
code: "CONFIG_INVALID_VALUE",
|
|
55
|
+
fieldPath: "regional.timeZone",
|
|
56
|
+
}),
|
|
57
|
+
);
|
|
58
|
+
expect(() =>
|
|
59
|
+
loadPlatformConfig({
|
|
60
|
+
PASSWORD_MIN_LENGTH: "64",
|
|
61
|
+
PASSWORD_MAX_LENGTH: "32",
|
|
62
|
+
}),
|
|
63
|
+
).toThrow(
|
|
64
|
+
expect.objectContaining<Partial<ConfigLoadError>>({
|
|
65
|
+
code: "CONFIG_INVALID_VALUE",
|
|
66
|
+
fieldPath: "security.passwordMinLength",
|
|
67
|
+
}),
|
|
68
|
+
);
|
|
69
|
+
expect(() => loadPlatformConfig({ MAIL_ENABLED: "true" })).toThrow(
|
|
70
|
+
expect.objectContaining<Partial<ConfigLoadError>>({
|
|
71
|
+
code: "CONFIG_INVALID_VALUE",
|
|
72
|
+
fieldPath: "mail.fromAddress",
|
|
73
|
+
}),
|
|
74
|
+
);
|
|
75
|
+
});
|
|
76
|
+
|
|
32
77
|
test("strict loader 对 unknown 与错误类型 fail-fast 且不回显输入值", () => {
|
|
33
78
|
expect(() => loadPlatformConfig({ PLATFORM_ENABLE_AII: "true" })).toThrow(
|
|
34
79
|
expect.objectContaining<Partial<ConfigLoadError>>({
|
|
@@ -34,7 +34,23 @@ export interface PlatformConfig {
|
|
|
34
34
|
sessionCookieName: string;
|
|
35
35
|
sessionTtlSeconds: number;
|
|
36
36
|
passwordHash: "argon2id";
|
|
37
|
+
passwordMinLength: number;
|
|
38
|
+
passwordMaxLength: number;
|
|
37
39
|
};
|
|
40
|
+
storage: {
|
|
41
|
+
bulkDataMaxByteSize: number;
|
|
42
|
+
brandingLogoMaxByteSize: number;
|
|
43
|
+
};
|
|
44
|
+
mail: {
|
|
45
|
+
enabled: boolean;
|
|
46
|
+
host: string;
|
|
47
|
+
port: number;
|
|
48
|
+
secure: boolean;
|
|
49
|
+
fromAddress: string;
|
|
50
|
+
connectTimeoutMs: number;
|
|
51
|
+
smtpUrl?: string;
|
|
52
|
+
};
|
|
53
|
+
regional: { timeZone: string };
|
|
38
54
|
license: {
|
|
39
55
|
enabled: boolean;
|
|
40
56
|
publicKeyId?: string;
|
|
@@ -60,56 +76,111 @@ export interface ProjectConfig {
|
|
|
60
76
|
modules: string[];
|
|
61
77
|
}
|
|
62
78
|
|
|
63
|
-
const platformSchema: z.ZodType<PlatformConfig> = z
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
}
|
|
99
|
-
})
|
|
100
|
-
.optional(),
|
|
101
|
-
}),
|
|
102
|
-
audit: z.strictObject({
|
|
103
|
-
enabled: z.boolean(),
|
|
104
|
-
redactFields: z.array(z.string().min(1)).min(1),
|
|
105
|
-
}),
|
|
106
|
-
compatibility: z.strictObject({
|
|
107
|
-
ruoyiVue: z.strictObject({
|
|
79
|
+
const platformSchema: z.ZodType<PlatformConfig> = z
|
|
80
|
+
.strictObject({
|
|
81
|
+
name: z.string().trim().min(1).max(120),
|
|
82
|
+
logoUrl: z.string().trim().url().optional(),
|
|
83
|
+
enableAI: z.boolean(),
|
|
84
|
+
database: z.strictObject({
|
|
85
|
+
dialect: z.enum(["postgresql", "mysql", "dm", "kingbase"]),
|
|
86
|
+
url: z.string().trim().min(1).optional(),
|
|
87
|
+
legacyRuoYiMysqlUrl: z.string().trim().min(1).optional(),
|
|
88
|
+
legacyRuoYiRedisUrl: z.string().trim().min(1).optional(),
|
|
89
|
+
}),
|
|
90
|
+
cache: z.strictObject({
|
|
91
|
+
redisUrl: z.string().trim().min(1).optional(),
|
|
92
|
+
healthTimeoutMs: z.number().int().min(50).max(10_000),
|
|
93
|
+
}),
|
|
94
|
+
security: z.strictObject({
|
|
95
|
+
sessionCookieName: z.string().trim().min(1).max(120),
|
|
96
|
+
sessionTtlSeconds: z.number().int().min(60).max(2_592_000),
|
|
97
|
+
passwordHash: z.literal("argon2id"),
|
|
98
|
+
passwordMinLength: z.number().int().min(8).max(128),
|
|
99
|
+
passwordMaxLength: z.number().int().min(12).max(512),
|
|
100
|
+
}),
|
|
101
|
+
storage: z.strictObject({
|
|
102
|
+
bulkDataMaxByteSize: z
|
|
103
|
+
.number()
|
|
104
|
+
.int()
|
|
105
|
+
.min(1024)
|
|
106
|
+
.max(10 * 1024 ** 3),
|
|
107
|
+
brandingLogoMaxByteSize: z
|
|
108
|
+
.number()
|
|
109
|
+
.int()
|
|
110
|
+
.min(1024)
|
|
111
|
+
.max(50 * 1024 ** 2),
|
|
112
|
+
}),
|
|
113
|
+
mail: z.strictObject({
|
|
108
114
|
enabled: z.boolean(),
|
|
109
|
-
|
|
115
|
+
host: z.string().trim().max(253),
|
|
116
|
+
port: z.number().int().min(1).max(65_535),
|
|
117
|
+
secure: z.boolean(),
|
|
118
|
+
fromAddress: z.string().trim().max(320),
|
|
119
|
+
connectTimeoutMs: z.number().int().min(100).max(120_000),
|
|
120
|
+
smtpUrl: z.string().trim().min(1).optional(),
|
|
110
121
|
}),
|
|
111
|
-
|
|
112
|
-
|
|
122
|
+
regional: z.strictObject({
|
|
123
|
+
timeZone: z
|
|
124
|
+
.string()
|
|
125
|
+
.trim()
|
|
126
|
+
.min(1)
|
|
127
|
+
.max(100)
|
|
128
|
+
.refine(isSupportedTimeZone, "时区必须是有效的 IANA 时区"),
|
|
129
|
+
}),
|
|
130
|
+
license: z.strictObject({
|
|
131
|
+
enabled: z.boolean(),
|
|
132
|
+
publicKeyId: z.string().trim().min(1).optional(),
|
|
133
|
+
publicKey: z.string().trim().min(1).optional(),
|
|
134
|
+
machineCode: z.string().trim().min(1).optional(),
|
|
135
|
+
versions: z
|
|
136
|
+
.unknown()
|
|
137
|
+
.transform((value, context) => {
|
|
138
|
+
try {
|
|
139
|
+
return parseLicenseCatalog(value);
|
|
140
|
+
} catch (error) {
|
|
141
|
+
context.addIssue({
|
|
142
|
+
code: "custom",
|
|
143
|
+
message: error instanceof Error ? error.message : "版本目录无效",
|
|
144
|
+
});
|
|
145
|
+
return z.NEVER;
|
|
146
|
+
}
|
|
147
|
+
})
|
|
148
|
+
.optional(),
|
|
149
|
+
}),
|
|
150
|
+
audit: z.strictObject({
|
|
151
|
+
enabled: z.boolean(),
|
|
152
|
+
redactFields: z.array(z.string().min(1)).min(1),
|
|
153
|
+
}),
|
|
154
|
+
compatibility: z.strictObject({
|
|
155
|
+
ruoyiVue: z.strictObject({
|
|
156
|
+
enabled: z.boolean(),
|
|
157
|
+
runtimeReadonly: z.boolean(),
|
|
158
|
+
}),
|
|
159
|
+
}),
|
|
160
|
+
})
|
|
161
|
+
.superRefine((config, context) => {
|
|
162
|
+
if (config.security.passwordMinLength > config.security.passwordMaxLength) {
|
|
163
|
+
context.addIssue({
|
|
164
|
+
code: "custom",
|
|
165
|
+
path: ["security", "passwordMinLength"],
|
|
166
|
+
message: "密码最小长度不能大于最大长度",
|
|
167
|
+
});
|
|
168
|
+
}
|
|
169
|
+
if (config.mail.enabled && !config.mail.fromAddress) {
|
|
170
|
+
context.addIssue({
|
|
171
|
+
code: "custom",
|
|
172
|
+
path: ["mail", "fromAddress"],
|
|
173
|
+
message: "启用邮件传输时必须配置发件地址",
|
|
174
|
+
});
|
|
175
|
+
}
|
|
176
|
+
if (config.mail.enabled && !config.mail.smtpUrl && !config.mail.host) {
|
|
177
|
+
context.addIssue({
|
|
178
|
+
code: "custom",
|
|
179
|
+
path: ["mail", "host"],
|
|
180
|
+
message: "启用邮件传输时必须配置 SMTP URL 或主机",
|
|
181
|
+
});
|
|
182
|
+
}
|
|
183
|
+
});
|
|
113
184
|
|
|
114
185
|
export const platformConfigDefinition = defineModuleConfig<PlatformConfig>({
|
|
115
186
|
key: "platform.runtime",
|
|
@@ -118,9 +189,13 @@ export const platformConfigDefinition = defineModuleConfig<PlatformConfig>({
|
|
|
118
189
|
ownedEnvironmentPrefixes: [
|
|
119
190
|
"PLATFORM_",
|
|
120
191
|
"DATABASE_",
|
|
192
|
+
"PASSWORD_",
|
|
121
193
|
"REDIS_",
|
|
122
194
|
"RUOYI_",
|
|
123
195
|
"SESSION_",
|
|
196
|
+
"STORAGE_",
|
|
197
|
+
"MAIL_",
|
|
198
|
+
"REGIONAL_",
|
|
124
199
|
"AUDIT_",
|
|
125
200
|
],
|
|
126
201
|
ownedEnvironmentKeys: [
|
|
@@ -153,6 +228,43 @@ export const platformConfigDefinition = defineModuleConfig<PlatformConfig>({
|
|
|
153
228
|
strictInteger,
|
|
154
229
|
),
|
|
155
230
|
value("PLATFORM_PASSWORD_HASH", "security.passwordHash", "argon2id"),
|
|
231
|
+
value(
|
|
232
|
+
"PASSWORD_MIN_LENGTH",
|
|
233
|
+
"security.passwordMinLength",
|
|
234
|
+
12,
|
|
235
|
+
strictInteger,
|
|
236
|
+
),
|
|
237
|
+
value(
|
|
238
|
+
"PASSWORD_MAX_LENGTH",
|
|
239
|
+
"security.passwordMaxLength",
|
|
240
|
+
128,
|
|
241
|
+
strictInteger,
|
|
242
|
+
),
|
|
243
|
+
value(
|
|
244
|
+
"STORAGE_BULK_DATA_MAX_BYTE_SIZE",
|
|
245
|
+
"storage.bulkDataMaxByteSize",
|
|
246
|
+
512 * 1024 * 1024,
|
|
247
|
+
strictInteger,
|
|
248
|
+
),
|
|
249
|
+
value(
|
|
250
|
+
"STORAGE_BRANDING_LOGO_MAX_BYTE_SIZE",
|
|
251
|
+
"storage.brandingLogoMaxByteSize",
|
|
252
|
+
5 * 1024 * 1024,
|
|
253
|
+
strictInteger,
|
|
254
|
+
),
|
|
255
|
+
value("MAIL_ENABLED", "mail.enabled", false, strictBoolean),
|
|
256
|
+
value("MAIL_HOST", "mail.host", ""),
|
|
257
|
+
value("MAIL_PORT", "mail.port", 587, strictInteger),
|
|
258
|
+
value("MAIL_SECURE", "mail.secure", false, strictBoolean),
|
|
259
|
+
value("MAIL_FROM_ADDRESS", "mail.fromAddress", ""),
|
|
260
|
+
value(
|
|
261
|
+
"MAIL_CONNECT_TIMEOUT_MS",
|
|
262
|
+
"mail.connectTimeoutMs",
|
|
263
|
+
10_000,
|
|
264
|
+
strictInteger,
|
|
265
|
+
),
|
|
266
|
+
secret("MAIL_SMTP_URL", "mail.smtpUrl"),
|
|
267
|
+
value("REGIONAL_TIME_ZONE", "regional.timeZone", "Asia/Shanghai"),
|
|
156
268
|
value("LICENSE_ENABLED", "license.enabled", true, strictBoolean),
|
|
157
269
|
value("LICENSE_PUBLIC_KEY_ID", "license.publicKeyId"),
|
|
158
270
|
value("LICENSE_PUBLIC_KEY", "license.publicKey"),
|
|
@@ -210,3 +322,12 @@ function value(
|
|
|
210
322
|
function secret(key: string, path: string) {
|
|
211
323
|
return { key, path, secret: { provider: "env" as const } };
|
|
212
324
|
}
|
|
325
|
+
|
|
326
|
+
function isSupportedTimeZone(value: string): boolean {
|
|
327
|
+
try {
|
|
328
|
+
new Intl.DateTimeFormat("zh-CN", { timeZone: value });
|
|
329
|
+
return true;
|
|
330
|
+
} catch {
|
|
331
|
+
return false;
|
|
332
|
+
}
|
|
333
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
CREATE TABLE "notification_favorites" (
|
|
2
|
+
"notification_id" varchar(64) NOT NULL,
|
|
3
|
+
"user_id" varchar(64) NOT NULL,
|
|
4
|
+
"favorited_at" timestamp with time zone DEFAULT now() NOT NULL,
|
|
5
|
+
CONSTRAINT "notification_favorites_notification_id_user_id_pk" PRIMARY KEY("notification_id","user_id")
|
|
6
|
+
);
|
|
7
|
+
--> statement-breakpoint
|
|
8
|
+
ALTER TABLE "notification_favorites" ADD CONSTRAINT "notification_favorites_notification_id_platform_notifications_id_fk" FOREIGN KEY ("notification_id") REFERENCES "public"."platform_notifications"("id") ON DELETE restrict ON UPDATE no action;--> statement-breakpoint
|
|
9
|
+
ALTER TABLE "notification_favorites" ADD CONSTRAINT "notification_favorites_user_id_users_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."users"("id") ON DELETE restrict ON UPDATE no action;--> statement-breakpoint
|
|
10
|
+
CREATE INDEX "idx_notification_favorites_user" ON "notification_favorites" USING btree ("user_id","favorited_at");
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
CREATE TABLE "notification_revisions" (
|
|
2
|
+
"notification_id" varchar(64) NOT NULL,
|
|
3
|
+
"revision" integer NOT NULL,
|
|
4
|
+
"title" varchar(120) NOT NULL,
|
|
5
|
+
"summary" varchar(240) NOT NULL,
|
|
6
|
+
"content" text NOT NULL,
|
|
7
|
+
"category" varchar(40) NOT NULL,
|
|
8
|
+
"edited_at" timestamp with time zone NOT NULL,
|
|
9
|
+
"edited_by" varchar(64) NOT NULL,
|
|
10
|
+
CONSTRAINT "notification_revisions_notification_id_revision_pk" PRIMARY KEY("notification_id","revision")
|
|
11
|
+
);
|
|
12
|
+
--> statement-breakpoint
|
|
13
|
+
ALTER TABLE "platform_notifications" ADD COLUMN "revision" integer DEFAULT 1 NOT NULL;--> statement-breakpoint
|
|
14
|
+
ALTER TABLE "notification_revisions" ADD CONSTRAINT "notification_revisions_notification_id_platform_notifications_id_fk" FOREIGN KEY ("notification_id") REFERENCES "public"."platform_notifications"("id") ON DELETE restrict ON UPDATE no action;--> statement-breakpoint
|
|
15
|
+
CREATE INDEX "idx_notification_revisions_time" ON "notification_revisions" USING btree ("notification_id","edited_at");--> statement-breakpoint
|
|
16
|
+
INSERT INTO "notification_revisions" (
|
|
17
|
+
"notification_id",
|
|
18
|
+
"revision",
|
|
19
|
+
"title",
|
|
20
|
+
"summary",
|
|
21
|
+
"content",
|
|
22
|
+
"category",
|
|
23
|
+
"edited_at",
|
|
24
|
+
"edited_by"
|
|
25
|
+
)
|
|
26
|
+
SELECT
|
|
27
|
+
"id",
|
|
28
|
+
1,
|
|
29
|
+
"title",
|
|
30
|
+
"summary",
|
|
31
|
+
"content",
|
|
32
|
+
"category",
|
|
33
|
+
"published_at",
|
|
34
|
+
"created_by"
|
|
35
|
+
FROM "platform_notifications";
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
CREATE UNIQUE INDEX "uk_departments_single_root" ON "departments" USING btree (((1))) WHERE "departments"."parent_id" is null and "departments"."deleted_at" is null;--> statement-breakpoint
|
|
2
|
+
ALTER TABLE "departments" ADD CONSTRAINT "departments_parent_not_self" CHECK ("departments"."parent_id" is null or "departments"."parent_id" <> "departments"."id");
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
CREATE TABLE "notification_delivery_outbox" (
|
|
2
|
+
"id" varchar(64) PRIMARY KEY NOT NULL,
|
|
3
|
+
"notification_id" varchar(64) NOT NULL,
|
|
4
|
+
"user_id" varchar(64) NOT NULL,
|
|
5
|
+
"channel" varchar(16) NOT NULL,
|
|
6
|
+
"status" varchar(16) NOT NULL,
|
|
7
|
+
"subject" varchar(120) NOT NULL,
|
|
8
|
+
"content" text NOT NULL,
|
|
9
|
+
"attempt_count" integer DEFAULT 0 NOT NULL,
|
|
10
|
+
"next_attempt_at" timestamp with time zone DEFAULT now() NOT NULL,
|
|
11
|
+
"lease_token" varchar(64),
|
|
12
|
+
"lease_expires_at" timestamp with time zone,
|
|
13
|
+
"delivered_at" timestamp with time zone,
|
|
14
|
+
"provider_message_id" varchar(180),
|
|
15
|
+
"last_error_code" varchar(64),
|
|
16
|
+
"created_at" timestamp with time zone DEFAULT now() NOT NULL,
|
|
17
|
+
"updated_at" timestamp with time zone DEFAULT now() NOT NULL
|
|
18
|
+
);
|
|
19
|
+
--> statement-breakpoint
|
|
20
|
+
CREATE TABLE "notification_preferences" (
|
|
21
|
+
"user_id" varchar(64) PRIMARY KEY NOT NULL,
|
|
22
|
+
"enabled_channels" jsonb DEFAULT '[]'::jsonb NOT NULL,
|
|
23
|
+
"disabled_categories" jsonb DEFAULT '[]'::jsonb NOT NULL,
|
|
24
|
+
"updated_at" timestamp with time zone DEFAULT now() NOT NULL,
|
|
25
|
+
"updated_by" varchar(64) NOT NULL
|
|
26
|
+
);
|
|
27
|
+
--> statement-breakpoint
|
|
28
|
+
ALTER TABLE "platform_notifications" ADD COLUMN "scheduled_for" timestamp with time zone;--> statement-breakpoint
|
|
29
|
+
ALTER TABLE "platform_notifications" ADD COLUMN "recipient_user_ids" jsonb DEFAULT '[]'::jsonb NOT NULL;--> statement-breakpoint
|
|
30
|
+
ALTER TABLE "platform_notifications" ADD COLUMN "recipient_department_ids" jsonb DEFAULT '[]'::jsonb NOT NULL;--> statement-breakpoint
|
|
31
|
+
ALTER TABLE "platform_notifications" ADD COLUMN "include_child_departments" boolean DEFAULT false NOT NULL;--> statement-breakpoint
|
|
32
|
+
ALTER TABLE "platform_notifications" ADD COLUMN "delivery_channels" jsonb DEFAULT '[]'::jsonb NOT NULL;--> statement-breakpoint
|
|
33
|
+
ALTER TABLE "notification_delivery_outbox" ADD CONSTRAINT "notification_delivery_outbox_notification_id_platform_notifications_id_fk" FOREIGN KEY ("notification_id") REFERENCES "public"."platform_notifications"("id") ON DELETE restrict ON UPDATE no action;--> statement-breakpoint
|
|
34
|
+
ALTER TABLE "notification_delivery_outbox" ADD CONSTRAINT "notification_delivery_outbox_user_id_users_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."users"("id") ON DELETE restrict ON UPDATE no action;--> statement-breakpoint
|
|
35
|
+
ALTER TABLE "notification_preferences" ADD CONSTRAINT "notification_preferences_user_id_users_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."users"("id") ON DELETE restrict ON UPDATE no action;--> statement-breakpoint
|
|
36
|
+
CREATE UNIQUE INDEX "uk_notification_delivery_target" ON "notification_delivery_outbox" USING btree ("notification_id","user_id","channel");--> statement-breakpoint
|
|
37
|
+
CREATE INDEX "idx_notification_delivery_claim" ON "notification_delivery_outbox" USING btree ("status","next_attempt_at","lease_expires_at");--> statement-breakpoint
|
|
38
|
+
CREATE INDEX "idx_notification_delivery_notification" ON "notification_delivery_outbox" USING btree ("notification_id");
|