@nakafa/aksara-contracts 0.47.0 → 0.47.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/content.d.ts +8 -6
- package/dist/content.js +8 -3
- package/dist/math/arc.js +5 -1
- package/dist/math/base.js +6 -6
- package/dist/math/collision.d.ts +4 -4
- package/dist/math/collision.js +15 -9
- package/dist/math/coordinate.d.ts +24 -13
- package/dist/math/coordinate.js +16 -2
- package/dist/math/extent.d.ts +26 -17
- package/dist/math/extent.js +18 -2
- package/dist/math/intersection.d.ts +21 -11
- package/dist/math/intersection.js +14 -1
- package/dist/math/precision.js +3 -3
- package/dist/math/proximity.d.ts +11 -7
- package/dist/math/proximity.js +21 -4
- package/dist/math/rational.d.ts +6 -5
- package/dist/math/rational.js +6 -1
- package/dist/math/resolution.d.ts +1 -1
- package/dist/math/resolution.js +12 -4
- package/dist/math/scene.d.ts +22 -3
- package/dist/preview/auth.js +2 -1
- package/dist/preview/target.js +7 -0
- package/dist/program/curriculum.js +2 -1
- package/dist/program/snapshot/digest.js +32 -31
- package/dist/program/snapshot/hash.js +2 -1
- package/dist/program/spec.js +2 -1
- package/dist/projection/article.js +2 -1
- package/dist/projection/material.js +2 -1
- package/dist/projection/page.js +2 -1
- package/dist/projection/question.d.ts +544 -17
- package/dist/projection/question.js +17 -3
- package/dist/projection/verify.d.ts +4 -3
- package/dist/projection/verify.js +14 -7
- package/dist/question/answer.d.ts +12 -6
- package/dist/question/answer.js +17 -2
- package/dist/question/item.js +5 -4
- package/dist/question/response.js +3 -3
- package/dist/question/rubric.js +2 -1
- package/dist/quran/identity.js +11 -0
- package/dist/quran/notes.js +13 -0
- package/dist/quran/provenance.js +3 -2
- package/dist/quran/snapshot/digest.js +4 -3
- package/dist/quran/snapshot/hash.js +2 -1
- package/dist/quran/snapshot/row/hash.js +5 -4
- package/dist/quran/snapshot/spec.js +3 -2
- package/dist/renderer/compatibility.js +8 -5
- package/dist/renderer/contract.js +5 -4
- package/dist/runtime/protected/limits.js +2 -1
- package/dist/runtime/protected/spec.js +3 -3
- package/dist/text/json.d.ts +5 -0
- package/dist/text/json.js +5 -0
- package/dist/transport/request.d.ts +108 -108
- package/dist/tryout/closure/accounting.js +5 -4
- package/dist/tryout/closure/placement.js +3 -2
- package/dist/tryout/hash/catalog.js +11 -10
- package/dist/tryout/hash/content.js +2 -1
- package/dist/tryout/hash/placement.js +2 -1
- package/dist/tryout/language.js +2 -4
- package/dist/tryout/runtime/canonical.js +2 -1
- package/dist/tryout/scoring.d.ts +13 -9
- package/dist/tryout/scoring.js +17 -8
- package/dist/tryout/snapshot/canonical.js +2 -1
- package/dist/tryout/snapshot/hash.js +2 -1
- package/package.json +1 -1
|
@@ -1,8 +1,4 @@
|
|
|
1
1
|
import { Effect, Schema } from "effect";
|
|
2
|
-
import type { ContentKeySchema } from "#contracts/ids";
|
|
3
|
-
import type { ArtifactLocaleSchema } from "#contracts/locale";
|
|
4
|
-
import { type QuestionBodyKind, type QuestionKey, type QuestionSetKey } from "#contracts/question/identity";
|
|
5
|
-
import { type QuestionItem } from "#contracts/question/item";
|
|
6
2
|
/** Exact metadata authored by every current question and answer body. */
|
|
7
3
|
export declare const QuestionMetadataSchema: Schema.Struct<{
|
|
8
4
|
readonly dateModified: Schema.optionalKey<Schema.String>;
|
|
@@ -260,19 +256,322 @@ export declare const QuestionBodyProjectionSchema: Schema.Union<readonly [Schema
|
|
|
260
256
|
readonly stimulusKey: Schema.optionalKey<Schema.String>;
|
|
261
257
|
}>]>;
|
|
262
258
|
export type QuestionBodyProjection = typeof QuestionBodyProjectionSchema.Type;
|
|
263
|
-
|
|
264
|
-
readonly artifactLocale:
|
|
265
|
-
readonly bodyKind:
|
|
266
|
-
readonly contentKey:
|
|
267
|
-
readonly item:
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
259
|
+
declare const QuestionProjectionInputSchema: Schema.Struct<{
|
|
260
|
+
readonly artifactLocale: Schema.brand<Schema.Literals<readonly ["en", "id", "de"]>, "@NakafaAI/AksaraArtifactLocale">;
|
|
261
|
+
readonly bodyKind: Schema.Literals<readonly ["question", "answer"]>;
|
|
262
|
+
readonly contentKey: Schema.brand<Schema.String, "@NakafaAI/AksaraContentKey">;
|
|
263
|
+
readonly item: Schema.Struct<{
|
|
264
|
+
readonly blueprint: Schema.optionalKey<Schema.Struct<{
|
|
265
|
+
readonly cognitiveLevel: Schema.String;
|
|
266
|
+
readonly contentDomain: Schema.String;
|
|
267
|
+
readonly topic: Schema.String;
|
|
268
|
+
}>>;
|
|
269
|
+
readonly points: Schema.optionalKey<Schema.Int>;
|
|
270
|
+
readonly responses: Schema.$Record<Schema.Literals<readonly ["en", "id", "de"]>, Schema.optional<Schema.Union<readonly [Schema.Struct<{
|
|
271
|
+
readonly categories: Schema.mutableKey<Schema.mutable<Schema.$Array<Schema.String>>>;
|
|
272
|
+
readonly kind: Schema.mutableKey<Schema.Literal<"category">>;
|
|
273
|
+
readonly statements: Schema.mutableKey<Schema.mutable<Schema.$Array<Schema.Struct<{
|
|
274
|
+
readonly correctCategoryOrder: Schema.mutableKey<Schema.Int>;
|
|
275
|
+
readonly label: Schema.mutableKey<Schema.String>;
|
|
276
|
+
}>>>>;
|
|
277
|
+
}>, Schema.Struct<{
|
|
278
|
+
readonly kind: Schema.mutableKey<Schema.Literal<"multiple-choice">>;
|
|
279
|
+
readonly options: Schema.mutableKey<Schema.mutable<Schema.$Array<Schema.Struct<{
|
|
280
|
+
readonly isCorrect: Schema.mutableKey<Schema.Boolean>;
|
|
281
|
+
readonly label: Schema.mutableKey<Schema.String>;
|
|
282
|
+
}>>>>;
|
|
283
|
+
}>, Schema.Struct<{
|
|
284
|
+
readonly criteria: Schema.mutableKey<Schema.mutable<Schema.$Array<Schema.Struct<{
|
|
285
|
+
readonly finalAnswer: Schema.mutableKey<Schema.optionalKey<Schema.Union<readonly [Schema.Struct<{
|
|
286
|
+
readonly acceptsFractions: Schema.Boolean;
|
|
287
|
+
readonly kind: Schema.Literal<"number">;
|
|
288
|
+
readonly tolerance: Schema.optionalKey<Schema.Struct<{
|
|
289
|
+
readonly kind: Schema.Literals<readonly ["absolute", "relative"]>;
|
|
290
|
+
readonly value: Schema.String;
|
|
291
|
+
}>>;
|
|
292
|
+
readonly value: Schema.String;
|
|
293
|
+
}>, Schema.Struct<{
|
|
294
|
+
readonly acceptedAnswers: Schema.NonEmptyArray<Schema.Trimmed>;
|
|
295
|
+
readonly collapseWhitespace: Schema.Boolean;
|
|
296
|
+
readonly ignoreCase: Schema.Boolean;
|
|
297
|
+
readonly kind: Schema.Literal<"text">;
|
|
298
|
+
}>]>>>;
|
|
299
|
+
readonly label: Schema.mutableKey<Schema.$Record<Schema.Literals<readonly ["en", "id", "de"]>, Schema.String>>;
|
|
300
|
+
readonly levels: Schema.mutableKey<Schema.mutable<Schema.$Array<Schema.Struct<{
|
|
301
|
+
readonly label: Schema.mutableKey<Schema.$Record<Schema.Literals<readonly ["en", "id", "de"]>, Schema.String>>;
|
|
302
|
+
readonly points: Schema.mutableKey<Schema.Int>;
|
|
303
|
+
}>>>>;
|
|
304
|
+
}>>>>;
|
|
305
|
+
readonly kind: Schema.mutableKey<Schema.Literal<"rubric">>;
|
|
306
|
+
}>, Schema.Struct<{
|
|
307
|
+
readonly key: Schema.mutableKey<Schema.Union<readonly [Schema.Struct<{
|
|
308
|
+
readonly acceptsFractions: Schema.Boolean;
|
|
309
|
+
readonly kind: Schema.Literal<"number">;
|
|
310
|
+
readonly tolerance: Schema.optionalKey<Schema.Struct<{
|
|
311
|
+
readonly kind: Schema.Literals<readonly ["absolute", "relative"]>;
|
|
312
|
+
readonly value: Schema.String;
|
|
313
|
+
}>>;
|
|
314
|
+
readonly value: Schema.String;
|
|
315
|
+
}>, Schema.Struct<{
|
|
316
|
+
readonly acceptedAnswers: Schema.NonEmptyArray<Schema.Trimmed>;
|
|
317
|
+
readonly collapseWhitespace: Schema.Boolean;
|
|
318
|
+
readonly ignoreCase: Schema.Boolean;
|
|
319
|
+
readonly kind: Schema.Literal<"text">;
|
|
320
|
+
}>]>>;
|
|
321
|
+
readonly kind: Schema.mutableKey<Schema.Literal<"short-answer">>;
|
|
322
|
+
}>, Schema.Struct<{
|
|
323
|
+
readonly kind: Schema.mutableKey<Schema.Literal<"single-choice">>;
|
|
324
|
+
readonly options: Schema.mutableKey<Schema.mutable<Schema.$Array<Schema.Struct<{
|
|
325
|
+
readonly isCorrect: Schema.mutableKey<Schema.Boolean>;
|
|
326
|
+
readonly label: Schema.mutableKey<Schema.String>;
|
|
327
|
+
}>>>>;
|
|
328
|
+
}>]>>>;
|
|
329
|
+
readonly stimulusKey: Schema.optionalKey<Schema.String>;
|
|
330
|
+
}>;
|
|
331
|
+
readonly metadata: Schema.Struct<{
|
|
332
|
+
readonly dateModified: Schema.optionalKey<Schema.String>;
|
|
333
|
+
readonly datePublished: Schema.String;
|
|
334
|
+
readonly authors: Schema.$Array<Schema.Struct<{
|
|
335
|
+
readonly name: Schema.String;
|
|
336
|
+
}>>;
|
|
337
|
+
readonly title: Schema.String;
|
|
338
|
+
}>;
|
|
339
|
+
readonly peerContentKey: Schema.brand<Schema.String, "@NakafaAI/AksaraContentKey">;
|
|
340
|
+
readonly questionKey: Schema.brand<Schema.String, "@NakafaAI/AksaraQuestionKey">;
|
|
341
|
+
readonly questionNumber: Schema.Finite;
|
|
342
|
+
readonly setKey: Schema.brand<Schema.String, "@NakafaAI/AksaraQuestionSetKey">;
|
|
343
|
+
}>;
|
|
344
|
+
type QuestionProjectionInput = typeof QuestionProjectionInputSchema.Type;
|
|
274
345
|
/** Builds one prompt projection with its exact-locale frozen response. */
|
|
275
|
-
export declare const makeQuestionPromptProjection: (input:
|
|
346
|
+
export declare const makeQuestionPromptProjection: (input: {
|
|
347
|
+
readonly artifactLocale: ("de" | "en" | "id") & import("effect/Brand").Brand<"@NakafaAI/AksaraArtifactLocale">;
|
|
348
|
+
readonly bodyKind: "answer" | "question";
|
|
349
|
+
readonly contentKey: string & import("effect/Brand").Brand<"@NakafaAI/AksaraContentKey">;
|
|
350
|
+
readonly item: {
|
|
351
|
+
readonly blueprint?: {
|
|
352
|
+
readonly cognitiveLevel: string;
|
|
353
|
+
readonly contentDomain: string;
|
|
354
|
+
readonly topic: string;
|
|
355
|
+
};
|
|
356
|
+
readonly points?: number;
|
|
357
|
+
readonly responses: {
|
|
358
|
+
readonly de?: {
|
|
359
|
+
criteria: {
|
|
360
|
+
finalAnswer?: {
|
|
361
|
+
readonly acceptsFractions: boolean;
|
|
362
|
+
readonly kind: "number";
|
|
363
|
+
readonly tolerance?: {
|
|
364
|
+
readonly kind: "absolute" | "relative";
|
|
365
|
+
readonly value: string;
|
|
366
|
+
};
|
|
367
|
+
readonly value: string;
|
|
368
|
+
} | {
|
|
369
|
+
readonly acceptedAnswers: readonly [string, ...string[]];
|
|
370
|
+
readonly collapseWhitespace: boolean;
|
|
371
|
+
readonly ignoreCase: boolean;
|
|
372
|
+
readonly kind: "text";
|
|
373
|
+
};
|
|
374
|
+
label: {
|
|
375
|
+
readonly de: string;
|
|
376
|
+
readonly en: string;
|
|
377
|
+
readonly id: string;
|
|
378
|
+
};
|
|
379
|
+
levels: {
|
|
380
|
+
label: {
|
|
381
|
+
readonly de: string;
|
|
382
|
+
readonly en: string;
|
|
383
|
+
readonly id: string;
|
|
384
|
+
};
|
|
385
|
+
points: number;
|
|
386
|
+
}[];
|
|
387
|
+
}[];
|
|
388
|
+
kind: "rubric";
|
|
389
|
+
} | {
|
|
390
|
+
categories: string[];
|
|
391
|
+
kind: "category";
|
|
392
|
+
statements: {
|
|
393
|
+
correctCategoryOrder: number;
|
|
394
|
+
label: string;
|
|
395
|
+
}[];
|
|
396
|
+
} | {
|
|
397
|
+
kind: "multiple-choice";
|
|
398
|
+
options: {
|
|
399
|
+
isCorrect: boolean;
|
|
400
|
+
label: string;
|
|
401
|
+
}[];
|
|
402
|
+
} | {
|
|
403
|
+
key: {
|
|
404
|
+
readonly acceptsFractions: boolean;
|
|
405
|
+
readonly kind: "number";
|
|
406
|
+
readonly tolerance?: {
|
|
407
|
+
readonly kind: "absolute" | "relative";
|
|
408
|
+
readonly value: string;
|
|
409
|
+
};
|
|
410
|
+
readonly value: string;
|
|
411
|
+
} | {
|
|
412
|
+
readonly acceptedAnswers: readonly [string, ...string[]];
|
|
413
|
+
readonly collapseWhitespace: boolean;
|
|
414
|
+
readonly ignoreCase: boolean;
|
|
415
|
+
readonly kind: "text";
|
|
416
|
+
};
|
|
417
|
+
kind: "short-answer";
|
|
418
|
+
} | {
|
|
419
|
+
kind: "single-choice";
|
|
420
|
+
options: {
|
|
421
|
+
isCorrect: boolean;
|
|
422
|
+
label: string;
|
|
423
|
+
}[];
|
|
424
|
+
} | undefined;
|
|
425
|
+
readonly en?: {
|
|
426
|
+
criteria: {
|
|
427
|
+
finalAnswer?: {
|
|
428
|
+
readonly acceptsFractions: boolean;
|
|
429
|
+
readonly kind: "number";
|
|
430
|
+
readonly tolerance?: {
|
|
431
|
+
readonly kind: "absolute" | "relative";
|
|
432
|
+
readonly value: string;
|
|
433
|
+
};
|
|
434
|
+
readonly value: string;
|
|
435
|
+
} | {
|
|
436
|
+
readonly acceptedAnswers: readonly [string, ...string[]];
|
|
437
|
+
readonly collapseWhitespace: boolean;
|
|
438
|
+
readonly ignoreCase: boolean;
|
|
439
|
+
readonly kind: "text";
|
|
440
|
+
};
|
|
441
|
+
label: {
|
|
442
|
+
readonly de: string;
|
|
443
|
+
readonly en: string;
|
|
444
|
+
readonly id: string;
|
|
445
|
+
};
|
|
446
|
+
levels: {
|
|
447
|
+
label: {
|
|
448
|
+
readonly de: string;
|
|
449
|
+
readonly en: string;
|
|
450
|
+
readonly id: string;
|
|
451
|
+
};
|
|
452
|
+
points: number;
|
|
453
|
+
}[];
|
|
454
|
+
}[];
|
|
455
|
+
kind: "rubric";
|
|
456
|
+
} | {
|
|
457
|
+
categories: string[];
|
|
458
|
+
kind: "category";
|
|
459
|
+
statements: {
|
|
460
|
+
correctCategoryOrder: number;
|
|
461
|
+
label: string;
|
|
462
|
+
}[];
|
|
463
|
+
} | {
|
|
464
|
+
kind: "multiple-choice";
|
|
465
|
+
options: {
|
|
466
|
+
isCorrect: boolean;
|
|
467
|
+
label: string;
|
|
468
|
+
}[];
|
|
469
|
+
} | {
|
|
470
|
+
key: {
|
|
471
|
+
readonly acceptsFractions: boolean;
|
|
472
|
+
readonly kind: "number";
|
|
473
|
+
readonly tolerance?: {
|
|
474
|
+
readonly kind: "absolute" | "relative";
|
|
475
|
+
readonly value: string;
|
|
476
|
+
};
|
|
477
|
+
readonly value: string;
|
|
478
|
+
} | {
|
|
479
|
+
readonly acceptedAnswers: readonly [string, ...string[]];
|
|
480
|
+
readonly collapseWhitespace: boolean;
|
|
481
|
+
readonly ignoreCase: boolean;
|
|
482
|
+
readonly kind: "text";
|
|
483
|
+
};
|
|
484
|
+
kind: "short-answer";
|
|
485
|
+
} | {
|
|
486
|
+
kind: "single-choice";
|
|
487
|
+
options: {
|
|
488
|
+
isCorrect: boolean;
|
|
489
|
+
label: string;
|
|
490
|
+
}[];
|
|
491
|
+
} | undefined;
|
|
492
|
+
readonly id?: {
|
|
493
|
+
criteria: {
|
|
494
|
+
finalAnswer?: {
|
|
495
|
+
readonly acceptsFractions: boolean;
|
|
496
|
+
readonly kind: "number";
|
|
497
|
+
readonly tolerance?: {
|
|
498
|
+
readonly kind: "absolute" | "relative";
|
|
499
|
+
readonly value: string;
|
|
500
|
+
};
|
|
501
|
+
readonly value: string;
|
|
502
|
+
} | {
|
|
503
|
+
readonly acceptedAnswers: readonly [string, ...string[]];
|
|
504
|
+
readonly collapseWhitespace: boolean;
|
|
505
|
+
readonly ignoreCase: boolean;
|
|
506
|
+
readonly kind: "text";
|
|
507
|
+
};
|
|
508
|
+
label: {
|
|
509
|
+
readonly de: string;
|
|
510
|
+
readonly en: string;
|
|
511
|
+
readonly id: string;
|
|
512
|
+
};
|
|
513
|
+
levels: {
|
|
514
|
+
label: {
|
|
515
|
+
readonly de: string;
|
|
516
|
+
readonly en: string;
|
|
517
|
+
readonly id: string;
|
|
518
|
+
};
|
|
519
|
+
points: number;
|
|
520
|
+
}[];
|
|
521
|
+
}[];
|
|
522
|
+
kind: "rubric";
|
|
523
|
+
} | {
|
|
524
|
+
categories: string[];
|
|
525
|
+
kind: "category";
|
|
526
|
+
statements: {
|
|
527
|
+
correctCategoryOrder: number;
|
|
528
|
+
label: string;
|
|
529
|
+
}[];
|
|
530
|
+
} | {
|
|
531
|
+
kind: "multiple-choice";
|
|
532
|
+
options: {
|
|
533
|
+
isCorrect: boolean;
|
|
534
|
+
label: string;
|
|
535
|
+
}[];
|
|
536
|
+
} | {
|
|
537
|
+
key: {
|
|
538
|
+
readonly acceptsFractions: boolean;
|
|
539
|
+
readonly kind: "number";
|
|
540
|
+
readonly tolerance?: {
|
|
541
|
+
readonly kind: "absolute" | "relative";
|
|
542
|
+
readonly value: string;
|
|
543
|
+
};
|
|
544
|
+
readonly value: string;
|
|
545
|
+
} | {
|
|
546
|
+
readonly acceptedAnswers: readonly [string, ...string[]];
|
|
547
|
+
readonly collapseWhitespace: boolean;
|
|
548
|
+
readonly ignoreCase: boolean;
|
|
549
|
+
readonly kind: "text";
|
|
550
|
+
};
|
|
551
|
+
kind: "short-answer";
|
|
552
|
+
} | {
|
|
553
|
+
kind: "single-choice";
|
|
554
|
+
options: {
|
|
555
|
+
isCorrect: boolean;
|
|
556
|
+
label: string;
|
|
557
|
+
}[];
|
|
558
|
+
} | undefined;
|
|
559
|
+
};
|
|
560
|
+
readonly stimulusKey?: string;
|
|
561
|
+
};
|
|
562
|
+
readonly metadata: {
|
|
563
|
+
readonly dateModified?: string;
|
|
564
|
+
readonly datePublished: string;
|
|
565
|
+
readonly authors: readonly {
|
|
566
|
+
readonly name: string;
|
|
567
|
+
}[];
|
|
568
|
+
readonly title: string;
|
|
569
|
+
};
|
|
570
|
+
readonly peerContentKey: string & import("effect/Brand").Brand<"@NakafaAI/AksaraContentKey">;
|
|
571
|
+
readonly questionKey: string & import("effect/Brand").Brand<"@NakafaAI/AksaraQuestionKey">;
|
|
572
|
+
readonly questionNumber: number;
|
|
573
|
+
readonly setKey: string & import("effect/Brand").Brand<"@NakafaAI/AksaraQuestionSetKey">;
|
|
574
|
+
} & {
|
|
276
575
|
readonly bodyKind: "question";
|
|
277
576
|
}) => Effect.Effect<{
|
|
278
577
|
artifactLocale: ("de" | "en" | "id") & import("effect/Brand").Brand<"@NakafaAI/AksaraArtifactLocale">;
|
|
@@ -407,7 +706,235 @@ export declare function makeQuestionAnswerProjection(input: QuestionProjectionIn
|
|
|
407
706
|
kind: "question-body";
|
|
408
707
|
};
|
|
409
708
|
/** Builds one strictly bound question or answer projection from authored facts. */
|
|
410
|
-
export declare const makeQuestionBodyProjection: (input:
|
|
709
|
+
export declare const makeQuestionBodyProjection: (input: {
|
|
710
|
+
readonly artifactLocale: ("de" | "en" | "id") & import("effect/Brand").Brand<"@NakafaAI/AksaraArtifactLocale">;
|
|
711
|
+
readonly bodyKind: "answer" | "question";
|
|
712
|
+
readonly contentKey: string & import("effect/Brand").Brand<"@NakafaAI/AksaraContentKey">;
|
|
713
|
+
readonly item: {
|
|
714
|
+
readonly blueprint?: {
|
|
715
|
+
readonly cognitiveLevel: string;
|
|
716
|
+
readonly contentDomain: string;
|
|
717
|
+
readonly topic: string;
|
|
718
|
+
};
|
|
719
|
+
readonly points?: number;
|
|
720
|
+
readonly responses: {
|
|
721
|
+
readonly de?: {
|
|
722
|
+
criteria: {
|
|
723
|
+
finalAnswer?: {
|
|
724
|
+
readonly acceptsFractions: boolean;
|
|
725
|
+
readonly kind: "number";
|
|
726
|
+
readonly tolerance?: {
|
|
727
|
+
readonly kind: "absolute" | "relative";
|
|
728
|
+
readonly value: string;
|
|
729
|
+
};
|
|
730
|
+
readonly value: string;
|
|
731
|
+
} | {
|
|
732
|
+
readonly acceptedAnswers: readonly [string, ...string[]];
|
|
733
|
+
readonly collapseWhitespace: boolean;
|
|
734
|
+
readonly ignoreCase: boolean;
|
|
735
|
+
readonly kind: "text";
|
|
736
|
+
};
|
|
737
|
+
label: {
|
|
738
|
+
readonly de: string;
|
|
739
|
+
readonly en: string;
|
|
740
|
+
readonly id: string;
|
|
741
|
+
};
|
|
742
|
+
levels: {
|
|
743
|
+
label: {
|
|
744
|
+
readonly de: string;
|
|
745
|
+
readonly en: string;
|
|
746
|
+
readonly id: string;
|
|
747
|
+
};
|
|
748
|
+
points: number;
|
|
749
|
+
}[];
|
|
750
|
+
}[];
|
|
751
|
+
kind: "rubric";
|
|
752
|
+
} | {
|
|
753
|
+
categories: string[];
|
|
754
|
+
kind: "category";
|
|
755
|
+
statements: {
|
|
756
|
+
correctCategoryOrder: number;
|
|
757
|
+
label: string;
|
|
758
|
+
}[];
|
|
759
|
+
} | {
|
|
760
|
+
kind: "multiple-choice";
|
|
761
|
+
options: {
|
|
762
|
+
isCorrect: boolean;
|
|
763
|
+
label: string;
|
|
764
|
+
}[];
|
|
765
|
+
} | {
|
|
766
|
+
key: {
|
|
767
|
+
readonly acceptsFractions: boolean;
|
|
768
|
+
readonly kind: "number";
|
|
769
|
+
readonly tolerance?: {
|
|
770
|
+
readonly kind: "absolute" | "relative";
|
|
771
|
+
readonly value: string;
|
|
772
|
+
};
|
|
773
|
+
readonly value: string;
|
|
774
|
+
} | {
|
|
775
|
+
readonly acceptedAnswers: readonly [string, ...string[]];
|
|
776
|
+
readonly collapseWhitespace: boolean;
|
|
777
|
+
readonly ignoreCase: boolean;
|
|
778
|
+
readonly kind: "text";
|
|
779
|
+
};
|
|
780
|
+
kind: "short-answer";
|
|
781
|
+
} | {
|
|
782
|
+
kind: "single-choice";
|
|
783
|
+
options: {
|
|
784
|
+
isCorrect: boolean;
|
|
785
|
+
label: string;
|
|
786
|
+
}[];
|
|
787
|
+
} | undefined;
|
|
788
|
+
readonly en?: {
|
|
789
|
+
criteria: {
|
|
790
|
+
finalAnswer?: {
|
|
791
|
+
readonly acceptsFractions: boolean;
|
|
792
|
+
readonly kind: "number";
|
|
793
|
+
readonly tolerance?: {
|
|
794
|
+
readonly kind: "absolute" | "relative";
|
|
795
|
+
readonly value: string;
|
|
796
|
+
};
|
|
797
|
+
readonly value: string;
|
|
798
|
+
} | {
|
|
799
|
+
readonly acceptedAnswers: readonly [string, ...string[]];
|
|
800
|
+
readonly collapseWhitespace: boolean;
|
|
801
|
+
readonly ignoreCase: boolean;
|
|
802
|
+
readonly kind: "text";
|
|
803
|
+
};
|
|
804
|
+
label: {
|
|
805
|
+
readonly de: string;
|
|
806
|
+
readonly en: string;
|
|
807
|
+
readonly id: string;
|
|
808
|
+
};
|
|
809
|
+
levels: {
|
|
810
|
+
label: {
|
|
811
|
+
readonly de: string;
|
|
812
|
+
readonly en: string;
|
|
813
|
+
readonly id: string;
|
|
814
|
+
};
|
|
815
|
+
points: number;
|
|
816
|
+
}[];
|
|
817
|
+
}[];
|
|
818
|
+
kind: "rubric";
|
|
819
|
+
} | {
|
|
820
|
+
categories: string[];
|
|
821
|
+
kind: "category";
|
|
822
|
+
statements: {
|
|
823
|
+
correctCategoryOrder: number;
|
|
824
|
+
label: string;
|
|
825
|
+
}[];
|
|
826
|
+
} | {
|
|
827
|
+
kind: "multiple-choice";
|
|
828
|
+
options: {
|
|
829
|
+
isCorrect: boolean;
|
|
830
|
+
label: string;
|
|
831
|
+
}[];
|
|
832
|
+
} | {
|
|
833
|
+
key: {
|
|
834
|
+
readonly acceptsFractions: boolean;
|
|
835
|
+
readonly kind: "number";
|
|
836
|
+
readonly tolerance?: {
|
|
837
|
+
readonly kind: "absolute" | "relative";
|
|
838
|
+
readonly value: string;
|
|
839
|
+
};
|
|
840
|
+
readonly value: string;
|
|
841
|
+
} | {
|
|
842
|
+
readonly acceptedAnswers: readonly [string, ...string[]];
|
|
843
|
+
readonly collapseWhitespace: boolean;
|
|
844
|
+
readonly ignoreCase: boolean;
|
|
845
|
+
readonly kind: "text";
|
|
846
|
+
};
|
|
847
|
+
kind: "short-answer";
|
|
848
|
+
} | {
|
|
849
|
+
kind: "single-choice";
|
|
850
|
+
options: {
|
|
851
|
+
isCorrect: boolean;
|
|
852
|
+
label: string;
|
|
853
|
+
}[];
|
|
854
|
+
} | undefined;
|
|
855
|
+
readonly id?: {
|
|
856
|
+
criteria: {
|
|
857
|
+
finalAnswer?: {
|
|
858
|
+
readonly acceptsFractions: boolean;
|
|
859
|
+
readonly kind: "number";
|
|
860
|
+
readonly tolerance?: {
|
|
861
|
+
readonly kind: "absolute" | "relative";
|
|
862
|
+
readonly value: string;
|
|
863
|
+
};
|
|
864
|
+
readonly value: string;
|
|
865
|
+
} | {
|
|
866
|
+
readonly acceptedAnswers: readonly [string, ...string[]];
|
|
867
|
+
readonly collapseWhitespace: boolean;
|
|
868
|
+
readonly ignoreCase: boolean;
|
|
869
|
+
readonly kind: "text";
|
|
870
|
+
};
|
|
871
|
+
label: {
|
|
872
|
+
readonly de: string;
|
|
873
|
+
readonly en: string;
|
|
874
|
+
readonly id: string;
|
|
875
|
+
};
|
|
876
|
+
levels: {
|
|
877
|
+
label: {
|
|
878
|
+
readonly de: string;
|
|
879
|
+
readonly en: string;
|
|
880
|
+
readonly id: string;
|
|
881
|
+
};
|
|
882
|
+
points: number;
|
|
883
|
+
}[];
|
|
884
|
+
}[];
|
|
885
|
+
kind: "rubric";
|
|
886
|
+
} | {
|
|
887
|
+
categories: string[];
|
|
888
|
+
kind: "category";
|
|
889
|
+
statements: {
|
|
890
|
+
correctCategoryOrder: number;
|
|
891
|
+
label: string;
|
|
892
|
+
}[];
|
|
893
|
+
} | {
|
|
894
|
+
kind: "multiple-choice";
|
|
895
|
+
options: {
|
|
896
|
+
isCorrect: boolean;
|
|
897
|
+
label: string;
|
|
898
|
+
}[];
|
|
899
|
+
} | {
|
|
900
|
+
key: {
|
|
901
|
+
readonly acceptsFractions: boolean;
|
|
902
|
+
readonly kind: "number";
|
|
903
|
+
readonly tolerance?: {
|
|
904
|
+
readonly kind: "absolute" | "relative";
|
|
905
|
+
readonly value: string;
|
|
906
|
+
};
|
|
907
|
+
readonly value: string;
|
|
908
|
+
} | {
|
|
909
|
+
readonly acceptedAnswers: readonly [string, ...string[]];
|
|
910
|
+
readonly collapseWhitespace: boolean;
|
|
911
|
+
readonly ignoreCase: boolean;
|
|
912
|
+
readonly kind: "text";
|
|
913
|
+
};
|
|
914
|
+
kind: "short-answer";
|
|
915
|
+
} | {
|
|
916
|
+
kind: "single-choice";
|
|
917
|
+
options: {
|
|
918
|
+
isCorrect: boolean;
|
|
919
|
+
label: string;
|
|
920
|
+
}[];
|
|
921
|
+
} | undefined;
|
|
922
|
+
};
|
|
923
|
+
readonly stimulusKey?: string;
|
|
924
|
+
};
|
|
925
|
+
readonly metadata: {
|
|
926
|
+
readonly dateModified?: string;
|
|
927
|
+
readonly datePublished: string;
|
|
928
|
+
readonly authors: readonly {
|
|
929
|
+
readonly name: string;
|
|
930
|
+
}[];
|
|
931
|
+
readonly title: string;
|
|
932
|
+
};
|
|
933
|
+
readonly peerContentKey: string & import("effect/Brand").Brand<"@NakafaAI/AksaraContentKey">;
|
|
934
|
+
readonly questionKey: string & import("effect/Brand").Brand<"@NakafaAI/AksaraQuestionKey">;
|
|
935
|
+
readonly questionNumber: number;
|
|
936
|
+
readonly setKey: string & import("effect/Brand").Brand<"@NakafaAI/AksaraQuestionSetKey">;
|
|
937
|
+
}) => Effect.Effect<{
|
|
411
938
|
artifactLocale: ("de" | "en" | "id") & import("effect/Brand").Brand<"@NakafaAI/AksaraArtifactLocale">;
|
|
412
939
|
contentKey: string & import("effect/Brand").Brand<"@NakafaAI/AksaraContentKey">;
|
|
413
940
|
metadata: {
|
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
import { Effect, Schema } from "effect";
|
|
2
2
|
import { ContentAuthorSchema } from "#contracts/content";
|
|
3
3
|
import { withPublicationDates } from "#contracts/date";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
4
|
+
import { ContentKeySchema } from "#contracts/ids";
|
|
5
|
+
import { ArtifactLocaleSchema } from "#contracts/locale";
|
|
6
|
+
import { QuestionAnswerIdentitySchema, QuestionBodyKindSchema, QuestionKeySchema, QuestionPromptIdentitySchema, QuestionSetKeySchema, } from "#contracts/question/identity";
|
|
7
|
+
import { canonicalQuestionBlueprint, QuestionBlueprintSchema, QuestionItemSchema, questionResponseFor, } from "#contracts/question/item";
|
|
6
8
|
import { canonicalQuestionResponse, QuestionResponseSchema, } from "#contracts/question/response";
|
|
9
|
+
import { encodeJsonText } from "#contracts/text/json";
|
|
7
10
|
import { TryoutKeySchema } from "#contracts/tryout/key";
|
|
8
11
|
/** Exact metadata authored by every current question and answer body. */
|
|
9
12
|
export const QuestionMetadataSchema = withPublicationDates({
|
|
@@ -29,6 +32,17 @@ export const QuestionBodyProjectionSchema = Schema.Union([
|
|
|
29
32
|
QuestionPromptProjectionSchema,
|
|
30
33
|
QuestionAnswerProjectionSchema,
|
|
31
34
|
]);
|
|
35
|
+
const QuestionProjectionInputSchema = Schema.Struct({
|
|
36
|
+
artifactLocale: ArtifactLocaleSchema,
|
|
37
|
+
bodyKind: QuestionBodyKindSchema,
|
|
38
|
+
contentKey: ContentKeySchema,
|
|
39
|
+
item: QuestionItemSchema,
|
|
40
|
+
metadata: QuestionMetadataSchema,
|
|
41
|
+
peerContentKey: ContentKeySchema,
|
|
42
|
+
questionKey: QuestionKeySchema,
|
|
43
|
+
questionNumber: Schema.Finite,
|
|
44
|
+
setKey: QuestionSetKeySchema,
|
|
45
|
+
});
|
|
32
46
|
/** Shared identity and metadata carried by both question body projections. */
|
|
33
47
|
function questionProjectionFields(input) {
|
|
34
48
|
return {
|
|
@@ -77,7 +91,7 @@ export const makeQuestionBodyProjection = Effect.fn("AksaraContracts.makeQuestio
|
|
|
77
91
|
});
|
|
78
92
|
/** Serializes one question projection with stable signed field order. */
|
|
79
93
|
export function canonicalizeQuestionProjection(projection) {
|
|
80
|
-
return
|
|
94
|
+
return encodeJsonText({
|
|
81
95
|
bodyKind: projection.bodyKind,
|
|
82
96
|
...(projection.bodyKind === "question"
|
|
83
97
|
? { response: canonicalQuestionResponse(projection.response) }
|
|
@@ -36,10 +36,11 @@ declare const ProjectionDigestError_base: Schema.Class<ProjectionDigestError, Sc
|
|
|
36
36
|
/** The streamed projection digest differs from the signed manifest. */
|
|
37
37
|
export declare class ProjectionDigestError extends ProjectionDigestError_base {
|
|
38
38
|
}
|
|
39
|
+
declare const VerifiedContentProjectionsSchema: Schema.Struct<{
|
|
40
|
+
readonly count: Schema.Finite;
|
|
41
|
+
}>;
|
|
39
42
|
/** Count authenticated without retaining complete projection bodies. */
|
|
40
|
-
export
|
|
41
|
-
readonly count: number;
|
|
42
|
-
}
|
|
43
|
+
export type VerifiedContentProjections = typeof VerifiedContentProjectionsSchema.Type;
|
|
43
44
|
/** Strictly decodes a replayable canonical content projection stream. */
|
|
44
45
|
export declare function decodeContentProjections<E, R>(projections: Stream.Stream<unknown, E, R>): Stream.Stream<{
|
|
45
46
|
readonly appLocale: ("de" | "en" | "id") & import("effect/Brand").Brand<"@NakafaAI/AksaraAppLocale">;
|