lawspec 0.29.2 → 0.31.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 (79) hide show
  1. package/CHANGELOG.md +407 -1
  2. package/README.md +9 -3
  3. package/api.mjs +1 -0
  4. package/beam-doctor.mjs +2 -2
  5. package/bin/lawspec.mjs +100 -102
  6. package/build.json +503 -411
  7. package/component-packages.mjs +339 -0
  8. package/component.d.ts +46 -0
  9. package/component.mjs +208 -0
  10. package/core.wasm +2 -2
  11. package/core_jsffi.js +5 -5
  12. package/examples/native-payments/clojure/lawspec.edn +48 -0
  13. package/examples/native-payments/clojure/src/domain/payments.clj +1 -1
  14. package/examples/native-payments/clojure/test/domain/payment_generators.clj +1 -1
  15. package/examples/native-payments/csharp/lawspec.edn +48 -0
  16. package/examples/native-payments/elixir/lawspec.edn +123 -0
  17. package/examples/native-payments/erlang/lawspec.edn +128 -0
  18. package/examples/native-payments/fsharp/lawspec.edn +123 -0
  19. package/examples/native-payments/gleam/lawspec.edn +123 -0
  20. package/examples/native-payments/go/lawspec.edn +123 -0
  21. package/examples/native-payments/groovy/lawspec.edn +123 -0
  22. package/examples/native-payments/haskell/lawspec.edn +123 -0
  23. package/examples/native-payments/java/lawspec.edn +123 -0
  24. package/examples/native-payments/javascript/lawspec.edn +123 -0
  25. package/examples/native-payments/kotlin/lawspec.edn +123 -0
  26. package/examples/native-payments/prolog/lawspec.edn +48 -0
  27. package/examples/native-payments/python/lawspec.edn +123 -0
  28. package/examples/native-payments/rust/lawspec.edn +124 -0
  29. package/examples/native-payments/scala/lawspec.edn +123 -0
  30. package/examples/native-payments/swift/lawspec.edn +123 -0
  31. package/examples/native-payments/typescript/lawspec.edn +123 -0
  32. package/examples/packages/orders/lawspec.edn +25 -0
  33. package/examples/packages/shop-domain/lawspec.edn +13 -0
  34. package/examples/packages/shop-tax-1/lawspec.edn +9 -0
  35. package/examples/packages/shop-tax-2/lawspec.edn +9 -0
  36. package/examples/specs/handler_bindings.lawspec +2 -2
  37. package/examples/specs/harness_testing.lawspec +1 -1
  38. package/files.mjs +2 -1
  39. package/go.mod +4 -0
  40. package/index.d.ts +145 -8
  41. package/input-files.mjs +47 -0
  42. package/launcher.mjs +33 -13
  43. package/lsp.mjs +10 -5
  44. package/native-evidence.mjs +58 -19
  45. package/native-examples.mjs +8 -7
  46. package/native-host.mjs +71 -0
  47. package/package.json +8 -3
  48. package/proof.d.ts +8 -2
  49. package/proof.mjs +186 -34
  50. package/scala-build-state.mjs +59 -0
  51. package/templates.mjs +242 -2
  52. package/test-command.mjs +193 -61
  53. package/builtin-data-names.mjs +0 -73
  54. package/examples/native-payments/clojure/lawspec.json +0 -62
  55. package/examples/native-payments/csharp/lawspec.json +0 -62
  56. package/examples/native-payments/elixir/lawspec.json +0 -160
  57. package/examples/native-payments/erlang/lawspec.json +0 -159
  58. package/examples/native-payments/fsharp/lawspec.json +0 -178
  59. package/examples/native-payments/gleam/lawspec.json +0 -160
  60. package/examples/native-payments/go/lawspec.json +0 -147
  61. package/examples/native-payments/groovy/lawspec.json +0 -176
  62. package/examples/native-payments/haskell/lawspec.json +0 -160
  63. package/examples/native-payments/java/lawspec.json +0 -176
  64. package/examples/native-payments/javascript/lawspec.json +0 -160
  65. package/examples/native-payments/kotlin/lawspec.json +0 -176
  66. package/examples/native-payments/prolog/lawspec.json +0 -20
  67. package/examples/native-payments/python/lawspec.json +0 -160
  68. package/examples/native-payments/rust/lawspec.json +0 -178
  69. package/examples/native-payments/scala/lawspec.json +0 -176
  70. package/examples/native-payments/swift/lawspec.json +0 -165
  71. package/examples/native-payments/typescript/lawspec.json +0 -160
  72. package/examples/packages/orders/lawspec.json +0 -27
  73. package/examples/packages/shop-domain/lawspec-package.json +0 -7
  74. package/examples/packages/shop-tax-1/lawspec-package.json +0 -5
  75. package/examples/packages/shop-tax-2/lawspec-package.json +0 -5
  76. package/explain.mjs +0 -114
  77. package/expression-presentation.mjs +0 -333
  78. package/positional-fields.mjs +0 -13
  79. package/typed-presentation.mjs +0 -165
