czapp-shared 1.0.33 → 1.0.34

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
@@ -80,6 +80,19 @@ declare enum LearningStage {
80
80
  RETIRED = "RETIRED",
81
81
  QUEUED = "QUEUED"
82
82
  }
83
+ /**
84
+ * User-facing grouping of LearningStage, used by the dictionary tabs.
85
+ * NEW is an internal transition stage the user never selects, so it is
86
+ * presented together with LEARNING - the same pairing the stored procedures
87
+ * already use for the active learning set (learningStage IN ('NEW','LEARNING')).
88
+ */
89
+ declare enum LearningStageGroup {
90
+ QUEUED = "QUEUED",
91
+ LEARNING = "LEARNING",
92
+ RETIRED = "RETIRED"
93
+ }
94
+ declare const LEARNING_STAGES_IN_GROUP: Record<LearningStageGroup, LearningStage[]>;
95
+ declare const isLearningStageGroup: (value: unknown) => value is LearningStageGroup;
83
96
  declare enum Progress {
84
97
  WORSE = "WORSE",
85
98
  NONE = "NONE",
@@ -263,7 +276,9 @@ declare enum ApiPath {
263
276
  LEXEMES_ALL = "/lexemes/all",
264
277
  LEXEMES_COUNT = "/lexemes/count/:language",
265
278
  LEXEMES_DELETE_ALL = "/lexemes/deleteAll",
279
+ LEXEMES_LEARNING_INFO = "/lexemes/learningInfo",
266
280
  LEXEMES_PAGE = "/lexemes/:length/:page",
281
+ LEXEMES_PAGE_BY_STAGE = "/lexemes/stage/:stageGroup/:length/:page",
267
282
  LEXEME_PAIR = "/lexemePair/:czId/:enId",
268
283
  LEXEME_PAIRS_BY_TEXT = "/lexemePairsByText/:inputText/:inputLang",
269
284
  LEXEME_PAIR_FAMILIARITY = "/lexemePair/:czId/:enId/:familiarity",
@@ -353,6 +368,7 @@ interface SelectLexemePairsByTextParams {
353
368
  interface SelectLexemesParams {
354
369
  page: number;
355
370
  length: number;
371
+ stageGroup?: LearningStageGroup;
356
372
  }
357
373
  interface SelectTestLexemesParams {
358
374
  testType: VocabCheckType;
@@ -431,4 +447,4 @@ type DeeplTranslation = {
431
447
  }>;
432
448
  };
433
449
 
434
- export { ApiMethod, ApiPath, AppError, type AutologinRequestBody, ClientPlatform, type ControllerResponse, type DateString, type DeeplTranslation, type DeleteLexemePairRequestParams, Familiarity, type HeatMapParams, type HeatMapResponseData, HttpStatusCode, type IActivityCount, type ICount, type ILexeme, type ILexemeIdPair, type ILexemeLearningInfo, type ILexemePair, type ILexemePairTexts, type ISession, type ITestResult, type IUserData, type IVocabCheckActivity, type InsertOrUpdateRequestBody, type InsertOrUpdateResponseData, Language, LearningStage, Lexeme, LexemePair, type LexemePairRequestBody, type LexemePairWithLang, type MySQLDate, Progress, type RecycleLexemePairParams, type RegisterPushTokenRequestBody, ReminderFrequency, type ResetTestUserParams, type Result, Scenario, type SelectAllTranslationsParams, type SelectLexemeCountParams, type SelectLexemePairParams, type SelectLexemePairsByTextParams, type SelectLexemesParams, type SelectTestLexemesParams, type SelectVocabCheckActivityParams, type SignInRequestBody, type SignInResponseData, type Streaks, type TestCompleteRequestBody, type TestCompleteResponseData, type TestInitRequestBody, type TestInitResponseData, type TranslationRequestBody, type TranslationResponseData, type UpdateLexemePairFamiliarityParams, type UpdateOnboardingStatusRequestBody, type UpdateUserRequestBody, VocabCheckType, convertJSDateStringToMySQLDate, dateDifferenceInDays, deriveStreakFromVocabCheckActivity, getFormattedDate, getMysqlDateIgnoreTZ, isClientDateTooFarFromServerDate, isExpired, isStringContainingInteger, isThePreviousDay, isTheSameDay, isValidJsDateString, isValidMysqlDateString, parameterReplace };
450
+ export { ApiMethod, ApiPath, AppError, type AutologinRequestBody, ClientPlatform, type ControllerResponse, type DateString, type DeeplTranslation, type DeleteLexemePairRequestParams, Familiarity, type HeatMapParams, type HeatMapResponseData, HttpStatusCode, type IActivityCount, type ICount, type ILexeme, type ILexemeIdPair, type ILexemeLearningInfo, type ILexemePair, type ILexemePairTexts, type ISession, type ITestResult, type IUserData, type IVocabCheckActivity, type InsertOrUpdateRequestBody, type InsertOrUpdateResponseData, LEARNING_STAGES_IN_GROUP, Language, LearningStage, LearningStageGroup, Lexeme, LexemePair, type LexemePairRequestBody, type LexemePairWithLang, type MySQLDate, Progress, type RecycleLexemePairParams, type RegisterPushTokenRequestBody, ReminderFrequency, type ResetTestUserParams, type Result, Scenario, type SelectAllTranslationsParams, type SelectLexemeCountParams, type SelectLexemePairParams, type SelectLexemePairsByTextParams, type SelectLexemesParams, type SelectTestLexemesParams, type SelectVocabCheckActivityParams, type SignInRequestBody, type SignInResponseData, type Streaks, type TestCompleteRequestBody, type TestCompleteResponseData, type TestInitRequestBody, type TestInitResponseData, type TranslationRequestBody, type TranslationResponseData, type UpdateLexemePairFamiliarityParams, type UpdateOnboardingStatusRequestBody, type UpdateUserRequestBody, VocabCheckType, convertJSDateStringToMySQLDate, dateDifferenceInDays, deriveStreakFromVocabCheckActivity, getFormattedDate, getMysqlDateIgnoreTZ, isClientDateTooFarFromServerDate, isExpired, isLearningStageGroup, isStringContainingInteger, isThePreviousDay, isTheSameDay, isValidJsDateString, isValidMysqlDateString, parameterReplace };
package/dist/index.d.ts CHANGED
@@ -80,6 +80,19 @@ declare enum LearningStage {
80
80
  RETIRED = "RETIRED",
81
81
  QUEUED = "QUEUED"
82
82
  }
83
+ /**
84
+ * User-facing grouping of LearningStage, used by the dictionary tabs.
85
+ * NEW is an internal transition stage the user never selects, so it is
86
+ * presented together with LEARNING - the same pairing the stored procedures
87
+ * already use for the active learning set (learningStage IN ('NEW','LEARNING')).
88
+ */
89
+ declare enum LearningStageGroup {
90
+ QUEUED = "QUEUED",
91
+ LEARNING = "LEARNING",
92
+ RETIRED = "RETIRED"
93
+ }
94
+ declare const LEARNING_STAGES_IN_GROUP: Record<LearningStageGroup, LearningStage[]>;
95
+ declare const isLearningStageGroup: (value: unknown) => value is LearningStageGroup;
83
96
  declare enum Progress {
84
97
  WORSE = "WORSE",
85
98
  NONE = "NONE",
@@ -263,7 +276,9 @@ declare enum ApiPath {
263
276
  LEXEMES_ALL = "/lexemes/all",
264
277
  LEXEMES_COUNT = "/lexemes/count/:language",
265
278
  LEXEMES_DELETE_ALL = "/lexemes/deleteAll",
279
+ LEXEMES_LEARNING_INFO = "/lexemes/learningInfo",
266
280
  LEXEMES_PAGE = "/lexemes/:length/:page",
281
+ LEXEMES_PAGE_BY_STAGE = "/lexemes/stage/:stageGroup/:length/:page",
267
282
  LEXEME_PAIR = "/lexemePair/:czId/:enId",
268
283
  LEXEME_PAIRS_BY_TEXT = "/lexemePairsByText/:inputText/:inputLang",
269
284
  LEXEME_PAIR_FAMILIARITY = "/lexemePair/:czId/:enId/:familiarity",
@@ -353,6 +368,7 @@ interface SelectLexemePairsByTextParams {
353
368
  interface SelectLexemesParams {
354
369
  page: number;
355
370
  length: number;
371
+ stageGroup?: LearningStageGroup;
356
372
  }
357
373
  interface SelectTestLexemesParams {
358
374
  testType: VocabCheckType;
@@ -431,4 +447,4 @@ type DeeplTranslation = {
431
447
  }>;
432
448
  };
433
449
 
434
- export { ApiMethod, ApiPath, AppError, type AutologinRequestBody, ClientPlatform, type ControllerResponse, type DateString, type DeeplTranslation, type DeleteLexemePairRequestParams, Familiarity, type HeatMapParams, type HeatMapResponseData, HttpStatusCode, type IActivityCount, type ICount, type ILexeme, type ILexemeIdPair, type ILexemeLearningInfo, type ILexemePair, type ILexemePairTexts, type ISession, type ITestResult, type IUserData, type IVocabCheckActivity, type InsertOrUpdateRequestBody, type InsertOrUpdateResponseData, Language, LearningStage, Lexeme, LexemePair, type LexemePairRequestBody, type LexemePairWithLang, type MySQLDate, Progress, type RecycleLexemePairParams, type RegisterPushTokenRequestBody, ReminderFrequency, type ResetTestUserParams, type Result, Scenario, type SelectAllTranslationsParams, type SelectLexemeCountParams, type SelectLexemePairParams, type SelectLexemePairsByTextParams, type SelectLexemesParams, type SelectTestLexemesParams, type SelectVocabCheckActivityParams, type SignInRequestBody, type SignInResponseData, type Streaks, type TestCompleteRequestBody, type TestCompleteResponseData, type TestInitRequestBody, type TestInitResponseData, type TranslationRequestBody, type TranslationResponseData, type UpdateLexemePairFamiliarityParams, type UpdateOnboardingStatusRequestBody, type UpdateUserRequestBody, VocabCheckType, convertJSDateStringToMySQLDate, dateDifferenceInDays, deriveStreakFromVocabCheckActivity, getFormattedDate, getMysqlDateIgnoreTZ, isClientDateTooFarFromServerDate, isExpired, isStringContainingInteger, isThePreviousDay, isTheSameDay, isValidJsDateString, isValidMysqlDateString, parameterReplace };
450
+ export { ApiMethod, ApiPath, AppError, type AutologinRequestBody, ClientPlatform, type ControllerResponse, type DateString, type DeeplTranslation, type DeleteLexemePairRequestParams, Familiarity, type HeatMapParams, type HeatMapResponseData, HttpStatusCode, type IActivityCount, type ICount, type ILexeme, type ILexemeIdPair, type ILexemeLearningInfo, type ILexemePair, type ILexemePairTexts, type ISession, type ITestResult, type IUserData, type IVocabCheckActivity, type InsertOrUpdateRequestBody, type InsertOrUpdateResponseData, LEARNING_STAGES_IN_GROUP, Language, LearningStage, LearningStageGroup, Lexeme, LexemePair, type LexemePairRequestBody, type LexemePairWithLang, type MySQLDate, Progress, type RecycleLexemePairParams, type RegisterPushTokenRequestBody, ReminderFrequency, type ResetTestUserParams, type Result, Scenario, type SelectAllTranslationsParams, type SelectLexemeCountParams, type SelectLexemePairParams, type SelectLexemePairsByTextParams, type SelectLexemesParams, type SelectTestLexemesParams, type SelectVocabCheckActivityParams, type SignInRequestBody, type SignInResponseData, type Streaks, type TestCompleteRequestBody, type TestCompleteResponseData, type TestInitRequestBody, type TestInitResponseData, type TranslationRequestBody, type TranslationResponseData, type UpdateLexemePairFamiliarityParams, type UpdateOnboardingStatusRequestBody, type UpdateUserRequestBody, VocabCheckType, convertJSDateStringToMySQLDate, dateDifferenceInDays, deriveStreakFromVocabCheckActivity, getFormattedDate, getMysqlDateIgnoreTZ, isClientDateTooFarFromServerDate, isExpired, isLearningStageGroup, isStringContainingInteger, isThePreviousDay, isTheSameDay, isValidJsDateString, isValidMysqlDateString, parameterReplace };
package/dist/index.js CHANGED
@@ -25,8 +25,10 @@ __export(index_exports, {
25
25
  ClientPlatform: () => ClientPlatform,
26
26
  Familiarity: () => Familiarity,
27
27
  HttpStatusCode: () => HttpStatusCode,
28
+ LEARNING_STAGES_IN_GROUP: () => LEARNING_STAGES_IN_GROUP,
28
29
  Language: () => Language,
29
30
  LearningStage: () => LearningStage,
31
+ LearningStageGroup: () => LearningStageGroup,
30
32
  Lexeme: () => Lexeme,
31
33
  LexemePair: () => LexemePair,
32
34
  Progress: () => Progress,
@@ -40,6 +42,7 @@ __export(index_exports, {
40
42
  getMysqlDateIgnoreTZ: () => getMysqlDateIgnoreTZ,
41
43
  isClientDateTooFarFromServerDate: () => isClientDateTooFarFromServerDate,
42
44
  isExpired: () => isExpired,
45
+ isLearningStageGroup: () => isLearningStageGroup,
43
46
  isStringContainingInteger: () => isStringContainingInteger,
44
47
  isThePreviousDay: () => isThePreviousDay,
45
48
  isTheSameDay: () => isTheSameDay,
@@ -137,6 +140,18 @@ var LearningStage = /* @__PURE__ */ ((LearningStage2) => {
137
140
  LearningStage2["QUEUED"] = "QUEUED";
138
141
  return LearningStage2;
139
142
  })(LearningStage || {});
143
+ var LearningStageGroup = /* @__PURE__ */ ((LearningStageGroup2) => {
144
+ LearningStageGroup2["QUEUED"] = "QUEUED";
145
+ LearningStageGroup2["LEARNING"] = "LEARNING";
146
+ LearningStageGroup2["RETIRED"] = "RETIRED";
147
+ return LearningStageGroup2;
148
+ })(LearningStageGroup || {});
149
+ var LEARNING_STAGES_IN_GROUP = {
150
+ ["QUEUED" /* QUEUED */]: ["QUEUED" /* QUEUED */],
151
+ ["LEARNING" /* LEARNING */]: ["NEW" /* NEW */, "LEARNING" /* LEARNING */],
152
+ ["RETIRED" /* RETIRED */]: ["RETIRED" /* RETIRED */]
153
+ };
154
+ var isLearningStageGroup = (value) => typeof value === "string" && Object.values(LearningStageGroup).includes(value);
140
155
  var Progress = /* @__PURE__ */ ((Progress2) => {
141
156
  Progress2["WORSE"] = "WORSE";
142
157
  Progress2["NONE"] = "NONE";
@@ -294,7 +309,9 @@ var ApiPath = /* @__PURE__ */ ((ApiPath2) => {
294
309
  ApiPath2["LEXEMES_ALL"] = "/lexemes/all";
295
310
  ApiPath2["LEXEMES_COUNT"] = "/lexemes/count/:language";
296
311
  ApiPath2["LEXEMES_DELETE_ALL"] = "/lexemes/deleteAll";
312
+ ApiPath2["LEXEMES_LEARNING_INFO"] = "/lexemes/learningInfo";
297
313
  ApiPath2["LEXEMES_PAGE"] = "/lexemes/:length/:page";
314
+ ApiPath2["LEXEMES_PAGE_BY_STAGE"] = "/lexemes/stage/:stageGroup/:length/:page";
298
315
  ApiPath2["LEXEME_PAIR"] = "/lexemePair/:czId/:enId";
299
316
  ApiPath2["LEXEME_PAIRS_BY_TEXT"] = "/lexemePairsByText/:inputText/:inputLang";
300
317
  ApiPath2["LEXEME_PAIR_FAMILIARITY"] = "/lexemePair/:czId/:enId/:familiarity";
@@ -328,8 +345,10 @@ var ClientPlatform = /* @__PURE__ */ ((ClientPlatform2) => {
328
345
  ClientPlatform,
329
346
  Familiarity,
330
347
  HttpStatusCode,
348
+ LEARNING_STAGES_IN_GROUP,
331
349
  Language,
332
350
  LearningStage,
351
+ LearningStageGroup,
333
352
  Lexeme,
334
353
  LexemePair,
335
354
  Progress,
@@ -343,6 +362,7 @@ var ClientPlatform = /* @__PURE__ */ ((ClientPlatform2) => {
343
362
  getMysqlDateIgnoreTZ,
344
363
  isClientDateTooFarFromServerDate,
345
364
  isExpired,
365
+ isLearningStageGroup,
346
366
  isStringContainingInteger,
347
367
  isThePreviousDay,
348
368
  isTheSameDay,
package/dist/index.mjs CHANGED
@@ -86,6 +86,18 @@ var LearningStage = /* @__PURE__ */ ((LearningStage2) => {
86
86
  LearningStage2["QUEUED"] = "QUEUED";
87
87
  return LearningStage2;
88
88
  })(LearningStage || {});
89
+ var LearningStageGroup = /* @__PURE__ */ ((LearningStageGroup2) => {
90
+ LearningStageGroup2["QUEUED"] = "QUEUED";
91
+ LearningStageGroup2["LEARNING"] = "LEARNING";
92
+ LearningStageGroup2["RETIRED"] = "RETIRED";
93
+ return LearningStageGroup2;
94
+ })(LearningStageGroup || {});
95
+ var LEARNING_STAGES_IN_GROUP = {
96
+ ["QUEUED" /* QUEUED */]: ["QUEUED" /* QUEUED */],
97
+ ["LEARNING" /* LEARNING */]: ["NEW" /* NEW */, "LEARNING" /* LEARNING */],
98
+ ["RETIRED" /* RETIRED */]: ["RETIRED" /* RETIRED */]
99
+ };
100
+ var isLearningStageGroup = (value) => typeof value === "string" && Object.values(LearningStageGroup).includes(value);
89
101
  var Progress = /* @__PURE__ */ ((Progress2) => {
90
102
  Progress2["WORSE"] = "WORSE";
91
103
  Progress2["NONE"] = "NONE";
@@ -243,7 +255,9 @@ var ApiPath = /* @__PURE__ */ ((ApiPath2) => {
243
255
  ApiPath2["LEXEMES_ALL"] = "/lexemes/all";
244
256
  ApiPath2["LEXEMES_COUNT"] = "/lexemes/count/:language";
245
257
  ApiPath2["LEXEMES_DELETE_ALL"] = "/lexemes/deleteAll";
258
+ ApiPath2["LEXEMES_LEARNING_INFO"] = "/lexemes/learningInfo";
246
259
  ApiPath2["LEXEMES_PAGE"] = "/lexemes/:length/:page";
260
+ ApiPath2["LEXEMES_PAGE_BY_STAGE"] = "/lexemes/stage/:stageGroup/:length/:page";
247
261
  ApiPath2["LEXEME_PAIR"] = "/lexemePair/:czId/:enId";
248
262
  ApiPath2["LEXEME_PAIRS_BY_TEXT"] = "/lexemePairsByText/:inputText/:inputLang";
249
263
  ApiPath2["LEXEME_PAIR_FAMILIARITY"] = "/lexemePair/:czId/:enId/:familiarity";
@@ -276,8 +290,10 @@ export {
276
290
  ClientPlatform,
277
291
  Familiarity,
278
292
  HttpStatusCode,
293
+ LEARNING_STAGES_IN_GROUP,
279
294
  Language,
280
295
  LearningStage,
296
+ LearningStageGroup,
281
297
  Lexeme,
282
298
  LexemePair,
283
299
  Progress,
@@ -291,6 +307,7 @@ export {
291
307
  getMysqlDateIgnoreTZ,
292
308
  isClientDateTooFarFromServerDate,
293
309
  isExpired,
310
+ isLearningStageGroup,
294
311
  isStringContainingInteger,
295
312
  isThePreviousDay,
296
313
  isTheSameDay,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "czapp-shared",
3
- "version": "1.0.33",
3
+ "version": "1.0.34",
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
@@ -5,6 +5,7 @@ import {
5
5
  Familiarity,
6
6
  ITestResult,
7
7
  Language,
8
+ LearningStageGroup,
8
9
  MySQLDate,
9
10
  Scenario,
10
11
  IVocabCheckActivity,
@@ -38,7 +39,9 @@ export enum ApiPath {
38
39
  LEXEMES_ALL = '/lexemes/all',
39
40
  LEXEMES_COUNT = '/lexemes/count/:language',
40
41
  LEXEMES_DELETE_ALL = '/lexemes/deleteAll',
42
+ LEXEMES_LEARNING_INFO = '/lexemes/learningInfo',
41
43
  LEXEMES_PAGE = '/lexemes/:length/:page',
44
+ LEXEMES_PAGE_BY_STAGE = '/lexemes/stage/:stageGroup/:length/:page',
42
45
  LEXEME_PAIR = '/lexemePair/:czId/:enId',
43
46
  LEXEME_PAIRS_BY_TEXT = '/lexemePairsByText/:inputText/:inputLang',
44
47
  LEXEME_PAIR_FAMILIARITY = '/lexemePair/:czId/:enId/:familiarity',
@@ -133,6 +136,7 @@ export interface SelectLexemePairsByTextParams {
133
136
  export interface SelectLexemesParams {
134
137
  page: number;
135
138
  length: number;
139
+ stageGroup?: LearningStageGroup; // undefined means every learning stage
136
140
  }
137
141
  export interface SelectTestLexemesParams {
138
142
  testType: VocabCheckType;
@@ -33,6 +33,28 @@ export enum LearningStage {
33
33
  QUEUED = 'QUEUED',
34
34
  }
35
35
 
36
+ /**
37
+ * User-facing grouping of LearningStage, used by the dictionary tabs.
38
+ * NEW is an internal transition stage the user never selects, so it is
39
+ * presented together with LEARNING - the same pairing the stored procedures
40
+ * already use for the active learning set (learningStage IN ('NEW','LEARNING')).
41
+ */
42
+ export enum LearningStageGroup {
43
+ QUEUED = 'QUEUED',
44
+ LEARNING = 'LEARNING',
45
+ RETIRED = 'RETIRED',
46
+ }
47
+
48
+ export const LEARNING_STAGES_IN_GROUP: Record<LearningStageGroup, LearningStage[]> = {
49
+ [LearningStageGroup.QUEUED]: [LearningStage.QUEUED],
50
+ [LearningStageGroup.LEARNING]: [LearningStage.NEW, LearningStage.LEARNING],
51
+ [LearningStageGroup.RETIRED]: [LearningStage.RETIRED],
52
+ };
53
+
54
+ export const isLearningStageGroup = (value: unknown): value is LearningStageGroup =>
55
+ typeof value === 'string' &&
56
+ Object.values(LearningStageGroup).includes(value as LearningStageGroup);
57
+
36
58
  export enum Progress {
37
59
  WORSE = "WORSE",
38
60
  NONE = "NONE",