@hyperscale0/hsx 1.0.337 → 1.0.338

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.
@@ -16,4 +16,22 @@ export declare function purposeWarnings(document: UdlDocument, selectors: Readon
16
16
  name: string;
17
17
  template: InstrumentDecl;
18
18
  }>): Diagnostic[];
19
+ /**
20
+ * A move whose payer and payee resolve to one party pays nobody. `actor` is
21
+ * whoever runs the attachment's create, so a create bound to a party pins it:
22
+ * in money.schedule the payee runs create, and `payer: actor` is the payee.
23
+ * Without a pinned create, `actor` against `operator` is the company paying
24
+ * itself whenever the company runs create; that is only known at run time.
25
+ */
26
+ export declare function samePartyMoves(document: UdlDocument, selectors: ReadonlyMap<string, {
27
+ prefix: string;
28
+ root: string;
29
+ }>, attaches: ReadonlyMap<string, {
30
+ entry: Entry;
31
+ name: string;
32
+ template: InstrumentDecl;
33
+ }>): {
34
+ errors: Diagnostic[];
35
+ warnings: Diagnostic[];
36
+ };
19
37
  //# sourceMappingURL=attachment-economics.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"attachment-economics.d.ts","sourceRoot":"","sources":["../../src/attachment-economics.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,sBAAsB,EAE3B,KAAK,WAAW,EAChB,KAAK,aAAa,EACnB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE,IAAI,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAGxE,uFAAuF;AACvF,wBAAgB,wBAAwB,CACtC,QAAQ,EAAE,WAAW,EACrB,UAAU,EAAE,aAAa,EACzB,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,sBAAsB,CAAC,EAC/C,YAAY,EAAE,KAAK,EAAE,EACrB,IAAI,EAAE,CAAC,UAAU,EAAE,IAAI,KAAK,OAAO,EACnC,OAAO,GAAE,SAAS,MAAM,EAAO,GAC9B,IAAI,CAoFN;AAED;;;;;G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Dd;AAED;;;;;;GAMG;AACH,wBAAgB,cAAc,CAC5B,QAAQ,EAAE,WAAW,EACrB,SAAS,EAAE,WAAW,CAAC,MAAM,EAAE;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC,EAChE,QAAQ,EAAE,WAAW,CACnB,MAAM,EACN;IAAE,KAAK,EAAE,KAAK,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,cAAc,CAAA;CAAE,CACzD,GACA;IAAE,MAAM,EAAE,UAAU,EAAE,CAAC;IAAC,QAAQ,EAAE,UAAU,EAAE,CAAA;CAAE,CAuFlD"}
@@ -108,4 +108,86 @@ export function purposeWarnings(document, selectors, attaches) {
108
108
  }
109
109
  return warnings;
110
110
  }
