@reventlessdev/online-shop-hybrid-catalog 1.0.0-alpha.331 → 1.0.0-alpha.333
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 +15 -0
- package/package.json +8 -8
- package/src/Product/InboundTranslation/ImportProduct_Translation.res +6 -3
- package/src/Product/InboundTranslation/ImportProduct_Translation.res.mjs +1 -1
- package/tests/Catalog_Examples.res +3 -3
- package/tests/Catalog_Examples.res.mjs +3 -3
- package/tests/ExtensionPoint/Products_ExtensionPointMapping_GWT.res +7 -7
- package/tests/ExtensionPoint/Products_ExtensionPointMapping_GWT.res.mjs +7 -7
- package/tests/Product/InboundTranslation/ImportProduct_GWT.res +1 -1
- package/tests/Product/InboundTranslation/ImportProduct_GWT.res.mjs +1 -1
- package/tests/Product/StateChange/ChangeProductPrice_GWT.res +1 -1
- package/tests/Product/StateChange/ChangeProductPrice_GWT.res.mjs +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,21 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
# 1.0.0-alpha.333 (2026-11-22)
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
* **spec:** money is written down as people say it, and counted in minor units inside ([0588a5a](https://github.com/ReventlessDev/reventless-core/commit/0588a5ac4542930d518985764aaaeecf2356e4c9))
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
# 1.0.0-alpha.332 (2026-11-22)
|
|
14
|
+
|
|
15
|
+
**Note:** Version bump only for package @reventlessdev/online-shop-hybrid-catalog
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
6
21
|
# 1.0.0-alpha.331 (2026-11-22)
|
|
7
22
|
|
|
8
23
|
**Note:** Version bump only for package @reventlessdev/online-shop-hybrid-catalog
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@reventlessdev/online-shop-hybrid-catalog",
|
|
3
|
-
"version": "1.0.0-alpha.
|
|
3
|
+
"version": "1.0.0-alpha.333",
|
|
4
4
|
"description": "Online Shop Hybrid example — Catalog plugin (Category + Product/ProductDemand DCB slices)",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"jest": {
|
|
@@ -21,14 +21,14 @@
|
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
23
|
"sury": "11.1.0",
|
|
24
|
-
"@reventlessdev/online-shop-hybrid-catalog-spec": "1.0.0-alpha.207",
|
|
25
|
-
"@reventlessdev/reventless-gwt": "1.0.0-alpha.297",
|
|
26
|
-
"@reventlessdev/reventless-infra": "3.0.0-alpha.241",
|
|
27
24
|
"@reventlessdev/rescript-pulumi-pulumi": "3.0.0-alpha.2",
|
|
28
|
-
"@reventlessdev/
|
|
29
|
-
"@reventlessdev/
|
|
30
|
-
"@reventlessdev/
|
|
31
|
-
"@reventlessdev/
|
|
25
|
+
"@reventlessdev/reventless-gwt": "1.0.0-alpha.299",
|
|
26
|
+
"@reventlessdev/online-shop-hybrid-ordering-spec": "1.0.0-alpha.208",
|
|
27
|
+
"@reventlessdev/online-shop-hybrid-catalog-spec": "1.0.0-alpha.209",
|
|
28
|
+
"@reventlessdev/reventless-local": "3.0.0-alpha.344",
|
|
29
|
+
"@reventlessdev/reventless-infra": "3.0.0-alpha.243",
|
|
30
|
+
"@reventlessdev/reventless-spec": "3.0.0-alpha.212",
|
|
31
|
+
"@reventlessdev/trait-attachments": "1.0.0-alpha.101"
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
|
34
34
|
"rescript": "12.3.1",
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
@@reventless.translation
|
|
2
2
|
|
|
3
3
|
// The feed already speaks in minor units, so the translation is a *parse* of its
|
|
4
|
-
// currency code rather than an arithmetic conversion: `Money.
|
|
5
|
-
// facts the supplier sent and nothing is scaled.
|
|
4
|
+
// currency code rather than an arithmetic conversion: `Money.ofMinorUnits` takes
|
|
5
|
+
// the two facts the supplier sent and nothing is scaled.
|
|
6
6
|
//
|
|
7
7
|
// This used to read `Int.toFloat(input.unitPrice) /. 100.0` and reject anything
|
|
8
8
|
// that was not USD — two halves of one mistake. The divide-by-100 was a minor
|
|
@@ -28,7 +28,10 @@ let translate = async (input: externalInput, ~capabilities as _, ~caller as _) =
|
|
|
28
28
|
productId: CatalogSpec.ProductId.makeFromString(input.sku),
|
|
29
29
|
name: input.title,
|
|
30
30
|
description: input.desc,
|
|
31
|
-
price: Reventless.Money.
|
|
31
|
+
price: Reventless.Money.ofMinorUnits(
|
|
32
|
+
~minorUnits=Int.toFloat(input.unitPrice),
|
|
33
|
+
~currency,
|
|
34
|
+
),
|
|
32
35
|
categoryId: CategoryId.makeFromString(input.category),
|
|
33
36
|
}),
|
|
34
37
|
),
|
|
@@ -33,7 +33,7 @@ async function translate(input, param, param$1) {
|
|
|
33
33
|
productId: ProductId$CatalogSpec.makeFromString(input.sku),
|
|
34
34
|
name: input.title,
|
|
35
35
|
description: input.desc,
|
|
36
|
-
price: Money$Reventless.
|
|
36
|
+
price: Money$Reventless.ofMinorUnits(input.unitPrice, why._0),
|
|
37
37
|
categoryId: CategoryId$CatalogPlugin.makeFromString(input.category)
|
|
38
38
|
}
|
|
39
39
|
]]
|
|
@@ -29,14 +29,14 @@ let frontImage: Reventless.UploadableImage.t = "/uploads/3e7b41c8-5a2d-4f60-8c19
|
|
|
29
29
|
let sideImage: Reventless.UploadableImage.t = "/uploads/9c1f2a30-0b7e-4a11-9d33-6f0d2e5a8b41/p1-side.jpg"
|
|
30
30
|
|
|
31
31
|
let buchPrice: Reventless.Money.t = Reventless.Money.make(
|
|
32
|
-
~amount=
|
|
32
|
+
~amount=19.99,
|
|
33
33
|
~currency=Reventless.Currency.EUR,
|
|
34
34
|
)
|
|
35
35
|
let laptopChangedPrice: Reventless.Money.t = Reventless.Money.make(
|
|
36
|
-
~amount=
|
|
36
|
+
~amount=899.99,
|
|
37
37
|
~currency=Reventless.Currency.EUR,
|
|
38
38
|
)
|
|
39
39
|
let laptopPrice: Reventless.Money.t = Reventless.Money.make(
|
|
40
|
-
~amount=
|
|
40
|
+
~amount=999.99,
|
|
41
41
|
~currency=Reventless.Currency.EUR,
|
|
42
42
|
)
|
|
@@ -12,11 +12,11 @@ let p1 = ProductId$CatalogSpec.makeFromString("p1");
|
|
|
12
12
|
|
|
13
13
|
let p2 = ProductId$CatalogSpec.makeFromString("p2");
|
|
14
14
|
|
|
15
|
-
let buchPrice = Money$Reventless.make(
|
|
15
|
+
let buchPrice = Money$Reventless.make(19.99, "EUR");
|
|
16
16
|
|
|
17
|
-
let laptopChangedPrice = Money$Reventless.make(
|
|
17
|
+
let laptopChangedPrice = Money$Reventless.make(899.99, "EUR");
|
|
18
18
|
|
|
19
|
-
let laptopPrice = Money$Reventless.make(
|
|
19
|
+
let laptopPrice = Money$Reventless.make(999.99, "EUR");
|
|
20
20
|
|
|
21
21
|
let anyDescription = "x";
|
|
22
22
|
|
|
@@ -19,14 +19,14 @@ describe("Products ExtensionPoint mapping", () => {
|
|
|
19
19
|
productId: p1,
|
|
20
20
|
name: "Book",
|
|
21
21
|
description: "A good book",
|
|
22
|
-
price: Reventless.Money.make(~amount=
|
|
22
|
+
price: Reventless.Money.make(~amount=9.99, ~currency=Reventless.Currency.EUR),
|
|
23
23
|
}),
|
|
24
24
|
)->thenPublishesEvent(
|
|
25
25
|
"p1",
|
|
26
26
|
ExtensionPoint.ProductBecameAvailable({
|
|
27
27
|
productId: p1,
|
|
28
28
|
name: "Book",
|
|
29
|
-
price: Reventless.Money.make(~amount=
|
|
29
|
+
price: Reventless.Money.make(~amount=9.99, ~currency=Reventless.Currency.EUR),
|
|
30
30
|
}),
|
|
31
31
|
)
|
|
32
32
|
)
|
|
@@ -38,7 +38,7 @@ describe("Products ExtensionPoint mapping", () => {
|
|
|
38
38
|
productId: p1,
|
|
39
39
|
name: "Book",
|
|
40
40
|
description: "A good book",
|
|
41
|
-
price: Reventless.Money.make(~amount=
|
|
41
|
+
price: Reventless.Money.make(~amount=9.99, ~currency=Reventless.Currency.EUR),
|
|
42
42
|
}),
|
|
43
43
|
)->thenHandlesNoDirective
|
|
44
44
|
)
|
|
@@ -48,13 +48,13 @@ describe("Products ExtensionPoint mapping", () => {
|
|
|
48
48
|
whenDelegateEvent(
|
|
49
49
|
Delegate.ProductPriceChanged({
|
|
50
50
|
productId: p1,
|
|
51
|
-
price: Reventless.Money.make(~amount=
|
|
51
|
+
price: Reventless.Money.make(~amount=7.5, ~currency=Reventless.Currency.EUR),
|
|
52
52
|
}),
|
|
53
53
|
)->thenPublishesEvent(
|
|
54
54
|
"p1",
|
|
55
55
|
ExtensionPoint.ProductPriceChanged({
|
|
56
56
|
productId: p1,
|
|
57
|
-
price: Reventless.Money.make(~amount=
|
|
57
|
+
price: Reventless.Money.make(~amount=7.5, ~currency=Reventless.Currency.EUR),
|
|
58
58
|
}),
|
|
59
59
|
)
|
|
60
60
|
)
|
|
@@ -64,12 +64,12 @@ describe("Products ExtensionPoint mapping", () => {
|
|
|
64
64
|
whenDelegateEvent(
|
|
65
65
|
Delegate.ProductPriceChanged({
|
|
66
66
|
productId: p1,
|
|
67
|
-
price: Reventless.Money.make(~amount=
|
|
67
|
+
price: Reventless.Money.make(~amount=7.5, ~currency=Reventless.Currency.EUR),
|
|
68
68
|
}),
|
|
69
69
|
)->thenHandlesDirective(
|
|
70
70
|
ExtensionPoint.EmitPricingUpdate({
|
|
71
71
|
productId: p1,
|
|
72
|
-
price: Reventless.Money.make(~amount=
|
|
72
|
+
price: Reventless.Money.make(~amount=7.5, ~currency=Reventless.Currency.EUR),
|
|
73
73
|
}),
|
|
74
74
|
)
|
|
75
75
|
)
|
|
@@ -51,37 +51,37 @@ describe("Products ExtensionPoint mapping", () => {
|
|
|
51
51
|
productId: Catalog_Examples$CatalogPlugin.p1,
|
|
52
52
|
name: "Book",
|
|
53
53
|
description: "A good book",
|
|
54
|
-
price: Money$Reventless.make(
|
|
54
|
+
price: Money$Reventless.make(9.99, "EUR")
|
|
55
55
|
}), "p1", {
|
|
56
56
|
TAG: "ProductBecameAvailable",
|
|
57
57
|
productId: Catalog_Examples$CatalogPlugin.p1,
|
|
58
58
|
name: "Book",
|
|
59
|
-
price: Money$Reventless.make(
|
|
59
|
+
price: Money$Reventless.make(9.99, "EUR")
|
|
60
60
|
}));
|
|
61
61
|
test("ProductAdded raises no directive", undefined, () => thenHandlesNoDirective(whenDelegateEvent({
|
|
62
62
|
TAG: "ProductAdded",
|
|
63
63
|
productId: Catalog_Examples$CatalogPlugin.p1,
|
|
64
64
|
name: "Book",
|
|
65
65
|
description: "A good book",
|
|
66
|
-
price: Money$Reventless.make(
|
|
66
|
+
price: Money$Reventless.make(9.99, "EUR")
|
|
67
67
|
})));
|
|
68
68
|
test("ProductPriceChanged is forwarded to the extension point", undefined, () => thenPublishesEvent(whenDelegateEvent({
|
|
69
69
|
TAG: "ProductPriceChanged",
|
|
70
70
|
productId: Catalog_Examples$CatalogPlugin.p1,
|
|
71
|
-
price: Money$Reventless.make(
|
|
71
|
+
price: Money$Reventless.make(7.5, "EUR")
|
|
72
72
|
}), "p1", {
|
|
73
73
|
TAG: "ProductPriceChanged",
|
|
74
74
|
productId: Catalog_Examples$CatalogPlugin.p1,
|
|
75
|
-
price: Money$Reventless.make(
|
|
75
|
+
price: Money$Reventless.make(7.5, "EUR")
|
|
76
76
|
}));
|
|
77
77
|
test("ProductPriceChanged also fires a pricing-update directive", undefined, () => thenHandlesDirective(whenDelegateEvent({
|
|
78
78
|
TAG: "ProductPriceChanged",
|
|
79
79
|
productId: Catalog_Examples$CatalogPlugin.p1,
|
|
80
|
-
price: Money$Reventless.make(
|
|
80
|
+
price: Money$Reventless.make(7.5, "EUR")
|
|
81
81
|
}), {
|
|
82
82
|
TAG: "EmitPricingUpdate",
|
|
83
83
|
productId: Catalog_Examples$CatalogPlugin.p1,
|
|
84
|
-
price: Money$Reventless.make(
|
|
84
|
+
price: Money$Reventless.make(7.5, "EUR")
|
|
85
85
|
}));
|
|
86
86
|
test("ProductArchived publishes ProductWithdrawn", undefined, () => thenPublishesEvent(whenDelegateEvent({
|
|
87
87
|
TAG: "ProductArchived",
|
|
@@ -24,7 +24,7 @@ describe("ImportProduct InboundTranslationSlice", () => {
|
|
|
24
24
|
productId: pid("p-1"),
|
|
25
25
|
name: laptop,
|
|
26
26
|
description: highEnd,
|
|
27
|
-
price: Reventless.Money.make(~amount=
|
|
27
|
+
price: Reventless.Money.make(~amount=999.99, ~currency=Reventless.Currency.USD),
|
|
28
28
|
categoryId: cat1,
|
|
29
29
|
}),
|
|
30
30
|
)
|
|
@@ -49,7 +49,7 @@ describe("ImportProduct InboundTranslationSlice", () => {
|
|
|
49
49
|
productId: ProductId$CatalogSpec.make("p-1"),
|
|
50
50
|
name: Catalog_Examples$CatalogPlugin.laptop,
|
|
51
51
|
description: Catalog_Examples$CatalogPlugin.highEnd,
|
|
52
|
-
price: Money$Reventless.make(
|
|
52
|
+
price: Money$Reventless.make(999.99, "USD"),
|
|
53
53
|
categoryId: Catalog_Examples$CatalogPlugin.cat1
|
|
54
54
|
}));
|
|
55
55
|
test("a non-USD payload translates instead of failing", undefined, () => thenCommand(whenInput({
|
|
@@ -14,7 +14,7 @@ describe("ChangeProductPrice StateChangeSlice", () => {
|
|
|
14
14
|
->whenCmd(
|
|
15
15
|
ChangeProductPrice({
|
|
16
16
|
productId: p1,
|
|
17
|
-
price: Reventless.Money.make(~amount=
|
|
17
|
+
price: Reventless.Money.make(~amount=1.0, ~currency=Reventless.Currency.EUR),
|
|
18
18
|
}),
|
|
19
19
|
)
|
|
20
20
|
->thenError(ProductNotFound)
|
|
@@ -43,7 +43,7 @@ describe("ChangeProductPrice StateChangeSlice", () => {
|
|
|
43
43
|
test("non-existent product returns ProductNotFound", () => thenError(whenCmd(givenEvents([]), {
|
|
44
44
|
TAG: "ChangeProductPrice",
|
|
45
45
|
productId: Catalog_Examples$CatalogPlugin.p1,
|
|
46
|
-
price: Money$Reventless.make(
|
|
46
|
+
price: Money$Reventless.make(1.0, "EUR")
|
|
47
47
|
}), "ProductNotFound"));
|
|
48
48
|
test("existing product produces ProductPriceChanged", () => thenEvent(whenCmd(givenEvents([{
|
|
49
49
|
TAG: "ProductAdded",
|