create-windy 0.1.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/README.md +114 -0
- package/assets/LICENSE-Apache-2.0.txt +201 -0
- package/dist/cli.js +1662 -0
- package/package.json +37 -0
- package/template/.dockerignore +11 -0
- package/template/.oxfmtrc.json +9 -0
- package/template/.oxlintrc.json +119 -0
- package/template/.windy-template.json +71 -0
- package/template/AGENTS.md +87 -0
- package/template/README.md +128 -0
- package/template/apps/server/Dockerfile +34 -0
- package/template/apps/server/package.json +30 -0
- package/template/apps/server/src/access-guards.ts +112 -0
- package/template/apps/server/src/admin/routes.test.ts +105 -0
- package/template/apps/server/src/admin/routes.ts +95 -0
- package/template/apps/server/src/agent/data-scope-routes.test.ts +143 -0
- package/template/apps/server/src/agent/routes.test.ts +244 -0
- package/template/apps/server/src/agent/routes.ts +257 -0
- package/template/apps/server/src/api-app.ts +32 -0
- package/template/apps/server/src/application-services.ts +154 -0
- package/template/apps/server/src/audit/contracts.ts +21 -0
- package/template/apps/server/src/audit/drizzle-log-store.ts +150 -0
- package/template/apps/server/src/audit/policy.ts +18 -0
- package/template/apps/server/src/audit/recovery-queue.test.ts +42 -0
- package/template/apps/server/src/audit/recovery-queue.ts +63 -0
- package/template/apps/server/src/audit/redaction.ts +55 -0
- package/template/apps/server/src/audit/reliable-writer.test.ts +200 -0
- package/template/apps/server/src/audit/reliable-writer.ts +201 -0
- package/template/apps/server/src/audit/search-summary.ts +32 -0
- package/template/apps/server/src/auth/actor-resolver.test.ts +138 -0
- package/template/apps/server/src/auth/actor-resolver.ts +109 -0
- package/template/apps/server/src/auth/authentication-provider.test.ts +180 -0
- package/template/apps/server/src/auth/authentication-provider.ts +117 -0
- package/template/apps/server/src/auth/authorization-snapshot.test.ts +117 -0
- package/template/apps/server/src/auth/authorization-snapshot.ts +98 -0
- package/template/apps/server/src/auth/bearer-token.ts +5 -0
- package/template/apps/server/src/auth/bootstrap-admin.ts +33 -0
- package/template/apps/server/src/auth/credential-restriction.ts +29 -0
- package/template/apps/server/src/auth/credential-routes.test.ts +190 -0
- package/template/apps/server/src/auth/credential-service.ts +165 -0
- package/template/apps/server/src/auth/development-bypass.ts +22 -0
- package/template/apps/server/src/auth/drizzle-repository.ts +315 -0
- package/template/apps/server/src/auth/drizzle-session-operations.ts +119 -0
- package/template/apps/server/src/auth/login-routes.ts +121 -0
- package/template/apps/server/src/auth/own-session-routes.test.ts +248 -0
- package/template/apps/server/src/auth/own-session-routes.ts +110 -0
- package/template/apps/server/src/auth/password.test.ts +30 -0
- package/template/apps/server/src/auth/password.ts +46 -0
- package/template/apps/server/src/auth/repository.test.ts +61 -0
- package/template/apps/server/src/auth/repository.ts +305 -0
- package/template/apps/server/src/auth/routes.test.ts +350 -0
- package/template/apps/server/src/auth/routes.ts +237 -0
- package/template/apps/server/src/auth/runtime.ts +20 -0
- package/template/apps/server/src/auth/service.ts +329 -0
- package/template/apps/server/src/auth/session-service.ts +123 -0
- package/template/apps/server/src/background/task-guard.test.ts +66 -0
- package/template/apps/server/src/background/task-guard.ts +49 -0
- package/template/apps/server/src/bulk-data/artifact-store.ts +82 -0
- package/template/apps/server/src/bulk-data/dictionary-handler.ts +122 -0
- package/template/apps/server/src/bulk-data/drizzle-repository.integration.test.ts +156 -0
- package/template/apps/server/src/bulk-data/drizzle-repository.ts +298 -0
- package/template/apps/server/src/bulk-data/helpers.ts +36 -0
- package/template/apps/server/src/bulk-data/input-validation.ts +99 -0
- package/template/apps/server/src/bulk-data/repository.ts +246 -0
- package/template/apps/server/src/bulk-data/resource-handler.ts +27 -0
- package/template/apps/server/src/bulk-data/routes.test.ts +169 -0
- package/template/apps/server/src/bulk-data/routes.ts +248 -0
- package/template/apps/server/src/bulk-data/scheduler-integration.test.ts +142 -0
- package/template/apps/server/src/bulk-data/service.test.ts +347 -0
- package/template/apps/server/src/bulk-data/service.ts +319 -0
- package/template/apps/server/src/bulk-data/types.ts +73 -0
- package/template/apps/server/src/configuration/bootstrap.ts +59 -0
- package/template/apps/server/src/configuration/definition.ts +89 -0
- package/template/apps/server/src/configuration/drizzle-repository.ts +166 -0
- package/template/apps/server/src/configuration/repository.ts +138 -0
- package/template/apps/server/src/configuration/routes.test.ts +178 -0
- package/template/apps/server/src/configuration/routes.ts +260 -0
- package/template/apps/server/src/configuration/service.test.ts +128 -0
- package/template/apps/server/src/configuration/service.ts +187 -0
- package/template/apps/server/src/data-access/context.ts +162 -0
- package/template/apps/server/src/data-access/department-tree.ts +27 -0
- package/template/apps/server/src/data-access/drizzle-predicate.test.ts +86 -0
- package/template/apps/server/src/data-access/drizzle-predicate.ts +50 -0
- package/template/apps/server/src/data-access/errors.ts +5 -0
- package/template/apps/server/src/data-access/platform-actor.ts +25 -0
- package/template/apps/server/src/data-access/query-specification.test.ts +82 -0
- package/template/apps/server/src/data-access/query-specification.ts +77 -0
- package/template/apps/server/src/data-access/scoped-repository.integration.test.ts +203 -0
- package/template/apps/server/src/data-access/scoped-repository.ts +268 -0
- package/template/apps/server/src/data-access/scoped-resource.test.ts +158 -0
- package/template/apps/server/src/data-access/scoped-resource.ts +141 -0
- package/template/apps/server/src/data-governance/export/approval-port.ts +84 -0
- package/template/apps/server/src/data-governance/export/authorization-port.test.ts +103 -0
- package/template/apps/server/src/data-governance/export/authorization-port.ts +69 -0
- package/template/apps/server/src/data-governance/export/drizzle-repository.integration.test.ts +88 -0
- package/template/apps/server/src/data-governance/export/drizzle-repository.ts +97 -0
- package/template/apps/server/src/data-governance/export/job-runtime.test.ts +339 -0
- package/template/apps/server/src/data-governance/export/job-runtime.ts +242 -0
- package/template/apps/server/src/data-governance/export/ndjson-stream.ts +62 -0
- package/template/apps/server/src/data-governance/export/postgres-api-actors.ts +140 -0
- package/template/apps/server/src/data-governance/export/postgres-api-assertions.ts +76 -0
- package/template/apps/server/src/data-governance/export/postgres-api-fixture.ts +265 -0
- package/template/apps/server/src/data-governance/export/postgres-api.integration.test.ts +298 -0
- package/template/apps/server/src/data-governance/export/postgres-recovery.integration.test.ts +344 -0
- package/template/apps/server/src/data-governance/export/repository.test.ts +55 -0
- package/template/apps/server/src/data-governance/export/repository.ts +83 -0
- package/template/apps/server/src/data-governance/export/request-fingerprint.test.ts +51 -0
- package/template/apps/server/src/data-governance/export/request-fingerprint.ts +45 -0
- package/template/apps/server/src/data-governance/export/routes-integrity.test.ts +90 -0
- package/template/apps/server/src/data-governance/export/routes-test-fixture.ts +239 -0
- package/template/apps/server/src/data-governance/export/routes.test.ts +182 -0
- package/template/apps/server/src/data-governance/export/routes.ts +215 -0
- package/template/apps/server/src/data-governance/export/scope-snapshot.test.ts +45 -0
- package/template/apps/server/src/data-governance/export/scope-snapshot.ts +27 -0
- package/template/apps/server/src/data-governance/export/service.ts +337 -0
- package/template/apps/server/src/data-governance/export/source.ts +69 -0
- package/template/apps/server/src/data-governance/export/types.ts +55 -0
- package/template/apps/server/src/data-governance/plaintext-access.test.ts +70 -0
- package/template/apps/server/src/data-governance/plaintext-access.ts +88 -0
- package/template/apps/server/src/data-governance/plaintext-postgres.integration.test.ts +223 -0
- package/template/apps/server/src/data-governance/user-plaintext-routes.test.ts +287 -0
- package/template/apps/server/src/data-governance/user-plaintext-routes.ts +181 -0
- package/template/apps/server/src/data-governance/user-projection.ts +54 -0
- package/template/apps/server/src/data-governance/user-sensitive-read-service.ts +54 -0
- package/template/apps/server/src/example-modules.ts +62 -0
- package/template/apps/server/src/example-permissions.ts +5 -0
- package/template/apps/server/src/feature/manifest-feature-repository.test.ts +187 -0
- package/template/apps/server/src/feature/manifest-feature-repository.ts +200 -0
- package/template/apps/server/src/feature/routes.authorization.test.ts +199 -0
- package/template/apps/server/src/feature/routes.ts +193 -0
- package/template/apps/server/src/foundation-access.test.ts +50 -0
- package/template/apps/server/src/foundation-access.ts +34 -0
- package/template/apps/server/src/foundation-route.ts +55 -0
- package/template/apps/server/src/foundation.ts +85 -0
- package/template/apps/server/src/guards.test.ts +74 -0
- package/template/apps/server/src/guards.ts +214 -0
- package/template/apps/server/src/http-app.test.ts +77 -0
- package/template/apps/server/src/http-app.ts +51 -0
- package/template/apps/server/src/index.ts +374 -0
- package/template/apps/server/src/jobs/artifact-service.test.ts +78 -0
- package/template/apps/server/src/jobs/artifact-service.ts +94 -0
- package/template/apps/server/src/jobs/drizzle-artifact.ts +63 -0
- package/template/apps/server/src/jobs/drizzle-claim.ts +111 -0
- package/template/apps/server/src/jobs/drizzle-execution-repository.ts +299 -0
- package/template/apps/server/src/jobs/drizzle-execution.integration.test.ts +232 -0
- package/template/apps/server/src/jobs/drizzle-lease.ts +21 -0
- package/template/apps/server/src/jobs/drizzle-mappers.ts +121 -0
- package/template/apps/server/src/jobs/drizzle-recovery-repository.ts +214 -0
- package/template/apps/server/src/jobs/drizzle-repository.integration.test.ts +135 -0
- package/template/apps/server/src/jobs/drizzle-repository.ts +268 -0
- package/template/apps/server/src/jobs/execution-repository.ts +72 -0
- package/template/apps/server/src/jobs/execution.test.ts +303 -0
- package/template/apps/server/src/jobs/handler-registry.ts +81 -0
- package/template/apps/server/src/jobs/in-memory-claim.ts +96 -0
- package/template/apps/server/src/jobs/in-memory-execution.ts +336 -0
- package/template/apps/server/src/jobs/in-memory-lease.ts +66 -0
- package/template/apps/server/src/jobs/legacy-adapter.integration.test.ts +177 -0
- package/template/apps/server/src/jobs/legacy-adapter.test.ts +199 -0
- package/template/apps/server/src/jobs/legacy-adapter.ts +109 -0
- package/template/apps/server/src/jobs/legacy-service-runtime.ts +95 -0
- package/template/apps/server/src/jobs/repository.ts +141 -0
- package/template/apps/server/src/jobs/service.test.ts +64 -0
- package/template/apps/server/src/jobs/service.ts +44 -0
- package/template/apps/server/src/jobs/types.ts +180 -0
- package/template/apps/server/src/jobs/worker.ts +258 -0
- package/template/apps/server/src/license/legacy-license-resolver.ts +23 -0
- package/template/apps/server/src/license/license-resolver.test.ts +55 -0
- package/template/apps/server/src/license/license-resolver.ts +122 -0
- package/template/apps/server/src/license/reminder.test.ts +61 -0
- package/template/apps/server/src/license/reminder.ts +33 -0
- package/template/apps/server/src/license/restriction.test.ts +54 -0
- package/template/apps/server/src/license/restriction.ts +80 -0
- package/template/apps/server/src/license/routes-offline-code.test.ts +173 -0
- package/template/apps/server/src/license/routes.ts +99 -0
- package/template/apps/server/src/license/runtime-audit-reliability.test.ts +96 -0
- package/template/apps/server/src/license/runtime-reminder.test.ts +147 -0
- package/template/apps/server/src/license/runtime-service-test-http.ts +28 -0
- package/template/apps/server/src/license/runtime-service.test.ts +334 -0
- package/template/apps/server/src/license/runtime-service.ts +308 -0
- package/template/apps/server/src/module-composition.test.ts +70 -0
- package/template/apps/server/src/module-composition.ts +28 -0
- package/template/apps/server/src/notification/drizzle-repository.ts +233 -0
- package/template/apps/server/src/notification/repository.ts +160 -0
- package/template/apps/server/src/notification/routes.test.ts +151 -0
- package/template/apps/server/src/notification/routes.ts +185 -0
- package/template/apps/server/src/observability/bootstrap.ts +56 -0
- package/template/apps/server/src/observability/http-observability.test.ts +53 -0
- package/template/apps/server/src/observability/http-observability.ts +54 -0
- package/template/apps/server/src/observability/metrics.test.ts +36 -0
- package/template/apps/server/src/observability/metrics.ts +105 -0
- package/template/apps/server/src/observability/readiness.test.ts +36 -0
- package/template/apps/server/src/observability/readiness.ts +43 -0
- package/template/apps/server/src/observability/routes.test.ts +61 -0
- package/template/apps/server/src/observability/routes.ts +44 -0
- package/template/apps/server/src/pagination.ts +31 -0
- package/template/apps/server/src/persistence.integration.test.ts +54 -0
- package/template/apps/server/src/persistence.ts +118 -0
- package/template/apps/server/src/profile/routes.test.ts +190 -0
- package/template/apps/server/src/profile/routes.ts +173 -0
- package/template/apps/server/src/request-restriction.ts +29 -0
- package/template/apps/server/src/route-guards.test.ts +148 -0
- package/template/apps/server/src/route-guards.ts +63 -0
- package/template/apps/server/src/runtime-audit-list.test.ts +98 -0
- package/template/apps/server/src/runtime-config.ts +11 -0
- package/template/apps/server/src/runtime-development.ts +68 -0
- package/template/apps/server/src/runtime-license.ts +50 -0
- package/template/apps/server/src/runtime.test.ts +264 -0
- package/template/apps/server/src/runtime.ts +324 -0
- package/template/apps/server/src/scheduler/audit.ts +38 -0
- package/template/apps/server/src/scheduler/definitions.test.ts +35 -0
- package/template/apps/server/src/scheduler/definitions.ts +79 -0
- package/template/apps/server/src/scheduler/drizzle-durable-links.ts +52 -0
- package/template/apps/server/src/scheduler/drizzle-mappers.ts +36 -0
- package/template/apps/server/src/scheduler/drizzle-repository.integration.test.ts +174 -0
- package/template/apps/server/src/scheduler/drizzle-repository.ts +348 -0
- package/template/apps/server/src/scheduler/execution-context.ts +24 -0
- package/template/apps/server/src/scheduler/execution-recorder.ts +101 -0
- package/template/apps/server/src/scheduler/feature-preflight.ts +40 -0
- package/template/apps/server/src/scheduler/history.ts +22 -0
- package/template/apps/server/src/scheduler/overview.test.ts +89 -0
- package/template/apps/server/src/scheduler/overview.ts +125 -0
- package/template/apps/server/src/scheduler/recovery-conflict.ts +19 -0
- package/template/apps/server/src/scheduler/recovery-service.test.ts +238 -0
- package/template/apps/server/src/scheduler/recovery-service.ts +152 -0
- package/template/apps/server/src/scheduler/repository.ts +274 -0
- package/template/apps/server/src/scheduler/routes.test.ts +347 -0
- package/template/apps/server/src/scheduler/routes.ts +222 -0
- package/template/apps/server/src/scheduler/sensitive-text.ts +20 -0
- package/template/apps/server/src/scheduler/service-idle.test.ts +73 -0
- package/template/apps/server/src/scheduler/service.test.ts +330 -0
- package/template/apps/server/src/scheduler/service.ts +339 -0
- package/template/apps/server/src/scheduler/types.ts +103 -0
- package/template/apps/server/src/scheduler/worker.ts +38 -0
- package/template/apps/server/src/search/config.test.ts +43 -0
- package/template/apps/server/src/search/config.ts +62 -0
- package/template/apps/server/src/search/contracts.ts +127 -0
- package/template/apps/server/src/search/cursor.ts +39 -0
- package/template/apps/server/src/search/errors.ts +11 -0
- package/template/apps/server/src/search/host.ts +36 -0
- package/template/apps/server/src/search/masking.ts +6 -0
- package/template/apps/server/src/search/provider-execution.ts +195 -0
- package/template/apps/server/src/search/rate-limiter.ts +23 -0
- package/template/apps/server/src/search/registry.ts +105 -0
- package/template/apps/server/src/search/routes.test.ts +156 -0
- package/template/apps/server/src/search/routes.ts +95 -0
- package/template/apps/server/src/search/service.test.ts +314 -0
- package/template/apps/server/src/search/service.ts +257 -0
- package/template/apps/server/src/search/test-support.ts +122 -0
- package/template/apps/server/src/session/routes.test.ts +111 -0
- package/template/apps/server/src/session/routes.ts +56 -0
- package/template/apps/server/src/settings/drizzle-repository.ts +66 -0
- package/template/apps/server/src/settings/repository.ts +29 -0
- package/template/apps/server/src/settings/routes.test.ts +250 -0
- package/template/apps/server/src/settings/routes.ts +175 -0
- package/template/apps/server/src/settings/runtime.ts +13 -0
- package/template/apps/server/src/storage/blob-reference-registry.test.ts +25 -0
- package/template/apps/server/src/storage/blob-reference-registry.ts +15 -0
- package/template/apps/server/src/storage/drizzle-upload-repository.integration.test.ts +136 -0
- package/template/apps/server/src/storage/drizzle-upload-repository.ts +248 -0
- package/template/apps/server/src/storage/route-support.ts +84 -0
- package/template/apps/server/src/storage/routes.test.ts +288 -0
- package/template/apps/server/src/storage/routes.ts +297 -0
- package/template/apps/server/src/storage/runtime.ts +86 -0
- package/template/apps/server/src/system/audit-query.ts +17 -0
- package/template/apps/server/src/system/audit-routes.test.ts +139 -0
- package/template/apps/server/src/system/audit-routes.ts +113 -0
- package/template/apps/server/src/system/built-in-roles.ts +116 -0
- package/template/apps/server/src/system/department-routes.test.ts +80 -0
- package/template/apps/server/src/system/department-routes.ts +90 -0
- package/template/apps/server/src/system/drizzle-mapping.ts +53 -0
- package/template/apps/server/src/system/drizzle-repository.ts +298 -0
- package/template/apps/server/src/system/drizzle-scoped-repository.ts +235 -0
- package/template/apps/server/src/system/drizzle-system.ts +361 -0
- package/template/apps/server/src/system/entities.ts +78 -0
- package/template/apps/server/src/system/feature-routes.test.ts +55 -0
- package/template/apps/server/src/system/identity-route-config.ts +73 -0
- package/template/apps/server/src/system/interface-catalog.test.ts +103 -0
- package/template/apps/server/src/system/interface-catalog.ts +82 -0
- package/template/apps/server/src/system/menu-registry.test.ts +125 -0
- package/template/apps/server/src/system/menu-registry.ts +259 -0
- package/template/apps/server/src/system/menu-routes.test.ts +68 -0
- package/template/apps/server/src/system/menu-routes.ts +200 -0
- package/template/apps/server/src/system/mutation-runner.ts +33 -0
- package/template/apps/server/src/system/operation-monitoring.test.ts +78 -0
- package/template/apps/server/src/system/operation-monitoring.ts +233 -0
- package/template/apps/server/src/system/operations.test.ts +269 -0
- package/template/apps/server/src/system/operations.ts +155 -0
- package/template/apps/server/src/system/postgres-monitoring.ts +31 -0
- package/template/apps/server/src/system/redis-health.test.ts +116 -0
- package/template/apps/server/src/system/redis-health.ts +230 -0
- package/template/apps/server/src/system/repository.ts +234 -0
- package/template/apps/server/src/system/resource-access-response.ts +47 -0
- package/template/apps/server/src/system/resource-export-route.ts +64 -0
- package/template/apps/server/src/system/resource-route-support.ts +50 -0
- package/template/apps/server/src/system/response-projection.ts +24 -0
- package/template/apps/server/src/system/route-helpers.ts +104 -0
- package/template/apps/server/src/system/route-test-app.ts +27 -0
- package/template/apps/server/src/system/route-types.ts +52 -0
- package/template/apps/server/src/system/routes-validation.test.ts +61 -0
- package/template/apps/server/src/system/routes.test.ts +311 -0
- package/template/apps/server/src/system/routes.ts +354 -0
- package/template/apps/server/src/system/seed.test.ts +129 -0
- package/template/apps/server/src/system/seed.ts +237 -0
- package/template/apps/server/src/system/user-account-policy.test.ts +158 -0
- package/template/apps/server/src/system/user-account-policy.ts +103 -0
- package/template/apps/server/src/system/user-data-scope.ts +10 -0
- package/template/apps/server/src/system/user-department-validation.ts +17 -0
- package/template/apps/server/src/system/user-projection.test.ts +40 -0
- package/template/apps/server/src/system/user-projection.ts +35 -0
- package/template/apps/server/src/work-order/data-scope.integration.test.ts +171 -0
- package/template/apps/server/src/work-order/drizzle-repository.integration.test.ts +78 -0
- package/template/apps/server/src/work-order/drizzle-repository.ts +67 -0
- package/template/apps/server/src/work-order/foundation-modules.test.ts +85 -0
- package/template/apps/server/src/work-order/repository.ts +46 -0
- package/template/apps/server/src/work-order/routes.test.ts +209 -0
- package/template/apps/server/src/work-order/routes.ts +159 -0
- package/template/apps/server/src/work-order/search-api.test.ts +121 -0
- package/template/apps/server/src/work-order/search-provider.test.ts +201 -0
- package/template/apps/server/src/work-order/search-provider.ts +59 -0
- package/template/apps/server/src/work-order/service.ts +82 -0
- package/template/apps/server/src/work-order/task.test.ts +79 -0
- package/template/apps/server/src/work-order/task.ts +30 -0
- package/template/apps/server/src/workflow/assignee-directory.ts +23 -0
- package/template/apps/server/src/workflow/drizzle-repository.integration.test.ts +213 -0
- package/template/apps/server/src/workflow/drizzle-repository.ts +299 -0
- package/template/apps/server/src/workflow/effects.test.ts +64 -0
- package/template/apps/server/src/workflow/effects.ts +112 -0
- package/template/apps/server/src/workflow/repository.ts +160 -0
- package/template/apps/server/src/workflow/routes.test.ts +256 -0
- package/template/apps/server/src/workflow/routes.ts +249 -0
- package/template/apps/server/src/workflow/service.ts +196 -0
- package/template/apps/server/src/workflow/timeout-runtime.test.ts +96 -0
- package/template/apps/server/src/workflow/timeout-runtime.ts +66 -0
- package/template/apps/server/tsconfig.json +17 -0
- package/template/apps/web/Dockerfile +41 -0
- package/template/apps/web/components.json +24 -0
- package/template/apps/web/dev/dev-identity.ts +58 -0
- package/template/apps/web/dev/dev-port.test.ts +53 -0
- package/template/apps/web/dev/dev-port.ts +68 -0
- package/template/apps/web/dev/start.ts +37 -0
- package/template/apps/web/index.html +14 -0
- package/template/apps/web/package.json +44 -0
- package/template/apps/web/runtime-server.test.ts +86 -0
- package/template/apps/web/runtime-server.ts +143 -0
- package/template/apps/web/server.ts +21 -0
- package/template/apps/web/src/App.vue +22 -0
- package/template/apps/web/src/app/home/HomePage.vue +75 -0
- package/template/apps/web/src/app/home/HomeWelcome.vue +85 -0
- package/template/apps/web/src/app/home/HomeWelcome.webtest.ts +32 -0
- package/template/apps/web/src/app/layouts/AppLayout.vue +10 -0
- package/template/apps/web/src/components/auth/DevelopmentAuthWarning.vue +15 -0
- package/template/apps/web/src/components/auth/LoginForm.vue +80 -0
- package/template/apps/web/src/components/auth/LoginForm.webtest.ts +33 -0
- package/template/apps/web/src/components/auth/PasswordChangeForm.vue +90 -0
- package/template/apps/web/src/components/auth/UserSessionMenu.vue +60 -0
- package/template/apps/web/src/components/auth/UserSessionMenu.webtest.ts +45 -0
- package/template/apps/web/src/components/common/ConfirmDialog.vue +75 -0
- package/template/apps/web/src/components/common/DataPagination.vue +79 -0
- package/template/apps/web/src/components/common/DataPagination.webtest.ts +28 -0
- package/template/apps/web/src/components/common/EmptyState.vue +43 -0
- package/template/apps/web/src/components/common/FormDialog.vue +86 -0
- package/template/apps/web/src/components/common/ModalBody.vue +19 -0
- package/template/apps/web/src/components/common/ModalLayout.webtest.ts +54 -0
- package/template/apps/web/src/components/common/PageError.vue +46 -0
- package/template/apps/web/src/components/common/PageLoading.vue +41 -0
- package/template/apps/web/src/components/common/StatusSummary.vue +37 -0
- package/template/apps/web/src/components/common/UnsavedChangesDialog.vue +60 -0
- package/template/apps/web/src/components/common/UnsavedChangesDialog.webtest.ts +60 -0
- package/template/apps/web/src/components/license/LicenseActivationCodeForm.vue +80 -0
- package/template/apps/web/src/components/license/LicenseExpiryBanner.vue +54 -0
- package/template/apps/web/src/components/license/LicenseFlow.webtest.ts +170 -0
- package/template/apps/web/src/components/license/LicenseStatusCard.vue +95 -0
- package/template/apps/web/src/components/license/LicenseUploadForm.vue +79 -0
- package/template/apps/web/src/components/license/license-display.ts +12 -0
- package/template/apps/web/src/components/ui/alert/Alert.vue +21 -0
- package/template/apps/web/src/components/ui/alert/AlertAction.vue +17 -0
- package/template/apps/web/src/components/ui/alert/AlertDescription.vue +22 -0
- package/template/apps/web/src/components/ui/alert/AlertTitle.vue +22 -0
- package/template/apps/web/src/components/ui/alert/index.ts +25 -0
- package/template/apps/web/src/components/ui/badge/Badge.vue +29 -0
- package/template/apps/web/src/components/ui/badge/index.ts +28 -0
- package/template/apps/web/src/components/ui/breadcrumb/Breadcrumb.vue +18 -0
- package/template/apps/web/src/components/ui/breadcrumb/BreadcrumbEllipsis.vue +26 -0
- package/template/apps/web/src/components/ui/breadcrumb/BreadcrumbItem.vue +17 -0
- package/template/apps/web/src/components/ui/breadcrumb/BreadcrumbLink.vue +24 -0
- package/template/apps/web/src/components/ui/breadcrumb/BreadcrumbList.vue +22 -0
- package/template/apps/web/src/components/ui/breadcrumb/BreadcrumbPage.vue +20 -0
- package/template/apps/web/src/components/ui/breadcrumb/BreadcrumbSeparator.vue +23 -0
- package/template/apps/web/src/components/ui/breadcrumb/index.ts +7 -0
- package/template/apps/web/src/components/ui/button/Button.vue +31 -0
- package/template/apps/web/src/components/ui/button/index.ts +42 -0
- package/template/apps/web/src/components/ui/card/Card.vue +29 -0
- package/template/apps/web/src/components/ui/card/CardAction.vue +22 -0
- package/template/apps/web/src/components/ui/card/CardContent.vue +17 -0
- package/template/apps/web/src/components/ui/card/CardDescription.vue +17 -0
- package/template/apps/web/src/components/ui/card/CardFooter.vue +22 -0
- package/template/apps/web/src/components/ui/card/CardHeader.vue +22 -0
- package/template/apps/web/src/components/ui/card/CardTitle.vue +22 -0
- package/template/apps/web/src/components/ui/card/index.ts +7 -0
- package/template/apps/web/src/components/ui/checkbox/Checkbox.vue +41 -0
- package/template/apps/web/src/components/ui/checkbox/index.ts +1 -0
- package/template/apps/web/src/components/ui/dialog/Dialog.vue +15 -0
- package/template/apps/web/src/components/ui/dialog/DialogClose.vue +12 -0
- package/template/apps/web/src/components/ui/dialog/DialogContent.vue +62 -0
- package/template/apps/web/src/components/ui/dialog/DialogDescription.vue +30 -0
- package/template/apps/web/src/components/ui/dialog/DialogFooter.vue +33 -0
- package/template/apps/web/src/components/ui/dialog/DialogHeader.vue +17 -0
- package/template/apps/web/src/components/ui/dialog/DialogOverlay.vue +28 -0
- package/template/apps/web/src/components/ui/dialog/DialogScrollContent.vue +67 -0
- package/template/apps/web/src/components/ui/dialog/DialogTitle.vue +27 -0
- package/template/apps/web/src/components/ui/dialog/DialogTrigger.vue +12 -0
- package/template/apps/web/src/components/ui/dialog/index.ts +10 -0
- package/template/apps/web/src/components/ui/dropdown-menu/DropdownMenu.vue +19 -0
- package/template/apps/web/src/components/ui/dropdown-menu/DropdownMenuCheckboxItem.vue +50 -0
- package/template/apps/web/src/components/ui/dropdown-menu/DropdownMenuContent.vue +48 -0
- package/template/apps/web/src/components/ui/dropdown-menu/DropdownMenuGroup.vue +12 -0
- package/template/apps/web/src/components/ui/dropdown-menu/DropdownMenuItem.vue +41 -0
- package/template/apps/web/src/components/ui/dropdown-menu/DropdownMenuLabel.vue +30 -0
- package/template/apps/web/src/components/ui/dropdown-menu/DropdownMenuRadioGroup.vue +21 -0
- package/template/apps/web/src/components/ui/dropdown-menu/DropdownMenuRadioItem.vue +51 -0
- package/template/apps/web/src/components/ui/dropdown-menu/DropdownMenuSeparator.vue +23 -0
- package/template/apps/web/src/components/ui/dropdown-menu/DropdownMenuShortcut.vue +22 -0
- package/template/apps/web/src/components/ui/dropdown-menu/DropdownMenuSub.vue +19 -0
- package/template/apps/web/src/components/ui/dropdown-menu/DropdownMenuSubContent.vue +34 -0
- package/template/apps/web/src/components/ui/dropdown-menu/DropdownMenuSubTrigger.vue +36 -0
- package/template/apps/web/src/components/ui/dropdown-menu/DropdownMenuTrigger.vue +17 -0
- package/template/apps/web/src/components/ui/dropdown-menu/index.ts +16 -0
- package/template/apps/web/src/components/ui/input/Input.vue +33 -0
- package/template/apps/web/src/components/ui/input/index.ts +1 -0
- package/template/apps/web/src/components/ui/select/Select.vue +15 -0
- package/template/apps/web/src/components/ui/select/SelectContent.vue +61 -0
- package/template/apps/web/src/components/ui/select/SelectGroup.vue +23 -0
- package/template/apps/web/src/components/ui/select/SelectItem.vue +49 -0
- package/template/apps/web/src/components/ui/select/SelectItemText.vue +12 -0
- package/template/apps/web/src/components/ui/select/SelectLabel.vue +19 -0
- package/template/apps/web/src/components/ui/select/SelectScrollDownButton.vue +34 -0
- package/template/apps/web/src/components/ui/select/SelectScrollUpButton.vue +34 -0
- package/template/apps/web/src/components/ui/select/SelectSeparator.vue +21 -0
- package/template/apps/web/src/components/ui/select/SelectTrigger.vue +43 -0
- package/template/apps/web/src/components/ui/select/SelectValue.vue +12 -0
- package/template/apps/web/src/components/ui/select/index.ts +11 -0
- package/template/apps/web/src/components/ui/separator/Separator.vue +30 -0
- package/template/apps/web/src/components/ui/separator/index.ts +1 -0
- package/template/apps/web/src/components/ui/sheet/Sheet.vue +15 -0
- package/template/apps/web/src/components/ui/sheet/SheetClose.vue +12 -0
- package/template/apps/web/src/components/ui/sheet/SheetContent.vue +62 -0
- package/template/apps/web/src/components/ui/sheet/SheetDescription.vue +23 -0
- package/template/apps/web/src/components/ui/sheet/SheetFooter.vue +15 -0
- package/template/apps/web/src/components/ui/sheet/SheetHeader.vue +15 -0
- package/template/apps/web/src/components/ui/sheet/SheetOverlay.vue +28 -0
- package/template/apps/web/src/components/ui/sheet/SheetTitle.vue +25 -0
- package/template/apps/web/src/components/ui/sheet/SheetTrigger.vue +12 -0
- package/template/apps/web/src/components/ui/sheet/index.ts +8 -0
- package/template/apps/web/src/components/ui/sidebar/Sidebar.vue +114 -0
- package/template/apps/web/src/components/ui/sidebar/SidebarContent.vue +23 -0
- package/template/apps/web/src/components/ui/sidebar/SidebarFooter.vue +18 -0
- package/template/apps/web/src/components/ui/sidebar/SidebarGroup.vue +18 -0
- package/template/apps/web/src/components/ui/sidebar/SidebarGroupAction.vue +29 -0
- package/template/apps/web/src/components/ui/sidebar/SidebarGroupContent.vue +18 -0
- package/template/apps/web/src/components/ui/sidebar/SidebarGroupLabel.vue +29 -0
- package/template/apps/web/src/components/ui/sidebar/SidebarHeader.vue +18 -0
- package/template/apps/web/src/components/ui/sidebar/SidebarInput.vue +19 -0
- package/template/apps/web/src/components/ui/sidebar/SidebarInset.vue +22 -0
- package/template/apps/web/src/components/ui/sidebar/SidebarMenu.vue +18 -0
- package/template/apps/web/src/components/ui/sidebar/SidebarMenuAction.vue +37 -0
- package/template/apps/web/src/components/ui/sidebar/SidebarMenuBadge.vue +23 -0
- package/template/apps/web/src/components/ui/sidebar/SidebarMenuButton.vue +60 -0
- package/template/apps/web/src/components/ui/sidebar/SidebarMenuButtonChild.vue +36 -0
- package/template/apps/web/src/components/ui/sidebar/SidebarMenuItem.vue +18 -0
- package/template/apps/web/src/components/ui/sidebar/SidebarMenuSkeleton.vue +35 -0
- package/template/apps/web/src/components/ui/sidebar/SidebarMenuSub.vue +23 -0
- package/template/apps/web/src/components/ui/sidebar/SidebarMenuSubButton.vue +39 -0
- package/template/apps/web/src/components/ui/sidebar/SidebarMenuSubItem.vue +18 -0
- package/template/apps/web/src/components/ui/sidebar/SidebarProvider.vue +128 -0
- package/template/apps/web/src/components/ui/sidebar/SidebarRail.vue +94 -0
- package/template/apps/web/src/components/ui/sidebar/SidebarSeparator.vue +19 -0
- package/template/apps/web/src/components/ui/sidebar/SidebarTrigger.vue +28 -0
- package/template/apps/web/src/components/ui/sidebar/index.ts +62 -0
- package/template/apps/web/src/components/ui/sidebar/sidebar-width.ts +29 -0
- package/template/apps/web/src/components/ui/sidebar/sidebar-width.webtest.ts +28 -0
- package/template/apps/web/src/components/ui/sidebar/utils.ts +26 -0
- package/template/apps/web/src/components/ui/skeleton/Skeleton.vue +17 -0
- package/template/apps/web/src/components/ui/skeleton/index.ts +1 -0
- package/template/apps/web/src/components/ui/sonner/Sonner.vue +70 -0
- package/template/apps/web/src/components/ui/sonner/index.ts +1 -0
- package/template/apps/web/src/components/ui/switch/Switch.vue +47 -0
- package/template/apps/web/src/components/ui/switch/Switch.webtest.ts +23 -0
- package/template/apps/web/src/components/ui/switch/index.ts +1 -0
- package/template/apps/web/src/components/ui/table/Table.vue +19 -0
- package/template/apps/web/src/components/ui/table/TableBody.vue +17 -0
- package/template/apps/web/src/components/ui/table/TableCaption.vue +17 -0
- package/template/apps/web/src/components/ui/table/TableCell.vue +22 -0
- package/template/apps/web/src/components/ui/table/TableEmpty.vue +37 -0
- package/template/apps/web/src/components/ui/table/TableFooter.vue +19 -0
- package/template/apps/web/src/components/ui/table/TableHead.vue +22 -0
- package/template/apps/web/src/components/ui/table/TableHeader.vue +14 -0
- package/template/apps/web/src/components/ui/table/TableRow.vue +22 -0
- package/template/apps/web/src/components/ui/table/index.ts +9 -0
- package/template/apps/web/src/components/ui/table/utils.ts +10 -0
- package/template/apps/web/src/components/ui/tabs/Tabs.vue +27 -0
- package/template/apps/web/src/components/ui/tabs/TabsContent.vue +23 -0
- package/template/apps/web/src/components/ui/tabs/TabsList.vue +34 -0
- package/template/apps/web/src/components/ui/tabs/TabsTrigger.vue +33 -0
- package/template/apps/web/src/components/ui/tabs/index.ts +24 -0
- package/template/apps/web/src/components/ui/tooltip/Tooltip.vue +15 -0
- package/template/apps/web/src/components/ui/tooltip/TooltipContent.vue +49 -0
- package/template/apps/web/src/components/ui/tooltip/TooltipProvider.vue +14 -0
- package/template/apps/web/src/components/ui/tooltip/TooltipTrigger.vue +12 -0
- package/template/apps/web/src/components/ui/tooltip/index.ts +4 -0
- package/template/apps/web/src/composables/useAccessSnapshot.ts +55 -0
- package/template/apps/web/src/composables/useAccessSnapshot.webtest.ts +39 -0
- package/template/apps/web/src/composables/useAppToast.ts +30 -0
- package/template/apps/web/src/composables/useAuthSession.ts +127 -0
- package/template/apps/web/src/composables/useAuthSession.webtest.ts +48 -0
- package/template/apps/web/src/composables/useLicenseReminderRefresh.ts +27 -0
- package/template/apps/web/src/composables/useLicenseReminderRefresh.webtest.ts +30 -0
- package/template/apps/web/src/composables/useLicenseRuntime.ts +90 -0
- package/template/apps/web/src/composables/useLoginFlow.ts +39 -0
- package/template/apps/web/src/composables/useModuleConfigurations.ts +116 -0
- package/template/apps/web/src/composables/usePasswordChange.ts +31 -0
- package/template/apps/web/src/composables/usePlatformSettings.ts +90 -0
- package/template/apps/web/src/composables/useSessionContext.ts +56 -0
- package/template/apps/web/src/composables/useTheme.ts +123 -0
- package/template/apps/web/src/composables/useUnsavedChangesConfirmation.ts +55 -0
- package/template/apps/web/src/composables/useWatermarkSettings.ts +56 -0
- package/template/apps/web/src/composables/watermark-settings.ts +45 -0
- package/template/apps/web/src/composables/watermark-settings.webtest.ts +38 -0
- package/template/apps/web/src/env.d.ts +17 -0
- package/template/apps/web/src/layout/AppHeader.vue +107 -0
- package/template/apps/web/src/layout/AppShell.vue +55 -0
- package/template/apps/web/src/layout/AppShell.webtest.ts +75 -0
- package/template/apps/web/src/layout/AppSidebar.vue +262 -0
- package/template/apps/web/src/layout/AppSidebar.webtest.ts +167 -0
- package/template/apps/web/src/layout/GlobalWatermark.vue +38 -0
- package/template/apps/web/src/layout/NavigationSearchDialog.vue +166 -0
- package/template/apps/web/src/layout/NavigationSearchDialog.webtest.ts +84 -0
- package/template/apps/web/src/layout/NotificationMenu.vue +174 -0
- package/template/apps/web/src/layout/NotificationMenu.webtest.ts +102 -0
- package/template/apps/web/src/layout/ThemeToggle.vue +44 -0
- package/template/apps/web/src/layout/navigation.ts +103 -0
- package/template/apps/web/src/layout/navigation.webtest.ts +99 -0
- package/template/apps/web/src/lib/date-time.ts +21 -0
- package/template/apps/web/src/lib/date-time.webtest.ts +14 -0
- package/template/apps/web/src/lib/utils.ts +7 -0
- package/template/apps/web/src/main.ts +11 -0
- package/template/apps/web/src/pages/AccessDeniedPage.vue +61 -0
- package/template/apps/web/src/pages/auth/ChangePasswordPage.vue +46 -0
- package/template/apps/web/src/pages/auth/LoginPage.vue +63 -0
- package/template/apps/web/src/pages/configuration/ModuleConfigurationPage.vue +15 -0
- package/template/apps/web/src/pages/configuration/components/ModuleConfigRollbackDialog.vue +51 -0
- package/template/apps/web/src/pages/configuration/components/ModuleConfigVersionList.vue +116 -0
- package/template/apps/web/src/pages/configuration/components/ModuleConfigurationEditor.vue +126 -0
- package/template/apps/web/src/pages/configuration/components/ModuleConfigurationEditor.webtest.ts +73 -0
- package/template/apps/web/src/pages/configuration/components/ModuleConfigurationWorkbench.vue +236 -0
- package/template/apps/web/src/pages/dashboard/DashboardPage.vue +39 -0
- package/template/apps/web/src/pages/dashboard/DashboardPage.webtest.ts +37 -0
- package/template/apps/web/src/pages/dashboard/components/DashboardAttention.vue +36 -0
- package/template/apps/web/src/pages/dashboard/components/DashboardMetricCards.vue +28 -0
- package/template/apps/web/src/pages/dashboard/dashboard-presenter.ts +115 -0
- package/template/apps/web/src/pages/dashboard/dashboard-presenter.webtest.ts +92 -0
- package/template/apps/web/src/pages/license/LicensePage.vue +65 -0
- package/template/apps/web/src/pages/profile/PersonalSettingsPage.vue +177 -0
- package/template/apps/web/src/pages/profile/PersonalSettingsPage.webtest.ts +78 -0
- package/template/apps/web/src/pages/settings/BrandingSettingsSection.vue +198 -0
- package/template/apps/web/src/pages/settings/GlobalSettingsPage.vue +195 -0
- package/template/apps/web/src/pages/settings/GlobalSettingsPage.webtest.ts +314 -0
- package/template/apps/web/src/pages/settings/WatermarkSettingsSection.vue +115 -0
- package/template/apps/web/src/pages/settings/logo-file.ts +23 -0
- package/template/apps/web/src/pages/settings/logo-file.webtest.ts +14 -0
- package/template/apps/web/src/pages/system/SystemNotificationsPage.vue +262 -0
- package/template/apps/web/src/pages/system/SystemNotificationsPage.webtest.ts +88 -0
- package/template/apps/web/src/pages/system/SystemOperationsPage.vue +151 -0
- package/template/apps/web/src/pages/system/SystemOperationsPage.webtest.ts +146 -0
- package/template/apps/web/src/pages/system/SystemResourceRoutePage.vue +80 -0
- package/template/apps/web/src/pages/system/SystemResourceRoutePage.webtest.ts +100 -0
- package/template/apps/web/src/pages/system/components/AuditActionCell.vue +87 -0
- package/template/apps/web/src/pages/system/components/AuditActionCell.webtest.ts +66 -0
- package/template/apps/web/src/pages/system/components/AuditLogFilters.vue +119 -0
- package/template/apps/web/src/pages/system/components/AuditLogFilters.webtest.ts +59 -0
- package/template/apps/web/src/pages/system/components/DiskUsageChart.vue +62 -0
- package/template/apps/web/src/pages/system/components/FeatureLicensePolicyDialog.vue +136 -0
- package/template/apps/web/src/pages/system/components/FeatureLicensePolicyDialog.webtest.ts +67 -0
- package/template/apps/web/src/pages/system/components/NotificationPublishForm.vue +57 -0
- package/template/apps/web/src/pages/system/components/OperationCacheMonitor.vue +73 -0
- package/template/apps/web/src/pages/system/components/OperationOnlineUsers.vue +60 -0
- package/template/apps/web/src/pages/system/components/OperationOnlineUsers.webtest.ts +35 -0
- package/template/apps/web/src/pages/system/components/OperationServiceMonitor.vue +118 -0
- package/template/apps/web/src/pages/system/components/OperationServiceMonitor.webtest.ts +64 -0
- package/template/apps/web/src/pages/system/components/SchedulerOperationsPanel.vue +297 -0
- package/template/apps/web/src/pages/system/components/SchedulerOperationsPanel.webtest.ts +145 -0
- package/template/apps/web/src/pages/system/components/SchedulerRunTable.vue +127 -0
- package/template/apps/web/src/pages/system/components/SchedulerRunTable.webtest.ts +75 -0
- package/template/apps/web/src/pages/system/components/SchedulerStaleRecoveryForm.vue +125 -0
- package/template/apps/web/src/pages/system/components/SchedulerStaleRecoveryForm.webtest.ts +84 -0
- package/template/apps/web/src/pages/system/components/SystemResourceFilters.vue +64 -0
- package/template/apps/web/src/pages/system/components/SystemResourceForm.vue +102 -0
- package/template/apps/web/src/pages/system/components/SystemResourcePage.vue +360 -0
- package/template/apps/web/src/pages/system/components/SystemResourcePage.webtest.ts +263 -0
- package/template/apps/web/src/pages/system/components/SystemResourceTable.vue +242 -0
- package/template/apps/web/src/pages/system/components/SystemResourceTable.webtest.ts +196 -0
- package/template/apps/web/src/pages/system/components/dictionary-bulk/DictionaryBulkActions.vue +142 -0
- package/template/apps/web/src/pages/system/components/dictionary-bulk/DictionaryBulkJobDetail.vue +109 -0
- package/template/apps/web/src/pages/system/components/dictionary-bulk/DictionaryBulkJobList.vue +127 -0
- package/template/apps/web/src/pages/system/components/dictionary-bulk/DictionaryBulkPanel.vue +72 -0
- package/template/apps/web/src/pages/system/components/dictionary-bulk/DictionaryBulkPanel.webtest.ts +255 -0
- package/template/apps/web/src/pages/system/components/feature-license-policy.ts +12 -0
- package/template/apps/web/src/pages/system/components/menu-management/MenuManagementPage.vue +131 -0
- package/template/apps/web/src/pages/system/components/menu-management/MenuManagementPage.webtest.ts +228 -0
- package/template/apps/web/src/pages/system/components/menu-management/MenuStructureTable.vue +230 -0
- package/template/apps/web/src/pages/system/components/menu-management/menu-model.ts +161 -0
- package/template/apps/web/src/pages/system/components/menu-management/menu-model.webtest.ts +133 -0
- package/template/apps/web/src/pages/system/components/menu-management/useMenuManagement.ts +117 -0
- package/template/apps/web/src/pages/system/components/role-policy/RolePermissionTree.vue +144 -0
- package/template/apps/web/src/pages/system/components/role-policy/RolePermissionTree.webtest.ts +55 -0
- package/template/apps/web/src/pages/system/components/role-policy/RolePolicyForm.vue +134 -0
- package/template/apps/web/src/pages/system/components/role-policy/permission-tree.ts +58 -0
- package/template/apps/web/src/pages/system/components/role-policy/permission-tree.webtest.ts +80 -0
- package/template/apps/web/src/pages/system/components/user-account/UserAccountForm.vue +307 -0
- package/template/apps/web/src/pages/system/components/user-account/UserRoleSelector.vue +111 -0
- package/template/apps/web/src/pages/system/components/user-account/UserRoleSelector.webtest.ts +45 -0
- package/template/apps/web/src/pages/system/components/user-account/save-user-account.ts +47 -0
- package/template/apps/web/src/pages/system/composables/useDictionaryBulkJobs.ts +152 -0
- package/template/apps/web/src/pages/system/composables/useFeatureLicenseEditor.ts +38 -0
- package/template/apps/web/src/pages/system/composables/useSchedulerOperations.ts +141 -0
- package/template/apps/web/src/pages/system/composables/useSchedulerOperations.webtest.ts +224 -0
- package/template/apps/web/src/pages/system/composables/useSystemResource.ts +269 -0
- package/template/apps/web/src/pages/system/composables/useSystemResource.webtest.ts +51 -0
- package/template/apps/web/src/pages/system/dictionary-bulk-presenter.ts +126 -0
- package/template/apps/web/src/pages/system/resource-config.ts +233 -0
- package/template/apps/web/src/router/auth-navigation.ts +76 -0
- package/template/apps/web/src/router/index.ts +246 -0
- package/template/apps/web/src/router/index.webtest.ts +396 -0
- package/template/apps/web/src/router/manifest-routes.ts +59 -0
- package/template/apps/web/src/services/access-api.ts +26 -0
- package/template/apps/web/src/services/auth-api.ts +72 -0
- package/template/apps/web/src/services/bulk-data-api.ts +105 -0
- package/template/apps/web/src/services/configuration-api.ts +43 -0
- package/template/apps/web/src/services/http.ts +145 -0
- package/template/apps/web/src/services/http.webtest.ts +73 -0
- package/template/apps/web/src/services/license-api.ts +53 -0
- package/template/apps/web/src/services/notification-api.ts +51 -0
- package/template/apps/web/src/services/operations-api.ts +128 -0
- package/template/apps/web/src/services/platform-settings-api.ts +21 -0
- package/template/apps/web/src/services/profile-api.ts +17 -0
- package/template/apps/web/src/services/session-context-api.ts +20 -0
- package/template/apps/web/src/services/system-api.ts +156 -0
- package/template/apps/web/src/style.css +142 -0
- package/template/apps/web/src/style.webtest.ts +18 -0
- package/template/apps/web/tsconfig.json +23 -0
- package/template/apps/web/vite.config.ts +26 -0
- package/template/apps/web/vitest.config.ts +14 -0
- package/template/bunfig.toml +2 -0
- package/template/docker-compose.yml +74 -0
- package/template/docs/adapters/ruoyi-vue-compatibility.md +93 -0
- package/template/docs/architecture/admin-surface-boundary.md +24 -0
- package/template/docs/architecture/data-scope-query-enforcement.md +26 -0
- package/template/docs/architecture/durable-jobs.md +101 -0
- package/template/docs/architecture/minimal-approval-workflow.md +60 -0
- package/template/docs/architecture/module-manifest-composition.md +47 -0
- package/template/docs/architecture/object-storage.md +65 -0
- package/template/docs/architecture/search-provider-protocol.md +59 -0
- package/template/docs/development/crud-generator.md +57 -0
- package/template/docs/license/license-offline-activation-code.md +67 -0
- package/template/docs/operations/observability.md +50 -0
- package/template/docs/platform/agent-tools.md +37 -0
- package/template/docs/platform/audit-reliability.md +95 -0
- package/template/docs/platform/bulk-data-jobs.md +156 -0
- package/template/docs/platform/data-access-control.md +62 -0
- package/template/docs/platform/module-configuration.md +98 -0
- package/template/docs/platform/navigation-registry.md +36 -0
- package/template/docs/platform/notifications.md +33 -0
- package/template/docs/platform/operations-overview.md +35 -0
- package/template/docs/platform/organization-membership.md +31 -0
- package/template/docs/platform/platform-authentication.md +127 -0
- package/template/docs/platform/platform-shell-settings.md +88 -0
- package/template/docs/platform/scheduled-task-executor.md +89 -0
- package/template/docs/platform/system-crud-api.md +100 -0
- package/template/docs/platform/web-system-crud.md +96 -0
- package/template/docs/product/built-in-roles.md +26 -0
- package/template/drizzle.config.ts +16 -0
- package/template/examples/inventory-item.crud.json +55 -0
- package/template/package.json +55 -0
- package/template/packages/config/index.test.ts +114 -0
- package/template/packages/config/index.ts +4 -0
- package/template/packages/config/package.json +13 -0
- package/template/packages/config/src/definition.ts +109 -0
- package/template/packages/config/src/environment-loader.ts +240 -0
- package/template/packages/config/src/platform.ts +185 -0
- package/template/packages/config/src/secrets.ts +69 -0
- package/template/packages/crud-generator/index.ts +3 -0
- package/template/packages/crud-generator/package.json +12 -0
- package/template/packages/crud-generator/src/cli.ts +31 -0
- package/template/packages/crud-generator/src/definition.ts +48 -0
- package/template/packages/crud-generator/src/generator.test.ts +180 -0
- package/template/packages/crud-generator/src/generator.ts +99 -0
- package/template/packages/crud-generator/src/template-helpers.ts +72 -0
- package/template/packages/crud-generator/src/templates/domain.ts +27 -0
- package/template/packages/crud-generator/src/templates/drizzle-repository.ts +126 -0
- package/template/packages/crud-generator/src/templates/dto.ts +19 -0
- package/template/packages/crud-generator/src/templates/index.ts +8 -0
- package/template/packages/crud-generator/src/templates/manifest.ts +69 -0
- package/template/packages/crud-generator/src/templates/project.ts +161 -0
- package/template/packages/crud-generator/src/templates/repository.ts +23 -0
- package/template/packages/crud-generator/src/templates/routes.ts +158 -0
- package/template/packages/crud-generator/src/templates/schema.ts +45 -0
- package/template/packages/crud-generator/src/templates/service.ts +32 -0
- package/template/packages/crud-generator/src/validation.ts +205 -0
- package/template/packages/crud-generator/tsconfig.json +15 -0
- package/template/packages/database/drizzle/0000_organic_madame_web.sql +136 -0
- package/template/packages/database/drizzle/0001_flawless_senator_kelly.sql +80 -0
- package/template/packages/database/drizzle/0002_woozy_squadron_supreme.sql +53 -0
- package/template/packages/database/drizzle/0003_far_carnage.sql +17 -0
- package/template/packages/database/drizzle/0004_flat_bastion.sql +2 -0
- package/template/packages/database/drizzle/0005_fixed_enchantress.sql +6 -0
- package/template/packages/database/drizzle/0006_groovy_overlord.sql +146 -0
- package/template/packages/database/drizzle/0007_chubby_may_parker.sql +9 -0
- package/template/packages/database/drizzle/0008_secret_toxin.sql +21 -0
- package/template/packages/database/drizzle/0009_ambiguous_adam_warlock.sql +46 -0
- package/template/packages/database/drizzle/0010_complex_orphan.sql +42 -0
- package/template/packages/database/drizzle/0011_lowly_maria_hill.sql +42 -0
- package/template/packages/database/drizzle/0012_serious_marvex.sql +11 -0
- package/template/packages/database/drizzle/0013_mysterious_miek.sql +48 -0
- package/template/packages/database/drizzle/0014_graceful_husk.sql +1 -0
- package/template/packages/database/drizzle/0015_illegal_jazinda.sql +29 -0
- package/template/packages/database/drizzle/0016_seed_platform_roles.sql +21 -0
- package/template/packages/database/drizzle/0017_silly_thunderbolt.sql +35 -0
- package/template/packages/database/drizzle/0018_cheerful_alex_power.sql +22 -0
- package/template/packages/database/drizzle/0019_omniscient_luckman.sql +3 -0
- package/template/packages/database/drizzle/0020_handy_vertigo.sql +18 -0
- package/template/packages/database/drizzle/0021_plain_paladin.sql +51 -0
- package/template/packages/database/drizzle/0022_icy_rhodey.sql +2 -0
- package/template/packages/database/drizzle/0023_fresh_thunderbolt_ross.sql +138 -0
- package/template/packages/database/drizzle/0024_misty_lizard.sql +13 -0
- package/template/packages/database/drizzle/0025_premium_songbird.sql +6 -0
- package/template/packages/database/drizzle/0026_aberrant_doctor_octopus.sql +42 -0
- package/template/packages/database/drizzle/0027_tiny_diamondback.sql +5 -0
- package/template/packages/database/drizzle/0028_condemned_ulik.sql +27 -0
- package/template/packages/database/drizzle/0029_clean_nightshade.sql +5 -0
- package/template/packages/database/drizzle/0030_governed_export_constraints.sql +84 -0
- package/template/packages/database/drizzle/meta/0000_snapshot.json +973 -0
- package/template/packages/database/drizzle/meta/0001_snapshot.json +1559 -0
- package/template/packages/database/drizzle/meta/0002_snapshot.json +1911 -0
- package/template/packages/database/drizzle/meta/0003_snapshot.json +2047 -0
- package/template/packages/database/drizzle/meta/0004_snapshot.json +2059 -0
- package/template/packages/database/drizzle/meta/0005_snapshot.json +2084 -0
- package/template/packages/database/drizzle/meta/0006_snapshot.json +3192 -0
- package/template/packages/database/drizzle/meta/0007_snapshot.json +3208 -0
- package/template/packages/database/drizzle/meta/0008_snapshot.json +3367 -0
- package/template/packages/database/drizzle/meta/0009_snapshot.json +3629 -0
- package/template/packages/database/drizzle/meta/0010_snapshot.json +3955 -0
- package/template/packages/database/drizzle/meta/0011_snapshot.json +4299 -0
- package/template/packages/database/drizzle/meta/0012_snapshot.json +4368 -0
- package/template/packages/database/drizzle/meta/0013_snapshot.json +4483 -0
- package/template/packages/database/drizzle/meta/0014_snapshot.json +4489 -0
- package/template/packages/database/drizzle/meta/0015_snapshot.json +4771 -0
- package/template/packages/database/drizzle/meta/0016_snapshot.json +4694 -0
- package/template/packages/database/drizzle/meta/0017_snapshot.json +4731 -0
- package/template/packages/database/drizzle/meta/0018_snapshot.json +4978 -0
- package/template/packages/database/drizzle/meta/0019_snapshot.json +4996 -0
- package/template/packages/database/drizzle/meta/0020_snapshot.json +5140 -0
- package/template/packages/database/drizzle/meta/0021_snapshot.json +5535 -0
- package/template/packages/database/drizzle/meta/0022_snapshot.json +5541 -0
- package/template/packages/database/drizzle/meta/0023_snapshot.json +6667 -0
- package/template/packages/database/drizzle/meta/0024_snapshot.json +6780 -0
- package/template/packages/database/drizzle/meta/0025_snapshot.json +6849 -0
- package/template/packages/database/drizzle/meta/0026_snapshot.json +7185 -0
- package/template/packages/database/drizzle/meta/0027_snapshot.json +7225 -0
- package/template/packages/database/drizzle/meta/0028_snapshot.json +7454 -0
- package/template/packages/database/drizzle/meta/0029_snapshot.json +7460 -0
- package/template/packages/database/drizzle/meta/0030_snapshot.json +7473 -0
- package/template/packages/database/drizzle/meta/_journal.json +223 -0
- package/template/packages/database/index.ts +5 -0
- package/template/packages/database/package.json +17 -0
- package/template/packages/database/src/dialects.test.ts +33 -0
- package/template/packages/database/src/dialects.ts +139 -0
- package/template/packages/database/src/runner.test.ts +96 -0
- package/template/packages/database/src/runner.ts +175 -0
- package/template/packages/database/src/schema/bulk-data.ts +87 -0
- package/template/packages/database/src/schema/common.ts +33 -0
- package/template/packages/database/src/schema/durable-jobs.ts +266 -0
- package/template/packages/database/src/schema/file-storage.ts +94 -0
- package/template/packages/database/src/schema/governance.ts +195 -0
- package/template/packages/database/src/schema/governed-exports.ts +90 -0
- package/template/packages/database/src/schema/identity.ts +169 -0
- package/template/packages/database/src/schema/index.ts +33 -0
- package/template/packages/database/src/schema/license-legacy.ts +93 -0
- package/template/packages/database/src/schema/license-v1.ts +246 -0
- package/template/packages/database/src/schema/migration-history.ts +30 -0
- package/template/packages/database/src/schema/notifications.ts +60 -0
- package/template/packages/database/src/schema/platform-settings.ts +55 -0
- package/template/packages/database/src/schema/scheduler.ts +89 -0
- package/template/packages/database/src/schema/work-orders.ts +23 -0
- package/template/packages/database/src/schema/workflow.ts +86 -0
- package/template/packages/database/src/schema-durable-links.test.ts +27 -0
- package/template/packages/database/src/schema-governed-exports.test.ts +49 -0
- package/template/packages/database/src/schema-workflow-notification.test.ts +63 -0
- package/template/packages/database/src/schema.test.ts +343 -0
- package/template/packages/database/src/sql-store.test.ts +92 -0
- package/template/packages/database/src/sql-store.ts +101 -0
- package/template/packages/database/src/store.ts +32 -0
- package/template/packages/database/tsconfig.json +17 -0
- package/template/packages/example-work-order/index.ts +3 -0
- package/template/packages/example-work-order/package.json +13 -0
- package/template/packages/example-work-order/src/contract.ts +50 -0
- package/template/packages/example-work-order/src/manifest.test.ts +54 -0
- package/template/packages/example-work-order/src/manifest.ts +120 -0
- package/template/packages/example-work-order/src/schema.ts +27 -0
- package/template/packages/license-sdk/index.ts +13 -0
- package/template/packages/license-sdk/package.json +18 -0
- package/template/packages/license-sdk/src/bounded-json-body.test.ts +65 -0
- package/template/packages/license-sdk/src/bounded-json-body.ts +135 -0
- package/template/packages/license-sdk/src/canonical-json.test.ts +28 -0
- package/template/packages/license-sdk/src/canonical-json.ts +104 -0
- package/template/packages/license-sdk/src/client.test.ts +82 -0
- package/template/packages/license-sdk/src/client.ts +86 -0
- package/template/packages/license-sdk/src/device.ts +46 -0
- package/template/packages/license-sdk/src/file-storage.test.ts +80 -0
- package/template/packages/license-sdk/src/file-storage.ts +77 -0
- package/template/packages/license-sdk/src/installation.test.ts +241 -0
- package/template/packages/license-sdk/src/installation.ts +150 -0
- package/template/packages/license-sdk/src/license-parser.ts +56 -0
- package/template/packages/license-sdk/src/offline-code-base32.ts +57 -0
- package/template/packages/license-sdk/src/offline-code-decompression.ts +55 -0
- package/template/packages/license-sdk/src/offline-code-limits.ts +10 -0
- package/template/packages/license-sdk/src/offline-code-wire.ts +72 -0
- package/template/packages/license-sdk/src/offline-code.test.ts +172 -0
- package/template/packages/license-sdk/src/offline-code.ts +319 -0
- package/template/packages/license-sdk/src/payload.test.ts +72 -0
- package/template/packages/license-sdk/src/payload.ts +201 -0
- package/template/packages/license-sdk/src/storage.ts +64 -0
- package/template/packages/license-sdk/src/test-fixtures.ts +59 -0
- package/template/packages/license-sdk/src/v1-test-vector.ts +49 -0
- package/template/packages/license-sdk/src/validation.test.ts +62 -0
- package/template/packages/license-sdk/src/validation.ts +143 -0
- package/template/packages/license-sdk/src/verification.test.ts +97 -0
- package/template/packages/license-sdk/src/verification.ts +199 -0
- package/template/packages/license-sdk/tsconfig.json +17 -0
- package/template/packages/modules/index.ts +8 -0
- package/template/packages/modules/package.json +13 -0
- package/template/packages/modules/src/composition.test.ts +267 -0
- package/template/packages/modules/src/composition.ts +342 -0
- package/template/packages/modules/src/installed-business-modules.ts +10 -0
- package/template/packages/modules/src/manifest.ts +97 -0
- package/template/packages/modules/src/menu-composition.test.ts +64 -0
- package/template/packages/modules/src/menu-composition.ts +54 -0
- package/template/packages/modules/src/registry.ts +53 -0
- package/template/packages/modules/src/system-admin-routes.ts +134 -0
- package/template/packages/modules/src/system-agent-tools.ts +28 -0
- package/template/packages/modules/src/system-api-binding.ts +37 -0
- package/template/packages/modules/src/system-api-data-governance.ts +21 -0
- package/template/packages/modules/src/system-api-permissions.ts +344 -0
- package/template/packages/modules/src/system-audit-actions.ts +70 -0
- package/template/packages/modules/src/system-data-governance.ts +30 -0
- package/template/packages/modules/src/system-features.ts +143 -0
- package/template/packages/modules/src/system-governed-export-bindings.ts +31 -0
- package/template/packages/modules/src/system-module-catalog.test.ts +145 -0
- package/template/packages/modules/src/system-module-catalog.ts +250 -0
- package/template/packages/modules/src/system-modules.test.ts +344 -0
- package/template/packages/modules/src/system-modules.ts +335 -0
- package/template/packages/modules/src/system-permissions.ts +142 -0
- package/template/packages/modules/user/module.ts +72 -0
- package/template/packages/shared/index.ts +16 -0
- package/template/packages/shared/package.json +9 -0
- package/template/packages/shared/src/audit.test.ts +17 -0
- package/template/packages/shared/src/audit.ts +237 -0
- package/template/packages/shared/src/correlation.test.ts +10 -0
- package/template/packages/shared/src/correlation.ts +11 -0
- package/template/packages/shared/src/data-governance.test.ts +44 -0
- package/template/packages/shared/src/data-governance.ts +89 -0
- package/template/packages/shared/src/database.ts +67 -0
- package/template/packages/shared/src/feature.test.ts +54 -0
- package/template/packages/shared/src/feature.ts +104 -0
- package/template/packages/shared/src/license-legacy.ts +153 -0
- package/template/packages/shared/src/license.test.ts +63 -0
- package/template/packages/shared/src/license.ts +267 -0
- package/template/packages/shared/src/module-configuration.ts +50 -0
- package/template/packages/shared/src/notification.ts +46 -0
- package/template/packages/shared/src/platform-settings.ts +5 -0
- package/template/packages/shared/src/primitives.ts +47 -0
- package/template/packages/shared/src/profile.ts +13 -0
- package/template/packages/shared/src/rbac.ts +117 -0
- package/template/packages/shared/src/ruoyi.ts +98 -0
- package/template/packages/shared/src/scheduler.ts +108 -0
- package/template/packages/shared/src/search-provider.ts +24 -0
- package/template/packages/shared/src/workflow.test.ts +225 -0
- package/template/packages/shared/src/workflow.ts +307 -0
- package/template/packages/storage/index.ts +11 -0
- package/template/packages/storage/package.json +12 -0
- package/template/packages/storage/src/blob-store.ts +64 -0
- package/template/packages/storage/src/content-hash.ts +24 -0
- package/template/packages/storage/src/file-service.test.ts +100 -0
- package/template/packages/storage/src/file-service.ts +59 -0
- package/template/packages/storage/src/in-memory-upload-repository.ts +154 -0
- package/template/packages/storage/src/local-file-blob-store.test.ts +175 -0
- package/template/packages/storage/src/local-file-blob-store.ts +344 -0
- package/template/packages/storage/src/local-file-maintenance.ts +133 -0
- package/template/packages/storage/src/memory-blob-store.test.ts +16 -0
- package/template/packages/storage/src/memory-blob-store.ts +100 -0
- package/template/packages/storage/src/upload-repository.ts +43 -0
- package/template/packages/storage/src/upload-service.test.ts +246 -0
- package/template/packages/storage/src/upload-service.ts +334 -0
- package/template/packages/storage/src/upload-streams.ts +123 -0
- package/template/packages/storage/src/upload-types.ts +110 -0
- package/template/packages/storage/tsconfig.json +16 -0
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { describe, expect, test } from "bun:test";
|
|
2
|
+
import { createPlatformHttpApp } from "./http-app.js";
|
|
3
|
+
import { createPlatformObservability } from "./observability/bootstrap.js";
|
|
4
|
+
import { createServerRuntime } from "./runtime.js";
|
|
5
|
+
|
|
6
|
+
describe("platform HTTP app observability", () => {
|
|
7
|
+
test("校验并回传 request id,日志与指标不包含 URL 和查询值", async () => {
|
|
8
|
+
const records: Record<string, unknown>[] = [];
|
|
9
|
+
const runtime = createServerRuntime({ NODE_ENV: "test" });
|
|
10
|
+
const observability = createPlatformObservability({
|
|
11
|
+
databaseRequired: false,
|
|
12
|
+
auditStatus: () => runtime.auditSink.status(),
|
|
13
|
+
logger: {
|
|
14
|
+
info(fields) {
|
|
15
|
+
records.push(fields);
|
|
16
|
+
},
|
|
17
|
+
},
|
|
18
|
+
});
|
|
19
|
+
const app = createPlatformHttpApp(runtime, observability).get(
|
|
20
|
+
"/probe",
|
|
21
|
+
() => ({ ok: true }),
|
|
22
|
+
);
|
|
23
|
+
const response = await app.handle(
|
|
24
|
+
new Request("http://localhost/api/probe?q=secret-query", {
|
|
25
|
+
headers: { "x-request-id": "invalid request id" },
|
|
26
|
+
}),
|
|
27
|
+
);
|
|
28
|
+
|
|
29
|
+
expect(response.status).toBe(200);
|
|
30
|
+
expect(response.headers.get("x-request-id")).toMatch(
|
|
31
|
+
/^[A-Za-z0-9._-]{1,128}$/,
|
|
32
|
+
);
|
|
33
|
+
expect(JSON.stringify(records)).not.toContain("secret-query");
|
|
34
|
+
expect(observability.metrics.render()).not.toContain("secret-query");
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
// @windy-module system.license begin
|
|
38
|
+
test("License 限制模式在全局 Elysia 边界允许治理导出取消", async () => {
|
|
39
|
+
const runtime = createServerRuntime(
|
|
40
|
+
{ NODE_ENV: "test" },
|
|
41
|
+
{
|
|
42
|
+
licenseResolver: {
|
|
43
|
+
resolve: () => ({
|
|
44
|
+
entitlements: [],
|
|
45
|
+
status: "expired",
|
|
46
|
+
restricted: true,
|
|
47
|
+
}),
|
|
48
|
+
},
|
|
49
|
+
},
|
|
50
|
+
);
|
|
51
|
+
const observability = createPlatformObservability({
|
|
52
|
+
databaseRequired: false,
|
|
53
|
+
auditStatus: () => runtime.auditSink.status(),
|
|
54
|
+
logger: { info() {} },
|
|
55
|
+
});
|
|
56
|
+
const app = createPlatformHttpApp(runtime, observability)
|
|
57
|
+
.post("/system/users/exports/:id/cancel", ({ params }) => ({
|
|
58
|
+
cancelled: params.id,
|
|
59
|
+
}))
|
|
60
|
+
.get("/system/users", () => ({ reachable: true }));
|
|
61
|
+
|
|
62
|
+
const allowed = await app.handle(
|
|
63
|
+
new Request("http://localhost/api/system/users/exports/export-1/cancel", {
|
|
64
|
+
method: "POST",
|
|
65
|
+
}),
|
|
66
|
+
);
|
|
67
|
+
expect(allowed.status).toBe(200);
|
|
68
|
+
expect(await allowed.json()).toEqual({ cancelled: "export-1" });
|
|
69
|
+
|
|
70
|
+
const denied = await app.handle(
|
|
71
|
+
new Request("http://localhost/api/system/users"),
|
|
72
|
+
);
|
|
73
|
+
expect(denied.status).toBe(403);
|
|
74
|
+
expect(await denied.json()).toMatchObject({ error: "LICENSE_RESTRICTED" });
|
|
75
|
+
});
|
|
76
|
+
// @windy-module system.license end
|
|
77
|
+
});
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { swagger } from "@elysiajs/swagger";
|
|
2
|
+
import { Elysia } from "elysia";
|
|
3
|
+
import type { createPlatformObservability } from "./observability/bootstrap.js";
|
|
4
|
+
// @windy-module system.license begin
|
|
5
|
+
import { restrictedRequestResponse } from "./request-restriction.js";
|
|
6
|
+
// @windy-module system.license end
|
|
7
|
+
import type { createServerRuntime } from "./runtime.js";
|
|
8
|
+
|
|
9
|
+
type ServerRuntime = ReturnType<typeof createServerRuntime>;
|
|
10
|
+
type PlatformObservability = ReturnType<typeof createPlatformObservability>;
|
|
11
|
+
|
|
12
|
+
export function createPlatformHttpApp(
|
|
13
|
+
runtime: ServerRuntime,
|
|
14
|
+
observability: PlatformObservability,
|
|
15
|
+
) {
|
|
16
|
+
return (
|
|
17
|
+
new Elysia({ prefix: "/api" })
|
|
18
|
+
.derive(async ({ request, server }) => ({
|
|
19
|
+
guardContext: await runtime.createGuardContext(request, {
|
|
20
|
+
clientIp: server?.requestIP(request)?.address,
|
|
21
|
+
}),
|
|
22
|
+
requestObservation: observability.http.begin(request.method),
|
|
23
|
+
}))
|
|
24
|
+
// @windy-module system.license begin
|
|
25
|
+
.onBeforeHandle(({ request, guardContext }) =>
|
|
26
|
+
restrictedRequestResponse(runtime, guardContext, request),
|
|
27
|
+
)
|
|
28
|
+
// @windy-module system.license end
|
|
29
|
+
.onAfterHandle(({ guardContext, set }) => {
|
|
30
|
+
set.headers["x-request-id"] = guardContext.requestId;
|
|
31
|
+
})
|
|
32
|
+
.onAfterResponse(
|
|
33
|
+
({ request, guardContext, requestObservation, responseValue, set }) => {
|
|
34
|
+
observability.http.complete({
|
|
35
|
+
request,
|
|
36
|
+
guardContext,
|
|
37
|
+
observation: requestObservation,
|
|
38
|
+
responseValue,
|
|
39
|
+
status: set.status,
|
|
40
|
+
});
|
|
41
|
+
},
|
|
42
|
+
)
|
|
43
|
+
.use(
|
|
44
|
+
swagger({
|
|
45
|
+
documentation: {
|
|
46
|
+
info: { title: "Windy Platform API", version: "0.1.0" },
|
|
47
|
+
},
|
|
48
|
+
}),
|
|
49
|
+
)
|
|
50
|
+
);
|
|
51
|
+
}
|
|
@@ -0,0 +1,374 @@
|
|
|
1
|
+
import { loadPlatformConfig } from "@windy/config";
|
|
2
|
+
import pino from "pino";
|
|
3
|
+
import { registerAdminBootstrapRoute } from "./admin/routes.js";
|
|
4
|
+
import { registerSessionContextRoute } from "./session/routes.js";
|
|
5
|
+
import {
|
|
6
|
+
createFoundationSnapshot,
|
|
7
|
+
loadFoundationModules,
|
|
8
|
+
} from "./foundation.js";
|
|
9
|
+
import { registerFoundationRoute } from "./foundation-route.js";
|
|
10
|
+
// @windy-module system.scheduler begin
|
|
11
|
+
import { createApplicationServices } from "./application-services.js";
|
|
12
|
+
// @windy-module system.scheduler end
|
|
13
|
+
// @windy-module system.bulk-data begin
|
|
14
|
+
import { registerBulkDataRoutes } from "./bulk-data/routes.js";
|
|
15
|
+
// @windy-module system.bulk-data end
|
|
16
|
+
// @windy-module system.data-governance begin
|
|
17
|
+
import { registerGovernedUserExportRoutes } from "./data-governance/export/routes.js";
|
|
18
|
+
// @windy-module system.data-governance end
|
|
19
|
+
import { createServerRuntime } from "./runtime.js";
|
|
20
|
+
// @windy-module system.scheduler begin
|
|
21
|
+
import { readPositiveInt } from "./runtime-config.js";
|
|
22
|
+
// @windy-module system.scheduler end
|
|
23
|
+
// @windy-module system.agent begin
|
|
24
|
+
import {
|
|
25
|
+
createSystemToolHandlers,
|
|
26
|
+
registerAgentRoutes,
|
|
27
|
+
} from "./agent/routes.js";
|
|
28
|
+
// @windy-module system.agent end
|
|
29
|
+
import { registerAuthRoutes, registerAuthSessionRoute } from "./auth/routes.js";
|
|
30
|
+
import { createAuthRuntime } from "./auth/runtime.js";
|
|
31
|
+
import { createPlatformHttpApp } from "./http-app.js";
|
|
32
|
+
import { bootstrapAdminPassword } from "./auth/bootstrap-admin.js";
|
|
33
|
+
import { createServerPersistence } from "./persistence.js";
|
|
34
|
+
// @windy-module system.license begin
|
|
35
|
+
import { registerPlatformLicenseRoutes } from "./license/routes.js";
|
|
36
|
+
import {
|
|
37
|
+
createPlatformLicenseRuntimeOptions,
|
|
38
|
+
hasConfiguredLicenseKeys,
|
|
39
|
+
PlatformLicenseRuntime,
|
|
40
|
+
} from "./license/runtime-service.js";
|
|
41
|
+
// @windy-module system.license end
|
|
42
|
+
// @windy-module system.operations begin
|
|
43
|
+
import { registerSystemOperationRoutes } from "./system/operations.js";
|
|
44
|
+
import { createPostgresMonitorProbe } from "./system/postgres-monitoring.js";
|
|
45
|
+
// @windy-module system.operations end
|
|
46
|
+
import { registerSystemRoutes } from "./system/routes.js";
|
|
47
|
+
import {
|
|
48
|
+
createSystemRepositories,
|
|
49
|
+
synchronizeBuiltInRoles,
|
|
50
|
+
} from "./system/seed.js";
|
|
51
|
+
// @windy-module system.scheduler begin
|
|
52
|
+
import { registerSchedulerRoutes } from "./scheduler/routes.js";
|
|
53
|
+
import { SchedulerWorker } from "./scheduler/worker.js";
|
|
54
|
+
// @windy-module system.scheduler end
|
|
55
|
+
// @windy-module system.settings begin
|
|
56
|
+
import { registerBrandingSettingsRoutes } from "./settings/routes.js";
|
|
57
|
+
import { createBrandingSettingsRepository } from "./settings/runtime.js";
|
|
58
|
+
// @windy-module system.settings end
|
|
59
|
+
import { registerProfileRoutes } from "./profile/routes.js";
|
|
60
|
+
// @windy-module system.notification begin
|
|
61
|
+
import { registerNotificationRoutes } from "./notification/routes.js";
|
|
62
|
+
// @windy-module system.notification end
|
|
63
|
+
// @windy-module work-order begin
|
|
64
|
+
import {
|
|
65
|
+
createExampleModuleRuntime,
|
|
66
|
+
registerExampleModuleRoutes,
|
|
67
|
+
} from "./example-modules.js";
|
|
68
|
+
// @windy-module work-order end
|
|
69
|
+
// @windy-module system.configuration begin
|
|
70
|
+
import { bootstrapModuleConfiguration } from "./configuration/bootstrap.js";
|
|
71
|
+
// @windy-module system.configuration end
|
|
72
|
+
// @windy-module system.storage begin
|
|
73
|
+
import { createStorageRuntime } from "./storage/runtime.js";
|
|
74
|
+
import { registerStorageRoutes } from "./storage/routes.js";
|
|
75
|
+
// @windy-module system.storage end
|
|
76
|
+
import { validateServerModuleComposition } from "./module-composition.js";
|
|
77
|
+
// @windy-module system.search begin
|
|
78
|
+
import { createSearchHost } from "./search/host.js";
|
|
79
|
+
// @windy-module system.search end
|
|
80
|
+
// @windy-module system.workflow begin
|
|
81
|
+
import { registerWorkflowRoutes } from "./workflow/routes.js";
|
|
82
|
+
// @windy-module system.workflow end
|
|
83
|
+
import {
|
|
84
|
+
createPlatformObservability,
|
|
85
|
+
logPlatformStartup,
|
|
86
|
+
} from "./observability/bootstrap.js";
|
|
87
|
+
|
|
88
|
+
const logger = pino({ name: "windy-server" });
|
|
89
|
+
const platformConfig = loadPlatformConfig();
|
|
90
|
+
const persistence = createServerPersistence(
|
|
91
|
+
process.env,
|
|
92
|
+
(status) => {
|
|
93
|
+
logger.error({ audit: status }, "审计持久化进入降级状态");
|
|
94
|
+
},
|
|
95
|
+
platformConfig,
|
|
96
|
+
);
|
|
97
|
+
// @windy-module system.audit begin
|
|
98
|
+
await persistence?.auditWriter.recover();
|
|
99
|
+
// @windy-module system.audit end
|
|
100
|
+
// @windy-module system.configuration begin
|
|
101
|
+
const configurationRuntime = await bootstrapModuleConfiguration(
|
|
102
|
+
platformConfig,
|
|
103
|
+
persistence?.configVersionRepository,
|
|
104
|
+
);
|
|
105
|
+
// @windy-module system.configuration end
|
|
106
|
+
const foundationSnapshot = createFoundationSnapshot(platformConfig);
|
|
107
|
+
// @windy-module system.configuration begin
|
|
108
|
+
configurationRuntime.bindFoundation(foundationSnapshot);
|
|
109
|
+
// @windy-module system.configuration end
|
|
110
|
+
const foundationModules = loadFoundationModules();
|
|
111
|
+
const systemRepositories = createSystemRepositories(foundationSnapshot, {
|
|
112
|
+
db: persistence?.db,
|
|
113
|
+
});
|
|
114
|
+
const featureSync = await systemRepositories.features.syncManifest(
|
|
115
|
+
foundationSnapshot.features,
|
|
116
|
+
);
|
|
117
|
+
await systemRepositories.menuRegistry.synchronize({
|
|
118
|
+
id: "system_bootstrap",
|
|
119
|
+
type: "service",
|
|
120
|
+
name: "平台初始化",
|
|
121
|
+
roleCodes: ["system"],
|
|
122
|
+
permissionKeys: ["system.menu.manage"],
|
|
123
|
+
});
|
|
124
|
+
await synchronizeBuiltInRoles(systemRepositories, foundationSnapshot);
|
|
125
|
+
// @windy-module system.license begin
|
|
126
|
+
const platformLicenseOptions = createPlatformLicenseRuntimeOptions(process.env);
|
|
127
|
+
const platformLicenseRuntime = new PlatformLicenseRuntime(
|
|
128
|
+
platformLicenseOptions,
|
|
129
|
+
);
|
|
130
|
+
const useInstalledLicense =
|
|
131
|
+
Boolean(platformLicenseOptions.enforceRestrictions) ||
|
|
132
|
+
hasConfiguredLicenseKeys(platformLicenseOptions);
|
|
133
|
+
// @windy-module system.license end
|
|
134
|
+
const runtime = createServerRuntime(process.env, {
|
|
135
|
+
actorResolver: persistence?.actorResolver,
|
|
136
|
+
// @windy-module system.license begin
|
|
137
|
+
licenseResolver: useInstalledLicense
|
|
138
|
+
? platformLicenseRuntime
|
|
139
|
+
: persistence?.licenseResolver,
|
|
140
|
+
// @windy-module system.license end
|
|
141
|
+
featureResolver: persistence ? systemRepositories.features : undefined,
|
|
142
|
+
// @windy-module system.audit begin
|
|
143
|
+
auditReader: persistence?.auditReader,
|
|
144
|
+
auditWriter: persistence?.auditWriter,
|
|
145
|
+
// @windy-module system.audit end
|
|
146
|
+
});
|
|
147
|
+
const observability = createPlatformObservability({
|
|
148
|
+
databaseCheck: persistence
|
|
149
|
+
? async () => void (await persistence.pool.query("select 1"))
|
|
150
|
+
: undefined,
|
|
151
|
+
databaseRequired: process.env.NODE_ENV === "production",
|
|
152
|
+
auditStatus: () => runtime.auditSink.status(),
|
|
153
|
+
logger,
|
|
154
|
+
});
|
|
155
|
+
// @windy-module system.license begin
|
|
156
|
+
platformLicenseRuntime.setAuditSink(runtime.auditSink);
|
|
157
|
+
// @windy-module system.license end
|
|
158
|
+
const { authRepository, authService } = createAuthRuntime({
|
|
159
|
+
repository: persistence?.authRepository,
|
|
160
|
+
sessionTtlSeconds: platformConfig.security.sessionTtlSeconds,
|
|
161
|
+
auditWriter: (event) => runtime.auditSink.recordCriticalEvent(event),
|
|
162
|
+
// @windy-module system.audit begin
|
|
163
|
+
auditReader: persistence?.auditReader,
|
|
164
|
+
// @windy-module system.audit end
|
|
165
|
+
});
|
|
166
|
+
// @windy-module system.storage begin
|
|
167
|
+
const storageRuntime = createStorageRuntime(process.env, persistence?.db);
|
|
168
|
+
// @windy-module system.storage end
|
|
169
|
+
// @windy-module system.settings begin
|
|
170
|
+
const brandingSettingsRepository = createBrandingSettingsRepository(
|
|
171
|
+
persistence?.db,
|
|
172
|
+
{ softwareName: platformConfig.name, logoUrl: platformConfig.logoUrl },
|
|
173
|
+
);
|
|
174
|
+
// @windy-module system.settings end
|
|
175
|
+
// @windy-module work-order begin
|
|
176
|
+
const exampleModuleRuntime = createExampleModuleRuntime({
|
|
177
|
+
features: foundationSnapshot.features,
|
|
178
|
+
departments: systemRepositories.departments,
|
|
179
|
+
db: persistence?.db,
|
|
180
|
+
});
|
|
181
|
+
// @windy-module work-order end
|
|
182
|
+
// @windy-module system.search begin
|
|
183
|
+
const businessSearchProviders = [
|
|
184
|
+
// @windy-module work-order begin
|
|
185
|
+
...(exampleModuleRuntime?.providers || []),
|
|
186
|
+
// @windy-module work-order end
|
|
187
|
+
];
|
|
188
|
+
// @windy-module system.search end
|
|
189
|
+
// @windy-module system.search begin
|
|
190
|
+
const searchHost = createSearchHost(
|
|
191
|
+
foundationModules,
|
|
192
|
+
{ providers: businessSearchProviders },
|
|
193
|
+
runtime,
|
|
194
|
+
);
|
|
195
|
+
// @windy-module system.search end
|
|
196
|
+
// @windy-module system.scheduler begin
|
|
197
|
+
const businessTaskDefinitions = [
|
|
198
|
+
// @windy-module work-order begin
|
|
199
|
+
...(exampleModuleRuntime?.tasks || []),
|
|
200
|
+
// @windy-module work-order end
|
|
201
|
+
];
|
|
202
|
+
const {
|
|
203
|
+
bulkDataService,
|
|
204
|
+
scheduler,
|
|
205
|
+
taskDefinitions: scheduledTaskDefinitions,
|
|
206
|
+
notifications: notificationRepository,
|
|
207
|
+
workflow: workflowService,
|
|
208
|
+
governedExportService,
|
|
209
|
+
} = await createApplicationServices({
|
|
210
|
+
persistence,
|
|
211
|
+
systemRepositories,
|
|
212
|
+
foundation: foundationSnapshot,
|
|
213
|
+
runtime,
|
|
214
|
+
storage: storageRuntime,
|
|
215
|
+
exampleTasks: businessTaskDefinitions,
|
|
216
|
+
bulkRetentionDays: readPositiveInt(process.env.BULK_DATA_RETENTION_DAYS, 7),
|
|
217
|
+
});
|
|
218
|
+
const schedulerWorker = new SchedulerWorker(
|
|
219
|
+
scheduler,
|
|
220
|
+
readPositiveInt(process.env.SCHEDULER_POLL_INTERVAL_MS, 1_000),
|
|
221
|
+
() => logger.error({ event: "scheduler.tick.failed" }, "定时任务 tick 失败"),
|
|
222
|
+
(result) => observability.metrics.observeSchedulerTick(result),
|
|
223
|
+
);
|
|
224
|
+
// @windy-module system.scheduler end
|
|
225
|
+
|
|
226
|
+
await bootstrapAdminPassword({
|
|
227
|
+
authService,
|
|
228
|
+
authRepository: persistence?.authRepository,
|
|
229
|
+
repositories: systemRepositories,
|
|
230
|
+
password: process.env.WINDY_BOOTSTRAP_ADMIN_PASSWORD,
|
|
231
|
+
});
|
|
232
|
+
|
|
233
|
+
const app = createPlatformHttpApp(runtime, observability);
|
|
234
|
+
observability.register(app);
|
|
235
|
+
|
|
236
|
+
registerAuthSessionRoute(app);
|
|
237
|
+
|
|
238
|
+
registerAuthRoutes(app, authService, {
|
|
239
|
+
sessionCookieName: platformConfig.security.sessionCookieName,
|
|
240
|
+
secureCookie: process.env.NODE_ENV === "production",
|
|
241
|
+
});
|
|
242
|
+
registerProfileRoutes(
|
|
243
|
+
app,
|
|
244
|
+
authRepository,
|
|
245
|
+
runtime,
|
|
246
|
+
foundationSnapshot.features,
|
|
247
|
+
);
|
|
248
|
+
|
|
249
|
+
// @windy-module system.license begin
|
|
250
|
+
registerPlatformLicenseRoutes(app, platformLicenseRuntime);
|
|
251
|
+
// @windy-module system.license end
|
|
252
|
+
|
|
253
|
+
// @windy-module system.settings begin
|
|
254
|
+
registerBrandingSettingsRoutes(
|
|
255
|
+
app,
|
|
256
|
+
brandingSettingsRepository,
|
|
257
|
+
runtime,
|
|
258
|
+
foundationSnapshot.features,
|
|
259
|
+
);
|
|
260
|
+
// @windy-module system.settings end
|
|
261
|
+
// @windy-module system.notification begin
|
|
262
|
+
registerNotificationRoutes(
|
|
263
|
+
app,
|
|
264
|
+
notificationRepository,
|
|
265
|
+
runtime,
|
|
266
|
+
foundationSnapshot.features,
|
|
267
|
+
);
|
|
268
|
+
// @windy-module system.notification end
|
|
269
|
+
// @windy-module system.workflow begin
|
|
270
|
+
registerWorkflowRoutes(app, workflowService, runtime);
|
|
271
|
+
// @windy-module system.workflow end
|
|
272
|
+
// @windy-module system.configuration begin
|
|
273
|
+
configurationRuntime.register(app, runtime, foundationSnapshot.features);
|
|
274
|
+
// @windy-module system.configuration end
|
|
275
|
+
// @windy-module system.storage begin
|
|
276
|
+
registerStorageRoutes(
|
|
277
|
+
app,
|
|
278
|
+
{
|
|
279
|
+
uploads: storageRuntime.uploads,
|
|
280
|
+
files: storageRuntime.files,
|
|
281
|
+
isPublicBrandingFile: async (fileId) =>
|
|
282
|
+
(await brandingSettingsRepository.get()).logoUrl ===
|
|
283
|
+
`/api/platform/files/${fileId}`,
|
|
284
|
+
},
|
|
285
|
+
runtime,
|
|
286
|
+
foundationSnapshot.features,
|
|
287
|
+
);
|
|
288
|
+
// @windy-module system.storage end
|
|
289
|
+
// @windy-module system.search begin
|
|
290
|
+
searchHost.register(app);
|
|
291
|
+
// @windy-module system.search end
|
|
292
|
+
|
|
293
|
+
registerAdminBootstrapRoute(app, runtime, {
|
|
294
|
+
modules: foundationModules,
|
|
295
|
+
snapshot: foundationSnapshot,
|
|
296
|
+
loadMenus: () => systemRepositories.menuRegistry.tree(),
|
|
297
|
+
});
|
|
298
|
+
registerSessionContextRoute(app, runtime, foundationSnapshot.features);
|
|
299
|
+
|
|
300
|
+
registerFoundationRoute(app, runtime, foundationSnapshot, systemRepositories);
|
|
301
|
+
|
|
302
|
+
// @windy-module system.data-governance begin
|
|
303
|
+
registerGovernedUserExportRoutes(
|
|
304
|
+
app,
|
|
305
|
+
governedExportService,
|
|
306
|
+
runtime,
|
|
307
|
+
foundationSnapshot.features,
|
|
308
|
+
);
|
|
309
|
+
// @windy-module system.data-governance end
|
|
310
|
+
registerSystemRoutes(
|
|
311
|
+
app,
|
|
312
|
+
systemRepositories,
|
|
313
|
+
runtime,
|
|
314
|
+
foundationSnapshot.features,
|
|
315
|
+
{ authRepository: persistence?.authRepository },
|
|
316
|
+
);
|
|
317
|
+
// @windy-module system.operations begin
|
|
318
|
+
registerSystemOperationRoutes(app, runtime, foundationSnapshot.features, {
|
|
319
|
+
redisHealthProbe: configurationRuntime.redisHealthProbe,
|
|
320
|
+
onlineUserProvider: () =>
|
|
321
|
+
persistence?.authRepository.listActiveSessions(
|
|
322
|
+
new Date(),
|
|
323
|
+
new Date(Date.now() - 15 * 60 * 1_000),
|
|
324
|
+
) ?? Promise.resolve([]),
|
|
325
|
+
databaseMonitorProbe: createPostgresMonitorProbe(persistence?.pool),
|
|
326
|
+
});
|
|
327
|
+
// @windy-module system.operations end
|
|
328
|
+
// @windy-module system.agent begin
|
|
329
|
+
const toolHandlers = createSystemToolHandlers(systemRepositories, runtime);
|
|
330
|
+
registerAgentRoutes(app, foundationModules, toolHandlers, runtime);
|
|
331
|
+
// @windy-module system.agent end
|
|
332
|
+
// @windy-module system.scheduler begin
|
|
333
|
+
registerSchedulerRoutes(app, scheduler, runtime, foundationSnapshot.features);
|
|
334
|
+
// @windy-module system.scheduler end
|
|
335
|
+
// @windy-module system.bulk-data begin
|
|
336
|
+
registerBulkDataRoutes(
|
|
337
|
+
app,
|
|
338
|
+
bulkDataService,
|
|
339
|
+
runtime,
|
|
340
|
+
foundationSnapshot.features,
|
|
341
|
+
);
|
|
342
|
+
// @windy-module system.bulk-data end
|
|
343
|
+
// @windy-module work-order begin
|
|
344
|
+
registerExampleModuleRoutes({
|
|
345
|
+
app,
|
|
346
|
+
runtime,
|
|
347
|
+
moduleRuntime: exampleModuleRuntime,
|
|
348
|
+
});
|
|
349
|
+
// @windy-module work-order end
|
|
350
|
+
|
|
351
|
+
validateServerModuleComposition({
|
|
352
|
+
modules: foundationModules,
|
|
353
|
+
routes: app.routes,
|
|
354
|
+
// @windy-module system.scheduler begin
|
|
355
|
+
tasks: scheduledTaskDefinitions,
|
|
356
|
+
// @windy-module system.scheduler end
|
|
357
|
+
// @windy-module system.agent begin
|
|
358
|
+
tools: toolHandlers,
|
|
359
|
+
// @windy-module system.agent end
|
|
360
|
+
// @windy-module system.search begin
|
|
361
|
+
providers: searchHost.providerKeys,
|
|
362
|
+
// @windy-module system.search end
|
|
363
|
+
});
|
|
364
|
+
|
|
365
|
+
const port = process.env.PORT ? Number(process.env.PORT) : 3000;
|
|
366
|
+
app.listen(port);
|
|
367
|
+
// @windy-module system.scheduler begin
|
|
368
|
+
schedulerWorker.start();
|
|
369
|
+
// @windy-module system.scheduler end
|
|
370
|
+
logPlatformStartup(logger, {
|
|
371
|
+
featureSync,
|
|
372
|
+
persistenceEnabled: Boolean(persistence),
|
|
373
|
+
port,
|
|
374
|
+
});
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { describe, expect, test } from "bun:test";
|
|
2
|
+
import { MemoryBlobStore } from "@windy/storage";
|
|
3
|
+
import { DurableArtifactService } from "./artifact-service.js";
|
|
4
|
+
import { InMemoryDurableJobRepository } from "./repository.js";
|
|
5
|
+
import { DurableJobService } from "./service.js";
|
|
6
|
+
|
|
7
|
+
describe("DurableArtifactService", () => {
|
|
8
|
+
test("只有 Owner 或 manage 权限可读取且过期后统一拒绝", async () => {
|
|
9
|
+
let now = new Date("2026-07-16T00:00:00.000Z");
|
|
10
|
+
const repository = new InMemoryDurableJobRepository();
|
|
11
|
+
const jobs = new DurableJobService(repository, () => now);
|
|
12
|
+
const submitted = await jobs.submit({
|
|
13
|
+
handlerKey: "test.artifact",
|
|
14
|
+
idempotencyKey: "artifact-access-001",
|
|
15
|
+
payload: {},
|
|
16
|
+
requestedBy: "owner-1",
|
|
17
|
+
});
|
|
18
|
+
const snapshot = await jobs.get(submitted.job.id);
|
|
19
|
+
const stage = snapshot?.stages[0];
|
|
20
|
+
if (!stage) throw new Error("应创建默认阶段");
|
|
21
|
+
const blobStore = new MemoryBlobStore();
|
|
22
|
+
const bytes = new TextEncoder().encode("durable artifact");
|
|
23
|
+
const blob = await blobStore.put({
|
|
24
|
+
body: new ReadableStream({
|
|
25
|
+
start(controller) {
|
|
26
|
+
controller.enqueue(bytes);
|
|
27
|
+
controller.close();
|
|
28
|
+
},
|
|
29
|
+
}),
|
|
30
|
+
});
|
|
31
|
+
await repository.putArtifact({
|
|
32
|
+
id: Bun.randomUUIDv7(),
|
|
33
|
+
jobId: submitted.job.id,
|
|
34
|
+
stageId: stage.id,
|
|
35
|
+
kind: "result",
|
|
36
|
+
artifactRef: blob.ref,
|
|
37
|
+
filename: "result.txt",
|
|
38
|
+
contentType: "text/plain",
|
|
39
|
+
byteSize: blob.byteSize,
|
|
40
|
+
sha256: blob.contentHash.value,
|
|
41
|
+
ownerId: "owner-1",
|
|
42
|
+
expiresAt: "2026-07-17T00:00:00.000Z",
|
|
43
|
+
createdAt: now.toISOString(),
|
|
44
|
+
});
|
|
45
|
+
const service = new DurableArtifactService(
|
|
46
|
+
repository,
|
|
47
|
+
blobStore,
|
|
48
|
+
() => now,
|
|
49
|
+
);
|
|
50
|
+
|
|
51
|
+
expect(
|
|
52
|
+
await readText(
|
|
53
|
+
(await service.open(submitted.job.id, "result", "owner-1")).body,
|
|
54
|
+
),
|
|
55
|
+
).toBe("durable artifact");
|
|
56
|
+
await expect(
|
|
57
|
+
service.open(submitted.job.id, "result", "other-user"),
|
|
58
|
+
).rejects.toMatchObject({
|
|
59
|
+
code: "ARTIFACT_FORBIDDEN",
|
|
60
|
+
});
|
|
61
|
+
expect(
|
|
62
|
+
await readText(
|
|
63
|
+
(await service.open(submitted.job.id, "result", "admin", true)).body,
|
|
64
|
+
),
|
|
65
|
+
).toBe("durable artifact");
|
|
66
|
+
|
|
67
|
+
now = new Date("2026-07-17T00:00:00.000Z");
|
|
68
|
+
await expect(
|
|
69
|
+
service.open(submitted.job.id, "result", "owner-1"),
|
|
70
|
+
).rejects.toMatchObject({
|
|
71
|
+
code: "ARTIFACT_EXPIRED",
|
|
72
|
+
});
|
|
73
|
+
});
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
async function readText(body: ReadableStream<Uint8Array>) {
|
|
77
|
+
return new Response(body).text();
|
|
78
|
+
}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import type { BlobStore, ReadableBlob } from "@windy/storage";
|
|
2
|
+
import type { DurableJobRepository } from "./repository.js";
|
|
3
|
+
import type { DurableJobArtifact } from "./types.js";
|
|
4
|
+
|
|
5
|
+
export type DurableArtifactErrorCode =
|
|
6
|
+
| "ARTIFACT_NOT_FOUND"
|
|
7
|
+
| "ARTIFACT_FORBIDDEN"
|
|
8
|
+
| "ARTIFACT_EXPIRED"
|
|
9
|
+
| "ARTIFACT_CONTENT_MISSING";
|
|
10
|
+
|
|
11
|
+
export class DurableArtifactError extends Error {
|
|
12
|
+
constructor(
|
|
13
|
+
readonly code: DurableArtifactErrorCode,
|
|
14
|
+
message: string,
|
|
15
|
+
) {
|
|
16
|
+
super(message);
|
|
17
|
+
this.name = "DurableArtifactError";
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export interface OpenedDurableArtifact {
|
|
22
|
+
artifact: DurableJobArtifact;
|
|
23
|
+
body: ReadableBlob["body"];
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export class DurableArtifactService {
|
|
27
|
+
constructor(
|
|
28
|
+
private readonly repository: DurableJobRepository,
|
|
29
|
+
private readonly blobStore: BlobStore,
|
|
30
|
+
private readonly now: () => Date = () => new Date(),
|
|
31
|
+
) {}
|
|
32
|
+
|
|
33
|
+
async open(
|
|
34
|
+
jobId: string,
|
|
35
|
+
kind: string,
|
|
36
|
+
actorId: string,
|
|
37
|
+
allowManage = false,
|
|
38
|
+
): Promise<OpenedDurableArtifact> {
|
|
39
|
+
const artifact = await this.inspect(jobId, kind, actorId, allowManage);
|
|
40
|
+
return this.openInspected(artifact);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
async inspect(
|
|
44
|
+
jobId: string,
|
|
45
|
+
kind: string,
|
|
46
|
+
actorId: string,
|
|
47
|
+
allowManage = false,
|
|
48
|
+
): Promise<DurableJobArtifact> {
|
|
49
|
+
const snapshot = await this.repository.get(jobId);
|
|
50
|
+
const artifact = snapshot?.artifacts.find((item) => item.kind === kind);
|
|
51
|
+
if (!artifact) {
|
|
52
|
+
throw new DurableArtifactError("ARTIFACT_NOT_FOUND", "任务产物不存在");
|
|
53
|
+
}
|
|
54
|
+
if (artifact.ownerId !== actorId && !allowManage) {
|
|
55
|
+
throw new DurableArtifactError("ARTIFACT_FORBIDDEN", "无权访问任务产物");
|
|
56
|
+
}
|
|
57
|
+
if (artifact.expiresAt && artifact.expiresAt <= this.now().toISOString()) {
|
|
58
|
+
throw new DurableArtifactError("ARTIFACT_EXPIRED", "任务产物已过期");
|
|
59
|
+
}
|
|
60
|
+
const blob = await this.blobStore.inspect(artifact.artifactRef);
|
|
61
|
+
if (
|
|
62
|
+
!blob ||
|
|
63
|
+
blob.byteSize !== artifact.byteSize ||
|
|
64
|
+
blob.contentHash.value !== artifact.sha256
|
|
65
|
+
) {
|
|
66
|
+
throw new DurableArtifactError(
|
|
67
|
+
"ARTIFACT_CONTENT_MISSING",
|
|
68
|
+
"任务产物内容不可用",
|
|
69
|
+
);
|
|
70
|
+
}
|
|
71
|
+
return artifact;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
async openInspected(
|
|
75
|
+
artifact: DurableJobArtifact,
|
|
76
|
+
): Promise<OpenedDurableArtifact> {
|
|
77
|
+
const blob = await this.blobStore.open(artifact.artifactRef);
|
|
78
|
+
if (
|
|
79
|
+
!blob ||
|
|
80
|
+
blob.byteSize !== artifact.byteSize ||
|
|
81
|
+
blob.contentHash.value !== artifact.sha256
|
|
82
|
+
) {
|
|
83
|
+
throw new DurableArtifactError(
|
|
84
|
+
"ARTIFACT_CONTENT_MISSING",
|
|
85
|
+
"任务产物内容不可用",
|
|
86
|
+
);
|
|
87
|
+
}
|
|
88
|
+
return { artifact, body: blob.body };
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
async deleteInspected(artifact: DurableJobArtifact) {
|
|
92
|
+
await this.blobStore.delete(artifact.artifactRef);
|
|
93
|
+
}
|
|
94
|
+
}
|