czapp-shared 1.0.18 → 1.0.20
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 +14 -6
- package/dist/index.d.mts +8 -13
- package/dist/index.d.ts +8 -13
- package/dist/index.js +3 -3
- package/package.json +4 -4
- package/src/design/api.ts +7 -4
- package/src/design/data.ts +1 -12
- package/tsconfig.json +1 -1
package/README.md
CHANGED
|
@@ -14,22 +14,30 @@ import { MyType } from 'czapp-shared';
|
|
|
14
14
|
```
|
|
15
15
|
|
|
16
16
|
## Development
|
|
17
|
-
|
|
17
|
+
Note `npm link` does not work. Use Yalc instead.
|
|
18
|
+
|
|
19
|
+
First install Yalc globally:
|
|
20
|
+
```bash
|
|
21
|
+
npm install -g yalc
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
Then run the following command in the root of this project:
|
|
18
25
|
```bash
|
|
19
|
-
|
|
26
|
+
yalc publish
|
|
20
27
|
```
|
|
21
|
-
|
|
28
|
+
|
|
29
|
+
Then in the project that you want to use this package, run the following command:
|
|
22
30
|
```bash
|
|
23
|
-
|
|
31
|
+
yalc add czapp-shared
|
|
24
32
|
```
|
|
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
33
|
|
|
28
34
|
To run the project in watch mode:
|
|
29
35
|
```bash
|
|
30
36
|
npm run watch
|
|
31
37
|
```
|
|
32
38
|
|
|
39
|
+
TODO - make yalc republish after every change. At the moment it is manual. Run `yalc publish` after every change.
|
|
40
|
+
|
|
33
41
|
To build the project (generate the artifacts):
|
|
34
42
|
```bash
|
|
35
43
|
To build:
|
package/dist/index.d.mts
CHANGED
|
@@ -188,18 +188,10 @@ declare class LexemePair implements ILexemePair {
|
|
|
188
188
|
declare const isStringContainingInteger: (str: any) => boolean;
|
|
189
189
|
declare const parameterReplace: (path: string, params?: string[]) => string;
|
|
190
190
|
|
|
191
|
-
interface
|
|
191
|
+
interface IActivityCount {
|
|
192
192
|
date: DateString;
|
|
193
193
|
count: number;
|
|
194
194
|
}
|
|
195
|
-
interface ITestedData {
|
|
196
|
-
date: DateString;
|
|
197
|
-
questionCount: number;
|
|
198
|
-
}
|
|
199
|
-
interface IReviewedData {
|
|
200
|
-
date: DateString;
|
|
201
|
-
flashcardCount: number;
|
|
202
|
-
}
|
|
203
195
|
|
|
204
196
|
interface IUserData {
|
|
205
197
|
currentStreakEnd: MySQLDate | undefined;
|
|
@@ -364,6 +356,9 @@ interface ControllerResponse<T> {
|
|
|
364
356
|
}
|
|
365
357
|
type TranslationResponseData = {
|
|
366
358
|
detectedSourceLanguage: Language;
|
|
359
|
+
sourceLangCode: string;
|
|
360
|
+
targetLangCode: string;
|
|
361
|
+
sourceText: string;
|
|
367
362
|
translations: Array<{
|
|
368
363
|
translatedText: string;
|
|
369
364
|
}>;
|
|
@@ -388,9 +383,9 @@ interface TestCompleteResponseData {
|
|
|
388
383
|
rewardPointsDelta: number;
|
|
389
384
|
}
|
|
390
385
|
interface HeatMapResponseData {
|
|
391
|
-
added:
|
|
392
|
-
tested:
|
|
393
|
-
reviewed:
|
|
386
|
+
added: IActivityCount[];
|
|
387
|
+
tested: IActivityCount[];
|
|
388
|
+
reviewed: IActivityCount[];
|
|
394
389
|
}
|
|
395
390
|
type DeeplTranslation = {
|
|
396
391
|
detectedSourceLanguage: Language;
|
|
@@ -399,4 +394,4 @@ type DeeplTranslation = {
|
|
|
399
394
|
}>;
|
|
400
395
|
};
|
|
401
396
|
|
|
402
|
-
export { ApiMethod, ApiPath, AppError, type AutologinRequestBody, ClientPlatform, type ControllerResponse, type DateString, type DeeplTranslation, type DeleteLexemePairRequestParams, Familiarity, type HeatMapParams, type HeatMapResponseData, HttpStatusCode, type
|
|
397
|
+
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 ITestResult, type IUserData, type InsertOrUpdateRequestBody, type InsertOrUpdateResponseData, Language, LearningStage, Lexeme, LexemePair, type LexemePairRequestBody, type LexemePairWithLang, type MySQLDate, Progress, type RecycleLexemePairParams, 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 UpdateOnboardingStatusRequestBody, type UpdateUserRequestBody, VocabCheckType, convertJSDateStringToMySQLDate, dateDifferenceInDays, getFormattedDate, getMysqlDateIgnoreTZ, isClientDateTooFarFromServerDate, isStringContainingInteger, isThePreviousDay, isTheSameDay, isValidJsDateString, isValidMysqlDateString, parameterReplace };
|
package/dist/index.d.ts
CHANGED
|
@@ -188,18 +188,10 @@ declare class LexemePair implements ILexemePair {
|
|
|
188
188
|
declare const isStringContainingInteger: (str: any) => boolean;
|
|
189
189
|
declare const parameterReplace: (path: string, params?: string[]) => string;
|
|
190
190
|
|
|
191
|
-
interface
|
|
191
|
+
interface IActivityCount {
|
|
192
192
|
date: DateString;
|
|
193
193
|
count: number;
|
|
194
194
|
}
|
|
195
|
-
interface ITestedData {
|
|
196
|
-
date: DateString;
|
|
197
|
-
questionCount: number;
|
|
198
|
-
}
|
|
199
|
-
interface IReviewedData {
|
|
200
|
-
date: DateString;
|
|
201
|
-
flashcardCount: number;
|
|
202
|
-
}
|
|
203
195
|
|
|
204
196
|
interface IUserData {
|
|
205
197
|
currentStreakEnd: MySQLDate | undefined;
|
|
@@ -364,6 +356,9 @@ interface ControllerResponse<T> {
|
|
|
364
356
|
}
|
|
365
357
|
type TranslationResponseData = {
|
|
366
358
|
detectedSourceLanguage: Language;
|
|
359
|
+
sourceLangCode: string;
|
|
360
|
+
targetLangCode: string;
|
|
361
|
+
sourceText: string;
|
|
367
362
|
translations: Array<{
|
|
368
363
|
translatedText: string;
|
|
369
364
|
}>;
|
|
@@ -388,9 +383,9 @@ interface TestCompleteResponseData {
|
|
|
388
383
|
rewardPointsDelta: number;
|
|
389
384
|
}
|
|
390
385
|
interface HeatMapResponseData {
|
|
391
|
-
added:
|
|
392
|
-
tested:
|
|
393
|
-
reviewed:
|
|
386
|
+
added: IActivityCount[];
|
|
387
|
+
tested: IActivityCount[];
|
|
388
|
+
reviewed: IActivityCount[];
|
|
394
389
|
}
|
|
395
390
|
type DeeplTranslation = {
|
|
396
391
|
detectedSourceLanguage: Language;
|
|
@@ -399,4 +394,4 @@ type DeeplTranslation = {
|
|
|
399
394
|
}>;
|
|
400
395
|
};
|
|
401
396
|
|
|
402
|
-
export { ApiMethod, ApiPath, AppError, type AutologinRequestBody, ClientPlatform, type ControllerResponse, type DateString, type DeeplTranslation, type DeleteLexemePairRequestParams, Familiarity, type HeatMapParams, type HeatMapResponseData, HttpStatusCode, type
|
|
397
|
+
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 ITestResult, type IUserData, type InsertOrUpdateRequestBody, type InsertOrUpdateResponseData, Language, LearningStage, Lexeme, LexemePair, type LexemePairRequestBody, type LexemePairWithLang, type MySQLDate, Progress, type RecycleLexemePairParams, 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 UpdateOnboardingStatusRequestBody, type UpdateUserRequestBody, VocabCheckType, convertJSDateStringToMySQLDate, dateDifferenceInDays, getFormattedDate, getMysqlDateIgnoreTZ, isClientDateTooFarFromServerDate, isStringContainingInteger, isThePreviousDay, isTheSameDay, isValidJsDateString, isValidMysqlDateString, parameterReplace };
|
package/dist/index.js
CHANGED
|
@@ -17,8 +17,8 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
17
17
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
18
|
|
|
19
19
|
// src/index.ts
|
|
20
|
-
var
|
|
21
|
-
__export(
|
|
20
|
+
var index_exports = {};
|
|
21
|
+
__export(index_exports, {
|
|
22
22
|
ApiMethod: () => ApiMethod,
|
|
23
23
|
ApiPath: () => ApiPath,
|
|
24
24
|
AppError: () => AppError,
|
|
@@ -45,7 +45,7 @@ __export(src_exports, {
|
|
|
45
45
|
isValidMysqlDateString: () => isValidMysqlDateString,
|
|
46
46
|
parameterReplace: () => parameterReplace
|
|
47
47
|
});
|
|
48
|
-
module.exports = __toCommonJS(
|
|
48
|
+
module.exports = __toCommonJS(index_exports);
|
|
49
49
|
|
|
50
50
|
// src/concrete/date.ts
|
|
51
51
|
var getMysqlDateIgnoreTZ = (date) => {
|
package/package.json
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "czapp-shared",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.20",
|
|
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",
|
|
7
7
|
"typings": "dist/index.d.ts",
|
|
8
8
|
"scripts": {
|
|
9
|
-
"test:unit": "mocha --require ts-node/register/transpile-only test/**/*.ts",
|
|
10
9
|
"build": "tsup src/index.ts --clean --format=cjs,esm --dts",
|
|
11
|
-
"
|
|
12
|
-
"
|
|
10
|
+
"watch": "npm run build -- --watch",
|
|
11
|
+
"test:unit": "mocha --require ts-node/register/transpile-only test/**/*.ts",
|
|
12
|
+
"release:bump": "bumpp"
|
|
13
13
|
},
|
|
14
14
|
"repository": {
|
|
15
15
|
"type": "git",
|
package/src/design/api.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { IActivityCount } from './data';
|
|
2
2
|
import { ILexeme, ILexemeIdPair, ILexemeLearningInfo, ILexemePair } from './lexemes';
|
|
3
3
|
import { DateString, Familiarity, ITestResult, Language, MySQLDate, Scenario, VocabCheckType } from './types';
|
|
4
4
|
import { IUserData } from './user';
|
|
@@ -158,6 +158,9 @@ export interface ControllerResponse<T> {
|
|
|
158
158
|
// Response Data
|
|
159
159
|
export type TranslationResponseData = {
|
|
160
160
|
detectedSourceLanguage: Language,
|
|
161
|
+
sourceLangCode: string,
|
|
162
|
+
targetLangCode: string,
|
|
163
|
+
sourceText: string,
|
|
161
164
|
translations: Array<{
|
|
162
165
|
translatedText: string
|
|
163
166
|
}>
|
|
@@ -183,9 +186,9 @@ export interface TestCompleteResponseData {
|
|
|
183
186
|
}
|
|
184
187
|
|
|
185
188
|
export interface HeatMapResponseData {
|
|
186
|
-
added:
|
|
187
|
-
tested:
|
|
188
|
-
reviewed:
|
|
189
|
+
added: IActivityCount[];
|
|
190
|
+
tested: IActivityCount[];
|
|
191
|
+
reviewed: IActivityCount[];
|
|
189
192
|
}
|
|
190
193
|
|
|
191
194
|
// other
|
package/src/design/data.ts
CHANGED
|
@@ -1,17 +1,6 @@
|
|
|
1
1
|
import { DateString } from './types';
|
|
2
2
|
|
|
3
|
-
export interface
|
|
3
|
+
export interface IActivityCount {
|
|
4
4
|
date: DateString;
|
|
5
5
|
count: number;
|
|
6
6
|
}
|
|
7
|
-
|
|
8
|
-
export interface ITestedData {
|
|
9
|
-
date: DateString;
|
|
10
|
-
questionCount: number;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export interface IReviewedData {
|
|
14
|
-
date: DateString;
|
|
15
|
-
flashcardCount: number;
|
|
16
|
-
}
|
|
17
|
-
|