@tinyweb_dev/oe-exam-sdk 0.1.26 → 0.1.27
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 +5 -4
- package/dist/components/exams/ExamPreviewDialog.d.ts +7 -6
- package/dist/components/exams/ExamPreviewDialog.js +1 -1
- package/dist/components/exams/index.d.ts +0 -1
- package/dist/components/exams/take/components/QuestionRenderer.js +1 -1
- package/dist/components/exams/take/components/question-renderers/MoversListenAndWriteRenderer.js +1 -1
- package/dist/components/exams/take/components/question-renderers/MoversWordFillStructuredFormRenderer.js +1 -1
- package/dist/components/exams/take/exam-taking.utils.d.ts +0 -13
- package/dist/components/exams/take/exam-taking.utils.js +1 -1
- package/dist/components/exams/take/utils/answer-transformers.js +1 -1
- package/dist/components/exams/take/utils/question-transformers.d.ts +7 -17
- package/dist/components/exams/take/utils/question-transformers.js +1 -1
- package/dist/components/questions/_shared/config/question-types.config.js +1 -1
- package/dist/components/questions/_shared/types/choose-the-correct-answer-group.type.d.ts +36 -0
- package/dist/components/questions/_shared/types/cross-out-word-group.type.d.ts +40 -0
- package/dist/components/questions/_shared/types/index.d.ts +1 -0
- package/dist/components/questions/_shared/types/index.js +1 -1
- package/dist/components/questions/_shared/types/true-false-group.type.d.ts +31 -0
- package/dist/components/questions/_shared/types/true-false-group.type.js +1 -0
- package/dist/components/questions/_shared/types/word-fill-structured-form.type.d.ts +11 -17
- package/dist/components/questions/creator/question-type-registry.js +1 -1
- package/dist/components/questions/index.d.ts +0 -1
- package/dist/components/questions/index.js +1 -1
- package/dist/components/questions/types/choose-the-correct-answer-group/ChooseTheCorrectAnswerGroupClient.d.ts +2 -0
- package/dist/components/questions/types/choose-the-correct-answer-group/ChooseTheCorrectAnswerGroupClient.js +1 -0
- package/dist/components/questions/types/choose-the-correct-answer-group/ChooseTheCorrectAnswerGroupCreator.d.ts +2 -0
- package/dist/components/questions/types/choose-the-correct-answer-group/ChooseTheCorrectAnswerGroupCreator.js +1 -0
- package/dist/components/questions/types/choose-the-correct-answer-group/index.d.ts +2 -0
- package/dist/components/questions/types/choose-the-correct-answer-group/index.js +1 -0
- package/dist/components/questions/types/choose-the-correct-answer-group/register.d.ts +2 -0
- package/dist/components/questions/types/choose-the-correct-answer-group/register.js +1 -0
- package/dist/components/questions/types/choose-the-correct-answer-group/transform.d.ts +2 -0
- package/dist/components/questions/types/choose-the-correct-answer-group/transform.js +1 -0
- package/dist/components/questions/types/cross-out-word-group/CrossOutWordGroupClient.d.ts +2 -0
- package/dist/components/questions/types/cross-out-word-group/CrossOutWordGroupClient.js +1 -0
- package/dist/components/questions/types/cross-out-word-group/CrossOutWordGroupCreator.d.ts +2 -0
- package/dist/components/questions/types/cross-out-word-group/CrossOutWordGroupCreator.js +1 -0
- package/dist/components/questions/types/cross-out-word-group/index.d.ts +4 -0
- package/dist/components/questions/types/cross-out-word-group/index.js +1 -0
- package/dist/components/questions/types/cross-out-word-group/register.d.ts +2 -0
- package/dist/components/questions/types/cross-out-word-group/register.js +1 -0
- package/dist/components/questions/types/cross-out-word-group/transform.d.ts +2 -0
- package/dist/components/questions/types/cross-out-word-group/transform.js +1 -0
- package/dist/components/questions/types/true-false-group/TrueFalseGroupClient.d.ts +2 -0
- package/dist/components/questions/types/true-false-group/TrueFalseGroupClient.js +1 -0
- package/dist/components/questions/types/true-false-group/TrueFalseGroupCreator.d.ts +2 -0
- package/dist/components/questions/types/true-false-group/TrueFalseGroupCreator.js +1 -0
- package/dist/components/questions/types/true-false-group/index.d.ts +4 -0
- package/dist/components/questions/types/true-false-group/index.js +1 -0
- package/dist/components/questions/types/true-false-group/register.d.ts +2 -0
- package/dist/components/questions/types/true-false-group/register.js +1 -0
- package/dist/components/questions/types/true-false-group/transform.d.ts +2 -0
- package/dist/components/questions/types/true-false-group/transform.js +1 -0
- package/dist/components/questions/types/word-fill-structured-form/transform.js +1 -1
- package/dist/components/questions/viewer/QuestionViewer.js +1 -1
- package/dist/components/results/renderers/review-question-body-dedicated.js +1 -1
- package/dist/components/results/review-data.js +1 -1
- package/dist/components/themes/english-certification/EcWordFillStructuredForm.js +1 -1
- package/dist/index.d.ts +1 -2
- package/dist/index.js +1 -1
- package/dist/mcp/config.d.ts +12 -0
- package/dist/mcp/config.js +1 -0
- package/dist/mcp/http-client.d.ts +6 -0
- package/dist/mcp/http-client.js +1 -0
- package/dist/mcp/index.d.ts +6 -0
- package/dist/mcp/index.js +2 -0
- package/dist/mcp/tools/_helpers.d.ts +4 -0
- package/dist/mcp/tools/_helpers.js +1 -0
- package/dist/mcp/tools/exams.d.ts +2 -0
- package/dist/mcp/tools/exams.js +1 -0
- package/dist/mcp/tools/index.d.ts +2 -0
- package/dist/mcp/tools/index.js +1 -0
- package/dist/mcp/tools/results.d.ts +2 -0
- package/dist/mcp/tools/results.js +1 -0
- package/dist/shared/constants/question-skills.js +1 -1
- package/dist/shared/lib/i18n/messages/en/admin.d.ts +4 -11
- package/dist/shared/lib/i18n/messages/en/admin.js +1 -1
- package/dist/shared/lib/i18n/messages/en.d.ts +4 -11
- package/dist/shared/lib/i18n/messages/vi/admin.d.ts +4 -11
- package/dist/shared/lib/i18n/messages/vi/admin.js +1 -1
- package/dist/shared/lib/i18n/messages/vi.d.ts +4 -11
- package/dist/shared/lib/utils/question-reverse-transform.js +1 -1
- package/dist/shared/lib/utils/question-transform.js +1 -1
- package/dist/shared/types/common.types.d.ts +1 -1
- package/dist/shared/types/questions/choose-the-correct-answer-group.d.ts +41 -0
- package/dist/shared/types/questions/choose-the-correct-answer-group.js +1 -0
- package/dist/shared/types/questions/cross-out-word-group.d.ts +41 -0
- package/dist/shared/types/questions/cross-out-word-group.js +1 -0
- package/dist/shared/types/questions/index.d.ts +2 -0
- package/dist/shared/types/questions/index.js +1 -1
- package/package.json +165 -169
- package/dist/components/exams/ExamPreviewPartContent.d.ts +0 -18
- package/dist/components/exams/ExamPreviewPartContent.js +0 -1
- package/dist/components/exams/ExamPreviewSidebar.d.ts +0 -17
- package/dist/components/exams/ExamPreviewSidebar.js +0 -1
- package/dist/components/exams/exam-preview.types.d.ts +0 -34
- package/dist/components/exams/exam-preview.types.js +0 -1
- package/dist/components/questions/_shared/utils/parseFillBlankStem.d.ts +0 -30
- package/dist/components/questions/_shared/utils/parseFillBlankStem.js +0 -1
- package/dist/components/questions/question-bank/EditQuestionBankDialog.d.ts +0 -2
- package/dist/components/questions/question-bank/EditQuestionBankDialog.js +0 -1
- package/dist/components/questions/question-bank/QuestionEditorRenderer.d.ts +0 -23
- package/dist/components/questions/question-bank/QuestionEditorRenderer.js +0 -1
- package/dist/components/questions/question-bank/difficulty.d.ts +0 -15
- package/dist/components/questions/question-bank/difficulty.js +0 -1
- package/dist/components/questions/question-bank/editor-adapters/choice-adapters.d.ts +0 -5
- package/dist/components/questions/question-bank/editor-adapters/choice-adapters.js +0 -1
- package/dist/components/questions/question-bank/editor-adapters/index.d.ts +0 -5
- package/dist/components/questions/question-bank/editor-adapters/index.js +0 -1
- package/dist/components/questions/question-bank/editor-adapters/media-adapters.d.ts +0 -6
- package/dist/components/questions/question-bank/editor-adapters/media-adapters.js +0 -1
- package/dist/components/questions/question-bank/editor-adapters/types.d.ts +0 -1
- package/dist/components/questions/question-bank/editor-adapters/unsupported-fallback.d.ts +0 -8
- package/dist/components/questions/question-bank/editor-adapters/unsupported-fallback.js +0 -1
- package/dist/components/questions/question-bank/editor-adapters/writing-adapters.d.ts +0 -5
- package/dist/components/questions/question-bank/editor-adapters/writing-adapters.js +0 -1
- package/dist/components/questions/question-bank/index.d.ts +0 -4
- package/dist/components/questions/question-bank/index.js +0 -1
- package/dist/components/questions/question-bank/types.d.ts +0 -59
- /package/dist/components/questions/{question-bank/editor-adapters/types.js → _shared/types/choose-the-correct-answer-group.type.js} +0 -0
- /package/dist/components/questions/{question-bank/types.js → _shared/types/cross-out-word-group.type.js} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as e,jsxs as t}from"react/jsx-runtime";import{useRef as r,useEffect as n,useMemo as s,useCallback as
|
|
1
|
+
"use client";import{jsx as e,jsxs as t}from"react/jsx-runtime";import{useRef as r,useEffect as n,useMemo as s,useCallback as a,memo as o}from"react";import{ResolvedImage as l}from"../../../components/common/ResolvedImage";import{cn as i}from"../../../shared/lib/utils";import{transformWordFillStructuredForm as d}from"../../../components/exams/take/exam-taking.utils";import{englishCertQuestionDomId as c}from"./english-cert-scroll";function b(e){const t=Number(e);return Number.isFinite(t)?String(t+1):e}function u(e,t){const r=e.trim();return t?r:r.toLowerCase()}function m(e,t){const r=Object.keys(e).map(e=>Number(e)).filter(e=>Number.isFinite(e)).sort((e,t)=>e-t);if(0===r.length)return`Question ${t}`;const n=r[0]+1,s=r[r.length-1]+1;return n===s?`Question ${n}`:`Questions ${n}–${s}`}const p={},f=o(function({question:a,initialAnswers:o,onBlankChange:d,isReviewMode:c}){const m=r(null),p=r(d);p.current=d;const f=r(!1),x=r(o),g=s(()=>a.content.replace(/\{([\w\d]+)\}/g,(e,t)=>`\n <span class="ec-blank-wrapper" data-blank-wrapper="${t}">\n <span class="ec-blank-number" data-blank-number="${t}">${b(t)}</span>\n <input type="text" data-blank-key="${t}" class="ec-blank-input" />\n </span>\n `),[a.content]);return n(()=>{const e=m.current;if(!e)return;f.current||(e.innerHTML=g,f.current=!0);const t=e.querySelectorAll("input.ec-blank-input"),r=[];return t.forEach(t=>{const n=t.getAttribute("data-blank-key")||"",s=e.querySelector(`[data-blank-wrapper="${n}"]`),o=x.current[n]||"",l=a.answers[n]||"",d=o.trim().length>0,m=d&&u(o,a.caseSensitive)===u(l,a.caseSensitive),f=c&&!m&&l.trim().length>0;t.value=f?`${d?o:"(empty)"} → ${l}`:o,t.disabled=c,t.className=i("ec-blank-input inline-block min-w-[100px] max-w-[200px] rounded-t border-0 border-b-2 border-dashed border-[#1167e8] bg-blue-50/30 px-2 py-0.5 text-base font-semibold leading-tight text-[#0f1730] align-baseline outline-none transition-all hover:bg-blue-50/60 focus:border-solid focus:border-[#0b57d0] focus:bg-blue-50/80",c?m?"border-solid border-[#22c55e] bg-emerald-50 text-[#15803d]":d?"border-solid border-[#ef4444] bg-rose-50 text-red-700":"border-solid border-[#f97316] bg-amber-50 text-[#c2410c]":"");const g=e.querySelector(`[data-blank-number="${n}"]`);g&&(g.textContent=b(n),g.className=i("ec-blank-number mr-1 inline-flex h-5 min-w-5 items-center justify-center rounded-full px-1.5 text-[11px] font-bold leading-none text-white align-baseline shadow-xs",c?m?"bg-[#22c55e]":d?"bg-[#ef4444]":"bg-[#f97316]":"bg-[#0b57d0]")),s&&(s.className=i("ec-blank-wrapper inline-flex items-baseline whitespace-nowrap align-baseline",c?"mx-1":"mx-0.5"));const h=e=>{const t=e.target;p.current(n,t.value)};t.addEventListener("input",h),r.push({el:t,handler:h})}),()=>{r.forEach(({el:e,handler:t})=>{e.removeEventListener("input",t)})}},[g,c]),t("div",{className:"space-y-3",children:[a.title&&e("h3",{className:"text-base font-semibold text-[#0f1730]",children:a.title}),a.imageUrl&&e("div",{className:"flex justify-center",children:e("div",{className:"overflow-hidden rounded-lg border border-[#d9e4f2]",children:e(l,{src:a.imageUrl,alt:a.title||"Question image",className:"max-h-56 w-auto object-contain"})})}),e("div",{ref:m,className:"ec-structured-content w-full overflow-x-auto rounded-xl border border-[#d9e4f2] bg-[#f4f9ff] p-5 text-base leading-relaxed text-[#0f1730] [&_table]:w-full [&_table]:border-collapse [&_td]:border [&_td]:border-[#d9e4f2] [&_td]:px-4 [&_td]:py-3 [&_td]:align-top [&_th]:border [&_th]:border-[#d9e4f2] [&_th]:bg-[#e9f3ff] [&_th]:px-4 [&_th]:py-3 [&_th]:text-left [&_th]:font-semibold"}),c&&Object.keys(a.answers).length>0&&t("div",{className:"rounded-xl border border-[#d9e4f2] bg-white/70 p-3",children:[e("span",{className:"text-[10px] font-semibold uppercase tracking-wider text-[#64748b]",children:"Correct answers"}),e("div",{className:"mt-1 flex flex-wrap gap-1.5",children:Object.entries(a.answers).map(([e,r])=>t("span",{className:"rounded border border-[#b9edc8] bg-[#ddf8e7] px-2 py-0.5 text-xs font-semibold text-[#15803d]",children:[e,": ",r]},e))})]})]})});export function EcWordFillStructuredForm({part:n,answers:o,onAnswerChange:i,isReviewMode:b=!1}){const{questions:u,instruction:x,groupTitle:g,groupContent:h,groupImageUrl:w}=s(()=>d(n.questions),[n.questions]),N=r(o);N.current=o;const v=r(i);v.current=i;const k=a((e,t,r)=>{const n=N.current[e]||{};v.current(e,{...n,[t]:r})},[]),y=s(()=>{const e={};return u.forEach(t=>{e[t.id]=(e,r)=>k(t.id,e,r)}),e},[u,k]);return t("div",{className:"flex flex-col gap-4",children:[x&&e("div",{className:"rounded-xl border border-[#d9e4f2] bg-[#e9f3ff] px-4 py-2.5 text-sm font-semibold uppercase tracking-wide text-[#0b57d0]",children:x}),g&&e("h2",{className:"text-center text-lg font-bold uppercase text-[#0b57d0]",children:g}),w&&e("div",{className:"flex items-center justify-center",children:e(l,{src:w,alt:g||"Group image",className:"max-h-[300px] rounded-lg object-contain shadow-md"})}),e("div",{className:"flex flex-col gap-4",children:u.map(r=>t("div",{id:c(r.id),className:"scroll-mt-24 rounded-2xl border border-[#d9e4f2] bg-white/90 p-4 shadow-[0_14px_35px_rgba(13,71,161,0.10)] backdrop-blur-md",children:[e("div",{className:"mb-2 flex items-center gap-2",children:e("span",{className:"inline-flex items-center rounded-full bg-gradient-to-b from-[#1f7cff] to-[#0b57d0] px-3 py-1 text-xs font-bold text-white shadow-sm",children:m(r.answers,r.questionNumber)})}),e(f,{question:r,initialAnswers:o[r.id]||p,onBlankChange:y[r.id],isReviewMode:b})]},r.id))})]})}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export * as Api from './api';
|
|
2
2
|
export * as Components from './components';
|
|
3
|
+
export * as Mcp from './mcp';
|
|
3
4
|
export * as Exams from './components/exams';
|
|
4
5
|
export * as Questions from './components/questions';
|
|
5
6
|
export * as Results from './components/results';
|
|
@@ -15,8 +16,6 @@ export { QuestionCreator } from './components/questions/creator/QuestionCreator'
|
|
|
15
16
|
export type { QuestionCreatorProps } from './components/questions/creator/QuestionCreator';
|
|
16
17
|
export { QuestionGroupCreator } from './components/questions/creator/QuestionGroupCreator';
|
|
17
18
|
export type { QuestionGroupCreatorProps } from './components/questions/creator/QuestionGroupCreator';
|
|
18
|
-
export { DifficultyLevel, EditQuestionBankDialog, QuestionBankEditorType, QuestionEditorRenderer, } from './components/questions/question-bank';
|
|
19
|
-
export type { EditQuestionBankDialogProps, QuestionBankEditItem, QuestionEditorChangeData, QuestionEditorRendererProps, SkillType as QuestionBankSkillType, UpdateQuestionBankDto, } from './components/questions/question-bank';
|
|
20
19
|
export { renderDedicatedComponent } from './components/questions/creator/dedicated-component-router';
|
|
21
20
|
export type { DedicatedComponentRouterProps, ValidationRef, } from './components/questions/creator/dedicated-component-router';
|
|
22
21
|
export { questionTypeRegistry } from './components/questions/creator/question-type-registry';
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export*as Api from"./api";export*as Components from"./components";export*as Exams from"./components/exams";export*as Questions from"./components/questions";export*as Results from"./components/results";export*as Themes from"./components/themes";export*as Shared from"./shared";export{buildExamTemplatePayload,createContestRoomsApi,createExamCreateApi,createExamEntryApi,createExamQuestionsApi,createExamQuestionsFetchApi,createExamTakingApi,createMockContestRoomsApi,createMockCreateExamApi,createMockExamEntryApi,createMockExamQuestionsApi,createMockExamTakingApi,createMockResultReviewApi,createResultReviewApi}from"./api";export{CreateExamPageContainer,ExamPreviewDialog,ExamQuestionsPageContainer,ExamTakingPageContainer,ExamViewDialog,StudentContestRoomsPageContainer,StudentExamEntryPageContainer}from"./components/exams";export{ResultReviewPageContainer}from"./components/results";export{QuestionCreator}from"./components/questions/creator/QuestionCreator";export{QuestionGroupCreator}from"./components/questions/creator/QuestionGroupCreator";export{
|
|
1
|
+
export*as Api from"./api";export*as Components from"./components";export*as Mcp from"./mcp";export*as Exams from"./components/exams";export*as Questions from"./components/questions";export*as Results from"./components/results";export*as Themes from"./components/themes";export*as Shared from"./shared";export{buildExamTemplatePayload,createContestRoomsApi,createExamCreateApi,createExamEntryApi,createExamQuestionsApi,createExamQuestionsFetchApi,createExamTakingApi,createMockContestRoomsApi,createMockCreateExamApi,createMockExamEntryApi,createMockExamQuestionsApi,createMockExamTakingApi,createMockResultReviewApi,createResultReviewApi}from"./api";export{CreateExamPageContainer,ExamPreviewDialog,ExamQuestionsPageContainer,ExamTakingPageContainer,ExamViewDialog,StudentContestRoomsPageContainer,StudentExamEntryPageContainer}from"./components/exams";export{ResultReviewPageContainer}from"./components/results";export{QuestionCreator}from"./components/questions/creator/QuestionCreator";export{QuestionGroupCreator}from"./components/questions/creator/QuestionGroupCreator";export{renderDedicatedComponent}from"./components/questions/creator/dedicated-component-router";export{questionTypeRegistry}from"./components/questions/creator/question-type-registry";export{QUESTION_TYPE_CONFIG,QUESTION_TYPES_WITH_DEDICATED_COMPONENTS}from"./components/questions/_shared/config/question-types.config";export{validateQuestion}from"./components/questions/_shared/utils/question-validation";export{buildAnswerPayload}from"./components/questions/_shared/utils/answer-builder";export*from"./components/questions/_shared/types";
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
declare const schema: z.ZodObject<{
|
|
3
|
+
OE_API_URL: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
|
|
4
|
+
OE_API_TOKEN: z.ZodString;
|
|
5
|
+
OE_HTTP_TIMEOUT_MS: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
6
|
+
}, z.core.$strip>;
|
|
7
|
+
export type McpConfig = z.infer<typeof schema> & {
|
|
8
|
+
packageName: string;
|
|
9
|
+
packageVersion: string;
|
|
10
|
+
};
|
|
11
|
+
export declare function loadMcpConfig(): McpConfig;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{readFileSync as e}from"node:fs";import{dirname as r,join as o}from"node:path";import{fileURLToPath as n}from"node:url";import{z as t}from"zod";const s=function(){try{const t=r(n(import.meta.url));return JSON.parse(e(o(t,"..","..","package.json"),"utf8"))}catch{return{name:"@tinyweb_dev/oe-exam-sdk",version:"0.0.0"}}}(),a=t.object({OE_API_URL:t.string().url().transform(e=>e.replace(/\/+$/,"")),OE_API_TOKEN:t.string().min(1),OE_HTTP_TIMEOUT_MS:t.coerce.number().int().positive().default(15e3)});let i=null;export function loadMcpConfig(){if(i)return i;const e=a.safeParse(process.env);if(!e.success){const r=e.error.issues.map(e=>` • ${e.path.join(".")||"<root>"}: ${e.message}`).join("\n");console.error(`\n[oe-exam-mcp] Configuration error:\n${r}\n\nRequired: OE_API_URL and OE_API_TOKEN.\n`),process.exit(1)}return i={...e.data,packageName:s.name,packageVersion:s.version},i}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{ErrorCode as t,McpError as o}from"@modelcontextprotocol/sdk/types.js";import{loadMcpConfig as r}from"./config.js";export async function mcpRequest(n){const s=r(),a=new AbortController,i=setTimeout(()=>a.abort(),s.OE_HTTP_TIMEOUT_MS);try{const r=await fetch(`${s.OE_API_URL}${n.url}`,{method:n.method,signal:a.signal,headers:{Accept:"application/json","Content-Type":"application/json",...e(s.OE_API_TOKEN)},body:void 0===n.body?void 0:JSON.stringify(n.body)}),i=await r.text(),c=i?JSON.parse(i):void 0;if(!r.ok){const e=function(t){if(!t||"object"!=typeof t)return;const o=t.message;return Array.isArray(o)?o.join("; "):"string"==typeof o?o:void 0}(c)??r.statusText,s=400===r.status||404===r.status||422===r.status?t.InvalidParams:t.InternalError;throw new o(s,`[${n.method} ${n.url}] ${r.status}: ${e}`)}return c}catch(r){if(r instanceof o)throw r;throw new o(t.InternalError,r instanceof Error?r.message:"Unknown HTTP error")}finally{clearTimeout(i)}}function e(t){return t?t.startsWith("oeexam_")?{"X-API-Key":t}:{Authorization:`Bearer ${t}`}:{}}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
export declare function startOeExamMcpServer(): Promise<void>;
|
|
3
|
+
export { loadMcpConfig } from './config.js';
|
|
4
|
+
export { registerAllMcpTools } from './tools/index.js';
|
|
5
|
+
export { registerExamTools } from './tools/exams.js';
|
|
6
|
+
export { registerResultTools } from './tools/results.js';
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import{McpServer as e}from"@modelcontextprotocol/sdk/server/mcp.js";import{StdioServerTransport as o}from"@modelcontextprotocol/sdk/server/stdio.js";import{loadMcpConfig as r}from"./config.js";import{registerAllMcpTools as s}from"./tools/index.js";export async function startOeExamMcpServer(){const t=r(),a=new e({name:t.packageName,version:t.packageVersion},{capabilities:{tools:{},logging:{}},instructions:"OE Exam MCP server. Use exam_json_template_generate then exam_create_from_json to create an exam, and exam_result_get to view a result review."});s(a),await a.connect(new o);const c=async()=>{await a.close().catch(e=>console.error("[oe-exam-mcp] server.close failed",e)),process.exit(0)};process.on("SIGINT",()=>{c()}),process.on("SIGTERM",()=>{c()})}import.meta.url===`file://${process.argv[1]}`&&startOeExamMcpServer().catch(e=>{console.error("[oe-exam-mcp] Fatal startup error",e),process.exit(1)});export{loadMcpConfig}from"./config.js";export{registerAllMcpTools}from"./tools/index.js";export{registerExamTools}from"./tools/exams.js";export{registerResultTools}from"./tools/results.js";
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { CallToolResult } from '@modelcontextprotocol/sdk/types.js';
|
|
2
|
+
export declare function buildToolResult<T>(value: T): CallToolResult;
|
|
3
|
+
export declare function wrapHandler<TInput extends Record<string, unknown>>(toolName: string, fn: (input: TInput) => Promise<CallToolResult>): (input: TInput) => Promise<CallToolResult>;
|
|
4
|
+
export declare function unwrapData<T>(value: unknown): T;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{ErrorCode as t,McpError as r}from"@modelcontextprotocol/sdk/types.js";export function buildToolResult(t){return{content:[{type:"text",text:"string"==typeof t?t:JSON.stringify(t,null,2)}],...t&&"object"==typeof t?{structuredContent:t}:{}}}export function wrapHandler(e,o){return async n=>{try{return await o(n)}catch(o){if(o instanceof r)throw o;throw console.error(`[oe-exam-mcp] ${e} failed`,o),new r(t.InternalError,o instanceof Error?o.message:"Unknown error")}}}export function unwrapData(t){return t&&"object"==typeof t&&"data"in t?t.data:t}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{mkdir as e,writeFile as t}from"node:fs/promises";import{dirname as n,resolve as i}from"node:path";import{z as a}from"zod";import{mcpRequest as o}from"../http-client.js";import{buildToolResult as r,unwrapData as s,wrapHandler as l}from"./_helpers.js";const p=a.record(a.string(),a.unknown()).describe("Full API question payload or short form: { question, options, answer, points?, partId?, partNo? }."),u=(a.record(a.string(),a.unknown()).describe("Part payload: { name?, partId?, questions: [...] }."),a.record(a.string(),a.unknown()).describe("Template payload accepted by PATCH /manage/exams/:id/template.")),m=a.enum(["PRE_A1","A1","A2","B1","B2","C1","C2"]);export function registerExamTools(g){g.registerTool("exam_templates_search",{title:"Search exam templates",description:"Search available OE Exam templates. Use this before exam_create_with_questions to choose examTemplateId.",inputSchema:{search:a.string().optional().describe("Template name keyword."),page:a.number().int().positive().default(1).describe("1-based page number."),limit:a.number().int().positive().max(50).default(9).describe("Page size sent as API size.")}},l("exam_templates_search",async e=>{const t=new URLSearchParams({page:String(e.page??1),size:String(e.limit??9)});e.search&&t.set("filter",`name:like:${e.search}`);const n=await o({method:"GET",url:`/api/v1/exam-templates?${t}`});return r({templates:k(n)})})),g.registerTool("exam_template_get",{title:"Get exam template",description:"Get one OE Exam template by id. The returned templatePayload can be passed as template to exam_create_with_questions.",inputSchema:{id:a.string().min(1).describe("Template id from exam_templates_search.")}},l("exam_template_get",async e=>{const t=s(await o({method:"GET",url:`/api/v1/exam-templates/${encodeURIComponent(String(e.id))}`}));return r({template:t,templatePayload:P(t)})})),g.registerTool("exam_question_template_get",{title:"Get question payload template",description:"Return easy-to-fill question JSON templates for exam_create_with_questions. Use this before creating questions if you need the expected shape.",inputSchema:{templateId:a.string().min(1).optional().describe("Template id. If provided, generate question payloads from template.parts."),type:a.string().default("CHOOSE_THE_CORRECT_ANSWER").describe("Fallback question type when templateId is omitted."),count:a.number().int().positive().max(100).default(1).describe("Fallback count when templateId is omitted."),partId:a.union([a.string(),a.number()]).default(1),partNo:a.number().int().positive().default(1),skill:a.string().default("READING")}},l("exam_question_template_get",async e=>{const t="string"==typeof e.templateId?s(await o({method:"GET",url:`/api/v1/exam-templates/${encodeURIComponent(e.templateId)}`})):void 0;return r({usage:"Pass questions directly into exam_create_with_questions.questions. Fill content/correctAnswer for each generated API-format payload.",templateId:t?.id,questions:t?b(t):S(e)})})),g.registerTool("exam_json_template_generate",{title:"Get exam JSON template",description:"Generate a user-friendly examJson skeleton from templateTitle or templateId. Edit this JSON, then pass it to exam_create_from_json.",inputSchema:{templateTitle:a.string().optional().describe("Template title to search, e.g. Achievers 2026 Round 1."),templateId:a.string().optional().describe("Exact template id. Preferred when known."),name:a.string().optional().describe("Exam name to put in the JSON."),examLevel:m.optional().describe("Optional exam level for the generated JSON."),difficulty:a.enum(["EASY","MEDIUM","HARD"]).optional().describe("Optional difficulty for the generated JSON."),durationMinutes:a.number().int().positive().optional().describe("Optional duration for the generated JSON.")}},l("exam_json_template_generate",async a=>{const o=await f({templateId:a.templateId,templateTitle:a.templateTitle}),s=function(e,t){const n=Array.isArray(e.parts)?e.parts.filter(c):[];return{name:v(t.name,`${e.title??e.name??"OE Exam"} Draft`),templateId:e.id,templateTitle:e.title??e.name,totalScore:O(e.totalScore??e.total_questions,y(n)),examLevel:_(t.examLevel)??_(e.examLevel??e.exam_level??e.level)??"A1",difficulty:E(t.difficulty)??"MEDIUM",durationMinutes:O(t.durationMinutes,45),isComplete:!1,isActive:!1,parts:n.map((e,t)=>function(e,t){const n=O(e.startIndex,0),i=O(e.questionCount,O(e.endIndex,n)-n+1);return{id:e.id??t+1,name:e.name??`Part ${t+1}`,questionType:v(e.questionType,"CHOOSE_THE_CORRECT_ANSWER"),skill:v(e.skill,"READING"),questions:Array.from({length:Math.max(i,0)},(t,i)=>function(e,t){const n=v(e.questionType,"CHOOSE_THE_CORRECT_ANSWER"),i=(Array.isArray(e.defaultValue)&&e.defaultValue.length>0?e.defaultValue:Array.from({length:O(e.optionCount,4)},(e,t)=>String.fromCharCode(65+t))).map(String);return n.includes("FILL")||n.includes("WRITE")?{question:`Question ${t}`,answer:""}:n.includes("SPEAK")?{prompt:`Question ${t}`,expectedAnswer:""}:{question:`Question ${t}`,options:i,answer:i[0]??"A"}}(e,n+i+1))}}(e,t))}}(o,a),l=JSON.stringify(s,null,2),p=i(`${u=String(a.name??o.title??o.name??"exam"),u.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"").slice(0,80)||"exam"}.json`);var u;return await e(n(p),{recursive:!0}),await t(p,`${l}\n`,"utf8"),r({usage:"Edit filePath, then call exam_create_from_json with the edited JSON string.",templateId:o.id,templateTitle:o.title??o.name,filePath:p,examJson:s,examJsonString:l})})),g.registerTool("exam_create_from_json",{title:"Create exam from JSON",description:"Create an exam from a user-friendly JSON payload grouped by parts. Searches template by title, patches template, maps questions to template.parts, then creates questions.",inputSchema:{examJson:a.string().optional().describe("JSON string with { name, templateTitle/templateId, parts: [{ questions: [...] }] }. Use this for copy/paste."),exam:a.record(a.string(),a.unknown()).optional().describe("Same payload as object if the client supports object arguments.")}},l("exam_create_from_json",async e=>{const t=function(e,t){if(c(t))return t;if("string"!=typeof e||!e.trim())throw new Error("examJson or exam is required");const n=JSON.parse(e);if(!c(n))throw new Error("examJson must be a JSON object");return n}(e.examJson,e.exam),n=await f(t),i=function(e,t){const n=Array.isArray(t.parts)?t.parts.filter(c):[],i=Array.isArray(e.parts)?e.parts.filter(c):[{questions:e.questions}];return i.flatMap((e,t)=>{const i=function(e,t,n){const i=A(e.partId??e.id),a=A(e.name);return t.find(e=>String(e.id)===i)??t.find(e=>"string"==typeof e.name&&e.name===a)??t[n]??{id:n+1,questionType:"CHOOSE_THE_CORRECT_ANSWER",skill:"READING",optionCount:4}}(e,n,t);return(Array.isArray(e.questions)?e.questions.filter(c):[]).map((e,n)=>function(e,t,n,i){const a=O(t.startIndex,0),o=w({questionType:v(e.questionType??e.type??t.questionType,"CHOOSE_THE_CORRECT_ANSWER"),questionNumber:O(e.questionNumber,a+i+1),partId:String(e.partId??t.id??n+1),partNo:O(e.partNo,n+1),sectionId:R(e.sectionId??t.sectionId),skill:v(e.questionSkillType??e.skill??t.skill,"READING"),optionCount:O(t.optionCount,4),defaultValue:Array.isArray(t.defaultValue)?t.defaultValue:void 0});return q(function(e){const t=c(e.content)?{...e.content}:{};"string"==typeof e.question&&(t.question=e.question);"string"==typeof e.text&&(t.question=e.text);Array.isArray(e.options)&&(t.optionType=t.optionType??"text",t.options=e.options);return d({...e,content:c(t)?t:e.content,correctAnswer:void 0===e.answer&&void 0===e.expectedAnswer?e.correctAnswer:x(e.questionType,e.answer??e.expectedAnswer,t.options)})}({...o,...e}),i)}(e,i,t,n))})}(t,n),a=function(e,t,n){return{exam:d({name:v(e.name,"New OE Exam"),code:A(e.code)??h(v(e.name,"New OE Exam")),totalScore:O(e.totalScore,n.length||100),description:A(e.description)??A(e.templateTitle)??"",isComplete:T(e.isComplete,!1),isActive:T(e.isActive,!1),examTemplateId:t,examLevel:_(e.examLevel),difficulty:E(e.difficulty),durationMinutes:R(e.durationMinutes)})}}(t,n.id,i),l=s(await o({method:"POST",url:"/api/v1/manage/exams",body:a.exam}));await o({method:"PATCH",url:`/api/v1/manage/exams/${encodeURIComponent(l.id)}/template`,body:{template:P(n)}});const p=0===i.length?null:await o({method:"POST",url:"/api/v1/manage/questions/batch",body:{examId:l.id,questions:i}});return r({exam:l,templateId:n.id,questions:p,generatedQuestionCount:i.length})})),g.registerTool("exam_create_with_questions",{title:"Create exam with questions",description:"Create an exam, optionally patch template, then bulk create questions via /api/v1/manage/questions/batch. If you do not know examTemplateId/template, call exam_templates_search then exam_template_get first.",inputSchema:{name:a.string().min(1),code:a.string().min(1).optional(),examLevel:m.optional().describe("Valid exam level only: PRE_A1, A1, A2, B1, B2, C1, C2. Do not use template title/id here."),difficulty:a.enum(["EASY","MEDIUM","HARD"]).optional(),totalScore:a.number().nonnegative().optional(),durationMinutes:a.number().int().positive().optional(),description:a.string().optional(),isComplete:a.boolean().optional(),isActive:a.boolean().optional(),examTemplateId:a.string().min(1).optional(),template:u.optional(),questions:a.array(p).default([])}},l("exam_create_with_questions",async e=>{const{template:t,questions:n,...i}=e,a=s(await o({method:"POST",url:"/api/v1/manage/exams",body:d(i)})),l=c(t)?t:await async function(e){if("string"!=typeof e||!e)return;const t=s(await o({method:"GET",url:`/api/v1/exam-templates/${encodeURIComponent(e)}`}));return P(t)}(i.examTemplateId);c(l)&&await o({method:"PATCH",url:`/api/v1/manage/exams/${encodeURIComponent(a.id)}/template`,body:{template:l}});const p=n.map(q),u=0===p.length?null:await o({method:"POST",url:"/api/v1/manage/questions/batch",body:{examId:a.id,questions:p}});return r({exam:a,questions:u})}))}function d(e){return Object.fromEntries(Object.entries(e).filter(([,e])=>void 0!==e))}function c(e){return Boolean(e&&"object"==typeof e&&!Array.isArray(e)&&Object.keys(e).length>0)}async function f(e){const t=A(e.templateId);if(t)return s(await o({method:"GET",url:`/api/v1/exam-templates/${encodeURIComponent(t)}`}));const n=A(e.templateTitle);if(!n)throw new Error("templateTitle or templateId is required");const i=new URLSearchParams({page:"1",size:"10",filter:`name:like:${n}`}),a=k(await o({method:"GET",url:`/api/v1/exam-templates?${i}`})),r=a.find(e=>(e.title??e.name)===n),l=r??a[0];if(!l?.id)throw new Error(`No exam template found for title: ${n}`);return s(await o({method:"GET",url:`/api/v1/exam-templates/${encodeURIComponent(l.id)}`}))}function y(e){return e.reduce((e,t)=>e+O(t.questionCount,0),0)}function x(e,t,n){if(void 0===t)return;const i=String(e??"");return i.includes("FILL")||i.includes("WRITE")?{answers:[String(t)]}:i.includes("SPEAK")?{expectedAnswer:String(t)}:{answer:g(t,n)}}function g(e,t){if("string"==typeof e&&Array.isArray(t)){const n=t.map(String).findIndex(t=>t===e);if(n>=0)return n}return I(e)}function h(e){return e.toUpperCase().replace(/[^A-Z0-9]+/g,"_").replace(/^_|_$/g,"").slice(0,40)||"OE_EXAM"}function A(e){return"string"==typeof e&&e?e:void 0}function T(e,t){return"boolean"==typeof e?e:t}function _(e){return"string"==typeof e&&m.safeParse(e).success?e:void 0}function E(e){return"string"==typeof e&&["EASY","MEDIUM","HARD"].includes(e)?e:void 0}function q(e,t){if(e.questionType)return d({...e,partId:void 0===e.partId?void 0:String(e.partId),partNo:e.partNo??1,questionNumber:e.questionNumber??t+1,points:e.points??1,addToQuestionBank:e.addToQuestionBank??!1,isExample:e.isExample??!1});const n=Array.isArray(e.options)?e.options:["A","B","C","D"];return d({questionType:e.type??"CHOOSE_THE_CORRECT_ANSWER",content:e.content??{question:String(e.question??e.text??`Question ${t+1}`),optionType:"text",options:n},correctAnswer:e.correctAnswer??{answer:I(e.answer??e.correctAnswerIndex??0)},points:e.points??1,explanation:e.explanation??"",questionNumber:e.questionNumber??t+1,partId:String(e.partId??1),partNo:e.partNo??1,sectionId:e.sectionId,questionSkillType:e.questionSkillType??e.skill??"READING",addToQuestionBank:e.addToQuestionBank??!1,isExample:e.isExample??!1})}function I(e){if("number"==typeof e)return e;if("string"==typeof e&&/^[A-E]$/i.test(e))return e.toUpperCase().charCodeAt(0)-65;const t=Number(e);return Number.isFinite(t)?t:0}function S(e){return Array.from({length:Number(e.count??1)},(t,n)=>w({questionType:String(e.type??"CHOOSE_THE_CORRECT_ANSWER"),questionNumber:n+1,partId:String(e.partId??1),partNo:Number(e.partNo??1),skill:String(e.skill??"READING")}))}function b(e){return(Array.isArray(e.parts)?e.parts.filter(c):[]).flatMap((e,t)=>{const n=O(e.startIndex,0),i=O(e.questionCount,O(e.endIndex,n)-n+1);return Array.from({length:Math.max(i,0)},(i,a)=>w({questionType:v(e.questionType,"CHOOSE_THE_CORRECT_ANSWER"),questionNumber:n+a+1,partId:String(e.id??t+1),partNo:t+1,sectionId:R(e.sectionId),skill:v(e.skill,"READING"),optionCount:O(e.optionCount,4),defaultValue:Array.isArray(e.defaultValue)?e.defaultValue:void 0}))})}function w(e){return d({questionType:e.questionType,content:C(e.questionType,e.questionNumber,e.optionCount,e.defaultValue),correctAnswer:N(e.questionType),points:1,explanation:"",questionNumber:e.questionNumber,partId:e.partId,partNo:e.partNo,sectionId:e.sectionId,questionSkillType:e.skill,addToQuestionBank:!1,isExample:!1})}function C(e,t,n=4,i){const a=(i?.length?i:Array.from({length:n},(e,t)=>String.fromCharCode(65+t))).map(String);return e.includes("FILL")||e.includes("WRITE")?{question:`Question ${t}`,text:""}:e.includes("SPEAK")?{prompt:`Question ${t}`}:e.includes("LISTEN")?{question:`Question ${t}`,audioUrl:"",optionType:"text",options:a}:{question:`Question ${t}`,optionType:"text",options:a}}function N(e){return e.includes("FILL")||e.includes("WRITE")?{answers:[""]}:e.includes("SPEAK")?{expectedAnswer:""}:{answer:0}}function v(e,t){return"string"==typeof e&&e?e:t}function O(e,t){const n=Number(e);return Number.isFinite(n)?n:t}function R(e){const t=Number(e);return Number.isFinite(t)?t:void 0}function k(e){const t=s(e);return Array.isArray(t)?t:t&&"object"==typeof t&&"data"in t&&Array.isArray(t.data)?t.data:[]}function P(e){const t=Array.isArray(e.parts)?e.parts:[];return d({id:e.id,title:e.title??e.name,subTitle:e.subTitle??e.sub_title??"",theme:e.theme,totalQuestions:e.totalQuestions??e.total_questions,totalParts:e.totalParts??e.total_parts??t.length,description:e.description??"",examLevel:e.examLevel??e.exam_level??e.level??"",type:e.type??null,parts:t})}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{registerExamTools as o}from"./exams.js";import{registerResultTools as r}from"./results.js";export function registerAllMcpTools(s){o(s),r(s)}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{z as t}from"zod";import{mcpRequest as e}from"../http-client.js";import{buildToolResult as n,wrapHandler as o}from"./_helpers.js";export function registerResultTools(r){r.registerTool("exam_result_get",{title:"Get exam result review",description:"Fetch student exam result review by attemptId. Optional token supports public result review links.",inputSchema:{attemptId:t.string().min(1),token:t.string().min(1).optional(),includeAttempt:t.boolean().default(!0)}},o("exam_result_get",async({attemptId:t,token:o,includeAttempt:r})=>{const i=o?`?token=${encodeURIComponent(String(o))}`:"",s=await e({method:"GET",url:`/api/v1/student/results/${encodeURIComponent(String(t))}${i}`}),l=!1===r?null:await e({method:"GET",url:`/api/v1/student/attempts/${encodeURIComponent(String(t))}${i}`});return n({result:s,attempt:l})}))}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{SkillEnum as E}from"../types/common.types";export const QUESTION_TYPE_SKILLS={LISTEN_AND_FILL_IN_THE_BLANK_WITH_IMAGE:E.LISTENING,LISTEN_AND_TICK_ANSWER:E.LISTENING,LISTEN_AND_FILL_NAME_NUMBER:E.LISTENING,LISTENING_FILL_BLANK:E.LISTENING,LISTENING_COLOR:E.LISTENING,LISTENING:E.LISTENING,LISTEN_AND_CHOOSE_FROM_ANSWER_GROUP:E.SPEAKING,LISTEN_AND_CHOOSE_OBJECTS_IN_SCENE:E.SPEAKING,LISTEN_AND_DRAG_OBJECTS_INTO_SCENE:E.SPEAKING,LISTEN_AND_SPEAK_ANSWER:E.SPEAKING,LISTEN_AND_SPEAK_IMAGE_GROUP:E.SPEAKING,LISTEN_AND_SPEAK_QUESTION_LIST:E.SPEAKING,LISTEN_AND_SPEAK_COMPARE_IMAGES:E.SPEAKING,LISTEN_AND_SPEAK_WITH_STORY_IMAGES:E.SPEAKING,LISTEN_AND_SPEAK_ODD_ONE_OUT:E.SPEAKING,LISTEN_AND_SPEAK_INFO_EXCHANGE:E.SPEAKING,READ_DISPLAYED_CONTENT:E.SPEAKING,SPEAKING_DESCRIBE_IMAGE:E.SPEAKING,SPONTANEOUS_QA:E.SPEAKING,SPEAKING_CONVERSATION:E.SPEAKING,SPEAKING_CUE_CARD:E.SPEAKING,GN_SPEAKING_INTERVIEW:E.SPEAKING,CHOOSE_THE_CORRECT_ANSWER:E.READING,CHOOSE_CORRECT_ADJECTIVE:E.READING,FILL_IN_BLANK:E.READING,FILL_MISSING_WORDS_IN_GRID:E.READING,READ_PASSAGE_AND_ANSWER_QUESTIONS:E.READING,ANSWER_THE_QUESTION:E.READING,WORD_ORDERING:E.READING,WORD_FILL_PARAGRAPH:E.READING,MATCH_BY_WRITING_ANSWER:E.READING,LABEL_THE_PICTURE:E.READING,LOOK_PICTURE_CHOOSE_CORRECT_ANSWER:E.READING,LOOK_PICTURE_FILL_BLANK_CHOOSE_ANSWER:E.READING,LOOK_PICTURE_FILL_WORD_HINT:E.READING,READ_AND_COLOR_OBJECTS:E.READING,IMAGE_OBJECT_MATCHING:E.READING,TRUE_FALSE:E.READING,MATCHING:E.READING,ORDERING:E.READING,TICK_TRUE_OR_FALSE:E.READING,TICK_YES_OR_NO:E.READING,READING_TICK_CROSS:E.READING,ARRANGE_LETTERS_INTO_WORDS:E.READING,READ_PASSAGE_AND_COMPLETE_STORY:E.READING,CLOZE_TEST_WITH_TICK_BOX:E.READING,READ_AND_CHOOSE_APPROPRIATE_WORD:E.READING,READING_LETTER_ARRANGE:E.READING,READING_PASSAGE_FILL:E.READING,FILL_BLANK:E.READING,WORD_FILL_STRUCTURED_FORM:E.READING,WRITE_A_SHORT_LETTER:E.WRITING,WRITE_CORRECT_VERB_FORM:E.WRITING,WRITE_SHORT_PARAGRAPH:E.WRITING,WRITE_SENTENCES:E.WRITING,ESSAY:E.WRITING,COLORING:E.WRITING};export function getQuestionTypeSkill(E){return QUESTION_TYPE_SKILLS[E]||"READING"}export function getQuestionTypesBySkill(E){return Object.entries(QUESTION_TYPE_SKILLS).filter(([_,N])=>N===E).map(([E,_])=>E)}export const QUESTION_TYPES_BY_SKILL={LISTENING:getQuestionTypesBySkill("LISTENING"),SPEAKING:getQuestionTypesBySkill("SPEAKING"),READING:getQuestionTypesBySkill("READING"),WRITING:getQuestionTypesBySkill("WRITING")};export const MARKETING_QUESTION_TYPES_BY_SKILL={[E.LISTENING]:[],[E.SPEAKING]:[],[E.READING]:["CHOOSE_THE_CORRECT_ANSWER","CHOOSE_CORRECT_ADJECTIVE","FILL_IN_BLANK","FILL_MISSING_WORDS_IN_GRID","LABEL_THE_PICTURE","LOOK_PICTURE_CHOOSE_CORRECT_ANSWER","LOOK_PICTURE_FILL_BLANK_CHOOSE_ANSWER","LOOK_PICTURE_FILL_WORD_HINT","READ_AND_COLOR_OBJECTS","IMAGE_OBJECT_MATCHING","READ_PASSAGE_AND_ANSWER_QUESTIONS"],[E.WRITING]:["WRITE_A_SHORT_LETTER","WRITE_CORRECT_VERB_FORM","WRITE_SENTENCES"]};export function isMarketingQuestionType(E){return Object.values(MARKETING_QUESTION_TYPES_BY_SKILL).flat().includes(E)}export const QUESTION_TYPE_LABELS={LISTEN_AND_FILL_IN_THE_BLANK_WITH_IMAGE:"Nghe - Điền từ có hình",LISTEN_AND_TICK_ANSWER:"Nghe - Đánh dấu",LISTEN_AND_FILL_NAME_NUMBER:"Nghe - Điền tên/số",LISTENING_FILL_BLANK:"Nghe - Điền chỗ trống",LISTENING_COLOR:"Nghe - Tô màu",LISTENING:"Nghe",CHOOSE_THE_CORRECT_ANSWER:"Chọn đáp án đúng",CHOOSE_CORRECT_ADJECTIVE:"Chọn tính từ",FILL_IN_BLANK:"Điền vào chỗ trống",FILL_MISSING_WORDS_IN_GRID:"Điền từ vào lưới",READ_PASSAGE_AND_ANSWER_QUESTIONS:"Đọc hiểu - Trả lời",LABEL_THE_PICTURE:"Gắn nhãn hình ảnh",LOOK_PICTURE_CHOOSE_CORRECT_ANSWER:"Nhìn ảnh - Chọn đáp án",LOOK_PICTURE_FILL_BLANK_CHOOSE_ANSWER:"Nhìn ảnh - Điền và chọn",LOOK_PICTURE_FILL_WORD_HINT:"Nhìn ảnh - Điền từ gợi ý",READ_AND_COLOR_OBJECTS:"Đọc - Tô màu",IMAGE_OBJECT_MATCHING:"Ghép hình ảnh - Đối tượng",TRUE_FALSE:"Đúng/Sai",MATCHING:"Ghép nối",ORDERING:"Sắp xếp",TICK_TRUE_OR_FALSE:"Đánh dấu Đúng/Sai",TICK_YES_OR_NO:"Đánh dấu Có/Không",READING_TICK_CROSS:"Đọc - Đánh dấu",ARRANGE_LETTERS_INTO_WORDS:"Sắp xếp chữ cái thành từ",READ_PASSAGE_AND_COMPLETE_STORY:"Đọc - Hoàn thành câu chuyện",CLOZE_TEST_WITH_TICK_BOX:"Điền từ - Đánh dấu",READ_AND_CHOOSE_APPROPRIATE_WORD:"Đọc - Chọn từ phù hợp",READING_LETTER_ARRANGE:"Đọc - Sắp xếp chữ cái",READING_PASSAGE_FILL:"Đọc - Điền đoạn văn",FILL_BLANK:"Điền chỗ trống",ANSWER_THE_QUESTION:"Nghe - Đọc câu hỏi và viết đáp án",WORD_ORDERING:"Sắp xếp từ",WORD_FILL_PARAGRAPH:"Điền từ vào đoạn văn",MATCH_BY_WRITING_ANSWER:"Ghép đáp án bằng cách viết",WORD_FILL_STRUCTURED_FORM:"Điền từ vào biểu mẫu có cấu trúc",WRITE_A_SHORT_LETTER:"Viết thư",WRITE_CORRECT_VERB_FORM:"Chia động từ",WRITE_SHORT_PARAGRAPH:"Viết đoạn văn ngắn",WRITE_SENTENCES:"Viết câu",ESSAY:"Viết luận",COLORING:"Tô màu",LISTEN_AND_CHOOSE_FROM_ANSWER_GROUP:"Nghe và chọn trong nhóm đáp án",LISTEN_AND_CHOOSE_OBJECTS_IN_SCENE:"Nghe và chọn đối tượng trong cảnh",LISTEN_AND_DRAG_OBJECTS_INTO_SCENE:"Nghe và kéo thả đối tượng vào cảnh",LISTEN_AND_SPEAK_ANSWER:"Nghe và trả lời (Speaking)",LISTEN_AND_SPEAK_IMAGE_GROUP:"Nghe, nhìn nhóm ảnh và trả lời (Speaking)",LISTEN_AND_SPEAK_QUESTION_LIST:"Nghe, chọn câu hỏi và trả lời (Speaking)",LISTEN_AND_SPEAK_COMPARE_IMAGES:"Nghe và so sánh ảnh (Speaking)",LISTEN_AND_SPEAK_WITH_STORY_IMAGES:"Nghe, nhìn ảnh truyện và kể lại (Speaking)",LISTEN_AND_SPEAK_ODD_ONE_OUT:"Nghe, chọn hình khác loại và giải thích (Speaking)",LISTEN_AND_SPEAK_INFO_EXCHANGE:"Trao đổi thông tin (Speaking)",READ_DISPLAYED_CONTENT:"Đọc nội dung hiển thị (Speaking)",SPEAKING_DESCRIBE_IMAGE:"Nhìn tranh và mô tả (Speaking Part 2)",SPONTANEOUS_QA:"Hỏi đáp tự phát (Speaking Part 3)",SPEAKING_CONVERSATION:"Hội thoại Speaking (KFS Speaking)",GN_SPEAKING_INTERVIEW:"GN Speaking - Hỏi đáp (Virtual + Real)"};export function getQuestionTypeLabel(E){return QUESTION_TYPE_LABELS[E]||E}export const SKILL_METADATA={[E.LISTENING]:{name:"Nghe",emoji:"🎧",color:"text-blue-600",bgColor:"bg-blue-50",borderColor:"border-blue-200",description:"Kỹ năng nghe hiểu"},[E.SPEAKING]:{name:"Nói",emoji:"🗣️",color:"text-green-600",bgColor:"bg-green-50",borderColor:"border-green-200",description:"Kỹ năng giao tiếp"},[E.READING]:{name:"Đọc",emoji:"📖",color:"text-purple-600",bgColor:"bg-purple-50",borderColor:"border-purple-200",description:"Kỹ năng đọc hiểu"},[E.WRITING]:{name:"Viết",emoji:"✏️",color:"text-orange-600",bgColor:"bg-orange-50",borderColor:"border-orange-200",description:"Kỹ năng viết"}};
|
|
1
|
+
import{SkillEnum as E}from"../types/common.types";export const QUESTION_TYPE_SKILLS={LISTEN_AND_FILL_IN_THE_BLANK_WITH_IMAGE:E.LISTENING,LISTEN_AND_TICK_ANSWER:E.LISTENING,LISTEN_AND_FILL_NAME_NUMBER:E.LISTENING,LISTENING_FILL_BLANK:E.LISTENING,LISTENING_COLOR:E.LISTENING,LISTENING:E.LISTENING,LISTEN_AND_CHOOSE_FROM_ANSWER_GROUP:E.SPEAKING,LISTEN_AND_CHOOSE_OBJECTS_IN_SCENE:E.SPEAKING,LISTEN_AND_DRAG_OBJECTS_INTO_SCENE:E.SPEAKING,LISTEN_AND_SPEAK_ANSWER:E.SPEAKING,LISTEN_AND_SPEAK_IMAGE_GROUP:E.SPEAKING,LISTEN_AND_SPEAK_QUESTION_LIST:E.SPEAKING,LISTEN_AND_SPEAK_COMPARE_IMAGES:E.SPEAKING,LISTEN_AND_SPEAK_WITH_STORY_IMAGES:E.SPEAKING,LISTEN_AND_SPEAK_ODD_ONE_OUT:E.SPEAKING,LISTEN_AND_SPEAK_INFO_EXCHANGE:E.SPEAKING,READ_DISPLAYED_CONTENT:E.SPEAKING,SPEAKING_DESCRIBE_IMAGE:E.SPEAKING,SPONTANEOUS_QA:E.SPEAKING,SPEAKING_CONVERSATION:E.SPEAKING,SPEAKING_CUE_CARD:E.SPEAKING,GN_SPEAKING_INTERVIEW:E.SPEAKING,CHOOSE_THE_CORRECT_ANSWER:E.READING,CHOOSE_THE_CORRECT_ANSWER_GROUP:E.READING,CHOOSE_CORRECT_ADJECTIVE:E.READING,FILL_IN_BLANK:E.READING,FILL_MISSING_WORDS_IN_GRID:E.READING,READ_PASSAGE_AND_ANSWER_QUESTIONS:E.READING,ANSWER_THE_QUESTION:E.READING,WORD_ORDERING:E.READING,WORD_FILL_PARAGRAPH:E.READING,MATCH_BY_WRITING_ANSWER:E.READING,LABEL_THE_PICTURE:E.READING,LOOK_PICTURE_CHOOSE_CORRECT_ANSWER:E.READING,LOOK_PICTURE_FILL_BLANK_CHOOSE_ANSWER:E.READING,LOOK_PICTURE_FILL_WORD_HINT:E.READING,READ_AND_COLOR_OBJECTS:E.READING,IMAGE_OBJECT_MATCHING:E.READING,TRUE_FALSE:E.READING,TRUE_FALSE_GROUP:E.READING,CROSS_OUT_WORD_GROUP:E.READING,MATCHING:E.READING,ORDERING:E.READING,TICK_TRUE_OR_FALSE:E.READING,TICK_YES_OR_NO:E.READING,READING_TICK_CROSS:E.READING,ARRANGE_LETTERS_INTO_WORDS:E.READING,READ_PASSAGE_AND_COMPLETE_STORY:E.READING,CLOZE_TEST_WITH_TICK_BOX:E.READING,READ_AND_CHOOSE_APPROPRIATE_WORD:E.READING,READING_LETTER_ARRANGE:E.READING,READING_PASSAGE_FILL:E.READING,FILL_BLANK:E.READING,WORD_FILL_STRUCTURED_FORM:E.READING,WRITE_A_SHORT_LETTER:E.WRITING,WRITE_CORRECT_VERB_FORM:E.WRITING,WRITE_SHORT_PARAGRAPH:E.WRITING,WRITE_SENTENCES:E.WRITING,ESSAY:E.WRITING,COLORING:E.WRITING};export function getQuestionTypeSkill(E){return QUESTION_TYPE_SKILLS[E]||"READING"}export function getQuestionTypesBySkill(E){return Object.entries(QUESTION_TYPE_SKILLS).filter(([_,N])=>N===E).map(([E,_])=>E)}export const QUESTION_TYPES_BY_SKILL={LISTENING:getQuestionTypesBySkill("LISTENING"),SPEAKING:getQuestionTypesBySkill("SPEAKING"),READING:getQuestionTypesBySkill("READING"),WRITING:getQuestionTypesBySkill("WRITING")};export const MARKETING_QUESTION_TYPES_BY_SKILL={[E.LISTENING]:[],[E.SPEAKING]:[],[E.READING]:["CHOOSE_THE_CORRECT_ANSWER","CHOOSE_CORRECT_ADJECTIVE","FILL_IN_BLANK","FILL_MISSING_WORDS_IN_GRID","LABEL_THE_PICTURE","LOOK_PICTURE_CHOOSE_CORRECT_ANSWER","LOOK_PICTURE_FILL_BLANK_CHOOSE_ANSWER","LOOK_PICTURE_FILL_WORD_HINT","READ_AND_COLOR_OBJECTS","IMAGE_OBJECT_MATCHING","READ_PASSAGE_AND_ANSWER_QUESTIONS"],[E.WRITING]:["WRITE_A_SHORT_LETTER","WRITE_CORRECT_VERB_FORM","WRITE_SENTENCES"]};export function isMarketingQuestionType(E){return Object.values(MARKETING_QUESTION_TYPES_BY_SKILL).flat().includes(E)}export const QUESTION_TYPE_LABELS={LISTEN_AND_FILL_IN_THE_BLANK_WITH_IMAGE:"Nghe - Điền từ có hình",LISTEN_AND_TICK_ANSWER:"Nghe - Đánh dấu",LISTEN_AND_FILL_NAME_NUMBER:"Nghe - Điền tên/số",LISTENING_FILL_BLANK:"Nghe - Điền chỗ trống",LISTENING_COLOR:"Nghe - Tô màu",LISTENING:"Nghe",CHOOSE_THE_CORRECT_ANSWER:"Chọn đáp án đúng",CHOOSE_THE_CORRECT_ANSWER_GROUP:"Chọn đáp án đúng (nhóm)",CHOOSE_CORRECT_ADJECTIVE:"Chọn tính từ",FILL_IN_BLANK:"Điền vào chỗ trống",FILL_MISSING_WORDS_IN_GRID:"Điền từ vào lưới",READ_PASSAGE_AND_ANSWER_QUESTIONS:"Đọc hiểu - Trả lời",LABEL_THE_PICTURE:"Gắn nhãn hình ảnh",LOOK_PICTURE_CHOOSE_CORRECT_ANSWER:"Nhìn ảnh - Chọn đáp án",LOOK_PICTURE_FILL_BLANK_CHOOSE_ANSWER:"Nhìn ảnh - Điền và chọn",LOOK_PICTURE_FILL_WORD_HINT:"Nhìn ảnh - Điền từ gợi ý",READ_AND_COLOR_OBJECTS:"Đọc - Tô màu",IMAGE_OBJECT_MATCHING:"Ghép hình ảnh - Đối tượng",TRUE_FALSE:"Đúng/Sai",TRUE_FALSE_GROUP:"Đúng/Sai (nhóm)",CROSS_OUT_WORD_GROUP:"Gạch từ / sửa từ (nhóm)",MATCHING:"Ghép nối",ORDERING:"Sắp xếp",TICK_TRUE_OR_FALSE:"Đánh dấu Đúng/Sai",TICK_YES_OR_NO:"Đánh dấu Có/Không",READING_TICK_CROSS:"Đọc - Đánh dấu",ARRANGE_LETTERS_INTO_WORDS:"Sắp xếp chữ cái thành từ",READ_PASSAGE_AND_COMPLETE_STORY:"Đọc - Hoàn thành câu chuyện",CLOZE_TEST_WITH_TICK_BOX:"Điền từ - Đánh dấu",READ_AND_CHOOSE_APPROPRIATE_WORD:"Đọc - Chọn từ phù hợp",READING_LETTER_ARRANGE:"Đọc - Sắp xếp chữ cái",READING_PASSAGE_FILL:"Đọc - Điền đoạn văn",FILL_BLANK:"Điền chỗ trống",ANSWER_THE_QUESTION:"Nghe - Đọc câu hỏi và viết đáp án",WORD_ORDERING:"Sắp xếp từ",WORD_FILL_PARAGRAPH:"Điền từ vào đoạn văn",MATCH_BY_WRITING_ANSWER:"Ghép đáp án bằng cách viết",WORD_FILL_STRUCTURED_FORM:"Điền từ vào biểu mẫu có cấu trúc",WRITE_A_SHORT_LETTER:"Viết thư",WRITE_CORRECT_VERB_FORM:"Chia động từ",WRITE_SHORT_PARAGRAPH:"Viết đoạn văn ngắn",WRITE_SENTENCES:"Viết câu",ESSAY:"Viết luận",COLORING:"Tô màu",LISTEN_AND_CHOOSE_FROM_ANSWER_GROUP:"Nghe và chọn trong nhóm đáp án",LISTEN_AND_CHOOSE_OBJECTS_IN_SCENE:"Nghe và chọn đối tượng trong cảnh",LISTEN_AND_DRAG_OBJECTS_INTO_SCENE:"Nghe và kéo thả đối tượng vào cảnh",LISTEN_AND_SPEAK_ANSWER:"Nghe và trả lời (Speaking)",LISTEN_AND_SPEAK_IMAGE_GROUP:"Nghe, nhìn nhóm ảnh và trả lời (Speaking)",LISTEN_AND_SPEAK_QUESTION_LIST:"Nghe, chọn câu hỏi và trả lời (Speaking)",LISTEN_AND_SPEAK_COMPARE_IMAGES:"Nghe và so sánh ảnh (Speaking)",LISTEN_AND_SPEAK_WITH_STORY_IMAGES:"Nghe, nhìn ảnh truyện và kể lại (Speaking)",LISTEN_AND_SPEAK_ODD_ONE_OUT:"Nghe, chọn hình khác loại và giải thích (Speaking)",LISTEN_AND_SPEAK_INFO_EXCHANGE:"Trao đổi thông tin (Speaking)",READ_DISPLAYED_CONTENT:"Đọc nội dung hiển thị (Speaking)",SPEAKING_DESCRIBE_IMAGE:"Nhìn tranh và mô tả (Speaking Part 2)",SPONTANEOUS_QA:"Hỏi đáp tự phát (Speaking Part 3)",SPEAKING_CONVERSATION:"Hội thoại Speaking (KFS Speaking)",GN_SPEAKING_INTERVIEW:"GN Speaking - Hỏi đáp (Virtual + Real)"};export function getQuestionTypeLabel(E){return QUESTION_TYPE_LABELS[E]||E}export const SKILL_METADATA={[E.LISTENING]:{name:"Nghe",emoji:"🎧",color:"text-blue-600",bgColor:"bg-blue-50",borderColor:"border-blue-200",description:"Kỹ năng nghe hiểu"},[E.SPEAKING]:{name:"Nói",emoji:"🗣️",color:"text-green-600",bgColor:"bg-green-50",borderColor:"border-green-200",description:"Kỹ năng giao tiếp"},[E.READING]:{name:"Đọc",emoji:"📖",color:"text-purple-600",bgColor:"bg-purple-50",borderColor:"border-purple-200",description:"Kỹ năng đọc hiểu"},[E.WRITING]:{name:"Viết",emoji:"✏️",color:"text-orange-600",bgColor:"bg-orange-50",borderColor:"border-orange-200",description:"Kỹ năng viết"}};
|
|
@@ -118,12 +118,6 @@ declare const admin: {
|
|
|
118
118
|
readonly 'admin.questionBank.dialog.edit.save': "Save changes";
|
|
119
119
|
readonly 'admin.questionBank.dialog.edit.codeError': "Please enter question code";
|
|
120
120
|
readonly 'admin.questionBank.dialog.edit.titleError': "Please enter title";
|
|
121
|
-
readonly 'admin.questionBank.dialog.edit.loading': "Loading...";
|
|
122
|
-
readonly 'admin.questionBank.dialog.edit.unsupportedNote': "Note:";
|
|
123
|
-
readonly 'admin.questionBank.dialog.edit.unsupportedType': "Question type \"{type}\" is not editable in this UI. Please use the exam creator to edit this question.";
|
|
124
|
-
readonly 'admin.questionBank.dialog.edit.contentLabel': "Question content";
|
|
125
|
-
readonly 'admin.questionBank.dialog.edit.answerLabel': "Correct answer";
|
|
126
|
-
readonly 'admin.questionBank.dialog.edit.explanationLabel': "Explanation";
|
|
127
121
|
readonly 'admin.questionBank.dialog.delete.title': "Confirm Delete Question";
|
|
128
122
|
readonly 'admin.questionBank.dialog.delete.message': "Are you sure you want to delete question";
|
|
129
123
|
readonly 'admin.questionBank.dialog.delete.warning': "This action cannot be undone.";
|
|
@@ -1393,6 +1387,9 @@ declare const admin: {
|
|
|
1393
1387
|
readonly 'admin.exams.shuffle.info3': "Questions within the same Part are randomly shuffled";
|
|
1394
1388
|
readonly 'admin.exams.shuffle.info4': "Variants are linked to the parent exam for management";
|
|
1395
1389
|
readonly 'admin.exams.shuffle.countLabel': "Number of variants to create";
|
|
1390
|
+
readonly 'admin.exams.shuffle.strategyLabel': "Existing exam handling option";
|
|
1391
|
+
readonly 'admin.exams.shuffle.keepOld': "Keep existing exams and add new ones";
|
|
1392
|
+
readonly 'admin.exams.shuffle.replaceAll': "Create a completely new set";
|
|
1396
1393
|
readonly 'admin.exams.shuffle.existingVariants': "Existing exams ({count})";
|
|
1397
1394
|
readonly 'admin.exams.shuffle.deleteAll': "Delete all ({count})";
|
|
1398
1395
|
readonly 'admin.exams.shuffle.loading': "Loading...";
|
|
@@ -1483,25 +1480,21 @@ declare const admin: {
|
|
|
1483
1480
|
readonly 'admin.exams.preview.totalPoints': "Total Points:";
|
|
1484
1481
|
readonly 'admin.exams.preview.progress': "Progress";
|
|
1485
1482
|
readonly 'admin.exams.preview.loading': "Loading...";
|
|
1486
|
-
readonly 'admin.exams.preview.questionNavigation': "
|
|
1483
|
+
readonly 'admin.exams.preview.questionNavigation': "Question Navigation";
|
|
1487
1484
|
readonly 'admin.exams.preview.all': "All";
|
|
1488
1485
|
readonly 'admin.exams.preview.allQuestions': "All {count} questions";
|
|
1489
1486
|
readonly 'admin.exams.preview.partQuestions': "Part {part}: {count} questions";
|
|
1490
1487
|
readonly 'admin.exams.preview.collapse': "Collapse";
|
|
1491
1488
|
readonly 'admin.exams.preview.detail': "Details";
|
|
1492
1489
|
readonly 'admin.exams.preview.questionIndex': "Question {index} / {total}";
|
|
1493
|
-
readonly 'admin.exams.preview.partIndex': "Part {index} / {total}";
|
|
1494
1490
|
readonly 'admin.exams.preview.noQuestions': "No questions yet";
|
|
1495
1491
|
readonly 'admin.exams.preview.loadingQuestions': "Loading questions...";
|
|
1496
1492
|
readonly 'admin.exams.preview.retry': "Retry";
|
|
1497
1493
|
readonly 'admin.exams.preview.examNoQuestions': "This exam has no questions yet.";
|
|
1498
1494
|
readonly 'admin.exams.preview.prevQuestion': "Previous Question";
|
|
1499
|
-
readonly 'admin.exams.preview.prevPart': "Previous Part";
|
|
1500
1495
|
readonly 'admin.exams.preview.prev': "Prev";
|
|
1501
1496
|
readonly 'admin.exams.preview.nextQuestion': "Next Question";
|
|
1502
|
-
readonly 'admin.exams.preview.nextPart': "Next Part";
|
|
1503
1497
|
readonly 'admin.exams.preview.next': "Next";
|
|
1504
|
-
readonly 'admin.exams.preview.questionLabel': "Question {number}";
|
|
1505
1498
|
readonly 'admin.exams.preview.footerNote': "This is a preview mode to check the layout and content of the exam.";
|
|
1506
1499
|
readonly 'admin.exams.preview.close': "Close";
|
|
1507
1500
|
readonly 'admin.exams.preview.loadError': "Unable to load questions. Please try again.";
|