111
+ /**
112
+ * A move whose payer and payee resolve to one party pays nobody. `actor` is
113
+ * whoever runs the attachment's create, so a create bound to a party pins it:
114
+ * in money.schedule the payee runs create, and `payer: actor` is the payee.
115
+ * Without a pinned create, `actor` against `operator` is the company paying
116
+ * itself whenever the company runs create; that is only known at run time.
117
+ */
118
+ export function samePartyMoves(document, selectors, attaches) {
119
+ const errors = [];
120
+ const warnings = [];
121
+ const bindings = new Map(document.objects.flatMap((object) => object.attachments.map((item) => [item.instrument, item.parties])));
122
+ const party = (path) => /^party\.(\w+)$/.exec(path ?? "")?.[1];
123
+ const normal = (name) => name === "programOperator" ||
124
+ document.parties[name]?.role === "program_operator"
125
+ ? "operator"
126
+ : name;
127
+ const seen = new Set();
128
+ for (const instrument of document.instruments) {
129
+ const selector = selectors.get(instrument.id);
130
+ const attach = selector && attaches.get(selector.root);
131
+ if (!selector || !attach)
132
+ continue;
133
+ const parties = bindings.get(selector.root) ?? {};
134
+ // The template's own parameter, as the founder bound it.
135
+ const parameter = (name) => Object.entries(parties).find(([, binding]) => [name, normal(name)].includes(normal("role" in binding ? binding.role : binding.party)))?.[0];
136
+ const spell = (name) => {
137
+ const key = parameter(name);
138
+ return key && key !== name ? `${key}: ${name}` : name;
139
+ };
140
+ const creator = document.instruments.find((item) => item.id === selector.root)?.actions.create?.actor;
141
+ const pinned = typeof creator === "object" && "party" in creator
142
+ ? normal(creator.party)
143
+ : undefined;
144
+ const runsCreate = pinned && pinned !== "actor" ? pinned : undefined;
145
+ for (const actionName of instrument.actionOrder) {
146
+ for (const move of instrument.actions[actionName].moves) {
147
+ const from = "from" in move ? party(move.from) : undefined;
148
+ const to = "to" in move ? party(move.to) : undefined;
149
+ if (!from || !to)
150
+ continue;
151
+ const payer = normal(from);
152
+ const payee = normal(to);
153
+ const resolve = (name) => name === "actor" && runsCreate ? runsCreate : name;
154
+ const key = `${attach.name}:${payer}:${payee}`;
155
+ if (seen.has(key))
156
+ continue;
157
+ const path = `${selector.prefix}${actionName}`;
158
+ const span = {
159
+ start: attach.entry.span.start,
160
+ end: attach.entry.span.start + `attach ${attach.name}`.length,
161
+ };
162
+ if (resolve(payer) === resolve(payee)) {
163
+ seen.add(key);
164
+ const via = payer !== payee
165
+ ? ` ${parameter(runsCreate) ?? runsCreate} runs create, so actor is ${runsCreate}.`
166
+ : "";
167
+ errors.push({
168
+ code: "same_party_move",
169
+ message: `${attach.name}: ${path} moves money from ${spell(from)} to ${spell(to)}, and both are ${resolve(payer)}.${via} A party cannot pay itself.`,
170
+ fix: `Bind the paying and receiving parties to different roles, such as ${parameter(from) ?? "payer"}: owner and ${parameter(to) ?? "payee"}: operator for a customer paying the company.`,
171
+ span,
172
+ });
173
+ }
174
+ else if (
175
+ // A template's own programOperator leg, such as a fee, is the
176
+ // template's design; warn on the founder's operator binding.
177
+ !runsCreate &&
178
+ [from, to].includes("actor") &&
179
+ [from, to].includes("operator")) {
180
+ seen.add(key);
181
+ warnings.push({
182
+ code: "same_party_move",
183
+ message: `${attach.name}: ${path} moves money from ${spell(from)} to ${spell(to)}. When the company runs create itself, actor is the company and it pays itself.`,
184
+ fix: `Run create on behalf of a customer, or bind ${parameter("actor") ?? "the paying party"}: owner if the record's owner pays.`,
185
+ span,
186
+ });
187
+ }
188
+ }
189
+ }
190
+ }
191
+ return { errors, warnings };
192
+ }
111
193
  //# sourceMappingURL=attachment-economics.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"attachment-economics.js","sourceRoot":"","sources":["../../src/attachment-economics.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,iBAAiB,EACjB,aAAa,GAKd,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAExC,uFAAuF;AACvF,MAAM,UAAU,wBAAwB,CACtC,QAAqB,EACrB,UAAyB,EACzB,OAA+C,EAC/C,YAAqB,EACrB,IAAmC,EACnC,OAAO,GAAsB,EAAE;IAE/B,MAAM,QAAQ,GAAG,IAAI,GAAG,EAAU,CAAC;IACnC,KAAK,MAAM,WAAW,IAAI,YAAY,EAAE,CAAC;QACvC,MAAM,QAAQ,GAAG,WAAW,CAAC,GAAG,CAAC,KAAK,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC;QAC5D,MAAM,CAAC,UAAU,EAAE,OAAO,EAAE,KAAK,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QACzD,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,UAAU,CAAC,OAAO,EAAE,UAAW,CAAC;YAC3D,CAAC,CAAC,UAAU,CAAC,OAAO,CAAC,UAAW,CAAC;YACjC,CAAC,CAAC,SAAS,CAAC;QACd,IAAI,CAAC,MAAM;YACT,IAAI,CACF,WAAW,EACX,4BAA4B,UAAU,EAAE,EACxC,UAAU,UAAU,CAAC,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,4BAA4B,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,oCAAoC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CACzJ,CAAC;QACJ,MAAM,IAAI,GAAG,OAAO;YAClB,CAAC,CAAC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AAM,CAAC,IAAI,CAAC;wBACV,IAAI,EAAE,iBAAiB;wBACvB,OAAO,EAAE,GAAG,MAAM,CAAC,IAAI,KAAK,IAAI,qBAAqB,KAAK,CAAC,IAAI,CAAC,OAAO,KAAK,CAAC,EAAE,CAAC,kBAAkB,OAAO,CAAC,KAAK,CAAC,IAAI,GAAG,6BAA6B;wBACpJ,GAAG,EAAE,qEAAqE,SAAS,CAAC,IAAI,CAAC,IAAI,OAAO,eAAe,SAAS,CAAC,EAAE,CAAC,IAAI,OAAO,+CAA+C;wBAC1L,IAAI;qBACL,CAAC,CAAC;gBACL,CAAC;qBAAM;gBACL,8DAA8D;gBAC9D,6DAA6D;gBAC7D,CAAC,UAAU;oBACX,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC;oBAC5B,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,QAAQ,CAAC,UAAU,CAAC,EAC/B,CAAC;oBACD,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;oBACd,QAAQ,CAAC,IAAI,CAAC;wBACZ,IAAI,EAAE,iBAAiB;wBACvB,OAAO,EAAE,GAAG,MAAM,CAAC,IAAI,KAAK,IAAI,qBAAqB,KAAK,CAAC,IAAI,CAAC,OAAO,KAAK,CAAC,EAAE,CAAC,iFAAiF;wBACjK,GAAG,EAAE,+CAA+C,SAAS,CAAC,OAAO,CAAC,IAAI,kBAAkB,qCAAqC;wBACjI,IAAI;qBACL,CAAC,CAAC;gBACL,CAAC;YACH,CAAC;QACH,CAAC;IACH,CAAC;IACD,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC;AAC9B,CAAC"}
