@hyperscale0/hsx 5.4.0 → 5.4.2

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.
Files changed (43) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/README.md +45 -62
  3. package/dist/src/examples-bundle.d.ts.map +1 -1
  4. package/dist/src/examples-bundle.js +16 -15
  5. package/dist/src/examples-bundle.js.map +1 -1
  6. package/dist/src/std-bundle.js +12 -12
  7. package/dist/src/std-bundle.js.map +1 -1
  8. package/dist/src/version.d.ts +1 -1
  9. package/dist/src/version.js +1 -1
  10. package/docs/README.md +136 -30
  11. package/docs/examples.md +1 -0
  12. package/examples/cards.hsx +4 -0
  13. package/examples/collections.hsx +5 -2
  14. package/examples/escrow.hsx +2 -0
  15. package/examples/financing.hsx +3 -0
  16. package/examples/insurance.hsx +3 -0
  17. package/examples/lending.hsx +5 -0
  18. package/examples/library.hsx +3 -3
  19. package/examples/marketplace.hsx +6 -0
  20. package/examples/money.hsx +1 -0
  21. package/examples/rental-deposit.hsx +60 -0
  22. package/examples/repair-approval.hsx +1 -0
  23. package/examples/reporting.hsx +4 -1
  24. package/examples/savings.hsx +2 -0
  25. package/examples/serviced.hsx +5 -4
  26. package/examples/travel.hsx +3 -0
  27. package/examples/wallet.hsx +2 -0
  28. package/package.json +3 -3
  29. package/src/examples-bundle.ts +16 -15
  30. package/src/std-bundle.ts +12 -12
  31. package/src/version.ts +1 -1
  32. package/std/cards.hsx +4 -0
  33. package/std/collections.hsx +4 -0
  34. package/std/escrow.hsx +4 -0
  35. package/std/financing.hsx +4 -0
  36. package/std/insurance.hsx +4 -0
  37. package/std/lending.hsx +4 -0
  38. package/std/marketplace.hsx +4 -0
  39. package/std/money.hsx +4 -0
  40. package/std/reporting.hsx +4 -0
  41. package/std/savings.hsx +4 -0
  42. package/std/travel.hsx +5 -0
  43. package/std/wallet.hsx +4 -0
package/src/version.ts CHANGED
@@ -1 +1 @@
1
- export const HSX_VERSION = "5.4.0";
1
+ export const HSX_VERSION = "5.4.2";
package/std/cards.hsx CHANGED
@@ -12,6 +12,10 @@ header cards
12
12
  // Disputes need a posted transaction, issuer review and win before their deadline;
13
13
  // win invokes the same refund. The alias never changes the declared action actor.
14
14
 
