@aikdna/kdna-cli 0.20.3 → 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 +1 -1
- package/src/cmds/domain.js +19 -3
package/package.json
CHANGED
package/src/cmds/domain.js
CHANGED
|
@@ -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 {
|
|
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
|
-
|
|
517
|
-
|
|
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;
|