create-windy 0.2.6 → 0.2.8

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.
Files changed (361) hide show
  1. package/README.md +14 -3
  2. package/dist/cli.js +191 -87
  3. package/package.json +1 -1
  4. package/template/.windy-template.json +2 -2
  5. package/template/README.md +8 -0
  6. package/template/apps/server/Dockerfile +2 -0
  7. package/template/apps/server/package.json +10 -8
  8. package/template/apps/server/src/access-guards.ts +1 -1
  9. package/template/apps/server/src/admin/routes.test.ts +10 -0
  10. package/template/apps/server/src/admin/routes.ts +4 -2
  11. package/template/apps/server/src/agent/routes.test.ts +1 -1
  12. package/template/apps/server/src/agent/routes.ts +2 -2
  13. package/template/apps/server/src/application-services.ts +3 -0
  14. package/template/apps/server/src/audit/drizzle-log-store.ts +2 -2
  15. package/template/apps/server/src/audit/policy.ts +1 -1
  16. package/template/apps/server/src/audit/recovery-queue.test.ts +1 -1
  17. package/template/apps/server/src/audit/recovery-queue.ts +1 -1
  18. package/template/apps/server/src/audit/redaction.ts +1 -1
  19. package/template/apps/server/src/audit/reliable-writer.test.ts +1 -1
  20. package/template/apps/server/src/audit/reliable-writer.ts +1 -1
  21. package/template/apps/server/src/audit/search-summary.ts +1 -1
  22. package/template/apps/server/src/auth/authentication-provider.test.ts +1 -1
  23. package/template/apps/server/src/auth/credential-service.ts +1 -1
  24. package/template/apps/server/src/auth/drizzle-repository.ts +2 -2
  25. package/template/apps/server/src/auth/drizzle-session-operations.ts +1 -1
  26. package/template/apps/server/src/auth/own-session-routes.test.ts +1 -1
  27. package/template/apps/server/src/auth/password.ts +2 -4
  28. package/template/apps/server/src/auth/repository.ts +1 -1
  29. package/template/apps/server/src/auth/routes.test.ts +1 -1
  30. package/template/apps/server/src/auth/service.ts +1 -1
  31. package/template/apps/server/src/bulk-data/artifact-store.ts +1 -1
  32. package/template/apps/server/src/bulk-data/dictionary-handler.ts +1 -1
  33. package/template/apps/server/src/bulk-data/drizzle-repository.ts +3 -3
  34. package/template/apps/server/src/bulk-data/repository.ts +1 -1
  35. package/template/apps/server/src/bulk-data/routes.test.ts +1 -1
  36. package/template/apps/server/src/bulk-data/routes.ts +1 -1
  37. package/template/apps/server/src/bulk-data/service.test.ts +1 -1
  38. package/template/apps/server/src/bulk-data/service.ts +1 -1
  39. package/template/apps/server/src/bulk-data/types.ts +1 -1
  40. package/template/apps/server/src/configuration/bootstrap.ts +2 -2
  41. package/template/apps/server/src/configuration/definition.ts +2 -2
  42. package/template/apps/server/src/configuration/drizzle-repository.ts +2 -2
  43. package/template/apps/server/src/configuration/repository.ts +1 -1
  44. package/template/apps/server/src/configuration/routes.ts +1 -1
  45. package/template/apps/server/src/configuration/service.ts +1 -1
  46. package/template/apps/server/src/data-access/context.ts +2 -2
  47. package/template/apps/server/src/data-access/query-specification.test.ts +1 -1
  48. package/template/apps/server/src/data-access/scoped-repository.integration.test.ts +1 -1
  49. package/template/apps/server/src/data-access/scoped-repository.ts +1 -1
  50. package/template/apps/server/src/data-access/scoped-resource.test.ts +1 -1
  51. package/template/apps/server/src/data-access/scoped-resource.ts +1 -1
  52. package/template/apps/server/src/data-governance/export/approval-port.ts +1 -1
  53. package/template/apps/server/src/data-governance/export/drizzle-repository.ts +1 -1
  54. package/template/apps/server/src/data-governance/export/job-runtime.test.ts +2 -2
  55. package/template/apps/server/src/data-governance/export/job-runtime.ts +2 -3
  56. package/template/apps/server/src/data-governance/export/postgres-api-fixture.ts +2 -2
  57. package/template/apps/server/src/data-governance/export/postgres-api.integration.test.ts +1 -1
  58. package/template/apps/server/src/data-governance/export/routes-test-fixture.ts +3 -3
  59. package/template/apps/server/src/data-governance/export/routes.ts +1 -1
  60. package/template/apps/server/src/data-governance/export/scope-snapshot.ts +1 -1
  61. package/template/apps/server/src/data-governance/export/service.ts +2 -2
  62. package/template/apps/server/src/data-governance/export/source.ts +1 -1
  63. package/template/apps/server/src/data-governance/export/types.ts +1 -1
  64. package/template/apps/server/src/data-governance/plaintext-access.test.ts +1 -1
  65. package/template/apps/server/src/data-governance/plaintext-access.ts +1 -1
  66. package/template/apps/server/src/data-governance/plaintext-postgres.integration.test.ts +1 -1
  67. package/template/apps/server/src/data-governance/user-plaintext-routes.ts +1 -1
  68. package/template/apps/server/src/data-governance/user-projection.ts +2 -2
  69. package/template/apps/server/src/example-modules.ts +25 -1
  70. package/template/apps/server/src/feature/manifest-feature-repository.test.ts +1 -1
  71. package/template/apps/server/src/feature/manifest-feature-repository.ts +1 -1
  72. package/template/apps/server/src/feature/routes.ts +3 -6
  73. package/template/apps/server/src/foundation-access.test.ts +1 -1
  74. package/template/apps/server/src/foundation-access.ts +1 -1
  75. package/template/apps/server/src/foundation.ts +21 -7
  76. package/template/apps/server/src/guards.test.ts +1 -1
  77. package/template/apps/server/src/guards.ts +3 -3
  78. package/template/apps/server/src/index.ts +27 -3
  79. package/template/{packages/modules → apps/server}/src/installed-business-modules.ts +2 -2
  80. package/template/apps/server/src/jobs/artifact-service.test.ts +1 -1
  81. package/template/apps/server/src/jobs/artifact-service.ts +2 -2
  82. package/template/apps/server/src/jobs/drizzle-artifact.ts +2 -2
  83. package/template/apps/server/src/jobs/drizzle-claim.ts +1 -1
  84. package/template/apps/server/src/jobs/drizzle-execution-repository.ts +2 -2
  85. package/template/apps/server/src/jobs/drizzle-execution.integration.test.ts +1 -1
  86. package/template/apps/server/src/jobs/drizzle-lease.ts +2 -2
  87. package/template/apps/server/src/jobs/drizzle-mappers.ts +3 -3
  88. package/template/apps/server/src/jobs/drizzle-recovery-repository.ts +1 -1
  89. package/template/apps/server/src/jobs/drizzle-repository.integration.test.ts +1 -1
  90. package/template/apps/server/src/jobs/drizzle-repository.ts +3 -3
  91. package/template/apps/server/src/jobs/execution-repository.ts +1 -1
  92. package/template/apps/server/src/jobs/execution.test.ts +2 -2
  93. package/template/apps/server/src/jobs/in-memory-claim.ts +1 -1
  94. package/template/apps/server/src/jobs/in-memory-execution.ts +1 -1
  95. package/template/apps/server/src/jobs/in-memory-lease.ts +1 -1
  96. package/template/apps/server/src/jobs/legacy-adapter.integration.test.ts +1 -1
  97. package/template/apps/server/src/jobs/legacy-adapter.test.ts +1 -1
  98. package/template/apps/server/src/jobs/legacy-adapter.ts +1 -1
  99. package/template/apps/server/src/jobs/legacy-service-runtime.ts +4 -2
  100. package/template/apps/server/src/jobs/repository.ts +2 -2
  101. package/template/apps/server/src/jobs/service.ts +2 -2
  102. package/template/apps/server/src/jobs/worker.ts +3 -2
  103. package/template/apps/server/src/license/legacy-license-resolver.ts +1 -1
  104. package/template/apps/server/src/license/license-resolver.test.ts +1 -1
  105. package/template/apps/server/src/license/license-resolver.ts +3 -3
  106. package/template/apps/server/src/license/routes-offline-code.test.ts +2 -2
  107. package/template/apps/server/src/license/routes.ts +1 -1
  108. package/template/apps/server/src/license/runtime-audit-reliability.test.ts +2 -2
  109. package/template/apps/server/src/license/runtime-reminder.test.ts +2 -2
  110. package/template/apps/server/src/license/runtime-service.test.ts +2 -2
  111. package/template/apps/server/src/license/runtime-service.ts +2 -2
  112. package/template/apps/server/src/module-composition.test.ts +1 -1
  113. package/template/apps/server/src/module-composition.ts +1 -1
  114. package/template/apps/server/src/module-host.test.ts +145 -0
  115. package/template/apps/server/src/module-host.ts +110 -0
  116. package/template/apps/server/src/notification/drizzle-repository.ts +2 -2
  117. package/template/apps/server/src/notification/repository.ts +1 -1
  118. package/template/apps/server/src/notification/routes.ts +1 -1
  119. package/template/apps/server/src/pagination.ts +1 -1
  120. package/template/apps/server/src/persistence.integration.test.ts +1 -1
  121. package/template/apps/server/src/persistence.ts +1 -1
  122. package/template/apps/server/src/profile/routes.ts +1 -1
  123. package/template/apps/server/src/route-guards.test.ts +1 -1
  124. package/template/apps/server/src/route-guards.ts +1 -1
  125. package/template/apps/server/src/runtime-feature.ts +125 -0
  126. package/template/apps/server/src/runtime-license.ts +1 -1
  127. package/template/apps/server/src/runtime.test.ts +48 -1
  128. package/template/apps/server/src/runtime.ts +17 -64
  129. package/template/apps/server/src/scheduler/audit.ts +1 -1
  130. package/template/apps/server/src/scheduler/definitions.test.ts +1 -1
  131. package/template/apps/server/src/scheduler/definitions.ts +2 -2
  132. package/template/apps/server/src/scheduler/drizzle-durable-links.ts +1 -1
  133. package/template/apps/server/src/scheduler/drizzle-mappers.ts +1 -1
  134. package/template/apps/server/src/scheduler/drizzle-repository.ts +1 -1
  135. package/template/apps/server/src/scheduler/execution-recorder.ts +1 -1
  136. package/template/apps/server/src/scheduler/history.ts +1 -1
  137. package/template/apps/server/src/scheduler/overview.ts +1 -1
  138. package/template/apps/server/src/scheduler/recovery-service.test.ts +1 -1
  139. package/template/apps/server/src/scheduler/recovery-service.ts +1 -1
  140. package/template/apps/server/src/scheduler/repository.ts +1 -1
  141. package/template/apps/server/src/scheduler/routes.ts +1 -1
  142. package/template/apps/server/src/scheduler/service-idle.test.ts +1 -1
  143. package/template/apps/server/src/scheduler/service.test.ts +1 -1
  144. package/template/apps/server/src/scheduler/service.ts +1 -1
  145. package/template/apps/server/src/scheduler/types.ts +1 -1
  146. package/template/apps/server/src/search/contracts.ts +2 -2
  147. package/template/apps/server/src/search/host.ts +1 -1
  148. package/template/apps/server/src/search/registry.ts +1 -1
  149. package/template/apps/server/src/search/routes.test.ts +1 -1
  150. package/template/apps/server/src/search/routes.ts +1 -1
  151. package/template/apps/server/src/search/service.ts +2 -2
  152. package/template/apps/server/src/search/test-support.ts +2 -2
  153. package/template/apps/server/src/session/routes.ts +1 -1
  154. package/template/apps/server/src/settings/drizzle-repository.ts +2 -2
  155. package/template/apps/server/src/settings/repository.ts +1 -1
  156. package/template/apps/server/src/settings/routes.test.ts +1 -1
  157. package/template/apps/server/src/settings/routes.ts +1 -1
  158. package/template/apps/server/src/settings/runtime.ts +1 -1
  159. package/template/apps/server/src/storage/blob-reference-registry.test.ts +1 -1
  160. package/template/apps/server/src/storage/blob-reference-registry.ts +1 -1
  161. package/template/apps/server/src/storage/drizzle-upload-repository.integration.test.ts +1 -1
  162. package/template/apps/server/src/storage/drizzle-upload-repository.ts +2 -2
  163. package/template/apps/server/src/storage/route-support.ts +1 -1
  164. package/template/apps/server/src/storage/routes.test.ts +1 -1
  165. package/template/apps/server/src/storage/routes.ts +2 -2
  166. package/template/apps/server/src/storage/runtime.ts +6 -4
  167. package/template/apps/server/src/system/audit-routes.ts +1 -1
  168. package/template/apps/server/src/system/department-routes.ts +1 -1
  169. package/template/apps/server/src/system/drizzle-repository.ts +1 -1
  170. package/template/apps/server/src/system/drizzle-scoped-repository.ts +1 -1
  171. package/template/apps/server/src/system/drizzle-system.ts +1 -1
  172. package/template/apps/server/src/system/entities.ts +1 -1
  173. package/template/apps/server/src/system/identity-route-config.ts +1 -1
  174. package/template/apps/server/src/system/interface-catalog.test.ts +3 -3
  175. package/template/apps/server/src/system/interface-catalog.ts +2 -2
  176. package/template/apps/server/src/system/menu-registry.ts +1 -1
  177. package/template/apps/server/src/system/menu-routes.ts +1 -1
  178. package/template/apps/server/src/system/operations.test.ts +1 -1
  179. package/template/apps/server/src/system/operations.ts +1 -1
  180. package/template/apps/server/src/system/redis-health.ts +1 -1
  181. package/template/apps/server/src/system/repository.ts +1 -1
  182. package/template/apps/server/src/system/resource-route-support.ts +1 -1
  183. package/template/apps/server/src/system/route-helpers.ts +1 -1
  184. package/template/apps/server/src/system/route-types.ts +1 -1
  185. package/template/apps/server/src/system/routes.test.ts +1 -1
  186. package/template/apps/server/src/system/routes.ts +1 -1
  187. package/template/apps/server/src/system/user-projection.ts +1 -1
  188. package/template/apps/server/src/work-order/data-scope.integration.test.ts +1 -1
  189. package/template/apps/server/src/work-order/drizzle-repository.integration.test.ts +1 -1
  190. package/template/apps/server/src/work-order/drizzle-repository.ts +2 -2
  191. package/template/apps/server/src/work-order/foundation-modules.test.ts +15 -5
  192. package/template/apps/server/src/work-order/repository.ts +1 -1
  193. package/template/apps/server/src/work-order/routes.test.ts +2 -2
  194. package/template/apps/server/src/work-order/routes.ts +2 -2
  195. package/template/apps/server/src/work-order/search-api.test.ts +3 -3
  196. package/template/apps/server/src/work-order/search-provider.test.ts +3 -3
  197. package/template/apps/server/src/work-order/service.ts +1 -1
  198. package/template/apps/server/src/work-order/task.test.ts +1 -1
  199. package/template/apps/server/src/work-order/task.ts +2 -2
  200. package/template/apps/server/src/workflow/drizzle-repository.integration.test.ts +2 -2
  201. package/template/apps/server/src/workflow/drizzle-repository.ts +3 -3
  202. package/template/apps/server/src/workflow/effects.test.ts +1 -1
  203. package/template/apps/server/src/workflow/effects.ts +1 -1
  204. package/template/apps/server/src/workflow/repository.ts +2 -2
  205. package/template/apps/server/src/workflow/routes.ts +3 -3
  206. package/template/apps/server/src/workflow/service.ts +1 -1
  207. package/template/apps/server/src/workflow/timeout-runtime.test.ts +1 -1
  208. package/template/apps/server/src/workflow/timeout-runtime.ts +2 -2
  209. package/template/apps/web/Dockerfile +2 -0
  210. package/template/apps/web/package.json +4 -4
  211. package/template/apps/web/runtime-server.ts +1 -1
  212. package/template/apps/web/src/app/layouts/AppLayout.vue +6 -0
  213. package/template/apps/web/src/components/auth/PasswordChangeForm.vue +52 -7
  214. package/template/apps/web/src/components/auth/PasswordChangeForm.webtest.ts +43 -0
  215. package/template/apps/web/src/components/common/DataPagination.vue +1 -1
  216. package/template/apps/web/src/components/license/LicenseActivationCodeForm.vue +1 -1
  217. package/template/apps/web/src/components/license/LicenseFlow.webtest.ts +2 -2
  218. package/template/apps/web/src/composables/useModuleConfigurations.ts +1 -1
  219. package/template/apps/web/src/composables/useWatermarkSettings.ts +1 -0
  220. package/template/apps/web/src/composables/watermark-settings.ts +6 -0
  221. package/template/apps/web/src/composables/watermark-settings.webtest.ts +27 -1
  222. package/template/apps/web/src/layout/AppSidebar.vue +12 -3
  223. package/template/apps/web/src/layout/AppSidebar.webtest.ts +11 -0
  224. package/template/apps/web/src/layout/GlobalWatermark.vue +25 -8
  225. package/template/apps/web/src/layout/GlobalWatermark.webtest.ts +109 -0
  226. package/template/apps/web/src/layout/NavigationSearchDialog.vue +1 -1
  227. package/template/apps/web/src/layout/NotificationMenu.vue +1 -1
  228. package/template/apps/web/src/layout/navigation.ts +5 -1
  229. package/template/apps/web/src/layout/navigation.webtest.ts +1 -1
  230. package/template/apps/web/src/pages/configuration/components/ModuleConfigRollbackDialog.vue +1 -1
  231. package/template/apps/web/src/pages/configuration/components/ModuleConfigVersionList.vue +1 -1
  232. package/template/apps/web/src/pages/configuration/components/ModuleConfigurationEditor.vue +1 -1
  233. package/template/apps/web/src/pages/configuration/components/ModuleConfigurationEditor.webtest.ts +1 -1
  234. package/template/apps/web/src/pages/configuration/components/ModuleConfigurationWorkbench.vue +1 -1
  235. package/template/apps/web/src/pages/dashboard/dashboard-presenter.webtest.ts +1 -1
  236. package/template/apps/web/src/pages/settings/WatermarkSettingsSection.vue +21 -0
  237. package/template/apps/web/src/pages/system/SystemNotificationsPage.vue +2 -2
  238. package/template/apps/web/src/pages/system/components/AuditActionCell.vue +7 -2
  239. package/template/apps/web/src/pages/system/components/AuditLogFilters.vue +7 -2
  240. package/template/apps/web/src/pages/system/components/NotificationPublishForm.vue +1 -1
  241. package/template/apps/web/src/pages/system/components/SchedulerOperationsPanel.vue +1 -1
  242. package/template/apps/web/src/pages/system/components/SchedulerOperationsPanel.webtest.ts +1 -1
  243. package/template/apps/web/src/pages/system/components/SchedulerRunTable.vue +1 -1
  244. package/template/apps/web/src/pages/system/components/SchedulerRunTable.webtest.ts +1 -1
  245. package/template/apps/web/src/pages/system/components/SchedulerStaleRecoveryForm.vue +1 -1
  246. package/template/apps/web/src/pages/system/components/SchedulerStaleRecoveryForm.webtest.ts +1 -1
  247. package/template/apps/web/src/pages/system/components/SystemResourcePage.vue +1 -1
  248. package/template/apps/web/src/pages/system/components/SystemResourceTable.vue +10 -3
  249. package/template/apps/web/src/pages/system/components/role-policy/RolePermissionTree.vue +1 -1
  250. package/template/apps/web/src/pages/system/components/role-policy/RolePermissionTree.webtest.ts +1 -1
  251. package/template/apps/web/src/pages/system/components/role-policy/RolePolicyForm.vue +1 -1
  252. package/template/apps/web/src/pages/system/components/role-policy/permission-tree.ts +1 -1
  253. package/template/apps/web/src/pages/system/components/role-policy/permission-tree.webtest.ts +1 -1
  254. package/template/apps/web/src/pages/system/composables/useSchedulerOperations.ts +2 -2
  255. package/template/apps/web/src/pages/system/composables/useSchedulerOperations.webtest.ts +1 -1
  256. package/template/apps/web/src/pages/system/composables/useSystemResource.ts +1 -1
  257. package/template/apps/web/src/router/manifest-routes.ts +1 -1
  258. package/template/apps/web/src/router/manifest-routes.webtest.ts +1 -1
  259. package/template/apps/web/src/services/access-api.ts +10 -1
  260. package/template/apps/web/src/services/configuration-api.ts +1 -1
  261. package/template/apps/web/src/services/license-api.ts +1 -1
  262. package/template/apps/web/src/services/notification-api.ts +2 -2
  263. package/template/apps/web/src/services/operations-api.ts +1 -1
  264. package/template/apps/web/src/services/platform-settings-api.ts +2 -2
  265. package/template/apps/web/src/services/profile-api.ts +2 -2
  266. package/template/docs/architecture/durable-jobs.md +5 -0
  267. package/template/docs/architecture/module-manifest-composition.md +14 -7
  268. package/template/docs/architecture/object-storage.md +1 -1
  269. package/template/docs/development/crud-generator.md +4 -1
  270. package/template/docs/platform/audit-reliability.md +1 -1
  271. package/template/package.json +2 -1
  272. package/template/packages/config/package.json +15 -4
  273. package/template/packages/config/src/platform.ts +1 -1
  274. package/template/packages/crud-generator/package.json +1 -1
  275. package/template/packages/crud-generator/src/generator.test.ts +16 -0
  276. package/template/packages/crud-generator/src/templates/domain.ts +1 -1
  277. package/template/packages/crud-generator/src/templates/manifest.ts +2 -2
  278. package/template/packages/crud-generator/src/templates/project.ts +3 -3
  279. package/template/packages/crud-generator/src/templates/repository.ts +1 -1
  280. package/template/packages/crud-generator/src/templates/routes.ts +2 -2
  281. package/template/packages/crud-generator/src/validation.ts +22 -1
  282. package/template/packages/database/package.json +15 -5
  283. package/template/packages/database/src/bundle-validation.ts +218 -0
  284. package/template/packages/database/src/dialects.ts +1 -1
  285. package/template/packages/database/src/runner.test.ts +160 -13
  286. package/template/packages/database/src/runner.ts +95 -77
  287. package/template/packages/database/src/schema/governed-exports.ts +1 -1
  288. package/template/packages/database/src/schema/identity.ts +1 -1
  289. package/template/packages/database/src/schema/license-v1.ts +1 -1
  290. package/template/packages/database/src/schema/notifications.ts +1 -1
  291. package/template/packages/database/src/schema/platform-settings.ts +1 -1
  292. package/template/packages/database/src/schema/workflow.ts +1 -1
  293. package/template/packages/database/src/sql-store.ts +1 -1
  294. package/template/packages/database/src/store.ts +1 -1
  295. package/template/packages/example-work-order/index.ts +1 -0
  296. package/template/packages/example-work-order/package.json +4 -3
  297. package/template/packages/example-work-order/src/contract.ts +1 -1
  298. package/template/packages/example-work-order/src/manifest.ts +8 -3
  299. package/template/packages/example-work-order/src/migration-bundle.test.ts +43 -0
  300. package/template/packages/example-work-order/src/migration-bundle.ts +64 -0
  301. package/template/packages/jobs/index.ts +2 -0
  302. package/template/packages/jobs/package.json +29 -0
  303. package/template/packages/jobs/src/handlers.test.ts +72 -0
  304. package/template/{apps/server/src/jobs/handler-registry.ts → packages/jobs/src/handlers.ts} +4 -4
  305. package/template/{apps/server/src/jobs → packages/jobs/src}/types.ts +7 -1
  306. package/template/packages/{license-sdk → jobs}/tsconfig.json +0 -1
  307. package/template/packages/modules/index.ts +1 -1
  308. package/template/packages/modules/package.json +15 -5
  309. package/template/packages/modules/src/catalog-validation.ts +123 -0
  310. package/template/packages/modules/src/composition.test.ts +75 -2
  311. package/template/packages/modules/src/composition.ts +4 -2
  312. package/template/packages/modules/src/manifest.ts +7 -12
  313. package/template/packages/modules/src/menu-composition.ts +1 -1
  314. package/template/packages/modules/src/system-api-binding.ts +1 -1
  315. package/template/packages/modules/src/system-api-data-governance.ts +1 -1
  316. package/template/packages/modules/src/system-api-permissions.ts +1 -1
  317. package/template/packages/modules/src/system-data-governance.ts +1 -1
  318. package/template/packages/modules/src/system-features.ts +1 -1
  319. package/template/packages/modules/src/system-governed-export-bindings.ts +1 -1
  320. package/template/packages/modules/src/system-module-catalog.ts +1 -1
  321. package/template/packages/server-sdk/index.ts +5 -0
  322. package/template/packages/server-sdk/package.json +25 -0
  323. package/template/packages/server-sdk/src/module-host.ts +29 -0
  324. package/template/packages/server-sdk/tsconfig.json +16 -0
  325. package/template/packages/shared/index.ts +3 -0
  326. package/template/packages/shared/package.json +14 -3
  327. package/template/packages/shared/src/audit.ts +22 -1
  328. package/template/packages/shared/src/license-catalog.test.ts +17 -0
  329. package/template/packages/shared/src/license-catalog.ts +33 -0
  330. package/template/packages/shared/src/migration.ts +39 -0
  331. package/template/packages/shared/src/password.ts +4 -0
  332. package/template/packages/storage/package.json +14 -3
  333. package/template/packages/license-sdk/index.ts +0 -13
  334. package/template/packages/license-sdk/package.json +0 -18
  335. package/template/packages/license-sdk/src/bounded-json-body.test.ts +0 -65
  336. package/template/packages/license-sdk/src/bounded-json-body.ts +0 -135
  337. package/template/packages/license-sdk/src/canonical-json.test.ts +0 -28
  338. package/template/packages/license-sdk/src/canonical-json.ts +0 -104
  339. package/template/packages/license-sdk/src/client.test.ts +0 -82
  340. package/template/packages/license-sdk/src/client.ts +0 -86
  341. package/template/packages/license-sdk/src/device.ts +0 -46
  342. package/template/packages/license-sdk/src/file-storage.test.ts +0 -80
  343. package/template/packages/license-sdk/src/file-storage.ts +0 -77
  344. package/template/packages/license-sdk/src/installation.test.ts +0 -241
  345. package/template/packages/license-sdk/src/installation.ts +0 -150
  346. package/template/packages/license-sdk/src/license-parser.ts +0 -56
  347. package/template/packages/license-sdk/src/offline-code-base32.ts +0 -57
  348. package/template/packages/license-sdk/src/offline-code-decompression.ts +0 -55
  349. package/template/packages/license-sdk/src/offline-code-limits.ts +0 -10
  350. package/template/packages/license-sdk/src/offline-code-wire.ts +0 -72
  351. package/template/packages/license-sdk/src/offline-code.test.ts +0 -172
  352. package/template/packages/license-sdk/src/offline-code.ts +0 -319
  353. package/template/packages/license-sdk/src/payload.test.ts +0 -72
  354. package/template/packages/license-sdk/src/payload.ts +0 -201
  355. package/template/packages/license-sdk/src/storage.ts +0 -64
  356. package/template/packages/license-sdk/src/test-fixtures.ts +0 -59
  357. package/template/packages/license-sdk/src/v1-test-vector.ts +0 -49
  358. package/template/packages/license-sdk/src/validation.test.ts +0 -62
  359. package/template/packages/license-sdk/src/validation.ts +0 -143
  360. package/template/packages/license-sdk/src/verification.test.ts +0 -97
  361. package/template/packages/license-sdk/src/verification.ts +0 -199
