arkaik 0.11.0 → 0.11.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.
Files changed (2) hide show
  1. package/dist/index.js +43 -3
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -22123,6 +22123,12 @@ Options:
22123
22123
  flag, that refuses outright \u2014 it usually means
22124
22124
  docs/quality/ was looked for in the wrong place, which
22125
22125
  --root fixes, rather than an intended wipe.
22126
+ --allow-metadata-loss Proceed even though the local bundle's project.metadata
22127
+ lacks settings the hosted project has (products, maps,
22128
+ ref_policy, pollen, ...). Without this flag, that
22129
+ refuses outright and names the keys \u2014 those settings
22130
+ are usually edited in the app and never reach the
22131
+ repo bundle, so a restore would silently delete them.
22126
22132
  --audit <id> Fold ONE audit's snapshot rather than merging every
22127
22133
  audit into current state. An id that is not on disk is
22128
22134
  an error, not an empty section.
@@ -22305,6 +22311,21 @@ function describeQualityLoss(hostedQuality, qualityRoot, noQuality, foldNotice)
22305
22311
  }
22306
22312
  return lines.join("\n");
22307
22313
  }
22314
+ function droppedMetadataKeys(hostedProject, outboundProject) {
22315
+ const metadataOf = (project) => {
22316
+ if (typeof project !== "object" || project === null || Array.isArray(project)) return {};
22317
+ const metadata = project.metadata;
22318
+ return typeof metadata === "object" && metadata !== null && !Array.isArray(metadata) ? metadata : {};
22319
+ };
22320
+ const outbound = metadataOf(outboundProject);
22321
+ return Object.keys(metadataOf(hostedProject)).filter((key) => !(key in outbound)).sort();
22322
+ }
22323
+ function describeMetadataLoss(dropped, bundlePath) {
22324
+ return [
22325
+ `This restore would DELETE ${dropped.length} hosted project setting${dropped.length === 1 ? "" : "s"} (project.metadata: ${dropped.join(", ")}) that ${bundlePath} does not carry. Nothing was sent.`,
22326
+ `Those settings are usually edited in the app and never reach the repo bundle. Copy them into the local bundle's project.metadata (GET .../export has them) so the restore keeps them, or re-run with --allow-metadata-loss if they really are meant to go.`
22327
+ ].join("\n");
22328
+ }
22308
22329
  async function runRestore(options = {}) {
22309
22330
  const cwd = options.cwd ?? process.cwd();
22310
22331
  const env = options.env ?? process.env;
@@ -22313,6 +22334,7 @@ async function runRestore(options = {}) {
22313
22334
  const allowDeletions = options.allowDeletions ?? false;
22314
22335
  const noQuality = options.noQuality ?? false;
22315
22336
  const allowQualityLoss = options.allowQualityLoss ?? false;
22337
+ const allowMetadataLoss = options.allowMetadataLoss ?? false;
22316
22338
  const httpClient = options.httpClient ?? DEFAULT_HTTP_CLIENT;
22317
22339
  const linkPath = join10(cwd, LINK_FILE4);
22318
22340
  if (!existsSync10(linkPath)) {
@@ -22423,6 +22445,10 @@ async function runRestore(options = {}) {
22423
22445
  if (isQualitySection(hostedQuality) && !isQualitySection(outboundBundle.quality) && !allowQualityLoss) {
22424
22446
  return fatalResult5(dryRun, describeQualityLoss(hostedQuality, qualityRoot, noQuality, qualityNotice), qualityFields);
22425
22447
  }
22448
+ const droppedKeys = droppedMetadataKeys(exportedBundle.project, outboundBundle.project);
22449
+ if (droppedKeys.length > 0 && !allowMetadataLoss) {
22450
+ return fatalResult5(dryRun, describeMetadataLoss(droppedKeys, bundlePath), qualityFields);
22451
+ }
22426
22452
  const removedNodes = removedIds(exportedBundle.nodes, Array.isArray(local.nodes) ? local.nodes : []);
22427
22453
  const removedEdges = removedIds(exportedBundle.edges, Array.isArray(local.edges) ? local.edges : []);
22428
22454
  if ((removedNodes.length > 0 || removedEdges.length > 0) && !allowDeletions) {
@@ -22505,7 +22531,7 @@ function reportRestore(result) {
22505
22531
  console.log("[dry-run] server preview \u2014 nothing was written:");
22506
22532
  printDelta(result.delta);
22507
22533
  console.log(
22508
- "Re-run without --dry-run to apply \u2014 that run takes the backup, and only that run checks the history, deletion and quality-loss guards (all three read the export, which a dry run never fetches)."
22534
+ "Re-run without --dry-run to apply \u2014 that run takes the backup, and only that run checks the history, deletion, quality-loss and metadata-loss guards (all four read the export, which a dry run never fetches)."
22509
22535
  );
22510
22536
  } else {
22511
22537
  console.log(`Restored. New version ${result.version}.`);
@@ -22529,6 +22555,7 @@ function runRestoreCli(argv) {
22529
22555
  let allowDeletions = false;
22530
22556
  let noQuality = false;
22531
22557
  let allowQualityLoss = false;
22558
+ let allowMetadataLoss = false;
22532
22559
  let audit;
22533
22560
  let root;
22534
22561
  let apiBase;
@@ -22549,6 +22576,8 @@ function runRestoreCli(argv) {
22549
22576
  noQuality = true;
22550
22577
  } else if (arg === "--allow-quality-loss") {
22551
22578
  allowQualityLoss = true;
22579
+ } else if (arg === "--allow-metadata-loss") {
22580
+ allowMetadataLoss = true;
22552
22581
  } else if (arg === "--audit") {
22553
22582
  const value = argv[++i];
22554
22583
  if (value === void 0) fail10(`Missing value for --audit
@@ -22583,7 +22612,18 @@ ${USAGE13}`);
22583
22612
 
22584
22613
  ${USAGE13}`);
22585
22614
  }
22586
- runRestore({ path: positionals[0], dryRun, allowHistoryLoss, allowDeletions, noQuality, allowQualityLoss, audit, root, apiBase }).then((result) => reportRestore(result)).catch((e) => fail10(`FATAL: ${e.message}`));
22615
+ runRestore({
22616
+ path: positionals[0],
22617
+ dryRun,
22618
+ allowHistoryLoss,
22619
+ allowDeletions,
22620
+ noQuality,
22621
+ allowQualityLoss,
22622
+ allowMetadataLoss,
22623
+ audit,
22624
+ root,
22625
+ apiBase
22626
+ }).then((result) => reportRestore(result)).catch((e) => fail10(`FATAL: ${e.message}`));
22587
22627
  }
22588
22628
 
22589
22629
  // src/commands/bootstrap.ts
@@ -25947,7 +25987,7 @@ Options:
25947
25987
  -v, --version Print the version.
25948
25988
 
25949
25989
  Run "arkaik <command> --help" for command-specific help.`;
25950
- var VERSION = "0.11.0";
25990
+ var VERSION = "0.11.1";
25951
25991
  function main(argv) {
25952
25992
  const [command, ...rest] = argv;
25953
25993
  if (command === void 0 || command === "--help" || command === "-h" || command === "help") {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "arkaik",
3
- "version": "0.11.0",
3
+ "version": "0.11.1",
4
4
  "description": "Arkaik CLI — link a repository to a hosted product graph, validate and pack bundles, mirror external ref status.",
5
5
  "license": "MIT",
6
6
  "type": "module",