@aikdna/kdna-core 0.12.1 → 0.12.2

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-core",
3
- "version": "0.12.1",
3
+ "version": "0.12.2",
4
4
  "description": "KDNA core library — load, validate, lint, and render KDNA domain judgment assets. Supports KDNA Container format (payload.kdnab via CBOR).",
5
5
  "type": "commonjs",
6
6
  "main": "src/index.js",
@@ -71,7 +71,12 @@
71
71
  "additionalProperties": true,
72
72
  "properties": {
73
73
  "name": { "type": "string", "minLength": 1 },
74
- "id": { "type": "string" }
74
+ "id": { "type": "string" },
75
+ "creator_type": {
76
+ "type": "string",
77
+ "enum": ["human", "agent", "tool", "organization"],
78
+ "description": "Kind of creator identity represented by this record."
79
+ }
75
80
  },
76
81
  "description": "Who produced the asset. Provenance only; not a trust claim."
77
82
  },
package/src/v1/index.js CHANGED
@@ -1374,6 +1374,12 @@ function loadV1(inputPath, opts = {}) {
1374
1374
  return loadAuthorized(inputPath, opts);
1375
1375
  }
1376
1376
 
1377
+ function normalizeTextList(value) {
1378
+ if (Array.isArray(value)) return value.filter((item) => typeof item === 'string' && item.trim()).map((item) => item.trim());
1379
+ if (typeof value === 'string' && value.trim()) return [value.trim()];
1380
+ return [];
1381
+ }
1382
+
1377
1383
  function normalizeCompactAxiom(axiom) {
1378
1384
  if (typeof axiom === 'string') {
1379
1385
  return {
@@ -1393,8 +1399,8 @@ function normalizeCompactAxiom(axiom) {
1393
1399
  id: axiom.id || null,
1394
1400
  statement,
1395
1401
  one_sentence: axiom.one_sentence || statement,
1396
- applies_when: Array.isArray(axiom.applies_when) ? axiom.applies_when : [],
1397
- does_not_apply_when: Array.isArray(axiom.does_not_apply_when) ? axiom.does_not_apply_when : [],
1402
+ applies_when: normalizeTextList(axiom.applies_when),
1403
+ does_not_apply_when: normalizeTextList(axiom.does_not_apply_when),
1398
1404
  failure_risk: axiom.failure_risk || null,
1399
1405
  };
1400
1406
  }