@@ -3,5 +3,5 @@
3
3
  * compiler admits. Each template guide takes its example from here, and
4
4
  * std-headers.spec proves the whole program compiles.
5
5
  */
6
- export declare const catalogProgramSource = "program catalog \"Template catalog\"\nuse money\nuse escrow\nuse purchase\nuse booking\nuse marketplace\nuse financing\nuse insurance\nuse lending\nuse wallet\nuse cards\nuse collections\nuse savings\nuse reporting\nparty supplier: business\nparty inspector: staff role claim_inspector\nparty investor: business\nobject item \"Item\" {\n attach transfer = money.transfer { payer: actor, payee: owner, amount: 750 SAR }\n attach hold = money.hold { payer: actor, payee: owner, amount: 750 SAR }\n attach split = money.split { payer: actor, amount: 750 SAR }\n attach schedule = money.schedule { payer: actor, payee: owner, amount: 750 SAR, count: 3 }\n attach pool = money.pool { payer: actor, payee: owner, target: 1000 SAR, closes: 2027-01-01 }\n attach swap = money.swap { first: actor, second: owner, first_amount: 100 SAR, second_amount: 200 SAR, expires: 2027-01-01 }\n attach payout = money.payout { payer: actor, payee: owner, adapter: \"conformance_boundary\" }\n attach mandate = money.mandate { payer: actor, payee: owner }\n attach metered = money.metered { payer: actor, payee: owner, unit_price: 10 SAR }\n attach late_fee = money.late_fee { payer: actor, payee: owner, amount: 50 SAR, cap: 500 SAR }\n attach policy = insurance.cover { holder: actor, adapter: \"conformance_boundary\" }\n attach claim = insurance.claim { cover: policy, inspector: inspector }\n attach cov = insurance.cover { holder: actor, broker: supplier, adapter: \"conformance_boundary\", covers: sale }\n attach deposit = escrow.hold { payer: actor, payee: owner }\n attach sale = escrow.hold { funding: { controllers: [checkout], reference: \"funds\", blocking_states: [active] }, payer: actor, payee: owner }\n attach trip = booking.reservation { customer: actor, operator: owner }\n attach limits = financing.limits { borrower: actor, per_borrower: 60000 SAR }\n attach ceiling = financing.portfolio_limit { limit: 1500000 SAR }\n attach checkout = purchase.checkout { plans: plan, funds: sale, borrower: actor, capital: operator }\n 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 }\n attach late = financing.late_charge { on: plan, borrower: actor }\n attach line = financing.credit_line { borrower: operator, adapter: \"conformance_boundary\", limit: 100000 SAR, expires: 2027-01-01 }\n attach advance = financing.advance { line: line }\n attach case = collections.case { on: plan, agency: supplier }\n attach contact = collections.contact { case: case, agency: supplier }\n attach reminder = collections.reminder { on: plan }\n attach wallet = wallet.balance { holder: investor }\n attach spend = wallet.spend { wallet: wallet, payee: supplier, holder: investor }\n attach round = lending.round { borrower: actor, plan: plan, minimum_ticket: 100 SAR, investor_cap: 100% }\n attach commitment = lending.commitment { round: round, wallet: wallet, investor: investor }\n attach distribution = lending.distribution { round: round, receipt: plan.settlement }\n attach cardholder = cards.cardholder { holder: actor }\n attach card = cards.card { holder: cardholder, person: actor, spend_limit: 5000 SAR }\n attach authorization = cards.authorization { card: card, merchant: supplier }\n attach transaction = cards.transaction { authorization: authorization }\n attach dispute = cards.dispute { transaction: transaction }\n attach listing = marketplace.listing { seller: owner }\n attach order = marketplace.order { listing: listing, buyer: actor }\n attach reservation = marketplace.reservation { listing: listing, funds: sale, converters: checkout, buyer: actor, seller: owner }\n attach circle = savings.circle { contribution: 300 SAR, members: 8, starts: 2027-01-01 }\n attach membership = savings.membership { circle: circle, member: actor }\n attach reports = reporting.portfolio { on: plan }\n}";
6
+ export declare const catalogProgramSource = "program catalog \"Template catalog\"\nuse money\nuse escrow\nuse purchase\nuse booking\nuse marketplace\nuse financing\nuse insurance\nuse lending\nuse wallet\nuse cards\nuse collections\nuse savings\nuse reporting\nparty supplier: business\nparty inspector: staff role claim_inspector\nparty investor: business\nobject item \"Item\" {\n attach transfer = money.transfer { payer: actor, payee: owner, amount: 750 SAR }\n attach hold = money.hold { payer: actor, payee: owner, amount: 750 SAR }\n attach split = money.split { payer: actor, amount: 750 SAR }\n attach schedule = money.schedule { payer: owner, payee: operator, amount: 250 SAR, every: 1 month }\n attach pool = money.pool { payer: actor, payee: owner, target: 1000 SAR, closes: 2027-01-01 }\n attach swap = money.swap { first: actor, second: owner, first_amount: 100 SAR, second_amount: 200 SAR, expires: 2027-01-01 }\n attach payout = money.payout { payer: actor, payee: owner, adapter: \"conformance_boundary\" }\n attach mandate = money.mandate { payer: actor, payee: owner }\n attach metered = money.metered { payer: actor, payee: owner, unit_price: 10 SAR }\n attach late_fee = money.late_fee { payer: actor, payee: owner, amount: 50 SAR, cap: 500 SAR }\n attach policy = insurance.cover { holder: actor, adapter: \"conformance_boundary\" }\n attach claim = insurance.claim { cover: policy, inspector: inspector }\n attach cov = insurance.cover { holder: actor, broker: supplier, adapter: \"conformance_boundary\", covers: sale }\n attach deposit = escrow.hold { payer: actor, payee: owner }\n attach sale = escrow.hold { funding: { controllers: [checkout], reference: \"funds\", blocking_states: [active] }, payer: actor, payee: owner }\n attach trip = booking.reservation { customer: actor, operator: owner }\n attach limits = financing.limits { borrower: actor, per_borrower: 60000 SAR }\n attach ceiling = financing.portfolio_limit { limit: 1500000 SAR }\n attach checkout = purchase.checkout { plans: plan, funds: sale, borrower: actor, capital: operator }\n 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 }\n attach late = financing.late_charge { on: plan, borrower: actor }\n attach line = financing.credit_line { borrower: operator, adapter: \"conformance_boundary\", limit: 100000 SAR, expires: 2027-01-01 }\n attach advance = financing.advance { line: line }\n attach case = collections.case { on: plan, agency: supplier }\n attach contact = collections.contact { case: case, agency: supplier }\n attach reminder = collections.reminder { on: plan }\n attach wallet = wallet.balance { holder: investor }\n attach spend = wallet.spend { wallet: wallet, payee: supplier, holder: investor }\n attach round = lending.round { borrower: actor, plan: plan, minimum_ticket: 100 SAR, investor_cap: 100% }\n attach commitment = lending.commitment { round: round, wallet: wallet, investor: investor }\n attach distribution = lending.distribution { round: round, receipt: plan.settlement }\n attach cardholder = cards.cardholder { holder: actor }\n attach card = cards.card { holder: cardholder, person: actor, spend_limit: 5000 SAR }\n attach authorization = cards.authorization { card: card, merchant: supplier }\n attach transaction = cards.transaction { authorization: authorization }\n attach dispute = cards.dispute { transaction: transaction }\n attach listing = marketplace.listing { seller: owner }\n attach order = marketplace.order { listing: listing, buyer: actor }\n attach reservation = marketplace.reservation { listing: listing, funds: sale, converters: checkout, buyer: actor, seller: owner }\n attach circle = savings.circle { contribution: 300 SAR, members: 8, starts: 2027-01-01 }\n attach membership = savings.membership { circle: circle, member: actor }\n attach reports = reporting.portfolio { on: plan }\n}";
7
7
  //# sourceMappingURL=catalog-program.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"catalog-program.d.ts","sourceRoot":"","sources":["../../src/catalog-program.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,eAAO,MAAM,oBAAoB,s2HA4D/B,CAAC"}
