@hyperscale0/hsx 5.6.0 → 5.8.0
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 +33 -0
- package/dist/src/compile.d.ts.map +1 -1
- package/dist/src/compile.js +352 -18
- package/dist/src/compile.js.map +1 -1
- package/dist/src/diagnostics.d.ts +2 -0
- package/dist/src/diagnostics.d.ts.map +1 -1
- package/dist/src/diagnostics.js +23 -0
- package/dist/src/diagnostics.js.map +1 -1
- package/dist/src/examples-bundle.js +3 -3
- package/dist/src/examples-bundle.js.map +1 -1
- package/dist/src/std-bundle.js +2 -2
- package/dist/src/std-bundle.js.map +1 -1
- package/dist/src/version.d.ts +1 -1
- package/dist/src/version.js +1 -1
- package/docs/README.md +45 -11
- package/docs/examples.md +1 -1
- package/docs/headers.md +1 -1
- package/examples/collections.hsx +8 -2
- package/examples/financing.hsx +5 -0
- package/examples/lending.hsx +7 -1
- package/package.json +3 -3
- package/src/compile.ts +458 -30
- package/src/diagnostics.ts +34 -0
- package/src/examples-bundle.ts +3 -3
- package/src/std-bundle.ts +2 -2
- package/src/version.ts +1 -1
- package/std/financing.hsx +6 -2
- package/std/marketplace.hsx +3 -9
package/src/version.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const HSX_VERSION = "5.
|
|
1
|
+
export const HSX_VERSION = "5.8.0";
|
package/std/financing.hsx
CHANGED
|
@@ -10,6 +10,8 @@ header financing
|
|
|
10
10
|
// it tops up only the missing down payment, without advancing lender principal.
|
|
11
11
|
// Disburse still collects any missing down payment, activates slices, and confirms
|
|
12
12
|
// the fully funded hold. Existing escrow credit counts once toward the down payment.
|
|
13
|
+
// Disburse first credits an active marketplace.reservation on the same hold,
|
|
14
|
+
// so list the plan in its converters; the deposit then counts as escrow credit.
|
|
13
15
|
// Borrower-directed disbursement excludes collect_down_payment. A down_payment
|
|
14
16
|
// there reduces principal but does not collect cash. Price is subject metadata,
|
|
15
17
|
// not the borrower limit. The escrow payer and price must match the plan.
|
|
@@ -82,7 +84,7 @@ instrument installments(months: integer(1, 366), charge_limit: integer(1, 3) = 3
|
|
|
82
84
|
requires self.portfolioLimit in [approved]
|
|
83
85
|
when disburse_to is funds {
|
|
84
86
|
requires self.funds in [pending]
|
|
85
|
-
invoke: [{ reference: self.id, action: fund_down_payment, input: {} }]
|
|
87
|
+
invoke: [{ selection: { instrument: all(marketplace.reservation), reference: "funds", anchor: self.funds, states: [active], limit: 1 }, action: credit, input: { funds: { field: self.funds }, contribution: { field: self.downPayment } } }, { reference: self.id, action: fund_down_payment, input: {} }]
|
|
86
88
|
}
|
|
87
89
|
when disburse_to is borrower { moves self.principal from self.capital to self.borrower economics { purpose: principal, sourceParty: capital } }
|
|
88
90
|
invoke: [{ selection: { instrument: slice, reference: "plan", anchor: self.id, states: [draft], limit: 366, order: [position] }, action: activate, input: {} }]
|
|
@@ -497,7 +499,7 @@ instrument late_charge(on: ref<financing.installments>[], grace: duration = 3d,
|
|
|
497
499
|
receivable: account(self, claim), debt: account(borrower, claim, contra, "debt")
|
|
498
500
|
}
|
|
499
501
|
lifecycle { states: [proposed, assessed, collected, waived], initial: proposed }
|
|
500
|
-
action create { calculate: [{ target: overdueAt, op: shift, date: { field: self.slice.dueAt }, milliseconds: { literal: grace }, direction: after }], requires unique "late_assessment" on [self.slice, self.overdueAt]; requires self.borrower == self.slice.plan.borrower; requires self.plan == self.slice.plan }
|
|
502
|
+
action create { input { slice: ref<on.slice>? }, calculate: [{ target: overdueAt, op: shift, date: { field: self.slice.dueAt }, milliseconds: { literal: grace }, direction: after }], requires unique "late_assessment" on [self.slice, self.overdueAt]; requires self.borrower == self.slice.plan.borrower; requires self.plan == self.slice.plan }
|
|
501
503
|
action assess { allowZero: true,
|
|
502
504
|
from: proposed, to: assessed, actor: clock, due: { at: self.overdueAt }
|
|
503
505
|
requires self.slice.principalReceivable.balance > "0"
|
|
@@ -630,6 +632,7 @@ instrument late_charge(on: ref<financing.installments>[], grace: duration = 3d,
|
|
|
630
632
|
|
|
631
633
|
instrument limits(per_borrower: money, borrower: party = party(person), active_plans: integer = 1) {
|
|
632
634
|
familyRevision: 1
|
|
635
|
+
scope: product
|
|
633
636
|
summary: "One outstanding balance ceiling per borrower."
|
|
634
637
|
fields { borrower: account of borrower, limit: money = per_borrower, activePlans: integer = active_plans }
|
|
635
638
|
lifecycle { states: [pending, approved], initial: pending }
|
|
@@ -639,6 +642,7 @@ instrument limits(per_borrower: money, borrower: party = party(person), active_p
|
|
|
639
642
|
|
|
640
643
|
instrument portfolio_limit(limit: money) {
|
|
641
644
|
familyRevision: 1
|
|
645
|
+
scope: product
|
|
642
646
|
summary: "One shared ceiling on the principal the product may hold."
|
|
643
647
|
fields { key: text = "portfolio", limit: money = limit }
|
|
644
648
|
lifecycle { states: [pending, approved], initial: pending }
|
package/std/marketplace.hsx
CHANGED
|
@@ -9,8 +9,8 @@ header marketplace
|
|
|
9
9
|
// verify_return and refund aliases. Refund needs disputed -> return_verified,
|
|
10
10
|
// with payee evidence, then returns the full price to payer; accept pays payee.
|
|
11
11
|
// A reservation holds its own deposit. Activate requires an active listing and
|
|
12
|
-
// no placed order.
|
|
13
|
-
//
|
|
12
|
+
// no placed order. Only a declared converter may invoke credit. A financing
|
|
13
|
+
// plan on the same hold credits it when the lender disburses. Credit consumes the
|
|
14
14
|
// deposit once, credits at most the contribution, and returns excess to buyer.
|
|
15
15
|
// Expose cancel, seller_cancel or operator_cancel for the intended actors.
|
|
16
16
|
// Buyer cancel and expiry use configured refund percentages; seller/operator
|
|
@@ -64,7 +64,7 @@ instrument order(listing: ref<marketplace.listing>, buyer: party) {
|
|
|
64
64
|
action cancel { from: [quoted, placed], to: cancelled, actor: { party: buyer } }
|
|
65
65
|
}
|
|
66
66
|
|
|
67
|
-
instrument reservation(listing: ref<marketplace.listing>, funds: ref<escrow.hold>,
|
|
67
|
+
instrument reservation(listing: ref<marketplace.listing>, funds: ref<escrow.hold>, converters: ref[], buyer: party, seller: party, expires_after: duration = 48h, deposit: money = 1000 SAR, cancellation_refund: percent = 100%, expiry_refund: percent = 100%, retained_to: party = programOperator, operator: party = programOperator, competing_quotes: enum(allowed, blocked) = allowed) {
|
|
68
68
|
revisioned: true
|
|
69
69
|
summary: "Exclusive timed listing hold with explicit deposit credit and refund."
|
|
70
70
|
fields {
|
|
@@ -82,12 +82,6 @@ instrument reservation(listing: ref<marketplace.listing>, funds: ref<escrow.hold
|
|
|
82
82
|
requires count of { instrument: all(marketplace.order), reference: "listing", anchor: self.listing, states: [placed, fulfilled], limit: 366 } == 0
|
|
83
83
|
moves self.deposit from self.buyer to self.held economics { purpose: principal, sourceParty: buyer }
|
|
84
84
|
}
|
|
85
|
-
action convert_financed {
|
|
86
|
-
from: active, to: active, actor: { party: buyer }, deadline: { at: self.expiresAt }
|
|
87
|
-
input { plan: ref<plans> }
|
|
88
|
-
requires input.plan.funds == self.funds; requires input.plan.borrower == self.buyer
|
|
89
|
-
invoke: [{ reference: input.plan, action: disburse, input: {} }]
|
|
90
|
-
}
|
|
91
85
|
action convert_cash {
|
|
92
86
|
from: active, to: active, actor: { party: buyer }, deadline: { at: self.expiresAt }
|
|
93
87
|
invoke: [{ reference: self.funds, action: fund, input: {} }]
|