@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,461 @@
|
|
|
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.encodePolicyInput = encodePolicyInput;
|
|
6
|
+
exports.decodePolicyInput = decodePolicyInput;
|
|
7
|
+
exports.encodePolicyOutput = encodePolicyOutput;
|
|
8
|
+
exports.decodePolicyOutput = decodePolicyOutput;
|
|
9
|
+
exports.encodeRenderPolicyInput = encodeRenderPolicyInput;
|
|
10
|
+
exports.decodeRenderPolicyInput = decodeRenderPolicyInput;
|
|
11
|
+
exports.encodeRenderedArtifact = encodeRenderedArtifact;
|
|
12
|
+
exports.decodeRenderedArtifact = decodeRenderedArtifact;
|
|
13
|
+
exports.encodePolicySource = encodePolicySource;
|
|
14
|
+
exports.decodePolicySource = decodePolicySource;
|
|
15
|
+
exports.encodePrecalculatedPath = encodePrecalculatedPath;
|
|
16
|
+
exports.decodePrecalculatedPath = decodePrecalculatedPath;
|
|
17
|
+
exports.encodeCBORPolicyInput = encodeCBORPolicyInput;
|
|
18
|
+
exports.appendCBORPolicyInput = appendCBORPolicyInput;
|
|
19
|
+
exports.decodeCBORPolicyInput = decodeCBORPolicyInput;
|
|
20
|
+
exports.decodeCBORPolicyInputFrom = decodeCBORPolicyInputFrom;
|
|
21
|
+
exports.encodeCBORPolicyOutput = encodeCBORPolicyOutput;
|
|
22
|
+
exports.appendCBORPolicyOutput = appendCBORPolicyOutput;
|
|
23
|
+
exports.decodeCBORPolicyOutput = decodeCBORPolicyOutput;
|
|
24
|
+
exports.decodeCBORPolicyOutputFrom = decodeCBORPolicyOutputFrom;
|
|
25
|
+
exports.encodeCBORRenderPolicyInput = encodeCBORRenderPolicyInput;
|
|
26
|
+
exports.appendCBORRenderPolicyInput = appendCBORRenderPolicyInput;
|
|
27
|
+
exports.decodeCBORRenderPolicyInput = decodeCBORRenderPolicyInput;
|
|
28
|
+
exports.decodeCBORRenderPolicyInputFrom = decodeCBORRenderPolicyInputFrom;
|
|
29
|
+
exports.encodeCBORRenderedArtifact = encodeCBORRenderedArtifact;
|
|
30
|
+
exports.appendCBORRenderedArtifact = appendCBORRenderedArtifact;
|
|
31
|
+
exports.decodeCBORRenderedArtifact = decodeCBORRenderedArtifact;
|
|
32
|
+
exports.decodeCBORRenderedArtifactFrom = decodeCBORRenderedArtifactFrom;
|
|
33
|
+
exports.encodeCBORPolicySource = encodeCBORPolicySource;
|
|
34
|
+
exports.appendCBORPolicySource = appendCBORPolicySource;
|
|
35
|
+
exports.decodeCBORPolicySource = decodeCBORPolicySource;
|
|
36
|
+
exports.decodeCBORPolicySourceFrom = decodeCBORPolicySourceFrom;
|
|
37
|
+
exports.encodeCBORPrecalculatedPath = encodeCBORPrecalculatedPath;
|
|
38
|
+
exports.appendCBORPrecalculatedPath = appendCBORPrecalculatedPath;
|
|
39
|
+
exports.decodeCBORPrecalculatedPath = decodeCBORPrecalculatedPath;
|
|
40
|
+
exports.decodeCBORPrecalculatedPathFrom = decodeCBORPrecalculatedPathFrom;
|
|
41
|
+
// Code generated by internal/tools/typegen from
|
|
42
|
+
// aggrega-schemas/json/wasm-policy-v1beta1.schema.json. DO NOT EDIT.
|
|
43
|
+
// Regenerate with `go generate ./internal/tools/typegen` from the
|
|
44
|
+
// aggrega-cli checkout.
|
|
45
|
+
const ir_gen_ts_1 = require("./ir_gen.js");
|
|
46
|
+
const diagnostic_gen_ts_1 = require("./diagnostic_gen.js");
|
|
47
|
+
const orderedmap_gen_ts_1 = require("./orderedmap_gen.js");
|
|
48
|
+
const cbor_gen_ts_1 = require("./cbor_gen.js");
|
|
49
|
+
const ir_gen_ts_2 = require("./ir_gen.js");
|
|
50
|
+
const diagnostic_gen_ts_2 = require("./diagnostic_gen.js");
|
|
51
|
+
function jstr(s) {
|
|
52
|
+
return JSON.stringify(s);
|
|
53
|
+
}
|
|
54
|
+
// encodeOpaque carries an opaque (`any` / RawMessage) value VERBATIM: the
|
|
55
|
+
// key order from JSON.parse is preserved, matching the Go and Rust codecs'
|
|
56
|
+
// byte-carry of opaque values. Opaque values are never sorted.
|
|
57
|
+
function encodeOpaque(v) {
|
|
58
|
+
return JSON.stringify(v);
|
|
59
|
+
}
|
|
60
|
+
function encodePolicyInput(v) {
|
|
61
|
+
const parts = [];
|
|
62
|
+
parts.push(`${jstr("graph")}:${(0, ir_gen_ts_1.encodeIRGraph)(v.graph)}`);
|
|
63
|
+
parts.push(`${jstr("precalculated_paths")}:${`[${v.precalculated_paths.map((e0) => encodePrecalculatedPath(e0)).join(",")}]`}`);
|
|
64
|
+
if (v.sources !== undefined && v.sources.length > 0)
|
|
65
|
+
parts.push(`${jstr("sources")}:${`[${v.sources.map((e0) => encodePolicySource(e0)).join(",")}]`}`);
|
|
66
|
+
if (v.settings !== undefined && v.settings !== null)
|
|
67
|
+
parts.push(`${jstr("settings")}:${encodeOpaque(v.settings)}`);
|
|
68
|
+
return `{${parts.join(",")}}`;
|
|
69
|
+
}
|
|
70
|
+
function decodePolicyInput(data) {
|
|
71
|
+
const o = {};
|
|
72
|
+
(0, orderedmap_gen_ts_1.readJSONMembers)(data, (k, raw) => {
|
|
73
|
+
switch (k) {
|
|
74
|
+
case "graph":
|
|
75
|
+
o["graph"] = (0, ir_gen_ts_1.decodeIRGraph)(raw);
|
|
76
|
+
break;
|
|
77
|
+
case "precalculated_paths":
|
|
78
|
+
o["precalculated_paths"] = JSON.parse(raw);
|
|
79
|
+
break;
|
|
80
|
+
case "sources":
|
|
81
|
+
o["sources"] = JSON.parse(raw);
|
|
82
|
+
break;
|
|
83
|
+
case "settings":
|
|
84
|
+
o["settings"] = JSON.parse(raw);
|
|
85
|
+
break;
|
|
86
|
+
}
|
|
87
|
+
});
|
|
88
|
+
return o;
|
|
89
|
+
}
|
|
90
|
+
function encodePolicyOutput(v) {
|
|
91
|
+
const parts = [];
|
|
92
|
+
parts.push(`${jstr("results")}:${`[${v.results.map((e0) => (0, diagnostic_gen_ts_1.encodeDiagnostic)(e0)).join(",")}]`}`);
|
|
93
|
+
if (v.error !== undefined && v.error !== "")
|
|
94
|
+
parts.push(`${jstr("error")}:${jstr(v.error)}`);
|
|
95
|
+
return `{${parts.join(",")}}`;
|
|
96
|
+
}
|
|
97
|
+
function decodePolicyOutput(data) {
|
|
98
|
+
return JSON.parse(data);
|
|
99
|
+
}
|
|
100
|
+
function encodeRenderPolicyInput(v) {
|
|
101
|
+
const parts = [];
|
|
102
|
+
parts.push(`${jstr("artifacts")}:${`[${v.artifacts.map((e0) => encodeRenderedArtifact(e0)).join(",")}]`}`);
|
|
103
|
+
if (v.sources !== undefined && v.sources.length > 0)
|
|
104
|
+
parts.push(`${jstr("sources")}:${`[${v.sources.map((e0) => encodePolicySource(e0)).join(",")}]`}`);
|
|
105
|
+
if (v.settings !== undefined && v.settings !== null)
|
|
106
|
+
parts.push(`${jstr("settings")}:${encodeOpaque(v.settings)}`);
|
|
107
|
+
return `{${parts.join(",")}}`;
|
|
108
|
+
}
|
|
109
|
+
function decodeRenderPolicyInput(data) {
|
|
110
|
+
return JSON.parse(data);
|
|
111
|
+
}
|
|
112
|
+
function encodeRenderedArtifact(v) {
|
|
113
|
+
const parts = [];
|
|
114
|
+
parts.push(`${jstr("path")}:${jstr(v.path)}`);
|
|
115
|
+
parts.push(`${jstr("content")}:${jstr(v.content)}`);
|
|
116
|
+
if (v.tree !== undefined && v.tree !== null)
|
|
117
|
+
parts.push(`${jstr("tree")}:${encodeOpaque(v.tree)}`);
|
|
118
|
+
if (v.format !== undefined && v.format !== "")
|
|
119
|
+
parts.push(`${jstr("format")}:${jstr(v.format)}`);
|
|
120
|
+
return `{${parts.join(",")}}`;
|
|
121
|
+
}
|
|
122
|
+
function decodeRenderedArtifact(data) {
|
|
123
|
+
return JSON.parse(data);
|
|
124
|
+
}
|
|
125
|
+
function encodePolicySource(v) {
|
|
126
|
+
const parts = [];
|
|
127
|
+
parts.push(`${jstr("path")}:${jstr(v.path)}`);
|
|
128
|
+
parts.push(`${jstr("content")}:${jstr(v.content)}`);
|
|
129
|
+
return `{${parts.join(",")}}`;
|
|
130
|
+
}
|
|
131
|
+
function decodePolicySource(data) {
|
|
132
|
+
return JSON.parse(data);
|
|
133
|
+
}
|
|
134
|
+
function encodePrecalculatedPath(v) {
|
|
135
|
+
const parts = [];
|
|
136
|
+
parts.push(`${jstr("path_id")}:${jstr(v.path_id)}`);
|
|
137
|
+
parts.push(`${jstr("nodes")}:${`[${v.nodes.map((e0) => jstr(e0)).join(",")}]`}`);
|
|
138
|
+
parts.push(`${jstr("attached_features")}:${`[${v.attached_features.map((e0) => jstr(e0)).join(",")}]`}`);
|
|
139
|
+
return `{${parts.join(",")}}`;
|
|
140
|
+
}
|
|
141
|
+
function decodePrecalculatedPath(data) {
|
|
142
|
+
return JSON.parse(data);
|
|
143
|
+
}
|
|
144
|
+
function encodeCBORPolicyInput(v) {
|
|
145
|
+
const out = [];
|
|
146
|
+
appendCBORPolicyInput(out, v);
|
|
147
|
+
return new Uint8Array(out);
|
|
148
|
+
}
|
|
149
|
+
function appendCBORPolicyInput(out, v) {
|
|
150
|
+
let n = 2;
|
|
151
|
+
if (v.sources !== undefined && v.sources.length > 0)
|
|
152
|
+
n++;
|
|
153
|
+
if (v.settings !== undefined && v.settings !== null)
|
|
154
|
+
n++;
|
|
155
|
+
(0, cbor_gen_ts_1.writeHead)(out, 5, n);
|
|
156
|
+
(0, cbor_gen_ts_1.writeText)(out, "graph");
|
|
157
|
+
(0, ir_gen_ts_2.appendCBORIRGraph)(out, v.graph);
|
|
158
|
+
if (v.sources !== undefined && v.sources.length > 0) {
|
|
159
|
+
(0, cbor_gen_ts_1.writeText)(out, "sources");
|
|
160
|
+
{
|
|
161
|
+
const a0 = v.sources;
|
|
162
|
+
(0, cbor_gen_ts_1.writeHead)(out, 4, a0.length);
|
|
163
|
+
for (const ee0 of a0) {
|
|
164
|
+
appendCBORPolicySource(out, ee0);
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
if (v.settings !== undefined && v.settings !== null) {
|
|
169
|
+
(0, cbor_gen_ts_1.writeText)(out, "settings");
|
|
170
|
+
(0, cbor_gen_ts_1.writeBytes)(out, (0, cbor_gen_ts_1.utf8Encode)(JSON.stringify(v.settings)));
|
|
171
|
+
}
|
|
172
|
+
(0, cbor_gen_ts_1.writeText)(out, "precalculated_paths");
|
|
173
|
+
{
|
|
174
|
+
const a0 = v.precalculated_paths;
|
|
175
|
+
(0, cbor_gen_ts_1.writeHead)(out, 4, a0.length);
|
|
176
|
+
for (const ee0 of a0) {
|
|
177
|
+
appendCBORPrecalculatedPath(out, ee0);
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
function decodeCBORPolicyInput(data) {
|
|
182
|
+
const dec = new cbor_gen_ts_1.CborDec(data);
|
|
183
|
+
return decodeCBORPolicyInputFrom(dec);
|
|
184
|
+
}
|
|
185
|
+
function decodeCBORPolicyInputFrom(dec) {
|
|
186
|
+
const o = {};
|
|
187
|
+
const n = dec.readMapHeader();
|
|
188
|
+
for (let i = 0; i < n; i++) {
|
|
189
|
+
const k = dec.readText();
|
|
190
|
+
switch (k) {
|
|
191
|
+
case "graph":
|
|
192
|
+
o["graph"] = (0, ir_gen_ts_2.decodeCBORIRGraphFrom)(dec);
|
|
193
|
+
break;
|
|
194
|
+
case "precalculated_paths":
|
|
195
|
+
o["precalculated_paths"] = (() => { const a = []; const sn = dec.readArrayHeader(); for (let j = 0; j < sn; j++) {
|
|
196
|
+
a.push(decodeCBORPrecalculatedPathFrom(dec));
|
|
197
|
+
} return a; })();
|
|
198
|
+
break;
|
|
199
|
+
case "sources":
|
|
200
|
+
o["sources"] = (() => { const a = []; const sn = dec.readArrayHeader(); for (let j = 0; j < sn; j++) {
|
|
201
|
+
a.push(decodeCBORPolicySourceFrom(dec));
|
|
202
|
+
} return a; })();
|
|
203
|
+
break;
|
|
204
|
+
case "settings":
|
|
205
|
+
o["settings"] = JSON.parse((0, cbor_gen_ts_1.utf8Decode)(dec.readBytes()));
|
|
206
|
+
break;
|
|
207
|
+
default: dec.skip();
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
return o;
|
|
211
|
+
}
|
|
212
|
+
function encodeCBORPolicyOutput(v) {
|
|
213
|
+
const out = [];
|
|
214
|
+
appendCBORPolicyOutput(out, v);
|
|
215
|
+
return new Uint8Array(out);
|
|
216
|
+
}
|
|
217
|
+
function appendCBORPolicyOutput(out, v) {
|
|
218
|
+
let n = 1;
|
|
219
|
+
if (v.error !== undefined && v.error !== "")
|
|
220
|
+
n++;
|
|
221
|
+
(0, cbor_gen_ts_1.writeHead)(out, 5, n);
|
|
222
|
+
if (v.error !== undefined && v.error !== "") {
|
|
223
|
+
(0, cbor_gen_ts_1.writeText)(out, "error");
|
|
224
|
+
(0, cbor_gen_ts_1.writeText)(out, v.error);
|
|
225
|
+
}
|
|
226
|
+
(0, cbor_gen_ts_1.writeText)(out, "results");
|
|
227
|
+
{
|
|
228
|
+
const a0 = v.results;
|
|
229
|
+
(0, cbor_gen_ts_1.writeHead)(out, 4, a0.length);
|
|
230
|
+
for (const ee0 of a0) {
|
|
231
|
+
(0, diagnostic_gen_ts_2.appendCBORDiagnostic)(out, ee0);
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
function decodeCBORPolicyOutput(data) {
|
|
236
|
+
const dec = new cbor_gen_ts_1.CborDec(data);
|
|
237
|
+
return decodeCBORPolicyOutputFrom(dec);
|
|
238
|
+
}
|
|
239
|
+
function decodeCBORPolicyOutputFrom(dec) {
|
|
240
|
+
const o = {};
|
|
241
|
+
const n = dec.readMapHeader();
|
|
242
|
+
for (let i = 0; i < n; i++) {
|
|
243
|
+
const k = dec.readText();
|
|
244
|
+
switch (k) {
|
|
245
|
+
case "results":
|
|
246
|
+
o["results"] = (() => { const a = []; const sn = dec.readArrayHeader(); for (let j = 0; j < sn; j++) {
|
|
247
|
+
a.push((0, diagnostic_gen_ts_2.decodeCBORDiagnosticFrom)(dec));
|
|
248
|
+
} return a; })();
|
|
249
|
+
break;
|
|
250
|
+
case "error":
|
|
251
|
+
o["error"] = dec.readText();
|
|
252
|
+
break;
|
|
253
|
+
default: dec.skip();
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
return o;
|
|
257
|
+
}
|
|
258
|
+
function encodeCBORRenderPolicyInput(v) {
|
|
259
|
+
const out = [];
|
|
260
|
+
appendCBORRenderPolicyInput(out, v);
|
|
261
|
+
return new Uint8Array(out);
|
|
262
|
+
}
|
|
263
|
+
function appendCBORRenderPolicyInput(out, v) {
|
|
264
|
+
let n = 1;
|
|
265
|
+
if (v.sources !== undefined && v.sources.length > 0)
|
|
266
|
+
n++;
|
|
267
|
+
if (v.settings !== undefined && v.settings !== null)
|
|
268
|
+
n++;
|
|
269
|
+
(0, cbor_gen_ts_1.writeHead)(out, 5, n);
|
|
270
|
+
if (v.sources !== undefined && v.sources.length > 0) {
|
|
271
|
+
(0, cbor_gen_ts_1.writeText)(out, "sources");
|
|
272
|
+
{
|
|
273
|
+
const a0 = v.sources;
|
|
274
|
+
(0, cbor_gen_ts_1.writeHead)(out, 4, a0.length);
|
|
275
|
+
for (const ee0 of a0) {
|
|
276
|
+
appendCBORPolicySource(out, ee0);
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
if (v.settings !== undefined && v.settings !== null) {
|
|
281
|
+
(0, cbor_gen_ts_1.writeText)(out, "settings");
|
|
282
|
+
(0, cbor_gen_ts_1.writeBytes)(out, (0, cbor_gen_ts_1.utf8Encode)(JSON.stringify(v.settings)));
|
|
283
|
+
}
|
|
284
|
+
(0, cbor_gen_ts_1.writeText)(out, "artifacts");
|
|
285
|
+
{
|
|
286
|
+
const a0 = v.artifacts;
|
|
287
|
+
(0, cbor_gen_ts_1.writeHead)(out, 4, a0.length);
|
|
288
|
+
for (const ee0 of a0) {
|
|
289
|
+
appendCBORRenderedArtifact(out, ee0);
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
function decodeCBORRenderPolicyInput(data) {
|
|
294
|
+
const dec = new cbor_gen_ts_1.CborDec(data);
|
|
295
|
+
return decodeCBORRenderPolicyInputFrom(dec);
|
|
296
|
+
}
|
|
297
|
+
function decodeCBORRenderPolicyInputFrom(dec) {
|
|
298
|
+
const o = {};
|
|
299
|
+
const n = dec.readMapHeader();
|
|
300
|
+
for (let i = 0; i < n; i++) {
|
|
301
|
+
const k = dec.readText();
|
|
302
|
+
switch (k) {
|
|
303
|
+
case "artifacts":
|
|
304
|
+
o["artifacts"] = (() => { const a = []; const sn = dec.readArrayHeader(); for (let j = 0; j < sn; j++) {
|
|
305
|
+
a.push(decodeCBORRenderedArtifactFrom(dec));
|
|
306
|
+
} return a; })();
|
|
307
|
+
break;
|
|
308
|
+
case "sources":
|
|
309
|
+
o["sources"] = (() => { const a = []; const sn = dec.readArrayHeader(); for (let j = 0; j < sn; j++) {
|
|
310
|
+
a.push(decodeCBORPolicySourceFrom(dec));
|
|
311
|
+
} return a; })();
|
|
312
|
+
break;
|
|
313
|
+
case "settings":
|
|
314
|
+
o["settings"] = JSON.parse((0, cbor_gen_ts_1.utf8Decode)(dec.readBytes()));
|
|
315
|
+
break;
|
|
316
|
+
default: dec.skip();
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
return o;
|
|
320
|
+
}
|
|
321
|
+
function encodeCBORRenderedArtifact(v) {
|
|
322
|
+
const out = [];
|
|
323
|
+
appendCBORRenderedArtifact(out, v);
|
|
324
|
+
return new Uint8Array(out);
|
|
325
|
+
}
|
|
326
|
+
function appendCBORRenderedArtifact(out, v) {
|
|
327
|
+
let n = 2;
|
|
328
|
+
if (v.tree !== undefined && v.tree !== null)
|
|
329
|
+
n++;
|
|
330
|
+
if (v.format !== undefined && v.format !== "")
|
|
331
|
+
n++;
|
|
332
|
+
(0, cbor_gen_ts_1.writeHead)(out, 5, n);
|
|
333
|
+
(0, cbor_gen_ts_1.writeText)(out, "path");
|
|
334
|
+
(0, cbor_gen_ts_1.writeText)(out, v.path);
|
|
335
|
+
if (v.tree !== undefined && v.tree !== null) {
|
|
336
|
+
(0, cbor_gen_ts_1.writeText)(out, "tree");
|
|
337
|
+
(0, cbor_gen_ts_1.writeBytes)(out, (0, cbor_gen_ts_1.utf8Encode)(JSON.stringify(v.tree)));
|
|
338
|
+
}
|
|
339
|
+
if (v.format !== undefined && v.format !== "") {
|
|
340
|
+
(0, cbor_gen_ts_1.writeText)(out, "format");
|
|
341
|
+
(0, cbor_gen_ts_1.writeText)(out, v.format);
|
|
342
|
+
}
|
|
343
|
+
(0, cbor_gen_ts_1.writeText)(out, "content");
|
|
344
|
+
(0, cbor_gen_ts_1.writeText)(out, v.content);
|
|
345
|
+
}
|
|
346
|
+
function decodeCBORRenderedArtifact(data) {
|
|
347
|
+
const dec = new cbor_gen_ts_1.CborDec(data);
|
|
348
|
+
return decodeCBORRenderedArtifactFrom(dec);
|
|
349
|
+
}
|
|
350
|
+
function decodeCBORRenderedArtifactFrom(dec) {
|
|
351
|
+
const o = {};
|
|
352
|
+
const n = dec.readMapHeader();
|
|
353
|
+
for (let i = 0; i < n; i++) {
|
|
354
|
+
const k = dec.readText();
|
|
355
|
+
switch (k) {
|
|
356
|
+
case "path":
|
|
357
|
+
o["path"] = dec.readText();
|
|
358
|
+
break;
|
|
359
|
+
case "content":
|
|
360
|
+
o["content"] = dec.readText();
|
|
361
|
+
break;
|
|
362
|
+
case "tree":
|
|
363
|
+
o["tree"] = JSON.parse((0, cbor_gen_ts_1.utf8Decode)(dec.readBytes()));
|
|
364
|
+
break;
|
|
365
|
+
case "format":
|
|
366
|
+
o["format"] = dec.readText();
|
|
367
|
+
break;
|
|
368
|
+
default: dec.skip();
|
|
369
|
+
}
|
|
370
|
+
}
|
|
371
|
+
return o;
|
|
372
|
+
}
|
|
373
|
+
function encodeCBORPolicySource(v) {
|
|
374
|
+
const out = [];
|
|
375
|
+
appendCBORPolicySource(out, v);
|
|
376
|
+
return new Uint8Array(out);
|
|
377
|
+
}
|
|
378
|
+
function appendCBORPolicySource(out, v) {
|
|
379
|
+
let n = 2;
|
|
380
|
+
(0, cbor_gen_ts_1.writeHead)(out, 5, n);
|
|
381
|
+
(0, cbor_gen_ts_1.writeText)(out, "path");
|
|
382
|
+
(0, cbor_gen_ts_1.writeText)(out, v.path);
|
|
383
|
+
(0, cbor_gen_ts_1.writeText)(out, "content");
|
|
384
|
+
(0, cbor_gen_ts_1.writeText)(out, v.content);
|
|
385
|
+
}
|
|
386
|
+
function decodeCBORPolicySource(data) {
|
|
387
|
+
const dec = new cbor_gen_ts_1.CborDec(data);
|
|
388
|
+
return decodeCBORPolicySourceFrom(dec);
|
|
389
|
+
}
|
|
390
|
+
function decodeCBORPolicySourceFrom(dec) {
|
|
391
|
+
const o = {};
|
|
392
|
+
const n = dec.readMapHeader();
|
|
393
|
+
for (let i = 0; i < n; i++) {
|
|
394
|
+
const k = dec.readText();
|
|
395
|
+
switch (k) {
|
|
396
|
+
case "path":
|
|
397
|
+
o["path"] = dec.readText();
|
|
398
|
+
break;
|
|
399
|
+
case "content":
|
|
400
|
+
o["content"] = dec.readText();
|
|
401
|
+
break;
|
|
402
|
+
default: dec.skip();
|
|
403
|
+
}
|
|
404
|
+
}
|
|
405
|
+
return o;
|
|
406
|
+
}
|
|
407
|
+
function encodeCBORPrecalculatedPath(v) {
|
|
408
|
+
const out = [];
|
|
409
|
+
appendCBORPrecalculatedPath(out, v);
|
|
410
|
+
return new Uint8Array(out);
|
|
411
|
+
}
|
|
412
|
+
function appendCBORPrecalculatedPath(out, v) {
|
|
413
|
+
let n = 3;
|
|
414
|
+
(0, cbor_gen_ts_1.writeHead)(out, 5, n);
|
|
415
|
+
(0, cbor_gen_ts_1.writeText)(out, "nodes");
|
|
416
|
+
{
|
|
417
|
+
const a0 = v.nodes;
|
|
418
|
+
(0, cbor_gen_ts_1.writeHead)(out, 4, a0.length);
|
|
419
|
+
for (const ee0 of a0) {
|
|
420
|
+
(0, cbor_gen_ts_1.writeText)(out, ee0);
|
|
421
|
+
}
|
|
422
|
+
}
|
|
423
|
+
(0, cbor_gen_ts_1.writeText)(out, "path_id");
|
|
424
|
+
(0, cbor_gen_ts_1.writeText)(out, v.path_id);
|
|
425
|
+
(0, cbor_gen_ts_1.writeText)(out, "attached_features");
|
|
426
|
+
{
|
|
427
|
+
const a0 = v.attached_features;
|
|
428
|
+
(0, cbor_gen_ts_1.writeHead)(out, 4, a0.length);
|
|
429
|
+
for (const ee0 of a0) {
|
|
430
|
+
(0, cbor_gen_ts_1.writeText)(out, ee0);
|
|
431
|
+
}
|
|
432
|
+
}
|
|
433
|
+
}
|
|
434
|
+
function decodeCBORPrecalculatedPath(data) {
|
|
435
|
+
const dec = new cbor_gen_ts_1.CborDec(data);
|
|
436
|
+
return decodeCBORPrecalculatedPathFrom(dec);
|
|
437
|
+
}
|
|
438
|
+
function decodeCBORPrecalculatedPathFrom(dec) {
|
|
439
|
+
const o = {};
|
|
440
|
+
const n = dec.readMapHeader();
|
|
441
|
+
for (let i = 0; i < n; i++) {
|
|
442
|
+
const k = dec.readText();
|
|
443
|
+
switch (k) {
|
|
444
|
+
case "path_id":
|
|
445
|
+
o["path_id"] = dec.readText();
|
|
446
|
+
break;
|
|
447
|
+
case "nodes":
|
|
448
|
+
o["nodes"] = (() => { const a = []; const sn = dec.readArrayHeader(); for (let j = 0; j < sn; j++) {
|
|
449
|
+
a.push(dec.readText());
|
|
450
|
+
} return a; })();
|
|
451
|
+
break;
|
|
452
|
+
case "attached_features":
|
|
453
|
+
o["attached_features"] = (() => { const a = []; const sn = dec.readArrayHeader(); for (let j = 0; j < sn; j++) {
|
|
454
|
+
a.push(dec.readText());
|
|
455
|
+
} return a; })();
|
|
456
|
+
break;
|
|
457
|
+
default: dec.skip();
|
|
458
|
+
}
|
|
459
|
+
}
|
|
460
|
+
return o;
|
|
461
|
+
}
|