czapp-shared 1.0.6 → 1.0.7
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/README.md +18 -0
- package/dist/index.d.mts +185 -232
- package/dist/index.d.ts +185 -232
- package/dist/index.js +149 -114
- package/dist/index.mjs +144 -113
- package/package.json +3 -3
- package/src/{util.ts → concrete/date.ts} +1 -1
- package/src/concrete/lexeme.ts +32 -0
- package/src/concrete/string.ts +9 -0
- package/src/design/api.ts +94 -0
- package/src/design/lexemes.ts +37 -0
- package/src/{types.ts → design/types.ts} +13 -122
- package/src/{user.ts → design/user.ts} +13 -12
- package/src/index.ts +8 -4
- package/test/String.ts +31 -0
- package/src/lexemes.ts +0 -114
package/README.md
CHANGED
|
@@ -14,6 +14,24 @@ import { MyType } from 'czapp-shared';
|
|
|
14
14
|
```
|
|
15
15
|
|
|
16
16
|
## Development
|
|
17
|
+
To link the local copy of the package to another project, first in the root of the czapp-shared project run:
|
|
18
|
+
```bash
|
|
19
|
+
npm link
|
|
20
|
+
```
|
|
21
|
+
... then in the root of the project you want to link to run:
|
|
22
|
+
```bash
|
|
23
|
+
npm link czapp-shared
|
|
24
|
+
```
|
|
25
|
+
This will create a symlink in the node_modules folder of the project you want to link to that points to the local copy
|
|
26
|
+
of the package.
|
|
27
|
+
|
|
28
|
+
To run the project in watch mode:
|
|
29
|
+
```bash
|
|
30
|
+
npm run watch
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
To build the project (generate the artifacts):
|
|
34
|
+
```bash
|
|
17
35
|
To build:
|
|
18
36
|
```bash
|
|
19
37
|
npm run build
|
package/dist/index.d.mts
CHANGED
|
@@ -1,45 +1,132 @@
|
|
|
1
|
-
import { RowDataPacket } from 'mysql2';
|
|
2
|
-
|
|
3
1
|
/**
|
|
4
|
-
*
|
|
2
|
+
* @name convertJSDateObjectToMySQLDateString
|
|
3
|
+
* @description Converts a JavaScript Date object to a MySQL date string
|
|
4
|
+
* @param date
|
|
5
|
+
* @type Date
|
|
6
|
+
* @returns MySQLDate in the format "2021-01-01 07:41:23"
|
|
5
7
|
*/
|
|
8
|
+
declare const convertJSDateObjectToMySQLDateString: (date: Date) => MySQLDate | undefined;
|
|
6
9
|
/**
|
|
7
|
-
* @
|
|
8
|
-
* @description
|
|
9
|
-
*
|
|
10
|
+
* @name convertJSDateStringToMySQLDate
|
|
11
|
+
* @description Converts a JavaScript Date object to a MySQL date string
|
|
12
|
+
* @param date in the format "2021-01-01T07:41:23.000Z"
|
|
13
|
+
* @type string
|
|
14
|
+
* @returns date in the format "2021-01-01 07:41:23"
|
|
15
|
+
* @returns undefined if the input date is invalid
|
|
10
16
|
*/
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
+
declare const convertJSDateStringToMySQLDate: (date: string) => MySQLDate | undefined;
|
|
18
|
+
/**
|
|
19
|
+
* @name isValidMysqlDateString
|
|
20
|
+
* @description Checks if a string representation of date/time is in the format "2021-01-01 07:41:23"
|
|
21
|
+
* @param dateStr
|
|
22
|
+
* @returns boolean
|
|
23
|
+
*/
|
|
24
|
+
declare const isValidMysqlDateString: (dateStr: string) => boolean;
|
|
17
25
|
/**
|
|
18
|
-
* @
|
|
19
|
-
* @description
|
|
20
|
-
*
|
|
26
|
+
* @name isValidJsDateString
|
|
27
|
+
* @description Checks if a string representation of date/time is in the format "2021-01-01T07:41:23.000Z"
|
|
28
|
+
* @param dateStr
|
|
29
|
+
* @returns boolean
|
|
21
30
|
*/
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
lastModified: MySQLDate;
|
|
32
|
-
lastTested: MySQLDate;
|
|
33
|
-
learningStage: LearningStage;
|
|
34
|
-
notes: string;
|
|
35
|
-
userId: string;
|
|
36
|
-
}
|
|
31
|
+
declare const isValidJsDateString: (dateStr: string) => boolean;
|
|
32
|
+
/**
|
|
33
|
+
* @name isClientDateTooFarFromServerDate
|
|
34
|
+
* @description Checks if the client date is more than one day away from the server date
|
|
35
|
+
* @param clientDateMySQLFormat date in MySQL format
|
|
36
|
+
* @param serverDate date object representation of the current time on the server
|
|
37
|
+
* @returns boolean
|
|
38
|
+
*/
|
|
39
|
+
declare const isClientDateTooFarFromServerDate: (clientDateMySQLFormat: MySQLDate, serverDate: Date) => boolean;
|
|
37
40
|
/**
|
|
38
|
-
*
|
|
41
|
+
* @name dateDifferenceInDays
|
|
42
|
+
* @description Calculates the difference in days between two dates and returns a positive integer
|
|
43
|
+
* if the first date is before the second date, and a negative integer if the first date is after the second date
|
|
44
|
+
* @param date1 date in MySQL format
|
|
45
|
+
* @param date2 date in MySQL format
|
|
46
|
+
* @returns number
|
|
39
47
|
*/
|
|
48
|
+
declare const dateDifferenceInDays: (date1: MySQLDate, date2: MySQLDate) => number;
|
|
49
|
+
declare const getClientDate: (date: Date) => string;
|
|
50
|
+
declare const isThePreviousDay: (date: MySQLDate, referenceDate: MySQLDate) => boolean;
|
|
51
|
+
declare const isTheSameDay: (date1: MySQLDate, date2: MySQLDate) => boolean;
|
|
52
|
+
declare const getFormattedDate: (date: Date) => string;
|
|
53
|
+
|
|
54
|
+
declare enum Language {
|
|
55
|
+
CZECH = "cz",
|
|
56
|
+
ENGLISH = "en",
|
|
57
|
+
UNKNOWN = "UNKNOWN"
|
|
58
|
+
}
|
|
59
|
+
type Result<T> = [T, undefined] | [undefined, Error];
|
|
60
|
+
declare enum Familiarity {
|
|
61
|
+
KNOWN = "KNOWN",
|
|
62
|
+
ALMOST = "ALMOST",
|
|
63
|
+
UNKNOWN = "UNKNOWN"
|
|
64
|
+
}
|
|
65
|
+
declare enum VocabCheckType {
|
|
66
|
+
FLASHCARD = "flashcard",
|
|
67
|
+
TEST = "test"
|
|
68
|
+
}
|
|
69
|
+
declare enum LearningStage {
|
|
70
|
+
NEW = "NEW",
|
|
71
|
+
LEARNING = "LEARNING",
|
|
72
|
+
RETIRED = "RETIRED"
|
|
73
|
+
}
|
|
74
|
+
declare enum Progress {
|
|
75
|
+
WORSE = 0,
|
|
76
|
+
NONE = 1,
|
|
77
|
+
IMPROVED = 2
|
|
78
|
+
}
|
|
79
|
+
interface ITestResult {
|
|
80
|
+
lexemePair: ILexemePair;
|
|
81
|
+
progress: Progress;
|
|
82
|
+
thinkingTimeSecs: number;
|
|
83
|
+
}
|
|
84
|
+
type MySQLDate = `${number}-${number}-${number} ${number}:${number}:${number}`;
|
|
85
|
+
declare enum ReminderFrequency {
|
|
86
|
+
ALWAYS = "always",
|
|
87
|
+
DAILY = "daily",
|
|
88
|
+
NEVER = "never"
|
|
89
|
+
}
|
|
90
|
+
declare enum AppError {
|
|
91
|
+
NONE = "No error",
|
|
92
|
+
REQUEST_AUTOLOGIN_FAILED = "Failed to auto-login",
|
|
93
|
+
REQUEST_DELETE_ALL_USER_DATA_FAILED = "Failed to delete all user data",
|
|
94
|
+
REQUEST_DELETE_LEXEME_PAIR_FAILED = "Failed to delete lexeme pair",
|
|
95
|
+
REQUEST_SIGN_IN_FAILED = "Failed to sign in",
|
|
96
|
+
REQUEST_SIGN_OUT_FAILED = "Failed to sign out",
|
|
97
|
+
REQUEST_GET_LEXEMES_FAILED = "Failed to get lexemes",
|
|
98
|
+
REQUEST_GET_LEXEMES_FOR_TEST_FAILED = "Failed to get lexemes for test",
|
|
99
|
+
REQUEST_UPDATE_FAMILIARITY_FAILED = "Failed to update familiarity",
|
|
100
|
+
REQUEST_UPDATE_USER_SETTINGS_FAILED = "Failed to update user settings",
|
|
101
|
+
REQUEST_INSERT_OR_UPDATE_LEXEME_PAIR_FAILED = "Failed to insert or update lexeme pair",
|
|
102
|
+
REQUEST_TRANSLATION_FAILED = "Failed to get translation",
|
|
103
|
+
REQUEST_TEST_COMPLETE_FAILED = "Failed to complete test"
|
|
104
|
+
}
|
|
105
|
+
declare enum Scenario {
|
|
106
|
+
S1_INSERT_HAPPY_PATH = "Insert, happy path",
|
|
107
|
+
S2_INSERT_ENGLISH_LEXEME_AND_MAPPING_DUPLICATE_CZECH_LEXEME_FOUND_AND_USED = "Insert English lexeme and mapping, duplicate Czech lexeme found and used",
|
|
108
|
+
S3_INSERT_CZECH_LEXEME_AND_MAPPING_DUPLICATE_ENGLISH_LEXEME_FOUND_AND_USED = "Insert Czech lexeme and mapping, duplicate English lexeme found and used",
|
|
109
|
+
S4_INSERT_MAPPING_ONLY_DUPLICATE_CZECH_AND_ENGLISH_LEXEMES_FOUND_AND_USED = "Insert mapping only, duplicate Czech and English lexemes found and used",
|
|
110
|
+
S5_NO_INSERT_REQUIRED_DUPLICATE_LEXEMES_AND_PAIRING_FOUND = "No insert required, duplicate lexemes and pairing found",
|
|
111
|
+
S6_NO_UPDATE_REQUIRED_NO_CHANGES_DETECTED = "No update required, no changes detected",
|
|
112
|
+
S7_CZECH_LEXEME_UPDATED = "Scenario 7: Czech lexeme updated",
|
|
113
|
+
S8_CZECH_LEXEME_DELETED_DUPLICATE_CZECH_LEXEME_CAN_BE_USED = "Scenario 8: Czech lexeme deleted, duplicate Czech lexeme can be used can be used",
|
|
114
|
+
S9_CZECH_LEXEME_AND_MAPPING_DELETED_DISCOVERED_LEXEMES_AND_MAPPING_CAN_BE_USED = "Scenario 9: Czech lexeme and mapping deleted, discovered lexemes and mapping can be used",
|
|
115
|
+
S10_MAPPING_UPDATED_TO_USE_NEW_CZECH_LEXEME = "Scenario 10: Mapping updated to use new Czech lexeme",
|
|
116
|
+
S11_MAPPING_UPDATED_TO_USE_DUPLICATE_CZECH_LEXEME = "Scenario 11: Mapping updated to use duplicate Czech lexeme",
|
|
117
|
+
S12_MAPPING_DELETED_DUPLICATE_MAPPING_CAN_BE_USED_WHEN_CZECH_LEXEME_MODIFIED = "Scenario 12: Mapping deleted, duplicate mapping can be used when Czech lexeme modified",
|
|
118
|
+
S13_ENGLISH_LEXEME_UPDATED = "Scenario 13: English lexeme updated",
|
|
119
|
+
S14_ENGLISH_LEXEME_DELETED_DUPLICATE_ENGLISH_LEXEME_CAN_BE_USED = "Scenario 14: English lexeme deleted, duplicate English lexeme can be used",
|
|
120
|
+
S15_ENGLISH_LEXEME_AND_MAPPING_DELETED_DISCOVERED_LEXEMES_AND_MAPPING_CAN_BE_USED = "Scenario 15: English lexeme and mapping deleted, discovered lexemes and mapping can be used",
|
|
121
|
+
S16_MAPPING_UPDATED_TO_USE_NEW_ENGLISH_LEXEME = "Scenario 16: Mapping updated to use new English lexeme",
|
|
122
|
+
S17_MAPPING_UPDATED_TO_USE_DUPLICATE_ENGLISH_LEXEME = "Scenario 17: Mapping updated to use duplicate English lexeme",
|
|
123
|
+
S18_MAPPING_DELETED_DUPLICATE_MAPPING_CAN_BE_USED_WHEN_ENGLISH_LEXEME_MODIFIED = "Scenario 18: Mapping deleted, duplicate mapping can be used when English lexeme modified",
|
|
124
|
+
ERROR = "Error"
|
|
125
|
+
}
|
|
126
|
+
|
|
40
127
|
interface ILexeme {
|
|
41
128
|
id: number | undefined;
|
|
42
|
-
dateAdded:
|
|
129
|
+
dateAdded: MySQLDate;
|
|
43
130
|
text: string;
|
|
44
131
|
userId: string;
|
|
45
132
|
}
|
|
@@ -56,16 +143,23 @@ interface ILexemePair {
|
|
|
56
143
|
notes: string;
|
|
57
144
|
userId: string;
|
|
58
145
|
}
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
};
|
|
146
|
+
interface ILexemeIdPair {
|
|
147
|
+
czId: number;
|
|
148
|
+
enId: number;
|
|
149
|
+
}
|
|
64
150
|
type LexemePairWithLang = {
|
|
65
151
|
czechLexeme: ILexeme;
|
|
66
152
|
englishLexeme: ILexeme;
|
|
67
153
|
langToFocus: Language;
|
|
68
154
|
};
|
|
155
|
+
|
|
156
|
+
declare class Lexeme implements ILexeme {
|
|
157
|
+
text: string;
|
|
158
|
+
id: number | undefined;
|
|
159
|
+
dateAdded: MySQLDate;
|
|
160
|
+
userId: string;
|
|
161
|
+
constructor();
|
|
162
|
+
}
|
|
69
163
|
declare class LexemePair implements ILexemePair {
|
|
70
164
|
czechLexeme: ILexeme;
|
|
71
165
|
dateAdded: MySQLDate;
|
|
@@ -78,43 +172,26 @@ declare class LexemePair implements ILexemePair {
|
|
|
78
172
|
learningStage: LearningStage;
|
|
79
173
|
notes: string;
|
|
80
174
|
userId: string;
|
|
81
|
-
constructor(englishLexeme:
|
|
175
|
+
constructor(englishLexeme: Lexeme, czechLexeme: Lexeme);
|
|
82
176
|
}
|
|
83
177
|
|
|
84
|
-
declare
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
declare enum VocabCheckType {
|
|
96
|
-
FLASHCARD = "flashcard",
|
|
97
|
-
TEST = "test"
|
|
98
|
-
}
|
|
99
|
-
declare enum LearningStage {
|
|
100
|
-
NEW = "NEW",
|
|
101
|
-
LEARNING = "LEARNING",
|
|
102
|
-
RETIRED = "RETIRED"
|
|
103
|
-
}
|
|
104
|
-
type MySQLDate = `${number}-${number}-${number} ${number}:${number}:${number}`;
|
|
105
|
-
declare enum ReminderFrequency {
|
|
106
|
-
ALWAYS = "always",
|
|
107
|
-
DAILY = "daily",
|
|
108
|
-
NEVER = "never"
|
|
109
|
-
}
|
|
110
|
-
interface TestInitResponse {
|
|
111
|
-
lexemePairs: ILexemePairRecord[];
|
|
112
|
-
vocabCheckType: VocabCheckType;
|
|
178
|
+
declare const isStringContainingInteger: (str: any) => boolean;
|
|
179
|
+
declare const parameterReplace: (path: string, params?: string[]) => string;
|
|
180
|
+
|
|
181
|
+
declare enum HttpStatusCode {
|
|
182
|
+
OK = 200,
|
|
183
|
+
BAD_REQUEST = 400,
|
|
184
|
+
UNAUTHORIZED = 401,
|
|
185
|
+
NOT_FOUND = 404,
|
|
186
|
+
TIMEOUT = 408,
|
|
187
|
+
ABORTED = 409,
|
|
188
|
+
INTERNAL_SERVER_ERROR = 500
|
|
113
189
|
}
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
190
|
+
declare enum ApiMethod {
|
|
191
|
+
GET = "GET",
|
|
192
|
+
POST = "POST",
|
|
193
|
+
PUT = "PUT",
|
|
194
|
+
DELETE = "DELETE"
|
|
118
195
|
}
|
|
119
196
|
declare enum ApiPath {
|
|
120
197
|
AUTOLOGIN = "/autologin",
|
|
@@ -136,45 +213,35 @@ declare enum ApiPath {
|
|
|
136
213
|
USER = "/user",
|
|
137
214
|
USER_RESET_TEST = "/user/test/reset/:flashcardReviewCompletedCount/:testsUnlocked"
|
|
138
215
|
}
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
NONE = "No error",
|
|
147
|
-
REQUEST_AUTOLOGIN_FAILED = "Failed to auto-login",
|
|
148
|
-
REQUEST_DELETE_ALL_USER_DATA_FAILED = "Failed to delete all user data",
|
|
149
|
-
REQUEST_DELETE_LEXEME_PAIR_FAILED = "Failed to delete lexeme pair",
|
|
150
|
-
REQUEST_SIGN_IN_FAILED = "Failed to sign in",
|
|
151
|
-
REQUEST_SIGN_OUT_FAILED = "Failed to sign out",
|
|
152
|
-
REQUEST_GET_LEXEMES_FAILED = "Failed to get lexemes",
|
|
153
|
-
REQUEST_GET_LEXEMES_FOR_TEST_FAILED = "Failed to get lexemes for test",
|
|
154
|
-
REQUEST_UPDATE_FAMILIARITY_FAILED = "Failed to update familiarity",
|
|
155
|
-
REQUEST_UPDATE_USER_SETTINGS_FAILED = "Failed to update user settings",
|
|
156
|
-
REQUEST_INSERT_OR_UPDATE_LEXEME_PAIR_FAILED = "Failed to insert or update lexeme pair",
|
|
157
|
-
REQUEST_TRANSLATION_FAILED = "Failed to get translation",
|
|
158
|
-
REQUEST_TEST_COMPLETE_FAILED = "Failed to complete test"
|
|
159
|
-
}
|
|
160
|
-
declare enum HttpStatusCode {
|
|
161
|
-
OK = 200,
|
|
162
|
-
BAD_REQUEST = 400,
|
|
163
|
-
UNAUTHORIZED = 401,
|
|
164
|
-
NOT_FOUND = 404,
|
|
165
|
-
TIMEOUT = 408,
|
|
166
|
-
ABORTED = 409,
|
|
167
|
-
INTERNAL_SERVER_ERROR = 500
|
|
216
|
+
/**
|
|
217
|
+
* Request payloads
|
|
218
|
+
*/
|
|
219
|
+
interface TestCompletePayload {
|
|
220
|
+
clientDate: MySQLDate;
|
|
221
|
+
results: ITestResult[];
|
|
222
|
+
vocabCheckType: string;
|
|
168
223
|
}
|
|
224
|
+
type LexemePairPayload = {
|
|
225
|
+
czLexeme: ILexeme;
|
|
226
|
+
enLexeme: ILexeme;
|
|
227
|
+
pairingNotes: string;
|
|
228
|
+
};
|
|
229
|
+
/**
|
|
230
|
+
* Response payloads
|
|
231
|
+
*/
|
|
169
232
|
interface ControllerResponse<T> {
|
|
170
233
|
message: string;
|
|
171
234
|
status: HttpStatusCode;
|
|
172
235
|
data: T;
|
|
173
236
|
}
|
|
174
|
-
interface
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
237
|
+
interface TestInitResponseData {
|
|
238
|
+
lexemePairs: ILexemePair[];
|
|
239
|
+
vocabCheckType: VocabCheckType;
|
|
240
|
+
}
|
|
241
|
+
interface InsertOrUpdateResponseData {
|
|
242
|
+
scenario: Scenario;
|
|
243
|
+
lexemeIdPair: ILexemeIdPair;
|
|
244
|
+
newMappingInserted?: boolean;
|
|
178
245
|
}
|
|
179
246
|
type DeeplTranslation = {
|
|
180
247
|
detectedSourceLanguage: string;
|
|
@@ -182,140 +249,26 @@ type DeeplTranslation = {
|
|
|
182
249
|
translatedText: string;
|
|
183
250
|
}>;
|
|
184
251
|
};
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
czId: number;
|
|
190
|
-
}
|
|
191
|
-
interface MappedEnIds extends RowDataPacket {
|
|
192
|
-
enId: number;
|
|
193
|
-
}
|
|
194
|
-
interface DuplicateId extends RowDataPacket {
|
|
195
|
-
id: number;
|
|
196
|
-
}
|
|
197
|
-
interface InsertIdDataRecord extends RowDataPacket {
|
|
198
|
-
insertId: number;
|
|
199
|
-
}
|
|
200
|
-
interface UpdateDataRecord extends RowDataPacket {
|
|
201
|
-
}
|
|
202
|
-
interface UserRecord extends RowDataPacket {
|
|
203
|
-
id: number | undefined;
|
|
204
|
-
googleSub: string;
|
|
205
|
-
name: string;
|
|
252
|
+
|
|
253
|
+
interface IUserData {
|
|
254
|
+
currentStreakEnd: MySQLDate | undefined;
|
|
255
|
+
currentStreakLength: number;
|
|
206
256
|
email: string;
|
|
207
|
-
phone: string;
|
|
208
|
-
signUpDate: Date;
|
|
209
|
-
lastModified: Date;
|
|
210
|
-
learningLanguage: string;
|
|
211
257
|
flashcardReviewCompletedCount: number;
|
|
212
|
-
currentStreakLength: number;
|
|
213
|
-
currentStreakEnd: MySQLDate | undefined;
|
|
214
|
-
highStreakLength: number;
|
|
215
|
-
highStreakEnd: MySQLDate | undefined;
|
|
216
|
-
testsUnlocked: boolean;
|
|
217
|
-
rewardPoints: number;
|
|
218
|
-
}
|
|
219
|
-
interface CountRecord extends RowDataPacket {
|
|
220
|
-
count: number;
|
|
221
|
-
}
|
|
222
|
-
interface LastWordsAddedRecord extends RowDataPacket {
|
|
223
|
-
czText: string;
|
|
224
|
-
enText: string;
|
|
225
|
-
}
|
|
226
|
-
declare enum Scenario {
|
|
227
|
-
S1_INSERT_HAPPY_PATH = "Insert, happy path",
|
|
228
|
-
S2_INSERT_ENGLISH_LEXEME_AND_MAPPING_DUPLICATE_CZECH_LEXEME_FOUND_AND_USED = "Insert English lexeme and mapping, duplicate Czech lexeme found and used",
|
|
229
|
-
S3_INSERT_CZECH_LEXEME_AND_MAPPING_DUPLICATE_ENGLISH_LEXEME_FOUND_AND_USED = "Insert Czech lexeme and mapping, duplicate English lexeme found and used",
|
|
230
|
-
S4_INSERT_MAPPING_ONLY_DUPLICATE_CZECH_AND_ENGLISH_LEXEMES_FOUND_AND_USED = "Insert mapping only, duplicate Czech and English lexemes found and used",
|
|
231
|
-
S5_NO_INSERT_REQUIRED_DUPLICATE_LEXEMES_AND_PAIRING_FOUND = "No insert required, duplicate lexemes and pairing found",
|
|
232
|
-
S6_NO_UPDATE_REQUIRED_NO_CHANGES_DETECTED = "No update required, no changes detected",
|
|
233
|
-
S7_CZECH_LEXEME_UPDATED = "Scenario 7: Czech lexeme updated",
|
|
234
|
-
S8_CZECH_LEXEME_DELETED_DUPLICATE_CZECH_LEXEME_CAN_BE_USED = "Scenario 8: Czech lexeme deleted, duplicate Czech lexeme can be used can be used",
|
|
235
|
-
S9_CZECH_LEXEME_AND_MAPPING_DELETED_DISCOVERED_LEXEMES_AND_MAPPING_CAN_BE_USED = "Scenario 9: Czech lexeme and mapping deleted, discovered lexemes and mapping can be used",
|
|
236
|
-
S10_MAPPING_UPDATED_TO_USE_NEW_CZECH_LEXEME = "Scenario 10: Mapping updated to use new Czech lexeme",
|
|
237
|
-
S11_MAPPING_UPDATED_TO_USE_DUPLICATE_CZECH_LEXEME = "Scenario 11: Mapping updated to use duplicate Czech lexeme",
|
|
238
|
-
S12_MAPPING_DELETED_DUPLICATE_MAPPING_CAN_BE_USED_WHEN_CZECH_LEXEME_MODIFIED = "Scenario 12: Mapping deleted, duplicate mapping can be used when Czech lexeme modified",
|
|
239
|
-
S13_ENGLISH_LEXEME_UPDATED = "Scenario 13: English lexeme updated",
|
|
240
|
-
S14_ENGLISH_LEXEME_DELETED_DUPLICATE_ENGLISH_LEXEME_CAN_BE_USED = "Scenario 14: English lexeme deleted, duplicate English lexeme can be used",
|
|
241
|
-
S15_ENGLISH_LEXEME_AND_MAPPING_DELETED_DISCOVERED_LEXEMES_AND_MAPPING_CAN_BE_USED = "Scenario 15: English lexeme and mapping deleted, discovered lexemes and mapping can be used",
|
|
242
|
-
S16_MAPPING_UPDATED_TO_USE_NEW_ENGLISH_LEXEME = "Scenario 16: Mapping updated to use new English lexeme",
|
|
243
|
-
S17_MAPPING_UPDATED_TO_USE_DUPLICATE_ENGLISH_LEXEME = "Scenario 17: Mapping updated to use duplicate English lexeme",
|
|
244
|
-
S18_MAPPING_DELETED_DUPLICATE_MAPPING_CAN_BE_USED_WHEN_ENGLISH_LEXEME_MODIFIED = "Scenario 18: Mapping deleted, duplicate mapping can be used when English lexeme modified",
|
|
245
|
-
ERROR = "Error"
|
|
246
|
-
}
|
|
247
|
-
|
|
248
|
-
/**
|
|
249
|
-
* @name convertJSDateObjectToMySQLDateString
|
|
250
|
-
* @description Converts a JavaScript Date object to a MySQL date string
|
|
251
|
-
* @param date
|
|
252
|
-
* @type Date
|
|
253
|
-
* @returns MySQLDate in the format "2021-01-01 07:41:23"
|
|
254
|
-
*/
|
|
255
|
-
declare const convertJSDateObjectToMySQLDateString: (date: Date) => MySQLDate | undefined;
|
|
256
|
-
/**
|
|
257
|
-
* @name convertJSDateStringToMySQLDate
|
|
258
|
-
* @description Converts a JavaScript Date object to a MySQL date string
|
|
259
|
-
* @param date in the format "2021-01-01T07:41:23.000Z"
|
|
260
|
-
* @type string
|
|
261
|
-
* @returns date in the format "2021-01-01 07:41:23"
|
|
262
|
-
* @returns undefined if the input date is invalid
|
|
263
|
-
*/
|
|
264
|
-
declare const convertJSDateStringToMySQLDate: (date: string) => MySQLDate | undefined;
|
|
265
|
-
/**
|
|
266
|
-
* @name isValidMysqlDateString
|
|
267
|
-
* @description Checks if a string representation of date/time is in the format "2021-01-01 07:41:23"
|
|
268
|
-
* @param dateStr
|
|
269
|
-
* @returns boolean
|
|
270
|
-
*/
|
|
271
|
-
declare const isValidMysqlDateString: (dateStr: string) => boolean;
|
|
272
|
-
/**
|
|
273
|
-
* @name isValidJsDateString
|
|
274
|
-
* @description Checks if a string representation of date/time is in the format "2021-01-01T07:41:23.000Z"
|
|
275
|
-
* @param dateStr
|
|
276
|
-
* @returns boolean
|
|
277
|
-
*/
|
|
278
|
-
declare const isValidJsDateString: (dateStr: string) => boolean;
|
|
279
|
-
/**
|
|
280
|
-
* @name isClientDateTooFarFromServerDate
|
|
281
|
-
* @description Checks if the client date is more than one day away from the server date
|
|
282
|
-
* @param clientDateMySQLFormat date in MySQL format
|
|
283
|
-
* @param serverDate date object representation of the current time on the server
|
|
284
|
-
* @returns boolean
|
|
285
|
-
*/
|
|
286
|
-
declare const isClientDateTooFarFromServerDate: (clientDateMySQLFormat: MySQLDate, serverDate: Date) => boolean;
|
|
287
|
-
/**
|
|
288
|
-
* @name dateDifferenceInDays
|
|
289
|
-
* @description Calculates the difference in days between two dates and returns a positive integer
|
|
290
|
-
* if the first date is before the second date, and a negative integer if the first date is after the second date
|
|
291
|
-
* @param date1 date in MySQL format
|
|
292
|
-
* @param date2 date in MySQL format
|
|
293
|
-
* @returns number
|
|
294
|
-
*/
|
|
295
|
-
declare const dateDifferenceInDays: (date1: MySQLDate, date2: MySQLDate) => number;
|
|
296
|
-
declare const getClientDate: (date: Date) => string;
|
|
297
|
-
declare const isThePreviousDay: (date: MySQLDate, referenceDate: MySQLDate) => boolean;
|
|
298
|
-
declare const isTheSameDay: (date1: MySQLDate, date2: MySQLDate) => boolean;
|
|
299
|
-
declare const getFormattedDate: (date: Date) => string;
|
|
300
|
-
|
|
301
|
-
type UserData = {
|
|
302
258
|
googleSub: string;
|
|
259
|
+
highStreakEnd: MySQLDate | undefined;
|
|
260
|
+
highStreakLength: number;
|
|
261
|
+
lastModified: MySQLDate;
|
|
262
|
+
lastWordAdded: string;
|
|
263
|
+
learningLanguage: Language;
|
|
264
|
+
lexemePairCount: number;
|
|
303
265
|
name: string;
|
|
304
|
-
email: string;
|
|
305
266
|
phone: string;
|
|
267
|
+
rewardPoints: number;
|
|
306
268
|
signUpDate: MySQLDate;
|
|
307
|
-
lastModified: MySQLDate;
|
|
308
|
-
learningLanguage: Language;
|
|
309
|
-
uiLanguage: Language;
|
|
310
269
|
testsCompletedCount: number;
|
|
311
|
-
currentStreakLength: number;
|
|
312
|
-
currentStreakEnd: MySQLDate;
|
|
313
|
-
highStreakLength: number;
|
|
314
|
-
highStreakEnd: MySQLDate;
|
|
315
270
|
testsUnlocked: boolean;
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
lexemePairCount: number;
|
|
319
|
-
};
|
|
271
|
+
uiLanguage: Language;
|
|
272
|
+
}
|
|
320
273
|
|
|
321
|
-
export { ApiMethod, ApiPath, AppError, type ControllerResponse, type
|
|
274
|
+
export { ApiMethod, ApiPath, AppError, type ControllerResponse, type DeeplTranslation, Familiarity, HttpStatusCode, type ILexeme, type ILexemeIdPair, type ILexemePair, type ITestResult, type IUserData, type InsertOrUpdateResponseData, Language, LearningStage, Lexeme, LexemePair, type LexemePairPayload, type LexemePairWithLang, type MySQLDate, Progress, ReminderFrequency, type Result, Scenario, type TestCompletePayload, type TestInitResponseData, VocabCheckType, convertJSDateObjectToMySQLDateString, convertJSDateStringToMySQLDate, dateDifferenceInDays, getClientDate, getFormattedDate, isClientDateTooFarFromServerDate, isStringContainingInteger, isThePreviousDay, isTheSameDay, isValidJsDateString, isValidMysqlDateString, parameterReplace };
|