@stevenkellner/team-conduct-api 2.0.17 → 2.0.19

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 (231) hide show
  1. package/lib/src/functions/fine/add.d.ts +3 -8
  2. package/lib/src/functions/fine/add.js +1 -2
  3. package/lib/src/functions/fine/delete.d.ts +1 -6
  4. package/lib/src/functions/fine/delete.js +2 -3
  5. package/lib/src/functions/fine/update.d.ts +2 -8
  6. package/lib/src/functions/fine/update.js +1 -3
  7. package/lib/src/functions/fineTemplate/add.d.ts +3 -3
  8. package/lib/src/functions/fineTemplate/update.d.ts +3 -3
  9. package/lib/src/functions/firebaseFunctionsContext.d.ts +34 -1
  10. package/lib/src/functions/firebaseFunctionsContext.js +33 -33
  11. package/lib/src/functions/index.d.ts +10 -8
  12. package/lib/src/functions/index.js +11 -8
  13. package/lib/src/functions/notification/markNotificationAsRead.d.ts +14 -0
  14. package/lib/src/functions/notification/{subscribe.js → markNotificationAsRead.js} +5 -7
  15. package/lib/src/functions/person/kickout.d.ts +6 -6
  16. package/lib/src/functions/person/kickout.js +4 -4
  17. package/lib/src/functions/person/roleEdit.d.ts +5 -5
  18. package/lib/src/functions/person/roleEdit.js +3 -3
  19. package/lib/src/functions/{paypalMe/edit.d.ts → team/delete.d.ts} +5 -7
  20. package/lib/src/functions/{paypalMe/edit.js → team/delete.js} +4 -5
  21. package/lib/src/functions/team/new.d.ts +18 -18
  22. package/lib/src/functions/team/new.js +8 -4
  23. package/lib/src/functions/team/update.d.ts +34 -0
  24. package/lib/src/functions/team/update.js +23 -0
  25. package/lib/src/functions/user/register.d.ts +4 -0
  26. package/lib/src/functions/user/register.js +3 -1
  27. package/lib/src/functions/user/update.d.ts +26 -0
  28. package/lib/src/functions/user/update.js +15 -0
  29. package/lib/src/index.d.ts +1 -1
  30. package/lib/src/index.js +1 -1
  31. package/lib/src/locales/de.d.ts +1 -1
  32. package/lib/src/locales/de.js +6 -2
  33. package/lib/src/locales/en.d.ts +6 -2
  34. package/lib/src/locales/en.js +6 -2
  35. package/lib/src/types/{MoneyAmount.d.ts → Money.d.ts} +23 -23
  36. package/lib/src/types/{MoneyAmount.js → Money.js} +25 -25
  37. package/lib/src/types/fine/Fine.d.ts +275 -0
  38. package/lib/src/types/fine/Fine.js +318 -0
  39. package/lib/src/types/fine/FineTemplate.d.ts +154 -0
  40. package/lib/src/types/fine/FineTemplate.js +170 -0
  41. package/lib/src/types/{PayedState.d.ts → fine/PayedState.d.ts} +1 -1
  42. package/lib/src/types/{PayedState.js → fine/PayedState.js} +1 -1
  43. package/lib/src/types/fine/index.d.ts +3 -0
  44. package/lib/src/{firebase → types/fine}/index.js +3 -6
  45. package/lib/src/types/index.d.ts +7 -18
  46. package/lib/src/types/index.js +7 -18
  47. package/lib/src/types/{Localization.d.ts → localization/Localization.d.ts} +15 -43
  48. package/lib/src/types/localization/Localization.js +54 -0
  49. package/lib/src/types/localization/PluralLocalization.d.ts +23 -0
  50. package/lib/src/types/localization/PluralLocalization.js +35 -0
  51. package/lib/src/types/{Pluralization.d.ts → localization/Pluralization.d.ts} +1 -0
  52. package/lib/src/types/{Pluralization.js → localization/Pluralization.js} +1 -0
  53. package/lib/src/types/localization/ValueLocalization.d.ts +22 -0
  54. package/lib/src/types/localization/ValueLocalization.js +41 -0
  55. package/lib/src/types/localization/index.d.ts +5 -0
  56. package/lib/src/types/localization/index.js +21 -0
  57. package/lib/src/types/notification/InAppNotification.d.ts +152 -0
  58. package/lib/src/types/notification/InAppNotification.js +136 -0
  59. package/lib/src/types/notification/index.d.ts +1 -0
  60. package/lib/src/types/notification/index.js +17 -0
  61. package/lib/src/types/{Person.d.ts → person/Person.d.ts} +3 -3
  62. package/lib/src/types/{Person.js → person/Person.js} +3 -3
  63. package/lib/src/types/{PersonProperties.d.ts → person/PersonProperties.d.ts} +8 -7
  64. package/lib/src/types/{PersonProperties.js → person/PersonProperties.js} +7 -6
  65. package/lib/src/types/{PersonSignInProperties.d.ts → person/PersonSignInProperties.d.ts} +9 -11
  66. package/lib/src/types/{PersonSignInProperties.js → person/PersonSignInProperties.js} +7 -10
  67. package/lib/src/types/person/index.d.ts +3 -0
  68. package/lib/src/types/person/index.js +19 -0
  69. package/lib/src/types/{Invitation.d.ts → team/Invitation.d.ts} +1 -1
  70. package/lib/src/types/{Invitation.js → team/Invitation.js} +1 -1
  71. package/lib/src/types/team/Team.d.ts +144 -0
  72. package/lib/src/types/team/Team.js +141 -0
  73. package/lib/src/types/team/TeamRole.d.ts +30 -0
  74. package/lib/src/types/{UserRole.js → team/TeamRole.js} +16 -15
  75. package/lib/src/types/team/index.d.ts +3 -0
  76. package/lib/src/types/team/index.js +19 -0
  77. package/lib/src/types/{NotificationProperties.d.ts → user/NotificationProperties.d.ts} +8 -3
  78. package/lib/src/types/{NotificationProperties.js → user/NotificationProperties.js} +4 -0
  79. package/lib/src/types/user/User.d.ts +328 -0
  80. package/lib/src/types/user/User.js +355 -0
  81. package/lib/src/types/user/index.d.ts +2 -0
  82. package/lib/src/types/user/index.js +18 -0
  83. package/lib/src/utils/StaticUnionTypeBuilder.d.ts +9 -0
  84. package/lib/src/utils/StaticUnionTypeBuilder.js +23 -0
  85. package/lib/src/utils/index.d.ts +1 -0
  86. package/lib/src/utils/index.js +17 -0
  87. package/lib/tsconfig.tsbuildinfo +1 -1
  88. package/package.json +7 -6
  89. package/src/functions/fine/add.ts +3 -5
  90. package/src/functions/fine/delete.ts +3 -5
  91. package/src/functions/fine/update.ts +2 -5
  92. package/src/functions/firebaseFunctionsContext.ts +40 -40
  93. package/src/functions/index.ts +11 -9
  94. package/src/functions/notification/markNotificationAsRead.ts +19 -0
  95. package/src/functions/person/add.ts +1 -1
  96. package/src/functions/person/kickout.ts +6 -6
  97. package/src/functions/person/roleEdit.ts +5 -5
  98. package/src/functions/{paypalMe/edit.ts → team/delete.ts} +5 -7
  99. package/src/functions/team/new.ts +19 -11
  100. package/src/functions/team/update.ts +40 -0
  101. package/src/functions/user/register.ts +7 -3
  102. package/src/functions/user/update.ts +29 -0
  103. package/src/index.ts +1 -1
  104. package/src/locales/de.ts +7 -3
  105. package/src/locales/en.ts +7 -3
  106. package/src/types/{MoneyAmount.ts → Money.ts} +29 -29
  107. package/src/types/fine/Fine.ts +399 -0
  108. package/src/types/fine/FineTemplate.ts +219 -0
  109. package/src/types/{PayedState.ts → fine/PayedState.ts} +2 -2
  110. package/src/types/fine/index.ts +3 -0
  111. package/src/types/index.ts +7 -18
  112. package/src/types/{Localization.ts → localization/Localization.ts} +7 -64
  113. package/src/types/localization/PluralLocalization.ts +32 -0
  114. package/src/types/{Pluralization.ts → localization/Pluralization.ts} +1 -0
  115. package/src/types/localization/ValueLocalization.ts +36 -0
  116. package/src/types/localization/index.ts +5 -0
  117. package/src/types/notification/InAppNotification.ts +184 -0
  118. package/src/types/notification/index.ts +1 -0
  119. package/src/types/{Person.ts → person/Person.ts} +3 -3
  120. package/src/types/{PersonProperties.ts → person/PersonProperties.ts} +8 -7
  121. package/src/types/{PersonSignInProperties.ts → person/PersonSignInProperties.ts} +13 -12
  122. package/src/types/person/index.ts +3 -0
  123. package/src/types/{Invitation.ts → team/Invitation.ts} +1 -1
  124. package/src/types/team/Team.ts +204 -0
  125. package/src/types/{UserRole.ts → team/TeamRole.ts} +19 -17
  126. package/src/types/team/index.ts +3 -0
  127. package/src/types/{NotificationProperties.ts → user/NotificationProperties.ts} +12 -3
  128. package/src/types/user/User.ts +451 -0
  129. package/src/types/user/index.ts +2 -0
  130. package/src/utils/StaticUnionTypeBuilder.ts +23 -0
  131. package/src/utils/index.ts +1 -0
  132. package/lib/src/firebase/FirebaseConfiguration.d.ts +0 -64
  133. package/lib/src/firebase/FirebaseConfiguration.js +0 -79
  134. package/lib/src/firebase/Firestore.d.ts +0 -201
  135. package/lib/src/firebase/Firestore.js +0 -244
  136. package/lib/src/firebase/FirestoreScheme.d.ts +0 -42
  137. package/lib/src/firebase/FirestoreScheme.js +0 -2
  138. package/lib/src/firebase/Messaging.d.ts +0 -90
  139. package/lib/src/firebase/Messaging.js +0 -2
  140. package/lib/src/firebase/checkAuthentication.d.ts +0 -38
  141. package/lib/src/firebase/checkAuthentication.js +0 -64
  142. package/lib/src/firebase/index.d.ts +0 -6
  143. package/lib/src/firebase/pushNotification.d.ts +0 -39
  144. package/lib/src/firebase/pushNotification.js +0 -88
  145. package/lib/src/functions/notification/subscribe.d.ts +0 -18
  146. package/lib/src/types/Configuration.d.ts +0 -46
  147. package/lib/src/types/Configuration.js +0 -51
  148. package/lib/src/types/Fine.d.ts +0 -71
  149. package/lib/src/types/Fine.js +0 -74
  150. package/lib/src/types/FineAmount.d.ts +0 -207
  151. package/lib/src/types/FineAmount.js +0 -238
  152. package/lib/src/types/FineTemplate.d.ts +0 -69
  153. package/lib/src/types/FineTemplate.js +0 -72
  154. package/lib/src/types/FineTemplateRepetition.d.ts +0 -87
  155. package/lib/src/types/FineTemplateRepetition.js +0 -103
  156. package/lib/src/types/Localization.js +0 -115
  157. package/lib/src/types/Team.d.ts +0 -62
  158. package/lib/src/types/Team.js +0 -64
  159. package/lib/src/types/User.d.ts +0 -221
  160. package/lib/src/types/User.js +0 -235
  161. package/lib/src/types/UserRole.d.ts +0 -29
  162. package/lib/test/firebase/FirebaseConfiguration.test.d.ts +0 -1
  163. package/lib/test/firebase/FirebaseConfiguration.test.js +0 -158
  164. package/lib/test/firebase/Firestore.test.d.ts +0 -1
  165. package/lib/test/firebase/Firestore.test.js +0 -46
  166. package/lib/test/firebase/checkAuthentication.test.d.ts +0 -1
  167. package/lib/test/firebase/checkAuthentication.test.js +0 -356
  168. package/lib/test/firebase/firebase-utils.d.ts +0 -32
  169. package/lib/test/firebase/firebase-utils.js +0 -134
  170. package/lib/test/firebase/pushNotification.test.d.ts +0 -1
  171. package/lib/test/firebase/pushNotification.test.js +0 -300
  172. package/lib/test/locales/localization.de.test.d.ts +0 -1
  173. package/lib/test/locales/localization.de.test.js +0 -144
  174. package/lib/test/locales/localization.en.test.d.ts +0 -1
  175. package/lib/test/locales/localization.en.test.js +0 -144
  176. package/lib/test/types/Configuration.test.d.ts +0 -1
  177. package/lib/test/types/Configuration.test.js +0 -84
  178. package/lib/test/types/Currency.test.d.ts +0 -1
  179. package/lib/test/types/Currency.test.js +0 -41
  180. package/lib/test/types/Fine.test.d.ts +0 -1
  181. package/lib/test/types/Fine.test.js +0 -265
  182. package/lib/test/types/FineAmount.test.d.ts +0 -1
  183. package/lib/test/types/FineAmount.test.js +0 -445
  184. package/lib/test/types/FineTemplate.test.d.ts +0 -1
  185. package/lib/test/types/FineTemplate.test.js +0 -271
  186. package/lib/test/types/FineTemplateRepetition.test.d.ts +0 -1
  187. package/lib/test/types/FineTemplateRepetition.test.js +0 -361
  188. package/lib/test/types/Invitation.test.d.ts +0 -1
  189. package/lib/test/types/Invitation.test.js +0 -269
  190. package/lib/test/types/Locale.test.d.ts +0 -1
  191. package/lib/test/types/Locale.test.js +0 -46
  192. package/lib/test/types/Localization.test.d.ts +0 -1
  193. package/lib/test/types/Localization.test.js +0 -241
  194. package/lib/test/types/MoneyAmount.test.d.ts +0 -1
  195. package/lib/test/types/MoneyAmount.test.js +0 -276
  196. package/lib/test/types/NotificationProperties.test.d.ts +0 -1
  197. package/lib/test/types/NotificationProperties.test.js +0 -258
  198. package/lib/test/types/PayedState.test.d.ts +0 -1
  199. package/lib/test/types/PayedState.test.js +0 -136
  200. package/lib/test/types/Person.test.d.ts +0 -1
  201. package/lib/test/types/Person.test.js +0 -266
  202. package/lib/test/types/PersonProperties.test.d.ts +0 -1
  203. package/lib/test/types/PersonProperties.test.js +0 -155
  204. package/lib/test/types/PersonSignInProperties.test.d.ts +0 -1
  205. package/lib/test/types/PersonSignInProperties.test.js +0 -208
  206. package/lib/test/types/Pluralization.test.d.ts +0 -1
  207. package/lib/test/types/Pluralization.test.js +0 -206
  208. package/lib/test/types/Team.test.d.ts +0 -1
  209. package/lib/test/types/Team.test.js +0 -145
  210. package/lib/test/types/User.test.d.ts +0 -1
  211. package/lib/test/types/User.test.js +0 -450
  212. package/lib/test/types/UserRole.test.d.ts +0 -1
  213. package/lib/test/types/UserRole.test.js +0 -140
  214. package/src/firebase/FirebaseConfiguration.ts +0 -99
  215. package/src/firebase/Firestore.ts +0 -258
  216. package/src/firebase/FirestoreScheme.ts +0 -41
  217. package/src/firebase/Messaging.ts +0 -93
  218. package/src/firebase/checkAuthentication.ts +0 -91
  219. package/src/firebase/index.ts +0 -7
  220. package/src/firebase/pushNotification.ts +0 -90
  221. package/src/functions/notification/subscribe.ts +0 -23
  222. package/src/types/Configuration.ts +0 -65
  223. package/src/types/Fine.ts +0 -100
  224. package/src/types/FineAmount.ts +0 -303
  225. package/src/types/FineTemplate.ts +0 -96
  226. package/src/types/FineTemplateRepetition.ts +0 -125
  227. package/src/types/Team.ts +0 -87
  228. package/src/types/User.ts +0 -302
  229. /package/lib/src/types/{Locale.d.ts → localization/Locale.d.ts} +0 -0
  230. /package/lib/src/types/{Locale.js → localization/Locale.js} +0 -0
  231. /package/src/types/{Locale.ts → localization/Locale.ts} +0 -0
