@brickkit/cli 0.16.0-beta.1 → 0.16.0-beta.2

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 (33) hide show
  1. package/README.md +13 -8
  2. package/dashboard-dist/{api-reference-C2_JX174.js → api-reference-FojtkYBA.js} +4 -4
  3. package/dashboard-dist/app.js +10 -10
  4. package/dashboard-dist/{client-DsITZplk.js → client-Cnm0Im6o.js} +1 -1
  5. package/dashboard-dist/{core-sW89OSz5.js → core-SiSejpN2.js} +1 -1
  6. package/dashboard-dist/{docs-D3U7gUWq.js → docs-D1HrRL0z.js} +2 -2
  7. package/dashboard-dist/kit.js +1 -1
  8. package/dashboard-dist/{popover-Bb2Q3jiK.js → popover-Da7zBKDq.js} +1 -1
  9. package/dist/bin.js +1 -1
  10. package/dist/dashboard-host.js +17 -8
  11. package/dist/dashboard-host.js.map +1 -1
  12. package/dist/dashboard-protocol.js +6 -6
  13. package/dist/dashboard-protocol.js.map +1 -1
  14. package/dist/dev-inspector.js +111 -0
  15. package/dist/dev-inspector.js.map +1 -0
  16. package/dist/dev-worker.js +1 -102
  17. package/dist/dev-worker.js.map +1 -1
  18. package/dist/production-dashboard.js +26 -2
  19. package/dist/production-dashboard.js.map +1 -1
  20. package/dist/production-dashboard2.d.ts +5 -0
  21. package/dist/project.js +1 -1
  22. package/dist/vite.js +1 -1
  23. package/inspector-dist/NOTICE +3 -1
  24. package/inspector-dist/server/assets/{app-w0nTXgJd.js → app-DUrMEdTr.js} +49 -11
  25. package/inspector-dist/server/assets/{functions-B9XwHSzK.js → functions-CvYRS9L5.js} +2 -2
  26. package/inspector-dist/server/assets/{serialization-DsMds3lJ.js → serialization-BMjuH1Dy.js} +1 -1
  27. package/inspector-dist/server/assets/{token-CvvD8Y5H.js → token-B03I2FMb.js} +1 -1
  28. package/inspector-dist/server/assets/{token-CxjWFNNq.js → token-CXQG49kq.js} +1 -1
  29. package/inspector-dist/server/assets/token-util-DQqrmFHy.js +3 -0
  30. package/inspector-dist/server/assets/{ws-transport-CamzQ5O8.js → ws-transport-CMidAEKi.js} +1 -1
  31. package/inspector-dist/server/index.js +1 -1
  32. package/package.json +2 -2
  33. package/inspector-dist/server/assets/token-util-D9IsWeEs.js +0 -3
@@ -1,5 +1,5 @@
1
1
  import { n as ConfigError, r as DEFAULT_DASHBOARD_PORT } from "./config2.js";
2
- import { _ as matchRoute, a as INSPECTOR_TOKEN_HEADER, c as SHARED_MODULES, d as assetUrl, f as decode, g as isExternalHref, h as docsHref, i as DOCS_PATHS, l as SPAN, m as docsFileUrl, n as ATTR, o as LIVE_LIMITS, s as ROUTES, t as ASSETS, u as THEME_STORAGE_KEY } from "./dashboard-protocol.js";
2
+ import { _ as isExternalHref, a as INSPECTOR_READ_ONLY_HEADER, c as ROUTES, d as THEME_STORAGE_KEY, f as assetUrl, g as docsHref, h as docsFileUrl, i as DOCS_PATHS, l as SHARED_MODULES, n as ATTR, o as INSPECTOR_TOKEN_HEADER, p as decode, s as LIVE_LIMITS, t as ASSETS, u as SPAN, v as matchRoute, y as viewsWithout } from "./dashboard-protocol.js";
3
3
  import { createRequire } from "node:module";
4
4
  import { existsSync, mkdirSync, watch, writeFileSync } from "node:fs";
5
5
  import { basename, dirname, extname, join, posix, relative, resolve, sep } from "node:path";
@@ -1253,6 +1253,8 @@ const NOT_RETURNED = /* @__PURE__ */ new Set([
1253
1253
  "content-encoding",
1254
1254
  "set-cookie"
1255
1255
  ]);
