revdev 0.233.0 → 0.235.0

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.
@@ -1,8 +1,9 @@
1
- import { IdCodeOption } from "../../common";
1
+ import { IdCodeOption, StringOption } from "../../common";
2
+ import { AppSettings } from "../../shared";
2
3
  export interface BoInitData {
3
- langCodes: string[];
4
+ langOptions: StringOption[];
4
5
  speechPartOptions: IdCodeOption[];
5
6
  quizCodes: string[];
6
7
  localeCodes: string[];
7
- localeTexts: [string, string][];
8
+ settings: AppSettings;
8
9
  }
@@ -1,14 +1,26 @@
1
- import { DualContribGen, EntryStatus } from "../../common";
1
+ import { ContribGen, DualContribGen, EntryStatus, ImageGen, UserReaction } from "../../common";
2
2
  import { WordGen } from "../../shared";
3
3
  export interface BoWordImageRecord {
4
4
  id: string;
5
5
  word: WordGen;
6
- imageId: string;
7
- fileName: string;
8
- thumbnailFileName: string;
6
+ image: ImageGen;
9
7
  contrib: DualContribGen;
10
8
  wordTotal: number;
11
9
  rate: number;
12
10
  active: boolean;
13
11
  status?: EntryStatus;
14
12
  }
13
+ interface WordImageContainerRecord {
14
+ id: string;
15
+ wordImageId: string;
16
+ word: WordGen;
17
+ image: ImageGen;
18
+ rate: number;
19
+ contrib: ContribGen;
20
+ }
21
+ export interface BoWordImageReactionRecord extends WordImageContainerRecord {
22
+ reaction: UserReaction;
23
+ }
24
+ export interface BoWordImagePinRecord extends WordImageContainerRecord {
25
+ }
26
+ export {};
@@ -2,8 +2,3 @@ import { LangFeedRequest } from "../../feed";
2
2
  export interface BoWordImageFeedRequest extends LangFeedRequest {
3
3
  wordId?: string;
4
4
  }
5
- export interface BoUploadWordImageRequest {
6
- langCode: string;
7
- text: string;
8
- [key: string]: any;
9
- }
@@ -31,5 +31,6 @@ export declare enum ExceptionCodes {
31
31
  ImageCannotUploadInDevelopmentFolder = "ImageCannotUploadInDevelopmentFolder",
32
32
  CsvParsingValidation = "CsvParsingValidation",
33
33
  EntryStatusCannotBeChangedForAdminEntity = "EntryStatusCannotBeChangedForAdminEntity",
34
- MaxTranWordPinsExceeded = "MaxTranWordPinsExceeded"
34
+ MaxTranWordPinsExceeded = "MaxTranWordPinsExceeded",
35
+ MaxWordImagePinsExceeded = "MaxWordImagePinsExceeded"
35
36
  }
@@ -39,4 +39,5 @@ var ExceptionCodes;
39
39
  // entry status
40
40
  ExceptionCodes["EntryStatusCannotBeChangedForAdminEntity"] = "EntryStatusCannotBeChangedForAdminEntity";
41
41
  ExceptionCodes["MaxTranWordPinsExceeded"] = "MaxTranWordPinsExceeded";
42
+ ExceptionCodes["MaxWordImagePinsExceeded"] = "MaxWordImagePinsExceeded";
42
43
  })(ExceptionCodes = exports.ExceptionCodes || (exports.ExceptionCodes = {}));
