@stacksjs/actions 0.70.88 → 0.70.90

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.
Files changed (261) hide show
  1. package/dist/action.d.ts +149 -0
  2. package/dist/action.js +78 -0
  3. package/dist/actions.d.ts +2 -0
  4. package/dist/actions.js +2 -0
  5. package/dist/add.d.ts +6 -0
  6. package/dist/add.js +20 -0
  7. package/dist/ai/request-model-access.d.ts +1 -0
  8. package/dist/ai/request-model-access.js +10 -0
  9. package/dist/auth/client.d.ts +1 -0
  10. package/dist/auth/client.js +44 -0
  11. package/dist/auth/prune.d.ts +1 -0
  12. package/dist/auth/prune.js +35 -0
  13. package/dist/auth/setup.d.ts +1 -0
  14. package/dist/auth/setup.js +322 -0
  15. package/dist/auth/token.d.ts +1 -0
  16. package/dist/auth/token.js +10 -0
  17. package/dist/blog-admin.d.ts +55 -0
  18. package/dist/blog-admin.js +156 -0
  19. package/dist/blog.d.ts +30 -0
  20. package/dist/blog.js +398 -0
  21. package/dist/build/cli.d.ts +1 -0
  22. package/dist/build/cli.js +6 -0
  23. package/dist/build/component-libs.d.ts +1 -0
  24. package/dist/build/component-libs.js +7 -0
  25. package/dist/build/core.d.ts +1 -0
  26. package/dist/build/core.js +55 -0
  27. package/dist/build/desktop.d.ts +1 -0
  28. package/dist/build/desktop.js +5 -0
  29. package/dist/build/docs.d.ts +1 -0
  30. package/dist/build/docs.js +5 -0
  31. package/dist/build/frontend-static.d.ts +16 -0
  32. package/dist/build/frontend-static.js +124 -0
  33. package/dist/build/server.d.ts +1 -0
  34. package/dist/build/server.js +6 -0
  35. package/dist/build/stacks.d.ts +1 -0
  36. package/dist/build/stacks.js +8 -0
  37. package/dist/build/views.d.ts +1 -0
  38. package/dist/build/views.js +11 -0
  39. package/dist/build.d.ts +9 -0
  40. package/dist/build.js +64 -0
  41. package/dist/bump.d.ts +1 -0
  42. package/dist/bump.js +163 -0
  43. package/dist/cdn/invalidate-cache.d.ts +1 -0
  44. package/dist/cdn/invalidate-cache.js +0 -0
  45. package/dist/changelog.d.ts +9 -0
  46. package/dist/changelog.js +27 -0
  47. package/dist/check/ports.d.ts +1 -0
  48. package/dist/check/ports.js +16 -0
  49. package/dist/clean.d.ts +1 -0
  50. package/dist/clean.js +4 -0
  51. package/dist/commit.d.ts +3 -0
  52. package/dist/commit.js +12 -0
  53. package/dist/copy-types.d.ts +1 -0
  54. package/dist/copy-types.js +10 -0
  55. package/dist/database/seed.d.ts +1 -0
  56. package/dist/database/seed.js +26 -0
  57. package/dist/deploy/create-receipt-rule.d.ts +1 -0
  58. package/dist/deploy/create-receipt-rule.js +36 -0
  59. package/dist/deploy/index.d.ts +1 -0
  60. package/dist/deploy/index.js +1574 -0
  61. package/dist/dev/api.d.ts +1 -0
  62. package/dist/dev/api.js +94 -0
  63. package/dist/dev/components.d.ts +1 -0
  64. package/dist/dev/components.js +7 -0
  65. package/dist/dev/dashboard-globals.d.ts +4 -0
  66. package/dist/dev/dashboard-globals.js +89 -0
  67. package/dist/dev/dashboard-utils.d.ts +150 -0
  68. package/dist/dev/dashboard-utils.js +380 -0
  69. package/dist/dev/dashboard.d.ts +22 -0
  70. package/dist/dev/dashboard.js +435 -0
  71. package/dist/dev/desktop.d.ts +1 -0
  72. package/dist/dev/desktop.js +5 -0
  73. package/dist/dev/docs.d.ts +1 -0
  74. package/dist/dev/docs.js +24 -0
  75. package/dist/dev/index.d.ts +10 -0
  76. package/dist/dev/index.js +29 -0
  77. package/dist/dev/migrate-watcher.d.ts +1 -0
  78. package/dist/dev/migrate-watcher.js +74 -0
  79. package/dist/dev/system-tray.d.ts +1 -0
  80. package/dist/dev/system-tray.js +5 -0
  81. package/dist/dev/views.d.ts +1 -0
  82. package/dist/dev/views.js +147 -0
  83. package/dist/discover-packages.d.ts +18 -0
  84. package/dist/discover-packages.js +32 -0
  85. package/dist/domains/add.d.ts +1 -0
  86. package/dist/domains/add.js +61 -0
  87. package/dist/domains/purchase.d.ts +1 -0
  88. package/dist/domains/purchase.js +66 -0
  89. package/dist/domains/remove.d.ts +1 -0
  90. package/dist/domains/remove.js +24 -0
  91. package/dist/examples.d.ts +5 -0
  92. package/dist/examples.js +34 -0
  93. package/dist/find-projects.d.ts +1 -0
  94. package/dist/find-projects.js +16 -0
  95. package/dist/fresh.d.ts +1 -0
  96. package/dist/fresh.js +17 -0
  97. package/dist/generate/action-types.d.ts +1 -0
  98. package/dist/generate/action-types.js +13 -0
  99. package/dist/generate/component-meta.d.ts +1 -0
  100. package/dist/generate/component-meta.js +9 -0
  101. package/dist/generate/custom-cli-file.d.ts +1 -0
  102. package/dist/generate/custom-cli-file.js +21 -0
  103. package/dist/generate/env-files.d.ts +1 -0
  104. package/dist/generate/env-files.js +66 -0
  105. package/dist/generate/ide-helpers.d.ts +1 -0
  106. package/dist/generate/ide-helpers.js +8 -0
  107. package/dist/generate/index.d.ts +36 -0
  108. package/dist/generate/index.js +158 -0
  109. package/dist/generate/lib-entries.d.ts +1 -0
  110. package/dist/generate/lib-entries.js +16 -0
  111. package/dist/generate/pantry-file.d.ts +1 -0
  112. package/dist/generate/pantry-file.js +46 -0
  113. package/dist/generate/symlink-core.d.ts +1 -0
  114. package/dist/generate/symlink-core.js +2 -0
  115. package/dist/generate/types.d.ts +1 -0
  116. package/dist/generate/types.js +3 -0
  117. package/dist/generate/vscode-custom-data.d.ts +1 -0
  118. package/dist/generate/vscode-custom-data.js +9 -0
  119. package/dist/generate/web-types.d.ts +1 -0
  120. package/dist/generate/web-types.js +0 -0
  121. package/dist/helpers/component-meta.d.ts +26 -0
  122. package/dist/helpers/component-meta.js +295 -0
  123. package/dist/helpers/index.d.ts +4 -0
  124. package/dist/helpers/index.js +1 -0
  125. package/dist/helpers/lib-entries.d.ts +12 -0
  126. package/dist/helpers/lib-entries.js +73 -0
  127. package/dist/helpers/package-json.d.ts +2 -0
  128. package/dist/helpers/package-json.js +74 -0
  129. package/dist/helpers/utils.d.ts +23 -0
  130. package/dist/helpers/utils.js +105 -0
  131. package/dist/helpers/vscode-custom-data.d.ts +3 -0
  132. package/dist/helpers/vscode-custom-data.js +30 -0
  133. package/dist/index.d.ts +62 -0
  134. package/dist/index.js +50 -0
  135. package/dist/key-generate.d.ts +1 -0
  136. package/dist/key-generate.js +24 -0
  137. package/dist/lint/fix.d.ts +1 -0
  138. package/dist/lint/fix.js +4 -0
  139. package/dist/lint/index.d.ts +1 -0
  140. package/dist/lint/index.js +4 -0
  141. package/dist/lint/lint.d.ts +14 -0
  142. package/dist/lint/lint.js +34 -0
  143. package/dist/make-command.d.ts +10 -0
  144. package/dist/make-command.js +95 -0
  145. package/dist/make-job.d.ts +5 -0
  146. package/dist/make-job.js +154 -0
  147. package/dist/make-policy.d.ts +10 -0
  148. package/dist/make-policy.js +142 -0
  149. package/dist/make-resource.d.ts +10 -0
  150. package/dist/make-resource.js +142 -0
  151. package/dist/make.d.ts +52 -0
  152. package/dist/make.js +328 -0
  153. package/dist/migrate/database.d.ts +1 -0
  154. package/dist/migrate/database.js +16 -0
  155. package/dist/migrate/fresh.d.ts +1 -0
  156. package/dist/migrate/fresh.js +31 -0
  157. package/dist/orm/base.d.ts +1 -0
  158. package/dist/orm/base.js +0 -0
  159. package/dist/orm/test.d.ts +1 -0
  160. package/dist/orm/test.js +0 -0
  161. package/dist/prepublish.d.ts +1 -0
  162. package/dist/prepublish.js +16 -0
  163. package/dist/queue/clear.d.ts +1 -0
  164. package/dist/queue/clear.js +42 -0
  165. package/dist/queue/dlq-purge.d.ts +1 -0
  166. package/dist/queue/dlq-purge.js +28 -0
  167. package/dist/queue/dlq-retry.d.ts +1 -0
  168. package/dist/queue/dlq-retry.js +35 -0
  169. package/dist/queue/dlq.d.ts +1 -0
  170. package/dist/queue/dlq.js +55 -0
  171. package/dist/queue/failed.d.ts +1 -0
  172. package/dist/queue/failed.js +69 -0
  173. package/dist/queue/flush.d.ts +1 -0
  174. package/dist/queue/flush.js +49 -0
  175. package/dist/queue/inspect.d.ts +1 -0
  176. package/dist/queue/inspect.js +154 -0
  177. package/dist/queue/list.d.ts +1 -0
  178. package/dist/queue/list.js +69 -0
  179. package/dist/queue/monitor.d.ts +1 -0
  180. package/dist/queue/monitor.js +95 -0
  181. package/dist/queue/pause.d.ts +1 -0
  182. package/dist/queue/pause.js +28 -0
  183. package/dist/queue/quarantine.d.ts +1 -0
  184. package/dist/queue/quarantine.js +42 -0
  185. package/dist/queue/resume.d.ts +1 -0
  186. package/dist/queue/resume.js +27 -0
  187. package/dist/queue/retry.d.ts +1 -0
  188. package/dist/queue/retry.js +41 -0
  189. package/dist/queue/schedule-list.d.ts +1 -0
  190. package/dist/queue/schedule-list.js +33 -0
  191. package/dist/queue/schedule.d.ts +1 -0
  192. package/dist/queue/schedule.js +12 -0
  193. package/dist/queue/status.d.ts +1 -0
  194. package/dist/queue/status.js +68 -0
  195. package/dist/queue/table.d.ts +1 -0
  196. package/dist/queue/table.js +10 -0
  197. package/dist/queue/unquarantine.d.ts +1 -0
  198. package/dist/queue/unquarantine.js +27 -0
  199. package/dist/queue/work.d.ts +1 -0
  200. package/dist/queue/work.js +57 -0
  201. package/dist/release.d.ts +1 -0
  202. package/dist/release.js +21 -0
  203. package/dist/route/list.d.ts +1 -0
  204. package/dist/route/list.js +78 -0
  205. package/dist/run-action.d.ts +2 -0
  206. package/dist/run-action.js +1 -0
  207. package/dist/saas/setup.d.ts +1 -0
  208. package/dist/saas/setup.js +9 -0
  209. package/dist/scaffold-crud.d.ts +25 -0
  210. package/dist/scaffold-crud.js +211 -0
  211. package/dist/schedule/run.d.ts +1 -0
  212. package/dist/schedule/run.js +7 -0
  213. package/dist/search/flush.d.ts +1 -0
  214. package/dist/search/flush.js +10 -0
  215. package/dist/search/import.d.ts +1 -0
  216. package/dist/search/import.js +10 -0
  217. package/dist/search/settings-list.d.ts +1 -0
  218. package/dist/search/settings-list.js +10 -0
  219. package/dist/search/settings.d.ts +1 -0
  220. package/dist/search/settings.js +9 -0
  221. package/dist/serve/api.d.ts +1 -0
  222. package/dist/serve/api.js +35 -0
  223. package/dist/setup/index.d.ts +1 -0
  224. package/dist/setup/index.js +1 -0
  225. package/dist/setup/ssl.d.ts +38 -0
  226. package/dist/setup/ssl.js +271 -0
  227. package/dist/stacks.d.ts +4 -0
  228. package/dist/stacks.js +265 -0
  229. package/dist/templates.d.ts +28 -0
  230. package/dist/templates.js +301 -0
  231. package/dist/test/feature.d.ts +1 -0
  232. package/dist/test/feature.js +11 -0
  233. package/dist/test/index.d.ts +1 -0
  234. package/dist/test/index.js +11 -0
  235. package/dist/test/ui.d.ts +1 -0
  236. package/dist/test/ui.js +4 -0
  237. package/dist/test/unit.d.ts +1 -0
  238. package/dist/test/unit.js +11 -0
  239. package/dist/typecheck.d.ts +1 -0
  240. package/dist/typecheck.js +4 -0
  241. package/dist/types.d.ts +3 -0
  242. package/dist/types.js +16 -0
  243. package/dist/upgrade/binary.d.ts +1 -0
  244. package/dist/upgrade/binary.js +29 -0
  245. package/dist/upgrade/bun.d.ts +1 -0
  246. package/dist/upgrade/bun.js +0 -0
  247. package/dist/upgrade/dependencies.d.ts +1 -0
  248. package/dist/upgrade/dependencies.js +0 -0
  249. package/dist/upgrade/framework-utils.d.ts +150 -0
  250. package/dist/upgrade/framework-utils.js +193 -0
  251. package/dist/upgrade/framework.d.ts +1 -0
  252. package/dist/upgrade/framework.js +310 -0
  253. package/dist/upgrade/index.d.ts +1 -0
  254. package/dist/upgrade/index.js +17 -0
  255. package/dist/upgrade/packages.d.ts +14 -0
  256. package/dist/upgrade/packages.js +99 -0
  257. package/dist/upgrade/shell.d.ts +1 -0
  258. package/dist/upgrade/shell.js +41 -0
  259. package/dist/upgrade.d.ts +7 -0
  260. package/dist/upgrade.js +38 -0
  261. package/package.json +16 -16
