@stacksjs/defaults 0.70.354 → 0.70.356
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/ai/skills/stacks-browse/SKILL.md +17 -2
- package/ai/skills/stacks-browse/scripts/browse.ts +207 -6
- package/ai/skills/stacks-email/SKILL.md +73 -16
- package/app/Actions/ContactAction.ts +2 -2
- package/app/Actions/Dashboard/Analytics/EventAnalyticsAction.ts +2 -3
- package/app/Actions/Dashboard/Analytics/MarketingAnalyticsAction.ts +2 -3
- package/app/Actions/Dashboard/Analytics/SalesAnalyticsAction.ts +2 -3
- package/app/Actions/Dashboard/Analytics/WebAnalyticsAction.ts +9 -3
- package/app/Actions/Dashboard/Auth/MeAction.ts +12 -14
- package/app/Actions/Dashboard/Buddy/BuddyChatAction.ts +2 -3
- package/app/Actions/Dashboard/Ci/RepoRunJobsAction.ts +10 -15
- package/app/Actions/Dashboard/Ci/RepoRunsAction.ts +12 -14
- package/app/Actions/Dashboard/Ci/RunnerHistoryAction.ts +11 -10
- package/app/Actions/Dashboard/Ci/StatusAction.ts +2 -11
- package/app/Actions/Dashboard/Cloud/CloudIndexAction.ts +8 -1
- package/app/Actions/Dashboard/Cloud/ServerlessIndexAction.ts +15 -8
- package/app/Actions/Dashboard/Commerce/CommerceCategoriesAction.ts +2 -4
- package/app/Actions/Dashboard/Commerce/CommerceCouponsAction.ts +2 -4
- package/app/Actions/Dashboard/Commerce/CommerceCustomersAction.ts +2 -4
- package/app/Actions/Dashboard/Commerce/CommerceDashboardAction.ts +2 -4
- package/app/Actions/Dashboard/Commerce/CommerceDeliveryAction.ts +2 -4
- package/app/Actions/Dashboard/Commerce/CommerceGiftCardsAction.ts +2 -4
- package/app/Actions/Dashboard/Commerce/CommerceOrdersAction.ts +2 -4
- package/app/Actions/Dashboard/Commerce/CommercePaymentsAction.ts +2 -4
- package/app/Actions/Dashboard/Commerce/CommercePosAction.ts +2 -4
- package/app/Actions/Dashboard/Commerce/CommercePosCheckoutAction.ts +76 -61
- package/app/Actions/Dashboard/Commerce/CommercePrintDevicesAction.ts +2 -4
- package/app/Actions/Dashboard/Commerce/CommercePrintLogsAction.ts +4 -7
- package/app/Actions/Dashboard/Commerce/CommerceProductDetailAction.ts +4 -4
- package/app/Actions/Dashboard/Commerce/CommerceProductsAction.ts +2 -4
- package/app/Actions/Dashboard/Commerce/CommerceTaxesAction.ts +2 -4
- package/app/Actions/Dashboard/Commerce/DeliveryRouteIndexAction.ts +2 -4
- package/app/Actions/Dashboard/Commerce/DigitalDeliveryIndexAction.ts +2 -4
- package/app/Actions/Dashboard/Commerce/DriverIndexAction.ts +2 -4
- package/app/Actions/Dashboard/Commerce/LicenseKeyIndexAction.ts +2 -4
- package/app/Actions/Dashboard/Commerce/LicenseKeyOptionsAction.ts +2 -4
- package/app/Actions/Dashboard/Commerce/ManufacturerIndexAction.ts +2 -4
- package/app/Actions/Dashboard/Commerce/PaymentRefundAction.ts +1 -0
- package/app/Actions/Dashboard/Commerce/ProductUnitDefaultAction.ts +1 -0
- package/app/Actions/Dashboard/Commerce/ProductUnitIndexAction.ts +2 -4
- package/app/Actions/Dashboard/Commerce/ProductVariantIndexAction.ts +2 -4
- package/app/Actions/Dashboard/Commerce/ProductWaitlistIndexAction.ts +2 -4
- package/app/Actions/Dashboard/Commerce/RestaurantWaitlistIndexAction.ts +2 -4
- package/app/Actions/Dashboard/Commerce/ReviewIndexAction.ts +2 -4
- package/app/Actions/Dashboard/Commerce/ShippingMethodIndexAction.ts +2 -4
- package/app/Actions/Dashboard/Commerce/ShippingRateIndexAction.ts +2 -4
- package/app/Actions/Dashboard/Commerce/ShippingZoneIndexAction.ts +2 -4
- package/app/Actions/Dashboard/Commerce/TaxRateDefaultAction.ts +1 -0
- package/app/Actions/Dashboard/DashboardActivityAction.ts +2 -5
- package/app/Actions/Dashboard/Data/ActivityIndexAction.ts +2 -5
- package/app/Actions/Dashboard/Data/SubscriberIndexAction.ts +2 -5
- package/app/Actions/Dashboard/Data/TeamIndexAction.ts +2 -5
- package/app/Actions/Dashboard/Data/UserIndexAction.ts +2 -5
- package/app/Actions/Dashboard/Deployments/CreateDeployment.ts +26 -21
- package/app/Actions/Dashboard/Deployments/GetAverageDeploymentTime.ts +8 -2
- package/app/Actions/Dashboard/Deployments/GetDeployScript.ts +3 -6
- package/app/Actions/Dashboard/Deployments/GetDeployment.ts +5 -5
- package/app/Actions/Dashboard/Deployments/GetDeploymentCount.ts +7 -1
- package/app/Actions/Dashboard/Deployments/GetDeploymentLiveTerminalOutput.ts +10 -9
- package/app/Actions/Dashboard/Deployments/GetDeployments.ts +2 -4
- package/app/Actions/Dashboard/Deployments/GetRecentDeployments.ts +8 -2
- package/app/Actions/Dashboard/Deployments/UpdateDeployScript.ts +21 -7
- package/app/Actions/Dashboard/Email/CapturedMailIndexAction.ts +2 -4
- package/app/Actions/Dashboard/Email/CapturedMailShowAction.ts +3 -4
- package/app/Actions/Dashboard/Email/InboxActivityAction.ts +28 -16
- package/app/Actions/Dashboard/Email/InboxAttachmentDownloadAction.ts +45 -0
- package/app/Actions/Dashboard/Email/InboxDeleteAction.ts +11 -6
- package/app/Actions/Dashboard/Email/InboxIndexAction.ts +5 -7
- package/app/Actions/Dashboard/Email/InboxMarkReadAction.ts +11 -6
- package/app/Actions/Dashboard/Email/InboxMarkUnreadAction.ts +11 -6
- package/app/Actions/Dashboard/Email/InboxPreferenceShowAction.ts +10 -4
- package/app/Actions/Dashboard/Email/InboxPreferenceUpdateAction.ts +8 -9
- package/app/Actions/Dashboard/Email/InboxShowAction.ts +7 -7
- package/app/Actions/Dashboard/Email/InboxStatsAction.ts +5 -7
- package/app/Actions/Dashboard/Email/inbox-request.ts +33 -0
- package/app/Actions/Dashboard/Infrastructure/InsightsAction.ts +15 -14
- package/app/Actions/Dashboard/Infrastructure/LogIndexAction.ts +4 -11
- package/app/Actions/Dashboard/Infrastructure/ServerShowAction.ts +3 -6
- package/app/Actions/Dashboard/Jobs/JobIndexAction.ts +9 -18
- package/app/Actions/Dashboard/Jobs/JobRetryAction.ts +4 -3
- package/app/Actions/Dashboard/Jobs/JobShowAction.ts +16 -11
- package/app/Actions/Dashboard/Jobs/JobStatsAction.ts +2 -4
- package/app/Actions/Dashboard/Kanban/BoardDestroyAction.ts +7 -8
- package/app/Actions/Dashboard/Kanban/BoardShowAction.ts +11 -19
- package/app/Actions/Dashboard/Kanban/BoardStoreAction.ts +6 -6
- package/app/Actions/Dashboard/Kanban/BoardUpdateAction.ts +7 -8
- package/app/Actions/Dashboard/Kanban/BoardsIndexAction.ts +3 -5
- package/app/Actions/Dashboard/Kanban/BoardsReorderAction.ts +6 -6
- package/app/Actions/Dashboard/Kanban/CardAssigneesSyncAction.ts +13 -12
- package/app/Actions/Dashboard/Kanban/CardCommentDestroyAction.ts +12 -15
- package/app/Actions/Dashboard/Kanban/CardCommentStoreAction.ts +21 -46
- package/app/Actions/Dashboard/Kanban/CardCommentUpdateAction.ts +43 -0
- package/app/Actions/Dashboard/Kanban/CardDestroyAction.ts +7 -8
- package/app/Actions/Dashboard/Kanban/CardLabelsSyncAction.ts +8 -9
- package/app/Actions/Dashboard/Kanban/CardShowAction.ts +6 -7
- package/app/Actions/Dashboard/Kanban/CardStoreAction.ts +9 -9
- package/app/Actions/Dashboard/Kanban/CardUpdateAction.ts +7 -8
- package/app/Actions/Dashboard/Kanban/CardsReorderAction.ts +6 -6
- package/app/Actions/Dashboard/Kanban/ColumnDestroyAction.ts +7 -8
- package/app/Actions/Dashboard/Kanban/ColumnStoreAction.ts +6 -6
- package/app/Actions/Dashboard/Kanban/ColumnUpdateAction.ts +7 -8
- package/app/Actions/Dashboard/Kanban/ColumnsReorderAction.ts +6 -6
- package/app/Actions/Dashboard/Kanban/LabelDestroyAction.ts +6 -7
- package/app/Actions/Dashboard/Kanban/LabelStoreAction.ts +6 -6
- package/app/Actions/Dashboard/Kanban/LabelUpdateAction.ts +7 -8
- package/app/Actions/Dashboard/Kanban/UsersListAction.ts +3 -4
- package/app/Actions/Dashboard/Kanban/kanban-comment.ts +14 -0
- package/app/Actions/Dashboard/Kanban/kanban-model.test.ts +36 -0
- package/app/Actions/Dashboard/Kanban/kanban-model.ts +14 -7
- package/app/Actions/Dashboard/Kanban/kanban-response.ts +5 -0
- package/app/Actions/Dashboard/Library/CreateComponent.ts +15 -6
- package/app/Actions/Dashboard/Library/CreateFunction.ts +15 -6
- package/app/Actions/Dashboard/Library/DependencyIndexAction.ts +88 -77
- package/app/Actions/Dashboard/Library/GetAverageReleaseTime.ts +21 -15
- package/app/Actions/Dashboard/Library/GetComponents.ts +14 -7
- package/app/Actions/Dashboard/Library/GetDownloadCount.ts +14 -5
- package/app/Actions/Dashboard/Library/GetFunctions.ts +12 -5
- package/app/Actions/Dashboard/Library/GetReleaseCount.ts +14 -5
- package/app/Actions/Dashboard/Library/GetReleases.ts +17 -10
- package/app/Actions/Dashboard/Library/PackageIndexAction.ts +14 -7
- package/app/Actions/Dashboard/Models/ModelDestroyAction.ts +11 -8
- package/app/Actions/Dashboard/Models/ModelShowAction.ts +97 -192
- package/app/Actions/Dashboard/Models/ModelStoreAction.ts +14 -12
- package/app/Actions/Dashboard/Models/ModelUpdateAction.ts +18 -16
- package/app/Actions/Dashboard/Models/ModelsIndexAction.ts +50 -19
- package/app/Actions/Dashboard/Models/model-api.ts +27 -0
- package/app/Actions/Dashboard/Models/model-write.ts +22 -15
- package/app/Actions/Dashboard/Notifications/NotificationDeliveryHistoryAction.ts +49 -40
- package/app/Actions/Dashboard/Notifications/NotificationDeliveryIndexAction.ts +20 -10
- package/app/Actions/Dashboard/Notifications/NotificationDeliveryOverviewAction.ts +96 -84
- package/app/Actions/Dashboard/Notifications/NotificationDeliveryRetryAction.ts +34 -21
- package/app/Actions/Dashboard/Queries/QueryDashboardAction.ts +2 -4
- package/app/Actions/Dashboard/Queries/QueryShowAction.ts +3 -3
- package/app/Actions/Dashboard/Queue/QueueStatsAction.ts +2 -4
- package/app/Actions/Dashboard/Queue/QueueWorkersAction.ts +2 -4
- package/app/Actions/Dashboard/Rbac/PermissionDestroyAction.ts +6 -6
- package/app/Actions/Dashboard/Rbac/PermissionStoreAction.ts +5 -4
- package/app/Actions/Dashboard/Rbac/PermissionsIndexAction.ts +2 -3
- package/app/Actions/Dashboard/Rbac/RoleDestroyAction.ts +6 -6
- package/app/Actions/Dashboard/Rbac/RolePermissionsShowAction.ts +6 -6
- package/app/Actions/Dashboard/Rbac/RolePermissionsSyncAction.ts +6 -9
- package/app/Actions/Dashboard/Rbac/RoleStoreAction.ts +5 -4
- package/app/Actions/Dashboard/Rbac/RolesIndexAction.ts +4 -6
- package/app/Actions/Dashboard/Rbac/UserRolesShowAction.ts +6 -7
- package/app/Actions/Dashboard/Rbac/UserRolesSyncAction.ts +6 -13
- package/app/Actions/Dashboard/Rbac/UsersListAction.ts +2 -3
- package/app/Actions/Dashboard/Rbac/rbac-response.ts +10 -0
- package/app/Actions/Dashboard/Realtime/RealtimeStatsAction.ts +2 -4
- package/app/Actions/Dashboard/Search/GlobalSearchAction.ts +69 -55
- package/app/Actions/Dashboard/Teams/TeamInvitationDestroyAction.ts +34 -16
- package/app/Actions/Dashboard/Teams/TeamInvitationResendAction.ts +52 -29
- package/app/Actions/Dashboard/Teams/TeamInviteAction.ts +104 -73
- package/app/Actions/Dashboard/Teams/TeamMemberDestroyAction.ts +36 -17
- package/app/Actions/Dashboard/Teams/TeamMemberUpdateAction.ts +41 -28
- package/app/Actions/Dashboard/Teams/TeamPeopleIndexAction.ts +71 -58
- package/app/Actions/Dashboard/Teams/team-invitation-delivery.ts +29 -7
- package/app/Actions/Dashboard/Teams/team-member-count.ts +4 -2
- package/app/Actions/Dashboard/Teams/team-records.test.ts +2 -0
- package/app/Actions/Dashboard/Teams/team-records.ts +2 -0
- package/app/Actions/Dashboard/dashboard-request.ts +13 -0
- package/app/Actions/Dashboard/dashboard-response.ts +16 -0
- package/app/Actions/SendWelcomeEmail.ts +1 -1
- package/app/Actions/Teams/AcceptInvitationAction.ts +74 -51
- package/app/Actions/Teams/ShowInvitationAction.ts +21 -14
- package/app/Actions/Teams/team-response.ts +23 -0
- package/app/Mail/OrderConfirmation.ts +1 -1
- package/app/Mail/SubscriptionConfirmation.ts +1 -1
- package/app/Mail/TeamInvitation.ts +1 -1
- package/app/Models/CardComment.ts +3 -4
- package/app/Models/EmailIdempotency.ts +64 -0
- package/app/Models/EmailSuppression.ts +52 -0
- package/app/Models/EmailWebhookEvent.ts +51 -0
- package/app/Models/TeamInvitation.ts +13 -0
- package/functions/dashboard-api.ts +51 -10
- package/functions/data.ts +0 -1
- package/functions/inbox.test.ts +2 -0
- package/functions/inbox.ts +27 -2
- package/functions/jobs.ts +0 -1
- package/functions/public-application-url.test.ts +13 -0
- package/functions/public-application-url.ts +27 -0
- package/ide/vscode/package.json +1 -1
- package/package.json +1 -1
- package/resources/components/Dashboard/Auth/AccessTokens.stx +15 -0
- package/resources/components/Dashboard/Ci/CiDashboard.stx +24 -6
- package/resources/components/Dashboard/Commerce/CommerceTaxDialog.stx +1 -1
- package/resources/components/Dashboard/Commerce/ProductWaitlistDashboard.stx +8 -7
- package/resources/components/Dashboard/Commerce/RestaurantWaitlistDashboard.stx +8 -7
- package/resources/components/Dashboard/Content/BlogDashboard.stx +14 -2
- package/resources/components/Dashboard/Content/PostsDashboard.stx +7 -1
- package/resources/components/Dashboard/Data/DataRecords.stx +0 -4
- package/resources/components/Dashboard/Deployments/DeploymentDetail.stx +16 -2
- package/resources/components/Dashboard/Email/EmailNavigation.stx +5 -5
- package/resources/components/Dashboard/Email/EmailSidebar.stx +1 -1
- package/resources/components/Dashboard/Email/InboxAttachmentList.stx +53 -0
- package/resources/components/Dashboard/Email/InboxDashboard.stx +5 -4
- package/resources/components/Dashboard/Email/InboxMessageDetail.stx +6 -4
- package/resources/components/Dashboard/Jobs/JobDetail.stx +3 -2
- package/resources/components/Dashboard/Kanban/KanbanBoardDashboard.stx +63 -6
- package/resources/components/Dashboard/Kanban/KanbanBoardsDashboard.stx +3 -6
- package/resources/components/Dashboard/Management/PermissionsDashboard.stx +4 -4
- package/resources/components/Dashboard/Models/ModelRecordsDashboard.stx +7 -13
- package/resources/components/Dashboard/Models/ModelsOverview.stx +1 -1
- package/resources/components/Dashboard/NotFoundDashboard.stx +2 -5
- package/resources/components/Dashboard/Queries/QueryDashboard.stx +6 -2
- package/resources/components/Dashboard/Settings/AppearanceSettingsDashboard.stx +4 -4
- package/resources/components/Dashboard/UI/EmptyState.stx +2 -2
- package/resources/components/Dashboard/UI/PageLayout.stx +3 -3
- package/resources/functions/dashboard/sidebar.ts +4 -4
- package/routes/dashboard-api.ts +8 -20
- package/views/dashboard/.discovered-models.json +54 -0
- package/views/dashboard/layouts/default.stx +19 -16
- package/views/dashboard/stores/auth.ts +15 -14
- package/views/dashboard/stores/ci.ts +13 -7
- package/views/dashboard/stores/kanban.ts +48 -11
|
@@ -1,94 +1,105 @@
|
|
|
1
1
|
import { Action } from '@stacksjs/actions'
|
|
2
2
|
import { existsSync, readFileSync } from 'node:fs'
|
|
3
3
|
import { join } from 'node:path'
|
|
4
|
+
import { dashboardOperationalError } from '../dashboard-response'
|
|
4
5
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
method: 'GET',
|
|
9
|
-
async handle() {
|
|
10
|
-
const projectRoot = process.cwd()
|
|
11
|
-
const lockPath = join(projectRoot, 'bun.lock')
|
|
6
|
+
function dependencySnapshot() {
|
|
7
|
+
const projectRoot = process.cwd()
|
|
8
|
+
const lockPath = join(projectRoot, 'bun.lock')
|
|
12
9
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
10
|
+
const declared: Array<Record<string, unknown>> = []
|
|
11
|
+
const transitive: Array<Record<string, unknown>> = []
|
|
12
|
+
let workspaceCount = 0
|
|
13
|
+
let thirdPartyCount = 0
|
|
14
|
+
let transitiveCount = 0
|
|
15
|
+
let totalCount = 0
|
|
19
16
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
}
|
|
17
|
+
if (!existsSync(lockPath)) {
|
|
18
|
+
return {
|
|
19
|
+
available: false,
|
|
20
|
+
source: 'bun.lock',
|
|
21
|
+
declared,
|
|
22
|
+
thirdParty: [],
|
|
23
|
+
workspace: [],
|
|
24
|
+
transitive,
|
|
25
|
+
stats: [],
|
|
26
|
+
totalCount,
|
|
27
|
+
transitiveCount,
|
|
28
|
+
workspaceCount,
|
|
29
|
+
thirdPartyCount,
|
|
34
30
|
}
|
|
31
|
+
}
|
|
35
32
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
33
|
+
const declaredSet: Record<string, boolean> = {}
|
|
34
|
+
const lockfile = Bun.JSONC.parse(readFileSync(lockPath, 'utf-8')) as {
|
|
35
|
+
workspaces?: Record<string, { name?: string, dependencies?: Record<string, string>, devDependencies?: Record<string, string> }>
|
|
36
|
+
packages?: Record<string, [string, ...unknown[]]>
|
|
37
|
+
}
|
|
38
|
+
const workspaces = lockfile.workspaces || {}
|
|
39
|
+
const workspaceNames = new Set(
|
|
40
|
+
Object.values(workspaces)
|
|
41
|
+
.map(workspace => workspace.name)
|
|
42
|
+
.filter((name): name is string => Boolean(name)),
|
|
43
|
+
)
|
|
47
44
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
}
|
|
45
|
+
for (const wsKey of Object.keys(workspaces)) {
|
|
46
|
+
const ws = workspaces[wsKey]
|
|
47
|
+
const allDeps = { ...ws.dependencies, ...ws.devDependencies }
|
|
48
|
+
for (const depName of Object.keys(allDeps)) {
|
|
49
|
+
if (declaredSet[depName]) continue
|
|
50
|
+
declaredSet[depName] = true
|
|
51
|
+
const version = allDeps[depName]
|
|
52
|
+
const isWorkspace = workspaceNames.has(depName)
|
|
53
|
+
declared.push({ name: depName, version, isWorkspace, isScoped: depName.includes('/') })
|
|
58
54
|
}
|
|
59
|
-
|
|
55
|
+
}
|
|
56
|
+
declared.sort((a, b) => String(a.name).localeCompare(String(b.name)))
|
|
60
57
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
58
|
+
const transitiveSet = new Set<string>()
|
|
59
|
+
for (const value of Object.values(lockfile.packages || {})) {
|
|
60
|
+
const resolution = value[0]
|
|
61
|
+
if (resolution.includes('@workspace:')) continue
|
|
62
|
+
const versionSeparator = resolution.startsWith('@')
|
|
63
|
+
? resolution.indexOf('@', 1)
|
|
64
|
+
: resolution.lastIndexOf('@')
|
|
65
|
+
if (versionSeparator <= 0) continue
|
|
66
|
+
const name = resolution.slice(0, versionSeparator)
|
|
67
|
+
const version = resolution.slice(versionSeparator + 1)
|
|
68
|
+
if (declaredSet[name] || transitiveSet.has(name)) continue
|
|
69
|
+
transitiveSet.add(name)
|
|
70
|
+
transitive.push({ name, version, isScoped: name.includes('/') })
|
|
71
|
+
}
|
|
72
|
+
transitive.sort((a, b) => String(a.name).localeCompare(String(b.name)))
|
|
73
|
+
|
|
74
|
+
workspaceCount = declared.filter(p => p.isWorkspace).length
|
|
75
|
+
thirdPartyCount = declared.length - workspaceCount
|
|
76
|
+
transitiveCount = transitive.length
|
|
77
|
+
totalCount = declared.length + transitiveCount
|
|
76
78
|
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
transitiveCount = transitive.length
|
|
80
|
-
totalCount = declared.length + transitiveCount
|
|
79
|
+
const thirdParty = declared.filter(p => !p.isWorkspace)
|
|
80
|
+
const workspace = declared.filter(p => p.isWorkspace)
|
|
81
81
|
|
|
82
|
-
|
|
83
|
-
|
|
82
|
+
const stats = [
|
|
83
|
+
{ label: 'Declared', value: String(declared.length) },
|
|
84
|
+
{ label: 'Third-Party', value: String(thirdPartyCount) },
|
|
85
|
+
{ label: 'Workspace', value: String(workspaceCount) },
|
|
86
|
+
{ label: 'Transitive', value: String(transitiveCount) },
|
|
87
|
+
]
|
|
84
88
|
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
{ label: 'Third-Party', value: String(thirdPartyCount) },
|
|
88
|
-
{ label: 'Workspace', value: String(workspaceCount) },
|
|
89
|
-
{ label: 'Transitive', value: String(transitiveCount) },
|
|
90
|
-
]
|
|
89
|
+
return { available: true, source: 'bun.lock', declared, thirdParty, workspace, transitive, stats, totalCount, transitiveCount, workspaceCount, thirdPartyCount }
|
|
90
|
+
}
|
|
91
91
|
|
|
92
|
-
|
|
92
|
+
export default new Action({
|
|
93
|
+
name: 'DependencyIndexAction',
|
|
94
|
+
description: 'Returns dependency data for the dashboard.',
|
|
95
|
+
method: 'GET',
|
|
96
|
+
apiResponse: true,
|
|
97
|
+
async handle() {
|
|
98
|
+
try {
|
|
99
|
+
return dependencySnapshot()
|
|
100
|
+
}
|
|
101
|
+
catch (error) {
|
|
102
|
+
return dashboardOperationalError(error, 'Dependency data could not be loaded.', 'DependencyIndexAction')
|
|
103
|
+
}
|
|
93
104
|
},
|
|
94
105
|
})
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Action } from '@stacksjs/actions'
|
|
2
2
|
import { db } from '@stacksjs/database'
|
|
3
|
+
import { dashboardOperationalError } from '../dashboard-response'
|
|
3
4
|
|
|
4
5
|
export default new Action({
|
|
5
6
|
name: 'GetAverageReleaseTime',
|
|
@@ -7,24 +8,29 @@ export default new Action({
|
|
|
7
8
|
apiResponse: true,
|
|
8
9
|
|
|
9
10
|
async handle() {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
11
|
+
try {
|
|
12
|
+
const rows = await db
|
|
13
|
+
.selectFrom('releases')
|
|
14
|
+
.select(['created_at'])
|
|
15
|
+
.whereNotNull('created_at')
|
|
16
|
+
.orderBy('created_at')
|
|
17
|
+
.execute() as unknown as Array<{ created_at: string }>
|
|
16
18
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
19
|
+
const timestamps = rows
|
|
20
|
+
.map(row => new Date(row.created_at).getTime())
|
|
21
|
+
.filter(Number.isFinite)
|
|
20
22
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
+
if (timestamps.length < 2)
|
|
24
|
+
return { averageSeconds: null, intervals: 0 }
|
|
23
25
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
26
|
+
const elapsed = timestamps.slice(1).reduce((total, value, index) => total + value - timestamps[index]!, 0)
|
|
27
|
+
return {
|
|
28
|
+
averageSeconds: Math.round(elapsed / (timestamps.length - 1) / 1000),
|
|
29
|
+
intervals: timestamps.length - 1,
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
catch (error) {
|
|
33
|
+
return dashboardOperationalError(error, 'Average release time could not be loaded.', 'GetAverageReleaseTime')
|
|
28
34
|
}
|
|
29
35
|
},
|
|
30
36
|
})
|
|
@@ -1,20 +1,27 @@
|
|
|
1
1
|
import { Action } from '@stacksjs/actions'
|
|
2
|
+
import { dashboardOperationalError } from '../dashboard-response'
|
|
2
3
|
import { componentSourceRows } from './library-source'
|
|
3
4
|
|
|
4
5
|
export default new Action({
|
|
5
6
|
name: 'GetComponents',
|
|
6
7
|
description: 'Gets your UI components.',
|
|
7
8
|
method: 'GET',
|
|
9
|
+
apiResponse: true,
|
|
8
10
|
|
|
9
11
|
async handle() {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
+
try {
|
|
13
|
+
const components = componentSourceRows()
|
|
14
|
+
const categories = ['All', ...new Set(components.map(component => component.category))]
|
|
12
15
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
return {
|
|
17
|
+
components,
|
|
18
|
+
categories,
|
|
19
|
+
totalBytes: components.reduce((sum, component) => sum + component.bytes, 0),
|
|
20
|
+
sourceRoot: 'resources/components',
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
catch (error) {
|
|
24
|
+
return dashboardOperationalError(error, 'Component library could not be loaded.', 'GetComponents')
|
|
18
25
|
}
|
|
19
26
|
},
|
|
20
27
|
})
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Action } from '@stacksjs/actions'
|
|
2
2
|
import { db } from '@stacksjs/database'
|
|
3
|
+
import { dashboardOperationalError } from '../dashboard-response'
|
|
3
4
|
|
|
4
5
|
export default new Action({
|
|
5
6
|
name: 'GetDownloadCount',
|
|
@@ -7,11 +8,19 @@ export default new Action({
|
|
|
7
8
|
apiResponse: true,
|
|
8
9
|
|
|
9
10
|
async handle() {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
11
|
+
try {
|
|
12
|
+
const row = await db
|
|
13
|
+
.selectFrom('releases')
|
|
14
|
+
.select(db.fn.sum('downloads').as('downloads'))
|
|
15
|
+
.executeTakeFirst() as { downloads?: number | string | null } | undefined
|
|
16
|
+
const downloads = Number(row?.downloads || 0)
|
|
17
|
+
if (!Number.isSafeInteger(downloads) || downloads < 0)
|
|
18
|
+
throw new TypeError('Release download total must be a non-negative integer.')
|
|
14
19
|
|
|
15
|
-
|
|
20
|
+
return { downloads, source: 'releases.downloads' }
|
|
21
|
+
}
|
|
22
|
+
catch (error) {
|
|
23
|
+
return dashboardOperationalError(error, 'Release download count could not be loaded.', 'GetDownloadCount')
|
|
24
|
+
}
|
|
16
25
|
},
|
|
17
26
|
})
|
|
@@ -1,18 +1,25 @@
|
|
|
1
1
|
import { Action } from '@stacksjs/actions'
|
|
2
|
+
import { dashboardOperationalError } from '../dashboard-response'
|
|
2
3
|
import { functionSourceRows } from './library-source'
|
|
3
4
|
|
|
4
5
|
export default new Action({
|
|
5
6
|
name: 'GetFunctions',
|
|
6
7
|
description: 'Gets your utility functions.',
|
|
7
8
|
method: 'GET',
|
|
9
|
+
apiResponse: true,
|
|
8
10
|
|
|
9
11
|
async handle() {
|
|
10
|
-
|
|
12
|
+
try {
|
|
13
|
+
const functions = functionSourceRows()
|
|
11
14
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
15
|
+
return {
|
|
16
|
+
functions,
|
|
17
|
+
totalBytes: functions.reduce((sum, fn) => sum + fn.bytes, 0),
|
|
18
|
+
sourceRoot: 'resources/functions',
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
catch (error) {
|
|
22
|
+
return dashboardOperationalError(error, 'Function library could not be loaded.', 'GetFunctions')
|
|
16
23
|
}
|
|
17
24
|
},
|
|
18
25
|
})
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Action } from '@stacksjs/actions'
|
|
2
2
|
import { db } from '@stacksjs/database'
|
|
3
|
+
import { dashboardOperationalError } from '../dashboard-response'
|
|
3
4
|
|
|
4
5
|
export default new Action({
|
|
5
6
|
name: 'GetReleaseCount',
|
|
@@ -7,11 +8,19 @@ export default new Action({
|
|
|
7
8
|
apiResponse: true,
|
|
8
9
|
|
|
9
10
|
async handle() {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
11
|
+
try {
|
|
12
|
+
const row = await db
|
|
13
|
+
.selectFrom('releases')
|
|
14
|
+
.select(db.fn.count('id').as('count'))
|
|
15
|
+
.executeTakeFirst() as { count?: number | string } | undefined
|
|
16
|
+
const count = Number(row?.count || 0)
|
|
17
|
+
if (!Number.isSafeInteger(count) || count < 0)
|
|
18
|
+
throw new TypeError('Release count must be a non-negative integer.')
|
|
14
19
|
|
|
15
|
-
|
|
20
|
+
return { count }
|
|
21
|
+
}
|
|
22
|
+
catch (error) {
|
|
23
|
+
return dashboardOperationalError(error, 'Release count could not be loaded.', 'GetReleaseCount')
|
|
24
|
+
}
|
|
16
25
|
},
|
|
17
26
|
})
|
|
@@ -1,23 +1,30 @@
|
|
|
1
1
|
import { Action } from '@stacksjs/actions'
|
|
2
2
|
import { Release } from '@stacksjs/orm'
|
|
3
|
+
import { dashboardOperationalError } from '../dashboard-response'
|
|
3
4
|
|
|
4
5
|
export default new Action({
|
|
5
6
|
name: 'GetReleases',
|
|
6
7
|
description: 'Gets your releases.',
|
|
7
8
|
method: 'GET',
|
|
9
|
+
apiResponse: true,
|
|
8
10
|
|
|
9
11
|
async handle() {
|
|
10
|
-
|
|
12
|
+
try {
|
|
13
|
+
const allReleases = await Release.orderByDesc('id').limit(500).get()
|
|
11
14
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
15
|
+
const releases = allReleases.map(r => ({
|
|
16
|
+
version: String(r.get('version') || ''),
|
|
17
|
+
date: String(r.get('created_at') || r.get('released_at') || ''),
|
|
18
|
+
type: String(r.get('type') || 'patch'),
|
|
19
|
+
status: String(r.get('status') || 'previous'),
|
|
20
|
+
changes: Number(r.get('changes') || r.get('change_count') || 0),
|
|
21
|
+
breaking: Boolean(r.get('breaking') || false),
|
|
22
|
+
}))
|
|
20
23
|
|
|
21
|
-
|
|
24
|
+
return { releases }
|
|
25
|
+
}
|
|
26
|
+
catch (error) {
|
|
27
|
+
return dashboardOperationalError(error, 'Releases could not be loaded.', 'GetReleases')
|
|
28
|
+
}
|
|
22
29
|
},
|
|
23
30
|
})
|
|
@@ -1,19 +1,26 @@
|
|
|
1
1
|
import { Action } from '@stacksjs/actions'
|
|
2
|
+
import { dashboardOperationalError } from '../dashboard-response'
|
|
2
3
|
import { workspacePackageRows } from './library-source'
|
|
3
4
|
|
|
4
5
|
export default new Action({
|
|
5
6
|
name: 'PackageIndexAction',
|
|
6
7
|
description: 'Returns package data for the dashboard.',
|
|
7
8
|
method: 'GET',
|
|
9
|
+
apiResponse: true,
|
|
8
10
|
async handle() {
|
|
9
|
-
|
|
11
|
+
try {
|
|
12
|
+
const packages = workspacePackageRows()
|
|
10
13
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
return {
|
|
15
|
+
packages,
|
|
16
|
+
publicCount: packages.filter(pkg => !pkg.private).length,
|
|
17
|
+
privateCount: packages.filter(pkg => pkg.private).length,
|
|
18
|
+
dependencyCount: packages.reduce((sum, pkg) => sum + pkg.dependencyCount, 0),
|
|
19
|
+
source: 'bun.lock',
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
catch (error) {
|
|
23
|
+
return dashboardOperationalError(error, 'Workspace packages could not be loaded.', 'PackageIndexAction')
|
|
17
24
|
}
|
|
18
25
|
},
|
|
19
26
|
})
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
+
import type { RequestInstance } from '@stacksjs/types'
|
|
1
2
|
import { Action } from '@stacksjs/actions'
|
|
3
|
+
import { response } from '@stacksjs/router'
|
|
4
|
+
import { dashboardOperationalError } from '../dashboard-response'
|
|
2
5
|
import { parseRowId, resolveWritableModel } from './model-write'
|
|
3
6
|
|
|
4
7
|
/**
|
|
@@ -13,24 +16,24 @@ export default new Action({
|
|
|
13
16
|
description: 'Deletes one row of a model from the dashboard model browser.',
|
|
14
17
|
method: 'DELETE',
|
|
15
18
|
apiResponse: true,
|
|
16
|
-
async handle(
|
|
17
|
-
const resolved = await resolveWritableModel(
|
|
19
|
+
async handle(request: RequestInstance) {
|
|
20
|
+
const resolved = await resolveWritableModel(request.getParam('slug'), 'destroy')
|
|
18
21
|
if ('error' in resolved)
|
|
19
|
-
return {
|
|
22
|
+
return response.json({ message: resolved.error }, resolved.status)
|
|
20
23
|
|
|
21
|
-
const id = parseRowId(
|
|
24
|
+
const id = parseRowId(request.getParam('id'))
|
|
22
25
|
if (id === null)
|
|
23
|
-
return {
|
|
26
|
+
return response.json({ message: 'A numeric row id is required.' }, 400)
|
|
24
27
|
|
|
25
28
|
try {
|
|
26
29
|
const row = await resolved.Model.find(id)
|
|
27
30
|
if (!row)
|
|
28
|
-
return {
|
|
31
|
+
return response.json({ message: `${resolved.modelName} ${id} not found.` }, 404)
|
|
29
32
|
await row.delete()
|
|
30
33
|
return { ok: true, id }
|
|
31
34
|
}
|
|
32
|
-
catch (
|
|
33
|
-
return
|
|
35
|
+
catch (error) {
|
|
36
|
+
return dashboardOperationalError(error, 'The model record could not be deleted.', 'ModelDestroyAction', 500)
|
|
34
37
|
}
|
|
35
38
|
},
|
|
36
39
|
})
|