@@ -0,0 +1,5 @@
1
+ export interface ImageGen {
2
+ id: string;
3
+ fileName: string;
4
+ thumbnailFileName: string;
5
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -8,3 +8,5 @@ export * from "./gen";
8
8
  export * from "./link";
9
9
  export * from "./feed";
10
10
  export * from "./exception";
11
+ export * from "./modifier";
12
+ export * from "./image";
@@ -20,3 +20,5 @@ __exportStar(require("./gen"), exports);
20
20
  __exportStar(require("./link"), exports);
21
21
  __exportStar(require("./feed"), exports);
22
22
  __exportStar(require("./exception"), exports);
23
+ __exportStar(require("./modifier"), exports);
24
+ __exportStar(require("./image"), exports);
@@ -0,0 +1,12 @@
1
+ import { UserReaction } from "./enums";
2
+ export interface ReactionModifier {
3
+ id: string;
4
+ reaction?: UserReaction;
5
+ reactionId?: string;
6
+ rate: number;
7
+ }
8
+ export interface PinModifier {
9
+ id: string;
10
+ pinned?: boolean;
11
+ pinId?: string;
12
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -17,10 +17,18 @@ export interface WordIdsRequest {
17
17
  }
18
18
  export interface ReactionRequest {
19
19
  reaction: UserReaction;
20
+ id: string;
20
21
  }
21
22
  export interface PinRequest {
22
23
  pin: boolean;
24
+ id: string;
23
25
  }
24
26
  export interface TokenRequest {
25
27
  token: string;
26
28
  }
29
+ export interface OptionRequest {
30
+ search?: string;
31
+ }
32
+ export interface LangOptionRequest extends OptionRequest {
33
+ langCode: string;
34
+ }
@@ -1,4 +1,5 @@
1
1
  import { IdCodeOption } from "../../common";
2
+ import { AppSettings } from "../../shared";
2
3
  import { FeLangRecord } from "../lang";
3
4
  import { FeListRecord } from "../list";
4
5
  import { FeTableRecord } from "../table";
@@ -8,6 +9,7 @@ export interface FeInitData {
8
9
  speechPartOptions: IdCodeOption[];
9
10
  quizCodes: string[];
10
11
  localeCodes: string[];
12
+ settings: AppSettings;
11
13
  }
12
14
  export interface FeIntroductionData {
13
15
  langs: FeLangRecord[];
@@ -1,4 +1,4 @@
1
- import { ContribGen, UserReaction } from "../../common";
1
+ import { ContribGen, PinModifier, UserReaction } from "../../common";
2
2
  import { TranRecord } from "../../shared";
3
3
  import { WordDataGen } from "../word";
4
4
  export interface FeTranRecord extends Omit<TranRecord, "dest"> {
@@ -8,3 +8,6 @@ export interface FeTranRecord extends Omit<TranRecord, "dest"> {
8
8
  pinned: boolean;
9
9
  contrib?: ContribGen;
10
10
  }
11
+ export interface FeTranWordPinModifier extends PinModifier {
12
+ tranId: string;
13
+ }
@@ -1,15 +1,4 @@
1
- import { PinRequest, ReactionRequest } from "../../common";
2
- export interface FeTranWordPinRequest extends PinRequest {
1
+ import { PinRequest } from "../../common";
2
+ export interface FeTranWordPinRequest extends Pick<PinRequest, "pin"> {
3
3
  tranWordId: string;
4
4
  }
5
- export interface FeTranWordPinModifier extends FeTranWordPinRequest {
6
- tranId: string;
7
- id: string;
8
- }
9
- export interface FeTranReactionRequest extends ReactionRequest {
10
- tranId: string;
11
- }
12
- export interface FeTranReactionModifier extends FeTranReactionRequest {
13
- rate: number;
14
- id: string;
15
- }
@@ -1,7 +1,7 @@
1
1
  import { Feed } from "../../feed";
2
2
  import { QuizCode, QuizMode, DualContribGen, AccessGen, ContribGen } from "../../common";
3
3
  import { FeTranRecord } from "../tran";
4
- import { ReactionGen, WordUserGen } from "../../shared";
4
+ import { WordUserGen } from "../../shared";
5
5
  import { FeWordImageRecord } from "../wordImage";
6
6
  export interface WordDataGen extends WordUserGen {
7
7
  attempts?: FeWordAttempt[];
@@ -13,7 +13,6 @@ export interface WordDataGen extends WordUserGen {
13
13
  export interface FeWordTag {
14
14
  wordId: string;
15
15
  tagCode: string;
16
- reaction: ReactionGen;
17
16
  contrib: ContribGen;
18
17
  }
19
18
  export interface FeWordAttempt {
@@ -30,7 +29,6 @@ export interface FeWordAudio {
30
29
  wordId: string;
31
30
  audioId: string;
32
31
  fileName: string;
33
- reaction: ReactionGen;
34
32
  contrib: ContribGen;
35
33
  }
36
34
  export interface FeWordSpeechPart {
@@ -1,13 +1,11 @@
1
- import { DualContribGen, UserReaction } from "../../common";
1
+ import { ContribGen, ImageGen, UserReaction } from "../../common";
2
2
  export interface FeWordImageRecord {
3
3
  id: string;
4
4
  wordId: string;
5
- imageId: string;
6
- fileName: string;
7
- thumbnailFileName: string;
5
+ image: ImageGen;
8
6
  active: boolean;
9
7
  rate: number;
10
8
  reaction: UserReaction;
11
9
  pinned: boolean;
12
- contrib: DualContribGen;
10
+ contrib: ContribGen;
13
11
  }
@@ -5,11 +5,27 @@ export interface WordKnowledge {
5
5
  unknown: number;
6
6
  }
7
7
  export declare type UserWordKnowing = [number, number];
8
- export interface ReactionGen {
9
- rate: number;
10
- userRate: number;
11
- }
12
8
  export interface UpdatedEntity {
13
9
  id: string;
14
10
  slug: string;
15
11
  }
12
+ export interface AppSettings {
13
+ readonly maxQuizWords: number;
14
+ readonly feedTake: number;
15
+ readonly shortFeedTake: number;
16
+ readonly maxListWords: number;
17
+ readonly maxTableRows: number;
18
+ readonly maxTableColumns: number;
19
+ readonly maxTableCellWords: number;
20
+ readonly resetPasswordTokenLifeHours: number;
21
+ readonly proveKnowingWords: number;
22
+ readonly wordSetTake: number;
23
+ readonly wordAttemptTake: number;
24
+ readonly wordImageMinDimension: number;
25
+ readonly wordImageOptimalDimension: number;
26
+ readonly wordImageThumbnailSize: number;
27
+ readonly initRateRange: [number, number];
28
+ readonly maxTranWordPins: number;
29
+ readonly maxWordImagePins: number;
30
+ readonly optionCount: number;
31
+ }
@@ -1 +1,2 @@
1
1
  export * from "./entity";
2
+ export * from "./request";
@@ -11,3 +11,4 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
11
11
  };
12
12
  Object.defineProperty(exports, "__esModule", { value: true });
13
13
  __exportStar(require("./entity"), exports);
14
+ __exportStar(require("./request"), exports);
@@ -0,0 +1,3 @@
1
+ export interface UploadWordImageRequest {
2
+ wordId: string;
3
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ var utils_1 = require("../utils");
4
+ describe("ArrayUtil Test", function () {
5
+ test("true", function () {
6
+ expect(utils_1.ArrayUtil.toArray(1)).toMatchObject([1]);
7
+ expect(utils_1.ArrayUtil.toArray("text")).toMatchObject(["text"]);
8
+ });
9
+ });
@@ -0,0 +1,5 @@
1
+ export declare class FileNameUtil {
2
+ static extension(fileName: string): string | undefined;
3
+ static parseAccept(accept: string): string[];
4
+ static extensionMatch(fileName: string, accept: string): boolean;
5
+ }
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.FileNameUtil = void 0;
4
+ var FileNameUtil = /** @class */ (function () {
5
+ function FileNameUtil() {
6
+ }
7
+ FileNameUtil.extension = function (fileName) {
8
+ return fileName === null || fileName === void 0 ? void 0 : fileName.split(".").pop();
9
+ };
10
+ FileNameUtil.parseAccept = function (accept) {
11
+ var extensions = (accept === null || accept === void 0 ? void 0 : accept.split(",").map(function (text) { return text.trim().replace(/^./, ""); })) || [];
12
+ return extensions;
13
+ };
14
+ FileNameUtil.extensionMatch = function (fileName, accept) {
15
+ var extension = FileNameUtil.extension(fileName);
16
+ var allowExtensions = FileNameUtil.parseAccept(accept);
17
+ return allowExtensions.includes(extension || "");
18
+ };
19
+ return FileNameUtil;
20
+ }());
21
+ exports.FileNameUtil = FileNameUtil;
@@ -4,3 +4,4 @@ export * from "./string";
4
4
  export * from "./regex";
5
5
  export * from "./array";
6
6
  export * from "./link";
7
+ export * from "./fileName";
@@ -16,3 +16,4 @@ __exportStar(require("./string"), exports);
16
16
  __exportStar(require("./regex"), exports);
17
17
  __exportStar(require("./array"), exports);
18
18
  __exportStar(require("./link"), exports);
19
+ __exportStar(require("./fileName"), exports);
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ var fileName_1 = require("../fileName");
4
+ describe("FileNameUtil", function () {
5
+ test("extension", function () {
6
+ expect(fileName_1.FileNameUtil.extension("file.txt")).toBe("txt");
7
+ expect(fileName_1.FileNameUtil.extension("first.file.txt")).toBe("txt");
8
+ expect(fileName_1.FileNameUtil.extension("file")).toBe("file");
9
+ expect(fileName_1.FileNameUtil.extension("")).toBe("");
10
+ expect(fileName_1.FileNameUtil.extension(undefined)).toBe(undefined);
11
+ });
12
+ test("parseAccept", function () {
13
+ expect(fileName_1.FileNameUtil.parseAccept(".jpg,.png")).toMatchObject(["jpg", "png"]);
14
+ expect(fileName_1.FileNameUtil.parseAccept(".jpg , .png")).toMatchObject(["jpg", "png"]);
15
+ });
16
+ test("extensionMatch", function () {
17
+ expect(fileName_1.FileNameUtil.extensionMatch("file.jpg", ".jpg,.png")).toBeTruthy();
18
+ });
19
+ });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "revdev",
3
- "version": "0.233.0",
3
+ "version": "0.235.0",
4
4
  "description": "",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",