@flarehr/superhero-basic-profile 0.1.2217 → 0.1.2219

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 (76) hide show
  1. package/dist/assets/delete.dcc7b157.svg +5 -0
  2. package/dist/assets/dialog-warning.cc77f3ba.svg +5 -0
  3. package/dist/assets/pencil.05fe6be6.svg +5 -0
  4. package/dist/index.html +20 -0
  5. package/dist/superhero-basic-profile.js +50 -0
  6. package/package.json +1 -1
  7. package/dist/App.jsx +0 -4
  8. package/dist/Basic.Profile.Domain/AnalyticsEvent.jsx +0 -102
  9. package/dist/Basic.Profile.Domain/Audit.jsx +0 -149
  10. package/dist/Basic.Profile.Domain/Commands.jsx +0 -68
  11. package/dist/Basic.Profile.Domain/CommonTypes.jsx +0 -194
  12. package/dist/Basic.Profile.Domain/Config/Api/Admin/Read.jsx +0 -58
  13. package/dist/Basic.Profile.Domain/Config/Api/Admin/Write.jsx +0 -23
  14. package/dist/Basic.Profile.Domain/Config/Api/FlareAdminShell/Read.jsx +0 -35
  15. package/dist/Basic.Profile.Domain/Config/Commands.jsx +0 -72
  16. package/dist/Basic.Profile.Domain/Config/ConfigCommandHandler.jsx +0 -197
  17. package/dist/Basic.Profile.Domain/Config/Dto.jsx +0 -181
  18. package/dist/Basic.Profile.Domain/Config/Types.jsx +0 -152
  19. package/dist/Basic.Profile.Domain/DateTimeProvider.jsx +0 -23
  20. package/dist/Basic.Profile.Domain/DomainAggregates.jsx +0 -801
  21. package/dist/Basic.Profile.Domain/DomainPrimitives.jsx +0 -426
  22. package/dist/Basic.Profile.Domain/Dto/Aggregates.jsx +0 -564
  23. package/dist/Basic.Profile.Domain/Dto/AnalyticsEvent.jsx +0 -157
  24. package/dist/Basic.Profile.Domain/Dto/Api/Backend/Common.jsx +0 -102
  25. package/dist/Basic.Profile.Domain/Dto/Api/Backend/Read.jsx +0 -85
  26. package/dist/Basic.Profile.Domain/Dto/Api/Backend/Write.jsx +0 -16
  27. package/dist/Basic.Profile.Domain/Dto/Api/Common.jsx +0 -427
  28. package/dist/Basic.Profile.Domain/Dto/Api/External/Read.jsx +0 -118
  29. package/dist/Basic.Profile.Domain/Dto/Api/External/ReadV2.jsx +0 -6
  30. package/dist/Basic.Profile.Domain/Dto/Api/External/Write.jsx +0 -184
  31. package/dist/Basic.Profile.Domain/Dto/Api/External/WriteV2.jsx +0 -439
  32. package/dist/Basic.Profile.Domain/Dto/Api/FlareAdminShell/Read.jsx +0 -38
  33. package/dist/Basic.Profile.Domain/Dto/Api/FlareAdminShell/Write.jsx +0 -199
  34. package/dist/Basic.Profile.Domain/Dto/Api/Internal/Read.jsx +0 -125
  35. package/dist/Basic.Profile.Domain/Dto/Audit.jsx +0 -121
  36. package/dist/Basic.Profile.Domain/Dto/Commands.jsx +0 -256
  37. package/dist/Basic.Profile.Domain/Dto/Common.jsx +0 -84
  38. package/dist/Basic.Profile.Domain/Dto/Events.jsx +0 -220
  39. package/dist/Basic.Profile.Domain/Dto/Primitives.jsx +0 -580
  40. package/dist/Basic.Profile.Domain/Dto/ProfileCreationModels.jsx +0 -324
  41. package/dist/Basic.Profile.Domain/Dto/Validation.jsx +0 -229
  42. package/dist/Basic.Profile.Domain/Events.jsx +0 -64
  43. package/dist/Basic.Profile.Domain/Import/Api/InternalApi/Read.jsx +0 -140
  44. package/dist/Basic.Profile.Domain/Import/Api/InternalApi/Validation.jsx +0 -499
  45. package/dist/Basic.Profile.Domain/Import/Api/InternalApi/Write.jsx +0 -51
  46. package/dist/Basic.Profile.Domain/Import/Api/Read.jsx +0 -154
  47. package/dist/Basic.Profile.Domain/Import/CommonTypes.jsx +0 -187
  48. package/dist/Basic.Profile.Domain/Import/Dto.jsx +0 -475
  49. package/dist/Basic.Profile.Domain/Import/ImportCommandHandler.jsx +0 -531
  50. package/dist/Basic.Profile.Domain/Import/Types.jsx +0 -405
  51. package/dist/Basic.Profile.Domain/JwtPayload.jsx +0 -44
  52. package/dist/Basic.Profile.Domain/Metadata.jsx +0 -257
  53. package/dist/Basic.Profile.Domain/ProfileCommandHandler.jsx +0 -261
  54. package/dist/Basic.Profile.Domain/ProfileModels.jsx +0 -59
  55. package/dist/Basic.Profile.Domain/Utils.jsx +0 -372
  56. package/dist/Common/PreactCustomElement.jsx +0 -8
  57. package/dist/Common/Resources.jsx +0 -20
  58. package/dist/Common/Tailwind.jsx +0 -8
  59. package/dist/Common/Utils.jsx +0 -18
  60. package/dist/Directory/App.jsx +0 -192
  61. package/dist/Directory/BackendServices/Common.jsx +0 -115
  62. package/dist/Directory/BackendServices/ConfigService.jsx +0 -168
  63. package/dist/Directory/BackendServices/ImportService.jsx +0 -137
  64. package/dist/Directory/Common.jsx +0 -93
  65. package/dist/Directory/Config/Components.jsx +0 -173
  66. package/dist/Directory/Config/Types.jsx +0 -187
  67. package/dist/Directory/PastImports/PastImports.jsx +0 -81
  68. package/dist/Directory/ProfileImport/ProfileImport.jsx +0 -284
  69. package/dist/Directory/ProfileImport/Types.jsx +0 -91
  70. package/dist/Directory/TabNav.jsx +0 -24
  71. package/dist/Directory/Types.jsx +0 -101
  72. package/dist/Directory/User.jsx +0 -117
  73. package/dist/HeadlessUI/Dialog.jsx +0 -66
  74. package/dist/HeadlessUI/ModalDialog.jsx +0 -74
  75. package/dist/HeadlessUI/Switch.jsx +0 -66
  76. package/dist/HeadlessUI/Transition.jsx +0 -66
