@stacksjs/defaults 0.70.355 → 0.70.357
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/ai/skills/stacks-orm/SKILL.md +6 -0
- 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/Content/AuthorDestroyAction.ts +23 -9
- package/app/Actions/Dashboard/Content/AuthorIndexAction.ts +32 -26
- package/app/Actions/Dashboard/Content/AuthorStoreAction.ts +44 -24
- package/app/Actions/Dashboard/Content/AuthorUpdateAction.ts +48 -26
- package/app/Actions/Dashboard/Content/CategoryDestroyAction.ts +27 -8
- package/app/Actions/Dashboard/Content/CategoryIndexAction.ts +21 -15
- package/app/Actions/Dashboard/Content/CategoryStoreAction.ts +47 -29
- package/app/Actions/Dashboard/Content/CommentDestroyAction.ts +17 -4
- package/app/Actions/Dashboard/Content/CommentIndexAction.ts +23 -17
- package/app/Actions/Dashboard/Content/CommentUpdateAction.ts +30 -12
- package/app/Actions/Dashboard/Content/ContentDashboardAction.ts +43 -37
- package/app/Actions/Dashboard/Content/PageDestroyAction.ts +17 -4
- package/app/Actions/Dashboard/Content/PageIndexAction.ts +23 -17
- package/app/Actions/Dashboard/Content/PageStoreAction.ts +33 -18
- package/app/Actions/Dashboard/Content/PageUpdateAction.ts +40 -22
- package/app/Actions/Dashboard/Content/PostDestroyAction.ts +24 -11
- package/app/Actions/Dashboard/Content/PostIndexAction.ts +55 -49
- package/app/Actions/Dashboard/Content/PostStoreAction.ts +43 -33
- package/app/Actions/Dashboard/Content/PostUpdateAction.ts +46 -34
- package/app/Actions/Dashboard/Content/TagDestroyAction.ts +27 -8
- package/app/Actions/Dashboard/Content/TagIndexAction.ts +31 -25
- package/app/Actions/Dashboard/Content/TagStoreAction.ts +44 -23
- package/app/Actions/Dashboard/Content/content-input.ts +4 -4
- package/app/Actions/Dashboard/Content/post-input.ts +60 -8
- 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,7 +1,7 @@
|
|
|
1
1
|
import type { RequestInstance } from '@stacksjs/types'
|
|
2
2
|
import { Action } from '@stacksjs/actions'
|
|
3
3
|
import { db } from '@stacksjs/database'
|
|
4
|
-
import { kanbanError } from './kanban-response'
|
|
4
|
+
import { kanbanActionError, kanbanError } from './kanban-response'
|
|
5
5
|
|
|
6
6
|
interface SyncInput {
|
|
7
7
|
labelIds?: unknown
|
|
@@ -92,8 +92,7 @@ export default new Action({
|
|
|
92
92
|
return { cardId, labels }
|
|
93
93
|
}
|
|
94
94
|
catch (err) {
|
|
95
|
-
|
|
96
|
-
return kanbanError(err instanceof Error ? err.message : 'unknown error', 500)
|
|
95
|
+
return kanbanActionError(err, 'CardLabelsSyncAction')
|
|
97
96
|
}
|
|
98
97
|
},
|
|
99
98
|
})
|
|
@@ -2,7 +2,7 @@ import type { RequestInstance } from '@stacksjs/types'
|
|
|
2
2
|
import { Action } from '@stacksjs/actions'
|
|
3
3
|
import { db } from '@stacksjs/database'
|
|
4
4
|
import { modelBoolean } from './kanban-model'
|
|
5
|
-
import { kanbanError } from './kanban-response'
|
|
5
|
+
import { kanbanActionError, kanbanError } from './kanban-response'
|
|
6
6
|
|
|
7
7
|
interface CardRow {
|
|
8
8
|
id: number
|
|
@@ -118,8 +118,7 @@ export default new Action({
|
|
|
118
118
|
}
|
|
119
119
|
}
|
|
120
120
|
catch (err) {
|
|
121
|
-
|
|
122
|
-
return kanbanError(err instanceof Error ? err.message : 'unknown error', 500)
|
|
121
|
+
return kanbanActionError(err, 'CardShowAction')
|
|
123
122
|
}
|
|
124
123
|
},
|
|
125
124
|
})
|
|
@@ -2,7 +2,7 @@ import type { RequestInstance } from '@stacksjs/types'
|
|
|
2
2
|
import { Action } from '@stacksjs/actions'
|
|
3
3
|
import { db } from '@stacksjs/database'
|
|
4
4
|
import { BoardColumn, Card } from '@stacksjs/orm'
|
|
5
|
-
import { kanbanError } from './kanban-response'
|
|
5
|
+
import { kanbanActionError, kanbanError } from './kanban-response'
|
|
6
6
|
|
|
7
7
|
interface CardInput {
|
|
8
8
|
columnId?: unknown
|
|
@@ -90,8 +90,7 @@ export default new Action({
|
|
|
90
90
|
}
|
|
91
91
|
}
|
|
92
92
|
catch (err) {
|
|
93
|
-
|
|
94
|
-
return kanbanError(err instanceof Error ? err.message : 'unknown error', 500)
|
|
93
|
+
return kanbanActionError(err, 'CardStoreAction')
|
|
95
94
|
}
|
|
96
95
|
},
|
|
97
96
|
})
|
|
@@ -2,7 +2,7 @@ import type { RequestInstance } from '@stacksjs/types'
|
|
|
2
2
|
import { Action } from '@stacksjs/actions'
|
|
3
3
|
import { Card } from '@stacksjs/orm'
|
|
4
4
|
import { modelBoolean, modelNullableString, modelNumber, modelString, modelValue, refreshModel } from './kanban-model'
|
|
5
|
-
import { kanbanError } from './kanban-response'
|
|
5
|
+
import { kanbanActionError, kanbanError } from './kanban-response'
|
|
6
6
|
|
|
7
7
|
interface CardInput {
|
|
8
8
|
title?: unknown
|
|
@@ -81,8 +81,7 @@ export default new Action({
|
|
|
81
81
|
}
|
|
82
82
|
}
|
|
83
83
|
catch (err) {
|
|
84
|
-
|
|
85
|
-
return kanbanError(err instanceof Error ? err.message : 'unknown error', 500)
|
|
84
|
+
return kanbanActionError(err, 'CardUpdateAction')
|
|
86
85
|
}
|
|
87
86
|
},
|
|
88
87
|
})
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { RequestInstance } from '@stacksjs/types'
|
|
2
2
|
import { Action } from '@stacksjs/actions'
|
|
3
3
|
import { db } from '@stacksjs/database'
|
|
4
|
-
import { kanbanError } from './kanban-response'
|
|
4
|
+
import { kanbanActionError, kanbanError } from './kanban-response'
|
|
5
5
|
|
|
6
6
|
interface ColumnReorder {
|
|
7
7
|
columnId: number
|
|
@@ -135,8 +135,7 @@ export default new Action({
|
|
|
135
135
|
return { moved: allCardIds.size, boardId }
|
|
136
136
|
}
|
|
137
137
|
catch (err) {
|
|
138
|
-
|
|
139
|
-
return kanbanError(err instanceof Error ? err.message : 'unknown error', 500)
|
|
138
|
+
return kanbanActionError(err, 'CardsReorderAction')
|
|
140
139
|
}
|
|
141
140
|
},
|
|
142
141
|
})
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { RequestInstance } from '@stacksjs/types'
|
|
2
2
|
import { Action } from '@stacksjs/actions'
|
|
3
3
|
import { db } from '@stacksjs/database'
|
|
4
|
-
import { kanbanError } from './kanban-response'
|
|
4
|
+
import { kanbanActionError, kanbanError } from './kanban-response'
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* `DELETE /api/dashboard/kanban/columns/:id`.
|
|
@@ -48,8 +48,7 @@ export default new Action({
|
|
|
48
48
|
return { deleted: true, id }
|
|
49
49
|
}
|
|
50
50
|
catch (err) {
|
|
51
|
-
|
|
52
|
-
return kanbanError(err instanceof Error ? err.message : 'unknown error', 500)
|
|
51
|
+
return kanbanActionError(err, 'ColumnDestroyAction')
|
|
53
52
|
}
|
|
54
53
|
},
|
|
55
54
|
})
|
|
@@ -2,7 +2,7 @@ import type { RequestInstance } from '@stacksjs/types'
|
|
|
2
2
|
import { Action } from '@stacksjs/actions'
|
|
3
3
|
import { db } from '@stacksjs/database'
|
|
4
4
|
import { Board, BoardColumn } from '@stacksjs/orm'
|
|
5
|
-
import { kanbanError } from './kanban-response'
|
|
5
|
+
import { kanbanActionError, kanbanError } from './kanban-response'
|
|
6
6
|
|
|
7
7
|
interface ColumnInput {
|
|
8
8
|
boardId?: unknown
|
|
@@ -75,8 +75,7 @@ export default new Action({
|
|
|
75
75
|
}
|
|
76
76
|
}
|
|
77
77
|
catch (err) {
|
|
78
|
-
|
|
79
|
-
return kanbanError(err instanceof Error ? err.message : 'unknown error', 500)
|
|
78
|
+
return kanbanActionError(err, 'ColumnStoreAction')
|
|
80
79
|
}
|
|
81
80
|
},
|
|
82
81
|
})
|
|
@@ -2,7 +2,7 @@ import type { RequestInstance } from '@stacksjs/types'
|
|
|
2
2
|
import { Action } from '@stacksjs/actions'
|
|
3
3
|
import { BoardColumn } from '@stacksjs/orm'
|
|
4
4
|
import { modelNullableString, modelNumber, modelString, modelValue, refreshModel } from './kanban-model'
|
|
5
|
-
import { kanbanError } from './kanban-response'
|
|
5
|
+
import { kanbanActionError, kanbanError } from './kanban-response'
|
|
6
6
|
|
|
7
7
|
interface ColumnInput {
|
|
8
8
|
name?: unknown
|
|
@@ -80,8 +80,7 @@ export default new Action({
|
|
|
80
80
|
}
|
|
81
81
|
}
|
|
82
82
|
catch (err) {
|
|
83
|
-
|
|
84
|
-
return kanbanError(err instanceof Error ? err.message : 'unknown error', 500)
|
|
83
|
+
return kanbanActionError(err, 'ColumnUpdateAction')
|
|
85
84
|
}
|
|
86
85
|
},
|
|
87
86
|
})
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { RequestInstance } from '@stacksjs/types'
|
|
2
2
|
import { Action } from '@stacksjs/actions'
|
|
3
3
|
import { db } from '@stacksjs/database'
|
|
4
|
-
import { kanbanError } from './kanban-response'
|
|
4
|
+
import { kanbanActionError, kanbanError } from './kanban-response'
|
|
5
5
|
|
|
6
6
|
interface ReorderInput {
|
|
7
7
|
boardId?: unknown
|
|
@@ -75,8 +75,7 @@ export default new Action({
|
|
|
75
75
|
return { reordered: ids.length }
|
|
76
76
|
}
|
|
77
77
|
catch (err) {
|
|
78
|
-
|
|
79
|
-
return kanbanError(err instanceof Error ? err.message : 'unknown error', 500)
|
|
78
|
+
return kanbanActionError(err, 'ColumnsReorderAction')
|
|
80
79
|
}
|
|
81
80
|
},
|
|
82
81
|
})
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { RequestInstance } from '@stacksjs/types'
|
|
2
2
|
import { Action } from '@stacksjs/actions'
|
|
3
3
|
import { db } from '@stacksjs/database'
|
|
4
|
-
import { kanbanError } from './kanban-response'
|
|
4
|
+
import { kanbanActionError, kanbanError } from './kanban-response'
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* `DELETE /api/dashboard/kanban/labels/:id`.
|
|
@@ -30,8 +30,7 @@ export default new Action({
|
|
|
30
30
|
return { deleted: true, id }
|
|
31
31
|
}
|
|
32
32
|
catch (err) {
|
|
33
|
-
|
|
34
|
-
return kanbanError(err instanceof Error ? err.message : 'unknown error', 500)
|
|
33
|
+
return kanbanActionError(err, 'LabelDestroyAction')
|
|
35
34
|
}
|
|
36
35
|
},
|
|
37
36
|
})
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { RequestInstance } from '@stacksjs/types'
|
|
2
2
|
import { Action } from '@stacksjs/actions'
|
|
3
3
|
import { Board, Label } from '@stacksjs/orm'
|
|
4
|
-
import { kanbanError } from './kanban-response'
|
|
4
|
+
import { kanbanActionError, kanbanError } from './kanban-response'
|
|
5
5
|
|
|
6
6
|
interface LabelInput {
|
|
7
7
|
boardId?: unknown
|
|
@@ -51,8 +51,7 @@ export default new Action({
|
|
|
51
51
|
}
|
|
52
52
|
}
|
|
53
53
|
catch (err) {
|
|
54
|
-
|
|
55
|
-
return kanbanError(err instanceof Error ? err.message : 'unknown error', 500)
|
|
54
|
+
return kanbanActionError(err, 'LabelStoreAction')
|
|
56
55
|
}
|
|
57
56
|
},
|
|
58
57
|
})
|
|
@@ -2,7 +2,7 @@ import type { RequestInstance } from '@stacksjs/types'
|
|
|
2
2
|
import { Action } from '@stacksjs/actions'
|
|
3
3
|
import { Label } from '@stacksjs/orm'
|
|
4
4
|
import { modelNumber, modelString, refreshModel } from './kanban-model'
|
|
5
|
-
import { kanbanError } from './kanban-response'
|
|
5
|
+
import { kanbanActionError, kanbanError } from './kanban-response'
|
|
6
6
|
|
|
7
7
|
interface LabelInput {
|
|
8
8
|
name?: unknown
|
|
@@ -74,8 +74,7 @@ export default new Action({
|
|
|
74
74
|
}
|
|
75
75
|
}
|
|
76
76
|
catch (err) {
|
|
77
|
-
|
|
78
|
-
return kanbanError(err instanceof Error ? err.message : 'unknown error', 500)
|
|
77
|
+
return kanbanActionError(err, 'LabelUpdateAction')
|
|
79
78
|
}
|
|
80
79
|
},
|
|
81
80
|
})
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Action } from '@stacksjs/actions'
|
|
2
2
|
import { db } from '@stacksjs/database'
|
|
3
|
-
import { kanbanError } from './kanban-response'
|
|
3
|
+
import { kanbanActionError, kanbanError } from './kanban-response'
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* `GET /api/dashboard/kanban/users`.
|
|
@@ -30,8 +30,7 @@ export default new Action({
|
|
|
30
30
|
}
|
|
31
31
|
}
|
|
32
32
|
catch (err) {
|
|
33
|
-
|
|
34
|
-
return kanbanError(err instanceof Error ? err.message : 'unknown error', 500)
|
|
33
|
+
return kanbanActionError(err, 'UsersListAction')
|
|
35
34
|
}
|
|
36
35
|
},
|
|
37
36
|
})
|
|
@@ -3,3 +3,8 @@ import { response } from '@stacksjs/router'
|
|
|
3
3
|
export function kanbanError(error: string, status: number): Response {
|
|
4
4
|
return response.json({ error }, status)
|
|
5
5
|
}
|
|
6
|
+
|
|
7
|
+
export function kanbanActionError(error: unknown, action: string): Response {
|
|
8
|
+
console.error(`[dashboard/kanban] ${action} failed:`, error)
|
|
9
|
+
return kanbanError('The Kanban request could not be completed.', 500)
|
|
10
|
+
}
|
|
@@ -3,12 +3,14 @@ import { existsSync } from 'node:fs'
|
|
|
3
3
|
import { Action, createComponent as scaffoldComponent } from '@stacksjs/actions'
|
|
4
4
|
import { userComponentsPath } from '@stacksjs/path'
|
|
5
5
|
import { response } from '@stacksjs/router'
|
|
6
|
+
import { dashboardOperationalError } from '../dashboard-response'
|
|
6
7
|
import { componentSourceRows } from './library-source'
|
|
7
8
|
|
|
8
9
|
export default new Action({
|
|
9
10
|
name: 'CreateComponent',
|
|
10
11
|
description: 'Creates a new STX component.',
|
|
11
12
|
method: 'POST',
|
|
13
|
+
apiResponse: true,
|
|
12
14
|
|
|
13
15
|
async handle(request: RequestInstance) {
|
|
14
16
|
const name = String(request.get('name') || '').trim()
|
|
@@ -16,13 +18,20 @@ export default new Action({
|
|
|
16
18
|
if (!/^[A-Z][A-Za-z0-9]*$/.test(name))
|
|
17
19
|
return response.json({ message: 'Use a PascalCase component name.' }, 422)
|
|
18
20
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
21
|
+
try {
|
|
22
|
+
const destination = userComponentsPath(`${name}.stx`)
|
|
23
|
+
if (existsSync(destination))
|
|
24
|
+
return response.json({ message: 'A component with that name already exists.' }, 409)
|
|
22
25
|
|
|
23
|
-
|
|
26
|
+
await scaffoldComponent({ name })
|
|
24
27
|
|
|
25
|
-
|
|
26
|
-
|
|
28
|
+
const created = componentSourceRows().find(component => component.name === name)
|
|
29
|
+
if (!created)
|
|
30
|
+
throw new Error(`Scaffolded component ${name} could not be found in resources/components.`)
|
|
31
|
+
return response.json({ component: created }, 201)
|
|
32
|
+
}
|
|
33
|
+
catch (error) {
|
|
34
|
+
return dashboardOperationalError(error, 'The component could not be created.', 'CreateComponent', 500)
|
|
35
|
+
}
|
|
27
36
|
},
|
|
28
37
|
})
|
|
@@ -3,12 +3,14 @@ import { existsSync } from 'node:fs'
|
|
|
3
3
|
import { Action, createFunction as scaffoldFunction } from '@stacksjs/actions'
|
|
4
4
|
import { userFunctionsPath } from '@stacksjs/path'
|
|
5
5
|
import { response } from '@stacksjs/router'
|
|
6
|
+
import { dashboardOperationalError } from '../dashboard-response'
|
|
6
7
|
import { functionSourceRows } from './library-source'
|
|
7
8
|
|
|
8
9
|
export default new Action({
|
|
9
10
|
name: 'CreateFunction',
|
|
10
11
|
description: 'Creates a new function.',
|
|
11
12
|
method: 'POST',
|
|
13
|
+
apiResponse: true,
|
|
12
14
|
|
|
13
15
|
async handle(request: RequestInstance) {
|
|
14
16
|
const name = String(request.get('name') || '').trim().toLowerCase()
|
|
@@ -16,13 +18,20 @@ export default new Action({
|
|
|
16
18
|
if (!/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/.test(name))
|
|
17
19
|
return response.json({ message: 'Use a lowercase kebab-case function name.' }, 422)
|
|
18
20
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
21
|
+
try {
|
|
22
|
+
const destination = userFunctionsPath(`${name}.ts`)
|
|
23
|
+
if (existsSync(destination))
|
|
24
|
+
return response.json({ message: 'A function with that name already exists.' }, 409)
|
|
22
25
|
|
|
23
|
-
|
|
26
|
+
await scaffoldFunction({ name })
|
|
24
27
|
|
|
25
|
-
|
|
26
|
-
|
|
28
|
+
const created = functionSourceRows().find(fn => fn.name === name)
|
|
29
|
+
if (!created)
|
|
30
|
+
throw new Error(`Scaffolded function ${name} could not be found in resources/functions.`)
|
|
31
|
+
return response.json({ function: created }, 201)
|
|
32
|
+
}
|
|
33
|
+
catch (error) {
|
|
34
|
+
return dashboardOperationalError(error, 'The function could not be created.', 'CreateFunction', 500)
|
|
35
|
+
}
|
|
27
36
|
},
|
|
28
37
|
})
|
|
@@ -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
|
})
|