revdev 0.367.0 → 0.369.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.
- package/lib/back/common/entity.d.ts +1 -0
- package/lib/back/index.d.ts +1 -0
- package/lib/back/index.js +1 -0
- package/lib/back/item/request.d.ts +2 -1
- package/lib/back/rule/entity.d.ts +8 -6
- package/lib/back/rule/request.d.ts +13 -1
- package/lib/back/ruleCategory/entity.d.ts +8 -0
- package/lib/back/ruleCategory/entity.js +2 -0
- package/lib/back/ruleCategory/index.d.ts +2 -0
- package/lib/back/ruleCategory/index.js +18 -0
- package/lib/back/ruleCategory/request.d.ts +12 -0
- package/lib/back/ruleCategory/request.js +2 -0
- package/lib/common/enums.d.ts +1 -0
- package/lib/common/enums.js +1 -0
- package/lib/shared/exercise/regular.d.ts +6 -8
- package/lib/tests/array.test.js +1 -0
- package/lib/utils/array.d.ts +1 -1
- package/lib/utils/array.js +6 -1
- package/lib/utils/regex.d.ts +2 -0
- package/lib/utils/regex.js +6 -0
- package/lib/utils/tests/slug.test.js +19 -0
- package/package.json +1 -1
package/lib/back/index.d.ts
CHANGED
package/lib/back/index.js
CHANGED
|
@@ -36,6 +36,7 @@ __exportStar(require("./episode"), exports);
|
|
|
36
36
|
__exportStar(require("./exercise"), exports);
|
|
37
37
|
__exportStar(require("./item"), exports);
|
|
38
38
|
__exportStar(require("./rule"), exports);
|
|
39
|
+
__exportStar(require("./ruleCategory"), exports);
|
|
39
40
|
__exportStar(require("./admin"), exports);
|
|
40
41
|
__exportStar(require("./ai"), exports);
|
|
41
42
|
__exportStar(require("./topic"), exports);
|
|
@@ -6,7 +6,7 @@ export interface BoGenerateItemChoiceRequest {
|
|
|
6
6
|
count: number;
|
|
7
7
|
exerciseId: string;
|
|
8
8
|
altRuleIds: string[];
|
|
9
|
-
|
|
9
|
+
answerTotal?: number;
|
|
10
10
|
}
|
|
11
11
|
export interface BoCreateItemChoiceSetRequest {
|
|
12
12
|
exerciseId: string;
|
|
@@ -14,6 +14,7 @@ export interface BoCreateItemChoiceSetRequest {
|
|
|
14
14
|
content: string;
|
|
15
15
|
answers: string[];
|
|
16
16
|
correctAnswerIndex: number;
|
|
17
|
+
ruleId?: string;
|
|
17
18
|
}[];
|
|
18
19
|
}
|
|
19
20
|
export interface BoUpdateItemRegularRequest {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { EntryStatus, LevelGen, NameGen, SelectOption } from "../../common";
|
|
2
2
|
export interface BoRuleRecord {
|
|
3
3
|
id: string;
|
|
4
4
|
langCode: string;
|
|
@@ -12,10 +12,12 @@ export interface BoRuleRecord {
|
|
|
12
12
|
levels: LevelGen[];
|
|
13
13
|
levelTotal: number;
|
|
14
14
|
userTotal: number;
|
|
15
|
+
category?: NameGen;
|
|
15
16
|
}
|
|
16
|
-
export interface
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
17
|
+
export interface BoRuleExerciseGenerator {
|
|
18
|
+
langCode: string;
|
|
19
|
+
rule: NameGen;
|
|
20
|
+
category?: NameGen;
|
|
21
|
+
ignoreRuleIds: string[];
|
|
22
|
+
altRuleOptions: SelectOption[];
|
|
21
23
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ContentType } from "../../common";
|
|
1
|
+
import { ContentType, EntryStatus, LangOptionRequest, LevelGen, ValueOption } from "../../common";
|
|
2
2
|
import { LangFeedRequest } from "../../feed";
|
|
3
3
|
export interface BoCreateRuleRequest {
|
|
4
4
|
langCode: string;
|
|
@@ -9,10 +9,19 @@ export interface BoCreateRuleRequest {
|
|
|
9
9
|
note?: string;
|
|
10
10
|
predefinedOptions?: string[];
|
|
11
11
|
description: string;
|
|
12
|
+
categoryId?: string;
|
|
12
13
|
}
|
|
13
14
|
export interface BoUpdateRuleRequest extends BoCreateRuleRequest {
|
|
14
15
|
id: string;
|
|
15
16
|
}
|
|
17
|
+
export interface BoRuleModifier extends BoUpdateRuleRequest {
|
|
18
|
+
categoryOption?: ValueOption;
|
|
19
|
+
created: string;
|
|
20
|
+
active: boolean;
|
|
21
|
+
status?: EntryStatus;
|
|
22
|
+
exerciseTotal: number;
|
|
23
|
+
levels: LevelGen[];
|
|
24
|
+
}
|
|
16
25
|
export interface BoRuleFeedRequest extends LangFeedRequest {
|
|
17
26
|
hasLevel?: boolean;
|
|
18
27
|
levelCode?: string;
|
|
@@ -26,3 +35,6 @@ export interface BoDeleteRuleLevelRequest {
|
|
|
26
35
|
ruleId: string;
|
|
27
36
|
levelCode: string;
|
|
28
37
|
}
|
|
38
|
+
export interface BoRuleOptionRequest extends LangOptionRequest {
|
|
39
|
+
categoryId?: string;
|
|
40
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./entity"), exports);
|
|
18
|
+
__exportStar(require("./request"), exports);
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { ValueOption } from "../../common";
|
|
2
|
+
export interface BoCreateRuleCategoryRequest {
|
|
3
|
+
langCode: string;
|
|
4
|
+
name: string;
|
|
5
|
+
rootRuleId?: string;
|
|
6
|
+
}
|
|
7
|
+
export interface BoUpdateRuleCategoryRequest extends BoCreateRuleCategoryRequest {
|
|
8
|
+
id: string;
|
|
9
|
+
}
|
|
10
|
+
export interface BoRuleCategoryModifier extends BoUpdateRuleCategoryRequest {
|
|
11
|
+
rootRuleOption?: ValueOption;
|
|
12
|
+
}
|
package/lib/common/enums.d.ts
CHANGED
|
@@ -122,6 +122,7 @@ export declare enum AiPromptName {
|
|
|
122
122
|
WordMeaning = "wordMeaning",
|
|
123
123
|
WordTranscription = "wordTranscription",
|
|
124
124
|
ExerciseItemChoice = "exerciseItemChoice",
|
|
125
|
+
RuleItemChoice = "ruleItemChoice",
|
|
125
126
|
WordLevel = "wordLevel",
|
|
126
127
|
RuleLevel = "ruleLevel"
|
|
127
128
|
}
|
package/lib/common/enums.js
CHANGED
|
@@ -154,6 +154,7 @@ var AiPromptName;
|
|
|
154
154
|
AiPromptName["WordMeaning"] = "wordMeaning";
|
|
155
155
|
AiPromptName["WordTranscription"] = "wordTranscription";
|
|
156
156
|
AiPromptName["ExerciseItemChoice"] = "exerciseItemChoice";
|
|
157
|
+
AiPromptName["RuleItemChoice"] = "ruleItemChoice";
|
|
157
158
|
AiPromptName["WordLevel"] = "wordLevel";
|
|
158
159
|
AiPromptName["RuleLevel"] = "ruleLevel";
|
|
159
160
|
})(AiPromptName || (exports.AiPromptName = AiPromptName = {}));
|
|
@@ -1,24 +1,22 @@
|
|
|
1
1
|
import { EntryStatus, ExerciseKind } from "../../common";
|
|
2
|
-
export interface
|
|
3
|
-
|
|
4
|
-
ruleId?: string;
|
|
2
|
+
export interface CreateExerciseRequest {
|
|
3
|
+
ruleId: string;
|
|
5
4
|
kind: ExerciseKind;
|
|
6
5
|
}
|
|
7
|
-
export interface
|
|
6
|
+
export interface UpdateExerciseRequest extends Pick<CreateExerciseRequest, "kind"> {
|
|
8
7
|
id: string;
|
|
9
8
|
}
|
|
10
|
-
export interface
|
|
9
|
+
export interface ExerciseModifier extends CreateExerciseRequest {
|
|
11
10
|
id: string;
|
|
12
11
|
valid: boolean;
|
|
13
|
-
exerciseRuleId?: string;
|
|
14
12
|
itemTotal: number;
|
|
15
13
|
active: boolean;
|
|
16
14
|
status?: EntryStatus;
|
|
17
15
|
}
|
|
18
|
-
export interface
|
|
16
|
+
export interface GenerateExerciseRequest {
|
|
19
17
|
ruleId: string;
|
|
20
18
|
kind: ExerciseKind;
|
|
21
19
|
itemCount: number;
|
|
22
20
|
altRuleIds: string[];
|
|
23
|
-
|
|
21
|
+
answerTotal?: number;
|
|
24
22
|
}
|
package/lib/tests/array.test.js
CHANGED
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
var utils_1 = require("../utils");
|
|
4
4
|
describe("ArrayUtil Test", function () {
|
|
5
5
|
test("true", function () {
|
|
6
|
+
expect(utils_1.ArrayUtil.toArray(undefined)).toMatchObject([]);
|
|
6
7
|
expect(utils_1.ArrayUtil.toArray(1)).toMatchObject([1]);
|
|
7
8
|
expect(utils_1.ArrayUtil.toArray("text")).toMatchObject(["text"]);
|
|
8
9
|
});
|
package/lib/utils/array.d.ts
CHANGED
package/lib/utils/array.js
CHANGED
|
@@ -5,7 +5,12 @@ var ArrayUtil = /** @class */ (function () {
|
|
|
5
5
|
function ArrayUtil() {
|
|
6
6
|
}
|
|
7
7
|
ArrayUtil.toArray = function (item) {
|
|
8
|
-
|
|
8
|
+
if (Array.isArray(item)) {
|
|
9
|
+
return item;
|
|
10
|
+
}
|
|
11
|
+
else {
|
|
12
|
+
return item !== undefined ? [item] : [];
|
|
13
|
+
}
|
|
9
14
|
};
|
|
10
15
|
ArrayUtil.shuffle = function (array) {
|
|
11
16
|
var _a;
|
package/lib/utils/regex.d.ts
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
export declare class RegexUtil {
|
|
2
2
|
private static slugRegex;
|
|
3
|
+
private static shortSlugRegex;
|
|
3
4
|
private static usernameRegex;
|
|
4
5
|
private static tagCodeRegex;
|
|
5
6
|
private static emailRegex;
|
|
6
7
|
private static passwordRegex;
|
|
7
8
|
static slug(slug: string): boolean;
|
|
9
|
+
static shortSlug(slug: string): boolean;
|
|
8
10
|
static username(text: string): boolean;
|
|
9
11
|
static tagCode(text: string): boolean;
|
|
10
12
|
static email(text: string): boolean;
|
package/lib/utils/regex.js
CHANGED
|
@@ -8,6 +8,10 @@ var RegexUtil = /** @class */ (function () {
|
|
|
8
8
|
this.slugRegex.lastIndex = 0;
|
|
9
9
|
return this.slugRegex.test(slug);
|
|
10
10
|
};
|
|
11
|
+
RegexUtil.shortSlug = function (slug) {
|
|
12
|
+
this.shortSlugRegex.lastIndex = 0;
|
|
13
|
+
return this.shortSlugRegex.test(slug);
|
|
14
|
+
};
|
|
11
15
|
RegexUtil.username = function (text) {
|
|
12
16
|
this.usernameRegex.lastIndex = 0;
|
|
13
17
|
return this.usernameRegex.test(text);
|
|
@@ -28,6 +32,8 @@ var RegexUtil = /** @class */ (function () {
|
|
|
28
32
|
};
|
|
29
33
|
// min: 6, max: 50
|
|
30
34
|
RegexUtil.slugRegex = /^[a-z][a-z0-9-]{4,48}[a-z0-9]$/g;
|
|
35
|
+
// min: 1, max: 50
|
|
36
|
+
RegexUtil.shortSlugRegex = /^[a-z](?:[a-z0-9-]{0,48}[a-z0-9])?$/g;
|
|
31
37
|
// min: 6, max: 50
|
|
32
38
|
RegexUtil.usernameRegex = /^[a-z][a-z0-9]{5,48}$/g;
|
|
33
39
|
RegexUtil.tagCodeRegex = /^[a-z]([-]?[a-z]+)*$/g;
|
|
@@ -19,6 +19,25 @@ describe("RegexUtil", function () {
|
|
|
19
19
|
validate("1mylist", false);
|
|
20
20
|
});
|
|
21
21
|
});
|
|
22
|
+
describe("shortSlug", function () {
|
|
23
|
+
function validate(text, valid) {
|
|
24
|
+
if (valid === void 0) { valid = true; }
|
|
25
|
+
expect(regex_1.RegexUtil.shortSlug(text)).toBe(valid);
|
|
26
|
+
}
|
|
27
|
+
test("true", function () {
|
|
28
|
+
validate("a");
|
|
29
|
+
validate("my-list");
|
|
30
|
+
validate("m12345");
|
|
31
|
+
validate("a".repeat(50));
|
|
32
|
+
});
|
|
33
|
+
test("false", function () {
|
|
34
|
+
validate("", false);
|
|
35
|
+
validate("-mylist", false);
|
|
36
|
+
validate("1mylist", false);
|
|
37
|
+
validate("mylist-", false);
|
|
38
|
+
validate("a".repeat(51), false);
|
|
39
|
+
});
|
|
40
|
+
});
|
|
22
41
|
describe("username", function () {
|
|
23
42
|
function validate(text, valid) {
|
|
24
43
|
if (valid === void 0) { valid = true; }
|