90dc-core 1.3.1 → 1.4.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/dist/index.js +2 -0
- package/dist/lib/Errors/Errors.d.ts +20 -0
- package/dist/lib/Errors/Errors.js +42 -0
- package/dist/lib/Errors/Errors.js.map +1 -0
- package/dist/lib/dbmodels/PersistedUser.d.ts +2 -1
- package/dist/lib/dbmodels/PersistedUser.js +119 -65
- package/dist/lib/dbmodels/PersistedUser.js.map +1 -1
- package/dist/lib/dbmodels/UsersFriends.js +13 -15
- package/dist/lib/models/BlueprintInterfaces.js +3 -1
- package/dist/lib/models/ExerciseInterfaces.js +3 -1
- package/dist/lib/models/ProgramInterfaces.js +3 -1
- package/dist/lib/models/UserInterfaces.d.ts +78 -0
- package/dist/lib/models/UserInterfaces.js +3 -1
- package/dist/lib/models/UserInterfaces.js.map +1 -1
- package/dist/lib/models/WorkoutInterfaces.js +3 -1
- package/dist/lib/utils/AuthenticationUtil.d.ts +18 -0
- package/dist/lib/utils/AuthenticationUtil.js +265 -0
- package/dist/lib/utils/AuthenticationUtil.js.map +1 -0
- package/dist/lib/utils/Logger.js +5 -6
- package/package.json +6 -2
- package/src/lib/Errors/Errors.ts +49 -0
- package/src/lib/dbmodels/PersistedUser.ts +2 -1
- package/src/lib/models/UserInterfaces.ts +90 -0
- package/src/lib/utils/AuthenticationUtil.ts +366 -0
package/dist/index.js
CHANGED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export declare class ExerciseNotFound extends Error {
|
|
2
|
+
error: {};
|
|
3
|
+
constructor(message: object);
|
|
4
|
+
}
|
|
5
|
+
export declare class ExerciseAlreadyUsed extends Error {
|
|
6
|
+
error: {};
|
|
7
|
+
constructor(message: object);
|
|
8
|
+
}
|
|
9
|
+
export declare class AppleTransactionError extends Error {
|
|
10
|
+
error: {};
|
|
11
|
+
constructor(message: string);
|
|
12
|
+
}
|
|
13
|
+
export declare class ProgramNotFound extends Error {
|
|
14
|
+
error: {};
|
|
15
|
+
constructor(message: object);
|
|
16
|
+
}
|
|
17
|
+
export declare class NotificationNotSent extends Error {
|
|
18
|
+
error: {};
|
|
19
|
+
constructor(message: object);
|
|
20
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
export class ExerciseNotFound extends Error {
|
|
2
|
+
error = {};
|
|
3
|
+
constructor(message){
|
|
4
|
+
super();
|
|
5
|
+
this.error = message;
|
|
6
|
+
Object.setPrototypeOf(this, ExerciseNotFound.prototype);
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
export class ExerciseAlreadyUsed extends Error {
|
|
10
|
+
error = {};
|
|
11
|
+
constructor(message){
|
|
12
|
+
super();
|
|
13
|
+
this.error = message;
|
|
14
|
+
Object.setPrototypeOf(this, ExerciseNotFound.prototype);
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
export class AppleTransactionError extends Error {
|
|
18
|
+
error = {};
|
|
19
|
+
constructor(message){
|
|
20
|
+
super();
|
|
21
|
+
this.error = message;
|
|
22
|
+
Object.setPrototypeOf(this, AppleTransactionError.prototype);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
export class ProgramNotFound extends Error {
|
|
26
|
+
error = {};
|
|
27
|
+
constructor(message){
|
|
28
|
+
super();
|
|
29
|
+
this.error = message;
|
|
30
|
+
Object.setPrototypeOf(this, ProgramNotFound.prototype);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
export class NotificationNotSent extends Error {
|
|
34
|
+
error = {};
|
|
35
|
+
constructor(message){
|
|
36
|
+
super();
|
|
37
|
+
this.error = message;
|
|
38
|
+
Object.setPrototypeOf(this, NotificationNotSent.prototype);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
//# sourceMappingURL=Errors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/lib/Errors/Errors.ts"],"sourcesContent":["export class ExerciseNotFound extends Error {\n error = {};\n\n constructor(message: object) {\n super();\n this.error = message;\n Object.setPrototypeOf(this, ExerciseNotFound.prototype);\n }\n}\n\nexport class ExerciseAlreadyUsed extends Error {\n error = {};\n\n constructor(message: object) {\n super();\n this.error = message;\n Object.setPrototypeOf(this, ExerciseNotFound.prototype);\n }\n}\n\nexport class AppleTransactionError extends Error {\n error = {};\n\n constructor(message: string) {\n super();\n this.error = message;\n Object.setPrototypeOf(this, AppleTransactionError.prototype);\n }\n}\n\nexport class ProgramNotFound extends Error {\n error = {};\n\n constructor(message: object) {\n super();\n this.error = message;\n Object.setPrototypeOf(this, ProgramNotFound.prototype);\n }\n}\n\nexport class NotificationNotSent extends Error {\n error = {};\n\n constructor(message: object) {\n super();\n this.error = message;\n Object.setPrototypeOf(this, NotificationNotSent.prototype);\n }\n}\n"],"names":["ExerciseNotFound","Error","error","constructor","message","Object","setPrototypeOf","prototype","ExerciseAlreadyUsed","AppleTransactionError","ProgramNotFound","NotificationNotSent"],"mappings":"AAAA,OAAO,MAAMA,yBAAyBC;IACpCC,QAAQ,CAAC,EAAE;IAEXC,YAAYC,OAAe,CAAE;QAC3B,KAAK;QACL,IAAI,CAACF,KAAK,GAAGE;QACbC,OAAOC,cAAc,CAAC,IAAI,EAAEN,iBAAiBO,SAAS;IACxD;AACF,CAAC;AAED,OAAO,MAAMC,4BAA4BP;IACvCC,QAAQ,CAAC,EAAE;IAEXC,YAAYC,OAAe,CAAE;QAC3B,KAAK;QACL,IAAI,CAACF,KAAK,GAAGE;QACbC,OAAOC,cAAc,CAAC,IAAI,EAAEN,iBAAiBO,SAAS;IACxD;AACF,CAAC;AAED,OAAO,MAAME,8BAA8BR;IACzCC,QAAQ,CAAC,EAAE;IAEXC,YAAYC,OAAe,CAAE;QAC3B,KAAK;QACL,IAAI,CAACF,KAAK,GAAGE;QACbC,OAAOC,cAAc,CAAC,IAAI,EAAEG,sBAAsBF,SAAS;IAC7D;AACF,CAAC;AAED,OAAO,MAAMG,wBAAwBT;IACnCC,QAAQ,CAAC,EAAE;IAEXC,YAAYC,OAAe,CAAE;QAC3B,KAAK;QACL,IAAI,CAACF,KAAK,GAAGE;QACbC,OAAOC,cAAc,CAAC,IAAI,EAAEI,gBAAgBH,SAAS;IACvD;AACF,CAAC;AAED,OAAO,MAAMI,4BAA4BV;IACvCC,QAAQ,CAAC,EAAE;IAEXC,YAAYC,OAAe,CAAE;QAC3B,KAAK;QACL,IAAI,CAACF,KAAK,GAAGE;QACbC,OAAOC,cAAc,CAAC,IAAI,EAAEK,oBAAoBJ,SAAS;IAC3D;AACF,CAAC"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Model } from "sequelize-typescript";
|
|
2
|
+
import type { Subscription } from "../models/UserInterfaces";
|
|
2
3
|
export declare class PersistedUser extends Model {
|
|
3
4
|
userUuid: string;
|
|
4
5
|
email: string;
|
|
@@ -28,5 +29,5 @@ export declare class PersistedUser extends Model {
|
|
|
28
29
|
utilityEmailConfirmed: boolean;
|
|
29
30
|
changeEmail: boolean;
|
|
30
31
|
changeUtilityEmail: boolean;
|
|
31
|
-
subscription:
|
|
32
|
+
subscription: Subscription;
|
|
32
33
|
}
|
|
@@ -1,14 +1,11 @@
|
|
|
1
|
-
var __decorate =
|
|
1
|
+
var __decorate = this && this.__decorate || function(decorators, target, key, desc) {
|
|
2
2
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
3
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
-
else for
|
|
4
|
+
else for(var i = decorators.length - 1; i >= 0; i--)if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
5
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
6
|
};
|
|
7
|
-
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
8
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
9
|
-
};
|
|
10
7
|
import { Column, DataType, Default, Index, Model, Table } from "sequelize-typescript";
|
|
11
|
-
let PersistedUser = class PersistedUser extends Model {
|
|
8
|
+
export let PersistedUser = class PersistedUser extends Model {
|
|
12
9
|
};
|
|
13
10
|
__decorate([
|
|
14
11
|
Default(DataType.UUIDV4),
|
|
@@ -17,123 +14,180 @@ __decorate([
|
|
|
17
14
|
defaultValue: DataType.UUID,
|
|
18
15
|
allowNull: false,
|
|
19
16
|
primaryKey: true
|
|
20
|
-
})
|
|
21
|
-
__metadata("design:type", String)
|
|
17
|
+
})
|
|
22
18
|
], PersistedUser.prototype, "userUuid", void 0);
|
|
23
19
|
__decorate([
|
|
24
20
|
Index,
|
|
25
|
-
Column({
|
|
26
|
-
|
|
21
|
+
Column({
|
|
22
|
+
type: DataType.TEXT,
|
|
23
|
+
allowNull: false,
|
|
24
|
+
unique: false
|
|
25
|
+
})
|
|
27
26
|
], PersistedUser.prototype, "email", void 0);
|
|
28
27
|
__decorate([
|
|
29
|
-
Column({
|
|
30
|
-
|
|
28
|
+
Column({
|
|
29
|
+
type: DataType.TEXT,
|
|
30
|
+
allowNull: false
|
|
31
|
+
})
|
|
31
32
|
], PersistedUser.prototype, "password", void 0);
|
|
32
33
|
__decorate([
|
|
33
|
-
Column({
|
|
34
|
-
|
|
34
|
+
Column({
|
|
35
|
+
type: DataType.TEXT,
|
|
36
|
+
allowNull: true
|
|
37
|
+
})
|
|
35
38
|
], PersistedUser.prototype, "firstName", void 0);
|
|
36
39
|
__decorate([
|
|
37
|
-
Column({
|
|
38
|
-
|
|
40
|
+
Column({
|
|
41
|
+
type: DataType.TEXT,
|
|
42
|
+
allowNull: true
|
|
43
|
+
})
|
|
39
44
|
], PersistedUser.prototype, "lastName", void 0);
|
|
40
45
|
__decorate([
|
|
41
|
-
Column({
|
|
42
|
-
|
|
46
|
+
Column({
|
|
47
|
+
type: DataType.TEXT,
|
|
48
|
+
allowNull: true
|
|
49
|
+
})
|
|
43
50
|
], PersistedUser.prototype, "avatar", void 0);
|
|
44
51
|
__decorate([
|
|
45
|
-
Column({
|
|
46
|
-
|
|
52
|
+
Column({
|
|
53
|
+
type: DataType.TEXT,
|
|
54
|
+
allowNull: true
|
|
55
|
+
})
|
|
47
56
|
], PersistedUser.prototype, "sex", void 0);
|
|
48
57
|
__decorate([
|
|
49
|
-
Column({
|
|
50
|
-
|
|
58
|
+
Column({
|
|
59
|
+
type: DataType.TEXT,
|
|
60
|
+
allowNull: true
|
|
61
|
+
})
|
|
51
62
|
], PersistedUser.prototype, "goal", void 0);
|
|
52
63
|
__decorate([
|
|
53
|
-
Column({
|
|
54
|
-
|
|
64
|
+
Column({
|
|
65
|
+
type: DataType.BOOLEAN,
|
|
66
|
+
allowNull: true
|
|
67
|
+
})
|
|
55
68
|
], PersistedUser.prototype, "isFreeVersion", void 0);
|
|
56
69
|
__decorate([
|
|
57
|
-
Column({
|
|
58
|
-
|
|
70
|
+
Column({
|
|
71
|
+
type: DataType.BOOLEAN,
|
|
72
|
+
allowNull: true
|
|
73
|
+
})
|
|
59
74
|
], PersistedUser.prototype, "allowsEmail", void 0);
|
|
60
75
|
__decorate([
|
|
61
|
-
Column({
|
|
62
|
-
|
|
76
|
+
Column({
|
|
77
|
+
type: DataType.BOOLEAN,
|
|
78
|
+
allowNull: true
|
|
79
|
+
})
|
|
63
80
|
], PersistedUser.prototype, "gotParentalConsent", void 0);
|
|
64
81
|
__decorate([
|
|
65
|
-
Column({
|
|
66
|
-
|
|
82
|
+
Column({
|
|
83
|
+
type: DataType.TEXT,
|
|
84
|
+
allowNull: true
|
|
85
|
+
})
|
|
67
86
|
], PersistedUser.prototype, "weightGoal", void 0);
|
|
68
87
|
__decorate([
|
|
69
|
-
Column({
|
|
70
|
-
|
|
88
|
+
Column({
|
|
89
|
+
type: DataType.TEXT,
|
|
90
|
+
allowNull: true
|
|
91
|
+
})
|
|
71
92
|
], PersistedUser.prototype, "role", void 0);
|
|
72
93
|
__decorate([
|
|
73
|
-
Column({
|
|
74
|
-
|
|
94
|
+
Column({
|
|
95
|
+
type: DataType.TEXT,
|
|
96
|
+
allowNull: true
|
|
97
|
+
})
|
|
75
98
|
], PersistedUser.prototype, "level", void 0);
|
|
76
99
|
__decorate([
|
|
77
|
-
Column({
|
|
78
|
-
|
|
100
|
+
Column({
|
|
101
|
+
type: DataType.TEXT,
|
|
102
|
+
allowNull: true
|
|
103
|
+
})
|
|
79
104
|
], PersistedUser.prototype, "type", void 0);
|
|
80
105
|
__decorate([
|
|
81
|
-
Column({
|
|
82
|
-
|
|
106
|
+
Column({
|
|
107
|
+
type: DataType.TEXT,
|
|
108
|
+
allowNull: true
|
|
109
|
+
})
|
|
83
110
|
], PersistedUser.prototype, "days", void 0);
|
|
84
111
|
__decorate([
|
|
85
|
-
Column({
|
|
86
|
-
|
|
112
|
+
Column({
|
|
113
|
+
type: DataType.TEXT,
|
|
114
|
+
allowNull: true
|
|
115
|
+
})
|
|
87
116
|
], PersistedUser.prototype, "dateOfBirth", void 0);
|
|
88
117
|
__decorate([
|
|
89
|
-
Column({
|
|
90
|
-
|
|
118
|
+
Column({
|
|
119
|
+
type: DataType.TEXT,
|
|
120
|
+
allowNull: true
|
|
121
|
+
})
|
|
91
122
|
], PersistedUser.prototype, "metricSystem", void 0);
|
|
92
123
|
__decorate([
|
|
93
|
-
Column({
|
|
94
|
-
|
|
124
|
+
Column({
|
|
125
|
+
type: DataType.TEXT,
|
|
126
|
+
allowNull: true
|
|
127
|
+
})
|
|
95
128
|
], PersistedUser.prototype, "height", void 0);
|
|
96
129
|
__decorate([
|
|
97
|
-
Column({
|
|
98
|
-
|
|
130
|
+
Column({
|
|
131
|
+
type: DataType.TEXT,
|
|
132
|
+
allowNull: true
|
|
133
|
+
})
|
|
99
134
|
], PersistedUser.prototype, "weight", void 0);
|
|
100
135
|
__decorate([
|
|
101
|
-
Column({
|
|
102
|
-
|
|
136
|
+
Column({
|
|
137
|
+
type: DataType.TEXT,
|
|
138
|
+
allowNull: true
|
|
139
|
+
})
|
|
103
140
|
], PersistedUser.prototype, "activeProgramId", void 0);
|
|
104
141
|
__decorate([
|
|
105
|
-
Column({
|
|
106
|
-
|
|
142
|
+
Column({
|
|
143
|
+
type: DataType.TEXT,
|
|
144
|
+
allowNull: true
|
|
145
|
+
})
|
|
107
146
|
], PersistedUser.prototype, "registrationDate", void 0);
|
|
108
147
|
__decorate([
|
|
109
|
-
Column({
|
|
110
|
-
|
|
148
|
+
Column({
|
|
149
|
+
type: DataType.TEXT,
|
|
150
|
+
allowNull: true
|
|
151
|
+
})
|
|
111
152
|
], PersistedUser.prototype, "registrationService", void 0);
|
|
112
153
|
__decorate([
|
|
113
|
-
Column({
|
|
114
|
-
|
|
154
|
+
Column({
|
|
155
|
+
type: DataType.TEXT,
|
|
156
|
+
allowNull: true
|
|
157
|
+
})
|
|
115
158
|
], PersistedUser.prototype, "utilityEmail", void 0);
|
|
116
159
|
__decorate([
|
|
117
|
-
Column({
|
|
118
|
-
|
|
160
|
+
Column({
|
|
161
|
+
type: DataType.BOOLEAN,
|
|
162
|
+
allowNull: true
|
|
163
|
+
})
|
|
119
164
|
], PersistedUser.prototype, "emailConfirmed", void 0);
|
|
120
165
|
__decorate([
|
|
121
|
-
Column({
|
|
122
|
-
|
|
166
|
+
Column({
|
|
167
|
+
type: DataType.BOOLEAN,
|
|
168
|
+
allowNull: true
|
|
169
|
+
})
|
|
123
170
|
], PersistedUser.prototype, "utilityEmailConfirmed", void 0);
|
|
124
171
|
__decorate([
|
|
125
|
-
Column({
|
|
126
|
-
|
|
172
|
+
Column({
|
|
173
|
+
type: DataType.BOOLEAN,
|
|
174
|
+
allowNull: true
|
|
175
|
+
})
|
|
127
176
|
], PersistedUser.prototype, "changeEmail", void 0);
|
|
128
177
|
__decorate([
|
|
129
|
-
Column({
|
|
130
|
-
|
|
178
|
+
Column({
|
|
179
|
+
type: DataType.BOOLEAN,
|
|
180
|
+
allowNull: true
|
|
181
|
+
})
|
|
131
182
|
], PersistedUser.prototype, "changeUtilityEmail", void 0);
|
|
132
183
|
__decorate([
|
|
133
|
-
Column({
|
|
134
|
-
|
|
184
|
+
Column({
|
|
185
|
+
type: DataType.JSONB,
|
|
186
|
+
allowNull: true
|
|
187
|
+
})
|
|
135
188
|
], PersistedUser.prototype, "subscription", void 0);
|
|
136
189
|
PersistedUser = __decorate([
|
|
137
190
|
Table
|
|
138
191
|
], PersistedUser);
|
|
139
|
-
|
|
192
|
+
|
|
193
|
+
//# sourceMappingURL=PersistedUser.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/lib/dbmodels/PersistedUser.ts"],"sourcesContent":["import { Column, DataType, Default, Index, Model, Table } from \"sequelize-typescript\";\n\n@Table\nexport class PersistedUser extends Model {\n\n @Default(DataType.UUIDV4)\n @Column({\n type: DataType.UUID,\n defaultValue: DataType.UUID,\n allowNull: false,\n primaryKey: true\n })\n declare userUuid: string;\n\n @Index\n @Column({ type: DataType.TEXT, allowNull: false, unique: false })\n declare email: string;\n\n @Column({ type: DataType.TEXT, allowNull: false })\n declare password: string;\n\n @Column({ type: DataType.TEXT, allowNull: true })\n declare firstName?: string;\n\n @Column({ type: DataType.TEXT, allowNull: true })\n declare lastName?: string;\n\n @Column({ type: DataType.TEXT, allowNull: true })\n declare avatar: string;\n\n @Column({ type: DataType.TEXT, allowNull: true })\n declare sex: string;\n\n @Column({ type: DataType.TEXT, allowNull: true })\n declare goal: string;\n\n @Column({ type: DataType.BOOLEAN, allowNull: true })\n declare isFreeVersion: boolean;\n\n @Column({ type: DataType.BOOLEAN, allowNull: true })\n declare allowsEmail: boolean;\n\n @Column({ type: DataType.BOOLEAN, allowNull: true })\n declare gotParentalConsent: boolean;\n\n @Column({ type: DataType.TEXT, allowNull: true })\n declare weightGoal: string;\n\n @Column({ type: DataType.TEXT, allowNull: true })\n declare role: 'default' | 'admin';\n\n @Column({ type: DataType.TEXT, allowNull: true })\n declare level: string;\n\n @Column({ type: DataType.TEXT, allowNull: true })\n declare type: string;\n\n @Column({ type: DataType.TEXT, allowNull: true })\n declare days: number;\n\n @Column({ type: DataType.TEXT, allowNull: true })\n declare dateOfBirth: string;\n\n @Column({ type: DataType.TEXT, allowNull: true })\n declare metricSystem: string;\n\n @Column({ type: DataType.TEXT, allowNull: true })\n declare height: string;\n\n @Column({ type: DataType.TEXT, allowNull: true })\n declare weight: string;\n\n @Column({ type: DataType.TEXT, allowNull: true })\n declare activeProgramId: string;\n\n @Column({ type: DataType.TEXT, allowNull: true })\n declare registrationDate: string;\n\n @Column({ type: DataType.TEXT, allowNull: true })\n declare registrationService: 'apple' | 'google' | 'facebook' | 'native';\n\n @Column({ type: DataType.TEXT, allowNull: true })\n declare utilityEmail: string;\n\n @Column({ type: DataType.BOOLEAN, allowNull: true })\n declare emailConfirmed: boolean;\n\n @Column({ type: DataType.BOOLEAN, allowNull: true })\n declare utilityEmailConfirmed: boolean;\n\n @Column({ type: DataType.BOOLEAN, allowNull: true })\n declare changeEmail: boolean;\n\n @Column({ type: DataType.BOOLEAN, allowNull: true })\n declare changeUtilityEmail: boolean;\n\n @Column({ type: DataType.JSONB, allowNull: true })\n declare subscription:
|
|
1
|
+
{"version":3,"sources":["../../../src/lib/dbmodels/PersistedUser.ts"],"sourcesContent":["import { Column, DataType, Default, Index, Model, Table } from \"sequelize-typescript\";\nimport type { Subscription } from \"../models/UserInterfaces\";\n\n@Table\nexport class PersistedUser extends Model {\n\n @Default(DataType.UUIDV4)\n @Column({\n type: DataType.UUID,\n defaultValue: DataType.UUID,\n allowNull: false,\n primaryKey: true\n })\n declare userUuid: string;\n\n @Index\n @Column({ type: DataType.TEXT, allowNull: false, unique: false })\n declare email: string;\n\n @Column({ type: DataType.TEXT, allowNull: false })\n declare password: string;\n\n @Column({ type: DataType.TEXT, allowNull: true })\n declare firstName?: string;\n\n @Column({ type: DataType.TEXT, allowNull: true })\n declare lastName?: string;\n\n @Column({ type: DataType.TEXT, allowNull: true })\n declare avatar: string;\n\n @Column({ type: DataType.TEXT, allowNull: true })\n declare sex: string;\n\n @Column({ type: DataType.TEXT, allowNull: true })\n declare goal: string;\n\n @Column({ type: DataType.BOOLEAN, allowNull: true })\n declare isFreeVersion: boolean;\n\n @Column({ type: DataType.BOOLEAN, allowNull: true })\n declare allowsEmail: boolean;\n\n @Column({ type: DataType.BOOLEAN, allowNull: true })\n declare gotParentalConsent: boolean;\n\n @Column({ type: DataType.TEXT, allowNull: true })\n declare weightGoal: string;\n\n @Column({ type: DataType.TEXT, allowNull: true })\n declare role: 'default' | 'admin';\n\n @Column({ type: DataType.TEXT, allowNull: true })\n declare level: string;\n\n @Column({ type: DataType.TEXT, allowNull: true })\n declare type: string;\n\n @Column({ type: DataType.TEXT, allowNull: true })\n declare days: number;\n\n @Column({ type: DataType.TEXT, allowNull: true })\n declare dateOfBirth: string;\n\n @Column({ type: DataType.TEXT, allowNull: true })\n declare metricSystem: string;\n\n @Column({ type: DataType.TEXT, allowNull: true })\n declare height: string;\n\n @Column({ type: DataType.TEXT, allowNull: true })\n declare weight: string;\n\n @Column({ type: DataType.TEXT, allowNull: true })\n declare activeProgramId: string;\n\n @Column({ type: DataType.TEXT, allowNull: true })\n declare registrationDate: string;\n\n @Column({ type: DataType.TEXT, allowNull: true })\n declare registrationService: 'apple' | 'google' | 'facebook' | 'native';\n\n @Column({ type: DataType.TEXT, allowNull: true })\n declare utilityEmail: string;\n\n @Column({ type: DataType.BOOLEAN, allowNull: true })\n declare emailConfirmed: boolean;\n\n @Column({ type: DataType.BOOLEAN, allowNull: true })\n declare utilityEmailConfirmed: boolean;\n\n @Column({ type: DataType.BOOLEAN, allowNull: true })\n declare changeEmail: boolean;\n\n @Column({ type: DataType.BOOLEAN, allowNull: true })\n declare changeUtilityEmail: boolean;\n\n @Column({ type: DataType.JSONB, allowNull: true })\n declare subscription: Subscription;\n\n}\n"],"names":["Column","DataType","Default","Index","Model","Table","PersistedUser","UUIDV4","type","UUID","def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AAW,IAAI;IAAC;GA1FvCL;;IA6FVN,OAAO;QAAEQ,MAAMP,SAASe,KAAK;QAAEL,WAAW,IAAI;IAAC;GA7FrCL;AAAAA;IADZD;GACYC"}
|
|
@@ -1,34 +1,32 @@
|
|
|
1
|
-
var __decorate =
|
|
1
|
+
var __decorate = this && this.__decorate || function(decorators, target, key, desc) {
|
|
2
2
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
3
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
-
else for
|
|
4
|
+
else for(var i = decorators.length - 1; i >= 0; i--)if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
5
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
6
|
};
|
|
7
|
-
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
8
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
9
|
-
};
|
|
10
7
|
import { Column, DataType, Model, Table } from "sequelize-typescript";
|
|
11
|
-
let UsersFriends = class UsersFriends extends Model {
|
|
8
|
+
export let UsersFriends = class UsersFriends extends Model {
|
|
12
9
|
};
|
|
13
10
|
__decorate([
|
|
14
11
|
Column({
|
|
15
12
|
type: DataType.UUID,
|
|
16
|
-
allowNull: false
|
|
17
|
-
})
|
|
18
|
-
__metadata("design:type", String)
|
|
13
|
+
allowNull: false
|
|
14
|
+
})
|
|
19
15
|
], UsersFriends.prototype, "userId", void 0);
|
|
20
16
|
__decorate([
|
|
21
17
|
Column({
|
|
22
18
|
type: DataType.UUID,
|
|
23
|
-
allowNull: false
|
|
24
|
-
})
|
|
25
|
-
__metadata("design:type", String)
|
|
19
|
+
allowNull: false
|
|
20
|
+
})
|
|
26
21
|
], UsersFriends.prototype, "friendId", void 0);
|
|
27
22
|
__decorate([
|
|
28
|
-
Column({
|
|
29
|
-
|
|
23
|
+
Column({
|
|
24
|
+
type: DataType.DATE,
|
|
25
|
+
allowNull: false
|
|
26
|
+
})
|
|
30
27
|
], UsersFriends.prototype, "createDate", void 0);
|
|
31
28
|
UsersFriends = __decorate([
|
|
32
29
|
Table
|
|
33
30
|
], UsersFriends);
|
|
34
|
-
|
|
31
|
+
|
|
32
|
+
//# sourceMappingURL=UsersFriends.js.map
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type jwt from "jsonwebtoken";
|
|
1
2
|
export interface UserTypes {
|
|
2
3
|
userUuid: string;
|
|
3
4
|
email: string;
|
|
@@ -6,11 +7,88 @@ export interface UserTypes {
|
|
|
6
7
|
avatar: string;
|
|
7
8
|
role: string;
|
|
8
9
|
}
|
|
10
|
+
export interface VerificationStatus {
|
|
11
|
+
status: string;
|
|
12
|
+
}
|
|
13
|
+
export interface TransactionsResponse {
|
|
14
|
+
revision: string;
|
|
15
|
+
bundleId: string;
|
|
16
|
+
environment: string;
|
|
17
|
+
hasMore: boolean;
|
|
18
|
+
signedTransactions: string[];
|
|
19
|
+
errorCode?: number;
|
|
20
|
+
}
|
|
9
21
|
export interface UserInfoModel {
|
|
10
22
|
userUuid: string;
|
|
11
23
|
height: string;
|
|
12
24
|
weight: string;
|
|
13
25
|
}
|
|
26
|
+
export interface Subscription {
|
|
27
|
+
type: "android" | "ios";
|
|
28
|
+
[key: string]: string;
|
|
29
|
+
}
|
|
30
|
+
export interface SingleTransactionResponse {
|
|
31
|
+
revision: string;
|
|
32
|
+
bundleId: string;
|
|
33
|
+
environment: string;
|
|
34
|
+
hasMore: boolean;
|
|
35
|
+
signedTransactionInfo: string;
|
|
36
|
+
errorCode?: number;
|
|
37
|
+
}
|
|
38
|
+
export interface SubscriptionStatus {
|
|
39
|
+
originalTransactionId: string;
|
|
40
|
+
status: number;
|
|
41
|
+
signedTransactionInfo: string;
|
|
42
|
+
signedRenewalInfo: string;
|
|
43
|
+
}
|
|
44
|
+
export interface SubscriptionStatusResponse {
|
|
45
|
+
environment: string;
|
|
46
|
+
bundleId: string;
|
|
47
|
+
data: [
|
|
48
|
+
{
|
|
49
|
+
subscriptionGroupIdentifier: string;
|
|
50
|
+
lastTransactions: SubscriptionStatus[];
|
|
51
|
+
}
|
|
52
|
+
];
|
|
53
|
+
errorCode?: number;
|
|
54
|
+
}
|
|
55
|
+
export interface SubscriptionStatusResponseError {
|
|
56
|
+
errorCode: number;
|
|
57
|
+
errorMessage: string;
|
|
58
|
+
}
|
|
59
|
+
export interface SubscriptionStatusResult {
|
|
60
|
+
originalTransactionId: string;
|
|
61
|
+
status: number;
|
|
62
|
+
signedTransactionInfo: string | jwt.JwtPayload | null;
|
|
63
|
+
signedRenewalInfo: string | jwt.JwtPayload | null;
|
|
64
|
+
}
|
|
65
|
+
export interface SignedTransactions {
|
|
66
|
+
transactionId: string;
|
|
67
|
+
originalTransactionId: string;
|
|
68
|
+
webOrderLineItemId: string;
|
|
69
|
+
bundleId: string;
|
|
70
|
+
productId: string;
|
|
71
|
+
subscriptionGroupIdentifier: string;
|
|
72
|
+
purchaseDate: number;
|
|
73
|
+
originalPurchaseDate: number;
|
|
74
|
+
expiresDate: number;
|
|
75
|
+
quantity: number;
|
|
76
|
+
type: string;
|
|
77
|
+
inAppOwnershipType: string;
|
|
78
|
+
signedDate: number;
|
|
79
|
+
environment: string;
|
|
80
|
+
transactionReason: string;
|
|
81
|
+
storefront: string;
|
|
82
|
+
storefrontId: string;
|
|
83
|
+
}
|
|
84
|
+
export interface Credentials {
|
|
85
|
+
refresh_token?: string | null;
|
|
86
|
+
expiry_date?: number | null;
|
|
87
|
+
access_token?: string | null;
|
|
88
|
+
token_type?: string | null;
|
|
89
|
+
id_token?: string | null;
|
|
90
|
+
scope?: string;
|
|
91
|
+
}
|
|
14
92
|
export interface LoginRequest {
|
|
15
93
|
email: string;
|
|
16
94
|
password: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/lib/models/UserInterfaces.ts"],"sourcesContent":["
|
|
1
|
+
{"version":3,"sources":["../../../src/lib/models/UserInterfaces.ts"],"sourcesContent":["import type jwt from \"jsonwebtoken\";\n\nexport interface UserTypes {\n userUuid: string;\n email: string;\n firstName: string;\n lastName: string;\n avatar: string;\n role: string;\n}\n\nexport interface VerificationStatus {\n status: string;\n}\n\nexport interface TransactionsResponse {\n revision: string;\n bundleId: string;\n environment: string;\n hasMore: boolean;\n signedTransactions: string[];\n errorCode?: number;\n}\n\nexport interface UserInfoModel {\n userUuid: string;\n height: string;\n weight: string;\n}\n\nexport interface Subscription {\n type: \"android\" | \"ios\",\n [key: string]: string;\n}\n\nexport interface SingleTransactionResponse {\n revision: string;\n bundleId: string;\n environment: string;\n hasMore: boolean;\n signedTransactionInfo: string;\n errorCode?: number;\n}\n\nexport interface SubscriptionStatus {\n originalTransactionId: string;\n status: number;\n signedTransactionInfo: string;\n signedRenewalInfo: string;\n}\n\nexport interface SubscriptionStatusResponse {\n environment: string;\n bundleId: string;\n data: [\n {\n subscriptionGroupIdentifier: string;\n lastTransactions: SubscriptionStatus[];\n }\n ];\n errorCode?: number;\n}\n\nexport interface SubscriptionStatusResponseError {\n errorCode: number;\n errorMessage: string;\n}\n\nexport interface SubscriptionStatusResult {\n originalTransactionId: string;\n status: number;\n signedTransactionInfo: string | jwt.JwtPayload | null;\n signedRenewalInfo: string | jwt.JwtPayload | null;\n}\n\nexport interface SignedTransactions {\n transactionId: string;\n originalTransactionId: string;\n webOrderLineItemId: string;\n bundleId: string;\n productId: string;\n subscriptionGroupIdentifier: string;\n purchaseDate: number;\n originalPurchaseDate: number;\n expiresDate: number;\n quantity: number;\n type: string;\n inAppOwnershipType: string;\n signedDate: number;\n environment: string;\n transactionReason: string;\n storefront: string;\n storefrontId: string;\n}\n\nexport interface Credentials {\n refresh_token?: string | null,\n expiry_date?: number | null,\n access_token?: string | null,\n token_type?: string | null ,\n id_token?: string | null,\n scope?: string\n}\n\n\nexport interface LoginRequest {\n email: string;\n password: string;\n}\n\nexport interface UserPhotoRequest {\n base64: string;\n}\n\nexport interface ProgressPhoto {\n date: Date;\n progressPhoto: string;\n userUuid: string;\n}\n\nexport interface ForgotPassword {\n uuid: string;\n userUuid: string;\n token: string;\n date: Date;\n}\n\nexport interface RefreshPayload {\n userUuid: string;\n}\n\nexport interface TokenRequest {\n token: string;\n}\n\nexport interface RefreshRequest {\n refreshToken: string;\n}\n\nexport interface UuidRequest {\n userUuid: string;\n}\n\nexport interface EmailRequest {\n email: string;\n}\n\nexport interface TitleRequest {\n title: string;\n}\n\nexport interface UserPhoto {\n base64: string;\n title: string;\n}\n\nexport default interface AuthenticationToken {\n type: string;\n contents: string;\n}\n\nexport interface RestorePasswordRequest {\n email: string;\n}\n\nexport interface BeforeSubscriptionOptions {\n firstName: string;\n lastName: string;\n sex: string;\n goal: string;\n weightGoal: string;\n level: string;\n type: string;\n days: number;\n}\n\nexport interface AfterSubscriptionOptions {\n dateOfBirth: string;\n metricSystem: string;\n height: string;\n weight: string;\n}\n"],"names":[],"mappings":"AAAA,WAqLC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { PersistedUser } from "../dbmodels/PersistedUser";
|
|
2
|
+
import type { Credentials, SignedTransactions, SubscriptionStatusResult, VerificationStatus } from "../models/UserInterfaces";
|
|
3
|
+
export default class AuthenticationUtil {
|
|
4
|
+
private static readonly ACCESS_SECRET;
|
|
5
|
+
static fetchUserWithTokenInfo(token: string): Promise<PersistedUser | null>;
|
|
6
|
+
static verifyAppleReceipt(data: string): Promise<VerificationStatus>;
|
|
7
|
+
static verifyTokenAndFetchUser(token: string): Promise<PersistedUser | null | false>;
|
|
8
|
+
static generateAppleJWT(): any;
|
|
9
|
+
static getAppleTransactions(originalTransactionId: string): Promise<SignedTransactions[]>;
|
|
10
|
+
static getAndroidAccessToken(): Promise<Credentials>;
|
|
11
|
+
static getAndroidSubscriptionsStatuses(token: string): Promise<any>;
|
|
12
|
+
static isAndroidSubscriptionsActive(token: string): Promise<boolean>;
|
|
13
|
+
static isAppleSubscriptionActive(transactionId: string): Promise<boolean>;
|
|
14
|
+
static getAppleSubscriptionsStatuses(transactionId: string): Promise<SubscriptionStatusResult[]>;
|
|
15
|
+
static getSingleAppleTransactionsInfo(transactionId: string): Promise<{
|
|
16
|
+
signedTransactionInfo: any;
|
|
17
|
+
}>;
|
|
18
|
+
}
|