@reventlessdev/reventless-registration 0.0.0-stage → 1.0.0-alpha.10

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 (40) hide show
  1. package/LICENSE +202 -0
  2. package/README.md +50 -2
  3. package/package.json +38 -3
  4. package/rescript.json +28 -0
  5. package/src/ContactVerification.res +106 -0
  6. package/src/ContactVerification.res.mjs +60 -0
  7. package/src/ContactVerification_Guards.res +180 -0
  8. package/src/ContactVerification_Guards.res.mjs +97 -0
  9. package/src/Registration/ContactAddressId.res +30 -0
  10. package/src/Registration/ContactAddressId.res.mjs +53 -0
  11. package/src/Registration/InboundTranslation/CompleteRegistration.res +35 -0
  12. package/src/Registration/InboundTranslation/CompleteRegistration.res.mjs +58 -0
  13. package/src/Registration/InboundTranslation/CompleteRegistration_Translation.res +43 -0
  14. package/src/Registration/InboundTranslation/CompleteRegistration_Translation.res.mjs +74 -0
  15. package/src/Registration/InboundTranslation/SignUp.res +36 -0
  16. package/src/Registration/InboundTranslation/SignUp.res.mjs +60 -0
  17. package/src/Registration/InboundTranslation/SignUp_Translation.res +51 -0
  18. package/src/Registration/InboundTranslation/SignUp_Translation.res.mjs +75 -0
  19. package/src/Registration/OutboundTranslation/CreateRegisteredPrincipal.res +40 -0
  20. package/src/Registration/OutboundTranslation/CreateRegisteredPrincipal.res.mjs +65 -0
  21. package/src/Registration/OutboundTranslation/CreateRegisteredPrincipal_Translation.res +49 -0
  22. package/src/Registration/OutboundTranslation/CreateRegisteredPrincipal_Translation.res.mjs +108 -0
  23. package/src/Registration/OutboundTranslation/SendRegistrationChallenge.res +72 -0
  24. package/src/Registration/OutboundTranslation/SendRegistrationChallenge.res.mjs +87 -0
  25. package/src/Registration/OutboundTranslation/SendRegistrationChallenge_Translation.res +115 -0
  26. package/src/Registration/OutboundTranslation/SendRegistrationChallenge_Translation.res.mjs +200 -0
  27. package/src/Registration/StateChange/RegistrationPolicy.res +58 -0
  28. package/src/Registration/StateChange/RegistrationPolicy.res.mjs +86 -0
  29. package/src/Registration/StateChange/RegistrationPolicy_Decision.res +43 -0
  30. package/src/Registration/StateChange/RegistrationPolicy_Decision.res.mjs +88 -0
  31. package/src/Registration/StateChange/Registrations.res +183 -0
  32. package/src/Registration/StateChange/Registrations.res.mjs +238 -0
  33. package/src/Registration/StateChange/Registrations_Decision.res +311 -0
  34. package/src/Registration/StateChange/Registrations_Decision.res.mjs +560 -0
  35. package/src/Registration/StateViewStream/RegistrationWindows.res +30 -0
  36. package/src/Registration/StateViewStream/RegistrationWindows.res.mjs +80 -0
  37. package/src/Registration/StateViewStream/RegistrationWindows_Projection.res +7 -0
  38. package/src/Registration/StateViewStream/RegistrationWindows_Projection.res.mjs +38 -0
  39. package/src/RegistrationChallenge.res +20 -0
  40. package/src/RegistrationChallenge.res.mjs +45 -0
