@reventlessdev/reventless-registration 1.0.0-alpha.11 → 1.0.0-alpha.13
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@reventlessdev/reventless-registration",
|
|
3
|
-
"version": "1.0.0-alpha.
|
|
3
|
+
"version": "1.0.0-alpha.13",
|
|
4
4
|
"description": "Self-registration as a library of slices: a person with no account proves control of an address and ends up with one, admitted per role as the app declares",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"files": [
|
|
@@ -13,9 +13,9 @@
|
|
|
13
13
|
"dependencies": {
|
|
14
14
|
"sury": "11.0.0",
|
|
15
15
|
"sury-ppx": "11.0.0",
|
|
16
|
-
"@reventlessdev/reventless-infra": "3.0.0-alpha.
|
|
17
|
-
"@reventlessdev/reventless-spec": "3.0.0-alpha.
|
|
18
|
-
"@reventlessdev/reventless-ppx": "1.0.0-alpha.
|
|
16
|
+
"@reventlessdev/reventless-infra": "3.0.0-alpha.216",
|
|
17
|
+
"@reventlessdev/reventless-spec": "3.0.0-alpha.187",
|
|
18
|
+
"@reventlessdev/reventless-ppx": "1.0.0-alpha.109"
|
|
19
19
|
},
|
|
20
20
|
"devDependencies": {
|
|
21
21
|
"rescript": "12.3.1"
|
|
@@ -78,6 +78,7 @@ type consumedEvent =
|
|
|
78
78
|
})
|
|
79
79
|
| RegistrationProofRefused({email: ContactAddressId.t, reason: string})
|
|
80
80
|
| RegistrationCompleted({email: ContactAddressId.t})
|
|
81
|
+
| RegistrationReleased({email: ContactAddressId.t, releasedAt: Reventless.DateTime.t})
|
|
81
82
|
|
|
82
83
|
// `Register` names the role asked for, and the policy is read by it. The
|
|
83
84
|
// registration records the roles it grants as
|
|
@@ -130,6 +131,9 @@ type command =
|
|
|
130
131
|
})
|
|
131
132
|
// Releases an address a registration holds and nobody has proved yet.
|
|
132
133
|
| @noApi WithdrawRegistration({email: ContactAddressId.t, withdrawnAt: Reventless.DateTime.t})
|
|
134
|
+
// Releases the address of an account that was erased, so its person may
|
|
135
|
+
// register again. Only the erasure workflow sends it, after the account is gone.
|
|
136
|
+
| @noApi ReleaseRegistration({email: ContactAddressId.t, releasedAt: Reventless.DateTime.t})
|
|
133
137
|
|
|
134
138
|
// Every outcome of a command relayed for an anonymous caller is a recorded fact
|
|
135
139
|
// or a quiet no-op, never an error: an error is the one answer a caller could
|
|
@@ -181,3 +185,4 @@ type event =
|
|
|
181
185
|
})
|
|
182
186
|
| RegistrationProofRefused({email: ContactAddressId.t, reason: string})
|
|
183
187
|
| RegistrationCompleted({email: ContactAddressId.t})
|
|
188
|
+
| RegistrationReleased({email: ContactAddressId.t, releasedAt: Reventless.DateTime.t})
|
|
@@ -77,6 +77,11 @@ let consumedEventSchema = Sury.union([
|
|
|
77
77
|
Sury.$schema(s => ({
|
|
78
78
|
TAG: "RegistrationCompleted",
|
|
79
79
|
email: s.m(DcbTag$Reventless.mark(ContactAddressId$ReventlessRegistration.schema))
|
|
80
|
+
})),
|
|
81
|
+
Sury.$schema(s => ({
|
|
82
|
+
TAG: "RegistrationReleased",
|
|
83
|
+
email: s.m(DcbTag$Reventless.mark(ContactAddressId$ReventlessRegistration.schema)),
|
|
84
|
+
releasedAt: s.m(DateTime$Reventless.schema)
|
|
80
85
|
}))
|
|
81
86
|
]);
|
|
82
87
|
|
|
@@ -121,6 +126,11 @@ let commandSchema = Sury.union([
|
|
|
121
126
|
TAG: "WithdrawRegistration",
|
|
122
127
|
email: s.m(DcbTag$Reventless.mark(ContactAddressId$ReventlessRegistration.schema)),
|
|
123
128
|
withdrawnAt: s.m(DateTime$Reventless.schema)
|
|
129
|
+
})),
|
|
130
|
+
Sury.$schema(s => ({
|
|
131
|
+
TAG: "ReleaseRegistration",
|
|
132
|
+
email: s.m(DcbTag$Reventless.mark(ContactAddressId$ReventlessRegistration.schema)),
|
|
133
|
+
releasedAt: s.m(DateTime$Reventless.schema)
|
|
124
134
|
}))
|
|
125
135
|
]);
|
|
126
136
|
|
|
@@ -191,6 +201,11 @@ let eventSchema = Sury.union([
|
|
|
191
201
|
Sury.$schema(s => ({
|
|
192
202
|
TAG: "RegistrationCompleted",
|
|
193
203
|
email: s.m(DcbTag$Reventless.mark(ContactAddressId$ReventlessRegistration.schema))
|
|
204
|
+
})),
|
|
205
|
+
Sury.$schema(s => ({
|
|
206
|
+
TAG: "RegistrationReleased",
|
|
207
|
+
email: s.m(DcbTag$Reventless.mark(ContactAddressId$ReventlessRegistration.schema)),
|
|
208
|
+
releasedAt: s.m(DateTime$Reventless.schema)
|
|
194
209
|
}))
|
|
195
210
|
]);
|
|
196
211
|
|
|
@@ -201,7 +216,8 @@ let commandSchema$1 = Api$ReventlessInfra.markNoApiVariants(commandSchema, [
|
|
|
201
216
|
"RecordRegistrationCompleted",
|
|
202
217
|
"Invite",
|
|
203
218
|
"ReissueRegistrationChallenge",
|
|
204
|
-
"WithdrawRegistration"
|
|
219
|
+
"WithdrawRegistration",
|
|
220
|
+
"ReleaseRegistration"
|
|
205
221
|
]);
|
|
206
222
|
|
|
207
223
|
function authorizationOf(param) {
|
|
@@ -128,6 +128,9 @@ let evolve = (state, event) =>
|
|
|
128
128
|
}
|
|
129
129
|
| RegistrationProofAccepted(_) => {...state, stage: Verified}
|
|
130
130
|
| RegistrationCompleted(_) => {...state, stage: Completed}
|
|
131
|
+
// The account was erased: the address is nobody's, and nobody was told of an
|
|
132
|
+
// attempt on it.
|
|
133
|
+
| RegistrationReleased(_) => {...state, stage: Unclaimed, lastNoticeAt: None}
|
|
131
134
|
}
|
|
132
135
|
|
|
133
136
|
/** Whether the policy admits a registration for `role` that arrived at `at`.
|
|
@@ -302,6 +305,14 @@ module Make = (App: Reventless.Admission.Declaration) => {
|
|
|
302
305
|
| Unclaimed | Verified | Completed => Ok([])
|
|
303
306
|
}
|
|
304
307
|
|
|
308
|
+
// Only an account: a claim nobody proved is withdrawn, and one being turned
|
|
309
|
+
// into an account is released once the account exists and is erased.
|
|
310
|
+
| ReleaseRegistration({email, releasedAt}) =>
|
|
311
|
+
switch state.stage {
|
|
312
|
+
| Completed => Ok([RegistrationReleased({email, releasedAt})])
|
|
313
|
+
| Unclaimed | Pending(_) | Verified => Ok([])
|
|
314
|
+
}
|
|
315
|
+
|
|
305
316
|
| RecordRegistrationCompleted({email}) =>
|
|
306
317
|
switch state.stage {
|
|
307
318
|
| Verified => Ok([RegistrationCompleted({email: email})])
|
|
@@ -165,6 +165,12 @@ function evolve(state, event) {
|
|
|
165
165
|
stage: "Completed",
|
|
166
166
|
lastNoticeAt: state.lastNoticeAt
|
|
167
167
|
};
|
|
168
|
+
case "RegistrationReleased" :
|
|
169
|
+
return {
|
|
170
|
+
admission: state.admission,
|
|
171
|
+
stage: "Unclaimed",
|
|
172
|
+
lastNoticeAt: undefined
|
|
173
|
+
};
|
|
168
174
|
}
|
|
169
175
|
}
|
|
170
176
|
|
|
@@ -519,6 +525,30 @@ function Make(App) {
|
|
|
519
525
|
}]
|
|
520
526
|
};
|
|
521
527
|
}
|
|
528
|
+
case "ReleaseRegistration" :
|
|
529
|
+
let match$3 = state.stage;
|
|
530
|
+
if (typeof match$3 !== "object") {
|
|
531
|
+
if (match$3 === "Completed") {
|
|
532
|
+
return {
|
|
533
|
+
TAG: "Ok",
|
|
534
|
+
_0: [{
|
|
535
|
+
TAG: "RegistrationReleased",
|
|
536
|
+
email: command.email,
|
|
537
|
+
releasedAt: command.releasedAt
|
|
538
|
+
}]
|
|
539
|
+
};
|
|
540
|
+
} else {
|
|
541
|
+
return {
|
|
542
|
+
TAG: "Ok",
|
|
543
|
+
_0: []
|
|
544
|
+
};
|
|
545
|
+
}
|
|
546
|
+
} else {
|
|
547
|
+
return {
|
|
548
|
+
TAG: "Ok",
|
|
549
|
+
_0: []
|
|
550
|
+
};
|
|
551
|
+
}
|
|
522
552
|
}
|
|
523
553
|
};
|
|
524
554
|
return {
|