15
+ // Cost: authorization approve, capture and reverse each declare one transfer
16
+ // instruction. Transaction refund declares one transfer; a successful dispute
17
+ // invokes that refund. Card state changes alone declare no transfers.
18
+
15
19
  instrument cardholder(holder: party) {
16
20
  summary: "An account holder whose card access can be activated, suspended or closed."
17
21
  fields { holder: account of holder }
@@ -11,6 +11,10 @@ header collections
11
11
  // before_due/overdue are clock-owned and require active debt. Scheduled admission
12
12
  // does not prove delivery or retry. No collector can infer authority from an alias.
13
13
 
14
+ // Cost: case recovery invokes the linked payment and then charges its agency
15
+ // fee. Its count includes those child effects. Contact and reminder delivery costs
16
+ // are not provider prices in hsx cost; the executor supplies commercial tariffs.
17
+
14
18
  instrument case(on: ref<financing.installments>[], agency: party, capital: party = programOperator, overdue: duration = 3d, fee: percent = 20%) {
15
19
  revisioned: true
16
20
  summary: "Refer an overdue installment without creating another debt."
package/std/escrow.hsx CHANGED
@@ -11,6 +11,10 @@ header escrow
11
11
  // it returns its credited balance to payer before cancelling. Confirm requires
12
12
  // the whole captured price in held. This flow has no partial release or refund.
13
13
 
14
+ // Cost: create declares one owned account. Fund and refund each declare one
15
+ // transfer; accept expands the configured fee and tax into moves. Run hsx cost
16
+ // on the composed program for instruction counts. The executor supplies prices.
17
+
14
18
  instrument hold(payer: party = party(person), payee: party = programOperator, accept_within: duration = 48h, fee: fee = { seller: 0%, tax: 0% }, dispute: policy = { refund_after: return_verified }) {
15
19
  revisioned: true
16
20
  summary: "Hold the subject price through delivery, acceptance and verified return."
package/std/financing.hsx CHANGED
@@ -22,6 +22,10 @@ header financing
22
22
  // not evidence of outside funding. Caller-authorized limit approvals and advances
23
23
  // need the Product's operation authority. No clock declaration proves retries.
24
24
 
25
+ // Cost: installments include cash and claim moves, child-account creation and
26
+ // bounded invocations across slices and assessments. Month and charge limits affect
27
+ // the bound. Run hsx cost on the selected policies; profit is not a platform tariff.
28
+
25
29
  instrument installments(months: integer(1, 366), charge_limit: integer(1, 3) = 3, profit: percent, disburse_to: enum(funds, borrower) = funds, profit_earned: enum(on_payment, by_schedule, at_disbursement) = on_payment, apply: enum(fines_profit_principal, principal_profit, pro_rata) = fines_profit_principal, payoff_rebate: percent = 100%, write_off_after: duration = 90d, max_extension: duration = 90d, max_amendments: integer(0, 366) = 2, waiver_limit: percent = 100%, amendment_expiry: duration = 7d, payoff_quote_expiry: duration = 1h, allow_overdue: enum(allowed, blocked) = allowed, assessed_fines: enum(carry, require_waiver) = carry, down_payment: percent = 0%, funds: ref<escrow.hold>?, borrower: party = party(person), capital: party = programOperator, share: percent = 0%, limits: ref<financing.limits> = object(financing.limits), portfolio: ref<financing.portfolio_limit> = object(financing.portfolio_limit)) {
26
30
  dependencies {
27
31
  funds {
package/std/insurance.hsx CHANGED
@@ -15,6 +15,10 @@ header insurance
15
15
  // Inspector is a bound party, not necessarily staff. These are ledger transfers;
16
16
  // outside settlement needs the boundary protocol, not a claim of provider success.
17
17
 
18
+ // Cost: each slice collection or refund declares two transfers. Claim approval
19
+ // reserves once; pay posts once and expiry voids once. Cover cancellation adds
20
+ // bounded slice invocations. Run hsx cost for composed counts, not provider prices.
21
+
18
22
  instrument cover(holder: party, adapter: text, commission: percent = 0%, broker: party = programOperator, covers: ref, premium: money = runtime) {
19
23
  summary: "Recurring cover bound to an outside insurer across an ADL boundary."
20
24
  fields { covers: ref<covers>, holder: account of holder, insurer: account(adapter(adapter), cash, "premium"), expiresAt: date }
package/std/lending.hsx CHANGED
@@ -14,6 +14,10 @@ header lending
14
14
  // floored residual goes to residual_to. Loss mode moves claim balances, not cash.
15
15
  // Child share execution is parent-owned. No report or clock proves outside payout.
16
16
 
17
+ // Cost: round.create declares one owned account. Close transfers its balance
18
+ // and invokes commitments; failure invokes their refunds. Distribution adds moves
19
+ // and bounded share invocations. Run hsx cost for counts after policy selection.
20
+
17
21
  instrument round(borrower: party, plan: ref<financing.installments> = object(financing.installments), operator: party = programOperator, minimum_ticket: money = 100 SAR, investor_cap: percent = 20%, commitments: ref<lending.commitment> = object(lending.commitment)) {
18
22
  summary: "A threshold funding round; failed rounds return each original wallet contribution."
19
23
  fields {
@@ -14,6 +14,10 @@ header marketplace
14
14
  // cancellation return the whole reservation balance. Converted money is in escrow,
15
15
  // so subsequent return verification and refund use the escrow aliases.
16
16
 
17
+ // Cost: listing and order actions declare no transfers. Reservation.create
18
+ // declares one owned account; activate declares one deposit transfer. Cancellation
19
+ // and credit split that balance into moves. Run hsx cost for the composed counts.
20
+
17
21
  instrument listing(seller: party) {
18
22
  revisioned: true
19
23
  summary: "A seller's offer and its asking price."
package/std/money.hsx CHANGED
@@ -13,6 +13,10 @@ header money
13
13
  // matching terminal instruction evidence. An acknowledgement cannot settle it.
14
14
  // Metered bill charges a unique usage identity at the fixed unit price.
15
15
 
16
+ // Cost: transfer.pay declares one transfer. Hold.create declares one owned account;
17
+ // fund, release and refund each declare one transfer. Schedules and pools add bounded
18
+ // child invocations. Run hsx cost on the composed program for counts, not SAR prices.
19
+
16
20
  instrument transfer(payer: party, payee: party, amount: money = runtime) {
17
21
  summary: "One transfer between the bound parties."
18
22
  fields { amount: money = amount }
package/std/reporting.hsx CHANGED
@@ -10,6 +10,10 @@ header reporting
10
10
  // explicitly refuse until their unavailable governed facts exist. No bureau
11
11
  // submission, provider layout, external transport or restructuring proof is supplied.
12
12
 
13
+ // Cost: portfolio.create declares no transfers, owned accounts or invocations.
14
+ // That zero instruction count does not price report capture, rendering, storage or
15
+ // release. The host owns those charges and their execution.
16
+
13
17
  instrument portfolio(on: ref<financing.installments>[], default_days: integer(1, 3650) = 90, retention_years: integer(1, 100) = 10, aging_first_days: integer(1, 3650) = 30, aging_second_days: integer(1, 3650) = 60, aging_third_days: integer(1, 3650) = 90, ratio_scale: integer(1, 1000000) = 10000, ratio_rounding: enum(floor, halfUp) = floor, lock_wait_ms: integer(1, 2000) = 2000, capture_ms: integer(1, 10000) = 10000, max_rows: integer(1, 100000) = 10000, max_join_rows: integer(1, 1000000) = 100000, max_bytes: integer(1024, 16777216) = 8388608) {
14
18
  summary: "Declared financing reports evaluated over frozen Product facts."
15
19
  fields {}
package/std/savings.hsx CHANGED
@@ -17,6 +17,10 @@ header savings
17
17
  // Circle.close needs every membership received and an empty held account.
18
18
  // Circle creation collects circleDates, one date per member for contributions and payouts.
19
19
 
20
+ // Cost: circle.create declares one owned account. Each contribution payment
21
+ // and each pot payout declares one transfer. Multiply by the actual member and
22
+ // period counts for a completed circle; hsx cost reports per-action bounds.
23
+
20
24
  instrument circle(contribution: money, members: integer(1, 60), starts: date, memberships: ref<savings.membership> = object(savings.membership)) {
21
25
  summary: "A fixed group contributes on its explicit calendar and takes the pot in order."
22
26
  fields { contribution: money = contribution, members: integer = members, startsAt: date = starts, circleDates: list(date, members), pot: money = multiply(self.contribution, self.members), held: account of self }
package/std/travel.hsx CHANGED
@@ -18,6 +18,11 @@ header travel
18
18
  // price from paid only. A penalty above held cash or retained deposit refuses;
19
19
  // this header does not subsidize a shortfall or reduce the configured penalty.
20
20
 
21
+ // Cost: booking.create declares one owned account. Deposit also invokes premium
22
+ // collections; cancellation declares the selected refund, penalty, tax and retained
23
+ // moves. Run hsx cost for bounded counts. Supplier penalties are business terms,
24
+ // not compiler or executor fees.
25
+
21
26
  instrument package(price: money, supplier_cost: money, departure: date) {
22
27
  constraints { supplier_cost: at_most(price) }
23
28
  summary: "Immutable package price, supplier cost and departure."
package/std/wallet.hsx CHANGED
@@ -9,6 +9,10 @@ header wallet
9
9
  // Existing reservations may still post after the wallet freezes. There is no
10
10
  // daily aggregate limit, partial spend or card-network settlement in this header.
11
11
 
12
+ // Cost: balance.create declares one owned account; topup and withdraw each
13
+ // declare one transfer. Spend reserve, pay and cancel each declare one transfer
14
+ // instruction. These are counts, not the executor tariff.
15
+
12
16
  instrument balance(holder: party, spend_limit: money = 100000 SAR) {
13
17
  summary: "A holder's reusable balance with an immutable per-spend ceiling."
14
18
  fields { holder: account of holder, held: account of self, spendLimit: money = spend_limit }