@camstack/server 1.2.880 → 1.2.882

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 (90) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/package.json +8 -7
  3. package/system/dist/addon-utils.mjs +1 -1
  4. package/system/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.js +1 -1
  5. package/system/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.mjs +4 -4
  6. package/system/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.js +1 -1
  7. package/system/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.mjs +5 -5
  8. package/system/dist/builtins/alerts/alerts.addon.js +1 -1
  9. package/system/dist/builtins/alerts/alerts.addon.mjs +3 -3
  10. package/system/dist/builtins/autotrack/index.js +1 -1
  11. package/system/dist/builtins/autotrack/index.mjs +1 -1
  12. package/system/dist/builtins/backup-orchestrator/backup-orchestrator.addon.js +2 -2
  13. package/system/dist/builtins/backup-orchestrator/backup-orchestrator.addon.mjs +5 -5
  14. package/system/dist/builtins/calendars/calendars.addon.js +1 -1
  15. package/system/dist/builtins/calendars/calendars.addon.mjs +1 -1
  16. package/system/dist/builtins/camera-grid/index.js +1 -1
  17. package/system/dist/builtins/camera-grid/index.mjs +1 -1
  18. package/system/dist/builtins/composer/composer.addon.js +4 -4
  19. package/system/dist/builtins/composer/composer.addon.mjs +4 -4
  20. package/system/dist/builtins/console-logging/index.js +1 -1
  21. package/system/dist/builtins/console-logging/index.mjs +1 -1
  22. package/system/dist/builtins/core-blocks/core-blocks.addon.js +3 -3
  23. package/system/dist/builtins/core-blocks/core-blocks.addon.mjs +3 -3
  24. package/system/dist/builtins/device-history/device-history.addon.js +2 -2
  25. package/system/dist/builtins/device-history/device-history.addon.mjs +2 -2
  26. package/system/dist/builtins/device-manager/device-manager.addon.js +2 -2
  27. package/system/dist/builtins/device-manager/device-manager.addon.mjs +2 -2
  28. package/system/dist/builtins/hub-forwarder/index.js +1 -1
  29. package/system/dist/builtins/hub-forwarder/index.mjs +1 -1
  30. package/system/dist/builtins/keychain/index.js +4 -4
  31. package/system/dist/builtins/keychain/index.mjs +4 -4
  32. package/system/dist/builtins/liveness-monitor/liveness-monitor.addon.js +1 -1
  33. package/system/dist/builtins/liveness-monitor/liveness-monitor.addon.mjs +1 -1
  34. package/system/dist/builtins/local-auth/local-auth.addon.js +2 -2
  35. package/system/dist/builtins/local-auth/local-auth.addon.mjs +5 -5
  36. package/system/dist/builtins/local-network/local-network.addon.js +3 -3
  37. package/system/dist/builtins/local-network/local-network.addon.mjs +3 -3
  38. package/system/dist/builtins/loki-logging/index.js +1 -1
  39. package/system/dist/builtins/loki-logging/index.mjs +1 -1
  40. package/system/dist/builtins/native-metrics/native-metrics.addon.js +1 -1
  41. package/system/dist/builtins/native-metrics/native-metrics.addon.mjs +10 -10
  42. package/system/dist/builtins/platform-probe/index.js +1 -1
  43. package/system/dist/builtins/platform-probe/index.mjs +10 -10
  44. package/system/dist/builtins/record-entries/index.js +1 -1
  45. package/system/dist/builtins/record-entries/index.mjs +1 -1
  46. package/system/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.js +1 -1
  47. package/system/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.mjs +1 -1
  48. package/system/dist/builtins/snapshot/index.js +1 -1
  49. package/system/dist/builtins/snapshot/index.mjs +1 -1
  50. package/system/dist/builtins/sqlite-storage/filesystem-storage.addon.js +1 -1
  51. package/system/dist/builtins/sqlite-storage/filesystem-storage.addon.mjs +20 -20
  52. package/system/dist/builtins/sqlite-storage/index.js +1 -1
  53. package/system/dist/builtins/sqlite-storage/index.mjs +1 -1
  54. package/system/dist/builtins/sqlite-storage/sqlite-settings.addon.js +3 -3
  55. package/system/dist/builtins/sqlite-storage/sqlite-settings.addon.mjs +3 -3
  56. package/system/dist/builtins/storage-orchestrator/storage-orchestrator.addon.js +1 -1
  57. package/system/dist/builtins/storage-orchestrator/storage-orchestrator.addon.mjs +1 -1
  58. package/system/dist/builtins/system-config/system-config.addon.js +3 -3
  59. package/system/dist/builtins/system-config/system-config.addon.mjs +115 -115
  60. package/system/dist/builtins/winston-logging/index.js +1 -1
  61. package/system/dist/builtins/winston-logging/index.mjs +1 -1
  62. package/system/dist/{capture-engine-CxD6UV_F.js → capture-engine-D1cSfGu_.js} +1 -1
  63. package/system/dist/{capture-engine-Btw78o_3.mjs → capture-engine-hBdaHSa5.mjs} +1 -1
  64. package/system/dist/{composition-sources-DcEvVNT0.js → composition-sources-CfKDTis7.js} +1 -1
  65. package/system/dist/{composition-sources-BeSuy_o2.mjs → composition-sources-Cpu22JMr.mjs} +1 -1
  66. package/system/dist/{constants-DfXUZ9B1.js → constants-CRKNMR3M.js} +1 -1
  67. package/system/dist/{constants-CFj_1tVH.mjs → constants-CTYmEHlW.mjs} +1 -1
  68. package/system/dist/{coral-accelerators-BW3OcrLD.mjs → coral-accelerators-DBlgWB8k.mjs} +6 -6
  69. package/system/dist/{custom-action-registry-N7flBDwT.mjs → custom-action-registry-B9zFBNVa.mjs} +37 -37
  70. package/system/dist/{device-ca-CJUo1gng.mjs → device-ca-Dj6nzcoq.mjs} +1 -1
  71. package/system/dist/{device-ca-DxQ_lJD2.js → device-ca-wlsnsg3M.js} +1 -1
  72. package/system/dist/{dist-BTJfwhbC.mjs → dist-BbuJa6G4.mjs} +102 -11
  73. package/system/dist/{dist-lI1nsGZD.js → dist-DFeAUBa8.js} +102 -11
  74. package/system/dist/file-host-worker.js +1 -1
  75. package/system/dist/file-host-worker.mjs +1 -1
  76. package/system/dist/{hub-identity-_lkdpfBw.mjs → hub-identity-CcEQJ8el.mjs} +10 -10
  77. package/system/dist/{hub-identity-DAo-4o-I.js → hub-identity-DPKmKOuk.js} +1 -1
  78. package/system/dist/{hub-mdns-ciao-D71EkR2r.js → hub-mdns-ciao-DP0ReXx8.js} +2 -2
  79. package/system/dist/{hub-mdns-ciao-rG5KvyjB.mjs → hub-mdns-ciao-p1Hky4He.mjs} +2 -2
  80. package/system/dist/index.js +8 -8
  81. package/system/dist/index.mjs +217 -217
  82. package/system/dist/{legacy-integration-rows-door-BWDa94xe.js → legacy-integration-rows-door-BxlPhgrH.js} +1 -1
  83. package/system/dist/{legacy-integration-rows-door-BTaWniqP.mjs → legacy-integration-rows-door-DJaNTUpH.mjs} +1 -1
  84. package/system/dist/{rename-composition-block-DFW6qzZI.js → rename-composition-block-BAiTDZoT.js} +1 -1
  85. package/system/dist/{rename-composition-block--_zxKuUp.mjs → rename-composition-block-DjyPUZPW.mjs} +1 -1
  86. package/system/dist/{restore-archive-05pKHcoC.mjs → restore-archive-BLJ9rXBX.mjs} +94 -94
  87. package/system/dist/{restore-archive-BDsgP18H.js → restore-archive-n-OmTBbN.js} +1 -1
  88. package/system/dist/{wal-maintenance-D7t11nIk.js → wal-maintenance-CrMVN_qH.js} +0 -0
  89. package/system/dist/{wal-maintenance-B0JAeEix.mjs → wal-maintenance-DKNovLM_.mjs} +0 -0
  90. package/system/package.json +1 -1
