@reventlessdev/online-shop-aggregates-catalog 3.0.0-alpha.264 → 3.0.0-alpha.265
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/lib/bs/.compiler.log +2 -2
- package/lib/bs/CatalogPlugin.cmi +0 -0
- package/lib/bs/CatalogPlugin.cmt +0 -0
- package/lib/bs/CatalogPlugin.mlmap +1 -0
- package/lib/bs/compiler-info.json +1 -1
- package/lib/bs/src/Category/Aggregate/Category-CatalogPlugin.cmi +0 -0
- package/lib/bs/src/Category/Aggregate/Category-CatalogPlugin.cmt +0 -0
- package/lib/bs/src/Category/Aggregate/Category.ast +0 -0
- package/lib/bs/src/Category/Aggregate/Category.res +1 -1
- package/lib/bs/src/Category/Aggregate/Category.res.mjs +1 -1
- package/lib/bs/src/Category/Aggregate/Category_Behavior-CatalogPlugin.cmi +0 -0
- package/lib/bs/src/Category/Aggregate/Category_Behavior-CatalogPlugin.cmt +0 -0
- package/lib/bs/src/Category/CategoryId-CatalogPlugin.cmi +0 -0
- package/lib/bs/src/Category/CategoryId-CatalogPlugin.cmt +0 -0
- package/lib/bs/src/Category/ReadModel/Categories-CatalogPlugin.cmi +0 -0
- package/lib/bs/src/Category/ReadModel/Categories-CatalogPlugin.cmt +0 -0
- package/lib/bs/src/Category/ReadModel/Categories.ast +0 -0
- package/lib/bs/src/Category/ReadModel/Categories_Projections-CatalogPlugin.cmi +0 -0
- package/lib/bs/src/Category/ReadModel/Categories_Projections-CatalogPlugin.cmt +0 -0
- package/lib/bs/src/Extension/Orders_Extension-CatalogPlugin.cmi +0 -0
- package/lib/bs/src/Extension/Orders_Extension-CatalogPlugin.cmt +0 -0
- package/lib/bs/src/ExtensionPoint/Products_ExtensionPointMapping-CatalogPlugin.cmi +0 -0
- package/lib/bs/src/ExtensionPoint/Products_ExtensionPointMapping-CatalogPlugin.cmt +0 -0
- package/lib/bs/src/LifecycleModel-CatalogPlugin.cmi +0 -0
- package/lib/bs/src/LifecycleModel-CatalogPlugin.cmt +0 -0
- package/lib/bs/src/Plugin-CatalogPlugin.cmi +0 -0
- package/lib/bs/src/Plugin-CatalogPlugin.cmt +0 -0
- package/lib/bs/src/Product/Aggregate/Product-CatalogPlugin.cmi +0 -0
- package/lib/bs/src/Product/Aggregate/Product-CatalogPlugin.cmt +0 -0
- package/lib/bs/src/Product/Aggregate/Product.ast +0 -0
- package/lib/bs/src/Product/Aggregate/Product_Behavior-CatalogPlugin.cmi +0 -0
- package/lib/bs/src/Product/Aggregate/Product_Behavior-CatalogPlugin.cmt +0 -0
- package/lib/bs/src/Product/ReadModel/Products-CatalogPlugin.cmi +0 -0
- package/lib/bs/src/Product/ReadModel/Products-CatalogPlugin.cmt +0 -0
- package/lib/bs/src/Product/ReadModel/Products.ast +0 -0
- package/lib/bs/src/Product/ReadModel/Products_Projections-CatalogPlugin.cmi +0 -0
- package/lib/bs/src/Product/ReadModel/Products_Projections-CatalogPlugin.cmt +0 -0
- package/lib/bs/src/ProductDemand/Aggregate/ProductDemand-CatalogPlugin.cmi +0 -0
- package/lib/bs/src/ProductDemand/Aggregate/ProductDemand-CatalogPlugin.cmt +0 -0
- package/lib/bs/src/ProductDemand/Aggregate/ProductDemand.ast +0 -0
- package/lib/bs/src/ProductDemand/Aggregate/ProductDemand_Behavior-CatalogPlugin.cmi +0 -0
- package/lib/bs/src/ProductDemand/Aggregate/ProductDemand_Behavior-CatalogPlugin.cmt +0 -0
- package/lib/bs/src/ProductDemand/ReadModel/ProductDemands-CatalogPlugin.cmi +0 -0
- package/lib/bs/src/ProductDemand/ReadModel/ProductDemands-CatalogPlugin.cmt +0 -0
- package/lib/bs/src/ProductDemand/ReadModel/ProductDemands.ast +0 -0
- package/lib/bs/src/ProductDemand/ReadModel/ProductDemands_Projections-CatalogPlugin.cmi +0 -0
- package/lib/bs/src/ProductDemand/ReadModel/ProductDemands_Projections-CatalogPlugin.cmt +0 -0
- package/lib/bs/src/Roles-CatalogPlugin.cmi +0 -0
- package/lib/bs/src/Roles-CatalogPlugin.cmj +0 -0
- package/lib/bs/src/Roles-CatalogPlugin.cmt +0 -0
- package/lib/bs/src/Roles.ast +0 -0
- package/lib/bs/src/Roles.res +2 -0
- package/lib/bs/src/Roles.res.mjs +2 -0
- package/lib/bs/src/Task/ImportProducts-CatalogPlugin.cmi +0 -0
- package/lib/bs/src/Task/ImportProducts-CatalogPlugin.cmt +0 -0
- package/lib/bs/tests/Catalog_Examples-CatalogPlugin.cmi +0 -0
- package/lib/bs/tests/Catalog_Examples-CatalogPlugin.cmt +0 -0
- package/lib/bs/tests/Catalog_Examples.ast +0 -0
- package/lib/bs/tests/Catalog_Examples.res +1 -0
- package/lib/bs/tests/Catalog_Examples.res.mjs +3 -0
- package/lib/bs/tests/Category/Aggregate/Category_GWT-CatalogPlugin.cmi +0 -0
- package/lib/bs/tests/Category/Aggregate/Category_GWT-CatalogPlugin.cmt +0 -0
- package/lib/bs/tests/Category/Aggregate/Category_GWT.ast +0 -0
- package/lib/bs/tests/Category/Aggregate/Category_GWT.res +26 -0
- package/lib/bs/tests/Category/Aggregate/Category_GWT.res.mjs +25 -8
- package/lib/bs/tests/Category/ReadModel/Categories_GWT-CatalogPlugin.cmi +0 -0
- package/lib/bs/tests/Category/ReadModel/Categories_GWT-CatalogPlugin.cmt +0 -0
- package/lib/bs/tests/Extension/Orders_Extension_GWT-CatalogPlugin.cmi +0 -0
- package/lib/bs/tests/Extension/Orders_Extension_GWT-CatalogPlugin.cmt +0 -0
- package/lib/bs/tests/ExtensionPoint/Products_ExtensionPointMapping_GWT-CatalogPlugin.cmi +0 -0
- package/lib/bs/tests/ExtensionPoint/Products_ExtensionPointMapping_GWT-CatalogPlugin.cmt +0 -0
- package/lib/bs/tests/Product/Aggregate/Product_GWT-CatalogPlugin.cmi +0 -0
- package/lib/bs/tests/Product/Aggregate/Product_GWT-CatalogPlugin.cmt +0 -0
- package/lib/bs/tests/Product/Aggregate/Product_GWT.res.mjs +4 -2
- package/lib/bs/tests/Product/ReadModel/Products_GWT-CatalogPlugin.cmi +0 -0
- package/lib/bs/tests/Product/ReadModel/Products_GWT-CatalogPlugin.cmt +0 -0
- package/lib/bs/tests/ProductDemand/Aggregate/ProductDemand_GWT-CatalogPlugin.cmi +0 -0
- package/lib/bs/tests/ProductDemand/Aggregate/ProductDemand_GWT-CatalogPlugin.cmt +0 -0
- package/lib/bs/tests/ProductDemand/Aggregate/ProductDemand_GWT.res.mjs +4 -2
- package/lib/bs/tests/ProductDemand/ReadModel/ProductDemands_GWT-CatalogPlugin.cmi +0 -0
- package/lib/bs/tests/ProductDemand/ReadModel/ProductDemands_GWT-CatalogPlugin.cmt +0 -0
- package/lib/ocaml/.compiler.log +2 -2
- package/lib/ocaml/CatalogPlugin.cmi +0 -0
- package/lib/ocaml/CatalogPlugin.cmt +0 -0
- package/lib/ocaml/CatalogPlugin.mlmap +1 -0
- package/lib/ocaml/Catalog_Examples-CatalogPlugin.cmi +0 -0
- package/lib/ocaml/Catalog_Examples-CatalogPlugin.cmt +0 -0
- package/lib/ocaml/Catalog_Examples.ast +0 -0
- package/lib/ocaml/Catalog_Examples.res +1 -0
- package/lib/ocaml/Categories-CatalogPlugin.cmi +0 -0
- package/lib/ocaml/Categories-CatalogPlugin.cmt +0 -0
- package/lib/ocaml/Categories.ast +0 -0
- package/lib/ocaml/Categories_GWT-CatalogPlugin.cmi +0 -0
- package/lib/ocaml/Categories_GWT-CatalogPlugin.cmt +0 -0
- package/lib/ocaml/Categories_Projections-CatalogPlugin.cmi +0 -0
- package/lib/ocaml/Categories_Projections-CatalogPlugin.cmt +0 -0
- package/lib/ocaml/Category-CatalogPlugin.cmi +0 -0
- package/lib/ocaml/Category-CatalogPlugin.cmt +0 -0
- package/lib/ocaml/Category.ast +0 -0
- package/lib/ocaml/Category.res +1 -1
- package/lib/ocaml/CategoryId-CatalogPlugin.cmi +0 -0
- package/lib/ocaml/CategoryId-CatalogPlugin.cmt +0 -0
- package/lib/ocaml/Category_Behavior-CatalogPlugin.cmi +0 -0
- package/lib/ocaml/Category_Behavior-CatalogPlugin.cmt +0 -0
- package/lib/ocaml/Category_GWT-CatalogPlugin.cmi +0 -0
- package/lib/ocaml/Category_GWT-CatalogPlugin.cmt +0 -0
- package/lib/ocaml/Category_GWT.ast +0 -0
- package/lib/ocaml/Category_GWT.res +26 -0
- package/lib/ocaml/ImportProducts-CatalogPlugin.cmi +0 -0
- package/lib/ocaml/ImportProducts-CatalogPlugin.cmt +0 -0
- package/lib/ocaml/LifecycleModel-CatalogPlugin.cmi +0 -0
- package/lib/ocaml/LifecycleModel-CatalogPlugin.cmt +0 -0
- package/lib/ocaml/Orders_Extension-CatalogPlugin.cmi +0 -0
- package/lib/ocaml/Orders_Extension-CatalogPlugin.cmt +0 -0
- package/lib/ocaml/Orders_Extension_GWT-CatalogPlugin.cmi +0 -0
- package/lib/ocaml/Orders_Extension_GWT-CatalogPlugin.cmt +0 -0
- package/lib/ocaml/Plugin-CatalogPlugin.cmi +0 -0
- package/lib/ocaml/Plugin-CatalogPlugin.cmt +0 -0
- package/lib/ocaml/Product-CatalogPlugin.cmi +0 -0
- package/lib/ocaml/Product-CatalogPlugin.cmt +0 -0
- package/lib/ocaml/Product.ast +0 -0
- package/lib/ocaml/ProductDemand-CatalogPlugin.cmi +0 -0
- package/lib/ocaml/ProductDemand-CatalogPlugin.cmt +0 -0
- package/lib/ocaml/ProductDemand.ast +0 -0
- package/lib/ocaml/ProductDemand_Behavior-CatalogPlugin.cmi +0 -0
- package/lib/ocaml/ProductDemand_Behavior-CatalogPlugin.cmt +0 -0
- package/lib/ocaml/ProductDemand_GWT-CatalogPlugin.cmi +0 -0
- package/lib/ocaml/ProductDemand_GWT-CatalogPlugin.cmt +0 -0
- package/lib/ocaml/ProductDemands-CatalogPlugin.cmi +0 -0
- package/lib/ocaml/ProductDemands-CatalogPlugin.cmt +0 -0
- package/lib/ocaml/ProductDemands.ast +0 -0
- package/lib/ocaml/ProductDemands_GWT-CatalogPlugin.cmi +0 -0
- package/lib/ocaml/ProductDemands_GWT-CatalogPlugin.cmt +0 -0
- package/lib/ocaml/ProductDemands_Projections-CatalogPlugin.cmi +0 -0
- package/lib/ocaml/ProductDemands_Projections-CatalogPlugin.cmt +0 -0
- package/lib/ocaml/Product_Behavior-CatalogPlugin.cmi +0 -0
- package/lib/ocaml/Product_Behavior-CatalogPlugin.cmt +0 -0
- package/lib/ocaml/Product_GWT-CatalogPlugin.cmi +0 -0
- package/lib/ocaml/Product_GWT-CatalogPlugin.cmt +0 -0
- package/lib/ocaml/Products-CatalogPlugin.cmi +0 -0
- package/lib/ocaml/Products-CatalogPlugin.cmt +0 -0
- package/lib/ocaml/Products.ast +0 -0
- package/lib/ocaml/Products_ExtensionPointMapping-CatalogPlugin.cmi +0 -0
- package/lib/ocaml/Products_ExtensionPointMapping-CatalogPlugin.cmt +0 -0
- package/lib/ocaml/Products_ExtensionPointMapping_GWT-CatalogPlugin.cmi +0 -0
- package/lib/ocaml/Products_ExtensionPointMapping_GWT-CatalogPlugin.cmt +0 -0
- package/lib/ocaml/Products_GWT-CatalogPlugin.cmi +0 -0
- package/lib/ocaml/Products_GWT-CatalogPlugin.cmt +0 -0
- package/lib/ocaml/Products_Projections-CatalogPlugin.cmi +0 -0
- package/lib/ocaml/Products_Projections-CatalogPlugin.cmt +0 -0
- package/lib/ocaml/Roles-CatalogPlugin.cmi +0 -0
- package/lib/ocaml/Roles-CatalogPlugin.cmj +0 -0
- package/lib/ocaml/Roles-CatalogPlugin.cmt +0 -0
- package/lib/ocaml/Roles.ast +0 -0
- package/lib/ocaml/Roles.res +2 -0
- package/package.json +8 -8
- package/src/Category/Aggregate/Category.res +1 -1
- package/src/Category/Aggregate/Category.res.mjs +1 -1
- package/src/Roles.res +2 -0
- package/src/Roles.res.mjs +2 -0
- package/tests/Catalog_Examples.res +1 -0
- package/tests/Catalog_Examples.res.mjs +3 -0
- package/tests/Category/Aggregate/Category_GWT.res +26 -0
- package/tests/Category/Aggregate/Category_GWT.res.mjs +25 -8
- package/tests/Product/Aggregate/Product_GWT.res.mjs +4 -2
- package/tests/ProductDemand/Aggregate/ProductDemand_GWT.res.mjs +4 -2
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
|
+
# 3.0.0-alpha.265 (2026-10-01)
|
|
7
|
+
|
|
8
|
+
* feat!: roles a plugin declares, groups a platform provides ([43daace](https://github.com/ReventlessDev/reventless-core/commit/43daace6ca588afe22562d079af1e6f1da81942e))
|
|
9
|
+
|
|
10
|
+
### BREAKING CHANGES
|
|
11
|
+
|
|
12
|
+
* AllowGroups and AdminGroup are removed — write AllowRoles over
|
|
13
|
+
the plugin's Roles.t, and use Role.admin / Platform.adminGroup(). Spec module
|
|
14
|
+
types declare `type role`, and their rules are Authorization.rule<role>; a spec
|
|
15
|
+
that writes its own rule declares `type role` (Reventless.Role.name for a rule
|
|
16
|
+
over Authorization.permission). Role.name is a private string: make one from a
|
|
17
|
+
string with Role.make.
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
6
21
|
# 3.0.0-alpha.264 (2026-10-01)
|
|
7
22
|
|
|
8
23
|
**Note:** Version bump only for package @reventlessdev/online-shop-aggregates-catalog
|
package/lib/bs/.compiler.log
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
#Start(
|
|
2
|
-
#Done(
|
|
1
|
+
#Start(1790854925300)
|
|
2
|
+
#Done(1790854931571)
|
package/lib/bs/CatalogPlugin.cmi
CHANGED
|
Binary file
|
package/lib/bs/CatalogPlugin.cmt
CHANGED
|
Binary file
|
|
@@ -4,5 +4,5 @@
|
|
|
4
4
|
"bsc_hash": "1006241435e8d5052329c523202a7fe6359a37e1e1688c023d37d6a7ebb5fb6d",
|
|
5
5
|
"rescript_config_hash": "50d5358a2cbe328e82ae9b442e4615b86dbfe6b2ce05e9eca04a0c78da0e4708",
|
|
6
6
|
"runtime_path": "/home/runner/work/reventless-core/reventless-core/node_modules/@rescript/runtime",
|
|
7
|
-
"generated_at": "
|
|
7
|
+
"generated_at": "1790854931587"
|
|
8
8
|
}
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -59,3 +59,29 @@ describe("Category Behavior", () => {
|
|
|
59
59
|
->thenNoEvent
|
|
60
60
|
)
|
|
61
61
|
})
|
|
62
|
+
|
|
63
|
+
describe("Who may Archive", () => {
|
|
64
|
+
// scenario-id: 5164cae5-bd41-4802-aa03-3d42b3e2fb9f
|
|
65
|
+
test("an Admin may archive a category", () =>
|
|
66
|
+
givenEvents([Added({name: electronics})])
|
|
67
|
+
->asCaller(Caller.inRoles([Admin]))
|
|
68
|
+
->whenCmd(Archive)
|
|
69
|
+
->thenEvent(Archived)
|
|
70
|
+
)
|
|
71
|
+
|
|
72
|
+
// scenario-id: 92a627eb-e78c-48ed-88f4-5065dc505885
|
|
73
|
+
test("a shopper may not archive a category", () =>
|
|
74
|
+
givenEvents([Added({name: electronics})])
|
|
75
|
+
->asCaller(Caller.owner(shopper))
|
|
76
|
+
->whenCmd(Archive)
|
|
77
|
+
->thenRefused
|
|
78
|
+
)
|
|
79
|
+
|
|
80
|
+
// scenario-id: c4c8e733-7e07-4f3c-b3f2-01bc6b52f601
|
|
81
|
+
test("an anonymous caller may not archive a category", () =>
|
|
82
|
+
givenEvents([Added({name: electronics})])
|
|
83
|
+
->asCaller(Caller.anonymous)
|
|
84
|
+
->whenCmd(Archive)
|
|
85
|
+
->thenRefused
|
|
86
|
+
)
|
|
87
|
+
})
|
|
@@ -9,13 +9,15 @@ let include = Behavior_GWT$ReventlessGwt.MakeFromAggregate({
|
|
|
9
9
|
name: Category$CatalogPlugin.name,
|
|
10
10
|
commandSchema: Category$CatalogPlugin.commandSchema,
|
|
11
11
|
eventSchema: Category$CatalogPlugin.eventSchema,
|
|
12
|
-
errorSchema: Category$CatalogPlugin.errorSchema
|
|
12
|
+
errorSchema: Category$CatalogPlugin.errorSchema,
|
|
13
|
+
commandAuthorization: Category$CatalogPlugin.commandAuthorization
|
|
13
14
|
})({
|
|
14
15
|
Spec: {
|
|
15
16
|
name: Category$CatalogPlugin.name,
|
|
16
17
|
commandSchema: Category$CatalogPlugin.commandSchema,
|
|
17
18
|
eventSchema: Category$CatalogPlugin.eventSchema,
|
|
18
|
-
errorSchema: Category$CatalogPlugin.errorSchema
|
|
19
|
+
errorSchema: Category$CatalogPlugin.errorSchema,
|
|
20
|
+
commandAuthorization: Category$CatalogPlugin.commandAuthorization
|
|
19
21
|
},
|
|
20
22
|
initialState: Category_Behavior$CatalogPlugin.initialState,
|
|
21
23
|
evolve: Category_Behavior$CatalogPlugin.evolve,
|
|
@@ -30,6 +32,10 @@ let test = include.test;
|
|
|
30
32
|
|
|
31
33
|
let givenEvents = include.givenEvents;
|
|
32
34
|
|
|
35
|
+
let Caller = include.Caller;
|
|
36
|
+
|
|
37
|
+
let asCaller = include.asCaller;
|
|
38
|
+
|
|
33
39
|
let whenCmd = include.whenCmd;
|
|
34
40
|
|
|
35
41
|
let thenEvent = include.thenEvent;
|
|
@@ -38,6 +44,8 @@ let thenNoEvent = include.thenNoEvent;
|
|
|
38
44
|
|
|
39
45
|
let thenError = include.thenError;
|
|
40
46
|
|
|
47
|
+
let thenRefused = include.thenRefused;
|
|
48
|
+
|
|
41
49
|
describe("Category Behavior", () => {
|
|
42
50
|
test("Add on new aggregate produces Added", () => thenEvent(whenCmd(givenEvents([]), {
|
|
43
51
|
TAG: "Add",
|
|
@@ -97,11 +105,22 @@ describe("Category Behavior", () => {
|
|
|
97
105
|
]), "Archive")));
|
|
98
106
|
});
|
|
99
107
|
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
108
|
+
describe("Who may Archive", () => {
|
|
109
|
+
test("an Admin may archive a category", () => thenEvent(whenCmd(asCaller(givenEvents([{
|
|
110
|
+
TAG: "Added",
|
|
111
|
+
name: Catalog_Examples$CatalogPlugin.electronics
|
|
112
|
+
}]), Caller.inRoles(["Admin"])), "Archive"), "Archived"));
|
|
113
|
+
test("a shopper may not archive a category", () => thenRefused(whenCmd(asCaller(givenEvents([{
|
|
114
|
+
TAG: "Added",
|
|
115
|
+
name: Catalog_Examples$CatalogPlugin.electronics
|
|
116
|
+
}]), Caller.owner(Catalog_Examples$CatalogPlugin.shopper, undefined)), "Archive")));
|
|
117
|
+
test("an anonymous caller may not archive a category", () => thenRefused(whenCmd(asCaller(givenEvents([{
|
|
118
|
+
TAG: "Added",
|
|
119
|
+
name: Catalog_Examples$CatalogPlugin.electronics
|
|
120
|
+
}]), Caller.anonymous), "Archive")));
|
|
121
|
+
});
|
|
103
122
|
|
|
104
|
-
let
|
|
123
|
+
let Spec = include.Spec;
|
|
105
124
|
|
|
106
125
|
let thenCompareEvent = include.thenCompareEvent;
|
|
107
126
|
|
|
@@ -113,8 +132,6 @@ let thenCompareEvents = include.thenCompareEvents;
|
|
|
113
132
|
|
|
114
133
|
let thenEventsWithError = include.thenEventsWithError;
|
|
115
134
|
|
|
116
|
-
let thenRefused = include.thenRefused;
|
|
117
|
-
|
|
118
135
|
export {
|
|
119
136
|
Spec,
|
|
120
137
|
describe,
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -9,13 +9,15 @@ let include = Behavior_GWT$ReventlessGwt.MakeFromAggregate({
|
|
|
9
9
|
name: Product$CatalogPlugin.name,
|
|
10
10
|
commandSchema: Product$CatalogPlugin.commandSchema,
|
|
11
11
|
eventSchema: Product$CatalogPlugin.eventSchema,
|
|
12
|
-
errorSchema: Product$CatalogPlugin.errorSchema
|
|
12
|
+
errorSchema: Product$CatalogPlugin.errorSchema,
|
|
13
|
+
commandAuthorization: Product$CatalogPlugin.commandAuthorization
|
|
13
14
|
})({
|
|
14
15
|
Spec: {
|
|
15
16
|
name: Product$CatalogPlugin.name,
|
|
16
17
|
commandSchema: Product$CatalogPlugin.commandSchema,
|
|
17
18
|
eventSchema: Product$CatalogPlugin.eventSchema,
|
|
18
|
-
errorSchema: Product$CatalogPlugin.errorSchema
|
|
19
|
+
errorSchema: Product$CatalogPlugin.errorSchema,
|
|
20
|
+
commandAuthorization: Product$CatalogPlugin.commandAuthorization
|
|
19
21
|
},
|
|
20
22
|
initialState: Product_Behavior$CatalogPlugin.initialState,
|
|
21
23
|
evolve: Product_Behavior$CatalogPlugin.evolve,
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -9,13 +9,15 @@ let include = Behavior_GWT$ReventlessGwt.MakeFromAggregate({
|
|
|
9
9
|
name: ProductDemand$CatalogPlugin.name,
|
|
10
10
|
commandSchema: ProductDemand$CatalogPlugin.commandSchema,
|
|
11
11
|
eventSchema: ProductDemand$CatalogPlugin.eventSchema,
|
|
12
|
-
errorSchema: ProductDemand$CatalogPlugin.errorSchema
|
|
12
|
+
errorSchema: ProductDemand$CatalogPlugin.errorSchema,
|
|
13
|
+
commandAuthorization: ProductDemand$CatalogPlugin.commandAuthorization
|
|
13
14
|
})({
|
|
14
15
|
Spec: {
|
|
15
16
|
name: ProductDemand$CatalogPlugin.name,
|
|
16
17
|
commandSchema: ProductDemand$CatalogPlugin.commandSchema,
|
|
17
18
|
eventSchema: ProductDemand$CatalogPlugin.eventSchema,
|
|
18
|
-
errorSchema: ProductDemand$CatalogPlugin.errorSchema
|
|
19
|
+
errorSchema: ProductDemand$CatalogPlugin.errorSchema,
|
|
20
|
+
commandAuthorization: ProductDemand$CatalogPlugin.commandAuthorization
|
|
19
21
|
},
|
|
20
22
|
initialState: ProductDemand_Behavior$CatalogPlugin.initialState,
|
|
21
23
|
evolve: ProductDemand_Behavior$CatalogPlugin.evolve,
|
|
Binary file
|
|
Binary file
|
package/lib/ocaml/.compiler.log
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
#Start(
|
|
2
|
-
#Done(
|
|
1
|
+
#Start(1790854925300)
|
|
2
|
+
#Done(1790854931571)
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/lib/ocaml/Categories.ast
CHANGED
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/lib/ocaml/Category.ast
CHANGED
|
Binary file
|
package/lib/ocaml/Category.res
CHANGED
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -59,3 +59,29 @@ describe("Category Behavior", () => {
|
|
|
59
59
|
->thenNoEvent
|
|
60
60
|
)
|
|
61
61
|
})
|
|
62
|
+
|
|
63
|
+
describe("Who may Archive", () => {
|
|
64
|
+
// scenario-id: 5164cae5-bd41-4802-aa03-3d42b3e2fb9f
|
|
65
|
+
test("an Admin may archive a category", () =>
|
|
66
|
+
givenEvents([Added({name: electronics})])
|
|
67
|
+
->asCaller(Caller.inRoles([Admin]))
|
|
68
|
+
->whenCmd(Archive)
|
|
69
|
+
->thenEvent(Archived)
|
|
70
|
+
)
|
|
71
|
+
|
|
72
|
+
// scenario-id: 92a627eb-e78c-48ed-88f4-5065dc505885
|
|
73
|
+
test("a shopper may not archive a category", () =>
|
|
74
|
+
givenEvents([Added({name: electronics})])
|
|
75
|
+
->asCaller(Caller.owner(shopper))
|
|
76
|
+
->whenCmd(Archive)
|
|
77
|
+
->thenRefused
|
|
78
|
+
)
|
|
79
|
+
|
|
80
|
+
// scenario-id: c4c8e733-7e07-4f3c-b3f2-01bc6b52f601
|
|
81
|
+
test("an anonymous caller may not archive a category", () =>
|
|
82
|
+
givenEvents([Added({name: electronics})])
|
|
83
|
+
->asCaller(Caller.anonymous)
|
|
84
|
+
->whenCmd(Archive)
|
|
85
|
+
->thenRefused
|
|
86
|
+
)
|
|
87
|
+
})
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/lib/ocaml/Product.ast
CHANGED
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/lib/ocaml/Products.ast
CHANGED
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@reventlessdev/online-shop-aggregates-catalog",
|
|
3
|
-
"version": "3.0.0-alpha.
|
|
3
|
+
"version": "3.0.0-alpha.265",
|
|
4
4
|
"description": "Online Shop example — Catalog plugin (Product & Category aggregates)",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"jest": {
|
|
@@ -21,18 +21,18 @@
|
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
23
|
"sury": "11.0.0",
|
|
24
|
-
"@reventlessdev/online-shop-aggregates-catalog-spec": "3.0.0-alpha.
|
|
24
|
+
"@reventlessdev/online-shop-aggregates-catalog-spec": "3.0.0-alpha.155",
|
|
25
|
+
"@reventlessdev/online-shop-aggregates-ordering-spec": "3.0.0-alpha.155",
|
|
26
|
+
"@reventlessdev/reventless-gwt": "1.0.0-alpha.233",
|
|
27
|
+
"@reventlessdev/reventless-infra": "3.0.0-alpha.184",
|
|
25
28
|
"@reventlessdev/rescript-pulumi-pulumi": "2.3.0-alpha.22",
|
|
26
|
-
"@reventlessdev/reventless-
|
|
27
|
-
"@reventlessdev/reventless-
|
|
28
|
-
"@reventlessdev/online-shop-aggregates-ordering-spec": "3.0.0-alpha.154",
|
|
29
|
-
"@reventlessdev/reventless-spec": "3.0.0-alpha.155",
|
|
30
|
-
"@reventlessdev/reventless-local": "3.0.0-alpha.275"
|
|
29
|
+
"@reventlessdev/reventless-local": "3.0.0-alpha.276",
|
|
30
|
+
"@reventlessdev/reventless-spec": "3.0.0-alpha.156"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
|
33
33
|
"rescript": "12.3.1",
|
|
34
34
|
"sury-ppx": "11.0.0",
|
|
35
|
-
"@reventlessdev/reventless-ppx": "1.0.0-alpha.
|
|
35
|
+
"@reventlessdev/reventless-ppx": "1.0.0-alpha.96"
|
|
36
36
|
},
|
|
37
37
|
"peerDependencies": {
|
|
38
38
|
"rescript": "^12.3.1"
|
package/src/Roles.res
ADDED
|
@@ -59,3 +59,29 @@ describe("Category Behavior", () => {
|
|
|
59
59
|
->thenNoEvent
|
|
60
60
|
)
|
|
61
61
|
})
|
|
62
|
+
|
|
63
|
+
describe("Who may Archive", () => {
|
|
64
|
+
// scenario-id: 5164cae5-bd41-4802-aa03-3d42b3e2fb9f
|
|
65
|
+
test("an Admin may archive a category", () =>
|
|
66
|
+
givenEvents([Added({name: electronics})])
|
|
67
|
+
->asCaller(Caller.inRoles([Admin]))
|
|
68
|
+
->whenCmd(Archive)
|
|
69
|
+
->thenEvent(Archived)
|
|
70
|
+
)
|
|
71
|
+
|
|
72
|
+
// scenario-id: 92a627eb-e78c-48ed-88f4-5065dc505885
|
|
73
|
+
test("a shopper may not archive a category", () =>
|
|
74
|
+
givenEvents([Added({name: electronics})])
|
|
75
|
+
->asCaller(Caller.owner(shopper))
|
|
76
|
+
->whenCmd(Archive)
|
|
77
|
+
->thenRefused
|
|
78
|
+
)
|
|
79
|
+
|
|
80
|
+
// scenario-id: c4c8e733-7e07-4f3c-b3f2-01bc6b52f601
|
|
81
|
+
test("an anonymous caller may not archive a category", () =>
|
|
82
|
+
givenEvents([Added({name: electronics})])
|
|
83
|
+
->asCaller(Caller.anonymous)
|
|
84
|
+
->whenCmd(Archive)
|
|
85
|
+
->thenRefused
|
|
86
|
+
)
|
|
87
|
+
})
|
|
@@ -9,13 +9,15 @@ let include = Behavior_GWT$ReventlessGwt.MakeFromAggregate({
|
|
|
9
9
|
name: Category$CatalogPlugin.name,
|
|
10
10
|
commandSchema: Category$CatalogPlugin.commandSchema,
|
|
11
11
|
eventSchema: Category$CatalogPlugin.eventSchema,
|
|
12
|
-
errorSchema: Category$CatalogPlugin.errorSchema
|
|
12
|
+
errorSchema: Category$CatalogPlugin.errorSchema,
|
|
13
|
+
commandAuthorization: Category$CatalogPlugin.commandAuthorization
|
|
13
14
|
})({
|
|
14
15
|
Spec: {
|
|
15
16
|
name: Category$CatalogPlugin.name,
|
|
16
17
|
commandSchema: Category$CatalogPlugin.commandSchema,
|
|
17
18
|
eventSchema: Category$CatalogPlugin.eventSchema,
|
|
18
|
-
errorSchema: Category$CatalogPlugin.errorSchema
|
|
19
|
+
errorSchema: Category$CatalogPlugin.errorSchema,
|
|
20
|
+
commandAuthorization: Category$CatalogPlugin.commandAuthorization
|
|
19
21
|
},
|
|
20
22
|
initialState: Category_Behavior$CatalogPlugin.initialState,
|
|
21
23
|
evolve: Category_Behavior$CatalogPlugin.evolve,
|
|
@@ -30,6 +32,10 @@ let test = include.test;
|
|
|
30
32
|
|
|
31
33
|
let givenEvents = include.givenEvents;
|
|
32
34
|
|
|
35
|
+
let Caller = include.Caller;
|
|
36
|
+
|
|
37
|
+
let asCaller = include.asCaller;
|
|
38
|
+
|
|
33
39
|
let whenCmd = include.whenCmd;
|
|
34
40
|
|
|
35
41
|
let thenEvent = include.thenEvent;
|
|
@@ -38,6 +44,8 @@ let thenNoEvent = include.thenNoEvent;
|
|
|
38
44
|
|
|
39
45
|
let thenError = include.thenError;
|
|
40
46
|
|
|
47
|
+
let thenRefused = include.thenRefused;
|
|
48
|
+
|
|
41
49
|
describe("Category Behavior", () => {
|
|
42
50
|
test("Add on new aggregate produces Added", () => thenEvent(whenCmd(givenEvents([]), {
|
|
43
51
|
TAG: "Add",
|
|
@@ -97,11 +105,22 @@ describe("Category Behavior", () => {
|
|
|
97
105
|
]), "Archive")));
|
|
98
106
|
});
|
|
99
107
|
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
108
|
+
describe("Who may Archive", () => {
|
|
109
|
+
test("an Admin may archive a category", () => thenEvent(whenCmd(asCaller(givenEvents([{
|
|
110
|
+
TAG: "Added",
|
|
111
|
+
name: Catalog_Examples$CatalogPlugin.electronics
|
|
112
|
+
}]), Caller.inRoles(["Admin"])), "Archive"), "Archived"));
|
|
113
|
+
test("a shopper may not archive a category", () => thenRefused(whenCmd(asCaller(givenEvents([{
|
|
114
|
+
TAG: "Added",
|
|
115
|
+
name: Catalog_Examples$CatalogPlugin.electronics
|
|
116
|
+
}]), Caller.owner(Catalog_Examples$CatalogPlugin.shopper, undefined)), "Archive")));
|
|
117
|
+
test("an anonymous caller may not archive a category", () => thenRefused(whenCmd(asCaller(givenEvents([{
|
|
118
|
+
TAG: "Added",
|
|
119
|
+
name: Catalog_Examples$CatalogPlugin.electronics
|
|
120
|
+
}]), Caller.anonymous), "Archive")));
|
|
121
|
+
});
|
|
103
122
|
|
|
104
|
-
let
|
|
123
|
+
let Spec = include.Spec;
|
|
105
124
|
|
|
106
125
|
let thenCompareEvent = include.thenCompareEvent;
|
|
107
126
|
|
|
@@ -113,8 +132,6 @@ let thenCompareEvents = include.thenCompareEvents;
|
|
|
113
132
|
|
|
114
133
|
let thenEventsWithError = include.thenEventsWithError;
|
|
115
134
|
|
|
116
|
-
let thenRefused = include.thenRefused;
|
|
117
|
-
|
|
118
135
|
export {
|
|
119
136
|
Spec,
|
|
120
137
|
describe,
|
|
@@ -9,13 +9,15 @@ let include = Behavior_GWT$ReventlessGwt.MakeFromAggregate({
|
|
|
9
9
|
name: Product$CatalogPlugin.name,
|
|
10
10
|
commandSchema: Product$CatalogPlugin.commandSchema,
|
|
11
11
|
eventSchema: Product$CatalogPlugin.eventSchema,
|
|
12
|
-
errorSchema: Product$CatalogPlugin.errorSchema
|
|
12
|
+
errorSchema: Product$CatalogPlugin.errorSchema,
|
|
13
|
+
commandAuthorization: Product$CatalogPlugin.commandAuthorization
|
|
13
14
|
})({
|
|
14
15
|
Spec: {
|
|
15
16
|
name: Product$CatalogPlugin.name,
|
|
16
17
|
commandSchema: Product$CatalogPlugin.commandSchema,
|
|
17
18
|
eventSchema: Product$CatalogPlugin.eventSchema,
|
|
18
|
-
errorSchema: Product$CatalogPlugin.errorSchema
|
|
19
|
+
errorSchema: Product$CatalogPlugin.errorSchema,
|
|
20
|
+
commandAuthorization: Product$CatalogPlugin.commandAuthorization
|
|
19
21
|
},
|
|
20
22
|
initialState: Product_Behavior$CatalogPlugin.initialState,
|
|
21
23
|
evolve: Product_Behavior$CatalogPlugin.evolve,
|
|
@@ -9,13 +9,15 @@ let include = Behavior_GWT$ReventlessGwt.MakeFromAggregate({
|
|
|
9
9
|
name: ProductDemand$CatalogPlugin.name,
|
|
10
10
|
commandSchema: ProductDemand$CatalogPlugin.commandSchema,
|
|
11
11
|
eventSchema: ProductDemand$CatalogPlugin.eventSchema,
|
|
12
|
-
errorSchema: ProductDemand$CatalogPlugin.errorSchema
|
|
12
|
+
errorSchema: ProductDemand$CatalogPlugin.errorSchema,
|
|
13
|
+
commandAuthorization: ProductDemand$CatalogPlugin.commandAuthorization
|
|
13
14
|
})({
|
|
14
15
|
Spec: {
|
|
15
16
|
name: ProductDemand$CatalogPlugin.name,
|
|
16
17
|
commandSchema: ProductDemand$CatalogPlugin.commandSchema,
|
|
17
18
|
eventSchema: ProductDemand$CatalogPlugin.eventSchema,
|
|
18
|
-
errorSchema: ProductDemand$CatalogPlugin.errorSchema
|
|
19
|
+
errorSchema: ProductDemand$CatalogPlugin.errorSchema,
|
|
20
|
+
commandAuthorization: ProductDemand$CatalogPlugin.commandAuthorization
|
|
19
21
|
},
|
|
20
22
|
initialState: ProductDemand_Behavior$CatalogPlugin.initialState,
|
|
21
23
|
evolve: ProductDemand_Behavior$CatalogPlugin.evolve,
|