@@ -2,7 +2,7 @@
2
2
  export {};
3
3
 
4
4
  // @windy-module system.configuration begin
5
- import type { ModuleConfigDiffEntry, ModuleConfigValues } from "@windy/shared";
5
+ import type { ModuleConfigDiffEntry, ModuleConfigValues } from "@southwind-ai/shared";
6
6
  import {
7
7
  index,
8
8
  integer,
@@ -10,7 +10,7 @@ import {
10
10
  uniqueIndex,
11
11
  varchar,
12
12
  } from "drizzle-orm/pg-core";
13
- import type { CandidateRole, TargetRef, WorkItem } from "@windy/shared";
13
+ import type { CandidateRole, TargetRef, WorkItem } from "@southwind-ai/shared";
14
14
 
15
15
  export const workflowWorkItems = pgTable(
16
16
  "workflow_work_items",
@@ -1,4 +1,4 @@
1
- import type { MigrationStatement } from "@windy/shared";
1
+ import type { MigrationStatement } from "@southwind-ai/shared";
2
2
  import type { MigrationHistoryEntry, MigrationHistoryStore } from "./store.js";
3
3
 
4
4
  export interface QueryResult<Row> {
@@ -1,4 +1,4 @@
1
- import type { ISODateTime } from "@windy/shared";
1
+ import type { ISODateTime } from "@southwind-ai/shared";
2
2
 
3
3
  export type MigrationStatus = "applied" | "failed";
4
4
 
@@ -1,3 +1,4 @@
1
1
  export * from "./src/contract.js";
2
2
  export * from "./src/manifest.js";
3
+ export * from "./src/migration-bundle.js";
3
4
  export * from "./src/schema.js";
@@ -1,13 +1,14 @@
1
1
  {
2
- "name": "@windy/example-work-order",
2
+ "name": "@southwind-ai/example-work-order",
3
3
  "version": "0.1.0",
4
4
  "private": true,
5
5
  "type": "module",
6
6
  "dependencies": {
7
- "@windy/shared": "workspace:*",
7
+ "@southwind-ai/shared": "workspace:*",
8
8
  "zod": "^4.4.3"
9
9
  },
10
10
  "exports": {
11
- ".": "./index.ts"
11
+ ".": "./index.ts",
12
+ "./migration-bundle": "./src/migration-bundle.ts"
12
13
  }
13
14
  }
@@ -2,7 +2,7 @@ import type {
2
2
  EntityAuditFields,
3
3
  LifecycleStatus,
4
4
  PageResult,
5
- } from "@windy/shared";
5
+ } from "@southwind-ai/shared";
6
6
 
7
7
  export const workOrderPriorities = ["low", "medium", "high"] as const;
8
8
  export const workOrderWorkflowStatuses = [
@@ -2,7 +2,11 @@ import {
2
2
  defineSearchProvider,
3
3
  featureKey,
4
4
  licenseVersionKey,
5
- } from "@windy/shared";
5
+ } from "@southwind-ai/shared";
6
+ import {
7
+ WORK_ORDER_INITIAL_MIGRATION_ID,
8
+ workOrderMigrationBundle,
9
+ } from "./migration-bundle.js";
6
10
 
7
11
  const FEATURE_KEY = featureKey("work-order.ticket");
8
12
 
@@ -41,12 +45,13 @@ export function workOrderModule() {
41
45
  ],
42
46
  },
43
47
  ],
