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 "kotlin"
5
+ :version "0.1.0"
6
+ }
7
+ :sources ["laws"]
8
+ :machine-bits 64
9
+ :targets [
10
+ {
11
+ :language :kotlin
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,48 @@
1
+ {
2
+ :manifest-version 1
3
+ :component {
4
+ :name "prolog"
5
+ :version "0.1.0"
6
+ }
7
+ :language-profile "1.0-rc.2"
8
+ :sources ["laws"]
9
+ :machine-bits 64
10
+ :verification {
11
+ :layers [
12
+ :proof
13
+ :exhaustive
14
+ :property
15
+ :examples
16
+ :runtime
17
+ :model
18
+ ]
19
+ }
20
+ :targets [
21
+ {
22
+ :language :prolog
23
+ :root "."
24
+ :native-bindings {
25
+ :functions [
26
+ {
27
+ :declaration "example.payments::addFee"
28
+ :native ["domain" "payments" "apply_fee"]
29
+ }
30
+ {
31
+ :declaration "example.payments::roundTrip"
32
+ :native ["domain" "payments" "restore"]
33
+ }
34
+ {
35
+ :declaration "example.payments::archive"
36
+ :native ["domain" "payments" "store"]
37
+ }
38
+ ]
39
+ :generators [
40
+ {
41
+ :type "example.payments::type::Money"
42
+ :factory ["domain" "payment_generators" "prices"]
43
+ }
44
+ ]
45
+ }
46
+ }
47
+ ]
48
+ }
@@ -0,0 +1,123 @@
1
+ {
2
+ :manifest-version 1
3
+ :component {
4
+ :name "python"
5
+ :version "0.1.0"
6
+ }
7
+ :sources ["laws"]
8
+ :machine-bits 64
9
+ :targets [
10
+ {
11
+ :language :python
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
+ }
@@ -0,0 +1,124 @@
1
+ {
2
+ :manifest-version 1
3
+ :component {
4
+ :name "rust"
5
+ :version "0.1.0"
6
+ }
7
+ :sources ["laws"]
8
+ :machine-bits 64
9
+ :targets [
10
+ {
11
+ :language :rust
12
+ :root "."
13
+ :native-bindings {
14
+ :rust-crate "lawspec_example"
15
+ :types [
16
+ {
17
+ :type "example.payments::type::Currency"
18
+ :native ["crate" "domain" "CurrencyCode"]
19
+ :constructors [
20
+ {
21
+ :constructor "USD"
22
+ :native ["crate" "domain" "CurrencyCode" "Dollars"]
23
+ :style "unit"
24
+ :fields []
25
+ }
26
+ {
27
+ :constructor "EUR"
28
+ :native ["crate" "domain" "CurrencyCode" "Euros"]
29
+ :style "unit"
30
+ :fields []
31
+ }
32
+ {
33
+ :constructor "GBP"
34
+ :native ["crate" "domain" "CurrencyCode" "Pounds"]
35
+ :style "unit"
36
+ :fields []
37
+ }
38
+ ]
39
+ }
40
+ {
41
+ :type "example.payments::type::Money"
42
+ :native ["crate" "domain" "Price"]
43
+ :constructors [
44
+ {
45
+ :constructor "Money"
46
+ :native ["crate" "domain" "Price"]
47
+ :style "record"
48
+ :fields [
49
+ {
50
+ :field "amount"
51
+ :native "major"
52
+ }
53
+ {
54
+ :field "currency"
55
+ :native "unit"
56
+ }
57
+ ]
58
+ }
59
+ ]
60
+ }
61
+ {
62
+ :type "example.payments::type::Payment"
63
+ :native ["crate" "domain" "PaymentStatus"]
64
+ :constructors [
65
+ {
66
+ :constructor "Paid"
67
+ :native ["crate" "domain" "PaymentStatus" "Settled"]
68
+ :style "variant"
69
+ :fields [
70
+ {
71
+ :field "value"
72
+ :native "price"
73
+ }
74
+ ]
75
+ }
76
+ {
77
+ :constructor "Declined"
78
+ :native ["crate" "domain" "PaymentStatus" "Rejected"]
79
+ :style "variant"
80
+ :fields [
81
+ {
82
+ :field "value"
83
+ :native "explanation"
84
+ }
85
+ ]
86
+ }
87
+ ]
88
+ }
89
+ ]
90
+ :functions [
91
+ {
92
+ :declaration "example.payments::addFee"
93
+ :native ["crate" "domain" "apply_fee"]
94
+ }
95
+ {
96
+ :declaration "example.payments::roundTrip"
97
+ :native ["crate" "domain" "restore"]
98
+ }
99
+ {
100
+ :declaration "example.payments::archive"
101
+ :native ["crate" "domain" "store"]
102
+ }
103
+ ]
104
+ :generators [
105
+ {
106
+ :type "example.payments::type::Money"
107
+ :factory ["lawspec_generators" "prices"]
108
+ }
109
+ ]
110
+ }
111
+ }
112
+ ]
113
+ :language-profile "1.0-rc.2"
114
+ :verification {
115
+ :layers [
116
+ :proof
117
+ :exhaustive
118
+ :property
119
+ :examples
120
+ :runtime
121
+ :model
122
+ ]
123
+ }
124
+ }
@@ -0,0 +1,123 @@
1
+ {
2
+ :manifest-version 1
3
+ :component {
4
+ :name "scala"
5
+ :version "0.1.0"
6
+ }
7
+ :sources ["laws"]
8
+ :machine-bits 64
9
+ :targets [
10
+ {
11
+ :language :scala
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 "swift"
5
+ :version "0.1.0"
6
+ }
7
+ :sources ["laws"]
8
+ :machine-bits 64
9
+ :targets [
10
+ {
11
+ :language :swift
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" "CurrencyCode" "dollars"]
22
+ :style "unit"
23
+ :fields []
24
+ }
25
+ {
26
+ :constructor "EUR"
27
+ :native ["PaymentsDomain" "CurrencyCode" "euros"]
28
+ :style "unit"
29
+ :fields []
30
+ }
31
+ {
32
+ :constructor "GBP"
33
+ :native ["PaymentsDomain" "CurrencyCode" "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" "PaymentStatus" "settled"]
67
+ :style "variant"
68
+ :fields [
69
+ {
70
+ :field "value"
71
+ :native "price"
72
+ }
73
+ ]
74
+ }
75
+ {
76
+ :constructor "Declined"
77
+ :native ["PaymentsDomain" "PaymentStatus" "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" "applyFee"]
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
+ }