revdev 0.234.0 → 0.236.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
- }
@@ -2,9 +2,11 @@ import { UserReaction } from "./enums";
2
2
  export interface ReactionModifier {
3
3
  id: string;
4
4
  reaction?: UserReaction;
5
+ reactionId?: string;
5
6
  rate: number;
6
7
  }
7
8
  export interface PinModifier {
8
9
  id: string;
9
10
  pinned?: boolean;
11
+ pinId?: string;
10
12
  }
@@ -26,3 +26,9 @@ export interface PinRequest {
26
26
  export interface TokenRequest {
27
27
  token: string;
28
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,14 +1,4 @@
1
- import { PinRequest, ReactionModifier, ReactionRequest } from "../../common";
1
+ import { PinRequest } from "../../common";
2
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 Pick<ReactionRequest, "reaction"> {
10
- tranId: string;
11
- }
12
- export interface FeTranReactionModifier extends ReactionModifier {
13
- tranId: string;
14
- }
@@ -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,4 +1,4 @@
1
- import { Knowing } from "../../common";
1
+ import { IdRequest, Knowing } from "../../common";
2
2
  import { WordFeedExtension, FeedRequest, ShortFeedRequest } from "../../feed";
3
3
  import { CreateWordRequest } from "../../shared";
4
4
  interface BaseWordEntityRequest {
@@ -46,4 +46,7 @@ export interface FeWordKnowingRequest {
46
46
  wordIds: string[];
47
47
  knowing: Knowing;
48
48
  }
49
+ export interface FeWordTranRecordRequest extends IdRequest {
50
+ tranLangCode: string;
51
+ }
49
52
  export {};
@@ -1,10 +1,8 @@
1
- import { ContribGen, 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;
@@ -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,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.234.0",
3
+ "version": "0.236.0",
4
4
  "description": "",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",