@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.
- package/dist/action.d.ts +149 -0
- package/dist/action.js +78 -0
- package/dist/actions.d.ts +2 -0
- package/dist/actions.js +2 -0
- package/dist/add.d.ts +6 -0
- package/dist/add.js +20 -0
- package/dist/ai/request-model-access.d.ts +1 -0
- package/dist/ai/request-model-access.js +10 -0
- package/dist/auth/client.d.ts +1 -0
- package/dist/auth/client.js +44 -0
- package/dist/auth/prune.d.ts +1 -0
- package/dist/auth/prune.js +35 -0
- package/dist/auth/setup.d.ts +1 -0
- package/dist/auth/setup.js +322 -0
- package/dist/auth/token.d.ts +1 -0
- package/dist/auth/token.js +10 -0
- package/dist/blog-admin.d.ts +55 -0
- package/dist/blog-admin.js +156 -0
- package/dist/blog.d.ts +30 -0
- package/dist/blog.js +398 -0
- package/dist/build/cli.d.ts +1 -0
- package/dist/build/cli.js +6 -0
- package/dist/build/component-libs.d.ts +1 -0
- package/dist/build/component-libs.js +7 -0
- package/dist/build/core.d.ts +1 -0
- package/dist/build/core.js +55 -0
- package/dist/build/desktop.d.ts +1 -0
- package/dist/build/desktop.js +5 -0
- package/dist/build/docs.d.ts +1 -0
- package/dist/build/docs.js +5 -0
- package/dist/build/frontend-static.d.ts +16 -0
- package/dist/build/frontend-static.js +124 -0
- package/dist/build/server.d.ts +1 -0
- package/dist/build/server.js +6 -0
- package/dist/build/stacks.d.ts +1 -0
- package/dist/build/stacks.js +8 -0
- package/dist/build/views.d.ts +1 -0
- package/dist/build/views.js +11 -0
- package/dist/build.d.ts +9 -0
- package/dist/build.js +64 -0
- package/dist/bump.d.ts +1 -0
- package/dist/bump.js +163 -0
- package/dist/cdn/invalidate-cache.d.ts +1 -0
- package/dist/cdn/invalidate-cache.js +0 -0
- package/dist/changelog.d.ts +9 -0
- package/dist/changelog.js +27 -0
- package/dist/check/ports.d.ts +1 -0
- package/dist/check/ports.js +16 -0
- package/dist/clean.d.ts +1 -0
- package/dist/clean.js +4 -0
- package/dist/commit.d.ts +3 -0
- package/dist/commit.js +12 -0
- package/dist/copy-types.d.ts +1 -0
- package/dist/copy-types.js +10 -0
- package/dist/database/seed.d.ts +1 -0
- package/dist/database/seed.js +26 -0
- package/dist/deploy/create-receipt-rule.d.ts +1 -0
- package/dist/deploy/create-receipt-rule.js +36 -0
- package/dist/deploy/index.d.ts +1 -0
- package/dist/deploy/index.js +1574 -0
- package/dist/dev/api.d.ts +1 -0
- package/dist/dev/api.js +94 -0
- package/dist/dev/components.d.ts +1 -0
- package/dist/dev/components.js +7 -0
- package/dist/dev/dashboard-globals.d.ts +4 -0
- package/dist/dev/dashboard-globals.js +89 -0
- package/dist/dev/dashboard-utils.d.ts +150 -0
- package/dist/dev/dashboard-utils.js +380 -0
- package/dist/dev/dashboard.d.ts +22 -0
- package/dist/dev/dashboard.js +435 -0
- package/dist/dev/desktop.d.ts +1 -0
- package/dist/dev/desktop.js +5 -0
- package/dist/dev/docs.d.ts +1 -0
- package/dist/dev/docs.js +24 -0
- package/dist/dev/index.d.ts +10 -0
- package/dist/dev/index.js +29 -0
- package/dist/dev/migrate-watcher.d.ts +1 -0
- package/dist/dev/migrate-watcher.js +74 -0
- package/dist/dev/system-tray.d.ts +1 -0
- package/dist/dev/system-tray.js +5 -0
- package/dist/dev/views.d.ts +1 -0
- package/dist/dev/views.js +147 -0
- package/dist/discover-packages.d.ts +18 -0
- package/dist/discover-packages.js +32 -0
- package/dist/domains/add.d.ts +1 -0
- package/dist/domains/add.js +61 -0
- package/dist/domains/purchase.d.ts +1 -0
- package/dist/domains/purchase.js +66 -0
- package/dist/domains/remove.d.ts +1 -0
- package/dist/domains/remove.js +24 -0
- package/dist/examples.d.ts +5 -0
- package/dist/examples.js +34 -0
- package/dist/find-projects.d.ts +1 -0
- package/dist/find-projects.js +16 -0
- package/dist/fresh.d.ts +1 -0
- package/dist/fresh.js +17 -0
- package/dist/generate/action-types.d.ts +1 -0
- package/dist/generate/action-types.js +13 -0
- package/dist/generate/component-meta.d.ts +1 -0
- package/dist/generate/component-meta.js +9 -0
- package/dist/generate/custom-cli-file.d.ts +1 -0
- package/dist/generate/custom-cli-file.js +21 -0
- package/dist/generate/env-files.d.ts +1 -0
- package/dist/generate/env-files.js +66 -0
- package/dist/generate/ide-helpers.d.ts +1 -0
- package/dist/generate/ide-helpers.js +8 -0
- package/dist/generate/index.d.ts +36 -0
- package/dist/generate/index.js +158 -0
- package/dist/generate/lib-entries.d.ts +1 -0
- package/dist/generate/lib-entries.js +16 -0
- package/dist/generate/pantry-file.d.ts +1 -0
- package/dist/generate/pantry-file.js +46 -0
- package/dist/generate/symlink-core.d.ts +1 -0
- package/dist/generate/symlink-core.js +2 -0
- package/dist/generate/types.d.ts +1 -0
- package/dist/generate/types.js +3 -0
- package/dist/generate/vscode-custom-data.d.ts +1 -0
- package/dist/generate/vscode-custom-data.js +9 -0
- package/dist/generate/web-types.d.ts +1 -0
- package/dist/generate/web-types.js +0 -0
- package/dist/helpers/component-meta.d.ts +26 -0
- package/dist/helpers/component-meta.js +295 -0
- package/dist/helpers/index.d.ts +4 -0
- package/dist/helpers/index.js +1 -0
- package/dist/helpers/lib-entries.d.ts +12 -0
- package/dist/helpers/lib-entries.js +73 -0
- package/dist/helpers/package-json.d.ts +2 -0
- package/dist/helpers/package-json.js +74 -0
- package/dist/helpers/utils.d.ts +23 -0
- package/dist/helpers/utils.js +105 -0
- package/dist/helpers/vscode-custom-data.d.ts +3 -0
- package/dist/helpers/vscode-custom-data.js +30 -0
- package/dist/index.d.ts +62 -0
- package/dist/index.js +50 -0
- package/dist/key-generate.d.ts +1 -0
- package/dist/key-generate.js +24 -0
- package/dist/lint/fix.d.ts +1 -0
- package/dist/lint/fix.js +4 -0
- package/dist/lint/index.d.ts +1 -0
- package/dist/lint/index.js +4 -0
- package/dist/lint/lint.d.ts +14 -0
- package/dist/lint/lint.js +34 -0
- package/dist/make-command.d.ts +10 -0
- package/dist/make-command.js +95 -0
- package/dist/make-job.d.ts +5 -0
- package/dist/make-job.js +154 -0
- package/dist/make-policy.d.ts +10 -0
- package/dist/make-policy.js +142 -0
- package/dist/make-resource.d.ts +10 -0
- package/dist/make-resource.js +142 -0
- package/dist/make.d.ts +52 -0
- package/dist/make.js +328 -0
- package/dist/migrate/database.d.ts +1 -0
- package/dist/migrate/database.js +16 -0
- package/dist/migrate/fresh.d.ts +1 -0
- package/dist/migrate/fresh.js +31 -0
- package/dist/orm/base.d.ts +1 -0
- package/dist/orm/base.js +0 -0
- package/dist/orm/test.d.ts +1 -0
- package/dist/orm/test.js +0 -0
- package/dist/prepublish.d.ts +1 -0
- package/dist/prepublish.js +16 -0
- package/dist/queue/clear.d.ts +1 -0
- package/dist/queue/clear.js +42 -0
- package/dist/queue/dlq-purge.d.ts +1 -0
- package/dist/queue/dlq-purge.js +28 -0
- package/dist/queue/dlq-retry.d.ts +1 -0
- package/dist/queue/dlq-retry.js +35 -0
- package/dist/queue/dlq.d.ts +1 -0
- package/dist/queue/dlq.js +55 -0
- package/dist/queue/failed.d.ts +1 -0
- package/dist/queue/failed.js +69 -0
- package/dist/queue/flush.d.ts +1 -0
- package/dist/queue/flush.js +49 -0
- package/dist/queue/inspect.d.ts +1 -0
- package/dist/queue/inspect.js +154 -0
- package/dist/queue/list.d.ts +1 -0
- package/dist/queue/list.js +69 -0
- package/dist/queue/monitor.d.ts +1 -0
- package/dist/queue/monitor.js +95 -0
- package/dist/queue/pause.d.ts +1 -0
- package/dist/queue/pause.js +28 -0
- package/dist/queue/quarantine.d.ts +1 -0
- package/dist/queue/quarantine.js +42 -0
- package/dist/queue/resume.d.ts +1 -0
- package/dist/queue/resume.js +27 -0
- package/dist/queue/retry.d.ts +1 -0
- package/dist/queue/retry.js +41 -0
- package/dist/queue/schedule-list.d.ts +1 -0
- package/dist/queue/schedule-list.js +33 -0
- package/dist/queue/schedule.d.ts +1 -0
- package/dist/queue/schedule.js +12 -0
- package/dist/queue/status.d.ts +1 -0
- package/dist/queue/status.js +68 -0
- package/dist/queue/table.d.ts +1 -0
- package/dist/queue/table.js +10 -0
- package/dist/queue/unquarantine.d.ts +1 -0
- package/dist/queue/unquarantine.js +27 -0
- package/dist/queue/work.d.ts +1 -0
- package/dist/queue/work.js +57 -0
- package/dist/release.d.ts +1 -0
- package/dist/release.js +21 -0
- package/dist/route/list.d.ts +1 -0
- package/dist/route/list.js +78 -0
- package/dist/run-action.d.ts +2 -0
- package/dist/run-action.js +1 -0
- package/dist/saas/setup.d.ts +1 -0
- package/dist/saas/setup.js +9 -0
- package/dist/scaffold-crud.d.ts +25 -0
- package/dist/scaffold-crud.js +211 -0
- package/dist/schedule/run.d.ts +1 -0
- package/dist/schedule/run.js +7 -0
- package/dist/search/flush.d.ts +1 -0
- package/dist/search/flush.js +10 -0
- package/dist/search/import.d.ts +1 -0
- package/dist/search/import.js +10 -0
- package/dist/search/settings-list.d.ts +1 -0
- package/dist/search/settings-list.js +10 -0
- package/dist/search/settings.d.ts +1 -0
- package/dist/search/settings.js +9 -0
- package/dist/serve/api.d.ts +1 -0
- package/dist/serve/api.js +35 -0
- package/dist/setup/index.d.ts +1 -0
- package/dist/setup/index.js +1 -0
- package/dist/setup/ssl.d.ts +38 -0
- package/dist/setup/ssl.js +271 -0
- package/dist/stacks.d.ts +4 -0
- package/dist/stacks.js +265 -0
- package/dist/templates.d.ts +28 -0
- package/dist/templates.js +301 -0
- package/dist/test/feature.d.ts +1 -0
- package/dist/test/feature.js +11 -0
- package/dist/test/index.d.ts +1 -0
- package/dist/test/index.js +11 -0
- package/dist/test/ui.d.ts +1 -0
- package/dist/test/ui.js +4 -0
- package/dist/test/unit.d.ts +1 -0
- package/dist/test/unit.js +11 -0
- package/dist/typecheck.d.ts +1 -0
- package/dist/typecheck.js +4 -0
- package/dist/types.d.ts +3 -0
- package/dist/types.js +16 -0
- package/dist/upgrade/binary.d.ts +1 -0
- package/dist/upgrade/binary.js +29 -0
- package/dist/upgrade/bun.d.ts +1 -0
- package/dist/upgrade/bun.js +0 -0
- package/dist/upgrade/dependencies.d.ts +1 -0
- package/dist/upgrade/dependencies.js +0 -0
- package/dist/upgrade/framework-utils.d.ts +150 -0
- package/dist/upgrade/framework-utils.js +193 -0
- package/dist/upgrade/framework.d.ts +1 -0
- package/dist/upgrade/framework.js +310 -0
- package/dist/upgrade/index.d.ts +1 -0
- package/dist/upgrade/index.js +17 -0
- package/dist/upgrade/packages.d.ts +14 -0
- package/dist/upgrade/packages.js +99 -0
- package/dist/upgrade/shell.d.ts +1 -0
- package/dist/upgrade/shell.js +41 -0
- package/dist/upgrade.d.ts +7 -0
- package/dist/upgrade.js +38 -0
- 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;
|