1256
+ const PRODUCTION_POLICY = "default-src 'self'; script-src 'self' 'unsafe-inline'; style-src 'self' 'unsafe-inline'; img-src 'self' data: blob:; font-src 'self' data:; connect-src 'self'; object-src 'none'; base-uri 'none'; form-action 'none'";
1257
+ const INSPECTOR_POLICY = `${PRODUCTION_POLICY.replace("script-src 'self' 'unsafe-inline'", "script-src 'self' 'unsafe-inline' 'wasm-unsafe-eval'")}; frame-ancestors 'self'`;
1256
1258
  const PRODUCTION_HEADERS = {
1257
1259
  "x-content-type-options": "nosniff",
1258
1260
  "x-frame-options": "DENY",
@@ -1260,7 +1262,7 @@ const PRODUCTION_HEADERS = {
1260
1262
  "cross-origin-opener-policy": "same-origin",
1261
1263
  "cross-origin-resource-policy": "same-origin",
1262
1264
  "cache-control": "no-store",
1263
- "content-security-policy": "default-src 'self'; script-src 'self' 'unsafe-inline'; style-src 'self' 'unsafe-inline'; img-src 'self' data: blob:; font-src 'self' data:; connect-src 'self'; object-src 'none'; base-uri 'none'; form-action 'none'; frame-ancestors 'none'"
1265
+ "content-security-policy": `${PRODUCTION_POLICY}; frame-ancestors 'none'`
1264
1266
  };
1265
1267
  /** How long `/_health` waits for the app before calling it down. */
1266
1268
  const PROBE_TIMEOUT_MS = 3e3;
@@ -1325,7 +1327,8 @@ function startDevDashboard(options) {
1325
1327
  }
1326
1328
  function servedInProduction(route) {
1327
1329
  const served = ROUTES[route].production;
1328
- return served === "extension" ? Boolean(extension?.active) : served;
1330
+ if (served === "extension") return Boolean(extension?.active);
1331
+ return served === "inspector" ? Boolean(options.inspector && options.store.inspectorTarget()) : served;
1329
1332
  }
1330
1333
  /** 200 while the app answers its own health check, 503 when it does not. */
1331
1334
  async function health(response) {
@@ -1378,11 +1381,12 @@ function startDevDashboard(options) {
1378
1381
  docs: (_request, response, url) => docsRoute(response, url.pathname, url.searchParams),
1379
1382
  openapi: (_request, response) => json(response, options.store.apiDocuments()),
1380
1383
  proxy,
1381
- workflows(request, response, url) {
1384
+ workflows(request, response, url, identity) {
1382
1385
  frameOnlyHere(response);
1383
- return inspector(request, response, url);
1386
+ if (production) response.setHeader("content-security-policy", INSPECTOR_POLICY);
1387
+ return inspector(request, response, url, identity);
1384
1388
  },
1385
- schedules: (request, response, url) => inspector(request, response, url),
1389
+ schedules: inspector,
1386
1390
  ingest,
1387
1391
  restart(request, response) {
1388
1392
  if (!options.restart) {
@@ -1399,6 +1403,7 @@ function startDevDashboard(options) {
1399
1403
  canRestart: Boolean(options.restart),
1400
1404
  historyDays: options.history?.days ?? 0,
1401
1405
  mode: production ? "production" : "dev",
1406
+ hiddenViews: production ? viewsWithout(servedInProduction) : [],
1402
1407
  extension: extension?.active ? {
1403
1408
  revision: extension.revision,
1404
1409
  error: extension.error
@@ -1475,7 +1480,7 @@ function startDevDashboard(options) {
1475
1480
  * from the dashboard's own page: the inspector can cancel runs and resume
1476
1481
  * hooks, and a page on another site could otherwise post to it.
1477
1482
  */
1478
- async function inspector(request, response, url) {
1483
+ async function inspector(request, response, url, identity) {
1479
1484
  const target = options.store.inspectorTarget();
1480
1485
  if (!target) {
1481
1486
  send(response, 503, "The workflow inspector and schedules are not being served. The app may be restarting, or it may have neither workflows nor schedules.", { "content-type": "text/plain; charset=utf-8" });
@@ -1485,7 +1490,11 @@ function startDevDashboard(options) {
1485
1490
  send(response, 403, "Forbidden");
1486
1491
  return;
1487
1492
  }
1488
- await forward(request, response, `http://127.0.0.1:${target.port}${url.pathname}${url.search}`, (headers) => headers.set(INSPECTOR_TOKEN_HEADER, target.token), "Could not reach the workflow inspector.");
1493
+ await forward(request, response, `http://127.0.0.1:${target.port}${url.pathname}${url.search}`, (headers) => {
1494
+ headers.set(INSPECTOR_TOKEN_HEADER, target.token);
1495
+ if (production && !identity.user) headers.set(INSPECTOR_READ_ONLY_HEADER, "1");
1496
+ else headers.delete(INSPECTOR_READ_ONLY_HEADER);
1497
+ }, "Could not reach the workflow inspector.");
1489
1498
  }
1490
1499
  /**
1491
1500
  * Pass `/app/*` to the app, so the extension's pages read it from the