@@ -0,0 +1,123 @@
1
+ {
2
+ :manifest-version 1
3
+ :component {
4
+ :name "go"
5
+ :version "0.1.0"
6
+ }
7
+ :sources ["laws"]
8
+ :machine-bits 64
9
+ :targets [
10
+ {
11
+ :language :go
12
+ :root "."
13
+ :native-bindings {
14
+ :types [
15
+ {
16
+ :type "example.payments::type::Currency"
17
+ :native ["CurrencyCode"]
18
+ :constructors [
19
+ {
20
+ :constructor "USD"
21
+ :native ["Dollars"]
22
+ :style "unit"
23
+ :fields []
24
+ }
25
+ {
26
+ :constructor "EUR"
27
+ :native ["Euros"]
28
+ :style "unit"
29
+ :fields []
30
+ }
31
+ {
32
+ :constructor "GBP"
33
+ :native ["Pounds"]
34
+ :style "unit"
35
+ :fields []
36
+ }
37
+ ]
38
+ }
39
+ {
40
+ :type "example.payments::type::Money"
41
+ :native ["Price"]
42
+ :constructors [
43
+ {
44
+ :constructor "Money"
45
+ :native ["Price"]
46
+ :style "record"
47
+ :fields [
48
+ {
49
+ :field "amount"
50
+ :native "Major"
51
+ }
52
+ {
53
+ :field "currency"
54
+ :native "Unit"
55
+ }
56
+ ]
57
+ }
58
+ ]
59
+ }
60
+ {
61
+ :type "example.payments::type::Payment"
62
+ :native ["PaymentStatus"]
63
+ :constructors [
64
+ {
65
+ :constructor "Paid"
66
+ :native ["Settled"]
67
+ :style "variant"
68
+ :fields [
69
+ {
70
+ :field "value"
71
+ :native "Price"
72
+ }
73
+ ]
74
+ }
75
+ {
76
+ :constructor "Declined"
77
+ :native ["Rejected"]
78
+ :style "variant"
79
+ :fields [
80
+ {
81
+ :field "value"
82
+ :native "Explanation"
83
+ }
84
+ ]
85
+ }
86
+ ]
87
+ }
88
+ ]
89
+ :functions [
90
+ {
91
+ :declaration "example.payments::addFee"
92
+ :native ["AddFee"]
93
+ }
94
+ {
95
+ :declaration "example.payments::roundTrip"
96
+ :native ["Restore"]
97
+ }
98
+ {
99
+ :declaration "example.payments::archive"
100
+ :native ["Store"]
101
+ }
102
+ ]
103
+ :generators [
104
+ {
105
+ :type "example.payments::type::Money"
106
+ :factory ["NativePrices"]
107
+ }
108
+ ]
109
+ }
110
+ }
111
+ ]
112
+ :language-profile "1.0-rc.2"
113
+ :verification {
114
+ :layers [
115
+ :proof
116
+ :exhaustive
117
+ :property
118
+ :examples
119
+ :runtime
120
+ :model
121
+ ]
122
+ }
123
+ }
@@ -0,0 +1,123 @@
1
+ {
2
+ :manifest-version 1
3
+ :component {
4
+ :name "groovy"
5
+ :version "0.1.0"
6
+ }
7
+ :sources ["laws"]
8
+ :machine-bits 64
9
+ :targets [
10
+ {
11
+ :language :groovy
12
+ :root "."
13
+ :native-bindings {
14
+ :types [
15
+ {
16
+ :type "example.payments::type::Currency"
17
+ :native ["domain" "PaymentsDomain" "CurrencyCode"]
18
+ :constructors [
19
+ {
20
+ :constructor "USD"
21
+ :native ["domain" "PaymentsDomain" "CurrencyCode" "Dollars"]
22
+ :style "unit"
23
+ :fields []
24
+ }
25
+ {
26
+ :constructor "EUR"
27
+ :native ["domain" "PaymentsDomain" "CurrencyCode" "Euros"]
28
+ :style "unit"
29
+ :fields []
30
+ }
31
+ {
32
+ :constructor "GBP"
33
+ :native ["domain" "PaymentsDomain" "CurrencyCode" "Pounds"]
34
+ :style "unit"
35
+ :fields []
36
+ }
37
+ ]
38
+ }
39
+ {
40
+ :type "example.payments::type::Money"
41
+ :native ["domain" "PaymentsDomain" "Price"]
42
+ :constructors [
43
+ {
44
+ :constructor "Money"
45
+ :native ["domain" "PaymentsDomain" "Price"]
46
+ :style "record"
47
+ :fields [
48
+ {
49
+ :field "amount"
50
+ :native "major"
51
+ }
52
+ {
53
+ :field "currency"
54
+ :native "unit"
55
+ }
56
+ ]
57
+ }
58
+ ]
59
+ }
60
+ {
61
+ :type "example.payments::type::Payment"
62
+ :native ["domain" "PaymentsDomain" "PaymentStatus"]
63
+ :constructors [
64
+ {
65
+ :constructor "Paid"
66
+ :native ["domain" "PaymentsDomain" "Settled"]
67
+ :style "variant"
68
+ :fields [
69
+ {
70
+ :field "value"
71
+ :native "price"
72
+ }
73
+ ]
74
+ }
75
+ {
76
+ :constructor "Declined"
77
+ :native ["domain" "PaymentsDomain" "Rejected"]
78
+ :style "variant"
79
+ :fields [
80
+ {
81
+ :field "value"
82
+ :native "explanation"
83
+ }
84
+ ]
85
+ }
86
+ ]
87
+ }
88
+ ]
89
+ :functions [
90
+ {
91
+ :declaration "example.payments::addFee"
92
+ :native ["domain" "PaymentsDomain" "apply_fee"]
93
+ }
94
+ {
95
+ :declaration "example.payments::roundTrip"
96
+ :native ["domain" "PaymentsDomain" "restore"]
97
+ }
98
+ {
99
+ :declaration "example.payments::archive"
100
+ :native ["domain" "PaymentsDomain" "store"]
101
+ }
102
+ ]
103
+ :generators [
104
+ {
105
+ :type "example.payments::type::Money"
106
+ :factory ["domain" "PaymentGenerators" "prices"]
107
+ }
108
+ ]
109
+ }
110
+ }
111
+ ]
112
+ :language-profile "1.0-rc.2"
113
+ :verification {
114
+ :layers [
115
+ :proof
116
+ :exhaustive
117
+ :property
118
+ :examples
119
+ :runtime
120
+ :model
121
+ ]
122
+ }
123
+ }
@@ -0,0 +1,123 @@
1
+ {
2
+ :manifest-version 1
3
+ :component {
4
+ :name "haskell"
5
+ :version "0.1.0"
6
+ }
7
+ :sources ["laws"]
8
+ :machine-bits 64
9
+ :targets [
10
+ {
11
+ :language :haskell
12
+ :root "."
13
+ :native-bindings {
14
+ :types [
15
+ {
16
+ :type "example.payments::type::Currency"
17
+ :native ["PaymentsDomain" "CurrencyCode"]
18
+ :constructors [
19
+ {
20
+ :constructor "USD"
21
+ :native ["PaymentsDomain" "Dollars"]
22
+ :style "unit"
23
+ :fields []
24
+ }
25
+ {
26
+ :constructor "EUR"
27
+ :native ["PaymentsDomain" "Euros"]
28
+ :style "unit"
29
+ :fields []
30
+ }
31
+ {
32
+ :constructor "GBP"
33
+ :native ["PaymentsDomain" "Pounds"]
34
+ :style "unit"
35
+ :fields []
36
+ }
37
+ ]
38
+ }
39
+ {
40
+ :type "example.payments::type::Money"
41
+ :native ["PaymentsDomain" "Price"]
42
+ :constructors [
43
+ {
44
+ :constructor "Money"
45
+ :native ["PaymentsDomain" "Price"]
46
+ :style "record"
47
+ :fields [
48
+ {
49
+ :field "amount"
50
+ :native "major"
51
+ }
52
+ {
53
+ :field "currency"
54
+ :native "unit"
55
+ }
56
+ ]
57
+ }
58
+ ]
59
+ }
60
+ {
61
+ :type "example.payments::type::Payment"
62
+ :native ["PaymentsDomain" "PaymentStatus"]
63
+ :constructors [
64
+ {
65
+ :constructor "Paid"
66
+ :native ["PaymentsDomain" "Settled"]
67
+ :style "variant"
68
+ :fields [
69
+ {
70
+ :field "value"
71
+ :native "price"
72
+ }
73
+ ]
74
+ }
75
+ {
76
+ :constructor "Declined"
77
+ :native ["PaymentsDomain" "Rejected"]
78
+ :style "variant"
79
+ :fields [
80
+ {
81
+ :field "value"
82
+ :native "explanation"
83
+ }
84
+ ]
85
+ }
86
+ ]
87
+ }
88
+ ]
89
+ :functions [
90
+ {
91
+ :declaration "example.payments::addFee"
92
+ :native ["PaymentsDomain" "addFee"]
93
+ }
94
+ {
95
+ :declaration "example.payments::roundTrip"
96
+ :native ["PaymentsDomain" "restore"]
97
+ }
98
+ {
99
+ :declaration "example.payments::archive"
100
+ :native ["PaymentsDomain" "store"]
101
+ }
102
+ ]
103
+ :generators [
104
+ {
105
+ :type "example.payments::type::Money"
106
+ :factory ["PaymentGenerators" "prices"]
107
+ }
108
+ ]
109
+ }
110
+ }
111
+ ]
112
+ :language-profile "1.0-rc.2"
113
+ :verification {
114
+ :layers [
115
+ :proof
116
+ :exhaustive
117
+ :property
118
+ :examples
119
+ :runtime
120
+ :model
121
+ ]
122
+ }
123
+ }
@@ -0,0 +1,123 @@
1
+ {
2
+ :manifest-version 1
3
+ :component {
4
+ :name "java"
5
+ :version "0.1.0"
6
+ }
7
+ :sources ["laws"]
8
+ :machine-bits 64
9
+ :targets [
10
+ {
11
+ :language :java
12
+ :root "."
13
+ :native-bindings {
14
+ :types [
15
+ {
16
+ :type "example.payments::type::Currency"
17
+ :native ["domain" "PaymentsDomain" "CurrencyCode"]
18
+ :constructors [
19
+ {
20
+ :constructor "USD"
21
+ :native ["domain" "PaymentsDomain" "CurrencyCode" "Dollars"]
22
+ :style "unit"
23
+ :fields []
24
+ }
25
+ {
26
+ :constructor "EUR"
27
+ :native ["domain" "PaymentsDomain" "CurrencyCode" "Euros"]
28
+ :style "unit"
29
+ :fields []
30
+ }
31
+ {
32
+ :constructor "GBP"
33
+ :native ["domain" "PaymentsDomain" "CurrencyCode" "Pounds"]
34
+ :style "unit"
35
+ :fields []
36
+ }
37
+ ]
38
+ }
39
+ {
40
+ :type "example.payments::type::Money"
41
+ :native ["domain" "PaymentsDomain" "Price"]
42
+ :constructors [
43
+ {
44
+ :constructor "Money"
45
+ :native ["domain" "PaymentsDomain" "Price"]
46
+ :style "record"
47
+ :fields [
48
+ {
49
+ :field "amount"
50
+ :native "major"
51
+ }
52
+ {
53
+ :field "currency"
54
+ :native "unit"
55
+ }
56
+ ]
57
+ }
58
+ ]
59
+ }
60
+ {
61
+ :type "example.payments::type::Payment"
62
+ :native ["domain" "PaymentsDomain" "PaymentStatus"]
63
+ :constructors [
64
+ {
65
+ :constructor "Paid"
66
+ :native ["domain" "PaymentsDomain" "Settled"]
67
+ :style "variant"
68
+ :fields [
69
+ {
70
+ :field "value"
71
+ :native "price"
72
+ }
73
+ ]
74
+ }
75
+ {
76
+ :constructor "Declined"
77
+ :native ["domain" "PaymentsDomain" "Rejected"]
78
+ :style "variant"
79
+ :fields [
80
+ {
81
+ :field "value"
82
+ :native "explanation"
83
+ }
84
+ ]
85
+ }
86
+ ]
87
+ }
88
+ ]
89
+ :functions [
90
+ {
91
+ :declaration "example.payments::addFee"
92
+ :native ["domain" "PaymentsDomain" "apply_fee"]
93
+ }
94
+ {
95
+ :declaration "example.payments::roundTrip"
96
+ :native ["domain" "PaymentsDomain" "restore"]
97
+ }
98
+ {
99
+ :declaration "example.payments::archive"
100
+ :native ["domain" "PaymentsDomain" "store"]
101
+ }
102
+ ]
103
+ :generators [
104
+ {
105
+ :type "example.payments::type::Money"
106
+ :factory ["domain" "PaymentGenerators" "prices"]
107
+ }
108
+ ]
109
+ }
110
+ }
111
+ ]
112
+ :language-profile "1.0-rc.2"
113
+ :verification {
114
+ :layers [
115
+ :proof
116
+ :exhaustive
117
+ :property
118
+ :examples
119
+ :runtime
120
+ :model
121
+ ]
122
+ }
123
+ }
@@ -0,0 +1,123 @@
1
+ {
2
+ :manifest-version 1
3
+ :component {
4
+ :name "javascript"
5
+ :version "0.1.0"
6
+ }
7
+ :sources ["laws"]
8
+ :machine-bits 64
9
+ :targets [
10
+ {
11
+ :language :javascript
12
+ :root "."
13
+ :native-bindings {
14
+ :types [
15
+ {
16
+ :type "example.payments::type::Currency"
17
+ :native ["payments_domain" "CurrencyCode"]
18
+ :constructors [
19
+ {
20
+ :constructor "USD"
21
+ :native ["payments_domain" "Dollars"]
22
+ :style "unit"
23
+ :fields []
24
+ }
25
+ {
26
+ :constructor "EUR"
27
+ :native ["payments_domain" "Euros"]
28
+ :style "unit"
29
+ :fields []
30
+ }
31
+ {
32
+ :constructor "GBP"
33
+ :native ["payments_domain" "Pounds"]
34
+ :style "unit"
35
+ :fields []
36
+ }
37
+ ]
38
+ }
39
+ {
40
+ :type "example.payments::type::Money"
41
+ :native ["payments_domain" "Price"]
42
+ :constructors [
43
+ {
44
+ :constructor "Money"
45
+ :native ["payments_domain" "Price"]
46
+ :style "record"
47
+ :fields [
48
+ {
49
+ :field "amount"
50
+ :native "major"
51
+ }
52
+ {
53
+ :field "currency"
54
+ :native "unit"
55
+ }
56
+ ]
57
+ }
58
+ ]
59
+ }
60
+ {
61
+ :type "example.payments::type::Payment"
62
+ :native ["payments_domain" "PaymentStatus"]
63
+ :constructors [
64
+ {
65
+ :constructor "Paid"
66
+ :native ["payments_domain" "Settled"]
67
+ :style "variant"
68
+ :fields [
69
+ {
70
+ :field "value"
71
+ :native "price"
72
+ }
73
+ ]
74
+ }
75
+ {
76
+ :constructor "Declined"
77
+ :native ["payments_domain" "Rejected"]
78
+ :style "variant"
79
+ :fields [
80
+ {
81
+ :field "value"
82
+ :native "explanation"
83
+ }
84
+ ]
85
+ }
86
+ ]
87
+ }
88
+ ]
89
+ :functions [
90
+ {
91
+ :declaration "example.payments::addFee"
92
+ :native ["payments_domain" "apply_fee"]
93
+ }
94
+ {
95
+ :declaration "example.payments::roundTrip"
96
+ :native ["payments_domain" "restore"]
97
+ }
98
+ {
99
+ :declaration "example.payments::archive"
100
+ :native ["payments_domain" "store"]
101
+ }
102
+ ]
103
+ :generators [
104
+ {
105
+ :type "example.payments::type::Money"
106
+ :factory ["lawspec_generators" "prices"]
107
+ }
108
+ ]
109
+ }
110
+ }
111
+ ]
112
+ :language-profile "1.0-rc.2"
113
+ :verification {
114
+ :layers [
115
+ :proof
116
+ :exhaustive
117
+ :property
118
+ :examples
119
+ :runtime
120
+ :model
121
+ ]
122
+ }
123
+ }