czapp-shared 1.0.35 → 1.0.37

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
@@ -108,6 +108,16 @@ interface IVocabCheckActivity {
108
108
  flashcardCount: number;
109
109
  testQuestionCount: number;
110
110
  }
111
+ /**
112
+ * A user's lexeme pair counts per LearningStageGroup as recorded on a given day. learningCount
113
+ * includes NEW pairs, matching the LearningStageGroup.LEARNING grouping.
114
+ */
115
+ interface IProgressHistoryDay {
116
+ date: DateString;
117
+ queuedCount: number;
118
+ learningCount: number;
119
+ retiredCount: number;
120
+ }
111
121
  type MySQLDate = `${number}-${number}-${number} ${number}:${number}:${number}`;
112
122
  type DateString = `${number}-${string}-${string}`;
113
123
  declare enum ReminderFrequency {
@@ -130,6 +140,7 @@ declare enum AppError {
130
140
  REQUEST_RECYCLE_LEXEME_PAIR_FAILED = "Failed to recycle lexeme pair",
131
141
  REQUEST_TRANSLATION_FAILED = "Failed to get translation",
132
142
  REQUEST_TEST_COMPLETE_FAILED = "Failed to complete test",
143
+ REQUEST_TEST_COMPLETE_QUEUED = "Your results couldn't be saved right now. They're stored on this device and will be sent automatically once the connection is back.",
133
144
  REQUEST_TEST_SKIP_FAILED = "Failed to skip to the next deck"
134
145
  }
135
146
  declare enum Scenario {
@@ -292,6 +303,7 @@ declare enum ApiPath {
292
303
  LEXEME_PAIR_FAMILIARITY = "/lexemePair/:czId/:enId/:familiarity",
293
304
  LEXEME_PAIR_COUNT = "/lexemePairCount",
294
305
  LEXEME_PAIR_RECYCLE = "/lexemePair/recycle/:czId/:enId",
306
+ PROGRESS_HISTORY = "/progressHistory/:endDate/:noOfDays",
295
307
  PUSH_TOKEN = "/user/pushToken",
296
308
  SIGN_IN = "/signIn",
297
309
  SIGN_OUT = "/signOut",
@@ -320,6 +332,11 @@ interface TestCompleteRequestBody {
320
332
  clientDate: MySQLDate;
321
333
  results: ITestResult[];
322
334
  vocabCheckType: VocabCheckType;
335
+ /**
336
+ * Client-generated idempotency key ([A-Za-z0-9-]{1,64}). Clients that re-send a failed completion send the same id
337
+ * each time so the server applies it only once. Optional - completions without one are never deduplicated.
338
+ */
339
+ completionId?: string;
323
340
  }
324
341
  interface TranslationRequestBody {
325
342
  q: string;
@@ -407,6 +424,10 @@ interface SelectVocabCheckActivityParams {
407
424
  endDate: DateString;
408
425
  noOfDays: number;
409
426
  }
427
+ interface SelectProgressHistoryParams {
428
+ endDate: DateString;
429
+ noOfDays: number;
430
+ }
410
431
  /**
411
432
  * Response payloads
412
433
  */
@@ -455,4 +476,4 @@ type DeeplTranslation = {
455
476
  }>;
456
477
  };
457
478
 
458
- 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, isFinalTest, isLearningStageGroup, isStringContainingInteger, isThePreviousDay, isTheSameDay, isValidJsDateString, isValidMysqlDateString, parameterReplace };
479
+ 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 IProgressHistoryDay, 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 SelectProgressHistoryParams, 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, isFinalTest, isLearningStageGroup, isStringContainingInteger, isThePreviousDay, isTheSameDay, isValidJsDateString, isValidMysqlDateString, parameterReplace };
package/dist/index.d.ts CHANGED
@@ -108,6 +108,16 @@ interface IVocabCheckActivity {
108
108
  flashcardCount: number;
109
109
  testQuestionCount: number;
110
110
  }
111
+ /**
112
+ * A user's lexeme pair counts per LearningStageGroup as recorded on a given day. learningCount
113
+ * includes NEW pairs, matching the LearningStageGroup.LEARNING grouping.
114
+ */
115
+ interface IProgressHistoryDay {
116
+ date: DateString;
117
+ queuedCount: number;
118
+ learningCount: number;
119
+ retiredCount: number;
120
+ }
111
121
  type MySQLDate = `${number}-${number}-${number} ${number}:${number}:${number}`;
112
122
  type DateString = `${number}-${string}-${string}`;
113
123
  declare enum ReminderFrequency {
@@ -130,6 +140,7 @@ declare enum AppError {
130
140
  REQUEST_RECYCLE_LEXEME_PAIR_FAILED = "Failed to recycle lexeme pair",
131
141
  REQUEST_TRANSLATION_FAILED = "Failed to get translation",
132
142
  REQUEST_TEST_COMPLETE_FAILED = "Failed to complete test",
143
+ REQUEST_TEST_COMPLETE_QUEUED = "Your results couldn't be saved right now. They're stored on this device and will be sent automatically once the connection is back.",
133
144
  REQUEST_TEST_SKIP_FAILED = "Failed to skip to the next deck"
134
145
  }
135
146
  declare enum Scenario {
@@ -292,6 +303,7 @@ declare enum ApiPath {
292
303
  LEXEME_PAIR_FAMILIARITY = "/lexemePair/:czId/:enId/:familiarity",
293
304
  LEXEME_PAIR_COUNT = "/lexemePairCount",
294
305
  LEXEME_PAIR_RECYCLE = "/lexemePair/recycle/:czId/:enId",
306
+ PROGRESS_HISTORY = "/progressHistory/:endDate/:noOfDays",
295
307
  PUSH_TOKEN = "/user/pushToken",
296
308
  SIGN_IN = "/signIn",
297
309
  SIGN_OUT = "/signOut",
@@ -320,6 +332,11 @@ interface TestCompleteRequestBody {
320
332
  clientDate: MySQLDate;
321
333
  results: ITestResult[];
322
334
  vocabCheckType: VocabCheckType;
335
+ /**
336
+ * Client-generated idempotency key ([A-Za-z0-9-]{1,64}). Clients that re-send a failed completion send the same id
337
+ * each time so the server applies it only once. Optional - completions without one are never deduplicated.
338
+ */
339
+ completionId?: string;
323
340
  }
324
341
  interface TranslationRequestBody {
325
342
  q: string;
@@ -407,6 +424,10 @@ interface SelectVocabCheckActivityParams {
407
424
  endDate: DateString;
408
425
  noOfDays: number;
409
426
  }
427
+ interface SelectProgressHistoryParams {
428
+ endDate: DateString;
429
+ noOfDays: number;
430
+ }
410
431
  /**
411
432
  * Response payloads
412
433
  */
@@ -455,4 +476,4 @@ type DeeplTranslation = {
455
476
  }>;
456
477
  };
457
478
 
458
- 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, isFinalTest, isLearningStageGroup, isStringContainingInteger, isThePreviousDay, isTheSameDay, isValidJsDateString, isValidMysqlDateString, parameterReplace };
479
+ 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 IProgressHistoryDay, 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 SelectProgressHistoryParams, 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, isFinalTest, isLearningStageGroup, isStringContainingInteger, isThePreviousDay, isTheSameDay, isValidJsDateString, isValidMysqlDateString, parameterReplace };
package/dist/index.js CHANGED
@@ -180,6 +180,7 @@ var AppError = /* @__PURE__ */ ((AppError2) => {
180
180
  AppError2["REQUEST_RECYCLE_LEXEME_PAIR_FAILED"] = "Failed to recycle lexeme pair";
181
181
  AppError2["REQUEST_TRANSLATION_FAILED"] = "Failed to get translation";
182
182
  AppError2["REQUEST_TEST_COMPLETE_FAILED"] = "Failed to complete test";
183
+ AppError2["REQUEST_TEST_COMPLETE_QUEUED"] = "Your results couldn't be saved right now. They're stored on this device and will be sent automatically once the connection is back.";
183
184
  AppError2["REQUEST_TEST_SKIP_FAILED"] = "Failed to skip to the next deck";
184
185
  return AppError2;
185
186
  })(AppError || {});
@@ -322,6 +323,7 @@ var ApiPath = /* @__PURE__ */ ((ApiPath2) => {
322
323
  ApiPath2["LEXEME_PAIR_FAMILIARITY"] = "/lexemePair/:czId/:enId/:familiarity";
323
324
  ApiPath2["LEXEME_PAIR_COUNT"] = "/lexemePairCount";
324
325
  ApiPath2["LEXEME_PAIR_RECYCLE"] = "/lexemePair/recycle/:czId/:enId";
326
+ ApiPath2["PROGRESS_HISTORY"] = "/progressHistory/:endDate/:noOfDays";
325
327
  ApiPath2["PUSH_TOKEN"] = "/user/pushToken";
326
328
  ApiPath2["SIGN_IN"] = "/signIn";
327
329
  ApiPath2["SIGN_OUT"] = "/signOut";
package/dist/index.mjs CHANGED
@@ -125,6 +125,7 @@ var AppError = /* @__PURE__ */ ((AppError2) => {
125
125
  AppError2["REQUEST_RECYCLE_LEXEME_PAIR_FAILED"] = "Failed to recycle lexeme pair";
126
126
  AppError2["REQUEST_TRANSLATION_FAILED"] = "Failed to get translation";
127
127
  AppError2["REQUEST_TEST_COMPLETE_FAILED"] = "Failed to complete test";
128
+ AppError2["REQUEST_TEST_COMPLETE_QUEUED"] = "Your results couldn't be saved right now. They're stored on this device and will be sent automatically once the connection is back.";
128
129
  AppError2["REQUEST_TEST_SKIP_FAILED"] = "Failed to skip to the next deck";
129
130
  return AppError2;
130
131
  })(AppError || {});
@@ -267,6 +268,7 @@ var ApiPath = /* @__PURE__ */ ((ApiPath2) => {
267
268
  ApiPath2["LEXEME_PAIR_FAMILIARITY"] = "/lexemePair/:czId/:enId/:familiarity";
268
269
  ApiPath2["LEXEME_PAIR_COUNT"] = "/lexemePairCount";
269
270
  ApiPath2["LEXEME_PAIR_RECYCLE"] = "/lexemePair/recycle/:czId/:enId";
271
+ ApiPath2["PROGRESS_HISTORY"] = "/progressHistory/:endDate/:noOfDays";
270
272
  ApiPath2["PUSH_TOKEN"] = "/user/pushToken";
271
273
  ApiPath2["SIGN_IN"] = "/signIn";
272
274
  ApiPath2["SIGN_OUT"] = "/signOut";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "czapp-shared",
3
- "version": "1.0.35",
3
+ "version": "1.0.37",
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
@@ -47,6 +47,7 @@ export enum ApiPath {
47
47
  LEXEME_PAIR_FAMILIARITY = '/lexemePair/:czId/:enId/:familiarity',
48
48
  LEXEME_PAIR_COUNT = '/lexemePairCount',
49
49
  LEXEME_PAIR_RECYCLE = '/lexemePair/recycle/:czId/:enId',
50
+ PROGRESS_HISTORY = '/progressHistory/:endDate/:noOfDays',
50
51
  PUSH_TOKEN = '/user/pushToken',
51
52
  SIGN_IN = '/signIn',
52
53
  SIGN_OUT = '/signOut',
@@ -77,6 +78,11 @@ export interface TestCompleteRequestBody {
77
78
  clientDate: MySQLDate
78
79
  results: ITestResult[]
79
80
  vocabCheckType: VocabCheckType
81
+ /**
82
+ * Client-generated idempotency key ([A-Za-z0-9-]{1,64}). Clients that re-send a failed completion send the same id
83
+ * each time so the server applies it only once. Optional - completions without one are never deduplicated.
84
+ */
85
+ completionId?: string
80
86
  }
81
87
  export interface TranslationRequestBody {
82
88
  q: string;
@@ -167,6 +173,10 @@ export interface SelectVocabCheckActivityParams {
167
173
  endDate: DateString;
168
174
  noOfDays: number;
169
175
  }
176
+ export interface SelectProgressHistoryParams {
177
+ endDate: DateString;
178
+ noOfDays: number;
179
+ }
170
180
 
171
181
 
172
182
  /**
@@ -73,6 +73,17 @@ export interface IVocabCheckActivity {
73
73
  testQuestionCount: number
74
74
  }
75
75
 
76
+ /**
77
+ * A user's lexeme pair counts per LearningStageGroup as recorded on a given day. learningCount
78
+ * includes NEW pairs, matching the LearningStageGroup.LEARNING grouping.
79
+ */
80
+ export interface IProgressHistoryDay {
81
+ date: DateString;
82
+ queuedCount: number;
83
+ learningCount: number;
84
+ retiredCount: number;
85
+ }
86
+
76
87
  export type MySQLDate = `${number}-${number}-${number} ${number}:${number}:${number}`;
77
88
 
78
89
  export type DateString = `${number}-${string}-${string}`;
@@ -98,6 +109,8 @@ export enum AppError {
98
109
  REQUEST_RECYCLE_LEXEME_PAIR_FAILED = 'Failed to recycle lexeme pair',
99
110
  REQUEST_TRANSLATION_FAILED = 'Failed to get translation',
100
111
  REQUEST_TEST_COMPLETE_FAILED = 'Failed to complete test',
112
+ // The completion couldn't reach the server, but the client kept it and will re-send it - nothing is lost
113
+ REQUEST_TEST_COMPLETE_QUEUED = "Your results couldn't be saved right now. They're stored on this device and will be sent automatically once the connection is back.",
101
114
  REQUEST_TEST_SKIP_FAILED = "Failed to skip to the next deck"
102
115
  }
103
116