@stevenkellner/team-conduct-api 1.0.4 → 1.0.5
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/Firestore.d.ts +15 -0
- package/lib/src/Firestore.js +53 -0
- package/{src/FirestoreScheme.ts → lib/src/FirestoreScheme.d.ts} +12 -13
- package/lib/src/FirestoreScheme.js +2 -0
- package/lib/src/checkAuthentication.d.ts +2 -0
- package/lib/src/checkAuthentication.js +31 -0
- package/lib/src/firebase/FirebaseConfiguration.d.ts +15 -0
- package/{src/firebase/FirebaseConfiguration.ts → lib/src/firebase/FirebaseConfiguration.js} +13 -24
- package/{src/firebase/Messaging.ts → lib/src/firebase/Messaging.d.ts} +0 -3
- package/lib/src/firebase/Messaging.js +2 -0
- package/lib/src/firebase/index.js +18 -0
- package/lib/src/firebaseFunctionCreators.d.ts +50 -0
- package/lib/src/firebaseFunctionCreators.js +58 -0
- package/lib/src/functions/fine/add.d.ts +37 -0
- package/lib/src/functions/fine/add.js +71 -0
- package/lib/src/functions/fine/delete.d.ts +24 -0
- package/lib/src/functions/fine/delete.js +71 -0
- package/lib/src/functions/fine/update.d.ts +38 -0
- package/lib/src/functions/fine/update.js +73 -0
- package/lib/src/functions/fineTemplate/add.d.ts +32 -0
- package/lib/src/functions/fineTemplate/add.js +23 -0
- package/lib/src/functions/fineTemplate/delete.d.ts +17 -0
- package/lib/src/functions/fineTemplate/delete.js +23 -0
- package/lib/src/functions/fineTemplate/update.d.ts +32 -0
- package/lib/src/functions/fineTemplate/update.js +23 -0
- package/lib/src/functions/invitation/invite.d.ts +7 -0
- package/lib/src/functions/invitation/invite.js +23 -0
- package/lib/src/functions/invitation/register.d.ts +7 -0
- package/lib/src/functions/invitation/register.js +43 -0
- package/lib/src/functions/invitation/withdraw.d.ts +8 -0
- package/lib/src/functions/invitation/withdraw.js +21 -0
- package/lib/src/functions/notification/register.d.ts +19 -0
- package/lib/src/functions/notification/register.js +27 -0
- package/lib/src/functions/notification/subscribe.d.ts +19 -0
- package/lib/src/functions/notification/subscribe.js +26 -0
- package/lib/src/functions/paypalMe/edit.d.ts +17 -0
- package/lib/src/functions/paypalMe/edit.js +25 -0
- package/lib/src/functions/person/add.d.ts +22 -0
- package/lib/src/functions/person/add.js +24 -0
- package/lib/src/functions/person/delete.d.ts +17 -0
- package/lib/src/functions/person/delete.js +25 -0
- package/lib/src/functions/person/update.d.ts +22 -0
- package/lib/src/functions/person/update.js +25 -0
- package/lib/src/functions/team/new.d.ts +26 -0
- package/lib/src/functions/team/new.js +36 -0
- package/lib/src/functions/user/login.d.ts +8 -0
- package/lib/src/functions/user/login.js +21 -0
- package/lib/src/functions/user/roleEdit.d.ts +19 -0
- package/lib/src/functions/user/roleEdit.js +30 -0
- package/lib/src/pushNotification.d.ts +3 -0
- package/lib/src/pushNotification.js +35 -0
- package/lib/src/types/Configuration.d.ts +27 -0
- package/lib/src/types/Configuration.js +38 -0
- package/lib/src/types/Fine.d.ts +30 -0
- package/lib/src/types/Fine.js +42 -0
- package/lib/src/types/FineAmount.d.ts +51 -0
- package/lib/src/types/FineAmount.js +124 -0
- package/lib/src/types/FineTemplate.d.ts +28 -0
- package/lib/src/types/FineTemplate.js +40 -0
- package/lib/src/types/FineTemplateRepetition.d.ts +22 -0
- package/lib/src/types/FineTemplateRepetition.js +38 -0
- package/lib/src/types/Invitation.d.ts +25 -0
- package/lib/src/types/Invitation.js +42 -0
- package/lib/src/types/MoneyAmount.d.ts +17 -0
- package/lib/src/types/MoneyAmount.js +68 -0
- package/lib/src/types/NotificationProperties.d.ts +28 -0
- package/lib/src/types/NotificationProperties.js +50 -0
- package/lib/src/types/PayedState.d.ts +6 -0
- package/lib/src/types/PayedState.js +9 -0
- package/lib/src/types/Person.d.ts +29 -0
- package/lib/src/types/Person.js +41 -0
- package/lib/src/types/PersonPrivateProperties.d.ts +17 -0
- package/lib/src/types/PersonPrivateProperties.js +27 -0
- package/lib/src/types/PersonSignInProperties.d.ts +24 -0
- package/lib/src/types/PersonSignInProperties.js +36 -0
- package/lib/src/types/Team.d.ts +24 -0
- package/lib/src/types/Team.js +35 -0
- package/lib/src/types/User.d.ts +40 -0
- package/lib/src/types/User.js +58 -0
- package/lib/src/types/UserRole.d.ts +6 -0
- package/lib/src/types/UserRole.js +14 -0
- package/lib/src/types/index.js +31 -0
- package/lib/tsconfig.tsbuildinfo +1 -0
- package/package.json +4 -1
- package/eslint.config.js +0 -72
- package/src/Firestore.ts +0 -63
- package/src/checkAuthentication.ts +0 -36
- package/src/firebaseFunctionCreators.ts +0 -56
- package/src/functions/fine/add.ts +0 -54
- package/src/functions/fine/delete.ts +0 -54
- package/src/functions/fine/update.ts +0 -55
- package/src/functions/fineTemplate/add.ts +0 -34
- package/src/functions/fineTemplate/delete.ts +0 -34
- package/src/functions/fineTemplate/update.ts +0 -34
- package/src/functions/invitation/invite.ts +0 -28
- package/src/functions/invitation/register.ts +0 -54
- package/src/functions/invitation/withdraw.ts +0 -24
- package/src/functions/notification/register.ts +0 -39
- package/src/functions/notification/subscribe.ts +0 -38
- package/src/functions/paypalMe/edit.ts +0 -36
- package/src/functions/person/add.ts +0 -36
- package/src/functions/person/delete.ts +0 -37
- package/src/functions/person/update.ts +0 -37
- package/src/functions/team/new.ts +0 -54
- package/src/functions/user/login.ts +0 -25
- package/src/functions/user/roleEdit.ts +0 -44
- package/src/locales/de.json +0 -30
- package/src/locales/en.json +0 -30
- package/src/pushNotification.ts +0 -37
- package/src/types/Configuration.ts +0 -54
- package/src/types/Fine.ts +0 -59
- package/src/types/FineAmount.ts +0 -123
- package/src/types/FineTemplate.ts +0 -55
- package/src/types/FineTemplateRepetition.ts +0 -54
- package/src/types/Invitation.ts +0 -56
- package/src/types/MoneyAmount.ts +0 -41
- package/src/types/NotificationProperties.ts +0 -67
- package/src/types/PayedState.ts +0 -12
- package/src/types/Person.ts +0 -56
- package/src/types/PersonPrivateProperties.ts +0 -37
- package/src/types/PersonSignInProperties.ts +0 -42
- package/src/types/Team.ts +0 -49
- package/src/types/User.ts +0 -76
- package/src/types/UserRole.ts +0 -19
- package/tsconfig.json +0 -117
- /package/{index.ts → lib/index.d.ts} +0 -0
- /package/{src/firebase/index.ts → lib/src/firebase/index.d.ts} +0 -0
- /package/{src/types/index.ts → lib/src/types/index.d.ts} +0 -0
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Invitation = 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
|
+
class Invitation {
|
|
8
|
+
teamId;
|
|
9
|
+
personId;
|
|
10
|
+
constructor(teamId, personId) {
|
|
11
|
+
this.teamId = teamId;
|
|
12
|
+
this.personId = personId;
|
|
13
|
+
}
|
|
14
|
+
createId() {
|
|
15
|
+
const hasher = new typescript_common_functionality_1.Sha512();
|
|
16
|
+
const teamIdBytes = typescript_common_functionality_1.BytesCoder.fromUtf8(this.teamId.guidString);
|
|
17
|
+
const personIdBytes = typescript_common_functionality_1.BytesCoder.fromUtf8(this.personId.guidString);
|
|
18
|
+
const hashedInvitationBytes = hasher.hash(new Uint8Array([...teamIdBytes, ...personIdBytes]));
|
|
19
|
+
const rawId = typescript_common_functionality_1.BytesCoder.toHex(hashedInvitationBytes).slice(0, 12);
|
|
20
|
+
return new typescript_common_functionality_1.Tagged(rawId, 'invitation');
|
|
21
|
+
}
|
|
22
|
+
get flatten() {
|
|
23
|
+
return {
|
|
24
|
+
teamId: this.teamId.flatten,
|
|
25
|
+
personId: this.personId.flatten
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
exports.Invitation = Invitation;
|
|
30
|
+
(function (Invitation) {
|
|
31
|
+
let Id;
|
|
32
|
+
(function (Id) {
|
|
33
|
+
Id.builder = typescript_common_functionality_1.Tagged.builder('invitation', new typescript_common_functionality_1.ValueTypeBuilder());
|
|
34
|
+
})(Id = Invitation.Id || (Invitation.Id = {}));
|
|
35
|
+
class TypeBuilder {
|
|
36
|
+
build(value) {
|
|
37
|
+
return new Invitation(Team_1.Team.Id.builder.build(value.teamId), Person_1.Person.Id.builder.build(value.personId));
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
Invitation.TypeBuilder = TypeBuilder;
|
|
41
|
+
Invitation.builder = new TypeBuilder();
|
|
42
|
+
})(Invitation || (exports.Invitation = Invitation = {}));
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Flattable, ITypeBuilder } from '@stevenkellner/typescript-common-functionality';
|
|
2
|
+
import { Configuration } from './Configuration';
|
|
3
|
+
export declare class MoneyAmount implements Flattable<MoneyAmount.Flatten> {
|
|
4
|
+
value: number;
|
|
5
|
+
subunitValue: number;
|
|
6
|
+
constructor(value: number, subunitValue: number);
|
|
7
|
+
static zero(): MoneyAmount;
|
|
8
|
+
formatted(currency: Configuration.Currency): string;
|
|
9
|
+
get flatten(): MoneyAmount.Flatten;
|
|
10
|
+
}
|
|
11
|
+
export declare namespace MoneyAmount {
|
|
12
|
+
type Flatten = number;
|
|
13
|
+
class TypeBuilder implements ITypeBuilder<Flatten, MoneyAmount> {
|
|
14
|
+
build(value: Flatten): MoneyAmount;
|
|
15
|
+
}
|
|
16
|
+
const builder: TypeBuilder;
|
|
17
|
+
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.MoneyAmount = void 0;
|
|
37
|
+
const i18n = __importStar(require("i18n"));
|
|
38
|
+
class MoneyAmount {
|
|
39
|
+
value;
|
|
40
|
+
subunitValue;
|
|
41
|
+
constructor(value, subunitValue) {
|
|
42
|
+
this.value = value;
|
|
43
|
+
this.subunitValue = subunitValue;
|
|
44
|
+
}
|
|
45
|
+
static zero() {
|
|
46
|
+
return new MoneyAmount(0, 0);
|
|
47
|
+
}
|
|
48
|
+
formatted(currency) {
|
|
49
|
+
const numberFormat = Intl.NumberFormat(i18n.getLocale(), {
|
|
50
|
+
style: 'currency',
|
|
51
|
+
currency: currency
|
|
52
|
+
});
|
|
53
|
+
return numberFormat.format(this.value + this.subunitValue / 100);
|
|
54
|
+
}
|
|
55
|
+
get flatten() {
|
|
56
|
+
return this.value + this.subunitValue / 100;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
exports.MoneyAmount = MoneyAmount;
|
|
60
|
+
(function (MoneyAmount) {
|
|
61
|
+
class TypeBuilder {
|
|
62
|
+
build(value) {
|
|
63
|
+
return new MoneyAmount(Math.floor(value), Math.round((value - Math.floor(value)) * 100));
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
MoneyAmount.TypeBuilder = TypeBuilder;
|
|
67
|
+
MoneyAmount.builder = new MoneyAmount.TypeBuilder();
|
|
68
|
+
})(MoneyAmount || (exports.MoneyAmount = MoneyAmount = {}));
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { Dictionary, Flattable, ITypeBuilder, Tagged, ValueTypeBuilder } from '@stevenkellner/typescript-common-functionality';
|
|
2
|
+
export declare class NotificationProperties implements Flattable<NotificationProperties.Flatten> {
|
|
3
|
+
tokens: Dictionary<NotificationProperties.TokenId, string>;
|
|
4
|
+
subscriptions: NotificationProperties.Subscription[];
|
|
5
|
+
constructor(tokens?: Dictionary<NotificationProperties.TokenId, string>, subscriptions?: NotificationProperties.Subscription[]);
|
|
6
|
+
get flatten(): NotificationProperties.Flatten;
|
|
7
|
+
}
|
|
8
|
+
export declare namespace NotificationProperties {
|
|
9
|
+
type TokenId = Tagged<string, 'notificationToken'>;
|
|
10
|
+
namespace TokenId {
|
|
11
|
+
function create(token: string): TokenId;
|
|
12
|
+
type Flatten = string;
|
|
13
|
+
const builder: Tagged.TypeBuilder<string, "notificationToken">;
|
|
14
|
+
}
|
|
15
|
+
type Subscription = 'new-fine' | 'fine-reminder' | 'fine-state-change';
|
|
16
|
+
namespace Subscription {
|
|
17
|
+
const all: Subscription[];
|
|
18
|
+
const builder: ValueTypeBuilder<Subscription>;
|
|
19
|
+
}
|
|
20
|
+
type Flatten = {
|
|
21
|
+
tokens: Dictionary.Flatten<string>;
|
|
22
|
+
subscriptions: Subscription[];
|
|
23
|
+
};
|
|
24
|
+
class TypeBuilder implements ITypeBuilder<Flatten, NotificationProperties> {
|
|
25
|
+
build(value: Flatten): NotificationProperties;
|
|
26
|
+
}
|
|
27
|
+
const builder: TypeBuilder;
|
|
28
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.NotificationProperties = void 0;
|
|
4
|
+
const typescript_common_functionality_1 = require("@stevenkellner/typescript-common-functionality");
|
|
5
|
+
class NotificationProperties {
|
|
6
|
+
tokens;
|
|
7
|
+
subscriptions;
|
|
8
|
+
constructor(tokens = new typescript_common_functionality_1.Dictionary(NotificationProperties.TokenId.builder), subscriptions = []) {
|
|
9
|
+
this.tokens = tokens;
|
|
10
|
+
this.subscriptions = subscriptions;
|
|
11
|
+
}
|
|
12
|
+
get flatten() {
|
|
13
|
+
return {
|
|
14
|
+
tokens: this.tokens.flatten,
|
|
15
|
+
subscriptions: this.subscriptions
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
exports.NotificationProperties = NotificationProperties;
|
|
20
|
+
(function (NotificationProperties) {
|
|
21
|
+
let TokenId;
|
|
22
|
+
(function (TokenId) {
|
|
23
|
+
function create(token) {
|
|
24
|
+
const hasher = new typescript_common_functionality_1.Sha512();
|
|
25
|
+
const tokenBytes = typescript_common_functionality_1.BytesCoder.fromUtf8(token);
|
|
26
|
+
const tokenIdBytes = hasher.hash(tokenBytes);
|
|
27
|
+
const tokenId = typescript_common_functionality_1.BytesCoder.toHex(tokenIdBytes);
|
|
28
|
+
const rawId = tokenId.slice(0, 16);
|
|
29
|
+
return new typescript_common_functionality_1.Tagged(rawId, 'notificationToken');
|
|
30
|
+
}
|
|
31
|
+
TokenId.create = create;
|
|
32
|
+
TokenId.builder = typescript_common_functionality_1.Tagged.builder('notificationToken', new typescript_common_functionality_1.ValueTypeBuilder());
|
|
33
|
+
})(TokenId = NotificationProperties.TokenId || (NotificationProperties.TokenId = {}));
|
|
34
|
+
let Subscription;
|
|
35
|
+
(function (Subscription) {
|
|
36
|
+
Subscription.all = [
|
|
37
|
+
'new-fine',
|
|
38
|
+
'fine-reminder',
|
|
39
|
+
'fine-state-change'
|
|
40
|
+
];
|
|
41
|
+
Subscription.builder = new typescript_common_functionality_1.ValueTypeBuilder();
|
|
42
|
+
})(Subscription = NotificationProperties.Subscription || (NotificationProperties.Subscription = {}));
|
|
43
|
+
class TypeBuilder {
|
|
44
|
+
build(value) {
|
|
45
|
+
return new NotificationProperties(typescript_common_functionality_1.Dictionary.builder(TokenId.builder, new typescript_common_functionality_1.ValueTypeBuilder()).build(value.tokens), value.subscriptions);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
NotificationProperties.TypeBuilder = TypeBuilder;
|
|
49
|
+
NotificationProperties.builder = new TypeBuilder();
|
|
50
|
+
})(NotificationProperties || (exports.NotificationProperties = NotificationProperties = {}));
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PayedState = void 0;
|
|
4
|
+
const typescript_common_functionality_1 = require("@stevenkellner/typescript-common-functionality");
|
|
5
|
+
var PayedState;
|
|
6
|
+
(function (PayedState) {
|
|
7
|
+
PayedState.all = ['payed', 'notPayed'];
|
|
8
|
+
PayedState.builder = new typescript_common_functionality_1.ValueTypeBuilder();
|
|
9
|
+
})(PayedState || (exports.PayedState = PayedState = {}));
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { PersonPrivateProperties } from './PersonPrivateProperties';
|
|
2
|
+
import { PersonSignInProperties } from './PersonSignInProperties';
|
|
3
|
+
import { Fine } from './Fine';
|
|
4
|
+
import { Flattable, Guid, ITypeBuilder, Tagged } from '@stevenkellner/typescript-common-functionality';
|
|
5
|
+
export declare class Person implements Flattable<Person.Flatten> {
|
|
6
|
+
id: Person.Id;
|
|
7
|
+
properties: PersonPrivateProperties;
|
|
8
|
+
fineIds: Fine.Id[];
|
|
9
|
+
signInProperties: PersonSignInProperties | null;
|
|
10
|
+
constructor(id: Person.Id, properties: PersonPrivateProperties, fineIds?: Fine.Id[], signInProperties?: PersonSignInProperties | null);
|
|
11
|
+
get flatten(): Person.Flatten;
|
|
12
|
+
}
|
|
13
|
+
export declare namespace Person {
|
|
14
|
+
type Id = Tagged<Guid, 'person'>;
|
|
15
|
+
namespace Id {
|
|
16
|
+
type Flatten = string;
|
|
17
|
+
const builder: Tagged.TypeBuilder<Guid, "person">;
|
|
18
|
+
}
|
|
19
|
+
type Flatten = {
|
|
20
|
+
id: Id.Flatten;
|
|
21
|
+
properties: PersonPrivateProperties.Flatten;
|
|
22
|
+
fineIds: Fine.Id.Flatten[];
|
|
23
|
+
signInProperties: PersonSignInProperties.Flatten | null;
|
|
24
|
+
};
|
|
25
|
+
class TypeBuilder implements ITypeBuilder<Flatten, Person> {
|
|
26
|
+
build(value: Flatten): Person;
|
|
27
|
+
}
|
|
28
|
+
const builder: TypeBuilder;
|
|
29
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Person = void 0;
|
|
4
|
+
const PersonPrivateProperties_1 = require("./PersonPrivateProperties");
|
|
5
|
+
const PersonSignInProperties_1 = require("./PersonSignInProperties");
|
|
6
|
+
const Fine_1 = require("./Fine");
|
|
7
|
+
const typescript_common_functionality_1 = require("@stevenkellner/typescript-common-functionality");
|
|
8
|
+
class Person {
|
|
9
|
+
id;
|
|
10
|
+
properties;
|
|
11
|
+
fineIds;
|
|
12
|
+
signInProperties;
|
|
13
|
+
constructor(id, properties, fineIds = [], signInProperties = null) {
|
|
14
|
+
this.id = id;
|
|
15
|
+
this.properties = properties;
|
|
16
|
+
this.fineIds = fineIds;
|
|
17
|
+
this.signInProperties = signInProperties;
|
|
18
|
+
}
|
|
19
|
+
get flatten() {
|
|
20
|
+
return {
|
|
21
|
+
id: this.id.flatten,
|
|
22
|
+
properties: this.properties.flatten,
|
|
23
|
+
fineIds: this.fineIds.map(fineId => fineId.flatten),
|
|
24
|
+
signInProperties: this.signInProperties?.flatten ?? null
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
exports.Person = Person;
|
|
29
|
+
(function (Person) {
|
|
30
|
+
let Id;
|
|
31
|
+
(function (Id) {
|
|
32
|
+
Id.builder = typescript_common_functionality_1.Tagged.builder('person', typescript_common_functionality_1.Guid.builder);
|
|
33
|
+
})(Id = Person.Id || (Person.Id = {}));
|
|
34
|
+
class TypeBuilder {
|
|
35
|
+
build(value) {
|
|
36
|
+
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);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
Person.TypeBuilder = TypeBuilder;
|
|
40
|
+
Person.builder = new TypeBuilder();
|
|
41
|
+
})(Person || (exports.Person = Person = {}));
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Flattable, ITypeBuilder } from '@stevenkellner/typescript-common-functionality';
|
|
2
|
+
export declare class PersonPrivateProperties implements Flattable<PersonPrivateProperties.Flatten> {
|
|
3
|
+
firstName: string;
|
|
4
|
+
lastName: string | null;
|
|
5
|
+
constructor(firstName: string, lastName: string | null);
|
|
6
|
+
get flatten(): PersonPrivateProperties.Flatten;
|
|
7
|
+
}
|
|
8
|
+
export declare namespace PersonPrivateProperties {
|
|
9
|
+
type Flatten = {
|
|
10
|
+
firstName: string;
|
|
11
|
+
lastName: string | null;
|
|
12
|
+
};
|
|
13
|
+
class TypeBuilder implements ITypeBuilder<Flatten, PersonPrivateProperties> {
|
|
14
|
+
build(value: Flatten): PersonPrivateProperties;
|
|
15
|
+
}
|
|
16
|
+
const builder: TypeBuilder;
|
|
17
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PersonPrivateProperties = void 0;
|
|
4
|
+
class PersonPrivateProperties {
|
|
5
|
+
firstName;
|
|
6
|
+
lastName;
|
|
7
|
+
constructor(firstName, lastName) {
|
|
8
|
+
this.firstName = firstName;
|
|
9
|
+
this.lastName = lastName;
|
|
10
|
+
}
|
|
11
|
+
get flatten() {
|
|
12
|
+
return {
|
|
13
|
+
firstName: this.firstName,
|
|
14
|
+
lastName: this.lastName
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
exports.PersonPrivateProperties = PersonPrivateProperties;
|
|
19
|
+
(function (PersonPrivateProperties) {
|
|
20
|
+
class TypeBuilder {
|
|
21
|
+
build(value) {
|
|
22
|
+
return new PersonPrivateProperties(value.firstName, value.lastName);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
PersonPrivateProperties.TypeBuilder = TypeBuilder;
|
|
26
|
+
PersonPrivateProperties.builder = new TypeBuilder();
|
|
27
|
+
})(PersonPrivateProperties || (exports.PersonPrivateProperties = PersonPrivateProperties = {}));
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { Flattable, ITypeBuilder, UtcDate } from '@stevenkellner/typescript-common-functionality';
|
|
2
|
+
import { NotificationProperties } from './NotificationProperties';
|
|
3
|
+
import { User } from './User';
|
|
4
|
+
import { UserRole } from './UserRole';
|
|
5
|
+
export declare class PersonSignInProperties implements Flattable<PersonSignInProperties.Flatten> {
|
|
6
|
+
userId: User.Id;
|
|
7
|
+
signInDate: UtcDate;
|
|
8
|
+
notificationProperties: NotificationProperties;
|
|
9
|
+
roles: UserRole[];
|
|
10
|
+
constructor(userId: User.Id, signInDate: UtcDate, notificationProperties?: NotificationProperties, roles?: UserRole[]);
|
|
11
|
+
get flatten(): PersonSignInProperties.Flatten;
|
|
12
|
+
}
|
|
13
|
+
export declare namespace PersonSignInProperties {
|
|
14
|
+
type Flatten = {
|
|
15
|
+
userId: User.Id.Flatten;
|
|
16
|
+
signInDate: UtcDate.Flatten;
|
|
17
|
+
notificationProperties: NotificationProperties.Flatten;
|
|
18
|
+
roles: UserRole[];
|
|
19
|
+
};
|
|
20
|
+
class TypeBuilder implements ITypeBuilder<Flatten, PersonSignInProperties> {
|
|
21
|
+
build(value: Flatten): PersonSignInProperties;
|
|
22
|
+
}
|
|
23
|
+
const builder: TypeBuilder;
|
|
24
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PersonSignInProperties = void 0;
|
|
4
|
+
const typescript_common_functionality_1 = require("@stevenkellner/typescript-common-functionality");
|
|
5
|
+
const NotificationProperties_1 = require("./NotificationProperties");
|
|
6
|
+
const User_1 = require("./User");
|
|
7
|
+
class PersonSignInProperties {
|
|
8
|
+
userId;
|
|
9
|
+
signInDate;
|
|
10
|
+
notificationProperties;
|
|
11
|
+
roles;
|
|
12
|
+
constructor(userId, signInDate, notificationProperties = new NotificationProperties_1.NotificationProperties(), roles = []) {
|
|
13
|
+
this.userId = userId;
|
|
14
|
+
this.signInDate = signInDate;
|
|
15
|
+
this.notificationProperties = notificationProperties;
|
|
16
|
+
this.roles = roles;
|
|
17
|
+
}
|
|
18
|
+
get flatten() {
|
|
19
|
+
return {
|
|
20
|
+
userId: this.userId.flatten,
|
|
21
|
+
signInDate: this.signInDate.flatten,
|
|
22
|
+
notificationProperties: this.notificationProperties.flatten,
|
|
23
|
+
roles: this.roles
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
exports.PersonSignInProperties = PersonSignInProperties;
|
|
28
|
+
(function (PersonSignInProperties) {
|
|
29
|
+
class TypeBuilder {
|
|
30
|
+
build(value) {
|
|
31
|
+
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
|
+
}
|
|
33
|
+
}
|
|
34
|
+
PersonSignInProperties.TypeBuilder = TypeBuilder;
|
|
35
|
+
PersonSignInProperties.builder = new TypeBuilder();
|
|
36
|
+
})(PersonSignInProperties || (exports.PersonSignInProperties = PersonSignInProperties = {}));
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { Flattable, Guid, ITypeBuilder, Tagged } from '@stevenkellner/typescript-common-functionality';
|
|
2
|
+
export declare class Team implements Flattable<Team.Flatten> {
|
|
3
|
+
id: Team.Id;
|
|
4
|
+
name: string;
|
|
5
|
+
paypalMeLink: string | null;
|
|
6
|
+
constructor(id: Team.Id, name: string, paypalMeLink: string | null);
|
|
7
|
+
get flatten(): Team.Flatten;
|
|
8
|
+
}
|
|
9
|
+
export declare namespace Team {
|
|
10
|
+
type Id = Tagged<Guid, 'team'>;
|
|
11
|
+
namespace Id {
|
|
12
|
+
type Flatten = string;
|
|
13
|
+
const builder: Tagged.TypeBuilder<Guid, "team">;
|
|
14
|
+
}
|
|
15
|
+
type Flatten = {
|
|
16
|
+
id: Id.Flatten;
|
|
17
|
+
name: string;
|
|
18
|
+
paypalMeLink: string | null;
|
|
19
|
+
};
|
|
20
|
+
class TypeBuilder implements ITypeBuilder<Flatten, Team> {
|
|
21
|
+
build(value: Flatten): Team;
|
|
22
|
+
}
|
|
23
|
+
const builder: TypeBuilder;
|
|
24
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
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
|
+
class Team {
|
|
6
|
+
id;
|
|
7
|
+
name;
|
|
8
|
+
paypalMeLink;
|
|
9
|
+
constructor(id, name, paypalMeLink) {
|
|
10
|
+
this.id = id;
|
|
11
|
+
this.name = name;
|
|
12
|
+
this.paypalMeLink = paypalMeLink;
|
|
13
|
+
}
|
|
14
|
+
get flatten() {
|
|
15
|
+
return {
|
|
16
|
+
id: this.id.flatten,
|
|
17
|
+
name: this.name,
|
|
18
|
+
paypalMeLink: this.paypalMeLink
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
exports.Team = Team;
|
|
23
|
+
(function (Team) {
|
|
24
|
+
let Id;
|
|
25
|
+
(function (Id) {
|
|
26
|
+
Id.builder = typescript_common_functionality_1.Tagged.builder('team', typescript_common_functionality_1.Guid.builder);
|
|
27
|
+
})(Id = Team.Id || (Team.Id = {}));
|
|
28
|
+
class TypeBuilder {
|
|
29
|
+
build(value) {
|
|
30
|
+
return new Team(Id.builder.build(value.id), value.name, value.paypalMeLink);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
Team.TypeBuilder = TypeBuilder;
|
|
34
|
+
Team.builder = new TypeBuilder();
|
|
35
|
+
})(Team || (exports.Team = Team = {}));
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { Dictionary, Flattable, ITypeBuilder, Tagged } from '@stevenkellner/typescript-common-functionality';
|
|
2
|
+
import { Team } from './Team';
|
|
3
|
+
import { Person } from './Person';
|
|
4
|
+
export declare class User implements Flattable<User.Flatten> {
|
|
5
|
+
id: User.Id;
|
|
6
|
+
teams: Dictionary<Team.Id, User.TeamProperties>;
|
|
7
|
+
constructor(id: User.Id, teams?: Dictionary<Team.Id, User.TeamProperties>);
|
|
8
|
+
get flatten(): User.Flatten;
|
|
9
|
+
}
|
|
10
|
+
export declare namespace User {
|
|
11
|
+
type Id = Tagged<string, 'user'>;
|
|
12
|
+
namespace Id {
|
|
13
|
+
type Flatten = string;
|
|
14
|
+
const builder: Tagged.TypeBuilder<string, "user">;
|
|
15
|
+
}
|
|
16
|
+
class TeamProperties implements Flattable<TeamProperties.Flatten> {
|
|
17
|
+
name: string;
|
|
18
|
+
personId: Person.Id;
|
|
19
|
+
constructor(name: string, personId: Person.Id);
|
|
20
|
+
get flatten(): TeamProperties.Flatten;
|
|
21
|
+
}
|
|
22
|
+
namespace TeamProperties {
|
|
23
|
+
type Flatten = {
|
|
24
|
+
name: string;
|
|
25
|
+
personId: Person.Id.Flatten;
|
|
26
|
+
};
|
|
27
|
+
class TypeBuilder implements ITypeBuilder<Flatten, TeamProperties> {
|
|
28
|
+
build(value: Flatten): TeamProperties;
|
|
29
|
+
}
|
|
30
|
+
const builder: TypeBuilder;
|
|
31
|
+
}
|
|
32
|
+
type Flatten = {
|
|
33
|
+
id: Id.Flatten;
|
|
34
|
+
teams: Dictionary.Flatten<TeamProperties>;
|
|
35
|
+
};
|
|
36
|
+
class TypeBuilder implements ITypeBuilder<Flatten, User> {
|
|
37
|
+
build(value: Flatten): User;
|
|
38
|
+
}
|
|
39
|
+
const builder: TypeBuilder;
|
|
40
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
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
|
+
class User {
|
|
8
|
+
id;
|
|
9
|
+
teams;
|
|
10
|
+
constructor(id, teams = new typescript_common_functionality_1.Dictionary(Team_1.Team.Id.builder)) {
|
|
11
|
+
this.id = id;
|
|
12
|
+
this.teams = teams;
|
|
13
|
+
}
|
|
14
|
+
get flatten() {
|
|
15
|
+
return {
|
|
16
|
+
id: this.id.flatten,
|
|
17
|
+
teams: this.teams.flatten
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
exports.User = User;
|
|
22
|
+
(function (User) {
|
|
23
|
+
let Id;
|
|
24
|
+
(function (Id) {
|
|
25
|
+
Id.builder = typescript_common_functionality_1.Tagged.builder('user', new typescript_common_functionality_1.ValueTypeBuilder());
|
|
26
|
+
})(Id = User.Id || (User.Id = {}));
|
|
27
|
+
class TeamProperties {
|
|
28
|
+
name;
|
|
29
|
+
personId;
|
|
30
|
+
constructor(name, personId) {
|
|
31
|
+
this.name = name;
|
|
32
|
+
this.personId = personId;
|
|
33
|
+
}
|
|
34
|
+
get flatten() {
|
|
35
|
+
return {
|
|
36
|
+
name: this.name,
|
|
37
|
+
personId: this.personId.flatten
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
User.TeamProperties = TeamProperties;
|
|
42
|
+
(function (TeamProperties) {
|
|
43
|
+
class TypeBuilder {
|
|
44
|
+
build(value) {
|
|
45
|
+
return new TeamProperties(value.name, Person_1.Person.Id.builder.build(value.personId));
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
TeamProperties.TypeBuilder = TypeBuilder;
|
|
49
|
+
TeamProperties.builder = new TypeBuilder();
|
|
50
|
+
})(TeamProperties = User.TeamProperties || (User.TeamProperties = {}));
|
|
51
|
+
class TypeBuilder {
|
|
52
|
+
build(value) {
|
|
53
|
+
return new User(Id.builder.build(value.id), typescript_common_functionality_1.Dictionary.builder(Team_1.Team.Id.builder, User.TeamProperties.builder).build(value.teams));
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
User.TypeBuilder = TypeBuilder;
|
|
57
|
+
User.builder = new TypeBuilder();
|
|
58
|
+
})(User || (exports.User = User = {}));
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { ValueTypeBuilder } from '@stevenkellner/typescript-common-functionality';
|
|
2
|
+
export type UserRole = 'person-manager' | 'fineTemplate-manager' | 'fine-manager' | 'team-manager';
|
|
3
|
+
export declare namespace UserRole {
|
|
4
|
+
const all: UserRole[];
|
|
5
|
+
const builder: ValueTypeBuilder<UserRole>;
|
|
6
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.UserRole = void 0;
|
|
4
|
+
const typescript_common_functionality_1 = require("@stevenkellner/typescript-common-functionality");
|
|
5
|
+
var UserRole;
|
|
6
|
+
(function (UserRole) {
|
|
7
|
+
UserRole.all = [
|
|
8
|
+
'person-manager',
|
|
9
|
+
'fineTemplate-manager',
|
|
10
|
+
'fine-manager',
|
|
11
|
+
'team-manager'
|
|
12
|
+
];
|
|
13
|
+
UserRole.builder = new typescript_common_functionality_1.ValueTypeBuilder();
|
|
14
|
+
})(UserRole || (exports.UserRole = UserRole = {}));
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./Configuration"), exports);
|
|
18
|
+
__exportStar(require("./Fine"), exports);
|
|
19
|
+
__exportStar(require("./FineAmount"), exports);
|
|
20
|
+
__exportStar(require("./FineTemplate"), exports);
|
|
21
|
+
__exportStar(require("./FineTemplateRepetition"), exports);
|
|
22
|
+
__exportStar(require("./Invitation"), exports);
|
|
23
|
+
__exportStar(require("./MoneyAmount"), exports);
|
|
24
|
+
__exportStar(require("./NotificationProperties"), exports);
|
|
25
|
+
__exportStar(require("./PayedState"), exports);
|
|
26
|
+
__exportStar(require("./Person"), exports);
|
|
27
|
+
__exportStar(require("./PersonPrivateProperties"), exports);
|
|
28
|
+
__exportStar(require("./PersonSignInProperties"), exports);
|
|
29
|
+
__exportStar(require("./Team"), exports);
|
|
30
|
+
__exportStar(require("./User"), exports);
|
|
31
|
+
__exportStar(require("./UserRole"), exports);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"root":["../index.ts","../src/Firestore.ts","../src/FirestoreScheme.ts","../src/checkAuthentication.ts","../src/firebaseFunctionCreators.ts","../src/pushNotification.ts","../src/firebase/FirebaseConfiguration.ts","../src/firebase/Messaging.ts","../src/firebase/index.ts","../src/functions/fine/add.ts","../src/functions/fine/delete.ts","../src/functions/fine/update.ts","../src/functions/fineTemplate/add.ts","../src/functions/fineTemplate/delete.ts","../src/functions/fineTemplate/update.ts","../src/functions/invitation/invite.ts","../src/functions/invitation/register.ts","../src/functions/invitation/withdraw.ts","../src/functions/notification/register.ts","../src/functions/notification/subscribe.ts","../src/functions/paypalMe/edit.ts","../src/functions/person/add.ts","../src/functions/person/delete.ts","../src/functions/person/update.ts","../src/functions/team/new.ts","../src/functions/user/login.ts","../src/functions/user/roleEdit.ts","../src/types/Configuration.ts","../src/types/Fine.ts","../src/types/FineAmount.ts","../src/types/FineTemplate.ts","../src/types/FineTemplateRepetition.ts","../src/types/Invitation.ts","../src/types/MoneyAmount.ts","../src/types/NotificationProperties.ts","../src/types/PayedState.ts","../src/types/Person.ts","../src/types/PersonPrivateProperties.ts","../src/types/PersonSignInProperties.ts","../src/types/Team.ts","../src/types/User.ts","../src/types/UserRole.ts","../src/types/index.ts"],"version":"5.8.3"}
|
package/package.json
CHANGED
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stevenkellner/team-conduct-api",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.5",
|
|
4
4
|
"description": "Firebase API for Team Conduct",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Steven Kellner",
|
|
7
7
|
"main": "lib/index.js",
|
|
8
8
|
"types": "lib/index.d.ts",
|
|
9
|
+
"files": [
|
|
10
|
+
"lib/**/*"
|
|
11
|
+
],
|
|
9
12
|
"scripts": {
|
|
10
13
|
"build": "tsc",
|
|
11
14
|
"rebuild": "tsc --build --force",
|