@stevenkellner/team-conduct-api 1.0.36 → 2.0.1
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/lib/src/firebase/FirebaseConfiguration.d.ts +45 -1
- package/lib/src/firebase/FirebaseConfiguration.js +44 -0
- package/lib/src/firebase/Firestore.d.ts +196 -0
- package/lib/src/firebase/Firestore.js +235 -0
- package/lib/src/{FirestoreScheme.d.ts → firebase/FirestoreScheme.d.ts} +15 -1
- package/lib/src/firebase/Messaging.d.ts +64 -0
- package/lib/src/firebase/checkAuthentication.d.ts +37 -0
- package/lib/src/{checkAuthentication.js → firebase/checkAuthentication.js} +26 -1
- package/lib/src/firebase/index.d.ts +4 -0
- package/lib/src/firebase/index.js +4 -0
- package/lib/src/firebase/pushNotification.d.ts +39 -0
- package/lib/src/firebase/pushNotification.js +88 -0
- package/lib/src/functions/fine/add.d.ts +10 -13
- package/lib/src/functions/fine/add.js +3 -30
- package/lib/src/functions/fine/delete.d.ts +10 -13
- package/lib/src/functions/fine/delete.js +3 -27
- package/lib/src/functions/fine/update.d.ts +10 -13
- package/lib/src/functions/fine/update.js +3 -28
- package/lib/src/functions/fineTemplate/add.d.ts +6 -9
- package/lib/src/functions/fineTemplate/add.js +3 -12
- package/lib/src/functions/fineTemplate/delete.d.ts +6 -9
- package/lib/src/functions/fineTemplate/delete.js +3 -12
- package/lib/src/functions/fineTemplate/update.d.ts +6 -9
- package/lib/src/functions/fineTemplate/update.js +3 -12
- package/lib/src/functions/invitation/getInvitation.d.ts +40 -43
- package/lib/src/functions/invitation/getInvitation.js +57 -88
- package/lib/src/functions/invitation/invite.d.ts +1 -2
- package/lib/src/functions/invitation/invite.js +3 -18
- package/lib/src/functions/invitation/register.d.ts +6 -11
- package/lib/src/functions/invitation/register.js +3 -39
- package/lib/src/functions/invitation/withdraw.d.ts +1 -2
- package/lib/src/functions/invitation/withdraw.js +3 -13
- package/lib/src/functions/notification/register.d.ts +7 -10
- package/lib/src/functions/notification/register.js +3 -15
- package/lib/src/functions/notification/subscribe.d.ts +8 -11
- package/lib/src/functions/notification/subscribe.js +3 -14
- package/lib/src/functions/paypalMe/edit.d.ts +6 -9
- package/lib/src/functions/paypalMe/edit.js +3 -14
- package/lib/src/functions/person/add.d.ts +7 -10
- package/lib/src/functions/person/add.js +3 -12
- package/lib/src/functions/person/delete.d.ts +6 -9
- package/lib/src/functions/person/delete.js +3 -14
- package/lib/src/functions/person/update.d.ts +7 -10
- package/lib/src/functions/person/update.js +3 -13
- package/lib/src/functions/team/new.d.ts +9 -12
- package/lib/src/functions/team/new.js +3 -22
- package/lib/src/functions/user/kickout.d.ts +6 -9
- package/lib/src/functions/user/kickout.js +3 -25
- package/lib/src/functions/user/login.d.ts +1 -2
- package/lib/src/functions/user/login.js +3 -13
- package/lib/src/functions/user/roleEdit.d.ts +8 -11
- package/lib/src/functions/user/roleEdit.js +3 -18
- package/lib/src/index.d.ts +0 -5
- package/lib/src/index.js +0 -5
- package/lib/src/locales/de.d.ts +10 -67
- package/lib/src/locales/de.js +8 -0
- package/lib/src/locales/en.d.ts +10 -0
- package/lib/src/locales/en.js +19 -2
- package/lib/src/types/Configuration.d.ts +33 -15
- package/lib/src/types/Configuration.js +24 -12
- package/lib/src/types/Currency.d.ts +20 -0
- package/lib/src/types/Currency.js +19 -0
- package/lib/src/types/Fine.d.ts +41 -0
- package/lib/src/types/Fine.js +32 -0
- package/lib/src/types/FineAmount.d.ts +160 -9
- package/lib/src/types/FineAmount.js +128 -7
- package/lib/src/types/FineTemplate.d.ts +41 -0
- package/lib/src/types/FineTemplate.js +32 -0
- package/lib/src/types/FineTemplateRepetition.d.ts +72 -10
- package/lib/src/types/FineTemplateRepetition.js +66 -12
- package/lib/src/types/Invitation.d.ts +48 -0
- package/lib/src/types/Invitation.js +39 -0
- package/lib/src/types/Locale.d.ts +16 -0
- package/lib/src/types/Locale.js +16 -0
- package/lib/src/types/Localization.d.ts +74 -74
- package/lib/src/types/Localization.js +80 -41
- package/lib/src/types/MoneyAmount.d.ts +67 -1
- package/lib/src/types/MoneyAmount.js +62 -0
- package/lib/src/types/NotificationProperties.d.ts +70 -9
- package/lib/src/types/NotificationProperties.js +49 -5
- package/lib/src/types/PayedState.d.ts +25 -9
- package/lib/src/types/PayedState.js +17 -27
- package/lib/src/types/Person.d.ts +45 -0
- package/lib/src/types/Person.js +36 -0
- package/lib/src/types/PersonPrivateProperties.d.ts +28 -0
- package/lib/src/types/PersonPrivateProperties.js +25 -0
- package/lib/src/types/PersonSignInProperties.d.ts +30 -0
- package/lib/src/types/PersonSignInProperties.js +27 -0
- package/lib/src/types/Pluralization.d.ts +46 -0
- package/lib/src/types/Pluralization.js +46 -0
- package/lib/src/types/Team.d.ts +38 -0
- package/lib/src/types/Team.js +29 -0
- package/lib/src/types/User.d.ts +68 -3
- package/lib/src/types/User.js +59 -5
- package/lib/src/types/UserRole.d.ts +26 -4
- package/lib/src/types/UserRole.js +25 -9
- package/lib/src/types/index.d.ts +2 -0
- package/lib/src/types/index.js +2 -0
- package/lib/test/firebase/FirebaseConfiguration.test.js +155 -0
- package/lib/test/firebase/Firestore.test.js +46 -0
- package/lib/test/firebase/checkAuthentication.test.d.ts +1 -0
- package/lib/test/firebase/checkAuthentication.test.js +305 -0
- package/lib/test/firebase/firebase-utils.d.ts +32 -0
- package/lib/test/firebase/firebase-utils.js +131 -0
- package/lib/test/firebase/pushNotification.test.d.ts +1 -0
- package/lib/test/firebase/pushNotification.test.js +300 -0
- package/lib/test/locales/localization.de.test.d.ts +1 -0
- package/lib/test/locales/localization.de.test.js +144 -0
- package/lib/test/locales/localization.en.test.d.ts +1 -0
- package/lib/test/locales/localization.en.test.js +144 -0
- package/lib/test/types/Configuration.test.d.ts +1 -0
- package/lib/test/types/Configuration.test.js +84 -0
- package/lib/test/types/Currency.test.d.ts +1 -0
- package/lib/test/types/Currency.test.js +41 -0
- package/lib/test/types/Fine.test.d.ts +1 -0
- package/lib/test/types/Fine.test.js +265 -0
- package/lib/test/types/FineAmount.test.d.ts +1 -0
- package/lib/test/types/FineAmount.test.js +445 -0
- package/lib/test/types/FineTemplate.test.d.ts +1 -0
- package/lib/test/types/FineTemplate.test.js +271 -0
- package/lib/test/types/FineTemplateRepetition.test.d.ts +1 -0
- package/lib/test/types/FineTemplateRepetition.test.js +361 -0
- package/lib/test/types/Invitation.test.d.ts +1 -0
- package/lib/test/types/Invitation.test.js +269 -0
- package/lib/test/types/Locale.test.d.ts +1 -0
- package/lib/test/types/Locale.test.js +46 -0
- package/lib/test/types/Localization.test.d.ts +1 -0
- package/lib/test/types/Localization.test.js +241 -0
- package/lib/test/types/MoneyAmount.test.d.ts +1 -0
- package/lib/test/types/MoneyAmount.test.js +276 -0
- package/lib/test/types/NotificationProperties.test.d.ts +1 -0
- package/lib/test/types/NotificationProperties.test.js +258 -0
- package/lib/test/types/PayedState.test.d.ts +1 -0
- package/lib/test/types/PayedState.test.js +105 -0
- package/lib/test/types/Person.test.d.ts +1 -0
- package/lib/test/types/Person.test.js +266 -0
- package/lib/test/types/PersonPrivateProperties.test.d.ts +1 -0
- package/lib/test/types/PersonPrivateProperties.test.js +155 -0
- package/lib/test/types/PersonSignInProperties.test.d.ts +1 -0
- package/lib/test/types/PersonSignInProperties.test.js +208 -0
- package/lib/test/types/Pluralization.test.d.ts +1 -0
- package/lib/test/types/Pluralization.test.js +206 -0
- package/lib/test/types/Team.test.d.ts +1 -0
- package/lib/test/types/Team.test.js +145 -0
- package/lib/test/types/User.test.d.ts +1 -0
- package/lib/test/types/User.test.js +232 -0
- package/lib/test/types/UserRole.test.d.ts +1 -0
- package/lib/test/types/UserRole.test.js +140 -0
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/package.json +10 -9
- package/src/firebase/FirebaseConfiguration.ts +49 -1
- package/src/firebase/Firestore.ts +248 -0
- package/src/{FirestoreScheme.ts → firebase/FirestoreScheme.ts} +15 -1
- package/src/firebase/Messaging.ts +64 -0
- package/src/{checkAuthentication.ts → firebase/checkAuthentication.ts} +39 -1
- package/src/firebase/index.ts +5 -0
- package/src/firebase/pushNotification.ts +90 -0
- package/src/functions/fine/add.ts +10 -48
- package/src/functions/fine/delete.ts +9 -43
- package/src/functions/fine/update.ts +10 -44
- package/src/functions/fineTemplate/add.ts +7 -23
- package/src/functions/fineTemplate/delete.ts +7 -23
- package/src/functions/fineTemplate/update.ts +7 -24
- package/src/functions/index.ts +0 -1
- package/src/functions/invitation/getInvitation.ts +81 -118
- package/src/functions/invitation/invite.ts +2 -25
- package/src/functions/invitation/register.ts +9 -60
- package/src/functions/invitation/withdraw.ts +2 -16
- package/src/functions/notification/register.ts +7 -26
- package/src/functions/notification/subscribe.ts +8 -26
- package/src/functions/paypalMe/edit.ts +7 -25
- package/src/functions/person/add.ts +8 -24
- package/src/functions/person/delete.ts +6 -25
- package/src/functions/person/update.ts +8 -25
- package/src/functions/team/new.ts +12 -42
- package/src/functions/user/kickout.ts +8 -41
- package/src/functions/user/login.ts +2 -16
- package/src/functions/user/roleEdit.ts +8 -32
- package/src/index.ts +0 -5
- package/src/locales/de.ts +10 -1
- package/src/locales/en.ts +21 -2
- package/src/types/Configuration.ts +33 -23
- package/src/types/Currency.ts +24 -0
- package/src/types/Fine.ts +41 -0
- package/src/types/FineAmount.ts +162 -11
- package/src/types/FineTemplate.ts +41 -0
- package/src/types/FineTemplateRepetition.ts +75 -17
- package/src/types/Invitation.ts +48 -0
- package/src/types/Locale.ts +20 -0
- package/src/types/Localization.ts +96 -41
- package/src/types/MoneyAmount.ts +67 -1
- package/src/types/NotificationProperties.ts +67 -9
- package/src/types/PayedState.ts +25 -30
- package/src/types/Person.ts +45 -0
- package/src/types/PersonPrivateProperties.ts +28 -1
- package/src/types/PersonSignInProperties.ts +30 -0
- package/src/types/Pluralization.ts +46 -0
- package/src/types/Team.ts +38 -0
- package/src/types/User.ts +70 -4
- package/src/types/UserRole.ts +32 -16
- package/src/types/index.ts +2 -0
- package/lib/src/Firestore.d.ts +0 -24
- package/lib/src/Firestore.js +0 -62
- package/lib/src/checkAuthentication.d.ts +0 -6
- package/lib/src/firebaseFunctionsContext.d.ts +0 -39
- package/lib/src/firebaseFunctionsContext.js +0 -43
- package/lib/src/pushNotification.d.ts +0 -3
- package/lib/src/pushNotification.js +0 -35
- package/lib/test/localization-utils.d.ts +0 -1
- package/lib/test/localization-utils.js +0 -24
- package/lib/test/localization.de.test.js +0 -151
- package/lib/test/localization.en.test.js +0 -145
- package/src/Firestore.ts +0 -75
- package/src/firebaseFunctionsContext.ts +0 -48
- package/src/pushNotification.ts +0 -37
- /package/lib/src/{FirestoreScheme.js → firebase/FirestoreScheme.js} +0 -0
- /package/lib/test/{localization.de.test.d.ts → firebase/FirebaseConfiguration.test.d.ts} +0 -0
- /package/lib/test/{localization.en.test.d.ts → firebase/Firestore.test.d.ts} +0 -0
|
@@ -2,13 +2,27 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.NotificationProperties = void 0;
|
|
4
4
|
const typescript_common_functionality_1 = require("@stevenkellner/typescript-common-functionality");
|
|
5
|
+
/**
|
|
6
|
+
* Represents notification properties for a user including device tokens and subscription preferences.
|
|
7
|
+
*
|
|
8
|
+
* Manages push notification device tokens (identified by hashed token IDs for security)
|
|
9
|
+
* and user preferences for which types of notifications they want to receive.
|
|
10
|
+
*/
|
|
5
11
|
class NotificationProperties {
|
|
6
12
|
tokens;
|
|
7
13
|
subscriptions;
|
|
14
|
+
/**
|
|
15
|
+
* Creates new notification properties.
|
|
16
|
+
* @param tokens - Dictionary mapping token IDs to device tokens for push notifications (defaults to empty)
|
|
17
|
+
* @param subscriptions - Array of notification types the user is subscribed to (defaults to empty)
|
|
18
|
+
*/
|
|
8
19
|
constructor(tokens = new typescript_common_functionality_1.Dictionary(NotificationProperties.TokenId.builder), subscriptions = []) {
|
|
9
20
|
this.tokens = tokens;
|
|
10
21
|
this.subscriptions = subscriptions;
|
|
11
22
|
}
|
|
23
|
+
/**
|
|
24
|
+
* Gets the flattened representation of these notification properties for serialization.
|
|
25
|
+
*/
|
|
12
26
|
get flatten() {
|
|
13
27
|
return {
|
|
14
28
|
tokens: this.tokens.flatten,
|
|
@@ -20,6 +34,12 @@ exports.NotificationProperties = NotificationProperties;
|
|
|
20
34
|
(function (NotificationProperties) {
|
|
21
35
|
let TokenId;
|
|
22
36
|
(function (TokenId) {
|
|
37
|
+
/**
|
|
38
|
+
* Creates a token ID from a device token by hashing it with SHA-512.
|
|
39
|
+
* Only the first 16 characters of the hash are used as the identifier.
|
|
40
|
+
* @param token - The device push notification token
|
|
41
|
+
* @returns A hashed token ID for secure storage and lookup
|
|
42
|
+
*/
|
|
23
43
|
function create(token) {
|
|
24
44
|
const hasher = new typescript_common_functionality_1.Sha512();
|
|
25
45
|
const tokenBytes = typescript_common_functionality_1.BytesCoder.fromUtf8(token);
|
|
@@ -29,22 +49,46 @@ exports.NotificationProperties = NotificationProperties;
|
|
|
29
49
|
return new typescript_common_functionality_1.Tagged(rawId, 'notificationToken');
|
|
30
50
|
}
|
|
31
51
|
TokenId.create = create;
|
|
52
|
+
/**
|
|
53
|
+
* Builder for constructing TokenId instances from strings.
|
|
54
|
+
*/
|
|
32
55
|
TokenId.builder = typescript_common_functionality_1.Tagged.builder('notificationToken', new typescript_common_functionality_1.ValueTypeBuilder());
|
|
33
56
|
})(TokenId = NotificationProperties.TokenId || (NotificationProperties.TokenId = {}));
|
|
57
|
+
/**
|
|
58
|
+
* Available notification subscription types.
|
|
59
|
+
*/
|
|
60
|
+
const subscriptions = [
|
|
61
|
+
'new-fine',
|
|
62
|
+
'fine-reminder',
|
|
63
|
+
'fine-state-change'
|
|
64
|
+
];
|
|
34
65
|
let Subscription;
|
|
35
66
|
(function (Subscription) {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
67
|
+
/**
|
|
68
|
+
* Readonly array of all available subscription types.
|
|
69
|
+
*/
|
|
70
|
+
Subscription.all = subscriptions;
|
|
71
|
+
/**
|
|
72
|
+
* Builder for constructing Subscription values from strings.
|
|
73
|
+
*/
|
|
41
74
|
Subscription.builder = new typescript_common_functionality_1.ValueTypeBuilder();
|
|
42
75
|
})(Subscription = NotificationProperties.Subscription || (NotificationProperties.Subscription = {}));
|
|
76
|
+
/**
|
|
77
|
+
* Builder for constructing NotificationProperties from flattened data.
|
|
78
|
+
*/
|
|
43
79
|
class TypeBuilder {
|
|
80
|
+
/**
|
|
81
|
+
* Builds a NotificationProperties instance from flattened data.
|
|
82
|
+
* @param value - The flattened notification properties data
|
|
83
|
+
* @returns A new NotificationProperties instance
|
|
84
|
+
*/
|
|
44
85
|
build(value) {
|
|
45
86
|
return new NotificationProperties(typescript_common_functionality_1.Dictionary.builder(TokenId.builder, new typescript_common_functionality_1.ValueTypeBuilder()).build(value.tokens), value.subscriptions);
|
|
46
87
|
}
|
|
47
88
|
}
|
|
48
89
|
NotificationProperties.TypeBuilder = TypeBuilder;
|
|
90
|
+
/**
|
|
91
|
+
* Singleton builder instance for NotificationProperties.
|
|
92
|
+
*/
|
|
49
93
|
NotificationProperties.builder = new TypeBuilder();
|
|
50
94
|
})(NotificationProperties || (exports.NotificationProperties = NotificationProperties = {}));
|
|
@@ -1,12 +1,28 @@
|
|
|
1
1
|
import { ValueTypeBuilder } from '@stevenkellner/typescript-common-functionality';
|
|
2
|
-
|
|
2
|
+
import { Locale } from './Locale';
|
|
3
|
+
declare const payedStates: readonly ["payed", "notPayed"];
|
|
4
|
+
/**
|
|
5
|
+
* Represents the payment status of a fine.
|
|
6
|
+
*
|
|
7
|
+
* Can be either 'payed' (fine has been paid) or 'notPayed' (fine is unpaid).
|
|
8
|
+
*/
|
|
9
|
+
export type PayedState = typeof payedStates[number];
|
|
3
10
|
export declare namespace PayedState {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
11
|
+
/**
|
|
12
|
+
* Array containing all possible payment states.
|
|
13
|
+
*/
|
|
14
|
+
const all: readonly PayedState[];
|
|
15
|
+
/**
|
|
16
|
+
* Returns the localized display string for a payment state.
|
|
17
|
+
*
|
|
18
|
+
* @param state - The payment state to format
|
|
19
|
+
* @param locale - The locale to use for formatting
|
|
20
|
+
* @returns Localized string representation of the payment state
|
|
21
|
+
*/
|
|
22
|
+
function formatted(state: PayedState, locale: Locale): string;
|
|
23
|
+
/**
|
|
24
|
+
* Type builder for PayedState serialization/deserialization.
|
|
25
|
+
*/
|
|
26
|
+
const builder: ValueTypeBuilder<"payed" | "notPayed">;
|
|
12
27
|
}
|
|
28
|
+
export {};
|
|
@@ -3,36 +3,26 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.PayedState = void 0;
|
|
4
4
|
const typescript_common_functionality_1 = require("@stevenkellner/typescript-common-functionality");
|
|
5
5
|
const Localization_1 = require("./Localization");
|
|
6
|
+
const payedStates = ['payed', 'notPayed'];
|
|
6
7
|
var PayedState;
|
|
7
8
|
(function (PayedState) {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
/**
|
|
10
|
+
* Array containing all possible payment states.
|
|
11
|
+
*/
|
|
12
|
+
PayedState.all = payedStates;
|
|
13
|
+
/**
|
|
14
|
+
* Returns the localized display string for a payment state.
|
|
15
|
+
*
|
|
16
|
+
* @param state - The payment state to format
|
|
17
|
+
* @param locale - The locale to use for formatting
|
|
18
|
+
* @returns Localized string representation of the payment state
|
|
19
|
+
*/
|
|
20
|
+
function formatted(state, locale) {
|
|
21
|
+
return Localization_1.Localization.shared(locale).payedState[state].value();
|
|
11
22
|
}
|
|
12
23
|
PayedState.formatted = formatted;
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
return 'notPayed';
|
|
17
|
-
case 'notPayed':
|
|
18
|
-
return 'payed';
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
PayedState.toggled = toggled;
|
|
22
|
-
function payedTag(state) {
|
|
23
|
-
switch (state) {
|
|
24
|
-
case 'payed':
|
|
25
|
-
return {
|
|
26
|
-
value: formatted(state),
|
|
27
|
-
severity: 'secondary'
|
|
28
|
-
};
|
|
29
|
-
case 'notPayed':
|
|
30
|
-
return {
|
|
31
|
-
value: formatted(state),
|
|
32
|
-
severity: 'danger'
|
|
33
|
-
};
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
PayedState.payedTag = payedTag;
|
|
24
|
+
/**
|
|
25
|
+
* Type builder for PayedState serialization/deserialization.
|
|
26
|
+
*/
|
|
37
27
|
PayedState.builder = new typescript_common_functionality_1.ValueTypeBuilder();
|
|
38
28
|
})(PayedState || (exports.PayedState = PayedState = {}));
|
|
@@ -2,29 +2,74 @@ import { PersonPrivateProperties } from './PersonPrivateProperties';
|
|
|
2
2
|
import { PersonSignInProperties } from './PersonSignInProperties';
|
|
3
3
|
import { Fine } from './Fine';
|
|
4
4
|
import { Flattable, Guid, ITypeBuilder, Tagged } from '@stevenkellner/typescript-common-functionality';
|
|
5
|
+
/**
|
|
6
|
+
* Represents a person within a team, including their personal details, assigned fines, and optional sign-in properties.
|
|
7
|
+
*
|
|
8
|
+
* A person can have multiple fines assigned to them and may or may not be signed in (have sign-in properties).
|
|
9
|
+
*/
|
|
5
10
|
export declare class Person implements Flattable<Person.Flatten> {
|
|
6
11
|
id: Person.Id;
|
|
7
12
|
properties: PersonPrivateProperties;
|
|
8
13
|
fineIds: Fine.Id[];
|
|
9
14
|
signInProperties: PersonSignInProperties | null;
|
|
15
|
+
/**
|
|
16
|
+
* Creates a new Person instance.
|
|
17
|
+
*
|
|
18
|
+
* @param id - Unique identifier for the person (GUID)
|
|
19
|
+
* @param properties - Private properties including first name and optional last name
|
|
20
|
+
* @param fineIds - Array of fine IDs assigned to this person (defaults to empty array)
|
|
21
|
+
* @param signInProperties - Optional sign-in properties if the person has signed in (defaults to null)
|
|
22
|
+
*/
|
|
10
23
|
constructor(id: Person.Id, properties: PersonPrivateProperties, fineIds?: Fine.Id[], signInProperties?: PersonSignInProperties | null);
|
|
24
|
+
/**
|
|
25
|
+
* Returns the flattened representation of the person for serialization.
|
|
26
|
+
*/
|
|
11
27
|
get flatten(): Person.Flatten;
|
|
28
|
+
/**
|
|
29
|
+
* Returns the person's full name.
|
|
30
|
+
*
|
|
31
|
+
* If lastName is null, returns only firstName. Otherwise returns "firstName lastName".
|
|
32
|
+
*/
|
|
12
33
|
get name(): string;
|
|
13
34
|
}
|
|
14
35
|
export declare namespace Person {
|
|
36
|
+
/**
|
|
37
|
+
* Tagged GUID type for person identifiers.
|
|
38
|
+
*/
|
|
15
39
|
type Id = Tagged<Guid, 'person'>;
|
|
16
40
|
namespace Id {
|
|
41
|
+
/**
|
|
42
|
+
* Flattened representation of a person ID (GUID string).
|
|
43
|
+
*/
|
|
17
44
|
type Flatten = string;
|
|
45
|
+
/**
|
|
46
|
+
* Type builder for Person.Id serialization/deserialization.
|
|
47
|
+
*/
|
|
18
48
|
const builder: Tagged.TypeBuilder<Guid, "person">;
|
|
19
49
|
}
|
|
50
|
+
/**
|
|
51
|
+
* Flattened representation of a Person for serialization.
|
|
52
|
+
*/
|
|
20
53
|
type Flatten = {
|
|
21
54
|
id: Id.Flatten;
|
|
22
55
|
properties: PersonPrivateProperties.Flatten;
|
|
23
56
|
fineIds: Fine.Id.Flatten[];
|
|
24
57
|
signInProperties: PersonSignInProperties.Flatten | null;
|
|
25
58
|
};
|
|
59
|
+
/**
|
|
60
|
+
* Type builder for Person serialization/deserialization.
|
|
61
|
+
*/
|
|
26
62
|
class TypeBuilder implements ITypeBuilder<Flatten, Person> {
|
|
63
|
+
/**
|
|
64
|
+
* Builds a Person instance from flattened data.
|
|
65
|
+
*
|
|
66
|
+
* @param value - Flattened person data
|
|
67
|
+
* @returns Person instance
|
|
68
|
+
*/
|
|
27
69
|
build(value: Flatten): Person;
|
|
28
70
|
}
|
|
71
|
+
/**
|
|
72
|
+
* Singleton instance of TypeBuilder for Person.
|
|
73
|
+
*/
|
|
29
74
|
const builder: TypeBuilder;
|
|
30
75
|
}
|
package/lib/src/types/Person.js
CHANGED
|
@@ -5,17 +5,33 @@ const PersonPrivateProperties_1 = require("./PersonPrivateProperties");
|
|
|
5
5
|
const PersonSignInProperties_1 = require("./PersonSignInProperties");
|
|
6
6
|
const Fine_1 = require("./Fine");
|
|
7
7
|
const typescript_common_functionality_1 = require("@stevenkellner/typescript-common-functionality");
|
|
8
|
+
/**
|
|
9
|
+
* Represents a person within a team, including their personal details, assigned fines, and optional sign-in properties.
|
|
10
|
+
*
|
|
11
|
+
* A person can have multiple fines assigned to them and may or may not be signed in (have sign-in properties).
|
|
12
|
+
*/
|
|
8
13
|
class Person {
|
|
9
14
|
id;
|
|
10
15
|
properties;
|
|
11
16
|
fineIds;
|
|
12
17
|
signInProperties;
|
|
18
|
+
/**
|
|
19
|
+
* Creates a new Person instance.
|
|
20
|
+
*
|
|
21
|
+
* @param id - Unique identifier for the person (GUID)
|
|
22
|
+
* @param properties - Private properties including first name and optional last name
|
|
23
|
+
* @param fineIds - Array of fine IDs assigned to this person (defaults to empty array)
|
|
24
|
+
* @param signInProperties - Optional sign-in properties if the person has signed in (defaults to null)
|
|
25
|
+
*/
|
|
13
26
|
constructor(id, properties, fineIds = [], signInProperties = null) {
|
|
14
27
|
this.id = id;
|
|
15
28
|
this.properties = properties;
|
|
16
29
|
this.fineIds = fineIds;
|
|
17
30
|
this.signInProperties = signInProperties;
|
|
18
31
|
}
|
|
32
|
+
/**
|
|
33
|
+
* Returns the flattened representation of the person for serialization.
|
|
34
|
+
*/
|
|
19
35
|
get flatten() {
|
|
20
36
|
return {
|
|
21
37
|
id: this.id.flatten,
|
|
@@ -24,6 +40,11 @@ class Person {
|
|
|
24
40
|
signInProperties: this.signInProperties?.flatten ?? null
|
|
25
41
|
};
|
|
26
42
|
}
|
|
43
|
+
/**
|
|
44
|
+
* Returns the person's full name.
|
|
45
|
+
*
|
|
46
|
+
* If lastName is null, returns only firstName. Otherwise returns "firstName lastName".
|
|
47
|
+
*/
|
|
27
48
|
get name() {
|
|
28
49
|
if (this.properties.lastName === null)
|
|
29
50
|
return this.properties.firstName;
|
|
@@ -34,13 +55,28 @@ exports.Person = Person;
|
|
|
34
55
|
(function (Person) {
|
|
35
56
|
let Id;
|
|
36
57
|
(function (Id) {
|
|
58
|
+
/**
|
|
59
|
+
* Type builder for Person.Id serialization/deserialization.
|
|
60
|
+
*/
|
|
37
61
|
Id.builder = typescript_common_functionality_1.Tagged.builder('person', typescript_common_functionality_1.Guid.builder);
|
|
38
62
|
})(Id = Person.Id || (Person.Id = {}));
|
|
63
|
+
/**
|
|
64
|
+
* Type builder for Person serialization/deserialization.
|
|
65
|
+
*/
|
|
39
66
|
class TypeBuilder {
|
|
67
|
+
/**
|
|
68
|
+
* Builds a Person instance from flattened data.
|
|
69
|
+
*
|
|
70
|
+
* @param value - Flattened person data
|
|
71
|
+
* @returns Person instance
|
|
72
|
+
*/
|
|
40
73
|
build(value) {
|
|
41
74
|
return new Person(Id.builder.build(value.id), PersonPrivateProperties_1.PersonPrivateProperties.builder.build(value.properties), value.fineIds.map(fineId => Fine_1.Fine.Id.builder.build(fineId)), value.signInProperties ? PersonSignInProperties_1.PersonSignInProperties.builder.build(value.signInProperties) : null);
|
|
42
75
|
}
|
|
43
76
|
}
|
|
44
77
|
Person.TypeBuilder = TypeBuilder;
|
|
78
|
+
/**
|
|
79
|
+
* Singleton instance of TypeBuilder for Person.
|
|
80
|
+
*/
|
|
45
81
|
Person.builder = new TypeBuilder();
|
|
46
82
|
})(Person || (exports.Person = Person = {}));
|
|
@@ -1,17 +1,45 @@
|
|
|
1
1
|
import { Flattable, ITypeBuilder } from '@stevenkellner/typescript-common-functionality';
|
|
2
|
+
/**
|
|
3
|
+
* Represents the private properties of a person.
|
|
4
|
+
*
|
|
5
|
+
* Contains personal information that is private to the person,
|
|
6
|
+
* such as their name. The last name is optional.
|
|
7
|
+
*/
|
|
2
8
|
export declare class PersonPrivateProperties implements Flattable<PersonPrivateProperties.Flatten> {
|
|
3
9
|
firstName: string;
|
|
4
10
|
lastName: string | null;
|
|
11
|
+
/**
|
|
12
|
+
* Creates new person private properties.
|
|
13
|
+
* @param firstName - The first name of the person
|
|
14
|
+
* @param lastName - The last name of the person (null if not provided)
|
|
15
|
+
*/
|
|
5
16
|
constructor(firstName: string, lastName: string | null);
|
|
17
|
+
/**
|
|
18
|
+
* Gets the flattened representation of these properties for serialization.
|
|
19
|
+
*/
|
|
6
20
|
get flatten(): PersonPrivateProperties.Flatten;
|
|
7
21
|
}
|
|
8
22
|
export declare namespace PersonPrivateProperties {
|
|
23
|
+
/**
|
|
24
|
+
* Flattened representation of person private properties for serialization.
|
|
25
|
+
*/
|
|
9
26
|
type Flatten = {
|
|
10
27
|
firstName: string;
|
|
11
28
|
lastName: string | null;
|
|
12
29
|
};
|
|
30
|
+
/**
|
|
31
|
+
* Builder for constructing PersonPrivateProperties from flattened data.
|
|
32
|
+
*/
|
|
13
33
|
class TypeBuilder implements ITypeBuilder<Flatten, PersonPrivateProperties> {
|
|
34
|
+
/**
|
|
35
|
+
* Builds a PersonPrivateProperties instance from flattened data.
|
|
36
|
+
* @param value - The flattened person private properties data
|
|
37
|
+
* @returns A new PersonPrivateProperties instance
|
|
38
|
+
*/
|
|
14
39
|
build(value: Flatten): PersonPrivateProperties;
|
|
15
40
|
}
|
|
41
|
+
/**
|
|
42
|
+
* Singleton builder instance for PersonPrivateProperties.
|
|
43
|
+
*/
|
|
16
44
|
const builder: TypeBuilder;
|
|
17
45
|
}
|
|
@@ -1,13 +1,27 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.PersonPrivateProperties = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Represents the private properties of a person.
|
|
6
|
+
*
|
|
7
|
+
* Contains personal information that is private to the person,
|
|
8
|
+
* such as their name. The last name is optional.
|
|
9
|
+
*/
|
|
4
10
|
class PersonPrivateProperties {
|
|
5
11
|
firstName;
|
|
6
12
|
lastName;
|
|
13
|
+
/**
|
|
14
|
+
* Creates new person private properties.
|
|
15
|
+
* @param firstName - The first name of the person
|
|
16
|
+
* @param lastName - The last name of the person (null if not provided)
|
|
17
|
+
*/
|
|
7
18
|
constructor(firstName, lastName) {
|
|
8
19
|
this.firstName = firstName;
|
|
9
20
|
this.lastName = lastName;
|
|
10
21
|
}
|
|
22
|
+
/**
|
|
23
|
+
* Gets the flattened representation of these properties for serialization.
|
|
24
|
+
*/
|
|
11
25
|
get flatten() {
|
|
12
26
|
return {
|
|
13
27
|
firstName: this.firstName,
|
|
@@ -17,11 +31,22 @@ class PersonPrivateProperties {
|
|
|
17
31
|
}
|
|
18
32
|
exports.PersonPrivateProperties = PersonPrivateProperties;
|
|
19
33
|
(function (PersonPrivateProperties) {
|
|
34
|
+
/**
|
|
35
|
+
* Builder for constructing PersonPrivateProperties from flattened data.
|
|
36
|
+
*/
|
|
20
37
|
class TypeBuilder {
|
|
38
|
+
/**
|
|
39
|
+
* Builds a PersonPrivateProperties instance from flattened data.
|
|
40
|
+
* @param value - The flattened person private properties data
|
|
41
|
+
* @returns A new PersonPrivateProperties instance
|
|
42
|
+
*/
|
|
21
43
|
build(value) {
|
|
22
44
|
return new PersonPrivateProperties(value.firstName, value.lastName);
|
|
23
45
|
}
|
|
24
46
|
}
|
|
25
47
|
PersonPrivateProperties.TypeBuilder = TypeBuilder;
|
|
48
|
+
/**
|
|
49
|
+
* Singleton builder instance for PersonPrivateProperties.
|
|
50
|
+
*/
|
|
26
51
|
PersonPrivateProperties.builder = new TypeBuilder();
|
|
27
52
|
})(PersonPrivateProperties || (exports.PersonPrivateProperties = PersonPrivateProperties = {}));
|
|
@@ -2,23 +2,53 @@ import { Flattable, ITypeBuilder, UtcDate } from '@stevenkellner/typescript-comm
|
|
|
2
2
|
import { NotificationProperties } from './NotificationProperties';
|
|
3
3
|
import { User } from './User';
|
|
4
4
|
import { UserRole } from './UserRole';
|
|
5
|
+
/**
|
|
6
|
+
* Represents the sign-in properties for a person in the system.
|
|
7
|
+
*
|
|
8
|
+
* Contains authentication-related information including user ID, sign-in timestamp,
|
|
9
|
+
* notification preferences, and assigned user roles for access control.
|
|
10
|
+
*/
|
|
5
11
|
export declare class PersonSignInProperties implements Flattable<PersonSignInProperties.Flatten> {
|
|
6
12
|
userId: User.Id;
|
|
7
13
|
signInDate: UtcDate;
|
|
8
14
|
notificationProperties: NotificationProperties;
|
|
9
15
|
roles: UserRole[];
|
|
16
|
+
/**
|
|
17
|
+
* Creates new person sign-in properties.
|
|
18
|
+
* @param userId - The unique identifier of the user associated with this person
|
|
19
|
+
* @param signInDate - The timestamp when the person signed in
|
|
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)
|
|
22
|
+
*/
|
|
10
23
|
constructor(userId: User.Id, signInDate: UtcDate, notificationProperties?: NotificationProperties, roles?: UserRole[]);
|
|
24
|
+
/**
|
|
25
|
+
* Gets the flattened representation of these sign-in properties for serialization.
|
|
26
|
+
*/
|
|
11
27
|
get flatten(): PersonSignInProperties.Flatten;
|
|
12
28
|
}
|
|
13
29
|
export declare namespace PersonSignInProperties {
|
|
30
|
+
/**
|
|
31
|
+
* Flattened representation of person sign-in properties for serialization.
|
|
32
|
+
*/
|
|
14
33
|
type Flatten = {
|
|
15
34
|
userId: User.Id.Flatten;
|
|
16
35
|
signInDate: UtcDate.Flatten;
|
|
17
36
|
notificationProperties: NotificationProperties.Flatten;
|
|
18
37
|
roles: UserRole[];
|
|
19
38
|
};
|
|
39
|
+
/**
|
|
40
|
+
* Builder for constructing PersonSignInProperties from flattened data.
|
|
41
|
+
*/
|
|
20
42
|
class TypeBuilder implements ITypeBuilder<Flatten, PersonSignInProperties> {
|
|
43
|
+
/**
|
|
44
|
+
* Builds a PersonSignInProperties instance from flattened data.
|
|
45
|
+
* @param value - The flattened sign-in properties data
|
|
46
|
+
* @returns A new PersonSignInProperties instance
|
|
47
|
+
*/
|
|
21
48
|
build(value: Flatten): PersonSignInProperties;
|
|
22
49
|
}
|
|
50
|
+
/**
|
|
51
|
+
* Singleton builder instance for PersonSignInProperties.
|
|
52
|
+
*/
|
|
23
53
|
const builder: TypeBuilder;
|
|
24
54
|
}
|
|
@@ -4,17 +4,33 @@ exports.PersonSignInProperties = void 0;
|
|
|
4
4
|
const typescript_common_functionality_1 = require("@stevenkellner/typescript-common-functionality");
|
|
5
5
|
const NotificationProperties_1 = require("./NotificationProperties");
|
|
6
6
|
const User_1 = require("./User");
|
|
7
|
+
/**
|
|
8
|
+
* Represents the sign-in properties for a person in the system.
|
|
9
|
+
*
|
|
10
|
+
* Contains authentication-related information including user ID, sign-in timestamp,
|
|
11
|
+
* notification preferences, and assigned user roles for access control.
|
|
12
|
+
*/
|
|
7
13
|
class PersonSignInProperties {
|
|
8
14
|
userId;
|
|
9
15
|
signInDate;
|
|
10
16
|
notificationProperties;
|
|
11
17
|
roles;
|
|
18
|
+
/**
|
|
19
|
+
* Creates new person sign-in properties.
|
|
20
|
+
* @param userId - The unique identifier of the user associated with this person
|
|
21
|
+
* @param signInDate - The timestamp when the person signed in
|
|
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)
|
|
24
|
+
*/
|
|
12
25
|
constructor(userId, signInDate, notificationProperties = new NotificationProperties_1.NotificationProperties(), roles = []) {
|
|
13
26
|
this.userId = userId;
|
|
14
27
|
this.signInDate = signInDate;
|
|
15
28
|
this.notificationProperties = notificationProperties;
|
|
16
29
|
this.roles = roles;
|
|
17
30
|
}
|
|
31
|
+
/**
|
|
32
|
+
* Gets the flattened representation of these sign-in properties for serialization.
|
|
33
|
+
*/
|
|
18
34
|
get flatten() {
|
|
19
35
|
return {
|
|
20
36
|
userId: this.userId.flatten,
|
|
@@ -26,11 +42,22 @@ class PersonSignInProperties {
|
|
|
26
42
|
}
|
|
27
43
|
exports.PersonSignInProperties = PersonSignInProperties;
|
|
28
44
|
(function (PersonSignInProperties) {
|
|
45
|
+
/**
|
|
46
|
+
* Builder for constructing PersonSignInProperties from flattened data.
|
|
47
|
+
*/
|
|
29
48
|
class TypeBuilder {
|
|
49
|
+
/**
|
|
50
|
+
* Builds a PersonSignInProperties instance from flattened data.
|
|
51
|
+
* @param value - The flattened sign-in properties data
|
|
52
|
+
* @returns A new PersonSignInProperties instance
|
|
53
|
+
*/
|
|
30
54
|
build(value) {
|
|
31
55
|
return new PersonSignInProperties(User_1.User.Id.builder.build(value.userId), typescript_common_functionality_1.UtcDate.builder.build(value.signInDate), NotificationProperties_1.NotificationProperties.builder.build(value.notificationProperties), value.roles);
|
|
32
56
|
}
|
|
33
57
|
}
|
|
34
58
|
PersonSignInProperties.TypeBuilder = TypeBuilder;
|
|
59
|
+
/**
|
|
60
|
+
* Singleton builder instance for PersonSignInProperties.
|
|
61
|
+
*/
|
|
35
62
|
PersonSignInProperties.builder = new TypeBuilder();
|
|
36
63
|
})(PersonSignInProperties || (exports.PersonSignInProperties = PersonSignInProperties = {}));
|
|
@@ -1,10 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Handles pluralization of strings based on count values.
|
|
3
|
+
* Supports different plural forms for various count categories (zero, one, two, few, many, other).
|
|
4
|
+
* This follows the Unicode CLDR plural rules for internationalization.
|
|
5
|
+
*/
|
|
1
6
|
export declare class Pluralization {
|
|
7
|
+
/**
|
|
8
|
+
* Plural form for count = 0 (optional).
|
|
9
|
+
*/
|
|
2
10
|
private readonly zero;
|
|
11
|
+
/**
|
|
12
|
+
* Plural form for count = 1 (optional).
|
|
13
|
+
*/
|
|
3
14
|
private readonly one;
|
|
15
|
+
/**
|
|
16
|
+
* Plural form for count = 2 (optional).
|
|
17
|
+
*/
|
|
4
18
|
private readonly two;
|
|
19
|
+
/**
|
|
20
|
+
* Plural form for count > 1 and < 5 (optional).
|
|
21
|
+
*/
|
|
5
22
|
private readonly few;
|
|
23
|
+
/**
|
|
24
|
+
* Plural form for count >= 5 and <= 20 (optional).
|
|
25
|
+
*/
|
|
6
26
|
private readonly many;
|
|
27
|
+
/**
|
|
28
|
+
* Default plural form used when no other category matches (required).
|
|
29
|
+
*/
|
|
7
30
|
private readonly other;
|
|
31
|
+
/**
|
|
32
|
+
* Creates a new Pluralization instance with specified plural forms.
|
|
33
|
+
* @param countLocals - Object containing plural forms for different count categories
|
|
34
|
+
* @param countLocals.zero - Optional form for zero items
|
|
35
|
+
* @param countLocals.one - Optional form for one item
|
|
36
|
+
* @param countLocals.two - Optional form for two items
|
|
37
|
+
* @param countLocals.few - Optional form for a few items (2-4)
|
|
38
|
+
* @param countLocals.many - Optional form for many items (5-20)
|
|
39
|
+
* @param countLocals.other - Required default form for all other counts
|
|
40
|
+
*/
|
|
8
41
|
constructor(countLocals: {
|
|
9
42
|
zero?: string;
|
|
10
43
|
one?: string;
|
|
@@ -13,5 +46,18 @@ export declare class Pluralization {
|
|
|
13
46
|
many?: string;
|
|
14
47
|
other: string;
|
|
15
48
|
});
|
|
49
|
+
/**
|
|
50
|
+
* Returns the appropriate plural form for the given count.
|
|
51
|
+
* Applies the following rules in order:
|
|
52
|
+
* - count = 0: returns 'zero' form if defined
|
|
53
|
+
* - count = 1: returns 'one' form if defined
|
|
54
|
+
* - count = 2: returns 'two' form if defined
|
|
55
|
+
* - 1 < count < 5: returns 'few' form if defined
|
|
56
|
+
* - 5 <= count <= 20: returns 'many' form if defined
|
|
57
|
+
* - Otherwise: returns 'other' form
|
|
58
|
+
*
|
|
59
|
+
* @param count - The number to determine the plural form for
|
|
60
|
+
* @returns The appropriate plural form string for the given count
|
|
61
|
+
*/
|
|
16
62
|
get(count: number): string;
|
|
17
63
|
}
|
|
@@ -1,13 +1,46 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.Pluralization = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Handles pluralization of strings based on count values.
|
|
6
|
+
* Supports different plural forms for various count categories (zero, one, two, few, many, other).
|
|
7
|
+
* This follows the Unicode CLDR plural rules for internationalization.
|
|
8
|
+
*/
|
|
4
9
|
class Pluralization {
|
|
10
|
+
/**
|
|
11
|
+
* Plural form for count = 0 (optional).
|
|
12
|
+
*/
|
|
5
13
|
zero;
|
|
14
|
+
/**
|
|
15
|
+
* Plural form for count = 1 (optional).
|
|
16
|
+
*/
|
|
6
17
|
one;
|
|
18
|
+
/**
|
|
19
|
+
* Plural form for count = 2 (optional).
|
|
20
|
+
*/
|
|
7
21
|
two;
|
|
22
|
+
/**
|
|
23
|
+
* Plural form for count > 1 and < 5 (optional).
|
|
24
|
+
*/
|
|
8
25
|
few;
|
|
26
|
+
/**
|
|
27
|
+
* Plural form for count >= 5 and <= 20 (optional).
|
|
28
|
+
*/
|
|
9
29
|
many;
|
|
30
|
+
/**
|
|
31
|
+
* Default plural form used when no other category matches (required).
|
|
32
|
+
*/
|
|
10
33
|
other;
|
|
34
|
+
/**
|
|
35
|
+
* Creates a new Pluralization instance with specified plural forms.
|
|
36
|
+
* @param countLocals - Object containing plural forms for different count categories
|
|
37
|
+
* @param countLocals.zero - Optional form for zero items
|
|
38
|
+
* @param countLocals.one - Optional form for one item
|
|
39
|
+
* @param countLocals.two - Optional form for two items
|
|
40
|
+
* @param countLocals.few - Optional form for a few items (2-4)
|
|
41
|
+
* @param countLocals.many - Optional form for many items (5-20)
|
|
42
|
+
* @param countLocals.other - Required default form for all other counts
|
|
43
|
+
*/
|
|
11
44
|
constructor(countLocals) {
|
|
12
45
|
this.zero = countLocals.zero ?? null;
|
|
13
46
|
this.one = countLocals.one ?? null;
|
|
@@ -16,6 +49,19 @@ class Pluralization {
|
|
|
16
49
|
this.many = countLocals.many ?? null;
|
|
17
50
|
this.other = countLocals.other;
|
|
18
51
|
}
|
|
52
|
+
/**
|
|
53
|
+
* Returns the appropriate plural form for the given count.
|
|
54
|
+
* Applies the following rules in order:
|
|
55
|
+
* - count = 0: returns 'zero' form if defined
|
|
56
|
+
* - count = 1: returns 'one' form if defined
|
|
57
|
+
* - count = 2: returns 'two' form if defined
|
|
58
|
+
* - 1 < count < 5: returns 'few' form if defined
|
|
59
|
+
* - 5 <= count <= 20: returns 'many' form if defined
|
|
60
|
+
* - Otherwise: returns 'other' form
|
|
61
|
+
*
|
|
62
|
+
* @param count - The number to determine the plural form for
|
|
63
|
+
* @returns The appropriate plural form string for the given count
|
|
64
|
+
*/
|
|
19
65
|
get(count) {
|
|
20
66
|
if (count === 0 && this.zero)
|
|
21
67
|
return this.zero;
|