@reventlessdev/reventless-registration 1.0.0-alpha.5 → 1.0.0-alpha.51

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 (48) hide show
  1. package/README.md +87 -2
  2. package/conformance/Registration/InboundTranslation/CompleteRegistration_Conformance_GWT.res +65 -0
  3. package/conformance/Registration/InboundTranslation/CompleteRegistration_Conformance_GWT.res.mjs +123 -0
  4. package/conformance/Registration/InboundTranslation/SignUp_Conformance_GWT.res +136 -0
  5. package/conformance/Registration/InboundTranslation/SignUp_Conformance_GWT.res.mjs +212 -0
  6. package/conformance/Registration/OutboundTranslation/CreateRegisteredPrincipal_Conformance_GWT.res +102 -0
  7. package/conformance/Registration/OutboundTranslation/CreateRegisteredPrincipal_Conformance_GWT.res.mjs +179 -0
  8. package/conformance/Registration/OutboundTranslation/SendRegistrationChallenge_Conformance_GWT.res +312 -0
  9. package/conformance/Registration/OutboundTranslation/SendRegistrationChallenge_Conformance_GWT.res.mjs +360 -0
  10. package/conformance/Registration/Registration_Conformance_Examples.res +58 -0
  11. package/conformance/Registration/Registration_Conformance_Examples.res.mjs +106 -0
  12. package/conformance/Registration/StateChange/RegistrationPolicy_Conformance_GWT.res +108 -0
  13. package/conformance/Registration/StateChange/RegistrationPolicy_Conformance_GWT.res.mjs +161 -0
  14. package/conformance/Registration/StateChange/RegistrationsByInvitation_Conformance_GWT.res +155 -0
  15. package/conformance/Registration/StateChange/RegistrationsByInvitation_Conformance_GWT.res.mjs +216 -0
  16. package/conformance/Registration/StateChange/Registrations_Conformance_GWT.res +469 -0
  17. package/conformance/Registration/StateChange/Registrations_Conformance_GWT.res.mjs +512 -0
  18. package/conformance/Registration/StateViewStream/RegistrationWindows_Conformance_GWT.res +33 -0
  19. package/conformance/Registration/StateViewStream/RegistrationWindows_Conformance_GWT.res.mjs +87 -0
  20. package/i18n/en.json +8 -0
  21. package/package.json +10 -6
  22. package/rescript.json +6 -1
  23. package/src/Registration/InboundTranslation/CompleteRegistration.res +2 -2
  24. package/src/Registration/InboundTranslation/CompleteRegistration.res.mjs +3 -3
  25. package/src/Registration/InboundTranslation/CompleteRegistration_Translation.res +1 -1
  26. package/src/Registration/InboundTranslation/CompleteRegistration_Translation.res.mjs +1 -1
  27. package/src/Registration/InboundTranslation/SignUp.res +19 -9
  28. package/src/Registration/InboundTranslation/SignUp.res.mjs +14 -7
  29. package/src/Registration/InboundTranslation/SignUp_Translation.res +32 -7
  30. package/src/Registration/InboundTranslation/SignUp_Translation.res.mjs +41 -8
  31. package/src/Registration/OutboundTranslation/CreateRegisteredPrincipal.res +5 -5
  32. package/src/Registration/OutboundTranslation/CreateRegisteredPrincipal.res.mjs +6 -5
  33. package/src/Registration/OutboundTranslation/CreateRegisteredPrincipal_Translation.res +10 -8
  34. package/src/Registration/OutboundTranslation/CreateRegisteredPrincipal_Translation.res.mjs +18 -10
  35. package/src/Registration/OutboundTranslation/SendRegistrationChallenge.res +24 -13
  36. package/src/Registration/OutboundTranslation/SendRegistrationChallenge.res.mjs +26 -16
  37. package/src/Registration/OutboundTranslation/SendRegistrationChallenge_Translation.res +115 -44
  38. package/src/Registration/OutboundTranslation/SendRegistrationChallenge_Translation.res.mjs +204 -66
  39. package/src/Registration/StateChange/RegistrationPolicy.res +3 -0
  40. package/src/Registration/StateChange/RegistrationPolicy.res.mjs +3 -0
  41. package/src/Registration/StateChange/RegistrationPolicy_Decision.res +6 -5
  42. package/src/Registration/StateChange/RegistrationPolicy_Decision.res.mjs +22 -15
  43. package/src/Registration/StateChange/Registrations.res +67 -41
  44. package/src/Registration/StateChange/Registrations.res.mjs +84 -51
  45. package/src/Registration/StateChange/Registrations_Decision.res +82 -39
  46. package/src/Registration/StateChange/Registrations_Decision.res.mjs +116 -58
  47. package/src/Registration/StateViewStream/RegistrationWindows.res +4 -0
  48. package/src/Registration/StateViewStream/RegistrationWindows.res.mjs +3 -3
