create-windy 0.2.7 → 0.2.9
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/README.md +6 -0
- package/dist/cli.js +181 -87
- package/package.json +1 -1
- package/template/.windy-template.json +2 -2
- package/template/apps/server/Dockerfile +2 -0
- package/template/apps/server/package.json +10 -8
- package/template/apps/server/src/access-guards.ts +1 -1
- package/template/apps/server/src/admin/routes.test.ts +10 -0
- package/template/apps/server/src/admin/routes.ts +4 -2
- package/template/apps/server/src/agent/routes.test.ts +1 -1
- package/template/apps/server/src/agent/routes.ts +2 -2
- package/template/apps/server/src/application-services.ts +3 -0
- package/template/apps/server/src/audit/drizzle-log-store.ts +2 -2
- package/template/apps/server/src/audit/policy.ts +1 -1
- package/template/apps/server/src/audit/recovery-queue.test.ts +1 -1
- package/template/apps/server/src/audit/recovery-queue.ts +1 -1
- package/template/apps/server/src/audit/redaction.ts +1 -1
- package/template/apps/server/src/audit/reliable-writer.test.ts +1 -1
- package/template/apps/server/src/audit/reliable-writer.ts +1 -1
- package/template/apps/server/src/audit/search-summary.ts +1 -1
- package/template/apps/server/src/auth/authentication-provider.test.ts +1 -1
- package/template/apps/server/src/auth/credential-service.ts +1 -1
- package/template/apps/server/src/auth/drizzle-repository.ts +2 -2
- package/template/apps/server/src/auth/drizzle-session-operations.ts +1 -1
- package/template/apps/server/src/auth/own-session-routes.test.ts +1 -1
- package/template/apps/server/src/auth/password.ts +2 -2
- package/template/apps/server/src/auth/repository.ts +1 -1
- package/template/apps/server/src/auth/routes.test.ts +1 -1
- package/template/apps/server/src/auth/service.ts +1 -1
- package/template/apps/server/src/bulk-data/artifact-store.ts +1 -1
- package/template/apps/server/src/bulk-data/dictionary-handler.ts +1 -1
- package/template/apps/server/src/bulk-data/drizzle-repository.ts +3 -3
- package/template/apps/server/src/bulk-data/repository.ts +1 -1
- package/template/apps/server/src/bulk-data/routes.test.ts +1 -1
- package/template/apps/server/src/bulk-data/routes.ts +1 -1
- package/template/apps/server/src/bulk-data/service.test.ts +1 -1
- package/template/apps/server/src/bulk-data/service.ts +1 -1
- package/template/apps/server/src/bulk-data/types.ts +1 -1
- package/template/apps/server/src/configuration/bootstrap.ts +2 -2
- package/template/apps/server/src/configuration/definition.ts +2 -2
- package/template/apps/server/src/configuration/drizzle-repository.ts +2 -2
- package/template/apps/server/src/configuration/repository.ts +1 -1
- package/template/apps/server/src/configuration/routes.ts +1 -1
- package/template/apps/server/src/configuration/service.ts +1 -1
- package/template/apps/server/src/data-access/context.ts +2 -2
- package/template/apps/server/src/data-access/query-specification.test.ts +1 -1
- package/template/apps/server/src/data-access/scoped-repository.integration.test.ts +1 -1
- package/template/apps/server/src/data-access/scoped-repository.ts +1 -1
- package/template/apps/server/src/data-access/scoped-resource.test.ts +1 -1
- package/template/apps/server/src/data-access/scoped-resource.ts +1 -1
- package/template/apps/server/src/data-governance/export/approval-port.ts +1 -1
- package/template/apps/server/src/data-governance/export/drizzle-repository.ts +1 -1
- package/template/apps/server/src/data-governance/export/job-runtime.test.ts +2 -2
- package/template/apps/server/src/data-governance/export/job-runtime.ts +2 -3
- package/template/apps/server/src/data-governance/export/postgres-api-fixture.ts +2 -2
- package/template/apps/server/src/data-governance/export/postgres-api.integration.test.ts +1 -1
- package/template/apps/server/src/data-governance/export/routes-test-fixture.ts +3 -3
- package/template/apps/server/src/data-governance/export/routes.ts +1 -1
- package/template/apps/server/src/data-governance/export/scope-snapshot.ts +1 -1
- package/template/apps/server/src/data-governance/export/service.ts +2 -2
- package/template/apps/server/src/data-governance/export/source.ts +1 -1
- package/template/apps/server/src/data-governance/export/types.ts +1 -1
- package/template/apps/server/src/data-governance/plaintext-access.test.ts +1 -1
- package/template/apps/server/src/data-governance/plaintext-access.ts +1 -1
- package/template/apps/server/src/data-governance/plaintext-postgres.integration.test.ts +1 -1
- package/template/apps/server/src/data-governance/user-plaintext-routes.ts +1 -1
- package/template/apps/server/src/data-governance/user-projection.ts +2 -2
- package/template/apps/server/src/example-modules.ts +25 -1
- package/template/apps/server/src/feature/manifest-feature-repository.test.ts +1 -1
- package/template/apps/server/src/feature/manifest-feature-repository.ts +1 -1
- package/template/apps/server/src/feature/routes.ts +3 -6
- package/template/apps/server/src/foundation-access.test.ts +1 -1
- package/template/apps/server/src/foundation-access.ts +1 -1
- package/template/apps/server/src/foundation.ts +21 -7
- package/template/apps/server/src/guards.test.ts +1 -1
- package/template/apps/server/src/guards.ts +3 -3
- package/template/apps/server/src/index.ts +28 -3
- package/template/{packages/modules → apps/server}/src/installed-business-modules.ts +2 -2
- package/template/apps/server/src/jobs/artifact-service.test.ts +1 -1
- package/template/apps/server/src/jobs/artifact-service.ts +2 -2
- package/template/apps/server/src/jobs/drizzle-artifact.ts +2 -2
- package/template/apps/server/src/jobs/drizzle-claim.ts +1 -1
- package/template/apps/server/src/jobs/drizzle-execution-repository.ts +2 -2
- package/template/apps/server/src/jobs/drizzle-execution.integration.test.ts +1 -1
- package/template/apps/server/src/jobs/drizzle-lease.ts +2 -2
- package/template/apps/server/src/jobs/drizzle-mappers.ts +3 -3
- package/template/apps/server/src/jobs/drizzle-recovery-repository.ts +1 -1
- package/template/apps/server/src/jobs/drizzle-repository.integration.test.ts +1 -1
- package/template/apps/server/src/jobs/drizzle-repository.ts +3 -3
- package/template/apps/server/src/jobs/execution-repository.ts +1 -1
- package/template/apps/server/src/jobs/execution.test.ts +2 -2
- package/template/apps/server/src/jobs/in-memory-claim.ts +1 -1
- package/template/apps/server/src/jobs/in-memory-execution.ts +1 -1
- package/template/apps/server/src/jobs/in-memory-lease.ts +1 -1
- package/template/apps/server/src/jobs/legacy-adapter.integration.test.ts +1 -1
- package/template/apps/server/src/jobs/legacy-adapter.test.ts +1 -1
- package/template/apps/server/src/jobs/legacy-adapter.ts +1 -1
- package/template/apps/server/src/jobs/legacy-service-runtime.ts +4 -2
- package/template/apps/server/src/jobs/repository.ts +2 -2
- package/template/apps/server/src/jobs/service.ts +2 -2
- package/template/apps/server/src/jobs/worker.ts +3 -2
- package/template/apps/server/src/license/legacy-license-resolver.ts +1 -1
- package/template/apps/server/src/license/license-resolver.test.ts +1 -1
- package/template/apps/server/src/license/license-resolver.ts +3 -3
- package/template/apps/server/src/license/routes-offline-code.test.ts +2 -2
- package/template/apps/server/src/license/routes.ts +1 -1
- package/template/apps/server/src/license/runtime-audit-reliability.test.ts +2 -2
- package/template/apps/server/src/license/runtime-reminder.test.ts +2 -2
- package/template/apps/server/src/license/runtime-service.test.ts +2 -2
- package/template/apps/server/src/license/runtime-service.ts +2 -2
- package/template/apps/server/src/module-composition.test.ts +1 -1
- package/template/apps/server/src/module-composition.ts +1 -1
- package/template/apps/server/src/module-host.test.ts +145 -0
- package/template/apps/server/src/module-host.ts +110 -0
- package/template/apps/server/src/notification/drizzle-repository.ts +2 -2
- package/template/apps/server/src/notification/repository.ts +1 -1
- package/template/apps/server/src/notification/routes.ts +1 -1
- package/template/apps/server/src/pagination.ts +1 -1
- package/template/apps/server/src/persistence.integration.test.ts +1 -1
- package/template/apps/server/src/persistence.ts +1 -1
- package/template/apps/server/src/profile/routes.ts +1 -1
- package/template/apps/server/src/route-guards.test.ts +1 -1
- package/template/apps/server/src/route-guards.ts +1 -1
- package/template/apps/server/src/runtime-feature.ts +125 -0
- package/template/apps/server/src/runtime-license.ts +1 -1
- package/template/apps/server/src/runtime.test.ts +48 -1
- package/template/apps/server/src/runtime.ts +17 -64
- package/template/apps/server/src/scheduler/audit.ts +1 -1
- package/template/apps/server/src/scheduler/definitions.test.ts +1 -1
- package/template/apps/server/src/scheduler/definitions.ts +2 -2
- package/template/apps/server/src/scheduler/drizzle-durable-links.ts +1 -1
- package/template/apps/server/src/scheduler/drizzle-mappers.ts +1 -1
- package/template/apps/server/src/scheduler/drizzle-repository.ts +1 -1
- package/template/apps/server/src/scheduler/execution-recorder.ts +1 -1
- package/template/apps/server/src/scheduler/history.ts +1 -1
- package/template/apps/server/src/scheduler/overview.ts +1 -1
- package/template/apps/server/src/scheduler/recovery-service.test.ts +1 -1
- package/template/apps/server/src/scheduler/recovery-service.ts +1 -1
- package/template/apps/server/src/scheduler/repository.ts +1 -1
- package/template/apps/server/src/scheduler/routes.ts +1 -1
- package/template/apps/server/src/scheduler/service-idle.test.ts +1 -1
- package/template/apps/server/src/scheduler/service.test.ts +1 -1
- package/template/apps/server/src/scheduler/service.ts +1 -1
- package/template/apps/server/src/scheduler/types.ts +1 -1
- package/template/apps/server/src/search/contracts.ts +2 -2
- package/template/apps/server/src/search/host.ts +1 -1
- package/template/apps/server/src/search/registry.ts +1 -1
- package/template/apps/server/src/search/routes.test.ts +1 -1
- package/template/apps/server/src/search/routes.ts +1 -1
- package/template/apps/server/src/search/service.ts +2 -2
- package/template/apps/server/src/search/test-support.ts +2 -2
- package/template/apps/server/src/session/routes.ts +1 -1
- package/template/apps/server/src/settings/drizzle-repository.ts +2 -2
- package/template/apps/server/src/settings/repository.ts +1 -1
- package/template/apps/server/src/settings/routes.test.ts +1 -1
- package/template/apps/server/src/settings/routes.ts +1 -1
- package/template/apps/server/src/settings/runtime.ts +1 -1
- package/template/apps/server/src/storage/blob-reference-registry.test.ts +1 -1
- package/template/apps/server/src/storage/blob-reference-registry.ts +1 -1
- package/template/apps/server/src/storage/drizzle-upload-repository.integration.test.ts +1 -1
- package/template/apps/server/src/storage/drizzle-upload-repository.ts +2 -2
- package/template/apps/server/src/storage/route-support.ts +1 -1
- package/template/apps/server/src/storage/routes.test.ts +1 -1
- package/template/apps/server/src/storage/routes.ts +2 -2
- package/template/apps/server/src/storage/runtime.ts +6 -4
- package/template/apps/server/src/system/audit-routes.ts +1 -1
- package/template/apps/server/src/system/department-routes.ts +1 -1
- package/template/apps/server/src/system/drizzle-repository.ts +1 -1
- package/template/apps/server/src/system/drizzle-scoped-repository.ts +1 -1
- package/template/apps/server/src/system/drizzle-system.ts +1 -1
- package/template/apps/server/src/system/entities.ts +1 -1
- package/template/apps/server/src/system/identity-route-config.ts +1 -1
- package/template/apps/server/src/system/interface-catalog.test.ts +3 -3
- package/template/apps/server/src/system/interface-catalog.ts +2 -2
- package/template/apps/server/src/system/menu-registry.ts +1 -1
- package/template/apps/server/src/system/menu-routes.ts +1 -1
- package/template/apps/server/src/system/operations.test.ts +1 -1
- package/template/apps/server/src/system/operations.ts +1 -1
- package/template/apps/server/src/system/redis-health.ts +1 -1
- package/template/apps/server/src/system/repository.ts +1 -1
- package/template/apps/server/src/system/resource-route-support.ts +1 -1
- package/template/apps/server/src/system/route-helpers.ts +1 -1
- package/template/apps/server/src/system/route-types.ts +1 -1
- package/template/apps/server/src/system/routes.test.ts +1 -1
- package/template/apps/server/src/system/routes.ts +1 -1
- package/template/apps/server/src/system/user-projection.ts +1 -1
- package/template/apps/server/src/work-order/data-scope.integration.test.ts +1 -1
- package/template/apps/server/src/work-order/drizzle-repository.integration.test.ts +1 -1
- package/template/apps/server/src/work-order/drizzle-repository.ts +2 -2
- package/template/apps/server/src/work-order/foundation-modules.test.ts +15 -5
- package/template/apps/server/src/work-order/repository.ts +1 -1
- package/template/apps/server/src/work-order/routes.test.ts +2 -2
- package/template/apps/server/src/work-order/routes.ts +2 -2
- package/template/apps/server/src/work-order/search-api.test.ts +3 -3
- package/template/apps/server/src/work-order/search-provider.test.ts +3 -3
- package/template/apps/server/src/work-order/service.ts +1 -1
- package/template/apps/server/src/work-order/task.test.ts +1 -1
- package/template/apps/server/src/work-order/task.ts +2 -2
- package/template/apps/server/src/workflow/drizzle-repository.integration.test.ts +2 -2
- package/template/apps/server/src/workflow/drizzle-repository.ts +3 -3
- package/template/apps/server/src/workflow/effects.test.ts +1 -1
- package/template/apps/server/src/workflow/effects.ts +1 -1
- package/template/apps/server/src/workflow/repository.ts +2 -2
- package/template/apps/server/src/workflow/routes.ts +3 -3
- package/template/apps/server/src/workflow/service.ts +1 -1
- package/template/apps/server/src/workflow/timeout-runtime.test.ts +1 -1
- package/template/apps/server/src/workflow/timeout-runtime.ts +2 -2
- package/template/apps/web/Dockerfile +2 -0
- package/template/apps/web/package.json +4 -4
- package/template/apps/web/runtime-server.ts +1 -1
- package/template/apps/web/src/app/layouts/AppLayout.vue +6 -0
- package/template/apps/web/src/components/auth/PasswordChangeForm.vue +1 -1
- package/template/apps/web/src/components/common/DataPagination.vue +1 -1
- package/template/apps/web/src/components/license/LicenseActivationCodeForm.vue +1 -1
- package/template/apps/web/src/components/license/LicenseFlow.webtest.ts +2 -2
- package/template/apps/web/src/composables/useModuleConfigurations.ts +1 -1
- package/template/apps/web/src/composables/useWatermarkSettings.ts +1 -0
- package/template/apps/web/src/composables/watermark-settings.ts +6 -0
- package/template/apps/web/src/composables/watermark-settings.webtest.ts +27 -1
- package/template/apps/web/src/layout/AppSidebar.vue +12 -3
- package/template/apps/web/src/layout/AppSidebar.webtest.ts +11 -0
- package/template/apps/web/src/layout/GlobalWatermark.vue +25 -8
- package/template/apps/web/src/layout/GlobalWatermark.webtest.ts +109 -0
- package/template/apps/web/src/layout/NavigationSearchDialog.vue +1 -1
- package/template/apps/web/src/layout/NotificationMenu.vue +1 -1
- package/template/apps/web/src/layout/navigation.ts +5 -1
- package/template/apps/web/src/layout/navigation.webtest.ts +1 -1
- package/template/apps/web/src/pages/configuration/components/ModuleConfigRollbackDialog.vue +1 -1
- package/template/apps/web/src/pages/configuration/components/ModuleConfigVersionList.vue +1 -1
- package/template/apps/web/src/pages/configuration/components/ModuleConfigurationEditor.vue +1 -1
- package/template/apps/web/src/pages/configuration/components/ModuleConfigurationEditor.webtest.ts +1 -1
- package/template/apps/web/src/pages/configuration/components/ModuleConfigurationWorkbench.vue +1 -1
- package/template/apps/web/src/pages/dashboard/dashboard-presenter.webtest.ts +1 -1
- package/template/apps/web/src/pages/settings/WatermarkSettingsSection.vue +21 -0
- package/template/apps/web/src/pages/system/SystemNotificationsPage.vue +2 -2
- package/template/apps/web/src/pages/system/components/AuditActionCell.vue +7 -2
- package/template/apps/web/src/pages/system/components/AuditLogFilters.vue +7 -2
- package/template/apps/web/src/pages/system/components/NotificationPublishForm.vue +1 -1
- package/template/apps/web/src/pages/system/components/SchedulerOperationsPanel.vue +1 -1
- package/template/apps/web/src/pages/system/components/SchedulerOperationsPanel.webtest.ts +1 -1
- package/template/apps/web/src/pages/system/components/SchedulerRunTable.vue +1 -1
- package/template/apps/web/src/pages/system/components/SchedulerRunTable.webtest.ts +1 -1
- package/template/apps/web/src/pages/system/components/SchedulerStaleRecoveryForm.vue +1 -1
- package/template/apps/web/src/pages/system/components/SchedulerStaleRecoveryForm.webtest.ts +1 -1
- package/template/apps/web/src/pages/system/components/SystemResourcePage.vue +1 -1
- package/template/apps/web/src/pages/system/components/SystemResourceTable.vue +10 -3
- package/template/apps/web/src/pages/system/components/role-policy/RolePermissionTree.vue +1 -1
- package/template/apps/web/src/pages/system/components/role-policy/RolePermissionTree.webtest.ts +1 -1
- package/template/apps/web/src/pages/system/components/role-policy/RolePolicyForm.vue +1 -1
- package/template/apps/web/src/pages/system/components/role-policy/permission-tree.ts +1 -1
- package/template/apps/web/src/pages/system/components/role-policy/permission-tree.webtest.ts +1 -1
- package/template/apps/web/src/pages/system/composables/useSchedulerOperations.ts +2 -2
- package/template/apps/web/src/pages/system/composables/useSchedulerOperations.webtest.ts +1 -1
- package/template/apps/web/src/pages/system/composables/useSystemResource.ts +1 -1
- package/template/apps/web/src/router/manifest-routes.ts +1 -1
- package/template/apps/web/src/router/manifest-routes.webtest.ts +1 -1
- package/template/apps/web/src/services/access-api.ts +10 -1
- package/template/apps/web/src/services/configuration-api.ts +1 -1
- package/template/apps/web/src/services/license-api.ts +1 -1
- package/template/apps/web/src/services/notification-api.ts +2 -2
- package/template/apps/web/src/services/operations-api.ts +1 -1
- package/template/apps/web/src/services/platform-settings-api.ts +2 -2
- package/template/apps/web/src/services/profile-api.ts +2 -2
- package/template/docs/architecture/durable-jobs.md +5 -0
- package/template/docs/architecture/module-manifest-composition.md +14 -7
- package/template/docs/architecture/object-storage.md +1 -1
- package/template/docs/development/crud-generator.md +4 -1
- package/template/docs/platform/audit-reliability.md +1 -1
- package/template/package.json +2 -1
- package/template/packages/config/package.json +15 -4
- package/template/packages/config/src/platform.ts +1 -1
- package/template/packages/crud-generator/package.json +1 -1
- package/template/packages/crud-generator/src/generator.test.ts +16 -0
- package/template/packages/crud-generator/src/templates/domain.ts +1 -1
- package/template/packages/crud-generator/src/templates/manifest.ts +2 -2
- package/template/packages/crud-generator/src/templates/project.ts +3 -3
- package/template/packages/crud-generator/src/templates/repository.ts +1 -1
- package/template/packages/crud-generator/src/templates/routes.ts +2 -2
- package/template/packages/crud-generator/src/validation.ts +22 -1
- package/template/packages/database/package.json +15 -5
- package/template/packages/database/src/bundle-validation.ts +218 -0
- package/template/packages/database/src/dialects.ts +1 -1
- package/template/packages/database/src/runner.test.ts +160 -13
- package/template/packages/database/src/runner.ts +95 -77
- package/template/packages/database/src/schema/governed-exports.ts +1 -1
- package/template/packages/database/src/schema/identity.ts +1 -1
- package/template/packages/database/src/schema/license-v1.ts +1 -1
- package/template/packages/database/src/schema/notifications.ts +1 -1
- package/template/packages/database/src/schema/platform-settings.ts +1 -1
- package/template/packages/database/src/schema/workflow.ts +1 -1
- package/template/packages/database/src/sql-store.ts +1 -1
- package/template/packages/database/src/store.ts +1 -1
- package/template/packages/example-work-order/index.ts +1 -0
- package/template/packages/example-work-order/package.json +4 -3
- package/template/packages/example-work-order/src/contract.ts +1 -1
- package/template/packages/example-work-order/src/manifest.ts +8 -3
- package/template/packages/example-work-order/src/migration-bundle.test.ts +43 -0
- package/template/packages/example-work-order/src/migration-bundle.ts +64 -0
- package/template/packages/jobs/index.ts +2 -0
- package/template/packages/jobs/package.json +29 -0
- package/template/packages/jobs/src/handlers.test.ts +72 -0
- package/template/{apps/server/src/jobs/handler-registry.ts → packages/jobs/src/handlers.ts} +4 -4
- package/template/{apps/server/src/jobs → packages/jobs/src}/types.ts +7 -1
- package/template/packages/{license-sdk → jobs}/tsconfig.json +0 -1
- package/template/packages/modules/index.ts +1 -1
- package/template/packages/modules/package.json +15 -5
- package/template/packages/modules/src/ai-operation-composition.test.ts +195 -0
- package/template/packages/modules/src/ai-operation-composition.ts +145 -0
- package/template/packages/modules/src/catalog-validation.ts +123 -0
- package/template/packages/modules/src/composition.test.ts +75 -2
- package/template/packages/modules/src/composition.ts +23 -39
- package/template/packages/modules/src/implementation-bindings.ts +70 -0
- package/template/packages/modules/src/manifest.ts +43 -12
- package/template/packages/modules/src/menu-composition.ts +1 -1
- package/template/packages/modules/src/system-api-binding.ts +1 -1
- package/template/packages/modules/src/system-api-data-governance.ts +1 -1
- package/template/packages/modules/src/system-api-permissions.ts +1 -1
- package/template/packages/modules/src/system-data-governance.ts +1 -1
- package/template/packages/modules/src/system-features.ts +1 -1
- package/template/packages/modules/src/system-governed-export-bindings.ts +1 -1
- package/template/packages/modules/src/system-module-catalog.ts +1 -1
- package/template/packages/server-sdk/index.ts +5 -0
- package/template/packages/server-sdk/package.json +25 -0
- package/template/packages/server-sdk/src/module-host.ts +29 -0
- package/template/packages/server-sdk/tsconfig.json +16 -0
- package/template/packages/shared/index.ts +2 -0
- package/template/packages/shared/package.json +14 -3
- package/template/packages/shared/src/audit.ts +22 -1
- package/template/packages/shared/src/license-catalog.test.ts +17 -0
- package/template/packages/shared/src/license-catalog.ts +33 -0
- package/template/packages/shared/src/migration.ts +39 -0
- package/template/packages/storage/package.json +14 -3
- package/template/packages/license-sdk/index.ts +0 -13
- package/template/packages/license-sdk/package.json +0 -18
- package/template/packages/license-sdk/src/bounded-json-body.test.ts +0 -65
- package/template/packages/license-sdk/src/bounded-json-body.ts +0 -135
- package/template/packages/license-sdk/src/canonical-json.test.ts +0 -28
- package/template/packages/license-sdk/src/canonical-json.ts +0 -104
- package/template/packages/license-sdk/src/client.test.ts +0 -82
- package/template/packages/license-sdk/src/client.ts +0 -86
- package/template/packages/license-sdk/src/device.ts +0 -46
- package/template/packages/license-sdk/src/file-storage.test.ts +0 -80
- package/template/packages/license-sdk/src/file-storage.ts +0 -77
- package/template/packages/license-sdk/src/installation.test.ts +0 -241
- package/template/packages/license-sdk/src/installation.ts +0 -150
- package/template/packages/license-sdk/src/license-parser.ts +0 -56
- package/template/packages/license-sdk/src/offline-code-base32.ts +0 -57
- package/template/packages/license-sdk/src/offline-code-decompression.ts +0 -55
- package/template/packages/license-sdk/src/offline-code-limits.ts +0 -10
- package/template/packages/license-sdk/src/offline-code-wire.ts +0 -72
- package/template/packages/license-sdk/src/offline-code.test.ts +0 -172
- package/template/packages/license-sdk/src/offline-code.ts +0 -319
- package/template/packages/license-sdk/src/payload.test.ts +0 -72
- package/template/packages/license-sdk/src/payload.ts +0 -201
- package/template/packages/license-sdk/src/storage.ts +0 -64
- package/template/packages/license-sdk/src/test-fixtures.ts +0 -59
- package/template/packages/license-sdk/src/v1-test-vector.ts +0 -49
- package/template/packages/license-sdk/src/validation.test.ts +0 -62
- package/template/packages/license-sdk/src/validation.ts +0 -143
- package/template/packages/license-sdk/src/verification.test.ts +0 -97
- package/template/packages/license-sdk/src/verification.ts +0 -199
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { describe, expect, test } from "bun:test";
|
|
2
|
-
import { featureKey } from "@
|
|
2
|
+
import { featureKey, licenseVersionKey } from "@southwind-ai/shared";
|
|
3
3
|
import type { ModuleManifest } from "./manifest.js";
|
|
4
4
|
import { validateModuleComposition } from "./composition.js";
|
|
5
5
|
|
|
@@ -50,10 +50,83 @@ describe("Module Composition 契约", () => {
|
|
|
50
50
|
);
|
|
51
51
|
|
|
52
52
|
const audit = fixture("audit");
|
|
53
|
-
audit.tools[0]!.auditAction = "
|
|
53
|
+
audit.tools[0]!.auditAction = "audit.unknown";
|
|
54
54
|
expect(() => validateModuleComposition([audit])).toThrow("未注册审计动作");
|
|
55
55
|
});
|
|
56
56
|
|
|
57
|
+
test("业务模块可注册带展示信息的审计动作目录", () => {
|
|
58
|
+
const module = fixture("ticket");
|
|
59
|
+
module.auditActions.push({
|
|
60
|
+
key: "ticket.assign",
|
|
61
|
+
label: "工单指派",
|
|
62
|
+
description: "将工单指派给处理人。",
|
|
63
|
+
});
|
|
64
|
+
module.tools[0]!.auditAction = "ticket.assign";
|
|
65
|
+
|
|
66
|
+
expect(() => validateModuleComposition([module])).not.toThrow();
|
|
67
|
+
|
|
68
|
+
const unknown = fixture("unknown");
|
|
69
|
+
unknown.auditActions.push("unknown.action");
|
|
70
|
+
expect(() => validateModuleComposition([unknown])).toThrow(
|
|
71
|
+
"引用了未定义审计动作",
|
|
72
|
+
);
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
test("审计动作定义不可覆盖平台动作或重复注册", () => {
|
|
76
|
+
const platform = fixture("platform");
|
|
77
|
+
platform.auditActions.push({
|
|
78
|
+
key: "crud.create",
|
|
79
|
+
label: "覆盖动作",
|
|
80
|
+
description: "不允许覆盖平台定义。",
|
|
81
|
+
});
|
|
82
|
+
expect(() => validateModuleComposition([platform])).toThrow(
|
|
83
|
+
"审计动作定义重复:crud.create",
|
|
84
|
+
);
|
|
85
|
+
|
|
86
|
+
const first = fixture("first");
|
|
87
|
+
const second = fixture("second");
|
|
88
|
+
for (const module of [first, second]) {
|
|
89
|
+
module.auditActions.push({
|
|
90
|
+
key: "ticket.assign",
|
|
91
|
+
label: "工单指派",
|
|
92
|
+
description: "将工单指派给处理人。",
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
expect(() => validateModuleComposition([first, second])).toThrow(
|
|
96
|
+
"审计动作定义重复:ticket.assign",
|
|
97
|
+
);
|
|
98
|
+
});
|
|
99
|
+
|
|
100
|
+
test("Feature 依赖未知、自依赖和循环时 fail-fast", () => {
|
|
101
|
+
const unknown = fixture("unknown");
|
|
102
|
+
unknown.features[0]!.dependencies = [featureKey("missing.feature")];
|
|
103
|
+
expect(() => validateModuleComposition([unknown])).toThrow(
|
|
104
|
+
"引用了未注册依赖",
|
|
105
|
+
);
|
|
106
|
+
|
|
107
|
+
const self = fixture("self");
|
|
108
|
+
self.features[0]!.dependencies = [featureKey("self.feature")];
|
|
109
|
+
expect(() => validateModuleComposition([self])).toThrow("不能依赖自身");
|
|
110
|
+
|
|
111
|
+
const first = fixture("first");
|
|
112
|
+
const second = fixture("second");
|
|
113
|
+
first.features[0]!.dependencies = [featureKey("second.feature")];
|
|
114
|
+
second.features[0]!.dependencies = [featureKey("first.feature")];
|
|
115
|
+
expect(() => validateModuleComposition([first, second])).toThrow(
|
|
116
|
+
"Feature 依赖存在循环",
|
|
117
|
+
);
|
|
118
|
+
});
|
|
119
|
+
|
|
120
|
+
test("Feature 只能引用 License Catalog 中的版本", () => {
|
|
121
|
+
const module = fixture("license");
|
|
122
|
+
module.features[0]!.allowedLicenseVersions = [
|
|
123
|
+
licenseVersionKey("enterprise"),
|
|
124
|
+
];
|
|
125
|
+
expect(() => validateModuleComposition([module])).toThrow(
|
|
126
|
+
"引用了未知 License 版本:enterprise",
|
|
127
|
+
);
|
|
128
|
+
});
|
|
129
|
+
|
|
57
130
|
test("菜单 Guard 必须与 Admin Route 一致", () => {
|
|
58
131
|
const module = fixture("system");
|
|
59
132
|
module.adminRoutes[0]!.permissionKey = "system.manage";
|
|
@@ -1,9 +1,12 @@
|
|
|
1
|
-
import type { MenuNode } from "@
|
|
1
|
+
import type { MenuNode } from "@southwind-ai/shared";
|
|
2
2
|
import type {
|
|
3
3
|
ModuleImplementationBindings,
|
|
4
4
|
ModuleManifest,
|
|
5
5
|
} from "./manifest.js";
|
|
6
|
+
import { validateAiOperations } from "./ai-operation-composition.js";
|
|
7
|
+
import { validateImplementationBindings } from "./implementation-bindings.js";
|
|
6
8
|
import { composeModuleMenus } from "./menu-composition.js";
|
|
9
|
+
import { validateCapabilityCatalogs } from "./catalog-validation.js";
|
|
7
10
|
|
|
8
11
|
export interface ValidatedModuleComposition {
|
|
9
12
|
modules: readonly ModuleManifest[];
|
|
@@ -31,7 +34,8 @@ export function validateModuleComposition(
|
|
|
31
34
|
"Feature",
|
|
32
35
|
modules.flatMap((module) => module.features.map(({ key }) => key)),
|
|
33
36
|
);
|
|
34
|
-
const
|
|
37
|
+
const catalogs = validateCapabilityCatalogs(modules);
|
|
38
|
+
const audits = new Set(catalogs.auditActions.map(({ key }) => key));
|
|
35
39
|
const menus = composeModuleMenus(modules).flatMap((menu) =>
|
|
36
40
|
flattenMenus([menu]),
|
|
37
41
|
);
|
|
@@ -56,10 +60,16 @@ export function validateModuleComposition(
|
|
|
56
60
|
tasks.map(({ key }) => key),
|
|
57
61
|
);
|
|
58
62
|
const tools = modules.flatMap((module) => module.tools);
|
|
59
|
-
unique(
|
|
63
|
+
const toolKeys = unique(
|
|
60
64
|
"Agent Tool",
|
|
61
65
|
tools.map(({ key }) => key),
|
|
62
66
|
);
|
|
67
|
+
const aiOperations = validateAiOperations(modules, {
|
|
68
|
+
permissions,
|
|
69
|
+
features,
|
|
70
|
+
audits,
|
|
71
|
+
tools: toolKeys,
|
|
72
|
+
});
|
|
63
73
|
const providers = modules.flatMap((module) => module.providers);
|
|
64
74
|
unique(
|
|
65
75
|
"Provider",
|
|
@@ -90,30 +100,16 @@ export function validateModuleComposition(
|
|
|
90
100
|
}
|
|
91
101
|
validateMenuRoutes(menus, adminRoutes);
|
|
92
102
|
validateSchemaMigrations(schemas);
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
validateImplementations(
|
|
104
|
-
"定时任务",
|
|
105
|
-
tasks.map(({ key }) => key),
|
|
106
|
-
implementations.tasks,
|
|
107
|
-
);
|
|
108
|
-
validateImplementations(
|
|
109
|
-
"Agent Tool",
|
|
110
|
-
tools.map(({ key }) => key),
|
|
111
|
-
implementations.tools,
|
|
112
|
-
);
|
|
113
|
-
validateImplementations(
|
|
114
|
-
"Provider",
|
|
115
|
-
providers.map(({ key }) => key),
|
|
116
|
-
implementations.providers,
|
|
103
|
+
validateImplementationBindings(
|
|
104
|
+
{
|
|
105
|
+
adminRoutes: adminRoutes.map(({ key }) => key),
|
|
106
|
+
apiRoutes: apiRoutes.map(apiRouteKey),
|
|
107
|
+
tasks: tasks.map(({ key }) => key),
|
|
108
|
+
tools: tools.map(({ key }) => key),
|
|
109
|
+
providers: providers.map(({ key }) => key),
|
|
110
|
+
},
|
|
111
|
+
aiOperations,
|
|
112
|
+
implementations,
|
|
117
113
|
);
|
|
118
114
|
|
|
119
115
|
return { modules, moduleOrder };
|
|
@@ -316,18 +312,6 @@ function validateSchemaMigrations(
|
|
|
316
312
|
}
|
|
317
313
|
}
|
|
318
314
|
|
|
319
|
-
function validateImplementations(
|
|
320
|
-
label: string,
|
|
321
|
-
declarations: readonly string[],
|
|
322
|
-
implementations: readonly string[] | undefined,
|
|
323
|
-
): void {
|
|
324
|
-
if (!implementations) return;
|
|
325
|
-
const registered = unique(`${label} Handler`, implementations);
|
|
326
|
-
for (const key of declarations) {
|
|
327
|
-
if (!registered.has(key)) throw new Error(`${label} ${key} 缺少 Handler`);
|
|
328
|
-
}
|
|
329
|
-
}
|
|
330
|
-
|
|
331
315
|
function unique(label: string, values: readonly string[]): Set<string> {
|
|
332
316
|
const result = new Set<string>();
|
|
333
317
|
for (const value of values) {
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { validateAiOperationImplementations } from "./ai-operation-composition.js";
|
|
2
|
+
import type {
|
|
3
|
+
ModuleAiOperationDefinition,
|
|
4
|
+
ModuleImplementationBindings,
|
|
5
|
+
} from "./manifest.js";
|
|
6
|
+
|
|
7
|
+
interface ModuleDeclarationKeys {
|
|
8
|
+
adminRoutes: readonly string[];
|
|
9
|
+
apiRoutes: readonly string[];
|
|
10
|
+
tasks: readonly string[];
|
|
11
|
+
tools: readonly string[];
|
|
12
|
+
providers: readonly string[];
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export function validateImplementationBindings(
|
|
16
|
+
declarations: ModuleDeclarationKeys,
|
|
17
|
+
aiOperations: readonly ModuleAiOperationDefinition[],
|
|
18
|
+
implementations: ModuleImplementationBindings,
|
|
19
|
+
): void {
|
|
20
|
+
validateImplementations(
|
|
21
|
+
"Admin Route",
|
|
22
|
+
declarations.adminRoutes,
|
|
23
|
+
implementations.adminRoutes,
|
|
24
|
+
);
|
|
25
|
+
validateImplementations(
|
|
26
|
+
"API Route",
|
|
27
|
+
declarations.apiRoutes,
|
|
28
|
+
implementations.apiRoutes,
|
|
29
|
+
);
|
|
30
|
+
validateImplementations(
|
|
31
|
+
"定时任务",
|
|
32
|
+
declarations.tasks,
|
|
33
|
+
implementations.tasks,
|
|
34
|
+
);
|
|
35
|
+
validateImplementations(
|
|
36
|
+
"Agent Tool",
|
|
37
|
+
declarations.tools,
|
|
38
|
+
implementations.tools,
|
|
39
|
+
);
|
|
40
|
+
validateAiOperationImplementations(
|
|
41
|
+
aiOperations,
|
|
42
|
+
implementations.aiOperations,
|
|
43
|
+
);
|
|
44
|
+
validateImplementations(
|
|
45
|
+
"Provider",
|
|
46
|
+
declarations.providers,
|
|
47
|
+
implementations.providers,
|
|
48
|
+
);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
function validateImplementations(
|
|
52
|
+
label: string,
|
|
53
|
+
declarations: readonly string[],
|
|
54
|
+
implementations: readonly string[] | undefined,
|
|
55
|
+
): void {
|
|
56
|
+
if (!implementations) return;
|
|
57
|
+
const registered = unique(`${label} Handler`, implementations);
|
|
58
|
+
for (const key of declarations) {
|
|
59
|
+
if (!registered.has(key)) throw new Error(`${label} ${key} 缺少 Handler`);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
function unique(label: string, values: readonly string[]): Set<string> {
|
|
64
|
+
const result = new Set<string>();
|
|
65
|
+
for (const value of values) {
|
|
66
|
+
if (result.has(value)) throw new Error(`${label} Key 重复:${value}`);
|
|
67
|
+
result.add(value);
|
|
68
|
+
}
|
|
69
|
+
return result;
|
|
70
|
+
}
|
|
@@ -1,23 +1,20 @@
|
|
|
1
1
|
import type {
|
|
2
2
|
ApiPermissionBinding,
|
|
3
|
+
AuditActionRegistration,
|
|
3
4
|
AuditActionType,
|
|
4
5
|
DataGovernancePolicyDefinition,
|
|
5
6
|
FeatureFlagDefinition,
|
|
6
|
-
|
|
7
|
+
MigrationBundle,
|
|
8
|
+
MigrationDefinition,
|
|
7
9
|
MenuNode,
|
|
8
10
|
PermissionDefinition,
|
|
9
11
|
SearchProviderManifestDefinition,
|
|
10
|
-
} from "@
|
|
12
|
+
} from "@southwind-ai/shared";
|
|
11
13
|
|
|
12
|
-
export type
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
module: string;
|
|
17
|
-
description: string;
|
|
18
|
-
direction: MigrationDirection;
|
|
19
|
-
run(context: MigrationExecutionContext): Promise<void>;
|
|
20
|
-
}
|
|
14
|
+
export type {
|
|
15
|
+
MigrationDefinition,
|
|
16
|
+
MigrationDirection,
|
|
17
|
+
} from "@southwind-ai/shared";
|
|
21
18
|
|
|
22
19
|
export interface ModuleToolDefinition {
|
|
23
20
|
key: string;
|
|
@@ -65,6 +62,37 @@ export interface ModuleScheduledTaskDefinition {
|
|
|
65
62
|
retryDelaySeconds: number;
|
|
66
63
|
}
|
|
67
64
|
|
|
65
|
+
export type AiOperationKind = "agent" | "document" | "speech";
|
|
66
|
+
export type AiOperationDataClassification = "public" | "internal" | "sensitive";
|
|
67
|
+
export type AiOperationExecution =
|
|
68
|
+
| "interactive"
|
|
69
|
+
| "streaming"
|
|
70
|
+
| "background"
|
|
71
|
+
| "live";
|
|
72
|
+
export type AiOperationPublicNetworkAccess = "forbidden" | "allowed";
|
|
73
|
+
|
|
74
|
+
export interface AiOperationLimits {
|
|
75
|
+
maxDurationSeconds: number;
|
|
76
|
+
maxInputBytes: number;
|
|
77
|
+
maxOutputBytes: number;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
export interface ModuleAiOperationDefinition {
|
|
81
|
+
key: string;
|
|
82
|
+
kind: AiOperationKind;
|
|
83
|
+
featureKey: string;
|
|
84
|
+
permissionKey: string;
|
|
85
|
+
auditAction: AuditActionType;
|
|
86
|
+
inputSchemaKey: string;
|
|
87
|
+
outputSchemaKey: string;
|
|
88
|
+
requiredCapabilities: readonly string[];
|
|
89
|
+
allowedToolKeys: readonly string[];
|
|
90
|
+
dataClassification: AiOperationDataClassification;
|
|
91
|
+
execution: AiOperationExecution;
|
|
92
|
+
publicNetworkAccess: AiOperationPublicNetworkAccess;
|
|
93
|
+
limits: AiOperationLimits;
|
|
94
|
+
}
|
|
95
|
+
|
|
68
96
|
export interface ModuleManifest {
|
|
69
97
|
name: string;
|
|
70
98
|
version: string;
|
|
@@ -77,12 +105,14 @@ export interface ModuleManifest {
|
|
|
77
105
|
apiPermissions: ApiPermissionBinding[];
|
|
78
106
|
features: FeatureFlagDefinition[];
|
|
79
107
|
migrations: MigrationDefinition[];
|
|
108
|
+
migrationBundle?: MigrationBundle;
|
|
80
109
|
schemaExports: ModuleSchemaExportDefinition[];
|
|
81
110
|
tasks: ModuleScheduledTaskDefinition[];
|
|
82
111
|
tools: ModuleToolDefinition[];
|
|
112
|
+
aiOperations?: ModuleAiOperationDefinition[];
|
|
83
113
|
providers: Array<ModuleProviderDefinition | SearchProviderManifestDefinition>;
|
|
84
114
|
dataPolicies?: DataGovernancePolicyDefinition[];
|
|
85
|
-
auditActions:
|
|
115
|
+
auditActions: AuditActionRegistration[];
|
|
86
116
|
metadata?: Record<string, unknown>;
|
|
87
117
|
}
|
|
88
118
|
|
|
@@ -93,5 +123,6 @@ export interface ModuleImplementationBindings {
|
|
|
93
123
|
apiRoutes?: readonly string[];
|
|
94
124
|
tasks?: readonly string[];
|
|
95
125
|
tools?: readonly string[];
|
|
126
|
+
aiOperations?: readonly string[];
|
|
96
127
|
providers?: readonly string[];
|
|
97
128
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ApiPermissionBinding } from "@
|
|
1
|
+
import type { ApiPermissionBinding } from "@southwind-ai/shared";
|
|
2
2
|
import { binding, resourceBindings } from "./system-api-binding.js";
|
|
3
3
|
// @windy-module system.data-governance begin
|
|
4
4
|
import { dataGovernanceApiPermissionBindings } from "./system-api-data-governance.js";
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@southwind-ai/server-sdk",
|
|
3
|
+
"version": "0.1.1",
|
|
4
|
+
"license": "UNLICENSED",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"engines": {
|
|
7
|
+
"bun": ">=1.3.0"
|
|
8
|
+
},
|
|
9
|
+
"files": [
|
|
10
|
+
"index.ts",
|
|
11
|
+
"src/module-host.ts"
|
|
12
|
+
],
|
|
13
|
+
"scripts": {
|
|
14
|
+
"typecheck": "tsc --noEmit --project tsconfig.json"
|
|
15
|
+
},
|
|
16
|
+
"dependencies": {
|
|
17
|
+
"@southwind-ai/jobs": "workspace:*"
|
|
18
|
+
},
|
|
19
|
+
"exports": {
|
|
20
|
+
".": "./index.ts"
|
|
21
|
+
},
|
|
22
|
+
"publishConfig": {
|
|
23
|
+
"access": "public"
|
|
24
|
+
}
|
|
25
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { DurableHandlerDefinition } from "@southwind-ai/jobs";
|
|
2
|
+
|
|
3
|
+
export interface ModuleUploadPolicy {
|
|
4
|
+
purpose: string;
|
|
5
|
+
maxByteSize: number;
|
|
6
|
+
maxPartByteSize: number;
|
|
7
|
+
sessionTtlMs: number;
|
|
8
|
+
allowedTypes: Readonly<Record<string, readonly string[]>>;
|
|
9
|
+
signature?: "image" | "none";
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* 模块作用域 Host。注册的任务 Key 与上传用途必须使用初始化器模块名作为命名空间。
|
|
14
|
+
*/
|
|
15
|
+
export interface ModuleHost {
|
|
16
|
+
readonly moduleName: string;
|
|
17
|
+
registerUploadPolicy(policy: ModuleUploadPolicy): void;
|
|
18
|
+
registerDurableHandler<T>(definition: DurableHandlerDefinition<T>): void;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* 已安装模块的 Server 初始化入口。
|
|
23
|
+
*
|
|
24
|
+
* 初始化器在 Storage 与 Durable Job 运行时创建前顺序执行;这里只注册定义,不启动 Worker。
|
|
25
|
+
*/
|
|
26
|
+
export interface ModuleInitializer {
|
|
27
|
+
readonly moduleName: string;
|
|
28
|
+
initialize(host: ModuleHost): Promise<void> | void;
|
|
29
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "esnext",
|
|
4
|
+
"module": "esnext",
|
|
5
|
+
"lib": ["esnext", "dom"],
|
|
6
|
+
"moduleResolution": "bundler",
|
|
7
|
+
"strict": true,
|
|
8
|
+
"noImplicitAny": true,
|
|
9
|
+
"esModuleInterop": true,
|
|
10
|
+
"skipLibCheck": true,
|
|
11
|
+
"outDir": "dist",
|
|
12
|
+
"types": ["bun"]
|
|
13
|
+
},
|
|
14
|
+
"include": ["src/**/*", "index.ts"],
|
|
15
|
+
"exclude": ["node_modules", "dist"]
|
|
16
|
+
}
|
|
@@ -3,6 +3,8 @@ export * from "./src/database.js";
|
|
|
3
3
|
export * from "./src/data-governance.js";
|
|
4
4
|
export * from "./src/feature.js";
|
|
5
5
|
export * from "./src/license.js";
|
|
6
|
+
export * from "./src/license-catalog.js";
|
|
7
|
+
export * from "./src/migration.js";
|
|
6
8
|
export * from "./src/module-configuration.js";
|
|
7
9
|
export * from "./src/correlation.js";
|
|
8
10
|
export * from "./src/notification.js";
|
|
@@ -1,9 +1,20 @@
|
|
|
1
1
|
{
|
|
2
|
-
"name": "@
|
|
3
|
-
"version": "0.1.
|
|
4
|
-
"
|
|
2
|
+
"name": "@southwind-ai/shared",
|
|
3
|
+
"version": "0.1.1",
|
|
4
|
+
"license": "UNLICENSED",
|
|
5
5
|
"type": "module",
|
|
6
|
+
"engines": {
|
|
7
|
+
"bun": ">=1.3.0"
|
|
8
|
+
},
|
|
9
|
+
"files": [
|
|
10
|
+
"index.ts",
|
|
11
|
+
"src/**/*.ts",
|
|
12
|
+
"!src/**/*.test.ts"
|
|
13
|
+
],
|
|
6
14
|
"exports": {
|
|
7
15
|
".": "./index.ts"
|
|
16
|
+
},
|
|
17
|
+
"publishConfig": {
|
|
18
|
+
"access": "public"
|
|
8
19
|
}
|
|
9
20
|
}
|
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
import type { EntityId, ISODateTime } from "./primitives.js";
|
|
2
2
|
|
|
3
|
+
export interface AuditActionDefinition {
|
|
4
|
+
key: AuditActionType;
|
|
5
|
+
label: string;
|
|
6
|
+
description: string;
|
|
7
|
+
}
|
|
8
|
+
|
|
3
9
|
export const AUDIT_ACTION_DEFINITIONS = [
|
|
4
10
|
{ key: "auth.login", label: "账号登录", description: "用户登录平台。" },
|
|
5
11
|
{ key: "auth.logout", label: "账号退出", description: "用户退出平台。" },
|
|
@@ -200,7 +206,22 @@ export const AUDIT_ACTION_DEFINITIONS = [
|
|
|
200
206
|
},
|
|
201
207
|
] as const;
|
|
202
208
|
|
|
203
|
-
export type
|
|
209
|
+
export type BuiltInAuditActionType =
|
|
210
|
+
(typeof AUDIT_ACTION_DEFINITIONS)[number]["key"];
|
|
211
|
+
|
|
212
|
+
/**
|
|
213
|
+
* 审计日志持久化保持字符串协议;业务动作是否有效由 Module Composition
|
|
214
|
+
* 对 AuditActionDefinition 目录进行 fail-fast 校验。
|
|
215
|
+
*/
|
|
216
|
+
export type AuditActionType = BuiltInAuditActionType | (string & {});
|
|
217
|
+
|
|
218
|
+
export type AuditActionRegistration = AuditActionType | AuditActionDefinition;
|
|
219
|
+
|
|
220
|
+
export function isAuditActionDefinition(
|
|
221
|
+
registration: AuditActionRegistration,
|
|
222
|
+
): registration is AuditActionDefinition {
|
|
223
|
+
return typeof registration !== "string";
|
|
224
|
+
}
|
|
204
225
|
|
|
205
226
|
export type AuditOutcome = "attempted" | "success" | "failure" | "denied";
|
|
206
227
|
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { describe, expect, test } from "bun:test";
|
|
2
|
+
import { LICENSE_CATALOG } from "./license-catalog.js";
|
|
3
|
+
|
|
4
|
+
describe("License Catalog", () => {
|
|
5
|
+
test("提供稳定且有序的默认产品版本", () => {
|
|
6
|
+
expect(LICENSE_CATALOG.map(({ key }) => key)).toEqual([
|
|
7
|
+
"free-trial",
|
|
8
|
+
"standard",
|
|
9
|
+
"advanced",
|
|
10
|
+
]);
|
|
11
|
+
expect(
|
|
12
|
+
LICENSE_CATALOG.every(
|
|
13
|
+
({ label, description }) => label.length > 0 && description.length > 0,
|
|
14
|
+
),
|
|
15
|
+
).toBe(true);
|
|
16
|
+
});
|
|
17
|
+
});
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { licenseVersionKey, type LicenseVersionKey } from "./license.js";
|
|
2
|
+
|
|
3
|
+
export interface LicenseCatalogDefinition {
|
|
4
|
+
key: LicenseVersionKey;
|
|
5
|
+
label: string;
|
|
6
|
+
description: string;
|
|
7
|
+
order: number;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export const LICENSE_CATALOG = [
|
|
11
|
+
{
|
|
12
|
+
key: licenseVersionKey("free-trial"),
|
|
13
|
+
label: "免费试用版",
|
|
14
|
+
description: "用于产品体验和非生产验证的基础版本。",
|
|
15
|
+
order: 10,
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
key: licenseVersionKey("standard"),
|
|
19
|
+
label: "标准版",
|
|
20
|
+
description: "面向常规企业业务场景的标准能力版本。",
|
|
21
|
+
order: 20,
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
key: licenseVersionKey("advanced"),
|
|
25
|
+
label: "高级版",
|
|
26
|
+
description: "包含高级治理、自动化和大批量处理能力。",
|
|
27
|
+
order: 30,
|
|
28
|
+
},
|
|
29
|
+
] as const satisfies readonly LicenseCatalogDefinition[];
|
|
30
|
+
|
|
31
|
+
export function licenseCatalogKeys(): ReadonlySet<LicenseVersionKey> {
|
|
32
|
+
return new Set(LICENSE_CATALOG.map(({ key }) => key));
|
|
33
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type { MigrationExecutionContext } from "./database.js";
|
|
2
|
+
|
|
3
|
+
export const MIGRATION_BUNDLE_FORMAT_VERSION = "1" as const;
|
|
4
|
+
|
|
5
|
+
export type MigrationDirection = "up" | "down";
|
|
6
|
+
|
|
7
|
+
export interface MigrationDefinition {
|
|
8
|
+
id: string;
|
|
9
|
+
module: string;
|
|
10
|
+
description: string;
|
|
11
|
+
direction: MigrationDirection;
|
|
12
|
+
checksum?: string;
|
|
13
|
+
dependsOn?: readonly string[];
|
|
14
|
+
run(context: MigrationExecutionContext): Promise<void>;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export interface BundleMigrationDefinition extends MigrationDefinition {
|
|
18
|
+
checksum: string;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export interface MigrationBundle {
|
|
22
|
+
formatVersion: typeof MIGRATION_BUNDLE_FORMAT_VERSION;
|
|
23
|
+
module: string;
|
|
24
|
+
version: string;
|
|
25
|
+
dependencies?: readonly string[];
|
|
26
|
+
migrations: readonly BundleMigrationDefinition[];
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export interface MigrationManifestSource {
|
|
30
|
+
name: string;
|
|
31
|
+
version: string;
|
|
32
|
+
dependencies?: readonly string[];
|
|
33
|
+
migrations: readonly MigrationDefinition[];
|
|
34
|
+
schemaExports?: readonly {
|
|
35
|
+
key: string;
|
|
36
|
+
migrationIds: readonly string[];
|
|
37
|
+
}[];
|
|
38
|
+
migrationBundle?: MigrationBundle;
|
|
39
|
+
}
|