@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 @@
|
|
|
1
|
+
export {};
|
package/dist/dev/api.js
ADDED
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { existsSync } from "node:fs";
|
|
2
|
+
import process from "node:process";
|
|
3
|
+
import { parseOptions } from "@stacksjs/cli";
|
|
4
|
+
import { config, overridesReady } from "@stacksjs/config";
|
|
5
|
+
import { path } from "@stacksjs/path";
|
|
6
|
+
import { route } from "@stacksjs/router";
|
|
7
|
+
import { generateAutoImportFiles, injectGlobalAutoImports } from "@stacksjs/server";
|
|
8
|
+
const _options = parseOptions();
|
|
9
|
+
await overridesReady;
|
|
10
|
+
const port = Number(process.env.PORT_API) || config.ports?.api || 3008, modelsIndex = path.storagePath("framework/auto-imports/models.ts");
|
|
11
|
+
if (!existsSync(modelsIndex))
|
|
12
|
+
await generateAutoImportFiles();
|
|
13
|
+
await injectGlobalAutoImports();
|
|
14
|
+
try {
|
|
15
|
+
const typesenseDev = path.appPath("Lib/typesense-dev.ts");
|
|
16
|
+
if (existsSync(typesenseDev)) {
|
|
17
|
+
const mod = await import(typesenseDev);
|
|
18
|
+
if (typeof mod.ensureTypesenseRunning === "function")
|
|
19
|
+
await mod.ensureTypesenseRunning();
|
|
20
|
+
}
|
|
21
|
+
} catch (err) {
|
|
22
|
+
const { log } = await import("@stacksjs/cli");
|
|
23
|
+
log.warn(`[api:dev] search engine bootstrap skipped: ${err.message}`);
|
|
24
|
+
}
|
|
25
|
+
try {
|
|
26
|
+
const listenerPath = path.appPath("Listener.ts");
|
|
27
|
+
if (existsSync(listenerPath)) {
|
|
28
|
+
const listener = await import(listenerPath);
|
|
29
|
+
if (typeof listener.handleEvents === "function")
|
|
30
|
+
await listener.handleEvents();
|
|
31
|
+
}
|
|
32
|
+
} catch (err) {
|
|
33
|
+
const { log } = await import("@stacksjs/cli");
|
|
34
|
+
log.warn(`[api:dev] failed to bootstrap event listeners \u2014 dispatched events will be ignored: ${err.message}`);
|
|
35
|
+
}
|
|
36
|
+
try {
|
|
37
|
+
const { startModelMigrationWatcher } = await import("./migrate-watcher");
|
|
38
|
+
startModelMigrationWatcher();
|
|
39
|
+
} catch (err) {
|
|
40
|
+
const { log } = await import("@stacksjs/cli");
|
|
41
|
+
log.debug(`[api:dev] auto-migrate watcher not started: ${err.message}`);
|
|
42
|
+
}
|
|
43
|
+
function resolveDefaultsCorsPath() {
|
|
44
|
+
const vendored = path.frameworkPath("defaults/app/Middleware/Cors.ts");
|
|
45
|
+
if (existsSync(vendored))
|
|
46
|
+
return vendored;
|
|
47
|
+
try {
|
|
48
|
+
return `${Bun.resolveSync("@stacksjs/defaults/package.json", process.cwd()).replace(/package\.json$/, "")}app/Middleware/Cors.ts`;
|
|
49
|
+
} catch {
|
|
50
|
+
return vendored;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
const corsMod = await import(resolveDefaultsCorsPath()), corsMiddleware = corsMod.default;
|
|
54
|
+
route.use(corsMiddleware.toRouterHandler());
|
|
55
|
+
const SAFE_REQUEST_ID = /^[a-zA-Z0-9._-]{8,128}$/;
|
|
56
|
+
route.use(async (request, next) => {
|
|
57
|
+
const inbound = request?.headers?.get?.("x-request-id") || request?.headers?.get?.("X-Request-ID") || "", id = typeof inbound === "string" && SAFE_REQUEST_ID.test(inbound) ? inbound : crypto.randomUUID();
|
|
58
|
+
request._requestId = id;
|
|
59
|
+
request._startNs = process.hrtime.bigint();
|
|
60
|
+
const response = await next();
|
|
61
|
+
if (response && response.status === 404 && (response.headers.get("content-type") || "").includes("json"))
|
|
62
|
+
try {
|
|
63
|
+
const body = await response.clone().json();
|
|
64
|
+
if (body && (body.message === "Not Found" || body.error === "Not Found")) {
|
|
65
|
+
const url = new URL(request.url), enriched = {
|
|
66
|
+
...body,
|
|
67
|
+
path: url.pathname,
|
|
68
|
+
method: request.method,
|
|
69
|
+
request_id: id
|
|
70
|
+
}, headers = new Headers(response.headers);
|
|
71
|
+
headers.set("X-Request-ID", id);
|
|
72
|
+
return new Response(JSON.stringify(enriched), { status: 404, headers });
|
|
73
|
+
}
|
|
74
|
+
} catch {}
|
|
75
|
+
return response;
|
|
76
|
+
});
|
|
77
|
+
await route.importRoutes();
|
|
78
|
+
try {
|
|
79
|
+
await route.serve({
|
|
80
|
+
port,
|
|
81
|
+
hostname: "127.0.0.1"
|
|
82
|
+
});
|
|
83
|
+
console.log(`
|
|
84
|
+
\u279C API server ready: http://localhost:${port}
|
|
85
|
+
`);
|
|
86
|
+
} catch (err) {
|
|
87
|
+
if ((err?.code || err?.errno) === "EADDRINUSE" || String(err?.message || "").includes("EADDRINUSE")) {
|
|
88
|
+
console.error(`
|
|
89
|
+
[dev/api] Port ${port} is already in use. Kill the other process and re-run \`./buddy dev\`, or set PORT_API to another port.
|
|
90
|
+
`);
|
|
91
|
+
process.exit(1);
|
|
92
|
+
}
|
|
93
|
+
throw err;
|
|
94
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { existsSync, readdirSync, statSync } from "node:fs";
|
|
2
|
+
import { join } from "node:path";
|
|
3
|
+
import process from "node:process";
|
|
4
|
+
import { projectPath, storagePath } from "@stacksjs/path";
|
|
5
|
+
const HELPER_DIRS = [
|
|
6
|
+
storagePath("framework/defaults/resources/functions/dashboard"),
|
|
7
|
+
projectPath("resources/functions"),
|
|
8
|
+
projectPath("app/Helpers")
|
|
9
|
+
];
|
|
10
|
+
export async function hoistDashboardGlobals(opts = {}) {
|
|
11
|
+
const g = globalThis, collisions = [];
|
|
12
|
+
let hoisted = 0;
|
|
13
|
+
for (const dir of HELPER_DIRS) {
|
|
14
|
+
if (!existsSync(dir))
|
|
15
|
+
continue;
|
|
16
|
+
let entries;
|
|
17
|
+
try {
|
|
18
|
+
entries = readdirSync(dir);
|
|
19
|
+
} catch {
|
|
20
|
+
continue;
|
|
21
|
+
}
|
|
22
|
+
for (const entry of entries) {
|
|
23
|
+
const full = join(dir, entry);
|
|
24
|
+
let s;
|
|
25
|
+
try {
|
|
26
|
+
s = statSync(full);
|
|
27
|
+
} catch {
|
|
28
|
+
continue;
|
|
29
|
+
}
|
|
30
|
+
if (s.isDirectory()) {
|
|
31
|
+
let subEntries;
|
|
32
|
+
try {
|
|
33
|
+
subEntries = readdirSync(full);
|
|
34
|
+
} catch {
|
|
35
|
+
continue;
|
|
36
|
+
}
|
|
37
|
+
for (const sub of subEntries) {
|
|
38
|
+
if (!isImportable(sub))
|
|
39
|
+
continue;
|
|
40
|
+
const subFull = join(full, sub), r = await hoistFile(subFull, g, opts.verbose);
|
|
41
|
+
hoisted += r.added;
|
|
42
|
+
collisions.push(...r.collisions);
|
|
43
|
+
}
|
|
44
|
+
continue;
|
|
45
|
+
}
|
|
46
|
+
if (!isImportable(entry))
|
|
47
|
+
continue;
|
|
48
|
+
const r = await hoistFile(full, g, opts.verbose);
|
|
49
|
+
hoisted += r.added;
|
|
50
|
+
collisions.push(...r.collisions);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
if (opts.verbose)
|
|
54
|
+
process.stdout.write(`[dashboard] hoisted ${hoisted} helper globals` + (collisions.length > 0 ? ` (skipped ${collisions.length} collisions: ${collisions.slice(0, 5).join(", ")}\u2026)` : "") + `
|
|
55
|
+
`);
|
|
56
|
+
}
|
|
57
|
+
function isImportable(name) {
|
|
58
|
+
if (!/\.(?:ts|tsx|js|mjs)$/.test(name))
|
|
59
|
+
return !1;
|
|
60
|
+
if (name.startsWith("_"))
|
|
61
|
+
return !1;
|
|
62
|
+
if (name.endsWith(".test.ts") || name.endsWith(".spec.ts"))
|
|
63
|
+
return !1;
|
|
64
|
+
if (name.endsWith(".d.ts"))
|
|
65
|
+
return !1;
|
|
66
|
+
return !0;
|
|
67
|
+
}
|
|
68
|
+
async function hoistFile(file, g, _verbose) {
|
|
69
|
+
let mod;
|
|
70
|
+
try {
|
|
71
|
+
mod = await import(file);
|
|
72
|
+
} catch {
|
|
73
|
+
return { added: 0, collisions: [] };
|
|
74
|
+
}
|
|
75
|
+
const collisions = [];
|
|
76
|
+
let added = 0;
|
|
77
|
+
for (const [name, value] of Object.entries(mod)) {
|
|
78
|
+
if (name === "default" || name.startsWith("_"))
|
|
79
|
+
continue;
|
|
80
|
+
if (typeof value === "function" || value && typeof value === "object") {
|
|
81
|
+
if (g[name] === void 0) {
|
|
82
|
+
g[name] = value;
|
|
83
|
+
added++;
|
|
84
|
+
} else if (g[name] !== value)
|
|
85
|
+
collisions.push(name);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
return { added, collisions };
|
|
89
|
+
}
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
import type { DashboardModelOptions } from '@stacksjs/types';
|
|
2
|
+
/** Convert PascalCase model name to kebab-case ID */
|
|
3
|
+
export declare function modelNameToId(name: string): string;
|
|
4
|
+
/** Get the icon for a model name, falling back to the default */
|
|
5
|
+
export declare function getModelIcon(name: string): string;
|
|
6
|
+
/** Scan a directory for model files and add them to the models array */
|
|
7
|
+
export declare function scanModelsDir(dir: string, seenNames: Set<string>, models: DiscoveredModel[], defaultCategory?: ModelCategory): Promise<void>;
|
|
8
|
+
/** Discover models from both user and default directories */
|
|
9
|
+
export declare function discoverModels(userModelsPath: string, defaultModelsPath: string): Promise<DiscoveredModel[]>;
|
|
10
|
+
/** Build the manifest array for discovered models */
|
|
11
|
+
export declare function buildManifest(models: DiscoveredModel[]): DiscoveredModelManifestRow[];
|
|
12
|
+
/** Check if a port is available by attempting to listen on it */
|
|
13
|
+
export declare function isPortAvailable(port: number): Promise<boolean>;
|
|
14
|
+
/** Find an available port starting from the preferred port */
|
|
15
|
+
export declare function findAvailablePort(preferred: number, maxAttempts?: number): Promise<number>;
|
|
16
|
+
/** Wait for STX server to accept connections */
|
|
17
|
+
export declare function waitForServer(port: number, maxWait?: number): Promise<boolean>;
|
|
18
|
+
/** Build sidebar config for native sidebar navigation */
|
|
19
|
+
export declare function buildSidebarConfig(baseRoute: string, discoveredModels: DiscoveredModel[], toggles?: DashboardSectionToggles): void;
|
|
20
|
+
/**
|
|
21
|
+
* Build the URL the Craft window opens to. The `native-sidebar=1` query
|
|
22
|
+
* param signals the layout that Craft is rendering the sidebar natively,
|
|
23
|
+
* so the layout can suppress its own HTML sidebar and let the macOS
|
|
24
|
+
* NSOutlineView own that 240px column.
|
|
25
|
+
*/
|
|
26
|
+
export declare function buildDashboardUrl(port: number): string;
|
|
27
|
+
/**
|
|
28
|
+
* Model name to icon mapping (SF Symbols)
|
|
29
|
+
* @defaultValue
|
|
30
|
+
* ```ts
|
|
31
|
+
* {
|
|
32
|
+
* user: 'person.fill',
|
|
33
|
+
* team: 'person.2.fill',
|
|
34
|
+
* subscriber: 'envelope.open.fill',
|
|
35
|
+
* subscriberemail: 'envelope.fill',
|
|
36
|
+
* post: 'doc.text.fill',
|
|
37
|
+
* page: 'doc.fill',
|
|
38
|
+
* product: 'cube.box.fill',
|
|
39
|
+
* productvariant: 'cube.fill',
|
|
40
|
+
* productunit: 'scalemass.fill',
|
|
41
|
+
* order: 'list.clipboard.fill',
|
|
42
|
+
* orderitem: 'list.bullet.clipboard.fill',
|
|
43
|
+
* customer: 'person.crop.circle.fill',
|
|
44
|
+
* payment: 'creditcard.fill',
|
|
45
|
+
* paymentmethod: 'creditcard.and.123',
|
|
46
|
+
* paymentproduct: 'creditcard.fill',
|
|
47
|
+
* paymenttransaction: 'creditcard.fill',
|
|
48
|
+
* category: 'tag.fill',
|
|
49
|
+
* tag: 'tag',
|
|
50
|
+
* comment: 'bubble.left.fill',
|
|
51
|
+
* author: 'person.text.rectangle.fill',
|
|
52
|
+
* notification: 'bell.fill',
|
|
53
|
+
* job: 'briefcase.fill',
|
|
54
|
+
* log: 'list.bullet.rectangle.portrait.fill',
|
|
55
|
+
* campaign: 'megaphone.fill',
|
|
56
|
+
* review: 'star.fill',
|
|
57
|
+
* coupon: 'ticket.fill',
|
|
58
|
+
* giftcard: 'giftcard.fill',
|
|
59
|
+
* cart: 'cart.fill',
|
|
60
|
+
* cartitem: 'cart.badge.plus',
|
|
61
|
+
* taxrate: 'percent',
|
|
62
|
+
* transaction: 'arrow.left.arrow.right.circle.fill',
|
|
63
|
+
* subscription: 'repeat.circle.fill',
|
|
64
|
+
* emaillist: 'envelope.badge.person.crop',
|
|
65
|
+
* socialpost: 'bubble.left.and.bubble.right.fill',
|
|
66
|
+
* manufacturer: 'building.2.fill',
|
|
67
|
+
* shippingmethod: 'shippingbox.fill',
|
|
68
|
+
* shippingzone: 'map.fill',
|
|
69
|
+
* shippingrate: 'dollarsign.circle.fill',
|
|
70
|
+
* deliveryroute: 'map.fill',
|
|
71
|
+
* driver: 'car.fill',
|
|
72
|
+
* digitaldelivery: 'arrow.down.doc.fill',
|
|
73
|
+
* licensekey: 'key.fill',
|
|
74
|
+
* loyaltypoint: 'star.circle.fill',
|
|
75
|
+
* loyaltyreward: 'gift.fill',
|
|
76
|
+
* printdevice: 'printer.fill',
|
|
77
|
+
* receipt: 'doc.text.fill',
|
|
78
|
+
* waitlistproduct: 'clock.fill',
|
|
79
|
+
* waitlistrestaurant: 'clock.badge.checkmark.fill',
|
|
80
|
+
* websocket: 'antenna.radiowaves.left.and.right',
|
|
81
|
+
* default: 'tablecells.fill'
|
|
82
|
+
* }
|
|
83
|
+
* ```
|
|
84
|
+
*/
|
|
85
|
+
export declare const iconMap: Record<string, string>;
|
|
86
|
+
// Models excluded from sidebar (already have dedicated pages)
|
|
87
|
+
export declare const excludeModels: Set<any>;
|
|
88
|
+
// Models that have dedicated dashboard pages
|
|
89
|
+
export declare const dedicatedPages: Set<any>;
|
|
90
|
+
export declare interface DiscoveredModel {
|
|
91
|
+
name: string
|
|
92
|
+
icon: string
|
|
93
|
+
id: string
|
|
94
|
+
category?: ModelCategory
|
|
95
|
+
dashboard?: DashboardModelOptions
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Manifest row written to `defaults/views/dashboard/.discovered-models.json`
|
|
99
|
+
* for the web-side sidebar to consume. Includes the per-model `dashboard`
|
|
100
|
+
* config (stacksjs/stacks#1843) so both sidebar builders (the native one
|
|
101
|
+
* here and the HTML one in `defaults/resources/functions/dashboard/sidebar.ts`)
|
|
102
|
+
* see the same data.
|
|
103
|
+
*/
|
|
104
|
+
export declare interface DiscoveredModelManifestRow {
|
|
105
|
+
id: string
|
|
106
|
+
name: string
|
|
107
|
+
icon: string
|
|
108
|
+
hasDedicatedPage: boolean
|
|
109
|
+
category: ModelCategory
|
|
110
|
+
dashboard?: DashboardModelOptions
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* Per-section toggles. Read from the project's `config/dashboard.ts` (when
|
|
114
|
+
* present) and passed through buildSidebarConfig / buildSidebarNavHtml so the
|
|
115
|
+
* commerce / content / marketing sections collapse out of the sidebar entirely
|
|
116
|
+
* for projects that don't ship those features. Anything not specified is on.
|
|
117
|
+
*
|
|
118
|
+
* `data` is a per-row toggle map (instead of a single boolean) because the
|
|
119
|
+
* Data section is always relevant — projects just want to hide individual
|
|
120
|
+
* basic rows like Subscribers when they're not running a newsletter, while
|
|
121
|
+
* still seeing their userland models.
|
|
122
|
+
*/
|
|
123
|
+
export declare interface DashboardSectionToggles {
|
|
124
|
+
commerce?: boolean
|
|
125
|
+
content?: boolean
|
|
126
|
+
marketing?: boolean
|
|
127
|
+
analytics?: boolean
|
|
128
|
+
management?: boolean
|
|
129
|
+
utilities?: boolean
|
|
130
|
+
library?: boolean
|
|
131
|
+
ci?: boolean
|
|
132
|
+
data?: {
|
|
133
|
+
dashboard?: boolean
|
|
134
|
+
activity?: boolean
|
|
135
|
+
users?: boolean
|
|
136
|
+
teams?: boolean
|
|
137
|
+
subscribers?: boolean
|
|
138
|
+
allModels?: boolean
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* Sidebar category each discovered model gets surfaced under.
|
|
143
|
+
* - `userland`: model in the project's `app/Models/` (always shown in Data)
|
|
144
|
+
* - `data`: framework root-level model that belongs in Data
|
|
145
|
+
* - `commerce`: model in framework `commerce/` subdir or commerce-coded root model
|
|
146
|
+
* - `content`: model in framework `Content/` subdir or content-coded root model
|
|
147
|
+
* - `marketing`: outreach / subscriber-list models grouped under Marketing
|
|
148
|
+
* - `system`: framework-internal models (jobs, deployments, requests…) → App
|
|
149
|
+
*/
|
|
150
|
+
export type ModelCategory = 'userland' | 'data' | 'commerce' | 'content' | 'marketing' | 'system';
|