@@ -0,0 +1,560 @@
1
+ // Generated by ReScript, PLEASE EDIT WITH CARE
2
+
3
+ import * as Primitive_object from "@rescript/runtime/lib/es6/Primitive_object.js";
4
+ import * as DateTime$Reventless from "@reventlessdev/reventless-spec/src/semantic/DateTime.res.mjs";
5
+ import * as Admission$Reventless from "@reventlessdev/reventless-spec/src/types/Admission.res.mjs";
6
+ import * as Registrations$ReventlessRegistration from "./Registrations.res.mjs";
7
+ import * as ContactAddressId$ReventlessRegistration from "../ContactAddressId.res.mjs";
8
+ import * as RegistrationChallenge$ReventlessRegistration from "../../RegistrationChallenge.res.mjs";
9
+ import * as ContactVerification_Guards$ReventlessRegistration from "../../ContactVerification_Guards.res.mjs";
10
+
11
+ let initialState = {
12
+ admission: "Unset",
13
+ stage: "Unclaimed",
14
+ lastNoticeAt: undefined
15
+ };
16
+
17
+ function contactOf(email) {
18
+ return {
19
+ TAG: "ByEmail",
20
+ _0: ContactAddressId$ReventlessRegistration.toString(email)
21
+ };
22
+ }
23
+
24
+ function purposeOf(p) {
25
+ return RegistrationChallenge$ReventlessRegistration.purposeOf(p.invitedBy);
26
+ }
27
+
28
+ function policyOf(p) {
29
+ return RegistrationChallenge$ReventlessRegistration.policyFor(RegistrationChallenge$ReventlessRegistration.purposeOf(p.invitedBy));
30
+ }
31
+
32
+ function evolve(state, event) {
33
+ switch (event.TAG) {
34
+ case "RegistrationOpened" :
35
+ return {
36
+ admission: {
37
+ TAG: "Open",
38
+ _0: event.until
39
+ },
40
+ stage: state.stage,
41
+ lastNoticeAt: state.lastNoticeAt
42
+ };
43
+ case "RegistrationClosed" :
44
+ return {
45
+ admission: "Closed",
46
+ stage: state.stage,
47
+ lastNoticeAt: state.lastNoticeAt
48
+ };
49
+ case "RegistrationRequested" :
50
+ return {
51
+ admission: state.admission,
52
+ stage: {
53
+ TAG: "Pending",
54
+ _0: {
55
+ address: event.address,
56
+ requestedAt: event.requestedAt,
57
+ roles: event.roles,
58
+ challenge: undefined,
59
+ proofHash: undefined
60
+ }
61
+ },
62
+ lastNoticeAt: state.lastNoticeAt
63
+ };
64
+ case "RegistrationInvited" :
65
+ return {
66
+ admission: state.admission,
67
+ stage: {
68
+ TAG: "Pending",
69
+ _0: {
70
+ address: event.address,
71
+ requestedAt: event.invitedAt,
72
+ roles: event.roles,
73
+ invitedBy: event.invitedBy,
74
+ challenge: undefined,
75
+ proofHash: undefined
76
+ }
77
+ },
78
+ lastNoticeAt: state.lastNoticeAt
79
+ };
80
+ case "RegistrationChallengeReissued" :
81
+ let p = state.stage;
82
+ if (typeof p !== "object") {
83
+ return state;
84
+ }
85
+ let newrecord = {...p._0};
86
+ return {
87
+ admission: state.admission,
88
+ stage: {
89
+ TAG: "Pending",
90
+ _0: (newrecord.proofHash = undefined, newrecord.challenge = undefined, newrecord.requestedAt = event.reissuedAt, newrecord)
91
+ },
92
+ lastNoticeAt: state.lastNoticeAt
93
+ };
94
+ case "RegistrationExpired" :
95
+ case "RegistrationWithdrawn" :
96
+ return {
97
+ admission: state.admission,
98
+ stage: "Unclaimed",
99
+ lastNoticeAt: state.lastNoticeAt
100
+ };
101
+ case "RegistrationAttemptedOnTakenAddress" :
102
+ return {
103
+ admission: state.admission,
104
+ stage: state.stage,
105
+ lastNoticeAt: event.attemptedAt
106
+ };
107
+ case "RegistrationChallengeIssued" :
108
+ let p$1 = state.stage;
109
+ if (typeof p$1 !== "object") {
110
+ return state;
111
+ }
112
+ let p$2 = p$1._0;
113
+ let newrecord$1 = {...p$2};
114
+ return {
115
+ admission: state.admission,
116
+ stage: {
117
+ TAG: "Pending",
118
+ _0: (newrecord$1.proofHash = event.proofHash, newrecord$1.challenge = {
119
+ contact: {
120
+ TAG: "ByEmail",
121
+ _0: ContactAddressId$ReventlessRegistration.toString(event.email)
122
+ },
123
+ purpose: RegistrationChallenge$ReventlessRegistration.purposeOf(p$2.invitedBy),
124
+ issuedAt: event.issuedAt,
125
+ attempts: 0,
126
+ settled: false
127
+ }, newrecord$1)
128
+ },
129
+ lastNoticeAt: state.lastNoticeAt
130
+ };
131
+ case "RegistrationProofAccepted" :
132
+ return {
133
+ admission: state.admission,
134
+ stage: "Verified",
135
+ lastNoticeAt: state.lastNoticeAt
136
+ };
137
+ case "RegistrationProofRefused" :
138
+ let p$3 = state.stage;
139
+ if (typeof p$3 !== "object") {
140
+ return state;
141
+ }
142
+ let p$4 = p$3._0;
143
+ let c = p$4.challenge;
144
+ if (c === undefined) {
145
+ return state;
146
+ }
147
+ let newrecord$2 = {...p$4};
148
+ return {
149
+ admission: state.admission,
150
+ stage: {
151
+ TAG: "Pending",
152
+ _0: (newrecord$2.challenge = {
153
+ contact: c.contact,
154
+ purpose: c.purpose,
155
+ issuedAt: c.issuedAt,
156
+ attempts: c.attempts + 1 | 0,
157
+ settled: c.settled
158
+ }, newrecord$2)
159
+ },
160
+ lastNoticeAt: state.lastNoticeAt
161
+ };
162
+ case "RegistrationCompleted" :
163
+ return {
164
+ admission: state.admission,
165
+ stage: "Completed",
166
+ lastNoticeAt: state.lastNoticeAt
167
+ };
168
+ }
169
+ }
170
+
171
+ function admits(admission, table, role, at) {
172
+ if (typeof admission !== "object") {
173
+ if (admission === "Unset") {
174
+ return Admission$Reventless.isSelfService(table, role);
175
+ } else {
176
+ return false;
177
+ }
178
+ }
179
+ let until = admission._0;
180
+ if (until !== undefined) {
181
+ return DateTime$Reventless.isBefore(at, until);
182
+ } else {
183
+ return true;
184
+ }
185
+ }
186
+
187
+ function isByInvitation(table, role) {
188
+ let match = Admission$Reventless.strategyOf(table, role);
189
+ return typeof match === "object";
190
+ }
191
+
192
+ function hasLapsed(p, now) {
193
+ let c = p.challenge;
194
+ if (c !== undefined) {
195
+ return ContactVerification_Guards$ReventlessRegistration.hasExpired(c, now, RegistrationChallenge$ReventlessRegistration.policyFor(RegistrationChallenge$ReventlessRegistration.purposeOf(p.invitedBy)));
196
+ } else {
197
+ return ContactVerification_Guards$ReventlessRegistration.elapsedSeconds(p.requestedAt, now) >= RegistrationChallenge$ReventlessRegistration.policyFor(RegistrationChallenge$ReventlessRegistration.purposeOf(p.invitedBy)).tokenTtl;
198
+ }
199
+ }
200
+
201
+ function refusalReason(r) {
202
+ switch (r) {
203
+ case "AddressSuperseded" :
204
+ return "AddressSuperseded";
205
+ case "ChallengeExpired" :
206
+ return "ChallengeExpired";
207
+ case "AlreadySettled" :
208
+ return "AlreadySettled";
209
+ case "AttemptsExhausted" :
210
+ return "AttemptsExhausted";
211
+ case "ProofMismatch" :
212
+ return "ProofMismatch";
213
+ }
214
+ }
215
+
216
+ function Make(App) {
217
+ let decide = (state, command) => {
218
+ switch (command.TAG) {
219
+ case "Register" :
220
+ let requestedAt = command.requestedAt;
221
+ let role = command.role;
222
+ let address = command.address;
223
+ let email = command.email;
224
+ if (!admits(state.admission, App.table, role, requestedAt)) {
225
+ return {
226
+ TAG: "Ok",
227
+ _0: []
228
+ };
229
+ }
230
+ let roles = [role];
231
+ let p = state.stage;
232
+ if (typeof p === "object") {
233
+ if (hasLapsed(p._0, requestedAt)) {
234
+ return {
235
+ TAG: "Ok",
236
+ _0: [
237
+ {
238
+ TAG: "RegistrationExpired",
239
+ email: email
240
+ },
241
+ {
242
+ TAG: "RegistrationRequested",
243
+ email: email,
244
+ address: {
245
+ TAG: "Value",
246
+ _0: address
247
+ },
248
+ roles: roles,
249
+ requestedAt: requestedAt
250
+ }
251
+ ]
252
+ };
253
+ } else {
254
+ return {
255
+ TAG: "Ok",
256
+ _0: []
257
+ };
258
+ }
259
+ }
260
+ switch (p) {
261
+ case "Unclaimed" :
262
+ return {
263
+ TAG: "Ok",
264
+ _0: [{
265
+ TAG: "RegistrationRequested",
266
+ email: email,
267
+ address: {
268
+ TAG: "Value",
269
+ _0: address
270
+ },
271
+ roles: roles,
272
+ requestedAt: requestedAt
273
+ }]
274
+ };
275
+ case "Verified" :
276
+ return {
277
+ TAG: "Ok",
278
+ _0: []
279
+ };
280
+ case "Completed" :
281
+ let last = state.lastNoticeAt;
282
+ if (last !== undefined && ContactVerification_Guards$ReventlessRegistration.elapsedSeconds(last, requestedAt) < 3600) {
283
+ return {
284
+ TAG: "Ok",
285
+ _0: []
286
+ };
287
+ }
288
+ return {
289
+ TAG: "Ok",
290
+ _0: [{
291
+ TAG: "RegistrationAttemptedOnTakenAddress",
292
+ email: email,
293
+ address: {
294
+ TAG: "Value",
295
+ _0: address
296
+ },
297
+ attemptedAt: requestedAt
298
+ }]
299
+ };
300
+ }
301
+ break;
302
+ case "IssueRegistrationChallenge" :
303
+ let issuedAt = command.issuedAt;
304
+ let email$1 = command.email;
305
+ let p$1 = state.stage;
306
+ if (typeof p$1 !== "object") {
307
+ return {
308
+ TAG: "Ok",
309
+ _0: []
310
+ };
311
+ }
312
+ let p$2 = p$1._0;
313
+ let match = ContactVerification_Guards$ReventlessRegistration.onIssueRequested({
314
+ TAG: "ByEmail",
315
+ _0: ContactAddressId$ReventlessRegistration.toString(email$1)
316
+ }, p$2.challenge, issuedAt, RegistrationChallenge$ReventlessRegistration.policyFor(RegistrationChallenge$ReventlessRegistration.purposeOf(p$2.invitedBy)));
317
+ if (match === "Issue") {
318
+ return {
319
+ TAG: "Ok",
320
+ _0: [{
321
+ TAG: "RegistrationChallengeIssued",
322
+ email: email$1,
323
+ proofHash: command.proofHash,
324
+ issuedAt: issuedAt
325
+ }]
326
+ };
327
+ } else {
328
+ return {
329
+ TAG: "Ok",
330
+ _0: []
331
+ };
332
+ }
333
+ case "SubmitRegistrationProof" :
334
+ let proofHash = command.proofHash;
335
+ let email$2 = command.email;
336
+ let p$3 = state.stage;
337
+ if (typeof p$3 !== "object") {
338
+ return {
339
+ TAG: "Ok",
340
+ _0: []
341
+ };
342
+ }
343
+ let p$4 = p$3._0;
344
+ let c = p$4.challenge;
345
+ if (c === undefined) {
346
+ return {
347
+ TAG: "Ok",
348
+ _0: []
349
+ };
350
+ }
351
+ let held = p$4.proofHash;
352
+ if (held === undefined) {
353
+ return {
354
+ TAG: "Ok",
355
+ _0: []
356
+ };
357
+ }
358
+ let reason = ContactVerification_Guards$ReventlessRegistration.onProofPresented(c, undefined, proofHash === held, command.presentedAt, RegistrationChallenge$ReventlessRegistration.policyFor(RegistrationChallenge$ReventlessRegistration.purposeOf(p$4.invitedBy)));
359
+ if (typeof reason !== "object") {
360
+ return {
361
+ TAG: "Ok",
362
+ _0: [{
363
+ TAG: "RegistrationProofAccepted",
364
+ email: email$2,
365
+ address: p$4.address,
366
+ roles: p$4.roles,
367
+ proofHash: proofHash
368
+ }]
369
+ };
370
+ } else {
371
+ return {
372
+ TAG: "Ok",
373
+ _0: [{
374
+ TAG: "RegistrationProofRefused",
375
+ email: email$2,
376
+ reason: refusalReason(reason._0)
377
+ }]
378
+ };
379
+ }
380
+ case "RecordRegistrationCompleted" :
381
+ let match$1 = state.stage;
382
+ if (typeof match$1 !== "object") {
383
+ if (match$1 === "Verified") {
384
+ return {
385
+ TAG: "Ok",
386
+ _0: [{
387
+ TAG: "RegistrationCompleted",
388
+ email: command.email
389
+ }]
390
+ };
391
+ } else {
392
+ return {
393
+ TAG: "Ok",
394
+ _0: []
395
+ };
396
+ }
397
+ } else {
398
+ return {
399
+ TAG: "Ok",
400
+ _0: []
401
+ };
402
+ }
403
+ case "Invite" :
404
+ let requestedAt$1 = command.requestedAt;
405
+ let roles$1 = command.roles;
406
+ let email$3 = command.email;
407
+ let role$1 = roles$1.find(r => !isByInvitation(App.table, r));
408
+ if (role$1 !== undefined) {
409
+ return {
410
+ TAG: "Error",
411
+ _0: {
412
+ TAG: "NotByInvitation",
413
+ role: role$1
414
+ }
415
+ };
416
+ }
417
+ if (Primitive_object.equal(roles$1, [])) {
418
+ return {
419
+ TAG: "Error",
420
+ _0: "NoRoleToGrant"
421
+ };
422
+ }
423
+ let invited_1 = {
424
+ TAG: "Value",
425
+ _0: command.address
426
+ };
427
+ let invited_2 = roles$1.map(r => r);
428
+ let invited_3 = command.invitedBy;
429
+ let invited = {
430
+ TAG: "RegistrationInvited",
431
+ email: email$3,
432
+ address: invited_1,
433
+ roles: invited_2,
434
+ invitedBy: invited_3,
435
+ invitedAt: requestedAt$1
436
+ };
437
+ let p$5 = state.stage;
438
+ if (typeof p$5 === "object") {
439
+ if (hasLapsed(p$5._0, requestedAt$1)) {
440
+ return {
441
+ TAG: "Ok",
442
+ _0: [
443
+ {
444
+ TAG: "RegistrationExpired",
445
+ email: email$3
446
+ },
447
+ invited
448
+ ]
449
+ };
450
+ } else {
451
+ return {
452
+ TAG: "Ok",
453
+ _0: []
454
+ };
455
+ }
456
+ }
457
+ switch (p$5) {
458
+ case "Unclaimed" :
459
+ return {
460
+ TAG: "Ok",
461
+ _0: [invited]
462
+ };
463
+ case "Verified" :
464
+ case "Completed" :
465
+ return {
466
+ TAG: "Ok",
467
+ _0: []
468
+ };
469
+ }
470
+ case "ReissueRegistrationChallenge" :
471
+ let requestedAt$2 = command.requestedAt;
472
+ let p$6 = state.stage;
473
+ if (typeof p$6 !== "object") {
474
+ return {
475
+ TAG: "Ok",
476
+ _0: []
477
+ };
478
+ }
479
+ let p$7 = p$6._0;
480
+ let c$1 = p$7.challenge;
481
+ if (c$1 !== undefined) {
482
+ if (ContactVerification_Guards$ReventlessRegistration.elapsedSeconds(c$1.issuedAt, requestedAt$2) >= RegistrationChallenge$ReventlessRegistration.policyFor(RegistrationChallenge$ReventlessRegistration.purposeOf(p$7.invitedBy)).resendCooldown) {
483
+ return {
484
+ TAG: "Ok",
485
+ _0: [{
486
+ TAG: "RegistrationChallengeReissued",
487
+ email: command.email,
488
+ address: p$7.address,
489
+ reissuedAt: requestedAt$2,
490
+ invitedBy: p$7.invitedBy
491
+ }]
492
+ };
493
+ } else {
494
+ return {
495
+ TAG: "Ok",
496
+ _0: []
497
+ };
498
+ }
499
+ } else {
500
+ return {
501
+ TAG: "Ok",
502
+ _0: []
503
+ };
504
+ }
505
+ case "WithdrawRegistration" :
506
+ let match$2 = state.stage;
507
+ if (typeof match$2 !== "object") {
508
+ return {
509
+ TAG: "Ok",
510
+ _0: []
511
+ };
512
+ } else {
513
+ return {
514
+ TAG: "Ok",
515
+ _0: [{
516
+ TAG: "RegistrationWithdrawn",
517
+ email: command.email,
518
+ withdrawnAt: command.withdrawnAt
519
+ }]
520
+ };
521
+ }
522
+ }
523
+ };
524
+ return {
525
+ Spec: undefined,
526
+ moduleUrl: Registrations$ReventlessRegistration.moduleUrl,
527
+ initialState: initialState,
528
+ evolve: evolve,
529
+ decide: decide
530
+ };
531
+ }
532
+
533
+ let Spec;
534
+
535
+ let V;
536
+
537
+ let Guards;
538
+
539
+ let noticeCooldown = 3600;
540
+
541
+ let moduleUrl = "@reventlessdev/reventless-registration/src/Registration/StateChange/Registrations_Decision.res.mjs";
542
+
543
+ export {
544
+ Spec,
545
+ V,
546
+ Guards,
547
+ initialState,
548
+ noticeCooldown,
549
+ contactOf,
550
+ purposeOf,
551
+ policyOf,
552
+ evolve,
553
+ admits,
554
+ isByInvitation,
555
+ hasLapsed,
556
+ refusalReason,
557
+ Make,
558
+ moduleUrl,
559
+ }
560
+ /* DateTime-Reventless Not a pure module */
@@ -0,0 +1,30 @@
1
+ // RegistrationWindows StateViewSliceStream.
2
+ //
3
+ // Which self-service roles an administrator has closed or opened, for a visitor
4
+ // deciding whether to sign up. Open to callers who are not signed in, and it
5
+ // tells them only what the door's own answers already tell: that registration
6
+ // for a role is or is not open here. Nothing about any address.
7
+ //
8
+ // A role with no row is open, since nothing recorded about a self-service role
9
+ // is open; the shell learns which roles are self-service from the platform's
10
+ // configuration and reads this view for the exceptions.
11
+
12
+ @@reventless.spec
13
+ @@reventless.authorize(AllowAnonymous)
14
+
15
+ @schema
16
+ type state = {
17
+ @id role: string,
18
+ isOpen: bool,
19
+ // The end of an open window, where one was given. Past it the role reads as
20
+ // closed, with no event to say so.
21
+ until?: Reventless.DateTime.t,
22
+ }
23
+
24
+ @schema
25
+ type consumedEvent =
26
+ | RegistrationOpened({role: string, until?: Reventless.DateTime.t})
27
+ | RegistrationClosed({role: string})
28
+
29
+ /** This view says which roles are open; the platform tells the shell where to read it. */
30
+ let admissionDoor = Reventless.Admission.OpenRoles
@@ -0,0 +1,80 @@
1
+ // Generated by ReScript, PLEASE EDIT WITH CARE
2
+
3
+ import * as Sury from "sury";
4
+ import * as DateTime$Reventless from "@reventlessdev/reventless-spec/src/semantic/DateTime.res.mjs";
5
+ import * as ReadModel$Reventless from "@reventlessdev/reventless-spec/src/components/ReadModel.res.mjs";
6
+ import * as StateAnnotations$Reventless from "@reventlessdev/reventless-spec/src/components/StateAnnotations.res.mjs";
7
+
8
+ let stateSchema = Sury.$schema(s => ({
9
+ role: s.m(Sury.string),
10
+ isOpen: s.m(Sury.boolean),
11
+ until: s.m(Sury.$option(DateTime$Reventless.schema))
12
+ }));
13
+
14
+ let consumedEventSchema = Sury.union([
15
+ Sury.$schema(s => ({
16
+ TAG: "RegistrationOpened",
17
+ role: s.m(Sury.string),
18
+ until: s.m(Sury.$option(DateTime$Reventless.schema))
19
+ })),
20
+ Sury.$schema(s => ({
21
+ TAG: "RegistrationClosed",
22
+ role: s.m(Sury.string)
23
+ }))
24
+ ]);
25
+
26
+ let config = ReadModel$Reventless.config(undefined, undefined, undefined);
27
+
28
+ let makeId = (state => state.role);
29
+
30
+ let stateSchema$1 = Sury.$Metadata_set(stateSchema, StateAnnotations$Reventless.stateAnnotationsId, {
31
+ ids: ["role"],
32
+ compositeIds: [],
33
+ subIds: [],
34
+ compositeSubIds: [],
35
+ indexes: [],
36
+ hidden: [],
37
+ summary: [],
38
+ internal: [],
39
+ drillTargets: [],
40
+ drillTargetKeys: [],
41
+ collapsed: [],
42
+ scan: [],
43
+ scanSort: [],
44
+ semantic: [],
45
+ metric: [],
46
+ lifecycle: undefined,
47
+ groupBy: undefined,
48
+ visibility: undefined,
49
+ live: undefined,
50
+ retired: undefined
51
+ });
52
+
53
+ let name = "RegistrationWindows";
54
+
55
+ let admissionDoor = "OpenRoles";
56
+
57
+ let Id;
58
+
59
+ let subIdConfig;
60
+
61
+ let moduleUrl = "@reventlessdev/reventless-registration/src/Registration/StateViewStream/RegistrationWindows.res.mjs";
62
+
63
+ let authorization = "AllowAnonymous";
64
+
65
+ let visibility = "Public";
66
+
67
+ export {
68
+ name,
69
+ consumedEventSchema,
70
+ admissionDoor,
71
+ config,
72
+ Id,
73
+ subIdConfig,
74
+ makeId,
75
+ stateSchema$1 as stateSchema,
76
+ moduleUrl,
77
+ authorization,
78
+ visibility,
79
+ }
80
+ /* stateSchema Not a pure module */
@@ -0,0 +1,7 @@
1
+ @@reventless.projection
2
+
3
+ let project = ({event}) =>
4
+ switch event {
5
+ | RegistrationOpened({role, ?until}) => [Set(role, {role, isOpen: true, ?until})]
6
+ | RegistrationClosed({role}) => [Set(role, {role, isOpen: false})]
7
+ }
@@ -0,0 +1,38 @@
1
+ // Generated by ReScript, PLEASE EDIT WITH CARE
2
+
3
+
4
+ function project(param) {
5
+ let event = param.event;
6
+ if (event.TAG === "RegistrationOpened") {
7
+ let role = event.role;
8
+ return [{
9
+ TAG: "Set",
10
+ _0: role,
11
+ _1: {
12
+ role: role,
13
+ isOpen: true,
14
+ until: event.until
15
+ }
16
+ }];
17
+ }
18
+ let role$1 = event.role;
19
+ return [{
20
+ TAG: "Set",
21
+ _0: role$1,
22
+ _1: {
23
+ role: role$1,
24
+ isOpen: false
25
+ }
26
+ }];
27
+ }
28
+
29
+ let Spec;
30
+
31
+ let moduleUrl = "@reventlessdev/reventless-registration/src/Registration/StateViewStream/RegistrationWindows_Projection.res.mjs";
32
+
33
+ export {
34
+ Spec,
35
+ project,
36
+ moduleUrl,
37
+ }
38
+ /* No side effect */