@@ -3,7 +3,7 @@ Object.defineProperties(exports, {
3
3
  [Symbol.toStringTag]: { value: "Module" }
4
4
  });
5
5
  const require_chunk = require("../../chunk-Cek0wNdY.js");
6
- const require_dist = require("../../dist-lI1nsGZD.js");
6
+ const require_dist = require("../../dist-DFeAUBa8.js");
7
7
  const require_formatter = require("../../formatter-xbxeV4GD.js");
8
8
  const require_log_file_read_protocol = require("../../log-file-read-protocol-DSV_vQRb.js");
9
9
  let node_path = require("node:path");
@@ -1,4 +1,4 @@
1
- import { Ea as preconditionOf, Gc as defineAddonMigrations, Gi as logDestinationCapability, Ks as BaseAddon } from "../../dist-BTJfwhbC.mjs";
1
+ import { Ea as preconditionOf, Gc as defineAddonMigrations, Gi as logDestinationCapability, Ks as BaseAddon } from "../../dist-BbuJa6G4.mjs";
2
2
  import { t as formatLogLine } from "../../formatter-DkYZ4LXp.mjs";
3
3
  import { a as LogFileIndexStore, i as serveRead, n as isFromReader, t as CancelBook } from "../../log-file-read-protocol-hTaAsYlX.mjs";
