@stacksjs/defaults 0.70.355 → 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-email/SKILL.md +38 -1
- 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 +4 -7
- package/app/Actions/Dashboard/Buddy/BuddyChatAction.ts +2 -3
- 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 +75 -61
- package/app/Actions/Dashboard/Commerce/CommercePrintDevicesAction.ts +2 -4
- package/app/Actions/Dashboard/Commerce/CommercePrintLogsAction.ts +2 -4
- package/app/Actions/Dashboard/Commerce/CommerceProductDetailAction.ts +3 -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/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/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 +23 -19
- 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 +4 -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 +18 -5
- package/app/Actions/Dashboard/Email/CapturedMailIndexAction.ts +2 -4
- package/app/Actions/Dashboard/Email/CapturedMailShowAction.ts +3 -4
- package/app/Actions/Dashboard/Infrastructure/InsightsAction.ts +15 -14
- package/app/Actions/Dashboard/Infrastructure/LogIndexAction.ts +2 -8
- package/app/Actions/Dashboard/Jobs/JobIndexAction.ts +2 -4
- package/app/Actions/Dashboard/Jobs/JobShowAction.ts +13 -8
- package/app/Actions/Dashboard/Jobs/JobStatsAction.ts +2 -4
- package/app/Actions/Dashboard/Kanban/BoardDestroyAction.ts +2 -3
- package/app/Actions/Dashboard/Kanban/BoardShowAction.ts +2 -3
- package/app/Actions/Dashboard/Kanban/BoardStoreAction.ts +2 -3
- package/app/Actions/Dashboard/Kanban/BoardUpdateAction.ts +2 -3
- package/app/Actions/Dashboard/Kanban/BoardsIndexAction.ts +2 -3
- package/app/Actions/Dashboard/Kanban/BoardsReorderAction.ts +2 -3
- package/app/Actions/Dashboard/Kanban/CardAssigneesSyncAction.ts +2 -3
- package/app/Actions/Dashboard/Kanban/CardCommentDestroyAction.ts +2 -3
- package/app/Actions/Dashboard/Kanban/CardCommentStoreAction.ts +2 -3
- package/app/Actions/Dashboard/Kanban/CardCommentUpdateAction.ts +2 -3
- package/app/Actions/Dashboard/Kanban/CardDestroyAction.ts +2 -3
- package/app/Actions/Dashboard/Kanban/CardLabelsSyncAction.ts +2 -3
- package/app/Actions/Dashboard/Kanban/CardShowAction.ts +2 -3
- package/app/Actions/Dashboard/Kanban/CardStoreAction.ts +2 -3
- package/app/Actions/Dashboard/Kanban/CardUpdateAction.ts +2 -3
- package/app/Actions/Dashboard/Kanban/CardsReorderAction.ts +2 -3
- package/app/Actions/Dashboard/Kanban/ColumnDestroyAction.ts +2 -3
- package/app/Actions/Dashboard/Kanban/ColumnStoreAction.ts +2 -3
- package/app/Actions/Dashboard/Kanban/ColumnUpdateAction.ts +2 -3
- package/app/Actions/Dashboard/Kanban/ColumnsReorderAction.ts +2 -3
- package/app/Actions/Dashboard/Kanban/LabelDestroyAction.ts +2 -3
- package/app/Actions/Dashboard/Kanban/LabelStoreAction.ts +2 -3
- package/app/Actions/Dashboard/Kanban/LabelUpdateAction.ts +2 -3
- package/app/Actions/Dashboard/Kanban/UsersListAction.ts +2 -3
- 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 +7 -5
- package/app/Actions/Dashboard/Models/ModelShowAction.ts +82 -174
- package/app/Actions/Dashboard/Models/ModelStoreAction.ts +6 -4
- package/app/Actions/Dashboard/Models/ModelUpdateAction.ts +9 -7
- package/app/Actions/Dashboard/Models/ModelsIndexAction.ts +47 -17
- package/app/Actions/Dashboard/Models/model-write.ts +20 -5
- package/app/Actions/Dashboard/Notifications/NotificationDeliveryHistoryAction.ts +46 -36
- package/app/Actions/Dashboard/Notifications/NotificationDeliveryIndexAction.ts +14 -6
- 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 +2 -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 +2 -2
- package/app/Actions/Dashboard/Rbac/PermissionStoreAction.ts +2 -2
- package/app/Actions/Dashboard/Rbac/PermissionsIndexAction.ts +2 -3
- package/app/Actions/Dashboard/Rbac/RoleDestroyAction.ts +2 -2
- package/app/Actions/Dashboard/Rbac/RolePermissionsShowAction.ts +2 -2
- package/app/Actions/Dashboard/Rbac/RolePermissionsSyncAction.ts +2 -6
- package/app/Actions/Dashboard/Rbac/RoleStoreAction.ts +2 -2
- package/app/Actions/Dashboard/Rbac/RolesIndexAction.ts +4 -6
- package/app/Actions/Dashboard/Rbac/UserRolesShowAction.ts +2 -2
- package/app/Actions/Dashboard/Rbac/UserRolesSyncAction.ts +2 -9
- 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 +68 -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 +102 -71
- package/app/Actions/Dashboard/Teams/TeamMemberDestroyAction.ts +36 -17
- package/app/Actions/Dashboard/Teams/TeamMemberUpdateAction.ts +39 -26
- 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-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/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/data.ts +0 -1
- package/functions/jobs.ts +0 -1
- package/ide/vscode/package.json +1 -1
- package/package.json +1 -1
- package/resources/components/Dashboard/Data/DataRecords.stx +0 -4
- package/resources/components/Dashboard/Jobs/JobDetail.stx +3 -2
- package/resources/components/Dashboard/Models/ModelRecordsDashboard.stx +7 -13
- package/resources/components/Dashboard/Models/ModelsOverview.stx +1 -1
- package/views/dashboard/.discovered-models.json +30 -0
- package/views/dashboard/stores/auth.ts +15 -14
|
@@ -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,5 +1,7 @@
|
|
|
1
1
|
import type { RequestInstance } from '@stacksjs/types'
|
|
2
2
|
import { Action } from '@stacksjs/actions'
|
|
3
|
+
import { response } from '@stacksjs/router'
|
|
4
|
+
import { dashboardOperationalError } from '../dashboard-response'
|
|
3
5
|
import { parseRowId, resolveWritableModel } from './model-write'
|
|
4
6
|
|
|
5
7
|
/**
|
|
@@ -17,21 +19,21 @@ export default new Action({
|
|
|
17
19
|
async handle(request: RequestInstance) {
|
|
18
20
|
const resolved = await resolveWritableModel(request.getParam('slug'), 'destroy')
|
|
19
21
|
if ('error' in resolved)
|
|
20
|
-
return {
|
|
22
|
+
return response.json({ message: resolved.error }, resolved.status)
|
|
21
23
|
|
|
22
24
|
const id = parseRowId(request.getParam('id'))
|
|
23
25
|
if (id === null)
|
|
24
|
-
return {
|
|
26
|
+
return response.json({ message: 'A numeric row id is required.' }, 400)
|
|
25
27
|
|
|
26
28
|
try {
|
|
27
29
|
const row = await resolved.Model.find(id)
|
|
28
30
|
if (!row)
|
|
29
|
-
return {
|
|
31
|
+
return response.json({ message: `${resolved.modelName} ${id} not found.` }, 404)
|
|
30
32
|
await row.delete()
|
|
31
33
|
return { ok: true, id }
|
|
32
34
|
}
|
|
33
|
-
catch (
|
|
34
|
-
return
|
|
35
|
+
catch (error) {
|
|
36
|
+
return dashboardOperationalError(error, 'The model record could not be deleted.', 'ModelDestroyAction', 500)
|
|
35
37
|
}
|
|
36
38
|
},
|
|
37
39
|
})
|