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

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 +6 -0
  10. package/src/Registration/ContactAddressId.res.mjs +29 -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 +40 -0
  14. package/src/Registration/InboundTranslation/CompleteRegistration_Translation.res.mjs +67 -0
  15. package/src/Registration/InboundTranslation/SignUp.res +35 -0
  16. package/src/Registration/InboundTranslation/SignUp.res.mjs +57 -0
  17. package/src/Registration/InboundTranslation/SignUp_Translation.res +40 -0
  18. package/src/Registration/InboundTranslation/SignUp_Translation.res.mjs +66 -0
  19. package/src/Registration/OutboundTranslation/CreateRegisteredPrincipal.res +34 -0
  20. package/src/Registration/OutboundTranslation/CreateRegisteredPrincipal.res.mjs +61 -0
  21. package/src/Registration/OutboundTranslation/CreateRegisteredPrincipal_Translation.res +46 -0
  22. package/src/Registration/OutboundTranslation/CreateRegisteredPrincipal_Translation.res.mjs +99 -0
  23. package/src/Registration/OutboundTranslation/SendRegistrationChallenge.res +51 -0
  24. package/src/Registration/OutboundTranslation/SendRegistrationChallenge.res.mjs +80 -0
  25. package/src/Registration/OutboundTranslation/SendRegistrationChallenge_Translation.res +113 -0
  26. package/src/Registration/OutboundTranslation/SendRegistrationChallenge_Translation.res.mjs +160 -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 +157 -0
  32. package/src/Registration/StateChange/Registrations.res.mjs +224 -0
  33. package/src/Registration/StateChange/Registrations_Decision.res +281 -0
  34. package/src/Registration/StateChange/Registrations_Decision.res.mjs +541 -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,541 @@
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 purposeOf(p) {
18
+ return RegistrationChallenge$ReventlessRegistration.purposeOf(p.invitedBy);
19
+ }
20
+
21
+ function policyOf(p) {
22
+ return RegistrationChallenge$ReventlessRegistration.policyFor(RegistrationChallenge$ReventlessRegistration.purposeOf(p.invitedBy));
23
+ }
24
+
25
+ function evolve(state, event) {
26
+ switch (event.TAG) {
27
+ case "RegistrationOpened" :
28
+ return {
29
+ admission: {
30
+ TAG: "Open",
31
+ _0: event.until
32
+ },
33
+ stage: state.stage,
34
+ lastNoticeAt: state.lastNoticeAt
35
+ };
36
+ case "RegistrationClosed" :
37
+ return {
38
+ admission: "Closed",
39
+ stage: state.stage,
40
+ lastNoticeAt: state.lastNoticeAt
41
+ };
42
+ case "RegistrationRequested" :
43
+ return {
44
+ admission: state.admission,
45
+ stage: {
46
+ TAG: "Pending",
47
+ _0: {
48
+ requestedAt: event.requestedAt,
49
+ roles: event.roles,
50
+ challenge: undefined,
51
+ proofHash: undefined
52
+ }
53
+ },
54
+ lastNoticeAt: state.lastNoticeAt
55
+ };
56
+ case "RegistrationInvited" :
57
+ return {
58
+ admission: state.admission,
59
+ stage: {
60
+ TAG: "Pending",
61
+ _0: {
62
+ requestedAt: event.invitedAt,
63
+ roles: event.roles,
64
+ invitedBy: event.invitedBy,
65
+ challenge: undefined,
66
+ proofHash: undefined
67
+ }
68
+ },
69
+ lastNoticeAt: state.lastNoticeAt
70
+ };
71
+ case "RegistrationChallengeReissued" :
72
+ let p = state.stage;
73
+ if (typeof p !== "object") {
74
+ return state;
75
+ }
76
+ let newrecord = {...p._0};
77
+ return {
78
+ admission: state.admission,
79
+ stage: {
80
+ TAG: "Pending",
81
+ _0: (newrecord.proofHash = undefined, newrecord.challenge = undefined, newrecord.requestedAt = event.reissuedAt, newrecord)
82
+ },
83
+ lastNoticeAt: state.lastNoticeAt
84
+ };
85
+ case "RegistrationExpired" :
86
+ case "RegistrationWithdrawn" :
87
+ return {
88
+ admission: state.admission,
89
+ stage: "Unclaimed",
90
+ lastNoticeAt: state.lastNoticeAt
91
+ };
92
+ case "RegistrationAttemptedOnTakenAddress" :
93
+ return {
94
+ admission: state.admission,
95
+ stage: state.stage,
96
+ lastNoticeAt: event.attemptedAt
97
+ };
98
+ case "RegistrationChallengeIssued" :
99
+ let p$1 = state.stage;
100
+ if (typeof p$1 !== "object") {
101
+ return state;
102
+ }
103
+ let p$2 = p$1._0;
104
+ let newrecord$1 = {...p$2};
105
+ return {
106
+ admission: state.admission,
107
+ stage: {
108
+ TAG: "Pending",
109
+ _0: (newrecord$1.proofHash = event.proofHash, newrecord$1.challenge = {
110
+ contact: {
111
+ TAG: "ByEmail",
112
+ _0: ContactAddressId$ReventlessRegistration.toString(event.email)
113
+ },
114
+ purpose: RegistrationChallenge$ReventlessRegistration.purposeOf(p$2.invitedBy),
115
+ issuedAt: event.issuedAt,
116
+ attempts: 0,
117
+ settled: false
118
+ }, newrecord$1)
119
+ },
120
+ lastNoticeAt: state.lastNoticeAt
121
+ };
122
+ case "RegistrationProofAccepted" :
123
+ return {
124
+ admission: state.admission,
125
+ stage: "Verified",
126
+ lastNoticeAt: state.lastNoticeAt
127
+ };
128
+ case "RegistrationProofRefused" :
129
+ let p$3 = state.stage;
130
+ if (typeof p$3 !== "object") {
131
+ return state;
132
+ }
133
+ let p$4 = p$3._0;
134
+ let c = p$4.challenge;
135
+ if (c === undefined) {
136
+ return state;
137
+ }
138
+ let newrecord$2 = {...p$4};
139
+ return {
140
+ admission: state.admission,
141
+ stage: {
142
+ TAG: "Pending",
143
+ _0: (newrecord$2.challenge = {
144
+ contact: c.contact,
145
+ purpose: c.purpose,
146
+ issuedAt: c.issuedAt,
147
+ attempts: c.attempts + 1 | 0,
148
+ settled: c.settled
149
+ }, newrecord$2)
150
+ },
151
+ lastNoticeAt: state.lastNoticeAt
152
+ };
153
+ case "RegistrationCompleted" :
154
+ return {
155
+ admission: state.admission,
156
+ stage: "Completed",
157
+ lastNoticeAt: state.lastNoticeAt
158
+ };
159
+ }
160
+ }
161
+
162
+ function admits(admission, table, role, at) {
163
+ if (typeof admission !== "object") {
164
+ if (admission === "Unset") {
165
+ return Admission$Reventless.isSelfService(table, role);
166
+ } else {
167
+ return false;
168
+ }
169
+ }
170
+ let until = admission._0;
171
+ if (until !== undefined) {
172
+ return DateTime$Reventless.isBefore(at, until);
173
+ } else {
174
+ return true;
175
+ }
176
+ }
177
+
178
+ function isByInvitation(table, role) {
179
+ let match = Admission$Reventless.strategyOf(table, role);
180
+ return typeof match === "object";
181
+ }
182
+
183
+ function hasLapsed(p, now) {
184
+ let c = p.challenge;
185
+ if (c !== undefined) {
186
+ return ContactVerification_Guards$ReventlessRegistration.hasExpired(c, now, RegistrationChallenge$ReventlessRegistration.policyFor(RegistrationChallenge$ReventlessRegistration.purposeOf(p.invitedBy)));
187
+ } else {
188
+ return ContactVerification_Guards$ReventlessRegistration.elapsedSeconds(p.requestedAt, now) >= RegistrationChallenge$ReventlessRegistration.policyFor(RegistrationChallenge$ReventlessRegistration.purposeOf(p.invitedBy)).tokenTtl;
189
+ }
190
+ }
191
+
192
+ function refusalReason(r) {
193
+ switch (r) {
194
+ case "AddressSuperseded" :
195
+ return "AddressSuperseded";
196
+ case "ChallengeExpired" :
197
+ return "ChallengeExpired";
198
+ case "AlreadySettled" :
199
+ return "AlreadySettled";
200
+ case "AttemptsExhausted" :
201
+ return "AttemptsExhausted";
202
+ case "ProofMismatch" :
203
+ return "ProofMismatch";
204
+ }
205
+ }
206
+
207
+ function Make(App) {
208
+ let decide = (state, command) => {
209
+ switch (command.TAG) {
210
+ case "Register" :
211
+ let requestedAt = command.requestedAt;
212
+ let role = command.role;
213
+ let email = command.email;
214
+ if (!admits(state.admission, App.table, role, requestedAt)) {
215
+ return {
216
+ TAG: "Ok",
217
+ _0: []
218
+ };
219
+ }
220
+ let roles = [role];
221
+ let p = state.stage;
222
+ if (typeof p === "object") {
223
+ if (hasLapsed(p._0, requestedAt)) {
224
+ return {
225
+ TAG: "Ok",
226
+ _0: [
227
+ {
228
+ TAG: "RegistrationExpired",
229
+ email: email
230
+ },
231
+ {
232
+ TAG: "RegistrationRequested",
233
+ email: email,
234
+ roles: roles,
235
+ requestedAt: requestedAt
236
+ }
237
+ ]
238
+ };
239
+ } else {
240
+ return {
241
+ TAG: "Ok",
242
+ _0: []
243
+ };
244
+ }
245
+ }
246
+ switch (p) {
247
+ case "Unclaimed" :
248
+ return {
249
+ TAG: "Ok",
250
+ _0: [{
251
+ TAG: "RegistrationRequested",
252
+ email: email,
253
+ roles: roles,
254
+ requestedAt: requestedAt
255
+ }]
256
+ };
257
+ case "Verified" :
258
+ return {
259
+ TAG: "Ok",
260
+ _0: []
261
+ };
262
+ case "Completed" :
263
+ 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 {
281
+ return {
282
+ TAG: "Ok",
283
+ _0: [{
284
+ TAG: "RegistrationAttemptedOnTakenAddress",
285
+ email: email,
286
+ attemptedAt: requestedAt
287
+ }]
288
+ };
289
+ }
290
+ }
291
+ case "IssueRegistrationChallenge" :
292
+ let issuedAt = command.issuedAt;
293
+ let email$1 = command.email;
294
+ let p$1 = state.stage;
295
+ if (typeof p$1 !== "object") {
296
+ return {
297
+ TAG: "Ok",
298
+ _0: []
299
+ };
300
+ }
301
+ let p$2 = p$1._0;
302
+ let match = ContactVerification_Guards$ReventlessRegistration.onIssueRequested({
303
+ TAG: "ByEmail",
304
+ _0: ContactAddressId$ReventlessRegistration.toString(email$1)
305
+ }, p$2.challenge, issuedAt, RegistrationChallenge$ReventlessRegistration.policyFor(RegistrationChallenge$ReventlessRegistration.purposeOf(p$2.invitedBy)));
306
+ if (match === "Issue") {
307
+ return {
308
+ TAG: "Ok",
309
+ _0: [{
310
+ TAG: "RegistrationChallengeIssued",
311
+ email: email$1,
312
+ proofHash: command.proofHash,
313
+ issuedAt: issuedAt
314
+ }]
315
+ };
316
+ } else {
317
+ return {
318
+ TAG: "Ok",
319
+ _0: []
320
+ };
321
+ }
322
+ case "SubmitRegistrationProof" :
323
+ let proofHash = command.proofHash;
324
+ let email$2 = command.email;
325
+ let p$3 = state.stage;
326
+ if (typeof p$3 !== "object") {
327
+ return {
328
+ TAG: "Ok",
329
+ _0: []
330
+ };
331
+ }
332
+ let p$4 = p$3._0;
333
+ let c = p$4.challenge;
334
+ if (c === undefined) {
335
+ return {
336
+ TAG: "Ok",
337
+ _0: []
338
+ };
339
+ }
340
+ let held = p$4.proofHash;
341
+ if (held === undefined) {
342
+ return {
343
+ TAG: "Ok",
344
+ _0: []
345
+ };
346
+ }
347
+ let reason = ContactVerification_Guards$ReventlessRegistration.onProofPresented(c, undefined, proofHash === held, command.presentedAt, RegistrationChallenge$ReventlessRegistration.policyFor(RegistrationChallenge$ReventlessRegistration.purposeOf(p$4.invitedBy)));
348
+ if (typeof reason !== "object") {
349
+ return {
350
+ TAG: "Ok",
351
+ _0: [{
352
+ TAG: "RegistrationProofAccepted",
353
+ email: email$2,
354
+ roles: p$4.roles,
355
+ proofHash: proofHash
356
+ }]
357
+ };
358
+ } else {
359
+ return {
360
+ TAG: "Ok",
361
+ _0: [{
362
+ TAG: "RegistrationProofRefused",
363
+ email: email$2,
364
+ reason: refusalReason(reason._0)
365
+ }]
366
+ };
367
+ }
368
+ case "RecordRegistrationCompleted" :
369
+ let match$1 = state.stage;
370
+ if (typeof match$1 !== "object") {
371
+ if (match$1 === "Verified") {
372
+ return {
373
+ TAG: "Ok",
374
+ _0: [{
375
+ TAG: "RegistrationCompleted",
376
+ email: command.email
377
+ }]
378
+ };
379
+ } else {
380
+ return {
381
+ TAG: "Ok",
382
+ _0: []
383
+ };
384
+ }
385
+ } else {
386
+ return {
387
+ TAG: "Ok",
388
+ _0: []
389
+ };
390
+ }
391
+ case "Invite" :
392
+ let requestedAt$1 = command.requestedAt;
393
+ let roles$1 = command.roles;
394
+ let email$3 = command.email;
395
+ let role$1 = roles$1.find(r => !isByInvitation(App.table, r));
396
+ if (role$1 !== undefined) {
397
+ return {
398
+ TAG: "Error",
399
+ _0: {
400
+ TAG: "NotByInvitation",
401
+ role: role$1
402
+ }
403
+ };
404
+ }
405
+ if (Primitive_object.equal(roles$1, [])) {
406
+ return {
407
+ TAG: "Error",
408
+ _0: "NoRoleToGrant"
409
+ };
410
+ }
411
+ let invited_1 = roles$1.map(r => r);
412
+ let invited_2 = command.invitedBy;
413
+ let invited = {
414
+ TAG: "RegistrationInvited",
415
+ email: email$3,
416
+ roles: invited_1,
417
+ invitedBy: invited_2,
418
+ invitedAt: requestedAt$1
419
+ };
420
+ let p$5 = state.stage;
421
+ if (typeof p$5 === "object") {
422
+ if (hasLapsed(p$5._0, requestedAt$1)) {
423
+ return {
424
+ TAG: "Ok",
425
+ _0: [
426
+ {
427
+ TAG: "RegistrationExpired",
428
+ email: email$3
429
+ },
430
+ invited
431
+ ]
432
+ };
433
+ } else {
434
+ return {
435
+ TAG: "Ok",
436
+ _0: []
437
+ };
438
+ }
439
+ }
440
+ switch (p$5) {
441
+ case "Unclaimed" :
442
+ return {
443
+ TAG: "Ok",
444
+ _0: [invited]
445
+ };
446
+ case "Verified" :
447
+ case "Completed" :
448
+ return {
449
+ TAG: "Ok",
450
+ _0: []
451
+ };
452
+ }
453
+ case "ReissueRegistrationChallenge" :
454
+ let requestedAt$2 = command.requestedAt;
455
+ let p$6 = state.stage;
456
+ if (typeof p$6 !== "object") {
457
+ return {
458
+ TAG: "Ok",
459
+ _0: []
460
+ };
461
+ }
462
+ let p$7 = p$6._0;
463
+ let c$1 = p$7.challenge;
464
+ if (c$1 !== undefined) {
465
+ if (ContactVerification_Guards$ReventlessRegistration.elapsedSeconds(c$1.issuedAt, requestedAt$2) >= RegistrationChallenge$ReventlessRegistration.policyFor(RegistrationChallenge$ReventlessRegistration.purposeOf(p$7.invitedBy)).resendCooldown) {
466
+ return {
467
+ TAG: "Ok",
468
+ _0: [{
469
+ TAG: "RegistrationChallengeReissued",
470
+ email: command.email,
471
+ reissuedAt: requestedAt$2,
472
+ invitedBy: p$7.invitedBy
473
+ }]
474
+ };
475
+ } else {
476
+ return {
477
+ TAG: "Ok",
478
+ _0: []
479
+ };
480
+ }
481
+ } else {
482
+ return {
483
+ TAG: "Ok",
484
+ _0: []
485
+ };
486
+ }
487
+ case "WithdrawRegistration" :
488
+ let match$2 = state.stage;
489
+ if (typeof match$2 !== "object") {
490
+ return {
491
+ TAG: "Ok",
492
+ _0: []
493
+ };
494
+ } else {
495
+ return {
496
+ TAG: "Ok",
497
+ _0: [{
498
+ TAG: "RegistrationWithdrawn",
499
+ email: command.email,
500
+ withdrawnAt: command.withdrawnAt
501
+ }]
502
+ };
503
+ }
504
+ }
505
+ };
506
+ return {
507
+ Spec: undefined,
508
+ moduleUrl: Registrations$ReventlessRegistration.moduleUrl,
509
+ initialState: initialState,
510
+ evolve: evolve,
511
+ decide: decide
512
+ };
513
+ }
514
+
515
+ let Spec;
516
+
517
+ let V;
518
+
519
+ let Guards;
520
+
521
+ let noticeCooldown = 3600;
522
+
523
+ let moduleUrl = "@reventlessdev/reventless-registration/src/Registration/StateChange/Registrations_Decision.res.mjs";
524
+
525
+ export {
526
+ Spec,
527
+ V,
528
+ Guards,
529
+ initialState,
530
+ noticeCooldown,
531
+ purposeOf,
532
+ policyOf,
533
+ evolve,
534
+ admits,
535
+ isByInvitation,
536
+ hasLapsed,
537
+ refusalReason,
538
+ Make,
539
+ moduleUrl,
540
+ }
541
+ /* 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 */