@flarehr/superhero-basic-profile 0.1.2214 → 0.1.2217
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/dist/App.jsx +4 -0
- package/dist/Basic.Profile.Domain/AnalyticsEvent.jsx +102 -0
- package/dist/Basic.Profile.Domain/Audit.jsx +149 -0
- package/dist/Basic.Profile.Domain/Commands.jsx +68 -0
- package/dist/Basic.Profile.Domain/CommonTypes.jsx +194 -0
- package/dist/Basic.Profile.Domain/Config/Api/Admin/Read.jsx +58 -0
- package/dist/Basic.Profile.Domain/Config/Api/Admin/Write.jsx +23 -0
- package/dist/Basic.Profile.Domain/Config/Api/FlareAdminShell/Read.jsx +35 -0
- package/dist/Basic.Profile.Domain/Config/Commands.jsx +72 -0
- package/dist/Basic.Profile.Domain/Config/ConfigCommandHandler.jsx +197 -0
- package/dist/Basic.Profile.Domain/Config/Dto.jsx +181 -0
- package/dist/Basic.Profile.Domain/Config/Types.jsx +152 -0
- package/dist/Basic.Profile.Domain/DateTimeProvider.jsx +23 -0
- package/dist/Basic.Profile.Domain/DomainAggregates.jsx +801 -0
- package/dist/Basic.Profile.Domain/DomainPrimitives.jsx +426 -0
- package/dist/Basic.Profile.Domain/Dto/Aggregates.jsx +564 -0
- package/dist/Basic.Profile.Domain/Dto/AnalyticsEvent.jsx +157 -0
- package/dist/Basic.Profile.Domain/Dto/Api/Backend/Common.jsx +102 -0
- package/dist/Basic.Profile.Domain/Dto/Api/Backend/Read.jsx +85 -0
- package/dist/Basic.Profile.Domain/Dto/Api/Backend/Write.jsx +16 -0
- package/dist/Basic.Profile.Domain/Dto/Api/Common.jsx +427 -0
- package/dist/Basic.Profile.Domain/Dto/Api/External/Read.jsx +118 -0
- package/dist/Basic.Profile.Domain/Dto/Api/External/ReadV2.jsx +6 -0
- package/dist/Basic.Profile.Domain/Dto/Api/External/Write.jsx +184 -0
- package/dist/Basic.Profile.Domain/Dto/Api/External/WriteV2.jsx +439 -0
- package/dist/Basic.Profile.Domain/Dto/Api/FlareAdminShell/Read.jsx +38 -0
- package/dist/Basic.Profile.Domain/Dto/Api/FlareAdminShell/Write.jsx +199 -0
- package/dist/Basic.Profile.Domain/Dto/Api/Internal/Read.jsx +125 -0
- package/dist/Basic.Profile.Domain/Dto/Audit.jsx +121 -0
- package/dist/Basic.Profile.Domain/Dto/Commands.jsx +256 -0
- package/dist/Basic.Profile.Domain/Dto/Common.jsx +84 -0
- package/dist/Basic.Profile.Domain/Dto/Events.jsx +220 -0
- package/dist/Basic.Profile.Domain/Dto/Primitives.jsx +580 -0
- package/dist/Basic.Profile.Domain/Dto/ProfileCreationModels.jsx +324 -0
- package/dist/Basic.Profile.Domain/Dto/Validation.jsx +229 -0
- package/dist/Basic.Profile.Domain/Events.jsx +64 -0
- package/dist/Basic.Profile.Domain/Import/Api/InternalApi/Read.jsx +140 -0
- package/dist/Basic.Profile.Domain/Import/Api/InternalApi/Validation.jsx +499 -0
- package/dist/Basic.Profile.Domain/Import/Api/InternalApi/Write.jsx +51 -0
- package/dist/Basic.Profile.Domain/Import/Api/Read.jsx +154 -0
- package/dist/Basic.Profile.Domain/Import/CommonTypes.jsx +187 -0
- package/dist/Basic.Profile.Domain/Import/Dto.jsx +475 -0
- package/dist/Basic.Profile.Domain/Import/ImportCommandHandler.jsx +531 -0
- package/dist/Basic.Profile.Domain/Import/Types.jsx +405 -0
- package/dist/Basic.Profile.Domain/JwtPayload.jsx +44 -0
- package/dist/Basic.Profile.Domain/Metadata.jsx +257 -0
- package/dist/Basic.Profile.Domain/ProfileCommandHandler.jsx +261 -0
- package/dist/Basic.Profile.Domain/ProfileModels.jsx +59 -0
- package/dist/Basic.Profile.Domain/Utils.jsx +372 -0
- package/dist/Common/PreactCustomElement.jsx +8 -0
- package/dist/Common/Resources.jsx +20 -0
- package/dist/Common/Tailwind.jsx +8 -0
- package/dist/Common/Utils.jsx +18 -0
- package/dist/Directory/App.jsx +192 -0
- package/dist/Directory/BackendServices/Common.jsx +115 -0
- package/dist/Directory/BackendServices/ConfigService.jsx +168 -0
- package/dist/Directory/BackendServices/ImportService.jsx +137 -0
- package/dist/Directory/Common.jsx +93 -0
- package/dist/Directory/Config/Components.jsx +173 -0
- package/dist/Directory/Config/Types.jsx +187 -0
- package/dist/Directory/PastImports/PastImports.jsx +81 -0
- package/dist/Directory/ProfileImport/ProfileImport.jsx +284 -0
- package/dist/Directory/ProfileImport/Types.jsx +91 -0
- package/dist/Directory/TabNav.jsx +24 -0
- package/dist/Directory/Types.jsx +101 -0
- package/dist/Directory/User.jsx +117 -0
- package/dist/HeadlessUI/Dialog.jsx +66 -0
- package/dist/HeadlessUI/ModalDialog.jsx +74 -0
- package/dist/HeadlessUI/Switch.jsx +66 -0
- package/dist/HeadlessUI/Transition.jsx +66 -0
- package/package.json +1 -1
- package/dist/assets/delete.dcc7b157.svg +0 -5
- package/dist/assets/dialog-warning.cc77f3ba.svg +0 -5
- package/dist/assets/pencil.05fe6be6.svg +0 -5
- package/dist/index.html +0 -20
- package/dist/superhero-basic-profile.js +0 -50
|
@@ -0,0 +1,261 @@
|
|
|
1
|
+
import { Union } from "../fable_modules/fable-library-js.4.20.0/Types.js";
|
|
2
|
+
import { union_type, list_type, string_type } from "../fable_modules/fable-library-js.4.20.0/Reflection.js";
|
|
3
|
+
import { ProfileModule_getMetadata, ProfileModule_createPartial, ProfileModule_create, ProfileModule_tryActivate, PartialProfileDetailModule_update, ProfileModule_tryPromotePartial, ProfileModule_tryPurge, ProfileModule_Updater, ProfileDetail, ProfileModule_tryRestore, ProfileModule_tryArchive, ProfileModule_tryDeactivate, ProfileModule_tryUpdate, ProfileModule_incrementVersion, OperationalProfileModule_$007CFullDetails$007CPartialDetails$007CNonOperational$007C, Profile_$reflection } from "./DomainAggregates.jsx";
|
|
4
|
+
import { Event$1, EventId, ProfileEvent, Event$1_$reflection, ProfileEvent_$reflection } from "./Events.jsx";
|
|
5
|
+
import { length, append, fold, isEmpty, mapIndexed, empty, singleton } from "../fable_modules/fable-library-js.4.20.0/List.js";
|
|
6
|
+
import { equals } from "../fable_modules/fable-library-js.4.20.0/Util.js";
|
|
7
|
+
import { PartialProfileUpdateDetails } from "./ProfileModels.jsx";
|
|
8
|
+
import { FSharpResult$2, Result_Map } from "../fable_modules/fable-library-js.4.20.0/Result.js";
|
|
9
|
+
import { CommandMetadata_toEventMetadata, ProfileEventMetadataModule_incrementVersion, ProfileEventMetadataModule_toAggregateMetaData } from "./Metadata.jsx";
|
|
10
|
+
import { newGuid } from "../fable_modules/fable-library-js.4.20.0/Guid.js";
|
|
11
|
+
import { printf, toText } from "../fable_modules/fable-library-js.4.20.0/String.js";
|
|
12
|
+
|
|
13
|
+
export class HandlerResult extends Union {
|
|
14
|
+
constructor(tag, fields) {
|
|
15
|
+
super();
|
|
16
|
+
this.tag = tag;
|
|
17
|
+
this.fields = fields;
|
|
18
|
+
}
|
|
19
|
+
cases() {
|
|
20
|
+
return ["NoChange", "InvalidCommand", "Conflict", "CreateProfile", "UpdateProfile"];
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export function HandlerResult_$reflection() {
|
|
25
|
+
return union_type("ProfileCommandHandler.HandlerResult", [], HandlerResult, () => [[], [["Item", string_type]], [["Item", string_type]], [["Item1", Profile_$reflection()], ["Item2", list_type(Event$1_$reflection(ProfileEvent_$reflection()))]], [["Item1", Profile_$reflection()], ["Item2", list_type(Event$1_$reflection(ProfileEvent_$reflection()))]]]);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
function ofCommand(profile, _arg) {
|
|
29
|
+
let partialDetail;
|
|
30
|
+
switch (_arg.tag) {
|
|
31
|
+
case 1:
|
|
32
|
+
return singleton(new ProfileEvent(1, [_arg.fields[0]]));
|
|
33
|
+
case 2: {
|
|
34
|
+
const update_1 = _arg.fields[0];
|
|
35
|
+
let matchResult, current;
|
|
36
|
+
if (profile == null) {
|
|
37
|
+
matchResult = 1;
|
|
38
|
+
}
|
|
39
|
+
else {
|
|
40
|
+
const activePatternResult = OperationalProfileModule_$007CFullDetails$007CPartialDetails$007CNonOperational$007C(profile);
|
|
41
|
+
switch (activePatternResult.tag) {
|
|
42
|
+
case 0:
|
|
43
|
+
case 2: {
|
|
44
|
+
matchResult = 1;
|
|
45
|
+
break;
|
|
46
|
+
}
|
|
47
|
+
default: {
|
|
48
|
+
matchResult = 0;
|
|
49
|
+
current = activePatternResult.fields[0];
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
switch (matchResult) {
|
|
54
|
+
case 0:
|
|
55
|
+
if (!equals(update_1, (partialDetail = current, new PartialProfileUpdateDetails(partialDetail.Name, partialDetail.Email, partialDetail.MobilePhone, partialDetail.Title, partialDetail.Gender, partialDetail.DateOfBirth, partialDetail.Address)))) {
|
|
56
|
+
return singleton(new ProfileEvent(2, [update_1]));
|
|
57
|
+
}
|
|
58
|
+
else {
|
|
59
|
+
return empty();
|
|
60
|
+
}
|
|
61
|
+
default:
|
|
62
|
+
return empty();
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
case 3:
|
|
66
|
+
return singleton(new ProfileEvent(3, [_arg.fields[0]]));
|
|
67
|
+
case 4:
|
|
68
|
+
return singleton(new ProfileEvent(4, []));
|
|
69
|
+
case 5:
|
|
70
|
+
return singleton(new ProfileEvent(5, []));
|
|
71
|
+
case 6:
|
|
72
|
+
return singleton(new ProfileEvent(6, []));
|
|
73
|
+
case 7:
|
|
74
|
+
return singleton(new ProfileEvent(7, []));
|
|
75
|
+
case 8:
|
|
76
|
+
return singleton(new ProfileEvent(8, [_arg.fields[0]]));
|
|
77
|
+
case 9:
|
|
78
|
+
return singleton(new ProfileEvent(9, [_arg.fields[0]]));
|
|
79
|
+
case 10:
|
|
80
|
+
return singleton(new ProfileEvent(10, [_arg.fields[0]]));
|
|
81
|
+
case 11:
|
|
82
|
+
return singleton(new ProfileEvent(11, [_arg.fields[0]]));
|
|
83
|
+
case 12:
|
|
84
|
+
return singleton(new ProfileEvent(12, [_arg.fields[0]]));
|
|
85
|
+
case 13:
|
|
86
|
+
return singleton(new ProfileEvent(13, [_arg.fields[0]]));
|
|
87
|
+
case 14:
|
|
88
|
+
return singleton(new ProfileEvent(14, [_arg.fields[0]]));
|
|
89
|
+
case 15:
|
|
90
|
+
return singleton(new ProfileEvent(15, [_arg.fields[0]]));
|
|
91
|
+
case 16:
|
|
92
|
+
return singleton(new ProfileEvent(16, []));
|
|
93
|
+
default:
|
|
94
|
+
return singleton(new ProfileEvent(0, [_arg.fields[0]]));
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
function markUpdated(timestamp, profile) {
|
|
99
|
+
return ProfileModule_incrementVersion(0, timestamp, profile);
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
function update(timestamp, profile, updater) {
|
|
103
|
+
return Result_Map((profile_2) => markUpdated(timestamp, profile_2), ProfileModule_tryUpdate(updater, profile));
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
function applyToExisting(profile, event) {
|
|
107
|
+
const ts = event.Metadata.Timestamp;
|
|
108
|
+
const markUpdated$0027 = (profile_1) => markUpdated(ts, profile_1);
|
|
109
|
+
const update$0027 = (profile_2, updater) => update(ts, profile_2, updater);
|
|
110
|
+
const matchValue = event.Data;
|
|
111
|
+
switch (matchValue.tag) {
|
|
112
|
+
case 5:
|
|
113
|
+
return Result_Map(markUpdated$0027, ProfileModule_tryDeactivate(profile));
|
|
114
|
+
case 6:
|
|
115
|
+
return Result_Map(markUpdated$0027, ProfileModule_tryArchive(profile));
|
|
116
|
+
case 7:
|
|
117
|
+
return Result_Map(markUpdated$0027, ProfileModule_tryRestore(profile));
|
|
118
|
+
case 8:
|
|
119
|
+
return update$0027(profile, new ProfileModule_Updater(0, [(p) => (new ProfileDetail(p.Metadata, p.AccountId, matchValue.fields[0], p.Title, p.Gender, p.Email, p.MobilePhone, p.DateOfBirth, p.Address, p.ExternalId, p.EmergencyContacts))]));
|
|
120
|
+
case 9:
|
|
121
|
+
return update$0027(profile, new ProfileModule_Updater(0, [(p_1) => (new ProfileDetail(p_1.Metadata, p_1.AccountId, p_1.Name, matchValue.fields[0], p_1.Gender, p_1.Email, p_1.MobilePhone, p_1.DateOfBirth, p_1.Address, p_1.ExternalId, p_1.EmergencyContacts))]));
|
|
122
|
+
case 10:
|
|
123
|
+
return update$0027(profile, new ProfileModule_Updater(0, [(p_2) => (new ProfileDetail(p_2.Metadata, p_2.AccountId, p_2.Name, p_2.Title, matchValue.fields[0], p_2.Email, p_2.MobilePhone, p_2.DateOfBirth, p_2.Address, p_2.ExternalId, p_2.EmergencyContacts))]));
|
|
124
|
+
case 11:
|
|
125
|
+
return update$0027(profile, new ProfileModule_Updater(0, [(p_3) => (new ProfileDetail(p_3.Metadata, p_3.AccountId, p_3.Name, p_3.Title, p_3.Gender, matchValue.fields[0], p_3.MobilePhone, p_3.DateOfBirth, p_3.Address, p_3.ExternalId, p_3.EmergencyContacts))]));
|
|
126
|
+
case 12:
|
|
127
|
+
return update$0027(profile, new ProfileModule_Updater(0, [(p_4) => (new ProfileDetail(p_4.Metadata, p_4.AccountId, p_4.Name, p_4.Title, p_4.Gender, p_4.Email, matchValue.fields[0], p_4.DateOfBirth, p_4.Address, p_4.ExternalId, p_4.EmergencyContacts))]));
|
|
128
|
+
case 13:
|
|
129
|
+
return update$0027(profile, new ProfileModule_Updater(0, [(p_5) => (new ProfileDetail(p_5.Metadata, p_5.AccountId, p_5.Name, p_5.Title, p_5.Gender, p_5.Email, p_5.MobilePhone, matchValue.fields[0], p_5.Address, p_5.ExternalId, p_5.EmergencyContacts))]));
|
|
130
|
+
case 14:
|
|
131
|
+
return update$0027(profile, new ProfileModule_Updater(0, [(p_6) => (new ProfileDetail(p_6.Metadata, p_6.AccountId, p_6.Name, p_6.Title, p_6.Gender, p_6.Email, p_6.MobilePhone, p_6.DateOfBirth, matchValue.fields[0], p_6.ExternalId, p_6.EmergencyContacts))]));
|
|
132
|
+
case 15:
|
|
133
|
+
return update$0027(profile, new ProfileModule_Updater(0, [(p_7) => (new ProfileDetail(p_7.Metadata, p_7.AccountId, p_7.Name, p_7.Title, p_7.Gender, p_7.Email, p_7.MobilePhone, p_7.DateOfBirth, p_7.Address, p_7.ExternalId, matchValue.fields[0]))]));
|
|
134
|
+
case 16:
|
|
135
|
+
return Result_Map(markUpdated$0027, ProfileModule_tryPurge(profile));
|
|
136
|
+
case 0:
|
|
137
|
+
case 1:
|
|
138
|
+
return new FSharpResult$2(1, ["Profile already exists"]);
|
|
139
|
+
case 3:
|
|
140
|
+
return Result_Map(markUpdated$0027, ProfileModule_tryPromotePartial(matchValue.fields[0], profile));
|
|
141
|
+
case 2:
|
|
142
|
+
return update$0027(profile, new ProfileModule_Updater(1, [(current) => PartialProfileDetailModule_update(matchValue.fields[0], current)]));
|
|
143
|
+
default:
|
|
144
|
+
return Result_Map(markUpdated$0027, ProfileModule_tryActivate(profile));
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
function applyToNewProfile(event) {
|
|
149
|
+
const aggregateMetadata = ProfileEventMetadataModule_toAggregateMetaData(event.Metadata);
|
|
150
|
+
const matchValue = event.Data;
|
|
151
|
+
switch (matchValue.tag) {
|
|
152
|
+
case 0:
|
|
153
|
+
return new FSharpResult$2(0, [ProfileModule_create(aggregateMetadata, matchValue.fields[0])]);
|
|
154
|
+
case 1:
|
|
155
|
+
return new FSharpResult$2(0, [ProfileModule_createPartial(aggregateMetadata, matchValue.fields[0])]);
|
|
156
|
+
default:
|
|
157
|
+
return new FSharpResult$2(1, ["Profile doesn\'t exist"]);
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
function eventFolder(state, event) {
|
|
162
|
+
if (state.tag === 0) {
|
|
163
|
+
if (state.fields[0] != null) {
|
|
164
|
+
return Result_Map((Value_1) => Value_1, applyToExisting(state.fields[0], event));
|
|
165
|
+
}
|
|
166
|
+
else {
|
|
167
|
+
return Result_Map((Value) => Value, applyToNewProfile(event));
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
else {
|
|
171
|
+
return new FSharpResult$2(1, [state.fields[0]]);
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
function triggerEvents(profile, command) {
|
|
176
|
+
return mapIndexed((index, event) => (new Event$1(new EventId(newGuid()), command.Id, event, ProfileEventMetadataModule_incrementVersion(index, CommandMetadata_toEventMetadata(command.Metadata)))), ofCommand(profile, command.Data));
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
function handleConsistentCommand(profile, command) {
|
|
180
|
+
const events = triggerEvents(profile, command);
|
|
181
|
+
if (isEmpty(events)) {
|
|
182
|
+
return new HandlerResult(0, []);
|
|
183
|
+
}
|
|
184
|
+
else {
|
|
185
|
+
const result = fold(eventFolder, new FSharpResult$2(0, [profile]), events);
|
|
186
|
+
const copyOfStruct = result;
|
|
187
|
+
if (copyOfStruct.tag === 1) {
|
|
188
|
+
return new HandlerResult(1, [copyOfStruct.fields[0]]);
|
|
189
|
+
}
|
|
190
|
+
else if (copyOfStruct.fields[0] != null) {
|
|
191
|
+
if (profile != null) {
|
|
192
|
+
const newProfile_1 = copyOfStruct.fields[0];
|
|
193
|
+
return new HandlerResult(4, [newProfile_1, events]);
|
|
194
|
+
}
|
|
195
|
+
else {
|
|
196
|
+
const newProfile = copyOfStruct.fields[0];
|
|
197
|
+
return new HandlerResult(3, [newProfile, events]);
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
else {
|
|
201
|
+
return new HandlerResult(0, []);
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
export function handle(profile, command) {
|
|
207
|
+
let arg_2;
|
|
208
|
+
const matchValue = command.Metadata.Version | 0;
|
|
209
|
+
if (profile != null) {
|
|
210
|
+
if (ProfileModule_getMetadata(profile).Version === matchValue) {
|
|
211
|
+
const p_1 = profile;
|
|
212
|
+
return handleConsistentCommand(profile, command);
|
|
213
|
+
}
|
|
214
|
+
else {
|
|
215
|
+
const p_2 = profile;
|
|
216
|
+
return new HandlerResult(2, [(arg_2 = (ProfileModule_getMetadata(p_2).Version | 0), toText(printf("Inconsistent command version: %i (should be %i)"))(matchValue)(arg_2))]);
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
else if (matchValue === 0) {
|
|
220
|
+
return handleConsistentCommand(profile, command);
|
|
221
|
+
}
|
|
222
|
+
else {
|
|
223
|
+
return new HandlerResult(2, [toText(printf("Inconsistent command version: %i (should be 0)"))(matchValue)]);
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
export function handleBatchUpdate(profile, commands) {
|
|
228
|
+
let p;
|
|
229
|
+
const result = fold((state, command) => {
|
|
230
|
+
if (state.tag === 0) {
|
|
231
|
+
const matchValue = handle(state.fields[0][1], command);
|
|
232
|
+
if (matchValue.tag === 4) {
|
|
233
|
+
return new FSharpResult$2(0, [[append(state.fields[0][0], matchValue.fields[1]), matchValue.fields[0]]]);
|
|
234
|
+
}
|
|
235
|
+
else {
|
|
236
|
+
return new FSharpResult$2(1, [toText(printf("%A"))(matchValue)]);
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
else {
|
|
240
|
+
return state;
|
|
241
|
+
}
|
|
242
|
+
}, new FSharpResult$2(0, [[empty(), profile]]), commands);
|
|
243
|
+
if (result.tag === 1) {
|
|
244
|
+
return new HandlerResult(2, [result.fields[0]]);
|
|
245
|
+
}
|
|
246
|
+
else {
|
|
247
|
+
const updatedProfileOption = result.fields[0][1];
|
|
248
|
+
const events_1 = result.fields[0][0];
|
|
249
|
+
if (updatedProfileOption == null) {
|
|
250
|
+
return new HandlerResult(2, ["Inconsistent batch of update commands"]);
|
|
251
|
+
}
|
|
252
|
+
else if ((p = updatedProfileOption, length(events_1) > 0)) {
|
|
253
|
+
const p_1 = updatedProfileOption;
|
|
254
|
+
return new HandlerResult(4, [p_1, events_1]);
|
|
255
|
+
}
|
|
256
|
+
else {
|
|
257
|
+
return new HandlerResult(0, []);
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { Record } from "../fable_modules/fable-library-js.4.20.0/Types.js";
|
|
2
|
+
import { ExternalId_$reflection, Address_$reflection, DateOfBirth_$reflection, MobilePhone_$reflection, Email_$reflection, Gender_$reflection, Title_$reflection, Name_$reflection, AccountId_$reflection } from "./DomainPrimitives.jsx";
|
|
3
|
+
import { record_type, option_type } from "../fable_modules/fable-library-js.4.20.0/Reflection.js";
|
|
4
|
+
|
|
5
|
+
export class FullProfileCreationDetails extends Record {
|
|
6
|
+
constructor(AccountId, Name, Title, Gender, Email, MobilePhone, DateOfBirth, Address, ExternalId) {
|
|
7
|
+
super();
|
|
8
|
+
this.AccountId = AccountId;
|
|
9
|
+
this.Name = Name;
|
|
10
|
+
this.Title = Title;
|
|
11
|
+
this.Gender = Gender;
|
|
12
|
+
this.Email = Email;
|
|
13
|
+
this.MobilePhone = MobilePhone;
|
|
14
|
+
this.DateOfBirth = DateOfBirth;
|
|
15
|
+
this.Address = Address;
|
|
16
|
+
this.ExternalId = ExternalId;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export function FullProfileCreationDetails_$reflection() {
|
|
21
|
+
return record_type("ProfileModels.FullProfileCreationDetails", [], FullProfileCreationDetails, () => [["AccountId", AccountId_$reflection()], ["Name", Name_$reflection()], ["Title", Title_$reflection()], ["Gender", Gender_$reflection()], ["Email", Email_$reflection()], ["MobilePhone", MobilePhone_$reflection()], ["DateOfBirth", DateOfBirth_$reflection()], ["Address", Address_$reflection()], ["ExternalId", option_type(ExternalId_$reflection())]]);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export class PartialProfileCreationDetails extends Record {
|
|
25
|
+
constructor(AccountId, Name, Email, MobilePhone, ExternalId, Title, Gender, DateOfBirth, Address) {
|
|
26
|
+
super();
|
|
27
|
+
this.AccountId = AccountId;
|
|
28
|
+
this.Name = Name;
|
|
29
|
+
this.Email = Email;
|
|
30
|
+
this.MobilePhone = MobilePhone;
|
|
31
|
+
this.ExternalId = ExternalId;
|
|
32
|
+
this.Title = Title;
|
|
33
|
+
this.Gender = Gender;
|
|
34
|
+
this.DateOfBirth = DateOfBirth;
|
|
35
|
+
this.Address = Address;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export function PartialProfileCreationDetails_$reflection() {
|
|
40
|
+
return record_type("ProfileModels.PartialProfileCreationDetails", [], PartialProfileCreationDetails, () => [["AccountId", AccountId_$reflection()], ["Name", Name_$reflection()], ["Email", Email_$reflection()], ["MobilePhone", option_type(MobilePhone_$reflection())], ["ExternalId", option_type(ExternalId_$reflection())], ["Title", option_type(Title_$reflection())], ["Gender", option_type(Gender_$reflection())], ["DateOfBirth", option_type(DateOfBirth_$reflection())], ["Address", option_type(Address_$reflection())]]);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export class PartialProfileUpdateDetails extends Record {
|
|
44
|
+
constructor(Name, Email, MobilePhone, Title, Gender, DateOfBirth, Address) {
|
|
45
|
+
super();
|
|
46
|
+
this.Name = Name;
|
|
47
|
+
this.Email = Email;
|
|
48
|
+
this.MobilePhone = MobilePhone;
|
|
49
|
+
this.Title = Title;
|
|
50
|
+
this.Gender = Gender;
|
|
51
|
+
this.DateOfBirth = DateOfBirth;
|
|
52
|
+
this.Address = Address;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
export function PartialProfileUpdateDetails_$reflection() {
|
|
57
|
+
return record_type("ProfileModels.PartialProfileUpdateDetails", [], PartialProfileUpdateDetails, () => [["Name", Name_$reflection()], ["Email", Email_$reflection()], ["MobilePhone", option_type(MobilePhone_$reflection())], ["Title", option_type(Title_$reflection())], ["Gender", option_type(Gender_$reflection())], ["DateOfBirth", option_type(DateOfBirth_$reflection())], ["Address", option_type(Address_$reflection())]]);
|
|
58
|
+
}
|
|
59
|
+
|
|
@@ -0,0 +1,372 @@
|
|
|
1
|
+
import { create, match } from "../fable_modules/fable-library-js.4.20.0/RegExp.js";
|
|
2
|
+
import { head, isEmpty, tail } from "../fable_modules/fable-library-js.4.20.0/List.js";
|
|
3
|
+
import { map, delay, toList } from "../fable_modules/fable-library-js.4.20.0/Seq.js";
|
|
4
|
+
import { interpolate, toText, isNullOrEmpty } from "../fable_modules/fable-library-js.4.20.0/String.js";
|
|
5
|
+
import { FSharpResult$2 } from "../fable_modules/fable-library-js.4.20.0/Result.js";
|
|
6
|
+
import { defaultOf } from "../fable_modules/fable-library-js.4.20.0/Util.js";
|
|
7
|
+
import { tryParse } from "../fable_modules/fable-library-js.4.20.0/Int32.js";
|
|
8
|
+
import { FSharpRef } from "../fable_modules/fable-library-js.4.20.0/Types.js";
|
|
9
|
+
import { some } from "../fable_modules/fable-library-js.4.20.0/Option.js";
|
|
10
|
+
import { create as create_1, isLeapYear } from "../fable_modules/fable-library-js.4.20.0/Date.js";
|
|
11
|
+
|
|
12
|
+
export function $007CParseRegex$007C_$007C(regex, str) {
|
|
13
|
+
const m = match(create(regex), str);
|
|
14
|
+
if (m != null) {
|
|
15
|
+
return tail(toList(delay(() => map((x) => (x || ""), m))));
|
|
16
|
+
}
|
|
17
|
+
else {
|
|
18
|
+
return undefined;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export function $007CIsValidEmail$007C_$007C(input) {
|
|
23
|
+
let matchResult;
|
|
24
|
+
const activePatternResult = $007CParseRegex$007C_$007C(".*?@(.*)", input);
|
|
25
|
+
if (activePatternResult != null) {
|
|
26
|
+
if (!isEmpty(activePatternResult)) {
|
|
27
|
+
if (isEmpty(tail(activePatternResult))) {
|
|
28
|
+
matchResult = 0;
|
|
29
|
+
}
|
|
30
|
+
else {
|
|
31
|
+
matchResult = 1;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
else {
|
|
35
|
+
matchResult = 1;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
else {
|
|
39
|
+
matchResult = 1;
|
|
40
|
+
}
|
|
41
|
+
switch (matchResult) {
|
|
42
|
+
case 0:
|
|
43
|
+
return input;
|
|
44
|
+
default:
|
|
45
|
+
return undefined;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export function requireNonEmpty(name, value) {
|
|
50
|
+
if (isNullOrEmpty(value)) {
|
|
51
|
+
return new FSharpResult$2(1, [`${name} cannot be null or empty`]);
|
|
52
|
+
}
|
|
53
|
+
else {
|
|
54
|
+
return new FSharpResult$2(0, [value]);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export function requireMaxLength(maxLength, name, value) {
|
|
59
|
+
if (value === defaultOf()) {
|
|
60
|
+
return new FSharpResult$2(0, [value]);
|
|
61
|
+
}
|
|
62
|
+
else if (value.length <= maxLength) {
|
|
63
|
+
return new FSharpResult$2(0, [value]);
|
|
64
|
+
}
|
|
65
|
+
else {
|
|
66
|
+
return new FSharpResult$2(1, [toText(interpolate("%s%P() should not exceed %d%P() characters", [name, maxLength]))]);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
export function requireEmail(value) {
|
|
71
|
+
const activePatternResult = $007CIsValidEmail$007C_$007C(value);
|
|
72
|
+
if (activePatternResult != null) {
|
|
73
|
+
const value_1 = activePatternResult;
|
|
74
|
+
return new FSharpResult$2(0, [value_1]);
|
|
75
|
+
}
|
|
76
|
+
else {
|
|
77
|
+
return new FSharpResult$2(1, ["Email is not in the correct format"]);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
export function $007CInt$007C_$007C(str) {
|
|
82
|
+
let matchValue;
|
|
83
|
+
let outArg = 0;
|
|
84
|
+
matchValue = [tryParse(str, 511, false, 32, new FSharpRef(() => outArg, (v) => {
|
|
85
|
+
outArg = (v | 0);
|
|
86
|
+
})), outArg];
|
|
87
|
+
if (matchValue[0]) {
|
|
88
|
+
return matchValue[1];
|
|
89
|
+
}
|
|
90
|
+
else {
|
|
91
|
+
return undefined;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
export function $007CBetween$007C_$007C(x, y, input) {
|
|
96
|
+
if ((input >= x) && (input <= y)) {
|
|
97
|
+
return some(undefined);
|
|
98
|
+
}
|
|
99
|
+
else {
|
|
100
|
+
return undefined;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
export function Date_isLeapYear(year) {
|
|
105
|
+
return isLeapYear(year);
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
export function Date_getDateParts(dateErr, dateStr) {
|
|
109
|
+
const activePatternResult_3 = $007CParseRegex$007C_$007C("^(\\d{4})-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])$", dateStr);
|
|
110
|
+
if (activePatternResult_3 != null) {
|
|
111
|
+
const d_1 = activePatternResult_3;
|
|
112
|
+
let matchResult, d_2, m_1, y_1;
|
|
113
|
+
if (!isEmpty(d_1)) {
|
|
114
|
+
if (!isEmpty(tail(d_1))) {
|
|
115
|
+
if (!isEmpty(tail(tail(d_1)))) {
|
|
116
|
+
if (isEmpty(tail(tail(tail(d_1))))) {
|
|
117
|
+
matchResult = 0;
|
|
118
|
+
d_2 = head(tail(tail(d_1)));
|
|
119
|
+
m_1 = head(tail(d_1));
|
|
120
|
+
y_1 = head(d_1);
|
|
121
|
+
}
|
|
122
|
+
else {
|
|
123
|
+
matchResult = 1;
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
else {
|
|
127
|
+
matchResult = 1;
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
else {
|
|
131
|
+
matchResult = 1;
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
else {
|
|
135
|
+
matchResult = 1;
|
|
136
|
+
}
|
|
137
|
+
switch (matchResult) {
|
|
138
|
+
case 0: {
|
|
139
|
+
const tupledArg = [y_1, m_1, d_2];
|
|
140
|
+
let matchResult_1, id, im, iy;
|
|
141
|
+
const activePatternResult = $007CInt$007C_$007C(tupledArg[0]);
|
|
142
|
+
if (activePatternResult != null) {
|
|
143
|
+
const activePatternResult_1 = $007CInt$007C_$007C(tupledArg[1]);
|
|
144
|
+
if (activePatternResult_1 != null) {
|
|
145
|
+
const activePatternResult_2 = $007CInt$007C_$007C(tupledArg[2]);
|
|
146
|
+
if (activePatternResult_2 != null) {
|
|
147
|
+
matchResult_1 = 0;
|
|
148
|
+
id = activePatternResult_2;
|
|
149
|
+
im = activePatternResult_1;
|
|
150
|
+
iy = activePatternResult;
|
|
151
|
+
}
|
|
152
|
+
else {
|
|
153
|
+
matchResult_1 = 1;
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
else {
|
|
157
|
+
matchResult_1 = 1;
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
else {
|
|
161
|
+
matchResult_1 = 1;
|
|
162
|
+
}
|
|
163
|
+
switch (matchResult_1) {
|
|
164
|
+
case 0:
|
|
165
|
+
return new FSharpResult$2(0, [[iy, im, id]]);
|
|
166
|
+
default:
|
|
167
|
+
return new FSharpResult$2(1, [dateErr]);
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
default:
|
|
171
|
+
return new FSharpResult$2(1, [dateErr]);
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
else {
|
|
175
|
+
return new FSharpResult$2(1, [dateErr]);
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
function Date_tryParseHelper(dateErr, dateSuccess, dateOfBirth) {
|
|
180
|
+
const input_1 = Date_getDateParts(dateErr, dateOfBirth);
|
|
181
|
+
if (input_1.tag === 1) {
|
|
182
|
+
return new FSharpResult$2(1, [input_1.fields[0]]);
|
|
183
|
+
}
|
|
184
|
+
else {
|
|
185
|
+
const _arg = input_1.fields[0];
|
|
186
|
+
const year = _arg[0] | 0;
|
|
187
|
+
const month = _arg[1] | 0;
|
|
188
|
+
const day = _arg[2] | 0;
|
|
189
|
+
if (year <= 0) {
|
|
190
|
+
return new FSharpResult$2(1, [dateErr]);
|
|
191
|
+
}
|
|
192
|
+
else {
|
|
193
|
+
let matchResult;
|
|
194
|
+
if (month === 2) {
|
|
195
|
+
if ($007CBetween$007C_$007C(1, 29, day) != null) {
|
|
196
|
+
if (Date_isLeapYear(year)) {
|
|
197
|
+
matchResult = 0;
|
|
198
|
+
}
|
|
199
|
+
else {
|
|
200
|
+
matchResult = 1;
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
else {
|
|
204
|
+
matchResult = 1;
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
else {
|
|
208
|
+
matchResult = 1;
|
|
209
|
+
}
|
|
210
|
+
switch (matchResult) {
|
|
211
|
+
case 0:
|
|
212
|
+
return new FSharpResult$2(0, [dateSuccess(year, month, day)]);
|
|
213
|
+
default: {
|
|
214
|
+
let matchResult_1;
|
|
215
|
+
if (month === 2) {
|
|
216
|
+
if ($007CBetween$007C_$007C(1, 28, day) != null) {
|
|
217
|
+
if (!Date_isLeapYear(year)) {
|
|
218
|
+
matchResult_1 = 0;
|
|
219
|
+
}
|
|
220
|
+
else {
|
|
221
|
+
matchResult_1 = 1;
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
else {
|
|
225
|
+
matchResult_1 = 1;
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
else {
|
|
229
|
+
matchResult_1 = 1;
|
|
230
|
+
}
|
|
231
|
+
switch (matchResult_1) {
|
|
232
|
+
case 0:
|
|
233
|
+
return new FSharpResult$2(0, [dateSuccess(year, month, day)]);
|
|
234
|
+
default: {
|
|
235
|
+
let matchResult_2;
|
|
236
|
+
switch (month) {
|
|
237
|
+
case 1: {
|
|
238
|
+
if ($007CBetween$007C_$007C(1, 31, day) != null) {
|
|
239
|
+
matchResult_2 = 0;
|
|
240
|
+
}
|
|
241
|
+
else {
|
|
242
|
+
matchResult_2 = 1;
|
|
243
|
+
}
|
|
244
|
+
break;
|
|
245
|
+
}
|
|
246
|
+
case 3: {
|
|
247
|
+
if ($007CBetween$007C_$007C(1, 31, day) != null) {
|
|
248
|
+
matchResult_2 = 0;
|
|
249
|
+
}
|
|
250
|
+
else {
|
|
251
|
+
matchResult_2 = 1;
|
|
252
|
+
}
|
|
253
|
+
break;
|
|
254
|
+
}
|
|
255
|
+
case 5: {
|
|
256
|
+
if ($007CBetween$007C_$007C(1, 31, day) != null) {
|
|
257
|
+
matchResult_2 = 0;
|
|
258
|
+
}
|
|
259
|
+
else {
|
|
260
|
+
matchResult_2 = 1;
|
|
261
|
+
}
|
|
262
|
+
break;
|
|
263
|
+
}
|
|
264
|
+
case 7: {
|
|
265
|
+
if ($007CBetween$007C_$007C(1, 31, day) != null) {
|
|
266
|
+
matchResult_2 = 0;
|
|
267
|
+
}
|
|
268
|
+
else {
|
|
269
|
+
matchResult_2 = 1;
|
|
270
|
+
}
|
|
271
|
+
break;
|
|
272
|
+
}
|
|
273
|
+
case 8: {
|
|
274
|
+
if ($007CBetween$007C_$007C(1, 31, day) != null) {
|
|
275
|
+
matchResult_2 = 0;
|
|
276
|
+
}
|
|
277
|
+
else {
|
|
278
|
+
matchResult_2 = 1;
|
|
279
|
+
}
|
|
280
|
+
break;
|
|
281
|
+
}
|
|
282
|
+
case 10: {
|
|
283
|
+
if ($007CBetween$007C_$007C(1, 31, day) != null) {
|
|
284
|
+
matchResult_2 = 0;
|
|
285
|
+
}
|
|
286
|
+
else {
|
|
287
|
+
matchResult_2 = 1;
|
|
288
|
+
}
|
|
289
|
+
break;
|
|
290
|
+
}
|
|
291
|
+
case 12: {
|
|
292
|
+
if ($007CBetween$007C_$007C(1, 31, day) != null) {
|
|
293
|
+
matchResult_2 = 0;
|
|
294
|
+
}
|
|
295
|
+
else {
|
|
296
|
+
matchResult_2 = 1;
|
|
297
|
+
}
|
|
298
|
+
break;
|
|
299
|
+
}
|
|
300
|
+
default:
|
|
301
|
+
matchResult_2 = 1;
|
|
302
|
+
}
|
|
303
|
+
switch (matchResult_2) {
|
|
304
|
+
case 0:
|
|
305
|
+
return new FSharpResult$2(0, [dateSuccess(year, month, day)]);
|
|
306
|
+
default: {
|
|
307
|
+
let matchResult_3;
|
|
308
|
+
switch (month) {
|
|
309
|
+
case 4: {
|
|
310
|
+
if ($007CBetween$007C_$007C(1, 30, day) != null) {
|
|
311
|
+
matchResult_3 = 0;
|
|
312
|
+
}
|
|
313
|
+
else {
|
|
314
|
+
matchResult_3 = 1;
|
|
315
|
+
}
|
|
316
|
+
break;
|
|
317
|
+
}
|
|
318
|
+
case 6: {
|
|
319
|
+
if ($007CBetween$007C_$007C(1, 30, day) != null) {
|
|
320
|
+
matchResult_3 = 0;
|
|
321
|
+
}
|
|
322
|
+
else {
|
|
323
|
+
matchResult_3 = 1;
|
|
324
|
+
}
|
|
325
|
+
break;
|
|
326
|
+
}
|
|
327
|
+
case 9: {
|
|
328
|
+
if ($007CBetween$007C_$007C(1, 30, day) != null) {
|
|
329
|
+
matchResult_3 = 0;
|
|
330
|
+
}
|
|
331
|
+
else {
|
|
332
|
+
matchResult_3 = 1;
|
|
333
|
+
}
|
|
334
|
+
break;
|
|
335
|
+
}
|
|
336
|
+
case 11: {
|
|
337
|
+
if ($007CBetween$007C_$007C(1, 30, day) != null) {
|
|
338
|
+
matchResult_3 = 0;
|
|
339
|
+
}
|
|
340
|
+
else {
|
|
341
|
+
matchResult_3 = 1;
|
|
342
|
+
}
|
|
343
|
+
break;
|
|
344
|
+
}
|
|
345
|
+
default:
|
|
346
|
+
matchResult_3 = 1;
|
|
347
|
+
}
|
|
348
|
+
switch (matchResult_3) {
|
|
349
|
+
case 0:
|
|
350
|
+
return new FSharpResult$2(0, [dateSuccess(year, month, day)]);
|
|
351
|
+
default:
|
|
352
|
+
return new FSharpResult$2(1, [dateErr]);
|
|
353
|
+
}
|
|
354
|
+
}
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
}
|
|
358
|
+
}
|
|
359
|
+
}
|
|
360
|
+
}
|
|
361
|
+
}
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
export function Date_isValid(dateErr, dateOfBirth) {
|
|
365
|
+
return Date_tryParseHelper(dateErr, (_arg, _arg_1, _arg_2) => {
|
|
366
|
+
}, dateOfBirth);
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
export function Date_tryParse(dateErr, dateOfBirth) {
|
|
370
|
+
return Date_tryParseHelper(dateErr, create_1, dateOfBirth);
|
|
371
|
+
}
|
|
372
|
+
|