@@ -0,0 +1,161 @@
1
+ // Generated by ReScript, PLEASE EDIT WITH CARE
2
+
3
+ import * as Decision_GWT$ReventlessGwt from "@reventlessdev/reventless-gwt/src/Decision_GWT.res.mjs";
4
+ import * as RegistrationPolicy$ReventlessRegistration from "../../../src/Registration/StateChange/RegistrationPolicy.res.mjs";
5
+ import * as RegistrationPolicy_Decision$ReventlessRegistration from "../../../src/Registration/StateChange/RegistrationPolicy_Decision.res.mjs";
6
+ import * as Registration_Conformance_Examples$ReventlessRegistration from "../Registration_Conformance_Examples.res.mjs";
7
+
8
+ function Make(App) {
9
+ let AppPolicy = RegistrationPolicy_Decision$ReventlessRegistration.Make(App);
10
+ let include = Decision_GWT$ReventlessGwt.Make({
11
+ name: RegistrationPolicy$ReventlessRegistration.name,
12
+ consumedEventSchema: RegistrationPolicy$ReventlessRegistration.consumedEventSchema,
13
+ commandSchema: RegistrationPolicy$ReventlessRegistration.commandSchema,
14
+ errorSchema: RegistrationPolicy$ReventlessRegistration.errorSchema,
15
+ eventSchema: RegistrationPolicy$ReventlessRegistration.eventSchema,
16
+ authorizationOf: RegistrationPolicy$ReventlessRegistration.authorizationOf
17
+ })({
18
+ initialState: AppPolicy.initialState,
19
+ evolve: AppPolicy.evolve,
20
+ decide: AppPolicy.decide
21
+ });
22
+ let describe = include.describe;
23
+ let todo = include.todo;
24
+ let test = include.test;
25
+ let givenEvents = include.givenEvents;
26
+ let Caller = include.Caller;
27
+ let asCaller = include.asCaller;
28
+ let whenCmd = include.whenCmd;
29
+ let thenEvent = include.thenEvent;
30
+ let thenNoEvent = include.thenNoEvent;
31
+ let thenError = include.thenError;
32
+ let thenForbidden = include.thenForbidden;
33
+ let needing = needs => ((name, body) => {
34
+ let why = Registration_Conformance_Examples$ReventlessRegistration.unmet(needs);
35
+ if (why !== undefined) {
36
+ return todo(name + ` (` + why + `)`);
37
+ } else {
38
+ return test(name, body);
39
+ }
40
+ });
41
+ let selfServiceRoles = Registration_Conformance_Examples$ReventlessRegistration.selfService(App.table);
42
+ let otherRoles = Registration_Conformance_Examples$ReventlessRegistration.notSelfService(App.table);
43
+ let role = Registration_Conformance_Examples$ReventlessRegistration.first(selfServiceRoles);
44
+ let other = Registration_Conformance_Examples$ReventlessRegistration.first(otherRoles);
45
+ let until = "2026-10-31T00:00:00.000Z";
46
+ describe("RegistrationPolicy StateChangeSlice", () => {
47
+ let test = needing([Registration_Conformance_Examples$ReventlessRegistration.has(selfServiceRoles, "self-service")]);
48
+ test("opening a role nothing is recorded about records it", () => thenEvent(whenCmd(givenEvents([]), {
49
+ TAG: "OpenRegistration",
50
+ role: role
51
+ }), {
52
+ TAG: "RegistrationOpened",
53
+ role: role
54
+ }));
55
+ test("closing a role nothing is recorded about records it", () => thenEvent(whenCmd(givenEvents([]), {
56
+ TAG: "CloseRegistration",
57
+ role: role
58
+ }), {
59
+ TAG: "RegistrationClosed",
60
+ role: role
61
+ }));
62
+ test("an open window carries its end", () => thenEvent(whenCmd(givenEvents([]), {
63
+ TAG: "OpenRegistration",
64
+ role: role,
65
+ until: until
66
+ }), {
67
+ TAG: "RegistrationOpened",
68
+ role: role,
69
+ until: until
70
+ }));
71
+ test("opening an open role again records nothing", () => thenNoEvent(whenCmd(givenEvents([{
72
+ TAG: "RegistrationOpened",
73
+ role: role
74
+ }]), {
75
+ TAG: "OpenRegistration",
76
+ role: role
77
+ })));
78
+ test("giving an open role an end records it", () => thenEvent(whenCmd(givenEvents([{
79
+ TAG: "RegistrationOpened",
80
+ role: role
81
+ }]), {
82
+ TAG: "OpenRegistration",
83
+ role: role,
84
+ until: until
85
+ }), {
86
+ TAG: "RegistrationOpened",
87
+ role: role,
88
+ until: until
89
+ }));
90
+ test("closing an open role records it", () => thenEvent(whenCmd(givenEvents([]), {
91
+ TAG: "CloseRegistration",
92
+ role: role
93
+ }), {
94
+ TAG: "RegistrationClosed",
95
+ role: role
96
+ }));
97
+ test("closing a closed role records nothing", () => thenNoEvent(whenCmd(givenEvents([{
98
+ TAG: "RegistrationClosed",
99
+ role: role
100
+ }]), {
101
+ TAG: "CloseRegistration",
102
+ role: role
103
+ })));
104
+ test("a closed role is opened again", () => thenEvent(whenCmd(givenEvents([{
105
+ TAG: "RegistrationClosed",
106
+ role: role
107
+ }]), {
108
+ TAG: "OpenRegistration",
109
+ role: role
110
+ }), {
111
+ TAG: "RegistrationOpened",
112
+ role: role
113
+ }));
114
+ test("only an administrator closes registration", () => thenForbidden(whenCmd(asCaller(givenEvents([]), Caller.inRoles([])), {
115
+ TAG: "CloseRegistration",
116
+ role: role
117
+ })));
118
+ let test$1 = needing([Registration_Conformance_Examples$ReventlessRegistration.has(otherRoles, "non-self-service")]);
119
+ test$1("a role not declared self-service cannot be opened", () => thenError(whenCmd(givenEvents([]), {
120
+ TAG: "OpenRegistration",
121
+ role: other
122
+ }), {
123
+ TAG: "NotSelfService",
124
+ role: other
125
+ }));
126
+ });
127
+ return {
128
+ Policy: undefined,
129
+ AppPolicy: AppPolicy,
130
+ Spec: include.Spec,
131
+ describe: describe,
132
+ todo: todo,
133
+ test: test,
134
+ givenEvents: givenEvents,
135
+ Caller: Caller,
136
+ asCaller: asCaller,
137
+ whenCmd: whenCmd,
138
+ whenCmdSent: include.whenCmdSent,
139
+ thenEvent: thenEvent,
140
+ thenEvents: include.thenEvents,
141
+ thenNoEvent: thenNoEvent,
142
+ thenEventWithError: include.thenEventWithError,
143
+ thenEventsWithError: include.thenEventsWithError,
144
+ thenError: thenError,
145
+ thenForbidden: thenForbidden,
146
+ thenRefusedBy: include.thenRefusedBy,
147
+ thenAppendsConditionedOn: include.thenAppendsConditionedOn,
148
+ thenAppendsConditionedOnExactly: include.thenAppendsConditionedOnExactly,
149
+ needing: needing,
150
+ selfServiceRoles: selfServiceRoles,
151
+ otherRoles: otherRoles,
152
+ role: role,
153
+ other: other,
154
+ until: until
155
+ };
156
+ }
157
+
158
+ export {
159
+ Make,
160
+ }
161
+ /* Decision_GWT-ReventlessGwt Not a pure module */
@@ -0,0 +1,155 @@
1
+ // The ledger's invitation rules, for a table that declares a role by invitation. An invitation
2
+ // claims the address as a sign-up does, holds for a week rather than a day, and settles through
3
+ // the same proof into every role it names. Under a table with no such role, each is listed.
4
+
5
+ module Make = (App: Reventless.Admission.Declaration) => {
6
+ module Ledger = Registrations
7
+ module AppLedger = Registrations_Decision.Make(App)
8
+ open Ledger
9
+ include ReventlessGwt.Decision_GWT.Make(Ledger, AppLedger)
10
+ open Registration_Conformance_Examples
11
+
12
+ let needing = needs =>
13
+ (name, body) =>
14
+ switch unmet(needs) {
15
+ | None => test(name, body)
16
+ | Some(why) => todo(`${name} (${why})`)
17
+ }
18
+
19
+ let invitedRoles = byInvitation(App.table)
20
+ let selfServiceRoles = selfService(App.table)
21
+ let aRoleByInvitation = has(invitedRoles, ~kind="by-invitation")
22
+ let aSelfServiceRole = has(selfServiceRoles, ~kind="self-service")
23
+
24
+ let emailId = alice
25
+ let email = aliceMail
26
+ let staff = invitedRoles
27
+ let staffNames = staff->Array.map(nameOf)
28
+ let signUpRole = first(selfServiceRoles)
29
+ let invitedBy = "u_admin"
30
+ let invitedAt = "2026-10-24T09:00:00.000Z"
31
+ let issuedAt = "2026-10-24T09:00:05.000Z"
32
+ let threeDaysOn = "2026-10-27T09:00:00.000Z"
33
+ let eightDaysOn = "2026-11-01T09:00:00.000Z"
34
+
35
+ let invite = (~roles=staff, ~at=invitedAt) => Invite({
36
+ emailId,
37
+ email,
38
+ roles,
39
+ invitedBy,
40
+ requestedAt: at,
41
+ })
42
+ let invited: array<consumedEvent> = [
43
+ RegistrationInvited({emailId, email: personal, roles: staffNames, invitedBy, invitedAt}),
44
+ ]
45
+ let challenged: array<consumedEvent> =
46
+ invited->Array.concat([RegistrationChallengeIssued({emailId, proofHash: secretHash, issuedAt})])
47
+ let submit = (~at) => SubmitRegistrationProof({emailId, proofHash: secretHash, presentedAt: at})
48
+
49
+ describe("Registrations StateChangeSlice, by invitation", () => {
50
+ let test = needing([aRoleByInvitation])
51
+
52
+ // scenario-id: b076201a-bbe1-436f-9c4e-fbc637e1f0ce
53
+ test("an invitation claims the address as every role it names", () =>
54
+ givenEvents([])
55
+ ->whenCmd(invite())
56
+ ->thenEvent(
57
+ RegistrationInvited({emailId, email: personal, roles: staffNames, invitedBy, invitedAt}),
58
+ )
59
+ )
60
+
61
+ // scenario-id: 7f944f2b-8b8a-4e14-9f01-97b702860719
62
+ test("an invitation granting nothing is refused", () =>
63
+ givenEvents([])->whenCmd(invite(~roles=[]))->thenError(NoRoleToGrant)
64
+ )
65
+
66
+ // The completion door is the one a sign-up ends at, unchanged.
67
+ // scenario-id: e1b9ec91-240c-43c7-a6e6-20719d977adc
68
+ test("the proof settles an invitation into every role it names", () =>
69
+ givenEvents(challenged)
70
+ ->whenCmd(submit(~at=threeDaysOn))
71
+ ->thenEvent(
72
+ RegistrationProofAccepted({
73
+ emailId,
74
+ email: personal,
75
+ roles: staffNames,
76
+ proofHash: secretHash,
77
+ }),
78
+ )
79
+ )
80
+
81
+ // A sign-up's code would have lapsed after a day.
82
+ // scenario-id: 72245b53-6ec2-49a3-9666-f7e74c2643b9
83
+ test("an invitation's code holds past a week only", () =>
84
+ givenEvents(challenged)
85
+ ->whenCmd(submit(~at=eightDaysOn))
86
+ ->thenEvent(RegistrationProofRefused({emailId, reason: "ChallengeExpired"}))
87
+ )
88
+
89
+ // scenario-id: 3bfd123b-3031-497d-bdf3-cd360858d7ea
90
+ test("an address that holds an account is not invited", () =>
91
+ givenEvents(
92
+ challenged->Array.concat([
93
+ RegistrationProofAccepted({
94
+ emailId,
95
+ email: personal,
96
+ roles: staffNames,
97
+ proofHash: secretHash,
98
+ }),
99
+ RegistrationCompleted({emailId: emailId}),
100
+ ]),
101
+ )
102
+ ->whenCmd(invite(~at=threeDaysOn))
103
+ ->thenNoEvent
104
+ )
105
+
106
+ // scenario-id: f17c5083-9bf0-45d1-b5ad-2a149609adf5
107
+ test("a lapsed invitation is replaced by a new one", () =>
108
+ givenEvents(challenged)
109
+ ->whenCmd(invite(~at=eightDaysOn))
110
+ ->thenEvents([
111
+ RegistrationExpired({emailId: emailId}),
112
+ RegistrationInvited({
113
+ emailId,
114
+ email: personal,
115
+ roles: staffNames,
116
+ invitedBy,
117
+ invitedAt: eightDaysOn,
118
+ }),
119
+ ])
120
+ )
121
+
122
+ // So the sender words the new code as an invitation too.
123
+ // scenario-id: d5ea232a-05e3-49b0-ae8f-c4bcdcf8dc9d
124
+ test("a reissued invitation's code says who invited", () =>
125
+ givenEvents(challenged)
126
+ ->whenCmd(ReissueRegistrationChallenge({emailId, requestedAt: threeDaysOn}))
127
+ ->thenEvent(
128
+ RegistrationChallengeReissued({
129
+ emailId,
130
+ email: personal,
131
+ reissuedAt: threeDaysOn,
132
+ invitedBy,
133
+ }),
134
+ )
135
+ )
136
+
137
+ let test = needing([aRoleByInvitation, aSelfServiceRole])
138
+
139
+ // The table is the hard cap: a self-service role is signed up for, not invited to.
140
+ // scenario-id: 5d82241b-05c9-4a9a-9f03-a463e53eae61
141
+ test("an invitation naming a role not by invitation is refused, naming it", () =>
142
+ givenEvents([])
143
+ ->whenCmd(invite(~roles=staff->Array.concat([signUpRole])))
144
+ ->thenError(NotByInvitation({role: nameOf(signUpRole)}))
145
+ )
146
+
147
+ // 🚨 A visitor cannot take over an address someone was invited at.
148
+ // scenario-id: 63dcf831-9b27-4ca7-9561-01825ec7cebc
149
+ test("a sign-up for an invited address records nothing while the invitation holds", () =>
150
+ givenEvents(challenged)
151
+ ->whenCmd(Register({emailId, email, role: signUpRole, requestedAt: threeDaysOn}))
152
+ ->thenNoEvent
153
+ )
154
+ })
155
+ }
@@ -0,0 +1,216 @@
1
+ // Generated by ReScript, PLEASE EDIT WITH CARE
2
+
3
+ import * as Decision_GWT$ReventlessGwt from "@reventlessdev/reventless-gwt/src/Decision_GWT.res.mjs";
4
+ import * as Registrations$ReventlessRegistration from "../../../src/Registration/StateChange/Registrations.res.mjs";
5
+ import * as Registrations_Decision$ReventlessRegistration from "../../../src/Registration/StateChange/Registrations_Decision.res.mjs";
6
+ import * as Registration_Conformance_Examples$ReventlessRegistration from "../Registration_Conformance_Examples.res.mjs";
7
+
8
+ function Make(App) {
9
+ let AppLedger = Registrations_Decision$ReventlessRegistration.Make(App);
10
+ let include = Decision_GWT$ReventlessGwt.Make({
11
+ name: Registrations$ReventlessRegistration.name,
12
+ consumedEventSchema: Registrations$ReventlessRegistration.consumedEventSchema,
13
+ commandSchema: Registrations$ReventlessRegistration.commandSchema,
14
+ errorSchema: Registrations$ReventlessRegistration.errorSchema,
15
+ eventSchema: Registrations$ReventlessRegistration.eventSchema,
16
+ authorizationOf: Registrations$ReventlessRegistration.authorizationOf
17
+ })({
18
+ initialState: AppLedger.initialState,
19
+ evolve: AppLedger.evolve,
20
+ decide: AppLedger.decide
21
+ });
22
+ let describe = include.describe;
23
+ let todo = include.todo;
24
+ let test = include.test;
25
+ let givenEvents = include.givenEvents;
26
+ let whenCmd = include.whenCmd;
27
+ let thenEvent = include.thenEvent;
28
+ let thenEvents = include.thenEvents;
29
+ let thenNoEvent = include.thenNoEvent;
30
+ let thenError = include.thenError;
31
+ let needing = needs => ((name, body) => {
32
+ let why = Registration_Conformance_Examples$ReventlessRegistration.unmet(needs);
33
+ if (why !== undefined) {
34
+ return todo(name + ` (` + why + `)`);
35
+ } else {
36
+ return test(name, body);
37
+ }
38
+ });
39
+ let invitedRoles = Registration_Conformance_Examples$ReventlessRegistration.byInvitation(App.table);
40
+ let selfServiceRoles = Registration_Conformance_Examples$ReventlessRegistration.selfService(App.table);
41
+ let aRoleByInvitation = Registration_Conformance_Examples$ReventlessRegistration.has(invitedRoles, "by-invitation");
42
+ let aSelfServiceRole = Registration_Conformance_Examples$ReventlessRegistration.has(selfServiceRoles, "self-service");
43
+ let staffNames = invitedRoles.map(Registration_Conformance_Examples$ReventlessRegistration.nameOf);
44
+ let signUpRole = Registration_Conformance_Examples$ReventlessRegistration.first(selfServiceRoles);
45
+ let invitedBy = "u_admin";
46
+ let invitedAt = "2026-10-24T09:00:00.000Z";
47
+ let issuedAt = "2026-10-24T09:00:05.000Z";
48
+ let threeDaysOn = "2026-10-27T09:00:00.000Z";
49
+ let eightDaysOn = "2026-11-01T09:00:00.000Z";
50
+ let invite = (rolesOpt, atOpt) => {
51
+ let roles = rolesOpt !== undefined ? rolesOpt : invitedRoles;
52
+ let at = atOpt !== undefined ? atOpt : invitedAt;
53
+ return {
54
+ TAG: "Invite",
55
+ emailId: Registration_Conformance_Examples$ReventlessRegistration.alice,
56
+ email: Registration_Conformance_Examples$ReventlessRegistration.aliceMail,
57
+ roles: roles,
58
+ invitedBy: invitedBy,
59
+ requestedAt: at
60
+ };
61
+ };
62
+ let invited = [{
63
+ TAG: "RegistrationInvited",
64
+ emailId: Registration_Conformance_Examples$ReventlessRegistration.alice,
65
+ email: Registration_Conformance_Examples$ReventlessRegistration.personal,
66
+ roles: staffNames,
67
+ invitedBy: invitedBy,
68
+ invitedAt: invitedAt
69
+ }];
70
+ let challenged = invited.concat([{
71
+ TAG: "RegistrationChallengeIssued",
72
+ emailId: Registration_Conformance_Examples$ReventlessRegistration.alice,
73
+ proofHash: Registration_Conformance_Examples$ReventlessRegistration.secretHash,
74
+ issuedAt: issuedAt
75
+ }]);
76
+ let submit = at => ({
77
+ TAG: "SubmitRegistrationProof",
78
+ emailId: Registration_Conformance_Examples$ReventlessRegistration.alice,
79
+ proofHash: Registration_Conformance_Examples$ReventlessRegistration.secretHash,
80
+ presentedAt: at
81
+ });
82
+ describe("Registrations StateChangeSlice, by invitation", () => {
83
+ let test = needing([aRoleByInvitation]);
84
+ test("an invitation claims the address as every role it names", () => thenEvent(whenCmd(givenEvents([]), invite(undefined, undefined)), {
85
+ TAG: "RegistrationInvited",
86
+ emailId: Registration_Conformance_Examples$ReventlessRegistration.alice,
87
+ email: Registration_Conformance_Examples$ReventlessRegistration.personal,
88
+ roles: staffNames,
89
+ invitedBy: invitedBy,
90
+ invitedAt: invitedAt
91
+ }));
92
+ test("an invitation granting nothing is refused", () => thenError(whenCmd(givenEvents([]), invite([], undefined)), "NoRoleToGrant"));
93
+ test("the proof settles an invitation into every role it names", () => thenEvent(whenCmd(givenEvents(challenged), {
94
+ TAG: "SubmitRegistrationProof",
95
+ emailId: Registration_Conformance_Examples$ReventlessRegistration.alice,
96
+ proofHash: Registration_Conformance_Examples$ReventlessRegistration.secretHash,
97
+ presentedAt: threeDaysOn
98
+ }), {
99
+ TAG: "RegistrationProofAccepted",
100
+ emailId: Registration_Conformance_Examples$ReventlessRegistration.alice,
101
+ email: Registration_Conformance_Examples$ReventlessRegistration.personal,
102
+ roles: staffNames,
103
+ proofHash: Registration_Conformance_Examples$ReventlessRegistration.secretHash
104
+ }));
105
+ test("an invitation's code holds past a week only", () => thenEvent(whenCmd(givenEvents(challenged), {
106
+ TAG: "SubmitRegistrationProof",
107
+ emailId: Registration_Conformance_Examples$ReventlessRegistration.alice,
108
+ proofHash: Registration_Conformance_Examples$ReventlessRegistration.secretHash,
109
+ presentedAt: eightDaysOn
110
+ }), {
111
+ TAG: "RegistrationProofRefused",
112
+ emailId: Registration_Conformance_Examples$ReventlessRegistration.alice,
113
+ reason: "ChallengeExpired"
114
+ }));
115
+ test("an address that holds an account is not invited", () => thenNoEvent(whenCmd(givenEvents(challenged.concat([
116
+ {
117
+ TAG: "RegistrationProofAccepted",
118
+ emailId: Registration_Conformance_Examples$ReventlessRegistration.alice,
119
+ email: Registration_Conformance_Examples$ReventlessRegistration.personal,
120
+ roles: staffNames,
121
+ proofHash: Registration_Conformance_Examples$ReventlessRegistration.secretHash
122
+ },
123
+ {
124
+ TAG: "RegistrationCompleted",
125
+ emailId: Registration_Conformance_Examples$ReventlessRegistration.alice
126
+ }
127
+ ])), invite(undefined, threeDaysOn))));
128
+ test("a lapsed invitation is replaced by a new one", () => thenEvents(whenCmd(givenEvents(challenged), invite(undefined, eightDaysOn)), [
129
+ {
130
+ TAG: "RegistrationExpired",
131
+ emailId: Registration_Conformance_Examples$ReventlessRegistration.alice
132
+ },
133
+ {
134
+ TAG: "RegistrationInvited",
135
+ emailId: Registration_Conformance_Examples$ReventlessRegistration.alice,
136
+ email: Registration_Conformance_Examples$ReventlessRegistration.personal,
137
+ roles: staffNames,
138
+ invitedBy: invitedBy,
139
+ invitedAt: eightDaysOn
140
+ }
141
+ ]));
142
+ test("a reissued invitation's code says who invited", () => thenEvent(whenCmd(givenEvents(challenged), {
143
+ TAG: "ReissueRegistrationChallenge",
144
+ emailId: Registration_Conformance_Examples$ReventlessRegistration.alice,
145
+ requestedAt: threeDaysOn
146
+ }), {
147
+ TAG: "RegistrationChallengeReissued",
148
+ emailId: Registration_Conformance_Examples$ReventlessRegistration.alice,
149
+ email: Registration_Conformance_Examples$ReventlessRegistration.personal,
150
+ reissuedAt: threeDaysOn,
151
+ invitedBy: invitedBy
152
+ }));
153
+ let test$1 = needing([
154
+ aRoleByInvitation,
155
+ aSelfServiceRole
156
+ ]);
157
+ test$1("an invitation naming a role not by invitation is refused, naming it", () => thenError(whenCmd(givenEvents([]), invite(invitedRoles.concat([signUpRole]), undefined)), {
158
+ TAG: "NotByInvitation",
159
+ role: Registration_Conformance_Examples$ReventlessRegistration.nameOf(signUpRole)
160
+ }));
161
+ test$1("a sign-up for an invited address records nothing while the invitation holds", () => thenNoEvent(whenCmd(givenEvents(challenged), {
162
+ TAG: "Register",
163
+ emailId: Registration_Conformance_Examples$ReventlessRegistration.alice,
164
+ email: Registration_Conformance_Examples$ReventlessRegistration.aliceMail,
165
+ role: signUpRole,
166
+ requestedAt: threeDaysOn
167
+ })));
168
+ });
169
+ return {
170
+ Ledger: undefined,
171
+ AppLedger: AppLedger,
172
+ Spec: include.Spec,
173
+ describe: describe,
174
+ todo: todo,
175
+ test: test,
176
+ givenEvents: givenEvents,
177
+ Caller: include.Caller,
178
+ asCaller: include.asCaller,
179
+ whenCmd: whenCmd,
180
+ whenCmdSent: include.whenCmdSent,
181
+ thenEvent: thenEvent,
182
+ thenEvents: thenEvents,
183
+ thenNoEvent: thenNoEvent,
184
+ thenEventWithError: include.thenEventWithError,
185
+ thenEventsWithError: include.thenEventsWithError,
186
+ thenError: thenError,
187
+ thenForbidden: include.thenForbidden,
188
+ thenRefusedBy: include.thenRefusedBy,
189
+ thenAppendsConditionedOn: include.thenAppendsConditionedOn,
190
+ thenAppendsConditionedOnExactly: include.thenAppendsConditionedOnExactly,
191
+ needing: needing,
192
+ invitedRoles: invitedRoles,
193
+ selfServiceRoles: selfServiceRoles,
194
+ aRoleByInvitation: aRoleByInvitation,
195
+ aSelfServiceRole: aSelfServiceRole,
196
+ emailId: Registration_Conformance_Examples$ReventlessRegistration.alice,
197
+ email: Registration_Conformance_Examples$ReventlessRegistration.aliceMail,
198
+ staff: invitedRoles,
199
+ staffNames: staffNames,
200
+ signUpRole: signUpRole,
201
+ invitedBy: invitedBy,
202
+ invitedAt: invitedAt,
203
+ issuedAt: issuedAt,
204
+ threeDaysOn: threeDaysOn,
205
+ eightDaysOn: eightDaysOn,
206
+ invite: invite,
207
+ invited: invited,
208
+ challenged: challenged,
209
+ submit: submit
210
+ };
211
+ }
212
+
213
+ export {
214
+ Make,
215
+ }
216
+ /* Decision_GWT-ReventlessGwt Not a pure module */