@hyperscale0/hsx 3.2.0 → 4.0.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 +8 -0
- package/README.md +1 -1
- package/dist/src/ast.d.ts +17 -2
- package/dist/src/ast.d.ts.map +1 -1
- package/dist/src/ast.js.map +1 -1
- package/dist/src/cli.js +1 -1
- package/dist/src/compile.d.ts +6 -0
- package/dist/src/compile.d.ts.map +1 -1
- package/dist/src/compile.js +1194 -97
- package/dist/src/compile.js.map +1 -1
- package/dist/src/cost.d.ts +1 -1
- package/dist/src/cost.d.ts.map +1 -1
- package/dist/src/cost.js +52 -9
- package/dist/src/cost.js.map +1 -1
- package/dist/src/headers.d.ts +2 -2
- package/dist/src/headers.d.ts.map +1 -1
- package/dist/src/headers.js +3 -2
- package/dist/src/headers.js.map +1 -1
- package/dist/src/index.d.ts +3 -2
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js.map +1 -1
- package/dist/src/lex.d.ts +1 -1
- package/dist/src/lex.d.ts.map +1 -1
- package/dist/src/lex.js +5 -0
- package/dist/src/lex.js.map +1 -1
- package/dist/src/parse.js +91 -5
- package/dist/src/parse.js.map +1 -1
- package/dist/src/std-bundle.d.ts.map +1 -1
- package/dist/src/std-bundle.js +10 -9
- package/dist/src/std-bundle.js.map +1 -1
- package/dist/src/version.d.ts +2 -2
- package/dist/src/version.js +2 -2
- package/docs/README.md +51 -27
- package/docs/headers.md +43 -40
- package/examples/cost-table.json +40 -324
- package/examples/library.hsx +12 -57
- package/package.json +7 -5
- package/src/ast.ts +11 -1
- package/src/cli.ts +1 -1
- package/src/compile.ts +1630 -114
- package/src/cost.ts +60 -16
- package/src/headers.ts +3 -2
- package/src/index.ts +12 -1
- package/src/lex.ts +5 -0
- package/src/parse.ts +87 -5
- package/src/std-bundle.ts +10 -9
- package/src/version.ts +2 -2
- package/std/approvals.hsx +3 -3
- package/std/collections.hsx +45 -4
- package/std/escrow.hsx +17 -8
- package/std/financing.hsx +292 -42
- package/std/insurance.hsx +4 -5
- package/std/lending.hsx +7 -8
- package/std/marketplace.hsx +90 -6
- package/std/money.hsx +15 -49
- package/std/reporting.hsx +1286 -0
- package/std/travel.hsx +5 -6
package/std/travel.hsx
CHANGED
|
@@ -10,11 +10,11 @@ instrument package(price: money, supplier_cost: money, departure: date) {
|
|
|
10
10
|
action close { from: published, to: closed, actor: clock, due: { at: self.departure } }
|
|
11
11
|
}
|
|
12
12
|
|
|
13
|
-
instrument booking(package: ref<travel.package>, buyer: party, supplier: approval, cover: ref<insurance.cover>, deposit: percent = 30%, balance_before: duration = 14d, confirm_within: duration = 24h, tax: percent = 15%, early_before: duration = 30d, middle_before: duration = 15d, middle_penalty: percent = 10%, late_penalty: percent = 30%) {
|
|
13
|
+
instrument booking(package: ref<travel.package>, buyer: party, supplier: party, approval: approval = programOperator, cover: ref<insurance.cover>, deposit: percent = 30%, balance_before: duration = 14d, confirm_within: duration = 24h, tax: percent = 15%, early_before: duration = 30d, middle_before: duration = 15d, middle_penalty: percent = 10%, late_penalty: percent = 30%) {
|
|
14
14
|
constraints { early_before: greater_than(middle_before) }
|
|
15
|
-
summary: "A deposited booking with three cancellation bands and
|
|
15
|
+
summary: "A deposited booking with three cancellation bands and confirmation."
|
|
16
16
|
fields {
|
|
17
|
-
package: ref<package>,
|
|
17
|
+
package: ref<package>, buyer: account of buyer, supplier: account of supplier
|
|
18
18
|
price: money = self.package.price, supplierCost: money = self.package.supplierCost
|
|
19
19
|
deposit: money = rate(self.price, deposit), balance: money = subtract(self.price, self.deposit)
|
|
20
20
|
margin: money = subtract(self.price, self.supplierCost)
|
|
@@ -32,7 +32,6 @@ instrument booking(package: ref<travel.package>, buyer: party, supplier: approva
|
|
|
32
32
|
lifecycle { states: [created, deposit_paid, paid, completed, cancelled, refunded], initial: created }
|
|
33
33
|
action create {
|
|
34
34
|
requires self.package in [published]
|
|
35
|
-
requires unique "booking_reference" on [self.bookingReference]
|
|
36
35
|
}
|
|
37
36
|
action deposit {
|
|
38
37
|
from: created, to: deposit_paid, actor: { party: buyer }, deadline: { at: self.balanceAt }
|
|
@@ -45,9 +44,9 @@ instrument booking(package: ref<travel.package>, buyer: party, supplier: approva
|
|
|
45
44
|
moves self.balance from buyer to self.held
|
|
46
45
|
}
|
|
47
46
|
action confirm {
|
|
48
|
-
from: paid, to: completed
|
|
47
|
+
from: paid, to: completed
|
|
49
48
|
due: { at: self.package.departure }, deadline: { at: self.confirmBy }
|
|
50
|
-
requires approval by
|
|
49
|
+
requires approval by approval protectedRequest self differentFromInitiator true
|
|
51
50
|
moves self.supplierCost from self.held to supplier
|
|
52
51
|
moves self.tax from self.held to programTax
|
|
53
52
|
moves self.operatorNet from self.held to programOperator
|