@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.
- package/CHANGELOG.md +904 -0
- package/LICENSE +202 -0
- package/__mocks__/emptyModule.js +1 -0
- package/package.json +57 -0
- package/rescript.json +37 -0
- package/src/CatalogProduct/StateChangeSlice/SyncCatalogProduct.res +29 -0
- package/src/CatalogProduct/StateChangeSlice/SyncCatalogProduct.res.mjs +71 -0
- package/src/CatalogProduct/StateChangeSlice/SyncCatalogProduct_Behavior.res +27 -0
- package/src/CatalogProduct/StateChangeSlice/SyncCatalogProduct_Behavior.res.mjs +73 -0
- package/src/CatalogProduct/StateViewSliceStream/AvailableProducts.res +15 -0
- package/src/CatalogProduct/StateViewSliceStream/AvailableProducts.res.mjs +69 -0
- package/src/CatalogProduct/StateViewSliceStream/AvailableProducts_Projection.res +8 -0
- package/src/CatalogProduct/StateViewSliceStream/AvailableProducts_Projection.res.mjs +38 -0
- package/src/Customer/Aggregate/Customer.res +24 -0
- package/src/Customer/Aggregate/Customer.res.mjs +64 -0
- package/src/Customer/Aggregate/Customer_Behavior.res +41 -0
- package/src/Customer/Aggregate/Customer_Behavior.res.mjs +143 -0
- package/src/Customer/ReadModelStream/Customers.res +15 -0
- package/src/Customer/ReadModelStream/Customers.res.mjs +44 -0
- package/src/Customer/ReadModelStream/Customers_Projections.res +78 -0
- package/src/Customer/ReadModelStream/Customers_Projections.res.mjs +153 -0
- package/src/Extension/Products_Extension.res +23 -0
- package/src/Extension/Products_Extension.res.mjs +43 -0
- package/src/ExtensionPoint/Orders_ExtensionPointMapping.res +33 -0
- package/src/ExtensionPoint/Orders_ExtensionPointMapping.res.mjs +82 -0
- package/src/Order/AutomationSlice/AutoShipOrder.res +19 -0
- package/src/Order/AutomationSlice/AutoShipOrder.res.mjs +42 -0
- package/src/Order/AutomationSlice/AutoShipOrder_Automation.res +37 -0
- package/src/Order/AutomationSlice/AutoShipOrder_Automation.res.mjs +101 -0
- package/src/Order/OutboundTranslationSlice/SendOrderConfirmation.res +22 -0
- package/src/Order/OutboundTranslationSlice/SendOrderConfirmation.res.mjs +45 -0
- package/src/Order/OutboundTranslationSlice/SendOrderConfirmation_Translation.res +24 -0
- package/src/Order/OutboundTranslationSlice/SendOrderConfirmation_Translation.res.mjs +46 -0
- package/src/Order/StateChangeSlice/CancelOrder.res +29 -0
- package/src/Order/StateChangeSlice/CancelOrder.res.mjs +75 -0
- package/src/Order/StateChangeSlice/CancelOrder_Behavior.res +35 -0
- package/src/Order/StateChangeSlice/CancelOrder_Behavior.res.mjs +110 -0
- package/src/Order/StateChangeSlice/PlaceOrder.res +28 -0
- package/src/Order/StateChangeSlice/PlaceOrder.res.mjs +63 -0
- package/src/Order/StateChangeSlice/PlaceOrder_Behavior.res +39 -0
- package/src/Order/StateChangeSlice/PlaceOrder_Behavior.res.mjs +70 -0
- package/src/Order/StateChangeSlice/RefundOrder.res +27 -0
- package/src/Order/StateChangeSlice/RefundOrder.res.mjs +59 -0
- package/src/Order/StateChangeSlice/RefundOrder_Behavior.res +26 -0
- package/src/Order/StateChangeSlice/RefundOrder_Behavior.res.mjs +77 -0
- package/src/Order/StateChangeSlice/ShipOrder.res +23 -0
- package/src/Order/StateChangeSlice/ShipOrder.res.mjs +56 -0
- package/src/Order/StateChangeSlice/ShipOrder_Behavior.res +26 -0
- package/src/Order/StateChangeSlice/ShipOrder_Behavior.res.mjs +73 -0
- package/src/Order/StateViewSliceStream/Orders.res +24 -0
- package/src/Order/StateViewSliceStream/Orders.res.mjs +80 -0
- package/src/Order/StateViewSliceStream/Orders_Projection.res +10 -0
- package/src/Order/StateViewSliceStream/Orders_Projection.res.mjs +52 -0
- package/src/Plugin.res +74 -0
- package/src/Plugin.res.mjs +304 -0
- package/src/Service/EmailService.res +3 -0
- package/src/Service/EmailService.res.mjs +11 -0
- package/src/plugin.json +1 -0
- package/tests/CatalogProduct/StateChangeSlice/SyncCatalogProduct_GWT.res +27 -0
- package/tests/CatalogProduct/StateChangeSlice/SyncCatalogProduct_GWT.res.mjs +109 -0
- package/tests/CatalogProduct/StateViewSliceStream/AvailableProducts_GWT.res +15 -0
- package/tests/CatalogProduct/StateViewSliceStream/AvailableProducts_GWT.res.mjs +93 -0
- package/tests/Customer/Aggregate/Customer_GWT.res +63 -0
- package/tests/Customer/Aggregate/Customer_GWT.res.mjs +153 -0
- package/tests/Customer/ReadModelStream/Customers_GWT.res +84 -0
- package/tests/Customer/ReadModelStream/Customers_GWT.res.mjs +90 -0
- package/tests/Extension/Products_Extension_GWT.res +23 -0
- package/tests/Extension/Products_Extension_GWT.res.mjs +108 -0
- package/tests/ExtensionPoint/Orders_ExtensionPointMapping_GWT.res +23 -0
- package/tests/ExtensionPoint/Orders_ExtensionPointMapping_GWT.res.mjs +139 -0
- package/tests/Flow/OrderingFlow_GWT.res +69 -0
- package/tests/Flow/OrderingFlow_GWT.res.mjs +184 -0
- package/tests/Order/AutomationSlice/AutoShipOrder_GWT.res +55 -0
- package/tests/Order/AutomationSlice/AutoShipOrder_GWT.res.mjs +133 -0
- package/tests/Order/OutboundTranslationSlice/SendOrderConfirmation_GWT.res +30 -0
- package/tests/Order/OutboundTranslationSlice/SendOrderConfirmation_GWT.res.mjs +102 -0
- package/tests/Order/StateChangeSlice/CancelOrder_GWT.res +45 -0
- package/tests/Order/StateChangeSlice/CancelOrder_GWT.res.mjs +131 -0
- package/tests/Order/StateChangeSlice/PlaceOrder_GWT.res +33 -0
- package/tests/Order/StateChangeSlice/PlaceOrder_GWT.res.mjs +139 -0
- package/tests/Order/StateChangeSlice/RefundOrder_GWT.res +31 -0
- package/tests/Order/StateChangeSlice/RefundOrder_GWT.res.mjs +100 -0
- package/tests/Order/StateChangeSlice/ShipOrder_GWT.res +27 -0
- package/tests/Order/StateChangeSlice/ShipOrder_GWT.res.mjs +91 -0
- package/tests/Order/StateViewSliceStream/Orders_GWT.res +36 -0
- package/tests/Order/StateViewSliceStream/Orders_GWT.res.mjs +114 -0
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
// Generated by ReScript, PLEASE EDIT WITH CARE
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
function project(event) {
|
|
5
|
+
switch (event.TAG) {
|
|
6
|
+
case "OrderPlaced" :
|
|
7
|
+
let orderId = event.orderId;
|
|
8
|
+
return [{
|
|
9
|
+
TAG: "Set",
|
|
10
|
+
_0: orderId,
|
|
11
|
+
_1: {
|
|
12
|
+
orderId: orderId,
|
|
13
|
+
customerId: event.customerId,
|
|
14
|
+
productIds: event.productIds,
|
|
15
|
+
status: "Placed"
|
|
16
|
+
}
|
|
17
|
+
}];
|
|
18
|
+
case "OrderShipped" :
|
|
19
|
+
return [{
|
|
20
|
+
TAG: "Update",
|
|
21
|
+
_0: event.orderId,
|
|
22
|
+
_1: state => ({
|
|
23
|
+
orderId: state.orderId,
|
|
24
|
+
customerId: state.customerId,
|
|
25
|
+
productIds: state.productIds,
|
|
26
|
+
status: "Shipped"
|
|
27
|
+
})
|
|
28
|
+
}];
|
|
29
|
+
case "OrderCancelled" :
|
|
30
|
+
return [{
|
|
31
|
+
TAG: "Update",
|
|
32
|
+
_0: event.orderId,
|
|
33
|
+
_1: state => ({
|
|
34
|
+
orderId: state.orderId,
|
|
35
|
+
customerId: state.customerId,
|
|
36
|
+
productIds: state.productIds,
|
|
37
|
+
status: "Cancelled"
|
|
38
|
+
})
|
|
39
|
+
}];
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
let Spec;
|
|
44
|
+
|
|
45
|
+
let moduleUrl = "@reventlessdev/online-shop-hybrid-ordering/src/Order/StateViewSliceStream/Orders_Projection.res.mjs";
|
|
46
|
+
|
|
47
|
+
export {
|
|
48
|
+
Spec,
|
|
49
|
+
project,
|
|
50
|
+
moduleUrl,
|
|
51
|
+
}
|
|
52
|
+
/* No side effect */
|
package/src/Plugin.res
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
// AUTO-GENERATED — do not edit. Run `npm run generate` to update.
|
|
2
|
+
|
|
3
|
+
@val external uiBundleUrl: option<string> = "process.env.ORDERING_UI_BUNDLE_URL"
|
|
4
|
+
|
|
5
|
+
module Make = (Platform: ReventlessInfra.Platform.T) => {
|
|
6
|
+
// StateChangeSlices
|
|
7
|
+
module CancelOrderSlice = Platform.StateChangeSlice.Make(CancelOrder, CancelOrder_Behavior)
|
|
8
|
+
module PlaceOrderSlice = Platform.StateChangeSlice.Make(PlaceOrder, PlaceOrder_Behavior)
|
|
9
|
+
module RefundOrderSlice = Platform.StateChangeSlice.Make(RefundOrder, RefundOrder_Behavior)
|
|
10
|
+
module ShipOrderSlice = Platform.StateChangeSlice.Make(ShipOrder, ShipOrder_Behavior)
|
|
11
|
+
module SyncCatalogProductSlice = Platform.StateChangeSlice.Make(SyncCatalogProduct, SyncCatalogProduct_Behavior)
|
|
12
|
+
|
|
13
|
+
// StateViewSliceStreams
|
|
14
|
+
module AvailableProductsStreamSlice = Platform.StateViewSliceStream.Make(AvailableProducts, AvailableProducts_Projection)
|
|
15
|
+
module OrdersStreamSlice = Platform.StateViewSliceStream.Make(Orders, Orders_Projection)
|
|
16
|
+
|
|
17
|
+
// AutomationSlices
|
|
18
|
+
module AutoShipOrderSlice = Platform.AutomationSlice.Make(AutoShipOrder, AutoShipOrder_Automation)
|
|
19
|
+
|
|
20
|
+
// OutboundTranslationSlices
|
|
21
|
+
module SendOrderConfirmationSlice = Platform.OutboundTranslationSlice.Make(SendOrderConfirmation, SendOrderConfirmation_Translation)
|
|
22
|
+
|
|
23
|
+
// Aggregates
|
|
24
|
+
module CustomerAggregate = Platform.Aggregate.Make(
|
|
25
|
+
Customer,
|
|
26
|
+
Customer_Behavior,
|
|
27
|
+
ReventlessInfra.NoEventMappings.Make(Customer),
|
|
28
|
+
)
|
|
29
|
+
|
|
30
|
+
// ReadModels
|
|
31
|
+
module CustomersReadModel = Platform.ReadModelStream.Make(Customers, Customers_Projections)
|
|
32
|
+
|
|
33
|
+
// ExtensionPoints
|
|
34
|
+
module Orders_ExtensionPoint = Platform.ExtensionPoint.Make(Orders_ExtensionPointMapping)
|
|
35
|
+
|
|
36
|
+
// Extensions
|
|
37
|
+
module Products_Extension = Platform.Extension.Make(Products_Extension.Mapping)
|
|
38
|
+
|
|
39
|
+
let pluginStructure = Platform.Plugin.makePluginDefinition(
|
|
40
|
+
~name="Ordering",
|
|
41
|
+
~aggregates=[module(CustomerAggregate)],
|
|
42
|
+
~readModels=[module(CustomersReadModel)],
|
|
43
|
+
~stateViewSlices=[module(AvailableProductsStreamSlice), module(OrdersStreamSlice)],
|
|
44
|
+
~stateChangeSlices=[module(CancelOrderSlice), module(PlaceOrderSlice), module(RefundOrderSlice), module(ShipOrderSlice), module(SyncCatalogProductSlice)],
|
|
45
|
+
~automationSlices=[module(AutoShipOrderSlice)],
|
|
46
|
+
~outboundTranslationSlices=[module(SendOrderConfirmationSlice)],
|
|
47
|
+
~extensions=[module(Products_Extension)],
|
|
48
|
+
~extensionPoints=[module(Orders_ExtensionPointMapping)],
|
|
49
|
+
)
|
|
50
|
+
|
|
51
|
+
let make = () =>
|
|
52
|
+
Platform.Plugin.make(
|
|
53
|
+
~name="Ordering",
|
|
54
|
+
~heartbeatInterval=5,
|
|
55
|
+
~extensionPoints=[module(Orders_ExtensionPoint)],
|
|
56
|
+
~extensions=[module(Products_Extension)],
|
|
57
|
+
~aggregates=[module(CustomerAggregate)],
|
|
58
|
+
~readModels=[module(CustomersReadModel)],
|
|
59
|
+
~stateChangeSlices=[module(CancelOrderSlice), module(PlaceOrderSlice), module(RefundOrderSlice), module(ShipOrderSlice), module(SyncCatalogProductSlice)],
|
|
60
|
+
~stateViewSlices=[module(AvailableProductsStreamSlice), module(OrdersStreamSlice)],
|
|
61
|
+
~automationSlices=[module(AutoShipOrderSlice)],
|
|
62
|
+
~outboundTranslationSlices=[module(SendOrderConfirmationSlice)],
|
|
63
|
+
~pluginStructure=pluginStructure,
|
|
64
|
+
~uiFragments=?uiBundleUrl->Option.map(url =>
|
|
65
|
+
Platform.Plugin.makeAutoUIManifest(
|
|
66
|
+
~remoteEntryUrl=url,
|
|
67
|
+
~name="Ordering",
|
|
68
|
+
~pluginStructure,
|
|
69
|
+
~readModelPositions=["platform-summary"],
|
|
70
|
+
~aggregatePositions=["resource-detail"],
|
|
71
|
+
)
|
|
72
|
+
),
|
|
73
|
+
)
|
|
74
|
+
}
|
|
@@ -0,0 +1,304 @@
|
|
|
1
|
+
// Generated by ReScript, PLEASE EDIT WITH CARE
|
|
2
|
+
|
|
3
|
+
import * as Id$Reventless from "@reventlessdev/reventless-spec/src/types/Id.res.mjs";
|
|
4
|
+
import * as Stdlib_Option from "@rescript/runtime/lib/es6/Stdlib_Option.js";
|
|
5
|
+
import * as Orders$OrderingPlugin from "./Order/StateViewSliceStream/Orders.res.mjs";
|
|
6
|
+
import * as Customer$OrderingPlugin from "./Customer/Aggregate/Customer.res.mjs";
|
|
7
|
+
import * as Customers$OrderingPlugin from "./Customer/ReadModelStream/Customers.res.mjs";
|
|
8
|
+
import * as ShipOrder$OrderingPlugin from "./Order/StateChangeSlice/ShipOrder.res.mjs";
|
|
9
|
+
import * as PlaceOrder$OrderingPlugin from "./Order/StateChangeSlice/PlaceOrder.res.mjs";
|
|
10
|
+
import * as CancelOrder$OrderingPlugin from "./Order/StateChangeSlice/CancelOrder.res.mjs";
|
|
11
|
+
import * as RefundOrder$OrderingPlugin from "./Order/StateChangeSlice/RefundOrder.res.mjs";
|
|
12
|
+
import * as AutoShipOrder$OrderingPlugin from "./Order/AutomationSlice/AutoShipOrder.res.mjs";
|
|
13
|
+
import * as NoEventMappings$ReventlessInfra from "@reventlessdev/reventless-infra/src/types/NoEventMappings.res.mjs";
|
|
14
|
+
import * as AvailableProducts$OrderingPlugin from "./CatalogProduct/StateViewSliceStream/AvailableProducts.res.mjs";
|
|
15
|
+
import * as Customer_Behavior$OrderingPlugin from "./Customer/Aggregate/Customer_Behavior.res.mjs";
|
|
16
|
+
import * as Orders_Projection$OrderingPlugin from "./Order/StateViewSliceStream/Orders_Projection.res.mjs";
|
|
17
|
+
import * as Products_Extension$OrderingPlugin from "./Extension/Products_Extension.res.mjs";
|
|
18
|
+
import * as ShipOrder_Behavior$OrderingPlugin from "./Order/StateChangeSlice/ShipOrder_Behavior.res.mjs";
|
|
19
|
+
import * as SyncCatalogProduct$OrderingPlugin from "./CatalogProduct/StateChangeSlice/SyncCatalogProduct.res.mjs";
|
|
20
|
+
import * as Orders_ExtensionPoint$OrderingSpec from "@reventlessdev/online-shop-hybrid-ordering-spec/src/Orders_ExtensionPoint.res.mjs";
|
|
21
|
+
import * as PlaceOrder_Behavior$OrderingPlugin from "./Order/StateChangeSlice/PlaceOrder_Behavior.res.mjs";
|
|
22
|
+
import * as CancelOrder_Behavior$OrderingPlugin from "./Order/StateChangeSlice/CancelOrder_Behavior.res.mjs";
|
|
23
|
+
import * as Products_ExtensionPoint$CatalogSpec from "@reventlessdev/online-shop-hybrid-catalog-spec/src/Products_ExtensionPoint.res.mjs";
|
|
24
|
+
import * as RefundOrder_Behavior$OrderingPlugin from "./Order/StateChangeSlice/RefundOrder_Behavior.res.mjs";
|
|
25
|
+
import * as Customers_Projections$OrderingPlugin from "./Customer/ReadModelStream/Customers_Projections.res.mjs";
|
|
26
|
+
import * as SendOrderConfirmation$OrderingPlugin from "./Order/OutboundTranslationSlice/SendOrderConfirmation.res.mjs";
|
|
27
|
+
import * as AutoShipOrder_Automation$OrderingPlugin from "./Order/AutomationSlice/AutoShipOrder_Automation.res.mjs";
|
|
28
|
+
import * as SyncCatalogProduct_Behavior$OrderingPlugin from "./CatalogProduct/StateChangeSlice/SyncCatalogProduct_Behavior.res.mjs";
|
|
29
|
+
import * as AvailableProducts_Projection$OrderingPlugin from "./CatalogProduct/StateViewSliceStream/AvailableProducts_Projection.res.mjs";
|
|
30
|
+
import * as Orders_ExtensionPointMapping$OrderingPlugin from "./ExtensionPoint/Orders_ExtensionPointMapping.res.mjs";
|
|
31
|
+
import * as SendOrderConfirmation_Translation$OrderingPlugin from "./Order/OutboundTranslationSlice/SendOrderConfirmation_Translation.res.mjs";
|
|
32
|
+
|
|
33
|
+
function Make(Platform) {
|
|
34
|
+
let CancelOrderSlice = Platform.StateChangeSlice.Make({
|
|
35
|
+
name: CancelOrder$OrderingPlugin.name,
|
|
36
|
+
moduleUrl: CancelOrder$OrderingPlugin.moduleUrl,
|
|
37
|
+
Id: Id$Reventless.$$String,
|
|
38
|
+
consumedEventSchema: CancelOrder$OrderingPlugin.consumedEventSchema,
|
|
39
|
+
errorSchema: CancelOrder$OrderingPlugin.errorSchema,
|
|
40
|
+
eventSchema: CancelOrder$OrderingPlugin.eventSchema,
|
|
41
|
+
commandSchema: CancelOrder$OrderingPlugin.commandSchema,
|
|
42
|
+
commandAuthorization: CancelOrder$OrderingPlugin.commandAuthorization,
|
|
43
|
+
readConsistency: CancelOrder$OrderingPlugin.readConsistency
|
|
44
|
+
})({
|
|
45
|
+
initialState: CancelOrder_Behavior$OrderingPlugin.initialState,
|
|
46
|
+
evolve: CancelOrder_Behavior$OrderingPlugin.evolve,
|
|
47
|
+
decide: CancelOrder_Behavior$OrderingPlugin.decide,
|
|
48
|
+
moduleUrl: CancelOrder_Behavior$OrderingPlugin.moduleUrl
|
|
49
|
+
});
|
|
50
|
+
let PlaceOrderSlice = Platform.StateChangeSlice.Make({
|
|
51
|
+
name: PlaceOrder$OrderingPlugin.name,
|
|
52
|
+
moduleUrl: PlaceOrder$OrderingPlugin.moduleUrl,
|
|
53
|
+
Id: Id$Reventless.$$String,
|
|
54
|
+
consumedEventSchema: PlaceOrder$OrderingPlugin.consumedEventSchema,
|
|
55
|
+
errorSchema: PlaceOrder$OrderingPlugin.errorSchema,
|
|
56
|
+
eventSchema: PlaceOrder$OrderingPlugin.eventSchema,
|
|
57
|
+
commandSchema: PlaceOrder$OrderingPlugin.commandSchema,
|
|
58
|
+
commandAuthorization: PlaceOrder$OrderingPlugin.commandAuthorization,
|
|
59
|
+
readConsistency: PlaceOrder$OrderingPlugin.readConsistency
|
|
60
|
+
})({
|
|
61
|
+
initialState: PlaceOrder_Behavior$OrderingPlugin.initialState,
|
|
62
|
+
evolve: PlaceOrder_Behavior$OrderingPlugin.evolve,
|
|
63
|
+
decide: PlaceOrder_Behavior$OrderingPlugin.decide,
|
|
64
|
+
moduleUrl: PlaceOrder_Behavior$OrderingPlugin.moduleUrl
|
|
65
|
+
});
|
|
66
|
+
let RefundOrderSlice = Platform.StateChangeSlice.Make({
|
|
67
|
+
name: RefundOrder$OrderingPlugin.name,
|
|
68
|
+
moduleUrl: RefundOrder$OrderingPlugin.moduleUrl,
|
|
69
|
+
Id: Id$Reventless.$$String,
|
|
70
|
+
consumedEventSchema: RefundOrder$OrderingPlugin.consumedEventSchema,
|
|
71
|
+
errorSchema: RefundOrder$OrderingPlugin.errorSchema,
|
|
72
|
+
eventSchema: RefundOrder$OrderingPlugin.eventSchema,
|
|
73
|
+
commandSchema: RefundOrder$OrderingPlugin.commandSchema,
|
|
74
|
+
commandAuthorization: RefundOrder$OrderingPlugin.commandAuthorization,
|
|
75
|
+
readConsistency: RefundOrder$OrderingPlugin.readConsistency
|
|
76
|
+
})({
|
|
77
|
+
initialState: RefundOrder_Behavior$OrderingPlugin.initialState,
|
|
78
|
+
evolve: RefundOrder_Behavior$OrderingPlugin.evolve,
|
|
79
|
+
decide: RefundOrder_Behavior$OrderingPlugin.decide,
|
|
80
|
+
moduleUrl: RefundOrder_Behavior$OrderingPlugin.moduleUrl
|
|
81
|
+
});
|
|
82
|
+
let ShipOrderSlice = Platform.StateChangeSlice.Make({
|
|
83
|
+
name: ShipOrder$OrderingPlugin.name,
|
|
84
|
+
moduleUrl: ShipOrder$OrderingPlugin.moduleUrl,
|
|
85
|
+
Id: Id$Reventless.$$String,
|
|
86
|
+
consumedEventSchema: ShipOrder$OrderingPlugin.consumedEventSchema,
|
|
87
|
+
errorSchema: ShipOrder$OrderingPlugin.errorSchema,
|
|
88
|
+
eventSchema: ShipOrder$OrderingPlugin.eventSchema,
|
|
89
|
+
commandSchema: ShipOrder$OrderingPlugin.commandSchema,
|
|
90
|
+
commandAuthorization: ShipOrder$OrderingPlugin.commandAuthorization,
|
|
91
|
+
readConsistency: ShipOrder$OrderingPlugin.readConsistency
|
|
92
|
+
})({
|
|
93
|
+
initialState: ShipOrder_Behavior$OrderingPlugin.initialState,
|
|
94
|
+
evolve: ShipOrder_Behavior$OrderingPlugin.evolve,
|
|
95
|
+
decide: ShipOrder_Behavior$OrderingPlugin.decide,
|
|
96
|
+
moduleUrl: ShipOrder_Behavior$OrderingPlugin.moduleUrl
|
|
97
|
+
});
|
|
98
|
+
let SyncCatalogProductSlice = Platform.StateChangeSlice.Make({
|
|
99
|
+
name: SyncCatalogProduct$OrderingPlugin.name,
|
|
100
|
+
moduleUrl: SyncCatalogProduct$OrderingPlugin.moduleUrl,
|
|
101
|
+
Id: Id$Reventless.$$String,
|
|
102
|
+
consumedEventSchema: SyncCatalogProduct$OrderingPlugin.consumedEventSchema,
|
|
103
|
+
errorSchema: SyncCatalogProduct$OrderingPlugin.errorSchema,
|
|
104
|
+
eventSchema: SyncCatalogProduct$OrderingPlugin.eventSchema,
|
|
105
|
+
commandSchema: SyncCatalogProduct$OrderingPlugin.commandSchema,
|
|
106
|
+
commandAuthorization: SyncCatalogProduct$OrderingPlugin.commandAuthorization,
|
|
107
|
+
readConsistency: SyncCatalogProduct$OrderingPlugin.readConsistency
|
|
108
|
+
})({
|
|
109
|
+
initialState: SyncCatalogProduct_Behavior$OrderingPlugin.initialState,
|
|
110
|
+
evolve: SyncCatalogProduct_Behavior$OrderingPlugin.evolve,
|
|
111
|
+
decide: SyncCatalogProduct_Behavior$OrderingPlugin.decide,
|
|
112
|
+
moduleUrl: SyncCatalogProduct_Behavior$OrderingPlugin.moduleUrl
|
|
113
|
+
});
|
|
114
|
+
let AvailableProductsStreamSlice = Platform.StateViewSliceStream.Make({
|
|
115
|
+
name: AvailableProducts$OrderingPlugin.name,
|
|
116
|
+
moduleUrl: AvailableProducts$OrderingPlugin.moduleUrl,
|
|
117
|
+
stateSchema: AvailableProducts$OrderingPlugin.stateSchema,
|
|
118
|
+
consumedEventSchema: AvailableProducts$OrderingPlugin.consumedEventSchema,
|
|
119
|
+
config: AvailableProducts$OrderingPlugin.config,
|
|
120
|
+
subIdConfig: undefined,
|
|
121
|
+
authorization: AvailableProducts$OrderingPlugin.authorization,
|
|
122
|
+
visibility: AvailableProducts$OrderingPlugin.visibility
|
|
123
|
+
})({
|
|
124
|
+
project: AvailableProducts_Projection$OrderingPlugin.project,
|
|
125
|
+
moduleUrl: AvailableProducts_Projection$OrderingPlugin.moduleUrl
|
|
126
|
+
});
|
|
127
|
+
let OrdersStreamSlice = Platform.StateViewSliceStream.Make({
|
|
128
|
+
name: Orders$OrderingPlugin.name,
|
|
129
|
+
moduleUrl: Orders$OrderingPlugin.moduleUrl,
|
|
130
|
+
stateSchema: Orders$OrderingPlugin.stateSchema,
|
|
131
|
+
consumedEventSchema: Orders$OrderingPlugin.consumedEventSchema,
|
|
132
|
+
config: Orders$OrderingPlugin.config,
|
|
133
|
+
subIdConfig: undefined,
|
|
134
|
+
authorization: Orders$OrderingPlugin.authorization,
|
|
135
|
+
visibility: Orders$OrderingPlugin.visibility
|
|
136
|
+
})({
|
|
137
|
+
project: Orders_Projection$OrderingPlugin.project,
|
|
138
|
+
moduleUrl: Orders_Projection$OrderingPlugin.moduleUrl
|
|
139
|
+
});
|
|
140
|
+
let AutoShipOrderSlice = Platform.AutomationSlice.Make({
|
|
141
|
+
name: AutoShipOrder$OrderingPlugin.name,
|
|
142
|
+
moduleUrl: AutoShipOrder$OrderingPlugin.moduleUrl,
|
|
143
|
+
todoItemSchema: AutoShipOrder$OrderingPlugin.todoItemSchema,
|
|
144
|
+
commandSchema: AutoShipOrder$OrderingPlugin.commandSchema,
|
|
145
|
+
maxRetries: AutoShipOrder$OrderingPlugin.maxRetries,
|
|
146
|
+
heartbeatInterval: AutoShipOrder$OrderingPlugin.heartbeatInterval,
|
|
147
|
+
targetName: AutoShipOrder$OrderingPlugin.targetName
|
|
148
|
+
})({
|
|
149
|
+
process: AutoShipOrder_Automation$OrderingPlugin.process,
|
|
150
|
+
moduleUrl: AutoShipOrder_Automation$OrderingPlugin.moduleUrl,
|
|
151
|
+
mappings: AutoShipOrder_Automation$OrderingPlugin.mappings
|
|
152
|
+
});
|
|
153
|
+
let SendOrderConfirmationSlice = Platform.OutboundTranslationSlice.Make({
|
|
154
|
+
name: SendOrderConfirmation$OrderingPlugin.name,
|
|
155
|
+
moduleUrl: SendOrderConfirmation$OrderingPlugin.moduleUrl,
|
|
156
|
+
consumedEventSchema: SendOrderConfirmation$OrderingPlugin.consumedEventSchema,
|
|
157
|
+
outboundItemSchema: SendOrderConfirmation$OrderingPlugin.outboundItemSchema,
|
|
158
|
+
inboundCommandSchema: SendOrderConfirmation$OrderingPlugin.inboundCommandSchema,
|
|
159
|
+
maxRetries: SendOrderConfirmation$OrderingPlugin.maxRetries,
|
|
160
|
+
heartbeatInterval: SendOrderConfirmation$OrderingPlugin.heartbeatInterval,
|
|
161
|
+
targetName: undefined,
|
|
162
|
+
externalSystem: SendOrderConfirmation$OrderingPlugin.externalSystem
|
|
163
|
+
})({
|
|
164
|
+
collect: SendOrderConfirmation_Translation$OrderingPlugin.collect,
|
|
165
|
+
translate: SendOrderConfirmation_Translation$OrderingPlugin.translate,
|
|
166
|
+
moduleUrl: SendOrderConfirmation_Translation$OrderingPlugin.moduleUrl
|
|
167
|
+
});
|
|
168
|
+
let CustomerAggregate = Platform.Aggregate.Make({
|
|
169
|
+
Id: Id$Reventless.$$String,
|
|
170
|
+
name: Customer$OrderingPlugin.name,
|
|
171
|
+
eventSchema: Customer$OrderingPlugin.eventSchema,
|
|
172
|
+
errorSchema: Customer$OrderingPlugin.errorSchema,
|
|
173
|
+
commandSchema: Customer$OrderingPlugin.commandSchema,
|
|
174
|
+
moduleUrl: Customer$OrderingPlugin.moduleUrl,
|
|
175
|
+
commandAuthorization: Customer$OrderingPlugin.commandAuthorization
|
|
176
|
+
})({
|
|
177
|
+
initialState: Customer_Behavior$OrderingPlugin.initialState,
|
|
178
|
+
evolve: Customer_Behavior$OrderingPlugin.evolve,
|
|
179
|
+
decide: Customer_Behavior$OrderingPlugin.decide,
|
|
180
|
+
moduleUrl: Customer_Behavior$OrderingPlugin.moduleUrl
|
|
181
|
+
})(NoEventMappings$ReventlessInfra.Make({
|
|
182
|
+
name: Customer$OrderingPlugin.name,
|
|
183
|
+
Id: Id$Reventless.$$String,
|
|
184
|
+
commandSchema: Customer$OrderingPlugin.commandSchema
|
|
185
|
+
}));
|
|
186
|
+
let CustomersReadModel = Platform.ReadModelStream.Make({
|
|
187
|
+
Id: Id$Reventless.$$String,
|
|
188
|
+
name: Customers$OrderingPlugin.name,
|
|
189
|
+
moduleUrl: Customers$OrderingPlugin.moduleUrl,
|
|
190
|
+
stateSchema: Customers$OrderingPlugin.stateSchema,
|
|
191
|
+
config: Customers$OrderingPlugin.config,
|
|
192
|
+
subIdConfig: undefined,
|
|
193
|
+
authorization: Customers$OrderingPlugin.authorization,
|
|
194
|
+
visibility: Customers$OrderingPlugin.visibility
|
|
195
|
+
})({
|
|
196
|
+
moduleUrl: Customers_Projections$OrderingPlugin.moduleUrl,
|
|
197
|
+
mappings: Customers_Projections$OrderingPlugin.mappings
|
|
198
|
+
});
|
|
199
|
+
let Orders_ExtensionPoint = Platform.ExtensionPoint.Make({
|
|
200
|
+
ExtensionPoint: {
|
|
201
|
+
name: Orders_ExtensionPoint$OrderingSpec.name,
|
|
202
|
+
moduleUrl: Orders_ExtensionPoint$OrderingSpec.moduleUrl,
|
|
203
|
+
commandSchema: Orders_ExtensionPoint$OrderingSpec.commandSchema,
|
|
204
|
+
eventSchema: Orders_ExtensionPoint$OrderingSpec.eventSchema,
|
|
205
|
+
directiveSchema: Orders_ExtensionPoint$OrderingSpec.directiveSchema
|
|
206
|
+
},
|
|
207
|
+
Delegate: {
|
|
208
|
+
Id: Id$Reventless.$$String,
|
|
209
|
+
name: Orders_ExtensionPointMapping$OrderingPlugin.Delegate.name,
|
|
210
|
+
eventSchema: Orders_ExtensionPointMapping$OrderingPlugin.Delegate.eventSchema,
|
|
211
|
+
errorSchema: Orders_ExtensionPointMapping$OrderingPlugin.Delegate.errorSchema,
|
|
212
|
+
commandSchema: Orders_ExtensionPointMapping$OrderingPlugin.Delegate.commandSchema,
|
|
213
|
+
moduleUrl: Orders_ExtensionPointMapping$OrderingPlugin.Delegate.moduleUrl,
|
|
214
|
+
commandAuthorization: Orders_ExtensionPointMapping$OrderingPlugin.Delegate.commandAuthorization
|
|
215
|
+
},
|
|
216
|
+
moduleUrl: Orders_ExtensionPointMapping$OrderingPlugin.moduleUrl,
|
|
217
|
+
mapIncomingCommand: Orders_ExtensionPointMapping$OrderingPlugin.mapIncomingCommand,
|
|
218
|
+
mapOutgoingEvent: Orders_ExtensionPointMapping$OrderingPlugin.mapOutgoingEvent
|
|
219
|
+
});
|
|
220
|
+
let Products_Extension = Platform.Extension.Make({
|
|
221
|
+
ExtensionPoint: {
|
|
222
|
+
name: Products_ExtensionPoint$CatalogSpec.name,
|
|
223
|
+
moduleUrl: Products_ExtensionPoint$CatalogSpec.moduleUrl,
|
|
224
|
+
commandSchema: Products_ExtensionPoint$CatalogSpec.commandSchema,
|
|
225
|
+
eventSchema: Products_ExtensionPoint$CatalogSpec.eventSchema,
|
|
226
|
+
directiveSchema: Products_ExtensionPoint$CatalogSpec.directiveSchema
|
|
227
|
+
},
|
|
228
|
+
Delegate: {
|
|
229
|
+
Id: Id$Reventless.$$String,
|
|
230
|
+
name: SyncCatalogProduct$OrderingPlugin.name,
|
|
231
|
+
eventSchema: SyncCatalogProduct$OrderingPlugin.eventSchema,
|
|
232
|
+
errorSchema: SyncCatalogProduct$OrderingPlugin.errorSchema,
|
|
233
|
+
commandSchema: SyncCatalogProduct$OrderingPlugin.commandSchema,
|
|
234
|
+
moduleUrl: SyncCatalogProduct$OrderingPlugin.moduleUrl,
|
|
235
|
+
commandAuthorization: SyncCatalogProduct$OrderingPlugin.commandAuthorization
|
|
236
|
+
},
|
|
237
|
+
moduleUrl: Products_Extension$OrderingPlugin.Mapping.moduleUrl,
|
|
238
|
+
delegateModuleUrl: Products_Extension$OrderingPlugin.Mapping.delegateModuleUrl,
|
|
239
|
+
mapIncomingEvent: Products_Extension$OrderingPlugin.Mapping.mapIncomingEvent,
|
|
240
|
+
mapOutgoingEvent: Products_Extension$OrderingPlugin.Mapping.mapOutgoingEvent
|
|
241
|
+
});
|
|
242
|
+
let pluginStructure = Platform.Plugin.makePluginDefinition("Ordering", [CustomerAggregate], [CustomersReadModel], [
|
|
243
|
+
AvailableProductsStreamSlice,
|
|
244
|
+
OrdersStreamSlice
|
|
245
|
+
], [
|
|
246
|
+
CancelOrderSlice,
|
|
247
|
+
PlaceOrderSlice,
|
|
248
|
+
RefundOrderSlice,
|
|
249
|
+
ShipOrderSlice,
|
|
250
|
+
SyncCatalogProductSlice
|
|
251
|
+
], [AutoShipOrderSlice], [SendOrderConfirmationSlice], undefined, [Products_Extension], [{
|
|
252
|
+
ExtensionPoint: {
|
|
253
|
+
name: Orders_ExtensionPoint$OrderingSpec.name,
|
|
254
|
+
moduleUrl: Orders_ExtensionPoint$OrderingSpec.moduleUrl,
|
|
255
|
+
commandSchema: Orders_ExtensionPoint$OrderingSpec.commandSchema,
|
|
256
|
+
eventSchema: Orders_ExtensionPoint$OrderingSpec.eventSchema,
|
|
257
|
+
directiveSchema: Orders_ExtensionPoint$OrderingSpec.directiveSchema
|
|
258
|
+
},
|
|
259
|
+
Delegate: {
|
|
260
|
+
Id: Id$Reventless.$$String,
|
|
261
|
+
name: Orders_ExtensionPointMapping$OrderingPlugin.Delegate.name,
|
|
262
|
+
eventSchema: Orders_ExtensionPointMapping$OrderingPlugin.Delegate.eventSchema,
|
|
263
|
+
errorSchema: Orders_ExtensionPointMapping$OrderingPlugin.Delegate.errorSchema,
|
|
264
|
+
commandSchema: Orders_ExtensionPointMapping$OrderingPlugin.Delegate.commandSchema,
|
|
265
|
+
moduleUrl: Orders_ExtensionPointMapping$OrderingPlugin.Delegate.moduleUrl,
|
|
266
|
+
commandAuthorization: Orders_ExtensionPointMapping$OrderingPlugin.Delegate.commandAuthorization
|
|
267
|
+
},
|
|
268
|
+
moduleUrl: Orders_ExtensionPointMapping$OrderingPlugin.moduleUrl,
|
|
269
|
+
mapIncomingCommand: Orders_ExtensionPointMapping$OrderingPlugin.mapIncomingCommand,
|
|
270
|
+
mapOutgoingEvent: Orders_ExtensionPointMapping$OrderingPlugin.mapOutgoingEvent
|
|
271
|
+
}]);
|
|
272
|
+
let make = () => Platform.Plugin.make("Ordering", 5, [Orders_ExtensionPoint], [Products_Extension], [CustomerAggregate], [CustomersReadModel], undefined, [
|
|
273
|
+
CancelOrderSlice,
|
|
274
|
+
PlaceOrderSlice,
|
|
275
|
+
RefundOrderSlice,
|
|
276
|
+
ShipOrderSlice,
|
|
277
|
+
SyncCatalogProductSlice
|
|
278
|
+
], [
|
|
279
|
+
AvailableProductsStreamSlice,
|
|
280
|
+
OrdersStreamSlice
|
|
281
|
+
], [AutoShipOrderSlice], [SendOrderConfirmationSlice], undefined, Stdlib_Option.map(process.env.ORDERING_UI_BUNDLE_URL, url => Platform.Plugin.makeAutoUIManifest(url, "Ordering", pluginStructure, ["platform-summary"], ["resource-detail"])), pluginStructure, undefined);
|
|
282
|
+
return {
|
|
283
|
+
CancelOrderSlice: CancelOrderSlice,
|
|
284
|
+
PlaceOrderSlice: PlaceOrderSlice,
|
|
285
|
+
RefundOrderSlice: RefundOrderSlice,
|
|
286
|
+
ShipOrderSlice: ShipOrderSlice,
|
|
287
|
+
SyncCatalogProductSlice: SyncCatalogProductSlice,
|
|
288
|
+
AvailableProductsStreamSlice: AvailableProductsStreamSlice,
|
|
289
|
+
OrdersStreamSlice: OrdersStreamSlice,
|
|
290
|
+
AutoShipOrderSlice: AutoShipOrderSlice,
|
|
291
|
+
SendOrderConfirmationSlice: SendOrderConfirmationSlice,
|
|
292
|
+
CustomerAggregate: CustomerAggregate,
|
|
293
|
+
CustomersReadModel: CustomersReadModel,
|
|
294
|
+
Orders_ExtensionPoint: Orders_ExtensionPoint,
|
|
295
|
+
Products_Extension: Products_Extension,
|
|
296
|
+
pluginStructure: pluginStructure,
|
|
297
|
+
make: make
|
|
298
|
+
};
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
export {
|
|
302
|
+
Make,
|
|
303
|
+
}
|
|
304
|
+
/* Id-Reventless Not a pure module */
|
package/src/plugin.json
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"name": "Ordering"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
@@reventless.gwt
|
|
2
|
+
|
|
3
|
+
describe("SyncCatalogProduct StateChangeSlice", () => {
|
|
4
|
+
test("SyncNewProduct produces CatalogProductSynced", () =>
|
|
5
|
+
givenEvents([])
|
|
6
|
+
->whenCmd(SyncNewProduct({productId: "p1", name: "Laptop", price: 999.99}))
|
|
7
|
+
->thenEvent(CatalogProductSynced({productId: "p1", name: "Laptop", price: 999.99}))
|
|
8
|
+
)
|
|
9
|
+
|
|
10
|
+
test("ChangeSyncedPrice produces CatalogProductPriceChanged", () =>
|
|
11
|
+
givenEvents([CatalogProductSynced({name: "Laptop", price: 999.99})])
|
|
12
|
+
->whenCmd(ChangeSyncedPrice({productId: "p1", price: 899.99}))
|
|
13
|
+
->thenEvent(CatalogProductPriceChanged({productId: "p1", price: 899.99}))
|
|
14
|
+
)
|
|
15
|
+
|
|
16
|
+
test("re-syncing identical product data produces no events (idempotent)", () =>
|
|
17
|
+
givenEvents([CatalogProductSynced({name: "Laptop", price: 999.99})])
|
|
18
|
+
->whenCmd(SyncNewProduct({productId: "p1", name: "Laptop", price: 999.99}))
|
|
19
|
+
->thenNoEvent
|
|
20
|
+
)
|
|
21
|
+
|
|
22
|
+
test("re-applying the current price produces no events (idempotent)", () =>
|
|
23
|
+
givenEvents([CatalogProductSynced({name: "Laptop", price: 999.99})])
|
|
24
|
+
->whenCmd(ChangeSyncedPrice({productId: "p1", price: 999.99}))
|
|
25
|
+
->thenNoEvent
|
|
26
|
+
)
|
|
27
|
+
})
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
// Generated by ReScript, PLEASE EDIT WITH CARE
|
|
2
|
+
|
|
3
|
+
import * as Behavior_GWT$ReventlessGwt from "@reventlessdev/reventless-gwt/src/Behavior_GWT.res.mjs";
|
|
4
|
+
import * as SyncCatalogProduct$OrderingPlugin from "../../../src/CatalogProduct/StateChangeSlice/SyncCatalogProduct.res.mjs";
|
|
5
|
+
import * as SyncCatalogProduct_Behavior$OrderingPlugin from "../../../src/CatalogProduct/StateChangeSlice/SyncCatalogProduct_Behavior.res.mjs";
|
|
6
|
+
|
|
7
|
+
let include = Behavior_GWT$ReventlessGwt.Make({
|
|
8
|
+
name: SyncCatalogProduct$OrderingPlugin.name,
|
|
9
|
+
consumedEventSchema: SyncCatalogProduct$OrderingPlugin.consumedEventSchema,
|
|
10
|
+
commandSchema: SyncCatalogProduct$OrderingPlugin.commandSchema,
|
|
11
|
+
errorSchema: SyncCatalogProduct$OrderingPlugin.errorSchema,
|
|
12
|
+
eventSchema: SyncCatalogProduct$OrderingPlugin.eventSchema
|
|
13
|
+
})({
|
|
14
|
+
initialState: SyncCatalogProduct_Behavior$OrderingPlugin.initialState,
|
|
15
|
+
evolve: SyncCatalogProduct_Behavior$OrderingPlugin.evolve,
|
|
16
|
+
decide: SyncCatalogProduct_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
|
+
describe("SyncCatalogProduct StateChangeSlice", () => {
|
|
32
|
+
test("SyncNewProduct produces CatalogProductSynced", () => thenEvent(whenCmd(givenEvents([]), {
|
|
33
|
+
TAG: "SyncNewProduct",
|
|
34
|
+
productId: "p1",
|
|
35
|
+
name: "Laptop",
|
|
36
|
+
price: 999.99
|
|
37
|
+
}), {
|
|
38
|
+
TAG: "CatalogProductSynced",
|
|
39
|
+
productId: "p1",
|
|
40
|
+
name: "Laptop",
|
|
41
|
+
price: 999.99
|
|
42
|
+
}));
|
|
43
|
+
test("ChangeSyncedPrice produces CatalogProductPriceChanged", () => thenEvent(whenCmd(givenEvents([{
|
|
44
|
+
TAG: "CatalogProductSynced",
|
|
45
|
+
name: "Laptop",
|
|
46
|
+
price: 999.99
|
|
47
|
+
}]), {
|
|
48
|
+
TAG: "ChangeSyncedPrice",
|
|
49
|
+
productId: "p1",
|
|
50
|
+
price: 899.99
|
|
51
|
+
}), {
|
|
52
|
+
TAG: "CatalogProductPriceChanged",
|
|
53
|
+
productId: "p1",
|
|
54
|
+
price: 899.99
|
|
55
|
+
}));
|
|
56
|
+
test("re-syncing identical product data produces no events (idempotent)", () => thenNoEvent(whenCmd(givenEvents([{
|
|
57
|
+
TAG: "CatalogProductSynced",
|
|
58
|
+
name: "Laptop",
|
|
59
|
+
price: 999.99
|
|
60
|
+
}]), {
|
|
61
|
+
TAG: "SyncNewProduct",
|
|
62
|
+
productId: "p1",
|
|
63
|
+
name: "Laptop",
|
|
64
|
+
price: 999.99
|
|
65
|
+
})));
|
|
66
|
+
test("re-applying the current price produces no events (idempotent)", () => thenNoEvent(whenCmd(givenEvents([{
|
|
67
|
+
TAG: "CatalogProductSynced",
|
|
68
|
+
name: "Laptop",
|
|
69
|
+
price: 999.99
|
|
70
|
+
}]), {
|
|
71
|
+
TAG: "ChangeSyncedPrice",
|
|
72
|
+
productId: "p1",
|
|
73
|
+
price: 999.99
|
|
74
|
+
})));
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
let Spec = include.Spec;
|
|
78
|
+
|
|
79
|
+
let todo = include.todo;
|
|
80
|
+
|
|
81
|
+
let thenEvents = include.thenEvents;
|
|
82
|
+
|
|
83
|
+
let thenEventWithError = include.thenEventWithError;
|
|
84
|
+
|
|
85
|
+
let thenEventsWithError = include.thenEventsWithError;
|
|
86
|
+
|
|
87
|
+
let thenError = include.thenError;
|
|
88
|
+
|
|
89
|
+
let thenAppendsConditionedOn = include.thenAppendsConditionedOn;
|
|
90
|
+
|
|
91
|
+
let thenAppendsConditionedOnExactly = include.thenAppendsConditionedOnExactly;
|
|
92
|
+
|
|
93
|
+
export {
|
|
94
|
+
Spec,
|
|
95
|
+
describe,
|
|
96
|
+
todo,
|
|
97
|
+
test,
|
|
98
|
+
givenEvents,
|
|
99
|
+
whenCmd,
|
|
100
|
+
thenEvent,
|
|
101
|
+
thenEvents,
|
|
102
|
+
thenNoEvent,
|
|
103
|
+
thenEventWithError,
|
|
104
|
+
thenEventsWithError,
|
|
105
|
+
thenError,
|
|
106
|
+
thenAppendsConditionedOn,
|
|
107
|
+
thenAppendsConditionedOnExactly,
|
|
108
|
+
}
|
|
109
|
+
/* include Not a pure module */
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
@@reventless.gwt
|
|
2
|
+
|
|
3
|
+
describe("AvailableProducts StateViewSliceStream", () => {
|
|
4
|
+
test("CatalogProductSynced creates a row", () =>
|
|
5
|
+
givenEvents([])
|
|
6
|
+
->whenEvent(CatalogProductSynced({productId: "p1", name: "Laptop", price: 999.99}))
|
|
7
|
+
->thenStateWithId("p1", {productId: "p1", name: "Laptop", price: 999.99})
|
|
8
|
+
)
|
|
9
|
+
|
|
10
|
+
test("CatalogProductPriceChanged updates the price", () =>
|
|
11
|
+
givenEvents([CatalogProductSynced({productId: "p1", name: "Laptop", price: 999.99})])
|
|
12
|
+
->whenEvent(CatalogProductPriceChanged({productId: "p1", price: 899.99}))
|
|
13
|
+
->thenStateWithId("p1", {productId: "p1", name: "Laptop", price: 899.99})
|
|
14
|
+
)
|
|
15
|
+
})
|