@@ -1,199 +0,0 @@
1
- import { Record, Union } from "../../../../fable_modules/fable-library-js.4.20.0/Types.js";
2
- import { int32_type, option_type, string_type, record_type, list_type, union_type } from "../../../../fable_modules/fable-library-js.4.20.0/Reflection.js";
3
- import { StreamId_$reflection } from "../../../Metadata.jsx";
4
- import { Name_$reflection } from "../../Primitives.jsx";
5
- import { FSharpResult$2 } from "../../../../fable_modules/fable-library-js.4.20.0/Result.js";
6
- import { MobilePhone_toDomain, Email_toDomain, Name_toDomain } from "../Common.jsx";
7
- import { PartialProfileUpdateDetails, PartialProfileCreationDetails } from "../../../ProfileModels.jsx";
8
- import { newGuid } from "../../../../fable_modules/fable-library-js.4.20.0/Guid.js";
9
- import { Command$1, ProfileCommand, CommandId } from "../../../Commands.jsx";
10
- import { choose } from "../../../../fable_modules/fable-library-js.4.20.0/List.js";
11
- import { empty, singleton, append, delay, toList } from "../../../../fable_modules/fable-library-js.4.20.0/Seq.js";
12
- import { equals } from "../../../../fable_modules/fable-library-js.4.20.0/Util.js";
13
- import { defaultArg } from "../../../../fable_modules/fable-library-js.4.20.0/Option.js";
14
-
15
- export class BulkActionType extends Union {
16
- constructor(tag, fields) {
17
- super();
18
- this.tag = tag;
19
- this.fields = fields;
20
- }
21
- cases() {
22
- return ["Activate", "Deactivate", "Archive"];
23
- }
24
- }
25
-
26
- export function BulkActionType_$reflection() {
27
- return union_type("Dto.Api.FlareAdminShell.Write.BulkActionType", [], BulkActionType, () => [[], [], []]);
28
- }
29
-
30
- export class BulkActionDto extends Record {
31
- constructor(ActionType, ProfileIds) {
32
- super();
33
- this.ActionType = ActionType;
34
- this.ProfileIds = ProfileIds;
35
- }
36
- }
37
-
38
- export function BulkActionDto_$reflection() {
39
- return record_type("Dto.Api.FlareAdminShell.Write.BulkActionDto", [], BulkActionDto, () => [["ActionType", BulkActionType_$reflection()], ["ProfileIds", list_type(StreamId_$reflection())]]);
40
- }
41
-
42
- export class PartialProfileCreateDto extends Record {
43
- constructor(Name, Email, MobilePhone) {
44
- super();
45
- this.Name = Name;
46
- this.Email = Email;
47
- this.MobilePhone = MobilePhone;
48
- }
49
- }
50
-
51
- export function PartialProfileCreateDto_$reflection() {
52
- return record_type("Dto.Api.FlareAdminShell.Write.PartialProfileCreateDto", [], PartialProfileCreateDto, () => [["Name", Name_$reflection()], ["Email", string_type], ["MobilePhone", option_type(string_type)]]);
53
- }
54
-
55
- export function PartialProfileCreateDtoModule_toCommand(metadata, dto) {
56
- let commandPayload, copyOfStruct;
57
- let input_9;
58
- const option_1 = metadata.Domain;
59
- input_9 = ((option_1 == null) ? (new FSharpResult$2(1, ["Domain Metadata should have some value"])) : (new FSharpResult$2(0, [option_1])));
60
- if (input_9.tag === 1) {
61
- return new FSharpResult$2(1, [input_9.fields[0]]);
62
- }
63
- else {
64
- const input_7 = Name_toDomain(dto.Name);
65
- if (input_7.tag === 1) {
66
- return new FSharpResult$2(1, [input_7.fields[0]]);
67
- }
68
- else {
69
- const input_5 = Email_toDomain(dto.Email);
70
- if (input_5.tag === 1) {
71
- return new FSharpResult$2(1, [input_5.fields[0]]);
72
- }
73
- else {
74
- let input_3;
75
- const input_1 = dto.MobilePhone;
76
- if (input_1 != null) {
77
- const input_2 = MobilePhone_toDomain(input_1);
78
- input_3 = ((input_2.tag === 1) ? (new FSharpResult$2(1, [input_2.fields[0]])) : (new FSharpResult$2(0, [input_2.fields[0]])));
79
- }
80
- else {
81
- input_3 = (new FSharpResult$2(0, [undefined]));
82
- }
83
- if (input_3.tag === 1) {
84
- return new FSharpResult$2(1, [input_3.fields[0]]);
85
- }
86
- else {
87
- return new FSharpResult$2(0, [(commandPayload = (new PartialProfileCreationDetails(input_9.fields[0].AccountId, input_7.fields[0], input_5.fields[0], input_3.fields[0], undefined, undefined, undefined, undefined, undefined)), new Command$1(new CommandId((copyOfStruct = newGuid(), copyOfStruct)), new ProfileCommand(1, [commandPayload]), metadata))]);
88
- }
89
- }
90
- }
91
- }
92
- }
93
-
94
- export class UpdateProfileDto extends Record {
95
- constructor(Name, Email, MobilePhone, Version) {
96
- super();
97
- this.Name = Name;
98
- this.Email = Email;
99
- this.MobilePhone = MobilePhone;
100
- this.Version = (Version | 0);
101
- }
102
- }
103
-
104
- export function UpdateProfileDto_$reflection() {
105
- return record_type("Dto.Api.FlareAdminShell.Write.UpdateProfileDto", [], UpdateProfileDto, () => [["Name", Name_$reflection()], ["Email", string_type], ["MobilePhone", option_type(string_type)], ["Version", int32_type]]);
106
- }
107
-
108
- export function UpdateProfileDtoModule_getCommands(existingProfile, updateProfileDto) {
109
- let input_4;
110
- const input_10 = Name_toDomain(updateProfileDto.Name);
111
- if (input_10.tag === 1) {
112
- return new FSharpResult$2(1, [input_10.fields[0]]);
113
- }
114
- else {
115
- const name = input_10.fields[0];
116
- const input_8 = Email_toDomain(updateProfileDto.Email);
117
- if (input_8.tag === 1) {
118
- return new FSharpResult$2(1, [input_8.fields[0]]);
119
- }
120
- else {
121
- const email_1 = input_8.fields[0];
122
- let input_6;
123
- const input_1 = updateProfileDto.MobilePhone;
124
- if (input_1 != null) {
125
- const input_2 = MobilePhone_toDomain(input_1);
126
- input_6 = ((input_2.tag === 1) ? (new FSharpResult$2(1, [input_2.fields[0]])) : (new FSharpResult$2(0, [input_2.fields[0]])));
127
- }
128
- else {
129
- input_6 = (new FSharpResult$2(0, [undefined]));
130
- }
131
- if (input_6.tag === 1) {
132
- return new FSharpResult$2(1, [input_6.fields[0]]);
133
- }
134
- else {
135
- const mobilePhoneOption = input_6.fields[0];
136
- let matchResult, profileDetail, partialProfileDetail;
137
- switch (existingProfile.tag) {
138
- case 4:
139
- case 5:
140
- case 6: {
141
- matchResult = 2;
142
- break;
143
- }
144
- case 1: {
145
- matchResult = 0;
146
- profileDetail = existingProfile.fields[0];
147
- break;
148
- }
149
- case 2: {
150
- matchResult = 1;
151
- partialProfileDetail = existingProfile.fields[0];
152
- break;
153
- }
154
- case 3: {
155
- matchResult = 1;
156
- partialProfileDetail = existingProfile.fields[0];
157
- break;
158
- }
159
- default: {
160
- matchResult = 0;
161
- profileDetail = existingProfile.fields[0];
162
- }
163
- }
164
- switch (matchResult) {
165
- case 0:
166
- return new FSharpResult$2(0, [choose((x_1) => x_1, toList(delay(() => append(!equals(profileDetail.Name, name) ? singleton(new ProfileCommand(8, [name])) : empty(), delay(() => append(!equals(profileDetail.Email, email_1) ? singleton(new ProfileCommand(11, [email_1])) : empty(), delay(() => {
167
- const matchValue = mobilePhoneOption;
168
- let matchResult_1, m_2;
169
- if (matchValue != null) {
170
- if (!equals(profileDetail.MobilePhone, matchValue)) {
171
- matchResult_1 = 0;
172
- m_2 = matchValue;
173
- }
174
- else {
175
- matchResult_1 = 1;
176
- }
177
- }
178
- else {
179
- matchResult_1 = 1;
180
- }
181
- switch (matchResult_1) {
182
- case 0:
183
- return singleton(new ProfileCommand(12, [m_2]));
184
- default:
185
- return singleton(undefined);
186
- }
187
- })))))))]);
188
- case 1: {
189
- const shouldUpdate = (!equals(partialProfileDetail.Name, name) ? true : !equals(partialProfileDetail.Email, email_1)) ? true : defaultArg((input_4 = mobilePhoneOption, (input_4 == null) ? undefined : !equals(partialProfileDetail.MobilePhone, input_4)), false);
190
- return new FSharpResult$2(0, [toList(delay(() => (shouldUpdate ? singleton(new ProfileCommand(2, [new PartialProfileUpdateDetails(name, email_1, (mobilePhoneOption == null) ? partialProfileDetail.MobilePhone : mobilePhoneOption, partialProfileDetail.Title, partialProfileDetail.Gender, partialProfileDetail.DateOfBirth, partialProfileDetail.Address)])) : empty())))]);
191
- }
192
- default:
193
- return new FSharpResult$2(1, ["Cannot update profile when archived or purged"]);
194
- }
195
- }
196
- }
197
- }
198
- }
199
-
@@ -1,125 +0,0 @@
1
- import { Union, Record } from "../../../../fable_modules/fable-library-js.4.20.0/Types.js";
2
- import { ExternalId_ofDomain, AddressModule_ofDomain, DateOfBirth_ofDomain, MobilePhone_ofDomain, Email_ofDomain, Gender_ofDomain, Title_ofDomain, NameModule_ofDomain, AccountId_ofDomain, MetadataModule_ofDomain, Address_$reflection, Name_$reflection, Metadata_$reflection } from "../../Primitives.jsx";
3
- import { union_type, record_type, option_type, string_type, bool_type } from "../../../../fable_modules/fable-library-js.4.20.0/Reflection.js";
4
- import { map } from "../../../../fable_modules/fable-library-js.4.20.0/Option.js";
5
- import { Read_V2_ProfileDtoModule_ofDomainOperational, Read_V2_ProfileDtoModule_ofDomain, Read_V2_ProfileDto_$reflection } from "../Common.jsx";
6
- import { OperationalProfileModule_toDomain, ProfileModule_getMetadata, ProfileModule_getAccountId } from "../../../DomainAggregates.jsx";
7
-
8
- export class V1_Profile extends Record {
9
- constructor(Metadata, Enabled, AccountId, Name, Title, Gender, Email, MobilePhone, DateOfBirth, Address, ExternalId) {
10
- super();
11
- this.Metadata = Metadata;
12
- this.Enabled = Enabled;
13
- this.AccountId = AccountId;
14
- this.Name = Name;
15
- this.Title = Title;
16
- this.Gender = Gender;
17
- this.Email = Email;
18
- this.MobilePhone = MobilePhone;
19
- this.DateOfBirth = DateOfBirth;
20
- this.Address = Address;
21
- this.ExternalId = ExternalId;
22
- }
23
- }
24
-
25
- export function V1_Profile_$reflection() {
26
- return record_type("Dto.InternalApi.Read.V1.Profile", [], V1_Profile, () => [["Metadata", Metadata_$reflection()], ["Enabled", bool_type], ["AccountId", string_type], ["Name", Name_$reflection()], ["Title", string_type], ["Gender", string_type], ["Email", string_type], ["MobilePhone", string_type], ["DateOfBirth", string_type], ["Address", Address_$reflection()], ["ExternalId", option_type(string_type)]]);
27
- }
28
-
29
- export function V1_ProfileModule_ofDomain(p, enabled) {
30
- return new V1_Profile(MetadataModule_ofDomain(p.Metadata), enabled, AccountId_ofDomain(p.AccountId), NameModule_ofDomain(p.Name), Title_ofDomain(p.Title), Gender_ofDomain(p.Gender), Email_ofDomain(p.Email), MobilePhone_ofDomain(p.MobilePhone), DateOfBirth_ofDomain(p.DateOfBirth), AddressModule_ofDomain(p.Address), map(ExternalId_ofDomain, p.ExternalId));
31
- }
32
-
33
- export class V1_PartialProfile extends Record {
34
- constructor(Metadata, Enabled, AccountId, Name, Title, Gender, Email, MobilePhone, DateOfBirth, Address, ExternalId) {
35
- super();
36
- this.Metadata = Metadata;
37
- this.Enabled = Enabled;
38
- this.AccountId = AccountId;
39
- this.Name = Name;
40
- this.Title = Title;
41
- this.Gender = Gender;
42
- this.Email = Email;
43
- this.MobilePhone = MobilePhone;
44
- this.DateOfBirth = DateOfBirth;
45
- this.Address = Address;
46
- this.ExternalId = ExternalId;
47
- }
48
- }
49
-
50
- export function V1_PartialProfile_$reflection() {
51
- return record_type("Dto.InternalApi.Read.V1.PartialProfile", [], V1_PartialProfile, () => [["Metadata", Metadata_$reflection()], ["Enabled", bool_type], ["AccountId", string_type], ["Name", Name_$reflection()], ["Title", option_type(string_type)], ["Gender", option_type(string_type)], ["Email", string_type], ["MobilePhone", option_type(string_type)], ["DateOfBirth", option_type(string_type)], ["Address", option_type(Address_$reflection())], ["ExternalId", option_type(string_type)]]);
52
- }
53
-
54
- export function V1_PartialProfileModule_ofDomain(p, enabled) {
55
- return new V1_PartialProfile(MetadataModule_ofDomain(p.Metadata), enabled, AccountId_ofDomain(p.AccountId), NameModule_ofDomain(p.Name), map(Title_ofDomain, p.Title), map(Gender_ofDomain, p.Gender), Email_ofDomain(p.Email), map(MobilePhone_ofDomain, p.MobilePhone), map(DateOfBirth_ofDomain, p.DateOfBirth), map(AddressModule_ofDomain, p.Address), map(ExternalId_ofDomain, p.ExternalId));
56
- }
57
-
58
- export class V1_ReadModel extends Union {
59
- constructor(tag, fields) {
60
- super();
61
- this.tag = tag;
62
- this.fields = fields;
63
- }
64
- cases() {
65
- return ["Full", "Partial", "Purged"];
66
- }
67
- }
68
-
69
- export function V1_ReadModel_$reflection() {
70
- return union_type("Dto.InternalApi.Read.V1.ReadModel", [], V1_ReadModel, () => [[["Item", V1_Profile_$reflection()]], [["Item", V1_PartialProfile_$reflection()]], []]);
71
- }
72
-
73
- export function V1_ReadModelModule_ofDomain(profile) {
74
- switch (profile.tag) {
75
- case 1:
76
- return new V1_ReadModel(0, [V1_ProfileModule_ofDomain(profile.fields[0], false)]);
77
- case 4:
78
- return new V1_ReadModel(0, [V1_ProfileModule_ofDomain(profile.fields[0], false)]);
79
- case 2:
80
- return new V1_ReadModel(1, [V1_PartialProfileModule_ofDomain(profile.fields[0], true)]);
81
- case 3:
82
- return new V1_ReadModel(1, [V1_PartialProfileModule_ofDomain(profile.fields[0], false)]);
83
- case 5:
84
- return new V1_ReadModel(1, [V1_PartialProfileModule_ofDomain(profile.fields[0], false)]);
85
- case 6:
86
- return new V1_ReadModel(2, []);
87
- default:
88
- return new V1_ReadModel(0, [V1_ProfileModule_ofDomain(profile.fields[0], true)]);
89
- }
90
- }
91
-
92
- export function V1_ReadModelModule_ofDomainOperational(profile) {
93
- switch (profile.tag) {
94
- case 1:
95
- return new V1_ReadModel(0, [V1_ProfileModule_ofDomain(profile.fields[0], false)]);
96
- case 2:
97
- return new V1_ReadModel(1, [V1_PartialProfileModule_ofDomain(profile.fields[0], true)]);
98
- case 3:
99
- return new V1_ReadModel(1, [V1_PartialProfileModule_ofDomain(profile.fields[0], false)]);
100
- default:
101
- return new V1_ReadModel(0, [V1_ProfileModule_ofDomain(profile.fields[0], true)]);
102
- }
103
- }
104
-
105
- export class V2_ProfileDto$0027 extends Record {
106
- constructor(AccountId, Metadata, Payload) {
107
- super();
108
- this.AccountId = AccountId;
109
- this.Metadata = Metadata;
110
- this.Payload = Payload;
111
- }
112
- }
113
-
114
- export function V2_ProfileDto$0027_$reflection() {
115
- return record_type("Dto.InternalApi.Read.V2.ProfileDto\'", [], V2_ProfileDto$0027, () => [["AccountId", string_type], ["Metadata", Metadata_$reflection()], ["Payload", Read_V2_ProfileDto_$reflection()]]);
116
- }
117
-
118
- export function V2_ProfileDto_ofDomain(profile) {
119
- return new V2_ProfileDto$0027(AccountId_ofDomain(ProfileModule_getAccountId(profile)), MetadataModule_ofDomain(ProfileModule_getMetadata(profile)), Read_V2_ProfileDtoModule_ofDomain(profile));
120
- }
121
-
122
- export function V2_ProfileDto_ofDomainOperational(profile) {
123
- return new V2_ProfileDto$0027(AccountId_ofDomain(ProfileModule_getAccountId(OperationalProfileModule_toDomain(profile))), MetadataModule_ofDomain(ProfileModule_getMetadata(OperationalProfileModule_toDomain(profile))), Read_V2_ProfileDtoModule_ofDomainOperational(profile));
124
- }
125
-
@@ -1,121 +0,0 @@
1
- import { Record } from "../../fable_modules/fable-library-js.4.20.0/Types.js";
2
- import { record_type, class_type, obj_type, option_type, string_type } from "../../fable_modules/fable-library-js.4.20.0/Reflection.js";
3
- import { CommandId, CommandIdModule_value } from "../Commands.jsx";
4
- import { StreamId, StreamIdModule_value } from "../Metadata.jsx";
5
- import { defaultArg, map } from "../../fable_modules/fable-library-js.4.20.0/Option.js";
6
- import { JwtPayloadModule_create, JwtPayloadModule_value } from "../JwtPayload.jsx";
7
- import { PartnerId as PartnerId_1, AccountId as AccountId_1, PartnerIdModule_value, AccountIdModule_value } from "../DomainPrimitives.jsx";
8
- import { FSharpResult$2, Result_Map } from "../../fable_modules/fable-library-js.4.20.0/Result.js";
9
- import { FlareAdminShellInitiator, InternalInitiator, AdminInitiator, PartnerInitiator, AccountInitiator, Initiator as Initiator_1, ProfileInitiator, HttpTriggerAuditMetadata, Trigger, StorageQueueTriggerMetadata, AuditMetadata } from "../Audit.jsx";
10
-
11
- export class AuditMetadataDto extends Record {
12
- constructor(Initiator, CausationId, ApiRequestUrl, HttpMethod, IpAddress, AccountId, BearerTokenTruncated, ProfileId, PartnerId, UserAgent, XForwardedFor, Claims, QueueName, QueueMessageId) {
13
- super();
14
- this.Initiator = Initiator;
15
- this.CausationId = CausationId;
16
- this.ApiRequestUrl = ApiRequestUrl;
17
- this.HttpMethod = HttpMethod;
18
- this.IpAddress = IpAddress;
19
- this.AccountId = AccountId;
20
- this.BearerTokenTruncated = BearerTokenTruncated;
21
- this.ProfileId = ProfileId;
22
- this.PartnerId = PartnerId;
23
- this.UserAgent = UserAgent;
24
- this.XForwardedFor = XForwardedFor;
25
- this.Claims = Claims;
26
- this.QueueName = QueueName;
27
- this.QueueMessageId = QueueMessageId;
28
- }
29
- }
30
-
31
- export function AuditMetadataDto_$reflection() {
32
- return record_type("Dto.Audit.AuditMetadataDto", [], AuditMetadataDto, () => [["Initiator", string_type], ["CausationId", string_type], ["ApiRequestUrl", option_type(string_type)], ["HttpMethod", option_type(string_type)], ["IpAddress", option_type(string_type)], ["AccountId", option_type(string_type)], ["BearerTokenTruncated", option_type(string_type)], ["ProfileId", option_type(string_type)], ["PartnerId", option_type(string_type)], ["UserAgent", option_type(string_type)], ["XForwardedFor", option_type(string_type)], ["Claims", option_type(class_type("Microsoft.FSharp.Collections.FSharpMap`2", [string_type, obj_type]))], ["QueueName", option_type(string_type)], ["QueueMessageId", option_type(string_type)]]);
33
- }
34
-
35
- function AuditMetadata_ofInitiator(apiRequestUrl, httpMethod, causationId, ipAddress, xForwardedFor, initiator) {
36
- return new AuditMetadataDto(initiator, CommandIdModule_value(causationId), apiRequestUrl, httpMethod, ipAddress, undefined, undefined, undefined, undefined, undefined, xForwardedFor, undefined, undefined, undefined);
37
- }
38
-
39
- export function AuditMetadata_ofProfileInitiator(header_, header__1, header__2, header__3, header__4, initiator) {
40
- const header = [header_, header__1, header__2, header__3, header__4];
41
- const bind$0040 = AuditMetadata_ofInitiator(header[0], header[1], header[2], header[3], header[4], "Profile");
42
- return new AuditMetadataDto(bind$0040.Initiator, bind$0040.CausationId, bind$0040.ApiRequestUrl, bind$0040.HttpMethod, bind$0040.IpAddress, bind$0040.AccountId, initiator.BearerTokenTruncated, StreamIdModule_value(initiator.ProfileId), bind$0040.PartnerId, initiator.UserAgent, bind$0040.XForwardedFor, map(JwtPayloadModule_value, initiator.Claims), bind$0040.QueueName, bind$0040.QueueMessageId);
43
- }
44
-
45
- export function AuditMetadata_ofAccountInitiator(header_, header__1, header__2, header__3, header__4, initiator) {
46
- const header = [header_, header__1, header__2, header__3, header__4];
47
- const bind$0040 = AuditMetadata_ofInitiator(header[0], header[1], header[2], header[3], header[4], "Account");
48
- return new AuditMetadataDto(bind$0040.Initiator, bind$0040.CausationId, bind$0040.ApiRequestUrl, bind$0040.HttpMethod, bind$0040.IpAddress, AccountIdModule_value(initiator.AccountId), bind$0040.BearerTokenTruncated, bind$0040.ProfileId, bind$0040.PartnerId, bind$0040.UserAgent, bind$0040.XForwardedFor, bind$0040.Claims, bind$0040.QueueName, bind$0040.QueueMessageId);
49
- }
50
-
51
- export function AuditMetadata_ofPartnerInitiator(header_, header__1, header__2, header__3, header__4, initiator) {
52
- const header = [header_, header__1, header__2, header__3, header__4];
53
- const bind$0040 = AuditMetadata_ofInitiator(header[0], header[1], header[2], header[3], header[4], "Partner");
54
- return new AuditMetadataDto(bind$0040.Initiator, bind$0040.CausationId, bind$0040.ApiRequestUrl, bind$0040.HttpMethod, bind$0040.IpAddress, bind$0040.AccountId, bind$0040.BearerTokenTruncated, bind$0040.ProfileId, PartnerIdModule_value(initiator.PartnerId), bind$0040.UserAgent, bind$0040.XForwardedFor, bind$0040.Claims, bind$0040.QueueName, bind$0040.QueueMessageId);
55
- }
56
-
57
- export function AuditMetadata_ofAdminInitiator(header_, header__1, header__2, header__3, header__4, initiator) {
58
- const header = [header_, header__1, header__2, header__3, header__4];
59
- const bind$0040 = AuditMetadata_ofInitiator(header[0], header[1], header[2], header[3], header[4], "Admin");
60
- return new AuditMetadataDto(bind$0040.Initiator, bind$0040.CausationId, bind$0040.ApiRequestUrl, bind$0040.HttpMethod, bind$0040.IpAddress, bind$0040.AccountId, initiator.BearerTokenTruncated, bind$0040.ProfileId, bind$0040.PartnerId, bind$0040.UserAgent, bind$0040.XForwardedFor, map(JwtPayloadModule_value, initiator.Claims), bind$0040.QueueName, bind$0040.QueueMessageId);
61
- }
62
-
63
- export function AuditMetadata_ofInternalInitiator(header_, header__1, header__2, header__3, header__4, initiator) {
64
- const header = [header_, header__1, header__2, header__3, header__4];
65
- const bind$0040 = AuditMetadata_ofInitiator(header[0], header[1], header[2], header[3], header[4], "Internal");
66
- return new AuditMetadataDto(bind$0040.Initiator, bind$0040.CausationId, bind$0040.ApiRequestUrl, bind$0040.HttpMethod, bind$0040.IpAddress, bind$0040.AccountId, initiator.BearerTokenTruncated, bind$0040.ProfileId, bind$0040.PartnerId, bind$0040.UserAgent, bind$0040.XForwardedFor, map(JwtPayloadModule_value, initiator.Claims), bind$0040.QueueName, bind$0040.QueueMessageId);
67
- }
68
-
69
- export function AuditMetadata_ofFlareAdminInitiator(header_, header__1, header__2, header__3, header__4, initiator) {
70
- const header = [header_, header__1, header__2, header__3, header__4];
71
- const bind$0040 = AuditMetadata_ofInitiator(header[0], header[1], header[2], header[3], header[4], "FlareAdminShell");
72
- return new AuditMetadataDto(bind$0040.Initiator, bind$0040.CausationId, bind$0040.ApiRequestUrl, bind$0040.HttpMethod, bind$0040.IpAddress, bind$0040.AccountId, initiator.BearerTokenTruncated, bind$0040.ProfileId, bind$0040.PartnerId, initiator.UserAgent, bind$0040.XForwardedFor, map(JwtPayloadModule_value, initiator.Claims), bind$0040.QueueName, bind$0040.QueueMessageId);
73
- }
74
-
75
- export function AuditMetadata_ofStorageQueueInitiator(causationId, domain) {
76
- return new AuditMetadataDto("StorageQueue", CommandIdModule_value(causationId), undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, domain.QueueName, domain.MessageId);
77
- }
78
-
79
- export function AuditMetadata_ofDomain(domain) {
80
- const matchValue = domain.Trigger;
81
- if (matchValue.tag === 1) {
82
- return AuditMetadata_ofStorageQueueInitiator(domain.CausationId, matchValue.fields[0]);
83
- }
84
- else {
85
- const metaData = matchValue.fields[0];
86
- const matchValue_1 = metaData.Initiator;
87
- const matchValue_2 = [metaData.ApiRequestUrl, metaData.HttpMethod, domain.CausationId, metaData.IpAddress, metaData.XForwardedFor];
88
- switch (matchValue_1.tag) {
89
- case 1: {
90
- const tupledArg_1 = matchValue_2;
91
- return AuditMetadata_ofAccountInitiator(tupledArg_1[0], tupledArg_1[1], tupledArg_1[2], tupledArg_1[3], tupledArg_1[4], matchValue_1.fields[0]);
92
- }
93
- case 2: {
94
- const tupledArg_2 = matchValue_2;
95
- return AuditMetadata_ofPartnerInitiator(tupledArg_2[0], tupledArg_2[1], tupledArg_2[2], tupledArg_2[3], tupledArg_2[4], matchValue_1.fields[0]);
96
- }
97
- case 3: {
98
- const tupledArg_3 = matchValue_2;
99
- return AuditMetadata_ofAdminInitiator(tupledArg_3[0], tupledArg_3[1], tupledArg_3[2], tupledArg_3[3], tupledArg_3[4], matchValue_1.fields[0]);
100
- }
101
- case 4: {
102
- const tupledArg_4 = matchValue_2;
103
- return AuditMetadata_ofInternalInitiator(tupledArg_4[0], tupledArg_4[1], tupledArg_4[2], tupledArg_4[3], tupledArg_4[4], matchValue_1.fields[0]);
104
- }
105
- case 5: {
106
- const tupledArg_5 = matchValue_2;
107
- return AuditMetadata_ofFlareAdminInitiator(tupledArg_5[0], tupledArg_5[1], tupledArg_5[2], tupledArg_5[3], tupledArg_5[4], matchValue_1.fields[0]);
108
- }
109
- default: {
110
- const tupledArg = matchValue_2;
111
- return AuditMetadata_ofProfileInitiator(tupledArg[0], tupledArg[1], tupledArg[2], tupledArg[3], tupledArg[4], matchValue_1.fields[0]);
112
- }
113
- }
114
- }
115
- }
116
-
117
- export function AuditMetadata_toDomain(dto) {
118
- let dto_2, dto_1, matchValue;
119
- return Result_Map((trigger) => (new AuditMetadata(new CommandId(dto.CausationId), trigger)), (dto_2 = dto, (dto_2.Initiator === "StorageQueue") ? (new FSharpResult$2(0, [new Trigger(1, [new StorageQueueTriggerMetadata(defaultArg(dto_2.QueueName, ""), defaultArg(dto_2.QueueMessageId, ""))])])) : Result_Map((initiator) => (new Trigger(0, [new HttpTriggerAuditMetadata(defaultArg(dto_2.ApiRequestUrl, ""), defaultArg(dto_2.HttpMethod, ""), dto_2.IpAddress, dto_2.XForwardedFor, initiator)])), (dto_1 = dto_2, (matchValue = dto_1.Initiator, (matchValue === "Profile") ? (new FSharpResult$2(0, [new Initiator_1(0, [new ProfileInitiator(dto_1.BearerTokenTruncated, dto_1.UserAgent, new StreamId(defaultArg(dto_1.ProfileId, "")), map(JwtPayloadModule_create, dto_1.Claims))])])) : ((matchValue === "Account") ? (new FSharpResult$2(0, [new Initiator_1(1, [new AccountInitiator(new AccountId_1(defaultArg(dto_1.AccountId, "")))])])) : ((matchValue === "Partner") ? (new FSharpResult$2(0, [new Initiator_1(2, [new PartnerInitiator(new PartnerId_1(defaultArg(dto_1.PartnerId, "")))])])) : ((matchValue === "Admin") ? (new FSharpResult$2(0, [new Initiator_1(3, [new AdminInitiator(dto_1.BearerTokenTruncated, map(JwtPayloadModule_create, dto_1.Claims))])])) : ((matchValue === "Internal") ? (new FSharpResult$2(0, [new Initiator_1(4, [new InternalInitiator(dto_1.BearerTokenTruncated, map(JwtPayloadModule_create, dto_1.Claims))])])) : ((matchValue === "FlareAdminShell") ? (new FSharpResult$2(0, [new Initiator_1(5, [new FlareAdminShellInitiator(dto_1.BearerTokenTruncated, dto_1.UserAgent, map(JwtPayloadModule_create, dto_1.Claims))])])) : (new FSharpResult$2(1, ["Invalid Audit Metadata"]))))))))))));
120
- }
121
-