@stacksjs/defaults 0.70.357 → 0.70.358
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 +5 -1
- package/ai/skills/stacks-browse/scripts/browse.ts +61 -6
- package/app/Actions/Dashboard/Actions/GetActions.ts +15 -9
- package/app/Actions/Dashboard/Analytics/EventStoreAction.ts +21 -9
- package/app/Actions/Dashboard/Commerce/ProductUnitDefaultAction.ts +12 -3
- package/app/Actions/Dashboard/Commerce/TaxRateDefaultAction.ts +12 -3
- package/app/Actions/Dashboard/DashboardHealthAction.ts +34 -14
- package/app/Actions/Dashboard/DashboardHomeAction.test.ts +1 -1
- package/app/Actions/Dashboard/DashboardHomeAction.ts +31 -4
- package/app/Actions/Dashboard/DashboardStatsAction.ts +6 -1
- package/app/Actions/Dashboard/Email/InboxSendAction.ts +14 -7
- package/app/Actions/Dashboard/Infrastructure/CommandIndexAction.ts +33 -27
- package/app/Actions/Dashboard/Infrastructure/EnvironmentIndexAction.ts +10 -4
- package/app/Actions/Dashboard/Infrastructure/EnvironmentUpdateAction.ts +8 -1
- package/app/Actions/Dashboard/Infrastructure/RequestIndexAction.ts +24 -18
- package/app/Actions/Dashboard/Infrastructure/ServerIndexAction.ts +15 -9
- package/app/Actions/Dashboard/Infrastructure/ServerShowAction.ts +9 -2
- package/app/Actions/Dashboard/Marketing/CampaignCancelAction.ts +23 -5
- package/app/Actions/Dashboard/Marketing/CampaignDestroyAction.ts +26 -17
- package/app/Actions/Dashboard/Marketing/CampaignIndexAction.ts +49 -43
- package/app/Actions/Dashboard/Marketing/CampaignScheduleAction.ts +31 -25
- package/app/Actions/Dashboard/Marketing/CampaignSendAction.ts +28 -22
- package/app/Actions/Dashboard/Marketing/CampaignStoreAction.ts +15 -10
- package/app/Actions/Dashboard/Marketing/CampaignUpdateAction.ts +19 -12
- package/app/Actions/Dashboard/Marketing/ListDestroyAction.ts +34 -25
- package/app/Actions/Dashboard/Marketing/ListIndexAction.ts +32 -26
- package/app/Actions/Dashboard/Marketing/ListStoreAction.ts +31 -18
- package/app/Actions/Dashboard/Marketing/ListUpdateAction.ts +35 -19
- package/app/Actions/Dashboard/Marketing/SocialPostDestroyAction.ts +15 -5
- package/app/Actions/Dashboard/Marketing/SocialPostIndexAction.ts +11 -5
- package/app/Actions/Dashboard/Marketing/SocialPostStoreAction.ts +19 -13
- package/app/Actions/Dashboard/Marketing/SocialPostUpdateAction.ts +22 -12
- package/app/Actions/Dashboard/Marketing/campaign-delivery.ts +34 -0
- package/app/Actions/Dashboard/Marketing/marketing-list-records.test.ts +10 -0
- package/app/Actions/Dashboard/Marketing/marketing-list-records.ts +10 -0
- package/app/Actions/Dashboard/Marketing/marketing-response.ts +28 -0
- package/app/Actions/Dashboard/Marketing/social-post-records.test.ts +13 -0
- package/app/Actions/Dashboard/Marketing/social-post-records.ts +22 -4
- package/app/Actions/Dashboard/Models/GetModels.ts +14 -7
- package/app/Actions/Dashboard/Models/GetSubscriberCount.ts +8 -1
- package/app/Actions/Dashboard/Models/GetUserCount.ts +8 -1
- package/app/Actions/Dashboard/Releases/ReleaseIndexAction.ts +11 -5
- package/app/Actions/Dashboard/Settings/MailSettingsGetAction.ts +10 -4
- package/app/Actions/Dashboard/Settings/MailSettingsUpdateAction.ts +8 -1
- package/ide/vscode/package.json +1 -1
- package/package.json +1 -1
- package/resources/components/Dashboard/UI/Modal.stx +60 -10
- package/views/dashboard/stores/auth.ts +18 -2
|
@@ -3,15 +3,18 @@ import { Glob } from 'bun'
|
|
|
3
3
|
import { Action } from '@stacksjs/actions'
|
|
4
4
|
import { path } from '@stacksjs/path'
|
|
5
5
|
import { countRows } from '../../../../resources/functions/dashboard/data'
|
|
6
|
+
import { dashboardOperationalError } from '../dashboard-response'
|
|
6
7
|
|
|
7
8
|
export default new Action({
|
|
8
9
|
name: 'GetModels',
|
|
9
10
|
description: 'Gets the application models.',
|
|
11
|
+
method: 'GET',
|
|
10
12
|
|
|
11
13
|
async handle() {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
14
|
+
try {
|
|
15
|
+
const glob = new Glob('**/*.ts')
|
|
16
|
+
const scanOptions = { cwd: path.userModelsPath(), onlyFiles: true }
|
|
17
|
+
const displayModels: Model[] = []
|
|
15
18
|
|
|
16
19
|
for await (const file of glob.scan(scanOptions)) {
|
|
17
20
|
const model = (await import(path.userModelsPath(file))).default as Model
|
|
@@ -31,9 +34,13 @@ export default new Action({
|
|
|
31
34
|
displayModels.length = 8
|
|
32
35
|
displayModels.sort((a, b) => (a.name || '').localeCompare(b.name || ''))
|
|
33
36
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
37
|
+
return await Promise.all(displayModels.map(async model => ({
|
|
38
|
+
model: model.name,
|
|
39
|
+
total: await countRows(model),
|
|
40
|
+
})))
|
|
41
|
+
}
|
|
42
|
+
catch (error) {
|
|
43
|
+
return dashboardOperationalError(error, 'Dashboard models could not be loaded.', 'GetModels')
|
|
44
|
+
}
|
|
38
45
|
},
|
|
39
46
|
})
|
|
@@ -1,12 +1,19 @@
|
|
|
1
1
|
import { Action } from '@stacksjs/actions'
|
|
2
2
|
import { Subscriber } from '@stacksjs/orm'
|
|
3
|
+
import { dashboardOperationalError } from '../dashboard-response'
|
|
3
4
|
|
|
4
5
|
export default new Action({
|
|
5
6
|
name: 'GetSubscriberCount',
|
|
6
7
|
description: 'Gets the total number of subscribers.',
|
|
8
|
+
method: 'GET',
|
|
7
9
|
apiResponse: true,
|
|
8
10
|
|
|
9
11
|
async handle() {
|
|
10
|
-
|
|
12
|
+
try {
|
|
13
|
+
return await Subscriber.count()
|
|
14
|
+
}
|
|
15
|
+
catch (error) {
|
|
16
|
+
return dashboardOperationalError(error, 'Subscriber total could not be loaded.', 'GetSubscriberCount')
|
|
17
|
+
}
|
|
11
18
|
},
|
|
12
19
|
})
|
|
@@ -1,12 +1,19 @@
|
|
|
1
1
|
import { Action } from '@stacksjs/actions'
|
|
2
2
|
import { User } from '@stacksjs/orm'
|
|
3
|
+
import { dashboardOperationalError } from '../dashboard-response'
|
|
3
4
|
|
|
4
5
|
export default new Action({
|
|
5
6
|
name: 'GetUserCount',
|
|
6
7
|
description: 'Gets the total number of users.',
|
|
8
|
+
method: 'GET',
|
|
7
9
|
apiResponse: true,
|
|
8
10
|
|
|
9
11
|
async handle() {
|
|
10
|
-
|
|
12
|
+
try {
|
|
13
|
+
return await User.count()
|
|
14
|
+
}
|
|
15
|
+
catch (error) {
|
|
16
|
+
return dashboardOperationalError(error, 'User total could not be loaded.', 'GetUserCount')
|
|
17
|
+
}
|
|
11
18
|
},
|
|
12
19
|
})
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Action } from '@stacksjs/actions'
|
|
2
2
|
import { Release } from '@stacksjs/orm'
|
|
3
|
+
import { dashboardOperationalError } from '../dashboard-response'
|
|
3
4
|
import { normalizeReleaseRecord, summarizeReleases } from './release-records'
|
|
4
5
|
|
|
5
6
|
export default new Action({
|
|
@@ -9,12 +10,17 @@ export default new Action({
|
|
|
9
10
|
apiResponse: true,
|
|
10
11
|
|
|
11
12
|
async handle() {
|
|
12
|
-
|
|
13
|
-
|
|
13
|
+
try {
|
|
14
|
+
const records = await Release.orderByDesc('id').limit(200).get()
|
|
15
|
+
const releases = records.map(normalizeReleaseRecord)
|
|
14
16
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
17
|
+
return {
|
|
18
|
+
releases,
|
|
19
|
+
summary: summarizeReleases(releases),
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
catch (error) {
|
|
23
|
+
return dashboardOperationalError(error, 'Release history could not be loaded.', 'ReleaseIndexAction')
|
|
18
24
|
}
|
|
19
25
|
},
|
|
20
26
|
})
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Action } from '@stacksjs/actions'
|
|
2
|
+
import { dashboardOperationalError } from '../dashboard-response'
|
|
2
3
|
import { readMailSettings } from './mail-settings'
|
|
3
4
|
|
|
4
5
|
export default new Action({
|
|
@@ -8,9 +9,14 @@ export default new Action({
|
|
|
8
9
|
apiResponse: true,
|
|
9
10
|
|
|
10
11
|
async handle() {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
12
|
+
try {
|
|
13
|
+
return Response.json(
|
|
14
|
+
{ settings: await readMailSettings() },
|
|
15
|
+
{ headers: { 'Cache-Control': 'no-store', Pragma: 'no-cache' } },
|
|
16
|
+
)
|
|
17
|
+
}
|
|
18
|
+
catch (error) {
|
|
19
|
+
return dashboardOperationalError(error, 'Mail settings could not be loaded.', 'MailSettingsGetAction')
|
|
20
|
+
}
|
|
15
21
|
},
|
|
16
22
|
})
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { RequestInstance } from '@stacksjs/types'
|
|
2
2
|
import { Action } from '@stacksjs/actions'
|
|
3
3
|
import { response } from '@stacksjs/router'
|
|
4
|
+
import { dashboardOperationalError } from '../dashboard-response'
|
|
4
5
|
import { updateMailSettings } from './mail-settings'
|
|
5
6
|
|
|
6
7
|
export default new Action({
|
|
@@ -10,7 +11,13 @@ export default new Action({
|
|
|
10
11
|
apiResponse: true,
|
|
11
12
|
|
|
12
13
|
async handle(request: RequestInstance) {
|
|
13
|
-
|
|
14
|
+
let result
|
|
15
|
+
try {
|
|
16
|
+
result = await updateMailSettings(await request.all())
|
|
17
|
+
}
|
|
18
|
+
catch (error) {
|
|
19
|
+
return dashboardOperationalError(error, 'Mail settings could not be saved.', 'MailSettingsUpdateAction', 500)
|
|
20
|
+
}
|
|
14
21
|
|
|
15
22
|
if ('validation' in result) {
|
|
16
23
|
return response.json({
|
package/ide/vscode/package.json
CHANGED
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@stacksjs/defaults",
|
|
3
3
|
"type": "module",
|
|
4
4
|
"sideEffects": false,
|
|
5
|
-
"version": "0.70.
|
|
5
|
+
"version": "0.70.358",
|
|
6
6
|
"description": "The complete managed Stacks application scaffold, including runtime defaults, AI guidance, editor metadata, and npm-backed project support files.",
|
|
7
7
|
"author": "Chris Breuer",
|
|
8
8
|
"license": "MIT",
|
|
@@ -19,25 +19,68 @@ const sizeClasses = {
|
|
|
19
19
|
</script>
|
|
20
20
|
<script client>
|
|
21
21
|
const open = useReactiveProp('isOpen', false)
|
|
22
|
+
const liveClosable = useReactiveProp('closable', true)
|
|
22
23
|
const liveTitle = useReactiveProp('title', '')
|
|
23
24
|
const liveDescription = useReactiveProp('description', '')
|
|
25
|
+
const dialog = useRef<HTMLDialogElement>('dashboardModalDialog')
|
|
26
|
+
const activeElement = useActiveElement()
|
|
27
|
+
const scrollLocked = useScrollLock()
|
|
24
28
|
const emit = defineEmits()
|
|
29
|
+
let restoreFocus: HTMLElement | null = null
|
|
25
30
|
|
|
26
31
|
function closeModal(): void {
|
|
32
|
+
if (!liveClosable()) return
|
|
27
33
|
emit('close')
|
|
28
34
|
}
|
|
29
|
-
</script>
|
|
30
|
-
<div :if="open()" class="fixed inset-y-0 overflow-y-auto right-0 z-[55] dashboard-modal-layer">
|
|
31
|
-
<!-- Overlay -->
|
|
32
|
-
<button type="button" class="absolute inset-0 w-full bg-black/50 backdrop-blur-sm" aria-label="Close modal" @click="closeModal"></button>
|
|
33
35
|
|
|
36
|
+
function handleCancel(event: Event): void {
|
|
37
|
+
event.preventDefault()
|
|
38
|
+
closeModal()
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
function handleBackdropClick(event: MouseEvent): void {
|
|
42
|
+
if (event.target === event.currentTarget)
|
|
43
|
+
closeModal()
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
effect(() => {
|
|
47
|
+
const isOpen = open()
|
|
48
|
+
scrollLocked.value = isOpen
|
|
49
|
+
|
|
50
|
+
if (isOpen) {
|
|
51
|
+
const focused = peek(() => activeElement.value)
|
|
52
|
+
if (focused instanceof HTMLElement)
|
|
53
|
+
restoreFocus = focused
|
|
54
|
+
void nextTick(() => {
|
|
55
|
+
const element = dialog.current
|
|
56
|
+
if (!element) return
|
|
57
|
+
if (!element.open)
|
|
58
|
+
element.showModal()
|
|
59
|
+
element.focus()
|
|
60
|
+
})
|
|
61
|
+
return
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
if (dialog.current?.open)
|
|
65
|
+
dialog.current.close()
|
|
66
|
+
const target = restoreFocus
|
|
67
|
+
restoreFocus = null
|
|
68
|
+
if (target)
|
|
69
|
+
void nextTick(() => target.focus())
|
|
70
|
+
})
|
|
71
|
+
</script>
|
|
72
|
+
<dialog
|
|
73
|
+
:if="open()"
|
|
74
|
+
ref="dashboardModalDialog"
|
|
75
|
+
role="dialog"
|
|
76
|
+
aria-modal="true"
|
|
77
|
+
:aria-label="liveTitle() || 'Dialog'"
|
|
78
|
+
class="fixed inset-0 m-0 p-0 h-dvh max-h-none w-screen max-w-none overflow-y-auto z-[55] bg-transparent dashboard-modal-layer dashboard-modal-dialog"
|
|
79
|
+
@cancel="handleCancel"
|
|
80
|
+
>
|
|
34
81
|
<!-- Modal container -->
|
|
35
|
-
<div class="flex items-center justify-center p-4 min-h-full">
|
|
82
|
+
<div class="flex items-center justify-center p-4 min-h-full" @click="handleBackdropClick">
|
|
36
83
|
<div
|
|
37
|
-
role="dialog"
|
|
38
|
-
aria-modal="true"
|
|
39
|
-
:aria-label="liveTitle() || 'Dialog'"
|
|
40
|
-
tabindex="-1"
|
|
41
84
|
class="relative w-full rounded-xl bg-white dark:bg-neutral-900 shadow-2xl {{ sizeClasses[size] }}"
|
|
42
85
|
>
|
|
43
86
|
<!-- Header -->
|
|
@@ -78,4 +121,11 @@ function closeModal(): void {
|
|
|
78
121
|
@endif
|
|
79
122
|
</div>
|
|
80
123
|
</div>
|
|
81
|
-
</
|
|
124
|
+
</dialog>
|
|
125
|
+
|
|
126
|
+
<style>
|
|
127
|
+
.dashboard-modal-dialog::backdrop {
|
|
128
|
+
background: rgb(0 0 0 / 50%);
|
|
129
|
+
backdrop-filter: blur(4px);
|
|
130
|
+
}
|
|
131
|
+
</style>
|
|
@@ -33,6 +33,7 @@ export const authStore = defineStore('auth', () => {
|
|
|
33
33
|
const loading = state(false)
|
|
34
34
|
const error = state<string | null>(null)
|
|
35
35
|
const loaded = state(false)
|
|
36
|
+
let pendingLoad: Promise<void> | null = null
|
|
36
37
|
|
|
37
38
|
const isAdmin = derived(() => {
|
|
38
39
|
if (!loaded()) return false
|
|
@@ -50,8 +51,7 @@ export const authStore = defineStore('auth', () => {
|
|
|
50
51
|
return roles().includes('client')
|
|
51
52
|
})
|
|
52
53
|
|
|
53
|
-
async function
|
|
54
|
-
if (loading() || loaded()) return
|
|
54
|
+
async function resolveIdentity(): Promise<void> {
|
|
55
55
|
loading.set(true)
|
|
56
56
|
error.set(null)
|
|
57
57
|
try {
|
|
@@ -88,7 +88,23 @@ export const authStore = defineStore('auth', () => {
|
|
|
88
88
|
}
|
|
89
89
|
}
|
|
90
90
|
|
|
91
|
+
function load(): Promise<void> {
|
|
92
|
+
if (loaded())
|
|
93
|
+
return Promise.resolve()
|
|
94
|
+
|
|
95
|
+
if (pendingLoad)
|
|
96
|
+
return pendingLoad
|
|
97
|
+
|
|
98
|
+
pendingLoad = resolveIdentity().finally(() => {
|
|
99
|
+
pendingLoad = null
|
|
100
|
+
})
|
|
101
|
+
return pendingLoad
|
|
102
|
+
}
|
|
103
|
+
|
|
91
104
|
async function refresh(): Promise<void> {
|
|
105
|
+
if (pendingLoad)
|
|
106
|
+
await pendingLoad
|
|
107
|
+
|
|
92
108
|
loaded.set(false)
|
|
93
109
|
await load()
|
|
94
110
|
}
|