@reventlessdev/online-shop-hybrid-ordering 1.0.0-alpha.100

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 (86) hide show
  1. package/CHANGELOG.md +904 -0
  2. package/LICENSE +202 -0
  3. package/__mocks__/emptyModule.js +1 -0
  4. package/package.json +57 -0
  5. package/rescript.json +37 -0
  6. package/src/CatalogProduct/StateChangeSlice/SyncCatalogProduct.res +29 -0
  7. package/src/CatalogProduct/StateChangeSlice/SyncCatalogProduct.res.mjs +71 -0
  8. package/src/CatalogProduct/StateChangeSlice/SyncCatalogProduct_Behavior.res +27 -0
  9. package/src/CatalogProduct/StateChangeSlice/SyncCatalogProduct_Behavior.res.mjs +73 -0
  10. package/src/CatalogProduct/StateViewSliceStream/AvailableProducts.res +15 -0
  11. package/src/CatalogProduct/StateViewSliceStream/AvailableProducts.res.mjs +69 -0
  12. package/src/CatalogProduct/StateViewSliceStream/AvailableProducts_Projection.res +8 -0
  13. package/src/CatalogProduct/StateViewSliceStream/AvailableProducts_Projection.res.mjs +38 -0
  14. package/src/Customer/Aggregate/Customer.res +24 -0
  15. package/src/Customer/Aggregate/Customer.res.mjs +64 -0
  16. package/src/Customer/Aggregate/Customer_Behavior.res +41 -0
  17. package/src/Customer/Aggregate/Customer_Behavior.res.mjs +143 -0
  18. package/src/Customer/ReadModelStream/Customers.res +15 -0
  19. package/src/Customer/ReadModelStream/Customers.res.mjs +44 -0
  20. package/src/Customer/ReadModelStream/Customers_Projections.res +78 -0
  21. package/src/Customer/ReadModelStream/Customers_Projections.res.mjs +153 -0
  22. package/src/Extension/Products_Extension.res +23 -0
  23. package/src/Extension/Products_Extension.res.mjs +43 -0
  24. package/src/ExtensionPoint/Orders_ExtensionPointMapping.res +33 -0
  25. package/src/ExtensionPoint/Orders_ExtensionPointMapping.res.mjs +82 -0
  26. package/src/Order/AutomationSlice/AutoShipOrder.res +19 -0
  27. package/src/Order/AutomationSlice/AutoShipOrder.res.mjs +42 -0
  28. package/src/Order/AutomationSlice/AutoShipOrder_Automation.res +37 -0
  29. package/src/Order/AutomationSlice/AutoShipOrder_Automation.res.mjs +101 -0
  30. package/src/Order/OutboundTranslationSlice/SendOrderConfirmation.res +22 -0
  31. package/src/Order/OutboundTranslationSlice/SendOrderConfirmation.res.mjs +45 -0
  32. package/src/Order/OutboundTranslationSlice/SendOrderConfirmation_Translation.res +24 -0
  33. package/src/Order/OutboundTranslationSlice/SendOrderConfirmation_Translation.res.mjs +46 -0
  34. package/src/Order/StateChangeSlice/CancelOrder.res +29 -0
  35. package/src/Order/StateChangeSlice/CancelOrder.res.mjs +75 -0
  36. package/src/Order/StateChangeSlice/CancelOrder_Behavior.res +35 -0
  37. package/src/Order/StateChangeSlice/CancelOrder_Behavior.res.mjs +110 -0
  38. package/src/Order/StateChangeSlice/PlaceOrder.res +28 -0
  39. package/src/Order/StateChangeSlice/PlaceOrder.res.mjs +63 -0
  40. package/src/Order/StateChangeSlice/PlaceOrder_Behavior.res +39 -0
  41. package/src/Order/StateChangeSlice/PlaceOrder_Behavior.res.mjs +70 -0
  42. package/src/Order/StateChangeSlice/RefundOrder.res +27 -0
  43. package/src/Order/StateChangeSlice/RefundOrder.res.mjs +59 -0
  44. package/src/Order/StateChangeSlice/RefundOrder_Behavior.res +26 -0
  45. package/src/Order/StateChangeSlice/RefundOrder_Behavior.res.mjs +77 -0
  46. package/src/Order/StateChangeSlice/ShipOrder.res +23 -0
  47. package/src/Order/StateChangeSlice/ShipOrder.res.mjs +56 -0
  48. package/src/Order/StateChangeSlice/ShipOrder_Behavior.res +26 -0
  49. package/src/Order/StateChangeSlice/ShipOrder_Behavior.res.mjs +73 -0
  50. package/src/Order/StateViewSliceStream/Orders.res +24 -0
  51. package/src/Order/StateViewSliceStream/Orders.res.mjs +80 -0
  52. package/src/Order/StateViewSliceStream/Orders_Projection.res +10 -0
  53. package/src/Order/StateViewSliceStream/Orders_Projection.res.mjs +52 -0
  54. package/src/Plugin.res +74 -0
  55. package/src/Plugin.res.mjs +304 -0
  56. package/src/Service/EmailService.res +3 -0
  57. package/src/Service/EmailService.res.mjs +11 -0
  58. package/src/plugin.json +1 -0
  59. package/tests/CatalogProduct/StateChangeSlice/SyncCatalogProduct_GWT.res +27 -0
  60. package/tests/CatalogProduct/StateChangeSlice/SyncCatalogProduct_GWT.res.mjs +109 -0
  61. package/tests/CatalogProduct/StateViewSliceStream/AvailableProducts_GWT.res +15 -0
  62. package/tests/CatalogProduct/StateViewSliceStream/AvailableProducts_GWT.res.mjs +93 -0
  63. package/tests/Customer/Aggregate/Customer_GWT.res +63 -0
  64. package/tests/Customer/Aggregate/Customer_GWT.res.mjs +153 -0
  65. package/tests/Customer/ReadModelStream/Customers_GWT.res +84 -0
  66. package/tests/Customer/ReadModelStream/Customers_GWT.res.mjs +90 -0
  67. package/tests/Extension/Products_Extension_GWT.res +23 -0
  68. package/tests/Extension/Products_Extension_GWT.res.mjs +108 -0
  69. package/tests/ExtensionPoint/Orders_ExtensionPointMapping_GWT.res +23 -0
  70. package/tests/ExtensionPoint/Orders_ExtensionPointMapping_GWT.res.mjs +139 -0
  71. package/tests/Flow/OrderingFlow_GWT.res +69 -0
  72. package/tests/Flow/OrderingFlow_GWT.res.mjs +184 -0
  73. package/tests/Order/AutomationSlice/AutoShipOrder_GWT.res +55 -0
  74. package/tests/Order/AutomationSlice/AutoShipOrder_GWT.res.mjs +133 -0
  75. package/tests/Order/OutboundTranslationSlice/SendOrderConfirmation_GWT.res +30 -0
  76. package/tests/Order/OutboundTranslationSlice/SendOrderConfirmation_GWT.res.mjs +102 -0
  77. package/tests/Order/StateChangeSlice/CancelOrder_GWT.res +45 -0
  78. package/tests/Order/StateChangeSlice/CancelOrder_GWT.res.mjs +131 -0
  79. package/tests/Order/StateChangeSlice/PlaceOrder_GWT.res +33 -0
  80. package/tests/Order/StateChangeSlice/PlaceOrder_GWT.res.mjs +139 -0
  81. package/tests/Order/StateChangeSlice/RefundOrder_GWT.res +31 -0
  82. package/tests/Order/StateChangeSlice/RefundOrder_GWT.res.mjs +100 -0
  83. package/tests/Order/StateChangeSlice/ShipOrder_GWT.res +27 -0
  84. package/tests/Order/StateChangeSlice/ShipOrder_GWT.res.mjs +91 -0
  85. package/tests/Order/StateViewSliceStream/Orders_GWT.res +36 -0
  86. package/tests/Order/StateViewSliceStream/Orders_GWT.res.mjs +114 -0