@@ -0,0 +1,380 @@
1
+ import { Glob } from "bun";
2
+ import path from "node:path";
3
+ export const iconMap = {
4
+ user: "person.fill",
5
+ team: "person.2.fill",
6
+ subscriber: "envelope.open.fill",
7
+ subscriberemail: "envelope.fill",
8
+ post: "doc.text.fill",
9
+ page: "doc.fill",
10
+ product: "cube.box.fill",
11
+ productvariant: "cube.fill",
12
+ productunit: "scalemass.fill",
13
+ order: "list.clipboard.fill",
14
+ orderitem: "list.bullet.clipboard.fill",
15
+ customer: "person.crop.circle.fill",
16
+ payment: "creditcard.fill",
17
+ paymentmethod: "creditcard.and.123",
18
+ paymentproduct: "creditcard.fill",
19
+ paymenttransaction: "creditcard.fill",
20
+ category: "tag.fill",
21
+ tag: "tag",
22
+ comment: "bubble.left.fill",
23
+ author: "person.text.rectangle.fill",
24
+ notification: "bell.fill",
25
+ job: "briefcase.fill",
26
+ log: "list.bullet.rectangle.portrait.fill",
27
+ campaign: "megaphone.fill",
28
+ review: "star.fill",
29
+ coupon: "ticket.fill",
30
+ giftcard: "giftcard.fill",
31
+ cart: "cart.fill",
32
+ cartitem: "cart.badge.plus",
33
+ taxrate: "percent",
34
+ transaction: "arrow.left.arrow.right.circle.fill",
35
+ subscription: "repeat.circle.fill",
36
+ emaillist: "envelope.badge.person.crop",
37
+ socialpost: "bubble.left.and.bubble.right.fill",
38
+ manufacturer: "building.2.fill",
39
+ shippingmethod: "shippingbox.fill",
40
+ shippingzone: "map.fill",
41
+ shippingrate: "dollarsign.circle.fill",
42
+ deliveryroute: "map.fill",
43
+ driver: "car.fill",
44
+ digitaldelivery: "arrow.down.doc.fill",
45
+ licensekey: "key.fill",
46
+ loyaltypoint: "star.circle.fill",
47
+ loyaltyreward: "gift.fill",
48
+ printdevice: "printer.fill",
49
+ receipt: "doc.text.fill",
50
+ waitlistproduct: "clock.fill",
51
+ waitlistrestaurant: "clock.badge.checkmark.fill",
52
+ websocket: "antenna.radiowaves.left.and.right",
53
+ default: "tablecells.fill"
54
+ }, excludeModels = new Set(["activity", "request", "error", "failedjob"]), dedicatedPages = new Set(["user", "team", "subscriber", "post", "page", "product", "order", "customer", "payment", "coupon", "category", "tag", "comment", "author", "notification", "job", "campaign", "review", "gift-card"]);
55
+ const ROOT_MODEL_CATEGORY = {
56
+ user: "data",
57
+ team: "data",
58
+ subscriber: "data",
59
+ activity: "data",
60
+ campaign: "marketing",
61
+ emaillist: "marketing",
62
+ socialpost: "marketing",
63
+ subscriberemail: "marketing",
64
+ comment: "content",
65
+ tag: "content",
66
+ paymentmethod: "commerce",
67
+ paymentproduct: "commerce",
68
+ paymenttransaction: "commerce",
69
+ subscription: "commerce",
70
+ deployment: "system",
71
+ error: "system",
72
+ failedjob: "system",
73
+ job: "system",
74
+ log: "system",
75
+ notification: "system",
76
+ release: "system",
77
+ request: "system"
78
+ };
79
+ export function modelNameToId(name) {
80
+ return name.replace(/([A-Z])/g, "-$1").toLowerCase().replace(/^-/, "");
81
+ }
82
+ export function getModelIcon(name) {
83
+ return iconMap[name.toLowerCase()] || iconMap.default || "database";
84
+ }
85
+ function categorizeModel(relativePath, modelId, defaultCategory) {
86
+ if (defaultCategory)
87
+ return defaultCategory;
88
+ const firstSeg = relativePath.includes("/") ? (relativePath.split("/")[0] ?? "").toLowerCase() : "";
89
+ if (firstSeg === "commerce")
90
+ return "commerce";
91
+ if (firstSeg === "content")
92
+ return "content";
93
+ if (firstSeg === "realtime")
94
+ return "system";
95
+ return ROOT_MODEL_CATEGORY[modelId.replace(/-/g, "")] ?? "data";
96
+ }
97
+ async function readModelDashboardConfig(absolutePath) {
98
+ try {
99
+ const mod = await import(absolutePath);
100
+ return (mod.default ?? mod).dashboard;
101
+ } catch {
102
+ return;
103
+ }
104
+ }
105
+ export async function scanModelsDir(dir, seenNames, models, defaultCategory) {
106
+ try {
107
+ const glob = new Glob("**/*.ts");
108
+ for await (const file of glob.scan({ cwd: dir })) {
109
+ if (file.includes("README") || file.includes(".d.ts"))
110
+ continue;
111
+ const name = file.replace(/\.ts$/, "").split("/").pop() || "", nameLower = name.toLowerCase();
112
+ if (name && !seenNames.has(nameLower) && !excludeModels.has(nameLower)) {
113
+ seenNames.add(nameLower);
114
+ const id = modelNameToId(name), absolutePath = path.join(dir, file), dashboard = await readModelDashboardConfig(absolutePath);
115
+ models.push({
116
+ name,
117
+ icon: dashboard?.icon ?? getModelIcon(name),
118
+ id,
119
+ category: categorizeModel(file, id, defaultCategory),
120
+ dashboard
121
+ });
122
+ }
123
+ }
124
+ } catch {}
125
+ }
126
+ export async function discoverModels(userModelsPath, defaultModelsPath) {
127
+ const models = [], seenNames = new Set;
128
+ await Promise.all([
129
+ scanModelsDir(userModelsPath, seenNames, models, "userland"),
130
+ scanModelsDir(defaultModelsPath, seenNames, models)
131
+ ]);
132
+ return models.sort((a, b) => a.name.localeCompare(b.name));
133
+ }
134
+ export function buildManifest(models) {
135
+ return models.map((m) => {
136
+ const row = {
137
+ id: m.id,
138
+ name: m.name,
139
+ icon: m.icon,
140
+ hasDedicatedPage: dedicatedPages.has(m.id),
141
+ category: m.category ?? "data"
142
+ };
143
+ if (m.dashboard)
144
+ row.dashboard = m.dashboard;
145
+ return row;
146
+ });
147
+ }
148
+ export async function isPortAvailable(port) {
149
+ try {
150
+ Bun.serve({ port, fetch: () => new Response }).stop(!0);
151
+ return !0;
152
+ } catch {
153
+ return !1;
154
+ }
155
+ }
156
+ export async function findAvailablePort(preferred, maxAttempts = 20) {
157
+ for (let i = 0;i < maxAttempts; i++) {
158
+ const port = preferred + i;
159
+ if (await isPortAvailable(port))
160
+ return port;
161
+ }
162
+ return preferred;
163
+ }
164
+ export async function waitForServer(port, maxWait = 500) {
165
+ const start = Date.now();
166
+ while (Date.now() - start < maxWait) {
167
+ try {
168
+ const res = await fetch(`http://localhost:${port}/`, { method: "HEAD" });
169
+ if (res.ok || res.status === 404)
170
+ return !0;
171
+ } catch {}
172
+ await new Promise((resolve) => setTimeout(resolve, 25));
173
+ }
174
+ return !1;
175
+ }
176
+ function effectiveCategory(m) {
177
+ if (m.dashboard?.enabled === !1)
178
+ return;
179
+ if (m.dashboard?.section)
180
+ return m.dashboard.section;
181
+ return m.category ?? "data";
182
+ }
183
+ function categoryRows(baseRoute, models, category, dedicated) {
184
+ return models.filter((m) => effectiveCategory(m) === category).filter((m) => !dedicatedPages.has(m.id) && !dedicated.has(m.id)).map((m) => ({
185
+ id: `model-${m.id}`,
186
+ label: m.dashboard?.label ?? m.name,
187
+ icon: m.icon,
188
+ url: `${baseRoute}/models/${m.id}`,
189
+ ...m.dashboard?.roles && m.dashboard.roles.length > 0 ? { roles: m.dashboard.roles } : {}
190
+ }));
191
+ }
192
+ export function buildSidebarConfig(baseRoute, discoveredModels, toggles = {}) {
193
+ const enabled = {
194
+ library: toggles.library ?? !0,
195
+ content: toggles.content ?? !0,
196
+ commerce: toggles.commerce ?? !0,
197
+ marketing: toggles.marketing ?? !0,
198
+ analytics: toggles.analytics ?? !0,
199
+ management: toggles.management ?? !0,
200
+ utilities: toggles.utilities ?? !0
201
+ }, dataRow = {
202
+ dashboard: toggles.data?.dashboard ?? !0,
203
+ activity: toggles.data?.activity ?? !0,
204
+ users: toggles.data?.users ?? !0,
205
+ teams: toggles.data?.teams ?? !0,
206
+ subscribers: toggles.data?.subscribers ?? !0,
207
+ allModels: toggles.data?.allModels ?? !0
208
+ }, sections = [], homeItems = [
209
+ { id: "home", label: "Dashboard", icon: "house.fill", url: `${baseRoute}/` },
210
+ { id: "dependencies", label: "Dependencies", icon: "shippingbox.fill", url: `${baseRoute}/dependencies` },
211
+ { id: "health", label: "Health", icon: "heart.text.square.fill", url: `${baseRoute}/health` }
212
+ ];
213
+ if (toggles.ci)
214
+ homeItems.push({ id: "ci", label: "CI", icon: "checkmark.seal.fill", url: `${baseRoute}/ci` });
215
+ sections.push({
216
+ id: "home",
217
+ title: "Home",
218
+ items: homeItems
219
+ });
220
+ if (enabled.library)
221
+ sections.push({
222
+ id: "library",
223
+ title: "Library",
224
+ items: [
225
+ { id: "functions", label: "Functions", icon: "function", url: `${baseRoute}/functions` },
226
+ { id: "packages", label: "Packages", icon: "shippingbox.fill", url: `${baseRoute}/packages` }
227
+ ]
228
+ });
229
+ if (enabled.content)
230
+ sections.push({
231
+ id: "content",
232
+ title: "Content",
233
+ items: [
234
+ { id: "content-dashboard", label: "Dashboard", icon: "gauge.with.dots.needle.33percent", url: `${baseRoute}/content/dashboard` },
235
+ { id: "files", label: "Files", icon: "folder.fill", url: `${baseRoute}/content/files` },
236
+ { id: "pages", label: "Pages", icon: "doc.fill", url: `${baseRoute}/content/pages` },
237
+ { id: "posts", label: "Posts", icon: "text.bubble.fill", url: `${baseRoute}/content/posts` },
238
+ { id: "categories", label: "Categories", icon: "tag.fill", url: `${baseRoute}/content/categories` },
239
+ { id: "tags", label: "Tags", icon: "tag", url: `${baseRoute}/content/tags` },
240
+ { id: "comments", label: "Comments", icon: "bubble.left.fill", url: `${baseRoute}/content/comments` },
241
+ { id: "authors", label: "Authors", icon: "person.text.rectangle.fill", url: `${baseRoute}/content/authors` },
242
+ { id: "seo", label: "SEO", icon: "magnifyingglass", url: `${baseRoute}/content/seo` },
243
+ ...categoryRows(baseRoute, discoveredModels, "content", new Set([
244
+ "page",
245
+ "post",
246
+ "category",
247
+ "tag",
248
+ "comment",
249
+ "author"
250
+ ]))
251
+ ]
252
+ });
253
+ sections.push({
254
+ id: "app",
255
+ title: "App",
256
+ items: [
257
+ { id: "deployments", label: "Deployments", icon: "rocket.fill", url: `${baseRoute}/deployments` },
258
+ { id: "requests", label: "Requests", icon: "arrow.left.arrow.right", url: `${baseRoute}/requests` },
259
+ { id: "realtime", label: "Realtime", icon: "link", url: `${baseRoute}/realtime` },
260
+ { id: "actions", label: "Actions", icon: "bolt.fill", url: `${baseRoute}/actions` },
261
+ { id: "commands", label: "Commands", icon: "terminal.fill", url: `${baseRoute}/commands` },
262
+ { id: "queue", label: "Queue", icon: "list.bullet.rectangle.fill", url: `${baseRoute}/queue` },
263
+ { id: "jobs", label: "Jobs", icon: "briefcase.fill", url: `${baseRoute}/jobs` },
264
+ { id: "inbox", label: "Inbox", icon: "tray.full.fill", url: `${baseRoute}/inbox` },
265
+ { id: "queries", label: "Queries", icon: "magnifyingglass.circle.fill", url: `${baseRoute}/queries` },
266
+ { id: "notifications", label: "Notifications", icon: "bell.fill", url: `${baseRoute}/notifications/dashboard` },
267
+ ...categoryRows(baseRoute, discoveredModels, "system", new Set)
268
+ ]
269
+ });
270
+ const dataItems = [];
271
+ if (dataRow.dashboard)
272
+ dataItems.push({ id: "data-dashboard", label: "Dashboard", icon: "gauge.with.dots.needle.33percent", url: `${baseRoute}/data/dashboard` });
273
+ if (dataRow.activity)
274
+ dataItems.push({ id: "activity", label: "Activity", icon: "waveform.path.ecg", url: `${baseRoute}/data/activity` });
275
+ if (dataRow.users)
276
+ dataItems.push({ id: "users", label: "Users", icon: "person.crop.circle.fill", url: `${baseRoute}/data/users` });
277
+ if (dataRow.teams)
278
+ dataItems.push({ id: "teams", label: "Teams", icon: "person.3.fill", url: `${baseRoute}/data/teams` });
279
+ if (dataRow.subscribers)
280
+ dataItems.push({ id: "subscribers", label: "Subscribers", icon: "envelope.fill", url: `${baseRoute}/data/subscribers` });
281
+ if (dataRow.allModels)
282
+ dataItems.push({ id: "data-models", label: "All Models", icon: "square.grid.2x2.fill", url: `${baseRoute}/models` });
283
+ const dynamicRows = discoveredModels.filter((m) => {
284
+ const eff = effectiveCategory(m);
285
+ return eff === "userland" || eff === "data";
286
+ }).filter((m) => !dedicatedPages.has(m.id)).map((model) => ({
287
+ id: `model-${model.id}`,
288
+ label: model.dashboard?.label ?? model.name,
289
+ icon: model.icon,
290
+ url: `${baseRoute}/models/${model.id}`,
291
+ ...model.dashboard?.roles && model.dashboard.roles.length > 0 ? { roles: model.dashboard.roles } : {}
292
+ }));
293
+ sections.push({
294
+ id: "data",
295
+ title: "Data",
296
+ items: [...dataItems, ...dynamicRows]
297
+ });
298
+ if (enabled.commerce)
299
+ sections.push({
300
+ id: "commerce",
301
+ title: "Commerce",
302
+ items: [
303
+ { id: "commerce-dashboard", label: "Dashboard", icon: "gauge.with.dots.needle.33percent", url: `${baseRoute}/commerce/dashboard` },
304
+ { id: "customers", label: "Customers", icon: "person.crop.circle.fill", url: `${baseRoute}/commerce/customers` },
305
+ { id: "orders", label: "Orders", icon: "list.clipboard.fill", url: `${baseRoute}/commerce/orders` },
306
+ { id: "products", label: "Products", icon: "cube.box.fill", url: `${baseRoute}/commerce/products` },
307
+ { id: "coupons", label: "Coupons", icon: "ticket.fill", url: `${baseRoute}/commerce/coupons` },
308
+ { id: "gift-cards", label: "Gift Cards", icon: "giftcard.fill", url: `${baseRoute}/commerce/gift-cards` },
309
+ { id: "payments", label: "Payments", icon: "creditcard.fill", url: `${baseRoute}/commerce/payments` },
310
+ { id: "delivery", label: "Delivery", icon: "truck.box.fill", url: `${baseRoute}/commerce/delivery` },
311
+ { id: "taxes", label: "Taxes", icon: "percent", url: `${baseRoute}/commerce/taxes` },
312
+ ...categoryRows(baseRoute, discoveredModels, "commerce", new Set([
313
+ "customer",
314
+ "order",
315
+ "product",
316
+ "coupon",
317
+ "gift-card",
318
+ "payment",
319
+ "review",
320
+ "category"
321
+ ]))
322
+ ]
323
+ });
324
+ if (enabled.marketing)
325
+ sections.push({
326
+ id: "marketing",
327
+ title: "Marketing",
328
+ items: [
329
+ { id: "lists", label: "Lists", icon: "list.bullet", url: `${baseRoute}/marketing/lists` },
330
+ { id: "social-posts", label: "Social Posts", icon: "clock.fill", url: `${baseRoute}/marketing/social-posts` },
331
+ { id: "campaigns", label: "Campaigns", icon: "megaphone.fill", url: `${baseRoute}/marketing/campaigns` },
332
+ { id: "marketing-reviews", label: "Reviews", icon: "star.fill", url: `${baseRoute}/marketing/reviews` },
333
+ ...categoryRows(baseRoute, discoveredModels, "marketing", new Set(["campaign"]))
334
+ ]
335
+ });
336
+ if (enabled.analytics)
337
+ sections.push({
338
+ id: "analytics",
339
+ title: "Analytics",
340
+ items: [
341
+ { id: "analytics-web", label: "Web", icon: "globe", url: `${baseRoute}/analytics/web` },
342
+ { id: "analytics-blog", label: "Blog", icon: "doc.text.fill", url: `${baseRoute}/analytics/blog` },
343
+ { id: "analytics-commerce", label: "Commerce", icon: "cart.fill", url: `${baseRoute}/analytics/commerce/web` },
344
+ { id: "analytics-marketing", label: "Marketing", icon: "megaphone.fill", url: `${baseRoute}/analytics/marketing` }
345
+ ]
346
+ });
347
+ if (enabled.management)
348
+ sections.push({
349
+ id: "management",
350
+ title: "Management",
351
+ items: [
352
+ { id: "cloud", label: "Cloud", icon: "cloud.fill", url: `${baseRoute}/cloud` },
353
+ { id: "servers", label: "Servers", icon: "server.rack", url: `${baseRoute}/servers` },
354
+ { id: "serverless", label: "Serverless", icon: "bolt.horizontal.circle.fill", url: `${baseRoute}/serverless` },
355
+ { id: "dns", label: "DNS", icon: "network", url: `${baseRoute}/dns` },
356
+ { id: "mailboxes", label: "Mailboxes", icon: "tray.full.fill", url: `${baseRoute}/mailboxes` },
357
+ { id: "logs", label: "Logs", icon: "list.bullet.rectangle.portrait.fill", url: `${baseRoute}/logs` },
358
+ { id: "kanban", label: "Kanban", icon: "rectangle.stack.fill", url: `${baseRoute}/kanban`, roles: ["admin", "dev"] }
359
+ ]
360
+ });
361
+ if (enabled.utilities)
362
+ sections.push({
363
+ id: "utilities",
364
+ title: "Utilities",
365
+ items: [
366
+ { id: "buddy", label: "AI Buddy", icon: "bubble.left.and.bubble.right.fill", url: `${baseRoute}/buddy` },
367
+ { id: "environment", label: "Environment", icon: "key.fill", url: `${baseRoute}/environment` },
368
+ { id: "access-tokens", label: "Access Tokens", icon: "key.horizontal.fill", url: `${baseRoute}/access-tokens` },
369
+ { id: "settings", label: "Settings", icon: "gear", url: `${baseRoute}/settings/billing` }
370
+ ]
371
+ });
372
+ return {
373
+ sections,
374
+ minWidth: 200,
375
+ maxWidth: 280
376
+ };
377
+ }
378
+ export function buildDashboardUrl(port) {
379
+ return `http://localhost:${port}/?native-sidebar=1`;
380
+ }
@@ -0,0 +1,22 @@
1
+ /* eslint-enable no-console */
2
+ // Import Craft dynamically. Its static import triggers bun-router
3
+ // config loading which prints warnings before our console.log override is
4
+ // active. We also let it be missing — the native window is a nicety, not a
5
+ // requirement; the dashboard runs fine as a plain web server in that case.
6
+ declare interface CraftApplication {
7
+ show: () => Promise<void>
8
+ close: () => void
9
+ }
10
+ // Load dashboard section toggles from `config/dashboard.ts` if present.
11
+ // Falls back to "everything enabled" when the file is missing or fails to
12
+ // parse, so a fresh project (no dashboard config) still gets the full
13
+ // sidebar. Shape mirrors `DashboardSectionToggles` in dashboard-utils.ts.
14
+ declare type DataRowToggles = {
15
+ dashboard: boolean
16
+ activity: boolean
17
+ users: boolean
18
+ teams: boolean
19
+ subscribers: boolean
20
+ allModels: boolean
21
+ }
22
+ declare type CraftCreateApp = (options: Record<string, unknown>) => CraftApplication;