@hyperscale0/hsx 5.5.0 → 5.6.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/CHANGELOG.md +6 -0
- package/dist/src/compile.d.ts +5 -0
- package/dist/src/compile.d.ts.map +1 -1
- package/dist/src/compile.js +25 -4
- package/dist/src/compile.js.map +1 -1
- package/dist/src/std-bundle.js +1 -1
- package/dist/src/std-bundle.js.map +1 -1
- package/dist/src/version.d.ts +1 -1
- package/dist/src/version.js +1 -1
- package/package.json +3 -3
- package/src/compile.ts +32 -0
- package/src/std-bundle.ts +1 -1
- package/src/version.ts +1 -1
- package/std/travel.hsx +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
# HSX 5.6.0
|
|
2
|
+
|
|
3
|
+
The compiler records the standard block origin of every instrument compiled
|
|
4
|
+
from a bundled std header: block key, record path and header digest. Travel
|
|
5
|
+
booking cancellations declare `purpose: option`. Follows UDL 4.8.0.
|
|
6
|
+
|
|
1
7
|
# HSX 5.5.0
|
|
2
8
|
|
|
3
9
|
Std money moves declare posted economic purposes. Fee legs and recipient choices
|
package/dist/src/compile.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compile.d.ts","sourceRoot":"","sources":["../../src/compile.ts"],"names":[],"mappings":"AAEA,OAAO,EAAwB,KAAK,eAAe,EAAE,MAAM,WAAW,CAAC;AACvE,OAAO,EAeL,KAAK,WAAW,EAOjB,MAAM,kBAAkB,CAAC;AAS1B,OAAO,EAIL,KAAK,UAAU,EAKf,KAAK,IAAI,EACV,MAAM,UAAU,CAAC;AAClB,OAAO,EAA0B,KAAK,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAEhF,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAExD,MAAM,WAAW,iBAAkB,SAAQ,UAAU;IACnD,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,E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Ac;IAC7B,eAAe,CAAC,EAAE,eAAe,CAAC;IAClC,eAAe,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,oBAAoB,CAAC,CAAC,CAAC;CAClE;AACD,MAAM,WAAW,aAAa;IAC5B,OAAO,EAAE,OAAO,GAAG,SAAS,CAAC;IAC7B,WAAW,EAAE,iBAAiB,EAAE,CAAC;IACjC,SAAS,CAAC,EAAE;QACV,QAAQ,EAAE,WAAW,CAAC;QACtB,YAAY,EAAE,eAAe,CAAC;QAC9B,SAAS,EAAE,qBAAqB,EAAE,CAAC;KACpC,CAAC;CACH;AAqTD,wBAAgB,OAAO,CACrB,MAAM,EAAE,MAAM,EACd,OAAO,GAAE,cAAmB,GAC3B,aAAa,CAktGf"}
|
package/dist/src/compile.js
CHANGED
|
@@ -277,6 +277,7 @@ export function compile(source, options = {}) {
|
|
|
277
277
|
fail(program, "this release supports SAR", "write currency SAR or omit currency");
|
|
278
278
|
const templates = new Map();
|
|
279
279
|
const declarationSources = new Map();
|
|
280
|
+
const standardOrigins = new Map();
|
|
280
281
|
const requirementOrigins = new Map();
|
|
281
282
|
const used = new Set();
|
|
282
283
|
for (const use of program.decls.filter((d) => d.kind === "use")) {
|
|
@@ -287,6 +288,10 @@ export function compile(source, options = {}) {
|
|
|
287
288
|
if (!content)
|
|
288
289
|
fail(use, `unknown header ${use.name}`, "choose a published header");
|
|
289
290
|
sources.set(use.name, content);
|
|
291
|
+
const bundled = bundledStandardLibrary.source(use.name);
|
|
292
|
+
const headerDigest = bundled === content
|
|
293
|
+
? Array.from(sha256(new TextEncoder().encode(content)), (byte) => byte.toString(16).padStart(2, "0")).join("")
|
|
294
|
+
: undefined;
|
|
290
295
|
let header;
|
|
291
296
|
try {
|
|
292
297
|
header = parseHeader(content, use.name);
|
|
@@ -310,6 +315,14 @@ export function compile(source, options = {}) {
|
|
|
310
315
|
fail(parentDecl, `duplicate instrument ${prefix}`, "give each instrument a distinct name");
|
|
311
316
|
templates.set(prefix, parentDecl);
|
|
312
317
|
declarationSources.set(parentDecl, use.name);
|
|
318
|
+
if (headerDigest) {
|
|
319
|
+
const [, root, ...record] = prefix.split(".");
|
|
320
|
+
standardOrigins.set(parentDecl, {
|
|
321
|
+
key: `${use.name}.${root}`,
|
|
322
|
+
recordPath: record.join("."),
|
|
323
|
+
headerDigest,
|
|
324
|
+
});
|
|
325
|
+
}
|
|
313
326
|
const recs = entries(asBlock(entries(parentDecl.body).get("records")));
|
|
314
327
|
for (const [recName, recBlock] of recs) {
|
|
315
328
|
const recDecl = {
|
|
@@ -441,7 +454,7 @@ export function compile(source, options = {}) {
|
|
|
441
454
|
}
|
|
442
455
|
return { module: moduleName, exportPath, revision };
|
|
443
456
|
};
|
|
444
|
-
const addInstrument = (decl, id, arguments_, origin, inherited = new Map(), inheritedEnums = new Map(), attachmentInfo, familyDeclaration) => {
|
|
457
|
+
const addInstrument = (decl, id, arguments_, origin, inherited = new Map(), inheritedEnums = new Map(), attachmentInfo, familyDeclaration, standardOrigin) => {
|
|
445
458
|
const resolveFamilyInstruments = (family, currentInstId, expr) => {
|
|
446
459
|
const found = new Set();
|
|
447
460
|
if (currentInstId && familyDeclaration) {
|
|
@@ -2037,6 +2050,7 @@ export function compile(source, options = {}) {
|
|
|
2037
2050
|
origins.push({
|
|
2038
2051
|
path: `$.instruments[${document.instruments.length}]`,
|
|
2039
2052
|
span: { ...origin, ...lineColAt(source, origin.start) },
|
|
2053
|
+
...(standardOrigin ? { standardBlock: standardOrigin } : {}),
|
|
2040
2054
|
});
|
|
2041
2055
|
if (familyDeclaration && familyDeclaration.revision !== undefined) {
|
|
2042
2056
|
inst.family = {
|
|
@@ -2082,7 +2096,14 @@ export function compile(source, options = {}) {
|
|
|
2082
2096
|
addInstrument(child, `${id}_${key}`, emptyBlock, origin, new Map([
|
|
2083
2097
|
...environment,
|
|
2084
2098
|
["parent", { kind: "name", value: id, span: origin }],
|
|
2085
|
-
]), enums, childAttachment, childFamily
|
|
2099
|
+
]), enums, childAttachment, childFamily, standardOrigin
|
|
2100
|
+
? {
|
|
2101
|
+
...standardOrigin,
|
|
2102
|
+
recordPath: [standardOrigin.recordPath, key]
|
|
2103
|
+
.filter(Boolean)
|
|
2104
|
+
.join("."),
|
|
2105
|
+
}
|
|
2106
|
+
: undefined);
|
|
2086
2107
|
}
|
|
2087
2108
|
};
|
|
2088
2109
|
const compileObject = (decl) => {
|
|
@@ -2170,7 +2191,7 @@ export function compile(source, options = {}) {
|
|
|
2170
2191
|
exposed,
|
|
2171
2192
|
parties,
|
|
2172
2193
|
attachments,
|
|
2173
|
-
}, templateFamily ? { ...templateFamily } : undefined);
|
|
2194
|
+
}, templateFamily ? { ...templateFamily } : undefined, standardOrigins.get(template));
|
|
2174
2195
|
}
|
|
2175
2196
|
catch (error) {
|
|
2176
2197
|
if (!(error instanceof CompileFailure))
|
|
@@ -2268,7 +2289,7 @@ export function compile(source, options = {}) {
|
|
|
2268
2289
|
if (!template)
|
|
2269
2290
|
fail(decl, `unknown instrument ${decl.target}`, `add use ${decl.target.split(".")[0]} and choose a declared instrument`);
|
|
2270
2291
|
const templateFamily = resolveFamily(decl.target, decl, false);
|
|
2271
|
-
addInstrument(template, decl.name, decl.body, decl.span, new Map(), new Map(), undefined, templateFamily ? { ...templateFamily } : undefined);
|
|
2292
|
+
addInstrument(template, decl.name, decl.body, decl.span, new Map(), new Map(), undefined, templateFamily ? { ...templateFamily } : undefined, standardOrigins.get(template));
|
|
2272
2293
|
}
|
|
2273
2294
|
if (decl.kind === "object") {
|
|
2274
2295
|
compileObject(decl);
|