@floless/app 0.100.0 → 0.100.1

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.
@@ -42657,7 +42657,7 @@ var require_content_disposition = __commonJS({
42657
42657
  "use strict";
42658
42658
  module2.exports = contentDisposition;
42659
42659
  module2.exports.parse = parse;
42660
- var basename5 = require("path").basename;
42660
+ var basename6 = require("path").basename;
42661
42661
  var Buffer4 = require_safe_buffer().Buffer;
42662
42662
  var ENCODE_URL_ATTR_CHAR_REGEXP = /[\x00-\x20"'()*,/:;<=>?@[\\\]{}\x7f]/g;
42663
42663
  var HEX_ESCAPE_REGEXP = /%[0-9A-Fa-f]{2}/;
@@ -42693,9 +42693,9 @@ var require_content_disposition = __commonJS({
42693
42693
  if (typeof fallback === "string" && NON_LATIN1_REGEXP.test(fallback)) {
42694
42694
  throw new TypeError("fallback must be ISO-8859-1 string");
42695
42695
  }
42696
- var name = basename5(filename);
42696
+ var name = basename6(filename);
42697
42697
  var isQuotedString = TEXT_REGEXP.test(name);
42698
- var fallbackName = typeof fallback !== "string" ? fallback && getlatin1(name) : basename5(fallback);
42698
+ var fallbackName = typeof fallback !== "string" ? fallback && getlatin1(name) : basename6(fallback);
42699
42699
  var hasFallback = typeof fallbackName === "string" && fallbackName !== name;
42700
42700
  if (hasFallback || !isQuotedString || HEX_ESCAPE_REGEXP.test(name)) {
42701
42701
  params["filename*"] = name;
@@ -53106,7 +53106,7 @@ function appVersion() {
53106
53106
  return resolveVersion({
53107
53107
  isSea: isSea2(),
53108
53108
  sqVersionXml: readSqVersionXml(),
53109
- define: true ? "0.100.0" : void 0,
53109
+ define: true ? "0.100.1" : void 0,
53110
53110
  pkgVersion: readPkgVersion()
53111
53111
  });
53112
53112
  }
@@ -53116,7 +53116,7 @@ function resolveChannel(s) {
53116
53116
  return "dev";
53117
53117
  }
53118
53118
  function appChannel() {
53119
- return resolveChannel({ isSea: isSea2(), define: true ? "0.100.0" : void 0 });
53119
+ return resolveChannel({ isSea: isSea2(), define: true ? "0.100.1" : void 0 });
53120
53120
  }
53121
53121
 
53122
53122
  // workflow-update.ts
@@ -57196,6 +57196,18 @@ function projectExportFiles(appId) {
57196
57196
  { kind: "ifc", filename: `${appId}.ifc` }
57197
57197
  ];
57198
57198
  }
57199
+ function sanitizeExportName(name) {
57200
+ return name.replace(/[^\p{L}\p{N} \-_().]+/gu, " ").replace(/\s+/g, " ").trim().replace(/[. ]+$/, "").slice(0, 60).trim();
57201
+ }
57202
+ function exportStamp(d = /* @__PURE__ */ new Date()) {
57203
+ const p = (n) => String(n).padStart(2, "0");
57204
+ return `${d.getFullYear()}${p(d.getMonth() + 1)}${p(d.getDate())}-${p(d.getHours())}${p(d.getMinutes())}`;
57205
+ }
57206
+ function exportFileBase(projectId, appId, now = /* @__PURE__ */ new Date()) {
57207
+ if (!projectId) return appId;
57208
+ const name = sanitizeExportName(getProject(projectId)?.name ?? "");
57209
+ return `${name || appId}-${exportStamp(now)}`;
57210
+ }
57199
57211
 
57200
57212
  // project-export-receipts.ts
57201
57213
  var import_node_fs24 = require("node:fs");
@@ -57218,6 +57230,7 @@ function listProjectExportReceipts(projectId) {
57218
57230
  function recordProjectExport(projectId, receipt) {
57219
57231
  const dir = projectExportsDir(projectId);
57220
57232
  (0, import_node_fs24.mkdirSync)(dir, { recursive: true });
57233
+ const prior = listProjectExportReceipts(projectId).find((r) => r.kind === receipt.kind);
57221
57234
  const next = {
57222
57235
  ...receipt,
57223
57236
  exportId: `${receipt.version}-${receipt.kind}-${receipt.contractHash.slice(0, 12)}`,
@@ -57229,6 +57242,12 @@ function recordProjectExport(projectId, receipt) {
57229
57242
  const tmp = `${path}.${process.pid}.tmp`;
57230
57243
  (0, import_node_fs24.writeFileSync)(tmp, JSON.stringify(body, null, 2));
57231
57244
  (0, import_node_fs24.renameSync)(tmp, path);
57245
+ if (prior && prior.filename !== next.filename && (0, import_node_path21.basename)(prior.filename) === prior.filename) {
57246
+ try {
57247
+ (0, import_node_fs24.rmSync)((0, import_node_path21.join)(dir, prior.filename), { force: true });
57248
+ } catch {
57249
+ }
57250
+ }
57232
57251
  return next;
57233
57252
  }
57234
57253
  function receiptHasFile(projectId, receipt) {
@@ -65137,10 +65156,10 @@ var ReaddirpStream = class extends import_node_stream4.Readable {
65137
65156
  }
65138
65157
  async _formatEntry(dirent, path) {
65139
65158
  let entry2;
65140
- const basename5 = this._isDirent ? dirent.name : dirent;
65159
+ const basename6 = this._isDirent ? dirent.name : dirent;
65141
65160
  try {
65142
- const fullPath = (0, import_node_path35.resolve)((0, import_node_path35.join)(path, basename5));
65143
- entry2 = { path: (0, import_node_path35.relative)(this._root, fullPath), fullPath, basename: basename5 };
65161
+ const fullPath = (0, import_node_path35.resolve)((0, import_node_path35.join)(path, basename6));
65162
+ entry2 = { path: (0, import_node_path35.relative)(this._root, fullPath), fullPath, basename: basename6 };
65144
65163
  entry2[this._statsProp] = this._isDirent ? dirent : await this._stat(fullPath);
65145
65164
  } catch (err2) {
65146
65165
  this._onError(err2);
@@ -65679,9 +65698,9 @@ var NodeFsHandler = class {
65679
65698
  _watchWithNodeFs(path, listener) {
65680
65699
  const opts = this.fsw.options;
65681
65700
  const directory = sysPath.dirname(path);
65682
- const basename5 = sysPath.basename(path);
65701
+ const basename6 = sysPath.basename(path);
65683
65702
  const parent = this.fsw._getWatchedDir(directory);
65684
- parent.add(basename5);
65703
+ parent.add(basename6);
65685
65704
  const absolutePath = sysPath.resolve(path);
65686
65705
  const options = {
65687
65706
  persistent: opts.persistent
@@ -65691,7 +65710,7 @@ var NodeFsHandler = class {
65691
65710
  let closer;
65692
65711
  if (opts.usePolling) {
65693
65712
  const enableBin = opts.interval !== opts.binaryInterval;
65694
- options.interval = enableBin && isBinaryPath(basename5) ? opts.binaryInterval : opts.interval;
65713
+ options.interval = enableBin && isBinaryPath(basename6) ? opts.binaryInterval : opts.interval;
65695
65714
  closer = setFsWatchFileListener(path, absolutePath, options, {
65696
65715
  listener,
65697
65716
  rawEmitter: this.fsw._emitRaw
@@ -65714,10 +65733,10 @@ var NodeFsHandler = class {
65714
65733
  return;
65715
65734
  }
65716
65735
  const dirname16 = sysPath.dirname(file);
65717
- const basename5 = sysPath.basename(file);
65736
+ const basename6 = sysPath.basename(file);
65718
65737
  const parent = this.fsw._getWatchedDir(dirname16);
65719
65738
  let prevStats = stats;
65720
- if (parent.has(basename5))
65739
+ if (parent.has(basename6))
65721
65740
  return;
65722
65741
  const listener = async (path, newStats) => {
65723
65742
  if (!this.fsw._throttle(THROTTLE_MODE_WATCH, file, 5))
@@ -65742,9 +65761,9 @@ var NodeFsHandler = class {
65742
65761
  prevStats = newStats2;
65743
65762
  }
65744
65763
  } catch (error) {
65745
- this.fsw._remove(dirname16, basename5);
65764
+ this.fsw._remove(dirname16, basename6);
65746
65765
  }
65747
- } else if (parent.has(basename5)) {
65766
+ } else if (parent.has(basename6)) {
65748
65767
  const at = newStats.atimeMs;
65749
65768
  const mt = newStats.mtimeMs;
65750
65769
  if (!at || at <= mt || mt !== prevStats.mtimeMs) {
@@ -67647,7 +67666,9 @@ async function startServer() {
67647
67666
  const bad = projectAppMismatch(req.params.appId, project);
67648
67667
  if (bad) return reply.status(404).send({ ok: false, error: bad });
67649
67668
  const dir = projectExportsDir(project);
67650
- const exports2 = projectExportFiles(req.params.appId).map(({ kind, filename }) => {
67669
+ const byKind = new Map(listProjectExportReceipts(project).map((r) => [r.kind, r]));
67670
+ const exports2 = projectExportFiles(req.params.appId).map(({ kind, filename: legacy }) => {
67671
+ const filename = byKind.get(kind)?.filename ?? legacy;
67651
67672
  const path = (0, import_node_path37.join)(dir, filename);
67652
67673
  let exportedAt = null;
67653
67674
  try {
@@ -67741,7 +67762,7 @@ async function startServer() {
67741
67762
  return reply.status(422).send({ ok: false, error: emptyError, skipped });
67742
67763
  }
67743
67764
  const companionId = `${req.params.appId}-ifc`;
67744
- const filename = `${req.params.appId}.ifc`;
67765
+ const filename = `${exportFileBase(project, req.params.appId)}.ifc`;
67745
67766
  const outPath = project ? (0, import_node_path37.join)(projectExportsDir(project), filename) : (0, import_node_path37.join)(appPath(companionId), filename);
67746
67767
  if (project) (0, import_node_fs40.mkdirSync)((0, import_node_path37.dirname)(outPath), { recursive: true });
67747
67768
  let flo;
@@ -67879,7 +67900,7 @@ async function startServer() {
67879
67900
  if (bom.rows.filter((r) => r.Profile !== "TOTAL").length === 0) {
67880
67901
  return reply.status(422).send({ ok: false, error: "no priced members to export \u2014 every member is an RFI (no AISC size / weight yet)" });
67881
67902
  }
67882
- const filename = `${appId}-bom.${format}`;
67903
+ const filename = `${exportFileBase(project, appId)}-bom.${format}`;
67883
67904
  const outPath = project ? (0, import_node_path37.join)(projectExportsDir(project), filename) : bomExportPath(appId, format);
67884
67905
  const dir = (0, import_node_path37.dirname)(outPath);
67885
67906
  try {
@@ -67939,7 +67960,7 @@ async function startServer() {
67939
67960
  if (!v.valid) return reply.status(400).send({ ok: false, error: "stored contract is invalid \u2014 re-save it in the editor" });
67940
67961
  const cleaned = postProcess(doc);
67941
67962
  const svg = contractToSvg(cleaned);
67942
- const filename = `${req.params.appId}.svg`;
67963
+ const filename = `${exportFileBase(project, req.params.appId)}.svg`;
67943
67964
  const outPath = project ? (0, import_node_path37.join)(projectExportsDir(project), filename) : (0, import_node_path37.join)(appPath(req.params.appId), filename);
67944
67965
  try {
67945
67966
  (0, import_node_fs40.mkdirSync)((0, import_node_path37.dirname)(outPath), { recursive: true });
@@ -164,7 +164,7 @@
164
164
  { kind: 'bom-csv', ico: '▤', name: 'Bill of materials', fmt: 'CSV', verb: 'Export CSV', file: true, open: true },
165
165
  { kind: 'bom-xlsx', ico: '▦', name: 'Bill of materials', fmt: 'XLSX', verb: 'Export Excel', file: true, open: true },
166
166
  { kind: 'ifc', ico: '◈', name: 'Model', fmt: 'IFC4', verb: 'Export IFC', file: true, open: false },
167
- { kind: 'tekla', ico: '◧', name: 'Tekla', fmt: '.ifc → Open API', verb: 'Send to Tekla', file: false },
167
+ { kind: 'tekla', ico: '◧', name: 'Tekla', fmt: 'Native parts', verb: 'Send to Tekla', file: false },
168
168
  ],
169
169
  },
170
170
  vectorize: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@floless/app",
3
- "version": "0.100.0",
3
+ "version": "0.100.1",
4
4
  "type": "module",
5
5
  "description": "Thin localhost host for floless.app — serves web/ and shells the aware CLI. No engine, no LLM.",
6
6
  "bin": {