@hyperscale0/hsx 1.0.248 → 1.0.256
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 +2 -3
- package/SECURITY.md +1 -1
- package/dist/src/compile.d.ts.map +1 -1
- package/dist/src/compile.js +16 -0
- package/dist/src/compile.js.map +1 -1
- package/docs/README.md +7 -127
- package/examples/cost-table.json +0 -492
- package/package.json +4 -4
- package/src/compile.ts +27 -0
package/README.md
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
# HSX
|
|
2
2
|
|
|
3
|
+
Read [how Hyperscale fits](https://hyperscale0.ai/docs/runtime.md#how-hyperscale-fits) for provider authority and the shared operation API.
|
|
4
|
+
|
|
3
5
|
HSX is a typed composition language for a company's objects, agreements and
|
|
4
6
|
actions. Programs can model a repair approval, a rental deposit or a financing
|
|
5
7
|
plan. The compiler produces canonical UDL for an executor. It executes no actions.
|
|
6
|
-
A program declares what a company needs from its providers, such as a lender
|
|
7
|
-
funding a loan or an insurer issuing a policy. Providers do the originating,
|
|
8
|
-
underwriting and paying out through ADL adapters; HSX never does their job.
|
|
9
8
|
This release supports SAR.
|
|
10
9
|
|
|
11
10
|
## Start here
|
package/SECURITY.md
CHANGED
|
@@ -19,7 +19,7 @@ This compiler reads untrusted source and emits a document a runtime then
|
|
|
19
19
|
executes, so the interesting failures are the ones a source file can cause:
|
|
20
20
|
|
|
21
21
|
- **A program that compiles but should not**, especially one whose emitted
|
|
22
|
-
pieces do not partition their total, whose exits do not drain
|
|
22
|
+
pieces do not partition their total, whose exits do not drain instance-owned ledger accounts, or
|
|
23
23
|
whose fees move money the source did not authorise. A `valid` verdict on an
|
|
24
24
|
unsound program is the worst bug this package can have.
|
|
25
25
|
- **A program that makes the lexer, parser, checker, or lowering burn
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compile.d.ts","sourceRoot":"","sources":["../../src/compile.ts"],"names":[],"mappings":"AAOA,OAAO,E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,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,CAk7Hf"}
|
package/dist/src/compile.js
CHANGED
|
@@ -1900,6 +1900,22 @@ export function compile(source, options = {}) {
|
|
|
1900
1900
|
rate.kind !== "percent")
|
|
1901
1901
|
fail(rate, "split needs party percentages", "write party_name: 70%");
|
|
1902
1902
|
total += Number(literal(rate));
|
|
1903
|
+
const recipientRole = subjectPartyRoles.includes(recipient.value);
|
|
1904
|
+
if (attachmentInfo &&
|
|
1905
|
+
(recipientRole ||
|
|
1906
|
+
document.parties[recipient.value]?.kind ===
|
|
1907
|
+
"business") &&
|
|
1908
|
+
!Object.values(attachmentInfo.parties).some((binding) => ("role" in binding &&
|
|
1909
|
+
binding.role === recipient.value) ||
|
|
1910
|
+
("party" in binding &&
|
|
1911
|
+
binding.party === recipient.value))) {
|
|
1912
|
+
let binding = "splitRecipient";
|
|
1913
|
+
for (let index = 2; Object.hasOwn(attachmentInfo.parties, binding); index++)
|
|
1914
|
+
binding = `splitRecipient${index}`;
|
|
1915
|
+
attachmentInfo.parties[binding] = recipientRole
|
|
1916
|
+
? { role: recipient.value }
|
|
1917
|
+
: { party: recipient.value };
|
|
1918
|
+
}
|
|
1903
1919
|
const target = `${name}_${key}_share${index + 1}`;
|
|
1904
1920
|
if (fields.some((f) => f.name === target))
|
|
1905
1921
|
fail(move, "split field name conflicts", "rename the move key");
|