@stevenkellner/team-conduct-api 2.0.18 → 2.0.20
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/functions/fine/add.d.ts +3 -8
- package/lib/src/functions/fine/add.js +1 -2
- package/lib/src/functions/fine/delete.d.ts +1 -6
- package/lib/src/functions/fine/delete.js +2 -3
- package/lib/src/functions/fine/update.d.ts +2 -8
- package/lib/src/functions/fine/update.js +1 -3
- package/lib/src/functions/fineTemplate/add.d.ts +3 -3
- package/lib/src/functions/fineTemplate/update.d.ts +3 -3
- package/lib/src/functions/firebaseFunctionsContext.d.ts +34 -1
- package/lib/src/functions/firebaseFunctionsContext.js +33 -33
- package/lib/src/functions/index.d.ts +10 -8
- package/lib/src/functions/index.js +11 -8
- package/lib/src/functions/notification/markNotificationAsRead.d.ts +14 -0
- package/lib/src/functions/notification/{subscribe.js → markNotificationAsRead.js} +5 -7
- package/lib/src/functions/person/kickout.d.ts +6 -6
- package/lib/src/functions/person/kickout.js +4 -4
- package/lib/src/functions/person/roleEdit.d.ts +5 -5
- package/lib/src/functions/person/roleEdit.js +3 -3
- package/lib/src/functions/{paypalMe/edit.d.ts → team/delete.d.ts} +5 -7
- package/lib/src/functions/{paypalMe/edit.js → team/delete.js} +4 -5
- package/lib/src/functions/team/new.d.ts +18 -18
- package/lib/src/functions/team/new.js +8 -4
- package/lib/src/functions/team/update.d.ts +34 -0
- package/lib/src/functions/team/update.js +23 -0
- package/lib/src/functions/user/register.d.ts +4 -0
- package/lib/src/functions/user/register.js +3 -1
- package/lib/src/functions/user/update.d.ts +26 -0
- package/lib/src/functions/user/update.js +15 -0
- package/lib/src/index.d.ts +1 -1
- package/lib/src/index.js +1 -1
- package/lib/src/locales/de.d.ts +1 -1
- package/lib/src/locales/de.js +6 -2
- package/lib/src/locales/en.d.ts +6 -2
- package/lib/src/locales/en.js +6 -2
- package/lib/src/types/{MoneyAmount.d.ts → Money.d.ts} +23 -23
- package/lib/src/types/{MoneyAmount.js → Money.js} +25 -25
- package/lib/src/types/fine/Fine.d.ts +275 -0
- package/lib/src/types/fine/Fine.js +318 -0
- package/lib/src/types/fine/FineTemplate.d.ts +154 -0
- package/lib/src/types/fine/FineTemplate.js +170 -0
- package/lib/src/types/{PayedState.d.ts → fine/PayedState.d.ts} +1 -1
- package/lib/src/types/{PayedState.js → fine/PayedState.js} +1 -1
- package/lib/src/types/fine/index.d.ts +3 -0
- package/lib/src/{firebase → types/fine}/index.js +3 -6
- package/lib/src/types/index.d.ts +7 -18
- package/lib/src/types/index.js +7 -18
- package/lib/src/types/{Localization.d.ts → localization/Localization.d.ts} +15 -43
- package/lib/src/types/localization/Localization.js +54 -0
- package/lib/src/types/localization/PluralLocalization.d.ts +23 -0
- package/lib/src/types/localization/PluralLocalization.js +35 -0
- package/lib/src/types/{Pluralization.d.ts → localization/Pluralization.d.ts} +1 -0
- package/lib/src/types/{Pluralization.js → localization/Pluralization.js} +1 -0
- package/lib/src/types/localization/ValueLocalization.d.ts +22 -0
- package/lib/src/types/localization/ValueLocalization.js +41 -0
- package/lib/src/types/localization/index.d.ts +5 -0
- package/lib/src/types/localization/index.js +21 -0
- package/lib/src/types/notification/InAppNotification.d.ts +152 -0
- package/lib/src/types/notification/InAppNotification.js +136 -0
- package/lib/src/types/notification/index.d.ts +1 -0
- package/lib/src/types/notification/index.js +17 -0
- package/lib/src/types/{Person.d.ts → person/Person.d.ts} +3 -3
- package/lib/src/types/{Person.js → person/Person.js} +3 -3
- package/lib/src/types/{PersonProperties.d.ts → person/PersonProperties.d.ts} +8 -7
- package/lib/src/types/{PersonProperties.js → person/PersonProperties.js} +7 -6
- package/lib/src/types/{PersonSignInProperties.d.ts → person/PersonSignInProperties.d.ts} +9 -11
- package/lib/src/types/{PersonSignInProperties.js → person/PersonSignInProperties.js} +7 -10
- package/lib/src/types/person/index.d.ts +3 -0
- package/lib/src/types/person/index.js +19 -0
- package/lib/src/types/{Invitation.d.ts → team/Invitation.d.ts} +1 -1
- package/lib/src/types/{Invitation.js → team/Invitation.js} +1 -1
- package/lib/src/types/team/Team.d.ts +144 -0
- package/lib/src/types/team/Team.js +141 -0
- package/lib/src/types/team/TeamRole.d.ts +30 -0
- package/lib/src/types/{UserRole.js → team/TeamRole.js} +16 -15
- package/lib/src/types/team/index.d.ts +3 -0
- package/lib/src/types/team/index.js +19 -0
- package/lib/src/types/{NotificationProperties.d.ts → user/NotificationProperties.d.ts} +8 -3
- package/lib/src/types/{NotificationProperties.js → user/NotificationProperties.js} +4 -0
- package/lib/src/types/user/User.d.ts +328 -0
- package/lib/src/types/user/User.js +355 -0
- package/lib/src/types/user/index.d.ts +2 -0
- package/lib/src/types/user/index.js +18 -0
- package/lib/src/utils/StaticUnionTypeBuilder.d.ts +9 -0
- package/lib/src/utils/StaticUnionTypeBuilder.js +23 -0
- package/lib/src/utils/index.d.ts +1 -0
- package/lib/src/utils/index.js +17 -0
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/package.json +4 -3
- package/src/functions/fine/add.ts +3 -5
- package/src/functions/fine/delete.ts +3 -5
- package/src/functions/fine/update.ts +2 -5
- package/src/functions/firebaseFunctionsContext.ts +40 -40
- package/src/functions/index.ts +11 -9
- package/src/functions/notification/markNotificationAsRead.ts +19 -0
- package/src/functions/person/add.ts +1 -1
- package/src/functions/person/kickout.ts +6 -6
- package/src/functions/person/roleEdit.ts +5 -5
- package/src/functions/{paypalMe/edit.ts → team/delete.ts} +5 -7
- package/src/functions/team/new.ts +19 -11
- package/src/functions/team/update.ts +40 -0
- package/src/functions/user/register.ts +7 -3
- package/src/functions/user/update.ts +29 -0
- package/src/index.ts +1 -1
- package/src/locales/de.ts +7 -3
- package/src/locales/en.ts +7 -3
- package/src/types/{MoneyAmount.ts → Money.ts} +29 -29
- package/src/types/fine/Fine.ts +399 -0
- package/src/types/fine/FineTemplate.ts +219 -0
- package/src/types/{PayedState.ts → fine/PayedState.ts} +2 -2
- package/src/types/fine/index.ts +3 -0
- package/src/types/index.ts +7 -18
- package/src/types/{Localization.ts → localization/Localization.ts} +7 -64
- package/src/types/localization/PluralLocalization.ts +32 -0
- package/src/types/{Pluralization.ts → localization/Pluralization.ts} +1 -0
- package/src/types/localization/ValueLocalization.ts +36 -0
- package/src/types/localization/index.ts +5 -0
- package/src/types/notification/InAppNotification.ts +184 -0
- package/src/types/notification/index.ts +1 -0
- package/src/types/{Person.ts → person/Person.ts} +3 -3
- package/src/types/{PersonProperties.ts → person/PersonProperties.ts} +8 -7
- package/src/types/{PersonSignInProperties.ts → person/PersonSignInProperties.ts} +13 -12
- package/src/types/person/index.ts +3 -0
- package/src/types/{Invitation.ts → team/Invitation.ts} +1 -1
- package/src/types/team/Team.ts +204 -0
- package/src/types/{UserRole.ts → team/TeamRole.ts} +19 -17
- package/src/types/team/index.ts +3 -0
- package/src/types/{NotificationProperties.ts → user/NotificationProperties.ts} +12 -3
- package/src/types/user/User.ts +451 -0
- package/src/types/user/index.ts +2 -0
- package/src/utils/StaticUnionTypeBuilder.ts +23 -0
- package/src/utils/index.ts +1 -0
- package/lib/src/firebase/FirebaseConfiguration.d.ts +0 -64
- package/lib/src/firebase/FirebaseConfiguration.js +0 -79
- package/lib/src/firebase/Firestore.d.ts +0 -201
- package/lib/src/firebase/Firestore.js +0 -244
- package/lib/src/firebase/FirestoreScheme.d.ts +0 -42
- package/lib/src/firebase/FirestoreScheme.js +0 -2
- package/lib/src/firebase/Messaging.d.ts +0 -90
- package/lib/src/firebase/Messaging.js +0 -2
- package/lib/src/firebase/checkAuthentication.d.ts +0 -38
- package/lib/src/firebase/checkAuthentication.js +0 -64
- package/lib/src/firebase/index.d.ts +0 -6
- package/lib/src/firebase/pushNotification.d.ts +0 -39
- package/lib/src/firebase/pushNotification.js +0 -88
- package/lib/src/functions/notification/subscribe.d.ts +0 -18
- package/lib/src/types/Configuration.d.ts +0 -46
- package/lib/src/types/Configuration.js +0 -51
- package/lib/src/types/Fine.d.ts +0 -71
- package/lib/src/types/Fine.js +0 -74
- package/lib/src/types/FineAmount.d.ts +0 -207
- package/lib/src/types/FineAmount.js +0 -238
- package/lib/src/types/FineTemplate.d.ts +0 -69
- package/lib/src/types/FineTemplate.js +0 -72
- package/lib/src/types/FineTemplateRepetition.d.ts +0 -87
- package/lib/src/types/FineTemplateRepetition.js +0 -103
- package/lib/src/types/Localization.js +0 -115
- package/lib/src/types/Team.d.ts +0 -62
- package/lib/src/types/Team.js +0 -64
- package/lib/src/types/User.d.ts +0 -221
- package/lib/src/types/User.js +0 -235
- package/lib/src/types/UserRole.d.ts +0 -29
- package/lib/test/firebase/FirebaseConfiguration.test.d.ts +0 -1
- package/lib/test/firebase/FirebaseConfiguration.test.js +0 -158
- package/lib/test/firebase/Firestore.test.d.ts +0 -1
- package/lib/test/firebase/Firestore.test.js +0 -46
- package/lib/test/firebase/checkAuthentication.test.d.ts +0 -1
- package/lib/test/firebase/checkAuthentication.test.js +0 -356
- package/lib/test/firebase/firebase-utils.d.ts +0 -32
- package/lib/test/firebase/firebase-utils.js +0 -134
- package/lib/test/firebase/pushNotification.test.d.ts +0 -1
- package/lib/test/firebase/pushNotification.test.js +0 -300
- package/lib/test/locales/localization.de.test.d.ts +0 -1
- package/lib/test/locales/localization.de.test.js +0 -144
- package/lib/test/locales/localization.en.test.d.ts +0 -1
- package/lib/test/locales/localization.en.test.js +0 -144
- package/lib/test/types/Configuration.test.d.ts +0 -1
- package/lib/test/types/Configuration.test.js +0 -84
- package/lib/test/types/Currency.test.d.ts +0 -1
- package/lib/test/types/Currency.test.js +0 -41
- package/lib/test/types/Fine.test.d.ts +0 -1
- package/lib/test/types/Fine.test.js +0 -265
- package/lib/test/types/FineAmount.test.d.ts +0 -1
- package/lib/test/types/FineAmount.test.js +0 -445
- package/lib/test/types/FineTemplate.test.d.ts +0 -1
- package/lib/test/types/FineTemplate.test.js +0 -271
- package/lib/test/types/FineTemplateRepetition.test.d.ts +0 -1
- package/lib/test/types/FineTemplateRepetition.test.js +0 -361
- package/lib/test/types/Invitation.test.d.ts +0 -1
- package/lib/test/types/Invitation.test.js +0 -269
- package/lib/test/types/Locale.test.d.ts +0 -1
- package/lib/test/types/Locale.test.js +0 -46
- package/lib/test/types/Localization.test.d.ts +0 -1
- package/lib/test/types/Localization.test.js +0 -241
- package/lib/test/types/MoneyAmount.test.d.ts +0 -1
- package/lib/test/types/MoneyAmount.test.js +0 -276
- package/lib/test/types/NotificationProperties.test.d.ts +0 -1
- package/lib/test/types/NotificationProperties.test.js +0 -258
- package/lib/test/types/PayedState.test.d.ts +0 -1
- package/lib/test/types/PayedState.test.js +0 -136
- package/lib/test/types/Person.test.d.ts +0 -1
- package/lib/test/types/Person.test.js +0 -266
- package/lib/test/types/PersonProperties.test.d.ts +0 -1
- package/lib/test/types/PersonProperties.test.js +0 -155
- package/lib/test/types/PersonSignInProperties.test.d.ts +0 -1
- package/lib/test/types/PersonSignInProperties.test.js +0 -208
- package/lib/test/types/Pluralization.test.d.ts +0 -1
- package/lib/test/types/Pluralization.test.js +0 -206
- package/lib/test/types/Team.test.d.ts +0 -1
- package/lib/test/types/Team.test.js +0 -145
- package/lib/test/types/User.test.d.ts +0 -1
- package/lib/test/types/User.test.js +0 -450
- package/lib/test/types/UserRole.test.d.ts +0 -1
- package/lib/test/types/UserRole.test.js +0 -140
- package/src/firebase/FirebaseConfiguration.ts +0 -99
- package/src/firebase/Firestore.ts +0 -258
- package/src/firebase/FirestoreScheme.ts +0 -41
- package/src/firebase/Messaging.ts +0 -93
- package/src/firebase/checkAuthentication.ts +0 -91
- package/src/firebase/index.ts +0 -7
- package/src/firebase/pushNotification.ts +0 -90
- package/src/functions/notification/subscribe.ts +0 -23
- package/src/types/Configuration.ts +0 -65
- package/src/types/Fine.ts +0 -100
- package/src/types/FineAmount.ts +0 -303
- package/src/types/FineTemplate.ts +0 -96
- package/src/types/FineTemplateRepetition.ts +0 -125
- package/src/types/Team.ts +0 -87
- package/src/types/User.ts +0 -302
- /package/lib/src/types/{Locale.d.ts → localization/Locale.d.ts} +0 -0
- /package/lib/src/types/{Locale.js → localization/Locale.js} +0 -0
- /package/src/types/{Locale.ts → localization/Locale.ts} +0 -0
package/lib/src/types/Team.d.ts
DELETED
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
import { Flattable, Guid, ITypeBuilder, Tagged } from '@stevenkellner/typescript-common-functionality';
|
|
2
|
-
/**
|
|
3
|
-
* Represents a team in the system with its basic information.
|
|
4
|
-
*
|
|
5
|
-
* A team is a group of people who can track fines and payments together.
|
|
6
|
-
* Teams can optionally have a PayPal.Me link for simplified payment collection.
|
|
7
|
-
*/
|
|
8
|
-
export declare class Team implements Flattable<Team.Flatten> {
|
|
9
|
-
id: Team.Id;
|
|
10
|
-
name: string;
|
|
11
|
-
paypalMeLink: string | null;
|
|
12
|
-
/**
|
|
13
|
-
* Creates a new Team instance.
|
|
14
|
-
* @param id - The unique identifier for this team
|
|
15
|
-
* @param name - The display name of the team
|
|
16
|
-
* @param paypalMeLink - Optional PayPal.Me link for payment collection (null if not set)
|
|
17
|
-
*/
|
|
18
|
-
constructor(id: Team.Id, name: string, paypalMeLink: string | null);
|
|
19
|
-
/**
|
|
20
|
-
* Gets the flattened representation of this team for serialization.
|
|
21
|
-
*/
|
|
22
|
-
get flatten(): Team.Flatten;
|
|
23
|
-
}
|
|
24
|
-
export declare namespace Team {
|
|
25
|
-
/**
|
|
26
|
-
* Tagged type for team identifiers to prevent mixing with other GUID types.
|
|
27
|
-
*/
|
|
28
|
-
type Id = Tagged<Guid, 'team'>;
|
|
29
|
-
namespace Id {
|
|
30
|
-
/**
|
|
31
|
-
* Flattened representation of a team ID (plain GUID string).
|
|
32
|
-
*/
|
|
33
|
-
type Flatten = string;
|
|
34
|
-
/**
|
|
35
|
-
* Builder for constructing Team.Id instances from GUID strings.
|
|
36
|
-
*/
|
|
37
|
-
const builder: Tagged.TypeBuilder<Guid, "team">;
|
|
38
|
-
}
|
|
39
|
-
/**
|
|
40
|
-
* Flattened representation of a Team for serialization.
|
|
41
|
-
*/
|
|
42
|
-
type Flatten = {
|
|
43
|
-
id: Id.Flatten;
|
|
44
|
-
name: string;
|
|
45
|
-
paypalMeLink: string | null;
|
|
46
|
-
};
|
|
47
|
-
/**
|
|
48
|
-
* Builder for constructing Team instances from flattened data.
|
|
49
|
-
*/
|
|
50
|
-
class TypeBuilder implements ITypeBuilder<Flatten, Team> {
|
|
51
|
-
/**
|
|
52
|
-
* Builds a Team instance from flattened data.
|
|
53
|
-
* @param value - The flattened team data
|
|
54
|
-
* @returns A new Team instance
|
|
55
|
-
*/
|
|
56
|
-
build(value: Flatten): Team;
|
|
57
|
-
}
|
|
58
|
-
/**
|
|
59
|
-
* Singleton builder instance for Team.
|
|
60
|
-
*/
|
|
61
|
-
const builder: TypeBuilder;
|
|
62
|
-
}
|
package/lib/src/types/Team.js
DELETED
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Team = void 0;
|
|
4
|
-
const typescript_common_functionality_1 = require("@stevenkellner/typescript-common-functionality");
|
|
5
|
-
/**
|
|
6
|
-
* Represents a team in the system with its basic information.
|
|
7
|
-
*
|
|
8
|
-
* A team is a group of people who can track fines and payments together.
|
|
9
|
-
* Teams can optionally have a PayPal.Me link for simplified payment collection.
|
|
10
|
-
*/
|
|
11
|
-
class Team {
|
|
12
|
-
id;
|
|
13
|
-
name;
|
|
14
|
-
paypalMeLink;
|
|
15
|
-
/**
|
|
16
|
-
* Creates a new Team instance.
|
|
17
|
-
* @param id - The unique identifier for this team
|
|
18
|
-
* @param name - The display name of the team
|
|
19
|
-
* @param paypalMeLink - Optional PayPal.Me link for payment collection (null if not set)
|
|
20
|
-
*/
|
|
21
|
-
constructor(id, name, paypalMeLink) {
|
|
22
|
-
this.id = id;
|
|
23
|
-
this.name = name;
|
|
24
|
-
this.paypalMeLink = paypalMeLink;
|
|
25
|
-
}
|
|
26
|
-
/**
|
|
27
|
-
* Gets the flattened representation of this team for serialization.
|
|
28
|
-
*/
|
|
29
|
-
get flatten() {
|
|
30
|
-
return {
|
|
31
|
-
id: this.id.flatten,
|
|
32
|
-
name: this.name,
|
|
33
|
-
paypalMeLink: this.paypalMeLink
|
|
34
|
-
};
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
exports.Team = Team;
|
|
38
|
-
(function (Team) {
|
|
39
|
-
let Id;
|
|
40
|
-
(function (Id) {
|
|
41
|
-
/**
|
|
42
|
-
* Builder for constructing Team.Id instances from GUID strings.
|
|
43
|
-
*/
|
|
44
|
-
Id.builder = typescript_common_functionality_1.Tagged.builder('team', typescript_common_functionality_1.Guid.builder);
|
|
45
|
-
})(Id = Team.Id || (Team.Id = {}));
|
|
46
|
-
/**
|
|
47
|
-
* Builder for constructing Team instances from flattened data.
|
|
48
|
-
*/
|
|
49
|
-
class TypeBuilder {
|
|
50
|
-
/**
|
|
51
|
-
* Builds a Team instance from flattened data.
|
|
52
|
-
* @param value - The flattened team data
|
|
53
|
-
* @returns A new Team instance
|
|
54
|
-
*/
|
|
55
|
-
build(value) {
|
|
56
|
-
return new Team(Id.builder.build(value.id), value.name, value.paypalMeLink);
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
Team.TypeBuilder = TypeBuilder;
|
|
60
|
-
/**
|
|
61
|
-
* Singleton builder instance for Team.
|
|
62
|
-
*/
|
|
63
|
-
Team.builder = new TypeBuilder();
|
|
64
|
-
})(Team || (exports.Team = Team = {}));
|
package/lib/src/types/User.d.ts
DELETED
|
@@ -1,221 +0,0 @@
|
|
|
1
|
-
import { Dictionary, Flattable, ITypeBuilder, Tagged, UtcDate } from '@stevenkellner/typescript-common-functionality';
|
|
2
|
-
import { Team } from './Team';
|
|
3
|
-
import { Person } from './Person';
|
|
4
|
-
/**
|
|
5
|
-
* Represents a user in the system with associated team memberships.
|
|
6
|
-
*
|
|
7
|
-
* A user can be a member of multiple teams, and for each team, they have
|
|
8
|
-
* specific properties (team name and associated person ID).
|
|
9
|
-
*/
|
|
10
|
-
export declare class User implements Flattable<User.Flatten> {
|
|
11
|
-
id: User.Id;
|
|
12
|
-
signInDate: UtcDate;
|
|
13
|
-
signInType: User.SignInType;
|
|
14
|
-
teams: Dictionary<Team.Id, User.TeamProperties>;
|
|
15
|
-
/**
|
|
16
|
-
* Creates a new User instance.
|
|
17
|
-
* @param id - The unique identifier for this user
|
|
18
|
-
* @param teams - Dictionary mapping team IDs to team-specific user properties
|
|
19
|
-
*/
|
|
20
|
-
constructor(id: User.Id, signInDate: UtcDate, signInType: User.SignInType, teams?: Dictionary<Team.Id, User.TeamProperties>);
|
|
21
|
-
/**
|
|
22
|
-
* Gets the flattened representation of this user for serialization.
|
|
23
|
-
*/
|
|
24
|
-
get flatten(): User.Flatten;
|
|
25
|
-
}
|
|
26
|
-
export declare namespace User {
|
|
27
|
-
/**
|
|
28
|
-
* Tagged type for user identifiers to prevent mixing with other string IDs.
|
|
29
|
-
*/
|
|
30
|
-
type Id = Tagged<string, 'user'>;
|
|
31
|
-
namespace Id {
|
|
32
|
-
/**
|
|
33
|
-
* Flattened representation of a user ID (plain string).
|
|
34
|
-
*/
|
|
35
|
-
type Flatten = string;
|
|
36
|
-
/**
|
|
37
|
-
* Builder for constructing User.Id instances from strings.
|
|
38
|
-
*/
|
|
39
|
-
const builder: Tagged.TypeBuilder<string, "user">;
|
|
40
|
-
}
|
|
41
|
-
/**
|
|
42
|
-
* Represents email-based authentication sign-in type.
|
|
43
|
-
*
|
|
44
|
-
* Used when a user signs in using their email address.
|
|
45
|
-
*/
|
|
46
|
-
class SignInTypeEmail implements Flattable<SignInTypeEmail.Flatten> {
|
|
47
|
-
email: string;
|
|
48
|
-
/**
|
|
49
|
-
* Creates a new email sign-in type.
|
|
50
|
-
* @param email - The email address used for authentication
|
|
51
|
-
*/
|
|
52
|
-
constructor(email: string);
|
|
53
|
-
/**
|
|
54
|
-
* Gets the flattened representation for serialization.
|
|
55
|
-
*/
|
|
56
|
-
get flatten(): SignInTypeEmail.Flatten;
|
|
57
|
-
}
|
|
58
|
-
namespace SignInTypeEmail {
|
|
59
|
-
/**
|
|
60
|
-
* Flattened representation of email sign-in type for serialization.
|
|
61
|
-
*/
|
|
62
|
-
type Flatten = {
|
|
63
|
-
type: 'email';
|
|
64
|
-
email: string;
|
|
65
|
-
};
|
|
66
|
-
/**
|
|
67
|
-
* Builder for constructing SignInTypeEmail instances from flattened data.
|
|
68
|
-
*/
|
|
69
|
-
class TypeBuilder implements ITypeBuilder<Flatten, SignInTypeEmail> {
|
|
70
|
-
/**
|
|
71
|
-
* Builds a SignInTypeEmail instance from flattened data.
|
|
72
|
-
* @param value - The flattened email sign-in type data
|
|
73
|
-
* @returns A new SignInTypeEmail instance
|
|
74
|
-
*/
|
|
75
|
-
build(value: Flatten): SignInTypeEmail;
|
|
76
|
-
}
|
|
77
|
-
/**
|
|
78
|
-
* Singleton builder instance for SignInTypeEmail.
|
|
79
|
-
*/
|
|
80
|
-
const builder: TypeBuilder;
|
|
81
|
-
}
|
|
82
|
-
/**
|
|
83
|
-
* Represents OAuth-based authentication sign-in type.
|
|
84
|
-
*
|
|
85
|
-
* Used when a user signs in using an OAuth provider (Google or Apple).
|
|
86
|
-
*/
|
|
87
|
-
class SignInTypeOAuth implements Flattable<SignInTypeOAuth.Flatten> {
|
|
88
|
-
provider: 'google' | 'apple';
|
|
89
|
-
/**
|
|
90
|
-
* Creates a new OAuth sign-in type.
|
|
91
|
-
* @param provider - The OAuth provider used for authentication ('google' or 'apple')
|
|
92
|
-
*/
|
|
93
|
-
constructor(provider: 'google' | 'apple');
|
|
94
|
-
/**
|
|
95
|
-
* Gets the flattened representation for serialization.
|
|
96
|
-
*/
|
|
97
|
-
get flatten(): SignInTypeOAuth.Flatten;
|
|
98
|
-
}
|
|
99
|
-
namespace SignInTypeOAuth {
|
|
100
|
-
/**
|
|
101
|
-
* Flattened representation of OAuth sign-in type for serialization.
|
|
102
|
-
*/
|
|
103
|
-
type Flatten = {
|
|
104
|
-
type: 'google' | 'apple';
|
|
105
|
-
};
|
|
106
|
-
/**
|
|
107
|
-
* Builder for constructing SignInTypeOAuth instances from flattened data.
|
|
108
|
-
*/
|
|
109
|
-
class TypeBuilder implements ITypeBuilder<Flatten, SignInTypeOAuth> {
|
|
110
|
-
/**
|
|
111
|
-
* Builds a SignInTypeOAuth instance from flattened data.
|
|
112
|
-
* @param value - The flattened OAuth sign-in type data
|
|
113
|
-
* @returns A new SignInTypeOAuth instance
|
|
114
|
-
*/
|
|
115
|
-
build(value: Flatten): SignInTypeOAuth;
|
|
116
|
-
}
|
|
117
|
-
/**
|
|
118
|
-
* Singleton builder instance for SignInTypeOAuth.
|
|
119
|
-
*/
|
|
120
|
-
const builder: TypeBuilder;
|
|
121
|
-
}
|
|
122
|
-
/**
|
|
123
|
-
* Union type representing any sign-in method.
|
|
124
|
-
*
|
|
125
|
-
* Can be either email-based or OAuth-based authentication.
|
|
126
|
-
*/
|
|
127
|
-
type SignInType = SignInTypeEmail | SignInTypeOAuth;
|
|
128
|
-
namespace SignInType {
|
|
129
|
-
/**
|
|
130
|
-
* Flattened representation of any sign-in type for serialization.
|
|
131
|
-
*/
|
|
132
|
-
type Flatten = SignInTypeEmail.Flatten | SignInTypeOAuth.Flatten;
|
|
133
|
-
/**
|
|
134
|
-
* Builder for constructing SignInType instances from flattened data.
|
|
135
|
-
*
|
|
136
|
-
* Automatically determines the correct type based on the 'type' field.
|
|
137
|
-
*/
|
|
138
|
-
class TypeBuilder implements ITypeBuilder<Flatten, SignInType> {
|
|
139
|
-
/**
|
|
140
|
-
* Builds a SignInType instance from flattened data.
|
|
141
|
-
*
|
|
142
|
-
* Routes to the appropriate builder based on the type field.
|
|
143
|
-
* @param value - The flattened sign-in type data
|
|
144
|
-
* @returns Either a SignInTypeEmail or SignInTypeOAuth instance
|
|
145
|
-
*/
|
|
146
|
-
build(value: Flatten): SignInType;
|
|
147
|
-
}
|
|
148
|
-
/**
|
|
149
|
-
* Singleton builder instance for SignInType.
|
|
150
|
-
*/
|
|
151
|
-
const builder: TypeBuilder;
|
|
152
|
-
}
|
|
153
|
-
/**
|
|
154
|
-
* Properties that are specific to a user's membership in a particular team.
|
|
155
|
-
*/
|
|
156
|
-
class TeamProperties implements Flattable<TeamProperties.Flatten> {
|
|
157
|
-
teamId: Team.Id;
|
|
158
|
-
teamName: string;
|
|
159
|
-
personId: Person.Id;
|
|
160
|
-
/**
|
|
161
|
-
* Creates new team-specific user properties.
|
|
162
|
-
* @param teamId - The ID of the team
|
|
163
|
-
* @param teamName - The display name of the team
|
|
164
|
-
* @param personId - The ID of the person associated with this user in this team
|
|
165
|
-
*/
|
|
166
|
-
constructor(teamId: Team.Id, teamName: string, personId: Person.Id);
|
|
167
|
-
/**
|
|
168
|
-
* Gets the flattened representation of these team properties.
|
|
169
|
-
*/
|
|
170
|
-
get flatten(): TeamProperties.Flatten;
|
|
171
|
-
}
|
|
172
|
-
namespace TeamProperties {
|
|
173
|
-
/**
|
|
174
|
-
* Flattened representation of team properties for serialization.
|
|
175
|
-
*/
|
|
176
|
-
type Flatten = {
|
|
177
|
-
teamId: Team.Id.Flatten;
|
|
178
|
-
teamName: string;
|
|
179
|
-
personId: Person.Id.Flatten;
|
|
180
|
-
};
|
|
181
|
-
/**
|
|
182
|
-
* Builder for constructing TeamProperties from flattened data.
|
|
183
|
-
*/
|
|
184
|
-
class TypeBuilder implements ITypeBuilder<Flatten, TeamProperties> {
|
|
185
|
-
/**
|
|
186
|
-
* Builds a TeamProperties instance from flattened data.
|
|
187
|
-
* @param value - The flattened team properties data
|
|
188
|
-
* @returns A new TeamProperties instance
|
|
189
|
-
*/
|
|
190
|
-
build(value: Flatten): TeamProperties;
|
|
191
|
-
}
|
|
192
|
-
/**
|
|
193
|
-
* Singleton builder instance for TeamProperties.
|
|
194
|
-
*/
|
|
195
|
-
const builder: TypeBuilder;
|
|
196
|
-
}
|
|
197
|
-
/**
|
|
198
|
-
* Flattened representation of a User for serialization.
|
|
199
|
-
*/
|
|
200
|
-
type Flatten = {
|
|
201
|
-
id: Id.Flatten;
|
|
202
|
-
signInDate: string;
|
|
203
|
-
signInType: SignInType.Flatten;
|
|
204
|
-
teams: Dictionary.Flatten<TeamProperties>;
|
|
205
|
-
};
|
|
206
|
-
/**
|
|
207
|
-
* Builder for constructing User instances from flattened data.
|
|
208
|
-
*/
|
|
209
|
-
class TypeBuilder implements ITypeBuilder<Flatten, User> {
|
|
210
|
-
/**
|
|
211
|
-
* Builds a User instance from flattened data.
|
|
212
|
-
* @param value - The flattened user data
|
|
213
|
-
* @returns A new User instance with all teams reconstructed
|
|
214
|
-
*/
|
|
215
|
-
build(value: Flatten): User;
|
|
216
|
-
}
|
|
217
|
-
/**
|
|
218
|
-
* Singleton builder instance for User.
|
|
219
|
-
*/
|
|
220
|
-
const builder: TypeBuilder;
|
|
221
|
-
}
|
package/lib/src/types/User.js
DELETED
|
@@ -1,235 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.User = void 0;
|
|
4
|
-
const typescript_common_functionality_1 = require("@stevenkellner/typescript-common-functionality");
|
|
5
|
-
const Team_1 = require("./Team");
|
|
6
|
-
const Person_1 = require("./Person");
|
|
7
|
-
/**
|
|
8
|
-
* Represents a user in the system with associated team memberships.
|
|
9
|
-
*
|
|
10
|
-
* A user can be a member of multiple teams, and for each team, they have
|
|
11
|
-
* specific properties (team name and associated person ID).
|
|
12
|
-
*/
|
|
13
|
-
class User {
|
|
14
|
-
id;
|
|
15
|
-
signInDate;
|
|
16
|
-
signInType;
|
|
17
|
-
teams;
|
|
18
|
-
/**
|
|
19
|
-
* Creates a new User instance.
|
|
20
|
-
* @param id - The unique identifier for this user
|
|
21
|
-
* @param teams - Dictionary mapping team IDs to team-specific user properties
|
|
22
|
-
*/
|
|
23
|
-
constructor(id, signInDate, signInType, teams = new typescript_common_functionality_1.Dictionary(Team_1.Team.Id.builder)) {
|
|
24
|
-
this.id = id;
|
|
25
|
-
this.signInDate = signInDate;
|
|
26
|
-
this.signInType = signInType;
|
|
27
|
-
this.teams = teams;
|
|
28
|
-
}
|
|
29
|
-
/**
|
|
30
|
-
* Gets the flattened representation of this user for serialization.
|
|
31
|
-
*/
|
|
32
|
-
get flatten() {
|
|
33
|
-
return {
|
|
34
|
-
id: this.id.flatten,
|
|
35
|
-
signInDate: this.signInDate.flatten,
|
|
36
|
-
signInType: this.signInType.flatten,
|
|
37
|
-
teams: this.teams.flatten
|
|
38
|
-
};
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
exports.User = User;
|
|
42
|
-
(function (User) {
|
|
43
|
-
let Id;
|
|
44
|
-
(function (Id) {
|
|
45
|
-
/**
|
|
46
|
-
* Builder for constructing User.Id instances from strings.
|
|
47
|
-
*/
|
|
48
|
-
Id.builder = typescript_common_functionality_1.Tagged.builder('user', new typescript_common_functionality_1.ValueTypeBuilder());
|
|
49
|
-
})(Id = User.Id || (User.Id = {}));
|
|
50
|
-
/**
|
|
51
|
-
* Represents email-based authentication sign-in type.
|
|
52
|
-
*
|
|
53
|
-
* Used when a user signs in using their email address.
|
|
54
|
-
*/
|
|
55
|
-
class SignInTypeEmail {
|
|
56
|
-
email;
|
|
57
|
-
/**
|
|
58
|
-
* Creates a new email sign-in type.
|
|
59
|
-
* @param email - The email address used for authentication
|
|
60
|
-
*/
|
|
61
|
-
constructor(email) {
|
|
62
|
-
this.email = email;
|
|
63
|
-
}
|
|
64
|
-
/**
|
|
65
|
-
* Gets the flattened representation for serialization.
|
|
66
|
-
*/
|
|
67
|
-
get flatten() {
|
|
68
|
-
return {
|
|
69
|
-
type: 'email',
|
|
70
|
-
email: this.email
|
|
71
|
-
};
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
User.SignInTypeEmail = SignInTypeEmail;
|
|
75
|
-
(function (SignInTypeEmail) {
|
|
76
|
-
/**
|
|
77
|
-
* Builder for constructing SignInTypeEmail instances from flattened data.
|
|
78
|
-
*/
|
|
79
|
-
class TypeBuilder {
|
|
80
|
-
/**
|
|
81
|
-
* Builds a SignInTypeEmail instance from flattened data.
|
|
82
|
-
* @param value - The flattened email sign-in type data
|
|
83
|
-
* @returns A new SignInTypeEmail instance
|
|
84
|
-
*/
|
|
85
|
-
build(value) {
|
|
86
|
-
return new SignInTypeEmail(value.email);
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
SignInTypeEmail.TypeBuilder = TypeBuilder;
|
|
90
|
-
/**
|
|
91
|
-
* Singleton builder instance for SignInTypeEmail.
|
|
92
|
-
*/
|
|
93
|
-
SignInTypeEmail.builder = new TypeBuilder();
|
|
94
|
-
})(SignInTypeEmail = User.SignInTypeEmail || (User.SignInTypeEmail = {}));
|
|
95
|
-
/**
|
|
96
|
-
* Represents OAuth-based authentication sign-in type.
|
|
97
|
-
*
|
|
98
|
-
* Used when a user signs in using an OAuth provider (Google or Apple).
|
|
99
|
-
*/
|
|
100
|
-
class SignInTypeOAuth {
|
|
101
|
-
provider;
|
|
102
|
-
/**
|
|
103
|
-
* Creates a new OAuth sign-in type.
|
|
104
|
-
* @param provider - The OAuth provider used for authentication ('google' or 'apple')
|
|
105
|
-
*/
|
|
106
|
-
constructor(provider) {
|
|
107
|
-
this.provider = provider;
|
|
108
|
-
}
|
|
109
|
-
/**
|
|
110
|
-
* Gets the flattened representation for serialization.
|
|
111
|
-
*/
|
|
112
|
-
get flatten() {
|
|
113
|
-
return {
|
|
114
|
-
type: this.provider
|
|
115
|
-
};
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
User.SignInTypeOAuth = SignInTypeOAuth;
|
|
119
|
-
(function (SignInTypeOAuth) {
|
|
120
|
-
/**
|
|
121
|
-
* Builder for constructing SignInTypeOAuth instances from flattened data.
|
|
122
|
-
*/
|
|
123
|
-
class TypeBuilder {
|
|
124
|
-
/**
|
|
125
|
-
* Builds a SignInTypeOAuth instance from flattened data.
|
|
126
|
-
* @param value - The flattened OAuth sign-in type data
|
|
127
|
-
* @returns A new SignInTypeOAuth instance
|
|
128
|
-
*/
|
|
129
|
-
build(value) {
|
|
130
|
-
return new SignInTypeOAuth(value.type);
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
SignInTypeOAuth.TypeBuilder = TypeBuilder;
|
|
134
|
-
/**
|
|
135
|
-
* Singleton builder instance for SignInTypeOAuth.
|
|
136
|
-
*/
|
|
137
|
-
SignInTypeOAuth.builder = new TypeBuilder();
|
|
138
|
-
})(SignInTypeOAuth = User.SignInTypeOAuth || (User.SignInTypeOAuth = {}));
|
|
139
|
-
let SignInType;
|
|
140
|
-
(function (SignInType) {
|
|
141
|
-
/**
|
|
142
|
-
* Builder for constructing SignInType instances from flattened data.
|
|
143
|
-
*
|
|
144
|
-
* Automatically determines the correct type based on the 'type' field.
|
|
145
|
-
*/
|
|
146
|
-
class TypeBuilder {
|
|
147
|
-
/**
|
|
148
|
-
* Builds a SignInType instance from flattened data.
|
|
149
|
-
*
|
|
150
|
-
* Routes to the appropriate builder based on the type field.
|
|
151
|
-
* @param value - The flattened sign-in type data
|
|
152
|
-
* @returns Either a SignInTypeEmail or SignInTypeOAuth instance
|
|
153
|
-
*/
|
|
154
|
-
build(value) {
|
|
155
|
-
if (value.type === 'email')
|
|
156
|
-
return SignInTypeEmail.builder.build(value);
|
|
157
|
-
else
|
|
158
|
-
return SignInTypeOAuth.builder.build(value);
|
|
159
|
-
}
|
|
160
|
-
}
|
|
161
|
-
SignInType.TypeBuilder = TypeBuilder;
|
|
162
|
-
/**
|
|
163
|
-
* Singleton builder instance for SignInType.
|
|
164
|
-
*/
|
|
165
|
-
SignInType.builder = new TypeBuilder();
|
|
166
|
-
})(SignInType = User.SignInType || (User.SignInType = {}));
|
|
167
|
-
/**
|
|
168
|
-
* Properties that are specific to a user's membership in a particular team.
|
|
169
|
-
*/
|
|
170
|
-
class TeamProperties {
|
|
171
|
-
teamId;
|
|
172
|
-
teamName;
|
|
173
|
-
personId;
|
|
174
|
-
/**
|
|
175
|
-
* Creates new team-specific user properties.
|
|
176
|
-
* @param teamId - The ID of the team
|
|
177
|
-
* @param teamName - The display name of the team
|
|
178
|
-
* @param personId - The ID of the person associated with this user in this team
|
|
179
|
-
*/
|
|
180
|
-
constructor(teamId, teamName, personId) {
|
|
181
|
-
this.teamId = teamId;
|
|
182
|
-
this.teamName = teamName;
|
|
183
|
-
this.personId = personId;
|
|
184
|
-
}
|
|
185
|
-
/**
|
|
186
|
-
* Gets the flattened representation of these team properties.
|
|
187
|
-
*/
|
|
188
|
-
get flatten() {
|
|
189
|
-
return {
|
|
190
|
-
teamId: this.teamId.flatten,
|
|
191
|
-
teamName: this.teamName,
|
|
192
|
-
personId: this.personId.flatten
|
|
193
|
-
};
|
|
194
|
-
}
|
|
195
|
-
}
|
|
196
|
-
User.TeamProperties = TeamProperties;
|
|
197
|
-
(function (TeamProperties) {
|
|
198
|
-
/**
|
|
199
|
-
* Builder for constructing TeamProperties from flattened data.
|
|
200
|
-
*/
|
|
201
|
-
class TypeBuilder {
|
|
202
|
-
/**
|
|
203
|
-
* Builds a TeamProperties instance from flattened data.
|
|
204
|
-
* @param value - The flattened team properties data
|
|
205
|
-
* @returns A new TeamProperties instance
|
|
206
|
-
*/
|
|
207
|
-
build(value) {
|
|
208
|
-
return new TeamProperties(Team_1.Team.Id.builder.build(value.teamId), value.teamName, Person_1.Person.Id.builder.build(value.personId));
|
|
209
|
-
}
|
|
210
|
-
}
|
|
211
|
-
TeamProperties.TypeBuilder = TypeBuilder;
|
|
212
|
-
/**
|
|
213
|
-
* Singleton builder instance for TeamProperties.
|
|
214
|
-
*/
|
|
215
|
-
TeamProperties.builder = new TypeBuilder();
|
|
216
|
-
})(TeamProperties = User.TeamProperties || (User.TeamProperties = {}));
|
|
217
|
-
/**
|
|
218
|
-
* Builder for constructing User instances from flattened data.
|
|
219
|
-
*/
|
|
220
|
-
class TypeBuilder {
|
|
221
|
-
/**
|
|
222
|
-
* Builds a User instance from flattened data.
|
|
223
|
-
* @param value - The flattened user data
|
|
224
|
-
* @returns A new User instance with all teams reconstructed
|
|
225
|
-
*/
|
|
226
|
-
build(value) {
|
|
227
|
-
return new User(Id.builder.build(value.id), typescript_common_functionality_1.UtcDate.builder.build(value.signInDate), SignInType.builder.build(value.signInType), typescript_common_functionality_1.Dictionary.builder(Team_1.Team.Id.builder, User.TeamProperties.builder).build(value.teams));
|
|
228
|
-
}
|
|
229
|
-
}
|
|
230
|
-
User.TypeBuilder = TypeBuilder;
|
|
231
|
-
/**
|
|
232
|
-
* Singleton builder instance for User.
|
|
233
|
-
*/
|
|
234
|
-
User.builder = new TypeBuilder();
|
|
235
|
-
})(User || (exports.User = User = {}));
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { ValueTypeBuilder } from '@stevenkellner/typescript-common-functionality';
|
|
2
|
-
import { Locale } from './Locale';
|
|
3
|
-
/**
|
|
4
|
-
* Array of all available user roles.
|
|
5
|
-
*/
|
|
6
|
-
declare const userRoles: readonly ["person-manager", "fineTemplate-manager", "fine-manager", "fine-can-add", "team-manager"];
|
|
7
|
-
/**
|
|
8
|
-
* Represents user roles in the application.
|
|
9
|
-
* Defines different levels of permissions for team members.
|
|
10
|
-
*/
|
|
11
|
-
export type UserRole = typeof userRoles[number];
|
|
12
|
-
export declare namespace UserRole {
|
|
13
|
-
/**
|
|
14
|
-
* Array of all available user roles.
|
|
15
|
-
*/
|
|
16
|
-
const all: readonly UserRole[];
|
|
17
|
-
/**
|
|
18
|
-
* Returns the localized, human-readable name for a user role.
|
|
19
|
-
* @param role - The user role to format
|
|
20
|
-
* @param locale - The locale to use for localization
|
|
21
|
-
* @returns The localized role name
|
|
22
|
-
*/
|
|
23
|
-
function formatted(role: UserRole, locale: Locale): string;
|
|
24
|
-
/**
|
|
25
|
-
* Builder for constructing UserRole values.
|
|
26
|
-
*/
|
|
27
|
-
const builder: ValueTypeBuilder<"person-manager" | "fineTemplate-manager" | "fine-manager" | "fine-can-add" | "team-manager">;
|
|
28
|
-
}
|
|
29
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|