@kanonak-protocol/codec 0.1.1 → 0.3.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 +55 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +111 -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 {
|
|
@@ -45,6 +51,55 @@ export interface CodecNode {
|
|
|
45
51
|
$id?: string;
|
|
46
52
|
$extra?: Record<string, unknown>;
|
|
47
53
|
}
|
|
54
|
+
/**
|
|
55
|
+
* The full `$`-envelope as data — what a generated typed model's root carries.
|
|
56
|
+
* `$name` is an embedded value's authored dict-key and is HASH-RELEVANT
|
|
57
|
+
* (serialized into the canonical form); null/absent for subjects.
|
|
58
|
+
*/
|
|
59
|
+
export interface KanonakNode extends CodecNode {
|
|
60
|
+
$name?: string;
|
|
61
|
+
$contentHash?: string;
|
|
62
|
+
$version?: string;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* An object property's value: EXACTLY ONE of a reference to a named resource
|
|
66
|
+
* (`{ $ref: uri }`) or an embedded node (the value inline — derived identity,
|
|
67
|
+
* no `$id`). The choice between the arms is authorial and hash-relevant, so
|
|
68
|
+
* generated models carry it in the type, never infer it.
|
|
69
|
+
*/
|
|
70
|
+
export type Ref<T> = {
|
|
71
|
+
$ref: string;
|
|
72
|
+
} | (T & {
|
|
73
|
+
$type?: string;
|
|
74
|
+
});
|
|
75
|
+
/** Type guard: the reference arm of a {@link Ref}. */
|
|
76
|
+
export declare function isRef<T>(value: Ref<T>): value is {
|
|
77
|
+
$ref: string;
|
|
78
|
+
};
|
|
79
|
+
/** A reference to a named resource by its canonical URI. */
|
|
80
|
+
export declare function ref(uri: string): {
|
|
81
|
+
$ref: string;
|
|
82
|
+
};
|
|
83
|
+
/**
|
|
84
|
+
* A reference to a named resource by the instance itself — resolved through
|
|
85
|
+
* the target's `$id`. The target must already carry its identity; an embedded
|
|
86
|
+
* (id-less) value cannot be referenced.
|
|
87
|
+
*/
|
|
88
|
+
export declare function refTo(target: KanonakNode): {
|
|
89
|
+
$ref: string;
|
|
90
|
+
};
|
|
91
|
+
/**
|
|
92
|
+
* An embedded value, carried inline (derived identity — it must not have a
|
|
93
|
+
* `$id`), optionally with its authored dict-key name (hash-relevant).
|
|
94
|
+
*/
|
|
95
|
+
export declare function embed<T extends KanonakNode>(value: T, name?: string): T;
|
|
96
|
+
/**
|
|
97
|
+
* A typed instance's codec node. Provided for cross-port parity — in
|
|
98
|
+
* TypeScript the typed object already IS the node (the round through
|
|
99
|
+
* {@link serialize} + {@link deserialize} normalizes `$extra` placement and
|
|
100
|
+
* drops undefined, which the codec entry points tolerate anyway).
|
|
101
|
+
*/
|
|
102
|
+
export declare function toNode(typed: KanonakNode, schema: CodecSchema): CodecNode;
|
|
48
103
|
/**
|
|
49
104
|
* The identity of the (data) package being content-addressed — the consumer's
|
|
50
105
|
* package the nodes are assembled into. Used to synthesize the package-wrapper
|
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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onical';
|
|
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
|
+
/** Type guard: the reference arm of a {@link Ref}. */
|
|
26
|
+
export function isRef(value) {
|
|
27
|
+
return typeof value === 'object' && value !== null && '$ref' in value;
|
|
28
|
+
}
|
|
29
|
+
/** A reference to a named resource by its canonical URI. */
|
|
30
|
+
export function ref(uri) {
|
|
31
|
+
if (!uri)
|
|
32
|
+
throw new Error('A reference needs a canonical URI.');
|
|
33
|
+
return { $ref: uri };
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* A reference to a named resource by the instance itself — resolved through
|
|
37
|
+
* the target's `$id`. The target must already carry its identity; an embedded
|
|
38
|
+
* (id-less) value cannot be referenced.
|
|
39
|
+
*/
|
|
40
|
+
export function refTo(target) {
|
|
41
|
+
if (!target.$id) {
|
|
42
|
+
throw new Error('refTo(target) requires a node with a non-empty $id — ' +
|
|
43
|
+
'to carry the value inline instead, use embed(value).');
|
|
44
|
+
}
|
|
45
|
+
return { $ref: target.$id };
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* An embedded value, carried inline (derived identity — it must not have a
|
|
49
|
+
* `$id`), optionally with its authored dict-key name (hash-relevant).
|
|
50
|
+
*/
|
|
51
|
+
export function embed(value, name) {
|
|
52
|
+
if (value.$id) {
|
|
53
|
+
throw new Error('An embedded value must not carry $id — to point at a named resource, use ref/refTo.');
|
|
54
|
+
}
|
|
55
|
+
if (name !== undefined)
|
|
56
|
+
value.$name = name;
|
|
57
|
+
return value;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* A typed instance's codec node. Provided for cross-port parity — in
|
|
61
|
+
* TypeScript the typed object already IS the node (the round through
|
|
62
|
+
* {@link serialize} + {@link deserialize} normalizes `$extra` placement and
|
|
63
|
+
* drops undefined, which the codec entry points tolerate anyway).
|
|
64
|
+
*/
|
|
65
|
+
export function toNode(typed, schema) {
|
|
66
|
+
return deserialize(serialize(typed), schema);
|
|
67
|
+
}
|
|
25
68
|
/** A scalar's raw lexical token — the precise input the canonical entry normalizes. */
|
|
26
69
|
function lexical(value) {
|
|
27
70
|
return typeof value === 'string' ? value : String(value);
|
|
28
71
|
}
|
|
29
72
|
/** Build the `CanonicalInputValue` for one (already array-unwrapped) field value. */
|
|
30
|
-
function valueOf(prop, raw) {
|
|
73
|
+
function valueOf(prop, raw, schema) {
|
|
31
74
|
if (prop.kind === 'object') {
|
|
32
75
|
// A node: a reference (`{ $ref }`) or an embedded resource.
|
|
33
|
-
if (raw && typeof raw === 'object'
|
|
34
|
-
|
|
76
|
+
if (raw && typeof raw === 'object') {
|
|
77
|
+
const map = raw;
|
|
78
|
+
if ('$ref' in map)
|
|
79
|
+
return { ref: String(map.$ref) };
|
|
80
|
+
return embeddedValue(prop, map, schema);
|
|
35
81
|
}
|
|
36
|
-
throw new Error(
|
|
37
|
-
|
|
82
|
+
throw new Error(`Object property ${prop.predicate} expects a reference ({ $ref }) or an ` +
|
|
83
|
+
`embedded node (a map), got ${typeof raw}`);
|
|
38
84
|
}
|
|
39
85
|
// Datatype property — a typed scalar carrying its datatype URI.
|
|
40
86
|
return { lit: lexical(raw), datatype: prop.datatype };
|
|
41
87
|
}
|
|
42
|
-
/**
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
88
|
+
/**
|
|
89
|
+
* Canonicalize an embedded value: a map with no `$id`, an optional `$name` (the
|
|
90
|
+
* authored dict-key — hash-relevant), an optional `$type`, and schema-mapped
|
|
91
|
+
* fields. An explicit `$type` emits a type statement inside the embedded (and is
|
|
92
|
+
* therefore hash-relevant even when it equals the range-derived type); without
|
|
93
|
+
* it, fields are mapped via the containing property's `range` and NO type
|
|
94
|
+
* statement is emitted — range-derived typing is inference only.
|
|
95
|
+
*/
|
|
96
|
+
function embeddedValue(prop, map, schema) {
|
|
97
|
+
if ('$id' in map) {
|
|
98
|
+
throw new Error(`An embedded value under ${prop.predicate} must not carry $id — ` +
|
|
99
|
+
'to point at a named resource, pass a reference ({ $ref }).');
|
|
100
|
+
}
|
|
101
|
+
const explicitType = typeof map.$type === 'string' ? map.$type : undefined;
|
|
102
|
+
const clsUri = explicitType ?? prop.range;
|
|
103
|
+
if (!clsUri) {
|
|
104
|
+
throw new Error(`Cannot map embedded value under ${prop.predicate}: it carries no $type ` +
|
|
105
|
+
'and the property declares no range.');
|
|
106
|
+
}
|
|
107
|
+
const cls = schema.classes[clsUri];
|
|
48
108
|
if (!cls)
|
|
49
|
-
throw new Error(`No schema for type ${
|
|
50
|
-
const statements =
|
|
51
|
-
|
|
52
|
-
{ predicate: schema.typePredicate, value: { ref:
|
|
53
|
-
|
|
54
|
-
|
|
109
|
+
throw new Error(`No schema for embedded type ${clsUri}`);
|
|
110
|
+
const statements = fieldStatements(map, cls, schema);
|
|
111
|
+
if (explicitType) {
|
|
112
|
+
statements.push({ predicate: schema.typePredicate, value: { ref: explicitType } });
|
|
113
|
+
}
|
|
114
|
+
const name = typeof map.$name === 'string' && map.$name.length > 0 ? map.$name : undefined;
|
|
115
|
+
return name !== undefined ? { embed: { name, statements } } : { embed: { statements } };
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* The statements for one node-or-embedded's modeled fields + its `$extra`
|
|
119
|
+
* (everything except the type triple, which subjects always carry and embeddeds
|
|
120
|
+
* carry only when explicitly typed).
|
|
121
|
+
*/
|
|
122
|
+
function fieldStatements(source, cls, schema) {
|
|
123
|
+
const statements = [];
|
|
124
|
+
for (const [key, raw] of Object.entries(source)) {
|
|
55
125
|
if (ENVELOPE_KEYS.has(key))
|
|
56
126
|
continue;
|
|
57
127
|
if (raw === undefined || raw === null)
|
|
@@ -63,18 +133,23 @@ function statementsFor(node, schema) {
|
|
|
63
133
|
continue;
|
|
64
134
|
}
|
|
65
135
|
if (Array.isArray(raw)) {
|
|
136
|
+
// An empty list contributes NO statement — absent and empty are identical
|
|
137
|
+
// at the canonical layer (the wire serialize still preserves the empty list).
|
|
138
|
+
if (raw.length === 0)
|
|
139
|
+
continue;
|
|
66
140
|
statements.push({
|
|
67
141
|
predicate: prop.predicate,
|
|
68
|
-
value: { list: raw.map((item) => valueOf(prop, item)) },
|
|
142
|
+
value: { list: raw.map((item) => valueOf(prop, item, schema)) },
|
|
69
143
|
});
|
|
70
144
|
}
|
|
71
145
|
else {
|
|
72
|
-
statements.push({ predicate: prop.predicate, value: valueOf(prop, raw) });
|
|
146
|
+
statements.push({ predicate: prop.predicate, value: valueOf(prop, raw, schema) });
|
|
73
147
|
}
|
|
74
148
|
}
|
|
75
149
|
// Open-world extras outside the type-model, keyed by their own predicate URI.
|
|
76
|
-
|
|
77
|
-
|
|
150
|
+
const extra = source.$extra;
|
|
151
|
+
if (extra && typeof extra === 'object') {
|
|
152
|
+
for (const [pred, raw] of Object.entries(extra)) {
|
|
78
153
|
if (raw === undefined || raw === null)
|
|
79
154
|
continue;
|
|
80
155
|
statements.push({ predicate: pred, value: { raw: lexical(raw) } });
|
|
@@ -82,6 +157,20 @@ function statementsFor(node, schema) {
|
|
|
82
157
|
}
|
|
83
158
|
return statements;
|
|
84
159
|
}
|
|
160
|
+
/** Build the statements for one subject node: the type triple + its fields. */
|
|
161
|
+
function statementsFor(node, schema) {
|
|
162
|
+
const typeUri = node.$type;
|
|
163
|
+
if (!typeUri)
|
|
164
|
+
throw new Error(`Node ${node.$id ?? '(no $id)'} is missing $type`);
|
|
165
|
+
const cls = schema.classes[typeUri];
|
|
166
|
+
if (!cls)
|
|
167
|
+
throw new Error(`No schema for type ${typeUri}`);
|
|
168
|
+
return [
|
|
169
|
+
// The rdf:type triple every resource carries.
|
|
170
|
+
{ predicate: schema.typePredicate, value: { ref: typeUri } },
|
|
171
|
+
...fieldStatements(node, cls, schema),
|
|
172
|
+
];
|
|
173
|
+
}
|
|
85
174
|
/**
|
|
86
175
|
* Build the `CanonicalInput` for a set of resource nodes plus the synthesized
|
|
87
176
|
* 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;AAmF/F,sDAAsD;AACtD,MAAM,UAAU,KAAK,CAAI,KAAa;IACpC,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,MAAM,IAAI,KAAK,CAAC;AACxE,CAAC;AAED,4DAA4D;AAC5D,MAAM,UAAU,GAAG,CAAC,GAAW;IAC7B,IAAI,CAAC,GAAG;QAAE,MAAM,IAAI,KAAK,CAAC,oCAAoC,CAAC,CAAC;IAChE,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC;AACvB,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,KAAK,CAAC,MAAmB;IACvC,IAAI,CAAC,MAAM,CAAC,GAAG,EAAE,CAAC;QACh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AC,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.3.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",
|