@stacksjs/defaults 0.70.206 → 0.70.208
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/TODO.md +21 -0
- package/ai/AGENTS.md +79 -0
- package/ai/README.md +45 -0
- package/ai/claude/launch.json +12 -0
- package/ai/skills/stacks-actions/SKILL.md +128 -0
- package/ai/skills/stacks-ai/SKILL.md +276 -0
- package/ai/skills/stacks-alias/SKILL.md +94 -0
- package/ai/skills/stacks-analytics/SKILL.md +91 -0
- package/ai/skills/stacks-api/SKILL.md +738 -0
- package/ai/skills/stacks-arrays/SKILL.md +277 -0
- package/ai/skills/stacks-auth/SKILL.md +422 -0
- package/ai/skills/stacks-auto-imports/SKILL.md +138 -0
- package/ai/skills/stacks-brandkit/SKILL.md +811 -0
- package/ai/skills/stacks-browse/SKILL.md +127 -0
- package/ai/skills/stacks-browse/scripts/browse.ts +492 -0
- package/ai/skills/stacks-browser/SKILL.md +145 -0
- package/ai/skills/stacks-buddy/SKILL.md +676 -0
- package/ai/skills/stacks-build/SKILL.md +163 -0
- package/ai/skills/stacks-cache/SKILL.md +125 -0
- package/ai/skills/stacks-calendar/SKILL.md +113 -0
- package/ai/skills/stacks-chat/SKILL.md +371 -0
- package/ai/skills/stacks-cli/SKILL.md +112 -0
- package/ai/skills/stacks-cloud/SKILL.md +192 -0
- package/ai/skills/stacks-cms/SKILL.md +217 -0
- package/ai/skills/stacks-collections/SKILL.md +82 -0
- package/ai/skills/stacks-commerce/SKILL.md +114 -0
- package/ai/skills/stacks-composables/SKILL.md +161 -0
- package/ai/skills/stacks-config/SKILL.md +144 -0
- package/ai/skills/stacks-configuration/SKILL.md +154 -0
- package/ai/skills/stacks-cron/SKILL.md +123 -0
- package/ai/skills/stacks-crosswind/SKILL.md +190 -0
- package/ai/skills/stacks-dashboard/SKILL.md +173 -0
- package/ai/skills/stacks-database/SKILL.md +286 -0
- package/ai/skills/stacks-datetime/SKILL.md +269 -0
- package/ai/skills/stacks-dependencies/SKILL.md +111 -0
- package/ai/skills/stacks-deploy/SKILL.md +102 -0
- package/ai/skills/stacks-design-brutalist/SKILL.md +110 -0
- package/ai/skills/stacks-design-minimalist/SKILL.md +115 -0
- package/ai/skills/stacks-design-output/SKILL.md +55 -0
- package/ai/skills/stacks-design-soft/SKILL.md +156 -0
- package/ai/skills/stacks-design-taste/SKILL.md +1012 -0
- package/ai/skills/stacks-design-taste-codex/SKILL.md +294 -0
- package/ai/skills/stacks-desktop/SKILL.md +78 -0
- package/ai/skills/stacks-development/SKILL.md +298 -0
- package/ai/skills/stacks-dns/SKILL.md +149 -0
- package/ai/skills/stacks-docs/SKILL.md +109 -0
- package/ai/skills/stacks-email/SKILL.md +236 -0
- package/ai/skills/stacks-enums/SKILL.md +100 -0
- package/ai/skills/stacks-env/SKILL.md +181 -0
- package/ai/skills/stacks-error-handling/SKILL.md +137 -0
- package/ai/skills/stacks-events/SKILL.md +228 -0
- package/ai/skills/stacks-faker/SKILL.md +158 -0
- package/ai/skills/stacks-git/SKILL.md +158 -0
- package/ai/skills/stacks-guard/SKILL.md +98 -0
- package/ai/skills/stacks-health/SKILL.md +75 -0
- package/ai/skills/stacks-http/SKILL.md +316 -0
- package/ai/skills/stacks-i18n/SKILL.md +198 -0
- package/ai/skills/stacks-image-to-code/SKILL.md +629 -0
- package/ai/skills/stacks-imagegen-mobile/SKILL.md +1474 -0
- package/ai/skills/stacks-imagegen-web/SKILL.md +998 -0
- package/ai/skills/stacks-investigate/SKILL.md +119 -0
- package/ai/skills/stacks-jobs/SKILL.md +136 -0
- package/ai/skills/stacks-lint/SKILL.md +184 -0
- package/ai/skills/stacks-listeners/SKILL.md +99 -0
- package/ai/skills/stacks-logging/SKILL.md +78 -0
- package/ai/skills/stacks-mail/SKILL.md +120 -0
- package/ai/skills/stacks-middleware/SKILL.md +249 -0
- package/ai/skills/stacks-migrations/SKILL.md +105 -0
- package/ai/skills/stacks-models/SKILL.md +267 -0
- package/ai/skills/stacks-new-feature/SKILL.md +206 -0
- package/ai/skills/stacks-notifications/SKILL.md +210 -0
- package/ai/skills/stacks-objects/SKILL.md +205 -0
- package/ai/skills/stacks-office-hours/SKILL.md +134 -0
- package/ai/skills/stacks-orm/SKILL.md +342 -0
- package/ai/skills/stacks-path/SKILL.md +118 -0
- package/ai/skills/stacks-payments/SKILL.md +373 -0
- package/ai/skills/stacks-plan-review/SKILL.md +152 -0
- package/ai/skills/stacks-plugins/SKILL.md +149 -0
- package/ai/skills/stacks-push/SKILL.md +376 -0
- package/ai/skills/stacks-query-builder/SKILL.md +128 -0
- package/ai/skills/stacks-queue/SKILL.md +559 -0
- package/ai/skills/stacks-realtime/SKILL.md +442 -0
- package/ai/skills/stacks-redesign/SKILL.md +182 -0
- package/ai/skills/stacks-registry/SKILL.md +58 -0
- package/ai/skills/stacks-repl/SKILL.md +80 -0
- package/ai/skills/stacks-retro/SKILL.md +122 -0
- package/ai/skills/stacks-review/SKILL.md +135 -0
- package/ai/skills/stacks-router/SKILL.md +231 -0
- package/ai/skills/stacks-routes/SKILL.md +105 -0
- package/ai/skills/stacks-scaffolding/SKILL.md +162 -0
- package/ai/skills/stacks-scheduler/SKILL.md +363 -0
- package/ai/skills/stacks-search-engine/SKILL.md +112 -0
- package/ai/skills/stacks-security/SKILL.md +129 -0
- package/ai/skills/stacks-security-audit/SKILL.md +128 -0
- package/ai/skills/stacks-server/SKILL.md +458 -0
- package/ai/skills/stacks-shell/SKILL.md +62 -0
- package/ai/skills/stacks-slug/SKILL.md +87 -0
- package/ai/skills/stacks-sms/SKILL.md +385 -0
- package/ai/skills/stacks-socials/SKILL.md +303 -0
- package/ai/skills/stacks-storage/SKILL.md +576 -0
- package/ai/skills/stacks-strings/SKILL.md +416 -0
- package/ai/skills/stacks-stx/SKILL.md +176 -0
- package/ai/skills/stacks-technical-diagrams/LICENSE +22 -0
- package/ai/skills/stacks-technical-diagrams/SKILL.md +290 -0
- package/ai/skills/stacks-technical-diagrams/agents/openai.yaml +4 -0
- package/ai/skills/stacks-technical-diagrams/assets/template.html +1252 -0
- package/ai/skills/stacks-technical-diagrams/bin/technical-diagrams.mjs +289 -0
- package/ai/skills/stacks-technical-diagrams/bunfig.toml +1 -0
- package/ai/skills/stacks-technical-diagrams/examples/agent-run.lifecycle.json +64 -0
- package/ai/skills/stacks-technical-diagrams/examples/agent-tool-call.workflow.json +88 -0
- package/ai/skills/stacks-technical-diagrams/examples/cache-miss-request.sequence.json +75 -0
- package/ai/skills/stacks-technical-diagrams/examples/product-analytics.dataflow.json +70 -0
- package/ai/skills/stacks-technical-diagrams/examples/web-app.architecture.json +41 -0
- package/ai/skills/stacks-technical-diagrams/renderers/architecture/grid.mjs +62 -0
- package/ai/skills/stacks-technical-diagrams/renderers/architecture/render-architecture.mjs +371 -0
- package/ai/skills/stacks-technical-diagrams/renderers/dataflow/README.md +82 -0
- package/ai/skills/stacks-technical-diagrams/renderers/dataflow/render-dataflow.mjs +295 -0
- package/ai/skills/stacks-technical-diagrams/renderers/lifecycle/README.md +91 -0
- package/ai/skills/stacks-technical-diagrams/renderers/lifecycle/render-lifecycle.mjs +384 -0
- package/ai/skills/stacks-technical-diagrams/renderers/sequence/README.md +84 -0
- package/ai/skills/stacks-technical-diagrams/renderers/sequence/render-sequence.mjs +257 -0
- package/ai/skills/stacks-technical-diagrams/renderers/shared/cli.mjs +42 -0
- package/ai/skills/stacks-technical-diagrams/renderers/shared/generated-validators.mjs +13 -0
- package/ai/skills/stacks-technical-diagrams/renderers/shared/geometry.mjs +230 -0
- package/ai/skills/stacks-technical-diagrams/renderers/shared/layout-report.mjs +40 -0
- package/ai/skills/stacks-technical-diagrams/renderers/shared/utils.mjs +88 -0
- package/ai/skills/stacks-technical-diagrams/renderers/shared/validator.mjs +40 -0
- package/ai/skills/stacks-technical-diagrams/renderers/workflow/README.md +103 -0
- package/ai/skills/stacks-technical-diagrams/renderers/workflow/render-workflow.mjs +481 -0
- package/ai/skills/stacks-technical-diagrams/schemas/README.md +68 -0
- package/ai/skills/stacks-technical-diagrams/schemas/architecture.schema.json +121 -0
- package/ai/skills/stacks-technical-diagrams/schemas/common.schema.json +43 -0
- package/ai/skills/stacks-technical-diagrams/schemas/dataflow.schema.json +221 -0
- package/ai/skills/stacks-technical-diagrams/schemas/lifecycle.schema.json +241 -0
- package/ai/skills/stacks-technical-diagrams/schemas/sequence.schema.json +186 -0
- package/ai/skills/stacks-technical-diagrams/schemas/workflow.schema.json +332 -0
- package/ai/skills/stacks-technical-diagrams/scripts/check-render-output.mjs +297 -0
- package/ai/skills/stacks-technical-diagrams/scripts/render-examples.mjs +28 -0
- package/ai/skills/stacks-testing/SKILL.md +129 -0
- package/ai/skills/stacks-tunnel/SKILL.md +125 -0
- package/ai/skills/stacks-types/SKILL.md +178 -0
- package/ai/skills/stacks-ui/SKILL.md +246 -0
- package/ai/skills/stacks-utils/SKILL.md +444 -0
- package/ai/skills/stacks-validation/SKILL.md +371 -0
- package/ai/skills/stacks-whois/SKILL.md +315 -0
- package/assets/world-map-data.ts +121 -0
- package/bootstrap.ts +114 -0
- package/docs/api-examples.md +46 -0
- package/docs/index.md +24 -0
- package/docs/markdown-examples.md +87 -0
- package/functions/analytics.ts +97 -0
- package/functions/api.ts +143 -0
- package/functions/auth.ts +208 -0
- package/functions/billing/payments.ts +149 -0
- package/functions/blog.ts +120 -0
- package/functions/cms/categorizables.ts +107 -0
- package/functions/cms/pages.ts +108 -0
- package/functions/cms/posts.ts +100 -0
- package/functions/cms/taggables.ts +102 -0
- package/functions/commerce/coupons.ts +128 -0
- package/functions/commerce/customers.ts +128 -0
- package/functions/commerce/gift-cards.ts +119 -0
- package/functions/commerce/orders.ts +112 -0
- package/functions/commerce/payments.ts +119 -0
- package/functions/commerce/products/categories.ts +123 -0
- package/functions/commerce/products/manufacturers.ts +123 -0
- package/functions/commerce/products/products.ts +123 -0
- package/functions/commerce/products/reviews.ts +123 -0
- package/functions/commerce/products/units.ts +123 -0
- package/functions/commerce/products/variants.ts +123 -0
- package/functions/commerce/shippings/delivery-routes.ts +123 -0
- package/functions/commerce/shippings/digital-deliveries.ts +119 -0
- package/functions/commerce/shippings/drivers.ts +123 -0
- package/functions/commerce/shippings/license-keys.ts +123 -0
- package/functions/commerce/shippings/shipping-methods.ts +123 -0
- package/functions/commerce/shippings/shipping-rates.ts +119 -0
- package/functions/commerce/shippings/shipping-zones.ts +119 -0
- package/functions/commerce/taxes.ts +119 -0
- package/functions/commerce/waitlist/products.ts +123 -0
- package/functions/commerce/waitlist/restaurants.ts +123 -0
- package/functions/craft.ts +107 -0
- package/functions/dashboard.ts +153 -0
- package/functions/inbox.ts +95 -0
- package/functions/jobs.ts +86 -0
- package/functions/monitoring/errors.ts +295 -0
- package/functions/queue.ts +111 -0
- package/functions/realtime/websockets.ts +96 -0
- package/functions/realtime.ts +52 -0
- package/functions/releases.ts +49 -0
- package/functions/search.ts +126 -0
- package/functions/toasts.ts +95 -0
- package/functions/uploads.ts +216 -0
- package/ide/.gitignore +4 -0
- package/ide/cursor/rules/auto-imports.mdc +574 -0
- package/ide/cursor/rules/code-style.mdc +12 -0
- package/ide/cursor/rules/documentation.mdc +9 -0
- package/ide/cursor/rules/error-handling-validation.mdc +11 -0
- package/ide/cursor/rules/key-conventions.mdc +11 -0
- package/ide/cursor/rules/project-structure.mdc +169 -0
- package/ide/cursor/rules/readme.mdc +318 -0
- package/ide/cursor/rules/syntax-formatting.mdc +9 -0
- package/ide/cursor/rules/testing.mdc +10 -0
- package/ide/cursor/rules/typescript.mdc +9 -0
- package/ide/cursor/rules/ui-styling.mdc +0 -0
- package/ide/dictionary.txt +397 -0
- package/ide/jetbrains/.fleet/settings.json +4 -0
- package/ide/jetbrains/.idea/.gitignore +5 -0
- package/ide/jetbrains/.idea/.name +1 -0
- package/ide/jetbrains/.idea/inspectionProfiles/Project_Default.xml +6 -0
- package/ide/jetbrains/.idea/jsLinters/eslint.xml +7 -0
- package/ide/jetbrains/.idea/modules.xml +8 -0
- package/ide/jetbrains/.idea/stacks.iml +22 -0
- package/ide/jetbrains/.idea/vcs.xml +6 -0
- package/ide/jetbrains/.idea/webResources.xml +14 -0
- package/ide/jetbrains/IntelliJ IDEA Global Settings +0 -0
- package/ide/jetbrains/installed.txt +4 -0
- package/ide/jetbrains/options/github-copilot.xml +5 -0
- package/ide/jetbrains/options/nodejs.xml +7 -0
- package/ide/jetbrains/options/templates.xml +124 -0
- package/ide/jetbrains/templates/JavaScript.xml +6 -0
- package/ide/jetbrains/templates/Stacks.xml +8 -0
- package/ide/vscode/.vscode/README.md +23 -0
- package/ide/vscode/.vscode/extensions.json +5 -0
- package/ide/vscode/.vscode/settings.json +176 -0
- package/ide/vscode/.vscode/stacks.code-snippets +181 -0
- package/ide/vscode/LICENSE.md +21 -0
- package/ide/vscode/README.md +36 -0
- package/ide/vscode/logo.png +0 -0
- package/ide/vscode/package.json +79 -0
- package/ide/zed/.zed/settings.json +139 -0
- package/lang/README.md +28 -0
- package/lang/de.yml +14 -0
- package/lang/en.yml +15 -0
- package/package.json +19 -3
- package/project/bootstrap +161 -0
- package/project/buddy +175 -0
- package/project/storage/framework/tsconfig.app.json +50 -0
- package/project/storage/framework/tsconfig.base.json +58 -0
- package/routes/core.ts +78 -0
- package/routes/dashboard-api.ts +233 -0
- package/routes/dashboard.ts +739 -0
- package/routes/email.ts +129 -0
- package/stores/[name].stx +16 -0
- package/stores/git.ts +71 -0
- package/stores/payment.ts +474 -0
- package/stores/queue.ts +43 -0
- package/stores/user.ts +29 -0
- package/stx-components-plugin.ts +25 -0
- package/styles/design-tokens.css +597 -0
- package/types/dashboard.ts +70 -0
- package/types/defaults.ts +438 -0
- package/vcs/github/CODE_OF_CONDUCT.md +83 -0
- package/vcs/github/CONTRIBUTING.md +187 -0
- package/vcs/github/EXPLANATIONS.md +41 -0
- package/vcs/github/FUNDING.yml +1 -0
- package/vcs/github/ISSUE_TEMPLATE/bug_report.yml +49 -0
- package/vcs/github/ISSUE_TEMPLATE/config.yml +10 -0
- package/vcs/github/ISSUE_TEMPLATE/feature_request.yml +44 -0
- package/vcs/github/SECURITY.md +70 -0
- package/vcs/github/renovate.json +5 -0
- package/vcs/github/stale.yml +14 -0
- package/vcs/github/workflows/README.md +16 -0
- package/vcs/github/workflows/ci.yml +114 -0
- package/vcs/github/workflows/export-size.yml +25 -0
- package/vcs/github/workflows/labeler.yml +13 -0
- package/vcs/github/workflows/release.yml +219 -0
- package/views/[...all].stx +8 -0
- package/views/about.md +3 -0
- package/views/auth/login.stx +1 -0
- package/views/auth/signup.stx +85 -0
- package/views/dashboard/.discovered-models.json +542 -0
- package/views/dashboard/AUDIT.md +904 -0
- package/views/dashboard/[...all].stx +89 -0
- package/views/dashboard/access-tokens/index.stx +177 -0
- package/views/dashboard/actions/index.stx +129 -0
- package/views/dashboard/analytics/blog/index.stx +356 -0
- package/views/dashboard/analytics/browsers/index.stx +263 -0
- package/views/dashboard/analytics/commerce/sales/index.stx +329 -0
- package/views/dashboard/analytics/commerce/web/index.stx +379 -0
- package/views/dashboard/analytics/countries/index.stx +289 -0
- package/views/dashboard/analytics/devices/index.stx +305 -0
- package/views/dashboard/analytics/events/index.stx +536 -0
- package/views/dashboard/analytics/index.stx +88 -0
- package/views/dashboard/analytics/marketing/index.stx +315 -0
- package/views/dashboard/analytics/pages/index.stx +271 -0
- package/views/dashboard/analytics/referrers/index.stx +319 -0
- package/views/dashboard/analytics/web/index.stx +356 -0
- package/views/dashboard/buddy/index.stx +198 -0
- package/views/dashboard/ci/index.stx +462 -0
- package/views/dashboard/cloud/index.stx +452 -0
- package/views/dashboard/commands/index.stx +295 -0
- package/views/dashboard/commerce/categories/index.stx +406 -0
- package/views/dashboard/commerce/coupons/index.stx +485 -0
- package/views/dashboard/commerce/customers/index.stx +410 -0
- package/views/dashboard/commerce/dashboard/index.stx +287 -0
- package/views/dashboard/commerce/delivery/delivery-routes.stx +305 -0
- package/views/dashboard/commerce/delivery/digital-delivery.stx +332 -0
- package/views/dashboard/commerce/delivery/drivers.stx +397 -0
- package/views/dashboard/commerce/delivery/index.stx +18 -0
- package/views/dashboard/commerce/delivery/license-keys.stx +380 -0
- package/views/dashboard/commerce/delivery/shipping-methods.stx +346 -0
- package/views/dashboard/commerce/delivery/shipping-rates.stx +338 -0
- package/views/dashboard/commerce/delivery/shipping-zones.stx +302 -0
- package/views/dashboard/commerce/delivery/tabs.ts +25 -0
- package/views/dashboard/commerce/gift-cards/index.stx +561 -0
- package/views/dashboard/commerce/manufacturers/index.stx +308 -0
- package/views/dashboard/commerce/orders/index.stx +247 -0
- package/views/dashboard/commerce/payments/index.stx +535 -0
- package/views/dashboard/commerce/pos/index.stx +653 -0
- package/views/dashboard/commerce/printers/devices/index.stx +273 -0
- package/views/dashboard/commerce/printers/receipts/index.stx +308 -0
- package/views/dashboard/commerce/products/detail.stx +563 -0
- package/views/dashboard/commerce/products/index.stx +370 -0
- package/views/dashboard/commerce/reviews/index.stx +656 -0
- package/views/dashboard/commerce/reviews/index.ts +0 -0
- package/views/dashboard/commerce/taxes/index.stx +377 -0
- package/views/dashboard/commerce/units/index.stx +317 -0
- package/views/dashboard/commerce/variants/index.stx +319 -0
- package/views/dashboard/commerce/waitlist/products.stx +942 -0
- package/views/dashboard/commerce/waitlist/restaurant.stx +1024 -0
- package/views/dashboard/components/index.stx +330 -0
- package/views/dashboard/composables/index.ts +19 -0
- package/views/dashboard/composables/useChart.ts +77 -0
- package/views/dashboard/composables/useNavigation.ts +99 -0
- package/views/dashboard/composables/useRole.ts +58 -0
- package/views/dashboard/composables/useTheme.ts +74 -0
- package/views/dashboard/content/authors/index.stx +171 -0
- package/views/dashboard/content/blog/index.stx +493 -0
- package/views/dashboard/content/categories/index.stx +169 -0
- package/views/dashboard/content/comments/index.stx +189 -0
- package/views/dashboard/content/dashboard.stx +383 -0
- package/views/dashboard/content/files/index.stx +706 -0
- package/views/dashboard/content/pages/index.stx +174 -0
- package/views/dashboard/content/posts/index.stx +269 -0
- package/views/dashboard/content/seo/index.stx +240 -0
- package/views/dashboard/content/tags/index.stx +167 -0
- package/views/dashboard/data/activity/index.stx +261 -0
- package/views/dashboard/data/dashboard/index.stx +116 -0
- package/views/dashboard/data/subscribers.stx +270 -0
- package/views/dashboard/data/teams.stx +275 -0
- package/views/dashboard/data/users.stx +279 -0
- package/views/dashboard/dependencies/index.stx +178 -0
- package/views/dashboard/deployments/[id].stx +234 -0
- package/views/dashboard/deployments/index.stx +9 -0
- package/views/dashboard/dns/index.stx +163 -0
- package/views/dashboard/environment/index.stx +283 -0
- package/views/dashboard/errors/index.stx +274 -0
- package/views/dashboard/forgot-password.stx +57 -0
- package/views/dashboard/functions/index.stx +159 -0
- package/views/dashboard/health/index.stx +248 -0
- package/views/dashboard/inbox/activity.stx +350 -0
- package/views/dashboard/inbox/index.stx +452 -0
- package/views/dashboard/inbox/settings.stx +290 -0
- package/views/dashboard/index.stx +252 -0
- package/views/dashboard/insights/index.stx +529 -0
- package/views/dashboard/jobs/[id].stx +430 -0
- package/views/dashboard/jobs/history.stx +222 -0
- package/views/dashboard/jobs/index.stx +214 -0
- package/views/dashboard/kanban/[id].stx +899 -0
- package/views/dashboard/kanban/index.stx +260 -0
- package/views/dashboard/layouts/default.stx +565 -0
- package/views/dashboard/layouts/guest.stx +10 -0
- package/views/dashboard/login.stx +48 -0
- package/views/dashboard/logs/index.stx +540 -0
- package/views/dashboard/mailboxes/index.stx +149 -0
- package/views/dashboard/management/permissions/index.stx +490 -0
- package/views/dashboard/marketing/campaigns/index.stx +604 -0
- package/views/dashboard/marketing/lists/index.stx +514 -0
- package/views/dashboard/marketing/reviews/index.stx +475 -0
- package/views/dashboard/marketing/social-posts/index.stx +560 -0
- package/views/dashboard/models/[model].stx +195 -0
- package/views/dashboard/models/index.stx +159 -0
- package/views/dashboard/monitoring/errors/index.stx +415 -0
- package/views/dashboard/notifications/dashboard.stx +383 -0
- package/views/dashboard/notifications/email.stx +336 -0
- package/views/dashboard/notifications/history.stx +373 -0
- package/views/dashboard/notifications/sms.stx +332 -0
- package/views/dashboard/packages/index.stx +195 -0
- package/views/dashboard/queries/[id].stx +381 -0
- package/views/dashboard/queries/history.stx +227 -0
- package/views/dashboard/queries/index.stx +335 -0
- package/views/dashboard/queries/slow.stx +318 -0
- package/views/dashboard/queue/index.stx +427 -0
- package/views/dashboard/realtime/index.stx +429 -0
- package/views/dashboard/register.stx +46 -0
- package/views/dashboard/releases/index.stx +389 -0
- package/views/dashboard/requests/index.stx +462 -0
- package/views/dashboard/serverless/index.stx +475 -0
- package/views/dashboard/servers/[id].stx +299 -0
- package/views/dashboard/servers/index.stx +483 -0
- package/views/dashboard/settings/billing.stx +50 -0
- package/views/dashboard/settings/index.stx +256 -0
- package/views/dashboard/settings/mail.stx +252 -0
- package/views/dashboard/stores/auth.ts +123 -0
- package/views/dashboard/stores/ci.ts +342 -0
- package/views/dashboard/stores/index.ts +129 -0
- package/views/dashboard/stores/kanban.ts +723 -0
- package/views/dashboard/stores/rbac.ts +350 -0
- package/views/dashboard/stx.config.ts +34 -0
- package/views/dashboard/teams/[id].stx +170 -0
- package/views/forum/category.stx +92 -0
- package/views/forum/index.stx +209 -0
- package/views/forum/new-topic.stx +113 -0
- package/views/forum/profile.stx +1 -0
- package/views/forum/topic.stx +143 -0
- package/views/hello-world/[name].stx +47 -0
- package/views/index.stx +21 -0
- package/views/system-tray/index.stx +147 -0
|
@@ -0,0 +1,342 @@
|
|
|
1
|
+
import { defineStore, derived, registerStoresClient, state } from '@stacksjs/stx'
|
|
2
|
+
|
|
3
|
+
interface FailedJob {
|
|
4
|
+
name: string
|
|
5
|
+
conclusion: string
|
|
6
|
+
url: string
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
interface RepoStatus {
|
|
10
|
+
name: string
|
|
11
|
+
owner: string
|
|
12
|
+
fullName: string
|
|
13
|
+
url: string
|
|
14
|
+
defaultBranch: string
|
|
15
|
+
status: 'success' | 'failure' | 'pending' | 'no_runs' | 'error'
|
|
16
|
+
conclusion: string | null
|
|
17
|
+
workflowName: string | null
|
|
18
|
+
commitSha: string | null
|
|
19
|
+
commitMessage: string | null
|
|
20
|
+
commitUrl: string | null
|
|
21
|
+
commitAuthor: string | null
|
|
22
|
+
commitCount: number | null
|
|
23
|
+
updatedAt: string | null
|
|
24
|
+
runUrl: string | null
|
|
25
|
+
failedJobs: FailedJob[]
|
|
26
|
+
renovatePRs: number
|
|
27
|
+
renovatePRsUrl: string | null
|
|
28
|
+
actionsPRs: number
|
|
29
|
+
actionsPRsUrl: string | null
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
interface OrgRunnerUsage {
|
|
33
|
+
running: number
|
|
34
|
+
queued: number
|
|
35
|
+
cap: number
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
type StatusFilter = 'all' | 'passing' | 'failing' | 'pending'
|
|
39
|
+
|
|
40
|
+
// Drilldown shapes (stacksjs/stacks#1848). Mirror the @stacksjs/github
|
|
41
|
+
// `WorkflowRun` / `WorkflowJob` typings without the strict GH-conclusion
|
|
42
|
+
// union (lets unknown future conclusion strings flow through without
|
|
43
|
+
// breaking the type).
|
|
44
|
+
interface WorkflowRun {
|
|
45
|
+
id: number
|
|
46
|
+
status: string
|
|
47
|
+
conclusion: string | null
|
|
48
|
+
name: string
|
|
49
|
+
headBranch: string | null
|
|
50
|
+
headSha: string
|
|
51
|
+
headShaShort: string
|
|
52
|
+
commitMessage: string | null
|
|
53
|
+
commitAuthor: string | null
|
|
54
|
+
event: string
|
|
55
|
+
url: string
|
|
56
|
+
startedAt: string | null
|
|
57
|
+
updatedAt: string
|
|
58
|
+
durationMs: number | null
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
interface WorkflowJobStep { name: string, status: string, conclusion: string | null, number: number }
|
|
62
|
+
|
|
63
|
+
interface WorkflowJob {
|
|
64
|
+
id: number
|
|
65
|
+
name: string
|
|
66
|
+
status: string
|
|
67
|
+
conclusion: string | null
|
|
68
|
+
startedAt: string | null
|
|
69
|
+
completedAt: string | null
|
|
70
|
+
durationMs: number | null
|
|
71
|
+
url: string
|
|
72
|
+
steps: WorkflowJobStep[]
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/** The repo currently open in the drilldown drawer. `null` = closed. */
|
|
76
|
+
interface DrilldownTarget { owner: string, name: string, fullName: string }
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* CI tracking store — backs `dashboard/ci/index.stx` (stacksjs/stacks#1844).
|
|
80
|
+
* Fetches the aggregated snapshot from `/api/dashboard/ci/status` (Action:
|
|
81
|
+
* `Dashboard/Ci/StatusAction`) and exposes the slice the page needs:
|
|
82
|
+
* - Reactive list of repos for the current org tab + status filter.
|
|
83
|
+
* - Per-org aggregates (passing/failing/total) for the tab strip.
|
|
84
|
+
* - Per-org runner-usage for the runner-pressure line.
|
|
85
|
+
* Active tab + filter persist across SPA nav so a click into a repo and
|
|
86
|
+
* back doesn't reset the user's view.
|
|
87
|
+
*/
|
|
88
|
+
export const ciStore = defineStore('ci', () => {
|
|
89
|
+
const allRepos = state<RepoStatus[]>([])
|
|
90
|
+
const runners = state<Record<string, OrgRunnerUsage>>({})
|
|
91
|
+
const orgs = state<string[]>([])
|
|
92
|
+
const loading = state(true)
|
|
93
|
+
const error = state('')
|
|
94
|
+
const disabled = state(false)
|
|
95
|
+
const lastFetched = state<string | null>(null)
|
|
96
|
+
|
|
97
|
+
const activeTab = state<string>('')
|
|
98
|
+
const statusFilter = state<StatusFilter>('all')
|
|
99
|
+
|
|
100
|
+
// ─── Drilldown state (stacksjs/stacks#1848) ─────────────────────
|
|
101
|
+
const drilldown = state<DrilldownTarget | null>(null)
|
|
102
|
+
const drilldownRuns = state<WorkflowRun[]>([])
|
|
103
|
+
const loadingDrilldown = state(false)
|
|
104
|
+
const drilldownError = state<string | null>(null)
|
|
105
|
+
// Per-run job detail, keyed by run id. Lazy-loaded when the user
|
|
106
|
+
// expands a row. Once fetched, cached for the duration of the
|
|
107
|
+
// drawer so re-expanding doesn't re-fetch.
|
|
108
|
+
const drilldownJobsByRunId = state<Record<number, WorkflowJob[]>>({})
|
|
109
|
+
const loadingJobsForRunId = state<number | null>(null)
|
|
110
|
+
const expandedRunId = state<number | null>(null)
|
|
111
|
+
|
|
112
|
+
// ─── Runner pressure history (stacksjs/stacks#1850) ─────────────
|
|
113
|
+
// Per-org sample history for the sparkline under the runner line.
|
|
114
|
+
// Lazy-loaded on first view of an org's tab.
|
|
115
|
+
const runnerHistoryByOrg = state<Record<string, Array<{ queued: number, sampledAt: string }>>>({})
|
|
116
|
+
const loadingRunnerHistory = state<Record<string, boolean>>({})
|
|
117
|
+
|
|
118
|
+
const reposForTab = derived(() => {
|
|
119
|
+
const tab = activeTab()
|
|
120
|
+
const filter = statusFilter()
|
|
121
|
+
let list = allRepos().filter(r => r.owner === tab)
|
|
122
|
+
if (filter === 'passing')
|
|
123
|
+
list = list.filter(r => r.status === 'success')
|
|
124
|
+
else if (filter === 'failing')
|
|
125
|
+
list = list.filter(r => r.status === 'failure' || r.status === 'error')
|
|
126
|
+
else if (filter === 'pending')
|
|
127
|
+
list = list.filter(r => r.status === 'pending')
|
|
128
|
+
return list
|
|
129
|
+
})
|
|
130
|
+
|
|
131
|
+
const tabTotals = derived(() => {
|
|
132
|
+
const tab = activeTab()
|
|
133
|
+
const list = allRepos().filter(r => r.owner === tab)
|
|
134
|
+
return {
|
|
135
|
+
total: list.length,
|
|
136
|
+
passing: list.filter(r => r.status === 'success').length,
|
|
137
|
+
failing: list.filter(r => r.status === 'failure' || r.status === 'error').length,
|
|
138
|
+
pending: list.filter(r => r.status === 'pending').length,
|
|
139
|
+
}
|
|
140
|
+
})
|
|
141
|
+
|
|
142
|
+
const tabRunners = derived(() => runners()[activeTab()] ?? { running: 0, queued: 0, cap: 0 })
|
|
143
|
+
|
|
144
|
+
async function load(): Promise<void> {
|
|
145
|
+
loading.set(true)
|
|
146
|
+
error.set('')
|
|
147
|
+
try {
|
|
148
|
+
const res = await fetch('/api/dashboard/ci/status', { headers: { accept: 'application/json' } })
|
|
149
|
+
if (!res.ok)
|
|
150
|
+
throw new Error(`HTTP ${res.status}`)
|
|
151
|
+
const data = await res.json() as {
|
|
152
|
+
repos: RepoStatus[]
|
|
153
|
+
runners: Record<string, OrgRunnerUsage>
|
|
154
|
+
fetchedAt: string
|
|
155
|
+
disabled?: boolean
|
|
156
|
+
error?: string
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
if (data.disabled) {
|
|
160
|
+
disabled.set(true)
|
|
161
|
+
allRepos.set([])
|
|
162
|
+
runners.set({})
|
|
163
|
+
return
|
|
164
|
+
}
|
|
165
|
+
if (data.error) {
|
|
166
|
+
error.set(data.error)
|
|
167
|
+
return
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
allRepos.set(data.repos ?? [])
|
|
171
|
+
runners.set(data.runners ?? {})
|
|
172
|
+
lastFetched.set(data.fetchedAt ?? new Date().toISOString())
|
|
173
|
+
|
|
174
|
+
// Derive orgs from the runners map (server-authoritative) and
|
|
175
|
+
// default the active tab to the first org so the page renders
|
|
176
|
+
// something useful on first load. Preserve an existing selection
|
|
177
|
+
// if it's still valid after a refresh.
|
|
178
|
+
const nextOrgs = Object.keys(data.runners ?? {})
|
|
179
|
+
orgs.set(nextOrgs)
|
|
180
|
+
if (!nextOrgs.includes(activeTab()) && nextOrgs.length > 0)
|
|
181
|
+
activeTab.set(nextOrgs[0])
|
|
182
|
+
}
|
|
183
|
+
catch (e) {
|
|
184
|
+
error.set(e instanceof Error ? e.message : String(e))
|
|
185
|
+
}
|
|
186
|
+
finally {
|
|
187
|
+
loading.set(false)
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
function setActiveTab(id: string): void {
|
|
192
|
+
activeTab.set(id)
|
|
193
|
+
}
|
|
194
|
+
function setStatusFilter(filter: StatusFilter): void {
|
|
195
|
+
statusFilter.set(filter)
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
// ─── Drilldown actions ──────────────────────────────────────────
|
|
199
|
+
|
|
200
|
+
async function openDrilldown(repo: { owner: string, name: string, fullName: string }): Promise<void> {
|
|
201
|
+
drilldown.set({ owner: repo.owner, name: repo.name, fullName: repo.fullName })
|
|
202
|
+
drilldownRuns.set([])
|
|
203
|
+
drilldownJobsByRunId.set({})
|
|
204
|
+
expandedRunId.set(null)
|
|
205
|
+
drilldownError.set(null)
|
|
206
|
+
loadingDrilldown.set(true)
|
|
207
|
+
try {
|
|
208
|
+
const res = await fetch(`/api/dashboard/ci/repos/${encodeURIComponent(repo.owner)}/${encodeURIComponent(repo.name)}/runs?limit=20`, { headers: { accept: 'application/json' } })
|
|
209
|
+
if (!res.ok) throw new Error(`HTTP ${res.status}`)
|
|
210
|
+
const data = await res.json() as { runs?: WorkflowRun[], error?: string, disabled?: boolean }
|
|
211
|
+
if (data.error)
|
|
212
|
+
throw new Error(data.error)
|
|
213
|
+
drilldownRuns.set(data.runs ?? [])
|
|
214
|
+
}
|
|
215
|
+
catch (e) {
|
|
216
|
+
drilldownError.set(e instanceof Error ? e.message : String(e))
|
|
217
|
+
}
|
|
218
|
+
finally {
|
|
219
|
+
loadingDrilldown.set(false)
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
function closeDrilldown(): void {
|
|
224
|
+
drilldown.set(null)
|
|
225
|
+
drilldownRuns.set([])
|
|
226
|
+
drilldownJobsByRunId.set({})
|
|
227
|
+
expandedRunId.set(null)
|
|
228
|
+
drilldownError.set(null)
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
async function loadRunnerHistory(org: string): Promise<void> {
|
|
232
|
+
// Already loaded? Don't re-fetch — runner samples have a 30s
|
|
233
|
+
// refresh cadence anyway. If the user wants a fresh view they
|
|
234
|
+
// can reload the page.
|
|
235
|
+
if (runnerHistoryByOrg()[org] !== undefined) return
|
|
236
|
+
if (loadingRunnerHistory()[org]) return
|
|
237
|
+
|
|
238
|
+
loadingRunnerHistory.set({ ...loadingRunnerHistory(), [org]: true })
|
|
239
|
+
try {
|
|
240
|
+
const res = await fetch(`/api/dashboard/ci/runner-history?org=${encodeURIComponent(org)}`, {
|
|
241
|
+
headers: { accept: 'application/json' },
|
|
242
|
+
})
|
|
243
|
+
if (!res.ok) throw new Error(`HTTP ${res.status}`)
|
|
244
|
+
const data = await res.json() as { samples?: Array<{ queued: number, sampledAt: string }>, error?: string, disabled?: boolean }
|
|
245
|
+
if (data.disabled || data.error) {
|
|
246
|
+
runnerHistoryByOrg.set({ ...runnerHistoryByOrg(), [org]: [] })
|
|
247
|
+
return
|
|
248
|
+
}
|
|
249
|
+
runnerHistoryByOrg.set({
|
|
250
|
+
...runnerHistoryByOrg(),
|
|
251
|
+
[org]: (data.samples ?? []).map(s => ({ queued: s.queued, sampledAt: s.sampledAt })),
|
|
252
|
+
})
|
|
253
|
+
}
|
|
254
|
+
catch {
|
|
255
|
+
// Soft-fail — sparkline renders nothing, no need to surface
|
|
256
|
+
// the error in the main CI page.
|
|
257
|
+
runnerHistoryByOrg.set({ ...runnerHistoryByOrg(), [org]: [] })
|
|
258
|
+
}
|
|
259
|
+
finally {
|
|
260
|
+
loadingRunnerHistory.set({ ...loadingRunnerHistory(), [org]: false })
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
async function toggleRunJobs(runId: number): Promise<void> {
|
|
265
|
+
// Click-the-same-row-twice collapses it.
|
|
266
|
+
if (expandedRunId() === runId) {
|
|
267
|
+
expandedRunId.set(null)
|
|
268
|
+
return
|
|
269
|
+
}
|
|
270
|
+
expandedRunId.set(runId)
|
|
271
|
+
|
|
272
|
+
// Already cached? Don't re-fetch.
|
|
273
|
+
if (drilldownJobsByRunId()[runId])
|
|
274
|
+
return
|
|
275
|
+
|
|
276
|
+
const target = drilldown()
|
|
277
|
+
if (!target) return
|
|
278
|
+
|
|
279
|
+
loadingJobsForRunId.set(runId)
|
|
280
|
+
try {
|
|
281
|
+
const res = await fetch(`/api/dashboard/ci/repos/${encodeURIComponent(target.owner)}/${encodeURIComponent(target.name)}/runs/${runId}/jobs`, { headers: { accept: 'application/json' } })
|
|
282
|
+
if (!res.ok) throw new Error(`HTTP ${res.status}`)
|
|
283
|
+
const data = await res.json() as { jobs?: WorkflowJob[], error?: string }
|
|
284
|
+
if (data.error)
|
|
285
|
+
throw new Error(data.error)
|
|
286
|
+
drilldownJobsByRunId.set({ ...drilldownJobsByRunId(), [runId]: data.jobs ?? [] })
|
|
287
|
+
}
|
|
288
|
+
catch (e) {
|
|
289
|
+
// Set empty list on error so the row shows "no jobs" rather
|
|
290
|
+
// than spinning forever. The outer drawer error surface picks
|
|
291
|
+
// up the failure message instead.
|
|
292
|
+
drilldownJobsByRunId.set({ ...drilldownJobsByRunId(), [runId]: [] })
|
|
293
|
+
drilldownError.set(e instanceof Error ? e.message : String(e))
|
|
294
|
+
}
|
|
295
|
+
finally {
|
|
296
|
+
if (loadingJobsForRunId() === runId)
|
|
297
|
+
loadingJobsForRunId.set(null)
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
return {
|
|
302
|
+
allRepos,
|
|
303
|
+
runners,
|
|
304
|
+
orgs,
|
|
305
|
+
loading,
|
|
306
|
+
error,
|
|
307
|
+
disabled,
|
|
308
|
+
lastFetched,
|
|
309
|
+
activeTab,
|
|
310
|
+
statusFilter,
|
|
311
|
+
reposForTab,
|
|
312
|
+
tabTotals,
|
|
313
|
+
tabRunners,
|
|
314
|
+
load,
|
|
315
|
+
setActiveTab,
|
|
316
|
+
setStatusFilter,
|
|
317
|
+
// Drilldown (#1848)
|
|
318
|
+
drilldown,
|
|
319
|
+
drilldownRuns,
|
|
320
|
+
loadingDrilldown,
|
|
321
|
+
drilldownError,
|
|
322
|
+
drilldownJobsByRunId,
|
|
323
|
+
loadingJobsForRunId,
|
|
324
|
+
expandedRunId,
|
|
325
|
+
openDrilldown,
|
|
326
|
+
closeDrilldown,
|
|
327
|
+
toggleRunJobs,
|
|
328
|
+
// Runner-pressure history (#1850)
|
|
329
|
+
runnerHistoryByOrg,
|
|
330
|
+
loadingRunnerHistory,
|
|
331
|
+
loadRunnerHistory,
|
|
332
|
+
}
|
|
333
|
+
}, {
|
|
334
|
+
persist: {
|
|
335
|
+
storage: 'sessionStorage',
|
|
336
|
+
key: 'stacks-dashboard-ci',
|
|
337
|
+
pick: ['activeTab', 'statusFilter'],
|
|
338
|
+
},
|
|
339
|
+
})
|
|
340
|
+
|
|
341
|
+
if (typeof window !== 'undefined')
|
|
342
|
+
registerStoresClient({ ciStore })
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
import { defineStore, derived, registerStoresClient, state } from '@stacksjs/stx'
|
|
2
|
+
import { isDarkTheme, useTheme } from '../composables/useTheme'
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Dashboard Store — shared state across all dashboard pages.
|
|
6
|
+
* Persists sidebar state and user preferences across SPA navigation.
|
|
7
|
+
*
|
|
8
|
+
* Setup-function style (recommended in stx 0.2.x). Each piece of state
|
|
9
|
+
* is a signal; derived values use `derived(() => …)`; actions are plain
|
|
10
|
+
* functions. The store object returned at the bottom is what consumers
|
|
11
|
+
* see when they import `dashboardStore` or call `useStore('dashboard')`.
|
|
12
|
+
*/
|
|
13
|
+
export const dashboardStore = defineStore('dashboard', () => {
|
|
14
|
+
const currentPage = state('home')
|
|
15
|
+
const sidebarCollapsed = state(false)
|
|
16
|
+
const searchQuery = state('')
|
|
17
|
+
const timeRange = state('7d')
|
|
18
|
+
const notifications = state<Array<{ id: string, title: string, type: string, read: boolean }>>([])
|
|
19
|
+
const theme = state<'light' | 'dark' | 'system'>('system')
|
|
20
|
+
|
|
21
|
+
const unreadCount = derived(() => notifications().filter(n => !n.read).length)
|
|
22
|
+
|
|
23
|
+
// OS dark-mode preference now lives in `useTheme()` (stacksjs/stacks#1838)
|
|
24
|
+
// — the store no longer reaches into `window.matchMedia` directly. The
|
|
25
|
+
// composable installs a single listener at module load and exposes the
|
|
26
|
+
// signal so this derived re-runs when the OS flips theme.
|
|
27
|
+
const { prefersDark } = useTheme()
|
|
28
|
+
|
|
29
|
+
const isDark = derived(() => isDarkTheme(theme(), prefersDark()))
|
|
30
|
+
|
|
31
|
+
function navigate(pageId: string): void {
|
|
32
|
+
currentPage.set(pageId)
|
|
33
|
+
}
|
|
34
|
+
function toggleSidebar(): void {
|
|
35
|
+
sidebarCollapsed.set(!sidebarCollapsed())
|
|
36
|
+
}
|
|
37
|
+
function setSearchQuery(query: string): void {
|
|
38
|
+
searchQuery.set(query)
|
|
39
|
+
}
|
|
40
|
+
function setTimeRange(range: string): void {
|
|
41
|
+
timeRange.set(range)
|
|
42
|
+
}
|
|
43
|
+
function setTheme(next: 'light' | 'dark' | 'system'): void {
|
|
44
|
+
theme.set(next)
|
|
45
|
+
}
|
|
46
|
+
function markNotificationRead(id: string): void {
|
|
47
|
+
notifications.update(list => list.map(n => n.id === id ? { ...n, read: true } : n))
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
return {
|
|
51
|
+
currentPage,
|
|
52
|
+
sidebarCollapsed,
|
|
53
|
+
searchQuery,
|
|
54
|
+
timeRange,
|
|
55
|
+
notifications,
|
|
56
|
+
theme,
|
|
57
|
+
unreadCount,
|
|
58
|
+
isDark,
|
|
59
|
+
navigate,
|
|
60
|
+
toggleSidebar,
|
|
61
|
+
setSearchQuery,
|
|
62
|
+
setTimeRange,
|
|
63
|
+
setTheme,
|
|
64
|
+
markNotificationRead,
|
|
65
|
+
}
|
|
66
|
+
}, {
|
|
67
|
+
persist: {
|
|
68
|
+
storage: 'localStorage',
|
|
69
|
+
key: 'stacks-dashboard',
|
|
70
|
+
pick: ['sidebarCollapsed', 'timeRange', 'theme'],
|
|
71
|
+
},
|
|
72
|
+
})
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* Stats Store — dashboard overview data.
|
|
76
|
+
* Loaded server-side, refreshable from client.
|
|
77
|
+
*/
|
|
78
|
+
export const statsStore = defineStore('stats', () => {
|
|
79
|
+
const stats = state<Array<{ title: string, value: string, trend: number, trendLabel: string, icon: string }>>([])
|
|
80
|
+
const systemHealth = state<Array<{ name: string, status: string, latency: string, uptime: string }>>([])
|
|
81
|
+
const recentActivity = state<Array<{ type: string, title: string, time: string, status: string }>>([])
|
|
82
|
+
const isLoading = state(false)
|
|
83
|
+
const lastFetched = state<string | null>(null)
|
|
84
|
+
|
|
85
|
+
const healthyServices = derived(() => systemHealth().filter(s => s.status === 'healthy').length)
|
|
86
|
+
const totalServices = derived(() => systemHealth().length)
|
|
87
|
+
const hasErrors = derived(() => recentActivity().some(a => a.status === 'error'))
|
|
88
|
+
|
|
89
|
+
async function refresh(): Promise<void> {
|
|
90
|
+
isLoading.set(true)
|
|
91
|
+
try {
|
|
92
|
+
const res = await fetch('/api/dashboard/stats')
|
|
93
|
+
if (res.ok) {
|
|
94
|
+
const data = await res.json()
|
|
95
|
+
if (data.stats) stats.set(data.stats)
|
|
96
|
+
if (data.systemHealth) systemHealth.set(data.systemHealth)
|
|
97
|
+
if (data.recentActivity) recentActivity.set(data.recentActivity)
|
|
98
|
+
lastFetched.set(new Date().toISOString())
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
catch {
|
|
102
|
+
// API may not be available — keep existing data
|
|
103
|
+
}
|
|
104
|
+
finally {
|
|
105
|
+
isLoading.set(false)
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
return {
|
|
110
|
+
stats,
|
|
111
|
+
systemHealth,
|
|
112
|
+
recentActivity,
|
|
113
|
+
isLoading,
|
|
114
|
+
lastFetched,
|
|
115
|
+
healthyServices,
|
|
116
|
+
totalServices,
|
|
117
|
+
hasErrors,
|
|
118
|
+
refresh,
|
|
119
|
+
}
|
|
120
|
+
}, {
|
|
121
|
+
persist: {
|
|
122
|
+
storage: 'sessionStorage',
|
|
123
|
+
key: 'stacks-dashboard-stats',
|
|
124
|
+
},
|
|
125
|
+
})
|
|
126
|
+
|
|
127
|
+
// Register stores for client-side `@stores` imports.
|
|
128
|
+
if (typeof window !== 'undefined')
|
|
129
|
+
registerStoresClient({ dashboardStore, statsStore })
|