@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.
Files changed (57) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/README.md +1 -1
  3. package/dist/src/ast.d.ts +17 -2
  4. package/dist/src/ast.d.ts.map +1 -1
  5. package/dist/src/ast.js.map +1 -1
  6. package/dist/src/cli.js +1 -1
  7. package/dist/src/compile.d.ts +6 -0
  8. package/dist/src/compile.d.ts.map +1 -1
  9. package/dist/src/compile.js +1194 -97
  10. package/dist/src/compile.js.map +1 -1
  11. package/dist/src/cost.d.ts +1 -1
  12. package/dist/src/cost.d.ts.map +1 -1
  13. package/dist/src/cost.js +52 -9
  14. package/dist/src/cost.js.map +1 -1
  15. package/dist/src/headers.d.ts +2 -2
  16. package/dist/src/headers.d.ts.map +1 -1
  17. package/dist/src/headers.js +3 -2
  18. package/dist/src/headers.js.map +1 -1
  19. package/dist/src/index.d.ts +3 -2
  20. package/dist/src/index.d.ts.map +1 -1
  21. package/dist/src/index.js.map +1 -1
  22. package/dist/src/lex.d.ts +1 -1
  23. package/dist/src/lex.d.ts.map +1 -1
  24. package/dist/src/lex.js +5 -0
  25. package/dist/src/lex.js.map +1 -1
  26. package/dist/src/parse.js +91 -5
  27. package/dist/src/parse.js.map +1 -1
  28. package/dist/src/std-bundle.d.ts.map +1 -1
  29. package/dist/src/std-bundle.js +10 -9
  30. package/dist/src/std-bundle.js.map +1 -1
  31. package/dist/src/version.d.ts +2 -2
  32. package/dist/src/version.js +2 -2
  33. package/docs/README.md +51 -27
  34. package/docs/headers.md +43 -40
  35. package/examples/cost-table.json +40 -324
  36. package/examples/library.hsx +12 -57
  37. package/package.json +7 -5
  38. package/src/ast.ts +11 -1
  39. package/src/cli.ts +1 -1
  40. package/src/compile.ts +1630 -114
  41. package/src/cost.ts +60 -16
  42. package/src/headers.ts +3 -2
  43. package/src/index.ts +12 -1
  44. package/src/lex.ts +5 -0
  45. package/src/parse.ts +87 -5
  46. package/src/std-bundle.ts +10 -9
  47. package/src/version.ts +2 -2
  48. package/std/approvals.hsx +3 -3
  49. package/std/collections.hsx +45 -4
  50. package/std/escrow.hsx +17 -8
  51. package/std/financing.hsx +292 -42
  52. package/std/insurance.hsx +4 -5
  53. package/std/lending.hsx +7 -8
  54. package/std/marketplace.hsx +90 -6
  55. package/std/money.hsx +15 -49
  56. package/std/reporting.hsx +1286 -0
  57. 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 supplier confirmation."
15
+ summary: "A deposited booking with three cancellation bands and confirmation."
16
16
  fields {
17
- package: ref<package>, bookingReference: text, buyer: account of buyer, supplier: account of supplier
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, actor: { party: supplier }
47
+ from: paid, to: completed
49
48
  due: { at: self.package.departure }, deadline: { at: self.confirmBy }
50
- requires approval by supplier
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