@@ -0,0 +1,22 @@
1
+ /**
2
+ * Handles localization strings with template variable substitution.
3
+ * Supports {{variableName}} syntax for runtime value replacement.
4
+ */
5
+ export declare class ValueLocalization {
6
+ private readonly rawValue;
7
+ /**
8
+ * Creates a new ValueLocalization instance.
9
+ *
10
+ * @param rawValue - The template string with {{variable}} placeholders
11
+ */
12
+ constructor(rawValue: string);
13
+ /**
14
+ * Returns the localized string with variables substituted.
15
+ * Template variables in the format {{key}} are replaced with provided argument values.
16
+ *
17
+ * @param args - Record of variable names to their replacement values
18
+ * @returns The localized string with all variables replaced
19
+ * @throws Error if a required template variable is not provided in args
20
+ */
21
+ value(args?: Record<string, string>): string;
22
+ }
@@ -0,0 +1,41 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ValueLocalization = void 0;
4
+ /**
5
+ * Handles localization strings with template variable substitution.
6
+ * Supports {{variableName}} syntax for runtime value replacement.
7
+ */
8
+ class ValueLocalization {
9
+ rawValue;
10
+ /**
11
+ * Creates a new ValueLocalization instance.
12
+ *
13
+ * @param rawValue - The template string with {{variable}} placeholders
14
+ */
15
+ constructor(rawValue) {
16
+ this.rawValue = rawValue;
17
+ }
18
+ /**
19
+ * Returns the localized string with variables substituted.
20
+ * Template variables in the format {{key}} are replaced with provided argument values.
21
+ *
22
+ * @param args - Record of variable names to their replacement values
23
+ * @returns The localized string with all variables replaced
24
+ * @throws Error if a required template variable is not provided in args
25
+ */
26
+ value(args = {}) {
27
+ let rawValue = this.rawValue;
28
+ const regex = /\{\{(?<key>.*?)\}\}/;
29
+ while (true) {
30
+ const match = regex.exec(rawValue);
31
+ if (!match)
32
+ break;
33
+ const key = match.groups.key;
34
+ if (!(key in args))
35
+ throw new Error(`Missing argument for key: ${key}`);
36
+ rawValue = rawValue.replace(match[0], args[key]);
37
+ }
38
+ return rawValue;
39
+ }
40
+ }
41
+ exports.ValueLocalization = ValueLocalization;
@@ -0,0 +1,5 @@
1
+ export * from './Locale';
2
+ export * from './Localization';
3
+ export * from './Pluralization';
4
+ export * from './ValueLocalization';
5
+ export * from './PluralLocalization';
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./Locale"), exports);
18
+ __exportStar(require("./Localization"), exports);
19
+ __exportStar(require("./Pluralization"), exports);
20
+ __exportStar(require("./ValueLocalization"), exports);
21
+ __exportStar(require("./PluralLocalization"), exports);
@@ -0,0 +1,152 @@
1
+ import { Flattable, Guid, ITypeBuilder, Tagged, UtcDate } from '@stevenkellner/typescript-common-functionality';
2
+ import { Fine } from '../fine/Fine';
3
+ import { Team } from '../team/Team';
4
+ /**
5
+ * Represents an in-app notification for a user.
6
+ *
7
+ * Stores information about team and fine events that are delivered
8
+ * as in-app notifications rather than push notifications.
9
+ */
10
+ export declare class InAppNotification implements Flattable<InAppNotification.Flatten> {
11
+ id: InAppNotification.Id;
12
+ date: UtcDate;
13
+ isRead: boolean;
14
+ event: InAppNotification.Event;
15
+ /**
16
+ * Creates a new InAppNotification instance.
17
+ *
18
+ * @param id - Unique identifier for the notification
19
+ * @param date - The date and time the notification was created
20
+ * @param isRead - Whether the notification has been read by the user
21
+ * @param event - The event data describing what triggered the notification
22
+ */
23
+ constructor(id: InAppNotification.Id, date: UtcDate, isRead: boolean, event: InAppNotification.Event);
24
+ /**
25
+ * Returns the flattened representation for serialization.
26
+ */
27
+ get flatten(): InAppNotification.Flatten;
28
+ }
29
+ export declare namespace InAppNotification {
30
+ /**
31
+ * Tagged GUID type for in-app notification identifiers.
32
+ */
33
+ type Id = Tagged<Guid, 'inAppNotification'>;
34
+ namespace Id {
35
+ /**
36
+ * Flattened representation of a notification ID (GUID string).
37
+ */
38
+ type Flatten = string;
39
+ /**
40
+ * Type builder for InAppNotification.Id serialization/deserialization.
41
+ */
42
+ const builder: Tagged.TypeBuilder<Guid, "inAppNotification">;
43
+ }
44
+ /**
45
+ * Union type representing the different events that can trigger an in-app notification.
46
+ */
47
+ type Event = {
48
+ type: 'fine-added';
49
+ teamId: Team.Id;
50
+ fineId: Fine.Id;
51
+ reason: string;
52
+ } | {
53
+ type: 'fine-updated';
54
+ teamId: Team.Id;
55
+ fineId: Fine.Id;
56
+ reason: string;
57
+ } | {
58
+ type: 'fine-payed';
59
+ teamId: Team.Id;
60
+ fineId: Fine.Id;
61
+ reason: string;
62
+ } | {
63
+ type: 'fine-deleted';
64
+ teamId: Team.Id;
65
+ reason: string;
66
+ } | {
67
+ type: 'person-role-changed';
68
+ teamId: Team.Id;
69
+ } | {
70
+ type: 'team-kickout';
71
+ teamId: Team.Id;
72
+ };
73
+ namespace Event {
74
+ /**
75
+ * Flattened representation of an Event for serialization.
76
+ */
77
+ type Flatten = {
78
+ type: 'fine-added';
79
+ teamId: Team.Id.Flatten;
80
+ fineId: Fine.Id.Flatten;
81
+ reason: string;
82
+ } | {
83
+ type: 'fine-updated';
84
+ teamId: Team.Id.Flatten;
85
+ fineId: Fine.Id.Flatten;
86
+ reason: string;
87
+ } | {
88
+ type: 'fine-payed';
89
+ teamId: Team.Id.Flatten;
90
+ fineId: Fine.Id.Flatten;
91
+ reason: string;
92
+ } | {
93
+ type: 'fine-deleted';
94
+ teamId: Team.Id.Flatten;
95
+ reason: string;
96
+ } | {
97
+ type: 'person-role-changed';
98
+ teamId: Team.Id.Flatten;
99
+ } | {
100
+ type: 'team-kickout';
101
+ teamId: Team.Id.Flatten;
102
+ };
103
+ /**
104
+ * Flattens an Event instance for serialization.
105
+ *
106
+ * @param event - The event to flatten
107
+ * @returns The flattened event representation
108
+ */
109
+ function flatten(event: Event): Flatten;
110
+ /**
111
+ * Type builder for Event serialization/deserialization.
112
+ */
113
+ class TypeBuilder implements ITypeBuilder<Flatten, Event> {
114
+ /**
115
+ * Builds an Event instance from flattened data.
116
+ *
117
+ * @param value - The flattened event data
118
+ * @returns The appropriate Event instance based on the type discriminator
119
+ */
120
+ build(value: Flatten): Event;
121
+ }
122
+ /**
123
+ * Singleton builder instance for Event.
124
+ */
125
+ const builder: TypeBuilder;
126
+ }
127
+ /**
128
+ * Flattened representation of an InAppNotification for serialization.
129
+ */
130
+ type Flatten = {
131
+ id: Id.Flatten;
132
+ date: UtcDate.Flatten;
133
+ isRead: boolean;
134
+ event: Event.Flatten;
135
+ };
136
+ /**
137
+ * Type builder for InAppNotification serialization/deserialization.
138
+ */
139
+ class TypeBuilder implements ITypeBuilder<Flatten, InAppNotification> {
140
+ /**
141
+ * Builds an InAppNotification instance from flattened data.
142
+ *
143
+ * @param value - The flattened notification data
144
+ * @returns A new InAppNotification instance
145
+ */
146
+ build(value: Flatten): InAppNotification;
147
+ }
148
+ /**
149
+ * Singleton builder instance for InAppNotification.
150
+ */
151
+ const builder: TypeBuilder;
152
+ }
@@ -0,0 +1,136 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.InAppNotification = void 0;
4
+ const typescript_common_functionality_1 = require("@stevenkellner/typescript-common-functionality");
5
+ const Fine_1 = require("../fine/Fine");
6
+ const Team_1 = require("../team/Team");
7
+ /**
8
+ * Represents an in-app notification for a user.
9
+ *
10
+ * Stores information about team and fine events that are delivered
11
+ * as in-app notifications rather than push notifications.
12
+ */
13
+ class InAppNotification {
14
+ id;
15
+ date;
16
+ isRead;
17
+ event;
18
+ /**
19
+ * Creates a new InAppNotification instance.
20
+ *
21
+ * @param id - Unique identifier for the notification
22
+ * @param date - The date and time the notification was created
23
+ * @param isRead - Whether the notification has been read by the user
24
+ * @param event - The event data describing what triggered the notification
25
+ */
26
+ constructor(id, date, isRead, event) {
27
+ this.id = id;
28
+ this.date = date;
29
+ this.isRead = isRead;
30
+ this.event = event;
31
+ }
32
+ /**
33
+ * Returns the flattened representation for serialization.
34
+ */
35
+ get flatten() {
36
+ return {
37
+ id: this.id.flatten,
38
+ date: this.date.flatten,
39
+ isRead: this.isRead,
40
+ event: InAppNotification.Event.flatten(this.event)
41
+ };
42
+ }
43
+ }
44
+ exports.InAppNotification = InAppNotification;
45
+ (function (InAppNotification) {
46
+ let Id;
47
+ (function (Id) {
48
+ /**
49
+ * Type builder for InAppNotification.Id serialization/deserialization.
50
+ */
51
+ Id.builder = typescript_common_functionality_1.Tagged.builder('inAppNotification', typescript_common_functionality_1.Guid.builder);
52
+ })(Id = InAppNotification.Id || (InAppNotification.Id = {}));
53
+ let Event;
54
+ (function (Event) {
55
+ /**
56
+ * Flattens an Event instance for serialization.
57
+ *
58
+ * @param event - The event to flatten
59
+ * @returns The flattened event representation
60
+ */
61
+ function flatten(event) {
62
+ switch (event.type) {
63
+ case 'fine-added':
64
+ case 'fine-updated':
65
+ case 'fine-payed':
66
+ return { type: event.type, teamId: event.teamId.flatten, fineId: event.fineId.flatten, reason: event.reason };
67
+ case 'fine-deleted':
68
+ return { type: event.type, teamId: event.teamId.flatten, reason: event.reason };
69
+ case 'person-role-changed':
70
+ case 'team-kickout':
71
+ return { type: event.type, teamId: event.teamId.flatten };
72
+ }
73
+ }
74
+ Event.flatten = flatten;
75
+ /**
76
+ * Type builder for Event serialization/deserialization.
77
+ */
78
+ class TypeBuilder {
79
+ /**
80
+ * Builds an Event instance from flattened data.
81
+ *
82
+ * @param value - The flattened event data
83
+ * @returns The appropriate Event instance based on the type discriminator
84
+ */
85
+ build(value) {
86
+ switch (value.type) {
87
+ case 'fine-added':
88
+ case 'fine-updated':
89
+ case 'fine-payed':
90
+ return {
91
+ type: value.type,
92
+ teamId: Team_1.Team.Id.builder.build(value.teamId),
93
+ fineId: Fine_1.Fine.Id.builder.build(value.fineId),
94
+ reason: value.reason
95
+ };
96
+ case 'fine-deleted':
97
+ return {
98
+ type: value.type,
99
+ teamId: Team_1.Team.Id.builder.build(value.teamId),
100
+ reason: value.reason
101
+ };
102
+ case 'person-role-changed':
103
+ case 'team-kickout':
104
+ return {
105
+ type: value.type,
106
+ teamId: Team_1.Team.Id.builder.build(value.teamId)
107
+ };
108
+ }
109
+ }
110
+ }
111
+ Event.TypeBuilder = TypeBuilder;
112
+ /**
113
+ * Singleton builder instance for Event.
114
+ */
115
+ Event.builder = new TypeBuilder();
116
+ })(Event = InAppNotification.Event || (InAppNotification.Event = {}));
117
+ /**
118
+ * Type builder for InAppNotification serialization/deserialization.
119
+ */
120
+ class TypeBuilder {
121
+ /**
122
+ * Builds an InAppNotification instance from flattened data.
123
+ *
124
+ * @param value - The flattened notification data
125
+ * @returns A new InAppNotification instance
126
+ */
127
+ build(value) {
128
+ return new InAppNotification(Id.builder.build(value.id), typescript_common_functionality_1.UtcDate.builder.build(value.date), value.isRead, Event.builder.build(value.event));
129
+ }
130
+ }
131
+ InAppNotification.TypeBuilder = TypeBuilder;
132
+ /**
133
+ * Singleton builder instance for InAppNotification.
134
+ */
135
+ InAppNotification.builder = new TypeBuilder();
136
+ })(InAppNotification || (exports.InAppNotification = InAppNotification = {}));
@@ -0,0 +1 @@
1
+ export * from './InAppNotification';
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./InAppNotification"), exports);
@@ -1,7 +1,7 @@
1
+ import { Flattable, Guid, ITypeBuilder, Tagged } from '@stevenkellner/typescript-common-functionality';
1
2
  import { PersonProperties } from './PersonProperties';
