@hyperscale0/hsx 1.0.332 → 1.0.335
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/dist/src/attachment-economics.d.ts +16 -2
- package/dist/src/attachment-economics.d.ts.map +1 -1
- package/dist/src/attachment-economics.js +58 -2
- package/dist/src/attachment-economics.js.map +1 -1
- package/dist/src/catalog-program.d.ts +7 -0
- package/dist/src/catalog-program.d.ts.map +1 -0
- package/dist/src/catalog-program.js +66 -0
- package/dist/src/catalog-program.js.map +1 -0
- package/dist/src/cli.js +2 -2
- package/dist/src/cli.js.map +1 -1
- package/dist/src/compile.d.ts +5 -0
- package/dist/src/compile.d.ts.map +1 -1
- package/dist/src/compile.js +47 -5
- package/dist/src/compile.js.map +1 -1
- package/dist/src/index.d.ts +2 -1
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +1 -0
- package/dist/src/index.js.map +1 -1
- package/dist/src/parse.js +13 -0
- package/dist/src/parse.js.map +1 -1
- package/dist/src/template-guide.d.ts +57 -0
- package/dist/src/template-guide.d.ts.map +1 -0
- package/dist/src/template-guide.js +435 -0
- package/dist/src/template-guide.js.map +1 -0
- package/docs/README.md +11 -1
- package/package.json +4 -4
- package/src/attachment-economics.ts +77 -2
- package/src/catalog-program.ts +65 -0
- package/src/cli.ts +2 -2
- package/src/compile.ts +73 -8
- package/src/index.ts +7 -0
- package/src/parse.ts +15 -0
- package/src/template-guide.ts +584 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"template-guide.js","sourceRoot":"","sources":["../../src/template-guide.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAC5D,OAAO,EAAE,OAAO,EAAuB,MAAM,cAAc,CAAC;AAC5D,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAC5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AAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAChC,IAAI,IAAI,KAAK,MAAM;QACjB,OAAO,WAAW,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,KAAK,CAAC,QAAQ,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,aAAa,MAAM,CAAC,KAAK,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC;IACrH,IAAI,IAAI,KAAK,KAAK,IAAI,KAAK,CAAC,MAAM;QAAE,OAAO,UAAU,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,EAAE,CAAC;IAC5E,IAAI,IAAI,KAAK,MAAM,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,MAAM,CAAC;QAChD,OAAO,UAAU,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;IAC7C,OAAO,IAAI,CAAC;AACd,CAAC"}
|
package/docs/README.md
CHANGED
|
@@ -459,13 +459,23 @@ attach visit = wallet.spend {
|
|
|
459
459
|
```
|
|
460
460
|
|
|
461
461
|
Name the original action, before its public alias. If it has several moves,
|
|
462
|
-
select a move key, for example `economics pay.move1 { ... }`.
|
|
462
|
+
select a move key, for example `economics pay.move1 { ... }`. A record's
|
|
463
|
+
action takes the record name first: a schedule's payments are
|
|
464
|
+
`economics occurrence.pay { ... }`. The compiler
|
|
463
465
|
refuses an unknown action or move, a repeated selection, a void, or economics
|
|
464
466
|
that conflict with the instrument or its reservation. Cash purposes require
|
|
465
467
|
cash accounts. `sourceParty` resolves a party parameter, a subject role or a
|
|
466
468
|
declared business. The attachment retains this binding even when only economics
|
|
467
469
|
uses it. The credited account supplies the destination participant.
|
|
468
470
|
|
|
471
|
+
Stock transfers, splits and schedules declare no purpose, because the purpose
|
|
472
|
+
depends on how the attach binds its parties. When an attached move that
|
|
473
|
+
creates or reserves money has none, `hsx check` and `composer.check` return an
|
|
474
|
+
`economic_purpose_missing` warning on the attach line. Its fix is the line to
|
|
475
|
+
add, with `earning` when the payee binds `operator`, `participant_payout` when
|
|
476
|
+
the payer does, and `pass_through` otherwise. A warning does not block a
|
|
477
|
+
freeze, but the books leave an unclassified payment out of revenue.
|
|
478
|
+
|
|
469
479
|
The compiler writes the declaration into that attachment's UDL move. Imported
|
|
470
480
|
instruments stay generic. New Builds carry the purpose; existing agreements
|
|
471
481
|
and postings keep their retained Build and classification.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hyperscale0/hsx",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.335",
|
|
4
4
|
"description": "The strictly typed HSX language: compile total financial programs into canonical UDL.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"hsx",
|
|
@@ -90,8 +90,8 @@
|
|
|
90
90
|
"bases:bundle": "bun scripts/bundle-bases.ts"
|
|
91
91
|
},
|
|
92
92
|
"dependencies": {
|
|
93
|
-
"@hyperscale0/adl": "1.0.
|
|
94
|
-
"@hyperscale0/udl": "1.0.
|
|
93
|
+
"@hyperscale0/adl": "1.0.335",
|
|
94
|
+
"@hyperscale0/udl": "1.0.335",
|
|
95
95
|
"fast-sha256": "1.3.0"
|
|
96
96
|
},
|
|
97
97
|
"devDependencies": {
|
|
@@ -103,5 +103,5 @@
|
|
|
103
103
|
"Amir Ayub",
|
|
104
104
|
"Sara AlBakaawi"
|
|
105
105
|
],
|
|
106
|
-
"gitHead": "
|
|
106
|
+
"gitHead": "2e85336429dabd2355badfaa705f708cbe6a715d"
|
|
107
107
|
}
|
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
type UdlDocument,
|
|
7
7
|
type UdlInstrument,
|
|
8
8
|
} from "@hyperscale0/udl";
|
|
9
|
-
import type { Entry, Expr } from "./ast.ts";
|
|
9
|
+
import type { Diagnostic, Entry, Expr, InstrumentDecl } from "./ast.ts";
|
|
10
10
|
import { fail } from "./diagnostics.ts";
|
|
11
11
|
|
|
12
12
|
/** An attachment specializes its own instrument; imported definitions stay generic. */
|
|
@@ -16,6 +16,7 @@ export function applyAttachmentEconomics(
|
|
|
16
16
|
parties: Record<string, AttachmentPartyBinding>,
|
|
17
17
|
declarations: Entry[],
|
|
18
18
|
data: (expression: Expr) => unknown,
|
|
19
|
+
records: readonly string[] = [],
|
|
19
20
|
): void {
|
|
20
21
|
const selected = new Set<object>();
|
|
21
22
|
for (const declaration of declarations) {
|
|
@@ -28,7 +29,7 @@ export function applyAttachmentEconomics(
|
|
|
28
29
|
fail(
|
|
29
30
|
declaration,
|
|
30
31
|
`unknown economics action ${actionName}`,
|
|
31
|
-
`choose ${instrument.actionOrder.join(", ")}, before its public alias`,
|
|
32
|
+
`choose ${instrument.actionOrder.join(", ")}, before its public alias${records.length ? `, or record.action for a record (${records.join(", ")})` : ""}`,
|
|
32
33
|
);
|
|
33
34
|
const move = moveKey
|
|
34
35
|
? action.moves.find((move) => move.key === moveKey)
|
|
@@ -101,3 +102,77 @@ export function applyAttachmentEconomics(
|
|
|
101
102
|
move.economics = economics;
|
|
102
103
|
}
|
|
103
104
|
}
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* A money move an attachment leaves without a purpose books as neither
|
|
108
|
+
* revenue nor a payout. The warning names the economics line to add; its
|
|
109
|
+
* purpose follows the bound parties: earning into the operator, a payout out
|
|
110
|
+
* of it, money passing through otherwise.
|
|
111
|
+
*/
|
|
112
|
+
export function purposeWarnings(
|
|
113
|
+
document: UdlDocument,
|
|
114
|
+
selectors: ReadonlyMap<string, { prefix: string; root: string }>,
|
|
115
|
+
attaches: ReadonlyMap<
|
|
116
|
+
string,
|
|
117
|
+
{ entry: Entry; name: string; template: InstrumentDecl }
|
|
118
|
+
>,
|
|
119
|
+
): Diagnostic[] {
|
|
120
|
+
const warnings: Diagnostic[] = [];
|
|
121
|
+
const bindings = new Map(
|
|
122
|
+
document.objects.flatMap((object) =>
|
|
123
|
+
object.attachments.map((item) => [item.instrument, item.parties]),
|
|
124
|
+
),
|
|
125
|
+
);
|
|
126
|
+
const party = (path: string | undefined) =>
|
|
127
|
+
/^party\.(\w+)$/.exec(path ?? "")?.[1];
|
|
128
|
+
const operator = (name: string | undefined) =>
|
|
129
|
+
name === "operator" || name === "programOperator";
|
|
130
|
+
for (const instrument of document.instruments) {
|
|
131
|
+
const selector = selectors.get(instrument.id);
|
|
132
|
+
const attach = selector && attaches.get(selector.root);
|
|
133
|
+
if (!selector || !attach) continue;
|
|
134
|
+
const parties = bindings.get(instrument.id) ?? {};
|
|
135
|
+
const parameters = attach.template.parameters
|
|
136
|
+
.filter((row) => row.value.kind === "name" && row.value.value === "party")
|
|
137
|
+
.map((row) => row.key);
|
|
138
|
+
// The template's own parameter reads back in the founder's terms.
|
|
139
|
+
const parameter = (name: string) =>
|
|
140
|
+
parameters.find((key) => {
|
|
141
|
+
const binding = parties[key];
|
|
142
|
+
return (
|
|
143
|
+
binding && ("role" in binding ? binding.role : binding.party) === name
|
|
144
|
+
);
|
|
145
|
+
}) ?? name;
|
|
146
|
+
for (const actionName of instrument.actionOrder) {
|
|
147
|
+
const action = instrument.actions[actionName]!;
|
|
148
|
+
for (const move of action.moves) {
|
|
149
|
+
if (
|
|
150
|
+
move.economics ||
|
|
151
|
+
(move.operation !== "internal_transfer.create" &&
|
|
152
|
+
move.operation !== "internal_transfer.reserve")
|
|
153
|
+
)
|
|
154
|
+
continue;
|
|
155
|
+
const path = `${selector.prefix}${actionName}${action.moves.length > 1 ? `.${move.key}` : ""}`;
|
|
156
|
+
const from = party(move.from);
|
|
157
|
+
const to = party(move.to);
|
|
158
|
+
const purpose = operator(to)
|
|
159
|
+
? "earning"
|
|
160
|
+
: operator(from)
|
|
161
|
+
? "participant_payout"
|
|
162
|
+
: "pass_through";
|
|
163
|
+
const source = from ? parameter(from) : (parameters[0] ?? "owner");
|
|
164
|
+
warnings.push({
|
|
165
|
+
code: "economic_purpose_missing",
|
|
166
|
+
message: `${attach.name}: ${path} moves money with no declared purpose, so the books will not count it as revenue or a payout`,
|
|
167
|
+
fix: `add economics ${path} { purpose: ${purpose}, sourceParty: ${source} } inside attach ${attach.name}`,
|
|
168
|
+
// Underline `attach <name>`, the line the declaration goes under.
|
|
169
|
+
span: {
|
|
170
|
+
start: attach.entry.span.start,
|
|
171
|
+
end: attach.entry.span.start + `attach ${attach.name}`.length,
|
|
172
|
+
},
|
|
173
|
+
});
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
return warnings;
|
|
178
|
+
}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* One program that attaches every standard template with bindings the
|
|
3
|
+
* compiler admits. Each template guide takes its example from here, and
|
|
4
|
+
* std-headers.spec proves the whole program compiles.
|
|
5
|
+
*/
|
|
6
|
+
export const catalogProgramSource = `program catalog "Template catalog"
|
|
7
|
+
use money
|
|
8
|
+
use escrow
|
|
9
|
+
use purchase
|
|
10
|
+
use booking
|
|
11
|
+
use marketplace
|
|
12
|
+
use financing
|
|
13
|
+
use insurance
|
|
14
|
+
use lending
|
|
15
|
+
use wallet
|
|
16
|
+
use cards
|
|
17
|
+
use collections
|
|
18
|
+
use savings
|
|
19
|
+
use reporting
|
|
20
|
+
party supplier: business
|
|
21
|
+
party inspector: staff role claim_inspector
|
|
22
|
+
party investor: business
|
|
23
|
+
object item "Item" {
|
|
24
|
+
attach transfer = money.transfer { payer: actor, payee: owner, amount: 750 SAR }
|
|
25
|
+
attach hold = money.hold { payer: actor, payee: owner, amount: 750 SAR }
|
|
26
|
+
attach split = money.split { payer: actor, amount: 750 SAR }
|
|
27
|
+
attach schedule = money.schedule { payer: actor, payee: owner, amount: 750 SAR, count: 3 }
|
|
28
|
+
attach pool = money.pool { payer: actor, payee: owner, target: 1000 SAR, closes: 2027-01-01 }
|
|
29
|
+
attach swap = money.swap { first: actor, second: owner, first_amount: 100 SAR, second_amount: 200 SAR, expires: 2027-01-01 }
|
|
30
|
+
attach payout = money.payout { payer: actor, payee: owner, adapter: "conformance_boundary" }
|
|
31
|
+
attach mandate = money.mandate { payer: actor, payee: owner }
|
|
32
|
+
attach metered = money.metered { payer: actor, payee: owner, unit_price: 10 SAR }
|
|
33
|
+
attach policy = insurance.cover { holder: actor, adapter: "conformance_boundary" }
|
|
34
|
+
attach claim = insurance.claim { cover: policy, inspector: inspector }
|
|
35
|
+
attach cov = insurance.cover { holder: actor, broker: supplier, adapter: "conformance_boundary", covers: sale }
|
|
36
|
+
attach deposit = escrow.hold { payer: actor, payee: owner }
|
|
37
|
+
attach sale = escrow.hold { funding: { controllers: [checkout], reference: "funds", blocking_states: [active] }, payer: actor, payee: owner }
|
|
38
|
+
attach trip = booking.reservation { customer: actor, operator: owner }
|
|
39
|
+
attach limits = financing.limits { borrower: actor, per_borrower: 60000 SAR }
|
|
40
|
+
attach ceiling = financing.portfolio_limit { limit: 1500000 SAR }
|
|
41
|
+
attach checkout = purchase.checkout { plans: plan, funds: sale, borrower: actor, capital: operator }
|
|
42
|
+
attach plan = financing.installments { borrower: actor, capital: operator, months: 3, pricing: flat_total, profit_rate: 2.5%, down_payment: 20%, funds: checkout, limits: limits, portfolio: ceiling }
|
|
43
|
+
attach late = financing.late_charge { on: plan, borrower: actor }
|
|
44
|
+
attach line = financing.credit_line { borrower: operator, adapter: "conformance_boundary", limit: 100000 SAR, expires: 2027-01-01 }
|
|
45
|
+
attach advance = financing.advance { line: line }
|
|
46
|
+
attach case = collections.case { on: plan, agency: supplier }
|
|
47
|
+
attach contact = collections.contact { case: case, agency: supplier }
|
|
48
|
+
attach reminder = collections.reminder { on: plan }
|
|
49
|
+
attach wallet = wallet.balance { holder: investor }
|
|
50
|
+
attach spend = wallet.spend { wallet: wallet, payee: supplier, holder: investor }
|
|
51
|
+
attach round = lending.round { borrower: actor, plan: plan, minimum_ticket: 100 SAR, investor_cap: 100% }
|
|
52
|
+
attach commitment = lending.commitment { round: round, wallet: wallet, investor: investor }
|
|
53
|
+
attach distribution = lending.distribution { round: round, receipt: plan.settlement }
|
|
54
|
+
attach cardholder = cards.cardholder { holder: actor }
|
|
55
|
+
attach card = cards.card { holder: cardholder, person: actor, spend_limit: 5000 SAR }
|
|
56
|
+
attach authorization = cards.authorization { card: card, merchant: supplier }
|
|
57
|
+
attach transaction = cards.transaction { authorization: authorization }
|
|
58
|
+
attach dispute = cards.dispute { transaction: transaction }
|
|
59
|
+
attach listing = marketplace.listing { seller: owner }
|
|
60
|
+
attach order = marketplace.order { listing: listing, buyer: actor }
|
|
61
|
+
attach reservation = marketplace.reservation { listing: listing, funds: sale, converters: checkout, buyer: actor, seller: owner }
|
|
62
|
+
attach circle = savings.circle { contribution: 300 SAR, members: 8, starts: 2027-01-01 }
|
|
63
|
+
attach membership = savings.membership { circle: circle, member: actor }
|
|
64
|
+
attach reports = reporting.portfolio { on: plan }
|
|
65
|
+
}`;
|
package/src/cli.ts
CHANGED
|
@@ -85,9 +85,9 @@ export async function runCli(argv: readonly string[], io: Io): Promise<number> {
|
|
|
85
85
|
text = result.formatted;
|
|
86
86
|
} else {
|
|
87
87
|
const result = compile(source, { standardLibrary });
|
|
88
|
-
for (const d of result.diagnostics)
|
|
88
|
+
for (const d of [...result.diagnostics, ...result.warnings])
|
|
89
89
|
io.err(
|
|
90
|
-
`${d.source && d.source !== "program" ? d.source : file}:${d.line}:${d.column}: ${d.code} ${d.message.replace(/[^.?!]$/, "$&.")} ${d.fix}`,
|
|
90
|
+
`${d.source && d.source !== "program" ? d.source : file}:${d.line}:${d.column}: ${d.severity === "warning" ? "warning " : ""}${d.code} ${d.message.replace(/[^.?!]$/, "$&.")} ${d.fix}`,
|
|
91
91
|
);
|
|
92
92
|
if (!result.artifacts || result.verdict !== "valid") return 1;
|
|
93
93
|
if (command === "check") return 0;
|
package/src/compile.ts
CHANGED
|
@@ -40,7 +40,10 @@ import {
|
|
|
40
40
|
} from "./binding-contract.ts";
|
|
41
41
|
import { tunableBounds } from "./tunables.ts";
|
|
42
42
|
import { parseProgram } from "./parse.ts";
|
|
43
|
-
import {
|
|
43
|
+
import {
|
|
44
|
+
applyAttachmentEconomics,
|
|
45
|
+
purposeWarnings,
|
|
46
|
+
} from "./attachment-economics.ts";
|
|
44
47
|
import { parseHeader } from "./header-source.ts";
|
|
45
48
|
import {
|
|
46
49
|
lineColAt,
|
|
@@ -79,9 +82,14 @@ export interface CompileOptions {
|
|
|
79
82
|
standardLibrary?: StandardLibrary;
|
|
80
83
|
adapterRegistry?: Readonly<Record<string, AdapterBindingTarget>>;
|
|
81
84
|
}
|
|
85
|
+
export interface CompileWarning extends Omit<CompileDiagnostic, "severity"> {
|
|
86
|
+
severity: "warning";
|
|
87
|
+
}
|
|
82
88
|
export interface CompileResult {
|
|
83
89
|
verdict: "valid" | "invalid";
|
|
84
90
|
diagnostics: CompileDiagnostic[];
|
|
91
|
+
/** Advice that does not block a freeze, such as a money move with no purpose. */
|
|
92
|
+
warnings: CompileWarning[];
|
|
85
93
|
artifacts?: {
|
|
86
94
|
document: UdlDocument;
|
|
87
95
|
costManifest: UdlCostManifest;
|
|
@@ -392,8 +400,10 @@ function literal(expr: Expr, expectedType?: string): string | number | boolean {
|
|
|
392
400
|
if (!Number.isSafeInteger(n) || n <= 0)
|
|
393
401
|
fail(
|
|
394
402
|
expr,
|
|
395
|
-
"
|
|
396
|
-
|
|
403
|
+
expr.value.includes(" ")
|
|
404
|
+
? `${expr.value} is not a fixed duration`
|
|
405
|
+
: "invalid duration",
|
|
406
|
+
"write a positive fixed duration such as 48h, 3d or 30d",
|
|
397
407
|
);
|
|
398
408
|
return n;
|
|
399
409
|
}
|
|
@@ -463,6 +473,7 @@ export function compile(
|
|
|
463
473
|
return {
|
|
464
474
|
verdict: "invalid",
|
|
465
475
|
diagnostics: parsed.diagnostics.map((d) => diagnostic(d, "parse")),
|
|
476
|
+
warnings: [],
|
|
466
477
|
};
|
|
467
478
|
const program = parsed.program;
|
|
468
479
|
const bindingDiagnostics: Diagnostic[] = [];
|
|
@@ -489,6 +500,15 @@ export function compile(
|
|
|
489
500
|
"write currency SAR or omit currency",
|
|
490
501
|
);
|
|
491
502
|
const templates = new Map<string, InstrumentDecl>();
|
|
503
|
+
// Attached instruments, for the warning on a money move with no purpose.
|
|
504
|
+
const attachedSelectors = new Map<
|
|
505
|
+
string,
|
|
506
|
+
{ prefix: string; root: string }
|
|
507
|
+
>();
|
|
508
|
+
const attachEntries = new Map<
|
|
509
|
+
string,
|
|
510
|
+
{ entry: Entry; name: string; template: InstrumentDecl }
|
|
511
|
+
>();
|
|
492
512
|
const declarationSources = new Map<InstrumentDecl, string>();
|
|
493
513
|
const standardOrigins = new Map<
|
|
494
514
|
InstrumentDecl,
|
|
@@ -746,6 +766,11 @@ export function compile(
|
|
|
746
766
|
attachments: UdlObjectAttachment[];
|
|
747
767
|
economics: Entry[];
|
|
748
768
|
child?: boolean;
|
|
769
|
+
/** How an economics selector names this instrument: "" or "occurrence.". */
|
|
770
|
+
selectorPrefix?: string;
|
|
771
|
+
rootInstrument?: string;
|
|
772
|
+
/** The template as the founder wrote it, such as money.schedule. */
|
|
773
|
+
template?: string;
|
|
749
774
|
},
|
|
750
775
|
familyDeclaration?: {
|
|
751
776
|
module: string;
|
|
@@ -933,6 +958,7 @@ export function compile(
|
|
|
933
958
|
enums.set(parameter.key, type.args.map(text));
|
|
934
959
|
}
|
|
935
960
|
const supplied = new Map<string, Expr>();
|
|
961
|
+
const suppliedEntries = new Map<string, Entry>();
|
|
936
962
|
for (const entry of arguments_.entries) {
|
|
937
963
|
if (supplied.has(entry.key))
|
|
938
964
|
fail(
|
|
@@ -941,6 +967,7 @@ export function compile(
|
|
|
941
967
|
"supply each parameter once",
|
|
942
968
|
);
|
|
943
969
|
supplied.set(entry.key, entry.value);
|
|
970
|
+
suppliedEntries.set(entry.key, entry);
|
|
944
971
|
}
|
|
945
972
|
const environment = new Map<string, Expr>(inherited);
|
|
946
973
|
const parameterErrors: Diagnostic[] = [];
|
|
@@ -1082,10 +1109,11 @@ export function compile(
|
|
|
1082
1109
|
`Remove \`${key}\`. To use your object's money field, add \`rename { ${field}: ${target} }\`.`,
|
|
1083
1110
|
);
|
|
1084
1111
|
}
|
|
1112
|
+
const tunables = decl.parameters.map((p) => p.key);
|
|
1085
1113
|
fail(
|
|
1086
|
-
suppliedValue,
|
|
1087
|
-
|
|
1088
|
-
`
|
|
1114
|
+
suppliedEntries.get(key) ?? suppliedValue,
|
|
1115
|
+
`${assignments.get(id)?.target ?? attachmentInfo?.template ?? decl.name} has no tunable "${key}".${didYouMean(key, tunables)} Tunables: ${tunables.join(", ")}`,
|
|
1116
|
+
`remove ${key}, or set one of ${tunables.join(", ")}`,
|
|
1089
1117
|
);
|
|
1090
1118
|
}
|
|
1091
1119
|
const isParty = (name: string) =>
|
|
@@ -3205,14 +3233,39 @@ export function compile(
|
|
|
3205
3233
|
);
|
|
3206
3234
|
if (receipt) move.transfer = `self.${receipt}`;
|
|
3207
3235
|
}
|
|
3208
|
-
|
|
3236
|
+
// `economics occurrence.pay` classifies a record's move; an action of
|
|
3237
|
+
// the attached instrument wins over a record of the same name.
|
|
3238
|
+
const recordEconomics = new Map<string, Entry[]>();
|
|
3239
|
+
if (attachmentInfo) {
|
|
3240
|
+
const own: Entry[] = [];
|
|
3241
|
+
for (const declaration of attachmentInfo.economics) {
|
|
3242
|
+
const [first = "", ...rest] = declaration.key
|
|
3243
|
+
.slice("economics ".length)
|
|
3244
|
+
.split(".");
|
|
3245
|
+
if (
|
|
3246
|
+
rest.length &&
|
|
3247
|
+
!Object.hasOwn(inst.actions, first) &&
|
|
3248
|
+
records.has(first)
|
|
3249
|
+
)
|
|
3250
|
+
recordEconomics.set(first, [
|
|
3251
|
+
...(recordEconomics.get(first) ?? []),
|
|
3252
|
+
{ ...declaration, key: `economics ${rest.join(".")}` },
|
|
3253
|
+
]);
|
|
3254
|
+
else own.push(declaration);
|
|
3255
|
+
}
|
|
3209
3256
|
applyAttachmentEconomics(
|
|
3210
3257
|
document,
|
|
3211
3258
|
inst,
|
|
3212
3259
|
attachmentInfo.parties,
|
|
3213
|
-
|
|
3260
|
+
own,
|
|
3214
3261
|
data,
|
|
3262
|
+
[...records.keys()],
|
|
3215
3263
|
);
|
|
3264
|
+
attachedSelectors.set(inst.id, {
|
|
3265
|
+
prefix: attachmentInfo.selectorPrefix ?? "",
|
|
3266
|
+
root: attachmentInfo.rootInstrument ?? inst.id,
|
|
3267
|
+
});
|
|
3268
|
+
}
|
|
3216
3269
|
for (const key of [
|
|
3217
3270
|
"invariants",
|
|
3218
3271
|
"reports",
|
|
@@ -3292,6 +3345,9 @@ export function compile(
|
|
|
3292
3345
|
attachmentName: `${attachmentInfo.attachmentName}_${key}`,
|
|
3293
3346
|
child: true,
|
|
3294
3347
|
exposed: new Map<string, string>(),
|
|
3348
|
+
economics: recordEconomics.get(key) ?? [],
|
|
3349
|
+
selectorPrefix: `${attachmentInfo.selectorPrefix ?? ""}${key}.`,
|
|
3350
|
+
rootInstrument: attachmentInfo.rootInstrument ?? id,
|
|
3295
3351
|
}
|
|
3296
3352
|
: undefined;
|
|
3297
3353
|
if (childAttachment)
|
|
@@ -3450,6 +3506,7 @@ export function compile(
|
|
|
3450
3506
|
|
|
3451
3507
|
const parties: Record<string, AttachmentPartyBinding> = {};
|
|
3452
3508
|
attachments.push({ name: attachmentName, instrument: instId, parties });
|
|
3509
|
+
attachEntries.set(instId, { entry, name: attachmentName, template });
|
|
3453
3510
|
|
|
3454
3511
|
const tunableBlock: BlockExpr = {
|
|
3455
3512
|
kind: "block",
|
|
@@ -3475,6 +3532,7 @@ export function compile(
|
|
|
3475
3532
|
parties,
|
|
3476
3533
|
attachments,
|
|
3477
3534
|
economics,
|
|
3535
|
+
template: targetTemplate,
|
|
3478
3536
|
},
|
|
3479
3537
|
templateFamily ? { ...templateFamily } : undefined,
|
|
3480
3538
|
standardOrigins.get(template),
|
|
@@ -3689,6 +3747,7 @@ export function compile(
|
|
|
3689
3747
|
if (bindingDiagnostics.length)
|
|
3690
3748
|
return {
|
|
3691
3749
|
verdict: "invalid",
|
|
3750
|
+
warnings: [],
|
|
3692
3751
|
diagnostics: distinct(bindingDiagnostics)
|
|
3693
3752
|
.sort((a, b) => a.span.start - b.span.start)
|
|
3694
3753
|
.map((d) => diagnostic(d, "check")),
|
|
@@ -4500,6 +4559,7 @@ export function compile(
|
|
|
4500
4559
|
if (collisions.length)
|
|
4501
4560
|
return {
|
|
4502
4561
|
verdict: "invalid",
|
|
4562
|
+
warnings: [],
|
|
4503
4563
|
diagnostics: collisions
|
|
4504
4564
|
.sort((a, b) => a.span.start - b.span.start)
|
|
4505
4565
|
.map((d) => diagnostic(d, "check")),
|
|
@@ -4577,6 +4637,7 @@ export function compile(
|
|
|
4577
4637
|
if (!validated.ok)
|
|
4578
4638
|
return {
|
|
4579
4639
|
verdict: "invalid",
|
|
4640
|
+
warnings: [],
|
|
4580
4641
|
diagnostics: issues.map((i) => {
|
|
4581
4642
|
const origin = [...origins]
|
|
4582
4643
|
.reverse()
|
|
@@ -4652,6 +4713,9 @@ export function compile(
|
|
|
4652
4713
|
return {
|
|
4653
4714
|
verdict: "valid",
|
|
4654
4715
|
diagnostics: [],
|
|
4716
|
+
warnings: purposeWarnings(document, attachedSelectors, attachEntries).map(
|
|
4717
|
+
(d) => ({ ...diagnostic(d, "check"), severity: "warning" }),
|
|
4718
|
+
),
|
|
4655
4719
|
artifacts: {
|
|
4656
4720
|
document: validated.value,
|
|
4657
4721
|
costManifest: buildUdlCostManifest(validated.value),
|
|
@@ -4662,6 +4726,7 @@ export function compile(
|
|
|
4662
4726
|
if (error instanceof CompileFailure)
|
|
4663
4727
|
return {
|
|
4664
4728
|
verdict: "invalid",
|
|
4729
|
+
warnings: [],
|
|
4665
4730
|
diagnostics: distinct([...bindingDiagnostics, error.diagnostic]).map(
|
|
4666
4731
|
(d) => diagnostic(d, "check"),
|
|
4667
4732
|
),
|
package/src/index.ts
CHANGED
|
@@ -3,6 +3,7 @@ export {
|
|
|
3
3
|
type CompileDiagnostic,
|
|
4
4
|
type CompileOptions,
|
|
5
5
|
type CompileResult,
|
|
6
|
+
type CompileWarning,
|
|
6
7
|
type CompileOriginMapEntry,
|
|
7
8
|
type AdapterBindingTarget,
|
|
8
9
|
} from "./compile.ts";
|
|
@@ -24,3 +25,9 @@ export type {
|
|
|
24
25
|
} from "./ast.ts";
|
|
25
26
|
|
|
26
27
|
export { headerManifest, HEADER_NAMES } from "./headers.ts";
|
|
28
|
+
export {
|
|
29
|
+
templateGuide,
|
|
30
|
+
templateIndex,
|
|
31
|
+
type TemplateGuide,
|
|
32
|
+
type TemplateIndexEntry,
|
|
33
|
+
} from "./template-guide.ts";
|
package/src/parse.ts
CHANGED
|
@@ -514,6 +514,21 @@ class Parser {
|
|
|
514
514
|
};
|
|
515
515
|
if (/[a-z]$/.test(token.text))
|
|
516
516
|
return { kind: "duration", value: token.text, span: token.span };
|
|
517
|
+
// `1 month` reads as one value, so the checker names the tunable it
|
|
518
|
+
// was given to instead of failing on the next line. A unit followed by
|
|
519
|
+
// `:` is the next entry's key, as in `count: 2` then `months: 2`.
|
|
520
|
+
if (
|
|
521
|
+
/^(?:minute|hour|day|week|month|year)s?$/.test(this.peek().text) &&
|
|
522
|
+
this.peek().kind === "name" &&
|
|
523
|
+
this.tokens[this.index + 1]?.text !== ":"
|
|
524
|
+
) {
|
|
525
|
+
const unit = this.take().text;
|
|
526
|
+
return {
|
|
527
|
+
kind: "duration",
|
|
528
|
+
value: `${token.text} ${unit}`,
|
|
529
|
+
span: this.span(start),
|
|
530
|
+
};
|
|
531
|
+
}
|
|
517
532
|
if (/^[A-Z]{3}$/.test(this.peek().text)) {
|
|
518
533
|
const currency = this.take().text;
|
|
519
534
|
return {
|