44
- migrations: [],
48
+ migrations: [...workOrderMigrationBundle.migrations],
49
+ migrationBundle: workOrderMigrationBundle,
45
50
  schemaExports: [
46
51
  {
47
52
  key: "work-order.database.schema",
48
53
  exportName: "workOrders",
49
- migrationIds: ["0018_cheerful_alex_power"],
54
+ migrationIds: [WORK_ORDER_INITIAL_MIGRATION_ID],
50
55
  },
51
56
  ],
52
57
  tasks: [
@@ -0,0 +1,43 @@
1
+ import { describe, expect, test } from "bun:test";
2
+ import type {
3
+ DatabaseCompatibilityAdapter,
4
+ MigrationStatement,
5
+ } from "@southwind-ai/shared";
6
+ import { workOrderModule } from "./manifest.js";
7
+ import {
8
+ WORK_ORDER_INITIAL_MIGRATION_ID,
9
+ workOrderMigrationBundle,
10
+ } from "./migration-bundle.js";
11
+
12
+ describe("示例工单 Migration Bundle", () => {
13
+ test("业务包自持 bundle 并与 Manifest Schema Export 闭环", () => {
14
+ const manifest = workOrderModule();
15
+
16
+ expect(manifest.migrationBundle).toBe(workOrderMigrationBundle);
17
+ expect(manifest.migrations.map(({ id }) => id)).toEqual([
18
+ WORK_ORDER_INITIAL_MIGRATION_ID,
19
+ ]);
20
+ expect(manifest.schemaExports[0]?.migrationIds).toEqual([
21
+ WORK_ORDER_INITIAL_MIGRATION_ID,
22
+ ]);
23
+ });
24
+
25
+ test("安装 SQL 只包含 work_orders 表与索引且使用幂等建表", async () => {
26
+ const statements: MigrationStatement[] = [];
27
+ await workOrderMigrationBundle.migrations[0].run({
28
+ dialect: "postgresql",
29
+ dryRun: true,
30
+ adapter: {} as DatabaseCompatibilityAdapter,
31
+ execute(statement) {
32
+ statements.push(statement);
33
+ return Promise.resolve();
34
+ },
35
+ });
36
+ const sql = statements.map(({ sql: statement }) => statement).join("\n");
37
+
38
+ expect(sql).toContain("create table if not exists work_orders");
39
+ expect(sql).toContain("create index if not exists idx_work_orders_owner");
40
+ expect(sql).not.toContain("feature_flags");
41
+ expect(sql).not.toContain("license");
42
+ });
43
+ });
@@ -0,0 +1,64 @@
1
+ import {
2
+ MIGRATION_BUNDLE_FORMAT_VERSION,
3
+ type MigrationBundle,
4
+ type MigrationExecutionContext,
5
+ } from "@southwind-ai/shared";
6
+
7
+ export const WORK_ORDER_INITIAL_MIGRATION_ID =
8
+ "work-order.0001.create-work-orders";
9
+
10
+ export const workOrderMigrationBundle: MigrationBundle = {
11
+ formatVersion: MIGRATION_BUNDLE_FORMAT_VERSION,
12
+ module: "work-order",
13
+ version: "0.1.0",
14
+ migrations: [
15
+ {
16
+ id: WORK_ORDER_INITIAL_MIGRATION_ID,
17
+ module: "work-order",
18
+ description: "创建示例工单表及查询索引",
19
+ direction: "up",
20
+ checksum:
21
+ "sha256:cb97709a8680fabf46bff40e33d29e12255969bb54d232d7ea633324dc77ce33",
22
+ async run(context) {
23
+ for (const statement of workOrderStatements(context)) {
24
+ await context.execute({ sql: statement });
25
+ }
26
+ },
27
+ },
28
+ ],
29
+ };
30
+
31
+ function workOrderStatements(context: MigrationExecutionContext): string[] {
32
+ const timestamp =
33
+ context.dialect === "mysql" ? "datetime" : "timestamp with time zone";
34
+ const createTable = `create table if not exists work_orders (
35
+ id varchar(64) primary key not null,
36
+ title varchar(120) not null,
37
+ description text not null,
38
+ priority varchar(24) not null,
39
+ workflow_status varchar(32) not null,
40
+ owner_id varchar(64) not null,
41
+ department_id varchar(64),
42
+ status varchar(32) not null,
43
+ created_at ${timestamp} default current_timestamp not null,
44
+ created_by varchar(64) not null,
45
+ updated_at ${timestamp} default current_timestamp not null,
46
+ updated_by varchar(64) not null,
47
+ deleted_at ${timestamp},
48
+ deleted_by varchar(64)
49
+ )`;
50
+ const optionalClause =
51
+ context.dialect === "postgresql" || context.dialect === "kingbase"
52
+ ? " if not exists"
53
+ : "";
54
+ const indexes = [
55
+ ["idx_work_orders_owner", "owner_id"],
56
+ ["idx_work_orders_department", "department_id"],
57
+ ["idx_work_orders_status", "status"],
58
+ ["idx_work_orders_workflow", "workflow_status"],
59
+ ].map(
60
+ ([name, column]) =>
61
+ `create index${optionalClause} ${name} on work_orders (${column})`,
62
+ );
63
+ return [createTable, ...indexes];
64
+ }
@@ -0,0 +1,2 @@
1
+ export * from "./src/handlers.js";
2
+ export * from "./src/types.js";
@@ -0,0 +1,29 @@
1
+ {
2
+ "name": "@southwind-ai/jobs",
3
+ "version": "0.1.1",
4
+ "license": "UNLICENSED",
5
+ "type": "module",
6
+ "engines": {
7
+ "bun": ">=1.3.0"
8
+ },
9
+ "files": [
10
+ "index.ts",
11
+ "src/handlers.ts",
12
+ "src/types.ts"
13
+ ],
14
+ "scripts": {
15
+ "test": "bun test",
16
+ "typecheck": "tsc --noEmit --project tsconfig.json"
17
+ },
18
+ "dependencies": {
19
+ "@southwind-ai/storage": "workspace:*"
20
+ },
21
+ "exports": {
22
+ ".": "./index.ts",
23
+ "./handlers": "./src/handlers.ts",
24
+ "./types": "./src/types.ts"
25
+ },
26
+ "publishConfig": {
27
+ "access": "public"
28
+ }
29
+ }
@@ -0,0 +1,72 @@
1
+ import { describe, expect, test } from "bun:test";
2
+
3
+ import {
4
+ DurableHandlerError,
5
+ DurableHandlerRegistry,
6
+ type DurableHandlerContext,
7
+ } from "./handlers.js";
8
+
9
+ describe("DurableHandlerRegistry", () => {
10
+ test("解析 payload 后执行已注册 handler", async () => {
11
+ const received: string[] = [];
12
+ const registry = new DurableHandlerRegistry().register({
13
+ key: "example.report.generate",
14
+ payload: {
15
+ parse(input) {
16
+ if (
17
+ typeof input !== "object" ||
18
+ input === null ||
19
+ !("reportId" in input) ||
20
+ typeof input.reportId !== "string"
21
+ ) {
22
+ throw new DurableHandlerError(
23
+ "INVALID_PAYLOAD",
24
+ "reportId 无效",
25
+ false,
26
+ );
27
+ }
28
+ return { reportId: input.reportId };
29
+ },
30
+ },
31
+ execute(payload) {
32
+ received.push(payload.reportId);
33
+ },
34
+ });
35
+
36
+ await registry
37
+ .get("example.report.generate")
38
+ ?.execute({ reportId: "report-1" }, createContext());
39
+
40
+ expect(received).toEqual(["report-1"]);
41
+ expect(registry.keys()).toEqual(["example.report.generate"]);
42
+ });
43
+
44
+ test("拒绝空 key 和重复注册", () => {
45
+ const registry = new DurableHandlerRegistry();
46
+ const definition = {
47
+ key: "example.sync",
48
+ payload: { parse: () => ({}) },
49
+ execute: () => undefined,
50
+ };
51
+
52
+ expect(() => registry.register({ ...definition, key: " " })).toThrow(
53
+ "任务 handler key 不能为空",
54
+ );
55
+ registry.register(definition);
56
+ expect(() => registry.register(definition)).toThrow(
57
+ "任务 handler 重复注册:example.sync",
58
+ );
59
+ });
60
+ });
61
+
62
+ function createContext(): DurableHandlerContext {
63
+ return {
64
+ jobId: "job-1",
65
+ stageKey: "main",
66
+ attemptNumber: 1,
67
+ signal: new AbortController().signal,
68
+ heartbeat: async () => undefined,
69
+ progress: async () => undefined,
70
+ publishArtifact: async () => undefined,
71
+ };
72
+ }
@@ -1,4 +1,4 @@
1
- import type { ArtifactRef } from "@windy/storage";
1
+ import type { ArtifactRef } from "@southwind-ai/storage";
2
2
 
3
3
  export interface PayloadParser<T> {
4
4
  parse(input: unknown): T;
@@ -45,7 +45,7 @@ export interface RegisteredDurableHandler {
45
45
  export class DurableHandlerRegistry {
46
46
  private readonly handlers = new Map<string, RegisteredDurableHandler>();
47
47
 
48
- register<T>(definition: DurableHandlerDefinition<T>) {
48
+ register<T>(definition: DurableHandlerDefinition<T>): this {
49
49
  if (!definition.key.trim()) throw new Error("任务 handler key 不能为空");
50
50
  if (this.handlers.has(definition.key)) {
51
51
  throw new Error(`任务 handler 重复注册:${definition.key}`);
@@ -59,11 +59,11 @@ export class DurableHandlerRegistry {
59
59
  return this;
60
60
  }
61
61
 
62
- get(key: string) {
62
+ get(key: string): RegisteredDurableHandler | undefined {
63
63
  return this.handlers.get(key);
64
64
  }
65
65
 
66
- keys() {
66
+ keys(): string[] {
67
67
  return [...this.handlers.keys()].sort();
68
68
  }
69
69
  }
@@ -1,4 +1,4 @@
1
- import type { ArtifactRef } from "@windy/storage";
1
+ import type { ArtifactRef } from "@southwind-ai/storage";
2
2
 
3
3
  export type DurableJobStatus =
4
4
  | "queued"
@@ -178,3 +178,9 @@ export interface SubmitDurableJobResult {
178
178
  job: DurableJob;
179
179
  created: boolean;
180
180
  }
181
+
182
+ export interface DurableJobs {
183
+ submit(input: SubmitDurableJob): Promise<SubmitDurableJobResult>;
184
+ get(id: string): Promise<DurableJobSnapshot | undefined>;
185
+ list(requestedBy: string, limit?: number): Promise<DurableJob[]>;
186
+ }
@@ -7,7 +7,6 @@
7
7
  "strict": true,
8
8
  "noImplicitAny": true,
9
9
  "esModuleInterop": true,
10
- "resolveJsonModule": true,
11
10
  "skipLibCheck": true,
12
11
  "outDir": "dist",
13
12
  "types": ["bun"]
@@ -1,8 +1,8 @@
1
1
  export * from "./src/manifest.js";
2
2
  export * from "./src/composition.js";
3
+ export * from "./src/catalog-validation.js";
3
4
  export * from "./src/menu-composition.js";
4
5
  export * from "./src/registry.js";
5
6
  export * from "./src/system-modules.js";
6
7
  export * from "./src/system-module-catalog.js";
7
8
  export * from "./src/system-api-permissions.js";
8
- export * from "./src/installed-business-modules.js";
@@ -1,13 +1,23 @@
1
1
  {
2
- "name": "@windy/modules",
3
- "version": "0.1.0",
4
- "private": true,
2
+ "name": "@southwind-ai/modules",
3
+ "version": "0.1.1",
4
+ "license": "UNLICENSED",
5
5
  "type": "module",
6
+ "engines": {
7
+ "bun": ">=1.3.0"
8
+ },
9
+ "files": [
10
+ "index.ts",
11
+ "src/**/*.ts",
12
+ "!src/**/*.test.ts"
13
+ ],
6
14
  "dependencies": {
7
- "@windy/example-work-order": "workspace:*",
8
- "@windy/shared": "workspace:*"
15
+ "@southwind-ai/shared": "workspace:*"
9
16
  },
10
17
  "exports": {
11
18
  ".": "./index.ts"
19
+ },
20
+ "publishConfig": {
21
+ "access": "public"
12
22
  }
13
23
  }
@@ -0,0 +1,123 @@
1
+ import {
2
+ AUDIT_ACTION_DEFINITIONS,
3
+ isAuditActionDefinition,
4
+ LICENSE_CATALOG,
5
+ type AuditActionDefinition,
6
+ type FeatureFlagDefinition,
7
+ type LicenseCatalogDefinition,
8
+ } from "@southwind-ai/shared";
9
+ import type { ModuleManifest } from "./manifest.js";
10
+
11
+ export interface PlatformCapabilityCatalogs {
12
+ auditActions: readonly AuditActionDefinition[];
13
+ licenseVersions: readonly LicenseCatalogDefinition[];
14
+ }
15
+
16
+ export function validateCapabilityCatalogs(
17
+ modules: readonly ModuleManifest[],
18
+ ): PlatformCapabilityCatalogs {
19
+ const auditActions = composeAuditActionCatalog(modules);
20
+ validateFeatureCatalog(modules, LICENSE_CATALOG);
21
+ return {
22
+ auditActions,
23
+ licenseVersions: LICENSE_CATALOG,
24
+ };
25
+ }
26
+
27
+ export function composeAuditActionCatalog(
28
+ modules: readonly ModuleManifest[],
29
+ ): AuditActionDefinition[] {
30
+ const definitions = new Map<string, AuditActionDefinition>(
31
+ AUDIT_ACTION_DEFINITIONS.map((definition) => [
32
+ definition.key,
33
+ { ...definition },
34
+ ]),
35
+ );
36
+ const registrations = modules.flatMap((module) => module.auditActions);
37
+
38
+ for (const registration of registrations) {
39
+ if (!isAuditActionDefinition(registration)) continue;
40
+ validateAuditDefinition(registration);
41
+ if (definitions.has(registration.key)) {
42
+ throw new Error(`审计动作定义重复:${registration.key}`);
43
+ }
44
+ definitions.set(registration.key, { ...registration });
45
+ }
46
+
47
+ for (const registration of registrations) {
48
+ const key =
49
+ typeof registration === "string" ? registration : registration.key;
50
+ if (!definitions.has(key)) {
51
+ throw new Error(`引用了未定义审计动作:${key}`);
52
+ }
53
+ }
54
+
55
+ return [...definitions.values()].sort((left, right) =>
56
+ left.key.localeCompare(right.key),
57
+ );
58
+ }
59
+
60
+ export function validateFeatureCatalog(
61
+ modules: readonly ModuleManifest[],
62
+ licenseCatalog: readonly LicenseCatalogDefinition[],
63
+ ): void {
64
+ const features = modules.flatMap((module) => module.features);
65
+ const byKey = new Map(features.map((feature) => [feature.key, feature]));
66
+ const licenseKeys = new Set(licenseCatalog.map(({ key }) => key));
67
+
68
+ for (const feature of features) {
69
+ for (const dependency of feature.dependencies || []) {
70
+ if (dependency === feature.key) {
71
+ throw new Error(`Feature ${feature.key} 不能依赖自身`);
72
+ }
73
+ if (!byKey.has(dependency)) {
74
+ throw new Error(
75
+ `Feature ${feature.key} 引用了未注册依赖:${dependency}`,
76
+ );
77
+ }
78
+ }
79
+ for (const version of feature.allowedLicenseVersions || []) {
80
+ if (!licenseKeys.has(version)) {
81
+ throw new Error(
82
+ `Feature ${feature.key} 引用了未知 License 版本:${version}`,
83
+ );
84
+ }
85
+ }
86
+ }
87
+
88
+ validateFeatureCycles(features, byKey);
89
+ }
90
+
91
+ function validateAuditDefinition(definition: AuditActionDefinition): void {
92
+ if (
93
+ !definition.key.trim() ||
94
+ !definition.label.trim() ||
95
+ !definition.description.trim()
96
+ ) {
97
+ throw new Error("审计动作 Key、名称和说明不能为空");
98
+ }
99
+ }
100
+
101
+ function validateFeatureCycles(
102
+ features: readonly FeatureFlagDefinition[],
103
+ byKey: ReadonlyMap<string, FeatureFlagDefinition>,
104
+ ): void {
105
+ const visited = new Set<string>();
106
+ const visiting = new Set<string>();
107
+
108
+ const visit = (feature: FeatureFlagDefinition): void => {
109
+ if (visited.has(feature.key)) return;
110
+ if (visiting.has(feature.key)) {
111
+ throw new Error(`Feature 依赖存在循环:${feature.key}`);
112
+ }
113
+ visiting.add(feature.key);
114
+ for (const dependency of feature.dependencies || []) {
115
+ const target = byKey.get(dependency);
116
+ if (target) visit(target);
117
+ }
118
+ visiting.delete(feature.key);
119
+ visited.add(feature.key);
120
+ };
121
+
122
+ for (const feature of features) visit(feature);
123
+ }
@@ -1,5 +1,5 @@
1
1
  import { describe, expect, test } from "bun:test";
2
- import { featureKey } from "@windy/shared";
2
+ import { featureKey, licenseVersionKey } from "@southwind-ai/shared";
3
3
  import type { ModuleManifest } from "./manifest.js";
4
4
  import { validateModuleComposition } from "./composition.js";
5
5
 
@@ -50,10 +50,83 @@ describe("Module Composition 契约", () => {
50
50
  );
51
51
 
52
52
  const audit = fixture("audit");
53
- audit.tools[0]!.auditAction = "security.denied";
53
+ audit.tools[0]!.auditAction = "audit.unknown";
54
54
  expect(() => validateModuleComposition([audit])).toThrow("未注册审计动作");
55
55
  });
56
56
 
57
+ test("业务模块可注册带展示信息的审计动作目录", () => {
58
+ const module = fixture("ticket");
59
+ module.auditActions.push({
60
+ key: "ticket.assign",
61
+ label: "工单指派",
62
+ description: "将工单指派给处理人。",
63
+ });
64
+ module.tools[0]!.auditAction = "ticket.assign";
65
+
66
+ expect(() => validateModuleComposition([module])).not.toThrow();
67
+
68
+ const unknown = fixture("unknown");
69
+ unknown.auditActions.push("unknown.action");
70
+ expect(() => validateModuleComposition([unknown])).toThrow(
71
+ "引用了未定义审计动作",
72
+ );
73
+ });
74
+
75
+ test("审计动作定义不可覆盖平台动作或重复注册", () => {
76
+ const platform = fixture("platform");
77
+ platform.auditActions.push({
78
+ key: "crud.create",
79
+ label: "覆盖动作",
80
+ description: "不允许覆盖平台定义。",
81
+ });
82
+ expect(() => validateModuleComposition([platform])).toThrow(
83
+ "审计动作定义重复:crud.create",
84
+ );
85
+
86
+ const first = fixture("first");
87
+ const second = fixture("second");
88
+ for (const module of [first, second]) {
89
+ module.auditActions.push({
90
+ key: "ticket.assign",
91
+ label: "工单指派",
92
+ description: "将工单指派给处理人。",
93
+ });
94
+ }
95
+ expect(() => validateModuleComposition([first, second])).toThrow(
96
+ "审计动作定义重复:ticket.assign",
97
+ );
98
+ });
99
+
100
+ test("Feature 依赖未知、自依赖和循环时 fail-fast", () => {
101
+ const unknown = fixture("unknown");
102
+ unknown.features[0]!.dependencies = [featureKey("missing.feature")];
103
+ expect(() => validateModuleComposition([unknown])).toThrow(
104
+ "引用了未注册依赖",
105
+ );
106
+
107
+ const self = fixture("self");
108
+ self.features[0]!.dependencies = [featureKey("self.feature")];
109
+ expect(() => validateModuleComposition([self])).toThrow("不能依赖自身");
110
+
111
+ const first = fixture("first");
112
+ const second = fixture("second");
113
+ first.features[0]!.dependencies = [featureKey("second.feature")];
114
+ second.features[0]!.dependencies = [featureKey("first.feature")];
115
+ expect(() => validateModuleComposition([first, second])).toThrow(
116
+ "Feature 依赖存在循环",
117
+ );
118
+ });
119
+
120
+ test("Feature 只能引用 License Catalog 中的版本", () => {
121
+ const module = fixture("license");
122
+ module.features[0]!.allowedLicenseVersions = [
123
+ licenseVersionKey("enterprise"),
124
+ ];
125
+ expect(() => validateModuleComposition([module])).toThrow(
126
+ "引用了未知 License 版本:enterprise",
127
+ );
128
+ });
129
+
57
130
  test("菜单 Guard 必须与 Admin Route 一致", () => {
58
131
  const module = fixture("system");
59
132
  module.adminRoutes[0]!.permissionKey = "system.manage";
@@ -1,9 +1,10 @@
1
- import type { MenuNode } from "@windy/shared";
1
+ import type { MenuNode } from "@southwind-ai/shared";
2
2
  import type {
3
3
  ModuleImplementationBindings,
4
4
  ModuleManifest,
5
5
  } from "./manifest.js";
6
6
  import { composeModuleMenus } from "./menu-composition.js";
7
+ import { validateCapabilityCatalogs } from "./catalog-validation.js";
7
8
 
8
9
  export interface ValidatedModuleComposition {
9
10
  modules: readonly ModuleManifest[];
@@ -31,7 +32,8 @@ export function validateModuleComposition(
31
32
  "Feature",
32
33
  modules.flatMap((module) => module.features.map(({ key }) => key)),
33
34
  );
34
- const audits = new Set(modules.flatMap((module) => module.auditActions));
35
+ const catalogs = validateCapabilityCatalogs(modules);
36
+ const audits = new Set(catalogs.auditActions.map(({ key }) => key));
35
37
  const menus = composeModuleMenus(modules).flatMap((menu) =>
36
38
  flattenMenus([menu]),
37
39
  );