czapp-shared 1.0.7 → 1.0.8

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.d.mts CHANGED
@@ -152,6 +152,9 @@ type LexemePairWithLang = {
152
152
  englishLexeme: ILexeme;
153
153
  langToFocus: Language;
154
154
  };
155
+ interface ICount {
156
+ count: number;
157
+ }
155
158
 
156
159
  declare class Lexeme implements ILexeme {
157
160
  text: string;
@@ -178,6 +181,33 @@ declare class LexemePair implements ILexemePair {
178
181
  declare const isStringContainingInteger: (str: any) => boolean;
179
182
  declare const parameterReplace: (path: string, params?: string[]) => string;
180
183
 
184
+ declare enum Language$1 {
185
+ CZECH = "cz",
186
+ ENGLISH = "en",
187
+ UNKNOWN = "UNKNOWN"
188
+ }
189
+
190
+ interface IUserData {
191
+ currentStreakEnd: MySQLDate | undefined;
192
+ currentStreakLength: number;
193
+ email: string;
194
+ flashcardReviewCompletedCount: number;
195
+ googleSub: string;
196
+ highStreakEnd: MySQLDate | undefined;
197
+ highStreakLength: number;
198
+ lastModified: MySQLDate;
199
+ lastWordAdded: string;
200
+ learningLanguage: Language;
201
+ lexemePairCount: number;
202
+ name: string;
203
+ phone: string;
204
+ rewardPoints: number;
205
+ signUpDate: MySQLDate;
206
+ testsCompletedCount: number;
207
+ testsUnlocked: boolean;
208
+ uiLanguage: Language;
209
+ }
210
+
181
211
  declare enum HttpStatusCode {
182
212
  OK = 200,
183
213
  BAD_REQUEST = 400,
@@ -216,16 +246,78 @@ declare enum ApiPath {
216
246
  /**
217
247
  * Request payloads
218
248
  */
219
- interface TestCompletePayload {
249
+ interface TestInitRequestBody {
250
+ vocabCheckType: VocabCheckType;
251
+ }
252
+ interface TestCompleteRequestBody {
220
253
  clientDate: MySQLDate;
221
254
  results: ITestResult[];
222
255
  vocabCheckType: string;
223
256
  }
224
- type LexemePairPayload = {
257
+ interface TranslationRequestBody {
258
+ q: string;
259
+ source: Language$1;
260
+ target: Language$1;
261
+ }
262
+ type LexemePairRequestBody = {
225
263
  czLexeme: ILexeme;
226
264
  enLexeme: ILexeme;
227
265
  pairingNotes: string;
228
266
  };
267
+ interface UpdateUserRequestBody {
268
+ learningLanguage: Language$1;
269
+ uiLanguage: Language$1;
270
+ }
271
+ interface AutologinRequestBody {
272
+ clientDate: MySQLDate;
273
+ }
274
+ interface InsertOrUpdateRequestBody {
275
+ czLexeme: ILexeme;
276
+ enLexeme: ILexeme;
277
+ pairingNotes: string;
278
+ }
279
+ interface SignInRequestBody {
280
+ rememberMe: boolean;
281
+ }
282
+ /**
283
+ * Request Params
284
+ */
285
+ interface SelectAllTranslationsParams {
286
+ sourceText: string;
287
+ sourceLang: string;
288
+ }
289
+ interface SelectLexemeCountParams {
290
+ language: Language$1;
291
+ }
292
+ interface SelectLexemePairParams {
293
+ czId: string;
294
+ enId: string;
295
+ }
296
+ interface SelectLexemePairsByTextParams {
297
+ inputText: string;
298
+ inputLang: string;
299
+ }
300
+ interface SelectLexemesParams {
301
+ page: string;
302
+ length: string;
303
+ }
304
+ interface SelectTestLexemesParams {
305
+ testType: string;
306
+ testLength: string;
307
+ }
308
+ interface UpdateLexemePairFamiliarityParams {
309
+ czId: string;
310
+ enId: string;
311
+ familiarity: string;
312
+ }
313
+ interface DeleteLexemePairRequestParams {
314
+ czId: string;
315
+ enId: string;
316
+ }
317
+ interface ResetTestUserParams {
318
+ flashcardReviewCompletedCount: number;
319
+ testsUnlocked: boolean;
320
+ }
229
321
  /**
230
322
  * Response payloads
231
323
  */
@@ -234,15 +326,30 @@ interface ControllerResponse<T> {
234
326
  status: HttpStatusCode;
235
327
  data: T;
236
328
  }
237
- interface TestInitResponseData {
238
- lexemePairs: ILexemePair[];
239
- vocabCheckType: VocabCheckType;
240
- }
329
+ type TranslationResponseData = {
330
+ detectedSourceLanguage: string;
331
+ translations: Array<{
332
+ translatedText: string;
333
+ }>;
334
+ };
241
335
  interface InsertOrUpdateResponseData {
242
336
  scenario: Scenario;
243
337
  lexemeIdPair: ILexemeIdPair;
244
338
  newMappingInserted?: boolean;
245
339
  }
340
+ interface SignInResponseData {
341
+ expiryDate: number;
342
+ user: IUserData;
343
+ }
344
+ interface TestInitResponseData {
345
+ lexemePairs: ILexemePair[];
346
+ vocabCheckType: VocabCheckType;
347
+ }
348
+ interface TestCompleteResponseData {
349
+ user: IUserData;
350
+ testResultIds: number[];
351
+ rewardPointsDelta: number;
352
+ }
246
353
  type DeeplTranslation = {
247
354
  detectedSourceLanguage: string;
248
355
  translations: Array<{
@@ -250,25 +357,4 @@ type DeeplTranslation = {
250
357
  }>;
251
358
  };
252
359
 
253
- interface IUserData {
254
- currentStreakEnd: MySQLDate | undefined;
255
- currentStreakLength: number;
256
- email: string;
257
- flashcardReviewCompletedCount: number;
258
- googleSub: string;
259
- highStreakEnd: MySQLDate | undefined;
260
- highStreakLength: number;
261
- lastModified: MySQLDate;
262
- lastWordAdded: string;
263
- learningLanguage: Language;
264
- lexemePairCount: number;
265
- name: string;
266
- phone: string;
267
- rewardPoints: number;
268
- signUpDate: MySQLDate;
269
- testsCompletedCount: number;
270
- testsUnlocked: boolean;
271
- uiLanguage: Language;
272
- }
273
-
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 };
360
+ export { ApiMethod, ApiPath, AppError, type AutologinRequestBody, type ControllerResponse, type DeeplTranslation, type DeleteLexemePairRequestParams, Familiarity, HttpStatusCode, type ICount, type ILexeme, type ILexemeIdPair, type ILexemePair, type ITestResult, type IUserData, type InsertOrUpdateRequestBody, type InsertOrUpdateResponseData, Language, LearningStage, Lexeme, LexemePair, type LexemePairRequestBody, type LexemePairWithLang, type MySQLDate, Progress, ReminderFrequency, type ResetTestUserParams, type Result, Scenario, type SelectAllTranslationsParams, type SelectLexemeCountParams, type SelectLexemePairParams, type SelectLexemePairsByTextParams, type SelectLexemesParams, type SelectTestLexemesParams, type SignInRequestBody, type SignInResponseData, type TestCompleteRequestBody, type TestCompleteResponseData, type TestInitRequestBody, type TestInitResponseData, type TranslationRequestBody, type TranslationResponseData, type UpdateLexemePairFamiliarityParams, type UpdateUserRequestBody, VocabCheckType, convertJSDateObjectToMySQLDateString, convertJSDateStringToMySQLDate, dateDifferenceInDays, getClientDate, getFormattedDate, isClientDateTooFarFromServerDate, isStringContainingInteger, isThePreviousDay, isTheSameDay, isValidJsDateString, isValidMysqlDateString, parameterReplace };
package/dist/index.d.ts CHANGED
@@ -152,6 +152,9 @@ type LexemePairWithLang = {
152
152
  englishLexeme: ILexeme;
153
153
  langToFocus: Language;
154
154
  };
155
+ interface ICount {
156
+ count: number;
157
+ }
155
158
 
156
159
  declare class Lexeme implements ILexeme {
157
160
  text: string;
@@ -178,6 +181,33 @@ declare class LexemePair implements ILexemePair {
178
181
  declare const isStringContainingInteger: (str: any) => boolean;
179
182
  declare const parameterReplace: (path: string, params?: string[]) => string;
180
183
 
184
+ declare enum Language$1 {
185
+ CZECH = "cz",
186
+ ENGLISH = "en",
187
+ UNKNOWN = "UNKNOWN"
188
+ }
189
+
190
+ interface IUserData {
191
+ currentStreakEnd: MySQLDate | undefined;
192
+ currentStreakLength: number;
193
+ email: string;
194
+ flashcardReviewCompletedCount: number;
195
+ googleSub: string;
196
+ highStreakEnd: MySQLDate | undefined;
197
+ highStreakLength: number;
198
+ lastModified: MySQLDate;
199
+ lastWordAdded: string;
200
+ learningLanguage: Language;
201
+ lexemePairCount: number;
202
+ name: string;
203
+ phone: string;
204
+ rewardPoints: number;
205
+ signUpDate: MySQLDate;
206
+ testsCompletedCount: number;
207
+ testsUnlocked: boolean;
208
+ uiLanguage: Language;
209
+ }
210
+
181
211
  declare enum HttpStatusCode {
182
212
  OK = 200,
183
213
  BAD_REQUEST = 400,
@@ -216,16 +246,78 @@ declare enum ApiPath {
216
246
  /**
217
247
  * Request payloads
218
248
  */
219
- interface TestCompletePayload {
249
+ interface TestInitRequestBody {
250
+ vocabCheckType: VocabCheckType;
251
+ }
252
+ interface TestCompleteRequestBody {
220
253
  clientDate: MySQLDate;
221
254
  results: ITestResult[];
222
255
  vocabCheckType: string;
223
256
  }
224
- type LexemePairPayload = {
257
+ interface TranslationRequestBody {
258
+ q: string;
259
+ source: Language$1;
260
+ target: Language$1;
261
+ }
262
+ type LexemePairRequestBody = {
225
263
  czLexeme: ILexeme;
226
264
  enLexeme: ILexeme;
227
265
  pairingNotes: string;
228
266
  };
267
+ interface UpdateUserRequestBody {
268
+ learningLanguage: Language$1;
269
+ uiLanguage: Language$1;
270
+ }
271
+ interface AutologinRequestBody {
272
+ clientDate: MySQLDate;
273
+ }
274
+ interface InsertOrUpdateRequestBody {
275
+ czLexeme: ILexeme;
276
+ enLexeme: ILexeme;
277
+ pairingNotes: string;
278
+ }
279
+ interface SignInRequestBody {
280
+ rememberMe: boolean;
281
+ }
282
+ /**
283
+ * Request Params
284
+ */
285
+ interface SelectAllTranslationsParams {
286
+ sourceText: string;
287
+ sourceLang: string;
288
+ }
289
+ interface SelectLexemeCountParams {
290
+ language: Language$1;
291
+ }
292
+ interface SelectLexemePairParams {
293
+ czId: string;
294
+ enId: string;
295
+ }
296
+ interface SelectLexemePairsByTextParams {
297
+ inputText: string;
298
+ inputLang: string;
299
+ }
300
+ interface SelectLexemesParams {
301
+ page: string;
302
+ length: string;
303
+ }
304
+ interface SelectTestLexemesParams {
305
+ testType: string;
306
+ testLength: string;
307
+ }
308
+ interface UpdateLexemePairFamiliarityParams {
309
+ czId: string;
310
+ enId: string;
311
+ familiarity: string;
312
+ }
313
+ interface DeleteLexemePairRequestParams {
314
+ czId: string;
315
+ enId: string;
316
+ }
317
+ interface ResetTestUserParams {
318
+ flashcardReviewCompletedCount: number;
319
+ testsUnlocked: boolean;
320
+ }
229
321
  /**
230
322
  * Response payloads
231
323
  */
@@ -234,15 +326,30 @@ interface ControllerResponse<T> {
234
326
  status: HttpStatusCode;
235
327
  data: T;
236
328
  }
237
- interface TestInitResponseData {
238
- lexemePairs: ILexemePair[];
239
- vocabCheckType: VocabCheckType;
240
- }
329
+ type TranslationResponseData = {
330
+ detectedSourceLanguage: string;
331
+ translations: Array<{
332
+ translatedText: string;
333
+ }>;
334
+ };
241
335
  interface InsertOrUpdateResponseData {
242
336
  scenario: Scenario;
243
337
  lexemeIdPair: ILexemeIdPair;
244
338
  newMappingInserted?: boolean;
245
339
  }
340
+ interface SignInResponseData {
341
+ expiryDate: number;
342
+ user: IUserData;
343
+ }
344
+ interface TestInitResponseData {
345
+ lexemePairs: ILexemePair[];
346
+ vocabCheckType: VocabCheckType;
347
+ }
348
+ interface TestCompleteResponseData {
349
+ user: IUserData;
350
+ testResultIds: number[];
351
+ rewardPointsDelta: number;
352
+ }
246
353
  type DeeplTranslation = {
247
354
  detectedSourceLanguage: string;
248
355
  translations: Array<{
@@ -250,25 +357,4 @@ type DeeplTranslation = {
250
357
  }>;
251
358
  };
252
359
 
253
- interface IUserData {
254
- currentStreakEnd: MySQLDate | undefined;
255
- currentStreakLength: number;
256
- email: string;
257
- flashcardReviewCompletedCount: number;
258
- googleSub: string;
259
- highStreakEnd: MySQLDate | undefined;
260
- highStreakLength: number;
261
- lastModified: MySQLDate;
262
- lastWordAdded: string;
263
- learningLanguage: Language;
264
- lexemePairCount: number;
265
- name: string;
266
- phone: string;
267
- rewardPoints: number;
268
- signUpDate: MySQLDate;
269
- testsCompletedCount: number;
270
- testsUnlocked: boolean;
271
- uiLanguage: Language;
272
- }
273
-
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 };
360
+ export { ApiMethod, ApiPath, AppError, type AutologinRequestBody, type ControllerResponse, type DeeplTranslation, type DeleteLexemePairRequestParams, Familiarity, HttpStatusCode, type ICount, type ILexeme, type ILexemeIdPair, type ILexemePair, type ITestResult, type IUserData, type InsertOrUpdateRequestBody, type InsertOrUpdateResponseData, Language, LearningStage, Lexeme, LexemePair, type LexemePairRequestBody, type LexemePairWithLang, type MySQLDate, Progress, ReminderFrequency, type ResetTestUserParams, type Result, Scenario, type SelectAllTranslationsParams, type SelectLexemeCountParams, type SelectLexemePairParams, type SelectLexemePairsByTextParams, type SelectLexemesParams, type SelectTestLexemesParams, type SignInRequestBody, type SignInResponseData, type TestCompleteRequestBody, type TestCompleteResponseData, type TestInitRequestBody, type TestInitResponseData, type TranslationRequestBody, type TranslationResponseData, type UpdateLexemePairFamiliarityParams, type UpdateUserRequestBody, VocabCheckType, convertJSDateObjectToMySQLDateString, convertJSDateStringToMySQLDate, dateDifferenceInDays, getClientDate, getFormattedDate, isClientDateTooFarFromServerDate, isStringContainingInteger, isThePreviousDay, isTheSameDay, isValidJsDateString, isValidMysqlDateString, parameterReplace };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "czapp-shared",
3
- "version": "1.0.7",
3
+ "version": "1.0.8",
4
4
  "description": "This is a shared library for Czapp projects. It contains common code that is used across multiple projects.",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
package/src/design/api.ts CHANGED
@@ -1,5 +1,7 @@
1
+ import { Language } from '../../dist/index';
1
2
  import { ILexeme, ILexemeIdPair, ILexemePair } from './lexemes';
2
3
  import { ITestResult, MySQLDate, Scenario, VocabCheckType } from './types';
4
+ import { IUserData } from './user';
3
5
 
4
6
  export enum HttpStatusCode {
5
7
  OK = 200,
@@ -43,18 +45,81 @@ export enum ApiPath {
43
45
  /**
44
46
  * Request payloads
45
47
  */
46
-
47
- export interface TestCompletePayload {
48
+ export interface TestInitRequestBody {
49
+ vocabCheckType: VocabCheckType
50
+ }
51
+ export interface TestCompleteRequestBody {
48
52
  clientDate: MySQLDate
49
53
  results: ITestResult[]
50
54
  vocabCheckType: string
51
55
  }
52
-
53
- export type LexemePairPayload = {
56
+ export interface TranslationRequestBody {
57
+ q: string;
58
+ source: Language;
59
+ target: Language;
60
+ }
61
+ export type LexemePairRequestBody = {
54
62
  czLexeme: ILexeme
55
63
  enLexeme: ILexeme;
56
64
  pairingNotes: string;
57
65
  }
66
+ export interface UpdateUserRequestBody {
67
+ learningLanguage: Language;
68
+ uiLanguage: Language;
69
+ }
70
+ export interface AutologinRequestBody {
71
+ clientDate: MySQLDate;
72
+ }
73
+ export interface InsertOrUpdateRequestBody {
74
+ czLexeme: ILexeme;
75
+ enLexeme: ILexeme;
76
+ pairingNotes: string;
77
+ }
78
+ export interface SignInRequestBody {
79
+ rememberMe: boolean;
80
+ }
81
+
82
+ /**
83
+ * Request Params
84
+ */
85
+ export interface SelectAllTranslationsParams {
86
+ sourceText: string;
87
+ sourceLang: string;
88
+ }
89
+ export interface SelectLexemeCountParams {
90
+ language: Language;
91
+ }
92
+ export interface SelectLexemePairParams {
93
+ czId: string;
94
+ enId: string;
95
+ }
96
+ export interface SelectLexemePairsByTextParams {
97
+ inputText: string;
98
+ inputLang: string;
99
+ }
100
+ export interface SelectLexemesParams {
101
+ page: string;
102
+ length: string;
103
+ }
104
+ export interface SelectTestLexemesParams {
105
+ testType: string;
106
+ testLength: string;
107
+ }
108
+ export interface UpdateLexemePairFamiliarityParams {
109
+ czId: string;
110
+ enId: string;
111
+ familiarity: string;
112
+ }
113
+ export interface DeleteLexemePairRequestParams {
114
+ czId: string;
115
+ enId: string;
116
+ }
117
+ export interface ResetTestUserParams {
118
+ flashcardReviewCompletedCount: number;
119
+ testsUnlocked: boolean;
120
+ }
121
+
122
+
58
123
 
59
124
  /**
60
125
  * Response payloads
@@ -69,17 +134,30 @@ export interface ControllerResponse<T> {
69
134
  }
70
135
 
71
136
  // Response Data
72
-
73
- export interface TestInitResponseData {
74
- lexemePairs: ILexemePair[];
75
- vocabCheckType: VocabCheckType;
137
+ export type TranslationResponseData = {
138
+ detectedSourceLanguage: string,
139
+ translations: Array<{
140
+ translatedText: string
141
+ }>
76
142
  }
77
-
78
143
  export interface InsertOrUpdateResponseData {
79
144
  scenario: Scenario,
80
145
  lexemeIdPair: ILexemeIdPair,
81
146
  newMappingInserted?: boolean
82
147
  }
148
+ export interface SignInResponseData {
149
+ expiryDate: number;
150
+ user: IUserData;
151
+ }
152
+ export interface TestInitResponseData {
153
+ lexemePairs: ILexemePair[];
154
+ vocabCheckType: VocabCheckType;
155
+ }
156
+ export interface TestCompleteResponseData {
157
+ user: IUserData;
158
+ testResultIds: number[];
159
+ rewardPointsDelta: number;
160
+ }
83
161
 
84
162
  // other
85
163
  export type DeeplTranslation = {
@@ -32,6 +32,9 @@ export type LexemePairWithLang = {
32
32
  langToFocus: Language
33
33
  }
34
34
 
35
+ export interface ICount {
36
+ count: number;
37
+ }
35
38
 
36
39
 
37
40