@hyperscale0/hsx 1.0.128 → 1.0.132
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/cli.js +1 -1
- package/dist/src/cli.js.map +1 -1
- package/dist/src/compile.d.ts.map +1 -1
- package/dist/src/compile.js +173 -23
- package/dist/src/compile.js.map +1 -1
- package/dist/src/examples-bundle.js +6 -6
- package/dist/src/examples-bundle.js.map +1 -1
- package/dist/src/parse.js +4 -1
- package/dist/src/parse.js.map +1 -1
- package/dist/src/std-bundle.js +10 -10
- package/dist/src/std-bundle.js.map +1 -1
- package/docs/README.md +78 -27
- package/examples/cards.hsx +7 -1
- package/examples/collections.hsx +4 -0
- package/examples/cost-table.json +80 -56
- package/examples/insurance.hsx +2 -1
- package/examples/marketplace.hsx +3 -1
- package/examples/rental-deposit.hsx +2 -0
- package/examples/wallet.hsx +1 -1
- package/package.json +4 -4
- package/src/cli.ts +1 -1
- package/src/compile.ts +246 -23
- package/src/examples-bundle.ts +6 -6
- package/src/parse.ts +4 -1
- package/src/std-bundle.ts +10 -10
- package/std/booking.hsx +1 -1
- package/std/cards.hsx +20 -11
- package/std/escrow.hsx +45 -10
- package/std/financing.hsx +214 -62
- package/std/insurance.hsx +3 -3
- package/std/lending.hsx +16 -8
- package/std/marketplace.hsx +4 -3
- package/std/money.hsx +28 -14
- package/std/savings.hsx +3 -2
- package/std/wallet.hsx +13 -8
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"std-bundle.js","sourceRoot":"","sources":["../../src/std-bundle.ts"],"names":[],"mappings":"AAAA,oEAAoE;AAEpE,MAAM,CAAC,MAAM,iBAAiB,GAAgC,IAAI,GAAG,CAAiB;IACpF,CAAC,aAAa,EAAE,soLAAsoL,CAAC;IACvpL,CAAC,WAAW,EAAE,
|
|
1
|
+
{"version":3,"file":"std-bundle.js","sourceRoot":"","sources":["../../src/std-bundle.ts"],"names":[],"mappings":"AAAA,oEAAoE;AAEpE,MAAM,CAAC,MAAM,iBAAiB,GAAgC,IAAI,GAAG,CAAiB;IACpF,CAAC,aAAa,EAAE,soLAAsoL,CAAC;IACvpL,CAAC,WAAW,EAAE,6wMAA6wM,CAAC;IAC5xM,CAAC,iBAAiB,EAAE,2sNAA2sN,CAAC;IAChuN,CAAC,YAAY,EAAE,yjQAAyjQ,CAAC;IACzkQ,CAAC,eAAe,EAAE,6nrFAA6nrF,CAAC;IAChprF,CAAC,eAAe,EAAE,41LAA41L,CAAC;IAC/2L,CAAC,aAAa,EAAE,03UAA03U,CAAC;IAC34U,CAAC,iBAAiB,EAAE,syTAAsyT,CAAC;IAC3zT,CAAC,WAAW,EAAE,4zYAA4zY,CAAC;IAC30Y,CAAC,eAAe,EAAE,+q2BAA+q2B,CAAC;IACls2B,CAAC,aAAa,EAAE,ohKAAohK,CAAC;IACriK,CAAC,YAAY,EAAE,2zIAA2zI,CAAC;CAC50I,CAAC,CAAC"}
|
package/docs/README.md
CHANGED
|
@@ -110,11 +110,15 @@ executor. Compilation cannot establish balances, permissions or provider readine
|
|
|
110
110
|
Every attached party parameter binds to `owner`, `actor`, `operator`, a declared
|
|
111
111
|
business, or a declared staff party with a supported role. Configure declared
|
|
112
112
|
business participants per Build. The host binds a declared business to an
|
|
113
|
-
organization customer
|
|
114
|
-
|
|
113
|
+
organization customer of this company, and that business must be a customer with
|
|
114
|
+
an account before the Build that binds it is saved. It also needs an open balance
|
|
115
|
+
account in this Product before it takes part in a payment. Declared person
|
|
115
116
|
parties cannot bind attachments.
|
|
116
117
|
`owner` is the object's resolved customer or business, `actor` is the authenticated
|
|
117
|
-
caller,
|
|
118
|
+
caller, or the customer a Product key or member names in `onBehalfOf`, and
|
|
119
|
+
`operator` is the program operator. `programOperator`, the default
|
|
120
|
+
of many std party parameters, is the same company: it resolves to the Product's
|
|
121
|
+
own company, and a Build binding for it is ignored. A parameter with one of these
|
|
118
122
|
names binds by name. Other required party parameters use a same-named eligible
|
|
119
123
|
declaration, a header default, or an explicit binding. An optional party parameter
|
|
120
124
|
stays unset unless the attachment binds it. Explicit bindings take precedence.
|
|
@@ -128,7 +132,10 @@ compiler freezes the adapter identity, digest and requirements. An unavailable
|
|
|
128
132
|
declaration leaves a null snapshot in compiled output. Product creation and
|
|
129
133
|
recomposition reject unresolved or changed declarations during Build admission.
|
|
130
134
|
Execution checks the frozen declaration too; later adapter unavailability can
|
|
131
|
-
block actions on an already saved Build.
|
|
135
|
+
block actions on an already saved Build. A boundary adapter, such
|
|
136
|
+
as `conformance_boundary`, only binds its accounts and needs no evidence. Any
|
|
137
|
+
other adapter also needs a matching `requires evidence` rule on the action, or
|
|
138
|
+
preview and execution refuse with `subject_adapter_unbound`.
|
|
132
139
|
|
|
133
140
|
An attachment can use `rename { price: salePrice }` to separate requirements with
|
|
134
141
|
different meanings. Matching names must match types and constraints. The compiler
|
|
@@ -140,6 +147,19 @@ Creation accepts `{}`. Every normalized field, including adapter requirements,
|
|
|
140
147
|
is optional at creation. Only a named action requires its subject metadata.
|
|
141
148
|
Use `attach` inside the object block to configure its financial instruments.
|
|
142
149
|
|
|
150
|
+
A required instrument field with no fixed value is a local creation value by
|
|
151
|
+
default. It becomes create `input` on that agreement and never an object field,
|
|
152
|
+
so two agreements on one object keep separate amounts and a wallet spend never
|
|
153
|
+
prefills a later fee. Only a rename such as `rename { dueAt: dueAt }` shares
|
|
154
|
+
it as record metadata: the value then comes from the object field as a create
|
|
155
|
+
subject requirement. An authored object field of the same name does not share
|
|
156
|
+
it; write `rename { price: price }` when the agreement should read that field.
|
|
157
|
+
Later actions still read `self.amount` from the agreement either way. An
|
|
158
|
+
attachment whose create needs input must expose `create`, or compilation fails,
|
|
159
|
+
because a public action on a fresh attachment creates it first with no input.
|
|
160
|
+
A rename binds only fields of the attached instrument itself; renaming a record
|
|
161
|
+
field such as `insurance.cover`'s slice `premium` reports `subject_field_unknown`.
|
|
162
|
+
|
|
143
163
|
## Headers and tunables
|
|
144
164
|
|
|
145
165
|
The header defines the available policies. The company chooses percentages, amounts, durations,
|
|
@@ -244,6 +264,13 @@ a literal. `requires unique "order" on [self.order]` fixes an identity namespace
|
|
|
244
264
|
`requires count of { instrument: child, reference: "parent", anchor: self.id,
|
|
245
265
|
states: [pending], limit: 12 } == 12` checks a typed selection; `sum "amount" of`
|
|
246
266
|
uses the same selection syntax. `invariants` accepts these requirement expressions.
|
|
267
|
+
The reference is a `ref` field or a party account; `reference: "traveller",
|
|
268
|
+
anchor: self.traveller` selects every record of the same traveller. `overlaps:
|
|
269
|
+
{ start: departure, end: returning, from: { field: self.departure }, until: {
|
|
270
|
+
field: self.returning } }` keeps rows whose own `[departure, returning)` period
|
|
271
|
+
meets the range, so a stay ending on the 8th and one starting on the 8th do not
|
|
272
|
+
overlap. `count of { instrument: current(), ..., overlaps: ... } <= 1` stops one
|
|
273
|
+
traveller holding two trips on the same dates.
|
|
247
274
|
`requires hours self.now between 8 and 20 timezone "Asia/Riyadh"` checks local hours.
|
|
248
275
|
`requires evidence self.payer family registry check ownership result verified
|
|
249
276
|
maxAge 1d` requires a recent completed provider check.
|
|
@@ -252,7 +279,9 @@ maxAge 1d` requires a recent completed provider check.
|
|
|
252
279
|
`moves post self.receipt` posts it and `moves void self.receipt` releases it.
|
|
253
280
|
`moves amount from payer shares shares` expands a declared split. Optional `fee`,
|
|
254
281
|
`capture`, `key` and `boundary` modifiers describe a move. `boundary` applies
|
|
255
|
-
only to reservations. Fees settle with create moves, never reservations.
|
|
282
|
+
only to reservations. Fees settle with create moves, never reservations. A fee move
|
|
283
|
+
also derives `<action>_<move>_debit`, the payer's whole debit: amount plus fee and
|
|
284
|
+
tax when the buyer pays, the amount alone when the seller pays. Repeated clauses keep
|
|
256
285
|
their declaration order. The JSON-like clause form remains accepted and lowers
|
|
257
286
|
to the same [UDL clauses](https://github.com/hyperscale0/hyperscale-udl/blob/main/spec/README.md).
|
|
258
287
|
Use `economics { purpose: earning, sourceParty: merchant }` on a move to
|
|
@@ -393,27 +422,38 @@ Read the instrument's states, time gates and moves before promising a money
|
|
|
393
422
|
outcome. A compiler pass does not prove that required actions are exposed,
|
|
394
423
|
adapters are bound, participants have funds, or the flow can finish.
|
|
395
424
|
|
|
396
|
-
| Instrument | Behavior
|
|
397
|
-
| ------------------------------------------ |
|
|
398
|
-
| `financing.installments` | `share` allocates collected profit to a cash payable owned by `capital`. It does not itself pay operator income.
|
|
399
|
-
| `financing.limits` | `per_borrower` caps outstanding principal. Both borrower and portfolio limits must be approved before disbursement; attaching them does not approve them.
|
|
400
|
-
| `lending.round` | The target is the linked plan's principal. Closing requires commitments and held funds to equal that amount.
|
|
401
|
-
| `lending.distribution` | Cash distribution needs an eligible recorded settlement, `prepare_cash`, one share record per funded commitment, then `distribute_cash`. Attaching it moves nothing.
|
|
402
|
-
| `insurance.cover.slice` | `collect` credits premium net of commission to the insurer account. The tenant retains commission. `refund` returns both portions; claims reserve insurer funds. External settlement uses the boundary protocol.
|
|
403
|
-
| `financing.installments`, `savings.circle` | Supply explicit date lists when creating agreements. A term count does not generate a monthly calendar. Savings supports at most 60 distinct member seats.
|
|
404
|
-
| `escrow.hold` | `fund` takes the whole price. Financing into pending escrow collects the remaining down payment and adds capital principal at disbursement; `fund` is not a down-payment checkout.
|
|
405
|
-
| `escrow.hold` | Acceptance timeout enters `disputed` without paying the seller. Delivery and return verification belong to `payee`; rebinding it also changes who receives accepted funds.
|
|
406
|
-
| `escrow.hold` | `deliver_within` (default `14d`) starts at funding. After it passes without delivery, an exposed `refund_undelivered` lets the payer take the whole held price back. Nothing runs it automatically.
|
|
407
|
-
| `wallet.balance` | `topup_fee` (default `0%`) takes a floored percentage of each top-up for the Company. At `1%`, a 100.00 top-up credits 99.00 and earns 1.00.
|
|
408
|
-
| `booking.reservation` | The balance is payable only from `deposit_paid`, so a cancelled booking never takes it. `middle_forfeit` and `late_forfeit` default to `0%`, so every cancellation returns all held money until the author sets them.
|
|
409
|
-
| `financing.late_charge` | `fine` is a fixed money amount, not a percentage of overdue principal.
|
|
410
|
-
| `cards.card` | `spend_limit` is a per-authorization ceiling, not a monthly aggregate.
|
|
425
|
+
| Instrument | Behavior |
|
|
426
|
+
| ------------------------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
427
|
+
| `financing.installments` | `share` allocates collected profit to a cash payable owned by `capital`. It does not itself pay operator income. |
|
|
428
|
+
| `financing.limits` | `per_borrower` caps outstanding principal. Both borrower and portfolio limits must be approved before disbursement; attaching them does not approve them. |
|
|
429
|
+
| `lending.round` | The target is the linked plan's principal. Closing requires commitments and held funds to equal that amount. |
|
|
430
|
+
| `lending.distribution` | Cash distribution needs an eligible recorded settlement, `prepare_cash`, one share record per funded commitment, then `distribute_cash`. Attaching it moves nothing. |
|
|
431
|
+
| `insurance.cover.slice` | `collect` credits premium net of commission to the insurer account. The tenant retains commission. `refund` returns both portions; claims reserve insurer funds. External settlement uses the boundary protocol. |
|
|
432
|
+
| `financing.installments`, `savings.circle` | Supply explicit date lists when creating agreements. A term count does not generate a monthly calendar. Savings supports at most 60 distinct member seats. |
|
|
433
|
+
| `escrow.hold` | `fund` takes the whole price. Financing into pending escrow collects the remaining down payment and adds capital principal at disbursement; `fund` is not a down-payment checkout. |
|
|
434
|
+
| `escrow.hold` | Acceptance timeout enters `disputed` without paying the seller. Delivery and return verification belong to `payee`; rebinding it also changes who receives accepted funds. |
|
|
435
|
+
| `escrow.hold` | `deliver_within` (default `14d`) starts at funding. After it passes without delivery, an exposed `refund_undelivered` lets the payer take the whole held price back. Nothing runs it automatically. |
|
|
436
|
+
| `wallet.balance` | `topup_fee` (default `0%`) takes a floored percentage of each top-up for the Company. At `1%`, a 100.00 top-up credits 99.00 and earns 1.00. |
|
|
437
|
+
| `booking.reservation` | The balance is payable only from `deposit_paid`, so a cancelled booking never takes it. `middle_forfeit` and `late_forfeit` default to `0%`, so every cancellation returns all held money until the author sets them. At departure the clock completes a paid booking and lapses an unpaid one on `late_forfeit`. |
|
|
438
|
+
| `financing.late_charge` | `fine` is a fixed money amount, not a percentage of overdue principal. |
|
|
439
|
+
| `cards.card` | `spend_limit` is a per-authorization ceiling, not a monthly aggregate. Bind `person` to the cardholder's `holder`, such as `person: actor`; create refuses any other party. The person freezes, unfreezes and cancels; the issuer uses `issuer_freeze`, `issuer_unfreeze` and `issuer_cancel`, and only `issuer_unfreeze` lifts a block. |
|
|
411
440
|
|
|
412
441
|
A seller-owned marketplace object can declare `entryActions: [create_order]`
|
|
413
442
|
when `create_order` exposes an attachment's create action with its buyer bound
|
|
414
443
|
to `actor`. This admits active enrolled customers to that action. The default
|
|
415
444
|
is closed. A retained buyer can read the record and run its buyer actions;
|
|
416
445
|
the seller remains owner. Entry never grants access to an existing escrow.
|
|
446
|
+
Without entry actions, the company runs a two-customer sale from its Product
|
|
447
|
+
key: create the record with `onBehalfOf` naming the seller, then run the buyer's
|
|
448
|
+
steps with `onBehalfOf` naming the buyer.
|
|
449
|
+
|
|
450
|
+
The same rule admits the other std creates whose starting party can be a
|
|
451
|
+
customer: `financing.limits` and `financing.installments` (borrower),
|
|
452
|
+
`insurance.cover` (holder), `wallet.balance` (holder) and `savings.membership`
|
|
453
|
+
(member). Several customers can each start one on the same record. A plan,
|
|
454
|
+
commitment or other reference resolves the sibling that binds the same
|
|
455
|
+
accounts to the parties both share, so each customer's plan finds its own
|
|
456
|
+
escrow and each investor's commitment finds their own wallet.
|
|
417
457
|
|
|
418
458
|
`financing.limits` and `financing.portfolio_limit` declare `scope: product`.
|
|
419
459
|
Create and approve the portfolio limit once per Product and the borrower limit
|
|
@@ -426,8 +466,10 @@ The account primitive creates it automatically and shares it across the Product.
|
|
|
426
466
|
Zero-tax escrow releases need no additional party setup.
|
|
427
467
|
|
|
428
468
|
The financing, collections and lending samples expose payment creation, payment,
|
|
429
|
-
refund and payoff quotes through the object's existing action routes.
|
|
430
|
-
|
|
469
|
+
refund and payoff quotes through the object's existing action routes. Record
|
|
470
|
+
actions are private: the parent still runs them, but a caller sees one only
|
|
471
|
+
after the program exposes it. A child alias names the full attachment path, for
|
|
472
|
+
example:
|
|
431
473
|
|
|
432
474
|
```hsx
|
|
433
475
|
expose enrolment.tuition.payment.create as create_payment
|
|
@@ -449,9 +491,10 @@ allocation order and payoff rebate; aliases do not change those terms.
|
|
|
449
491
|
|
|
450
492
|
The [lending sample](../examples/lending.hsx) also exposes share creation. Callers
|
|
451
493
|
still need dates, agreement inputs, funded wallets and eligible settlements.
|
|
452
|
-
|
|
453
|
-
the object
|
|
454
|
-
|
|
494
|
+
Every agreement reference is an optional creation input on an exposed create.
|
|
495
|
+
With one matching agreement on the object the engine picks it; with several,
|
|
496
|
+
such as a plan's slices or a lending round's settlements, the caller passes the
|
|
497
|
+
chosen instance ID under the reference's name.
|
|
455
498
|
Insurance needs premium-slice records and actions. Savings needs dated
|
|
456
499
|
contribution records. Read each header's creation and lifecycle requirements.
|
|
457
500
|
|
|
@@ -481,7 +524,8 @@ cost assessment is a separate record.
|
|
|
481
524
|
|
|
482
525
|
Bind `insurance.cover.broker` to the agency that receives commission. Collection
|
|
483
526
|
pays the insurer's net premium and the broker's commission as two moves. Refunds
|
|
484
|
-
reverse those same portions. The default broker is the
|
|
527
|
+
reverse those same portions. The default broker, `programOperator`, is the
|
|
528
|
+
Product's own company and needs no binding.
|
|
485
529
|
`claim.deny` accepts only `submitted`; after approval, `pay` or expiry consumes
|
|
486
530
|
the reservation. `claim_limit` is the sum insured, supplied per cover at creation:
|
|
487
531
|
approved and paid claims on one cover never total more. `adapter` names a
|
|
@@ -493,6 +537,13 @@ separately for eligible premium refunds before the paid period starts. Active
|
|
|
493
537
|
and expired premium periods are excluded. A card transaction needs a captured
|
|
494
538
|
authorization and its own record before refund, but no authorization-expiry wait.
|
|
495
539
|
|
|
540
|
+
A booking runs two clock actions at departure. `complete` takes a `paid`
|
|
541
|
+
booking and pays the held money to `operator`. `lapse` takes a booking still
|
|
542
|
+
`reserved` or `deposit_paid` to `cancelled`: `operator` keeps `late_forfeit` of
|
|
543
|
+
the held money and the customer gets the rest back. An unpaid balance at
|
|
544
|
+
departure therefore costs the customer the same as `cancel_late`, and with the
|
|
545
|
+
default `0%` it costs nothing. Nothing stays held after departure.
|
|
546
|
+
|
|
496
547
|
A savings membership becomes `received` after its pot payout. Its contribution
|
|
497
548
|
records become `paid` independently. Future contributions can remain pending
|
|
498
549
|
after the member receives the pot; paying a contribution does not advance their
|
|
@@ -506,7 +557,7 @@ An attachment can declare the purpose of an imported action's money:
|
|
|
506
557
|
|
|
507
558
|
```hsx
|
|
508
559
|
attach visit = wallet.spend {
|
|
509
|
-
wallet: balance, payee: operator
|
|
560
|
+
wallet: balance, payee: operator, holder: owner
|
|
510
561
|
economics pay { purpose: earning, sourceParty: owner }
|
|
511
562
|
expose pay as charge_visit
|
|
512
563
|
}
|
package/examples/cards.hsx
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
// A company issues expense cards to employees and reserves each supplier payment before capture.
|
|
2
2
|
program team_expense_cards "Team expense cards"
|
|
3
3
|
use cards
|
|
4
|
+
// supplier is a business this program declares, so plan needs {"partyBindings":{"supplier":"<partyId>"}}.
|
|
5
|
+
// That partyId is an organization customer's: create the Product from this source without the payment
|
|
6
|
+
// and receipt attachments, add the customer with customer.create, activate its access, open its
|
|
7
|
+
// customer_balance account, then compose this source with the binding.
|
|
4
8
|
party supplier: business
|
|
5
9
|
|
|
6
10
|
object employee "Employee card" {
|
|
@@ -14,10 +18,12 @@ object employee "Employee card" {
|
|
|
14
18
|
}
|
|
15
19
|
attach card = cards.card {
|
|
16
20
|
expose create as create_card
|
|
17
|
-
holder: holder, spend_limit: 5000 SAR
|
|
21
|
+
holder: holder, person: owner, spend_limit: 5000 SAR
|
|
18
22
|
expose activate as activate_card
|
|
19
23
|
expose freeze as freeze_card
|
|
20
24
|
expose unfreeze as unfreeze_card
|
|
25
|
+
expose issuer_freeze as block_card
|
|
26
|
+
expose issuer_unfreeze as unblock_card
|
|
21
27
|
}
|
|
22
28
|
attach payment = cards.authorization {
|
|
23
29
|
expose create as create_payment
|
package/examples/collections.hsx
CHANGED
|
@@ -2,6 +2,10 @@
|
|
|
2
2
|
program business_collections "Small business collections"
|
|
3
3
|
use collections
|
|
4
4
|
use financing
|
|
5
|
+
// agency is a business this program declares, so plan needs {"partyBindings":{"agency":"<partyId>"}}.
|
|
6
|
+
// That partyId is an organization customer's: create the Product from this source without the recovery
|
|
7
|
+
// and contact attachments, add the customer with customer.create, activate its access, open its
|
|
8
|
+
// customer_balance account, then compose this source with the binding.
|
|
5
9
|
party agency: business
|
|
6
10
|
|
|
7
11
|
object facility "Business loan" {
|
package/examples/cost-table.json
CHANGED
|
@@ -4,15 +4,14 @@
|
|
|
4
4
|
"declaredMeters": [
|
|
5
5
|
"account.active_month",
|
|
6
6
|
"instrument.event.count",
|
|
7
|
-
"transfer.internal.count"
|
|
8
|
-
"transfer.internal.volume_sar"
|
|
7
|
+
"transfer.internal.count"
|
|
9
8
|
],
|
|
10
|
-
"effectiveTableDigest": "
|
|
9
|
+
"effectiveTableDigest": "e58f5c33766a44254880f328f1f9fb886b63d510bf3dfa0f9fb529a0638d74c6",
|
|
11
10
|
"fixed": {
|
|
12
11
|
"activationBaseMinor": "500000",
|
|
13
|
-
"activationPerPointMinor": "
|
|
12
|
+
"activationPerPointMinor": "10000",
|
|
14
13
|
"monthlyBaseMinor": "100000",
|
|
15
|
-
"monthlyPerPointMinor": "
|
|
14
|
+
"monthlyPerPointMinor": "2000",
|
|
16
15
|
"weights": {
|
|
17
16
|
"aggregate_invariant": 2,
|
|
18
17
|
"flow": 1,
|
|
@@ -69,7 +68,7 @@
|
|
|
69
68
|
"bps": 0,
|
|
70
69
|
"meter": "account.active_month",
|
|
71
70
|
"payer": "product",
|
|
72
|
-
"perEventMinor": "
|
|
71
|
+
"perEventMinor": "500",
|
|
73
72
|
"settlement": "invoice",
|
|
74
73
|
"signature": "meters.account.active_month"
|
|
75
74
|
},
|
|
@@ -77,18 +76,25 @@
|
|
|
77
76
|
"bps": 0,
|
|
78
77
|
"meter": "instrument.event.count",
|
|
79
78
|
"payer": "product",
|
|
80
|
-
"perEventMinor": "
|
|
79
|
+
"perEventMinor": "25",
|
|
81
80
|
"settlement": "invoice",
|
|
82
81
|
"signature": "meters.instrument.event.count"
|
|
83
82
|
},
|
|
84
83
|
{
|
|
85
|
-
"bps":
|
|
84
|
+
"bps": 0,
|
|
86
85
|
"meter": "transfer.internal.count",
|
|
87
|
-
"payer": "
|
|
88
|
-
"perEventMinor": "
|
|
89
|
-
"settlement": "
|
|
90
|
-
"signature": "
|
|
91
|
-
|
|
86
|
+
"payer": "product",
|
|
87
|
+
"perEventMinor": "25",
|
|
88
|
+
"settlement": "invoice",
|
|
89
|
+
"signature": "meters.transfer.internal.count"
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
"bps": 0,
|
|
93
|
+
"meter": "instrument.event.count",
|
|
94
|
+
"payer": "product",
|
|
95
|
+
"perEventMinor": "0",
|
|
96
|
+
"settlement": "invoice",
|
|
97
|
+
"signature": "moves.transfer.internal"
|
|
92
98
|
},
|
|
93
99
|
{
|
|
94
100
|
"bps": 0,
|
|
@@ -155,22 +161,21 @@
|
|
|
155
161
|
"signature": "unwinds.void"
|
|
156
162
|
}
|
|
157
163
|
],
|
|
158
|
-
"version": "2026-09-
|
|
164
|
+
"version": "2026-09-27.1"
|
|
159
165
|
},
|
|
160
166
|
{
|
|
161
167
|
"currency": "USD",
|
|
162
168
|
"declaredMeters": [
|
|
163
169
|
"account.active_month",
|
|
164
170
|
"instrument.event.count",
|
|
165
|
-
"transfer.internal.count"
|
|
166
|
-
"transfer.internal.volume_usd"
|
|
171
|
+
"transfer.internal.count"
|
|
167
172
|
],
|
|
168
|
-
"effectiveTableDigest": "
|
|
173
|
+
"effectiveTableDigest": "f2845819ad077745ed5d0af924b33f34210b20da703522e78aa2629d9be5040e",
|
|
169
174
|
"fixed": {
|
|
170
175
|
"activationBaseMinor": "133300",
|
|
171
|
-
"activationPerPointMinor": "
|
|
176
|
+
"activationPerPointMinor": "2700",
|
|
172
177
|
"monthlyBaseMinor": "26700",
|
|
173
|
-
"monthlyPerPointMinor": "
|
|
178
|
+
"monthlyPerPointMinor": "500",
|
|
174
179
|
"weights": {
|
|
175
180
|
"aggregate_invariant": 2,
|
|
176
181
|
"flow": 1,
|
|
@@ -227,7 +232,7 @@
|
|
|
227
232
|
"bps": 0,
|
|
228
233
|
"meter": "account.active_month",
|
|
229
234
|
"payer": "product",
|
|
230
|
-
"perEventMinor": "
|
|
235
|
+
"perEventMinor": "133",
|
|
231
236
|
"settlement": "invoice",
|
|
232
237
|
"signature": "meters.account.active_month"
|
|
233
238
|
},
|
|
@@ -235,18 +240,25 @@
|
|
|
235
240
|
"bps": 0,
|
|
236
241
|
"meter": "instrument.event.count",
|
|
237
242
|
"payer": "product",
|
|
238
|
-
"perEventMinor": "
|
|
243
|
+
"perEventMinor": "7",
|
|
239
244
|
"settlement": "invoice",
|
|
240
245
|
"signature": "meters.instrument.event.count"
|
|
241
246
|
},
|
|
242
247
|
{
|
|
243
|
-
"bps":
|
|
248
|
+
"bps": 0,
|
|
244
249
|
"meter": "transfer.internal.count",
|
|
245
|
-
"payer": "
|
|
246
|
-
"perEventMinor": "
|
|
247
|
-
"settlement": "
|
|
248
|
-
"signature": "
|
|
249
|
-
|
|
250
|
+
"payer": "product",
|
|
251
|
+
"perEventMinor": "7",
|
|
252
|
+
"settlement": "invoice",
|
|
253
|
+
"signature": "meters.transfer.internal.count"
|
|
254
|
+
},
|
|
255
|
+
{
|
|
256
|
+
"bps": 0,
|
|
257
|
+
"meter": "instrument.event.count",
|
|
258
|
+
"payer": "product",
|
|
259
|
+
"perEventMinor": "0",
|
|
260
|
+
"settlement": "invoice",
|
|
261
|
+
"signature": "moves.transfer.internal"
|
|
250
262
|
},
|
|
251
263
|
{
|
|
252
264
|
"bps": 0,
|
|
@@ -313,22 +325,21 @@
|
|
|
313
325
|
"signature": "unwinds.void"
|
|
314
326
|
}
|
|
315
327
|
],
|
|
316
|
-
"version": "2026-09-
|
|
328
|
+
"version": "2026-09-27.1"
|
|
317
329
|
},
|
|
318
330
|
{
|
|
319
331
|
"currency": "EUR",
|
|
320
332
|
"declaredMeters": [
|
|
321
333
|
"account.active_month",
|
|
322
334
|
"instrument.event.count",
|
|
323
|
-
"transfer.internal.count"
|
|
324
|
-
"transfer.internal.volume_eur"
|
|
335
|
+
"transfer.internal.count"
|
|
325
336
|
],
|
|
326
|
-
"effectiveTableDigest": "
|
|
337
|
+
"effectiveTableDigest": "f741132e1aa38a860d855a83f20f12c0ec8a7ec5379117c407799e2012e63335",
|
|
327
338
|
"fixed": {
|
|
328
339
|
"activationBaseMinor": "125000",
|
|
329
|
-
"activationPerPointMinor": "
|
|
340
|
+
"activationPerPointMinor": "2500",
|
|
330
341
|
"monthlyBaseMinor": "25000",
|
|
331
|
-
"monthlyPerPointMinor": "
|
|
342
|
+
"monthlyPerPointMinor": "500",
|
|
332
343
|
"weights": {
|
|
333
344
|
"aggregate_invariant": 2,
|
|
334
345
|
"flow": 1,
|
|
@@ -385,7 +396,7 @@
|
|
|
385
396
|
"bps": 0,
|
|
386
397
|
"meter": "account.active_month",
|
|
387
398
|
"payer": "product",
|
|
388
|
-
"perEventMinor": "
|
|
399
|
+
"perEventMinor": "125",
|
|
389
400
|
"settlement": "invoice",
|
|
390
401
|
"signature": "meters.account.active_month"
|
|
391
402
|
},
|
|
@@ -393,18 +404,25 @@
|
|
|
393
404
|
"bps": 0,
|
|
394
405
|
"meter": "instrument.event.count",
|
|
395
406
|
"payer": "product",
|
|
396
|
-
"perEventMinor": "
|
|
407
|
+
"perEventMinor": "6",
|
|
397
408
|
"settlement": "invoice",
|
|
398
409
|
"signature": "meters.instrument.event.count"
|
|
399
410
|
},
|
|
400
411
|
{
|
|
401
|
-
"bps":
|
|
412
|
+
"bps": 0,
|
|
402
413
|
"meter": "transfer.internal.count",
|
|
403
|
-
"payer": "
|
|
404
|
-
"perEventMinor": "
|
|
405
|
-
"settlement": "
|
|
406
|
-
"signature": "
|
|
407
|
-
|
|
414
|
+
"payer": "product",
|
|
415
|
+
"perEventMinor": "6",
|
|
416
|
+
"settlement": "invoice",
|
|
417
|
+
"signature": "meters.transfer.internal.count"
|
|
418
|
+
},
|
|
419
|
+
{
|
|
420
|
+
"bps": 0,
|
|
421
|
+
"meter": "instrument.event.count",
|
|
422
|
+
"payer": "product",
|
|
423
|
+
"perEventMinor": "0",
|
|
424
|
+
"settlement": "invoice",
|
|
425
|
+
"signature": "moves.transfer.internal"
|
|
408
426
|
},
|
|
409
427
|
{
|
|
410
428
|
"bps": 0,
|
|
@@ -471,22 +489,21 @@
|
|
|
471
489
|
"signature": "unwinds.void"
|
|
472
490
|
}
|
|
473
491
|
],
|
|
474
|
-
"version": "2026-09-
|
|
492
|
+
"version": "2026-09-27.1"
|
|
475
493
|
},
|
|
476
494
|
{
|
|
477
495
|
"currency": "GBP",
|
|
478
496
|
"declaredMeters": [
|
|
479
497
|
"account.active_month",
|
|
480
498
|
"instrument.event.count",
|
|
481
|
-
"transfer.internal.count"
|
|
482
|
-
"transfer.internal.volume_gbp"
|
|
499
|
+
"transfer.internal.count"
|
|
483
500
|
],
|
|
484
|
-
"effectiveTableDigest": "
|
|
501
|
+
"effectiveTableDigest": "12ed3fa44010e80ae20c114d7dd94f277686225c040576a8bb96d12a0fe5333a",
|
|
485
502
|
"fixed": {
|
|
486
503
|
"activationBaseMinor": "104200",
|
|
487
|
-
"activationPerPointMinor": "
|
|
504
|
+
"activationPerPointMinor": "2100",
|
|
488
505
|
"monthlyBaseMinor": "20800",
|
|
489
|
-
"monthlyPerPointMinor": "
|
|
506
|
+
"monthlyPerPointMinor": "400",
|
|
490
507
|
"weights": {
|
|
491
508
|
"aggregate_invariant": 2,
|
|
492
509
|
"flow": 1,
|
|
@@ -543,7 +560,7 @@
|
|
|
543
560
|
"bps": 0,
|
|
544
561
|
"meter": "account.active_month",
|
|
545
562
|
"payer": "product",
|
|
546
|
-
"perEventMinor": "
|
|
563
|
+
"perEventMinor": "104",
|
|
547
564
|
"settlement": "invoice",
|
|
548
565
|
"signature": "meters.account.active_month"
|
|
549
566
|
},
|
|
@@ -551,18 +568,25 @@
|
|
|
551
568
|
"bps": 0,
|
|
552
569
|
"meter": "instrument.event.count",
|
|
553
570
|
"payer": "product",
|
|
554
|
-
"perEventMinor": "
|
|
571
|
+
"perEventMinor": "5",
|
|
555
572
|
"settlement": "invoice",
|
|
556
573
|
"signature": "meters.instrument.event.count"
|
|
557
574
|
},
|
|
558
575
|
{
|
|
559
|
-
"bps":
|
|
576
|
+
"bps": 0,
|
|
560
577
|
"meter": "transfer.internal.count",
|
|
561
|
-
"payer": "
|
|
562
|
-
"perEventMinor": "
|
|
563
|
-
"settlement": "
|
|
564
|
-
"signature": "
|
|
565
|
-
|
|
578
|
+
"payer": "product",
|
|
579
|
+
"perEventMinor": "5",
|
|
580
|
+
"settlement": "invoice",
|
|
581
|
+
"signature": "meters.transfer.internal.count"
|
|
582
|
+
},
|
|
583
|
+
{
|
|
584
|
+
"bps": 0,
|
|
585
|
+
"meter": "instrument.event.count",
|
|
586
|
+
"payer": "product",
|
|
587
|
+
"perEventMinor": "0",
|
|
588
|
+
"settlement": "invoice",
|
|
589
|
+
"signature": "moves.transfer.internal"
|
|
566
590
|
},
|
|
567
591
|
{
|
|
568
592
|
"bps": 0,
|
|
@@ -629,6 +653,6 @@
|
|
|
629
653
|
"signature": "unwinds.void"
|
|
630
654
|
}
|
|
631
655
|
],
|
|
632
|
-
"version": "2026-09-
|
|
656
|
+
"version": "2026-09-27.1"
|
|
633
657
|
}
|
|
634
658
|
]
|
package/examples/insurance.hsx
CHANGED
|
@@ -13,7 +13,8 @@ object device "Insured device" {
|
|
|
13
13
|
expose pay as pay_for_device
|
|
14
14
|
}
|
|
15
15
|
// conformance_boundary is the sandbox insurer adapter; swap in the insurer's registered adapter to go live.
|
|
16
|
-
// Premiums net of commission go to its account.
|
|
16
|
+
// Premiums net of commission go to its account. The default broker is the retailer, which keeps the commission.
|
|
17
|
+
// claim_limit is the sum insured, set per cover at creation.
|
|
17
18
|
attach protection = insurance.cover {
|
|
18
19
|
expose create as create_protection
|
|
19
20
|
holder: owner, adapter: "conformance_boundary", commission: 10%, covers: purchase
|
package/examples/marketplace.hsx
CHANGED
|
@@ -7,14 +7,16 @@ object project "Project" {
|
|
|
7
7
|
fields { brief: text, deliverable: text, price: money }
|
|
8
8
|
columns: [brief, deliverable, price]
|
|
9
9
|
attach offer = marketplace.listing {
|
|
10
|
+
rename { price: price }
|
|
10
11
|
expose create as create_offer
|
|
11
12
|
seller: owner
|
|
12
13
|
expose publish as publish_offer
|
|
13
14
|
expose withdraw as withdraw_offer
|
|
14
15
|
}
|
|
15
16
|
attach order = marketplace.order {
|
|
17
|
+
rename { price: price }
|
|
16
18
|
expose create as create_order
|
|
17
|
-
listing: offer, buyer: actor
|
|
19
|
+
listing: offer, buyer: actor, fulfiller: owner
|
|
18
20
|
expose commit as place_order
|
|
19
21
|
expose fulfill as finish_order
|
|
20
22
|
}
|
|
@@ -45,6 +45,8 @@ object rental "Equipment rental" {
|
|
|
45
45
|
fields { equipment: text }
|
|
46
46
|
columns: [equipment, dueAt]
|
|
47
47
|
attach security = deposit {
|
|
48
|
+
// dueAt is a column, so it stays shared object metadata.
|
|
49
|
+
rename { dueAt: dueAt }
|
|
48
50
|
expose create as agree_rental
|
|
49
51
|
expose fund as pay_deposit
|
|
50
52
|
expose return_on_time as return_equipment
|
package/examples/wallet.hsx
CHANGED
|
@@ -15,7 +15,7 @@ object membership "Membership" {
|
|
|
15
15
|
}
|
|
16
16
|
attach visit = wallet.spend {
|
|
17
17
|
expose create as create_visit
|
|
18
|
-
wallet: balance, payee: operator
|
|
18
|
+
wallet: balance, payee: operator, holder: owner
|
|
19
19
|
economics pay { purpose: earning, sourceParty: owner }
|
|
20
20
|
expose reserve as reserve_visit
|
|
21
21
|
expose pay as charge_visit
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hyperscale0/hsx",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.132",
|
|
4
4
|
"description": "The strictly typed HSX language: compile total financial programs into canonical UDL.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"hsx",
|
|
@@ -84,8 +84,8 @@
|
|
|
84
84
|
"examples:bundle": "bun scripts/bundle-examples.ts"
|
|
85
85
|
},
|
|
86
86
|
"dependencies": {
|
|
87
|
-
"@hyperscale0/adl": "1.0.
|
|
88
|
-
"@hyperscale0/udl": "1.0.
|
|
87
|
+
"@hyperscale0/adl": "1.0.132",
|
|
88
|
+
"@hyperscale0/udl": "1.0.132",
|
|
89
89
|
"fast-sha256": "1.3.0"
|
|
90
90
|
},
|
|
91
91
|
"devDependencies": {
|
|
@@ -97,5 +97,5 @@
|
|
|
97
97
|
"Amir Ayub",
|
|
98
98
|
"Sara AlBakaawi"
|
|
99
99
|
],
|
|
100
|
-
"gitHead": "
|
|
100
|
+
"gitHead": "3449c1fe1ea4ee1ae40edc3775ab7bebf890e91b"
|
|
101
101
|
}
|
package/src/cli.ts
CHANGED
|
@@ -87,7 +87,7 @@ export async function runCli(argv: readonly string[], io: Io): Promise<number> {
|
|
|
87
87
|
const result = compile(source, { standardLibrary });
|
|
88
88
|
for (const d of result.diagnostics)
|
|
89
89
|
io.err(
|
|
90
|
-
`${d.source && d.source !== "program" ? d.source : file}:${d.line}:${d.column}: ${d.code} ${d.message
|
|
90
|
+
`${d.source && d.source !== "program" ? d.source : file}:${d.line}:${d.column}: ${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;
|