2
3
  import { PersonSignInProperties } from './PersonSignInProperties';
3
- import { Fine } from './Fine';
4
- import { Flattable, Guid, ITypeBuilder, Tagged } from '@stevenkellner/typescript-common-functionality';
4
+ import { Fine } from '../fine/Fine';
5
5
  /**
6
6
  * Represents a person within a team, including their personal details, assigned fines, and optional sign-in properties.
7
7
  *
@@ -16,7 +16,7 @@ export declare class Person implements Flattable<Person.Flatten> {
16
16
  * Creates a new Person instance.
17
17
  *
18
18
  * @param id - Unique identifier for the person (GUID)
19
- * @param properties - Private properties including first name and optional last name
19
+ * @param properties - Personal properties including first name and last name
20
20
  * @param fineIds - Array of fine IDs assigned to this person (defaults to empty array)
21
21
  * @param signInProperties - Optional sign-in properties if the person has signed in (defaults to null)
22
22
  */
@@ -1,10 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Person = void 0;
4
+ const typescript_common_functionality_1 = require("@stevenkellner/typescript-common-functionality");
4
5
  const PersonProperties_1 = require("./PersonProperties");
5
6
  const PersonSignInProperties_1 = require("./PersonSignInProperties");
6
- const Fine_1 = require("./Fine");
7
- const typescript_common_functionality_1 = require("@stevenkellner/typescript-common-functionality");
7
+ const Fine_1 = require("../fine/Fine");
8
8
  /**
9
9
  * Represents a person within a team, including their personal details, assigned fines, and optional sign-in properties.
10
10
  *
@@ -19,7 +19,7 @@ class Person {
19
19
  * Creates a new Person instance.
20
20
  *
21
21
  * @param id - Unique identifier for the person (GUID)
22
- * @param properties - Private properties including first name and optional last name
22
+ * @param properties - Personal properties including first name and last name
23
23
  * @param fineIds - Array of fine IDs assigned to this person (defaults to empty array)
24
24
  * @param signInProperties - Optional sign-in properties if the person has signed in (defaults to null)
25
25
  */
