@hyperscale0/hsx 1.0.256 → 1.0.265
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 +4 -0
- package/README.md +31 -3
- package/bases/cards.hsx +38 -0
- package/bases/collections.hsx +51 -0
- package/bases/escrow.hsx +23 -0
- package/bases/financing.hsx +36 -0
- package/bases/insurance.hsx +22 -0
- package/bases/lending.hsx +73 -0
- package/bases/marketplace.hsx +38 -0
- package/bases/money.hsx +12 -0
- package/bases/reporting.hsx +40 -0
- package/bases/savings.hsx +20 -0
- package/bases/wallet.hsx +23 -0
- package/dist/src/bases-bundle.d.ts +3 -0
- package/dist/src/bases-bundle.d.ts.map +1 -0
- package/dist/src/bases-bundle.js +14 -0
- package/dist/src/bases-bundle.js.map +1 -0
- package/dist/src/bases.d.ts +10 -0
- package/dist/src/bases.d.ts.map +1 -0
- package/dist/src/bases.js +2 -0
- package/dist/src/bases.js.map +1 -0
- package/dist/src/compile.d.ts.map +1 -1
- package/dist/src/compile.js +10 -1
- package/dist/src/compile.js.map +1 -1
- package/package.json +13 -7
- package/src/bases-bundle.ts +15 -0
- package/src/bases.ts +9 -0
- package/src/compile.ts +20 -0
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
## Unreleased
|
|
4
4
|
|
|
5
|
+
- Add eleven neutral archetype programs in `bases/` and the browser export
|
|
6
|
+
`@hyperscale0/hsx/bases`. Generation and preparation bundle their source and
|
|
7
|
+
metadata. Package checks enforce compilation, coverage and neutral content.
|
|
8
|
+
|
|
5
9
|
- Rewrite all 15 ready-made products as Saudi business examples with SAR prices,
|
|
6
10
|
explicit fees and VAT treatment, named business counterparties, useful list
|
|
7
11
|
columns, and supported payment, refund, dispute and overdue paths.
|
package/README.md
CHANGED
|
@@ -28,6 +28,34 @@ bundled headers as JSON. The [samples](examples/) include both complete action p
|
|
|
28
28
|
compositions that still need child-record actions or adapter bindings. A compile
|
|
29
29
|
pass does not prove that a flow is publicly executable or funded.
|
|
30
30
|
|
|
31
|
+
## Bases and examples
|
|
32
|
+
|
|
33
|
+
Choose one of three starting points: write a bespoke program, tailor a neutral
|
|
34
|
+
[base](bases/), or adapt a company from [examples](examples/). The `std/` headers
|
|
35
|
+
supply the mechanisms behind both bases and examples. A base supplies one object
|
|
36
|
+
and the actions its mechanism needs, without a company's names or prices.
|
|
37
|
+
|
|
38
|
+
```ts
|
|
39
|
+
import { bases, type HsxBase } from "@hyperscale0/hsx/bases";
|
|
40
|
+
|
|
41
|
+
const escrow: HsxBase = bases.find((base) => base.id === "escrow")!;
|
|
42
|
+
const source = escrow.source;
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
Each base has `id`, `title`, `summary`, `headers` and `source`. Its ID is the std
|
|
46
|
+
header name. The array is sorted by ID and imports no filesystem APIs. The eleven
|
|
47
|
+
bases cover escrow, money, wallet, cards, financing, savings, marketplace,
|
|
48
|
+
insurance, lending, collections and reporting.
|
|
49
|
+
|
|
50
|
+
Architect tailors the base's name, parties, fields, economics and action paths.
|
|
51
|
+
Required amounts come from action inputs or the object's price. Optional settings
|
|
52
|
+
use std defaults. Financing starts with two instalments and a required zero profit
|
|
53
|
+
rate. Savings starts with two members and collects its start date and contribution
|
|
54
|
+
at creation. Architect sets these terms during tailoring. Insurance binds the
|
|
55
|
+
sandbox `conformance_boundary` adapter; replace it with the insurer's registered
|
|
56
|
+
adapter for that provider. Parties, accounts, funding, inputs and lifecycle
|
|
57
|
+
prerequisites still govern execution.
|
|
58
|
+
|
|
31
59
|
## Browser language service
|
|
32
60
|
|
|
33
61
|
```ts
|
|
@@ -54,9 +82,9 @@ by filename and contains no filesystem imports. Workspace imports use
|
|
|
54
82
|
|
|
55
83
|
Run `bun install` and `bun run build` in this package's public source checkout.
|
|
56
84
|
Run `bun bin/hsx.ts check examples/rental-deposit.hsx` to use the source CLI.
|
|
57
|
-
`bun run check` checks types, compiles
|
|
85
|
+
`bun run check` checks types, compiles bases and examples and checks bundle freshness.
|
|
58
86
|
|
|
59
|
-
Edit prose in `docs/README.md`, programs in `examples/`, and header comments in
|
|
87
|
+
Edit prose in `docs/README.md`, programs in `bases/` and `examples/`, and header comments in
|
|
60
88
|
`std/`. Run `bun run generate` after changing these inputs. It emits the header
|
|
61
|
-
and example bundles.
|
|
89
|
+
base and example bundles.
|
|
62
90
|
`bun run build` also builds the browser playground.
|
package/bases/cards.hsx
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
// Reserve a card payment within its spending limit before capture.
|
|
2
|
+
program cards_base "Control card spending"
|
|
3
|
+
use cards
|
|
4
|
+
party seller: business
|
|
5
|
+
|
|
6
|
+
object card "Card" {
|
|
7
|
+
attach holder = cards.cardholder {
|
|
8
|
+
holder: owner
|
|
9
|
+
expose create as create_holder
|
|
10
|
+
expose activate as activate_holder
|
|
11
|
+
expose suspend as suspend_holder
|
|
12
|
+
expose resume as resume_holder
|
|
13
|
+
expose close as close_holder
|
|
14
|
+
}
|
|
15
|
+
attach card = cards.card {
|
|
16
|
+
holder: holder, person: owner, issuer: operator, spend_limit: runtime
|
|
17
|
+
expose create as create_card
|
|
18
|
+
expose activate as activate_card
|
|
19
|
+
expose freeze as freeze_card
|
|
20
|
+
expose unfreeze as unfreeze_card
|
|
21
|
+
expose issuer_freeze as issuer_freeze_card
|
|
22
|
+
expose issuer_unfreeze as issuer_unfreeze_card
|
|
23
|
+
expose cancel as cancel_card
|
|
24
|
+
}
|
|
25
|
+
attach payment = cards.authorization {
|
|
26
|
+
card: card, merchant: seller, issuer: operator
|
|
27
|
+
expose create as create
|
|
28
|
+
expose approve as approve
|
|
29
|
+
expose decline as decline
|
|
30
|
+
expose capture as capture
|
|
31
|
+
expose reverse as reverse
|
|
32
|
+
}
|
|
33
|
+
attach receipt = cards.transaction {
|
|
34
|
+
authorization: payment
|
|
35
|
+
expose create as record_payment
|
|
36
|
+
expose refund as refund
|
|
37
|
+
}
|
|
38
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
// Refer overdue instalments for collection and limit contact attempts.
|
|
2
|
+
program collections_base "Follow up overdue payments"
|
|
3
|
+
use collections
|
|
4
|
+
use financing
|
|
5
|
+
party collector: business
|
|
6
|
+
|
|
7
|
+
object plan "Plan" {
|
|
8
|
+
fields { price: money }
|
|
9
|
+
attach allowance = financing.limits {
|
|
10
|
+
borrower: owner, per_borrower: runtime
|
|
11
|
+
expose create as request_limit
|
|
12
|
+
expose approve as approve_limit
|
|
13
|
+
}
|
|
14
|
+
attach budget = financing.portfolio_limit {
|
|
15
|
+
limit: runtime
|
|
16
|
+
expose create as create_budget
|
|
17
|
+
expose approve as approve_budget
|
|
18
|
+
}
|
|
19
|
+
// Architect sets the placeholder profit rate during tailoring.
|
|
20
|
+
attach plan = financing.installments {
|
|
21
|
+
borrower: owner, capital: operator
|
|
22
|
+
months: 2, pricing: flat_total, profit_rate: 0%
|
|
23
|
+
disburse_to: borrower, limits: allowance, portfolio: budget
|
|
24
|
+
expose create as quote
|
|
25
|
+
expose sign as sign
|
|
26
|
+
expose disburse as fund
|
|
27
|
+
expose cancel as cancel_quote
|
|
28
|
+
expose void as cancel_plan
|
|
29
|
+
expose payoff as repay_early
|
|
30
|
+
expose complete as complete
|
|
31
|
+
}
|
|
32
|
+
attach recovery = collections.case {
|
|
33
|
+
on: plan, agency: collector, capital: operator
|
|
34
|
+
expose create as refer
|
|
35
|
+
expose assign as assign
|
|
36
|
+
expose recover as recover
|
|
37
|
+
expose recall as recall
|
|
38
|
+
expose return_uncollected as return_uncollected
|
|
39
|
+
}
|
|
40
|
+
attach contact = collections.contact {
|
|
41
|
+
case: recovery, agency: collector
|
|
42
|
+
expose create as record_contact
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
expose plan.plan.payment.create as record_payment
|
|
47
|
+
expose plan.plan.payment.pay as pay_instalment
|
|
48
|
+
expose plan.plan.payment.refund as refund_payment
|
|
49
|
+
expose plan.plan.payoff_quote.create as quote_payoff
|
|
50
|
+
|
|
51
|
+
expose plan.contact.outcome.create as record_contact_outcome
|
package/bases/escrow.hsx
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
// Hold a buyer’s payment until delivery is accepted.
|
|
2
|
+
program escrow_base "Hold payment until delivery"
|
|
3
|
+
use escrow
|
|
4
|
+
party seller: business
|
|
5
|
+
|
|
6
|
+
object order "Order" {
|
|
7
|
+
fields { price: money }
|
|
8
|
+
attach payment = escrow.hold {
|
|
9
|
+
payer: owner, payee: seller
|
|
10
|
+
expose create as create
|
|
11
|
+
expose fund as fund
|
|
12
|
+
expose deliver as deliver
|
|
13
|
+
expose accept as accept
|
|
14
|
+
expose dispute as dispute
|
|
15
|
+
expose verify_return as verify_return
|
|
16
|
+
expose refund as refund
|
|
17
|
+
expose refund_undelivered as refund_undelivered
|
|
18
|
+
expose settle_release as settle_release
|
|
19
|
+
expose settle_return as settle_return
|
|
20
|
+
expose settle_refund as settle_refund
|
|
21
|
+
expose cancel as cancel
|
|
22
|
+
}
|
|
23
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
// Fund a purchase and collect its scheduled repayments.
|
|
2
|
+
program financing_base "Split a purchase into instalments"
|
|
3
|
+
use financing
|
|
4
|
+
party seller: business
|
|
5
|
+
|
|
6
|
+
object purchase "Purchase" {
|
|
7
|
+
fields { price: money }
|
|
8
|
+
attach allowance = financing.limits {
|
|
9
|
+
borrower: owner, per_borrower: runtime
|
|
10
|
+
expose create as request_limit
|
|
11
|
+
expose approve as approve_limit
|
|
12
|
+
}
|
|
13
|
+
attach budget = financing.portfolio_limit {
|
|
14
|
+
limit: runtime
|
|
15
|
+
expose create as create_budget
|
|
16
|
+
expose approve as approve_budget
|
|
17
|
+
}
|
|
18
|
+
// Architect sets the placeholder profit rate during tailoring.
|
|
19
|
+
attach plan = financing.installments {
|
|
20
|
+
borrower: owner, capital: operator
|
|
21
|
+
months: 2, pricing: flat_total, profit_rate: 0%
|
|
22
|
+
disburse_to: seller, seller: seller, limits: allowance, portfolio: budget
|
|
23
|
+
expose create as quote
|
|
24
|
+
expose sign as sign
|
|
25
|
+
expose disburse as fund
|
|
26
|
+
expose cancel as cancel_quote
|
|
27
|
+
expose void as cancel_plan
|
|
28
|
+
expose payoff as repay_early
|
|
29
|
+
expose complete as complete
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
expose purchase.plan.payment.create as record_payment
|
|
34
|
+
expose purchase.plan.payment.pay as pay_instalment
|
|
35
|
+
expose purchase.plan.payment.refund as refund_payment
|
|
36
|
+
expose purchase.plan.payoff_quote.create as quote_payoff
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
// Collect cover premiums and reserve approved claims for payment.
|
|
2
|
+
program insurance_base "Protect a purchase"
|
|
3
|
+
use insurance
|
|
4
|
+
|
|
5
|
+
object purchase "Purchase" {
|
|
6
|
+
attach cover = insurance.cover {
|
|
7
|
+
holder: owner, adapter: "conformance_boundary"
|
|
8
|
+
expose create as create_cover
|
|
9
|
+
expose activate as activate_cover
|
|
10
|
+
expose cancel as cancel_cover
|
|
11
|
+
}
|
|
12
|
+
attach claim = insurance.claim {
|
|
13
|
+
cover: cover, inspector: operator
|
|
14
|
+
expose create as create_claim
|
|
15
|
+
expose approve as approve_claim
|
|
16
|
+
expose deny as deny_claim
|
|
17
|
+
expose pay as pay_claim
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
expose purchase.cover.slice.create as create_period
|
|
22
|
+
expose purchase.cover.slice.collect as collect_premium
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
// Pool member commitments to fund a loan and distribute repayments or losses.
|
|
2
|
+
program lending_base "Pool funds for lending"
|
|
3
|
+
use lending
|
|
4
|
+
use financing
|
|
5
|
+
use wallet
|
|
6
|
+
|
|
7
|
+
object plan "Plan" {
|
|
8
|
+
fields { price: money }
|
|
9
|
+
attach allowance = financing.limits {
|
|
10
|
+
borrower: owner, per_borrower: runtime
|
|
11
|
+
expose create as request_limit
|
|
12
|
+
expose approve as approve_limit
|
|
13
|
+
}
|
|
14
|
+
attach budget = financing.portfolio_limit {
|
|
15
|
+
limit: runtime
|
|
16
|
+
expose create as create_budget
|
|
17
|
+
expose approve as approve_budget
|
|
18
|
+
}
|
|
19
|
+
// Architect sets the placeholder profit rate during tailoring.
|
|
20
|
+
attach plan = financing.installments {
|
|
21
|
+
borrower: owner, capital: operator
|
|
22
|
+
months: 2, pricing: flat_total, profit_rate: 0%
|
|
23
|
+
disburse_to: borrower, limits: allowance, portfolio: budget
|
|
24
|
+
expose create as quote
|
|
25
|
+
expose sign as sign
|
|
26
|
+
expose disburse as fund
|
|
27
|
+
expose cancel as cancel_quote
|
|
28
|
+
expose void as cancel_plan
|
|
29
|
+
expose payoff as repay_early
|
|
30
|
+
expose complete as complete
|
|
31
|
+
}
|
|
32
|
+
attach balance = wallet.balance {
|
|
33
|
+
holder: actor
|
|
34
|
+
expose create as create_balance
|
|
35
|
+
expose activate as activate_balance
|
|
36
|
+
expose topup as add_funds
|
|
37
|
+
expose withdraw as withdraw_funds
|
|
38
|
+
expose close as close_balance
|
|
39
|
+
}
|
|
40
|
+
attach round = lending.round {
|
|
41
|
+
borrower: owner, plan: plan
|
|
42
|
+
expose create as open_round
|
|
43
|
+
expose close as close_round
|
|
44
|
+
}
|
|
45
|
+
attach commitment = lending.commitment {
|
|
46
|
+
round: round, wallet: balance, investor: actor
|
|
47
|
+
expose create as commit
|
|
48
|
+
expose withdraw as withdraw_commitment
|
|
49
|
+
}
|
|
50
|
+
attach returns = lending.distribution {
|
|
51
|
+
round: round, receipt: plan.settlement
|
|
52
|
+
expose create as record_settlement
|
|
53
|
+
expose prepare_cash as prepare_returns
|
|
54
|
+
expose distribute_cash as distribute_returns
|
|
55
|
+
}
|
|
56
|
+
attach losses = lending.distribution {
|
|
57
|
+
round: round, receipt: plan.settlement, mode: loss
|
|
58
|
+
expose create as record_loss
|
|
59
|
+
expose prepare_loss as prepare_losses
|
|
60
|
+
expose distribute_loss as distribute_losses
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
expose plan.plan.payment.create as record_payment
|
|
65
|
+
expose plan.plan.payment.pay as pay_instalment
|
|
66
|
+
expose plan.plan.payment.refund as refund_payment
|
|
67
|
+
expose plan.plan.payoff_quote.create as quote_payoff
|
|
68
|
+
|
|
69
|
+
expose plan.returns.share.create as create_return_share
|
|
70
|
+
expose plan.losses.share.create as create_loss_share
|
|
71
|
+
expose plan.plan.write_off_request.create as request_write_off
|
|
72
|
+
expose plan.plan.write_off_request.apply as apply_write_off
|
|
73
|
+
expose plan.plan.write_off_request.cancel as cancel_write_off
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
// Turn a seller’s offer into an order with payment held until acceptance.
|
|
2
|
+
program marketplace_base "Connect buyers and sellers"
|
|
3
|
+
use marketplace
|
|
4
|
+
use escrow
|
|
5
|
+
party seller: business
|
|
6
|
+
|
|
7
|
+
object order "Order" {
|
|
8
|
+
fields { price: money }
|
|
9
|
+
attach offer = marketplace.listing {
|
|
10
|
+
seller: seller
|
|
11
|
+
expose create as create_offer
|
|
12
|
+
expose publish as publish_offer
|
|
13
|
+
expose withdraw as withdraw_offer
|
|
14
|
+
expose sell as sell_offer
|
|
15
|
+
}
|
|
16
|
+
attach order = marketplace.order {
|
|
17
|
+
listing: offer, buyer: owner, fulfiller: seller
|
|
18
|
+
expose create as create_order
|
|
19
|
+
expose commit as commit_order
|
|
20
|
+
expose fulfill as fulfill_order
|
|
21
|
+
expose cancel as cancel_order
|
|
22
|
+
}
|
|
23
|
+
attach payment = escrow.hold {
|
|
24
|
+
payer: owner, payee: seller
|
|
25
|
+
expose create as create
|
|
26
|
+
expose fund as fund
|
|
27
|
+
expose deliver as deliver
|
|
28
|
+
expose accept as accept
|
|
29
|
+
expose dispute as dispute
|
|
30
|
+
expose verify_return as verify_return
|
|
31
|
+
expose refund as refund
|
|
32
|
+
expose refund_undelivered as refund_undelivered
|
|
33
|
+
expose settle_release as settle_release
|
|
34
|
+
expose settle_return as settle_return
|
|
35
|
+
expose settle_refund as settle_refund
|
|
36
|
+
expose cancel as cancel
|
|
37
|
+
}
|
|
38
|
+
}
|
package/bases/money.hsx
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
// Collect a payment from a customer.
|
|
2
|
+
program money_base "Collect a payment"
|
|
3
|
+
use money
|
|
4
|
+
|
|
5
|
+
object purchase "Purchase" {
|
|
6
|
+
attach payment = money.transfer {
|
|
7
|
+
payer: owner, payee: operator
|
|
8
|
+
expose create as create
|
|
9
|
+
expose pay as pay
|
|
10
|
+
expose cancel as cancel
|
|
11
|
+
}
|
|
12
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
// Report outstanding balances and overdue repayments on financed purchases.
|
|
2
|
+
program reporting_base "Track repayments"
|
|
3
|
+
use reporting
|
|
4
|
+
use financing
|
|
5
|
+
|
|
6
|
+
object purchase "Purchase" {
|
|
7
|
+
fields { price: money }
|
|
8
|
+
attach allowance = financing.limits {
|
|
9
|
+
borrower: owner, per_borrower: runtime
|
|
10
|
+
expose create as request_limit
|
|
11
|
+
expose approve as approve_limit
|
|
12
|
+
}
|
|
13
|
+
attach budget = financing.portfolio_limit {
|
|
14
|
+
limit: runtime
|
|
15
|
+
expose create as create_budget
|
|
16
|
+
expose approve as approve_budget
|
|
17
|
+
}
|
|
18
|
+
// Architect sets the placeholder profit rate during tailoring.
|
|
19
|
+
attach plan = financing.installments {
|
|
20
|
+
borrower: owner, capital: operator
|
|
21
|
+
months: 2, pricing: flat_total, profit_rate: 0%
|
|
22
|
+
disburse_to: borrower, limits: allowance, portfolio: budget
|
|
23
|
+
expose create as quote
|
|
24
|
+
expose sign as sign
|
|
25
|
+
expose disburse as fund
|
|
26
|
+
expose cancel as cancel_quote
|
|
27
|
+
expose void as cancel_plan
|
|
28
|
+
expose payoff as repay_early
|
|
29
|
+
expose complete as complete
|
|
30
|
+
}
|
|
31
|
+
attach reports = reporting.portfolio {
|
|
32
|
+
on: plan
|
|
33
|
+
expose create as create_reports
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
expose purchase.plan.payment.create as record_payment
|
|
38
|
+
expose purchase.plan.payment.pay as pay_instalment
|
|
39
|
+
expose purchase.plan.payment.refund as refund_payment
|
|
40
|
+
expose purchase.plan.payoff_quote.create as quote_payoff
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
// Collect contributions into a shared pot and pay each member in turn.
|
|
2
|
+
program savings_base "Save as a group"
|
|
3
|
+
use savings
|
|
4
|
+
|
|
5
|
+
object pot "Pot" {
|
|
6
|
+
attach circle = savings.circle {
|
|
7
|
+
contribution: runtime, members: 2, starts: runtime
|
|
8
|
+
expose create as create_circle
|
|
9
|
+
expose disband as disband_circle
|
|
10
|
+
expose close as close_circle
|
|
11
|
+
}
|
|
12
|
+
attach membership = savings.membership {
|
|
13
|
+
circle: circle, member: actor
|
|
14
|
+
expose create as join
|
|
15
|
+
expose activate as activate_membership
|
|
16
|
+
expose withdraw as withdraw
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
expose pot.membership.contribution.create as schedule_contribution
|
package/bases/wallet.hsx
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
// Let a customer add funds and reserve each spend before payment.
|
|
2
|
+
program wallet_base "Offer prepaid credit"
|
|
3
|
+
use wallet
|
|
4
|
+
|
|
5
|
+
object balance "Balance" {
|
|
6
|
+
attach balance = wallet.balance {
|
|
7
|
+
holder: owner
|
|
8
|
+
expose create as create_balance
|
|
9
|
+
expose activate as activate_balance
|
|
10
|
+
expose topup as add_funds
|
|
11
|
+
expose withdraw as withdraw_funds
|
|
12
|
+
expose freeze as freeze_balance
|
|
13
|
+
expose unfreeze as unfreeze_balance
|
|
14
|
+
expose close as close_balance
|
|
15
|
+
}
|
|
16
|
+
attach spend = wallet.spend {
|
|
17
|
+
wallet: balance, payee: operator, holder: owner
|
|
18
|
+
expose create as create
|
|
19
|
+
expose reserve as reserve
|
|
20
|
+
expose pay as pay
|
|
21
|
+
expose cancel as cancel
|
|
22
|
+
}
|
|
23
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bases-bundle.d.ts","sourceRoot":"","sources":["../../src/bases-bundle.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAC1C,eAAO,MAAM,KAAK,EAAE,OAAO,EAY1B,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export const bases = [
|
|
2
|
+
{ "id": "cards", "title": "Control card spending", "summary": "Reserve a card payment within its spending limit before capture.", "headers": ["cards"], "source": "// Reserve a card payment within its spending limit before capture.\nprogram cards_base \"Control card spending\"\nuse cards\nparty seller: business\n\nobject card \"Card\" {\n attach holder = cards.cardholder {\n holder: owner\n expose create as create_holder\n expose activate as activate_holder\n expose suspend as suspend_holder\n expose resume as resume_holder\n expose close as close_holder\n }\n attach card = cards.card {\n holder: holder, person: owner, issuer: operator, spend_limit: runtime\n expose create as create_card\n expose activate as activate_card\n expose freeze as freeze_card\n expose unfreeze as unfreeze_card\n expose issuer_freeze as issuer_freeze_card\n expose issuer_unfreeze as issuer_unfreeze_card\n expose cancel as cancel_card\n }\n attach payment = cards.authorization {\n card: card, merchant: seller, issuer: operator\n expose create as create\n expose approve as approve\n expose decline as decline\n expose capture as capture\n expose reverse as reverse\n }\n attach receipt = cards.transaction {\n authorization: payment\n expose create as record_payment\n expose refund as refund\n }\n}\n" },
|
|
3
|
+
{ "id": "collections", "title": "Follow up overdue payments", "summary": "Refer overdue instalments for collection and limit contact attempts.", "headers": ["collections", "financing"], "source": "// Refer overdue instalments for collection and limit contact attempts.\nprogram collections_base \"Follow up overdue payments\"\nuse collections\nuse financing\nparty collector: business\n\nobject plan \"Plan\" {\n fields { price: money }\n attach allowance = financing.limits {\n borrower: owner, per_borrower: runtime\n expose create as request_limit\n expose approve as approve_limit\n }\n attach budget = financing.portfolio_limit {\n limit: runtime\n expose create as create_budget\n expose approve as approve_budget\n }\n // Architect sets the placeholder profit rate during tailoring.\n attach plan = financing.installments {\n borrower: owner, capital: operator\n months: 2, pricing: flat_total, profit_rate: 0%\n disburse_to: borrower, limits: allowance, portfolio: budget\n expose create as quote\n expose sign as sign\n expose disburse as fund\n expose cancel as cancel_quote\n expose void as cancel_plan\n expose payoff as repay_early\n expose complete as complete\n }\n attach recovery = collections.case {\n on: plan, agency: collector, capital: operator\n expose create as refer\n expose assign as assign\n expose recover as recover\n expose recall as recall\n expose return_uncollected as return_uncollected\n }\n attach contact = collections.contact {\n case: recovery, agency: collector\n expose create as record_contact\n }\n}\n\nexpose plan.plan.payment.create as record_payment\nexpose plan.plan.payment.pay as pay_instalment\nexpose plan.plan.payment.refund as refund_payment\nexpose plan.plan.payoff_quote.create as quote_payoff\n\nexpose plan.contact.outcome.create as record_contact_outcome\n" },
|
|
4
|
+
{ "id": "escrow", "title": "Hold payment until delivery", "summary": "Hold a buyer’s payment until delivery is accepted.", "headers": ["escrow"], "source": "// Hold a buyer’s payment until delivery is accepted.\nprogram escrow_base \"Hold payment until delivery\"\nuse escrow\nparty seller: business\n\nobject order \"Order\" {\n fields { price: money }\n attach payment = escrow.hold {\n payer: owner, payee: seller\n expose create as create\n expose fund as fund\n expose deliver as deliver\n expose accept as accept\n expose dispute as dispute\n expose verify_return as verify_return\n expose refund as refund\n expose refund_undelivered as refund_undelivered\n expose settle_release as settle_release\n expose settle_return as settle_return\n expose settle_refund as settle_refund\n expose cancel as cancel\n }\n}\n" },
|
|
5
|
+
{ "id": "financing", "title": "Split a purchase into instalments", "summary": "Fund a purchase and collect its scheduled repayments.", "headers": ["financing"], "source": "// Fund a purchase and collect its scheduled repayments.\nprogram financing_base \"Split a purchase into instalments\"\nuse financing\nparty seller: business\n\nobject purchase \"Purchase\" {\n fields { price: money }\n attach allowance = financing.limits {\n borrower: owner, per_borrower: runtime\n expose create as request_limit\n expose approve as approve_limit\n }\n attach budget = financing.portfolio_limit {\n limit: runtime\n expose create as create_budget\n expose approve as approve_budget\n }\n // Architect sets the placeholder profit rate during tailoring.\n attach plan = financing.installments {\n borrower: owner, capital: operator\n months: 2, pricing: flat_total, profit_rate: 0%\n disburse_to: seller, seller: seller, limits: allowance, portfolio: budget\n expose create as quote\n expose sign as sign\n expose disburse as fund\n expose cancel as cancel_quote\n expose void as cancel_plan\n expose payoff as repay_early\n expose complete as complete\n }\n}\n\nexpose purchase.plan.payment.create as record_payment\nexpose purchase.plan.payment.pay as pay_instalment\nexpose purchase.plan.payment.refund as refund_payment\nexpose purchase.plan.payoff_quote.create as quote_payoff\n" },
|
|
6
|
+
{ "id": "insurance", "title": "Protect a purchase", "summary": "Collect cover premiums and reserve approved claims for payment.", "headers": ["insurance"], "source": "// Collect cover premiums and reserve approved claims for payment.\nprogram insurance_base \"Protect a purchase\"\nuse insurance\n\nobject purchase \"Purchase\" {\n attach cover = insurance.cover {\n holder: owner, adapter: \"conformance_boundary\"\n expose create as create_cover\n expose activate as activate_cover\n expose cancel as cancel_cover\n }\n attach claim = insurance.claim {\n cover: cover, inspector: operator\n expose create as create_claim\n expose approve as approve_claim\n expose deny as deny_claim\n expose pay as pay_claim\n }\n}\n\nexpose purchase.cover.slice.create as create_period\nexpose purchase.cover.slice.collect as collect_premium\n" },
|
|
7
|
+
{ "id": "lending", "title": "Pool funds for lending", "summary": "Pool member commitments to fund a loan and distribute repayments or losses.", "headers": ["lending", "financing", "wallet"], "source": "// Pool member commitments to fund a loan and distribute repayments or losses.\nprogram lending_base \"Pool funds for lending\"\nuse lending\nuse financing\nuse wallet\n\nobject plan \"Plan\" {\n fields { price: money }\n attach allowance = financing.limits {\n borrower: owner, per_borrower: runtime\n expose create as request_limit\n expose approve as approve_limit\n }\n attach budget = financing.portfolio_limit {\n limit: runtime\n expose create as create_budget\n expose approve as approve_budget\n }\n // Architect sets the placeholder profit rate during tailoring.\n attach plan = financing.installments {\n borrower: owner, capital: operator\n months: 2, pricing: flat_total, profit_rate: 0%\n disburse_to: borrower, limits: allowance, portfolio: budget\n expose create as quote\n expose sign as sign\n expose disburse as fund\n expose cancel as cancel_quote\n expose void as cancel_plan\n expose payoff as repay_early\n expose complete as complete\n }\n attach balance = wallet.balance {\n holder: actor\n expose create as create_balance\n expose activate as activate_balance\n expose topup as add_funds\n expose withdraw as withdraw_funds\n expose close as close_balance\n }\n attach round = lending.round {\n borrower: owner, plan: plan\n expose create as open_round\n expose close as close_round\n }\n attach commitment = lending.commitment {\n round: round, wallet: balance, investor: actor\n expose create as commit\n expose withdraw as withdraw_commitment\n }\n attach returns = lending.distribution {\n round: round, receipt: plan.settlement\n expose create as record_settlement\n expose prepare_cash as prepare_returns\n expose distribute_cash as distribute_returns\n }\n attach losses = lending.distribution {\n round: round, receipt: plan.settlement, mode: loss\n expose create as record_loss\n expose prepare_loss as prepare_losses\n expose distribute_loss as distribute_losses\n }\n}\n\nexpose plan.plan.payment.create as record_payment\nexpose plan.plan.payment.pay as pay_instalment\nexpose plan.plan.payment.refund as refund_payment\nexpose plan.plan.payoff_quote.create as quote_payoff\n\nexpose plan.returns.share.create as create_return_share\nexpose plan.losses.share.create as create_loss_share\nexpose plan.plan.write_off_request.create as request_write_off\nexpose plan.plan.write_off_request.apply as apply_write_off\nexpose plan.plan.write_off_request.cancel as cancel_write_off\n" },
|
|
8
|
+
{ "id": "marketplace", "title": "Connect buyers and sellers", "summary": "Turn a seller’s offer into an order with payment held until acceptance.", "headers": ["marketplace", "escrow"], "source": "// Turn a seller’s offer into an order with payment held until acceptance.\nprogram marketplace_base \"Connect buyers and sellers\"\nuse marketplace\nuse escrow\nparty seller: business\n\nobject order \"Order\" {\n fields { price: money }\n attach offer = marketplace.listing {\n seller: seller\n expose create as create_offer\n expose publish as publish_offer\n expose withdraw as withdraw_offer\n expose sell as sell_offer\n }\n attach order = marketplace.order {\n listing: offer, buyer: owner, fulfiller: seller\n expose create as create_order\n expose commit as commit_order\n expose fulfill as fulfill_order\n expose cancel as cancel_order\n }\n attach payment = escrow.hold {\n payer: owner, payee: seller\n expose create as create\n expose fund as fund\n expose deliver as deliver\n expose accept as accept\n expose dispute as dispute\n expose verify_return as verify_return\n expose refund as refund\n expose refund_undelivered as refund_undelivered\n expose settle_release as settle_release\n expose settle_return as settle_return\n expose settle_refund as settle_refund\n expose cancel as cancel\n }\n}\n" },
|
|
9
|
+
{ "id": "money", "title": "Collect a payment", "summary": "Collect a payment from a customer.", "headers": ["money"], "source": "// Collect a payment from a customer.\nprogram money_base \"Collect a payment\"\nuse money\n\nobject purchase \"Purchase\" {\n attach payment = money.transfer {\n payer: owner, payee: operator\n expose create as create\n expose pay as pay\n expose cancel as cancel\n }\n}\n" },
|
|
10
|
+
{ "id": "reporting", "title": "Track repayments", "summary": "Report outstanding balances and overdue repayments on financed purchases.", "headers": ["reporting", "financing"], "source": "// Report outstanding balances and overdue repayments on financed purchases.\nprogram reporting_base \"Track repayments\"\nuse reporting\nuse financing\n\nobject purchase \"Purchase\" {\n fields { price: money }\n attach allowance = financing.limits {\n borrower: owner, per_borrower: runtime\n expose create as request_limit\n expose approve as approve_limit\n }\n attach budget = financing.portfolio_limit {\n limit: runtime\n expose create as create_budget\n expose approve as approve_budget\n }\n // Architect sets the placeholder profit rate during tailoring.\n attach plan = financing.installments {\n borrower: owner, capital: operator\n months: 2, pricing: flat_total, profit_rate: 0%\n disburse_to: borrower, limits: allowance, portfolio: budget\n expose create as quote\n expose sign as sign\n expose disburse as fund\n expose cancel as cancel_quote\n expose void as cancel_plan\n expose payoff as repay_early\n expose complete as complete\n }\n attach reports = reporting.portfolio {\n on: plan\n expose create as create_reports\n }\n}\n\nexpose purchase.plan.payment.create as record_payment\nexpose purchase.plan.payment.pay as pay_instalment\nexpose purchase.plan.payment.refund as refund_payment\nexpose purchase.plan.payoff_quote.create as quote_payoff\n" },
|
|
11
|
+
{ "id": "savings", "title": "Save as a group", "summary": "Collect contributions into a shared pot and pay each member in turn.", "headers": ["savings"], "source": "// Collect contributions into a shared pot and pay each member in turn.\nprogram savings_base \"Save as a group\"\nuse savings\n\nobject pot \"Pot\" {\n attach circle = savings.circle {\n contribution: runtime, members: 2, starts: runtime\n expose create as create_circle\n expose disband as disband_circle\n expose close as close_circle\n }\n attach membership = savings.membership {\n circle: circle, member: actor\n expose create as join\n expose activate as activate_membership\n expose withdraw as withdraw\n }\n}\n\nexpose pot.membership.contribution.create as schedule_contribution\n" },
|
|
12
|
+
{ "id": "wallet", "title": "Offer prepaid credit", "summary": "Let a customer add funds and reserve each spend before payment.", "headers": ["wallet"], "source": "// Let a customer add funds and reserve each spend before payment.\nprogram wallet_base \"Offer prepaid credit\"\nuse wallet\n\nobject balance \"Balance\" {\n attach balance = wallet.balance {\n holder: owner\n expose create as create_balance\n expose activate as activate_balance\n expose topup as add_funds\n expose withdraw as withdraw_funds\n expose freeze as freeze_balance\n expose unfreeze as unfreeze_balance\n expose close as close_balance\n }\n attach spend = wallet.spend {\n wallet: balance, payee: operator, holder: owner\n expose create as create\n expose reserve as reserve\n expose pay as pay\n expose cancel as cancel\n }\n}\n" },
|
|
13
|
+
];
|
|
14
|
+
//# sourceMappingURL=bases-bundle.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bases-bundle.js","sourceRoot":"","sources":["../../src/bases-bundle.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,KAAK,GAAc;IAC9B,EAAC,IAAI,EAAC,OAAO,EAAC,OAAO,EAAC,uBAAuB,EAAC,SAAS,EAAC,kEAAkE,EAAC,SAAS,EAAC,CAAC,OAAO,CAAC,EAAC,QAAQ,EAAC,srCAAsrC,EAAC;IAC/0C,EAAC,IAAI,EAAC,aAAa,EAAC,OAAO,EAAC,4BAA4B,EAAC,SAAS,EAAC,sEAAsE,EAAC,SAAS,EAAC,CAAC,aAAa,EAAC,WAAW,CAAC,EAAC,QAAQ,EAAC,wqDAAwqD,EAAC;IACl2D,EAAC,IAAI,EAAC,QAAQ,EAAC,OAAO,EAAC,6BAA6B,EAAC,SAAS,EAAC,oDAAoD,EAAC,SAAS,EAAC,CAAC,QAAQ,CAAC,EAAC,QAAQ,EAAC,ksBAAksB,EAAC;IACr1B,EAAC,IAAI,EAAC,WAAW,EAAC,OAAO,EAAC,mCAAmC,EAAC,SAAS,EAAC,uDAAuD,EAAC,SAAS,EAAC,CAAC,WAAW,CAAC,EAAC,QAAQ,EAAC,0uCAA0uC,EAAC;IAC54C,EAAC,IAAI,EAAC,WAAW,EAAC,OAAO,EAAC,oBAAoB,EAAC,SAAS,EAAC,iEAAiE,EAAC,SAAS,EAAC,CAAC,WAAW,CAAC,EAAC,QAAQ,EAAC,wrBAAwrB,EAAC;IACr1B,EAAC,IAAI,EAAC,SAAS,EAAC,OAAO,EAAC,wBAAwB,EAAC,SAAS,EAAC,6EAA6E,EAAC,SAAS,EAAC,CAAC,SAAS,EAAC,WAAW,EAAC,QAAQ,CAAC,EAAC,QAAQ,EAAC,8+EAA8+E,EAAC;IAC5qF,EAAC,IAAI,EAAC,aAAa,EAAC,OAAO,EAAC,4BAA4B,EAAC,SAAS,EAAC,yEAAyE,EAAC,SAAS,EAAC,CAAC,aAAa,EAAC,QAAQ,CAAC,EAAC,QAAQ,EAAC,yqCAAyqC,EAAC;IACn2C,EAAC,IAAI,EAAC,OAAO,EAAC,OAAO,EAAC,mBAAmB,EAAC,SAAS,EAAC,oCAAoC,EAAC,SAAS,EAAC,CAAC,OAAO,CAAC,EAAC,QAAQ,EAAC,iSAAiS,EAAC;IACxZ,EAAC,IAAI,EAAC,WAAW,EAAC,OAAO,EAAC,kBAAkB,EAAC,SAAS,EAAC,2EAA2E,EAAC,SAAS,EAAC,CAAC,WAAW,EAAC,WAAW,CAAC,EAAC,QAAQ,EAAC,wzCAAwzC,EAAC;IACz+C,EAAC,IAAI,EAAC,SAAS,EAAC,OAAO,EAAC,iBAAiB,EAAC,SAAS,EAAC,sEAAsE,EAAC,SAAS,EAAC,CAAC,SAAS,CAAC,EAAC,QAAQ,EAAC,4mBAA4mB,EAAC;IACvwB,EAAC,IAAI,EAAC,QAAQ,EAAC,OAAO,EAAC,sBAAsB,EAAC,SAAS,EAAC,iEAAiE,EAAC,SAAS,EAAC,CAAC,QAAQ,CAAC,EAAC,QAAQ,EAAC,grBAAgrB,EAAC;CAC10B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bases.d.ts","sourceRoot":"","sources":["../../src/bases.ts"],"names":[],"mappings":"AAAA,mDAAmD;AACnD,MAAM,WAAW,OAAO;IACtB,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;CAChB;AACD,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bases.js","sourceRoot":"","sources":["../../src/bases.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC"}
|
|
@@ -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,
|
|
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,EAiBL,KAAK,WAAW,EAQjB,MAAM,kBAAkB,CAAC;AAU1B,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,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,OAAO,CAAC;IAClB,KAAK,EAAE,OAAO,GAAG,OAAO,GAAG,OAAO,CAAC;CACpC;AACD,MAAM,WAAW,qBAAqB;IACpC,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,IAAI,GAAG;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC;IAC9C,aAAa,CAAC,EAAE;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,UAAU,EAAE,MAAM,CAAC;QAAC,YAAY,EAAE,MAAM,CAAA;KAAE,CAAC;CAC3E;AACD,MAAM,WAAW,oBAAoB;IACnC,OAAO,EAAE,eAAe,CAAC;IACzB,SAAS,EAAE,MAAM,CAAC;CACnB;AACD,MAAM,WAAW,cAAc;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,CAq8Hf"}
|
package/dist/src/compile.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { CompileFailure, didYouMean, fail, failWithCode, } from "./diagnostics.js";
|
|
2
2
|
import { hash as sha256 } from "fast-sha256";
|
|
3
3
|
import { buildUdlCostManifest } from "./cost.js";
|
|
4
|
-
import { validateUdl, resolveField, sameObjectField, subjectPartyRoles, RESERVED_OBJECT_NAMES, UDL_FORMAT_VERSION, udlObjectFieldSchema, udlInstrumentSchema, } from "@hyperscale0/udl";
|
|
4
|
+
import { validateUdl, resolveField, sameAccount, sameObjectField, subjectPartyRoles, RESERVED_OBJECT_NAMES, UDL_FORMAT_VERSION, udlObjectFieldSchema, udlInstrumentSchema, } from "@hyperscale0/udl";
|
|
5
5
|
import { bindingDependencies, parameterDiagnostics, BindingContractError, } from "./binding-contract.js";
|
|
6
6
|
import { tunableBounds } from "./tunables.js";
|
|
7
7
|
import { parseProgram } from "./parse.js";
|
|
@@ -414,6 +414,7 @@ export function compile(source, options = {}) {
|
|
|
414
414
|
// Lowered objects lose their spans, so each keeps the expression that
|
|
415
415
|
// produced it for the name check after lowering.
|
|
416
416
|
const authored = new WeakMap();
|
|
417
|
+
const splitMoves = new WeakSet();
|
|
417
418
|
const declarations = new WeakMap();
|
|
418
419
|
const exposures = [];
|
|
419
420
|
const refundBindings = new Map();
|
|
@@ -1944,6 +1945,7 @@ export function compile(source, options = {}) {
|
|
|
1944
1945
|
from: moneyPath(from),
|
|
1945
1946
|
to: `party.${recipient.value}`,
|
|
1946
1947
|
});
|
|
1948
|
+
splitMoves.add(a.moves.at(-1));
|
|
1947
1949
|
}
|
|
1948
1950
|
if (total !== 10000)
|
|
1949
1951
|
fail(move, "split percentages must sum to 100%", "give the recipients exactly 100% together");
|
|
@@ -3114,6 +3116,13 @@ export function compile(source, options = {}) {
|
|
|
3114
3116
|
fail(objects.get(kind.id), `entry action ${name} must create an attachment as actor`, "expose its create action and bind its acting party to actor");
|
|
3115
3117
|
}
|
|
3116
3118
|
}
|
|
3119
|
+
// Resolve account bindings after lowering, keeping all share calculations
|
|
3120
|
+
// and original leg keys even when a split allocation stays in its source.
|
|
3121
|
+
for (const instrument of document.instruments)
|
|
3122
|
+
for (const action of Object.values(instrument.actions))
|
|
3123
|
+
action.moves = action.moves.filter((move) => !splitMoves.has(move) ||
|
|
3124
|
+
!("amount" in move) ||
|
|
3125
|
+
!sameAccount(document, instrument, move.from, move.to, action.input, action));
|
|
3117
3126
|
const validated = validateUdl(document);
|
|
3118
3127
|
if (!validated.ok)
|
|
3119
3128
|
return {
|