czapp-shared 1.0.36 → 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
@@ -140,6 +140,7 @@ declare enum AppError {
140
140
  REQUEST_RECYCLE_LEXEME_PAIR_FAILED = "Failed to recycle lexeme pair",
141
141
  REQUEST_TRANSLATION_FAILED = "Failed to get translation",
142
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.",
143
144
  REQUEST_TEST_SKIP_FAILED = "Failed to skip to the next deck"
144
145
  }
145
146
  declare enum Scenario {
@@ -331,6 +332,11 @@ interface TestCompleteRequestBody {
331
332
  clientDate: MySQLDate;
332
333
  results: ITestResult[];
333
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;
334
340
  }
335
341
  interface TranslationRequestBody {
336
342
  q: string;
package/dist/index.d.ts CHANGED
@@ -140,6 +140,7 @@ declare enum AppError {
140
140
  REQUEST_RECYCLE_LEXEME_PAIR_FAILED = "Failed to recycle lexeme pair",
141
141
  REQUEST_TRANSLATION_FAILED = "Failed to get translation",
142
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.",
143
144
  REQUEST_TEST_SKIP_FAILED = "Failed to skip to the next deck"
144
145
  }
145
146
  declare enum Scenario {
@@ -331,6 +332,11 @@ interface TestCompleteRequestBody {
331
332
  clientDate: MySQLDate;
332
333
  results: ITestResult[];
333
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;
334
340
  }
335
341
  interface TranslationRequestBody {
336
342
  q: string;
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 || {});
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 || {});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "czapp-shared",
3
- "version": "1.0.36",
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
@@ -78,6 +78,11 @@ export interface TestCompleteRequestBody {
78
78
  clientDate: MySQLDate
79
79
  results: ITestResult[]
80
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
81
86
  }
82
87
  export interface TranslationRequestBody {
83
88
  q: string;
@@ -109,6 +109,8 @@ export enum AppError {
109
109
  REQUEST_RECYCLE_LEXEME_PAIR_FAILED = 'Failed to recycle lexeme pair',
110
110
  REQUEST_TRANSLATION_FAILED = 'Failed to get translation',
111
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.",
112
114
  REQUEST_TEST_SKIP_FAILED = "Failed to skip to the next deck"
113
115
  }
114
116