@reventlessdev/reventless-registration 1.0.0-alpha.2 → 1.0.0-alpha.20

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 (21) hide show
  1. package/package.json +4 -4
  2. package/src/Registration/ContactAddressId.res +27 -3
  3. package/src/Registration/ContactAddressId.res.mjs +26 -2
  4. package/src/Registration/InboundTranslation/CompleteRegistration_Translation.res +9 -6
  5. package/src/Registration/InboundTranslation/CompleteRegistration_Translation.res.mjs +16 -9
  6. package/src/Registration/InboundTranslation/SignUp.res +1 -0
  7. package/src/Registration/InboundTranslation/SignUp.res.mjs +3 -0
  8. package/src/Registration/InboundTranslation/SignUp_Translation.res +23 -12
  9. package/src/Registration/InboundTranslation/SignUp_Translation.res.mjs +13 -4
  10. package/src/Registration/OutboundTranslation/CreateRegisteredPrincipal.res +7 -1
  11. package/src/Registration/OutboundTranslation/CreateRegisteredPrincipal.res.mjs +4 -0
  12. package/src/Registration/OutboundTranslation/CreateRegisteredPrincipal_Translation.res +6 -3
  13. package/src/Registration/OutboundTranslation/CreateRegisteredPrincipal_Translation.res.mjs +11 -2
  14. package/src/Registration/OutboundTranslation/SendRegistrationChallenge.res +24 -3
  15. package/src/Registration/OutboundTranslation/SendRegistrationChallenge.res.mjs +7 -0
  16. package/src/Registration/OutboundTranslation/SendRegistrationChallenge_Translation.res +17 -15
  17. package/src/Registration/OutboundTranslation/SendRegistrationChallenge_Translation.res.mjs +75 -35
  18. package/src/Registration/StateChange/Registrations.res +33 -2
  19. package/src/Registration/StateChange/Registrations.res.mjs +31 -1
  20. package/src/Registration/StateChange/Registrations_Decision.res +54 -13
  21. package/src/Registration/StateChange/Registrations_Decision.res.mjs +75 -26
@@ -14,6 +14,13 @@ let initialState = {
14
14
  lastNoticeAt: undefined
15
15
  };
16
16
 
17
+ function contactOf(email) {
18
+ return {
19
+ TAG: "ByEmail",
20
+ _0: ContactAddressId$ReventlessRegistration.toString(email)
21
+ };
22
+ }
23
+
17
24
  function purposeOf(p) {
18
25
  return RegistrationChallenge$ReventlessRegistration.purposeOf(p.invitedBy);
19
26
  }
@@ -45,6 +52,7 @@ function evolve(state, event) {
45
52
  stage: {
46
53
  TAG: "Pending",
47
54
  _0: {
55
+ address: event.address,
48
56
  requestedAt: event.requestedAt,
49
57
  roles: event.roles,
50
58
  challenge: undefined,
@@ -59,6 +67,7 @@ function evolve(state, event) {
59
67
  stage: {
60
68
  TAG: "Pending",
61
69
  _0: {
70
+ address: event.address,
62
71
  requestedAt: event.invitedAt,
63
72
  roles: event.roles,
64
73
  invitedBy: event.invitedBy,
@@ -156,6 +165,12 @@ function evolve(state, event) {
156
165
  stage: "Completed",
157
166
  lastNoticeAt: state.lastNoticeAt
158
167
  };
168
+ case "RegistrationReleased" :
169
+ return {
170
+ admission: state.admission,
171
+ stage: "Unclaimed",
172
+ lastNoticeAt: undefined
173
+ };
159
174
  }
160
175
  }
161
176
 
@@ -210,6 +225,7 @@ function Make(App) {
210
225
  case "Register" :
211
226
  let requestedAt = command.requestedAt;
212
227
  let role = command.role;
228
+ let address = command.address;
213
229
  let email = command.email;
214
230
  if (!admits(state.admission, App.table, role, requestedAt)) {
215
231
  return {
@@ -231,6 +247,10 @@ function Make(App) {
231
247
  {
232
248
  TAG: "RegistrationRequested",
233
249
  email: email,
250
+ address: {
251
+ TAG: "Value",
252
+ _0: address
253
+ },
234
254
  roles: roles,
235
255
  requestedAt: requestedAt
236
256
  }
@@ -250,6 +270,10 @@ function Make(App) {
250
270
  _0: [{
251
271
  TAG: "RegistrationRequested",
252
272
  email: email,
273
+ address: {
274
+ TAG: "Value",
275
+ _0: address
276
+ },
253
277
  roles: roles,
254
278
  requestedAt: requestedAt
255
279
  }]
@@ -261,33 +285,26 @@ function Make(App) {
261
285
  };
262
286
  case "Completed" :
263
287
  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 {
288
+ if (last !== undefined && ContactVerification_Guards$ReventlessRegistration.elapsedSeconds(last, requestedAt) < 3600) {
281
289
  return {
282
290
  TAG: "Ok",
283
- _0: [{
284
- TAG: "RegistrationAttemptedOnTakenAddress",
285
- email: email,
286
- attemptedAt: requestedAt
287
- }]
291
+ _0: []
288
292
  };
289
293
  }
294
+ return {
295
+ TAG: "Ok",
296
+ _0: [{
297
+ TAG: "RegistrationAttemptedOnTakenAddress",
298
+ email: email,
299
+ address: {
300
+ TAG: "Value",
301
+ _0: address
302
+ },
303
+ attemptedAt: requestedAt
304
+ }]
305
+ };
290
306
  }
307
+ break;
291
308
  case "IssueRegistrationChallenge" :
292
309
  let issuedAt = command.issuedAt;
293
310
  let email$1 = command.email;
@@ -351,6 +368,7 @@ function Make(App) {
351
368
  _0: [{
352
369
  TAG: "RegistrationProofAccepted",
353
370
  email: email$2,
371
+ address: p$4.address,
354
372
  roles: p$4.roles,
355
373
  proofHash: proofHash
356
374
  }]
@@ -408,13 +426,18 @@ function Make(App) {
408
426
  _0: "NoRoleToGrant"
409
427
  };
410
428
  }
411
- let invited_1 = roles$1.map(r => r);
412
- let invited_2 = command.invitedBy;
429
+ let invited_1 = {
430
+ TAG: "Value",
431
+ _0: command.address
432
+ };
433
+ let invited_2 = roles$1.map(r => r);
434
+ let invited_3 = command.invitedBy;
413
435
  let invited = {
414
436
  TAG: "RegistrationInvited",
415
437
  email: email$3,
416
- roles: invited_1,
417
- invitedBy: invited_2,
438
+ address: invited_1,
439
+ roles: invited_2,
440
+ invitedBy: invited_3,
418
441
  invitedAt: requestedAt$1
419
442
  };
420
443
  let p$5 = state.stage;
@@ -468,6 +491,7 @@ function Make(App) {
468
491
  _0: [{
469
492
  TAG: "RegistrationChallengeReissued",
470
493
  email: command.email,
494
+ address: p$7.address,
471
495
  reissuedAt: requestedAt$2,
472
496
  invitedBy: p$7.invitedBy
473
497
  }]
@@ -501,6 +525,30 @@ function Make(App) {
501
525
  }]
502
526
  };
503
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
+ }
504
552
  }
505
553
  };
506
554
  return {
@@ -528,6 +576,7 @@ export {
528
576
  Guards,
529
577
  initialState,
530
578
  noticeCooldown,
579
+ contactOf,
531
580
  purposeOf,
532
581
  policyOf,
533
582
  evolve,