4
4
  import { createRequire } from "node:module";
@@ -1,4 +1,4 @@
1
- const require_dist = require("./dist-lI1nsGZD.js");
1
+ const require_dist = require("./dist-DFeAUBa8.js");
2
2
  //#region src/builtins/device-history/store/series-registry.ts
3
3
  function subjectIdOf(subject) {
4
4
  return subject.kind === "device" ? `d:${subject.deviceId}` : `n:${subject.nodeId}`;
@@ -1,4 +1,4 @@
1
- import { Gl as DeviceType, nc as HISTORY_DEFAULT_MIN_INTERVAL_MS, tl as historyItemFieldPath } from "./dist-BTJfwhbC.mjs";
1
+ import { Gl as DeviceType, nc as HISTORY_DEFAULT_MIN_INTERVAL_MS, tl as historyItemFieldPath } from "./dist-BbuJa6G4.mjs";
2
2
  //#region src/builtins/device-history/store/series-registry.ts
3
3
  function subjectIdOf(subject) {
4
4
  return subject.kind === "device" ? `d:${subject.deviceId}` : `n:${subject.nodeId}`;
@@ -1,4 +1,4 @@
1
- const require_dist = require("./dist-lI1nsGZD.js");
1
+ const require_dist = require("./dist-DFeAUBa8.js");
2
2
  //#region src/builtins/shared/device-state-changed.ts
3
3
  /** Structural narrowing helper for untrusted bus payloads. */
4
4
  function isRecord(value) {
@@ -1,4 +1,4 @@
1
- import { Ds as compositionSourceKey, Kl as errMsg } from "./dist-BTJfwhbC.mjs";
1
+ import { Ds as compositionSourceKey, Kl as errMsg } from "./dist-BbuJa6G4.mjs";
2
2
  //#region src/builtins/shared/device-state-changed.ts
3
3
  /** Structural narrowing helper for untrusted bus payloads. */
4
4
  function isRecord(value) {
@@ -1,5 +1,5 @@
1
1
  /** `secret://system/global/meshCaKey` — EC P-256 PKCS#8 PEM of the hub mesh CA. */
2
- var MESH_CA_KEY_REF = require("./dist-lI1nsGZD.js").buildSecretRef({
2
+ var MESH_CA_KEY_REF = require("./dist-DFeAUBa8.js").buildSecretRef({
3
3
  owner: "system",
4
4
  scope: { kind: "global" },
5
5
  fieldPath: "meshCaKey"
@@ -1,4 +1,4 @@
1
- import { Ic as buildSecretRef } from "./dist-BTJfwhbC.mjs";
1
+ import { Ic as buildSecretRef } from "./dist-BbuJa6G4.mjs";
2
2
  /** `secret://system/global/meshCaKey` — EC P-256 PKCS#8 PEM of the hub mesh CA. */
3
3
  var MESH_CA_KEY_REF = buildSecretRef({
4
4
  owner: "system",
@@ -1,5 +1,5 @@
1
1
  import { EDGETPU_LIB_ENV, chooseEdgetpuDelegate, nodeDataRootFromEnv } from "@camstack/types/node";
2
- import Kt from "node:fs";
2
+ import fs from "node:fs";
3
3
  //#region src/builtins/platform-probe/coral-accelerators.ts
4
4
  /**
5
5
  * Coral USB Edge TPU USB identifiers.
@@ -185,21 +185,21 @@ function detectCoralAccelerator(fsx, delegateHost = currentDelegateHost()) {
185
185
  }
186
186
  function safeListOrNull(dir) {
187
187
  try {
188
- return Kt.readdirSync(dir);
188
+ return fs.readdirSync(dir);
189
189
  } catch {
190
190
  return null;
191
191
  }
192
192
  }
193
193
  function safeList(dir) {
194
194
  try {
195
- return Kt.readdirSync(dir);
195
+ return fs.readdirSync(dir);
196
196
  } catch {
197
197
  return [];
198
198
  }
199
199
  }
200
200
  function safeRead(path) {
201
201
  try {
202
- return Kt.readFileSync(path, "utf8").trim();
202
+ return fs.readFileSync(path, "utf8").trim();
203
203
  } catch {
204
204
  return "";
205
205
  }
@@ -213,7 +213,7 @@ var nodeCoralFs = {
213
213
  listApexClass: () => safeList("/sys/class/apex"),
214
214
  canOpen: (path) => {
215
215
  try {
216
- Kt.accessSync(path, Kt.constants.R_OK | Kt.constants.W_OK);
216
+ fs.accessSync(path, fs.constants.R_OK | fs.constants.W_OK);
217
217
  return true;
218
218
  } catch {
219
219
  return false;
@@ -221,7 +221,7 @@ var nodeCoralFs = {
221
221
  },
222
222
  exists: (path) => {
223
223
  try {
224
- return Kt.existsSync(path);
224
+ return fs.existsSync(path);
225
225
  } catch {
226
226
  return false;
227
227
  }
@@ -1,5 +1,5 @@
1
1
  import { createHash } from "node:crypto";
2
- import * as fs from "node:fs";
2
+ import * as fs$1 from "node:fs";
3
3
  import { createReadStream, promises } from "node:fs";
4
4
  import * as path$1 from "node:path";
5
5
  import path from "node:path";
@@ -159,7 +159,7 @@ var HOSTED_MODEL_REVISIONS = {
159
159
  //#endregion
160
160
  //#region src/download/model-downloader.ts
161
161
  function isNonEmptyFile(filePath) {
162
- return fs.existsSync(filePath) && fs.statSync(filePath).size > 0;
162
+ return fs$1.existsSync(filePath) && fs$1.statSync(filePath).size > 0;
163
163
  }
164
164
  /**
165
165
  * Sibling files of a single-file (non-directory) format — extra files the
@@ -269,11 +269,11 @@ function resolveRedirectUrl(current, location) {
269
269
  return new URL(location, current);
270
270
  }
271
271
  async function downloadFile(url, destPath, onProgressOrOptions) {
272
- if (fs.existsSync(destPath)) return destPath;
272
+ if (fs$1.existsSync(destPath)) return destPath;
273
273
  const opts = normalizeDownloadOptions(onProgressOrOptions);
274
274
  const fetchImpl = opts.fetchImpl ?? fetch;
275
275
  const maxRedirects = opts.maxRedirects ?? DEFAULT_MAX_REDIRECTS;
276
- fs.mkdirSync(path$1.dirname(destPath), { recursive: true });
276
+ fs$1.mkdirSync(path$1.dirname(destPath), { recursive: true });
277
277
  const tmpPath = destPath + ".downloading";
278
278
  try {
279
279
  let current = url;
@@ -315,7 +315,7 @@ async function downloadFile(url, destPath, onProgressOrOptions) {
315
315
  if (!response.body) throw new Error(`No response body from ${url}`);
316
316
  const total = parseInt(response.headers.get("content-length") ?? "0", 10);
317
317
  let downloaded = 0;
318
- const fileStream = fs.createWriteStream(tmpPath);
318
+ const fileStream = fs$1.createWriteStream(tmpPath);
319
319
  const reader = response.body.getReader();
320
320
  try {
321
321
  for (;;) {
@@ -333,11 +333,11 @@ async function downloadFile(url, destPath, onProgressOrOptions) {
333
333
  fileStream.on("error", reject);
334
334
  });
335
335
  }
336
- fs.renameSync(tmpPath, destPath);
336
+ fs$1.renameSync(tmpPath, destPath);
337
337
  return destPath;
338
338
  } catch (err) {
339
339
  try {
340
- fs.unlinkSync(tmpPath);
340
+ fs$1.unlinkSync(tmpPath);
341
341
  } catch {}
342
342
  throw err;
343
343
  }
@@ -368,12 +368,12 @@ async function downloadModel(options) {
368
368
  const { url, fallbackUrls = [], destDir, filename, expectedSha256, onProgress } = options;
369
369
  const fname = filename ?? url.split("/").pop() ?? "model.bin";
370
370
  const destPath = path$1.join(destDir, fname);
371
- if (fs.existsSync(destPath)) return {
371
+ if (fs$1.existsSync(destPath)) return {
372
372
  filePath: destPath,
373
373
  downloadedBytes: 0,
374
374
  fromCache: true
375
375
  };
376
- fs.mkdirSync(destDir, { recursive: true });
376
+ fs$1.mkdirSync(destDir, { recursive: true });
377
377
  const urls = [url, ...fallbackUrls];
378
378
  let lastError = null;
379
379
  for (const tryUrl of urls) try {
@@ -381,25 +381,25 @@ async function downloadModel(options) {
381
381
  if (expectedSha256) {
382
382
  const hash = await computeSha256(destPath);
383
383
  if (hash !== expectedSha256) {
384
- fs.unlinkSync(destPath);
384
+ fs$1.unlinkSync(destPath);
385
385
  throw new Error(`SHA256 mismatch: expected ${expectedSha256}, got ${hash}`);
386
386
  }
387
387
  }
388
388
  return {
389
389
  filePath: destPath,
390
- downloadedBytes: fs.statSync(destPath).size,
390
+ downloadedBytes: fs$1.statSync(destPath).size,
391
391
  fromCache: false
392
392
  };
393
393
  } catch (e) {
394
394
  lastError = e;
395
- if (fs.existsSync(destPath)) fs.unlinkSync(destPath);
395
+ if (fs$1.existsSync(destPath)) fs$1.unlinkSync(destPath);
396
396
  }
397
397
  throw lastError ?? /* @__PURE__ */ new Error(`Failed to download model from ${url}`);
398
398
  }
399
399
  async function computeSha256(filePath) {
400
400
  return new Promise((resolve, reject) => {
401
401
  const hash = createHash("sha256");
402
- const stream = fs.createReadStream(filePath);
402
+ const stream = fs$1.createReadStream(filePath);
403
403
  stream.on("data", (chunk) => hash.update(chunk));
404
404
  stream.on("end", () => resolve(hash.digest("hex")));
405
405
  stream.on("error", reject);
@@ -424,28 +424,28 @@ async function downloadDirectory(url, destDir, knownFiles, onProgress) {
424
424
  fileUrl: `https://huggingface.co/${repo}/resolve/main/${dirPath}/${f}`
425
425
  }));
426
426
  const tmpDir = destDir + ".downloading";
427
- fs.rmSync(tmpDir, {
427
+ fs$1.rmSync(tmpDir, {
428
428
  recursive: true,
429
429
  force: true
430
430
  });
431
- fs.mkdirSync(tmpDir, { recursive: true });
431
+ fs$1.mkdirSync(tmpDir, { recursive: true });
432
432
  let totalDownloaded = 0;
433
433
  try {
434
434
  for (const file of files) {
435
435
  const destPath = path$1.join(tmpDir, file.relativePath);
436
- fs.mkdirSync(path$1.dirname(destPath), { recursive: true });
436
+ fs$1.mkdirSync(path$1.dirname(destPath), { recursive: true });
437
437
  await downloadFile(file.fileUrl, destPath, (downloaded, _total) => {
438
438
  onProgress?.(totalDownloaded + downloaded, void 0);
439
439
  });
440
- totalDownloaded += fs.statSync(destPath).size;
440
+ totalDownloaded += fs$1.statSync(destPath).size;
441
441
  }
442
- fs.rmSync(destDir, {
442
+ fs$1.rmSync(destDir, {
443
443
  recursive: true,
444
444
  force: true
445
445
  });
446
- fs.renameSync(tmpDir, destDir);
446
+ fs$1.renameSync(tmpDir, destDir);
447
447
  } catch (err) {
448
- fs.rmSync(tmpDir, {
448
+ fs$1.rmSync(tmpDir, {
449
449
  recursive: true,
450
450
  force: true
451
451
  });
@@ -477,7 +477,7 @@ function revisionRecordPath(modelPath) {
477
477
  }
478
478
  function readRevisionRecord(modelPath) {
479
479
  try {
480
- return fs.readFileSync(revisionRecordPath(modelPath), "utf8").trim();
480
+ return fs$1.readFileSync(revisionRecordPath(modelPath), "utf8").trim();
481
481
  } catch {
482
482
  return null;
483
483
  }
@@ -541,8 +541,8 @@ function writeRevisionRecord(modelPath, revision) {
541
541
  if (revision === void 0) return;
542
542
  const record = revisionRecordPath(modelPath);
543
543
  const tmp = `${record}.tmp`;
544
- fs.writeFileSync(tmp, `${revision}\n`);
545
- fs.renameSync(tmp, record);
544
+ fs$1.writeFileSync(tmp, `${revision}\n`);
545
+ fs$1.renameSync(tmp, record);
546
546
  }
547
547
  /**
548
548
  * Prove an unrecorded (or differently recorded) copy current by hashing its
@@ -562,9 +562,9 @@ async function adoptByHash(modelsDir, modelPath, formatEntry) {
562
562
  }
563
563
  /** True when every file of the format is on disk, whatever revision it holds. */
564
564
  function isCompleteCopy(modelsDir, modelPath, formatEntry) {
565
- if (!fs.existsSync(modelPath)) return false;
566
- if (formatEntry.isDirectory) return fs.existsSync(path$1.join(modelPath, "Manifest.json"));
567
- if (fs.statSync(modelPath).size <= 0) return false;
565
+ if (!fs$1.existsSync(modelPath)) return false;
566
+ if (formatEntry.isDirectory) return fs$1.existsSync(path$1.join(modelPath, "Manifest.json"));
567
+ if (fs$1.statSync(modelPath).size <= 0) return false;
568
568
  return siblingFilesFor(formatEntry).every((f) => isNonEmptyFile(path$1.join(modelsDir, f)));
569
569
  }
570
570
  /**
@@ -586,14 +586,14 @@ async function replaceSingleFileFormat(url, modelPath, modelsDir, siblings, onPr
586
586
  }));
587
587
  try {
588
588
  for (const [i, part] of parts.entries()) {
589
- fs.rmSync(part.staged, { force: true });
589
+ fs$1.rmSync(part.staged, { force: true });
590
590
  await downloadFile(part.url, part.staged, i === 0 ? (downloaded, total) => onProgress?.(downloaded, total === 0 ? void 0 : total) : void 0);
591
591
  }
592
592
  } catch (err) {
593
- for (const part of parts) fs.rmSync(part.staged, { force: true });
593
+ for (const part of parts) fs$1.rmSync(part.staged, { force: true });
594
594
  throw err;
595
595
  }
596
- for (const part of parts) fs.renameSync(part.staged, part.dest);
596
+ for (const part of parts) fs$1.renameSync(part.staged, part.dest);
597
597
  }
598
598
  /**
599
599
  * Resolve a `ModelCatalogEntry` against `modelsDir`: download model file
@@ -608,14 +608,14 @@ async function ensureModel(modelsDir, entry, format, onProgress) {
608
608
  const modelPath = path$1.join(modelsDir, filename);
609
609
  const siblings = siblingFilesFor(formatEntry);
610
610
  let outdated = false;
611
- if (fs.existsSync(modelPath)) if (formatEntry.isDirectory && !fs.existsSync(path$1.join(modelPath, "Manifest.json"))) fs.rmSync(modelPath, {
611
+ if (fs$1.existsSync(modelPath)) if (formatEntry.isDirectory && !fs$1.existsSync(path$1.join(modelPath, "Manifest.json"))) fs$1.rmSync(modelPath, {
612
612
  recursive: true,
613
613
  force: true
614
614
  });
615
615
  else if (siblings.some((f) => !isNonEmptyFile(path$1.join(modelsDir, f)))) outdated = !isCurrentRevision(modelPath, formatEntry) && !await adoptByHash(modelsDir, modelPath, formatEntry);
616
616
  else if (isCurrentRevision(modelPath, formatEntry) || await adoptByHash(modelsDir, modelPath, formatEntry)) return modelPath;
617
617
  else outdated = true;
618
- fs.mkdirSync(modelsDir, { recursive: true });
618
+ fs$1.mkdirSync(modelsDir, { recursive: true });
619
619
  if (formatEntry.isDirectory) await downloadDirectory(formatEntry.url, modelPath, formatEntry.files, onProgress);
620
620
  else if (outdated) await replaceSingleFileFormat(formatEntry.url, modelPath, modelsDir, siblings, onProgress);
621
621
  else {
@@ -673,25 +673,25 @@ function isModelDownloaded(modelsDir, entry, format) {
673
673
  const formatEntry = entry.formats[format];
674
674
  if (!formatEntry) return false;
675
675
  const modelPath = getModelFilePath(modelsDir, entry, format);
676
- if (!modelPath || !fs.existsSync(modelPath)) return false;
676
+ if (!modelPath || !fs$1.existsSync(modelPath)) return false;
677
677
  if (!isCurrentRevision(modelPath, formatEntry)) return false;
678
678
  return isCompleteCopy(modelsDir, modelPath, formatEntry);
679
679
  }
680
680
  /** Remove the on-disk model file/directory. Returns true if something was deleted. */
681
681
  function deleteModelFromDisk(modelsDir, entry, format) {
682
682
  const modelPath = getModelFilePath(modelsDir, entry, format);
683
- if (!modelPath || !fs.existsSync(modelPath)) return false;
684
- fs.rmSync(revisionRecordPath(modelPath), { force: true });
683
+ if (!modelPath || !fs$1.existsSync(modelPath)) return false;
684
+ fs$1.rmSync(revisionRecordPath(modelPath), { force: true });
685
685
  const formatEntry = entry.formats[format];
686
- if (formatEntry?.isDirectory) fs.rmSync(modelPath, {
686
+ if (formatEntry?.isDirectory) fs$1.rmSync(modelPath, {
687
687
  recursive: true,
688
688
  force: true
689
689
  });
690
690
  else {
691
- fs.unlinkSync(modelPath);
691
+ fs$1.unlinkSync(modelPath);
692
692
  if (formatEntry) for (const sibling of siblingFilesFor(formatEntry)) {
693
693
  const sibPath = path$1.join(modelsDir, sibling);
694
- if (fs.existsSync(sibPath)) fs.unlinkSync(sibPath);
694
+ if (fs$1.existsSync(sibPath)) fs$1.unlinkSync(sibPath);
695
695
  }
696
696
  }
697
697
  return true;
@@ -1,4 +1,4 @@
1
- import { Ic as buildSecretRef, K as DEVICE_SAN_CREDENTIAL_PREFIX, q as DEVICE_SAN_USER_PREFIX } from "./dist-BTJfwhbC.mjs";
1
+ import { Ic as buildSecretRef, K as DEVICE_SAN_CREDENTIAL_PREFIX, q as DEVICE_SAN_USER_PREFIX } from "./dist-BbuJa6G4.mjs";
2
2
  import { C as backdatedNotBefore, S as withUtcTimeEncoding, a as KeyUsageFlags, d as SubjectKeyIdentifierExtension, f as X509Certificate$1, m as cryptoProvider, n as BasicConstraintsExtension, o as KeyUsagesExtension, p as X509CertificateGenerator, r as ExtendedKeyUsageExtension, s as PemConverter, t as AuthorityKeyIdentifierExtension, u as SubjectAlternativeNameExtension } from "./x509.es-BRiJgOvu.mjs";
3
3
  import { X509Certificate, createPublicKey, randomBytes, verify, webcrypto } from "node:crypto";
4
4
  //#region src/auth/jwt-signing-key.ts
@@ -1,4 +1,4 @@
1
- const require_dist = require("./dist-lI1nsGZD.js");
1
+ const require_dist = require("./dist-DFeAUBa8.js");
2
2
  const require_x509_es = require("./x509.es-WtnRNyYS.js");
3
3
  let node_crypto = require("node:crypto");
4
4
  //#region src/auth/jwt-signing-key.ts
@@ -21910,19 +21910,43 @@ var DEVICE_TEMPLATE_CATALOGUE_CATEGORIES = [
21910
21910
  "loop",
21911
21911
  "variable"
21912
21912
  ];
21913
+ var DEVICE_TEMPLATE_PARAM_TYPES = [
21914
+ "string",
21915
+ "number",
21916
+ "boolean"
21917
+ ];
21918
+ /**
21919
+ * Where the values a parameter takes come from, when a fixed set makes sense.
21920
+ * `units-of-field` is the units in the dimension of the piped field's unit;
21921
+ * `choices` is a named list (a time pattern); `range` is the numbers
21922
+ * `min…max` by `step`. An absent source means free input.
21923
+ */
21924
+ var deviceTemplateParamValuesSchemaValue = z.discriminatedUnion("kind", [
21925
+ z.object({ kind: z.literal("units-of-field") }),
21926
+ z.object({
21927
+ kind: z.literal("choices"),
21928
+ options: z.array(z.object({
21929
+ value: z.string(),
21930
+ labelKey: z.string().min(1)
21931
+ })).min(1)
21932
+ }),
21933
+ z.object({
21934
+ kind: z.literal("range"),
21935
+ min: z.number(),
21936
+ max: z.number(),
21937
+ step: z.number().positive()
21938
+ })
21939
+ ]);
21913
21940
  var deviceTemplateParamSchema = z.object({
21914
21941
  name: z.string().min(1),
21915
- type: z.enum([
21916
- "string",
21917
- "number",
21918
- "boolean"
21919
- ]),
21942
+ type: z.enum(DEVICE_TEMPLATE_PARAM_TYPES),
21920
21943
  optional: z.boolean(),
21921
21944
  default: z.union([
21922
21945
  z.string(),
21923
21946
  z.number(),
21924
21947
  z.boolean()
21925
- ]).optional()
21948
+ ]).optional(),
21949
+ values: deviceTemplateParamValuesSchemaValue.optional()
21926
21950
  });
21927
21951
  z.object({
21928
21952
  name: z.string().min(1),
@@ -21932,8 +21956,8 @@ z.object({
21932
21956
  descriptionKey: z.string().min(1),
21933
21957
  exampleKey: z.string().min(1)
21934
21958
  });
21935
- function param(name, type, optional, fallback) {
21936
- return fallback === void 0 ? {
21959
+ function param(name, type, optional, fallback, values) {
21960
+ const base = fallback === void 0 ? {
21937
21961
  name,
21938
21962
  type,
21939
21963
  optional
@@ -21943,6 +21967,10 @@ function param(name, type, optional, fallback) {
21943
21967
  optional,
21944
21968
  default: fallback
21945
21969
  };
21970
+ return values === void 0 ? base : {
21971
+ ...base,
21972
+ values
21973
+ };
21946
21974
  }
21947
21975
  function entry(name, kind, category, params) {
21948
21976
  return {
@@ -21954,12 +21982,71 @@ function entry(name, kind, category, params) {
21954
21982
  exampleKey: `uiLibrary.deviceTemplateCatalogue.${name}.example`
21955
21983
  };
21956
21984
  }
21957
- var DIGITS = param("digits", "number", true, 0);
21985
+ var DIGITS = param("digits", "number", true, 0, {
21986
+ kind: "range",
21987
+ min: 0,
21988
+ max: 4,
21989
+ step: 1
21990
+ });
21991
+ var UNITS_OF_FIELD = { kind: "units-of-field" };
21992
+ /** Named time patterns: the engine's tokens are `YYYY MM DD HH mm ss`. */
21993
+ var TIME_PATTERNS = [
21994
+ [
21995
+ "hm",
21996
+ "HH:mm",
21997
+ "Hours and minutes (14:05)",
21998
+ "Ore e minuti (14:05)"
21999
+ ],
22000
+ [
22001
+ "hms",
22002
+ "HH:mm:ss",
22003
+ "Hours, minutes, seconds (14:05:09)",
22004
+ "Ore, minuti, secondi (14:05:09)"
22005
+ ],
22006
+ [
22007
+ "dm",
22008
+ "DD/MM",
22009
+ "Day and month (31/12)",
22010
+ "Giorno e mese (31/12)"
22011
+ ],
22012
+ [
22013
+ "dmy",
22014
+ "DD/MM/YYYY",
22015
+ "Day, month, year (31/12/2026)",
22016
+ "Giorno, mese, anno (31/12/2026)"
22017
+ ],
22018
+ [
22019
+ "dmyhm",
22020
+ "DD/MM/YYYY HH:mm",
22021
+ "Date and time (31/12/2026 14:05)",
22022
+ "Data e ora (31/12/2026 14:05)"
22023
+ ],
22024
+ [
22025
+ "iso",
22026
+ "YYYY-MM-DD",
22027
+ "ISO date (2026-12-31)",
22028
+ "Data ISO (2026-12-31)"
22029
+ ],
22030
+ [
22031
+ "isohms",
22032
+ "YYYY-MM-DD HH:mm:ss",
22033
+ "ISO date and time (2026-12-31 14:05:09)",
22034
+ "Data e ora ISO (2026-12-31 14:05:09)"
22035
+ ]
22036
+ ];
22037
+ var TIME_PATTERN_KEY = (id) => `uiLibrary.deviceTemplateCatalogue.choice.time.${id}`;
22038
+ var TIME_PATTERN_VALUES = {
22039
+ kind: "choices",
22040
+ options: TIME_PATTERNS.map(([id, pattern]) => ({
22041
+ value: pattern,
22042
+ labelKey: TIME_PATTERN_KEY(id)
22043
+ }))
22044
+ };
21958
22045
  var FALLBACK_TEXT = param("fallback", "string", false);
21959
22046
  var FALSY = param("falsy", "boolean", true, false);
21960
22047
  /** Every name the engine allows, in the order operators meet them. */
21961
22048
  var DEVICE_TEMPLATE_CATALOGUE = [
21962
- entry("unit", "filter", "unit", [param("symbol", "string", false), param("from", "string", true)]),
22049
+ entry("unit", "filter", "unit", [param("symbol", "string", false, void 0, UNITS_OF_FIELD), param("from", "string", true, void 0, UNITS_OF_FIELD)]),
21963
22050
  entry("round", "filter", "number", [DIGITS]),
21964
22051
  entry("trunc", "filter", "number", [DIGITS]),
21965
22052
  entry("onoff", "filter", "state", []),
@@ -21995,7 +22082,7 @@ var DEVICE_TEMPLATE_CATALOGUE = [
21995
22082
  param("killwords", "boolean", true, false),
21996
22083
  param("end", "string", true, "…")
21997
22084
  ]),
21998
- entry("time", "filter", "time", [param("pattern", "string", false)]),
22085
+ entry("time", "filter", "time", [param("pattern", "string", false, void 0, TIME_PATTERN_VALUES)]),
21999
22086
  entry("range", "global", "loop", [
22000
22087
  param("stop", "number", false),
22001
22088
  param("start", "number", true, 0),
@@ -22163,6 +22250,10 @@ function buildText() {
22163
22250
  it: row.example[1]
22164
22251
  };
22165
22252
  }
22253
+ for (const [id, , en, it] of TIME_PATTERNS) out[TIME_PATTERN_KEY(id)] = {
22254
+ en,
22255
+ it
22256
+ };
22166
22257
  return out;
22167
22258
  }
22168
22259
  buildText();