@silvermoon-work/ipfs-payload 0.0.0-stage → 0.1.0-rc.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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 preset-pnpm-monorepo contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,103 @@
1
- # Temporary Holding Version
1
+ # @silvermoon-work/ipfs-payload
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ Pure typed references, self-contained JSON payloads and canonical DAG-CBOR.
4
+ No Store, Task SDK, Engine, file-tree dependency, network, pin or content access.
5
+
6
+ ```ts
7
+ import { Type, type Static } from "@sinclair/typebox";
8
+ import {
9
+ ContentRef, ContentRefSchema, encodePayload, decodePayload,
10
+ encodePayloadBlock, decodePayloadBlock,
11
+ } from "@silvermoon-work/ipfs-payload";
12
+
13
+ const schema = Type.Object({
14
+ document: ContentRefSchema(),
15
+ label: Type.String(),
16
+ });
17
+ const parameters: Static<typeof schema> = {
18
+ document: ContentRef.fromCID(targetCid),
19
+ label: targetCid.toString(), // ordinary business text
20
+ };
21
+ const json = encodePayload(schema, parameters);
22
+ // { data: { document: "...", label: "..." }, cidPaths: ['$["document"]'] }
23
+ const restored = decodePayload(json, schema);
24
+ restored.document.cid; // native CID; no read methods or path
25
+ const block = await encodePayloadBlock(json, schema);
26
+ const roundTrip = await decodePayloadBlock(block.bytes, schema, { cid: block.cid });
27
+ ```
28
+
29
+ `ContentRefSchema()` is a TypeBox extension with `Static<> = ContentRef`, a
30
+ registered author-side TypeBox validator, and serializable
31
+ `{ type: "string", "x-ipfs-content-ref": true }` semantics. The package's codecs
32
+ validate this keyword and the complete business schema; an unrelated JSON
33
+ Schema validator ignoring the keyword is **not** sufficient. Current Task
34
+ Builder/Engine protocol integration is a later phase, not added by this package.
35
+ Author fields require `ContentRef.fromCID(CID | string)`, not untyped strings,
36
+ lookalike `{ cid }` objects or bare native CIDs. References retain immutable
37
+ identity only; reading an exposed CID cannot mutate the original identity.
38
+
39
+ ## Conversions and validation
40
+
41
+ - `encodePayload(schema, author, options?)` produces `IpfsPayload<JsonOf<T>>`.
42
+ - `validatePayload(unknown, schema?, options?)` validates and snapshots the
43
+ exact `{ data, cidPaths }` envelope.
44
+ - `decodePayload(payload, schema?, options?)` restores `ContentRef` only at
45
+ marked positions. Without a schema it validates the self-contained descriptor,
46
+ not an absent business contract; admission must supply the contract.
47
+ - `toDagPayload` / `fromDagPayload` convert the same envelope between JSON and
48
+ logical DAG values. Marked fields become genuine `multiformats` CID links.
49
+ Every actual link must agree with the metadata, in both directions.
50
+ - `encodePayloadBlock` returns `{ cid, bytes }` using DAG-CBOR and SHA-256.
51
+ `decodePayloadBlock` rejects noncanonical encodings and, when supplied,
52
+ verifies `options.cid`. Neither function stores anything.
53
+
54
+ All conversions snapshot without invoking getters, `toJSON` or prototype
55
+ properties. Ordinary strings, `{ cid: "..." }`, `{ "/": "..." }` and even
56
+ CID-shaped business objects stay ordinary. `./dag-cbor` exposes `encodeDagCbor`
57
+ plus the standard codec `code`/`decode` for generic structured blocks: it reuses
58
+ the standard DAG-CBOR encoder options with identity-only CID detection, rather
59
+ than its permissive object-shape detection. `asNativeCID` rebases native instances
60
+ from separately loaded modern multiformats modules using data descriptors, never
61
+ getters or plain JSON object shapes. This subpath loads no TypeBox/AJV.
62
+
63
+ Finite JSON primitives, objects, arrays and tuples are supported. Sparse arrays,
64
+ undefined, custom prototypes, cycles, nonfinite numbers, negative zero, unsafe
65
+ integers and malformed Unicode fail rather than silently changing on round trip.
66
+ References may contain syntactically valid CIDs; host codec/hash allowlists and
67
+ target integrity/availability are separate Store responsibilities.
68
+
69
+ ## Contracts and bounded paths
70
+
71
+ Supported schemas are the JSON-compatible TypeBox primitives, literals/enums,
72
+ objects, optional properties, homogeneous arrays, tuples, and unions. Common
73
+ JSON Schema value constraints are enforced by AJV in strict mode. Reference
74
+ unions require uniquely distinguishing **required literal object properties**;
75
+ direct `ContentRef | string`, optional/duplicate discriminators and ambiguous
76
+ branches fail. Reference-bearing non-object unions (including nullable direct
77
+ refs) are intentionally unsupported; use a tagged object union. `$ref`, recursive
78
+ schemas, transforms, intersections, patternProperties, formats and schema-valued
79
+ tuple additionalItems are rejected explicitly, not ignored.
80
+
81
+ Paths are relative to `data`. `parseCidPath` accepts only `$`, bracket properties,
82
+ nonnegative fixed array indices, array `[*]`, and array literal filters such as
83
+ `$["items"][?@["kind"] == "reference"]["value"]`. Quoted strings may use single
84
+ or double quotes with JSON escapes. No recursive descent, slices, functions,
85
+ logical expressions, evaluation or arbitrary query scripts are supported.
86
+
87
+ Encoding derives paths from the contract **and actual discriminator branches**.
88
+ It uses wildcards/filters only when they match no extra positions, otherwise
89
+ falls back to concrete indices. Re-encoding recomposed results recalculates
90
+ positions. Validation compares the exact selected location sets; missing, extra,
91
+ duplicate or overlapping matches fail. Optional/empty paths may match nothing;
92
+ with a contract such zero-match paths must be schema-declared.
93
+
94
+ `options.limits` may bound path count (default 1,024), each path's length (4,096),
95
+ structure/path depth (64), cumulative visited/evaluated nodes (100,000), and
96
+ JSON/encoded block bytes (2 MiB). Schema inspection and repeated path evaluation
97
+ consume the same operation budget. Canonical encoding fixes CBOR map ordering,
98
+ numbers and CID tags, not the semantic equivalence of differently written
99
+ but valid path expressions. Fixed byte/CID vectors are in `test/payload.test.ts`.
100
+
101
+ Encoding does not prove targets exist; pinning does not commit a business fact.
102
+ SQLite remains the authority. Finalized RunHistory assembly, retention intent
103
+ management and Task protocol switching are outside this foundation package.
@@ -0,0 +1,9 @@
1
+ import { CID } from "multiformats/cid";
2
+ /** Immutable identity only; no reads, paths, credentials or host authority. */
3
+ export declare class ContentRef {
4
+ #private;
5
+ private constructor();
6
+ static fromCID(value: CID | string): ContentRef;
7
+ get cid(): CID;
8
+ }
9
+ //# sourceMappingURL=content-ref.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"content-ref.d.ts","sourceRoot":"","sources":["../src/content-ref.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,kBAAkB,CAAC;AAEvC,+EAA+E;AAC/E,qBAAa,UAAU;;IAErB,OAAO;IAIP,MAAM,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,GAAG,MAAM,GAAG,UAAU;IAK/C,IAAI,GAAG,IAAI,GAAG,CAEb;CACF"}
@@ -0,0 +1,19 @@
1
+ import { CID } from "multiformats/cid";
2
+ /** Immutable identity only; no reads, paths, credentials or host authority. */
3
+ export class ContentRef {
4
+ #value;
5
+ constructor(cid) {
6
+ this.#value = cid.toString();
7
+ Object.freeze(this);
8
+ }
9
+ static fromCID(value) {
10
+ const cid = typeof value === "string" ? CID.parse(value) : CID.asCID(value);
11
+ if (!cid)
12
+ throw new Error("Expected a CID.");
13
+ return new ContentRef(CID.decode(cid.bytes));
14
+ }
15
+ get cid() {
16
+ return CID.parse(this.#value);
17
+ }
18
+ }
19
+ //# sourceMappingURL=content-ref.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"content-ref.js","sourceRoot":"","sources":["../src/content-ref.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,kBAAkB,CAAC;AAEvC,+EAA+E;AAC/E,MAAM,OAAO,UAAU;IACZ,MAAM,CAAS;IACxB,YAAoB,GAAQ;QAC1B,IAAI,CAAC,MAAM,GAAG,GAAG,CAAC,QAAQ,EAAE,CAAC;QAC7B,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IACtB,CAAC;IACD,MAAM,CAAC,OAAO,CAAC,KAAmB;QAChC,MAAM,GAAG,GAAG,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;QAC5E,IAAI,CAAC,GAAG;YAAE,MAAM,IAAI,KAAK,CAAC,iBAAiB,CAAC,CAAC;QAC7C,OAAO,IAAI,UAAU,CAAC,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC;IAC/C,CAAC;IACD,IAAI,GAAG;QACL,OAAO,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IAChC,CAAC;CACF"}
@@ -0,0 +1,9 @@
1
+ import { Ajv2020 } from "ajv/dist/2020.js";
2
+ import { Budget, type JsonValue } from "./value.js";
3
+ export declare function addContentRefKeyword(ajv: Ajv2020): void;
4
+ /** Locate ContentRef positions using the Task JSON Schema dialect; never the P1 keyword allowlist. */
5
+ export declare function inspectTaskSchema(input: unknown, data: JsonValue, budget: Budget, validate?: (data: JsonValue) => void): {
6
+ expected: Map<string, string>;
7
+ rules: Set<string>;
8
+ };
9
+ //# sourceMappingURL=contract.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"contract.d.ts","sourceRoot":"","sources":["../src/contract.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAC3C,OAAO,EAAE,MAAM,EAA0B,KAAK,SAAS,EAAE,MAAM,YAAY,CAAC;AAkC5E,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,OAAO,GAAG,IAAI,CAEvD;AAmCD,sGAAsG;AACtG,wBAAgB,iBAAiB,CAC/B,KAAK,EAAE,OAAO,EACd,IAAI,EAAE,SAAS,EACf,MAAM,EAAE,MAAM,EACd,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,SAAS,KAAK,IAAI;;;EAsQrC"}
@@ -0,0 +1,280 @@
1
+ import { Ajv2020 } from "ajv/dist/2020.js";
2
+ import { Budget, propertyPath, snapshot } from "./value.js";
3
+ const metadata = new Set([
4
+ "$schema",
5
+ "$id",
6
+ "$anchor",
7
+ "$comment",
8
+ "title",
9
+ "description",
10
+ "default",
11
+ "examples",
12
+ "readOnly",
13
+ "writeOnly",
14
+ "deprecated",
15
+ ]);
16
+ export function addContentRefKeyword(ajv) {
17
+ ajv.addKeyword({ keyword: "x-ipfs-content-ref", schemaType: "boolean", errors: false });
18
+ }
19
+ function record(value) {
20
+ return !!value && typeof value === "object" && !Array.isArray(value);
21
+ }
22
+ function pointer(root, ref, budget, depth) {
23
+ budget.visit(depth);
24
+ if (typeof ref !== "string" || !ref.startsWith("#") || (ref !== "#" && !ref.startsWith("#/")))
25
+ throw new Error("Only local schema references are supported.");
26
+ if (ref === "#")
27
+ return root;
28
+ let node = root;
29
+ for (const part of ref.slice(2).split("/")) {
30
+ const key = part.replaceAll("~1", "/").replaceAll("~0", "~");
31
+ if (!node || typeof node !== "object" || !Object.hasOwn(node, key))
32
+ throw new Error("Unresolved local schema reference.");
33
+ node = node[key];
34
+ }
35
+ if (typeof node === "boolean")
36
+ return node;
37
+ if (!record(node))
38
+ throw new Error("Reference target is not a schema location.");
39
+ return node;
40
+ }
41
+ function extras(schema) {
42
+ const rest = {};
43
+ for (const [key, value] of Object.entries(schema))
44
+ if (key !== "$ref" && !metadata.has(key))
45
+ Object.defineProperty(rest, key, { value, enumerable: true });
46
+ return rest;
47
+ }
48
+ function isRef(schema) {
49
+ return record(schema) && schema["x-ipfs-content-ref"] === true;
50
+ }
51
+ /** Locate ContentRef positions using the Task JSON Schema dialect; never the P1 keyword allowlist. */
52
+ export function inspectTaskSchema(input, data, budget, validate) {
53
+ const root = snapshot(input, budget, undefined, true);
54
+ budget.bytes(root);
55
+ if (validate)
56
+ validate(data);
57
+ else {
58
+ const ajv = new Ajv2020({
59
+ strict: true,
60
+ strictTuples: false,
61
+ allowUnionTypes: true,
62
+ validateFormats: false,
63
+ ownProperties: true,
64
+ allErrors: false,
65
+ });
66
+ addContentRefKeyword(ajv);
67
+ if (!ajv.validateSchema(root))
68
+ throw new Error("Invalid payload schema.");
69
+ const check = ajv.compile(root);
70
+ if (!check(data))
71
+ throw new Error(`Payload does not match schema: ${ajv.errorsText(check.errors)}.`);
72
+ }
73
+ const cache = new WeakMap();
74
+ const resolve = (schema, depth, trail) => {
75
+ budget.visit(depth);
76
+ if (!record(schema) || schema.$ref === undefined)
77
+ return schema;
78
+ const cached = cache.get(schema);
79
+ if (cached)
80
+ return cached;
81
+ if (trail.has(schema))
82
+ throw new Error("Cyclic schema reference.");
83
+ const target = resolve(pointer(root, schema.$ref, budget, depth + 1), depth + 1, new Set(trail).add(schema));
84
+ const rest = extras(schema);
85
+ const combined = Object.keys(rest).length
86
+ ? record(target)
87
+ ? { allOf: [target, rest] }
88
+ : rest
89
+ : target;
90
+ cache.set(schema, combined);
91
+ return combined;
92
+ };
93
+ const checkRef = (schema) => {
94
+ if (!isRef(schema))
95
+ return false;
96
+ if (schema.type !== "string" ||
97
+ Object.keys(schema).some((key) => !metadata.has(key) &&
98
+ !["type", "x-ipfs-content-ref", "$ref", "$id", "$anchor"].includes(key)))
99
+ throw new Error("Invalid ContentRef schema.");
100
+ return true;
101
+ };
102
+ const unionOf = (schema) => schema.anyOf ?? schema.oneOf;
103
+ const discriminators = new Map();
104
+ const references = new Map();
105
+ const inspect = (schema, depth, trail) => {
106
+ budget.visit(depth);
107
+ schema = resolve(schema, depth, trail);
108
+ if (typeof schema === "boolean") {
109
+ references.set(schema, false);
110
+ return false;
111
+ }
112
+ if (checkRef(schema)) {
113
+ references.set(schema, true);
114
+ return true;
115
+ }
116
+ let hasRefs = false;
117
+ if (schema.allOf) {
118
+ let refNodes = 0;
119
+ for (const child of schema.allOf) {
120
+ const resolved = resolve(child, depth + 1, trail);
121
+ if (checkRef(resolved))
122
+ refNodes++;
123
+ hasRefs = inspect(child, depth + 1, trail) || hasRefs;
124
+ }
125
+ if (refNodes &&
126
+ schema.allOf.some((child) => {
127
+ const resolved = resolve(child, depth + 1, trail);
128
+ return (record(resolved) &&
129
+ !checkRef(resolved) &&
130
+ !!(resolved.properties || resolved.items || resolved.prefixItems || unionOf(resolved)));
131
+ }))
132
+ throw new Error("Reference unions require a unique required literal discriminator.");
133
+ }
134
+ for (const child of Object.values(schema.properties ?? {}))
135
+ hasRefs = inspect(child, depth + 1, trail) || hasRefs;
136
+ if (record(schema.additionalProperties))
137
+ hasRefs = inspect(schema.additionalProperties, depth + 1, trail) || hasRefs;
138
+ const prefix = schema.prefixItems ?? (Array.isArray(schema.items) ? schema.items : undefined);
139
+ if (prefix)
140
+ for (const child of prefix)
141
+ hasRefs = inspect(child, depth + 1, trail) || hasRefs;
142
+ if (schema.items && !Array.isArray(schema.items))
143
+ hasRefs = inspect(schema.items, depth + 1, trail) || hasRefs;
144
+ if (record(schema.additionalItems))
145
+ throw new Error("Schema-valued additionalItems are unsupported; use a homogeneous array.");
146
+ const options = unionOf(schema);
147
+ if (options) {
148
+ let unionRefs = false;
149
+ for (const branch of options)
150
+ unionRefs = inspect(branch, depth + 1, trail) || unionRefs;
151
+ if (unionRefs) {
152
+ const first = options[0];
153
+ const key = record(first) &&
154
+ Object.keys(first.properties ?? {}).find((key) => {
155
+ const literals = new Set();
156
+ for (const branch of options) {
157
+ const resolved = resolve(branch, depth + 1, trail);
158
+ const property = record(resolved) ? resolved.properties?.[key] : undefined;
159
+ const field = property ? resolve(property, depth + 2, trail) : undefined;
160
+ if (!record(resolved) ||
161
+ !resolved.required?.includes(key) ||
162
+ !record(field) ||
163
+ !Object.hasOwn(field, "const") ||
164
+ (field.const !== null && typeof field.const === "object") ||
165
+ field["x-ipfs-content-ref"] ||
166
+ unionOf(resolved))
167
+ return false;
168
+ const literal = JSON.stringify(field.const);
169
+ if (literals.has(literal))
170
+ return false;
171
+ literals.add(literal);
172
+ }
173
+ return true;
174
+ });
175
+ if (!key)
176
+ throw new Error("Reference unions require a unique required literal discriminator.");
177
+ discriminators.set(schema, key);
178
+ }
179
+ hasRefs = hasRefs || unionRefs;
180
+ }
181
+ if (options &&
182
+ (schema.properties || schema.items || schema.prefixItems || schema.additionalProperties))
183
+ throw new Error("Reference traversal does not support union structural siblings.");
184
+ references.set(schema, hasRefs);
185
+ return hasRefs;
186
+ };
187
+ inspect(root, 0, new Set());
188
+ const expected = new Map();
189
+ const rules = new Set();
190
+ const selected = (schema, value) => {
191
+ const key = discriminators.get(schema);
192
+ const options = unionOf(schema);
193
+ if (!value || typeof value !== "object" || Array.isArray(value) || !Object.hasOwn(value, key))
194
+ throw new Error("Missing payload discriminator.");
195
+ const branches = options.filter((branch) => {
196
+ const resolved = resolve(branch, 0, new Set());
197
+ const property = record(resolved) ? resolved.properties?.[key] : undefined;
198
+ const field = property ? resolve(property, 0, new Set()) : undefined;
199
+ return record(field) && field.const === value[key];
200
+ });
201
+ if (branches.length !== 1)
202
+ throw new Error("Invalid or ambiguous payload discriminator.");
203
+ return resolve(branches[0], 0, new Set());
204
+ };
205
+ const filter = (path, key, literal) => `${path}[?@[${JSON.stringify(key)}] == ${JSON.stringify(literal)}]`;
206
+ const constant = (schema, key) => {
207
+ const property = record(schema) ? schema.properties?.[key] : undefined;
208
+ const field = property ? resolve(property, 0, new Set()) : undefined;
209
+ return record(field) ? field.const : undefined;
210
+ };
211
+ const walk = (schema, value, path, rule, depth) => {
212
+ budget.visit(depth);
213
+ schema = resolve(schema, depth, new Set());
214
+ if (typeof schema === "boolean" || !references.get(schema))
215
+ return;
216
+ if (checkRef(schema)) {
217
+ rules.add(rule);
218
+ if (value !== undefined)
219
+ expected.set(path, rule);
220
+ return;
221
+ }
222
+ if (schema.allOf) {
223
+ for (const child of schema.allOf)
224
+ walk(child, value, path, rule, depth + 1);
225
+ return;
226
+ }
227
+ const options = unionOf(schema);
228
+ if (options) {
229
+ const branch = value === undefined ? undefined : selected(schema, value);
230
+ for (const option of options) {
231
+ const resolved = resolve(option, depth + 1, new Set());
232
+ walk(resolved, resolved === branch ? value : undefined, path, rule, depth + 1);
233
+ }
234
+ return;
235
+ }
236
+ if (schema.properties)
237
+ for (const [key, child] of Object.entries(schema.properties))
238
+ walk(child, value && typeof value === "object" && !Array.isArray(value) && Object.hasOwn(value, key)
239
+ ? value[key]
240
+ : undefined, propertyPath(path, key), propertyPath(rule, key), depth + 1);
241
+ if (record(schema.additionalProperties) &&
242
+ value &&
243
+ typeof value === "object" &&
244
+ !Array.isArray(value))
245
+ for (const [key, item] of Object.entries(value))
246
+ if (!Object.hasOwn(schema.properties ?? {}, key))
247
+ walk(schema.additionalProperties, item, propertyPath(path, key), propertyPath(rule, key), depth + 1);
248
+ const prefix = schema.prefixItems ?? (Array.isArray(schema.items) ? schema.items : undefined);
249
+ if (prefix)
250
+ prefix.forEach((item, i) => {
251
+ walk(item, Array.isArray(value) ? value[i] : undefined, `${path}[${i}]`, `${rule}[${i}]`, depth + 1);
252
+ });
253
+ const rest = schema.items && !Array.isArray(schema.items)
254
+ ? resolve(schema.items, depth + 1, new Set())
255
+ : undefined;
256
+ if (rest !== undefined) {
257
+ const key = record(rest) ? discriminators.get(rest) : undefined;
258
+ if (key && record(rest) && unionOf(rest)) {
259
+ for (const branch of unionOf(rest)) {
260
+ const resolved = resolve(branch, depth + 2, new Set());
261
+ walk(resolved, undefined, path, filter(rule, key, constant(resolved, key)), depth + 1);
262
+ }
263
+ }
264
+ else
265
+ walk(rest, undefined, path, `${rule}[*]`, depth + 1);
266
+ if (Array.isArray(value))
267
+ value.forEach((child, i) => {
268
+ if (prefix && i < prefix.length)
269
+ return;
270
+ const branch = key && record(rest) ? selected(rest, child) : rest;
271
+ walk(branch, child, `${path}[${i}]`, key ? filter(rule, key, constant(branch, key)) : `${rule}[*]`, depth + 1);
272
+ });
273
+ }
274
+ };
275
+ walk(root, data, "$", "$", 0);
276
+ if (rules.size > budget.limits.maxPaths)
277
+ throw new Error("Schema reference path capacity exceeded.");
278
+ return { expected, rules };
279
+ }
280
+ //# sourceMappingURL=contract.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"contract.js","sourceRoot":"","sources":["../src/contract.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAC3C,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,QAAQ,EAAkB,MAAM,YAAY,CAAC;AAoB5E,MAAM,QAAQ,GAAG,IAAI,GAAG,CAAC;IACvB,SAAS;IACT,KAAK;IACL,SAAS;IACT,UAAU;IACV,OAAO;IACP,aAAa;IACb,SAAS;IACT,UAAU;IACV,UAAU;IACV,WAAW;IACX,YAAY;CACb,CAAC,CAAC;AAEH,MAAM,UAAU,oBAAoB,CAAC,GAAY;IAC/C,GAAG,CAAC,UAAU,CAAC,EAAE,OAAO,EAAE,oBAAoB,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,CAAC;AAC1F,CAAC;AAED,SAAS,MAAM,CAAC,KAAc;IAC5B,OAAO,CAAC,CAAC,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;AACvE,CAAC;AAED,SAAS,OAA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CAAC,CAAC,CAAC,QAAQ,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;oBAClE,IAAI,CACF,MAAM,EACN,KAAK,EACL,GAAG,IAAI,IAAI,CAAC,GAAG,EACf,GAAG,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,EAAE,GAAG,EAAE,QAAQ,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,IAAI,KAAK,EAC7D,KAAK,GAAG,CAAC,CACV,CAAC;gBACJ,CAAC,CAAC,CAAC;QACP,CAAC;IACH,CAAC,CAAC;IACF,IAAI,CAAC,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,CAAC,CAAC;IAC9B,IAAI,KAAK,CAAC,IAAI,GAAG,MAAM,CAAC,MAAM,CAAC,QAAQ;QACrC,MAAM,IAAI,KAAK,CAAC,0CAA0C,CAAC,CAAC;IAC9D,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC;AAC7B,CAAC"}
@@ -0,0 +1,7 @@
1
+ import { CID } from "multiformats/cid";
2
+ export { code, decode } from "@ipld/dag-cbor";
3
+ /** Rebase separately loaded multiformats instances without consulting object getters. */
4
+ export declare function asNativeCID(value: unknown): CID | null;
5
+ /** Reuse the canonical codec, but never interpret a plain business object as a CID. */
6
+ export declare function encodeDagCbor(value: unknown): Uint8Array;
7
+ //# sourceMappingURL=dag-cbor.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dag-cbor.d.ts","sourceRoot":"","sources":["../src/dag-cbor.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,GAAG,EAAE,MAAM,kBAAkB,CAAC;AAEvC,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAE9C,yFAAyF;AACzF,wBAAgB,WAAW,CAAC,KAAK,EAAE,OAAO,GAAG,GAAG,GAAG,IAAI,CAYtD;AAED,uFAAuF;AACvF,wBAAgB,aAAa,CAAC,KAAK,EAAE,OAAO,GAAG,UAAU,CAWxD"}
@@ -0,0 +1,36 @@
1
+ import { encodeOptions } from "@ipld/dag-cbor";
2
+ import { encode } from "cborg";
3
+ import { CID } from "multiformats/cid";
4
+ export { code, decode } from "@ipld/dag-cbor";
5
+ /** Rebase separately loaded multiformats instances without consulting object getters. */
6
+ export function asNativeCID(value) {
7
+ if (value instanceof CID)
8
+ return value;
9
+ if (!value || typeof value !== "object")
10
+ return null;
11
+ const prototype = Object.getPrototypeOf(value);
12
+ if (prototype === Object.prototype || prototype === null)
13
+ return null;
14
+ const descriptors = Object.getOwnPropertyDescriptors(value);
15
+ const bytes = descriptors.bytes?.value;
16
+ if (!(bytes instanceof Uint8Array) || descriptors["/"]?.value !== bytes)
17
+ return null;
18
+ const cid = CID.decode(bytes);
19
+ if (cid.version !== descriptors.version?.value || cid.code !== descriptors.code?.value)
20
+ throw new Error("Invalid native CID identity.");
21
+ return cid;
22
+ }
23
+ /** Reuse the canonical codec, but never interpret a plain business object as a CID. */
24
+ export function encodeDagCbor(value) {
25
+ return encode(value, {
26
+ ...encodeOptions,
27
+ typeEncoders: {
28
+ ...encodeOptions.typeEncoders,
29
+ Object: (object) => {
30
+ const cid = asNativeCID(object);
31
+ return cid ? encodeOptions.typeEncoders.Object(cid) : null;
32
+ },
33
+ },
34
+ });
35
+ }
36
+ //# sourceMappingURL=dag-cbor.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dag-cbor.js","sourceRoot":"","sources":["../src/dag-cbor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAC/C,OAAO,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,GAAG,EAAE,MAAM,kBAAkB,CAAC;AAEvC,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAE9C,yFAAyF;AACzF,MAAM,UAAU,WAAW,CAA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AAC;AACL,CAAC"}
@@ -0,0 +1,63 @@
1
+ import type { Static, TSchema } from "@sinclair/typebox";
2
+ import { CID } from "multiformats/cid";
3
+ import { ContentRef } from "./content-ref.js";
4
+ import { Budget, type JsonValue, type PayloadLimits } from "./value.js";
5
+ export { addContentRefKeyword, inspectTaskSchema } from "./contract.js";
6
+ export { ContentRef } from "./content-ref.js";
7
+ export { parseCidPath, type CidPathStep } from "./paths.js";
8
+ export { Budget, defaultPayloadLimits, type JsonValue, type PayloadLimits } from "./value.js";
9
+ export type IpfsPayload<T = JsonValue> = {
10
+ data: T;
11
+ cidPaths: string[];
12
+ };
13
+ export type DagValue = null | boolean | number | string | CID | DagValue[] | {
14
+ [key: string]: DagValue;
15
+ };
16
+ export type DagPayload = IpfsPayload<DagValue>;
17
+ export type JsonOf<T> = T extends ContentRef ? string : T extends readonly unknown[] ? {
18
+ [K in keyof T]: JsonOf<T[K]>;
19
+ } : T extends object ? {
20
+ [K in keyof T]: JsonOf<T[K]>;
21
+ } : T;
22
+ export type PayloadInspector = (schema: unknown, data: JsonValue, budget: Budget) => {
23
+ expected: Map<string, string>;
24
+ rules: Set<string>;
25
+ };
26
+ export interface PayloadOptions {
27
+ limits?: Partial<PayloadLimits>;
28
+ /** Task contracts inject inspectTaskSchema; the P1 profile remains the default. */
29
+ inspect?: PayloadInspector;
30
+ /** Host-supplied Task dialect validator; never skip business keywords. */
31
+ validate?: (data: JsonValue) => void;
32
+ }
33
+ export interface PayloadBlock {
34
+ cid: CID;
35
+ bytes: Uint8Array;
36
+ }
37
+ /** Encode ContentRef instances without a contract; lookalike strings stay ordinary. */
38
+ export declare function encodeReferences(value: unknown, options?: PayloadOptions): IpfsPayload;
39
+ /** Encode author values according to their contract; strings and lookalike objects stay ordinary. */
40
+ export declare function encodePayload<S extends TSchema>(schema: S, value: Static<S>, options?: PayloadOptions): IpfsPayload<JsonOf<Static<S>>>;
41
+ export declare function validatePayload(payload: unknown, schema?: unknown, options?: PayloadOptions): IpfsPayload;
42
+ export declare function decodePayload<S extends TSchema>(payload: unknown, schema: S, options?: PayloadOptions): Static<S>;
43
+ export declare function decodePayload(payload: unknown, schema?: unknown, options?: PayloadOptions): unknown;
44
+ /** The DAG envelope preserves metadata, but reference positions contain real IPLD CID links. */
45
+ export declare function toDagPayload(payload: unknown, schema?: unknown, options?: PayloadOptions): DagPayload;
46
+ export declare function fromDagPayload(value: unknown, schema?: unknown, options?: PayloadOptions): IpfsPayload;
47
+ export declare function encodePayloadBlock(payload: unknown, schema?: unknown, options?: PayloadOptions): Promise<PayloadBlock>;
48
+ export declare function decodePayloadBlock(bytes: Uint8Array, schema?: unknown, options?: PayloadOptions & {
49
+ cid?: CID;
50
+ }): Promise<IpfsPayload>;
51
+ export interface TrustedPayloadContract {
52
+ readonly schema: unknown;
53
+ encode(value: unknown): IpfsPayload;
54
+ decode(payload: unknown): unknown;
55
+ validate(payload: unknown): IpfsPayload;
56
+ toDag(payload: unknown): DagPayload;
57
+ fromDag(value: unknown): IpfsPayload;
58
+ encodeBlock(payload: unknown): Promise<PayloadBlock>;
59
+ decodeBlock(bytes: Uint8Array, cid?: CID): Promise<IpfsPayload>;
60
+ }
61
+ /** Trusted Task-dialect bridge: snapshot/path conversion plus full Schema validation. */
62
+ export declare function compileTrustedContract(schema: unknown, options?: PayloadOptions): TrustedPayloadContract;
63
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AACzD,OAAO,EAAE,GAAG,EAAE,MAAM,kBAAkB,CAAC;AAGvC,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAG9C,OAAO,EAAE,MAAM,EAAY,KAAK,SAAS,EAAE,KAAK,aAAa,EAAE,MAAM,YAAY,CAAC;AAElF,OAAO,EAAE,oBAAoB,EAAE,iBA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