@@ -0,0 +1,91 @@
1
+ // Generated by ReScript, PLEASE EDIT WITH CARE
2
+
3
+ import * as ShipOrder$OrderingPlugin from "../../../src/Order/StateChangeSlice/ShipOrder.res.mjs";
4
+ import * as Behavior_GWT$ReventlessGwt from "@reventlessdev/reventless-gwt/src/Behavior_GWT.res.mjs";
5
+ import * as ShipOrder_Behavior$OrderingPlugin from "../../../src/Order/StateChangeSlice/ShipOrder_Behavior.res.mjs";
6
+
7
+ let include = Behavior_GWT$ReventlessGwt.Make({
8
+ name: ShipOrder$OrderingPlugin.name,
9
+ consumedEventSchema: ShipOrder$OrderingPlugin.consumedEventSchema,
10
+ commandSchema: ShipOrder$OrderingPlugin.commandSchema,
11
+ errorSchema: ShipOrder$OrderingPlugin.errorSchema,
12
+ eventSchema: ShipOrder$OrderingPlugin.eventSchema
13
+ })({
14
+ initialState: ShipOrder_Behavior$OrderingPlugin.initialState,
15
+ evolve: ShipOrder_Behavior$OrderingPlugin.evolve,
16
+ decide: ShipOrder_Behavior$OrderingPlugin.decide
17
+ });
18
+
19
+ let describe = include.describe;
20
+
21
+ let test = include.test;
22
+
23
+ let givenEvents = include.givenEvents;
24
+
25
+ let whenCmd = include.whenCmd;
26
+
27
+ let thenEvent = include.thenEvent;
28
+
29
+ let thenNoEvent = include.thenNoEvent;
30
+
31
+ let thenError = include.thenError;
32
+
33
+ describe("ShipOrder StateChangeSlice", () => {
34
+ test("non-existent order returns OrderNotFound", () => thenError(whenCmd(givenEvents([]), {
35
+ TAG: "ShipOrder",
36
+ orderId: "o1"
37
+ }), "OrderNotFound"));
38
+ test("placed order produces OrderShipped", () => thenEvent(whenCmd(givenEvents(["OrderPlaced"]), {
39
+ TAG: "ShipOrder",
40
+ orderId: "o1"
41
+ }), {
42
+ TAG: "OrderShipped",
43
+ orderId: "o1"
44
+ }));
45
+ test("already shipped order produces no events (idempotent)", () => thenNoEvent(whenCmd(givenEvents([
46
+ "OrderPlaced",
47
+ "OrderShipped"
48
+ ]), {
49
+ TAG: "ShipOrder",
50
+ orderId: "o1"
51
+ })));
52
+ test("cancelled order returns OrderAlreadyCancelled", () => thenError(whenCmd(givenEvents([
53
+ "OrderPlaced",
54
+ "OrderCancelled"
55
+ ]), {
56
+ TAG: "ShipOrder",
57
+ orderId: "o1"
58
+ }), "OrderAlreadyCancelled"));
59
+ });
60
+
61
+ let Spec = include.Spec;
62
+
63
+ let todo = include.todo;
64
+
65
+ let thenEvents = include.thenEvents;
66
+
67
+ let thenEventWithError = include.thenEventWithError;
68
+
69
+ let thenEventsWithError = include.thenEventsWithError;
70
+
71
+ let thenAppendsConditionedOn = include.thenAppendsConditionedOn;
72
+
73
+ let thenAppendsConditionedOnExactly = include.thenAppendsConditionedOnExactly;
74
+
75
+ export {
76
+ Spec,
77
+ describe,
78
+ todo,
79
+ test,
80
+ givenEvents,
81
+ whenCmd,
82
+ thenEvent,
83
+ thenEvents,
84
+ thenNoEvent,
85
+ thenEventWithError,
86
+ thenEventsWithError,
87
+ thenError,
88
+ thenAppendsConditionedOn,
89
+ thenAppendsConditionedOnExactly,
90
+ }
91
+ /* include Not a pure module */
@@ -0,0 +1,36 @@
1
+ @@reventless.gwt
2
+
3
+ describe("Orders StateViewSlice", () => {
4
+ test("OrderPlaced creates a row with status Placed", () =>
5
+ givenEvents([])
6
+ ->whenEvent(
7
+ OrderPlaced({orderId: "o1", customerId: "c1", productIds: ["p1", "p2"]}),
8
+ )
9
+ ->thenStateWithId(
10
+ "o1",
11
+ {orderId: "o1", customerId: "c1", productIds: ["p1", "p2"], status: Placed},
12
+ )
13
+ )
14
+
15
+ test("OrderShipped updates status to Shipped", () =>
16
+ givenEvents([
17
+ OrderPlaced({orderId: "o1", customerId: "c1", productIds: ["p1"]}),
18
+ ])
19
+ ->whenEvent(OrderShipped({orderId: "o1"}))
20
+ ->thenStateWithId(
21
+ "o1",
22
+ {orderId: "o1", customerId: "c1", productIds: ["p1"], status: Shipped},
23
+ )
24
+ )
25
+
26
+ test("OrderCancelled updates status to Cancelled", () =>
27
+ givenEvents([
28
+ OrderPlaced({orderId: "o1", customerId: "c1", productIds: ["p1"]}),
29
+ ])
30
+ ->whenEvent(OrderCancelled({orderId: "o1"}))
31
+ ->thenStateWithId(
32
+ "o1",
33
+ {orderId: "o1", customerId: "c1", productIds: ["p1"], status: Cancelled},
34
+ )
35
+ )
36
+ })
@@ -0,0 +1,114 @@
1
+ // Generated by ReScript, PLEASE EDIT WITH CARE
2
+
3
+ import * as Orders$OrderingPlugin from "../../../src/Order/StateViewSliceStream/Orders.res.mjs";
4
+ import * as Projection_GWT$ReventlessGwt from "@reventlessdev/reventless-gwt/src/Projection_GWT.res.mjs";
5
+ import * as Orders_Projection$OrderingPlugin from "../../../src/Order/StateViewSliceStream/Orders_Projection.res.mjs";
6
+
7
+ let include = Projection_GWT$ReventlessGwt.Make({
8
+ name: Orders$OrderingPlugin.name,
9
+ stateSchema: Orders$OrderingPlugin.stateSchema,
10
+ consumedEventSchema: Orders$OrderingPlugin.consumedEventSchema,
11
+ subIdConfig: undefined
12
+ })({
13
+ project: Orders_Projection$OrderingPlugin.project
14
+ });
15
+
16
+ let describe = include.describe;
17
+
18
+ let test = include.test;
19
+
20
+ let givenEvents = include.givenEvents;
21
+
22
+ let whenEvent = include.whenEvent;
23
+
24
+ let thenStateWithId = include.thenStateWithId;
25
+
26
+ describe("Orders StateViewSlice", () => {
27
+ test("OrderPlaced creates a row with status Placed", undefined, () => thenStateWithId(whenEvent(givenEvents([]), {
28
+ TAG: "OrderPlaced",
29
+ orderId: "o1",
30
+ customerId: "c1",
31
+ productIds: [
32
+ "p1",
33
+ "p2"
34
+ ]
35
+ }), "o1", {
36
+ orderId: "o1",
37
+ customerId: "c1",
38
+ productIds: [
39
+ "p1",
40
+ "p2"
41
+ ],
42
+ status: "Placed"
43
+ }));
44
+ test("OrderShipped updates status to Shipped", undefined, () => thenStateWithId(whenEvent(givenEvents([{
45
+ TAG: "OrderPlaced",
46
+ orderId: "o1",
47
+ customerId: "c1",
48
+ productIds: ["p1"]
49
+ }]), {
50
+ TAG: "OrderShipped",
51
+ orderId: "o1"
52
+ }), "o1", {
53
+ orderId: "o1",
54
+ customerId: "c1",
55
+ productIds: ["p1"],
56
+ status: "Shipped"
57
+ }));
58
+ test("OrderCancelled updates status to Cancelled", undefined, () => thenStateWithId(whenEvent(givenEvents([{
59
+ TAG: "OrderPlaced",
60
+ orderId: "o1",
61
+ customerId: "c1",
62
+ productIds: ["p1"]
63
+ }]), {
64
+ TAG: "OrderCancelled",
65
+ orderId: "o1"
66
+ }), "o1", {
67
+ orderId: "o1",
68
+ customerId: "c1",
69
+ productIds: ["p1"],
70
+ status: "Cancelled"
71
+ }));
72
+ });
73
+
74
+ let Spec = include.Spec;
75
+
76
+ let describeWithId = include.describeWithId;
77
+
78
+ let todo = include.todo;
79
+
80
+ let whenEvents = include.whenEvents;
81
+
82
+ let thenStates = include.thenStates;
83
+
84
+ let thenStatesWithId = include.thenStatesWithId;
85
+
86
+ let thenAllStates = include.thenAllStates;
87
+
88
+ let thenState = include.thenState;
89
+
90
+ let thenNoState = include.thenNoState;
91
+
92
+ let thenThrow = include.thenThrow;
93
+
94
+ let thenFail = include.thenFail;
95
+
96
+ export {
97
+ Spec,
98
+ describe,
99
+ describeWithId,
100
+ todo,
101
+ test,
102
+ givenEvents,
103
+ whenEvent,
104
+ whenEvents,
105
+ thenStates,
106
+ thenStatesWithId,
107
+ thenAllStates,
108
+ thenState,
109
+ thenStateWithId,
110
+ thenNoState,
111
+ thenThrow,
112
+ thenFail,
113
+ }
114
+ /* include Not a pure module */