@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
|
@@ -1,28 +1,69 @@
|
|
|
1
1
|
import { Flattable, Guid, ITypeBuilder, Tagged } from '@stevenkellner/typescript-common-functionality';
|
|
2
2
|
import { FineAmount } from './FineAmount';
|
|
3
3
|
import { FineTemplateRepetition } from './FineTemplateRepetition';
|
|
4
|
+
/**
|
|
5
|
+
* Represents a template for creating fines with predefined reason, amount, and optional repetition rules.
|
|
6
|
+
*
|
|
7
|
+
* Fine templates allow teams to quickly create recurring or standard fines without entering
|
|
8
|
+
* the same information repeatedly.
|
|
9
|
+
*/
|
|
4
10
|
export declare class FineTemplate implements Flattable<FineTemplate.Flatten> {
|
|
5
11
|
id: FineTemplate.Id;
|
|
6
12
|
reason: string;
|
|
7
13
|
amount: FineAmount;
|
|
8
14
|
repetition: FineTemplateRepetition | null;
|
|
15
|
+
/**
|
|
16
|
+
* Creates a new FineTemplate instance.
|
|
17
|
+
*
|
|
18
|
+
* @param id - Unique identifier for the fine template (GUID)
|
|
19
|
+
* @param reason - The reason or description for the fine
|
|
20
|
+
* @param amount - The monetary or item-based amount of the fine
|
|
21
|
+
* @param repetition - Optional repetition rules (null for non-recurring templates)
|
|
22
|
+
*/
|
|
9
23
|
constructor(id: FineTemplate.Id, reason: string, amount: FineAmount, repetition: FineTemplateRepetition | null);
|
|
24
|
+
/**
|
|
25
|
+
* Returns the flattened representation for serialization.
|
|
26
|
+
*/
|
|
10
27
|
get flatten(): FineTemplate.Flatten;
|
|
11
28
|
}
|
|
12
29
|
export declare namespace FineTemplate {
|
|
30
|
+
/**
|
|
31
|
+
* Tagged GUID type for fine template identifiers.
|
|
32
|
+
*/
|
|
13
33
|
type Id = Tagged<Guid, 'fineTemplate'>;
|
|
14
34
|
namespace Id {
|
|
35
|
+
/**
|
|
36
|
+
* Flattened representation of a fine template ID (GUID string).
|
|
37
|
+
*/
|
|
15
38
|
type Flatten = string;
|
|
39
|
+
/**
|
|
40
|
+
* Type builder for FineTemplate.Id serialization/deserialization.
|
|
41
|
+
*/
|
|
16
42
|
const builder: Tagged.TypeBuilder<Guid, "fineTemplate">;
|
|
17
43
|
}
|
|
44
|
+
/**
|
|
45
|
+
* Flattened representation of a FineTemplate for serialization.
|
|
46
|
+
*/
|
|
18
47
|
type Flatten = {
|
|
19
48
|
id: Id.Flatten;
|
|
20
49
|
reason: string;
|
|
21
50
|
amount: FineAmount.Flatten;
|
|
22
51
|
repetition: FineTemplateRepetition.Flatten | null;
|
|
23
52
|
};
|
|
53
|
+
/**
|
|
54
|
+
* Type builder for FineTemplate serialization/deserialization.
|
|
55
|
+
*/
|
|
24
56
|
class TypeBuilder implements ITypeBuilder<Flatten, FineTemplate> {
|
|
57
|
+
/**
|
|
58
|
+
* Builds a FineTemplate instance from flattened data.
|
|
59
|
+
*
|
|
60
|
+
* @param value - Flattened fine template data
|
|
61
|
+
* @returns FineTemplate instance
|
|
62
|
+
*/
|
|
25
63
|
build(value: Flatten): FineTemplate;
|
|
26
64
|
}
|
|
65
|
+
/**
|
|
66
|
+
* Singleton instance of TypeBuilder for FineTemplate.
|
|
67
|
+
*/
|
|
27
68
|
const builder: TypeBuilder;
|
|
28
69
|
}
|
|
@@ -4,17 +4,34 @@ exports.FineTemplate = void 0;
|
|
|
4
4
|
const typescript_common_functionality_1 = require("@stevenkellner/typescript-common-functionality");
|
|
5
5
|
const FineAmount_1 = require("./FineAmount");
|
|
6
6
|
const FineTemplateRepetition_1 = require("./FineTemplateRepetition");
|
|
7
|
+
/**
|
|
8
|
+
* Represents a template for creating fines with predefined reason, amount, and optional repetition rules.
|
|
9
|
+
*
|
|
10
|
+
* Fine templates allow teams to quickly create recurring or standard fines without entering
|
|
11
|
+
* the same information repeatedly.
|
|
12
|
+
*/
|
|
7
13
|
class FineTemplate {
|
|
8
14
|
id;
|
|
9
15
|
reason;
|
|
10
16
|
amount;
|
|
11
17
|
repetition;
|
|
18
|
+
/**
|
|
19
|
+
* Creates a new FineTemplate instance.
|
|
20
|
+
*
|
|
21
|
+
* @param id - Unique identifier for the fine template (GUID)
|
|
22
|
+
* @param reason - The reason or description for the fine
|
|
23
|
+
* @param amount - The monetary or item-based amount of the fine
|
|
24
|
+
* @param repetition - Optional repetition rules (null for non-recurring templates)
|
|
25
|
+
*/
|
|
12
26
|
constructor(id, reason, amount, repetition) {
|
|
13
27
|
this.id = id;
|
|
14
28
|
this.reason = reason;
|
|
15
29
|
this.amount = amount;
|
|
16
30
|
this.repetition = repetition;
|
|
17
31
|
}
|
|
32
|
+
/**
|
|
33
|
+
* Returns the flattened representation for serialization.
|
|
34
|
+
*/
|
|
18
35
|
get flatten() {
|
|
19
36
|
return {
|
|
20
37
|
id: this.id.flatten,
|
|
@@ -28,13 +45,28 @@ exports.FineTemplate = FineTemplate;
|
|
|
28
45
|
(function (FineTemplate) {
|
|
29
46
|
let Id;
|
|
30
47
|
(function (Id) {
|
|
48
|
+
/**
|
|
49
|
+
* Type builder for FineTemplate.Id serialization/deserialization.
|
|
50
|
+
*/
|
|
31
51
|
Id.builder = typescript_common_functionality_1.Tagged.builder('fineTemplate', typescript_common_functionality_1.Guid.builder);
|
|
32
52
|
})(Id = FineTemplate.Id || (FineTemplate.Id = {}));
|
|
53
|
+
/**
|
|
54
|
+
* Type builder for FineTemplate serialization/deserialization.
|
|
55
|
+
*/
|
|
33
56
|
class TypeBuilder {
|
|
57
|
+
/**
|
|
58
|
+
* Builds a FineTemplate instance from flattened data.
|
|
59
|
+
*
|
|
60
|
+
* @param value - Flattened fine template data
|
|
61
|
+
* @returns FineTemplate instance
|
|
62
|
+
*/
|
|
34
63
|
build(value) {
|
|
35
64
|
return new FineTemplate(Id.builder.build(value.id), value.reason, FineAmount_1.FineAmount.builder.build(value.amount), value.repetition === null ? null : FineTemplateRepetition_1.FineTemplateRepetition.builder.build(value.repetition));
|
|
36
65
|
}
|
|
37
66
|
}
|
|
38
67
|
FineTemplate.TypeBuilder = TypeBuilder;
|
|
68
|
+
/**
|
|
69
|
+
* Singleton instance of TypeBuilder for FineTemplate.
|
|
70
|
+
*/
|
|
39
71
|
FineTemplate.builder = new TypeBuilder();
|
|
40
72
|
})(FineTemplate || (exports.FineTemplate = FineTemplate = {}));
|
|
@@ -1,25 +1,87 @@
|
|
|
1
1
|
import { Flattable, ITypeBuilder, ValueTypeBuilder } from '@stevenkellner/typescript-common-functionality';
|
|
2
|
+
import { Locale } from './Locale';
|
|
3
|
+
/**
|
|
4
|
+
* Represents how a fine template repeats over time.
|
|
5
|
+
*
|
|
6
|
+
* Defines the repetition unit (minute, day, item, count) and optional maximum count for repetitions.
|
|
7
|
+
*/
|
|
2
8
|
export declare class FineTemplateRepetition implements Flattable<FineTemplateRepetition.Flatten> {
|
|
3
9
|
item: FineTemplateRepetition.Item;
|
|
4
10
|
maxCount: number | null;
|
|
11
|
+
/**
|
|
12
|
+
* Creates a new FineTemplateRepetition instance.
|
|
13
|
+
*
|
|
14
|
+
* @param item - The repetition unit type (minute, day, item, count)
|
|
15
|
+
* @param maxCount - Optional maximum number of repetitions (null for unlimited)
|
|
16
|
+
*/
|
|
5
17
|
constructor(item: FineTemplateRepetition.Item, maxCount: number | null);
|
|
6
|
-
|
|
7
|
-
|
|
18
|
+
/**
|
|
19
|
+
* Returns a localized formatted string including the count value.
|
|
20
|
+
*
|
|
21
|
+
* @param count - The number of repetitions
|
|
22
|
+
* @param locale - The locale to use for formatting
|
|
23
|
+
* @returns Formatted string (e.g., "every 5 minutes")
|
|
24
|
+
*/
|
|
25
|
+
formatted(count: number, locale: Locale): string;
|
|
26
|
+
/**
|
|
27
|
+
* Returns a localized formatted string without explicitly showing the count.
|
|
28
|
+
*
|
|
29
|
+
* @param count - The number of repetitions
|
|
30
|
+
* @param locale - The locale to use for formatting
|
|
31
|
+
* @returns Formatted string without count display
|
|
32
|
+
*/
|
|
33
|
+
formattedWithoutCount(count: number, locale: Locale): string;
|
|
34
|
+
/**
|
|
35
|
+
* Returns the flattened representation for serialization.
|
|
36
|
+
*/
|
|
8
37
|
get flatten(): FineTemplateRepetition.Flatten;
|
|
9
38
|
}
|
|
10
39
|
export declare namespace FineTemplateRepetition {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
40
|
+
const repetitionItems: readonly ["minute", "day", "item", "count"];
|
|
41
|
+
/**
|
|
42
|
+
* Repetition unit type: 'minute', 'day', 'item', or 'count'.
|
|
43
|
+
*/
|
|
44
|
+
export type Item = typeof repetitionItems[number];
|
|
45
|
+
export namespace Item {
|
|
46
|
+
/**
|
|
47
|
+
* Array containing all possible repetition item types.
|
|
48
|
+
*/
|
|
49
|
+
const all: readonly Item[];
|
|
50
|
+
/**
|
|
51
|
+
* Returns the localized name for a repetition item type.
|
|
52
|
+
*
|
|
53
|
+
* @param item - The repetition item type
|
|
54
|
+
* @param locale - The locale to use for formatting
|
|
55
|
+
* @returns Localized name string
|
|
56
|
+
*/
|
|
57
|
+
function formatted(item: Item, locale: Locale): string;
|
|
58
|
+
/**
|
|
59
|
+
* Type builder for Item serialization/deserialization.
|
|
60
|
+
*/
|
|
61
|
+
const builder: ValueTypeBuilder<"item" | "minute" | "day" | "count">;
|
|
16
62
|
}
|
|
17
|
-
|
|
63
|
+
/**
|
|
64
|
+
* Flattened representation of FineTemplateRepetition for serialization.
|
|
65
|
+
*/
|
|
66
|
+
export type Flatten = {
|
|
18
67
|
item: Item;
|
|
19
68
|
maxCount: number | null;
|
|
20
69
|
};
|
|
21
|
-
|
|
70
|
+
/**
|
|
71
|
+
* Type builder for FineTemplateRepetition serialization/deserialization.
|
|
72
|
+
*/
|
|
73
|
+
export class TypeBuilder implements ITypeBuilder<Flatten, FineTemplateRepetition> {
|
|
74
|
+
/**
|
|
75
|
+
* Builds a FineTemplateRepetition instance from flattened data.
|
|
76
|
+
*
|
|
77
|
+
* @param flatten - Flattened repetition data
|
|
78
|
+
* @returns FineTemplateRepetition instance
|
|
79
|
+
*/
|
|
22
80
|
build(flatten: Flatten): FineTemplateRepetition;
|
|
23
81
|
}
|
|
24
|
-
|
|
82
|
+
/**
|
|
83
|
+
* Singleton instance of TypeBuilder for FineTemplateRepetition.
|
|
84
|
+
*/
|
|
85
|
+
export const builder: TypeBuilder;
|
|
86
|
+
export {};
|
|
25
87
|
}
|
|
@@ -3,19 +3,47 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.FineTemplateRepetition = void 0;
|
|
4
4
|
const typescript_common_functionality_1 = require("@stevenkellner/typescript-common-functionality");
|
|
5
5
|
const Localization_1 = require("./Localization");
|
|
6
|
+
/**
|
|
7
|
+
* Represents how a fine template repeats over time.
|
|
8
|
+
*
|
|
9
|
+
* Defines the repetition unit (minute, day, item, count) and optional maximum count for repetitions.
|
|
10
|
+
*/
|
|
6
11
|
class FineTemplateRepetition {
|
|
7
12
|
item;
|
|
8
13
|
maxCount;
|
|
14
|
+
/**
|
|
15
|
+
* Creates a new FineTemplateRepetition instance.
|
|
16
|
+
*
|
|
17
|
+
* @param item - The repetition unit type (minute, day, item, count)
|
|
18
|
+
* @param maxCount - Optional maximum number of repetitions (null for unlimited)
|
|
19
|
+
*/
|
|
9
20
|
constructor(item, maxCount) {
|
|
10
21
|
this.item = item;
|
|
11
22
|
this.maxCount = maxCount;
|
|
12
23
|
}
|
|
13
|
-
|
|
14
|
-
|
|
24
|
+
/**
|
|
25
|
+
* Returns a localized formatted string including the count value.
|
|
26
|
+
*
|
|
27
|
+
* @param count - The number of repetitions
|
|
28
|
+
* @param locale - The locale to use for formatting
|
|
29
|
+
* @returns Formatted string (e.g., "every 5 minutes")
|
|
30
|
+
*/
|
|
31
|
+
formatted(count, locale) {
|
|
32
|
+
return Localization_1.Localization.shared(locale).fineTemplateRepetition.item[this.item].withCount.value(count);
|
|
15
33
|
}
|
|
16
|
-
|
|
17
|
-
|
|
34
|
+
/**
|
|
35
|
+
* Returns a localized formatted string without explicitly showing the count.
|
|
36
|
+
*
|
|
37
|
+
* @param count - The number of repetitions
|
|
38
|
+
* @param locale - The locale to use for formatting
|
|
39
|
+
* @returns Formatted string without count display
|
|
40
|
+
*/
|
|
41
|
+
formattedWithoutCount(count, locale) {
|
|
42
|
+
return Localization_1.Localization.shared(locale).fineTemplateRepetition.item[this.item].withoutCount.value(count);
|
|
18
43
|
}
|
|
44
|
+
/**
|
|
45
|
+
* Returns the flattened representation for serialization.
|
|
46
|
+
*/
|
|
19
47
|
get flatten() {
|
|
20
48
|
return {
|
|
21
49
|
item: this.item,
|
|
@@ -25,25 +53,51 @@ class FineTemplateRepetition {
|
|
|
25
53
|
}
|
|
26
54
|
exports.FineTemplateRepetition = FineTemplateRepetition;
|
|
27
55
|
(function (FineTemplateRepetition) {
|
|
56
|
+
const repetitionItems = [
|
|
57
|
+
'minute',
|
|
58
|
+
'day',
|
|
59
|
+
'item',
|
|
60
|
+
'count'
|
|
61
|
+
];
|
|
28
62
|
let Item;
|
|
29
63
|
(function (Item) {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
64
|
+
/**
|
|
65
|
+
* Array containing all possible repetition item types.
|
|
66
|
+
*/
|
|
67
|
+
Item.all = repetitionItems;
|
|
68
|
+
/**
|
|
69
|
+
* Returns the localized name for a repetition item type.
|
|
70
|
+
*
|
|
71
|
+
* @param item - The repetition item type
|
|
72
|
+
* @param locale - The locale to use for formatting
|
|
73
|
+
* @returns Localized name string
|
|
74
|
+
*/
|
|
75
|
+
function formatted(item, locale) {
|
|
76
|
+
return Localization_1.Localization.shared(locale).fineTemplateRepetition.item[item].name.value();
|
|
38
77
|
}
|
|
39
78
|
Item.formatted = formatted;
|
|
79
|
+
/**
|
|
80
|
+
* Type builder for Item serialization/deserialization.
|
|
81
|
+
*/
|
|
40
82
|
Item.builder = new typescript_common_functionality_1.ValueTypeBuilder();
|
|
41
83
|
})(Item = FineTemplateRepetition.Item || (FineTemplateRepetition.Item = {}));
|
|
84
|
+
/**
|
|
85
|
+
* Type builder for FineTemplateRepetition serialization/deserialization.
|
|
86
|
+
*/
|
|
42
87
|
class TypeBuilder {
|
|
88
|
+
/**
|
|
89
|
+
* Builds a FineTemplateRepetition instance from flattened data.
|
|
90
|
+
*
|
|
91
|
+
* @param flatten - Flattened repetition data
|
|
92
|
+
* @returns FineTemplateRepetition instance
|
|
93
|
+
*/
|
|
43
94
|
build(flatten) {
|
|
44
95
|
return new FineTemplateRepetition(flatten.item, flatten.maxCount);
|
|
45
96
|
}
|
|
46
97
|
}
|
|
47
98
|
FineTemplateRepetition.TypeBuilder = TypeBuilder;
|
|
99
|
+
/**
|
|
100
|
+
* Singleton instance of TypeBuilder for FineTemplateRepetition.
|
|
101
|
+
*/
|
|
48
102
|
FineTemplateRepetition.builder = new TypeBuilder();
|
|
49
103
|
})(FineTemplateRepetition || (exports.FineTemplateRepetition = FineTemplateRepetition = {}));
|
|
@@ -1,25 +1,73 @@
|
|
|
1
1
|
import { Flattable, ITypeBuilder, Tagged } from '@stevenkellner/typescript-common-functionality';
|
|
2
2
|
import { Team } from './Team';
|
|
3
3
|
import { Person } from './Person';
|
|
4
|
+
/**
|
|
5
|
+
* Represents an invitation to join a team.
|
|
6
|
+
*
|
|
7
|
+
* An invitation can be team-wide (personId is null) or specific to a person.
|
|
8
|
+
* The invitation ID is generated by hashing the team ID and optional person ID.
|
|
9
|
+
*/
|
|
4
10
|
export declare class Invitation implements Flattable<Invitation.Flatten> {
|
|
5
11
|
teamId: Team.Id;
|
|
6
12
|
personId: Person.Id | null;
|
|
13
|
+
/**
|
|
14
|
+
* Creates a new Invitation instance.
|
|
15
|
+
*
|
|
16
|
+
* @param teamId - The ID of the team for the invitation
|
|
17
|
+
* @param personId - Optional person ID for person-specific invitations (null for team-wide invitations)
|
|
18
|
+
*/
|
|
7
19
|
constructor(teamId: Team.Id, personId: Person.Id | null);
|
|
20
|
+
/**
|
|
21
|
+
* Creates a unique invitation ID by hashing the team ID and optional person ID.
|
|
22
|
+
*
|
|
23
|
+
* Uses SHA-512 hashing and takes the first 12 characters of the hex representation.
|
|
24
|
+
* Team-wide invitations (personId null) hash only the team ID.
|
|
25
|
+
* Person-specific invitations hash both team ID and person ID concatenated.
|
|
26
|
+
*
|
|
27
|
+
* @returns Tagged invitation ID string (12 hex characters)
|
|
28
|
+
*/
|
|
8
29
|
createId(): Invitation.Id;
|
|
30
|
+
/**
|
|
31
|
+
* Returns the flattened representation for serialization.
|
|
32
|
+
*/
|
|
9
33
|
get flatten(): Invitation.Flatten;
|
|
10
34
|
}
|
|
11
35
|
export declare namespace Invitation {
|
|
36
|
+
/**
|
|
37
|
+
* Tagged string type for invitation identifiers (12 hex characters).
|
|
38
|
+
*/
|
|
12
39
|
type Id = Tagged<string, 'invitation'>;
|
|
13
40
|
namespace Id {
|
|
41
|
+
/**
|
|
42
|
+
* Flattened representation of an invitation ID (string).
|
|
43
|
+
*/
|
|
14
44
|
type Flatten = string;
|
|
45
|
+
/**
|
|
46
|
+
* Type builder for Invitation.Id serialization/deserialization.
|
|
47
|
+
*/
|
|
15
48
|
const builder: Tagged.TypeBuilder<string, "invitation">;
|
|
16
49
|
}
|
|
50
|
+
/**
|
|
51
|
+
* Flattened representation of an Invitation for serialization.
|
|
52
|
+
*/
|
|
17
53
|
type Flatten = {
|
|
18
54
|
teamId: Team.Id.Flatten;
|
|
19
55
|
personId: Person.Id.Flatten | null;
|
|
20
56
|
};
|
|
57
|
+
/**
|
|
58
|
+
* Type builder for Invitation serialization/deserialization.
|
|
59
|
+
*/
|
|
21
60
|
class TypeBuilder implements ITypeBuilder<Flatten, Invitation> {
|
|
61
|
+
/**
|
|
62
|
+
* Builds an Invitation instance from flattened data.
|
|
63
|
+
*
|
|
64
|
+
* @param value - Flattened invitation data
|
|
65
|
+
* @returns Invitation instance
|
|
66
|
+
*/
|
|
22
67
|
build(value: Flatten): Invitation;
|
|
23
68
|
}
|
|
69
|
+
/**
|
|
70
|
+
* Singleton instance of TypeBuilder for Invitation.
|
|
71
|
+
*/
|
|
24
72
|
const builder: TypeBuilder;
|
|
25
73
|
}
|
|
@@ -4,13 +4,34 @@ exports.Invitation = void 0;
|
|
|
4
4
|
const typescript_common_functionality_1 = require("@stevenkellner/typescript-common-functionality");
|
|
5
5
|
const Team_1 = require("./Team");
|
|
6
6
|
const Person_1 = require("./Person");
|
|
7
|
+
/**
|
|
8
|
+
* Represents an invitation to join a team.
|
|
9
|
+
*
|
|
10
|
+
* An invitation can be team-wide (personId is null) or specific to a person.
|
|
11
|
+
* The invitation ID is generated by hashing the team ID and optional person ID.
|
|
12
|
+
*/
|
|
7
13
|
class Invitation {
|
|
8
14
|
teamId;
|
|
9
15
|
personId;
|
|
16
|
+
/**
|
|
17
|
+
* Creates a new Invitation instance.
|
|
18
|
+
*
|
|
19
|
+
* @param teamId - The ID of the team for the invitation
|
|
20
|
+
* @param personId - Optional person ID for person-specific invitations (null for team-wide invitations)
|
|
21
|
+
*/
|
|
10
22
|
constructor(teamId, personId) {
|
|
11
23
|
this.teamId = teamId;
|
|
12
24
|
this.personId = personId;
|
|
13
25
|
}
|
|
26
|
+
/**
|
|
27
|
+
* Creates a unique invitation ID by hashing the team ID and optional person ID.
|
|
28
|
+
*
|
|
29
|
+
* Uses SHA-512 hashing and takes the first 12 characters of the hex representation.
|
|
30
|
+
* Team-wide invitations (personId null) hash only the team ID.
|
|
31
|
+
* Person-specific invitations hash both team ID and person ID concatenated.
|
|
32
|
+
*
|
|
33
|
+
* @returns Tagged invitation ID string (12 hex characters)
|
|
34
|
+
*/
|
|
14
35
|
createId() {
|
|
15
36
|
const hasher = new typescript_common_functionality_1.Sha512();
|
|
16
37
|
const teamIdBytes = typescript_common_functionality_1.BytesCoder.fromUtf8(this.teamId.guidString);
|
|
@@ -23,6 +44,9 @@ class Invitation {
|
|
|
23
44
|
const rawId = typescript_common_functionality_1.BytesCoder.toHex(hashedInvitationBytes).slice(0, 12);
|
|
24
45
|
return new typescript_common_functionality_1.Tagged(rawId, 'invitation');
|
|
25
46
|
}
|
|
47
|
+
/**
|
|
48
|
+
* Returns the flattened representation for serialization.
|
|
49
|
+
*/
|
|
26
50
|
get flatten() {
|
|
27
51
|
return {
|
|
28
52
|
teamId: this.teamId.flatten,
|
|
@@ -34,13 +58,28 @@ exports.Invitation = Invitation;
|
|
|
34
58
|
(function (Invitation) {
|
|
35
59
|
let Id;
|
|
36
60
|
(function (Id) {
|
|
61
|
+
/**
|
|
62
|
+
* Type builder for Invitation.Id serialization/deserialization.
|
|
63
|
+
*/
|
|
37
64
|
Id.builder = typescript_common_functionality_1.Tagged.builder('invitation', new typescript_common_functionality_1.ValueTypeBuilder());
|
|
38
65
|
})(Id = Invitation.Id || (Invitation.Id = {}));
|
|
66
|
+
/**
|
|
67
|
+
* Type builder for Invitation serialization/deserialization.
|
|
68
|
+
*/
|
|
39
69
|
class TypeBuilder {
|
|
70
|
+
/**
|
|
71
|
+
* Builds an Invitation instance from flattened data.
|
|
72
|
+
*
|
|
73
|
+
* @param value - Flattened invitation data
|
|
74
|
+
* @returns Invitation instance
|
|
75
|
+
*/
|
|
40
76
|
build(value) {
|
|
41
77
|
return new Invitation(Team_1.Team.Id.builder.build(value.teamId), new typescript_common_functionality_1.OptionalTypeBuilder(Person_1.Person.Id.builder).build(value.personId));
|
|
42
78
|
}
|
|
43
79
|
}
|
|
44
80
|
Invitation.TypeBuilder = TypeBuilder;
|
|
81
|
+
/**
|
|
82
|
+
* Singleton instance of TypeBuilder for Invitation.
|
|
83
|
+
*/
|
|
45
84
|
Invitation.builder = new TypeBuilder();
|
|
46
85
|
})(Invitation || (exports.Invitation = Invitation = {}));
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { ValueTypeBuilder } from '@stevenkellner/typescript-common-functionality';
|
|
2
|
+
import { localizations } from './Localization';
|
|
3
|
+
/**
|
|
4
|
+
* Supported locale types, derived from available localizations.
|
|
5
|
+
*/
|
|
6
|
+
export type Locale = keyof typeof localizations;
|
|
7
|
+
export declare namespace Locale {
|
|
8
|
+
/**
|
|
9
|
+
* Array of all available locales.
|
|
10
|
+
*/
|
|
11
|
+
const all: Locale[];
|
|
12
|
+
/**
|
|
13
|
+
* Builder for constructing Locale values.
|
|
14
|
+
*/
|
|
15
|
+
const builder: ValueTypeBuilder<"en" | "de">;
|
|
16
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Locale = void 0;
|
|
4
|
+
const typescript_common_functionality_1 = require("@stevenkellner/typescript-common-functionality");
|
|
5
|
+
const Localization_1 = require("./Localization");
|
|
6
|
+
var Locale;
|
|
7
|
+
(function (Locale) {
|
|
8
|
+
/**
|
|
9
|
+
* Array of all available locales.
|
|
10
|
+
*/
|
|
11
|
+
Locale.all = (0, typescript_common_functionality_1.keys)(Localization_1.localizations);
|
|
12
|
+
/**
|
|
13
|
+
* Builder for constructing Locale values.
|
|
14
|
+
*/
|
|
15
|
+
Locale.builder = new typescript_common_functionality_1.ValueTypeBuilder();
|
|
16
|
+
})(Locale || (exports.Locale = Locale = {}));
|