1
+ {"version":3,"file":"catalog-program.d.ts","sourceRoot":"","sources":["../../src/catalog-program.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,eAAO,MAAM,oBAAoB,+2HA4D/B,CAAC"}
@@ -24,7 +24,7 @@ object item "Item" {
24
24
  attach transfer = money.transfer { payer: actor, payee: owner, amount: 750 SAR }
25
25
  attach hold = money.hold { payer: actor, payee: owner, amount: 750 SAR }
26
26
  attach split = money.split { payer: actor, amount: 750 SAR }
27
- attach schedule = money.schedule { payer: actor, payee: owner, amount: 750 SAR, count: 3 }
27
+ attach schedule = money.schedule { payer: owner, payee: operator, amount: 250 SAR, every: 1 month }
28
28
  attach pool = money.pool { payer: actor, payee: owner, target: 1000 SAR, closes: 2027-01-01 }
29
29
  attach swap = money.swap { first: actor, second: owner, first_amount: 100 SAR, second_amount: 200 SAR, expires: 2027-01-01 }
30
30
  attach payout = money.payout { payer: actor, payee: owner, adapter: "conformance_boundary" }
@@ -1 +1 @@
1
- {"version":3,"file":"compile.d.ts","sourceRoot":"","sources":["../../src/compile.ts"],"names":[],"mappings":"AAOA,OAAO,EAAwB,KAAK,eAAe,EAAE,MAAM,WAAW,CAAC;AACvE,OAAO,EAkBL,KAAK,WAAW,EAQjB,MAAM,kBAAkB,CAAC;AAa1B,OAAO,EAIL,KAAK,UAAU,EAKf,KAAK,IAAI,EACV,MAAM,UAAU,CAAC;AAClB,OAAO,EAA0B,KAAK,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAEhF,OAAO,KAAK,EAAE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EAAE,oBAAoB,CAAC,CAAC,CAAC;CAClE;AACD,MAAM,WAAW,cAAe,SAAQ,IAAI,CAAC,iBAAiB,EAAE,UAAU,CAAC;IACzE,QAAQ,EAAE,SAAS,CAAC;CACrB;AACD,MAAM,WAAW,aAAa;IAC5B,OAAO,EAAE,OAAO,GAAG,SAAS,CAAC;IAC7B,WAAW,EAAE,iBAAiB,EAAE,CAAC;IACjC,iFAAiF;IACjF,QAAQ,EAAE,cAAc,EAAE,CAAC;IAC3B,SAAS,CAAC,EAAE;QACV,QAAQ,EAAE,WAAW,CAAC;QACtB,YAAY,EAAE,eAAe,CAAC;QAC9B,SAAS,EAAE,qBAAqB,EAAE,CAAC;KACpC,CAAC;CACH;AAuWD,wBAAgB,OAAO,CACrB,MAAM,EAAE,MAAM,EACd,OAAO,GAAE,cAAmB,GAC3B,aAAa,CA4vIf"}
@@ -5,7 +5,7 @@ import { validateUdl, resolveField, sameAccount, sameObjectField, subjectPartyRo
5
5
  import { bindingDependencies, parameterDiagnostics, BindingContractError, } from "./binding-contract.js";
6
6
  import { tunableBounds } from "./tunables.js";
7
7
  import { parseProgram } from "./parse.js";
8
- import { applyAttachmentEconomics, purposeWarnings, } from "./attachment-economics.js";
8
+ import { applyAttachmentEconomics, purposeWarnings, samePartyMoves, } from "./attachment-economics.js";
9
9
  import { parseHeader } from "./header-source.js";
10
10
  import { lineColAt, } from "./ast.js";
11
11
  import { bundledStandardLibrary } from "./std-library.js";
@@ -200,6 +200,24 @@ function decimal(raw, scale, expr) {
200
200
  return (BigInt(whole) * 10n ** BigInt(scale) +
201
201
  BigInt(fraction.padEnd(scale, "0") || "0")).toString();
202
202
  }
203
+ /**
204
+ * A calendar period as ISO-8601 text: `1 month`, `2 weeks`, `7d` or `P1M`.
205
+ * Days, weeks, months and years only, the units Stripe and Shopify bill in.
206
+ */
207
+ function periodText(expr) {
208
+ if (!["duration", "text", "name"].includes(expr.kind))
209
+ return undefined;
210
+ const value = expr.value.trim();
211
+ const units = { d: "D", w: "W", m: "M", y: "Y" };
212
+ const words = /^([1-9]\d{0,3}) ?(day|week|month|year)s?$/.exec(value);
213
+ const short = /^([1-9]\d{0,3})(d|w)$/.exec(value);
214
+ const iso = /^P(?!$)(?:[1-9]\d{0,3}Y)?(?:[1-9]\d{0,3}M)?(?:[1-9]\d{0,3}W)?(?:[1-9]\d{0,3}D)?$/.exec(value);
215
+ if (words)
216
+ return `P${words[1]}${units[words[2][0]]}`;
217
+ if (short)
218
+ return `P${short[1]}${units[short[2]]}`;
219
+ return iso ? value : undefined;
220
+ }
203
221
  function literal(expr, expectedType) {
204
222
  if (expr.kind === "text" && expectedType === "duration")
205
223
  return literal({ ...expr, kind: "duration" });
@@ -501,7 +519,9 @@ export function compile(source, options = {}) {
501
519
  }
502
520
  return { module: moduleName, exportPath, revision };
503
521
  };
504
- const addInstrument = (decl, id, arguments_, origin, inherited = new Map(), inheritedEnums = new Map(), attachmentInfo, familyDeclaration, standardOrigin) => {
522
+ const addInstrument = (decl, id, arguments_, origin, inherited = new Map(), inheritedEnums = new Map(), attachmentInfo, familyDeclaration, standardOrigin,
523
+ /** Declared tunables, true where the author bound them. */
524
+ inheritedTunables = new Map()) => {
505
525
  const resolveFamilyInstruments = (family, currentInstId, expr) => {
506
526
  const found = new Set();
507
527
  if (currentInstId && familyDeclaration) {
@@ -635,6 +655,9 @@ export function compile(source, options = {}) {
635
655
  suppliedEntries.set(entry.key, entry);
636
656
  }
637
657
  const environment = new Map(inherited);
658
+ // `when every is set` asks whether the author bound a tunable; a
659
+ // default leaves it unset.
660
+ const tunables = new Map(inheritedTunables);
638
661
  const parameterErrors = [];
639
662
  for (const param of decl.parameters) {
640
663
  const type = param.value.kind === "default" ? param.value.type : param.value;
@@ -650,6 +673,7 @@ export function compile(source, options = {}) {
650
673
  document.parties[param.key])
651
674
  ? { kind: "name", value: param.key, span: origin }
652
675
  : undefined;
676
+ tunables.set(param.key, supplied.has(param.key) || !!byName);
653
677
  const actual = supplied.get(param.key) ??
654
678
  byName ??
655
679
  (fallback && {
@@ -895,6 +919,10 @@ export function compile(source, options = {}) {
895
919
  (v.kind === "text" || v.kind === "name") &&
896
920
  /^P/.test(v.value))
897
921
  v = { ...v, kind: "duration" };
922
+ // A period lowers as ISO text, so `after` steps calendar months.
923
+ const period = type === "period" ? periodText(v) : undefined;
924
+ if (period)
925
+ v = { kind: "text", value: period, span: v.span };
898
926
  environment.set(param.key, v);
899
927
  if (type === "enum" && t.kind === "call") {
900
928
  if (v.kind !== "name" || !t.args.some((a) => text(a) === v.value))
@@ -982,6 +1010,10 @@ export function compile(source, options = {}) {
982
1010
  span: v.span,
983
1011
  });
984
1012
  }
1013
+ else if (type === "period") {
1014
+ if (!period)
1015
+ fail(v, `${param.key} needs a calendar period`, `write ${param.key}: 1 month, 2 weeks, 1 year or 7 days`);
1016
+ }
985
1017
  else if (type === "fee" || type === "split" || type === "policy") {
986
1018
  if (v.kind !== "block")
987
1019
  fail(v, `${param.key} needs a block`, `write ${param.key} { ... }`);
@@ -1289,9 +1321,52 @@ export function compile(source, options = {}) {
1289
1321
  : value.value;
1290
1322
  return literal(value);
1291
1323
  };
1324
+ const branchMatches = (entry) => {
1325
+ const [, tunable, relation, choice] = entry.key.split(" ");
1326
+ // `when every is set` holds when the author bound the tunable, so an
1327
+ // optional tunable and a defaulted one both read as unset.
1328
+ if (relation === "is" &&
1329
+ (choice === "set" || choice === "unset") &&
1330
+ tunables.has(tunable) &&
1331
+ !enums.has(tunable))
1332
+ return tunables.get(tunable) === (choice === "set");
1333
+ const binding = environment.get(tunable);
1334
+ if (!binding)
1335
+ fail(entry, `unknown branch tunable ${tunable}`, "name an enum, reference or optional tunable declared by this header");
1336
+ if (relation === "has") {
1337
+ // Inspect declarations, not lowering order: a bound object may
1338
+ // appear after the instrument that asks about its fields.
1339
+ const bound = resolve(binding);
1340
+ const [root, ...children] = text(bound).split(".");
1341
+ const assignment = assignments.get(root);
1342
+ let target = assignment
1343
+ ? templates.get(assignment.target)?.body
1344
+ : program.decls
1345
+ .filter((decl) => decl.kind === "instrument")
1346
+ .find((decl) => decl.name === root)?.body;
1347
+ for (const child of children) {
1348
+ const record = target
1349
+ ? entries(asBlock(entries(target).get("records"))).get(child)
1350
+ : undefined;
1351
+ target = record ? asBlock(record) : undefined;
1352
+ }
1353
+ if (!target)
1354
+ fail(entry, "field branch needs a declared object", "bind a reference to a declared object");
1355
+ return entries(asBlock(entries(target).get("fields"))).has(choice);
1356
+ }
1357
+ if (!enums.get(tunable)?.includes(choice))
1358
+ fail(entry, `unknown enum branch ${choice}`, "use a declared enum value, or set or unset");
1359
+ return text(binding) === choice;
1360
+ };
1361
+ // Fields and inputs take `when` branches too; a branch holds field rows.
1362
+ const branchRows = (block) => block.entries.flatMap((row) => row.key.startsWith("when ")
1363
+ ? branchMatches(row)
1364
+ ? branchRows(asBlock(row.value))
1365
+ : []
1366
+ : [row]);
1292
1367
  const lowerFields = (block) => {
1293
1368
  const result = [];
1294
- for (const row of block.entries) {
1369
+ for (const row of branchRows(block)) {
1295
1370
  const { type: t } = fieldType(row);
1296
1371
  const constant = row.value.kind === "default" ? resolve(row.value.value) : undefined;
1297
1372
  const f = lowerFieldShape(row, resolve);
@@ -1476,6 +1551,15 @@ export function compile(source, options = {}) {
1476
1551
  milliseconds: args[1],
1477
1552
  direction: constant.name,
1478
1553
  });
1554
+ // after(start, 1 month, 3) steps calendar periods from start.
1555
+ else if (constant.name === "after" && args.length === 3)
1556
+ calculations.push({
1557
+ target,
1558
+ op: "step",
1559
+ date: args[0],
1560
+ period: args[1],
1561
+ times: args[2],
1562
+ });
1479
1563
  else
1480
1564
  fail(constant, `unknown calculation ${constant.name}`, "use rate, sum, minimum, subtract, multiply, divide, before or after");
1481
1565
  authored.set(calculations.at(-1), constant);
@@ -1563,37 +1647,7 @@ export function compile(source, options = {}) {
1563
1647
  entries: block.entries.flatMap((entry) => {
1564
1648
  if (!entry.key.startsWith("when "))
1565
1649
  return [entry];
1566
- const [, tunable, relation, choice] = entry.key.split(" ");
1567
- const binding = environment.get(tunable);
1568
- if (!binding)
1569
- fail(entry, `unknown branch tunable ${tunable}`, "name an enum or reference tunable declared by this header");
1570
- let matches;
1571
- if (relation === "has") {
1572
- // Inspect declarations, not lowering order: a bound object may
1573
- // appear after the instrument that asks about its fields.
1574
- const bound = resolve(binding);
1575
- const [root, ...children] = text(bound).split(".");
1576
- const assignment = assignments.get(root);
1577
- let target = assignment
1578
- ? templates.get(assignment.target)?.body
1579
- : program.decls
1580
- .filter((decl) => decl.kind === "instrument")
1581
- .find((decl) => decl.name === root)?.body;
1582
- for (const child of children) {
1583
- const record = target
1584
- ? entries(asBlock(entries(target).get("records"))).get(child)
1585
- : undefined;
1586
- target = record ? asBlock(record) : undefined;
1587
- }
1588
- if (!target)
1589
- fail(entry, "field branch needs a declared object", "bind a reference to a declared object");
1590
- matches = entries(asBlock(entries(target).get("fields"))).has(choice);
1591
- }
1592
- else {
1593
- if (!enums.get(tunable)?.includes(choice))
1594
- fail(entry, `unknown enum branch ${choice}`, "use a declared enum value");
1595
- matches = text(binding) === choice;
1596
- }
1650
+ const matches = branchMatches(entry);
1597
1651
  const body = asBlock(entry.value);
1598
1652
  for (const clause of body.entries)
1599
1653
  if (!["requires", "moves", "invoke", "calculate"].includes(clause.key) &&
@@ -2446,7 +2500,7 @@ export function compile(source, options = {}) {
2446
2500
  .filter(Boolean)
2447
2501
  .join("."),
2448
2502
  }
2449
- : undefined);
2503
+ : undefined, tunables);
2450
2504
  }
2451
2505
  };
2452
2506
  const compileObject = (decl) => {
@@ -3388,10 +3442,20 @@ export function compile(source, options = {}) {
3388
3442
  }, "lower");
3389
3443
  }),
3390
3444
  };
3445
+ const sameParty = samePartyMoves(document, attachedSelectors, attachEntries);
3446
+ if (sameParty.errors.length)
3447
+ return {
3448
+ verdict: "invalid",
3449
+ warnings: [],
3450
+ diagnostics: sameParty.errors.map((d) => diagnostic(d, "check")),
3451
+ };
3391
3452
  return {
3392
3453
  verdict: "valid",
3393
3454
  diagnostics: [],
3394
- warnings: purposeWarnings(document, attachedSelectors, attachEntries).map((d) => ({ ...diagnostic(d, "check"), severity: "warning" })),
3455
+ warnings: [
3456
+ ...sameParty.warnings,
3457
+ ...purposeWarnings(document, attachedSelectors, attachEntries),
3458
+ ].map((d) => ({ ...diagnostic(d, "check"), severity: "warning" })),
3395
3459
  artifacts: {
3396
3460
  document: validated.value,
3397
3461
  costManifest: buildUdlCostManifest(validated.value),