@aikdna/kdna-cli 0.20.2 → 0.20.4

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aikdna/kdna-cli",
3
- "version": "0.20.2",
3
+ "version": "0.20.4",
4
4
  "description": "KDNA CLI — runtime control plane for verifying, installing, loading, comparing, publishing, and auditing existing .kdna assets.",
5
5
  "type": "commonjs",
6
6
  "bin": {
@@ -493,7 +493,11 @@ function inspectKdnaFile(filePath, jsonMode = false) {
493
493
  const isZip = head[0] === 0x50 && head[1] === 0x4b;
494
494
  if (!isZip) error('Invalid .kdna asset: expected ZIP container');
495
495
 
496
- const { listContainerEntries, readContainerJson } = require('../package-store');
496
+ const {
497
+ listContainerEntries,
498
+ readContainerJson,
499
+ readContainerDataMap,
500
+ } = require('../package-store');
497
501
  const { licenseDecryptOptionsForManifest } = require('./license');
498
502
  const presentFiles = listContainerEntries(abs).filter(
499
503
  (f) => (f.startsWith('KDNA_') && f.endsWith('.json')) || f === 'README.md' || f === 'LICENSE',
@@ -513,8 +517,20 @@ function inspectKdnaFile(filePath, jsonMode = false) {
513
517
  let core = null;
514
518
  let patterns = null;
515
519
  try {
516
- core = decryptError ? null : readContainerJson(abs, 'KDNA_Core.json', decryptOptions);
517
- patterns = decryptError ? null : readContainerJson(abs, 'KDNA_Patterns.json', decryptOptions);
520
+ if (decryptError) {
521
+ /* skip */
522
+ }
523
+ // v2 container: use readDataMap
524
+ else if (listContainerEntries(abs).includes('payload.kdnab')) {
525
+ const dm = readContainerDataMap(abs, decryptOptions);
526
+ core = dm['KDNA_Core.json'] || null;
527
+ patterns = dm['KDNA_Patterns.json'] || null;
528
+ }
529
+ // v1 container: read individual files
530
+ else {
531
+ core = readContainerJson(abs, 'KDNA_Core.json', decryptOptions);
532
+ patterns = readContainerJson(abs, 'KDNA_Patterns.json', decryptOptions);
533
+ }
518
534
  } catch (e) {
519
535
  if (!encryptedEntries.length) error(`Cannot inspect .kdna asset: ${e.message}`);
520
536
  decryptError = e.message;
package/src/verify.js CHANGED
@@ -62,9 +62,9 @@ function validateManifestFn(manifest) {
62
62
  if (manifest.format && manifest.format !== 'kdna') {
63
63
  errors.push(`kdna.json.format: invalid value "${manifest.format}". Expected "kdna".`);
64
64
  }
65
- if (manifest.format_version && manifest.format_version !== '1.0') {
65
+ if (manifest.format_version && manifest.format_version !== '1.0' && manifest.format_version !== '2.0') {
66
66
  errors.push(
67
- `kdna.json.format_version: invalid value "${manifest.format_version}". Expected "1.0".`,
67
+ `kdna.json.format_version: invalid value "${manifest.format_version}". Expected "1.0" or "2.0".`,
68
68
  );
69
69
  }
70
70
  if (manifest.spec_version && manifest.spec_version !== '1.0-rc') {