@taskforcehq/taskforce 0.3.170 → 0.3.301
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 +71 -21
- package/dist/Taskforce.module.css +3394 -5981
- package/dist/TaskforceCore.CategoryFallback.test.js +5 -2
- package/dist/TaskforceCore.filter-persistence.test.js +402 -0
- package/dist/TaskforceCore.js +388 -71
- package/dist/TaskforceCore.routing.test.js +311 -0
- package/dist/TaskforceCore.test.js +3344 -615
- package/dist/TaskforceWidget.js +3 -2
- package/dist/__tests__/localizationCatalogs.test.js +48 -31
- package/dist/__tests__/workflowSimulation.test.js +2 -2
- package/dist/annotatedAttachments/AnnotatedAttachmentSessionStore.d.ts +60 -0
- package/dist/annotatedAttachments/AnnotatedAttachmentSessionStore.js +324 -0
- package/dist/annotatedAttachments/AnnotatedAttachmentSessionStore.test.js +278 -0
- package/dist/annotatedAttachments/payload.d.ts +2 -0
- package/dist/annotatedAttachments/payload.js +54 -0
- package/dist/annotatedAttachments/payload.test.js +67 -0
- package/dist/annotatedAttachments/service.d.ts +49 -0
- package/dist/annotatedAttachments/service.js +121 -0
- package/dist/annotatedAttachments/types.d.ts +86 -0
- package/dist/cli.js +74 -25
- package/dist/compat/deploymentCompat.d.ts +12 -0
- package/dist/compat/deploymentCompat.js +43 -0
- package/dist/compat/workspaceSyncCompat.d.ts +6 -0
- package/dist/compat/workspaceSyncCompat.js +79 -0
- package/dist/compat/workspaceSyncCompat.test.js +87 -0
- package/dist/components/features/AgentsModule.d.ts +5 -0
- package/dist/components/features/AgentsModule.js +131 -0
- package/dist/components/features/AgentsModule.test.js +102 -0
- package/dist/components/features/AnnotatedAttachmentWorkspace.d.ts +24 -0
- package/dist/components/features/AnnotatedAttachmentWorkspace.js +1942 -0
- package/dist/components/features/AnnotatedAttachmentWorkspace.test.js +2831 -0
- package/dist/components/features/DocumentGenerateModal.js +8 -16
- package/dist/components/features/DocumentIndex.d.ts +3 -4
- package/dist/components/features/DocumentIndex.js +22 -10
- package/dist/components/features/DocumentViewer.d.ts +6 -2
- package/dist/components/features/DocumentViewer.js +1000 -18
- package/dist/components/features/DocumentWorkspace.d.ts +40 -2
- package/dist/components/features/DocumentWorkspace.js +96 -16
- package/dist/components/features/DocumentWorkspace.test.js +1202 -0
- package/dist/components/features/InitiativesModule.d.ts +22 -0
- package/dist/components/features/InitiativesModule.js +33 -0
- package/dist/components/features/TaskSettings.d.ts +41 -32
- package/dist/components/features/TaskSettings.js +798 -313
- package/dist/components/features/TaskSettings.test.js +1221 -47
- package/dist/components/features/WorkflowsModule.d.ts +27 -0
- package/dist/components/features/WorkflowsModule.js +21 -0
- package/dist/components/features/documentWorkspaceFilters.d.ts +10 -0
- package/dist/components/features/documentWorkspaceFilters.js +11 -0
- package/dist/components/features/settings/CategoryManager.d.ts +2 -0
- package/dist/components/features/settings/CategoryManager.js +15 -8
- package/dist/components/features/settings/PriorityManager.d.ts +18 -0
- package/dist/components/features/settings/PriorityManager.js +51 -0
- package/dist/components/features/settings/TaxonomyEditor.d.ts +2 -1
- package/dist/components/features/settings/TaxonomyEditor.js +41 -18
- package/dist/components/features/settings/TaxonomyLibraryManager.d.ts +26 -0
- package/dist/components/features/settings/TaxonomyLibraryManager.js +301 -0
- package/dist/components/features/settings/TaxonomyLibraryManager.test.js +141 -0
- package/dist/components/features/settings/TaxonomyManager.d.ts +35 -12
- package/dist/components/features/settings/TaxonomyManager.js +59 -27
- package/dist/components/features/settings/TypeManager.d.ts +11 -0
- package/dist/components/features/settings/TypeManager.js +48 -11
- package/dist/components/features/settings/{WorkflowEditorPrototype.d.ts → WorkflowEditor.d.ts} +2 -2
- package/dist/components/features/settings/{WorkflowEditorPrototype.js → WorkflowEditor.js} +3 -3
- package/dist/components/task/TaskActionHeader.d.ts +12 -2
- package/dist/components/task/TaskActionHeader.js +64 -8
- package/dist/components/task/TaskActionHeader.test.js +73 -0
- package/dist/components/task/TaskCard.d.ts +14 -16
- package/dist/components/task/TaskCard.js +144 -174
- package/dist/components/task/TaskCard.test.js +416 -64
- package/dist/components/task/TaskContextUpload.d.ts +6 -5
- package/dist/components/task/TaskContextUpload.js +199 -64
- package/dist/components/task/TaskContextUpload.test.js +331 -14
- package/dist/components/task/TaskForm.d.ts +23 -29
- package/dist/components/task/TaskForm.js +348 -169
- package/dist/components/task/TaskForm.test.js +419 -23
- package/dist/components/task/TaskKanban.d.ts +20 -21
- package/dist/components/task/TaskKanban.js +176 -316
- package/dist/components/task/TaskKanban.planning-drop.test.js +93 -0
- package/dist/components/task/TaskList.d.ts +22 -11
- package/dist/components/task/TaskList.js +98 -12
- package/dist/components/task/TaskList.test.js +206 -7
- package/dist/components/task/TaskReferenceBadge.d.ts +12 -0
- package/dist/components/task/TaskReferenceBadge.js +5 -0
- package/dist/components/task/TaskStatusActions.d.ts +12 -0
- package/dist/components/task/TaskStatusActions.js +18 -0
- package/dist/components/task/TaskStatusActions.test.js +45 -0
- package/dist/components/ui/ImageReferenceBadge.d.ts +12 -0
- package/dist/components/ui/ImageReferenceBadge.js +5 -0
- package/dist/components/ui/LevelSelector.d.ts +2 -1
- package/dist/components/ui/LevelSelector.js +2 -2
- package/dist/components/ui/Markdown.d.ts +1 -2
- package/dist/components/ui/Markdown.js +2 -13
- package/dist/components/ui/Modal.d.ts +3 -2
- package/dist/components/ui/Modal.js +4 -3
- package/dist/components/ui/MultiSelectFilter.d.ts +3 -1
- package/dist/components/ui/MultiSelectFilter.js +2 -2
- package/dist/components/ui/ReferenceBadgeButton.d.ts +13 -0
- package/dist/components/ui/ReferenceBadgeButton.js +6 -0
- package/dist/components/ui/TaxonomyDropdown.d.ts +7 -1
- package/dist/components/ui/TaxonomyDropdown.js +58 -23
- package/dist/components/ui/TopNoticeLayer.d.ts +7 -0
- package/dist/components/ui/TopNoticeLayer.js +14 -0
- package/dist/components/ui/TopNoticeLayer.test.js +25 -0
- package/dist/components/views/AppShellHeader.d.ts +13 -0
- package/dist/components/views/AppShellHeader.js +19 -0
- package/dist/components/views/AppShellHeader.test.js +21 -0
- package/dist/components/views/PlanComparisonPage.d.ts +73 -0
- package/dist/components/views/PlanComparisonPage.js +196 -0
- package/dist/components/views/PlanComparisonPage.test.js +251 -0
- package/dist/components/views/PlansPage.d.ts +14 -0
- package/dist/components/views/PlansPage.js +355 -0
- package/dist/components/views/StandaloneLayout.d.ts +2 -2
- package/dist/components/views/StandaloneLayout.js +2227 -1188
- package/dist/components/views/WidgetView.d.ts +2 -2
- package/dist/components/views/WidgetView.js +149 -43
- package/dist/components/views/chrome/WorkspaceChromeSections.d.ts +57 -0
- package/dist/components/views/chrome/WorkspaceChromeSections.js +38 -0
- package/dist/components/views/chrome/WorkspaceChromeSections.test.js +54 -0
- package/dist/components/views/chrome/workspaceChrome.d.ts +31 -0
- package/dist/components/views/chrome/workspaceChrome.js +108 -0
- package/dist/components/views/chrome/workspaceChrome.test.js +52 -0
- package/dist/components/views/panels/DocumentFilterToolbar.d.ts +10 -0
- package/dist/components/views/panels/DocumentFilterToolbar.js +7 -0
- package/dist/components/views/panels/DocumentFilterToolbar.test.js +19 -0
- package/dist/components/views/panels/FilterToolbar.d.ts +68 -0
- package/dist/components/views/panels/FilterToolbar.js +21 -0
- package/dist/components/views/panels/FilterToolbar.test.d.ts +1 -0
- package/dist/components/views/panels/FilterToolbar.test.js +45 -0
- package/dist/components/views/panels/FilterToolbarControls.d.ts +47 -0
- package/dist/components/views/panels/FilterToolbarControls.js +61 -0
- package/dist/components/views/panels/PlanningDrawer.d.ts +115 -0
- package/dist/components/views/panels/PlanningDrawer.js +220 -0
- package/dist/components/views/panels/ScheduleSidebar.d.ts +52 -0
- package/dist/components/views/panels/ScheduleSidebar.js +127 -0
- package/dist/components/views/panels/scheduleUtils.d.ts +14 -0
- package/dist/components/views/panels/scheduleUtils.js +79 -0
- package/dist/components/views/teamManagementAccess.d.ts +6 -0
- package/dist/components/views/teamManagementAccess.js +18 -0
- package/dist/components/views/teamManagementAccess.test.d.ts +1 -0
- package/dist/components/views/teamManagementAccess.test.js +44 -0
- package/dist/config/clientDeployment.d.ts +2 -0
- package/dist/config/clientDeployment.js +13 -0
- package/dist/config/cloudEnvironment.d.ts +15 -0
- package/dist/config/cloudEnvironment.js +60 -0
- package/dist/config/deployment.d.ts +20 -0
- package/dist/config/deployment.js +67 -0
- package/dist/config/deployment.test.d.ts +1 -0
- package/dist/config/deployment.test.js +88 -0
- package/dist/config/envSchema.js +36 -8
- package/dist/config/envSchema.test.js +28 -0
- package/dist/core/AiProfileService.d.ts +66 -0
- package/dist/core/AiProfileService.js +320 -0
- package/dist/core/AiProfileService.test.d.ts +1 -0
- package/dist/core/AiProfileService.test.js +164 -0
- package/dist/core/AiProfiles.test.d.ts +1 -0
- package/dist/core/AiProfiles.test.js +449 -0
- package/dist/core/AttachmentLinkService.d.ts +15 -0
- package/dist/core/AttachmentLinkService.js +157 -0
- package/dist/core/AuthTokenService.d.ts +44 -0
- package/dist/core/AuthTokenService.js +207 -0
- package/dist/core/CreatedBy.test.js +134 -6
- package/dist/core/DeletedTaskLifecycleService.d.ts +33 -0
- package/dist/core/DeletedTaskLifecycleService.js +158 -0
- package/dist/core/DeletedTaskTrash.test.d.ts +1 -0
- package/dist/core/DeletedTaskTrash.test.js +104 -0
- package/dist/core/EntitlementsPolicy.test.js +78 -5
- package/dist/core/GlobalSettingsService.d.ts +16 -0
- package/dist/core/GlobalSettingsService.js +370 -0
- package/dist/core/JsonBackupRuntime.test.d.ts +1 -0
- package/dist/core/JsonBackupRuntime.test.js +155 -0
- package/dist/core/McpTokenService.d.ts +118 -0
- package/dist/core/McpTokenService.js +921 -0
- package/dist/core/PlanEntitlementService.d.ts +201 -0
- package/dist/core/PlanEntitlementService.js +1442 -0
- package/dist/core/PlanVersionPolicy.test.d.ts +1 -0
- package/dist/core/PlanVersionPolicy.test.js +178 -0
- package/dist/core/PlanningEntities.test.d.ts +1 -0
- package/dist/core/PlanningEntities.test.js +95 -0
- package/dist/core/ScheduleFields.test.js +15 -19
- package/dist/core/SignupMonetizationSettings.test.d.ts +1 -0
- package/dist/core/SignupMonetizationSettings.test.js +159 -0
- package/dist/core/Stats.test.d.ts +1 -0
- package/dist/core/Stats.test.js +36 -0
- package/dist/core/SyncReconciliationService.d.ts +93 -0
- package/dist/core/SyncReconciliationService.js +406 -0
- package/dist/core/SystemAdmin.test.js +578 -13
- package/dist/core/TaskActivityService.d.ts +21 -0
- package/dist/core/TaskActivityService.js +130 -0
- package/dist/core/TaskAttachmentsCanonical.test.d.ts +1 -0
- package/dist/core/TaskAttachmentsCanonical.test.js +306 -0
- package/dist/core/TaskAuditTimeline.test.d.ts +1 -0
- package/dist/core/TaskAuditTimeline.test.js +132 -0
- package/dist/core/TaskTaxonomyValidation.test.js +338 -15
- package/dist/core/Taskforce.d.ts +930 -183
- package/dist/core/Taskforce.ids.test.js +252 -0
- package/dist/core/Taskforce.js +3848 -2532
- package/dist/core/Taskforce.mcpAuth.test.d.ts +1 -0
- package/dist/core/Taskforce.mcpAuth.test.js +343 -0
- package/dist/core/Taskforce.realtimeMutation.test.js +57 -2
- package/dist/core/TaxonomySettingsService.d.ts +18 -0
- package/dist/core/TaxonomySettingsService.js +162 -0
- package/dist/core/WorkspaceDelete.test.js +32 -13
- package/dist/core/WorkspaceLifecycleService.d.ts +11 -0
- package/dist/core/WorkspaceLifecycleService.js +88 -0
- package/dist/core/WorkspacePermissions.test.js +95 -0
- package/dist/core/WorkspacePlanMode.test.js +114 -1
- package/dist/core/WorkspacePreferenceService.d.ts +41 -0
- package/dist/core/WorkspacePreferenceService.js +246 -0
- package/dist/core/WorkspaceSyncSettings.test.d.ts +1 -0
- package/dist/core/WorkspaceSyncSettings.test.js +65 -0
- package/dist/core/__tests__/TaskAttachmentsCanonical.test.d.ts +1 -0
- package/dist/core/__tests__/TaskAttachmentsCanonical.test.js +212 -0
- package/dist/core/shared.d.ts +36 -0
- package/dist/core/shared.js +128 -0
- package/dist/core/types.d.ts +614 -0
- package/dist/core/types.js +27 -0
- package/dist/documentReviews/DocumentReviewCommentStore.d.ts +56 -0
- package/dist/documentReviews/DocumentReviewCommentStore.js +230 -0
- package/dist/documentReviews/DocumentReviewSessionStore.d.ts +52 -0
- package/dist/documentReviews/DocumentReviewSessionStore.js +193 -0
- package/dist/documentReviews/DocumentReviewSessionStore.test.d.ts +1 -0
- package/dist/documentReviews/DocumentReviewSessionStore.test.js +127 -0
- package/dist/documentReviews/service.d.ts +68 -0
- package/dist/documentReviews/service.js +210 -0
- package/dist/documentReviews/types.d.ts +58 -0
- package/dist/documentReviews/types.js +1 -0
- package/dist/hooks/auth/useAuthGuardPolicy.d.ts +2 -0
- package/dist/hooks/auth/useAuthGuardPolicy.js +1 -0
- package/dist/hooks/tasks/useCurrentTaskRelations.d.ts +15 -0
- package/dist/hooks/tasks/useCurrentTaskRelations.js +37 -0
- package/dist/hooks/tasks/useTaskActions.d.ts +3 -0
- package/dist/hooks/tasks/useTaskActions.js +2 -0
- package/dist/hooks/tasks/useTaskEditorNavigation.d.ts +65 -0
- package/dist/hooks/tasks/useTaskEditorNavigation.js +235 -0
- package/dist/hooks/tasks/useTaskFilters.d.ts +2 -0
- package/dist/hooks/tasks/useTaskFilters.js +2 -0
- package/dist/hooks/tasks/useTaskFormActions.d.ts +58 -0
- package/dist/hooks/tasks/useTaskFormActions.js +365 -0
- package/dist/hooks/tasks/useTaskRelationships.d.ts +16 -0
- package/dist/hooks/tasks/useTaskRelationships.js +64 -0
- package/dist/hooks/ui/useResourceExport.d.ts +19 -0
- package/dist/hooks/ui/useResourceExport.js +84 -0
- package/dist/hooks/ui/useSettingsModel.d.ts +203 -0
- package/dist/hooks/ui/useSettingsModel.js +125 -0
- package/dist/hooks/ui/useSettingsPersistence.d.ts +36 -0
- package/dist/hooks/ui/useSettingsPersistence.js +254 -0
- package/dist/hooks/ui/useSettingsTaxonomyManagement.d.ts +119 -0
- package/dist/hooks/ui/useSettingsTaxonomyManagement.js +536 -0
- package/dist/hooks/ui/useUiNotice.d.ts +1 -0
- package/dist/hooks/ui/useUiNotice.js +1 -0
- package/dist/hooks/ui/useWorkflowTemplates.d.ts +37 -0
- package/dist/hooks/ui/useWorkflowTemplates.js +111 -0
- package/dist/hooks/ui/useZenMode.d.ts +5 -0
- package/dist/hooks/ui/useZenMode.js +32 -0
- package/dist/hooks/useFilterSort.d.ts +60 -0
- package/dist/hooks/useFilterSort.js +362 -0
- package/dist/hooks/useFilterSort.test.d.ts +1 -0
- package/dist/hooks/useFilterSort.test.js +333 -0
- package/dist/hooks/useRealtimeSync.d.ts +1 -0
- package/dist/hooks/useRealtimeSync.js +24 -9
- package/dist/hooks/useRealtimeSync.test.js +28 -1
- package/dist/hooks/useSyncOrchestrator.aiProfiles.test.d.ts +1 -0
- package/dist/hooks/useSyncOrchestrator.aiProfiles.test.js +34 -0
- package/dist/hooks/useSyncOrchestrator.d.ts +65 -103
- package/dist/hooks/useSyncOrchestrator.js +1538 -670
- package/dist/hooks/useSyncOrchestrator.retry-closure.test.js +700 -174
- package/dist/hooks/useTaskData.d.ts +35 -0
- package/dist/hooks/useTaskData.js +243 -0
- package/dist/hooks/useTaskData.test.d.ts +1 -0
- package/dist/hooks/useTaskData.test.js +180 -0
- package/dist/hooks/useTaskMutations.d.ts +46 -0
- package/dist/hooks/useTaskMutations.js +472 -0
- package/dist/hooks/useTaskMutations.test.d.ts +1 -0
- package/dist/hooks/useTaskMutations.test.js +80 -0
- package/dist/hooks/useTaskforce.contract.test.d.ts +1 -0
- package/dist/hooks/useTaskforce.contract.test.js +7 -0
- package/dist/hooks/useTaskforce.d.ts +260 -295
- package/dist/hooks/useTaskforce.js +1954 -2623
- package/dist/hooks/useTaskforce.priority-filters.test.js +6 -11
- package/dist/hooks/useTaskforce.sync-behavior.test.d.ts +1 -0
- package/dist/hooks/useTaskforce.sync-behavior.test.js +1120 -0
- package/dist/hooks/useUiNotice.d.ts +16 -0
- package/dist/hooks/useUiNotice.js +49 -0
- package/dist/hooks/useWorkspaceSyncController.d.ts +23 -46
- package/dist/hooks/useWorkspaceSyncController.js +280 -461
- package/dist/hooks/useWorkspaceSyncController.test.js +106 -199
- package/dist/hooks/workspace/useTaskforceApiRouting.d.ts +8 -0
- package/dist/hooks/workspace/useTaskforceApiRouting.js +91 -0
- package/dist/hooks/workspace/useTaskforceApiRouting.test.d.ts +1 -0
- package/dist/hooks/workspace/useTaskforceApiRouting.test.js +60 -0
- package/dist/hooks/workspace/useWorkspaceSyncController.d.ts +1 -0
- package/dist/hooks/workspace/useWorkspaceSyncController.js +1 -0
- package/dist/hooks/workspace/workspaceLocalState.d.ts +30 -0
- package/dist/hooks/workspace/workspaceLocalState.js +101 -0
- package/dist/localization/locales/en-US.d.ts +1 -8
- package/dist/localization/locales/en-US.js +4 -11
- package/dist/localization/locales/es-419.js +2 -9
- package/dist/localization/locales/pt-BR.js +2 -9
- package/dist/localization/localizationCatalogs.test.d.ts +1 -0
- package/dist/localization/localizationCatalogs.test.js +37 -0
- package/dist/main.d.ts +1 -0
- package/dist/main.js +9 -15
- package/dist/mcp/clientIntegrations.d.ts +33 -0
- package/dist/mcp/clientIntegrations.js +199 -0
- package/dist/mcp/clientIntegrations.test.d.ts +1 -0
- package/dist/mcp/clientIntegrations.test.js +110 -0
- package/dist/mcp/index.d.ts +2 -0
- package/dist/mcp/index.js +2 -0
- package/dist/mcp/optionResolution.test.js +6 -2
- package/dist/mcp/runtime.d.ts +120 -0
- package/dist/mcp/runtime.js +5668 -0
- package/dist/mcp/runtime.test.d.ts +1 -0
- package/dist/mcp/runtime.test.js +3299 -0
- package/dist/mcp/server.js +2 -1793
- package/dist/mcp/structuredCommentValidation.test.d.ts +1 -0
- package/dist/{__tests__ → mcp}/structuredCommentValidation.test.js +1 -1
- package/dist/mcp/structuredDocValidation.js +1 -2
- package/dist/mcp/structuredDocValidation.test.d.ts +1 -0
- package/dist/{__tests__ → mcp}/structuredDocValidation.test.js +9 -4
- package/dist/mcp/toolRegistry.d.ts +570 -0
- package/dist/mcp/toolRegistry.js +90 -0
- package/dist/mcp/toolRegistry.test.d.ts +1 -0
- package/dist/mcp/toolRegistry.test.js +30 -0
- package/dist/migrations/billingSchemaParity.test.js +111 -0
- package/dist/migrations/taskSchemaMigrations.d.ts +5 -0
- package/dist/migrations/taskSchemaMigrations.js +681 -39
- package/dist/migrations/taskSchemaMigrations.test.d.ts +1 -0
- package/dist/migrations/taskSchemaMigrations.test.js +210 -0
- package/dist/plugins/vite.js +13 -7
- package/dist/public/apple-touch-icon.png +0 -0
- package/dist/public/archive/phoenix/apple-touch-icon.png +0 -0
- package/dist/public/archive/phoenix/favicon.ico +0 -0
- package/dist/public/archive/phoenix/site.webmanifest +1 -0
- package/dist/public/favicon-96x96.png +0 -0
- package/dist/public/favicon.ico +0 -0
- package/dist/public/favicon.svg +17 -0
- package/dist/public/site.webmanifest +21 -1
- package/dist/public/web-app-manifest-192x192.png +0 -0
- package/dist/public/web-app-manifest-512x512.png +0 -0
- package/dist/releaseVersion.test.d.ts +1 -0
- package/dist/{__tests__/releaseVersion.test.js → releaseVersion.test.js} +1 -1
- package/dist/resources/templates/WORKFLOW_V2_POLICY.md +1 -1
- package/dist/resources/templates/workflow-sources/workflowDocs.mjs +62 -52
- package/dist/resources/templates/workflows/collaborate.yaml +11 -5
- package/dist/resources/templates/workflows/do.yaml +8 -2
- package/dist/resources/templates/workflows/evaluate.yaml +13 -7
- package/dist/resources/templates/workflows/execute.yaml +40 -23
- package/dist/resources/templates/workflows/plan.yaml +15 -8
- package/dist/resources/templates/workflows/review.yaml +14 -8
- package/dist/runtime/appGateDefinitions.d.ts +32 -0
- package/dist/runtime/appGateDefinitions.js +32 -0
- package/dist/runtime/appGates.d.ts +29 -0
- package/dist/runtime/appGates.js +53 -0
- package/dist/runtime/appGates.test.d.ts +1 -0
- package/dist/runtime/appGates.test.js +42 -0
- package/dist/runtime/migrationFlags.d.ts +1 -0
- package/dist/runtime/migrationFlags.js +1 -0
- package/dist/server/annotatedAttachmentsRoutes.test.d.ts +1 -0
- package/dist/server/annotatedAttachmentsRoutes.test.js +473 -0
- package/dist/server/auth.js +14 -2
- package/dist/server/auth.test.js +21 -1
- package/dist/server/cors.js +11 -5
- package/dist/server/cors.test.js +6 -0
- package/dist/server/documentReviewRoutes.test.d.ts +1 -0
- package/dist/server/documentReviewRoutes.test.js +157 -0
- package/dist/server/index.cookieProxy.test.js +46 -1
- package/dist/server/index.d.ts +20 -0
- package/dist/server/index.js +168 -41
- package/dist/server/index.rateLimit.test.js +6 -0
- package/dist/server/index.test.js +133 -2
- package/dist/server/mockStripe.d.ts +72 -0
- package/dist/server/mockStripe.js +357 -0
- package/dist/server/realtimeSyncWs.js +4 -0
- package/dist/server/routes/admin.d.ts +114 -0
- package/dist/server/routes/admin.js +2226 -0
- package/dist/server/routes/annotatedAttachments.d.ts +24 -0
- package/dist/server/routes/annotatedAttachments.js +235 -0
- package/dist/server/routes/auth.d.ts +61 -0
- package/dist/server/routes/auth.js +1296 -0
- package/dist/server/{routes.billing.d.ts → routes/billing.d.ts} +3 -2
- package/dist/server/routes/billing.js +2001 -0
- package/dist/server/routes/billing.test.d.ts +1 -0
- package/dist/server/routes/billing.test.js +1631 -0
- package/dist/server/routes/documentReviews.d.ts +11 -0
- package/dist/server/routes/documentReviews.js +191 -0
- package/dist/server/routes/documents.d.ts +118 -0
- package/dist/server/routes/documents.js +1113 -0
- package/dist/server/routes/resources.d.ts +25 -0
- package/dist/server/routes/resources.js +225 -0
- package/dist/server/routes/shared.d.ts +35 -0
- package/dist/server/routes/shared.js +305 -0
- package/dist/server/routes/shared.test.d.ts +1 -0
- package/dist/server/routes/shared.test.js +32 -0
- package/dist/server/{routes.sync.d.ts → routes/sync.d.ts} +5 -5
- package/dist/server/routes/sync.integration.test.d.ts +1 -0
- package/dist/server/routes/sync.integration.test.js +2003 -0
- package/dist/server/routes/sync.js +3143 -0
- package/dist/server/routes/tasks.d.ts +72 -0
- package/dist/server/routes/tasks.js +1252 -0
- package/dist/server/routes/workspaces.d.ts +32 -0
- package/dist/server/routes/workspaces.js +307 -0
- package/dist/server/routes.d.ts +8 -9
- package/dist/server/routes.js +968 -4092
- package/dist/server/routes.test.js +9043 -2415
- package/dist/server/runtimeMode.d.ts +1 -1
- package/dist/server/runtimeMode.js +3 -18
- package/dist/server/runtimeMode.test.js +3 -3
- package/dist/server/securityHeaders.d.ts +1 -1
- package/dist/server/securityHeaders.js +65 -6
- package/dist/server/securityHeaders.test.js +40 -2
- package/dist/services/templateEngine.test.d.ts +1 -0
- package/dist/{__tests__ → services}/templateEngine.test.js +1 -1
- package/dist/services/templates.test.d.ts +1 -0
- package/dist/{__tests__ → services}/templates.test.js +1 -1
- package/dist/services/workflowDocumentFixtures.test.d.ts +1 -0
- package/dist/{__tests__ → services}/workflowDocumentFixtures.test.js +4 -4
- package/dist/services/workflowExportMatrix.test.d.ts +1 -0
- package/dist/{__tests__ → services}/workflowExportMatrix.test.js +1 -1
- package/dist/services/workflowExportSnapshots.test.d.ts +1 -0
- package/dist/services/workflowGeneration.test.d.ts +1 -0
- package/dist/services/workflowSimulation.test.d.ts +1 -0
- package/dist/services/workflowSimulation.test.js +113 -0
- package/dist/services/workflowV2Policy.test.d.ts +1 -0
- package/dist/{__tests__ → services}/workflowV2Policy.test.js +2 -2
- package/dist/shared/aiProfileSurfaceType.d.ts +9 -0
- package/dist/shared/aiProfileSurfaceType.js +49 -0
- package/dist/shared/customTaxonomyLibrary.d.ts +11 -0
- package/dist/shared/customTaxonomyLibrary.js +276 -0
- package/dist/shared/customTaxonomyLibrary.test.d.ts +1 -0
- package/dist/shared/customTaxonomyLibrary.test.js +20 -0
- package/dist/shared/taxonomyCatalog.d.ts +19 -0
- package/dist/shared/taxonomyCatalog.js +36 -0
- package/dist/shared/taxonomyDefaults.d.ts +29 -0
- package/dist/shared/taxonomyDefaults.js +26 -0
- package/dist/shared/taxonomyLibrary.d.ts +15 -0
- package/dist/shared/taxonomyLibrary.js +98 -0
- package/dist/shared/taxonomyLibrary.test.d.ts +1 -0
- package/dist/shared/taxonomyLibrary.test.js +26 -0
- package/dist/shared/taxonomyState.d.ts +36 -0
- package/dist/shared/taxonomyState.js +73 -0
- package/dist/shared/taxonomyState.test.d.ts +1 -0
- package/dist/shared/taxonomyState.test.js +71 -0
- package/dist/shared/workflowDefaults.d.ts +9 -0
- package/dist/shared/workflowDefaults.js +11 -0
- package/dist/storage/documentIntegrity.d.ts +2 -0
- package/dist/storage/documentIntegrity.js +34 -17
- package/dist/storage/documentPurge.d.ts +2 -1
- package/dist/storage/documentPurge.js +35 -8
- package/dist/storage/index.d.ts +4 -0
- package/dist/storage/index.js +2 -0
- package/dist/storage/objectStorage.d.ts +1 -1
- package/dist/storage/objectStorageClient.d.ts +6 -4
- package/dist/storage/objectStorageClient.js +77 -29
- package/dist/storage/objectStorageClient.test.d.ts +1 -0
- package/dist/storage/objectStorageClient.test.js +57 -0
- package/dist/storage/objectStorageConfig.js +3 -1
- package/dist/storage/objectStorageConfig.test.d.ts +1 -0
- package/dist/storage/objectStorageConfig.test.js +38 -0
- package/dist/storage/postgresAdapter.d.ts +5 -0
- package/dist/storage/postgresAdapter.js +2 -2
- package/dist/storage/postgresAdapter.test.d.ts +1 -0
- package/dist/storage/postgresAdapter.test.js +29 -0
- package/dist/storage/taskAssetStore.d.ts +7 -4
- package/dist/storage/taskAssetStore.js +65 -60
- package/dist/storage/workspaceAssetStore.d.ts +122 -0
- package/dist/storage/workspaceAssetStore.js +496 -0
- package/dist/storage/workspaceAssetStore.test.d.ts +1 -0
- package/dist/storage/workspaceAssetStore.test.js +501 -0
- package/dist/sync/cloudSyncApi.d.ts +33 -2
- package/dist/sync/cloudSyncApi.js +37 -15
- package/dist/sync/cloudSyncApi.test.js +60 -3
- package/dist/sync/index.d.ts +2 -0
- package/dist/sync/index.js +3 -0
- package/dist/sync/syncService.d.ts +25 -0
- package/dist/sync/syncService.js +184 -16
- package/dist/sync/syncService.test.js +289 -25
- package/dist/sync/workspaceRepair.d.ts +114 -0
- package/dist/sync/workspaceRepair.js +566 -0
- package/dist/sync/workspaceSyncModel.d.ts +230 -2
- package/dist/sync/workspaceSyncModel.js +456 -17
- package/dist/sync/workspaceSyncModel.test.js +642 -0
- package/dist/sync/workspaceSyncState.d.ts +12 -0
- package/dist/sync/workspaceSyncState.js +12 -0
- package/dist/sync/workspaceSyncSurface.d.ts +33 -0
- package/dist/sync/workspaceSyncSurface.js +74 -0
- package/dist/types.d.ts +143 -18
- package/dist/types.js +9 -24
- package/dist/ui/assets/AgentsModule-Bdq3T1Ts.js +1 -0
- package/dist/ui/assets/AnnotatedAttachmentWorkspace-BaS2VwIr.css +1 -0
- package/dist/ui/assets/AnnotatedAttachmentWorkspace-jKUVo-PJ.js +3 -0
- package/dist/ui/assets/DocumentWorkspace-C_8T8oz-.css +1 -0
- package/dist/ui/assets/DocumentWorkspace-DuQa-uIC.js +250 -0
- package/dist/ui/assets/InitiativesModule-C8Pi2VTk.js +1 -0
- package/dist/ui/assets/PlansPage-B6BDECSi.js +1 -0
- package/dist/ui/assets/PlansPage-BlVC_lRq.css +1 -0
- package/dist/ui/assets/TaskSettings-BwB9NtmJ.css +1 -0
- package/dist/ui/assets/TaskSettings-DUJgRTPU.js +8 -0
- package/dist/ui/assets/WorkflowsModule-b6TLuHwJ.js +5 -0
- package/dist/ui/assets/index-BiiF1cLQ.css +1 -0
- package/dist/ui/assets/index-xBWLPOEb.js +6 -0
- package/dist/ui/assets/vendor-dnd-DRzYolkg.js +5 -0
- package/dist/ui/assets/{vendor-icons-ZFG3SGwo.js → vendor-icons-QZyhEwgT.js} +1 -1
- package/dist/ui/assets/{vendor-markdown-CKYkQHfj.js → vendor-markdown-BUxTU7dS.js} +1 -1
- package/dist/ui/assets/vendor-react-CKJs5o3c.js +61 -0
- package/dist/ui/assets/vendor-router-BbWMxlnO.js +3 -0
- package/dist/ui/branding/logos/logo.png +0 -0
- package/dist/ui/branding/logos/logo_dark.svg +27 -0
- package/dist/ui/branding/logos/logo_favicon.svg +35 -0
- package/dist/ui/branding/logos/logo_light.svg +27 -0
- package/dist/ui/favicon/apple-touch-icon.png +0 -0
- package/dist/ui/favicon/archive/phoenix/apple-touch-icon.png +0 -0
- package/dist/ui/favicon/archive/phoenix/favicon.ico +0 -0
- package/dist/ui/favicon/archive/phoenix/site.webmanifest +1 -0
- package/dist/ui/favicon/favicon-96x96.png +0 -0
- package/dist/ui/favicon/favicon.ico +0 -0
- package/dist/ui/favicon/favicon.svg +17 -0
- package/dist/ui/favicon/site.webmanifest +21 -1
- package/dist/ui/favicon/web-app-manifest-192x192.png +0 -0
- package/dist/ui/favicon/web-app-manifest-512x512.png +0 -0
- package/dist/ui/index.html +10 -7
- package/dist/ui/product/screen_01.png +0 -0
- package/dist/ui/product/screen_02.png +0 -0
- package/dist/ui/product/screen_03.png +0 -0
- package/dist/utils/annotatedAttachments.d.ts +20 -0
- package/dist/utils/annotatedAttachments.js +74 -0
- package/dist/utils/annotatedAttachments.test.d.ts +1 -0
- package/dist/utils/annotatedAttachments.test.js +108 -0
- package/dist/utils/assignees.d.ts +26 -0
- package/dist/utils/assignees.js +132 -0
- package/dist/utils/canonicalAssetKind.d.ts +16 -0
- package/dist/utils/canonicalAssetKind.js +39 -0
- package/dist/utils/canonicalAssetKind.test.d.ts +1 -0
- package/dist/utils/canonicalAssetKind.test.js +24 -0
- package/dist/utils/coalescedRefresh.d.ts +5 -0
- package/dist/utils/coalescedRefresh.js +16 -0
- package/dist/utils/coalescedRefresh.test.d.ts +1 -0
- package/dist/utils/coalescedRefresh.test.js +30 -0
- package/dist/utils/constants.d.ts +16 -3
- package/dist/utils/constants.icons.test.js +2 -1
- package/dist/utils/constants.js +70 -13
- package/dist/utils/contextAssetEvents.d.ts +7 -0
- package/dist/utils/contextAssetEvents.js +6 -0
- package/dist/utils/contextFiles.d.ts +14 -3
- package/dist/utils/contextFiles.js +40 -8
- package/dist/utils/documentManagerApi.d.ts +6 -0
- package/dist/utils/documentManagerApi.js +19 -0
- package/dist/utils/documentNames.d.ts +24 -0
- package/dist/utils/documentNames.js +91 -0
- package/dist/utils/documentReferences.d.ts +9 -0
- package/dist/utils/documentReferences.js +11 -0
- package/dist/utils/entityReferences.d.ts +9 -0
- package/dist/utils/entityReferences.js +32 -0
- package/dist/utils/imageReferences.d.ts +9 -0
- package/dist/utils/imageReferences.js +11 -0
- package/dist/utils/planParser.d.ts +2 -2
- package/dist/utils/planParser.js +11 -11
- package/dist/utils/planParser.test.d.ts +1 -0
- package/dist/{__tests__ → utils}/planParser.test.js +22 -22
- package/dist/utils/planningReferences.d.ts +17 -0
- package/dist/utils/planningReferences.js +30 -0
- package/dist/utils/planningReferences.test.d.ts +1 -0
- package/dist/utils/planningReferences.test.js +17 -0
- package/dist/utils/taskActivity.d.ts +9 -0
- package/dist/utils/taskActivity.js +147 -0
- package/dist/utils/taskActivity.test.d.ts +1 -0
- package/dist/utils/taskActivity.test.js +34 -0
- package/dist/utils/taskDraftDefaults.d.ts +21 -0
- package/dist/utils/taskDraftDefaults.js +40 -0
- package/dist/utils/taskDraftDefaults.test.d.ts +1 -0
- package/dist/utils/taskDraftDefaults.test.js +34 -0
- package/dist/utils/taskNormalization.d.ts +25 -0
- package/dist/utils/taskNormalization.js +161 -0
- package/dist/utils/taskNormalization.test.d.ts +1 -0
- package/dist/utils/taskNormalization.test.js +158 -0
- package/dist/utils/taskReferences.d.ts +5 -0
- package/dist/utils/taskReferences.js +11 -0
- package/dist/utils/taskforceApiClient.d.ts +2 -0
- package/dist/utils/taskforceApiClient.js +101 -3
- package/dist/utils/taskforceApiClient.test.d.ts +1 -0
- package/dist/utils/taskforceApiClient.test.js +44 -0
- package/dist/utils/taxonomyFilterOptions.d.ts +2 -0
- package/dist/utils/taxonomyFilterOptions.js +17 -0
- package/dist/utils/taxonomyFormDefaults.d.ts +3 -0
- package/dist/utils/taxonomyFormDefaults.js +28 -0
- package/dist/utils/taxonomyFormDefaults.test.d.ts +1 -0
- package/dist/utils/taxonomyFormDefaults.test.js +63 -0
- package/dist/utils/taxonomyLifecycle.d.ts +3 -0
- package/dist/utils/taxonomyLifecycle.js +17 -0
- package/dist/utils/taxonomySorting.d.ts +7 -0
- package/dist/utils/taxonomySorting.js +74 -0
- package/dist/utils/theme.d.ts +15 -0
- package/dist/utils/theme.js +23 -0
- package/dist/utils/uiNotice.d.ts +7 -0
- package/dist/utils/uiNotice.js +6 -0
- package/dist/utils/uiNotice.test.d.ts +1 -0
- package/dist/utils/uiNotice.test.js +18 -0
- package/dist/utils/workspaceIdentity.d.ts +14 -0
- package/dist/utils/workspaceIdentity.js +21 -0
- package/dist/utils/workspaceIdentity.test.js +30 -1
- package/dist/utils/workspaceSyncPresentation.d.ts +20 -0
- package/dist/utils/workspaceSyncPresentation.js +21 -0
- package/dist/utils/workspaceSyncPresentation.test.d.ts +1 -0
- package/dist/utils/workspaceSyncPresentation.test.js +36 -0
- package/package.json +30 -23
- package/scripts/bootstrap-playwright-auth.mjs +155 -0
- package/scripts/check-compat-boundaries.mjs +41 -0
- package/scripts/check-env.ts +9 -2
- package/scripts/debug-login.mjs +32 -0
- package/scripts/deploy-prod.sh +41 -0
- package/scripts/deploy-staging.sh +23 -0
- package/scripts/migrate-planning-model.ts +233 -0
- package/scripts/migrate-task-data-assets.mjs +408 -0
- package/scripts/playwright-auth.sh +11 -0
- package/scripts/run-dev-proxy.sh +2 -0
- package/scripts/update-homebrew-formula.sh +2 -2
- package/scripts/with-esbuild.sh +11 -0
- package/src/resources/templates/WORKFLOW_V2_POLICY.md +1 -1
- package/src/resources/templates/workflow-sources/workflowDocs.mjs +62 -52
- package/src/resources/templates/workflows/collaborate.yaml +11 -5
- package/src/resources/templates/workflows/do.yaml +8 -2
- package/src/resources/templates/workflows/evaluate.yaml +13 -7
- package/src/resources/templates/workflows/execute.yaml +40 -23
- package/src/resources/templates/workflows/plan.yaml +15 -8
- package/src/resources/templates/workflows/review.yaml +14 -8
- package/dist/TaskforceScreenshot.d.ts +0 -11
- package/dist/TaskforceScreenshot.js +0 -113
- package/dist/compat/priorityCompat.d.ts +0 -2
- package/dist/compat/priorityCompat.js +0 -24
- package/dist/components/features/settings/TaxonomyManager 2.d.ts +0 -52
- package/dist/components/features/settings/TaxonomyManager 2.js +0 -75
- package/dist/components/task/TaskKanban 2.d.ts +0 -76
- package/dist/components/task/TaskKanban 2.js +0 -1004
- package/dist/components/task/TaskScreenshotSection.d.ts +0 -15
- package/dist/components/task/TaskScreenshotSection.js +0 -22
- package/dist/components/views/StandaloneLayout 2.d.ts +0 -8
- package/dist/components/views/StandaloneLayout 2.js +0 -1660
- package/dist/core/InitiativeTemplates.test.js +0 -50
- package/dist/core/ParentLifecycle.test.js +0 -98
- package/dist/migrations/clientMigrations.d.ts +0 -9
- package/dist/migrations/clientMigrations.js +0 -74
- package/dist/migrations/flags.d.ts +0 -6
- package/dist/migrations/flags.js +0 -8
- package/dist/migrations/taskMigrations.d.ts +0 -71
- package/dist/migrations/taskMigrations.js +0 -236
- package/dist/migrations/taskMigrations.test.js +0 -34
- package/dist/server/routes.billing.js +0 -991
- package/dist/server/routes.billing.test.js +0 -387
- package/dist/server/routes.sync.integration.test.js +0 -470
- package/dist/server/routes.sync.js +0 -1141
- package/dist/soak/syncSoakHarness.d.ts +0 -6
- package/dist/soak/syncSoakHarness.js +0 -10
- package/dist/ui/assets/index-0W5vyCpn.css +0 -1
- package/dist/ui/assets/index-MCZuNNfn.js +0 -23
- package/dist/ui/assets/logo_white_01-0Vx-iIIv.png +0 -0
- package/dist/ui/assets/vendor-dnd-BI1K77C1.js +0 -5
- package/dist/ui/assets/vendor-react-DdIDsh7f.js +0 -9
- package/dist/ui/assets/vendor-router-BtiNU7Dl.js +0 -3
- package/dist/utils/taskHierarchy.d.ts +0 -4
- package/dist/utils/taskHierarchy.js +0 -69
- package/dist/utils/taskHierarchy.test.js +0 -38
- package/dist/utils/taskParenting.d.ts +0 -3
- package/dist/utils/taskParenting.js +0 -24
- package/dist/utils/taskParenting.test.js +0 -21
- package/dist/utils/taskRelations.d.ts +0 -6
- package/dist/utils/taskRelations.js +0 -24
- package/dist/utils/taskRelations.test.js +0 -34
- package/scripts/check-compat-boundaries.js +0 -48
- /package/dist/{__tests__/planParser.test.d.ts → TaskforceCore.filter-persistence.test.d.ts} +0 -0
- /package/dist/{__tests__/releaseVersion.test.d.ts → TaskforceCore.routing.test.d.ts} +0 -0
- /package/dist/{__tests__/structuredCommentValidation.test.d.ts → annotatedAttachments/AnnotatedAttachmentSessionStore.test.d.ts} +0 -0
- /package/dist/{__tests__/structuredDocValidation.test.d.ts → annotatedAttachments/payload.test.d.ts} +0 -0
- /package/dist/{__tests__/templateEngine.test.d.ts → annotatedAttachments/types.js} +0 -0
- /package/dist/{__tests__/templates.test.d.ts → compat/workspaceSyncCompat.test.d.ts} +0 -0
- /package/dist/{__tests__/workflowDocumentFixtures.test.d.ts → components/features/AgentsModule.test.d.ts} +0 -0
- /package/dist/{__tests__/workflowExportMatrix.test.d.ts → components/features/AnnotatedAttachmentWorkspace.test.d.ts} +0 -0
- /package/dist/{__tests__/workflowExportSnapshots.test.d.ts → components/features/DocumentWorkspace.test.d.ts} +0 -0
- /package/dist/{__tests__/workflowGeneration.test.d.ts → components/features/settings/TaxonomyLibraryManager.test.d.ts} +0 -0
- /package/dist/{__tests__/workflowV2Policy.test.d.ts → components/task/TaskActionHeader.test.d.ts} +0 -0
- /package/dist/{core/InitiativeTemplates.test.d.ts → components/task/TaskKanban.planning-drop.test.d.ts} +0 -0
- /package/dist/{core/ParentLifecycle.test.d.ts → components/task/TaskStatusActions.test.d.ts} +0 -0
- /package/dist/{migrations/taskMigrations.test.d.ts → components/ui/TopNoticeLayer.test.d.ts} +0 -0
- /package/dist/{server/routes.billing.test.d.ts → components/views/AppShellHeader.test.d.ts} +0 -0
- /package/dist/{server/routes.sync.integration.test.d.ts → components/views/PlanComparisonPage.test.d.ts} +0 -0
- /package/dist/{utils/taskHierarchy.test.d.ts → components/views/chrome/WorkspaceChromeSections.test.d.ts} +0 -0
- /package/dist/{utils/taskParenting.test.d.ts → components/views/chrome/workspaceChrome.test.d.ts} +0 -0
- /package/dist/{utils/taskRelations.test.d.ts → components/views/panels/DocumentFilterToolbar.test.d.ts} +0 -0
- /package/dist/public/{android-chrome-192x192.png → archive/phoenix/android-chrome-192x192.png} +0 -0
- /package/dist/public/{android-chrome-512x512.png → archive/phoenix/android-chrome-512x512.png} +0 -0
- /package/dist/public/{favicon-16x16.png → archive/phoenix/favicon-16x16.png} +0 -0
- /package/dist/public/{favicon-32x32.png → archive/phoenix/favicon-32x32.png} +0 -0
- /package/dist/public/{favicon.png → archive/phoenix/favicon.png} +0 -0
- /package/dist/{__tests__ → services}/workflowExportSnapshots.test.js +0 -0
- /package/dist/{__tests__ → services}/workflowGeneration.test.js +0 -0
- /package/dist/ui/favicon/{android-chrome-192x192.png → archive/phoenix/android-chrome-192x192.png} +0 -0
- /package/dist/ui/favicon/{android-chrome-512x512.png → archive/phoenix/android-chrome-512x512.png} +0 -0
- /package/dist/ui/favicon/{favicon-16x16.png → archive/phoenix/favicon-16x16.png} +0 -0
- /package/dist/ui/favicon/{favicon-32x32.png → archive/phoenix/favicon-32x32.png} +0 -0
- /package/dist/ui/favicon/{favicon.png → archive/phoenix/favicon.png} +0 -0
|
@@ -6,16 +6,50 @@ import { TaskforceCore } from './Taskforce';
|
|
|
6
6
|
function makeProjectRoot() {
|
|
7
7
|
return fs.mkdtempSync(path.join(os.tmpdir(), 'taskforce-system-admin-'));
|
|
8
8
|
}
|
|
9
|
-
function
|
|
10
|
-
|
|
9
|
+
function seedPlans(core) {
|
|
10
|
+
core.upsertPlanCatalog({ planId: 'starter', displayName: 'Starter', status: 'active' });
|
|
11
|
+
core.upsertPlanCatalog({ planId: 'collab', displayName: 'Collab', status: 'active' });
|
|
12
|
+
core.updatePlanVersion({
|
|
13
|
+
planId: 'collab',
|
|
14
|
+
versionNumber: 1,
|
|
15
|
+
seatLimit: 5
|
|
16
|
+
});
|
|
17
|
+
core.updatePlanVersionFeatures({
|
|
18
|
+
planVersionId: 'starter-v1',
|
|
19
|
+
features: [
|
|
20
|
+
{ featureKey: 'workspace.switching', access: 'enabled' }
|
|
21
|
+
]
|
|
22
|
+
});
|
|
23
|
+
core.updatePlanVersionFeatures({
|
|
24
|
+
planVersionId: 'collab-v1',
|
|
25
|
+
features: [
|
|
26
|
+
{ featureKey: 'collaboration.invites', access: 'enabled' },
|
|
27
|
+
{ featureKey: 'collaboration.team_management', access: 'enabled' },
|
|
28
|
+
{ featureKey: 'context.uploads', access: 'enabled' },
|
|
29
|
+
{ featureKey: 'workspace.switching', access: 'enabled' }
|
|
30
|
+
]
|
|
31
|
+
});
|
|
32
|
+
core.updateGlobalSettings({
|
|
33
|
+
auth: {
|
|
34
|
+
signupMonetizationStrategy: 'auto_assign_default',
|
|
35
|
+
defaultSignupPlanVersionId: 'starter-v1'
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
function openCore(projectRoot, options = {}) {
|
|
40
|
+
const core = new TaskforceCore({
|
|
11
41
|
projectRoot,
|
|
12
42
|
storagePath: path.join(projectRoot, '.taskforce')
|
|
13
43
|
});
|
|
44
|
+
if (options.seedDefaultPlans === true) {
|
|
45
|
+
seedPlans(core);
|
|
46
|
+
}
|
|
47
|
+
return core;
|
|
14
48
|
}
|
|
15
49
|
describe('TaskforceCore system admin model', () => {
|
|
16
50
|
it('creates billing row for registration without workspace', () => {
|
|
17
51
|
const projectRoot = makeProjectRoot();
|
|
18
|
-
const core = openCore(projectRoot);
|
|
52
|
+
const core = openCore(projectRoot, { seedDefaultPlans: true });
|
|
19
53
|
try {
|
|
20
54
|
const created = core.registerPasswordUser({
|
|
21
55
|
email: 'billing-noworkspace@example.com',
|
|
@@ -29,8 +63,8 @@ describe('TaskforceCore system admin model', () => {
|
|
|
29
63
|
LIMIT 1
|
|
30
64
|
`).get('default', created.userId);
|
|
31
65
|
expect(row?.user_id).toBe(created.userId);
|
|
32
|
-
expect(row?.tier).toBe('
|
|
33
|
-
expect(row?.entitlement_state).toBe('
|
|
66
|
+
expect(row?.tier).toBe('starter');
|
|
67
|
+
expect(row?.entitlement_state).toBe('active');
|
|
34
68
|
}
|
|
35
69
|
finally {
|
|
36
70
|
core.close();
|
|
@@ -39,7 +73,7 @@ describe('TaskforceCore system admin model', () => {
|
|
|
39
73
|
});
|
|
40
74
|
it('creates billing row for registration with workspace', () => {
|
|
41
75
|
const projectRoot = makeProjectRoot();
|
|
42
|
-
const core = openCore(projectRoot);
|
|
76
|
+
const core = openCore(projectRoot, { seedDefaultPlans: true });
|
|
43
77
|
try {
|
|
44
78
|
core.createWorkspace({ workspaceId: 'workspace-1', name: 'Workspace 1' });
|
|
45
79
|
const created = core.registerPasswordUser({
|
|
@@ -56,17 +90,459 @@ describe('TaskforceCore system admin model', () => {
|
|
|
56
90
|
LIMIT 1
|
|
57
91
|
`).get('default', created.userId);
|
|
58
92
|
expect(row?.user_id).toBe(created.userId);
|
|
59
|
-
expect(row?.tier).toBe('
|
|
60
|
-
expect(row?.entitlement_state).toBe('
|
|
93
|
+
expect(row?.tier).toBe('starter');
|
|
94
|
+
expect(row?.entitlement_state).toBe('active');
|
|
95
|
+
}
|
|
96
|
+
finally {
|
|
97
|
+
core.close();
|
|
98
|
+
fs.rmSync(projectRoot, { recursive: true, force: true });
|
|
99
|
+
}
|
|
100
|
+
});
|
|
101
|
+
it('uses configured signup default plan version for registration when auto-assign config is valid', () => {
|
|
102
|
+
const projectRoot = makeProjectRoot();
|
|
103
|
+
const core = openCore(projectRoot, { seedDefaultPlans: true });
|
|
104
|
+
try {
|
|
105
|
+
core.createPlanVersion({
|
|
106
|
+
planId: 'collab',
|
|
107
|
+
versionNumber: 2,
|
|
108
|
+
isDefault: true,
|
|
109
|
+
seatLimit: 10
|
|
110
|
+
});
|
|
111
|
+
core.updatePlanVersionFeatures({
|
|
112
|
+
planVersionId: 'collab-v2',
|
|
113
|
+
features: [
|
|
114
|
+
{ featureKey: 'collaboration.invites', access: 'enabled' },
|
|
115
|
+
{ featureKey: 'collaboration.team_management', access: 'enabled' },
|
|
116
|
+
{ featureKey: 'context.uploads', access: 'enabled' },
|
|
117
|
+
{ featureKey: 'workspace.switching', access: 'enabled' }
|
|
118
|
+
]
|
|
119
|
+
});
|
|
120
|
+
core.createPlanVersion({
|
|
121
|
+
planId: 'starter',
|
|
122
|
+
versionNumber: 2,
|
|
123
|
+
isDefault: false,
|
|
124
|
+
seatLimit: null
|
|
125
|
+
});
|
|
126
|
+
core.updateGlobalSettings({
|
|
127
|
+
auth: {
|
|
128
|
+
signupMonetizationStrategy: 'auto_assign_default',
|
|
129
|
+
defaultSignupPlanVersionId: 'collab-v2'
|
|
130
|
+
}
|
|
131
|
+
});
|
|
132
|
+
const created = core.registerPasswordUser({
|
|
133
|
+
email: 'configured-signup@example.com',
|
|
134
|
+
password: 'password123'
|
|
135
|
+
});
|
|
136
|
+
const entitlement = core.getAccountEntitlement(created.userId);
|
|
137
|
+
const db = core.db;
|
|
138
|
+
const billing = db.prepare(`
|
|
139
|
+
SELECT tier, entitlement_state
|
|
140
|
+
FROM user_billing
|
|
141
|
+
WHERE tenant_id = ? AND user_id = ?
|
|
142
|
+
LIMIT 1
|
|
143
|
+
`).get(core.getTenantId(), created.userId);
|
|
144
|
+
expect(entitlement.planVersionId).toBe('collab-v2');
|
|
145
|
+
expect(entitlement.planId).toBe('collab');
|
|
146
|
+
expect(billing?.tier).toBe('collab');
|
|
147
|
+
expect(billing?.entitlement_state).toBe('active');
|
|
148
|
+
}
|
|
149
|
+
finally {
|
|
150
|
+
core.close();
|
|
151
|
+
fs.rmSync(projectRoot, { recursive: true, force: true });
|
|
152
|
+
}
|
|
153
|
+
});
|
|
154
|
+
it('fails registration when auto-assign signup config is stale or invalid', () => {
|
|
155
|
+
const projectRoot = makeProjectRoot();
|
|
156
|
+
const core = openCore(projectRoot, { seedDefaultPlans: true });
|
|
157
|
+
try {
|
|
158
|
+
core.updateGlobalSettings({
|
|
159
|
+
auth: {
|
|
160
|
+
signupMonetizationStrategy: 'auto_assign_default',
|
|
161
|
+
defaultSignupPlanVersionId: 'missing-v9'
|
|
162
|
+
}
|
|
163
|
+
});
|
|
164
|
+
expect(() => core.registerPasswordUser({
|
|
165
|
+
email: 'fallback-signup@example.com',
|
|
166
|
+
password: 'password123'
|
|
167
|
+
})).toThrowError(/was not found/i);
|
|
168
|
+
}
|
|
169
|
+
finally {
|
|
170
|
+
core.close();
|
|
171
|
+
fs.rmSync(projectRoot, { recursive: true, force: true });
|
|
172
|
+
}
|
|
173
|
+
});
|
|
174
|
+
it('registers without an entitlement when plan selection is required', () => {
|
|
175
|
+
const projectRoot = makeProjectRoot();
|
|
176
|
+
const core = openCore(projectRoot, { seedDefaultPlans: true });
|
|
177
|
+
try {
|
|
178
|
+
core.updateGlobalSettings({
|
|
179
|
+
auth: {
|
|
180
|
+
signupMonetizationStrategy: 'plan_selection_required',
|
|
181
|
+
defaultSignupPlanVersionId: null
|
|
182
|
+
}
|
|
183
|
+
});
|
|
184
|
+
const created = core.registerPasswordUser({
|
|
185
|
+
email: 'pending-plan@example.com',
|
|
186
|
+
password: 'password123'
|
|
187
|
+
});
|
|
188
|
+
expect(created.planSelectionRequired).toBe(true);
|
|
189
|
+
expect(core.hasAccountEntitlement(created.userId)).toBe(false);
|
|
190
|
+
const db = core.db;
|
|
191
|
+
const billing = db.prepare(`
|
|
192
|
+
SELECT entitlement_state, tier
|
|
193
|
+
FROM user_billing
|
|
194
|
+
WHERE tenant_id = ? AND user_id = ?
|
|
195
|
+
LIMIT 1
|
|
196
|
+
`).get('default', created.userId);
|
|
197
|
+
expect(billing?.entitlement_state).toBe('pending_plan_selection');
|
|
198
|
+
expect(String(billing?.tier || '')).toBe('');
|
|
199
|
+
expect(core.getAccountAccessStatus(created.userId)).toMatchObject({
|
|
200
|
+
gate: 'plan_selection_required',
|
|
201
|
+
hasEntitlement: false,
|
|
202
|
+
canAccessApp: false,
|
|
203
|
+
canAccessPlans: true
|
|
204
|
+
});
|
|
205
|
+
}
|
|
206
|
+
finally {
|
|
207
|
+
core.close();
|
|
208
|
+
fs.rmSync(projectRoot, { recursive: true, force: true });
|
|
209
|
+
}
|
|
210
|
+
});
|
|
211
|
+
it('removes legacy documents.workspace_access plan feature rows during startup normalization', () => {
|
|
212
|
+
const projectRoot = makeProjectRoot();
|
|
213
|
+
let core = openCore(projectRoot, { seedDefaultPlans: true });
|
|
214
|
+
try {
|
|
215
|
+
const db = core.db;
|
|
216
|
+
const now = new Date().toISOString();
|
|
217
|
+
db.prepare(`
|
|
218
|
+
INSERT INTO plan_feature_matrix (tenant_id, plan_version_id, feature_key, access, config_json, created_at, updated_at)
|
|
219
|
+
VALUES (?, ?, ?, ?, ?, ?, ?)
|
|
220
|
+
ON CONFLICT (tenant_id, plan_version_id, feature_key) DO UPDATE SET
|
|
221
|
+
access = excluded.access,
|
|
222
|
+
config_json = excluded.config_json,
|
|
223
|
+
updated_at = excluded.updated_at
|
|
224
|
+
`).run('default', 'collab-v1', 'documents.workspace_access', 'enabled', '{}', now, now);
|
|
225
|
+
}
|
|
226
|
+
finally {
|
|
227
|
+
core.close();
|
|
228
|
+
}
|
|
229
|
+
core = openCore(projectRoot);
|
|
230
|
+
try {
|
|
231
|
+
const db = core.db;
|
|
232
|
+
const row = db.prepare(`
|
|
233
|
+
SELECT feature_key
|
|
234
|
+
FROM plan_feature_matrix
|
|
235
|
+
WHERE tenant_id = ? AND plan_version_id = ? AND feature_key = ?
|
|
236
|
+
LIMIT 1
|
|
237
|
+
`).get('default', 'collab-v1', 'documents.workspace_access');
|
|
238
|
+
expect(row).toBeUndefined();
|
|
239
|
+
const snapshot = core.listPlanVersions('collab').find((version) => version.planVersionId === 'collab-v1');
|
|
240
|
+
expect(snapshot).toBeDefined();
|
|
241
|
+
expect(snapshot.features['documents.workspace_access']).toBeUndefined();
|
|
242
|
+
}
|
|
243
|
+
finally {
|
|
244
|
+
core.close();
|
|
245
|
+
fs.rmSync(projectRoot, { recursive: true, force: true });
|
|
246
|
+
}
|
|
247
|
+
});
|
|
248
|
+
it('assigns the explicitly selected signup plan version instead of the default signup plan', () => {
|
|
249
|
+
const projectRoot = makeProjectRoot();
|
|
250
|
+
const core = openCore(projectRoot, { seedDefaultPlans: true });
|
|
251
|
+
try {
|
|
252
|
+
core.upsertPlanCatalog({ planId: 'free', displayName: 'Free', status: 'active' });
|
|
253
|
+
core.updatePlanVersion({
|
|
254
|
+
planId: 'free',
|
|
255
|
+
versionNumber: 1,
|
|
256
|
+
seatLimit: 1
|
|
257
|
+
});
|
|
258
|
+
core.upsertPlanCatalog({ planId: 'starter', displayName: 'Starter', status: 'archived' });
|
|
259
|
+
core.updateGlobalSettings({
|
|
260
|
+
auth: {
|
|
261
|
+
signupMonetizationStrategy: 'auto_assign_default',
|
|
262
|
+
defaultSignupPlanVersionId: 'starter-v1'
|
|
263
|
+
}
|
|
264
|
+
});
|
|
265
|
+
const created = core.registerPasswordUser({
|
|
266
|
+
email: 'selected-plan@example.com',
|
|
267
|
+
password: 'password123',
|
|
268
|
+
planVersionId: 'free-v1'
|
|
269
|
+
});
|
|
270
|
+
expect(created.planSelectionRequired).toBe(false);
|
|
271
|
+
expect(core.getAccountEntitlement(created.userId)).toMatchObject({
|
|
272
|
+
planVersionId: 'free-v1',
|
|
273
|
+
planId: 'free',
|
|
274
|
+
state: 'active'
|
|
275
|
+
});
|
|
276
|
+
}
|
|
277
|
+
finally {
|
|
278
|
+
core.close();
|
|
279
|
+
fs.rmSync(projectRoot, { recursive: true, force: true });
|
|
280
|
+
}
|
|
281
|
+
});
|
|
282
|
+
it('treats accounts without an entitlement or pending-selection marker as plan selection required', () => {
|
|
283
|
+
const projectRoot = makeProjectRoot();
|
|
284
|
+
const core = openCore(projectRoot, { seedDefaultPlans: true });
|
|
285
|
+
try {
|
|
286
|
+
core.updateGlobalSettings({
|
|
287
|
+
auth: {
|
|
288
|
+
signupMonetizationStrategy: 'plan_selection_required',
|
|
289
|
+
defaultSignupPlanVersionId: null
|
|
290
|
+
}
|
|
291
|
+
});
|
|
292
|
+
const now = new Date().toISOString();
|
|
293
|
+
const db = core.db;
|
|
294
|
+
db.prepare(`
|
|
295
|
+
INSERT INTO users (id, tenant_id, email, display_name, auth_provider, external_auth_id, password_hash, system_role, beta_access, is_disabled, created_at, updated_at)
|
|
296
|
+
VALUES (?, ?, ?, ?, ?, ?, ?, 'user', 1, 0, ?, ?)
|
|
297
|
+
`).run('user-missing-entitlement', 'default', 'broken@example.com', 'Broken', 'password', 'broken@example.com', 'hash', now, now);
|
|
298
|
+
expect(core.getAccountAccessStatus('user-missing-entitlement')).toMatchObject({
|
|
299
|
+
gate: 'plan_selection_required',
|
|
300
|
+
hasEntitlement: false,
|
|
301
|
+
canAccessApp: false,
|
|
302
|
+
planSelectionRequired: true
|
|
303
|
+
});
|
|
304
|
+
}
|
|
305
|
+
finally {
|
|
306
|
+
core.close();
|
|
307
|
+
fs.rmSync(projectRoot, { recursive: true, force: true });
|
|
308
|
+
}
|
|
309
|
+
});
|
|
310
|
+
it('repairs missing default version during startup for existing plans', () => {
|
|
311
|
+
const projectRoot = makeProjectRoot();
|
|
312
|
+
const initial = openCore(projectRoot, { seedDefaultPlans: true });
|
|
313
|
+
try {
|
|
314
|
+
const db = initial.db;
|
|
315
|
+
db.prepare(`
|
|
316
|
+
UPDATE plan_versions
|
|
317
|
+
SET is_default = 0
|
|
318
|
+
WHERE tenant_id = ? AND plan_id = ?
|
|
319
|
+
`).run('default', 'starter');
|
|
320
|
+
}
|
|
321
|
+
finally {
|
|
322
|
+
initial.close();
|
|
323
|
+
}
|
|
324
|
+
const reopened = openCore(projectRoot, { seedDefaultPlans: false });
|
|
325
|
+
try {
|
|
326
|
+
const db = reopened.db;
|
|
327
|
+
const row = db.prepare(`
|
|
328
|
+
SELECT plan_version_id, is_default
|
|
329
|
+
FROM plan_versions
|
|
330
|
+
WHERE tenant_id = ? AND plan_id = ? AND plan_version_id = ?
|
|
331
|
+
LIMIT 1
|
|
332
|
+
`).get('default', 'starter', 'starter-v1');
|
|
333
|
+
expect(row?.plan_version_id).toBe('starter-v1');
|
|
334
|
+
expect(row?.is_default).toBe(1);
|
|
335
|
+
expect(reopened.getRequiredDefaultPlanVersionId('starter')).toBe('starter-v1');
|
|
336
|
+
}
|
|
337
|
+
finally {
|
|
338
|
+
reopened.close();
|
|
339
|
+
fs.rmSync(projectRoot, { recursive: true, force: true });
|
|
340
|
+
}
|
|
341
|
+
});
|
|
342
|
+
it('persists signup monetization defaults during startup for existing installs', () => {
|
|
343
|
+
const projectRoot = makeProjectRoot();
|
|
344
|
+
const initial = openCore(projectRoot, { seedDefaultPlans: true });
|
|
345
|
+
try {
|
|
346
|
+
initial.updateGlobalSettings({
|
|
347
|
+
auth: {
|
|
348
|
+
allowSelfRegistration: true
|
|
349
|
+
}
|
|
350
|
+
});
|
|
351
|
+
}
|
|
352
|
+
finally {
|
|
353
|
+
initial.close();
|
|
354
|
+
}
|
|
355
|
+
const reopened = openCore(projectRoot, { seedDefaultPlans: false });
|
|
356
|
+
try {
|
|
357
|
+
expect(reopened.getSignupMonetizationSettings()).toEqual({
|
|
358
|
+
strategy: 'auto_assign_default',
|
|
359
|
+
defaultSignupPlanVersionId: 'starter-v1'
|
|
360
|
+
});
|
|
361
|
+
expect(reopened.getGlobalSettings().auth).toMatchObject({
|
|
362
|
+
signupMonetizationStrategy: 'auto_assign_default',
|
|
363
|
+
defaultSignupPlanVersionId: 'starter-v1'
|
|
364
|
+
});
|
|
365
|
+
}
|
|
366
|
+
finally {
|
|
367
|
+
reopened.close();
|
|
368
|
+
fs.rmSync(projectRoot, { recursive: true, force: true });
|
|
369
|
+
}
|
|
370
|
+
});
|
|
371
|
+
it('repairs signup monetization defaults on the same startup pass that repairs missing plan defaults', () => {
|
|
372
|
+
const projectRoot = makeProjectRoot();
|
|
373
|
+
const initial = openCore(projectRoot, { seedDefaultPlans: true });
|
|
374
|
+
try {
|
|
375
|
+
initial.updateGlobalSettings({
|
|
376
|
+
auth: {
|
|
377
|
+
allowSelfRegistration: true
|
|
378
|
+
}
|
|
379
|
+
});
|
|
380
|
+
const db = initial.db;
|
|
381
|
+
db.prepare(`
|
|
382
|
+
UPDATE plan_versions
|
|
383
|
+
SET is_default = 0
|
|
384
|
+
WHERE tenant_id = ? AND plan_id = ?
|
|
385
|
+
`).run('default', 'starter');
|
|
386
|
+
}
|
|
387
|
+
finally {
|
|
388
|
+
initial.close();
|
|
389
|
+
}
|
|
390
|
+
const reopened = openCore(projectRoot, { seedDefaultPlans: false });
|
|
391
|
+
try {
|
|
392
|
+
expect(reopened.getSignupMonetizationSettings()).toEqual({
|
|
393
|
+
strategy: 'auto_assign_default',
|
|
394
|
+
defaultSignupPlanVersionId: 'starter-v1'
|
|
395
|
+
});
|
|
396
|
+
}
|
|
397
|
+
finally {
|
|
398
|
+
reopened.close();
|
|
399
|
+
fs.rmSync(projectRoot, { recursive: true, force: true });
|
|
400
|
+
}
|
|
401
|
+
});
|
|
402
|
+
it('does not inject a default signup plan version when strategy is plan selection required', () => {
|
|
403
|
+
const projectRoot = makeProjectRoot();
|
|
404
|
+
const initial = openCore(projectRoot, { seedDefaultPlans: true });
|
|
405
|
+
try {
|
|
406
|
+
initial.updateGlobalSettings({
|
|
407
|
+
auth: {
|
|
408
|
+
signupMonetizationStrategy: 'plan_selection_required',
|
|
409
|
+
defaultSignupPlanVersionId: null
|
|
410
|
+
}
|
|
411
|
+
});
|
|
412
|
+
}
|
|
413
|
+
finally {
|
|
414
|
+
initial.close();
|
|
415
|
+
}
|
|
416
|
+
const reopened = openCore(projectRoot, { seedDefaultPlans: false });
|
|
417
|
+
try {
|
|
418
|
+
expect(reopened.getSignupMonetizationSettings()).toEqual({
|
|
419
|
+
strategy: 'plan_selection_required',
|
|
420
|
+
defaultSignupPlanVersionId: null
|
|
421
|
+
});
|
|
422
|
+
}
|
|
423
|
+
finally {
|
|
424
|
+
reopened.close();
|
|
425
|
+
fs.rmSync(projectRoot, { recursive: true, force: true });
|
|
426
|
+
}
|
|
427
|
+
});
|
|
428
|
+
it('migrates legacy seat-limit feature config to version seatLimit during startup', () => {
|
|
429
|
+
const projectRoot = makeProjectRoot();
|
|
430
|
+
const initial = openCore(projectRoot, { seedDefaultPlans: true });
|
|
431
|
+
try {
|
|
432
|
+
const db = initial.db;
|
|
433
|
+
const now = new Date().toISOString();
|
|
434
|
+
db.prepare(`
|
|
435
|
+
UPDATE plan_versions
|
|
436
|
+
SET seat_limit = NULL, updated_at = ?
|
|
437
|
+
WHERE tenant_id = ? AND plan_version_id = ?
|
|
438
|
+
`).run(now, 'default', 'collab-v1');
|
|
439
|
+
db.prepare(`
|
|
440
|
+
INSERT INTO plan_feature_matrix (tenant_id, plan_version_id, feature_key, access, config_json, created_at, updated_at)
|
|
441
|
+
VALUES (?, ?, 'collaboration.seat_limit', 'limited', ?, ?, ?)
|
|
442
|
+
ON CONFLICT (tenant_id, plan_version_id, feature_key) DO UPDATE SET
|
|
443
|
+
access = excluded.access,
|
|
444
|
+
config_json = excluded.config_json,
|
|
445
|
+
updated_at = excluded.updated_at
|
|
446
|
+
`).run('default', 'collab-v1', JSON.stringify({ seat_limit: 7 }), now, now);
|
|
447
|
+
}
|
|
448
|
+
finally {
|
|
449
|
+
initial.close();
|
|
450
|
+
}
|
|
451
|
+
const reopened = openCore(projectRoot, { seedDefaultPlans: false });
|
|
452
|
+
try {
|
|
453
|
+
const version = reopened.getPlanVersionFeatures('collab', 'collab-v1');
|
|
454
|
+
expect(version.seatLimit).toBe(7);
|
|
455
|
+
expect(version.features['collaboration.seat_limit']?.config || {}).toEqual({});
|
|
456
|
+
}
|
|
457
|
+
finally {
|
|
458
|
+
reopened.close();
|
|
459
|
+
fs.rmSync(projectRoot, { recursive: true, force: true });
|
|
460
|
+
}
|
|
461
|
+
});
|
|
462
|
+
it('normalizes legacy billing mirror rows during startup', () => {
|
|
463
|
+
const projectRoot = makeProjectRoot();
|
|
464
|
+
const initial = openCore(projectRoot, { seedDefaultPlans: true });
|
|
465
|
+
let legacyUserId = '';
|
|
466
|
+
try {
|
|
467
|
+
const created = initial.registerPasswordUser({
|
|
468
|
+
email: 'legacy-billing@example.com',
|
|
469
|
+
password: 'password123'
|
|
470
|
+
});
|
|
471
|
+
legacyUserId = created.userId;
|
|
472
|
+
const db = initial.db;
|
|
473
|
+
db.prepare(`
|
|
474
|
+
UPDATE user_billing
|
|
475
|
+
SET tier = 'free',
|
|
476
|
+
entitlement_state = 'free'
|
|
477
|
+
WHERE tenant_id = ? AND user_id = ?
|
|
478
|
+
`).run('default', legacyUserId);
|
|
479
|
+
}
|
|
480
|
+
finally {
|
|
481
|
+
initial.close();
|
|
482
|
+
}
|
|
483
|
+
const reopened = openCore(projectRoot, { seedDefaultPlans: false });
|
|
484
|
+
try {
|
|
485
|
+
const db = reopened.db;
|
|
486
|
+
const row = db.prepare(`
|
|
487
|
+
SELECT tier, entitlement_state
|
|
488
|
+
FROM user_billing
|
|
489
|
+
WHERE tenant_id = ? AND user_id = ?
|
|
490
|
+
LIMIT 1
|
|
491
|
+
`).get('default', legacyUserId);
|
|
492
|
+
expect(row?.tier).toBe('starter');
|
|
493
|
+
expect(row?.entitlement_state).toBe('active');
|
|
494
|
+
}
|
|
495
|
+
finally {
|
|
496
|
+
reopened.close();
|
|
497
|
+
fs.rmSync(projectRoot, { recursive: true, force: true });
|
|
498
|
+
}
|
|
499
|
+
});
|
|
500
|
+
it('does not seed business plans into an empty catalog on startup', () => {
|
|
501
|
+
const projectRoot = makeProjectRoot();
|
|
502
|
+
const core = openCore(projectRoot, { seedDefaultPlans: false });
|
|
503
|
+
try {
|
|
504
|
+
expect(core.listPlanCatalog()).toEqual([]);
|
|
61
505
|
}
|
|
62
506
|
finally {
|
|
63
507
|
core.close();
|
|
64
508
|
fs.rmSync(projectRoot, { recursive: true, force: true });
|
|
65
509
|
}
|
|
66
510
|
});
|
|
511
|
+
it('keeps a custom catalog untouched on startup', () => {
|
|
512
|
+
const projectRoot = makeProjectRoot();
|
|
513
|
+
const initial = openCore(projectRoot, { seedDefaultPlans: false });
|
|
514
|
+
try {
|
|
515
|
+
const db = initial.db;
|
|
516
|
+
const now = new Date().toISOString();
|
|
517
|
+
db.prepare(`DELETE FROM plan_feature_matrix WHERE tenant_id = ?`).run('default');
|
|
518
|
+
db.prepare(`DELETE FROM plan_versions WHERE tenant_id = ?`).run('default');
|
|
519
|
+
db.prepare(`DELETE FROM plan_catalog WHERE tenant_id = ?`).run('default');
|
|
520
|
+
db.prepare(`
|
|
521
|
+
INSERT INTO plan_catalog (plan_id, tenant_id, display_name, status, created_at, updated_at)
|
|
522
|
+
VALUES (?, ?, ?, 'active', ?, ?)
|
|
523
|
+
`).run('enterprise', 'default', 'Enterprise', now, now);
|
|
524
|
+
db.prepare(`
|
|
525
|
+
INSERT INTO plan_versions (plan_version_id, tenant_id, plan_id, version_number, is_default, seat_limit, metadata_json, created_at, updated_at)
|
|
526
|
+
VALUES (?, ?, ?, 1, 1, 25, '{}', ?, ?)
|
|
527
|
+
`).run('enterprise-v1', 'default', 'enterprise', now, now);
|
|
528
|
+
}
|
|
529
|
+
finally {
|
|
530
|
+
initial.close();
|
|
531
|
+
}
|
|
532
|
+
const reopened = openCore(projectRoot, { seedDefaultPlans: false });
|
|
533
|
+
try {
|
|
534
|
+
const plans = reopened.listPlanCatalog();
|
|
535
|
+
expect(plans.map((plan) => plan.planId)).toEqual(['enterprise']);
|
|
536
|
+
expect(reopened.getDefaultPlanVersionIdByMode('personal')).toBe('enterprise-v1');
|
|
537
|
+
}
|
|
538
|
+
finally {
|
|
539
|
+
reopened.close();
|
|
540
|
+
fs.rmSync(projectRoot, { recursive: true, force: true });
|
|
541
|
+
}
|
|
542
|
+
});
|
|
67
543
|
it('assigns first registered user as system_admin and later users as user', () => {
|
|
68
544
|
const projectRoot = makeProjectRoot();
|
|
69
|
-
const core = openCore(projectRoot);
|
|
545
|
+
const core = openCore(projectRoot, { seedDefaultPlans: true });
|
|
70
546
|
try {
|
|
71
547
|
const first = core.registerPasswordUser({
|
|
72
548
|
email: 'first@example.com',
|
|
@@ -87,7 +563,7 @@ describe('TaskforceCore system admin model', () => {
|
|
|
87
563
|
});
|
|
88
564
|
it('applies registration betaAccess at user level', () => {
|
|
89
565
|
const projectRoot = makeProjectRoot();
|
|
90
|
-
const core = openCore(projectRoot);
|
|
566
|
+
const core = openCore(projectRoot, { seedDefaultPlans: true });
|
|
91
567
|
try {
|
|
92
568
|
core.createWorkspace({ workspaceId: 'workspace-1', name: 'Workspace 1' });
|
|
93
569
|
core.registerPasswordUser({
|
|
@@ -112,7 +588,7 @@ describe('TaskforceCore system admin model', () => {
|
|
|
112
588
|
});
|
|
113
589
|
it('enforces last-system-admin guard on demote and disable', () => {
|
|
114
590
|
const projectRoot = makeProjectRoot();
|
|
115
|
-
const core = openCore(projectRoot);
|
|
591
|
+
const core = openCore(projectRoot, { seedDefaultPlans: true });
|
|
116
592
|
try {
|
|
117
593
|
const first = core.registerPasswordUser({
|
|
118
594
|
email: 'first@example.com',
|
|
@@ -128,7 +604,7 @@ describe('TaskforceCore system admin model', () => {
|
|
|
128
604
|
});
|
|
129
605
|
it('does not auto-promote system role from workspace role changes post-migration', () => {
|
|
130
606
|
const projectRoot = makeProjectRoot();
|
|
131
|
-
const core = openCore(projectRoot);
|
|
607
|
+
const core = openCore(projectRoot, { seedDefaultPlans: true });
|
|
132
608
|
try {
|
|
133
609
|
const first = core.registerPasswordUser({
|
|
134
610
|
email: 'first@example.com',
|
|
@@ -154,6 +630,95 @@ describe('TaskforceCore system admin model', () => {
|
|
|
154
630
|
fs.rmSync(projectRoot, { recursive: true, force: true });
|
|
155
631
|
}
|
|
156
632
|
});
|
|
633
|
+
it('lists system users without ambiguous updated_at ordering', () => {
|
|
634
|
+
const projectRoot = makeProjectRoot();
|
|
635
|
+
const core = openCore(projectRoot, { seedDefaultPlans: true });
|
|
636
|
+
try {
|
|
637
|
+
const admin = core.registerPasswordUser({
|
|
638
|
+
email: 'admin@example.com',
|
|
639
|
+
password: 'password123'
|
|
640
|
+
});
|
|
641
|
+
const member = core.registerPasswordUser({
|
|
642
|
+
email: 'member@example.com',
|
|
643
|
+
password: 'password123'
|
|
644
|
+
});
|
|
645
|
+
core.createPlanVersion({
|
|
646
|
+
planId: 'starter',
|
|
647
|
+
versionNumber: 2,
|
|
648
|
+
isDefault: true
|
|
649
|
+
});
|
|
650
|
+
core.updateAccountEntitlement({
|
|
651
|
+
accountId: member.userId,
|
|
652
|
+
planVersionId: 'starter-v2',
|
|
653
|
+
entitlementState: 'active',
|
|
654
|
+
actorUserId: admin.userId,
|
|
655
|
+
actorRole: 'system_admin'
|
|
656
|
+
});
|
|
657
|
+
const users = core.listSystemUsers();
|
|
658
|
+
expect(users.map((user) => user.email)).toContain('admin@example.com');
|
|
659
|
+
expect(users.map((user) => user.email)).toContain('member@example.com');
|
|
660
|
+
}
|
|
661
|
+
finally {
|
|
662
|
+
core.close();
|
|
663
|
+
fs.rmSync(projectRoot, { recursive: true, force: true });
|
|
664
|
+
}
|
|
665
|
+
});
|
|
666
|
+
it('creates v1 automatically when a new plan is created', () => {
|
|
667
|
+
const projectRoot = makeProjectRoot();
|
|
668
|
+
const core = openCore(projectRoot, { seedDefaultPlans: true });
|
|
669
|
+
try {
|
|
670
|
+
const plan = core.upsertPlanCatalog({
|
|
671
|
+
planId: 'enterprise',
|
|
672
|
+
displayName: 'Enterprise',
|
|
673
|
+
status: 'active'
|
|
674
|
+
});
|
|
675
|
+
expect(plan.planId).toBe('enterprise');
|
|
676
|
+
const versions = core.listPlanVersions('enterprise');
|
|
677
|
+
expect(versions).toHaveLength(1);
|
|
678
|
+
expect(versions[0]).toMatchObject({
|
|
679
|
+
planVersionId: 'enterprise-v1',
|
|
680
|
+
planId: 'enterprise',
|
|
681
|
+
versionNumber: 1,
|
|
682
|
+
isDefault: true,
|
|
683
|
+
seatLimit: null
|
|
684
|
+
});
|
|
685
|
+
}
|
|
686
|
+
finally {
|
|
687
|
+
core.close();
|
|
688
|
+
fs.rmSync(projectRoot, { recursive: true, force: true });
|
|
689
|
+
}
|
|
690
|
+
});
|
|
691
|
+
it('does not recreate v1 when an existing plan is updated', () => {
|
|
692
|
+
const projectRoot = makeProjectRoot();
|
|
693
|
+
const core = openCore(projectRoot, { seedDefaultPlans: true });
|
|
694
|
+
try {
|
|
695
|
+
core.upsertPlanCatalog({
|
|
696
|
+
planId: 'enterprise',
|
|
697
|
+
displayName: 'Enterprise',
|
|
698
|
+
status: 'active'
|
|
699
|
+
});
|
|
700
|
+
core.createPlanVersion({
|
|
701
|
+
planId: 'enterprise',
|
|
702
|
+
versionNumber: 2,
|
|
703
|
+
isDefault: true,
|
|
704
|
+
seatLimit: 25
|
|
705
|
+
});
|
|
706
|
+
core.upsertPlanCatalog({
|
|
707
|
+
planId: 'enterprise',
|
|
708
|
+
displayName: 'Enterprise Plus',
|
|
709
|
+
status: 'archived'
|
|
710
|
+
});
|
|
711
|
+
const versions = core.listPlanVersions('enterprise');
|
|
712
|
+
expect(versions.map((version) => version.planVersionId)).toEqual(['enterprise-v2', 'enterprise-v1']);
|
|
713
|
+
expect(versions.find((version) => version.planVersionId === 'enterprise-v1')).toMatchObject({
|
|
714
|
+
isDefault: false
|
|
715
|
+
});
|
|
716
|
+
}
|
|
717
|
+
finally {
|
|
718
|
+
core.close();
|
|
719
|
+
fs.rmSync(projectRoot, { recursive: true, force: true });
|
|
720
|
+
}
|
|
721
|
+
});
|
|
157
722
|
it('backfills owner/admin memberships once and does not rerun after completion', () => {
|
|
158
723
|
const projectRoot = makeProjectRoot();
|
|
159
724
|
const initial = openCore(projectRoot);
|
|
@@ -279,7 +844,7 @@ describe('TaskforceCore system admin model', () => {
|
|
|
279
844
|
});
|
|
280
845
|
it('resolvePreferredUserWorkspaceId returns null for users with no active memberships', () => {
|
|
281
846
|
const projectRoot = makeProjectRoot();
|
|
282
|
-
const core = openCore(projectRoot);
|
|
847
|
+
const core = openCore(projectRoot, { seedDefaultPlans: true });
|
|
283
848
|
try {
|
|
284
849
|
const created = core.registerPasswordUser({
|
|
285
850
|
email: 'nomembership@example.com',
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { DatabaseAdapter } from '../storage/databaseAdapter.js';
|
|
2
|
+
import type { Comment, TaskActivityItem, TaskActor, TaskEvent, TaskEventDetails } from './Taskforce.js';
|
|
3
|
+
export interface TaskActivityServiceDeps {
|
|
4
|
+
db: DatabaseAdapter;
|
|
5
|
+
tenantId: string;
|
|
6
|
+
generateEntityId: (prefix: string) => string;
|
|
7
|
+
normalizeWorkspaceId: (workspaceId: string | undefined) => string;
|
|
8
|
+
resolveWorkspaceActor: (workspaceId: string, actorRef: unknown) => TaskActor | null;
|
|
9
|
+
}
|
|
10
|
+
export declare function replaceTaskCommentsService(deps: TaskActivityServiceDeps, taskId: string, workspaceId: string, comments: Comment[]): void;
|
|
11
|
+
export declare function listTaskEventsInternalService(deps: TaskActivityServiceDeps, taskId: string, workspaceId: string): TaskEvent[];
|
|
12
|
+
export declare function buildTaskActivityService(comments: Comment[], taskEvents: TaskEvent[]): TaskActivityItem[];
|
|
13
|
+
export declare function addTaskEventService(deps: TaskActivityServiceDeps, input: {
|
|
14
|
+
taskId: string;
|
|
15
|
+
workspaceId: string;
|
|
16
|
+
action: string;
|
|
17
|
+
actor: unknown;
|
|
18
|
+
createdAt?: string;
|
|
19
|
+
details?: TaskEventDetails;
|
|
20
|
+
}): void;
|
|
21
|
+
export declare function replaceTaskEventsService(deps: TaskActivityServiceDeps, taskId: string, workspaceId: string, taskEvents: TaskEvent[]): void;
|