@@ -1,19 +1,19 @@
1
1
  import { Flattable, ITypeBuilder } from '@stevenkellner/typescript-common-functionality';
2
2
  /**
3
- * Represents the private properties of a person.
3
+ * Represents the personal properties of a person within a team.
4
4
  *
5
- * Contains personal information that is private to the person,
6
- * such as their name. The last name is optional.
5
+ * Contains identification information such as first and last name.
7
6
  */
8
7
  export declare class PersonProperties implements Flattable<PersonProperties.Flatten> {
9
8
  firstName: string;
10
9
  lastName: string | null;
11
10
  /**
12
- * Creates new person private properties.
11
+ * Creates new person properties.
12
+ *
13
13
  * @param firstName - The first name of the person
14
14
  * @param lastName - The last name of the person (null if not provided)
15
15
  */
16
- constructor(firstName: string, lastName: string | null);
16
+ constructor(firstName: string, lastName?: string | null);
17
17
  /**
18
18
  * Gets the flattened representation of these properties for serialization.
19
19
  */
@@ -21,7 +21,7 @@ export declare class PersonProperties implements Flattable<PersonProperties.Flat
21
21
  }
22
22
  export declare namespace PersonProperties {
23
23
  /**
24
- * Flattened representation of person private properties for serialization.
24
+ * Flattened representation of person properties for serialization.
25
25
  */
26
26
  type Flatten = {
27
27
  firstName: string;
@@ -33,7 +33,8 @@ export declare namespace PersonProperties {
33
33
  class TypeBuilder implements ITypeBuilder<Flatten, PersonProperties> {
34
34
  /**
35
35
  * Builds a PersonProperties instance from flattened data.
36
- * @param value - The flattened person private properties data
36
+ *
37
+ * @param value - The flattened person properties data
37
38
  * @returns A new PersonProperties instance
38
39
  */
39
40
  build(value: Flatten): PersonProperties;
@@ -2,20 +2,20 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.PersonProperties = void 0;
4
4
  /**
5
- * Represents the private properties of a person.
5
+ * Represents the personal properties of a person within a team.
6
6
  *
7
- * Contains personal information that is private to the person,
8
- * such as their name. The last name is optional.
7
+ * Contains identification information such as first and last name.
9
8
  */
10
9
  class PersonProperties {
11
10
  firstName;
12
11
  lastName;
13
12
  /**
14
- * Creates new person private properties.
13
+ * Creates new person properties.
14
+ *
15
15
  * @param firstName - The first name of the person
16
16
  * @param lastName - The last name of the person (null if not provided)
17
17
  */
18
- constructor(firstName, lastName) {
18
+ constructor(firstName, lastName = null) {
19
19
  this.firstName = firstName;
20
20
  this.lastName = lastName;
21
21
  }
@@ -37,7 +37,8 @@ exports.PersonProperties = PersonProperties;
37
37
  class TypeBuilder {
38
38
  /**
39
39
  * Builds a PersonProperties instance from flattened data.
40
- * @param value - The flattened person private properties data
40
+ *
41
+ * @param value - The flattened person properties data
41
42
  * @returns A new PersonProperties instance
42
43
  */
43
44
  build(value) {
@@ -1,26 +1,24 @@
1
1
  import { Flattable, ITypeBuilder, UtcDate } from '@stevenkellner/typescript-common-functionality';
2
- import { NotificationProperties } from './NotificationProperties';
3
- import { User } from './User';
4
- import { UserRole } from './UserRole';
2
+ import { User } from '../user/User';
3
+ import { TeamRole } from '../team/TeamRole';
5
4
  /**
6
5
  * Represents the sign-in properties for a person in the system.
7
6
  *
8
7
  * Contains authentication-related information including user ID, sign-in timestamp,
9
- * notification preferences, and assigned user roles for access control.
8
+ * and assigned team roles for access control.
10
9
  */
11
10
  export declare class PersonSignInProperties implements Flattable<PersonSignInProperties.Flatten> {
12
11
  userId: User.Id;
13
12
  joinDate: UtcDate;
14
- notificationProperties: NotificationProperties;
15
- roles: UserRole[];
13
+ roles: TeamRole[];
16
14
  /**
17
15
  * Creates new person sign-in properties.
16
+ *
18
17
  * @param userId - The unique identifier of the user associated with this person
19
18
  * @param joinDate - The timestamp when the person joined the team
20
- * @param notificationProperties - Optional notification preferences (defaults to new NotificationProperties)
21
- * @param roles - Optional array of user roles for access control (defaults to empty array)
19
+ * @param roles - Optional array of team roles for access control (defaults to empty array)
22
20
  */
23
- constructor(userId: User.Id, joinDate: UtcDate, notificationProperties?: NotificationProperties, roles?: UserRole[]);
21
+ constructor(userId: User.Id, joinDate: UtcDate, roles?: TeamRole[]);
24
22
  /**
25
23
  * Gets the flattened representation of these sign-in properties for serialization.
26
24
  */
@@ -33,8 +31,7 @@ export declare namespace PersonSignInProperties {
33
31
  type Flatten = {
34
32
  userId: User.Id.Flatten;
35
33
  joinDate: UtcDate.Flatten;
36
- notificationProperties: NotificationProperties.Flatten;
37
- roles: UserRole[];
34
+ roles: TeamRole[];
38
35
  };
39
36
  /**
40
37
  * Builder for constructing PersonSignInProperties from flattened data.
@@ -42,6 +39,7 @@ export declare namespace PersonSignInProperties {
42
39
  class TypeBuilder implements ITypeBuilder<Flatten, PersonSignInProperties> {
43
40
  /**
44
41
  * Builds a PersonSignInProperties instance from flattened data.
42
+ *
45
43
  * @param value - The flattened sign-in properties data
46
44
  * @returns A new PersonSignInProperties instance
47
45
  */
@@ -2,30 +2,27 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.PersonSignInProperties = void 0;
4
4
  const typescript_common_functionality_1 = require("@stevenkellner/typescript-common-functionality");
5
- const NotificationProperties_1 = require("./NotificationProperties");
6
- const User_1 = require("./User");
5
+ const User_1 = require("../user/User");
7
6
  /**
8
7
  * Represents the sign-in properties for a person in the system.
9
8
  *
10
9
  * Contains authentication-related information including user ID, sign-in timestamp,
11
- * notification preferences, and assigned user roles for access control.
10
+ * and assigned team roles for access control.
12
11
  */
13
12
  class PersonSignInProperties {
14
13
  userId;
15
14
  joinDate;
16
- notificationProperties;
17
15
  roles;
18
16
  /**
19
17
  * Creates new person sign-in properties.
18
+ *
20
19
  * @param userId - The unique identifier of the user associated with this person
21
20
  * @param joinDate - The timestamp when the person joined the team
22
- * @param notificationProperties - Optional notification preferences (defaults to new NotificationProperties)
23
- * @param roles - Optional array of user roles for access control (defaults to empty array)
21
+ * @param roles - Optional array of team roles for access control (defaults to empty array)
24
22
  */
25
- constructor(userId, joinDate, notificationProperties = new NotificationProperties_1.NotificationProperties(), roles = []) {
23
+ constructor(userId, joinDate, roles = []) {
26
24
  this.userId = userId;
27
25
  this.joinDate = joinDate;
28
- this.notificationProperties = notificationProperties;
29
26
  this.roles = roles;
30
27
  }
31
28
  /**
@@ -35,7 +32,6 @@ class PersonSignInProperties {
35
32
  return {
36
33
  userId: this.userId.flatten,
37
34
  joinDate: this.joinDate.flatten,
38
- notificationProperties: this.notificationProperties.flatten,
39
35
  roles: this.roles
40
36
  };
41
37
  }
@@ -48,11 +44,12 @@ exports.PersonSignInProperties = PersonSignInProperties;
48
44
  class TypeBuilder {
49
45
  /**
50
46
  * Builds a PersonSignInProperties instance from flattened data.
47
+ *
51
48
  * @param value - The flattened sign-in properties data
52
49
  * @returns A new PersonSignInProperties instance
53
50
  */
54
51
  build(value) {
55
- return new PersonSignInProperties(User_1.User.Id.builder.build(value.userId), typescript_common_functionality_1.UtcDate.builder.build(value.joinDate), NotificationProperties_1.NotificationProperties.builder.build(value.notificationProperties), value.roles);
52
+ return new PersonSignInProperties(User_1.User.Id.builder.build(value.userId), typescript_common_functionality_1.UtcDate.builder.build(value.joinDate), value.roles);
56
53
  }
57
54
  }
58
55
  PersonSignInProperties.TypeBuilder = TypeBuilder;
@@ -0,0 +1,3 @@
1
+ export * from './Person';
2
+ export * from './PersonProperties';
3
+ export * from './PersonSignInProperties';
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./Person"), exports);
18
+ __exportStar(require("./PersonProperties"), exports);
19
+ __exportStar(require("./PersonSignInProperties"), exports);
@@ -1,6 +1,6 @@
1
1
  import { Flattable, ITypeBuilder, Tagged } from '@stevenkellner/typescript-common-functionality';
2
2
  import { Team } from './Team';
3
- import { Person } from './Person';
3
+ import { Person } from '../person/Person';
4
4
  /**
5
5
  * Represents an invitation to join a team.
6
6
  *