@aggrega-ai/aggrega-abi 0.0.0-stage → 0.9.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 +202 -0
- package/README.md +23 -2
- package/dist/abi_version_enums_gen.d.ts +1 -0
- package/dist/abi_version_enums_gen.js +33 -0
- package/dist/annotationtransform_gen.d.ts +56 -0
- package/dist/annotationtransform_gen.js +385 -0
- package/dist/cbor_gen.d.ts +28 -0
- package/dist/cbor_gen.js +413 -0
- package/dist/cli_gen.d.ts +11 -0
- package/dist/cli_gen.js +75 -0
- package/dist/describe_gen.d.ts +165 -0
- package/dist/describe_gen.js +1154 -0
- package/dist/diagnostic_enums_gen.d.ts +3 -0
- package/dist/diagnostic_enums_gen.js +27 -0
- package/dist/diagnostic_gen.d.ts +45 -0
- package/dist/diagnostic_gen.js +309 -0
- package/dist/frp_gen.d.ts +97 -0
- package/dist/frp_gen.js +731 -0
- package/dist/hostfunc_error_enums_gen.d.ts +13 -0
- package/dist/hostfunc_error_enums_gen.js +35 -0
- package/dist/import_gen.d.ts +159 -0
- package/dist/import_gen.js +1050 -0
- package/dist/index.d.ts +33 -0
- package/dist/index.js +51 -0
- package/dist/ir_gen.d.ts +180 -0
- package/dist/ir_gen.js +1640 -0
- package/dist/linter_gen.d.ts +45 -0
- package/dist/linter_gen.js +374 -0
- package/dist/mutator_gen.d.ts +64 -0
- package/dist/mutator_gen.js +448 -0
- package/dist/orderedmap_gen.d.ts +5 -0
- package/dist/orderedmap_gen.js +186 -0
- package/dist/parse_gen.d.ts +60 -0
- package/dist/parse_gen.js +364 -0
- package/dist/policy_gen.d.ts +69 -0
- package/dist/policy_gen.js +461 -0
- package/dist/providerrender_gen.d.ts +495 -0
- package/dist/providerrender_gen.js +3756 -0
- package/dist/servewire_gen.d.ts +1643 -0
- package/dist/servewire_gen.js +3035 -0
- package/package.json +30 -4
|
@@ -0,0 +1,448 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
// Copyright 2026 Cognitio s.r.l.
|
|
4
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
+
exports.encodeMutatorInput = encodeMutatorInput;
|
|
6
|
+
exports.decodeMutatorInput = decodeMutatorInput;
|
|
7
|
+
exports.encodeMutatorOutput = encodeMutatorOutput;
|
|
8
|
+
exports.decodeMutatorOutput = decodeMutatorOutput;
|
|
9
|
+
exports.encodeCompilationContext = encodeCompilationContext;
|
|
10
|
+
exports.decodeCompilationContext = decodeCompilationContext;
|
|
11
|
+
exports.encodeMutatorGraph = encodeMutatorGraph;
|
|
12
|
+
exports.decodeMutatorGraph = decodeMutatorGraph;
|
|
13
|
+
exports.encodeMutatorNode = encodeMutatorNode;
|
|
14
|
+
exports.decodeMutatorNode = decodeMutatorNode;
|
|
15
|
+
exports.encodeMutatorSource = encodeMutatorSource;
|
|
16
|
+
exports.decodeMutatorSource = decodeMutatorSource;
|
|
17
|
+
exports.encodeCBORMutatorInput = encodeCBORMutatorInput;
|
|
18
|
+
exports.appendCBORMutatorInput = appendCBORMutatorInput;
|
|
19
|
+
exports.decodeCBORMutatorInput = decodeCBORMutatorInput;
|
|
20
|
+
exports.decodeCBORMutatorInputFrom = decodeCBORMutatorInputFrom;
|
|
21
|
+
exports.encodeCBORMutatorOutput = encodeCBORMutatorOutput;
|
|
22
|
+
exports.appendCBORMutatorOutput = appendCBORMutatorOutput;
|
|
23
|
+
exports.decodeCBORMutatorOutput = decodeCBORMutatorOutput;
|
|
24
|
+
exports.decodeCBORMutatorOutputFrom = decodeCBORMutatorOutputFrom;
|
|
25
|
+
exports.encodeCBORCompilationContext = encodeCBORCompilationContext;
|
|
26
|
+
exports.appendCBORCompilationContext = appendCBORCompilationContext;
|
|
27
|
+
exports.decodeCBORCompilationContext = decodeCBORCompilationContext;
|
|
28
|
+
exports.decodeCBORCompilationContextFrom = decodeCBORCompilationContextFrom;
|
|
29
|
+
exports.encodeCBORMutatorGraph = encodeCBORMutatorGraph;
|
|
30
|
+
exports.appendCBORMutatorGraph = appendCBORMutatorGraph;
|
|
31
|
+
exports.decodeCBORMutatorGraph = decodeCBORMutatorGraph;
|
|
32
|
+
exports.decodeCBORMutatorGraphFrom = decodeCBORMutatorGraphFrom;
|
|
33
|
+
exports.encodeCBORMutatorNode = encodeCBORMutatorNode;
|
|
34
|
+
exports.appendCBORMutatorNode = appendCBORMutatorNode;
|
|
35
|
+
exports.decodeCBORMutatorNode = decodeCBORMutatorNode;
|
|
36
|
+
exports.decodeCBORMutatorNodeFrom = decodeCBORMutatorNodeFrom;
|
|
37
|
+
exports.encodeCBORMutatorSource = encodeCBORMutatorSource;
|
|
38
|
+
exports.appendCBORMutatorSource = appendCBORMutatorSource;
|
|
39
|
+
exports.decodeCBORMutatorSource = decodeCBORMutatorSource;
|
|
40
|
+
exports.decodeCBORMutatorSourceFrom = decodeCBORMutatorSourceFrom;
|
|
41
|
+
// Code generated by internal/tools/typegen from
|
|
42
|
+
// aggrega-schemas/json/wasm-mutator-v1beta1.schema.json. DO NOT EDIT.
|
|
43
|
+
// Regenerate with `go generate ./internal/tools/typegen` from the
|
|
44
|
+
// aggrega-cli checkout.
|
|
45
|
+
const orderedmap_gen_ts_1 = require("./orderedmap_gen.js");
|
|
46
|
+
const cbor_gen_ts_1 = require("./cbor_gen.js");
|
|
47
|
+
function jstr(s) {
|
|
48
|
+
return JSON.stringify(s);
|
|
49
|
+
}
|
|
50
|
+
// encodeOpaque carries an opaque (`any` / RawMessage) value VERBATIM: the
|
|
51
|
+
// key order from JSON.parse is preserved, matching the Go and Rust codecs'
|
|
52
|
+
// byte-carry of opaque values. Opaque values are never sorted.
|
|
53
|
+
function encodeOpaque(v) {
|
|
54
|
+
return JSON.stringify(v);
|
|
55
|
+
}
|
|
56
|
+
function encodeMutatorInput(v) {
|
|
57
|
+
const parts = [];
|
|
58
|
+
parts.push(`${jstr("compilation_context")}:${encodeCompilationContext(v.compilation_context)}`);
|
|
59
|
+
parts.push(`${jstr("graph")}:${encodeMutatorGraph(v.graph)}`);
|
|
60
|
+
if (v.sources !== undefined && v.sources.length > 0)
|
|
61
|
+
parts.push(`${jstr("sources")}:${`[${v.sources.map((e0) => encodeMutatorSource(e0)).join(",")}]`}`);
|
|
62
|
+
if (v.settings !== undefined && v.settings !== null)
|
|
63
|
+
parts.push(`${jstr("settings")}:${encodeOpaque(v.settings)}`);
|
|
64
|
+
return `{${parts.join(",")}}`;
|
|
65
|
+
}
|
|
66
|
+
function decodeMutatorInput(data) {
|
|
67
|
+
const o = {};
|
|
68
|
+
(0, orderedmap_gen_ts_1.readJSONMembers)(data, (k, raw) => {
|
|
69
|
+
switch (k) {
|
|
70
|
+
case "compilation_context":
|
|
71
|
+
o["compilation_context"] = JSON.parse(raw);
|
|
72
|
+
break;
|
|
73
|
+
case "graph":
|
|
74
|
+
o["graph"] = decodeMutatorGraph(raw);
|
|
75
|
+
break;
|
|
76
|
+
case "sources":
|
|
77
|
+
o["sources"] = JSON.parse(raw);
|
|
78
|
+
break;
|
|
79
|
+
case "settings":
|
|
80
|
+
o["settings"] = JSON.parse(raw);
|
|
81
|
+
break;
|
|
82
|
+
}
|
|
83
|
+
});
|
|
84
|
+
return o;
|
|
85
|
+
}
|
|
86
|
+
function encodeMutatorOutput(v) {
|
|
87
|
+
const parts = [];
|
|
88
|
+
parts.push(`${jstr("patches")}:${`[${v.patches.map((e0) => encodeOpaque(e0)).join(",")}]`}`);
|
|
89
|
+
if (v.error !== undefined && v.error !== "")
|
|
90
|
+
parts.push(`${jstr("error")}:${jstr(v.error)}`);
|
|
91
|
+
return `{${parts.join(",")}}`;
|
|
92
|
+
}
|
|
93
|
+
function decodeMutatorOutput(data) {
|
|
94
|
+
return JSON.parse(data);
|
|
95
|
+
}
|
|
96
|
+
function encodeCompilationContext(v) {
|
|
97
|
+
const parts = [];
|
|
98
|
+
parts.push(`${jstr("release_name")}:${jstr(v.release_name)}`);
|
|
99
|
+
parts.push(`${jstr("environment")}:${jstr(v.environment)}`);
|
|
100
|
+
return `{${parts.join(",")}}`;
|
|
101
|
+
}
|
|
102
|
+
function decodeCompilationContext(data) {
|
|
103
|
+
return JSON.parse(data);
|
|
104
|
+
}
|
|
105
|
+
function encodeMutatorGraph(v) {
|
|
106
|
+
const parts = [];
|
|
107
|
+
parts.push(`${jstr("nodes")}:${(0, orderedmap_gen_ts_1.writeOrderedObject)(v.nodes, (v0) => encodeMutatorNode(v0))}`);
|
|
108
|
+
return `{${parts.join(",")}}`;
|
|
109
|
+
}
|
|
110
|
+
function decodeMutatorGraph(data) {
|
|
111
|
+
const o = {};
|
|
112
|
+
(0, orderedmap_gen_ts_1.readJSONMembers)(data, (k, raw) => {
|
|
113
|
+
switch (k) {
|
|
114
|
+
case "nodes":
|
|
115
|
+
o["nodes"] = (0, orderedmap_gen_ts_1.readOrderedObject)(raw, (r0) => decodeMutatorNode(r0));
|
|
116
|
+
break;
|
|
117
|
+
}
|
|
118
|
+
});
|
|
119
|
+
return o;
|
|
120
|
+
}
|
|
121
|
+
function encodeMutatorNode(v) {
|
|
122
|
+
const parts = [];
|
|
123
|
+
parts.push(`${jstr("component")}:${jstr(v.component)}`);
|
|
124
|
+
parts.push(`${jstr("resolved_version")}:${jstr(v.resolved_version)}`);
|
|
125
|
+
parts.push(`${jstr("labels")}:${(0, orderedmap_gen_ts_1.writeOrderedObject)(v.labels, (v0) => jstr(v0))}`);
|
|
126
|
+
if (v.values !== undefined && v.values.size > 0)
|
|
127
|
+
parts.push(`${jstr("values")}:${(0, orderedmap_gen_ts_1.writeOrderedObject)(v.values, (v0) => encodeOpaque(v0))}`);
|
|
128
|
+
return `{${parts.join(",")}}`;
|
|
129
|
+
}
|
|
130
|
+
function decodeMutatorNode(data) {
|
|
131
|
+
const o = {};
|
|
132
|
+
(0, orderedmap_gen_ts_1.readJSONMembers)(data, (k, raw) => {
|
|
133
|
+
switch (k) {
|
|
134
|
+
case "component":
|
|
135
|
+
o["component"] = JSON.parse(raw);
|
|
136
|
+
break;
|
|
137
|
+
case "resolved_version":
|
|
138
|
+
o["resolved_version"] = JSON.parse(raw);
|
|
139
|
+
break;
|
|
140
|
+
case "labels":
|
|
141
|
+
o["labels"] = (0, orderedmap_gen_ts_1.readOrderedObject)(raw, (r0) => JSON.parse(r0));
|
|
142
|
+
break;
|
|
143
|
+
case "values":
|
|
144
|
+
o["values"] = (0, orderedmap_gen_ts_1.readOrderedObject)(raw, (r0) => JSON.parse(r0));
|
|
145
|
+
break;
|
|
146
|
+
}
|
|
147
|
+
});
|
|
148
|
+
return o;
|
|
149
|
+
}
|
|
150
|
+
function encodeMutatorSource(v) {
|
|
151
|
+
const parts = [];
|
|
152
|
+
parts.push(`${jstr("path")}:${jstr(v.path)}`);
|
|
153
|
+
parts.push(`${jstr("content")}:${jstr(v.content)}`);
|
|
154
|
+
return `{${parts.join(",")}}`;
|
|
155
|
+
}
|
|
156
|
+
function decodeMutatorSource(data) {
|
|
157
|
+
return JSON.parse(data);
|
|
158
|
+
}
|
|
159
|
+
function encodeCBORMutatorInput(v) {
|
|
160
|
+
const out = [];
|
|
161
|
+
appendCBORMutatorInput(out, v);
|
|
162
|
+
return new Uint8Array(out);
|
|
163
|
+
}
|
|
164
|
+
function appendCBORMutatorInput(out, v) {
|
|
165
|
+
let n = 2;
|
|
166
|
+
if (v.sources !== undefined && v.sources.length > 0)
|
|
167
|
+
n++;
|
|
168
|
+
if (v.settings !== undefined && v.settings !== null)
|
|
169
|
+
n++;
|
|
170
|
+
(0, cbor_gen_ts_1.writeHead)(out, 5, n);
|
|
171
|
+
(0, cbor_gen_ts_1.writeText)(out, "graph");
|
|
172
|
+
appendCBORMutatorGraph(out, v.graph);
|
|
173
|
+
if (v.sources !== undefined && v.sources.length > 0) {
|
|
174
|
+
(0, cbor_gen_ts_1.writeText)(out, "sources");
|
|
175
|
+
{
|
|
176
|
+
const a0 = v.sources;
|
|
177
|
+
(0, cbor_gen_ts_1.writeHead)(out, 4, a0.length);
|
|
178
|
+
for (const ee0 of a0) {
|
|
179
|
+
appendCBORMutatorSource(out, ee0);
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
if (v.settings !== undefined && v.settings !== null) {
|
|
184
|
+
(0, cbor_gen_ts_1.writeText)(out, "settings");
|
|
185
|
+
(0, cbor_gen_ts_1.writeBytes)(out, (0, cbor_gen_ts_1.utf8Encode)(JSON.stringify(v.settings)));
|
|
186
|
+
}
|
|
187
|
+
(0, cbor_gen_ts_1.writeText)(out, "compilation_context");
|
|
188
|
+
appendCBORCompilationContext(out, v.compilation_context);
|
|
189
|
+
}
|
|
190
|
+
function decodeCBORMutatorInput(data) {
|
|
191
|
+
const dec = new cbor_gen_ts_1.CborDec(data);
|
|
192
|
+
return decodeCBORMutatorInputFrom(dec);
|
|
193
|
+
}
|
|
194
|
+
function decodeCBORMutatorInputFrom(dec) {
|
|
195
|
+
const o = {};
|
|
196
|
+
const n = dec.readMapHeader();
|
|
197
|
+
for (let i = 0; i < n; i++) {
|
|
198
|
+
const k = dec.readText();
|
|
199
|
+
switch (k) {
|
|
200
|
+
case "compilation_context":
|
|
201
|
+
o["compilation_context"] = decodeCBORCompilationContextFrom(dec);
|
|
202
|
+
break;
|
|
203
|
+
case "graph":
|
|
204
|
+
o["graph"] = decodeCBORMutatorGraphFrom(dec);
|
|
205
|
+
break;
|
|
206
|
+
case "sources":
|
|
207
|
+
o["sources"] = (() => { const a = []; const sn = dec.readArrayHeader(); for (let j = 0; j < sn; j++) {
|
|
208
|
+
a.push(decodeCBORMutatorSourceFrom(dec));
|
|
209
|
+
} return a; })();
|
|
210
|
+
break;
|
|
211
|
+
case "settings":
|
|
212
|
+
o["settings"] = JSON.parse((0, cbor_gen_ts_1.utf8Decode)(dec.readBytes()));
|
|
213
|
+
break;
|
|
214
|
+
default: dec.skip();
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
return o;
|
|
218
|
+
}
|
|
219
|
+
function encodeCBORMutatorOutput(v) {
|
|
220
|
+
const out = [];
|
|
221
|
+
appendCBORMutatorOutput(out, v);
|
|
222
|
+
return new Uint8Array(out);
|
|
223
|
+
}
|
|
224
|
+
function appendCBORMutatorOutput(out, v) {
|
|
225
|
+
let n = 1;
|
|
226
|
+
if (v.error !== undefined && v.error !== "")
|
|
227
|
+
n++;
|
|
228
|
+
(0, cbor_gen_ts_1.writeHead)(out, 5, n);
|
|
229
|
+
if (v.error !== undefined && v.error !== "") {
|
|
230
|
+
(0, cbor_gen_ts_1.writeText)(out, "error");
|
|
231
|
+
(0, cbor_gen_ts_1.writeText)(out, v.error);
|
|
232
|
+
}
|
|
233
|
+
(0, cbor_gen_ts_1.writeText)(out, "patches");
|
|
234
|
+
{
|
|
235
|
+
const a0 = v.patches;
|
|
236
|
+
(0, cbor_gen_ts_1.writeHead)(out, 4, a0.length);
|
|
237
|
+
for (const ee0 of a0) {
|
|
238
|
+
(0, cbor_gen_ts_1.writeBytes)(out, (0, cbor_gen_ts_1.utf8Encode)(JSON.stringify(ee0)));
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
function decodeCBORMutatorOutput(data) {
|
|
243
|
+
const dec = new cbor_gen_ts_1.CborDec(data);
|
|
244
|
+
return decodeCBORMutatorOutputFrom(dec);
|
|
245
|
+
}
|
|
246
|
+
function decodeCBORMutatorOutputFrom(dec) {
|
|
247
|
+
const o = {};
|
|
248
|
+
const n = dec.readMapHeader();
|
|
249
|
+
for (let i = 0; i < n; i++) {
|
|
250
|
+
const k = dec.readText();
|
|
251
|
+
switch (k) {
|
|
252
|
+
case "patches":
|
|
253
|
+
o["patches"] = (() => { const a = []; const sn = dec.readArrayHeader(); for (let j = 0; j < sn; j++) {
|
|
254
|
+
a.push(JSON.parse((0, cbor_gen_ts_1.utf8Decode)(dec.readBytes())));
|
|
255
|
+
} return a; })();
|
|
256
|
+
break;
|
|
257
|
+
case "error":
|
|
258
|
+
o["error"] = dec.readText();
|
|
259
|
+
break;
|
|
260
|
+
default: dec.skip();
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
return o;
|
|
264
|
+
}
|
|
265
|
+
function encodeCBORCompilationContext(v) {
|
|
266
|
+
const out = [];
|
|
267
|
+
appendCBORCompilationContext(out, v);
|
|
268
|
+
return new Uint8Array(out);
|
|
269
|
+
}
|
|
270
|
+
function appendCBORCompilationContext(out, v) {
|
|
271
|
+
let n = 2;
|
|
272
|
+
(0, cbor_gen_ts_1.writeHead)(out, 5, n);
|
|
273
|
+
(0, cbor_gen_ts_1.writeText)(out, "environment");
|
|
274
|
+
(0, cbor_gen_ts_1.writeText)(out, v.environment);
|
|
275
|
+
(0, cbor_gen_ts_1.writeText)(out, "release_name");
|
|
276
|
+
(0, cbor_gen_ts_1.writeText)(out, v.release_name);
|
|
277
|
+
}
|
|
278
|
+
function decodeCBORCompilationContext(data) {
|
|
279
|
+
const dec = new cbor_gen_ts_1.CborDec(data);
|
|
280
|
+
return decodeCBORCompilationContextFrom(dec);
|
|
281
|
+
}
|
|
282
|
+
function decodeCBORCompilationContextFrom(dec) {
|
|
283
|
+
const o = {};
|
|
284
|
+
const n = dec.readMapHeader();
|
|
285
|
+
for (let i = 0; i < n; i++) {
|
|
286
|
+
const k = dec.readText();
|
|
287
|
+
switch (k) {
|
|
288
|
+
case "release_name":
|
|
289
|
+
o["release_name"] = dec.readText();
|
|
290
|
+
break;
|
|
291
|
+
case "environment":
|
|
292
|
+
o["environment"] = dec.readText();
|
|
293
|
+
break;
|
|
294
|
+
default: dec.skip();
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
return o;
|
|
298
|
+
}
|
|
299
|
+
function encodeCBORMutatorGraph(v) {
|
|
300
|
+
const out = [];
|
|
301
|
+
appendCBORMutatorGraph(out, v);
|
|
302
|
+
return new Uint8Array(out);
|
|
303
|
+
}
|
|
304
|
+
function appendCBORMutatorGraph(out, v) {
|
|
305
|
+
let n = 1;
|
|
306
|
+
(0, cbor_gen_ts_1.writeHead)(out, 5, n);
|
|
307
|
+
(0, cbor_gen_ts_1.writeText)(out, "nodes");
|
|
308
|
+
{
|
|
309
|
+
const m0 = v.nodes;
|
|
310
|
+
(0, cbor_gen_ts_1.writeHead)(out, 4, m0.size);
|
|
311
|
+
for (const [kk0, vv0] of m0) {
|
|
312
|
+
(0, cbor_gen_ts_1.writeHead)(out, 4, 2);
|
|
313
|
+
(0, cbor_gen_ts_1.writeText)(out, kk0);
|
|
314
|
+
appendCBORMutatorNode(out, vv0);
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
function decodeCBORMutatorGraph(data) {
|
|
319
|
+
const dec = new cbor_gen_ts_1.CborDec(data);
|
|
320
|
+
return decodeCBORMutatorGraphFrom(dec);
|
|
321
|
+
}
|
|
322
|
+
function decodeCBORMutatorGraphFrom(dec) {
|
|
323
|
+
const o = {};
|
|
324
|
+
const n = dec.readMapHeader();
|
|
325
|
+
for (let i = 0; i < n; i++) {
|
|
326
|
+
const k = dec.readText();
|
|
327
|
+
switch (k) {
|
|
328
|
+
case "nodes":
|
|
329
|
+
o["nodes"] = (() => { const m = new Map(); const mn = dec.readArrayHeader(); for (let j = 0; j < mn; j++) {
|
|
330
|
+
const mk = dec.readEntryKey();
|
|
331
|
+
if (m.has(mk))
|
|
332
|
+
throw (0, cbor_gen_ts_1.duplicateKeyError)(mk);
|
|
333
|
+
m.set(mk, decodeCBORMutatorNodeFrom(dec));
|
|
334
|
+
} return m; })();
|
|
335
|
+
break;
|
|
336
|
+
default: dec.skip();
|
|
337
|
+
}
|
|
338
|
+
}
|
|
339
|
+
return o;
|
|
340
|
+
}
|
|
341
|
+
function encodeCBORMutatorNode(v) {
|
|
342
|
+
const out = [];
|
|
343
|
+
appendCBORMutatorNode(out, v);
|
|
344
|
+
return new Uint8Array(out);
|
|
345
|
+
}
|
|
346
|
+
function appendCBORMutatorNode(out, v) {
|
|
347
|
+
let n = 3;
|
|
348
|
+
if (v.values !== undefined && v.values.size > 0)
|
|
349
|
+
n++;
|
|
350
|
+
(0, cbor_gen_ts_1.writeHead)(out, 5, n);
|
|
351
|
+
(0, cbor_gen_ts_1.writeText)(out, "labels");
|
|
352
|
+
{
|
|
353
|
+
const m0 = v.labels;
|
|
354
|
+
(0, cbor_gen_ts_1.writeHead)(out, 4, m0.size);
|
|
355
|
+
for (const [kk0, vv0] of m0) {
|
|
356
|
+
(0, cbor_gen_ts_1.writeHead)(out, 4, 2);
|
|
357
|
+
(0, cbor_gen_ts_1.writeText)(out, kk0);
|
|
358
|
+
(0, cbor_gen_ts_1.writeText)(out, vv0);
|
|
359
|
+
}
|
|
360
|
+
}
|
|
361
|
+
if (v.values !== undefined && v.values.size > 0) {
|
|
362
|
+
(0, cbor_gen_ts_1.writeText)(out, "values");
|
|
363
|
+
{
|
|
364
|
+
const m0 = v.values;
|
|
365
|
+
(0, cbor_gen_ts_1.writeHead)(out, 4, m0.size);
|
|
366
|
+
for (const [kk0, vv0] of m0) {
|
|
367
|
+
(0, cbor_gen_ts_1.writeHead)(out, 4, 2);
|
|
368
|
+
(0, cbor_gen_ts_1.writeText)(out, kk0);
|
|
369
|
+
(0, cbor_gen_ts_1.writeBytes)(out, (0, cbor_gen_ts_1.utf8Encode)(JSON.stringify(vv0)));
|
|
370
|
+
}
|
|
371
|
+
}
|
|
372
|
+
}
|
|
373
|
+
(0, cbor_gen_ts_1.writeText)(out, "component");
|
|
374
|
+
(0, cbor_gen_ts_1.writeText)(out, v.component);
|
|
375
|
+
(0, cbor_gen_ts_1.writeText)(out, "resolved_version");
|
|
376
|
+
(0, cbor_gen_ts_1.writeText)(out, v.resolved_version);
|
|
377
|
+
}
|
|
378
|
+
function decodeCBORMutatorNode(data) {
|
|
379
|
+
const dec = new cbor_gen_ts_1.CborDec(data);
|
|
380
|
+
return decodeCBORMutatorNodeFrom(dec);
|
|
381
|
+
}
|
|
382
|
+
function decodeCBORMutatorNodeFrom(dec) {
|
|
383
|
+
const o = {};
|
|
384
|
+
const n = dec.readMapHeader();
|
|
385
|
+
for (let i = 0; i < n; i++) {
|
|
386
|
+
const k = dec.readText();
|
|
387
|
+
switch (k) {
|
|
388
|
+
case "component":
|
|
389
|
+
o["component"] = dec.readText();
|
|
390
|
+
break;
|
|
391
|
+
case "resolved_version":
|
|
392
|
+
o["resolved_version"] = dec.readText();
|
|
393
|
+
break;
|
|
394
|
+
case "labels":
|
|
395
|
+
o["labels"] = (() => { const m = new Map(); const mn = dec.readArrayHeader(); for (let j = 0; j < mn; j++) {
|
|
396
|
+
const mk = dec.readEntryKey();
|
|
397
|
+
if (m.has(mk))
|
|
398
|
+
throw (0, cbor_gen_ts_1.duplicateKeyError)(mk);
|
|
399
|
+
m.set(mk, dec.readText());
|
|
400
|
+
} return m; })();
|
|
401
|
+
break;
|
|
402
|
+
case "values":
|
|
403
|
+
o["values"] = (() => { const m = new Map(); const mn = dec.readArrayHeader(); for (let j = 0; j < mn; j++) {
|
|
404
|
+
const mk = dec.readEntryKey();
|
|
405
|
+
if (m.has(mk))
|
|
406
|
+
throw (0, cbor_gen_ts_1.duplicateKeyError)(mk);
|
|
407
|
+
m.set(mk, JSON.parse((0, cbor_gen_ts_1.utf8Decode)(dec.readBytes())));
|
|
408
|
+
} return m; })();
|
|
409
|
+
break;
|
|
410
|
+
default: dec.skip();
|
|
411
|
+
}
|
|
412
|
+
}
|
|
413
|
+
return o;
|
|
414
|
+
}
|
|
415
|
+
function encodeCBORMutatorSource(v) {
|
|
416
|
+
const out = [];
|
|
417
|
+
appendCBORMutatorSource(out, v);
|
|
418
|
+
return new Uint8Array(out);
|
|
419
|
+
}
|
|
420
|
+
function appendCBORMutatorSource(out, v) {
|
|
421
|
+
let n = 2;
|
|
422
|
+
(0, cbor_gen_ts_1.writeHead)(out, 5, n);
|
|
423
|
+
(0, cbor_gen_ts_1.writeText)(out, "path");
|
|
424
|
+
(0, cbor_gen_ts_1.writeText)(out, v.path);
|
|
425
|
+
(0, cbor_gen_ts_1.writeText)(out, "content");
|
|
426
|
+
(0, cbor_gen_ts_1.writeText)(out, v.content);
|
|
427
|
+
}
|
|
428
|
+
function decodeCBORMutatorSource(data) {
|
|
429
|
+
const dec = new cbor_gen_ts_1.CborDec(data);
|
|
430
|
+
return decodeCBORMutatorSourceFrom(dec);
|
|
431
|
+
}
|
|
432
|
+
function decodeCBORMutatorSourceFrom(dec) {
|
|
433
|
+
const o = {};
|
|
434
|
+
const n = dec.readMapHeader();
|
|
435
|
+
for (let i = 0; i < n; i++) {
|
|
436
|
+
const k = dec.readText();
|
|
437
|
+
switch (k) {
|
|
438
|
+
case "path":
|
|
439
|
+
o["path"] = dec.readText();
|
|
440
|
+
break;
|
|
441
|
+
case "content":
|
|
442
|
+
o["content"] = dec.readText();
|
|
443
|
+
break;
|
|
444
|
+
default: dec.skip();
|
|
445
|
+
}
|
|
446
|
+
}
|
|
447
|
+
return o;
|
|
448
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export declare function readJSONMembers(text: string, visit: (key: string, raw: string) => void): void;
|
|
2
|
+
export declare function readOrderedObject<V>(text: string, value: (raw: string) => V): Map<string, V>;
|
|
3
|
+
export declare function readJSONArray<E>(text: string, element: (raw: string) => E): E[];
|
|
4
|
+
export declare function readPlainObject<V>(text: string, value: (raw: string) => V): Record<string, V>;
|
|
5
|
+
export declare function writeOrderedObject<V>(m: Map<string, V>, value: (v: V) => string): string;
|
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
// Copyright 2026 Cognitio s.r.l.
|
|
4
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
+
exports.readJSONMembers = readJSONMembers;
|
|
6
|
+
exports.readOrderedObject = readOrderedObject;
|
|
7
|
+
exports.readJSONArray = readJSONArray;
|
|
8
|
+
exports.readPlainObject = readPlainObject;
|
|
9
|
+
exports.writeOrderedObject = writeOrderedObject;
|
|
10
|
+
// Code generated by internal/tools/typegen. DO NOT EDIT.
|
|
11
|
+
// Regenerate with `go generate ./internal/tools/typegen` from the
|
|
12
|
+
// aggrega-cli checkout.
|
|
13
|
+
// The JSON leg of a Map<string, V> that keeps the order of an object's members.
|
|
14
|
+
// A plain object lists a key that is an array index, such as "8080", ahead of
|
|
15
|
+
// every other key, in ascending numeric order, so JSON.parse has lost the order
|
|
16
|
+
// before any code sees the object. The reader here visits the members in the
|
|
17
|
+
// order they are written instead, and hands each member's raw value text to the
|
|
18
|
+
// caller to decode.
|
|
19
|
+
//
|
|
20
|
+
// These functions are for the generated codecs; the package entry does not
|
|
21
|
+
// re-export them.
|
|
22
|
+
// isJSONWhitespace reports whether c is one of the four JSON whitespace
|
|
23
|
+
// characters.
|
|
24
|
+
function isJSONWhitespace(c) {
|
|
25
|
+
return c === 0x20 || c === 0x09 || c === 0x0a || c === 0x0d;
|
|
26
|
+
}
|
|
27
|
+
function skipWhitespace(s, i) {
|
|
28
|
+
while (i < s.length && isJSONWhitespace(s.charCodeAt(i)))
|
|
29
|
+
i++;
|
|
30
|
+
return i;
|
|
31
|
+
}
|
|
32
|
+
// endOfString returns the index just past the JSON string whose opening quote
|
|
33
|
+
// is at i.
|
|
34
|
+
function endOfString(s, i) {
|
|
35
|
+
for (i++; i < s.length; i++) {
|
|
36
|
+
const c = s.charCodeAt(i);
|
|
37
|
+
if (c === 0x5c) {
|
|
38
|
+
i++; // the character after a backslash is escaped
|
|
39
|
+
}
|
|
40
|
+
else if (c === 0x22) {
|
|
41
|
+
return i + 1;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
throw new Error("abi: unterminated JSON string");
|
|
45
|
+
}
|
|
46
|
+
// endOfValue returns the index just past the JSON value that starts at i. It
|
|
47
|
+
// finds the value's extent only; the value's text is checked when it is parsed.
|
|
48
|
+
function endOfValue(s, i) {
|
|
49
|
+
const c = s.charCodeAt(i);
|
|
50
|
+
if (c === 0x22)
|
|
51
|
+
return endOfString(s, i);
|
|
52
|
+
if (c === 0x7b || c === 0x5b) {
|
|
53
|
+
let depth = 0;
|
|
54
|
+
while (i < s.length) {
|
|
55
|
+
const d = s.charCodeAt(i);
|
|
56
|
+
if (d === 0x22) {
|
|
57
|
+
i = endOfString(s, i);
|
|
58
|
+
continue;
|
|
59
|
+
}
|
|
60
|
+
if (d === 0x7b || d === 0x5b) {
|
|
61
|
+
depth++;
|
|
62
|
+
}
|
|
63
|
+
else if (d === 0x7d || d === 0x5d) {
|
|
64
|
+
depth--;
|
|
65
|
+
if (depth === 0)
|
|
66
|
+
return i + 1;
|
|
67
|
+
}
|
|
68
|
+
i++;
|
|
69
|
+
}
|
|
70
|
+
throw new Error("abi: unterminated JSON value");
|
|
71
|
+
}
|
|
72
|
+
const start = i;
|
|
73
|
+
while (i < s.length) {
|
|
74
|
+
const d = s.charCodeAt(i);
|
|
75
|
+
if (d === 0x2c || d === 0x7d || d === 0x5d || isJSONWhitespace(d))
|
|
76
|
+
break;
|
|
77
|
+
i++;
|
|
78
|
+
}
|
|
79
|
+
if (i === start)
|
|
80
|
+
throw new Error("abi: expected a JSON value at offset " + start);
|
|
81
|
+
return i;
|
|
82
|
+
}
|
|
83
|
+
// readJSONMembers visits each member of the JSON object in text, in the order
|
|
84
|
+
// the members are written, handing visit the member's key and the raw text of
|
|
85
|
+
// its value. The raw text is not checked here: the visitor checks it by parsing
|
|
86
|
+
// it. Text that is not one JSON object, with nothing but whitespace around it, is
|
|
87
|
+
// refused.
|
|
88
|
+
function readJSONMembers(text, visit) {
|
|
89
|
+
let i = skipWhitespace(text, 0);
|
|
90
|
+
if (text.charCodeAt(i) !== 0x7b)
|
|
91
|
+
throw new Error("abi: expected a JSON object");
|
|
92
|
+
i = skipWhitespace(text, i + 1);
|
|
93
|
+
if (text.charCodeAt(i) === 0x7d) {
|
|
94
|
+
i = skipWhitespace(text, i + 1);
|
|
95
|
+
}
|
|
96
|
+
else {
|
|
97
|
+
for (;;) {
|
|
98
|
+
if (text.charCodeAt(i) !== 0x22)
|
|
99
|
+
throw new Error("abi: expected a string key at offset " + i);
|
|
100
|
+
const keyEnd = endOfString(text, i);
|
|
101
|
+
const key = JSON.parse(text.slice(i, keyEnd));
|
|
102
|
+
i = skipWhitespace(text, keyEnd);
|
|
103
|
+
if (text.charCodeAt(i) !== 0x3a)
|
|
104
|
+
throw new Error("abi: expected ':' at offset " + i);
|
|
105
|
+
i = skipWhitespace(text, i + 1);
|
|
106
|
+
const valueEnd = endOfValue(text, i);
|
|
107
|
+
visit(key, text.slice(i, valueEnd));
|
|
108
|
+
i = skipWhitespace(text, valueEnd);
|
|
109
|
+
const c = text.charCodeAt(i);
|
|
110
|
+
if (c === 0x7d) {
|
|
111
|
+
i = skipWhitespace(text, i + 1);
|
|
112
|
+
break;
|
|
113
|
+
}
|
|
114
|
+
if (c !== 0x2c)
|
|
115
|
+
throw new Error("abi: expected ',' or '}' at offset " + i);
|
|
116
|
+
i = skipWhitespace(text, i + 1);
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
if (i !== text.length)
|
|
120
|
+
throw new Error("abi: unexpected text after the JSON object at offset " + i);
|
|
121
|
+
}
|
|
122
|
+
// readOrderedObject reads the JSON object in text into a Map whose entries are
|
|
123
|
+
// in the order the members are written, decoding each member's raw value text
|
|
124
|
+
// with value. An object that repeats a key is refused, naming the key.
|
|
125
|
+
function readOrderedObject(text, value) {
|
|
126
|
+
const out = new Map();
|
|
127
|
+
readJSONMembers(text, (key, raw) => {
|
|
128
|
+
if (out.has(key))
|
|
129
|
+
throw new Error("abi: duplicate key " + JSON.stringify(key));
|
|
130
|
+
out.set(key, value(raw));
|
|
131
|
+
});
|
|
132
|
+
return out;
|
|
133
|
+
}
|
|
134
|
+
// readJSONArray reads the JSON array in text into an array, decoding each
|
|
135
|
+
// element's raw text with element, in the order the elements are written. A
|
|
136
|
+
// generated codec reads a list this way when its elements hold an
|
|
137
|
+
// order-preserving map, so no element passes through JSON.parse whole. Text that
|
|
138
|
+
// is not one JSON array, with nothing but whitespace around it, is refused.
|
|
139
|
+
function readJSONArray(text, element) {
|
|
140
|
+
const out = [];
|
|
141
|
+
let i = skipWhitespace(text, 0);
|
|
142
|
+
if (text.charCodeAt(i) !== 0x5b)
|
|
143
|
+
throw new Error("abi: expected a JSON array");
|
|
144
|
+
i = skipWhitespace(text, i + 1);
|
|
145
|
+
if (text.charCodeAt(i) === 0x5d) {
|
|
146
|
+
i = skipWhitespace(text, i + 1);
|
|
147
|
+
}
|
|
148
|
+
else {
|
|
149
|
+
for (;;) {
|
|
150
|
+
const end = endOfValue(text, i);
|
|
151
|
+
out.push(element(text.slice(i, end)));
|
|
152
|
+
i = skipWhitespace(text, end);
|
|
153
|
+
const c = text.charCodeAt(i);
|
|
154
|
+
if (c === 0x5d) {
|
|
155
|
+
i = skipWhitespace(text, i + 1);
|
|
156
|
+
break;
|
|
157
|
+
}
|
|
158
|
+
if (c !== 0x2c)
|
|
159
|
+
throw new Error("abi: expected ',' or ']' at offset " + i);
|
|
160
|
+
i = skipWhitespace(text, i + 1);
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
if (i !== text.length)
|
|
164
|
+
throw new Error("abi: unexpected text after the JSON array at offset " + i);
|
|
165
|
+
return out;
|
|
166
|
+
}
|
|
167
|
+
// readPlainObject reads the JSON object in text into a plain object, decoding
|
|
168
|
+
// each member's raw value text with value. A generated codec reads a plain map
|
|
169
|
+
// this way when its values hold an order-preserving map: the plain map's own
|
|
170
|
+
// order carries nothing, but its values' order does. As with JSON.parse, every
|
|
171
|
+
// key becomes an own member, and a key the text repeats keeps its last value.
|
|
172
|
+
function readPlainObject(text, value) {
|
|
173
|
+
const out = {};
|
|
174
|
+
readJSONMembers(text, (key, raw) => {
|
|
175
|
+
Object.defineProperty(out, key, { value: value(raw), enumerable: true, writable: true, configurable: true });
|
|
176
|
+
});
|
|
177
|
+
return out;
|
|
178
|
+
}
|
|
179
|
+
// writeOrderedObject writes m as a JSON object whose members are in the map's
|
|
180
|
+
// order, encoding each value with value.
|
|
181
|
+
function writeOrderedObject(m, value) {
|
|
182
|
+
const parts = [];
|
|
183
|
+
for (const [k, v] of m)
|
|
184
|
+
parts.push(JSON.stringify(k) + ":" + value(v));
|
|
185
|
+
return "{" + parts.join(",") + "}";
|
|
186
|
+
}
|