@reventlessdev/reventless-registration 1.0.0-alpha.3 → 1.0.0-alpha.31
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/README.md +10 -0
- package/i18n/en.json +8 -0
- package/package.json +7 -6
- package/src/Registration/ContactAddressId.res +27 -3
- package/src/Registration/ContactAddressId.res.mjs +26 -2
- package/src/Registration/InboundTranslation/CompleteRegistration.res +2 -2
- package/src/Registration/InboundTranslation/CompleteRegistration.res.mjs +3 -3
- package/src/Registration/InboundTranslation/CompleteRegistration_Translation.res +9 -6
- package/src/Registration/InboundTranslation/CompleteRegistration_Translation.res.mjs +16 -9
- package/src/Registration/InboundTranslation/SignUp.res +6 -3
- package/src/Registration/InboundTranslation/SignUp.res.mjs +11 -5
- package/src/Registration/InboundTranslation/SignUp_Translation.res +34 -13
- package/src/Registration/InboundTranslation/SignUp_Translation.res.mjs +26 -5
- package/src/Registration/OutboundTranslation/CreateRegisteredPrincipal.res +9 -3
- package/src/Registration/OutboundTranslation/CreateRegisteredPrincipal.res.mjs +7 -3
- package/src/Registration/OutboundTranslation/CreateRegisteredPrincipal_Translation.res +10 -7
- package/src/Registration/OutboundTranslation/CreateRegisteredPrincipal_Translation.res.mjs +17 -8
- package/src/Registration/OutboundTranslation/SendRegistrationChallenge.res +36 -7
- package/src/Registration/OutboundTranslation/SendRegistrationChallenge.res.mjs +24 -11
- package/src/Registration/OutboundTranslation/SendRegistrationChallenge_Translation.res +115 -44
- package/src/Registration/OutboundTranslation/SendRegistrationChallenge_Translation.res.mjs +203 -61
- package/src/Registration/StateChange/Registrations.res +76 -27
- package/src/Registration/StateChange/Registrations.res.mjs +83 -39
- package/src/Registration/StateChange/Registrations_Decision.res +74 -26
- package/src/Registration/StateChange/Registrations_Decision.res.mjs +106 -47
- package/src/Registration/StateViewStream/RegistrationWindows.res.mjs +1 -1
|
@@ -14,6 +14,13 @@ let initialState = {
|
|
|
14
14
|
lastNoticeAt: undefined
|
|
15
15
|
};
|
|
16
16
|
|
|
17
|
+
function contactOf(emailId) {
|
|
18
|
+
return {
|
|
19
|
+
TAG: "ByEmail",
|
|
20
|
+
_0: ContactAddressId$ReventlessRegistration.toString(emailId)
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
|
|
17
24
|
function purposeOf(p) {
|
|
18
25
|
return RegistrationChallenge$ReventlessRegistration.purposeOf(p.invitedBy);
|
|
19
26
|
}
|
|
@@ -45,8 +52,10 @@ function evolve(state, event) {
|
|
|
45
52
|
stage: {
|
|
46
53
|
TAG: "Pending",
|
|
47
54
|
_0: {
|
|
55
|
+
email: event.email,
|
|
48
56
|
requestedAt: event.requestedAt,
|
|
49
57
|
roles: event.roles,
|
|
58
|
+
language: event.language,
|
|
50
59
|
challenge: undefined,
|
|
51
60
|
proofHash: undefined
|
|
52
61
|
}
|
|
@@ -59,9 +68,11 @@ function evolve(state, event) {
|
|
|
59
68
|
stage: {
|
|
60
69
|
TAG: "Pending",
|
|
61
70
|
_0: {
|
|
71
|
+
email: event.email,
|
|
62
72
|
requestedAt: event.invitedAt,
|
|
63
73
|
roles: event.roles,
|
|
64
74
|
invitedBy: event.invitedBy,
|
|
75
|
+
language: event.language,
|
|
65
76
|
challenge: undefined,
|
|
66
77
|
proofHash: undefined
|
|
67
78
|
}
|
|
@@ -109,7 +120,7 @@ function evolve(state, event) {
|
|
|
109
120
|
_0: (newrecord$1.proofHash = event.proofHash, newrecord$1.challenge = {
|
|
110
121
|
contact: {
|
|
111
122
|
TAG: "ByEmail",
|
|
112
|
-
_0: ContactAddressId$ReventlessRegistration.toString(event.
|
|
123
|
+
_0: ContactAddressId$ReventlessRegistration.toString(event.emailId)
|
|
113
124
|
},
|
|
114
125
|
purpose: RegistrationChallenge$ReventlessRegistration.purposeOf(p$2.invitedBy),
|
|
115
126
|
issuedAt: event.issuedAt,
|
|
@@ -156,6 +167,12 @@ function evolve(state, event) {
|
|
|
156
167
|
stage: "Completed",
|
|
157
168
|
lastNoticeAt: state.lastNoticeAt
|
|
158
169
|
};
|
|
170
|
+
case "RegistrationReleased" :
|
|
171
|
+
return {
|
|
172
|
+
admission: state.admission,
|
|
173
|
+
stage: "Unclaimed",
|
|
174
|
+
lastNoticeAt: undefined
|
|
175
|
+
};
|
|
159
176
|
}
|
|
160
177
|
}
|
|
161
178
|
|
|
@@ -208,9 +225,11 @@ function Make(App) {
|
|
|
208
225
|
let decide = (state, command) => {
|
|
209
226
|
switch (command.TAG) {
|
|
210
227
|
case "Register" :
|
|
228
|
+
let language = command.language;
|
|
211
229
|
let requestedAt = command.requestedAt;
|
|
212
230
|
let role = command.role;
|
|
213
231
|
let email = command.email;
|
|
232
|
+
let emailId = command.emailId;
|
|
214
233
|
if (!admits(state.admission, App.table, role, requestedAt)) {
|
|
215
234
|
return {
|
|
216
235
|
TAG: "Ok",
|
|
@@ -226,13 +245,18 @@ function Make(App) {
|
|
|
226
245
|
_0: [
|
|
227
246
|
{
|
|
228
247
|
TAG: "RegistrationExpired",
|
|
229
|
-
|
|
248
|
+
emailId: emailId
|
|
230
249
|
},
|
|
231
250
|
{
|
|
232
251
|
TAG: "RegistrationRequested",
|
|
233
|
-
|
|
252
|
+
emailId: emailId,
|
|
253
|
+
email: {
|
|
254
|
+
TAG: "Value",
|
|
255
|
+
_0: email
|
|
256
|
+
},
|
|
234
257
|
roles: roles,
|
|
235
|
-
requestedAt: requestedAt
|
|
258
|
+
requestedAt: requestedAt,
|
|
259
|
+
language: language
|
|
236
260
|
}
|
|
237
261
|
]
|
|
238
262
|
};
|
|
@@ -249,9 +273,14 @@ function Make(App) {
|
|
|
249
273
|
TAG: "Ok",
|
|
250
274
|
_0: [{
|
|
251
275
|
TAG: "RegistrationRequested",
|
|
252
|
-
|
|
276
|
+
emailId: emailId,
|
|
277
|
+
email: {
|
|
278
|
+
TAG: "Value",
|
|
279
|
+
_0: email
|
|
280
|
+
},
|
|
253
281
|
roles: roles,
|
|
254
|
-
requestedAt: requestedAt
|
|
282
|
+
requestedAt: requestedAt,
|
|
283
|
+
language: language
|
|
255
284
|
}]
|
|
256
285
|
};
|
|
257
286
|
case "Verified" :
|
|
@@ -261,36 +290,29 @@ function Make(App) {
|
|
|
261
290
|
};
|
|
262
291
|
case "Completed" :
|
|
263
292
|
let last = state.lastNoticeAt;
|
|
264
|
-
if (last !== undefined) {
|
|
265
|
-
if (ContactVerification_Guards$ReventlessRegistration.elapsedSeconds(last, requestedAt) < 3600) {
|
|
266
|
-
return {
|
|
267
|
-
TAG: "Ok",
|
|
268
|
-
_0: []
|
|
269
|
-
};
|
|
270
|
-
} else {
|
|
271
|
-
return {
|
|
272
|
-
TAG: "Ok",
|
|
273
|
-
_0: [{
|
|
274
|
-
TAG: "RegistrationAttemptedOnTakenAddress",
|
|
275
|
-
email: email,
|
|
276
|
-
attemptedAt: requestedAt
|
|
277
|
-
}]
|
|
278
|
-
};
|
|
279
|
-
}
|
|
280
|
-
} else {
|
|
293
|
+
if (last !== undefined && ContactVerification_Guards$ReventlessRegistration.elapsedSeconds(last, requestedAt) < 3600) {
|
|
281
294
|
return {
|
|
282
295
|
TAG: "Ok",
|
|
283
|
-
_0: [
|
|
284
|
-
TAG: "RegistrationAttemptedOnTakenAddress",
|
|
285
|
-
email: email,
|
|
286
|
-
attemptedAt: requestedAt
|
|
287
|
-
}]
|
|
296
|
+
_0: []
|
|
288
297
|
};
|
|
289
298
|
}
|
|
299
|
+
return {
|
|
300
|
+
TAG: "Ok",
|
|
301
|
+
_0: [{
|
|
302
|
+
TAG: "RegistrationAttemptedOnTakenAddress",
|
|
303
|
+
emailId: emailId,
|
|
304
|
+
email: {
|
|
305
|
+
TAG: "Value",
|
|
306
|
+
_0: email
|
|
307
|
+
},
|
|
308
|
+
attemptedAt: requestedAt
|
|
309
|
+
}]
|
|
310
|
+
};
|
|
290
311
|
}
|
|
312
|
+
break;
|
|
291
313
|
case "IssueRegistrationChallenge" :
|
|
292
314
|
let issuedAt = command.issuedAt;
|
|
293
|
-
let
|
|
315
|
+
let emailId$1 = command.emailId;
|
|
294
316
|
let p$1 = state.stage;
|
|
295
317
|
if (typeof p$1 !== "object") {
|
|
296
318
|
return {
|
|
@@ -301,16 +323,18 @@ function Make(App) {
|
|
|
301
323
|
let p$2 = p$1._0;
|
|
302
324
|
let match = ContactVerification_Guards$ReventlessRegistration.onIssueRequested({
|
|
303
325
|
TAG: "ByEmail",
|
|
304
|
-
_0: ContactAddressId$ReventlessRegistration.toString(
|
|
326
|
+
_0: ContactAddressId$ReventlessRegistration.toString(emailId$1)
|
|
305
327
|
}, p$2.challenge, issuedAt, RegistrationChallenge$ReventlessRegistration.policyFor(RegistrationChallenge$ReventlessRegistration.purposeOf(p$2.invitedBy)));
|
|
306
328
|
if (match === "Issue") {
|
|
307
329
|
return {
|
|
308
330
|
TAG: "Ok",
|
|
309
331
|
_0: [{
|
|
310
332
|
TAG: "RegistrationChallengeIssued",
|
|
311
|
-
|
|
333
|
+
emailId: emailId$1,
|
|
312
334
|
proofHash: command.proofHash,
|
|
313
|
-
issuedAt: issuedAt
|
|
335
|
+
issuedAt: issuedAt,
|
|
336
|
+
language: command.language,
|
|
337
|
+
messageKey: command.messageKey
|
|
314
338
|
}]
|
|
315
339
|
};
|
|
316
340
|
} else {
|
|
@@ -321,7 +345,7 @@ function Make(App) {
|
|
|
321
345
|
}
|
|
322
346
|
case "SubmitRegistrationProof" :
|
|
323
347
|
let proofHash = command.proofHash;
|
|
324
|
-
let
|
|
348
|
+
let emailId$2 = command.emailId;
|
|
325
349
|
let p$3 = state.stage;
|
|
326
350
|
if (typeof p$3 !== "object") {
|
|
327
351
|
return {
|
|
@@ -350,7 +374,8 @@ function Make(App) {
|
|
|
350
374
|
TAG: "Ok",
|
|
351
375
|
_0: [{
|
|
352
376
|
TAG: "RegistrationProofAccepted",
|
|
353
|
-
|
|
377
|
+
emailId: emailId$2,
|
|
378
|
+
email: p$4.email,
|
|
354
379
|
roles: p$4.roles,
|
|
355
380
|
proofHash: proofHash
|
|
356
381
|
}]
|
|
@@ -360,7 +385,7 @@ function Make(App) {
|
|
|
360
385
|
TAG: "Ok",
|
|
361
386
|
_0: [{
|
|
362
387
|
TAG: "RegistrationProofRefused",
|
|
363
|
-
|
|
388
|
+
emailId: emailId$2,
|
|
364
389
|
reason: refusalReason(reason._0)
|
|
365
390
|
}]
|
|
366
391
|
};
|
|
@@ -373,7 +398,7 @@ function Make(App) {
|
|
|
373
398
|
TAG: "Ok",
|
|
374
399
|
_0: [{
|
|
375
400
|
TAG: "RegistrationCompleted",
|
|
376
|
-
|
|
401
|
+
emailId: command.emailId
|
|
377
402
|
}]
|
|
378
403
|
};
|
|
379
404
|
} else {
|
|
@@ -391,7 +416,7 @@ function Make(App) {
|
|
|
391
416
|
case "Invite" :
|
|
392
417
|
let requestedAt$1 = command.requestedAt;
|
|
393
418
|
let roles$1 = command.roles;
|
|
394
|
-
let
|
|
419
|
+
let emailId$3 = command.emailId;
|
|
395
420
|
let role$1 = roles$1.find(r => !isByInvitation(App.table, r));
|
|
396
421
|
if (role$1 !== undefined) {
|
|
397
422
|
return {
|
|
@@ -408,14 +433,21 @@ function Make(App) {
|
|
|
408
433
|
_0: "NoRoleToGrant"
|
|
409
434
|
};
|
|
410
435
|
}
|
|
411
|
-
let invited_1 =
|
|
412
|
-
|
|
436
|
+
let invited_1 = {
|
|
437
|
+
TAG: "Value",
|
|
438
|
+
_0: command.email
|
|
439
|
+
};
|
|
440
|
+
let invited_2 = roles$1.map(r => r);
|
|
441
|
+
let invited_3 = command.invitedBy;
|
|
442
|
+
let invited_5 = command.language;
|
|
413
443
|
let invited = {
|
|
414
444
|
TAG: "RegistrationInvited",
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
445
|
+
emailId: emailId$3,
|
|
446
|
+
email: invited_1,
|
|
447
|
+
roles: invited_2,
|
|
448
|
+
invitedBy: invited_3,
|
|
449
|
+
invitedAt: requestedAt$1,
|
|
450
|
+
language: invited_5
|
|
419
451
|
};
|
|
420
452
|
let p$5 = state.stage;
|
|
421
453
|
if (typeof p$5 === "object") {
|
|
@@ -425,7 +457,7 @@ function Make(App) {
|
|
|
425
457
|
_0: [
|
|
426
458
|
{
|
|
427
459
|
TAG: "RegistrationExpired",
|
|
428
|
-
|
|
460
|
+
emailId: emailId$3
|
|
429
461
|
},
|
|
430
462
|
invited
|
|
431
463
|
]
|
|
@@ -467,9 +499,11 @@ function Make(App) {
|
|
|
467
499
|
TAG: "Ok",
|
|
468
500
|
_0: [{
|
|
469
501
|
TAG: "RegistrationChallengeReissued",
|
|
470
|
-
|
|
502
|
+
emailId: command.emailId,
|
|
503
|
+
email: p$7.email,
|
|
471
504
|
reissuedAt: requestedAt$2,
|
|
472
|
-
invitedBy: p$7.invitedBy
|
|
505
|
+
invitedBy: p$7.invitedBy,
|
|
506
|
+
language: p$7.language
|
|
473
507
|
}]
|
|
474
508
|
};
|
|
475
509
|
} else {
|
|
@@ -496,11 +530,35 @@ function Make(App) {
|
|
|
496
530
|
TAG: "Ok",
|
|
497
531
|
_0: [{
|
|
498
532
|
TAG: "RegistrationWithdrawn",
|
|
499
|
-
|
|
533
|
+
emailId: command.emailId,
|
|
500
534
|
withdrawnAt: command.withdrawnAt
|
|
501
535
|
}]
|
|
502
536
|
};
|
|
503
537
|
}
|
|
538
|
+
case "ReleaseRegistration" :
|
|
539
|
+
let match$3 = state.stage;
|
|
540
|
+
if (typeof match$3 !== "object") {
|
|
541
|
+
if (match$3 === "Completed") {
|
|
542
|
+
return {
|
|
543
|
+
TAG: "Ok",
|
|
544
|
+
_0: [{
|
|
545
|
+
TAG: "RegistrationReleased",
|
|
546
|
+
emailId: command.emailId,
|
|
547
|
+
releasedAt: command.releasedAt
|
|
548
|
+
}]
|
|
549
|
+
};
|
|
550
|
+
} else {
|
|
551
|
+
return {
|
|
552
|
+
TAG: "Ok",
|
|
553
|
+
_0: []
|
|
554
|
+
};
|
|
555
|
+
}
|
|
556
|
+
} else {
|
|
557
|
+
return {
|
|
558
|
+
TAG: "Ok",
|
|
559
|
+
_0: []
|
|
560
|
+
};
|
|
561
|
+
}
|
|
504
562
|
}
|
|
505
563
|
};
|
|
506
564
|
return {
|
|
@@ -528,6 +586,7 @@ export {
|
|
|
528
586
|
Guards,
|
|
529
587
|
initialState,
|
|
530
588
|
noticeCooldown,
|
|
589
|
+
contactOf,
|
|
531
590
|
purposeOf,
|
|
532
591
|
policyOf,
|
|
533
592
|
evolve,
|