@reventlessdev/reventless-core 3.0.0-alpha.308 → 3.0.0-alpha.309
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
CHANGED
|
@@ -3,6 +3,13 @@
|
|
|
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.309 (2026-10-25)
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
* **admission:** the open-roles view marks itself, and the shell's key names its query ([4b91015](https://github.com/ReventlessDev/reventless-core/commit/4b910153c3c477b6830ce4636b93ed5b4dfde482))
|
|
11
|
+
|
|
12
|
+
|
|
6
13
|
# 3.0.0-alpha.308 (2026-10-25)
|
|
7
14
|
|
|
8
15
|
### Bug Fixes
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@reventlessdev/reventless-core",
|
|
3
|
-
"version": "3.0.0-alpha.
|
|
3
|
+
"version": "3.0.0-alpha.309",
|
|
4
4
|
"description": "Core package for Reventless framework",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"jest": {
|
|
@@ -28,22 +28,22 @@
|
|
|
28
28
|
"dependencies": {
|
|
29
29
|
"sury": "11.0.0",
|
|
30
30
|
"uuid": "^13.0.0",
|
|
31
|
-
"@reventlessdev/rescript-effect": "1.0.0-alpha.1",
|
|
32
|
-
"@reventlessdev/rescript-hash-object": "1.2.0-alpha.15",
|
|
33
|
-
"@reventlessdev/rescript-node": "2.0.0-alpha.23",
|
|
34
31
|
"@reventlessdev/rescript-fast-csv": "2.0.0-alpha.23",
|
|
35
32
|
"@reventlessdev/rescript-jest": "1.0.0-alpha.13",
|
|
33
|
+
"@reventlessdev/rescript-node": "2.0.0-alpha.23",
|
|
34
|
+
"@reventlessdev/rescript-hash-object": "1.2.0-alpha.15",
|
|
35
|
+
"@reventlessdev/rescript-effect": "1.0.0-alpha.1",
|
|
36
36
|
"@reventlessdev/rescript-pulumi-pulumi": "3.0.0-alpha.0",
|
|
37
37
|
"@reventlessdev/rescript-ssh2": "2.0.0-alpha.24",
|
|
38
38
|
"@reventlessdev/rescript-uuid": "2.0.0-alpha.1",
|
|
39
|
-
"@reventlessdev/reventless-infra": "3.0.0-alpha.205",
|
|
40
39
|
"@reventlessdev/reventless-interop": "3.0.0-alpha.42",
|
|
41
|
-
"@reventlessdev/reventless-
|
|
40
|
+
"@reventlessdev/reventless-infra": "3.0.0-alpha.206",
|
|
41
|
+
"@reventlessdev/reventless-spec": "3.0.0-alpha.177"
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
44
|
"rescript": "12.3.1",
|
|
45
45
|
"sury-ppx": "11.0.0",
|
|
46
|
-
"@reventlessdev/reventless-ppx": "1.0.0-alpha.
|
|
46
|
+
"@reventlessdev/reventless-ppx": "1.0.0-alpha.108"
|
|
47
47
|
},
|
|
48
48
|
"peerDependencies": {
|
|
49
49
|
"rescript": "^12.3.1"
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
// What the host shell needs to let a visitor create an account, read off the
|
|
2
2
|
// plugin structures rather than written by hand: the mutation that starts a
|
|
3
|
-
// registration, the one that completes it,
|
|
4
|
-
// for
|
|
5
|
-
// self-registration writes the
|
|
3
|
+
// registration, the one that completes it, the groups a visitor may sign up
|
|
4
|
+
// for, and the query that says which of them are open right now. Absent when no
|
|
5
|
+
// plugin marks both doors, so a deployment without self-registration writes the
|
|
6
|
+
// same `config.json` it always did.
|
|
6
7
|
|
|
7
8
|
let configKey = "selfRegistration"
|
|
8
9
|
|
|
@@ -11,17 +12,34 @@ type config = {
|
|
|
11
12
|
complete: string,
|
|
12
13
|
/** The groups of the roles declared self-service, as the deployment maps them. */
|
|
13
14
|
roles: array<string>,
|
|
15
|
+
/** The list query of the view saying which roles are open, where a plugin marks one. */
|
|
16
|
+
openRoles?: string,
|
|
14
17
|
}
|
|
15
18
|
|
|
16
|
-
let
|
|
19
|
+
let marked = (
|
|
17
20
|
structures: array<(string, Reventless.Plugin.pluginStructure)>,
|
|
18
21
|
part: Reventless.Admission.door,
|
|
19
|
-
): option<string> =>
|
|
22
|
+
): option<(string, Reventless.Admission.doorDef)> =>
|
|
20
23
|
structures->Array.findMap(((plugin, s)) =>
|
|
21
24
|
s.admissionDoors
|
|
22
25
|
->Option.getOr([])
|
|
23
26
|
->Array.find(d => d.part == Reventless.Admission.doorName(part))
|
|
24
|
-
->Option.map(d =>
|
|
27
|
+
->Option.map(d => (plugin, d))
|
|
28
|
+
)
|
|
29
|
+
|
|
30
|
+
let doorField = (
|
|
31
|
+
structures: array<(string, Reventless.Plugin.pluginStructure)>,
|
|
32
|
+
part: Reventless.Admission.door,
|
|
33
|
+
): option<string> =>
|
|
34
|
+
marked(structures, part)->Option.map(((plugin, d)) =>
|
|
35
|
+
Api_Naming.sliceMutationField(~plugin, ~slice=d.component)
|
|
36
|
+
)
|
|
37
|
+
|
|
38
|
+
let openRolesField = (structures: array<(string, Reventless.Plugin.pluginStructure)>): option<
|
|
39
|
+
string,
|
|
40
|
+
> =>
|
|
41
|
+
marked(structures, OpenRoles)->Option.map(((plugin, d)) =>
|
|
42
|
+
Api_Naming.queryFieldNamesForStateView(~plugin, ~viewName=d.component).listFieldName
|
|
25
43
|
)
|
|
26
44
|
|
|
27
45
|
let selfServiceGroups = (structures: array<(string, Reventless.Plugin.pluginStructure)>) =>
|
|
@@ -38,17 +56,24 @@ let fromStructures = (structures: array<(string, Reventless.Plugin.pluginStructu
|
|
|
38
56
|
config,
|
|
39
57
|
> =>
|
|
40
58
|
switch (doorField(structures, Start), doorField(structures, Complete)) {
|
|
41
|
-
| (Some(start), Some(complete)) =>
|
|
59
|
+
| (Some(start), Some(complete)) =>
|
|
60
|
+
Some({
|
|
61
|
+
start,
|
|
62
|
+
complete,
|
|
63
|
+
roles: selfServiceGroups(structures),
|
|
64
|
+
openRoles: ?openRolesField(structures),
|
|
65
|
+
})
|
|
42
66
|
| _ => None
|
|
43
67
|
}
|
|
44
68
|
|
|
45
|
-
let toJson = (c: config): JSON.t =>
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
)
|
|
69
|
+
let toJson = (c: config): JSON.t => {
|
|
70
|
+
let entries = Dict.fromArray([
|
|
71
|
+
("start", JSON.Encode.string(c.start)),
|
|
72
|
+
("complete", JSON.Encode.string(c.complete)),
|
|
73
|
+
("roles", c.roles->Array.map(JSON.Encode.string)->JSON.Encode.array),
|
|
74
|
+
])
|
|
75
|
+
c.openRoles->Option.forEach(q => entries->Dict.set("openRoles", JSON.Encode.string(q)))
|
|
76
|
+
JSON.Encode.object(entries)
|
|
77
|
+
}
|
|
53
78
|
|
|
54
79
|
let configEntry = (c: config): (string, JSON.t) => (configKey, toJson(c))
|
|
@@ -8,13 +8,24 @@ import * as Api_Naming$ReventlessCore from "../components/Api/Api_Naming.res.mjs
|
|
|
8
8
|
|
|
9
9
|
let configKey = "selfRegistration";
|
|
10
10
|
|
|
11
|
-
function
|
|
11
|
+
function marked(structures, part) {
|
|
12
12
|
return Stdlib_Array.findMap(structures, param => {
|
|
13
13
|
let plugin = param[0];
|
|
14
|
-
return Stdlib_Option.map(Stdlib_Option.getOr(param[1].admissionDoors, []).find(d => d.part === Admission$Reventless.doorName(part)), d =>
|
|
14
|
+
return Stdlib_Option.map(Stdlib_Option.getOr(param[1].admissionDoors, []).find(d => d.part === Admission$Reventless.doorName(part)), d => [
|
|
15
|
+
plugin,
|
|
16
|
+
d
|
|
17
|
+
]);
|
|
15
18
|
});
|
|
16
19
|
}
|
|
17
20
|
|
|
21
|
+
function doorField(structures, part) {
|
|
22
|
+
return Stdlib_Option.map(marked(structures, part), param => Api_Naming$ReventlessCore.sliceMutationField(param[0], param[1].component));
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
function openRolesField(structures) {
|
|
26
|
+
return Stdlib_Option.map(marked(structures, "OpenRoles"), param => Api_Naming$ReventlessCore.queryFieldNamesForStateView(param[0], param[1].component, undefined).listFieldName);
|
|
27
|
+
}
|
|
28
|
+
|
|
18
29
|
function selfServiceGroups(structures) {
|
|
19
30
|
return structures.flatMap(param => {
|
|
20
31
|
let match = Stdlib_Option.map(param[1].admission, Admission$Reventless.fromDefs);
|
|
@@ -37,13 +48,14 @@ function fromStructures(structures) {
|
|
|
37
48
|
return {
|
|
38
49
|
start: match,
|
|
39
50
|
complete: match$1,
|
|
40
|
-
roles: selfServiceGroups(structures)
|
|
51
|
+
roles: selfServiceGroups(structures),
|
|
52
|
+
openRoles: openRolesField(structures)
|
|
41
53
|
};
|
|
42
54
|
}
|
|
43
55
|
}
|
|
44
56
|
|
|
45
57
|
function toJson(c) {
|
|
46
|
-
|
|
58
|
+
let entries = Object.fromEntries([
|
|
47
59
|
[
|
|
48
60
|
"start",
|
|
49
61
|
c.start
|
|
@@ -57,6 +69,10 @@ function toJson(c) {
|
|
|
57
69
|
c.roles.map(prim => prim)
|
|
58
70
|
]
|
|
59
71
|
]);
|
|
72
|
+
Stdlib_Option.forEach(c.openRoles, q => {
|
|
73
|
+
entries["openRoles"] = q;
|
|
74
|
+
});
|
|
75
|
+
return entries;
|
|
60
76
|
}
|
|
61
77
|
|
|
62
78
|
function configEntry(c) {
|
|
@@ -68,7 +84,9 @@ function configEntry(c) {
|
|
|
68
84
|
|
|
69
85
|
export {
|
|
70
86
|
configKey,
|
|
87
|
+
marked,
|
|
71
88
|
doorField,
|
|
89
|
+
openRolesField,
|
|
72
90
|
selfServiceGroups,
|
|
73
91
|
fromStructures,
|
|
74
92
|
toJson,
|
|
@@ -23,23 +23,43 @@ let registration: Reventless.Plugin.pluginStructure = {
|
|
|
23
23
|
admissionDoors: [
|
|
24
24
|
{Reventless.Admission.component: "SignUp", part: "start"},
|
|
25
25
|
{Reventless.Admission.component: "CompleteRegistration", part: "complete"},
|
|
26
|
+
{Reventless.Admission.component: "RegistrationWindows", part: "openRoles"},
|
|
26
27
|
],
|
|
27
28
|
}
|
|
28
29
|
|
|
29
30
|
describe("Platform_SelfRegistration", () => {
|
|
30
|
-
testSync(
|
|
31
|
+
testSync(
|
|
32
|
+
"names the two doors by their mutation fields, the self-service groups, and the open-roles query",
|
|
33
|
+
() =>
|
|
34
|
+
expect(
|
|
35
|
+
Platform_SelfRegistration.fromStructures([
|
|
36
|
+
("Catalog", empty),
|
|
37
|
+
("Registration", registration),
|
|
38
|
+
]),
|
|
39
|
+
)->toEqual(
|
|
40
|
+
Some({
|
|
41
|
+
Platform_SelfRegistration.start: "Registration_SignUp",
|
|
42
|
+
complete: "Registration_CompleteRegistration",
|
|
43
|
+
roles: ["Shopper"],
|
|
44
|
+
openRoles: "Registration_RegistrationWindows",
|
|
45
|
+
}),
|
|
46
|
+
),
|
|
47
|
+
)
|
|
48
|
+
|
|
49
|
+
testSync("the open-roles query is left out where no view is marked", () =>
|
|
31
50
|
expect(
|
|
32
51
|
Platform_SelfRegistration.fromStructures([
|
|
33
|
-
(
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
52
|
+
(
|
|
53
|
+
"Registration",
|
|
54
|
+
{
|
|
55
|
+
...registration,
|
|
56
|
+
admissionDoors: registration.admissionDoors
|
|
57
|
+
->Option.getOr([])
|
|
58
|
+
->Array.filter(d => d.part != "openRoles"),
|
|
59
|
+
},
|
|
60
|
+
),
|
|
61
|
+
])->Option.flatMap(c => c.openRoles),
|
|
62
|
+
)->toEqual(None)
|
|
43
63
|
)
|
|
44
64
|
|
|
45
65
|
testSync("absent without both doors", () =>
|
|
@@ -62,9 +82,10 @@ describe("Platform_SelfRegistration", () => {
|
|
|
62
82
|
start: "Registration_SignUp",
|
|
63
83
|
complete: "Registration_CompleteRegistration",
|
|
64
84
|
roles: ["Shopper"],
|
|
85
|
+
openRoles: "Registration_RegistrationWindows",
|
|
65
86
|
})
|
|
66
87
|
->Pair.second
|
|
67
88
|
->JSON.stringify,
|
|
68
|
-
)->toEqual(`{"start":"Registration_SignUp","complete":"Registration_CompleteRegistration","roles":["Shopper"]}`)
|
|
89
|
+
)->toEqual(`{"start":"Registration_SignUp","complete":"Registration_CompleteRegistration","roles":["Shopper"],"openRoles":"Registration_RegistrationWindows"}`)
|
|
69
90
|
)
|
|
70
91
|
})
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
// Generated by ReScript, PLEASE EDIT WITH CARE
|
|
2
2
|
|
|
3
|
+
import * as Stdlib_Option from "@rescript/runtime/lib/es6/Stdlib_Option.js";
|
|
3
4
|
import * as Platform_SelfRegistration$ReventlessCore from "../../src/admin/Platform_SelfRegistration.res.mjs";
|
|
4
5
|
|
|
5
6
|
let empty_readModels = [];
|
|
@@ -39,6 +40,10 @@ newrecord.admissionDoors = [
|
|
|
39
40
|
{
|
|
40
41
|
component: "CompleteRegistration",
|
|
41
42
|
part: "complete"
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
component: "RegistrationWindows",
|
|
46
|
+
part: "openRoles"
|
|
42
47
|
}
|
|
43
48
|
];
|
|
44
49
|
|
|
@@ -54,7 +59,7 @@ newrecord.admission = [
|
|
|
54
59
|
];
|
|
55
60
|
|
|
56
61
|
globalThis.describe("Platform_SelfRegistration", () => {
|
|
57
|
-
globalThis.test("names the two doors by their mutation fields
|
|
62
|
+
globalThis.test("names the two doors by their mutation fields, the self-service groups, and the open-roles query", () => {
|
|
58
63
|
globalThis.expect(Platform_SelfRegistration$ReventlessCore.fromStructures([
|
|
59
64
|
[
|
|
60
65
|
"Catalog",
|
|
@@ -67,9 +72,17 @@ globalThis.describe("Platform_SelfRegistration", () => {
|
|
|
67
72
|
])).toEqual({
|
|
68
73
|
start: "Registration_SignUp",
|
|
69
74
|
complete: "Registration_CompleteRegistration",
|
|
70
|
-
roles: ["Shopper"]
|
|
75
|
+
roles: ["Shopper"],
|
|
76
|
+
openRoles: "Registration_RegistrationWindows"
|
|
71
77
|
});
|
|
72
78
|
});
|
|
79
|
+
globalThis.test("the open-roles query is left out where no view is marked", () => {
|
|
80
|
+
let newrecord$1 = {...newrecord};
|
|
81
|
+
globalThis.expect(Stdlib_Option.flatMap(Platform_SelfRegistration$ReventlessCore.fromStructures([[
|
|
82
|
+
"Registration",
|
|
83
|
+
(newrecord$1.admissionDoors = Stdlib_Option.getOr(newrecord.admissionDoors, []).filter(d => d.part !== "openRoles"), newrecord$1)
|
|
84
|
+
]]), c => c.openRoles)).toEqual(undefined);
|
|
85
|
+
});
|
|
73
86
|
globalThis.test("absent without both doors", () => {
|
|
74
87
|
let newrecord$1 = {...newrecord};
|
|
75
88
|
globalThis.expect(Platform_SelfRegistration$ReventlessCore.fromStructures([[
|
|
@@ -84,8 +97,9 @@ globalThis.describe("Platform_SelfRegistration", () => {
|
|
|
84
97
|
globalThis.expect(JSON.stringify(Platform_SelfRegistration$ReventlessCore.configEntry({
|
|
85
98
|
start: "Registration_SignUp",
|
|
86
99
|
complete: "Registration_CompleteRegistration",
|
|
87
|
-
roles: ["Shopper"]
|
|
88
|
-
|
|
100
|
+
roles: ["Shopper"],
|
|
101
|
+
openRoles: "Registration_RegistrationWindows"
|
|
102
|
+
})[1])).toEqual(`{"start":"Registration_SignUp","complete":"Registration_CompleteRegistration","roles":["Shopper"],"openRoles":"Registration_RegistrationWindows"}`);
|
|
89
103
|
});
|
|
90
104
|
});
|
|
91
105
|
|