@kanonak-protocol/codec 0.1.1 → 0.2.0
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/README.md +12 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +68 -22
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -48,4 +48,16 @@ const hash = packageContentHash(nodes, Schema, {
|
|
|
48
48
|
`canonicalFormVersion: "1"` — the content-address rules are frozen and evolve
|
|
49
49
|
only by minting a new version (via the underlying canonical-form spec).
|
|
50
50
|
|
|
51
|
+
## Embedded values (0.2.0)
|
|
52
|
+
|
|
53
|
+
An object property's value is a **reference** (`{ $ref: uri }`) or an
|
|
54
|
+
**embedded node**: a map with no `$id`, an optional `$name` (the authored
|
|
55
|
+
dict-key — hash-relevant), an optional `$type`, and schema-mapped fields.
|
|
56
|
+
An explicit `$type` emits a type statement inside the embedded (hash-relevant
|
|
57
|
+
even when it equals the range-derived type); without one, fields are mapped via
|
|
58
|
+
the containing property's `range` and no type statement is emitted. Embedded
|
|
59
|
+
collections are ordered lists — list order is semantic and hashed. An empty
|
|
60
|
+
list contributes no statement (absent and empty are identical at the canonical
|
|
61
|
+
layer). Gated by `vectors/codec-vectors-embedded.json`.
|
|
62
|
+
|
|
51
63
|
Source & issues: https://github.com/kanonak-protocol/runtime
|
package/dist/index.d.ts
CHANGED
|
@@ -7,6 +7,12 @@ export interface CodecProp {
|
|
|
7
7
|
kind: 'datatype' | 'object';
|
|
8
8
|
/** The datatype's canonical URI (carrier source) — present for datatype props. */
|
|
9
9
|
datatype?: string;
|
|
10
|
+
/**
|
|
11
|
+
* The range class's canonical URI — present for object props (0.2.0). Maps an
|
|
12
|
+
* embedded value's fields when the embedded carries no explicit `$type`
|
|
13
|
+
* (range-derived typing: inference only, never materialized as a statement).
|
|
14
|
+
*/
|
|
15
|
+
range?: string;
|
|
10
16
|
}
|
|
11
17
|
/** A class's canonicalization schema: its durable URI + its (flattened) props. */
|
|
12
18
|
export interface CodecClass {
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAsBA,OAAO,KAAK,EAAE,cAAc,EAAgD,MAAM,6BAA6B,CAAC;AAKhH,8EAA8E;AAC9E,MAAM,WAAW,SAAS;IACxB,qEAAqE;IACrE,SAAS,EAAE,MAAM,CAAC;IAClB,uEAAuE;IACvE,IAAI,EAAE,UAAU,GAAG,QAAQ,CAAC;IAC5B,kFAAkF;IAClF,QAAQ,CAAC,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAsBA,OAAO,KAAK,EAAE,cAAc,EAAgD,MAAM,6BAA6B,CAAC;AAKhH,8EAA8E;AAC9E,MAAM,WAAW,SAAS;IACxB,qEAAqE;IACrE,SAAS,EAAE,MAAM,CAAC;IAClB,uEAAuE;IACvE,IAAI,EAAE,UAAU,GAAG,QAAQ,CAAC;IAC5B,kFAAkF;IAClF,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;;;OAIG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,kFAAkF;AAClF,MAAM,WAAW,UAAU;IACzB,oFAAoF;IACpF,OAAO,EAAE,MAAM,CAAC;IAChB,4DAA4D;IAC5D,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;CAClC;AAED;;;;;;GAMG;AACH,MAAM,WAAW,WAAW;IAC1B,gEAAgE;IAChE,aAAa,EAAE,MAAM,CAAC;IACtB,iEAAiE;IACjE,cAAc,EAAE,MAAM,CAAC;IACvB,mEAAmE;IACnE,cAAc,EAAE,MAAM,CAAC;IACvB,8DAA8D;IAC9D,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;CACrC;AAED;;;;;;;GAOG;AACH,MAAM,WAAW,SAAS;IACxB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAClC;AAED;;;;GAIG;AACH,MAAM,WAAW,cAAc;IAC7B,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,MAAM,CAAC;IAChB,oFAAoF;IACpF,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AA2HD;;;;;GAKG;AACH,wBAAgB,mBAAmB,CACjC,KAAK,EAAE,SAAS,EAAE,EAClB,MAAM,EAAE,WAAW,EACnB,GAAG,EAAE,cAAc,GAClB,cAAc,CAiBhB;AAED,oFAAoF;AACpF,wBAAgB,oBAAoB,CAClC,KAAK,EAAE,SAAS,EAAE,EAClB,MAAM,EAAE,WAAW,EACnB,GAAG,EAAE,cAAc,GAClB,MAAM,CAER;AAED,yFAAyF;AACzF,wBAAgB,kBAAkB,CAChC,KAAK,EAAE,SAAS,EAAE,EAClB,MAAM,EAAE,WAAW,EACnB,GAAG,EAAE,cAAc,GAClB,MAAM,CAER;AAED;;;;;;;GAOG;AACH,wBAAgB,SAAS,CAAC,IAAI,EAAE,SAAS,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAYlE;AAED;;;;;;GAMG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,EAAE,WAAW,GAAG,SAAS,CAmBzF"}
|
package/dist/index.js
CHANGED
|
@@ -21,37 +21,64 @@
|
|
|
21
21
|
*/
|
|
22
22
|
import { canonicalForm, canonicalHash } from '@kanonak-protocol/canonical';
|
|
23
23
|
/** Reserved `$`-envelope keys — never emitted as ontology statements. */
|
|
24
|
-
const ENVELOPE_KEYS = new Set(['$type', '$id', '$contentHash', '$version', '$extra']);
|
|
24
|
+
const ENVELOPE_KEYS = new Set(['$type', '$id', '$name', '$contentHash', '$version', '$extra']);
|
|
25
25
|
/** A scalar's raw lexical token — the precise input the canonical entry normalizes. */
|
|
26
26
|
function lexical(value) {
|
|
27
27
|
return typeof value === 'string' ? value : String(value);
|
|
28
28
|
}
|
|
29
29
|
/** Build the `CanonicalInputValue` for one (already array-unwrapped) field value. */
|
|
30
|
-
function valueOf(prop, raw) {
|
|
30
|
+
function valueOf(prop, raw, schema) {
|
|
31
31
|
if (prop.kind === 'object') {
|
|
32
32
|
// A node: a reference (`{ $ref }`) or an embedded resource.
|
|
33
|
-
if (raw && typeof raw === 'object'
|
|
34
|
-
|
|
33
|
+
if (raw && typeof raw === 'object') {
|
|
34
|
+
const map = raw;
|
|
35
|
+
if ('$ref' in map)
|
|
36
|
+
return { ref: String(map.$ref) };
|
|
37
|
+
return embeddedValue(prop, map, schema);
|
|
35
38
|
}
|
|
36
|
-
throw new Error(
|
|
37
|
-
|
|
39
|
+
throw new Error(`Object property ${prop.predicate} expects a reference ({ $ref }) or an ` +
|
|
40
|
+
`embedded node (a map), got ${typeof raw}`);
|
|
38
41
|
}
|
|
39
42
|
// Datatype property — a typed scalar carrying its datatype URI.
|
|
40
43
|
return { lit: lexical(raw), datatype: prop.datatype };
|
|
41
44
|
}
|
|
42
|
-
/**
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
45
|
+
/**
|
|
46
|
+
* Canonicalize an embedded value: a map with no `$id`, an optional `$name` (the
|
|
47
|
+
* authored dict-key — hash-relevant), an optional `$type`, and schema-mapped
|
|
48
|
+
* fields. An explicit `$type` emits a type statement inside the embedded (and is
|
|
49
|
+
* therefore hash-relevant even when it equals the range-derived type); without
|
|
50
|
+
* it, fields are mapped via the containing property's `range` and NO type
|
|
51
|
+
* statement is emitted — range-derived typing is inference only.
|
|
52
|
+
*/
|
|
53
|
+
function embeddedValue(prop, map, schema) {
|
|
54
|
+
if ('$id' in map) {
|
|
55
|
+
throw new Error(`An embedded value under ${prop.predicate} must not carry $id — ` +
|
|
56
|
+
'to point at a named resource, pass a reference ({ $ref }).');
|
|
57
|
+
}
|
|
58
|
+
const explicitType = typeof map.$type === 'string' ? map.$type : undefined;
|
|
59
|
+
const clsUri = explicitType ?? prop.range;
|
|
60
|
+
if (!clsUri) {
|
|
61
|
+
throw new Error(`Cannot map embedded value under ${prop.predicate}: it carries no $type ` +
|
|
62
|
+
'and the property declares no range.');
|
|
63
|
+
}
|
|
64
|
+
const cls = schema.classes[clsUri];
|
|
48
65
|
if (!cls)
|
|
49
|
-
throw new Error(`No schema for type ${
|
|
50
|
-
const statements =
|
|
51
|
-
|
|
52
|
-
{ predicate: schema.typePredicate, value: { ref:
|
|
53
|
-
|
|
54
|
-
|
|
66
|
+
throw new Error(`No schema for embedded type ${clsUri}`);
|
|
67
|
+
const statements = fieldStatements(map, cls, schema);
|
|
68
|
+
if (explicitType) {
|
|
69
|
+
statements.push({ predicate: schema.typePredicate, value: { ref: explicitType } });
|
|
70
|
+
}
|
|
71
|
+
const name = typeof map.$name === 'string' && map.$name.length > 0 ? map.$name : undefined;
|
|
72
|
+
return name !== undefined ? { embed: { name, statements } } : { embed: { statements } };
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* The statements for one node-or-embedded's modeled fields + its `$extra`
|
|
76
|
+
* (everything except the type triple, which subjects always carry and embeddeds
|
|
77
|
+
* carry only when explicitly typed).
|
|
78
|
+
*/
|
|
79
|
+
function fieldStatements(source, cls, schema) {
|
|
80
|
+
const statements = [];
|
|
81
|
+
for (const [key, raw] of Object.entries(source)) {
|
|
55
82
|
if (ENVELOPE_KEYS.has(key))
|
|
56
83
|
continue;
|
|
57
84
|
if (raw === undefined || raw === null)
|
|
@@ -63,18 +90,23 @@ function statementsFor(node, schema) {
|
|
|
63
90
|
continue;
|
|
64
91
|
}
|
|
65
92
|
if (Array.isArray(raw)) {
|
|
93
|
+
// An empty list contributes NO statement — absent and empty are identical
|
|
94
|
+
// at the canonical layer (the wire serialize still preserves the empty list).
|
|
95
|
+
if (raw.length === 0)
|
|
96
|
+
continue;
|
|
66
97
|
statements.push({
|
|
67
98
|
predicate: prop.predicate,
|
|
68
|
-
value: { list: raw.map((item) => valueOf(prop, item)) },
|
|
99
|
+
value: { list: raw.map((item) => valueOf(prop, item, schema)) },
|
|
69
100
|
});
|
|
70
101
|
}
|
|
71
102
|
else {
|
|
72
|
-
statements.push({ predicate: prop.predicate, value: valueOf(prop, raw) });
|
|
103
|
+
statements.push({ predicate: prop.predicate, value: valueOf(prop, raw, schema) });
|
|
73
104
|
}
|
|
74
105
|
}
|
|
75
106
|
// Open-world extras outside the type-model, keyed by their own predicate URI.
|
|
76
|
-
|
|
77
|
-
|
|
107
|
+
const extra = source.$extra;
|
|
108
|
+
if (extra && typeof extra === 'object') {
|
|
109
|
+
for (const [pred, raw] of Object.entries(extra)) {
|
|
78
110
|
if (raw === undefined || raw === null)
|
|
79
111
|
continue;
|
|
80
112
|
statements.push({ predicate: pred, value: { raw: lexical(raw) } });
|
|
@@ -82,6 +114,20 @@ function statementsFor(node, schema) {
|
|
|
82
114
|
}
|
|
83
115
|
return statements;
|
|
84
116
|
}
|
|
117
|
+
/** Build the statements for one subject node: the type triple + its fields. */
|
|
118
|
+
function statementsFor(node, schema) {
|
|
119
|
+
const typeUri = node.$type;
|
|
120
|
+
if (!typeUri)
|
|
121
|
+
throw new Error(`Node ${node.$id ?? '(no $id)'} is missing $type`);
|
|
122
|
+
const cls = schema.classes[typeUri];
|
|
123
|
+
if (!cls)
|
|
124
|
+
throw new Error(`No schema for type ${typeUri}`);
|
|
125
|
+
return [
|
|
126
|
+
// The rdf:type triple every resource carries.
|
|
127
|
+
{ predicate: schema.typePredicate, value: { ref: typeUri } },
|
|
128
|
+
...fieldStatements(node, cls, schema),
|
|
129
|
+
];
|
|
130
|
+
}
|
|
85
131
|
/**
|
|
86
132
|
* Build the `CanonicalInput` for a set of resource nodes plus the synthesized
|
|
87
133
|
* package-wrapper subject — exactly the subject set `kanonak hash` produces for
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAG3E,yEAAyE;AACzE,MAAM,aAAa,GAAG,IAAI,GAAG,CAAC,CAAC,OAAO,EAAE,KAAK,EAAE,cAAc,EAAE,UAAU,EAAE,QAAQ,CAAC,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAG3E,yEAAyE;AACzE,MAAM,aAAa,GAAG,IAAI,GAAG,CAAC,CAAC,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,cAAc,EAAE,UAAU,EAAE,QAAQ,CAAC,CAAC,CAAC;AAuE/F,uFAAuF;AACvF,SAAS,OAAO,CAAC,KAAc;IAC7B,OAAO,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;AAC3D,CAAC;AAED,qFAAqF;AACrF,SAAS,OAAO,CAAC,IAAe,EAAE,GAAY,EAAE,MAAmB;IACjE,IAAI,IAAI,CAAC,IAAI,KAAK,QAAQ,EAAE,CAAC;QAC3B,4DAA4D;QAC5D,IAAI,GAAG,IAAI,OAAO,GAAG,KAAK,QAAQ,EAAE,CAAC;YACnC,MAAM,GAAG,GAAG,GAA8B,CAAC;YAC3C,IAAI,MAAM,IAAI,GAAG;gBAAE,OAAO,EAAE,GAAG,EAAE,MAAM,CAAC,GAAG,CAAC,I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AI,CAAC,KAAK,CAAC;IAC3B,IAAI,OAAO,OAAO,KAAK,QAAQ;QAAE,MAAM,IAAI,KAAK,CAAC,0CAA0C,CAAC,CAAC;IAC7F,MAAM,GAAG,GAAG,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;IACpC,IAAI,CAAC,GAAG;QAAE,MAAM,IAAI,KAAK,CAAC,0CAA0C,OAAO,EAAE,CAAC,CAAC;IAE/E,MAAM,IAAI,GAAc,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC;IAC3C,MAAM,MAAM,GAAG,IAA+B,CAAC;IAC/C,IAAI,KAA0C,CAAC;IAC/C,KAAK,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC;QAC1C,IAAI,CAAC,KAAK,OAAO;YAAE,SAAS;QAC5B,IAAI,CAAC,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,GAAG,CAAC,KAAK,EAAE,CAAC;YACxC,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;QAChB,CAAC;aAAM,CAAC;YACN,CAAC,KAAK,KAAK,EAAE,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;QACxB,CAAC;IACH,CAAC;IACD,IAAI,KAAK;QAAE,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;IAC/B,OAAO,IAAI,CAAC;AACd,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kanonak-protocol/codec",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "The generic Kanonak codec runtime: builds the canonical input model from typed nodes + an embedded schema, content-addresses it via @kanonak-protocol/canonical, and serializes/deserializes the normalized-JSON wire form. Referenced by generated typed SDKs; its only dependency is the lightweight canonical-form library.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"homepage": "https://kanonak.org",
|