feat(labs): describe the lab task contract and the provisioner port
This commit is contained in:
1 parent
3de226b16c
commit
9fdaa62b9b
91 files changed
+19262
-155
No files matched your search
@@ -28,6 +28,8 @@ import type {
|
||||
AssessmentExpressAttempt,
|
||||
AssessmentExpressResult,
|
||||
AssessmentItem,
|
||||
AssessmentLab,
|
||||
AssessmentLabConsoleSession,
|
||||
AssessmentQualifiedAttempt,
|
||||
AssessmentQualifiedResult,
|
||||
AssessmentResult,
|
||||
@@ -41,6 +43,7 @@ import type {
|
||||
ChoiceItemContent,
|
||||
ConfigurationItemContent,
|
||||
FindErrorItemContent,
|
||||
LabItemContent,
|
||||
NumberItemContent,
|
||||
OrderItemContent,
|
||||
PracticeItemContent,
|
||||
@@ -83,7 +86,9 @@ export const getCreateMyAssessmentAttemptResponseConfigurationItemContentMock =
|
||||
|
||||
export const getCreateMyAssessmentAttemptResponsePracticeItemContentMock = (overrideResponse: Partial<PracticeItemContent> = {}): PracticeItemContent => ({...{format: faker.helpers.arrayElement(['practice'] as const), languages: faker.helpers.arrayElements(['python','go'] as const), public_examples: Array.from({ length: faker.number.int({min: 1, max: 10}) }, (_, i) => i + 1).map(() => ({input: faker.string.alpha({length: {min: 10, max: 10000}}), expected_output: faker.string.alpha({length: {min: 10, max: 10000}})})), max_source_length: faker.number.int({min: 1, max: 65536})}, ...overrideResponse});
|
||||
|
||||
export const getCreateMyAssessmentAttemptResponseAssessmentItemMock = (overrideResponse: Partial<AssessmentItem> = {}): AssessmentItem => ({...{id: faker.string.uuid(), sequence: faker.number.int({min: 1, max: 100}), prompt: faker.string.alpha({length: {min: 1, max: 20000}}), content: faker.helpers.arrayElement([{...getCreateMyAssessmentAttemptResponseChoiceItemContentMock()},{...getCreateMyAssessmentAttemptResponseNumberItemContentMock()},{...getCreateMyAssessmentAttemptResponseStringItemContentMock()},{...getCreateMyAssessmentAttemptResponseOrderItemContentMock()},{...getCreateMyAssessmentAttemptResponseFindErrorItemContentMock()},{...getCreateMyAssessmentAttemptResponseConfigurationItemContentMock()},{...getCreateMyAssessmentAttemptResponsePracticeItemContentMock()},])}, ...overrideResponse});
|
||||
export const getCreateMyAssessmentAttemptResponseLabItemContentMock = (overrideResponse: Partial<LabItemContent> = {}): LabItemContent => ({...{format: faker.helpers.arrayElement(['lab'] as const), nodes: Array.from({ length: faker.number.int({min: 1, max: 8}) }, (_, i) => i + 1).map(() => ({name: fakeFromPattern("^[a-z][a-z0-9-]{0,14}$", {minLength: 1, maxLength: 15}), kind: faker.helpers.arrayElement(['mikrotik','ubuntu'] as const)})), time_limit_seconds: faker.number.int({min: 300, max: 14400})}, ...overrideResponse});
|
||||
|
||||
export const getCreateMyAssessmentAttemptResponseAssessmentItemMock = (overrideResponse: Partial<AssessmentItem> = {}): AssessmentItem => ({...{id: faker.string.uuid(), sequence: faker.number.int({min: 1, max: 100}), prompt: faker.string.alpha({length: {min: 1, max: 20000}}), content: faker.helpers.arrayElement([{...getCreateMyAssessmentAttemptResponseChoiceItemContentMock()},{...getCreateMyAssessmentAttemptResponseNumberItemContentMock()},{...getCreateMyAssessmentAttemptResponseStringItemContentMock()},{...getCreateMyAssessmentAttemptResponseOrderItemContentMock()},{...getCreateMyAssessmentAttemptResponseFindErrorItemContentMock()},{...getCreateMyAssessmentAttemptResponseConfigurationItemContentMock()},{...getCreateMyAssessmentAttemptResponsePracticeItemContentMock()},{...getCreateMyAssessmentAttemptResponseLabItemContentMock()},])}, ...overrideResponse});
|
||||
|
||||
export const getCreateMyAssessmentAttemptResponsePracticeVerdictMock = (overrideResponse: Partial<PracticeVerdict> = {}): PracticeVerdict => ({...{score: faker.number.int({min: 0, max: 3}), max_score: faker.number.int({min: 3, max: 3}), groups: Array.from({ length: faker.number.int({min: 3, max: 3}) }, (_, i) => i + 1).map(() => ({group: faker.number.int({min: 1, max: 3}), passed: faker.datatype.boolean()}))}, ...overrideResponse});
|
||||
|
||||
@@ -111,7 +116,9 @@ export const getGetMyAssessmentAttemptResponseConfigurationItemContentMock = (ov
|
||||
|
||||
export const getGetMyAssessmentAttemptResponsePracticeItemContentMock = (overrideResponse: Partial<PracticeItemContent> = {}): PracticeItemContent => ({...{format: faker.helpers.arrayElement(['practice'] as const), languages: faker.helpers.arrayElements(['python','go'] as const), public_examples: Array.from({ length: faker.number.int({min: 1, max: 10}) }, (_, i) => i + 1).map(() => ({input: faker.string.alpha({length: {min: 10, max: 10000}}), expected_output: faker.string.alpha({length: {min: 10, max: 10000}})})), max_source_length: faker.number.int({min: 1, max: 65536})}, ...overrideResponse});
|
||||
|
||||
export const getGetMyAssessmentAttemptResponseAssessmentItemMock = (overrideResponse: Partial<AssessmentItem> = {}): AssessmentItem => ({...{id: faker.string.uuid(), sequence: faker.number.int({min: 1, max: 100}), prompt: faker.string.alpha({length: {min: 1, max: 20000}}), content: faker.helpers.arrayElement([{...getGetMyAssessmentAttemptResponseChoiceItemContentMock()},{...getGetMyAssessmentAttemptResponseNumberItemContentMock()},{...getGetMyAssessmentAttemptResponseStringItemContentMock()},{...getGetMyAssessmentAttemptResponseOrderItemContentMock()},{...getGetMyAssessmentAttemptResponseFindErrorItemContentMock()},{...getGetMyAssessmentAttemptResponseConfigurationItemContentMock()},{...getGetMyAssessmentAttemptResponsePracticeItemContentMock()},])}, ...overrideResponse});
|
||||
export const getGetMyAssessmentAttemptResponseLabItemContentMock = (overrideResponse: Partial<LabItemContent> = {}): LabItemContent => ({...{format: faker.helpers.arrayElement(['lab'] as const), nodes: Array.from({ length: faker.number.int({min: 1, max: 8}) }, (_, i) => i + 1).map(() => ({name: fakeFromPattern("^[a-z][a-z0-9-]{0,14}$", {minLength: 1, maxLength: 15}), kind: faker.helpers.arrayElement(['mikrotik','ubuntu'] as const)})), time_limit_seconds: faker.number.int({min: 300, max: 14400})}, ...overrideResponse});
|
||||
|
||||
export const getGetMyAssessmentAttemptResponseAssessmentItemMock = (overrideResponse: Partial<AssessmentItem> = {}): AssessmentItem => ({...{id: faker.string.uuid(), sequence: faker.number.int({min: 1, max: 100}), prompt: faker.string.alpha({length: {min: 1, max: 20000}}), content: faker.helpers.arrayElement([{...getGetMyAssessmentAttemptResponseChoiceItemContentMock()},{...getGetMyAssessmentAttemptResponseNumberItemContentMock()},{...getGetMyAssessmentAttemptResponseStringItemContentMock()},{...getGetMyAssessmentAttemptResponseOrderItemContentMock()},{...getGetMyAssessmentAttemptResponseFindErrorItemContentMock()},{...getGetMyAssessmentAttemptResponseConfigurationItemContentMock()},{...getGetMyAssessmentAttemptResponsePracticeItemContentMock()},{...getGetMyAssessmentAttemptResponseLabItemContentMock()},])}, ...overrideResponse});
|
||||
|
||||
export const getGetMyAssessmentAttemptResponsePracticeVerdictMock = (overrideResponse: Partial<PracticeVerdict> = {}): PracticeVerdict => ({...{score: faker.number.int({min: 0, max: 3}), max_score: faker.number.int({min: 3, max: 3}), groups: Array.from({ length: faker.number.int({min: 3, max: 3}) }, (_, i) => i + 1).map(() => ({group: faker.number.int({min: 1, max: 3}), passed: faker.datatype.boolean()}))}, ...overrideResponse});
|
||||
|
||||
@@ -139,7 +146,9 @@ export const getStartMyAssessmentAttemptSessionResponseConfigurationItemContentM
|
||||
|
||||
export const getStartMyAssessmentAttemptSessionResponsePracticeItemContentMock = (overrideResponse: Partial<PracticeItemContent> = {}): PracticeItemContent => ({...{format: faker.helpers.arrayElement(['practice'] as const), languages: faker.helpers.arrayElements(['python','go'] as const), public_examples: Array.from({ length: faker.number.int({min: 1, max: 10}) }, (_, i) => i + 1).map(() => ({input: faker.string.alpha({length: {min: 10, max: 10000}}), expected_output: faker.string.alpha({length: {min: 10, max: 10000}})})), max_source_length: faker.number.int({min: 1, max: 65536})}, ...overrideResponse});
|
||||
|
||||
export const getStartMyAssessmentAttemptSessionResponseAssessmentItemMock = (overrideResponse: Partial<AssessmentItem> = {}): AssessmentItem => ({...{id: faker.string.uuid(), sequence: faker.number.int({min: 1, max: 100}), prompt: faker.string.alpha({length: {min: 1, max: 20000}}), content: faker.helpers.arrayElement([{...getStartMyAssessmentAttemptSessionResponseChoiceItemContentMock()},{...getStartMyAssessmentAttemptSessionResponseNumberItemContentMock()},{...getStartMyAssessmentAttemptSessionResponseStringItemContentMock()},{...getStartMyAssessmentAttemptSessionResponseOrderItemContentMock()},{...getStartMyAssessmentAttemptSessionResponseFindErrorItemContentMock()},{...getStartMyAssessmentAttemptSessionResponseConfigurationItemContentMock()},{...getStartMyAssessmentAttemptSessionResponsePracticeItemContentMock()},])}, ...overrideResponse});
|
||||
export const getStartMyAssessmentAttemptSessionResponseLabItemContentMock = (overrideResponse: Partial<LabItemContent> = {}): LabItemContent => ({...{format: faker.helpers.arrayElement(['lab'] as const), nodes: Array.from({ length: faker.number.int({min: 1, max: 8}) }, (_, i) => i + 1).map(() => ({name: fakeFromPattern("^[a-z][a-z0-9-]{0,14}$", {minLength: 1, maxLength: 15}), kind: faker.helpers.arrayElement(['mikrotik','ubuntu'] as const)})), time_limit_seconds: faker.number.int({min: 300, max: 14400})}, ...overrideResponse});
|
||||
|
||||
export const getStartMyAssessmentAttemptSessionResponseAssessmentItemMock = (overrideResponse: Partial<AssessmentItem> = {}): AssessmentItem => ({...{id: faker.string.uuid(), sequence: faker.number.int({min: 1, max: 100}), prompt: faker.string.alpha({length: {min: 1, max: 20000}}), content: faker.helpers.arrayElement([{...getStartMyAssessmentAttemptSessionResponseChoiceItemContentMock()},{...getStartMyAssessmentAttemptSessionResponseNumberItemContentMock()},{...getStartMyAssessmentAttemptSessionResponseStringItemContentMock()},{...getStartMyAssessmentAttemptSessionResponseOrderItemContentMock()},{...getStartMyAssessmentAttemptSessionResponseFindErrorItemContentMock()},{...getStartMyAssessmentAttemptSessionResponseConfigurationItemContentMock()},{...getStartMyAssessmentAttemptSessionResponsePracticeItemContentMock()},{...getStartMyAssessmentAttemptSessionResponseLabItemContentMock()},])}, ...overrideResponse});
|
||||
|
||||
export const getStartMyAssessmentAttemptSessionResponsePracticeVerdictMock = (overrideResponse: Partial<PracticeVerdict> = {}): PracticeVerdict => ({...{score: faker.number.int({min: 0, max: 3}), max_score: faker.number.int({min: 3, max: 3}), groups: Array.from({ length: faker.number.int({min: 3, max: 3}) }, (_, i) => i + 1).map(() => ({group: faker.number.int({min: 1, max: 3}), passed: faker.datatype.boolean()}))}, ...overrideResponse});
|
||||
|
||||
@@ -171,7 +180,9 @@ export const getSubmitMyAssessmentAnswerResponseConfigurationItemContentMock = (
|
||||
|
||||
export const getSubmitMyAssessmentAnswerResponsePracticeItemContentMock = (overrideResponse: Partial<PracticeItemContent> = {}): PracticeItemContent => ({...{format: faker.helpers.arrayElement(['practice'] as const), languages: faker.helpers.arrayElements(['python','go'] as const), public_examples: Array.from({ length: faker.number.int({min: 1, max: 10}) }, (_, i) => i + 1).map(() => ({input: faker.string.alpha({length: {min: 10, max: 10000}}), expected_output: faker.string.alpha({length: {min: 10, max: 10000}})})), max_source_length: faker.number.int({min: 1, max: 65536})}, ...overrideResponse});
|
||||
|
||||
export const getSubmitMyAssessmentAnswerResponseAssessmentItemMock = (overrideResponse: Partial<AssessmentItem> = {}): AssessmentItem => ({...{id: faker.string.uuid(), sequence: faker.number.int({min: 1, max: 100}), prompt: faker.string.alpha({length: {min: 1, max: 20000}}), content: faker.helpers.arrayElement([{...getSubmitMyAssessmentAnswerResponseChoiceItemContentMock()},{...getSubmitMyAssessmentAnswerResponseNumberItemContentMock()},{...getSubmitMyAssessmentAnswerResponseStringItemContentMock()},{...getSubmitMyAssessmentAnswerResponseOrderItemContentMock()},{...getSubmitMyAssessmentAnswerResponseFindErrorItemContentMock()},{...getSubmitMyAssessmentAnswerResponseConfigurationItemContentMock()},{...getSubmitMyAssessmentAnswerResponsePracticeItemContentMock()},])}, ...overrideResponse});
|
||||
export const getSubmitMyAssessmentAnswerResponseLabItemContentMock = (overrideResponse: Partial<LabItemContent> = {}): LabItemContent => ({...{format: faker.helpers.arrayElement(['lab'] as const), nodes: Array.from({ length: faker.number.int({min: 1, max: 8}) }, (_, i) => i + 1).map(() => ({name: fakeFromPattern("^[a-z][a-z0-9-]{0,14}$", {minLength: 1, maxLength: 15}), kind: faker.helpers.arrayElement(['mikrotik','ubuntu'] as const)})), time_limit_seconds: faker.number.int({min: 300, max: 14400})}, ...overrideResponse});
|
||||
|
||||
export const getSubmitMyAssessmentAnswerResponseAssessmentItemMock = (overrideResponse: Partial<AssessmentItem> = {}): AssessmentItem => ({...{id: faker.string.uuid(), sequence: faker.number.int({min: 1, max: 100}), prompt: faker.string.alpha({length: {min: 1, max: 20000}}), content: faker.helpers.arrayElement([{...getSubmitMyAssessmentAnswerResponseChoiceItemContentMock()},{...getSubmitMyAssessmentAnswerResponseNumberItemContentMock()},{...getSubmitMyAssessmentAnswerResponseStringItemContentMock()},{...getSubmitMyAssessmentAnswerResponseOrderItemContentMock()},{...getSubmitMyAssessmentAnswerResponseFindErrorItemContentMock()},{...getSubmitMyAssessmentAnswerResponseConfigurationItemContentMock()},{...getSubmitMyAssessmentAnswerResponsePracticeItemContentMock()},{...getSubmitMyAssessmentAnswerResponseLabItemContentMock()},])}, ...overrideResponse});
|
||||
|
||||
export const getSubmitMyAssessmentAnswerResponsePracticeVerdictMock = (overrideResponse: Partial<PracticeVerdict> = {}): PracticeVerdict => ({...{score: faker.number.int({min: 0, max: 3}), max_score: faker.number.int({min: 3, max: 3}), groups: Array.from({ length: faker.number.int({min: 3, max: 3}) }, (_, i) => i + 1).map(() => ({group: faker.number.int({min: 1, max: 3}), passed: faker.datatype.boolean()}))}, ...overrideResponse});
|
||||
|
||||
@@ -207,7 +218,9 @@ export const getFinalizeMyAssessmentAttemptResponseConfigurationItemContentMock
|
||||
|
||||
export const getFinalizeMyAssessmentAttemptResponsePracticeItemContentMock = (overrideResponse: Partial<PracticeItemContent> = {}): PracticeItemContent => ({...{format: faker.helpers.arrayElement(['practice'] as const), languages: faker.helpers.arrayElements(['python','go'] as const), public_examples: Array.from({ length: faker.number.int({min: 1, max: 10}) }, (_, i) => i + 1).map(() => ({input: faker.string.alpha({length: {min: 10, max: 10000}}), expected_output: faker.string.alpha({length: {min: 10, max: 10000}})})), max_source_length: faker.number.int({min: 1, max: 65536})}, ...overrideResponse});
|
||||
|
||||
export const getFinalizeMyAssessmentAttemptResponseAssessmentItemMock = (overrideResponse: Partial<AssessmentItem> = {}): AssessmentItem => ({...{id: faker.string.uuid(), sequence: faker.number.int({min: 1, max: 100}), prompt: faker.string.alpha({length: {min: 1, max: 20000}}), content: faker.helpers.arrayElement([{...getFinalizeMyAssessmentAttemptResponseChoiceItemContentMock()},{...getFinalizeMyAssessmentAttemptResponseNumberItemContentMock()},{...getFinalizeMyAssessmentAttemptResponseStringItemContentMock()},{...getFinalizeMyAssessmentAttemptResponseOrderItemContentMock()},{...getFinalizeMyAssessmentAttemptResponseFindErrorItemContentMock()},{...getFinalizeMyAssessmentAttemptResponseConfigurationItemContentMock()},{...getFinalizeMyAssessmentAttemptResponsePracticeItemContentMock()},])}, ...overrideResponse});
|
||||
export const getFinalizeMyAssessmentAttemptResponseLabItemContentMock = (overrideResponse: Partial<LabItemContent> = {}): LabItemContent => ({...{format: faker.helpers.arrayElement(['lab'] as const), nodes: Array.from({ length: faker.number.int({min: 1, max: 8}) }, (_, i) => i + 1).map(() => ({name: fakeFromPattern("^[a-z][a-z0-9-]{0,14}$", {minLength: 1, maxLength: 15}), kind: faker.helpers.arrayElement(['mikrotik','ubuntu'] as const)})), time_limit_seconds: faker.number.int({min: 300, max: 14400})}, ...overrideResponse});
|
||||
|
||||
export const getFinalizeMyAssessmentAttemptResponseAssessmentItemMock = (overrideResponse: Partial<AssessmentItem> = {}): AssessmentItem => ({...{id: faker.string.uuid(), sequence: faker.number.int({min: 1, max: 100}), prompt: faker.string.alpha({length: {min: 1, max: 20000}}), content: faker.helpers.arrayElement([{...getFinalizeMyAssessmentAttemptResponseChoiceItemContentMock()},{...getFinalizeMyAssessmentAttemptResponseNumberItemContentMock()},{...getFinalizeMyAssessmentAttemptResponseStringItemContentMock()},{...getFinalizeMyAssessmentAttemptResponseOrderItemContentMock()},{...getFinalizeMyAssessmentAttemptResponseFindErrorItemContentMock()},{...getFinalizeMyAssessmentAttemptResponseConfigurationItemContentMock()},{...getFinalizeMyAssessmentAttemptResponsePracticeItemContentMock()},{...getFinalizeMyAssessmentAttemptResponseLabItemContentMock()},])}, ...overrideResponse});
|
||||
|
||||
export const getFinalizeMyAssessmentAttemptResponsePracticeVerdictMock = (overrideResponse: Partial<PracticeVerdict> = {}): PracticeVerdict => ({...{score: faker.number.int({min: 0, max: 3}), max_score: faker.number.int({min: 3, max: 3}), groups: Array.from({ length: faker.number.int({min: 3, max: 3}) }, (_, i) => i + 1).map(() => ({group: faker.number.int({min: 1, max: 3}), passed: faker.datatype.boolean()}))}, ...overrideResponse});
|
||||
|
||||
@@ -231,6 +244,14 @@ export const getGetMyAssessmentResultResponseAssessmentExpressResultMock = (over
|
||||
|
||||
export const getGetMyAssessmentResultResponseMock = (): AssessmentResult => (faker.helpers.arrayElement([{...getGetMyAssessmentResultResponseAssessmentQualifiedResultMock()},{...getGetMyAssessmentResultResponseAssessmentCorrectiveResultMock()},{...getGetMyAssessmentResultResponseAssessmentExpressResultMock()},]))
|
||||
|
||||
export const getCreateMyAssessmentLabResponseMock = (overrideResponse: Partial<Extract<AssessmentLab, object>> = {}): AssessmentLab => (faker.helpers.arrayElement([{id: faker.string.uuid(), item_id: faker.string.uuid(), state: faker.helpers.arrayElement(['provisioning','ready','checking','submitted','expired','failed'] as const), nodes: Array.from({ length: faker.number.int({min: 1, max: 8}) }, (_, i) => i + 1).map(() => ({name: fakeFromPattern("^[a-z][a-z0-9-]{0,14}$", {minLength: 1, maxLength: 15}), kind: faker.helpers.arrayElement(['mikrotik','ubuntu'] as const)})), created_at: faker.date.past().toISOString().slice(0, 19) + 'Z', ready_at: faker.helpers.arrayElement([faker.date.past().toISOString().slice(0, 19) + 'Z',null,]), expires_at: faker.date.past().toISOString().slice(0, 19) + 'Z', finished_at: faker.helpers.arrayElement([faker.date.past().toISOString().slice(0, 19) + 'Z',null,]), failure_reason: faker.helpers.arrayElement([faker.helpers.arrayElement(['lab_error'] as const),null,]), ...overrideResponse}, {id: faker.string.uuid(), item_id: faker.string.uuid(), state: faker.helpers.arrayElement(['provisioning','ready','checking','submitted','expired','failed'] as const), nodes: Array.from({ length: faker.number.int({min: 1, max: 8}) }, (_, i) => i + 1).map(() => ({name: fakeFromPattern("^[a-z][a-z0-9-]{0,14}$", {minLength: 1, maxLength: 15}), kind: faker.helpers.arrayElement(['mikrotik','ubuntu'] as const)})), created_at: faker.date.past().toISOString().slice(0, 19) + 'Z', ready_at: faker.helpers.arrayElement([faker.date.past().toISOString().slice(0, 19) + 'Z',null,]), expires_at: faker.date.past().toISOString().slice(0, 19) + 'Z', finished_at: faker.helpers.arrayElement([faker.date.past().toISOString().slice(0, 19) + 'Z',null,]), failure_reason: faker.helpers.arrayElement([faker.helpers.arrayElement(['lab_error'] as const),null,]), ...overrideResponse}]))
|
||||
|
||||
export const getGetMyAssessmentLabResponseMock = (overrideResponse: Partial<Extract<AssessmentLab, object>> = {}): AssessmentLab => ({id: faker.string.uuid(), item_id: faker.string.uuid(), state: faker.helpers.arrayElement(['provisioning','ready','checking','submitted','expired','failed'] as const), nodes: Array.from({ length: faker.number.int({min: 1, max: 8}) }, (_, i) => i + 1).map(() => ({name: fakeFromPattern("^[a-z][a-z0-9-]{0,14}$", {minLength: 1, maxLength: 15}), kind: faker.helpers.arrayElement(['mikrotik','ubuntu'] as const)})), created_at: faker.date.past().toISOString().slice(0, 19) + 'Z', ready_at: faker.helpers.arrayElement([faker.date.past().toISOString().slice(0, 19) + 'Z',null,]), expires_at: faker.date.past().toISOString().slice(0, 19) + 'Z', finished_at: faker.helpers.arrayElement([faker.date.past().toISOString().slice(0, 19) + 'Z',null,]), failure_reason: faker.helpers.arrayElement([faker.helpers.arrayElement(['lab_error'] as const),null,]), ...overrideResponse})
|
||||
|
||||
export const getCreateMyAssessmentLabConsoleSessionResponseMock = (overrideResponse: Partial<Extract<AssessmentLabConsoleSession, object>> = {}): AssessmentLabConsoleSession => ({id: faker.string.uuid(), node: fakeFromPattern("^[a-z][a-z0-9-]{0,14}$", {minLength: 1, maxLength: 15}), websocket_path: fakeFromPattern("^/api/v1/me/assessment-lab-consoles/[0-9a-f-]{36}$", {maxLength: 128}), expires_at: faker.date.past().toISOString().slice(0, 19) + 'Z', ...overrideResponse})
|
||||
|
||||
export const getSubmitMyAssessmentLabResponseMock = (overrideResponse: Partial<Extract<AssessmentLab, object>> = {}): AssessmentLab => ({id: faker.string.uuid(), item_id: faker.string.uuid(), state: faker.helpers.arrayElement(['provisioning','ready','checking','submitted','expired','failed'] as const), nodes: Array.from({ length: faker.number.int({min: 1, max: 8}) }, (_, i) => i + 1).map(() => ({name: fakeFromPattern("^[a-z][a-z0-9-]{0,14}$", {minLength: 1, maxLength: 15}), kind: faker.helpers.arrayElement(['mikrotik','ubuntu'] as const)})), created_at: faker.date.past().toISOString().slice(0, 19) + 'Z', ready_at: faker.helpers.arrayElement([faker.date.past().toISOString().slice(0, 19) + 'Z',null,]), expires_at: faker.date.past().toISOString().slice(0, 19) + 'Z', finished_at: faker.helpers.arrayElement([faker.date.past().toISOString().slice(0, 19) + 'Z',null,]), failure_reason: faker.helpers.arrayElement([faker.helpers.arrayElement(['lab_error'] as const),null,]), ...overrideResponse})
|
||||
|
||||
|
||||
export const getGetMyAssessmentAvailabilityMockHandler = (overrideResponse?: AssessmentAvailability | ((info: Parameters<Parameters<typeof http.get>[1]>[0]) => Promise<AssessmentAvailability> | AssessmentAvailability), options?: RequestHandlerOptions) => {
|
||||
return http.get('*/api/v1/me/assessment-availability', async (info: Parameters<Parameters<typeof http.get>[1]>[0]) => {
|
||||
@@ -409,6 +430,54 @@ export const getGetMyAssessmentResultMockHandler = (overrideResponse?: Assessmen
|
||||
})
|
||||
}, options)
|
||||
}
|
||||
|
||||
export const getCreateMyAssessmentLabMockHandler = (overrideResponse?: AssessmentLab | ((info: Parameters<Parameters<typeof http.post>[1]>[0]) => Promise<AssessmentLab> | AssessmentLab), options?: RequestHandlerOptions) => {
|
||||
return http.post('*/api/v1/me/assessment-attempts/:attemptId/labs', async (info: Parameters<Parameters<typeof http.post>[1]>[0]) => {
|
||||
|
||||
|
||||
return HttpResponse.json(overrideResponse !== undefined
|
||||
? (typeof overrideResponse === "function" ? await overrideResponse(info) : overrideResponse)
|
||||
: getCreateMyAssessmentLabResponseMock(),
|
||||
{ status: 200
|
||||
})
|
||||
}, options)
|
||||
}
|
||||
|
||||
export const getGetMyAssessmentLabMockHandler = (overrideResponse?: AssessmentLab | ((info: Parameters<Parameters<typeof http.get>[1]>[0]) => Promise<AssessmentLab> | AssessmentLab), options?: RequestHandlerOptions) => {
|
||||
return http.get('*/api/v1/me/assessment-attempts/:attemptId/labs/:labId', async (info: Parameters<Parameters<typeof http.get>[1]>[0]) => {
|
||||
|
||||
|
||||
return HttpResponse.json(overrideResponse !== undefined
|
||||
? (typeof overrideResponse === "function" ? await overrideResponse(info) : overrideResponse)
|
||||
: getGetMyAssessmentLabResponseMock(),
|
||||
{ status: 200
|
||||
})
|
||||
}, options)
|
||||
}
|
||||
|
||||
export const getCreateMyAssessmentLabConsoleSessionMockHandler = (overrideResponse?: AssessmentLabConsoleSession | ((info: Parameters<Parameters<typeof http.post>[1]>[0]) => Promise<AssessmentLabConsoleSession> | AssessmentLabConsoleSession), options?: RequestHandlerOptions) => {
|
||||
return http.post('*/api/v1/me/assessment-attempts/:attemptId/labs/:labId/console-sessions', async (info: Parameters<Parameters<typeof http.post>[1]>[0]) => {
|
||||
|
||||
|
||||
return HttpResponse.json(overrideResponse !== undefined
|
||||
? (typeof overrideResponse === "function" ? await overrideResponse(info) : overrideResponse)
|
||||
: getCreateMyAssessmentLabConsoleSessionResponseMock(),
|
||||
{ status: 201
|
||||
})
|
||||
}, options)
|
||||
}
|
||||
|
||||
export const getSubmitMyAssessmentLabMockHandler = (overrideResponse?: AssessmentLab | ((info: Parameters<Parameters<typeof http.post>[1]>[0]) => Promise<AssessmentLab> | AssessmentLab), options?: RequestHandlerOptions) => {
|
||||
return http.post('*/api/v1/me/assessment-attempts/:attemptId/labs/:labId/submission', async (info: Parameters<Parameters<typeof http.post>[1]>[0]) => {
|
||||
|
||||
|
||||
return HttpResponse.json(overrideResponse !== undefined
|
||||
? (typeof overrideResponse === "function" ? await overrideResponse(info) : overrideResponse)
|
||||
: getSubmitMyAssessmentLabResponseMock(),
|
||||
{ status: 202
|
||||
})
|
||||
}, options)
|
||||
}
|
||||
export const getAssessmentMock = () => [
|
||||
getGetMyAssessmentAvailabilityMockHandler(),
|
||||
getListMyAssessmentResultsMockHandler(),
|
||||
@@ -424,5 +493,9 @@ export const getAssessmentMock = () => [
|
||||
getCreateMyAssessmentPracticeRunMockHandler(),
|
||||
getGetMyAssessmentPracticeRunMockHandler(),
|
||||
getFinalizeMyAssessmentAttemptMockHandler(),
|
||||
getGetMyAssessmentResultMockHandler()
|
||||
getGetMyAssessmentResultMockHandler(),
|
||||
getCreateMyAssessmentLabMockHandler(),
|
||||
getGetMyAssessmentLabMockHandler(),
|
||||
getCreateMyAssessmentLabConsoleSessionMockHandler(),
|
||||
getSubmitMyAssessmentLabMockHandler()
|
||||
]
|
||||
@@ -31,6 +31,11 @@ import type {
|
||||
AssessmentAvailability,
|
||||
AssessmentFinalization,
|
||||
AssessmentFinalizeConflictProblem,
|
||||
AssessmentLab,
|
||||
AssessmentLabConsoleSession,
|
||||
AssessmentLabConsoleSessionCreate,
|
||||
AssessmentLabCreate,
|
||||
AssessmentLabSubmission,
|
||||
AssessmentResult,
|
||||
AssessmentResultHistoryPage,
|
||||
AssessmentSignalBatch,
|
||||
@@ -39,6 +44,7 @@ import type {
|
||||
AssessmentSignalReceipt,
|
||||
AssessmentWorkSession,
|
||||
CreateMyAssessmentAttemptHeaders,
|
||||
CreateMyAssessmentLabHeaders,
|
||||
CreateMyAssessmentPracticeRunHeaders,
|
||||
FinalizeMyAssessmentAttemptHeaders,
|
||||
HoldMyAssessmentWorkSessionHeaders,
|
||||
@@ -49,7 +55,8 @@ import type {
|
||||
RecordMyAssessmentAttemptSignalsHeaders,
|
||||
ReleaseMyAssessmentWorkSessionHeaders,
|
||||
StartMyAssessmentAttemptSessionHeaders,
|
||||
SubmitMyAssessmentAnswerHeaders
|
||||
SubmitMyAssessmentAnswerHeaders,
|
||||
SubmitMyAssessmentLabHeaders
|
||||
} from '../../schemas';
|
||||
|
||||
import { apiRequest } from '../../client';
|
||||
@@ -1082,6 +1089,8 @@ export const useReleaseMyAssessmentWorkSession = <TError = ErrorType<Problem>,
|
||||
/**
|
||||
* Requires the session cookie of a candidate account, the CSRF token of that session in X-CSRF-Token, an allowed Origin, and an Idempotency-Key. The body names the item and carries the answer in the format of that item: `choice`, `number`, `string`, `order`, `find_error`, `configuration`, or `practice`. It never carries a score, a duration, or a correctness flag; the server records the times itself and scores the answer with the key of the fixed item instance. Time never enters the ability estimate or the grade decision.
|
||||
*
|
||||
* Lab: an item with format `lab` takes no answer here. Its lab is started with CreateMyAssessmentLab and submitted with SubmitMyAssessmentLab; any answer to a lab item answers 400 validation_failed with the pointer `/answer/format`, like an answer in the wrong format, and stores nothing.
|
||||
*
|
||||
* The response is the attempt with the next item to answer. It never says whether the answer was correct. Items are answered in order and each answer is final.
|
||||
*
|
||||
* A work command requires an active session. After `idle_timeout_seconds` of inactivity, the candidate calls StartMyAssessmentAttemptSession to explicitly start or resume a session; this answer command never starts one or consumes session quota. Reading the attempt or result is always read-only. A command that finds a due deadline transition may commit it before returning; a command that finds an expired idle session answers 409 until the candidate explicitly starts the next session.
|
||||
@@ -1598,3 +1607,409 @@ export function useGetMyAssessmentResult<TData = Awaited<ReturnType<typeof getMy
|
||||
|
||||
|
||||
|
||||
export const getCreateMyAssessmentLabUrl = (attemptId: string,) => {
|
||||
|
||||
|
||||
|
||||
|
||||
return `/api/v1/me/assessment-attempts/${attemptId}/labs`
|
||||
}
|
||||
|
||||
/**
|
||||
* Requires the session cookie of a candidate account, the CSRF token of that session in X-CSRF-Token, an allowed Origin, and an Idempotency-Key. The body names the current item, whose content has the format `lab`.
|
||||
*
|
||||
* The server asks the lab provisioner for a lab of the variant fixed for this item instance and answers 201 with the lab `provisioning`; the client polls GetMyAssessmentLab until it is `ready`. The lab lives until `expires_at`, the earlier of the item's `time_limit_seconds` and the attempt deadline, and is then deleted with everything done in it. Creating a lab does not change the attempt version, the current item, or any answer.
|
||||
*
|
||||
* One lab per item at a time. While the item has a lab in `provisioning`, `ready`, or `checking`, the server answers 200 with that lab and starts no second one. After a `failed` lab the candidate may start a new one while the item is current; after `submitted` or `expired` the item cannot start another lab (409 state_conflict).
|
||||
*
|
||||
* Busy pool. When the lab pool of the provisioner has no free capacity, the server answers 503 service_unavailable with Retry-After, for example `{"type": "urn:lincodex:problem:service_unavailable", "title": "Service unavailable", "status": 503, "code": "service_unavailable", "detail": "No lab capacity is free. The attempt is unchanged; retry later."}`. Nothing was stored: no lab exists, the attempt version and the current item are unchanged, the lab lifetime has not started, and the attempt is not consumed; the client retries after Retry-After with a new Idempotency-Key. When labs are not enabled on this server, or the provisioner cannot be reached, the server answers 503 service_unavailable without Retry-After and stores nothing either. The attempt deadline keeps running in both cases.
|
||||
*
|
||||
* Order of checks: session (401), CSRF and Origin (403 csrf_check_failed), request validation (400), account scenario (403 forbidden), the Idempotency-Key (422, 409 idempotency_in_progress, replay), the attempt and the item (404 not_found for an unknown attempt or item, or one of another candidate), the state (409 state_conflict: the attempt is terminal or its work session ended, the item is not current, its format is not `lab`, or its lab was submitted or expired), the rate limit (429), then the availability of labs and the capacity (503). Following the Idempotency-Key convention, 201, 200, 404, and 409 state_conflict are stored under the key and replayed; 400, 429, and 503 are not.
|
||||
* @summary Start the lab of the current lab item of an assessment attempt.
|
||||
*/
|
||||
export const createMyAssessmentLab = async (attemptId: string,
|
||||
assessmentLabCreate: AssessmentLabCreate,
|
||||
headers: CreateMyAssessmentLabHeaders, options?: Parameters<typeof apiRequest>[1]): Promise<AssessmentLab> => {
|
||||
|
||||
const getHeaders = (h?: NonNullable<RequestInit['headers']>): Record<string, string | readonly string[]> => {
|
||||
if (!h) return {};
|
||||
if (h instanceof Headers) return Object.fromEntries(h.entries());
|
||||
if (Symbol.iterator in h) {
|
||||
return Object.fromEntries(
|
||||
Array.from(h as Iterable<Iterable<string>>, (entry) => Array.from(entry) as [string, string]),
|
||||
);
|
||||
}
|
||||
const headers: Record<string, string | readonly string[]> = {};
|
||||
for (const [name, value] of Object.entries<string | readonly string[] | undefined>(h)) {
|
||||
if (value !== undefined) headers[name] = value;
|
||||
}
|
||||
return headers;
|
||||
};
|
||||
return apiRequest<AssessmentLab>(getCreateMyAssessmentLabUrl(attemptId),
|
||||
{
|
||||
...options,
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json',...headers, ...getHeaders(options?.headers) },
|
||||
body: JSON.stringify(assessmentLabCreate)
|
||||
}
|
||||
);}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
export const getCreateMyAssessmentLabMutationKey = () => ['createMyAssessmentLab'] as const;
|
||||
|
||||
export const getCreateMyAssessmentLabMutationOptions = <TError = ErrorType<Problem>,
|
||||
TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof createMyAssessmentLab>>, TError,CreateMyAssessmentLabMutationVariables, TContext>, request?: SecondParameter<typeof apiRequest>}
|
||||
): UseMutationOptions<Awaited<ReturnType<typeof createMyAssessmentLab>>, TError,CreateMyAssessmentLabMutationVariables, TContext> => {
|
||||
|
||||
const mutationKey = getCreateMyAssessmentLabMutationKey();
|
||||
const {mutation: mutationOptions, request: requestOptions} = options ?
|
||||
options.mutation && 'mutationKey' in options.mutation && options.mutation.mutationKey ?
|
||||
options
|
||||
: {...options, mutation: {...options.mutation, mutationKey}}
|
||||
: {mutation: { mutationKey, }, request: undefined};
|
||||
|
||||
|
||||
|
||||
|
||||
const mutationFn: MutationFunction<Awaited<ReturnType<typeof createMyAssessmentLab>>, CreateMyAssessmentLabMutationVariables> = (props) => {
|
||||
const {attemptId,data,headers} = props ?? {};
|
||||
|
||||
return createMyAssessmentLab(attemptId,data,headers,requestOptions)
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
return { mutationFn, ...mutationOptions }}
|
||||
|
||||
export type CreateMyAssessmentLabMutationResult = NonNullable<Awaited<ReturnType<typeof createMyAssessmentLab>>>
|
||||
export type CreateMyAssessmentLabMutationBody = AssessmentLabCreate
|
||||
export type CreateMyAssessmentLabMutationError = ErrorType<Problem>
|
||||
export type CreateMyAssessmentLabMutationVariables = {attemptId: string;data: AssessmentLabCreate;headers: CreateMyAssessmentLabHeaders}
|
||||
|
||||
/**
|
||||
* @summary Start the lab of the current lab item of an assessment attempt.
|
||||
*/
|
||||
export const useCreateMyAssessmentLab = <TError = ErrorType<Problem>,
|
||||
TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof createMyAssessmentLab>>, TError,CreateMyAssessmentLabMutationVariables, TContext>, request?: SecondParameter<typeof apiRequest>}
|
||||
, queryClient?: QueryClient): UseMutationResult<
|
||||
Awaited<ReturnType<typeof createMyAssessmentLab>>,
|
||||
TError,
|
||||
CreateMyAssessmentLabMutationVariables,
|
||||
TContext
|
||||
> => {
|
||||
return useMutation(getCreateMyAssessmentLabMutationOptions(options), queryClient);
|
||||
}
|
||||
export const getGetMyAssessmentLabUrl = (attemptId: string,
|
||||
labId: string,) => {
|
||||
|
||||
|
||||
|
||||
|
||||
return `/api/v1/me/assessment-attempts/${attemptId}/labs/${labId}`
|
||||
}
|
||||
|
||||
/**
|
||||
* Requires the session cookie of a candidate account. Returns the state of a lab started with CreateMyAssessmentLab: whether it is still provisioning, ready for the consoles, being checked after the submission, or ended. It never contains a node address, a credential, the seed, the checker state, or the result of the check. This GET is read-only; the server may record a due timer transition, such as `ready` to `expired`, before it answers.
|
||||
*
|
||||
* A lab of another candidate's attempt, a lab of another attempt, and an unknown identifier all answer 404 not_found.
|
||||
* @summary Read the lab of an assessment attempt item.
|
||||
*/
|
||||
export const getMyAssessmentLab = async (attemptId: string,
|
||||
labId: string, options?: Parameters<typeof apiRequest>[1]): Promise<AssessmentLab> => {
|
||||
|
||||
return apiRequest<AssessmentLab>(getGetMyAssessmentLabUrl(attemptId,labId),
|
||||
{
|
||||
...options,
|
||||
method: 'GET'
|
||||
|
||||
|
||||
}
|
||||
);}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
export const getGetMyAssessmentLabQueryKey = (attemptId: string,
|
||||
labId: string,) => {
|
||||
return [
|
||||
`/api/v1/me/assessment-attempts/${attemptId}/labs/${labId}`
|
||||
] as const;
|
||||
}
|
||||
|
||||
|
||||
export const getGetMyAssessmentLabQueryOptions = <TData = Awaited<ReturnType<typeof getMyAssessmentLab>>, TError = ErrorType<Problem>>(attemptId: string,
|
||||
labId: string, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getMyAssessmentLab>>, TError, TData>>, request?: SecondParameter<typeof apiRequest>}
|
||||
) => {
|
||||
|
||||
const {query: queryOptions, request: requestOptions} = options ?? {};
|
||||
|
||||
const queryKey = queryOptions?.queryKey ?? getGetMyAssessmentLabQueryKey(attemptId,labId);
|
||||
|
||||
|
||||
|
||||
const queryFn: QueryFunction<Awaited<ReturnType<typeof getMyAssessmentLab>>> = ({ signal }) => getMyAssessmentLab(attemptId,labId, { signal, ...requestOptions });
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
return { queryKey, queryFn, enabled: attemptId !== null && attemptId !== undefined && labId !== null && labId !== undefined, ...queryOptions} as UseQueryOptions<Awaited<ReturnType<typeof getMyAssessmentLab>>, TError, TData> & { queryKey: DataTag<QueryKey, TData, TError> }
|
||||
}
|
||||
|
||||
export type GetMyAssessmentLabQueryResult = NonNullable<Awaited<ReturnType<typeof getMyAssessmentLab>>>
|
||||
export type GetMyAssessmentLabQueryError = ErrorType<Problem>
|
||||
|
||||
|
||||
export function useGetMyAssessmentLab<TData = Awaited<ReturnType<typeof getMyAssessmentLab>>, TError = ErrorType<Problem>>(
|
||||
attemptId: string,
|
||||
labId: string, options: { query:Partial<UseQueryOptions<Awaited<ReturnType<typeof getMyAssessmentLab>>, TError, TData>> & Pick<
|
||||
DefinedInitialDataOptions<
|
||||
Awaited<ReturnType<typeof getMyAssessmentLab>>,
|
||||
TError,
|
||||
Awaited<ReturnType<typeof getMyAssessmentLab>>
|
||||
> , 'initialData'
|
||||
>, request?: SecondParameter<typeof apiRequest>}
|
||||
, queryClient?: QueryClient
|
||||
): DefinedUseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }
|
||||
export function useGetMyAssessmentLab<TData = Awaited<ReturnType<typeof getMyAssessmentLab>>, TError = ErrorType<Problem>>(
|
||||
attemptId: string,
|
||||
labId: string, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getMyAssessmentLab>>, TError, TData>> & Pick<
|
||||
UndefinedInitialDataOptions<
|
||||
Awaited<ReturnType<typeof getMyAssessmentLab>>,
|
||||
TError,
|
||||
Awaited<ReturnType<typeof getMyAssessmentLab>>
|
||||
> , 'initialData'
|
||||
>, request?: SecondParameter<typeof apiRequest>}
|
||||
, queryClient?: QueryClient
|
||||
): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }
|
||||
export function useGetMyAssessmentLab<TData = Awaited<ReturnType<typeof getMyAssessmentLab>>, TError = ErrorType<Problem>>(
|
||||
attemptId: string,
|
||||
labId: string, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getMyAssessmentLab>>, TError, TData>>, request?: SecondParameter<typeof apiRequest>}
|
||||
, queryClient?: QueryClient
|
||||
): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }
|
||||
/**
|
||||
* @summary Read the lab of an assessment attempt item.
|
||||
*/
|
||||
|
||||
export function useGetMyAssessmentLab<TData = Awaited<ReturnType<typeof getMyAssessmentLab>>, TError = ErrorType<Problem>>(
|
||||
attemptId: string,
|
||||
labId: string, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getMyAssessmentLab>>, TError, TData>>, request?: SecondParameter<typeof apiRequest>}
|
||||
, queryClient?: QueryClient
|
||||
): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } {
|
||||
|
||||
const queryOptions = getGetMyAssessmentLabQueryOptions(attemptId,labId,options)
|
||||
|
||||
const query = useQuery(queryOptions, queryClient) as UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };
|
||||
|
||||
return withQueryKey(query, queryOptions.queryKey);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
export const getCreateMyAssessmentLabConsoleSessionUrl = (attemptId: string,
|
||||
labId: string,) => {
|
||||
|
||||
|
||||
|
||||
|
||||
return `/api/v1/me/assessment-attempts/${attemptId}/labs/${labId}/console-sessions`
|
||||
}
|
||||
|
||||
/**
|
||||
* Requires the session cookie of a candidate account, the CSRF token of that session in X-CSRF-Token, and an allowed Origin. The body names a node of the lab by its task name.
|
||||
*
|
||||
* The response describes one console session: the client opens a WebSocket to `websocket_path` on the same origin before `expires_at`. The upgrade is authorized by the session cookie and the Origin check, and the server relays the serial console of the node through the lab provisioner. The response never carries a node address, a port, a password, a key, or a token; the browser never connects to a node or to the provisioner. Console traffic is not stored as an answer and is not logged.
|
||||
*
|
||||
* The WebSocket relay is planned together with the candidate interface of labs; this contract fixes the session shape it uses.
|
||||
*
|
||||
* Order of checks: session (401), CSRF and Origin (403 csrf_check_failed), request validation (400), account scenario (403 forbidden), the attempt and the lab (404 not_found for an unknown attempt, lab, or one of another candidate), the node (400 with the pointer `/node`), the state (409 state_conflict: the lab is not `ready`, the attempt is terminal, or its work session ended), the limit of open sessions per lab (429 rate_limited with Retry-After), then the provisioner (503 service_unavailable without Retry-After; nothing was opened).
|
||||
* @summary Open a console session of one node of a ready lab.
|
||||
*/
|
||||
export const createMyAssessmentLabConsoleSession = async (attemptId: string,
|
||||
labId: string,
|
||||
assessmentLabConsoleSessionCreate: AssessmentLabConsoleSessionCreate, options?: Parameters<typeof apiRequest>[1]): Promise<AssessmentLabConsoleSession> => {
|
||||
|
||||
const getHeaders = (h?: NonNullable<RequestInit['headers']>): Record<string, string | readonly string[]> => {
|
||||
if (!h) return {};
|
||||
if (h instanceof Headers) return Object.fromEntries(h.entries());
|
||||
if (Symbol.iterator in h) {
|
||||
return Object.fromEntries(
|
||||
Array.from(h as Iterable<Iterable<string>>, (entry) => Array.from(entry) as [string, string]),
|
||||
);
|
||||
}
|
||||
const headers: Record<string, string | readonly string[]> = {};
|
||||
for (const [name, value] of Object.entries<string | readonly string[] | undefined>(h)) {
|
||||
if (value !== undefined) headers[name] = value;
|
||||
}
|
||||
return headers;
|
||||
};
|
||||
return apiRequest<AssessmentLabConsoleSession>(getCreateMyAssessmentLabConsoleSessionUrl(attemptId,labId),
|
||||
{
|
||||
...options,
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json', ...getHeaders(options?.headers) },
|
||||
body: JSON.stringify(assessmentLabConsoleSessionCreate)
|
||||
}
|
||||
);}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
export const getCreateMyAssessmentLabConsoleSessionMutationKey = () => ['createMyAssessmentLabConsoleSession'] as const;
|
||||
|
||||
export const getCreateMyAssessmentLabConsoleSessionMutationOptions = <TError = ErrorType<Problem>,
|
||||
TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof createMyAssessmentLabConsoleSession>>, TError,CreateMyAssessmentLabConsoleSessionMutationVariables, TContext>, request?: SecondParameter<typeof apiRequest>}
|
||||
): UseMutationOptions<Awaited<ReturnType<typeof createMyAssessmentLabConsoleSession>>, TError,CreateMyAssessmentLabConsoleSessionMutationVariables, TContext> => {
|
||||
|
||||
const mutationKey = getCreateMyAssessmentLabConsoleSessionMutationKey();
|
||||
const {mutation: mutationOptions, request: requestOptions} = options ?
|
||||
options.mutation && 'mutationKey' in options.mutation && options.mutation.mutationKey ?
|
||||
options
|
||||
: {...options, mutation: {...options.mutation, mutationKey}}
|
||||
: {mutation: { mutationKey, }, request: undefined};
|
||||
|
||||
|
||||
|
||||
|
||||
const mutationFn: MutationFunction<Awaited<ReturnType<typeof createMyAssessmentLabConsoleSession>>, CreateMyAssessmentLabConsoleSessionMutationVariables> = (props) => {
|
||||
const {attemptId,labId,data} = props ?? {};
|
||||
|
||||
return createMyAssessmentLabConsoleSession(attemptId,labId,data,requestOptions)
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
return { mutationFn, ...mutationOptions }}
|
||||
|
||||
export type CreateMyAssessmentLabConsoleSessionMutationResult = NonNullable<Awaited<ReturnType<typeof createMyAssessmentLabConsoleSession>>>
|
||||
export type CreateMyAssessmentLabConsoleSessionMutationBody = AssessmentLabConsoleSessionCreate
|
||||
export type CreateMyAssessmentLabConsoleSessionMutationError = ErrorType<Problem>
|
||||
export type CreateMyAssessmentLabConsoleSessionMutationVariables = {attemptId: string;labId: string;data: AssessmentLabConsoleSessionCreate}
|
||||
|
||||
/**
|
||||
* @summary Open a console session of one node of a ready lab.
|
||||
*/
|
||||
export const useCreateMyAssessmentLabConsoleSession = <TError = ErrorType<Problem>,
|
||||
TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof createMyAssessmentLabConsoleSession>>, TError,CreateMyAssessmentLabConsoleSessionMutationVariables, TContext>, request?: SecondParameter<typeof apiRequest>}
|
||||
, queryClient?: QueryClient): UseMutationResult<
|
||||
Awaited<ReturnType<typeof createMyAssessmentLabConsoleSession>>,
|
||||
TError,
|
||||
CreateMyAssessmentLabConsoleSessionMutationVariables,
|
||||
TContext
|
||||
> => {
|
||||
return useMutation(getCreateMyAssessmentLabConsoleSessionMutationOptions(options), queryClient);
|
||||
}
|
||||
export const getSubmitMyAssessmentLabUrl = (attemptId: string,
|
||||
labId: string,) => {
|
||||
|
||||
|
||||
|
||||
|
||||
return `/api/v1/me/assessment-attempts/${attemptId}/labs/${labId}/submission`
|
||||
}
|
||||
|
||||
/**
|
||||
* Requires the session cookie of a candidate account, the CSRF token of that session in X-CSRF-Token, an allowed Origin, and an Idempotency-Key. The body carries the attempt version last read and the answer with format `lab`, which names the lab.
|
||||
*
|
||||
* The server closes the consoles, freezes the lab, and answers 202 with the lab `checking`; the checker of the task reads the state of the nodes asynchronously, the answer is recorded, and the lab becomes `submitted` and is deleted. The client polls GetMyAssessmentLab and then reads the attempt, which moves to the next item. Neither response says whether the answer was correct, and the candidate never sees the checker criteria or their results.
|
||||
*
|
||||
* When the checker cannot reach the nodes because of the lab infrastructure, the lab becomes `failed` with `lab_error`: nothing is recorded or consumed, the attempt version is unchanged, and the candidate may start a new lab of the item while it is current. A failure of the infrastructure is never scored as a wrong answer.
|
||||
*
|
||||
* Optimistic concurrency: `expected_version` must equal the current attempt version, otherwise the server answers 412 version_conflict and stores nothing.
|
||||
*
|
||||
* Order of checks: session (401), CSRF and Origin (403 csrf_check_failed), request validation (400), account scenario (403 forbidden), the Idempotency-Key (422, 409 idempotency_in_progress, replay), the attempt and the lab (404 not_found for an unknown attempt or lab, or one of another candidate), the version (412), the state (409 state_conflict: the lab is not `ready`, `answer.lab_id` is not the lab in the path, the item is not current, the attempt is terminal, or its work session ended), then the provisioner (503 service_unavailable without Retry-After; nothing was stored and the lab keeps running). Following the Idempotency-Key convention, 202, 404, and 409 state_conflict are stored under the key and replayed; 400, 412, 429, and 5xx are not.
|
||||
* @summary Submit the lab of the current lab item as its answer.
|
||||
*/
|
||||
export const submitMyAssessmentLab = async (attemptId: string,
|
||||
labId: string,
|
||||
assessmentLabSubmission: AssessmentLabSubmission,
|
||||
headers: SubmitMyAssessmentLabHeaders, options?: Parameters<typeof apiRequest>[1]): Promise<AssessmentLab> => {
|
||||
|
||||
const getHeaders = (h?: NonNullable<RequestInit['headers']>): Record<string, string | readonly string[]> => {
|
||||
if (!h) return {};
|
||||
if (h instanceof Headers) return Object.fromEntries(h.entries());
|
||||
if (Symbol.iterator in h) {
|
||||
return Object.fromEntries(
|
||||
Array.from(h as Iterable<Iterable<string>>, (entry) => Array.from(entry) as [string, string]),
|
||||
);
|
||||
}
|
||||
const headers: Record<string, string | readonly string[]> = {};
|
||||
for (const [name, value] of Object.entries<string | readonly string[] | undefined>(h)) {
|
||||
if (value !== undefined) headers[name] = value;
|
||||
}
|
||||
return headers;
|
||||
};
|
||||
return apiRequest<AssessmentLab>(getSubmitMyAssessmentLabUrl(attemptId,labId),
|
||||
{
|
||||
...options,
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json',...headers, ...getHeaders(options?.headers) },
|
||||
body: JSON.stringify(assessmentLabSubmission)
|
||||
}
|
||||
);}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
export const getSubmitMyAssessmentLabMutationKey = () => ['submitMyAssessmentLab'] as const;
|
||||
|
||||
export const getSubmitMyAssessmentLabMutationOptions = <TError = ErrorType<Problem>,
|
||||
TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof submitMyAssessmentLab>>, TError,SubmitMyAssessmentLabMutationVariables, TContext>, request?: SecondParameter<typeof apiRequest>}
|
||||
): UseMutationOptions<Awaited<ReturnType<typeof submitMyAssessmentLab>>, TError,SubmitMyAssessmentLabMutationVariables, TContext> => {
|
||||
|
||||
const mutationKey = getSubmitMyAssessmentLabMutationKey();
|
||||
const {mutation: mutationOptions, request: requestOptions} = options ?
|
||||
options.mutation && 'mutationKey' in options.mutation && options.mutation.mutationKey ?
|
||||
options
|
||||
: {...options, mutation: {...options.mutation, mutationKey}}
|
||||
: {mutation: { mutationKey, }, request: undefined};
|
||||
|
||||
|
||||
|
||||
|
||||
const mutationFn: MutationFunction<Awaited<ReturnType<typeof submitMyAssessmentLab>>, SubmitMyAssessmentLabMutationVariables> = (props) => {
|
||||
const {attemptId,labId,data,headers} = props ?? {};
|
||||
|
||||
return submitMyAssessmentLab(attemptId,labId,data,headers,requestOptions)
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
return { mutationFn, ...mutationOptions }}
|
||||
|
||||
export type SubmitMyAssessmentLabMutationResult = NonNullable<Awaited<ReturnType<typeof submitMyAssessmentLab>>>
|
||||
export type SubmitMyAssessmentLabMutationBody = AssessmentLabSubmission
|
||||
export type SubmitMyAssessmentLabMutationError = ErrorType<Problem>
|
||||
export type SubmitMyAssessmentLabMutationVariables = {attemptId: string;labId: string;data: AssessmentLabSubmission;headers: SubmitMyAssessmentLabHeaders}
|
||||
|
||||
/**
|
||||
* @summary Submit the lab of the current lab item as its answer.
|
||||
*/
|
||||
export const useSubmitMyAssessmentLab = <TError = ErrorType<Problem>,
|
||||
TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof submitMyAssessmentLab>>, TError,SubmitMyAssessmentLabMutationVariables, TContext>, request?: SecondParameter<typeof apiRequest>}
|
||||
, queryClient?: QueryClient): UseMutationResult<
|
||||
Awaited<ReturnType<typeof submitMyAssessmentLab>>,
|
||||
TError,
|
||||
SubmitMyAssessmentLabMutationVariables,
|
||||
TContext
|
||||
> => {
|
||||
return useMutation(getSubmitMyAssessmentLabMutationOptions(options), queryClient);
|
||||
}
|
||||
@@ -84,6 +84,15 @@ export const assessmentAttemptOneOneCurrentItemOneContentSevenPublicExamplesMax
|
||||
|
||||
export const assessmentAttemptOneOneCurrentItemOneContentSevenMaxSourceLengthMax = 65536;
|
||||
|
||||
export const assessmentAttemptOneOneCurrentItemOneContentEightNodesItemNameMax = 15;
|
||||
|
||||
|
||||
export const assessmentAttemptOneOneCurrentItemOneContentEightNodesItemNameRegExp = new RegExp('^[a-z][a-z0-9-]{0,14}$');
|
||||
export const assessmentAttemptOneOneCurrentItemOneContentEightNodesMax = 8;
|
||||
|
||||
export const assessmentAttemptOneOneCurrentItemOneContentEightTimeLimitSecondsMin = 300;
|
||||
export const assessmentAttemptOneOneCurrentItemOneContentEightTimeLimitSecondsMax = 14400;
|
||||
|
||||
export const assessmentAttemptOneOnePracticesItemVerdictOneScoreMin = 0;
|
||||
export const assessmentAttemptOneOnePracticesItemVerdictOneScoreMax = 3;
|
||||
|
||||
@@ -180,6 +189,15 @@ export const assessmentAttemptTwoOneCurrentItemOneContentSevenPublicExamplesMax
|
||||
|
||||
export const assessmentAttemptTwoOneCurrentItemOneContentSevenMaxSourceLengthMax = 65536;
|
||||
|
||||
export const assessmentAttemptTwoOneCurrentItemOneContentEightNodesItemNameMax = 15;
|
||||
|
||||
|
||||
export const assessmentAttemptTwoOneCurrentItemOneContentEightNodesItemNameRegExp = new RegExp('^[a-z][a-z0-9-]{0,14}$');
|
||||
export const assessmentAttemptTwoOneCurrentItemOneContentEightNodesMax = 8;
|
||||
|
||||
export const assessmentAttemptTwoOneCurrentItemOneContentEightTimeLimitSecondsMin = 300;
|
||||
export const assessmentAttemptTwoOneCurrentItemOneContentEightTimeLimitSecondsMax = 14400;
|
||||
|
||||
export const assessmentAttemptTwoOnePracticesItemVerdictOneScoreMin = 0;
|
||||
export const assessmentAttemptTwoOnePracticesItemVerdictOneScoreMax = 3;
|
||||
|
||||
@@ -276,6 +294,15 @@ export const assessmentAttemptThreeOneCurrentItemOneContentSevenPublicExamplesMa
|
||||
|
||||
export const assessmentAttemptThreeOneCurrentItemOneContentSevenMaxSourceLengthMax = 65536;
|
||||
|
||||
export const assessmentAttemptThreeOneCurrentItemOneContentEightNodesItemNameMax = 15;
|
||||
|
||||
|
||||
export const assessmentAttemptThreeOneCurrentItemOneContentEightNodesItemNameRegExp = new RegExp('^[a-z][a-z0-9-]{0,14}$');
|
||||
export const assessmentAttemptThreeOneCurrentItemOneContentEightNodesMax = 8;
|
||||
|
||||
export const assessmentAttemptThreeOneCurrentItemOneContentEightTimeLimitSecondsMin = 300;
|
||||
export const assessmentAttemptThreeOneCurrentItemOneContentEightTimeLimitSecondsMax = 14400;
|
||||
|
||||
export const assessmentAttemptThreeOnePracticesItemVerdictOneScoreMin = 0;
|
||||
export const assessmentAttemptThreeOnePracticesItemVerdictOneScoreMax = 3;
|
||||
|
||||
@@ -367,7 +394,14 @@ export const AssessmentAttempt = zod.union([zod.object({
|
||||
"expected_output": zod.string().max(assessmentAttemptOneOneCurrentItemOneContentSevenPublicExamplesItemExpectedOutputMax)
|
||||
}).describe('Public example of the practice task: an input and its expected output. Hidden checks are never listed.')).max(assessmentAttemptOneOneCurrentItemOneContentSevenPublicExamplesMax),
|
||||
"max_source_length": zod.int().min(1).max(assessmentAttemptOneOneCurrentItemOneContentSevenMaxSourceLengthMax).describe('Maximum length of the solution source in characters.')
|
||||
}).describe('Code practice. The candidate submits one final solution, which runs in the isolated sandbox against three groups of hidden checks. The content lists only the statement, the allowed languages, and public examples; hidden checks, their inputs, and seeds never reach the client.')]).describe('Format-specific part of an item, selected by `format`. It holds only what the candidate needs to answer: never an answer key, a correct option, a score, a family or variant identifier, a seed, or a hidden check. Limits such as `multiple`, `max_selections`, and `max_length` belong to the format or the task family and never reveal the key.')
|
||||
}).describe('Code practice. The candidate submits one final solution, which runs in the isolated sandbox against three groups of hidden checks. The content lists only the statement, the allowed languages, and public examples; hidden checks, their inputs, and seeds never reach the client.'),zod.object({
|
||||
"format": zod.enum(['lab']),
|
||||
"nodes": zod.array(zod.object({
|
||||
"name": zod.string().min(1).max(assessmentAttemptOneOneCurrentItemOneContentEightNodesItemNameMax).regex(assessmentAttemptOneOneCurrentItemOneContentEightNodesItemNameRegExp).describe('Name of a lab node as the task statement uses it, such as `r1` or `srv`. It is a label of the task, not a host name or an address.'),
|
||||
"kind": zod.enum(['mikrotik', 'ubuntu']).describe('What the console of a node shows.\n\n- mikrotik: a MikroTik router with the RouterOS console.\n- ubuntu: a small Ubuntu server with a Linux login.\n\nAdding a value is a contract change.')
|
||||
}).describe('A node of a lab by its task name and kind. It never carries an address, a MAC address, a port, a password, a key, or an infrastructure name.')).min(1).max(assessmentAttemptOneOneCurrentItemOneContentEightNodesMax).describe('Nodes of the lab in the order of the statement.'),
|
||||
"time_limit_seconds": zod.int().min(assessmentAttemptOneOneCurrentItemOneContentEightTimeLimitSecondsMin).max(assessmentAttemptOneOneCurrentItemOneContentEightTimeLimitSecondsMax).describe('Lifetime of a lab of this item from its creation. The lab also ends no later than the attempt deadline.')
|
||||
}).describe('Practical lab: configure or repair a small network of virtual nodes through their consoles. The candidate starts the lab of the item with CreateMyAssessmentLab, works in the node consoles, and submits with SubmitMyAssessmentLab; the server then checks the state of the nodes. The content lists only the nodes the statement names and the lifetime of the lab, never the checker, its criteria, the seed, or an address. SubmitMyAssessmentAnswer takes no answer to a lab item; its result is submitted only with SubmitMyAssessmentLab.')]).describe('Format-specific part of an item, selected by `format`. It holds only what the candidate needs to answer: never an answer key, a correct option, a score, a family or variant identifier, a seed, or a hidden check. Limits such as `multiple`, `max_selections`, and `max_length` belong to the format or the task family and never reveal the key.')
|
||||
}).describe('Item instance served to the candidate. The variant is fixed when it is first served: a reload, a retried request, or a resumed session returns the same instance with the same text and option order. The item never says whether an earlier answer was correct, and seed items, which are not scored, are indistinguishable from scored ones.'),zod.null()]).describe('Item to answer now: a test item in `in_progress`, the practice item to submit in `practice_pending` or `additional_practice_pending` while that practice is `not_started` or `failed`, and null otherwise.'),
|
||||
"practices": zod.array(zod.object({
|
||||
"kind": zod.enum(['main', 'additional']).describe('Role of a practice in the attempt.\n\n- main: the practice that every attempt with practice requires before a decision.\n- additional: adaptive only; offered by finalize when the probability of reaching the grade is in the band below confirmation. It continues the same attempt and spends no new attempt.\n\nAdding a value is a contract change.'),
|
||||
@@ -468,7 +502,14 @@ export const AssessmentAttempt = zod.union([zod.object({
|
||||
"expected_output": zod.string().max(assessmentAttemptTwoOneCurrentItemOneContentSevenPublicExamplesItemExpectedOutputMax)
|
||||
}).describe('Public example of the practice task: an input and its expected output. Hidden checks are never listed.')).max(assessmentAttemptTwoOneCurrentItemOneContentSevenPublicExamplesMax),
|
||||
"max_source_length": zod.int().min(1).max(assessmentAttemptTwoOneCurrentItemOneContentSevenMaxSourceLengthMax).describe('Maximum length of the solution source in characters.')
|
||||
}).describe('Code practice. The candidate submits one final solution, which runs in the isolated sandbox against three groups of hidden checks. The content lists only the statement, the allowed languages, and public examples; hidden checks, their inputs, and seeds never reach the client.')]).describe('Format-specific part of an item, selected by `format`. It holds only what the candidate needs to answer: never an answer key, a correct option, a score, a family or variant identifier, a seed, or a hidden check. Limits such as `multiple`, `max_selections`, and `max_length` belong to the format or the task family and never reveal the key.')
|
||||
}).describe('Code practice. The candidate submits one final solution, which runs in the isolated sandbox against three groups of hidden checks. The content lists only the statement, the allowed languages, and public examples; hidden checks, their inputs, and seeds never reach the client.'),zod.object({
|
||||
"format": zod.enum(['lab']),
|
||||
"nodes": zod.array(zod.object({
|
||||
"name": zod.string().min(1).max(assessmentAttemptTwoOneCurrentItemOneContentEightNodesItemNameMax).regex(assessmentAttemptTwoOneCurrentItemOneContentEightNodesItemNameRegExp).describe('Name of a lab node as the task statement uses it, such as `r1` or `srv`. It is a label of the task, not a host name or an address.'),
|
||||
"kind": zod.enum(['mikrotik', 'ubuntu']).describe('What the console of a node shows.\n\n- mikrotik: a MikroTik router with the RouterOS console.\n- ubuntu: a small Ubuntu server with a Linux login.\n\nAdding a value is a contract change.')
|
||||
}).describe('A node of a lab by its task name and kind. It never carries an address, a MAC address, a port, a password, a key, or an infrastructure name.')).min(1).max(assessmentAttemptTwoOneCurrentItemOneContentEightNodesMax).describe('Nodes of the lab in the order of the statement.'),
|
||||
"time_limit_seconds": zod.int().min(assessmentAttemptTwoOneCurrentItemOneContentEightTimeLimitSecondsMin).max(assessmentAttemptTwoOneCurrentItemOneContentEightTimeLimitSecondsMax).describe('Lifetime of a lab of this item from its creation. The lab also ends no later than the attempt deadline.')
|
||||
}).describe('Practical lab: configure or repair a small network of virtual nodes through their consoles. The candidate starts the lab of the item with CreateMyAssessmentLab, works in the node consoles, and submits with SubmitMyAssessmentLab; the server then checks the state of the nodes. The content lists only the nodes the statement names and the lifetime of the lab, never the checker, its criteria, the seed, or an address. SubmitMyAssessmentAnswer takes no answer to a lab item; its result is submitted only with SubmitMyAssessmentLab.')]).describe('Format-specific part of an item, selected by `format`. It holds only what the candidate needs to answer: never an answer key, a correct option, a score, a family or variant identifier, a seed, or a hidden check. Limits such as `multiple`, `max_selections`, and `max_length` belong to the format or the task family and never reveal the key.')
|
||||
}).describe('Item instance served to the candidate. The variant is fixed when it is first served: a reload, a retried request, or a resumed session returns the same instance with the same text and option order. The item never says whether an earlier answer was correct, and seed items, which are not scored, are indistinguishable from scored ones.'),zod.null()]).describe('Item to answer now: a test item in `in_progress`, the practice item to submit in `practice_pending` or `additional_practice_pending` while that practice is `not_started` or `failed`, and null otherwise.'),
|
||||
"practices": zod.array(zod.object({
|
||||
"kind": zod.enum(['main', 'additional']).describe('Role of a practice in the attempt.\n\n- main: the practice that every attempt with practice requires before a decision.\n- additional: adaptive only; offered by finalize when the probability of reaching the grade is in the band below confirmation. It continues the same attempt and spends no new attempt.\n\nAdding a value is a contract change.'),
|
||||
@@ -569,7 +610,14 @@ export const AssessmentAttempt = zod.union([zod.object({
|
||||
"expected_output": zod.string().max(assessmentAttemptThreeOneCurrentItemOneContentSevenPublicExamplesItemExpectedOutputMax)
|
||||
}).describe('Public example of the practice task: an input and its expected output. Hidden checks are never listed.')).max(assessmentAttemptThreeOneCurrentItemOneContentSevenPublicExamplesMax),
|
||||
"max_source_length": zod.int().min(1).max(assessmentAttemptThreeOneCurrentItemOneContentSevenMaxSourceLengthMax).describe('Maximum length of the solution source in characters.')
|
||||
}).describe('Code practice. The candidate submits one final solution, which runs in the isolated sandbox against three groups of hidden checks. The content lists only the statement, the allowed languages, and public examples; hidden checks, their inputs, and seeds never reach the client.')]).describe('Format-specific part of an item, selected by `format`. It holds only what the candidate needs to answer: never an answer key, a correct option, a score, a family or variant identifier, a seed, or a hidden check. Limits such as `multiple`, `max_selections`, and `max_length` belong to the format or the task family and never reveal the key.')
|
||||
}).describe('Code practice. The candidate submits one final solution, which runs in the isolated sandbox against three groups of hidden checks. The content lists only the statement, the allowed languages, and public examples; hidden checks, their inputs, and seeds never reach the client.'),zod.object({
|
||||
"format": zod.enum(['lab']),
|
||||
"nodes": zod.array(zod.object({
|
||||
"name": zod.string().min(1).max(assessmentAttemptThreeOneCurrentItemOneContentEightNodesItemNameMax).regex(assessmentAttemptThreeOneCurrentItemOneContentEightNodesItemNameRegExp).describe('Name of a lab node as the task statement uses it, such as `r1` or `srv`. It is a label of the task, not a host name or an address.'),
|
||||
"kind": zod.enum(['mikrotik', 'ubuntu']).describe('What the console of a node shows.\n\n- mikrotik: a MikroTik router with the RouterOS console.\n- ubuntu: a small Ubuntu server with a Linux login.\n\nAdding a value is a contract change.')
|
||||
}).describe('A node of a lab by its task name and kind. It never carries an address, a MAC address, a port, a password, a key, or an infrastructure name.')).min(1).max(assessmentAttemptThreeOneCurrentItemOneContentEightNodesMax).describe('Nodes of the lab in the order of the statement.'),
|
||||
"time_limit_seconds": zod.int().min(assessmentAttemptThreeOneCurrentItemOneContentEightTimeLimitSecondsMin).max(assessmentAttemptThreeOneCurrentItemOneContentEightTimeLimitSecondsMax).describe('Lifetime of a lab of this item from its creation. The lab also ends no later than the attempt deadline.')
|
||||
}).describe('Practical lab: configure or repair a small network of virtual nodes through their consoles. The candidate starts the lab of the item with CreateMyAssessmentLab, works in the node consoles, and submits with SubmitMyAssessmentLab; the server then checks the state of the nodes. The content lists only the nodes the statement names and the lifetime of the lab, never the checker, its criteria, the seed, or an address. SubmitMyAssessmentAnswer takes no answer to a lab item; its result is submitted only with SubmitMyAssessmentLab.')]).describe('Format-specific part of an item, selected by `format`. It holds only what the candidate needs to answer: never an answer key, a correct option, a score, a family or variant identifier, a seed, or a hidden check. Limits such as `multiple`, `max_selections`, and `max_length` belong to the format or the task family and never reveal the key.')
|
||||
}).describe('Item instance served to the candidate. The variant is fixed when it is first served: a reload, a retried request, or a resumed session returns the same instance with the same text and option order. The item never says whether an earlier answer was correct, and seed items, which are not scored, are indistinguishable from scored ones.'),zod.null()]).describe('Item to answer now: a test item in `in_progress`, the practice item to submit in `practice_pending` or `additional_practice_pending` while that practice is `not_started` or `failed`, and null otherwise.'),
|
||||
"practices": zod.array(zod.object({
|
||||
"kind": zod.enum(['main', 'additional']).describe('Role of a practice in the attempt.\n\n- main: the practice that every attempt with practice requires before a decision.\n- additional: adaptive only; offered by finalize when the probability of reaching the grade is in the band below confirmation. It continues the same attempt and spends no new attempt.\n\nAdding a value is a contract change.'),
|
||||
|
||||
@@ -84,6 +84,15 @@ export const assessmentAttemptCommonCurrentItemOneContentSevenPublicExamplesMax
|
||||
|
||||
export const assessmentAttemptCommonCurrentItemOneContentSevenMaxSourceLengthMax = 65536;
|
||||
|
||||
export const assessmentAttemptCommonCurrentItemOneContentEightNodesItemNameMax = 15;
|
||||
|
||||
|
||||
export const assessmentAttemptCommonCurrentItemOneContentEightNodesItemNameRegExp = new RegExp('^[a-z][a-z0-9-]{0,14}$');
|
||||
export const assessmentAttemptCommonCurrentItemOneContentEightNodesMax = 8;
|
||||
|
||||
export const assessmentAttemptCommonCurrentItemOneContentEightTimeLimitSecondsMin = 300;
|
||||
export const assessmentAttemptCommonCurrentItemOneContentEightTimeLimitSecondsMax = 14400;
|
||||
|
||||
export const assessmentAttemptCommonPracticesItemVerdictOneScoreMin = 0;
|
||||
export const assessmentAttemptCommonPracticesItemVerdictOneScoreMax = 3;
|
||||
|
||||
@@ -175,7 +184,14 @@ export const AssessmentAttemptCommon = zod.object({
|
||||
"expected_output": zod.string().max(assessmentAttemptCommonCurrentItemOneContentSevenPublicExamplesItemExpectedOutputMax)
|
||||
}).describe('Public example of the practice task: an input and its expected output. Hidden checks are never listed.')).max(assessmentAttemptCommonCurrentItemOneContentSevenPublicExamplesMax),
|
||||
"max_source_length": zod.int().min(1).max(assessmentAttemptCommonCurrentItemOneContentSevenMaxSourceLengthMax).describe('Maximum length of the solution source in characters.')
|
||||
}).describe('Code practice. The candidate submits one final solution, which runs in the isolated sandbox against three groups of hidden checks. The content lists only the statement, the allowed languages, and public examples; hidden checks, their inputs, and seeds never reach the client.')]).describe('Format-specific part of an item, selected by `format`. It holds only what the candidate needs to answer: never an answer key, a correct option, a score, a family or variant identifier, a seed, or a hidden check. Limits such as `multiple`, `max_selections`, and `max_length` belong to the format or the task family and never reveal the key.')
|
||||
}).describe('Code practice. The candidate submits one final solution, which runs in the isolated sandbox against three groups of hidden checks. The content lists only the statement, the allowed languages, and public examples; hidden checks, their inputs, and seeds never reach the client.'),zod.object({
|
||||
"format": zod.enum(['lab']),
|
||||
"nodes": zod.array(zod.object({
|
||||
"name": zod.string().min(1).max(assessmentAttemptCommonCurrentItemOneContentEightNodesItemNameMax).regex(assessmentAttemptCommonCurrentItemOneContentEightNodesItemNameRegExp).describe('Name of a lab node as the task statement uses it, such as `r1` or `srv`. It is a label of the task, not a host name or an address.'),
|
||||
"kind": zod.enum(['mikrotik', 'ubuntu']).describe('What the console of a node shows.\n\n- mikrotik: a MikroTik router with the RouterOS console.\n- ubuntu: a small Ubuntu server with a Linux login.\n\nAdding a value is a contract change.')
|
||||
}).describe('A node of a lab by its task name and kind. It never carries an address, a MAC address, a port, a password, a key, or an infrastructure name.')).min(1).max(assessmentAttemptCommonCurrentItemOneContentEightNodesMax).describe('Nodes of the lab in the order of the statement.'),
|
||||
"time_limit_seconds": zod.int().min(assessmentAttemptCommonCurrentItemOneContentEightTimeLimitSecondsMin).max(assessmentAttemptCommonCurrentItemOneContentEightTimeLimitSecondsMax).describe('Lifetime of a lab of this item from its creation. The lab also ends no later than the attempt deadline.')
|
||||
}).describe('Practical lab: configure or repair a small network of virtual nodes through their consoles. The candidate starts the lab of the item with CreateMyAssessmentLab, works in the node consoles, and submits with SubmitMyAssessmentLab; the server then checks the state of the nodes. The content lists only the nodes the statement names and the lifetime of the lab, never the checker, its criteria, the seed, or an address. SubmitMyAssessmentAnswer takes no answer to a lab item; its result is submitted only with SubmitMyAssessmentLab.')]).describe('Format-specific part of an item, selected by `format`. It holds only what the candidate needs to answer: never an answer key, a correct option, a score, a family or variant identifier, a seed, or a hidden check. Limits such as `multiple`, `max_selections`, and `max_length` belong to the format or the task family and never reveal the key.')
|
||||
}).describe('Item instance served to the candidate. The variant is fixed when it is first served: a reload, a retried request, or a resumed session returns the same instance with the same text and option order. The item never says whether an earlier answer was correct, and seed items, which are not scored, are indistinguishable from scored ones.'),zod.null()]).describe('Item to answer now: a test item in `in_progress`, the practice item to submit in `practice_pending` or `additional_practice_pending` while that practice is `not_started` or `failed`, and null otherwise.'),
|
||||
"practices": zod.array(zod.object({
|
||||
"kind": zod.enum(['main', 'additional']).describe('Role of a practice in the attempt.\n\n- main: the practice that every attempt with practice requires before a decision.\n- additional: adaptive only; offered by finalize when the probability of reaching the grade is in the band below confirmation. It continues the same attempt and spends no new attempt.\n\nAdding a value is a contract change.'),
|
||||
|
||||
@@ -84,6 +84,15 @@ export const assessmentCorrectiveAttemptOneCurrentItemOneContentSevenPublicExamp
|
||||
|
||||
export const assessmentCorrectiveAttemptOneCurrentItemOneContentSevenMaxSourceLengthMax = 65536;
|
||||
|
||||
export const assessmentCorrectiveAttemptOneCurrentItemOneContentEightNodesItemNameMax = 15;
|
||||
|
||||
|
||||
export const assessmentCorrectiveAttemptOneCurrentItemOneContentEightNodesItemNameRegExp = new RegExp('^[a-z][a-z0-9-]{0,14}$');
|
||||
export const assessmentCorrectiveAttemptOneCurrentItemOneContentEightNodesMax = 8;
|
||||
|
||||
export const assessmentCorrectiveAttemptOneCurrentItemOneContentEightTimeLimitSecondsMin = 300;
|
||||
export const assessmentCorrectiveAttemptOneCurrentItemOneContentEightTimeLimitSecondsMax = 14400;
|
||||
|
||||
export const assessmentCorrectiveAttemptOnePracticesItemVerdictOneScoreMin = 0;
|
||||
export const assessmentCorrectiveAttemptOnePracticesItemVerdictOneScoreMax = 3;
|
||||
|
||||
@@ -175,7 +184,14 @@ export const AssessmentCorrectiveAttempt = zod.object({
|
||||
"expected_output": zod.string().max(assessmentCorrectiveAttemptOneCurrentItemOneContentSevenPublicExamplesItemExpectedOutputMax)
|
||||
}).describe('Public example of the practice task: an input and its expected output. Hidden checks are never listed.')).max(assessmentCorrectiveAttemptOneCurrentItemOneContentSevenPublicExamplesMax),
|
||||
"max_source_length": zod.int().min(1).max(assessmentCorrectiveAttemptOneCurrentItemOneContentSevenMaxSourceLengthMax).describe('Maximum length of the solution source in characters.')
|
||||
}).describe('Code practice. The candidate submits one final solution, which runs in the isolated sandbox against three groups of hidden checks. The content lists only the statement, the allowed languages, and public examples; hidden checks, their inputs, and seeds never reach the client.')]).describe('Format-specific part of an item, selected by `format`. It holds only what the candidate needs to answer: never an answer key, a correct option, a score, a family or variant identifier, a seed, or a hidden check. Limits such as `multiple`, `max_selections`, and `max_length` belong to the format or the task family and never reveal the key.')
|
||||
}).describe('Code practice. The candidate submits one final solution, which runs in the isolated sandbox against three groups of hidden checks. The content lists only the statement, the allowed languages, and public examples; hidden checks, their inputs, and seeds never reach the client.'),zod.object({
|
||||
"format": zod.enum(['lab']),
|
||||
"nodes": zod.array(zod.object({
|
||||
"name": zod.string().min(1).max(assessmentCorrectiveAttemptOneCurrentItemOneContentEightNodesItemNameMax).regex(assessmentCorrectiveAttemptOneCurrentItemOneContentEightNodesItemNameRegExp).describe('Name of a lab node as the task statement uses it, such as `r1` or `srv`. It is a label of the task, not a host name or an address.'),
|
||||
"kind": zod.enum(['mikrotik', 'ubuntu']).describe('What the console of a node shows.\n\n- mikrotik: a MikroTik router with the RouterOS console.\n- ubuntu: a small Ubuntu server with a Linux login.\n\nAdding a value is a contract change.')
|
||||
}).describe('A node of a lab by its task name and kind. It never carries an address, a MAC address, a port, a password, a key, or an infrastructure name.')).min(1).max(assessmentCorrectiveAttemptOneCurrentItemOneContentEightNodesMax).describe('Nodes of the lab in the order of the statement.'),
|
||||
"time_limit_seconds": zod.int().min(assessmentCorrectiveAttemptOneCurrentItemOneContentEightTimeLimitSecondsMin).max(assessmentCorrectiveAttemptOneCurrentItemOneContentEightTimeLimitSecondsMax).describe('Lifetime of a lab of this item from its creation. The lab also ends no later than the attempt deadline.')
|
||||
}).describe('Practical lab: configure or repair a small network of virtual nodes through their consoles. The candidate starts the lab of the item with CreateMyAssessmentLab, works in the node consoles, and submits with SubmitMyAssessmentLab; the server then checks the state of the nodes. The content lists only the nodes the statement names and the lifetime of the lab, never the checker, its criteria, the seed, or an address. SubmitMyAssessmentAnswer takes no answer to a lab item; its result is submitted only with SubmitMyAssessmentLab.')]).describe('Format-specific part of an item, selected by `format`. It holds only what the candidate needs to answer: never an answer key, a correct option, a score, a family or variant identifier, a seed, or a hidden check. Limits such as `multiple`, `max_selections`, and `max_length` belong to the format or the task family and never reveal the key.')
|
||||
}).describe('Item instance served to the candidate. The variant is fixed when it is first served: a reload, a retried request, or a resumed session returns the same instance with the same text and option order. The item never says whether an earlier answer was correct, and seed items, which are not scored, are indistinguishable from scored ones.'),zod.null()]).describe('Item to answer now: a test item in `in_progress`, the practice item to submit in `practice_pending` or `additional_practice_pending` while that practice is `not_started` or `failed`, and null otherwise.'),
|
||||
"practices": zod.array(zod.object({
|
||||
"kind": zod.enum(['main', 'additional']).describe('Role of a practice in the attempt.\n\n- main: the practice that every attempt with practice requires before a decision.\n- additional: adaptive only; offered by finalize when the probability of reaching the grade is in the band below confirmation. It continues the same attempt and spends no new attempt.\n\nAdding a value is a contract change.'),
|
||||
|
||||
@@ -84,6 +84,15 @@ export const assessmentExpressAttemptOneCurrentItemOneContentSevenPublicExamples
|
||||
|
||||
export const assessmentExpressAttemptOneCurrentItemOneContentSevenMaxSourceLengthMax = 65536;
|
||||
|
||||
export const assessmentExpressAttemptOneCurrentItemOneContentEightNodesItemNameMax = 15;
|
||||
|
||||
|
||||
export const assessmentExpressAttemptOneCurrentItemOneContentEightNodesItemNameRegExp = new RegExp('^[a-z][a-z0-9-]{0,14}$');
|
||||
export const assessmentExpressAttemptOneCurrentItemOneContentEightNodesMax = 8;
|
||||
|
||||
export const assessmentExpressAttemptOneCurrentItemOneContentEightTimeLimitSecondsMin = 300;
|
||||
export const assessmentExpressAttemptOneCurrentItemOneContentEightTimeLimitSecondsMax = 14400;
|
||||
|
||||
export const assessmentExpressAttemptOnePracticesItemVerdictOneScoreMin = 0;
|
||||
export const assessmentExpressAttemptOnePracticesItemVerdictOneScoreMax = 3;
|
||||
|
||||
@@ -175,7 +184,14 @@ export const AssessmentExpressAttempt = zod.object({
|
||||
"expected_output": zod.string().max(assessmentExpressAttemptOneCurrentItemOneContentSevenPublicExamplesItemExpectedOutputMax)
|
||||
}).describe('Public example of the practice task: an input and its expected output. Hidden checks are never listed.')).max(assessmentExpressAttemptOneCurrentItemOneContentSevenPublicExamplesMax),
|
||||
"max_source_length": zod.int().min(1).max(assessmentExpressAttemptOneCurrentItemOneContentSevenMaxSourceLengthMax).describe('Maximum length of the solution source in characters.')
|
||||
}).describe('Code practice. The candidate submits one final solution, which runs in the isolated sandbox against three groups of hidden checks. The content lists only the statement, the allowed languages, and public examples; hidden checks, their inputs, and seeds never reach the client.')]).describe('Format-specific part of an item, selected by `format`. It holds only what the candidate needs to answer: never an answer key, a correct option, a score, a family or variant identifier, a seed, or a hidden check. Limits such as `multiple`, `max_selections`, and `max_length` belong to the format or the task family and never reveal the key.')
|
||||
}).describe('Code practice. The candidate submits one final solution, which runs in the isolated sandbox against three groups of hidden checks. The content lists only the statement, the allowed languages, and public examples; hidden checks, their inputs, and seeds never reach the client.'),zod.object({
|
||||
"format": zod.enum(['lab']),
|
||||
"nodes": zod.array(zod.object({
|
||||
"name": zod.string().min(1).max(assessmentExpressAttemptOneCurrentItemOneContentEightNodesItemNameMax).regex(assessmentExpressAttemptOneCurrentItemOneContentEightNodesItemNameRegExp).describe('Name of a lab node as the task statement uses it, such as `r1` or `srv`. It is a label of the task, not a host name or an address.'),
|
||||
"kind": zod.enum(['mikrotik', 'ubuntu']).describe('What the console of a node shows.\n\n- mikrotik: a MikroTik router with the RouterOS console.\n- ubuntu: a small Ubuntu server with a Linux login.\n\nAdding a value is a contract change.')
|
||||
}).describe('A node of a lab by its task name and kind. It never carries an address, a MAC address, a port, a password, a key, or an infrastructure name.')).min(1).max(assessmentExpressAttemptOneCurrentItemOneContentEightNodesMax).describe('Nodes of the lab in the order of the statement.'),
|
||||
"time_limit_seconds": zod.int().min(assessmentExpressAttemptOneCurrentItemOneContentEightTimeLimitSecondsMin).max(assessmentExpressAttemptOneCurrentItemOneContentEightTimeLimitSecondsMax).describe('Lifetime of a lab of this item from its creation. The lab also ends no later than the attempt deadline.')
|
||||
}).describe('Practical lab: configure or repair a small network of virtual nodes through their consoles. The candidate starts the lab of the item with CreateMyAssessmentLab, works in the node consoles, and submits with SubmitMyAssessmentLab; the server then checks the state of the nodes. The content lists only the nodes the statement names and the lifetime of the lab, never the checker, its criteria, the seed, or an address. SubmitMyAssessmentAnswer takes no answer to a lab item; its result is submitted only with SubmitMyAssessmentLab.')]).describe('Format-specific part of an item, selected by `format`. It holds only what the candidate needs to answer: never an answer key, a correct option, a score, a family or variant identifier, a seed, or a hidden check. Limits such as `multiple`, `max_selections`, and `max_length` belong to the format or the task family and never reveal the key.')
|
||||
}).describe('Item instance served to the candidate. The variant is fixed when it is first served: a reload, a retried request, or a resumed session returns the same instance with the same text and option order. The item never says whether an earlier answer was correct, and seed items, which are not scored, are indistinguishable from scored ones.'),zod.null()]).describe('Item to answer now: a test item in `in_progress`, the practice item to submit in `practice_pending` or `additional_practice_pending` while that practice is `not_started` or `failed`, and null otherwise.'),
|
||||
"practices": zod.array(zod.object({
|
||||
"kind": zod.enum(['main', 'additional']).describe('Role of a practice in the attempt.\n\n- main: the practice that every attempt with practice requires before a decision.\n- additional: adaptive only; offered by finalize when the probability of reaching the grade is in the band below confirmation. It continues the same attempt and spends no new attempt.\n\nAdding a value is a contract change.'),
|
||||
|
||||
@@ -62,6 +62,15 @@ export const assessmentItemContentSevenPublicExamplesMax = 10;
|
||||
|
||||
export const assessmentItemContentSevenMaxSourceLengthMax = 65536;
|
||||
|
||||
export const assessmentItemContentEightNodesItemNameMax = 15;
|
||||
|
||||
|
||||
export const assessmentItemContentEightNodesItemNameRegExp = new RegExp('^[a-z][a-z0-9-]{0,14}$');
|
||||
export const assessmentItemContentEightNodesMax = 8;
|
||||
|
||||
export const assessmentItemContentEightTimeLimitSecondsMin = 300;
|
||||
export const assessmentItemContentEightTimeLimitSecondsMax = 14400;
|
||||
|
||||
|
||||
export const AssessmentItem = zod.object({
|
||||
"id": zod.uuid().describe('Identifier of an item instance in one attempt. It identifies the fixed variant served to this candidate and reveals neither the task family, its version, nor the variant seed.'),
|
||||
@@ -107,7 +116,14 @@ export const AssessmentItem = zod.object({
|
||||
"expected_output": zod.string().max(assessmentItemContentSevenPublicExamplesItemExpectedOutputMax)
|
||||
}).describe('Public example of the practice task: an input and its expected output. Hidden checks are never listed.')).max(assessmentItemContentSevenPublicExamplesMax),
|
||||
"max_source_length": zod.int().min(1).max(assessmentItemContentSevenMaxSourceLengthMax).describe('Maximum length of the solution source in characters.')
|
||||
}).describe('Code practice. The candidate submits one final solution, which runs in the isolated sandbox against three groups of hidden checks. The content lists only the statement, the allowed languages, and public examples; hidden checks, their inputs, and seeds never reach the client.')]).describe('Format-specific part of an item, selected by `format`. It holds only what the candidate needs to answer: never an answer key, a correct option, a score, a family or variant identifier, a seed, or a hidden check. Limits such as `multiple`, `max_selections`, and `max_length` belong to the format or the task family and never reveal the key.')
|
||||
}).describe('Code practice. The candidate submits one final solution, which runs in the isolated sandbox against three groups of hidden checks. The content lists only the statement, the allowed languages, and public examples; hidden checks, their inputs, and seeds never reach the client.'),zod.object({
|
||||
"format": zod.enum(['lab']),
|
||||
"nodes": zod.array(zod.object({
|
||||
"name": zod.string().min(1).max(assessmentItemContentEightNodesItemNameMax).regex(assessmentItemContentEightNodesItemNameRegExp).describe('Name of a lab node as the task statement uses it, such as `r1` or `srv`. It is a label of the task, not a host name or an address.'),
|
||||
"kind": zod.enum(['mikrotik', 'ubuntu']).describe('What the console of a node shows.\n\n- mikrotik: a MikroTik router with the RouterOS console.\n- ubuntu: a small Ubuntu server with a Linux login.\n\nAdding a value is a contract change.')
|
||||
}).describe('A node of a lab by its task name and kind. It never carries an address, a MAC address, a port, a password, a key, or an infrastructure name.')).min(1).max(assessmentItemContentEightNodesMax).describe('Nodes of the lab in the order of the statement.'),
|
||||
"time_limit_seconds": zod.int().min(assessmentItemContentEightTimeLimitSecondsMin).max(assessmentItemContentEightTimeLimitSecondsMax).describe('Lifetime of a lab of this item from its creation. The lab also ends no later than the attempt deadline.')
|
||||
}).describe('Practical lab: configure or repair a small network of virtual nodes through their consoles. The candidate starts the lab of the item with CreateMyAssessmentLab, works in the node consoles, and submits with SubmitMyAssessmentLab; the server then checks the state of the nodes. The content lists only the nodes the statement names and the lifetime of the lab, never the checker, its criteria, the seed, or an address. SubmitMyAssessmentAnswer takes no answer to a lab item; its result is submitted only with SubmitMyAssessmentLab.')]).describe('Format-specific part of an item, selected by `format`. It holds only what the candidate needs to answer: never an answer key, a correct option, a score, a family or variant identifier, a seed, or a hidden check. Limits such as `multiple`, `max_selections`, and `max_length` belong to the format or the task family and never reveal the key.')
|
||||
}).describe('Item instance served to the candidate. The variant is fixed when it is first served: a reload, a retried request, or a resumed session returns the same instance with the same text and option order. The item never says whether an earlier answer was correct, and seed items, which are not scored, are indistinguishable from scored ones.')
|
||||
|
||||
export type AssessmentItem = zod.input<typeof AssessmentItem>;
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
/**
|
||||
* Generated by orval 🍺
|
||||
* Do not edit manually.
|
||||
* Lincodex API
|
||||
* OpenAPI spec version: 0.1.0
|
||||
*/
|
||||
import * as zod from 'zod';
|
||||
|
||||
export const assessmentLabNodesItemNameMax = 15;
|
||||
|
||||
|
||||
export const assessmentLabNodesItemNameRegExp = new RegExp('^[a-z][a-z0-9-]{0,14}$');
|
||||
export const assessmentLabNodesMax = 8;
|
||||
|
||||
|
||||
export const AssessmentLab = zod.object({
|
||||
"id": zod.uuid().describe('Identifier of the lab.'),
|
||||
"item_id": zod.uuid().describe('Identifier of an item instance in one attempt. It identifies the fixed variant served to this candidate and reveals neither the task family, its version, nor the variant seed.'),
|
||||
"state": zod.enum(['provisioning', 'ready', 'checking', 'submitted', 'expired', 'failed']).describe('State of a lab of an attempt item.\n\n- provisioning: the nodes are being prepared; poll GetMyAssessmentLab.\n- ready: the consoles can be opened until `expires_at`.\n- checking: the answer was accepted; the consoles are closed and the server checks the nodes.\n- submitted: the check finished and the answer is recorded; the lab is deleted. The state never says whether the answer was correct.\n- expired: the lifetime or the attempt deadline ended before a submission; the lab is deleted and the item cannot start another lab.\n- failed: the lab infrastructure failed, independently of the candidate; `failure_reason` is `lab_error`. Nothing was recorded or consumed, and the candidate may start a new lab of the same item while the item is current.\n\nAdding a value is a contract change.'),
|
||||
"nodes": zod.array(zod.object({
|
||||
"name": zod.string().min(1).max(assessmentLabNodesItemNameMax).regex(assessmentLabNodesItemNameRegExp).describe('Name of a lab node as the task statement uses it, such as `r1` or `srv`. It is a label of the task, not a host name or an address.'),
|
||||
"kind": zod.enum(['mikrotik', 'ubuntu']).describe('What the console of a node shows.\n\n- mikrotik: a MikroTik router with the RouterOS console.\n- ubuntu: a small Ubuntu server with a Linux login.\n\nAdding a value is a contract change.')
|
||||
}).describe('A node of a lab by its task name and kind. It never carries an address, a MAC address, a port, a password, a key, or an infrastructure name.')).min(1).max(assessmentLabNodesMax),
|
||||
"created_at": zod.iso.datetime({"offset":true}).describe('UTC instant in RFC 3339 format with the Z suffix, for example 2026-10-05T09:30:00Z. Servers always emit UTC. Every date-time field in this contract uses this schema.'),
|
||||
"ready_at": zod.union([zod.iso.datetime({"offset":true}).describe('UTC instant in RFC 3339 format with the Z suffix, for example 2026-10-05T09:30:00Z. Servers always emit UTC. Every date-time field in this contract uses this schema.'),zod.null()]).describe('Time the lab became `ready`, or null before.'),
|
||||
"expires_at": zod.iso.datetime({"offset":true}).describe('Time the lab ends unless it was submitted before: the earlier of the lifetime of the item and the attempt deadline. It never moves.'),
|
||||
"finished_at": zod.union([zod.iso.datetime({"offset":true}).describe('UTC instant in RFC 3339 format with the Z suffix, for example 2026-10-05T09:30:00Z. Servers always emit UTC. Every date-time field in this contract uses this schema.'),zod.null()]).describe('Time the lab reached `submitted`, `expired`, or `failed`, or null.'),
|
||||
"failure_reason": zod.union([zod.enum(['lab_error']).describe('Why a lab failed: `lab_error` for an infrastructure failure, such as a node that did not boot or a check that could not reach a node. It never depends on the candidate and is never a failed check.'),zod.null()]).describe('`lab_error` when `state` is `failed`, otherwise null.')
|
||||
}).describe('Candidate view of the lab of one attempt item. It contains no node address, MAC address, port, password, key, token, seed, checker state, criteria, score, or infrastructure name.')
|
||||
|
||||
export type AssessmentLab = zod.input<typeof AssessmentLab>;
|
||||
export type AssessmentLabOutput = zod.output<typeof AssessmentLab>;
|
||||
@@ -0,0 +1,26 @@
|
||||
/**
|
||||
* Generated by orval 🍺
|
||||
* Do not edit manually.
|
||||
* Lincodex API
|
||||
* OpenAPI spec version: 0.1.0
|
||||
*/
|
||||
import * as zod from 'zod';
|
||||
|
||||
export const assessmentLabConsoleSessionNodeMax = 15;
|
||||
|
||||
|
||||
export const assessmentLabConsoleSessionNodeRegExp = new RegExp('^[a-z][a-z0-9-]{0,14}$');
|
||||
export const assessmentLabConsoleSessionWebsocketPathMax = 128;
|
||||
|
||||
|
||||
export const assessmentLabConsoleSessionWebsocketPathRegExp = new RegExp('^/api/v1/me/assessment-lab-consoles/[0-9a-f-]{36}$');
|
||||
|
||||
export const AssessmentLabConsoleSession = zod.object({
|
||||
"id": zod.uuid().describe('Identifier of the console session; it is not a secret.'),
|
||||
"node": zod.string().min(1).max(assessmentLabConsoleSessionNodeMax).regex(assessmentLabConsoleSessionNodeRegExp).describe('Name of a lab node as the task statement uses it, such as `r1` or `srv`. It is a label of the task, not a host name or an address.'),
|
||||
"websocket_path": zod.string().max(assessmentLabConsoleSessionWebsocketPathMax).regex(assessmentLabConsoleSessionWebsocketPathRegExp).describe('Same-origin path of the console WebSocket.'),
|
||||
"expires_at": zod.iso.datetime({"offset":true}).describe('Time by which the WebSocket must be opened.')
|
||||
}).describe('A console session of one node. The client opens a WebSocket to `websocket_path` on the same origin before `expires_at`; the session cookie and the Origin check authorize the upgrade, so no secret travels in the path, the body, or a query string. A session can be attached once and ends with the lab.')
|
||||
|
||||
export type AssessmentLabConsoleSession = zod.input<typeof AssessmentLabConsoleSession>;
|
||||
export type AssessmentLabConsoleSessionOutput = zod.output<typeof AssessmentLabConsoleSession>;
|
||||
@@ -0,0 +1,19 @@
|
||||
/**
|
||||
* Generated by orval 🍺
|
||||
* Do not edit manually.
|
||||
* Lincodex API
|
||||
* OpenAPI spec version: 0.1.0
|
||||
*/
|
||||
import * as zod from 'zod';
|
||||
|
||||
export const assessmentLabConsoleSessionCreateNodeMax = 15;
|
||||
|
||||
|
||||
export const assessmentLabConsoleSessionCreateNodeRegExp = new RegExp('^[a-z][a-z0-9-]{0,14}$');
|
||||
|
||||
export const AssessmentLabConsoleSessionCreate = zod.object({
|
||||
"node": zod.string().min(1).max(assessmentLabConsoleSessionCreateNodeMax).regex(assessmentLabConsoleSessionCreateNodeRegExp).describe('Name of a lab node as the task statement uses it, such as `r1` or `srv`. It is a label of the task, not a host name or an address.')
|
||||
}).describe('Open a console of one node of a ready lab. Unknown fields are rejected.')
|
||||
|
||||
export type AssessmentLabConsoleSessionCreate = zod.input<typeof AssessmentLabConsoleSessionCreate>;
|
||||
export type AssessmentLabConsoleSessionCreateOutput = zod.output<typeof AssessmentLabConsoleSessionCreate>;
|
||||
@@ -0,0 +1,14 @@
|
||||
/**
|
||||
* Generated by orval 🍺
|
||||
* Do not edit manually.
|
||||
* Lincodex API
|
||||
* OpenAPI spec version: 0.1.0
|
||||
*/
|
||||
import * as zod from 'zod';
|
||||
|
||||
export const AssessmentLabCreate = zod.object({
|
||||
"item_id": zod.uuid().describe('Identifier of an item instance in one attempt. It identifies the fixed variant served to this candidate and reveals neither the task family, its version, nor the variant seed.')
|
||||
}).describe('Start the lab of the current lab item. Unknown fields are rejected.')
|
||||
|
||||
export type AssessmentLabCreate = zod.input<typeof AssessmentLabCreate>;
|
||||
export type AssessmentLabCreateOutput = zod.output<typeof AssessmentLabCreate>;
|
||||
@@ -0,0 +1,12 @@
|
||||
/**
|
||||
* Generated by orval 🍺
|
||||
* Do not edit manually.
|
||||
* Lincodex API
|
||||
* OpenAPI spec version: 0.1.0
|
||||
*/
|
||||
import * as zod from 'zod';
|
||||
|
||||
export const AssessmentLabFailureReason = zod.enum(['lab_error']).describe('Why a lab failed: `lab_error` for an infrastructure failure, such as a node that did not boot or a check that could not reach a node. It never depends on the candidate and is never a failed check.')
|
||||
|
||||
export type AssessmentLabFailureReason = zod.input<typeof AssessmentLabFailureReason>;
|
||||
export type AssessmentLabFailureReasonOutput = zod.output<typeof AssessmentLabFailureReason>;
|
||||
@@ -0,0 +1,20 @@
|
||||
/**
|
||||
* Generated by orval 🍺
|
||||
* Do not edit manually.
|
||||
* Lincodex API
|
||||
* OpenAPI spec version: 0.1.0
|
||||
*/
|
||||
import * as zod from 'zod';
|
||||
|
||||
export const assessmentLabNodeNameMax = 15;
|
||||
|
||||
|
||||
export const assessmentLabNodeNameRegExp = new RegExp('^[a-z][a-z0-9-]{0,14}$');
|
||||
|
||||
export const AssessmentLabNode = zod.object({
|
||||
"name": zod.string().min(1).max(assessmentLabNodeNameMax).regex(assessmentLabNodeNameRegExp).describe('Name of a lab node as the task statement uses it, such as `r1` or `srv`. It is a label of the task, not a host name or an address.'),
|
||||
"kind": zod.enum(['mikrotik', 'ubuntu']).describe('What the console of a node shows.\n\n- mikrotik: a MikroTik router with the RouterOS console.\n- ubuntu: a small Ubuntu server with a Linux login.\n\nAdding a value is a contract change.')
|
||||
}).describe('A node of a lab by its task name and kind. It never carries an address, a MAC address, a port, a password, a key, or an infrastructure name.')
|
||||
|
||||
export type AssessmentLabNode = zod.input<typeof AssessmentLabNode>;
|
||||
export type AssessmentLabNodeOutput = zod.output<typeof AssessmentLabNode>;
|
||||
@@ -0,0 +1,12 @@
|
||||
/**
|
||||
* Generated by orval 🍺
|
||||
* Do not edit manually.
|
||||
* Lincodex API
|
||||
* OpenAPI spec version: 0.1.0
|
||||
*/
|
||||
import * as zod from 'zod';
|
||||
|
||||
export const AssessmentLabNodeKind = zod.enum(['mikrotik', 'ubuntu']).describe('What the console of a node shows.\n\n- mikrotik: a MikroTik router with the RouterOS console.\n- ubuntu: a small Ubuntu server with a Linux login.\n\nAdding a value is a contract change.')
|
||||
|
||||
export type AssessmentLabNodeKind = zod.input<typeof AssessmentLabNodeKind>;
|
||||
export type AssessmentLabNodeKindOutput = zod.output<typeof AssessmentLabNodeKind>;
|
||||
@@ -0,0 +1,17 @@
|
||||
/**
|
||||
* Generated by orval 🍺
|
||||
* Do not edit manually.
|
||||
* Lincodex API
|
||||
* OpenAPI spec version: 0.1.0
|
||||
*/
|
||||
import * as zod from 'zod';
|
||||
|
||||
export const AssessmentLabNodeNameMax = 15;
|
||||
|
||||
|
||||
export const AssessmentLabNodeNameRegExp = new RegExp('^[a-z][a-z0-9-]{0,14}$');
|
||||
|
||||
export const AssessmentLabNodeName = zod.string().min(1).max(AssessmentLabNodeNameMax).regex(AssessmentLabNodeNameRegExp).describe('Name of a lab node as the task statement uses it, such as `r1` or `srv`. It is a label of the task, not a host name or an address.')
|
||||
|
||||
export type AssessmentLabNodeName = zod.input<typeof AssessmentLabNodeName>;
|
||||
export type AssessmentLabNodeNameOutput = zod.output<typeof AssessmentLabNodeName>;
|
||||
@@ -0,0 +1,12 @@
|
||||
/**
|
||||
* Generated by orval 🍺
|
||||
* Do not edit manually.
|
||||
* Lincodex API
|
||||
* OpenAPI spec version: 0.1.0
|
||||
*/
|
||||
import * as zod from 'zod';
|
||||
|
||||
export const AssessmentLabState = zod.enum(['provisioning', 'ready', 'checking', 'submitted', 'expired', 'failed']).describe('State of a lab of an attempt item.\n\n- provisioning: the nodes are being prepared; poll GetMyAssessmentLab.\n- ready: the consoles can be opened until `expires_at`.\n- checking: the answer was accepted; the consoles are closed and the server checks the nodes.\n- submitted: the check finished and the answer is recorded; the lab is deleted. The state never says whether the answer was correct.\n- expired: the lifetime or the attempt deadline ended before a submission; the lab is deleted and the item cannot start another lab.\n- failed: the lab infrastructure failed, independently of the candidate; `failure_reason` is `lab_error`. Nothing was recorded or consumed, and the candidate may start a new lab of the same item while the item is current.\n\nAdding a value is a contract change.')
|
||||
|
||||
export type AssessmentLabState = zod.input<typeof AssessmentLabState>;
|
||||
export type AssessmentLabStateOutput = zod.output<typeof AssessmentLabState>;
|
||||
@@ -0,0 +1,20 @@
|
||||
/**
|
||||
* Generated by orval 🍺
|
||||
* Do not edit manually.
|
||||
* Lincodex API
|
||||
* OpenAPI spec version: 0.1.0
|
||||
*/
|
||||
import * as zod from 'zod';
|
||||
|
||||
|
||||
|
||||
export const AssessmentLabSubmission = zod.object({
|
||||
"expected_version": zod.int().min(1).describe('Version of an assessment attempt. A new attempt has version 1, and each committed change advances it by exactly one: an accepted answer, a practice submission or resubmission, a verdict, a decision of finalize, an explicit work-session start, and a server-side transition such as expiry or automatic finalization. Reads never change the attempt. A rejected command and a repeat that stores nothing leave it unchanged. Commands send the version they read as `expected_version`.'),
|
||||
"answer": zod.object({
|
||||
"format": zod.enum(['lab']),
|
||||
"lab_id": zod.uuid().describe('The lab of this item that the candidate worked in.')
|
||||
}).describe('Answer of a lab item: the state of the nodes of the named lab at the moment of submission. The server reads that state with the checker of the task; the body carries no configuration text, score, or correctness flag. Two answers are equal when they name the same lab. It is the answer of SubmitMyAssessmentLab only and is not a member of AssessmentAnswer.')
|
||||
}).describe('Submit the lab of the current lab item as its answer. Unknown fields are rejected, so a request cannot send a score or a correctness flag.')
|
||||
|
||||
export type AssessmentLabSubmission = zod.input<typeof AssessmentLabSubmission>;
|
||||
export type AssessmentLabSubmissionOutput = zod.output<typeof AssessmentLabSubmission>;
|
||||
@@ -84,6 +84,15 @@ export const assessmentQualifiedAttemptOneCurrentItemOneContentSevenPublicExampl
|
||||
|
||||
export const assessmentQualifiedAttemptOneCurrentItemOneContentSevenMaxSourceLengthMax = 65536;
|
||||
|
||||
export const assessmentQualifiedAttemptOneCurrentItemOneContentEightNodesItemNameMax = 15;
|
||||
|
||||
|
||||
export const assessmentQualifiedAttemptOneCurrentItemOneContentEightNodesItemNameRegExp = new RegExp('^[a-z][a-z0-9-]{0,14}$');
|
||||
export const assessmentQualifiedAttemptOneCurrentItemOneContentEightNodesMax = 8;
|
||||
|
||||
export const assessmentQualifiedAttemptOneCurrentItemOneContentEightTimeLimitSecondsMin = 300;
|
||||
export const assessmentQualifiedAttemptOneCurrentItemOneContentEightTimeLimitSecondsMax = 14400;
|
||||
|
||||
export const assessmentQualifiedAttemptOnePracticesItemVerdictOneScoreMin = 0;
|
||||
export const assessmentQualifiedAttemptOnePracticesItemVerdictOneScoreMax = 3;
|
||||
|
||||
@@ -175,7 +184,14 @@ export const AssessmentQualifiedAttempt = zod.object({
|
||||
"expected_output": zod.string().max(assessmentQualifiedAttemptOneCurrentItemOneContentSevenPublicExamplesItemExpectedOutputMax)
|
||||
}).describe('Public example of the practice task: an input and its expected output. Hidden checks are never listed.')).max(assessmentQualifiedAttemptOneCurrentItemOneContentSevenPublicExamplesMax),
|
||||
"max_source_length": zod.int().min(1).max(assessmentQualifiedAttemptOneCurrentItemOneContentSevenMaxSourceLengthMax).describe('Maximum length of the solution source in characters.')
|
||||
}).describe('Code practice. The candidate submits one final solution, which runs in the isolated sandbox against three groups of hidden checks. The content lists only the statement, the allowed languages, and public examples; hidden checks, their inputs, and seeds never reach the client.')]).describe('Format-specific part of an item, selected by `format`. It holds only what the candidate needs to answer: never an answer key, a correct option, a score, a family or variant identifier, a seed, or a hidden check. Limits such as `multiple`, `max_selections`, and `max_length` belong to the format or the task family and never reveal the key.')
|
||||
}).describe('Code practice. The candidate submits one final solution, which runs in the isolated sandbox against three groups of hidden checks. The content lists only the statement, the allowed languages, and public examples; hidden checks, their inputs, and seeds never reach the client.'),zod.object({
|
||||
"format": zod.enum(['lab']),
|
||||
"nodes": zod.array(zod.object({
|
||||
"name": zod.string().min(1).max(assessmentQualifiedAttemptOneCurrentItemOneContentEightNodesItemNameMax).regex(assessmentQualifiedAttemptOneCurrentItemOneContentEightNodesItemNameRegExp).describe('Name of a lab node as the task statement uses it, such as `r1` or `srv`. It is a label of the task, not a host name or an address.'),
|
||||
"kind": zod.enum(['mikrotik', 'ubuntu']).describe('What the console of a node shows.\n\n- mikrotik: a MikroTik router with the RouterOS console.\n- ubuntu: a small Ubuntu server with a Linux login.\n\nAdding a value is a contract change.')
|
||||
}).describe('A node of a lab by its task name and kind. It never carries an address, a MAC address, a port, a password, a key, or an infrastructure name.')).min(1).max(assessmentQualifiedAttemptOneCurrentItemOneContentEightNodesMax).describe('Nodes of the lab in the order of the statement.'),
|
||||
"time_limit_seconds": zod.int().min(assessmentQualifiedAttemptOneCurrentItemOneContentEightTimeLimitSecondsMin).max(assessmentQualifiedAttemptOneCurrentItemOneContentEightTimeLimitSecondsMax).describe('Lifetime of a lab of this item from its creation. The lab also ends no later than the attempt deadline.')
|
||||
}).describe('Practical lab: configure or repair a small network of virtual nodes through their consoles. The candidate starts the lab of the item with CreateMyAssessmentLab, works in the node consoles, and submits with SubmitMyAssessmentLab; the server then checks the state of the nodes. The content lists only the nodes the statement names and the lifetime of the lab, never the checker, its criteria, the seed, or an address. SubmitMyAssessmentAnswer takes no answer to a lab item; its result is submitted only with SubmitMyAssessmentLab.')]).describe('Format-specific part of an item, selected by `format`. It holds only what the candidate needs to answer: never an answer key, a correct option, a score, a family or variant identifier, a seed, or a hidden check. Limits such as `multiple`, `max_selections`, and `max_length` belong to the format or the task family and never reveal the key.')
|
||||
}).describe('Item instance served to the candidate. The variant is fixed when it is first served: a reload, a retried request, or a resumed session returns the same instance with the same text and option order. The item never says whether an earlier answer was correct, and seed items, which are not scored, are indistinguishable from scored ones.'),zod.null()]).describe('Item to answer now: a test item in `in_progress`, the practice item to submit in `practice_pending` or `additional_practice_pending` while that practice is `not_started` or `failed`, and null otherwise.'),
|
||||
"practices": zod.array(zod.object({
|
||||
"kind": zod.enum(['main', 'additional']).describe('Role of a practice in the attempt.\n\n- main: the practice that every attempt with practice requires before a decision.\n- additional: adaptive only; offered by finalize when the probability of reaching the grade is in the band below confirmation. It continues the same attempt and spends no new attempt.\n\nAdding a value is a contract change.'),
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
/**
|
||||
* Generated by orval 🍺
|
||||
* Do not edit manually.
|
||||
* Lincodex API
|
||||
* OpenAPI spec version: 0.1.0
|
||||
*/
|
||||
import * as zod from 'zod';
|
||||
|
||||
export const CreateMyAssessmentLabBody = zod.object({
|
||||
"item_id": zod.uuid().describe('Identifier of an item instance in one attempt. It identifies the fixed variant served to this candidate and reveals neither the task family, its version, nor the variant seed.')
|
||||
}).describe('Start the lab of the current lab item. Unknown fields are rejected.')
|
||||
|
||||
export type CreateMyAssessmentLabBody = zod.input<typeof CreateMyAssessmentLabBody>;
|
||||
export type CreateMyAssessmentLabBodyOutput = zod.output<typeof CreateMyAssessmentLabBody>;
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
/**
|
||||
* Generated by orval 🍺
|
||||
* Do not edit manually.
|
||||
* Lincodex API
|
||||
* OpenAPI spec version: 0.1.0
|
||||
*/
|
||||
import * as zod from 'zod';
|
||||
|
||||
export const createMyAssessmentLabConsoleSessionBodyNodeMax = 15;
|
||||
|
||||
|
||||
export const createMyAssessmentLabConsoleSessionBodyNodeRegExp = new RegExp('^[a-z][a-z0-9-]{0,14}$');
|
||||
|
||||
export const CreateMyAssessmentLabConsoleSessionBody = zod.object({
|
||||
"node": zod.string().min(1).max(createMyAssessmentLabConsoleSessionBodyNodeMax).regex(createMyAssessmentLabConsoleSessionBodyNodeRegExp).describe('Name of a lab node as the task statement uses it, such as `r1` or `srv`. It is a label of the task, not a host name or an address.')
|
||||
}).describe('Open a console of one node of a ready lab. Unknown fields are rejected.')
|
||||
|
||||
export type CreateMyAssessmentLabConsoleSessionBody = zod.input<typeof CreateMyAssessmentLabConsoleSessionBody>;
|
||||
export type CreateMyAssessmentLabConsoleSessionBodyOutput = zod.output<typeof CreateMyAssessmentLabConsoleSessionBody>;
|
||||
@@ -0,0 +1,19 @@
|
||||
/**
|
||||
* Generated by orval 🍺
|
||||
* Do not edit manually.
|
||||
* Lincodex API
|
||||
* OpenAPI spec version: 0.1.0
|
||||
*/
|
||||
import * as zod from 'zod';
|
||||
|
||||
export const createMyAssessmentLabHeadersIdempotencyKeyMax = 255;
|
||||
|
||||
|
||||
export const createMyAssessmentLabHeadersIdempotencyKeyRegExp = new RegExp('^[A-Za-z0-9._:-]+$');
|
||||
|
||||
export const CreateMyAssessmentLabHeaders = zod.object({
|
||||
"Idempotency-Key": zod.string().min(1).max(createMyAssessmentLabHeadersIdempotencyKeyMax).regex(createMyAssessmentLabHeadersIdempotencyKeyRegExp)
|
||||
})
|
||||
|
||||
export type CreateMyAssessmentLabHeaders = zod.input<typeof CreateMyAssessmentLabHeaders>;
|
||||
export type CreateMyAssessmentLabHeadersOutput = zod.output<typeof CreateMyAssessmentLabHeaders>;
|
||||
@@ -36,6 +36,16 @@ export * from './assessmentGradeAvailabilityStatus.zod';
|
||||
export * from './assessmentInterval.zod';
|
||||
export * from './assessmentItem.zod';
|
||||
export * from './assessmentItemId.zod';
|
||||
export * from './assessmentLab.zod';
|
||||
export * from './assessmentLabConsoleSession.zod';
|
||||
export * from './assessmentLabConsoleSessionCreate.zod';
|
||||
export * from './assessmentLabCreate.zod';
|
||||
export * from './assessmentLabFailureReason.zod';
|
||||
export * from './assessmentLabNode.zod';
|
||||
export * from './assessmentLabNodeKind.zod';
|
||||
export * from './assessmentLabNodeName.zod';
|
||||
export * from './assessmentLabState.zod';
|
||||
export * from './assessmentLabSubmission.zod';
|
||||
export * from './assessmentLimitation.zod';
|
||||
export * from './assessmentMode.zod';
|
||||
export * from './assessmentNextAction.zod';
|
||||
@@ -78,6 +88,9 @@ export * from './configurationAnswer.zod';
|
||||
export * from './configurationItemContent.zod';
|
||||
export * from './createMyAssessmentAttemptBody.zod';
|
||||
export * from './createMyAssessmentAttemptHeaders.zod';
|
||||
export * from './createMyAssessmentLabBody.zod';
|
||||
export * from './createMyAssessmentLabConsoleSessionBody.zod';
|
||||
export * from './createMyAssessmentLabHeaders.zod';
|
||||
export * from './createMyAssessmentPracticeRunBody.zod';
|
||||
export * from './createMyAssessmentPracticeRunHeaders.zod';
|
||||
export * from './finalizeMyAssessmentAttemptBody.zod';
|
||||
@@ -86,6 +99,8 @@ export * from './findErrorAnswer.zod';
|
||||
export * from './findErrorItemContent.zod';
|
||||
export * from './holdMyAssessmentWorkSessionHeaders.zod';
|
||||
export * from './itemContent.zod';
|
||||
export * from './labAnswer.zod';
|
||||
export * from './labItemContent.zod';
|
||||
export * from './listMyAssessmentResultsParams.zod';
|
||||
export * from './numberAnswer.zod';
|
||||
export * from './numberItemContent.zod';
|
||||
@@ -116,3 +131,5 @@ export * from './stringAnswer.zod';
|
||||
export * from './stringItemContent.zod';
|
||||
export * from './submitMyAssessmentAnswerBody.zod';
|
||||
export * from './submitMyAssessmentAnswerHeaders.zod';
|
||||
export * from './submitMyAssessmentLabBody.zod';
|
||||
export * from './submitMyAssessmentLabHeaders.zod';
|
||||
@@ -58,6 +58,15 @@ export const itemContentSevenPublicExamplesMax = 10;
|
||||
|
||||
export const itemContentSevenMaxSourceLengthMax = 65536;
|
||||
|
||||
export const itemContentEightNodesItemNameMax = 15;
|
||||
|
||||
|
||||
export const itemContentEightNodesItemNameRegExp = new RegExp('^[a-z][a-z0-9-]{0,14}$');
|
||||
export const itemContentEightNodesMax = 8;
|
||||
|
||||
export const itemContentEightTimeLimitSecondsMin = 300;
|
||||
export const itemContentEightTimeLimitSecondsMax = 14400;
|
||||
|
||||
|
||||
export const ItemContent = zod.union([zod.object({
|
||||
"format": zod.enum(['choice']),
|
||||
@@ -99,7 +108,14 @@ export const ItemContent = zod.union([zod.object({
|
||||
"expected_output": zod.string().max(itemContentSevenPublicExamplesItemExpectedOutputMax)
|
||||
}).describe('Public example of the practice task: an input and its expected output. Hidden checks are never listed.')).max(itemContentSevenPublicExamplesMax),
|
||||
"max_source_length": zod.int().min(1).max(itemContentSevenMaxSourceLengthMax).describe('Maximum length of the solution source in characters.')
|
||||
}).describe('Code practice. The candidate submits one final solution, which runs in the isolated sandbox against three groups of hidden checks. The content lists only the statement, the allowed languages, and public examples; hidden checks, their inputs, and seeds never reach the client.')]).describe('Format-specific part of an item, selected by `format`. It holds only what the candidate needs to answer: never an answer key, a correct option, a score, a family or variant identifier, a seed, or a hidden check. Limits such as `multiple`, `max_selections`, and `max_length` belong to the format or the task family and never reveal the key.')
|
||||
}).describe('Code practice. The candidate submits one final solution, which runs in the isolated sandbox against three groups of hidden checks. The content lists only the statement, the allowed languages, and public examples; hidden checks, their inputs, and seeds never reach the client.'),zod.object({
|
||||
"format": zod.enum(['lab']),
|
||||
"nodes": zod.array(zod.object({
|
||||
"name": zod.string().min(1).max(itemContentEightNodesItemNameMax).regex(itemContentEightNodesItemNameRegExp).describe('Name of a lab node as the task statement uses it, such as `r1` or `srv`. It is a label of the task, not a host name or an address.'),
|
||||
"kind": zod.enum(['mikrotik', 'ubuntu']).describe('What the console of a node shows.\n\n- mikrotik: a MikroTik router with the RouterOS console.\n- ubuntu: a small Ubuntu server with a Linux login.\n\nAdding a value is a contract change.')
|
||||
}).describe('A node of a lab by its task name and kind. It never carries an address, a MAC address, a port, a password, a key, or an infrastructure name.')).min(1).max(itemContentEightNodesMax).describe('Nodes of the lab in the order of the statement.'),
|
||||
"time_limit_seconds": zod.int().min(itemContentEightTimeLimitSecondsMin).max(itemContentEightTimeLimitSecondsMax).describe('Lifetime of a lab of this item from its creation. The lab also ends no later than the attempt deadline.')
|
||||
}).describe('Practical lab: configure or repair a small network of virtual nodes through their consoles. The candidate starts the lab of the item with CreateMyAssessmentLab, works in the node consoles, and submits with SubmitMyAssessmentLab; the server then checks the state of the nodes. The content lists only the nodes the statement names and the lifetime of the lab, never the checker, its criteria, the seed, or an address. SubmitMyAssessmentAnswer takes no answer to a lab item; its result is submitted only with SubmitMyAssessmentLab.')]).describe('Format-specific part of an item, selected by `format`. It holds only what the candidate needs to answer: never an answer key, a correct option, a score, a family or variant identifier, a seed, or a hidden check. Limits such as `multiple`, `max_selections`, and `max_length` belong to the format or the task family and never reveal the key.')
|
||||
|
||||
export type ItemContent = zod.input<typeof ItemContent>;
|
||||
export type ItemContentOutput = zod.output<typeof ItemContent>;
|
||||
@@ -0,0 +1,15 @@
|
||||
/**
|
||||
* Generated by orval 🍺
|
||||
* Do not edit manually.
|
||||
* Lincodex API
|
||||
* OpenAPI spec version: 0.1.0
|
||||
*/
|
||||
import * as zod from 'zod';
|
||||
|
||||
export const LabAnswer = zod.object({
|
||||
"format": zod.enum(['lab']),
|
||||
"lab_id": zod.uuid().describe('The lab of this item that the candidate worked in.')
|
||||
}).describe('Answer of a lab item: the state of the nodes of the named lab at the moment of submission. The server reads that state with the checker of the task; the body carries no configuration text, score, or correctness flag. Two answers are equal when they name the same lab. It is the answer of SubmitMyAssessmentLab only and is not a member of AssessmentAnswer.')
|
||||
|
||||
export type LabAnswer = zod.input<typeof LabAnswer>;
|
||||
export type LabAnswerOutput = zod.output<typeof LabAnswer>;
|
||||
@@ -0,0 +1,29 @@
|
||||
/**
|
||||
* Generated by orval 🍺
|
||||
* Do not edit manually.
|
||||
* Lincodex API
|
||||
* OpenAPI spec version: 0.1.0
|
||||
*/
|
||||
import * as zod from 'zod';
|
||||
|
||||
export const labItemContentNodesItemNameMax = 15;
|
||||
|
||||
|
||||
export const labItemContentNodesItemNameRegExp = new RegExp('^[a-z][a-z0-9-]{0,14}$');
|
||||
export const labItemContentNodesMax = 8;
|
||||
|
||||
export const labItemContentTimeLimitSecondsMin = 300;
|
||||
export const labItemContentTimeLimitSecondsMax = 14400;
|
||||
|
||||
|
||||
export const LabItemContent = zod.object({
|
||||
"format": zod.enum(['lab']),
|
||||
"nodes": zod.array(zod.object({
|
||||
"name": zod.string().min(1).max(labItemContentNodesItemNameMax).regex(labItemContentNodesItemNameRegExp).describe('Name of a lab node as the task statement uses it, such as `r1` or `srv`. It is a label of the task, not a host name or an address.'),
|
||||
"kind": zod.enum(['mikrotik', 'ubuntu']).describe('What the console of a node shows.\n\n- mikrotik: a MikroTik router with the RouterOS console.\n- ubuntu: a small Ubuntu server with a Linux login.\n\nAdding a value is a contract change.')
|
||||
}).describe('A node of a lab by its task name and kind. It never carries an address, a MAC address, a port, a password, a key, or an infrastructure name.')).min(1).max(labItemContentNodesMax).describe('Nodes of the lab in the order of the statement.'),
|
||||
"time_limit_seconds": zod.int().min(labItemContentTimeLimitSecondsMin).max(labItemContentTimeLimitSecondsMax).describe('Lifetime of a lab of this item from its creation. The lab also ends no later than the attempt deadline.')
|
||||
}).describe('Practical lab: configure or repair a small network of virtual nodes through their consoles. The candidate starts the lab of the item with CreateMyAssessmentLab, works in the node consoles, and submits with SubmitMyAssessmentLab; the server then checks the state of the nodes. The content lists only the nodes the statement names and the lifetime of the lab, never the checker, its criteria, the seed, or an address. SubmitMyAssessmentAnswer takes no answer to a lab item; its result is submitted only with SubmitMyAssessmentLab.')
|
||||
|
||||
export type LabItemContent = zod.input<typeof LabItemContent>;
|
||||
export type LabItemContentOutput = zod.output<typeof LabItemContent>;
|
||||
@@ -0,0 +1,20 @@
|
||||
/**
|
||||
* Generated by orval 🍺
|
||||
* Do not edit manually.
|
||||
* Lincodex API
|
||||
* OpenAPI spec version: 0.1.0
|
||||
*/
|
||||
import * as zod from 'zod';
|
||||
|
||||
|
||||
|
||||
export const SubmitMyAssessmentLabBody = zod.object({
|
||||
"expected_version": zod.int().min(1).describe('Version of an assessment attempt. A new attempt has version 1, and each committed change advances it by exactly one: an accepted answer, a practice submission or resubmission, a verdict, a decision of finalize, an explicit work-session start, and a server-side transition such as expiry or automatic finalization. Reads never change the attempt. A rejected command and a repeat that stores nothing leave it unchanged. Commands send the version they read as `expected_version`.'),
|
||||
"answer": zod.object({
|
||||
"format": zod.enum(['lab']),
|
||||
"lab_id": zod.uuid().describe('The lab of this item that the candidate worked in.')
|
||||
}).describe('Answer of a lab item: the state of the nodes of the named lab at the moment of submission. The server reads that state with the checker of the task; the body carries no configuration text, score, or correctness flag. Two answers are equal when they name the same lab. It is the answer of SubmitMyAssessmentLab only and is not a member of AssessmentAnswer.')
|
||||
}).describe('Submit the lab of the current lab item as its answer. Unknown fields are rejected, so a request cannot send a score or a correctness flag.')
|
||||
|
||||
export type SubmitMyAssessmentLabBody = zod.input<typeof SubmitMyAssessmentLabBody>;
|
||||
export type SubmitMyAssessmentLabBodyOutput = zod.output<typeof SubmitMyAssessmentLabBody>;
|
||||
@@ -0,0 +1,19 @@
|
||||
/**
|
||||
* Generated by orval 🍺
|
||||
* Do not edit manually.
|
||||
* Lincodex API
|
||||
* OpenAPI spec version: 0.1.0
|
||||
*/
|
||||
import * as zod from 'zod';
|
||||
|
||||
export const submitMyAssessmentLabHeadersIdempotencyKeyMax = 255;
|
||||
|
||||
|
||||
export const submitMyAssessmentLabHeadersIdempotencyKeyRegExp = new RegExp('^[A-Za-z0-9._:-]+$');
|
||||
|
||||
export const SubmitMyAssessmentLabHeaders = zod.object({
|
||||
"Idempotency-Key": zod.string().min(1).max(submitMyAssessmentLabHeadersIdempotencyKeyMax).regex(submitMyAssessmentLabHeadersIdempotencyKeyRegExp)
|
||||
})
|
||||
|
||||
export type SubmitMyAssessmentLabHeaders = zod.input<typeof SubmitMyAssessmentLabHeaders>;
|
||||
export type SubmitMyAssessmentLabHeadersOutput = zod.output<typeof SubmitMyAssessmentLabHeaders>;
|
||||
Reference in new issue
Block a user