devpush 0.0.0-stage → 1.0.0-beta.4
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 +22 -2
- package/agent-release.json +37 -0
- package/dist/package/LICENSE.md +21 -0
- package/dist/package/migrate.mjs +182 -0
- package/dist/package/plugins.mjs +125 -0
- package/dist/package/vite.mjs +439 -0
- package/package.json +168 -3
- package/public/apple-touch-icon.png +0 -0
- package/public/favicon.svg +1 -0
- package/public/logo-email.png +0 -0
- package/public/robots.txt +3 -0
- package/public/social.png +0 -0
- package/src/cloudflare-runtime.d.ts +78 -0
- package/src/components/about-dialog.tsx +70 -0
- package/src/components/copy-button.tsx +74 -0
- package/src/components/logo-mark.tsx +20 -0
- package/src/components/pending-collection.tsx +103 -0
- package/src/components/resource-avatar.tsx +65 -0
- package/src/components/route-error-state.tsx +95 -0
- package/src/components/section-navigation.tsx +39 -0
- package/src/components/settings-layout.tsx +111 -0
- package/src/components/storage-capabilities.tsx +11 -0
- package/src/components/table-pager.tsx +101 -0
- package/src/components/ui/alert-dialog.tsx +180 -0
- package/src/components/ui/alert.tsx +78 -0
- package/src/components/ui/avatar.tsx +58 -0
- package/src/components/ui/badge.tsx +49 -0
- package/src/components/ui/button-group.tsx +38 -0
- package/src/components/ui/button.tsx +67 -0
- package/src/components/ui/card.tsx +82 -0
- package/src/components/ui/chart.tsx +307 -0
- package/src/components/ui/checkbox.tsx +30 -0
- package/src/components/ui/combobox.tsx +256 -0
- package/src/components/ui/dialog.tsx +163 -0
- package/src/components/ui/dropdown-menu.tsx +110 -0
- package/src/components/ui/empty.tsx +65 -0
- package/src/components/ui/field.tsx +192 -0
- package/src/components/ui/input-group.tsx +118 -0
- package/src/components/ui/input-otp.tsx +70 -0
- package/src/components/ui/input.tsx +19 -0
- package/src/components/ui/label.tsx +24 -0
- package/src/components/ui/pagination.tsx +34 -0
- package/src/components/ui/popover.tsx +86 -0
- package/src/components/ui/select.tsx +145 -0
- package/src/components/ui/skeleton.tsx +19 -0
- package/src/components/ui/sonner.tsx +47 -0
- package/src/components/ui/switch.tsx +31 -0
- package/src/components/ui/table.tsx +81 -0
- package/src/components/ui/textarea.tsx +18 -0
- package/src/components/ui/tooltip.tsx +55 -0
- package/src/features/admin/admin-settings.tsx +1048 -0
- package/src/features/auth/current-user-context-query.ts +11 -0
- package/src/features/auth/login-form.tsx +442 -0
- package/src/features/auth/sign-out-menu-item.tsx +42 -0
- package/src/features/deployments/deployment-actions.tsx +336 -0
- package/src/features/deployments/deployment-alias-badge.tsx +35 -0
- package/src/features/deployments/deployment-detail.tsx +596 -0
- package/src/features/deployments/deployment-filters.ts +66 -0
- package/src/features/deployments/deployment-list.tsx +465 -0
- package/src/features/deployments/deployment-visit-links.tsx +104 -0
- package/src/features/deployments/deployments-page.tsx +376 -0
- package/src/features/logs/log-scroll-area.tsx +69 -0
- package/src/features/notifications/email-preferences.tsx +232 -0
- package/src/features/onboarding/profile-onboarding.tsx +162 -0
- package/src/features/plugins/contributions.tsx +118 -0
- package/src/features/projects/backup-job-logs.tsx +143 -0
- package/src/features/projects/backup-policy-delete-dialog.tsx +82 -0
- package/src/features/projects/backup-restore-actions.tsx +573 -0
- package/src/features/projects/backup-status-icon.tsx +33 -0
- package/src/features/projects/backup-target-list.tsx +222 -0
- package/src/features/projects/backup-timestamp.tsx +32 -0
- package/src/features/projects/backup-volume-picker.tsx +158 -0
- package/src/features/projects/compose-service-input.tsx +64 -0
- package/src/features/projects/deploy-readiness.ts +28 -0
- package/src/features/projects/environment-dot.tsx +91 -0
- package/src/features/projects/log-keyword-filter.tsx +48 -0
- package/src/features/projects/manual-deploy-dialog.tsx +563 -0
- package/src/features/projects/pending-section.ts +26 -0
- package/src/features/projects/project-backup-details-pending.tsx +305 -0
- package/src/features/projects/project-backup-details.tsx +936 -0
- package/src/features/projects/project-backup-policy.tsx +644 -0
- package/src/features/projects/project-backup-utils.ts +190 -0
- package/src/features/projects/project-backups-pending.tsx +136 -0
- package/src/features/projects/project-backups.tsx +876 -0
- package/src/features/projects/project-environment-settings.tsx +1128 -0
- package/src/features/projects/project-heading.tsx +68 -0
- package/src/features/projects/project-layout.tsx +188 -0
- package/src/features/projects/project-logs.tsx +461 -0
- package/src/features/projects/project-overview.tsx +280 -0
- package/src/features/projects/project-route-pending.tsx +1064 -0
- package/src/features/projects/project-routing-settings.tsx +663 -0
- package/src/features/projects/project-settings-section.tsx +64 -0
- package/src/features/projects/project-settings-utils.ts +101 -0
- package/src/features/projects/project-settings.tsx +1472 -0
- package/src/features/projects/repository-picker-dialog.tsx +404 -0
- package/src/features/repositories/new-project-dialog-launcher.tsx +44 -0
- package/src/features/repositories/new-project-dialog.tsx +1204 -0
- package/src/features/repositories/new-project-pending.tsx +28 -0
- package/src/features/repositories/repository-list-pending.tsx +59 -0
- package/src/features/servers/server-availability-alert.tsx +44 -0
- package/src/features/servers/server-availability.ts +29 -0
- package/src/features/servers/server-avatar.tsx +52 -0
- package/src/features/servers/server-detail-pending.tsx +315 -0
- package/src/features/servers/server-detail.tsx +855 -0
- package/src/features/servers/server-metric-chart-pending.tsx +38 -0
- package/src/features/servers/server-metric-chart.tsx +182 -0
- package/src/features/servers/server-metric-format.ts +50 -0
- package/src/features/servers/server-metrics-pending.tsx +75 -0
- package/src/features/servers/server-metrics.tsx +136 -0
- package/src/features/servers/team-servers.tsx +432 -0
- package/src/features/settings/settings-route-pending.tsx +406 -0
- package/src/features/teams/backup-storage-settings.tsx +483 -0
- package/src/features/teams/navigation.ts +51 -0
- package/src/features/teams/new-team-dialog.tsx +132 -0
- package/src/features/teams/pending-section.ts +19 -0
- package/src/features/teams/team-header.tsx +1286 -0
- package/src/features/teams/team-heading.tsx +57 -0
- package/src/features/teams/team-home.tsx +391 -0
- package/src/features/teams/team-invite.tsx +155 -0
- package/src/features/teams/team-route-pending.tsx +505 -0
- package/src/features/teams/team-settings.tsx +1555 -0
- package/src/features/teams/use-workspace-updates.ts +126 -0
- package/src/features/users/api-keys-settings.tsx +544 -0
- package/src/features/users/api-scope-selection.tsx +269 -0
- package/src/features/users/connected-apps-settings.tsx +449 -0
- package/src/features/users/mcp-consent.tsx +220 -0
- package/src/features/users/profile-picture.tsx +171 -0
- package/src/features/users/user-settings.tsx +1064 -0
- package/src/lib/account-settings-schema.ts +78 -0
- package/src/lib/action-feedback.ts +81 -0
- package/src/lib/admin-search-schema.ts +8 -0
- package/src/lib/agent-release.d.mts +21 -0
- package/src/lib/agent-release.mjs +90 -0
- package/src/lib/allowlist-schema.ts +79 -0
- package/src/lib/api-key-schema.ts +176 -0
- package/src/lib/auth/client.ts +20 -0
- package/src/lib/avatar-schema.ts +11 -0
- package/src/lib/backup-cron.ts +118 -0
- package/src/lib/backup-database.ts +41 -0
- package/src/lib/backup-feature.ts +2 -0
- package/src/lib/backup-paths.ts +7 -0
- package/src/lib/backup-policy-schema.ts +85 -0
- package/src/lib/backup-resource-schema.ts +12 -0
- package/src/lib/backup-restore-schema.ts +15 -0
- package/src/lib/backup-storage-schema.ts +55 -0
- package/src/lib/deferred-module.ts +38 -0
- package/src/lib/deployment-logs-query.ts +63 -0
- package/src/lib/display-name.ts +7 -0
- package/src/lib/error-message.ts +119 -0
- package/src/lib/form-errors.ts +10 -0
- package/src/lib/internal-redirect.ts +25 -0
- package/src/lib/manual-deploy-options-query.ts +21 -0
- package/src/lib/notification-preferences.ts +43 -0
- package/src/lib/onboarding.ts +11 -0
- package/src/lib/operation-logs-query.ts +51 -0
- package/src/lib/page-head.ts +14 -0
- package/src/lib/project-context-query.ts +257 -0
- package/src/lib/project-creation-schema.ts +64 -0
- package/src/lib/project-env-schema.ts +23 -0
- package/src/lib/project-environments-schema.ts +56 -0
- package/src/lib/project-routing-schema.ts +94 -0
- package/src/lib/project-runtime-config.ts +131 -0
- package/src/lib/project-settings-schema.ts +75 -0
- package/src/lib/public-api-schema.ts +128 -0
- package/src/lib/public-error.ts +337 -0
- package/src/lib/query.ts +13 -0
- package/src/lib/repository-selection-query.ts +11 -0
- package/src/lib/resource-cache.ts +30 -0
- package/src/lib/runtime-id.ts +19 -0
- package/src/lib/search.ts +14 -0
- package/src/lib/server-context-query.ts +43 -0
- package/src/lib/server-name-schema.ts +11 -0
- package/src/lib/settings-conflict.ts +45 -0
- package/src/lib/settings-version.ts +7 -0
- package/src/lib/team-context-query.ts +126 -0
- package/src/lib/team-context-schema.ts +8 -0
- package/src/lib/team-forms-schema.ts +45 -0
- package/src/lib/team-role.ts +13 -0
- package/src/lib/team-settings-schema.ts +48 -0
- package/src/lib/urls.ts +3 -0
- package/src/lib/use-avatar-input.ts +61 -0
- package/src/lib/use-refresh-error.ts +18 -0
- package/src/lib/use-settings-version.ts +23 -0
- package/src/lib/utils.ts +6 -0
- package/src/lib/validation.ts +5 -0
- package/src/lib/workspace-updates.ts +53 -0
- package/src/package/config.ts +10 -0
- package/src/package/env.mjs +54 -0
- package/src/package/migrate-api.d.ts +5 -0
- package/src/package/migrate.ts +56 -0
- package/src/package/plugins.ts +141 -0
- package/src/package/sqlite.mjs +2 -0
- package/src/package/vite-api.d.ts +5 -0
- package/src/package/vite.ts +324 -0
- package/src/package/watch-guard.cjs +26 -0
- package/src/plugins/client.ts +57 -0
- package/src/plugins/contract.ts +188 -0
- package/src/plugins/default.server.ts +4 -0
- package/src/plugins/default.ui.ts +4 -0
- package/src/plugins/operations.ts +45 -0
- package/src/plugins/server.ts +197 -0
- package/src/plugins/version.ts +1 -0
- package/src/routeTree.gen.ts +1275 -0
- package/src/router.tsx +46 -0
- package/src/routes/$teamSlug.index.tsx +53 -0
- package/src/routes/$teamSlug.new-project.tsx +13 -0
- package/src/routes/$teamSlug.projects.$projectName.backups.$backupId.tsx +40 -0
- package/src/routes/$teamSlug.projects.$projectName.backups.tsx +82 -0
- package/src/routes/$teamSlug.projects.$projectName.deployments.$deploymentId.tsx +52 -0
- package/src/routes/$teamSlug.projects.$projectName.deployments.tsx +86 -0
- package/src/routes/$teamSlug.projects.$projectName.logs.tsx +55 -0
- package/src/routes/$teamSlug.projects.$projectName.settings.tsx +51 -0
- package/src/routes/$teamSlug.projects.$projectName.tsx +106 -0
- package/src/routes/$teamSlug.projects.tsx +40 -0
- package/src/routes/$teamSlug.servers.$serverId.tsx +31 -0
- package/src/routes/$teamSlug.servers.index.tsx +59 -0
- package/src/routes/$teamSlug.servers.tsx +7 -0
- package/src/routes/$teamSlug.settings.tsx +56 -0
- package/src/routes/$teamSlug.tsx +86 -0
- package/src/routes/[.]well-known.oauth-authorization-server.api.auth.ts +13 -0
- package/src/routes/[.]well-known.oauth-protected-resource.mcp.ts +6 -0
- package/src/routes/__root.tsx +155 -0
- package/src/routes/admin.tsx +55 -0
- package/src/routes/api/agents/certificates.ts +21 -0
- package/src/routes/api/agents/credentials/rotate.ts +22 -0
- package/src/routes/api/agents/heartbeat.ts +42 -0
- package/src/routes/api/agents/job-logs.ts +22 -0
- package/src/routes/api/agents/jobs/complete.ts +22 -0
- package/src/routes/api/agents/jobs/next.ts +29 -0
- package/src/routes/api/agents/jobs/progress.ts +32 -0
- package/src/routes/api/agents/jobs/status.ts +22 -0
- package/src/routes/api/agents/register.ts +45 -0
- package/src/routes/api/agents/runtime-logs.ts +22 -0
- package/src/routes/api/agents/switch.ts +25 -0
- package/src/routes/api/auth/$.ts +38 -0
- package/src/routes/api/cron/backups.ts +33 -0
- package/src/routes/api/cron/maintenance.ts +30 -0
- package/src/routes/api/github/install.callback.ts +51 -0
- package/src/routes/api/github/install.ts +41 -0
- package/src/routes/api/github/webhook.ts +11 -0
- package/src/routes/api/health.ts +19 -0
- package/src/routes/api/install/agent.$token.ts +50 -0
- package/src/routes/api/install/agent.binary.ts +83 -0
- package/src/routes/api/install/agent.checksum.ts +45 -0
- package/src/routes/api/install/agent.ts +26 -0
- package/src/routes/api/plugins/$.ts +11 -0
- package/src/routes/api/v1/$.ts +15 -0
- package/src/routes/api/workspaces/updates.ts +8 -0
- package/src/routes/auth.login.tsx +50 -0
- package/src/routes/deployments.$deploymentId.unavailable.tsx +21 -0
- package/src/routes/index.tsx +23 -0
- package/src/routes/invites.$token.tsx +35 -0
- package/src/routes/mcp.ts +13 -0
- package/src/routes/oauth.consent.tsx +54 -0
- package/src/routes/onboarding.tsx +37 -0
- package/src/routes/onboarding.workspace.tsx +44 -0
- package/src/routes/settings.tsx +30 -0
- package/src/routes/uploads/avatars/$fileName.ts +44 -0
- package/src/server/admin/access.ts +67 -0
- package/src/server/admin/functions.ts +122 -0
- package/src/server/admin/service.ts +260 -0
- package/src/server/agents/backup-state.ts +210 -0
- package/src/server/agents/certificates.ts +96 -0
- package/src/server/agents/claims.ts +116 -0
- package/src/server/agents/cleanup.ts +52 -0
- package/src/server/agents/compatibility.ts +116 -0
- package/src/server/agents/completion.ts +83 -0
- package/src/server/agents/container-cleanup-state.ts +51 -0
- package/src/server/agents/deployment-state.ts +111 -0
- package/src/server/agents/job-payloads.ts +159 -0
- package/src/server/agents/jobs.ts +1293 -0
- package/src/server/agents/protocol.ts +400 -0
- package/src/server/agents/reconciliation.ts +43 -0
- package/src/server/agents/runtime-logs.ts +337 -0
- package/src/server/agents/runtime-state.ts +125 -0
- package/src/server/api/admission.ts +12 -0
- package/src/server/api/authorization.ts +115 -0
- package/src/server/api/credentials.ts +569 -0
- package/src/server/api/cursors.ts +72 -0
- package/src/server/api/errors.ts +24 -0
- package/src/server/api/functions.ts +60 -0
- package/src/server/api/handler.ts +274 -0
- package/src/server/api/mutation-operations.ts +913 -0
- package/src/server/api/operation-context.ts +139 -0
- package/src/server/api/operation-contract.ts +1099 -0
- package/src/server/api/operations.ts +64 -0
- package/src/server/api/read-operations.ts +891 -0
- package/src/server/api/retention.ts +33 -0
- package/src/server/auth/access.ts +109 -0
- package/src/server/auth/auth-methods.ts +28 -0
- package/src/server/auth/better-auth.ts +518 -0
- package/src/server/auth/context.ts +28 -0
- package/src/server/auth/email-change.ts +47 -0
- package/src/server/auth/email-delivery.ts +51 -0
- package/src/server/auth/provider-identity.ts +19 -0
- package/src/server/auth/provider-tokens.ts +27 -0
- package/src/server/auth/session.server.ts +19 -0
- package/src/server/backups/database-commands.ts +40 -0
- package/src/server/backups/destination.ts +12 -0
- package/src/server/backups/feature.ts +6 -0
- package/src/server/backups/policy-validation.ts +51 -0
- package/src/server/backups/queue-state.ts +137 -0
- package/src/server/backups/service.ts +918 -0
- package/src/server/backups/storage-functions.ts +42 -0
- package/src/server/backups/storage-state.ts +67 -0
- package/src/server/backups/storage.ts +237 -0
- package/src/server/config.ts +274 -0
- package/src/server/db/atomic.ts +16 -0
- package/src/server/db/d1-connection.ts +83 -0
- package/src/server/db/errors.ts +17 -0
- package/src/server/db/index.cloudflare.ts +15 -0
- package/src/server/db/index.ts +35 -0
- package/src/server/db/libsql-connection.ts +72 -0
- package/src/server/db/log-schema.ts +102 -0
- package/src/server/db/migrate-libsql.ts +29 -0
- package/src/server/db/migrate-sqlite.ts +47 -0
- package/src/server/db/migration-history.ts +12 -0
- package/src/server/db/migrations-logs/0000_initial.sql +48 -0
- package/src/server/db/migrations-logs/0001_runtime_log_order.sql +2 -0
- package/src/server/db/migrations-logs/meta/0000_snapshot.json +327 -0
- package/src/server/db/migrations-logs/meta/0001_snapshot.json +329 -0
- package/src/server/db/migrations-logs/meta/_journal.json +20 -0
- package/src/server/db/migrations-sqlite/0000_initial.sql +894 -0
- package/src/server/db/migrations-sqlite/0001_agent_indexes.sql +5 -0
- package/src/server/db/migrations-sqlite/meta/0000_snapshot.json +5816 -0
- package/src/server/db/migrations-sqlite/meta/0001_snapshot.json +5841 -0
- package/src/server/db/migrations-sqlite/meta/_journal.json +20 -0
- package/src/server/db/oauth-schema.ts +216 -0
- package/src/server/db/remote-config.ts +47 -0
- package/src/server/db/schema.ts +1218 -0
- package/src/server/db/sqlite-connection.ts +94 -0
- package/src/server/db/sqlite-files.ts +27 -0
- package/src/server/db/sqlite-params.ts +19 -0
- package/src/server/db/worker-connection.ts +47 -0
- package/src/server/deleted-resources.ts +133 -0
- package/src/server/deletion-recovery.ts +272 -0
- package/src/server/email/layout.tsx +85 -0
- package/src/server/email/notification-template.tsx +62 -0
- package/src/server/email/otp-template.tsx +48 -0
- package/src/server/email/service.ts +251 -0
- package/src/server/email/team-invite-template.tsx +59 -0
- package/src/server/email/theme.ts +10 -0
- package/src/server/github/http.ts +14 -0
- package/src/server/github/install-state.ts +48 -0
- package/src/server/github/service.ts +831 -0
- package/src/server/github/webhook-handler.ts +198 -0
- package/src/server/github/webhooks.ts +205 -0
- package/src/server/http/auth.ts +11 -0
- package/src/server/http/error-diagnostics.ts +66 -0
- package/src/server/http/plugin-request.ts +15 -0
- package/src/server/http/proxy-request.ts +53 -0
- package/src/server/http/public-errors.ts +48 -0
- package/src/server/http/rate-limit.ts +59 -0
- package/src/server/http/request-body.ts +54 -0
- package/src/server/http/request-ip.ts +54 -0
- package/src/server/http/security-headers.ts +36 -0
- package/src/server/install/agent-binary.ts +230 -0
- package/src/server/install/agent-script.ts +565 -0
- package/src/server/install/release-binary.ts +65 -0
- package/src/server/logs/budget.ts +72 -0
- package/src/server/logs/cleanup.ts +64 -0
- package/src/server/logs/deployments.ts +98 -0
- package/src/server/logs/operations.ts +145 -0
- package/src/server/logs/retention.ts +39 -0
- package/src/server/maintenance.ts +61 -0
- package/src/server/mcp/connections.ts +358 -0
- package/src/server/mcp/functions.ts +63 -0
- package/src/server/mcp/handler.ts +295 -0
- package/src/server/mcp/oauth-discovery.cloudflare.ts +6 -0
- package/src/server/mcp/oauth-discovery.ts +8 -0
- package/src/server/mcp/oauth-provider.ts +220 -0
- package/src/server/mcp/urls.ts +20 -0
- package/src/server/notifications/functions.ts +51 -0
- package/src/server/notifications/observe.ts +303 -0
- package/src/server/notifications/outbox.ts +335 -0
- package/src/server/notifications/preferences.ts +131 -0
- package/src/server/notifications/query.ts +16 -0
- package/src/server/plugins/scope.ts +17 -0
- package/src/server/plugins/server-context.ts +157 -0
- package/src/server/plugins/services.server.ts +10 -0
- package/src/server/plugins/workspace-access.ts +74 -0
- package/src/server/projects/backup-policy-state.ts +68 -0
- package/src/server/projects/backups.ts +219 -0
- package/src/server/projects/compose-metadata.ts +174 -0
- package/src/server/projects/configuration-state.ts +90 -0
- package/src/server/projects/context.ts +909 -0
- package/src/server/projects/creation-state.ts +46 -0
- package/src/server/projects/deletion-state.ts +69 -0
- package/src/server/projects/deployment-config.ts +139 -0
- package/src/server/projects/deployment-logs.ts +97 -0
- package/src/server/projects/deployments.ts +1123 -0
- package/src/server/projects/domain-state.ts +71 -0
- package/src/server/projects/environment-branches.ts +75 -0
- package/src/server/projects/environment-state.ts +158 -0
- package/src/server/projects/environments.ts +424 -0
- package/src/server/projects/functions.ts +748 -0
- package/src/server/projects/generated-hostname.ts +77 -0
- package/src/server/projects/hostnames.ts +244 -0
- package/src/server/projects/mappers.ts +457 -0
- package/src/server/projects/names.ts +41 -0
- package/src/server/projects/project-env-vars.ts +28 -0
- package/src/server/projects/queue-state.ts +118 -0
- package/src/server/projects/repository.ts +368 -0
- package/src/server/projects/route-state.ts +37 -0
- package/src/server/projects/runtime-logs.ts +97 -0
- package/src/server/projects/settings-context.ts +58 -0
- package/src/server/projects/settings.ts +738 -0
- package/src/server/projects/types.ts +355 -0
- package/src/server/realtime/agent-events.ts +32 -0
- package/src/server/realtime/node-broadcaster.ts +71 -0
- package/src/server/realtime/node-handler.ts +55 -0
- package/src/server/realtime/service.ts +125 -0
- package/src/server/realtime/workspace-object.cloudflare.ts +62 -0
- package/src/server/realtime/workspace-object.ts +3 -0
- package/src/server/resources/color.ts +13 -0
- package/src/server/runtime/background.ts +21 -0
- package/src/server/runtime/node-asset-cache-plugin.ts +12 -0
- package/src/server/runtime/node-scheduler-plugin.ts +17 -0
- package/src/server/runtime/node-scheduler.ts +51 -0
- package/src/server/runtime/platform-env.cloudflare.ts +17 -0
- package/src/server/runtime/platform-env.ts +19 -0
- package/src/server/runtime/scheduled-task-error.ts +9 -0
- package/src/server/scheduled-tasks.ts +28 -0
- package/src/server/secrets/crypto.ts +56 -0
- package/src/server/servers/functions.ts +233 -0
- package/src/server/servers/lifecycle.ts +122 -0
- package/src/server/servers/metric-history-schema.ts +24 -0
- package/src/server/servers/metric-history.ts +55 -0
- package/src/server/servers/monitoring.ts +592 -0
- package/src/server/servers/service.ts +1211 -0
- package/src/server/servers/status.ts +32 -0
- package/src/server/servers/switch.ts +96 -0
- package/src/server/settings-version.ts +43 -0
- package/src/server/storage/capabilities.ts +6 -0
- package/src/server/storage/local-object-store.cloudflare.ts +7 -0
- package/src/server/storage/local-object-store.ts +50 -0
- package/src/server/storage/object-store.ts +160 -0
- package/src/server/teams/creation.ts +51 -0
- package/src/server/teams/delete-policy.ts +13 -0
- package/src/server/teams/deletion-state.ts +80 -0
- package/src/server/teams/functions.ts +324 -0
- package/src/server/teams/invitations.ts +38 -0
- package/src/server/teams/membership.ts +86 -0
- package/src/server/teams/queries.ts +261 -0
- package/src/server/teams/service.ts +1127 -0
- package/src/server/teams/types.ts +101 -0
- package/src/server/uploads/avatar.ts +133 -0
- package/src/server/users/deletion-state.ts +93 -0
- package/src/server/users/functions.ts +160 -0
- package/src/server/users/onboarding.ts +17 -0
- package/src/server/users/service.ts +644 -0
- package/src/server.ts +55 -0
- package/src/styles/shadcn.css +653 -0
- package/src/styles/theme.css +76 -0
- package/src/styles.css +177 -0
- package/wrangler.template.jsonc +37 -0
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { sql } from 'drizzle-orm'
|
|
2
|
+
import type { BaseSQLiteDatabase } from 'drizzle-orm/sqlite-core'
|
|
3
|
+
import type { AtomicStore } from '#devpush/server/db/atomic'
|
|
4
|
+
import * as schema from '#devpush/server/db/schema'
|
|
5
|
+
import type { ApiMutationAdmission } from '#devpush/server/api/admission'
|
|
6
|
+
import { createComposeRuntimeConfig } from '#devpush/lib/project-runtime-config'
|
|
7
|
+
|
|
8
|
+
export async function insertProject(
|
|
9
|
+
store: Pick<BaseSQLiteDatabase<'async', unknown, typeof schema>, 'insert'> &
|
|
10
|
+
AtomicStore,
|
|
11
|
+
input: {
|
|
12
|
+
project: typeof schema.projects.$inferInsert
|
|
13
|
+
environment: typeof schema.environments.$inferInsert
|
|
14
|
+
hostname: string | null
|
|
15
|
+
https: boolean
|
|
16
|
+
userId?: string
|
|
17
|
+
admission?: ApiMutationAdmission
|
|
18
|
+
},
|
|
19
|
+
) {
|
|
20
|
+
const p = input.project
|
|
21
|
+
const e = input.environment
|
|
22
|
+
const created = sql`exists(select 1 from ${schema.projects} where id = ${p.id})`
|
|
23
|
+
const actor = input.userId
|
|
24
|
+
? sql`exists(select 1 from ${schema.teamMembers} m join ${schema.user} u on u.id = m.user_id join ${schema.teams} t on t.id = m.team_id where m.user_id = ${input.userId} and m.team_id = ${p.teamId} and u.status = 'active' and t.status = 'active')`
|
|
25
|
+
: sql`1`
|
|
26
|
+
const [inserted] = await store.batch([
|
|
27
|
+
store.all(sql`insert into ${schema.projects}
|
|
28
|
+
(id,team_id,slug,name,status,github_repo_id,github_repo,github_installation_id,default_server_id,routes,env_vars_encrypted,runtime_config,compose_metadata)
|
|
29
|
+
select ${p.id},${p.teamId},${p.slug},${p.name},'active',${p.githubRepoId ?? null},${p.githubRepo},${p.githubInstallationId ?? null},${p.defaultServerId ?? null},${p.routes == null ? null : JSON.stringify(p.routes)},${p.envVarsEncrypted ?? null},${JSON.stringify(p.runtimeConfig ?? createComposeRuntimeConfig())},${p.composeMetadata == null ? null : JSON.stringify(p.composeMetadata)}
|
|
30
|
+
where ${created} or (${actor} and ${input.admission?.guard ?? sql`1`} and (${p.defaultServerId ?? null} is null or exists(select 1 from ${schema.servers} where id = ${p.defaultServerId ?? null} and team_id = ${p.teamId} and status <> 'deleted'))) returning id`),
|
|
31
|
+
store.run(sql`insert into ${schema.environments} (id,project_id,server_id,name,slug,branch,is_production,position,color,status,runtime_id)
|
|
32
|
+
select ${e.id},${e.projectId},${e.serverId ?? null},${e.name},${e.slug},${e.branch},${Number(e.isProduction ?? false)},${e.position ?? 0},${e.color ?? 'blue'},${e.status ?? 'active'},${e.runtimeId} where ${created}`),
|
|
33
|
+
...(input.hostname
|
|
34
|
+
? [
|
|
35
|
+
store.run(sql`insert into aliases
|
|
36
|
+
(id, project_id, environment_id, hostname, type, https)
|
|
37
|
+
select ${crypto.randomUUID()}, ${input.project.id}, ${input.environment.id},
|
|
38
|
+
case when exists(select 1 from domains where hostname = ${input.hostname})
|
|
39
|
+
then null else ${input.hostname} end,
|
|
40
|
+
'environment', ${Number(input.https)} where ${created}`),
|
|
41
|
+
]
|
|
42
|
+
: []),
|
|
43
|
+
...(input.admission?.statements ?? []),
|
|
44
|
+
])
|
|
45
|
+
return inserted.length === 1
|
|
46
|
+
}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { releaseBackupCleanupRuns } from '#devpush/server/backups/queue-state'
|
|
2
|
+
import type { ApiMutationAdmission } from '#devpush/server/api/admission'
|
|
3
|
+
import { sql } from 'drizzle-orm'
|
|
4
|
+
import type { AtomicStore } from '#devpush/server/db/atomic'
|
|
5
|
+
import { runtimeCleanupInsert } from '#devpush/server/agents/cleanup'
|
|
6
|
+
|
|
7
|
+
export async function deleteProjectState(
|
|
8
|
+
store: AtomicStore,
|
|
9
|
+
input: {
|
|
10
|
+
projectId: string
|
|
11
|
+
teamId: string
|
|
12
|
+
userId: string
|
|
13
|
+
removeDeployments: boolean
|
|
14
|
+
now: Date
|
|
15
|
+
admission?: ApiMutationAdmission
|
|
16
|
+
},
|
|
17
|
+
) {
|
|
18
|
+
const now = input.now.getTime()
|
|
19
|
+
const guard = sql`exists(select 1 from projects p join teams t on t.id = p.team_id
|
|
20
|
+
join team_members m on m.team_id = t.id join user u on u.id = m.user_id
|
|
21
|
+
where p.id = ${input.projectId} and p.team_id = ${input.teamId} and p.status = 'active'
|
|
22
|
+
and t.status = 'active' and u.status = 'active' and m.user_id = ${input.userId}
|
|
23
|
+
and m.role in ('owner', 'admin')) and ${input.admission?.guard ?? sql`1`}`
|
|
24
|
+
const envIds = sql`select id from environments where project_id = ${input.projectId}`
|
|
25
|
+
const message = 'Canceled because the project was deleted.'
|
|
26
|
+
const results = await store.batch([
|
|
27
|
+
store.run(
|
|
28
|
+
releaseBackupCleanupRuns({
|
|
29
|
+
jobIds: sql`select id from agent_jobs where project_id = ${input.projectId}`,
|
|
30
|
+
guard,
|
|
31
|
+
message,
|
|
32
|
+
now: input.now,
|
|
33
|
+
}),
|
|
34
|
+
),
|
|
35
|
+
store.run(sql`update agent_jobs set status = 'canceled', error_message = ${message},
|
|
36
|
+
finished_at = ${now}, updated_at = ${now} where project_id = ${input.projectId}
|
|
37
|
+
and type in ('deploy', 'backup', 'restore', 'backup_cleanup') and status in ('queued', 'running') and ${guard}`),
|
|
38
|
+
...(input.removeDeployments
|
|
39
|
+
? [
|
|
40
|
+
store.run(
|
|
41
|
+
runtimeCleanupInsert({
|
|
42
|
+
projectIds: sql`select id from projects where id = ${input.projectId}`,
|
|
43
|
+
projectId: input.projectId,
|
|
44
|
+
guard,
|
|
45
|
+
reason: 'Project deleted.',
|
|
46
|
+
now: input.now,
|
|
47
|
+
}),
|
|
48
|
+
),
|
|
49
|
+
]
|
|
50
|
+
: []),
|
|
51
|
+
store.run(sql`update backup_runs set status = 'canceled', error_message = ${message},
|
|
52
|
+
finished_at = ${now}, updated_at = ${now} where project_id = ${input.projectId}
|
|
53
|
+
and status in ('queued', 'running') and ${guard}`),
|
|
54
|
+
...(input.removeDeployments
|
|
55
|
+
? [
|
|
56
|
+
store.run(sql`update environments set status = 'deleted',
|
|
57
|
+
is_production = 0, updated_at = ${now} where project_id = ${input.projectId} and ${guard}`),
|
|
58
|
+
]
|
|
59
|
+
: []),
|
|
60
|
+
store.run(sql`update deployments set status = 'canceled', phase = 'canceled', error_message = ${message},
|
|
61
|
+
finished_at = ${now} where environment_id in (${envIds}) and status in ('queued', 'running') and ${guard}`),
|
|
62
|
+
// Keep hostname reservations until the agent confirms container removal.
|
|
63
|
+
store.all(sql`update projects set status = 'deleted', updated_at = ${now} where id = ${input.projectId}
|
|
64
|
+
and ${guard} returning id`),
|
|
65
|
+
...(input.admission?.statements ?? []),
|
|
66
|
+
])
|
|
67
|
+
const changed = results.at(-1 - (input.admission?.statements.length ?? 0))
|
|
68
|
+
return Array.isArray(changed) && changed.length === 1
|
|
69
|
+
}
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
import {
|
|
2
|
+
createCipheriv,
|
|
3
|
+
createDecipheriv,
|
|
4
|
+
createHash,
|
|
5
|
+
randomBytes,
|
|
6
|
+
} from 'node:crypto'
|
|
7
|
+
import { z } from 'zod'
|
|
8
|
+
|
|
9
|
+
import { config } from '#devpush/server/config'
|
|
10
|
+
import { projectRuntimeConfigSchema } from '#devpush/lib/project-runtime-config'
|
|
11
|
+
|
|
12
|
+
const deploymentRouteSchema = z.strictObject({
|
|
13
|
+
host: z.string().min(1),
|
|
14
|
+
service: z.string().min(1),
|
|
15
|
+
port: z.number().int().min(1).max(65_535),
|
|
16
|
+
path: z.string().regex(/^\//),
|
|
17
|
+
https: z.boolean(),
|
|
18
|
+
stripPrefix: z.boolean(),
|
|
19
|
+
})
|
|
20
|
+
|
|
21
|
+
const deploymentConfigSchema = z.strictObject({
|
|
22
|
+
schemaVersion: z.literal(1),
|
|
23
|
+
runtime: projectRuntimeConfigSchema,
|
|
24
|
+
routes: z.array(deploymentRouteSchema),
|
|
25
|
+
})
|
|
26
|
+
|
|
27
|
+
const deploymentEnvVarsSchema = z.array(
|
|
28
|
+
z.strictObject({
|
|
29
|
+
key: z.string(),
|
|
30
|
+
value: z.string(),
|
|
31
|
+
}),
|
|
32
|
+
)
|
|
33
|
+
|
|
34
|
+
export type DeploymentEnvVar = {
|
|
35
|
+
key: string
|
|
36
|
+
value: string
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export type DeploymentCommitMeta = {
|
|
40
|
+
githubSenderId?: string
|
|
41
|
+
message: string | null
|
|
42
|
+
authorName: string | null
|
|
43
|
+
authoredAt: string | null
|
|
44
|
+
url: string | null
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export type DeploymentConfig = z.infer<typeof deploymentConfigSchema>
|
|
48
|
+
|
|
49
|
+
export function encryptDeploymentEnvVars(envVars: Array<DeploymentEnvVar>) {
|
|
50
|
+
return encryptJson(envVars)
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export function decryptDeploymentEnvVars(
|
|
54
|
+
payload: string,
|
|
55
|
+
): Array<DeploymentEnvVar> {
|
|
56
|
+
return deploymentEnvVarsSchema.parse(decryptJson(payload))
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export function parseDeploymentConfig(value: unknown): DeploymentConfig | null {
|
|
60
|
+
const result = deploymentConfigSchema.safeParse(value)
|
|
61
|
+
return result.success ? result.data : null
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export function toDeploymentCommitMeta(commit: {
|
|
65
|
+
message: string | null
|
|
66
|
+
authorName?: string | null
|
|
67
|
+
authoredAt?: string | null
|
|
68
|
+
url?: string | null
|
|
69
|
+
}): DeploymentCommitMeta {
|
|
70
|
+
return {
|
|
71
|
+
message: commit.message,
|
|
72
|
+
authorName: commit.authorName ?? null,
|
|
73
|
+
authoredAt: commit.authoredAt ?? null,
|
|
74
|
+
url: commit.url ?? null,
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
export function normalizeDeploymentCommitMeta(
|
|
79
|
+
value: unknown,
|
|
80
|
+
): DeploymentCommitMeta {
|
|
81
|
+
if (typeof value === 'object' && value !== null && 'message' in value) {
|
|
82
|
+
const record = value as Record<string, unknown>
|
|
83
|
+
return {
|
|
84
|
+
message: typeof record.message === 'string' ? record.message : null,
|
|
85
|
+
authorName:
|
|
86
|
+
typeof record.authorName === 'string' ? record.authorName : null,
|
|
87
|
+
authoredAt:
|
|
88
|
+
typeof record.authoredAt === 'string' ? record.authoredAt : null,
|
|
89
|
+
url: typeof record.url === 'string' ? record.url : null,
|
|
90
|
+
...(typeof record.githubSenderId === 'string' &&
|
|
91
|
+
/^\d+$/.test(record.githubSenderId)
|
|
92
|
+
? { githubSenderId: record.githubSenderId }
|
|
93
|
+
: {}),
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
return { message: null, authorName: null, authoredAt: null, url: null }
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
function encryptJson(value: unknown) {
|
|
100
|
+
const iv = randomBytes(12)
|
|
101
|
+
const cipher = createCipheriv('aes-256-gcm', encryptionKey(), iv)
|
|
102
|
+
const encrypted = Buffer.concat([
|
|
103
|
+
cipher.update(JSON.stringify(value), 'utf8'),
|
|
104
|
+
cipher.final(),
|
|
105
|
+
])
|
|
106
|
+
const tag = cipher.getAuthTag()
|
|
107
|
+
|
|
108
|
+
return [
|
|
109
|
+
'v1',
|
|
110
|
+
iv.toString('base64url'),
|
|
111
|
+
tag.toString('base64url'),
|
|
112
|
+
encrypted.toString('base64url'),
|
|
113
|
+
].join(':')
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
function decryptJson(payload: string): unknown {
|
|
117
|
+
const [version, ivValue, tagValue, encryptedValue] = payload.split(':')
|
|
118
|
+
|
|
119
|
+
if (version !== 'v1' || !ivValue || !tagValue || !encryptedValue) {
|
|
120
|
+
throw new Error('Invalid encrypted deployment payload.')
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
const decipher = createDecipheriv(
|
|
124
|
+
'aes-256-gcm',
|
|
125
|
+
encryptionKey(),
|
|
126
|
+
Buffer.from(ivValue, 'base64url'),
|
|
127
|
+
)
|
|
128
|
+
decipher.setAuthTag(Buffer.from(tagValue, 'base64url'))
|
|
129
|
+
const decrypted = Buffer.concat([
|
|
130
|
+
decipher.update(Buffer.from(encryptedValue, 'base64url')),
|
|
131
|
+
decipher.final(),
|
|
132
|
+
])
|
|
133
|
+
|
|
134
|
+
return JSON.parse(decrypted.toString('utf8'))
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
function encryptionKey() {
|
|
138
|
+
return createHash('sha256').update(config.BETTER_AUTH_SECRET).digest()
|
|
139
|
+
}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import { and, desc, eq, gte, inArray, like, sql } from 'drizzle-orm'
|
|
2
|
+
import type { SQL } from 'drizzle-orm'
|
|
3
|
+
|
|
4
|
+
import { db, logsDb } from '#devpush/server/db'
|
|
5
|
+
import { deploymentLogs } from '#devpush/server/db/log-schema'
|
|
6
|
+
import { deployments, environments } from '#devpush/server/db/schema'
|
|
7
|
+
|
|
8
|
+
type Filters = {
|
|
9
|
+
projectId: string
|
|
10
|
+
branch?: string | null
|
|
11
|
+
deploymentId?: string | null
|
|
12
|
+
environmentId?: string | null
|
|
13
|
+
keyword?: string | null
|
|
14
|
+
since?: Date | null
|
|
15
|
+
}
|
|
16
|
+
type Line = {
|
|
17
|
+
deploymentId: string
|
|
18
|
+
stream: string
|
|
19
|
+
seq: number
|
|
20
|
+
content: string
|
|
21
|
+
createdAt: Date
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
// Call after main-project authorization. Denormalized identity filters the
|
|
25
|
+
// large store; main lookups exclude output whose deployment has been removed.
|
|
26
|
+
async function readOutput(filters: Filters, limit: number) {
|
|
27
|
+
const conditions: SQL[] = [eq(deploymentLogs.projectId, filters.projectId)]
|
|
28
|
+
if (filters.branch) conditions.push(eq(deploymentLogs.branch, filters.branch))
|
|
29
|
+
if (filters.deploymentId)
|
|
30
|
+
conditions.push(eq(deploymentLogs.deploymentId, filters.deploymentId))
|
|
31
|
+
if (filters.environmentId)
|
|
32
|
+
conditions.push(eq(deploymentLogs.environmentId, filters.environmentId))
|
|
33
|
+
if (filters.keyword)
|
|
34
|
+
conditions.push(
|
|
35
|
+
like(deploymentLogs.searchContent, `%${filters.keyword.toLowerCase()}%`),
|
|
36
|
+
)
|
|
37
|
+
if (filters.since)
|
|
38
|
+
conditions.push(gte(deploymentLogs.createdAt, filters.since))
|
|
39
|
+
const output: Line[] = []
|
|
40
|
+
let cursor: SQL | undefined
|
|
41
|
+
const pageSize = Math.min(200, Math.max(32, limit))
|
|
42
|
+
while (output.length < limit) {
|
|
43
|
+
const candidates = await logsDb
|
|
44
|
+
.select({
|
|
45
|
+
deploymentId: deploymentLogs.deploymentId,
|
|
46
|
+
stream: deploymentLogs.stream,
|
|
47
|
+
seq: deploymentLogs.seq,
|
|
48
|
+
content: deploymentLogs.content,
|
|
49
|
+
createdAt: deploymentLogs.createdAt,
|
|
50
|
+
})
|
|
51
|
+
.from(deploymentLogs)
|
|
52
|
+
.where(and(...conditions, cursor))
|
|
53
|
+
.orderBy(
|
|
54
|
+
desc(deploymentLogs.createdAt),
|
|
55
|
+
desc(deploymentLogs.deploymentId),
|
|
56
|
+
desc(deploymentLogs.stream),
|
|
57
|
+
desc(deploymentLogs.seq),
|
|
58
|
+
)
|
|
59
|
+
.limit(pageSize)
|
|
60
|
+
if (!candidates.length) break
|
|
61
|
+
const ids = [...new Set(candidates.map((line) => line.deploymentId))]
|
|
62
|
+
const live = new Set<string>()
|
|
63
|
+
for (let offset = 0; offset < ids.length; offset += 80) {
|
|
64
|
+
const rows = await db
|
|
65
|
+
.select({ id: deployments.id })
|
|
66
|
+
.from(deployments)
|
|
67
|
+
.innerJoin(environments, eq(environments.id, deployments.environmentId))
|
|
68
|
+
.where(
|
|
69
|
+
and(
|
|
70
|
+
eq(environments.projectId, filters.projectId),
|
|
71
|
+
inArray(deployments.id, ids.slice(offset, offset + 80)),
|
|
72
|
+
filters.branch
|
|
73
|
+
? eq(deployments.gitBranch, filters.branch)
|
|
74
|
+
: undefined,
|
|
75
|
+
filters.environmentId
|
|
76
|
+
? eq(deployments.environmentId, filters.environmentId)
|
|
77
|
+
: undefined,
|
|
78
|
+
),
|
|
79
|
+
)
|
|
80
|
+
for (const row of rows) live.add(row.id)
|
|
81
|
+
}
|
|
82
|
+
output.push(...candidates.filter((line) => live.has(line.deploymentId)))
|
|
83
|
+
if (candidates.length < pageSize) break
|
|
84
|
+
const last = candidates[candidates.length - 1]
|
|
85
|
+
if (!last) break
|
|
86
|
+
cursor = sql`(${deploymentLogs.createdAt}, ${deploymentLogs.deploymentId}, ${deploymentLogs.stream}, ${deploymentLogs.seq}) < (${last.createdAt}, ${last.deploymentId}, ${last.stream}, ${last.seq})`
|
|
87
|
+
}
|
|
88
|
+
return output.slice(0, limit)
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
export async function readProjectDeploymentLogs(filters: Filters, limit = 200) {
|
|
92
|
+
return readOutput(filters, limit)
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
export async function projectHasDeploymentLogs(projectId: string) {
|
|
96
|
+
return (await readOutput({ projectId }, 1)).length > 0
|
|
97
|
+
}
|