@nakafa/aksara-contracts 0.43.0 → 0.45.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (77) hide show
  1. package/README.md +22 -1
  2. package/dist/math/resolution.js +1 -1
  3. package/dist/math/scene.js +1 -1
  4. package/dist/preview/artifact.d.ts +44 -0
  5. package/dist/preview/document.d.ts +36 -12
  6. package/dist/preview/spec.d.ts +196 -36
  7. package/dist/preview/target.d.ts +10 -3
  8. package/dist/program/snapshot/digest.d.ts +1 -1
  9. package/dist/program/snapshot/digest.js +1 -1
  10. package/dist/program/snapshot/hash.d.ts +153 -0
  11. package/dist/program/snapshot/hash.js +31 -0
  12. package/dist/projection/digest.d.ts +74 -22
  13. package/dist/projection/material.d.ts +10 -0
  14. package/dist/projection/material.js +15 -0
  15. package/dist/projection/question.d.ts +188 -0
  16. package/dist/projection/spec.d.ts +45 -0
  17. package/dist/projection/verify.d.ts +127 -75
  18. package/dist/question/answer.d.ts +149 -0
  19. package/dist/question/answer.js +248 -0
  20. package/dist/question/item.d.ts +276 -1
  21. package/dist/question/item.js +63 -38
  22. package/dist/question/label.d.ts +3 -0
  23. package/dist/question/label.js +3 -0
  24. package/dist/question/points.d.ts +18 -0
  25. package/dist/question/points.js +22 -0
  26. package/dist/question/response.d.ts +187 -5
  27. package/dist/question/response.js +41 -4
  28. package/dist/question/rubric.d.ts +234 -0
  29. package/dist/question/rubric.js +182 -0
  30. package/dist/release/rollback/spec.d.ts +264 -0
  31. package/dist/release/snapshot/data.d.ts +52 -3
  32. package/dist/release/snapshot/{program-evidence.d.ts → evidence/program.d.ts} +2 -2
  33. package/dist/release/snapshot/{program-evidence.js → evidence/program.js} +1 -1
  34. package/dist/release/snapshot/{quran-evidence.d.ts → evidence/quran.d.ts} +2 -2
  35. package/dist/release/snapshot/{quran-evidence.js → evidence/quran.js} +1 -1
  36. package/dist/release/snapshot/{tryout-evidence.d.ts → evidence/tryout.d.ts} +2 -2
  37. package/dist/release/snapshot/{tryout-evidence.js → evidence/tryout.js} +4 -4
  38. package/dist/release/snapshot/evidence.d.ts +2 -2
  39. package/dist/release/snapshot/evidence.js +3 -3
  40. package/dist/release/snapshot/verify.d.ts +88 -31
  41. package/dist/runtime/spec.d.ts +25 -22
  42. package/dist/runtime/verify.d.ts +46 -44
  43. package/dist/transport/batch.d.ts +88 -0
  44. package/dist/transport/group.d.ts +288 -9
  45. package/dist/transport/request.d.ts +1858 -1018
  46. package/dist/transport/response.d.ts +499 -131
  47. package/dist/transport/snapshot.d.ts +104 -6
  48. package/dist/tryout/catalog.d.ts +28 -10
  49. package/dist/tryout/catalog.js +6 -2
  50. package/dist/tryout/closure/accounting.d.ts +16 -0
  51. package/dist/tryout/closure/accounting.js +68 -0
  52. package/dist/tryout/closure/locale.d.ts +14 -0
  53. package/dist/tryout/{locale-closure.js → closure/locale.js} +13 -72
  54. package/dist/tryout/{placement-closure.js → closure/placement.js} +1 -0
  55. package/dist/tryout/{catalog-hash.d.ts → hash/catalog.d.ts} +25 -20
  56. package/dist/tryout/{catalog-hash.js → hash/catalog.js} +8 -1
  57. package/dist/tryout/{content-hash.d.ts → hash/content.d.ts} +43 -0
  58. package/dist/tryout/{placement-hash.d.ts → hash/placement.d.ts} +1 -1
  59. package/dist/tryout/{placement-hash.js → hash/placement.js} +2 -1
  60. package/dist/tryout/placement.d.ts +136 -1
  61. package/dist/tryout/placement.js +16 -2
  62. package/dist/tryout/scoring.d.ts +37 -0
  63. package/dist/tryout/scoring.js +89 -0
  64. package/dist/tryout/spec.d.ts +32 -4
  65. package/dist/tryout/spec.js +35 -4
  66. package/package.json +28 -20
  67. package/dist/program/snapshot/row-hash.d.ts +0 -155
  68. package/dist/program/snapshot/row-hash.js +0 -34
  69. package/dist/tryout/locale-closure.d.ts +0 -20
  70. /package/dist/math/{arc-precision.d.ts → arc.d.ts} +0 -0
  71. /package/dist/math/{arc-precision.js → arc.js} +0 -0
  72. /package/dist/release/snapshot/{evidence-requirement.d.ts → evidence/requirement.d.ts} +0 -0
  73. /package/dist/release/snapshot/{evidence-requirement.js → evidence/requirement.js} +0 -0
  74. /package/dist/tryout/{placement-closure.d.ts → closure/placement.d.ts} +0 -0
  75. /package/dist/tryout/{row-hash.d.ts → digest.d.ts} +0 -0
  76. /package/dist/tryout/{row-hash.js → digest.js} +0 -0
  77. /package/dist/tryout/{content-hash.js → hash/content.js} +0 -0
@@ -361,7 +361,7 @@ export declare const StageSnapshotBatchInputSchema: Schema.Struct<{
361
361
  readonly kind: Schema.Literal<"exam">;
362
362
  readonly order: Schema.Finite;
363
363
  readonly publicPath: Schema.brand<Schema.String, "@NakafaAI/AksaraPublicPath">;
364
- readonly scoringStrategy: Schema.Literals<readonly ["irt", "raw"]>;
364
+ readonly scoringStrategy: Schema.Literals<readonly ["irt", "penalized", "raw"]>;
365
365
  }>, Schema.Struct<{
366
366
  readonly appLocale: Schema.brand<Schema.Literals<readonly ["en", "id", "de"]>, "@NakafaAI/AksaraAppLocale">;
367
367
  readonly description: Schema.optional<Schema.String>;
@@ -383,7 +383,7 @@ export declare const StageSnapshotBatchInputSchema: Schema.Struct<{
383
383
  readonly sectionCount: Schema.Finite;
384
384
  readonly setCount: Schema.Finite;
385
385
  readonly trackKey: Schema.String;
386
- readonly trackKind: Schema.Literals<readonly ["subject", "year"]>;
386
+ readonly trackKind: Schema.Literals<readonly ["institution", "subject", "year"]>;
387
387
  readonly visibleSectionCount: Schema.Finite;
388
388
  }>, Schema.Struct<{
389
389
  readonly appLocale: Schema.brand<Schema.Literals<readonly ["en", "id", "de"]>, "@NakafaAI/AksaraAppLocale">;
@@ -404,7 +404,7 @@ export declare const StageSnapshotBatchInputSchema: Schema.Struct<{
404
404
  readonly order: Schema.Finite;
405
405
  readonly publicPath: Schema.brand<Schema.String, "@NakafaAI/AksaraPublicPath">;
406
406
  readonly questionCount: Schema.Finite;
407
- readonly scoringStrategy: Schema.Literals<readonly ["irt", "raw"]>;
407
+ readonly scoringStrategy: Schema.Literals<readonly ["irt", "penalized", "raw"]>;
408
408
  readonly sectionCount: Schema.Finite;
409
409
  readonly setKey: Schema.String;
410
410
  readonly trackKey: Schema.String;
@@ -424,6 +424,11 @@ export declare const StageSnapshotBatchInputSchema: Schema.Struct<{
424
424
  readonly countryKey: Schema.String;
425
425
  readonly examKey: Schema.String;
426
426
  readonly kind: Schema.Literal<"section">;
427
+ readonly marks: Schema.optionalKey<Schema.Struct<{
428
+ readonly blank: Schema.Int;
429
+ readonly correct: Schema.Int;
430
+ readonly wrong: Schema.Int;
431
+ }>>;
427
432
  readonly order: Schema.Finite;
428
433
  readonly publicPath: Schema.optional<Schema.brand<Schema.String, "@NakafaAI/AksaraPublicPath">>;
429
434
  readonly questionCount: Schema.Finite;
@@ -458,6 +463,7 @@ export declare const StageSnapshotBatchInputSchema: Schema.Struct<{
458
463
  readonly kind: Schema.Literal<"fixed">;
459
464
  readonly language: Schema.brand<Schema.Literals<readonly ["en", "id", "de"]>, "@NakafaAI/AksaraDeliveryLanguage">;
460
465
  }>]>;
466
+ readonly points: Schema.optionalKey<Schema.Int>;
461
467
  readonly questionArtifactLocale: Schema.brand<Schema.Literals<readonly ["en", "id", "de"]>, "@NakafaAI/AksaraArtifactLocale">;
462
468
  readonly questionContentKey: Schema.brand<Schema.String, "@NakafaAI/AksaraContentKey">;
463
469
  readonly questionOrder: Schema.Finite;
@@ -484,6 +490,49 @@ export declare const StageSnapshotBatchInputSchema: Schema.Struct<{
484
490
  readonly optionKey: Schema.String;
485
491
  readonly order: Schema.Int;
486
492
  }>>;
493
+ }>, Schema.Struct<{
494
+ readonly criteria: Schema.$Array<Schema.Struct<{
495
+ readonly criterionKey: Schema.String;
496
+ readonly finalAnswer: Schema.optionalKey<Schema.Union<readonly [Schema.Struct<{
497
+ readonly acceptsFractions: Schema.Boolean;
498
+ readonly kind: Schema.Literal<"number">;
499
+ readonly tolerance: Schema.optionalKey<Schema.Struct<{
500
+ readonly kind: Schema.Literals<readonly ["absolute", "relative"]>;
501
+ readonly value: Schema.String;
502
+ }>>;
503
+ readonly value: Schema.String;
504
+ }>, Schema.Struct<{
505
+ readonly acceptedAnswers: Schema.NonEmptyArray<Schema.Trimmed>;
506
+ readonly collapseWhitespace: Schema.Boolean;
507
+ readonly ignoreCase: Schema.Boolean;
508
+ readonly kind: Schema.Literal<"text">;
509
+ }>]>>;
510
+ readonly order: Schema.Int;
511
+ readonly label: Schema.$Record<Schema.Literals<readonly ["en", "id", "de"]>, Schema.String>;
512
+ readonly levels: Schema.$Array<Schema.Struct<{
513
+ readonly levelKey: Schema.String;
514
+ readonly order: Schema.Int;
515
+ readonly points: Schema.Int;
516
+ readonly label: Schema.$Record<Schema.Literals<readonly ["en", "id", "de"]>, Schema.String>;
517
+ }>>;
518
+ }>>;
519
+ readonly kind: Schema.Literal<"rubric">;
520
+ }>, Schema.Struct<{
521
+ readonly key: Schema.Union<readonly [Schema.Struct<{
522
+ readonly acceptsFractions: Schema.Boolean;
523
+ readonly kind: Schema.Literal<"number">;
524
+ readonly tolerance: Schema.optionalKey<Schema.Struct<{
525
+ readonly kind: Schema.Literals<readonly ["absolute", "relative"]>;
526
+ readonly value: Schema.String;
527
+ }>>;
528
+ readonly value: Schema.String;
529
+ }>, Schema.Struct<{
530
+ readonly acceptedAnswers: Schema.NonEmptyArray<Schema.Trimmed>;
531
+ readonly collapseWhitespace: Schema.Boolean;
532
+ readonly ignoreCase: Schema.Boolean;
533
+ readonly kind: Schema.Literal<"text">;
534
+ }>]>;
535
+ readonly kind: Schema.Literal<"short-answer">;
487
536
  }>, Schema.Struct<{
488
537
  readonly kind: Schema.Literal<"single-choice">;
489
538
  readonly options: Schema.$Array<Schema.Struct<{
@@ -751,7 +800,7 @@ export declare const StageSnapshotBatchRequestSchema: Schema.Struct<{
751
800
  readonly kind: Schema.Literal<"exam">;
752
801
  readonly order: Schema.Finite;
753
802
  readonly publicPath: Schema.brand<Schema.String, "@NakafaAI/AksaraPublicPath">;
754
- readonly scoringStrategy: Schema.Literals<readonly ["irt", "raw"]>;
803
+ readonly scoringStrategy: Schema.Literals<readonly ["irt", "penalized", "raw"]>;
755
804
  }>, Schema.Struct<{
756
805
  readonly appLocale: Schema.brand<Schema.Literals<readonly ["en", "id", "de"]>, "@NakafaAI/AksaraAppLocale">;
757
806
  readonly description: Schema.optional<Schema.String>;
@@ -773,7 +822,7 @@ export declare const StageSnapshotBatchRequestSchema: Schema.Struct<{
773
822
  readonly sectionCount: Schema.Finite;
774
823
  readonly setCount: Schema.Finite;
775
824
  readonly trackKey: Schema.String;
776
- readonly trackKind: Schema.Literals<readonly ["subject", "year"]>;
825
+ readonly trackKind: Schema.Literals<readonly ["institution", "subject", "year"]>;
777
826
  readonly visibleSectionCount: Schema.Finite;
778
827
  }>, Schema.Struct<{
779
828
  readonly appLocale: Schema.brand<Schema.Literals<readonly ["en", "id", "de"]>, "@NakafaAI/AksaraAppLocale">;
@@ -794,7 +843,7 @@ export declare const StageSnapshotBatchRequestSchema: Schema.Struct<{
794
843
  readonly order: Schema.Finite;
795
844
  readonly publicPath: Schema.brand<Schema.String, "@NakafaAI/AksaraPublicPath">;
796
845
  readonly questionCount: Schema.Finite;
797
- readonly scoringStrategy: Schema.Literals<readonly ["irt", "raw"]>;
846
+ readonly scoringStrategy: Schema.Literals<readonly ["irt", "penalized", "raw"]>;
798
847
  readonly sectionCount: Schema.Finite;
799
848
  readonly setKey: Schema.String;
800
849
  readonly trackKey: Schema.String;
@@ -814,6 +863,11 @@ export declare const StageSnapshotBatchRequestSchema: Schema.Struct<{
814
863
  readonly countryKey: Schema.String;
815
864
  readonly examKey: Schema.String;
816
865
  readonly kind: Schema.Literal<"section">;
866
+ readonly marks: Schema.optionalKey<Schema.Struct<{
867
+ readonly blank: Schema.Int;
868
+ readonly correct: Schema.Int;
869
+ readonly wrong: Schema.Int;
870
+ }>>;
817
871
  readonly order: Schema.Finite;
818
872
  readonly publicPath: Schema.optional<Schema.brand<Schema.String, "@NakafaAI/AksaraPublicPath">>;
819
873
  readonly questionCount: Schema.Finite;
@@ -848,6 +902,7 @@ export declare const StageSnapshotBatchRequestSchema: Schema.Struct<{
848
902
  readonly kind: Schema.Literal<"fixed">;
849
903
  readonly language: Schema.brand<Schema.Literals<readonly ["en", "id", "de"]>, "@NakafaAI/AksaraDeliveryLanguage">;
850
904
  }>]>;
905
+ readonly points: Schema.optionalKey<Schema.Int>;
851
906
  readonly questionArtifactLocale: Schema.brand<Schema.Literals<readonly ["en", "id", "de"]>, "@NakafaAI/AksaraArtifactLocale">;
852
907
  readonly questionContentKey: Schema.brand<Schema.String, "@NakafaAI/AksaraContentKey">;
853
908
  readonly questionOrder: Schema.Finite;
@@ -874,6 +929,49 @@ export declare const StageSnapshotBatchRequestSchema: Schema.Struct<{
874
929
  readonly optionKey: Schema.String;
875
930
  readonly order: Schema.Int;
876
931
  }>>;
932
+ }>, Schema.Struct<{
933
+ readonly criteria: Schema.$Array<Schema.Struct<{
934
+ readonly criterionKey: Schema.String;
935
+ readonly finalAnswer: Schema.optionalKey<Schema.Union<readonly [Schema.Struct<{
936
+ readonly acceptsFractions: Schema.Boolean;
937
+ readonly kind: Schema.Literal<"number">;
938
+ readonly tolerance: Schema.optionalKey<Schema.Struct<{
939
+ readonly kind: Schema.Literals<readonly ["absolute", "relative"]>;
940
+ readonly value: Schema.String;
941
+ }>>;
942
+ readonly value: Schema.String;
943
+ }>, Schema.Struct<{
944
+ readonly acceptedAnswers: Schema.NonEmptyArray<Schema.Trimmed>;
945
+ readonly collapseWhitespace: Schema.Boolean;
946
+ readonly ignoreCase: Schema.Boolean;
947
+ readonly kind: Schema.Literal<"text">;
948
+ }>]>>;
949
+ readonly order: Schema.Int;
950
+ readonly label: Schema.$Record<Schema.Literals<readonly ["en", "id", "de"]>, Schema.String>;
951
+ readonly levels: Schema.$Array<Schema.Struct<{
952
+ readonly levelKey: Schema.String;
953
+ readonly order: Schema.Int;
954
+ readonly points: Schema.Int;
955
+ readonly label: Schema.$Record<Schema.Literals<readonly ["en", "id", "de"]>, Schema.String>;
956
+ }>>;
957
+ }>>;
958
+ readonly kind: Schema.Literal<"rubric">;
959
+ }>, Schema.Struct<{
960
+ readonly key: Schema.Union<readonly [Schema.Struct<{
961
+ readonly acceptsFractions: Schema.Boolean;
962
+ readonly kind: Schema.Literal<"number">;
963
+ readonly tolerance: Schema.optionalKey<Schema.Struct<{
964
+ readonly kind: Schema.Literals<readonly ["absolute", "relative"]>;
965
+ readonly value: Schema.String;
966
+ }>>;
967
+ readonly value: Schema.String;
968
+ }>, Schema.Struct<{
969
+ readonly acceptedAnswers: Schema.NonEmptyArray<Schema.Trimmed>;
970
+ readonly collapseWhitespace: Schema.Boolean;
971
+ readonly ignoreCase: Schema.Boolean;
972
+ readonly kind: Schema.Literal<"text">;
973
+ }>]>;
974
+ readonly kind: Schema.Literal<"short-answer">;
877
975
  }>, Schema.Struct<{
878
976
  readonly kind: Schema.Literal<"single-choice">;
879
977
  readonly options: Schema.$Array<Schema.Struct<{
@@ -70,7 +70,7 @@ export declare const TryoutExamSchema: Schema.Struct<{
70
70
  readonly kind: Schema.Literal<"exam">;
71
71
  readonly order: Schema.Finite;
72
72
  readonly publicPath: Schema.brand<Schema.String, "@NakafaAI/AksaraPublicPath">;
73
- readonly scoringStrategy: Schema.Literals<readonly ["irt", "raw"]>;
73
+ readonly scoringStrategy: Schema.Literals<readonly ["irt", "penalized", "raw"]>;
74
74
  }>;
75
75
  export type TryoutExam = typeof TryoutExamSchema.Type;
76
76
  /** One localized track row with exact inventory counts. */
@@ -95,7 +95,7 @@ export declare const TryoutTrackSchema: Schema.Struct<{
95
95
  readonly sectionCount: Schema.Finite;
96
96
  readonly setCount: Schema.Finite;
97
97
  readonly trackKey: Schema.String;
98
- readonly trackKind: Schema.Literals<readonly ["subject", "year"]>;
98
+ readonly trackKind: Schema.Literals<readonly ["institution", "subject", "year"]>;
99
99
  readonly visibleSectionCount: Schema.Finite;
100
100
  }>;
101
101
  export type TryoutTrack = typeof TryoutTrackSchema.Type;
@@ -119,14 +119,17 @@ export declare const TryoutSetSchema: Schema.Struct<{
119
119
  readonly order: Schema.Finite;
120
120
  readonly publicPath: Schema.brand<Schema.String, "@NakafaAI/AksaraPublicPath">;
121
121
  readonly questionCount: Schema.Finite;
122
- readonly scoringStrategy: Schema.Literals<readonly ["irt", "raw"]>;
122
+ readonly scoringStrategy: Schema.Literals<readonly ["irt", "penalized", "raw"]>;
123
123
  readonly sectionCount: Schema.Finite;
124
124
  readonly setKey: Schema.String;
125
125
  readonly trackKey: Schema.String;
126
126
  readonly visibleSectionCount: Schema.Finite;
127
127
  }>;
128
128
  export type TryoutSet = typeof TryoutSetSchema.Type;
129
- /** One localized section row with source ownership. */
129
+ /**
130
+ * One localized section row with source ownership. A section of a penalized
131
+ * set carries the marks that score its questions; no other section has marks.
132
+ */
130
133
  export declare const TryoutSectionSchema: Schema.Struct<{
131
134
  readonly appLocale: Schema.brand<Schema.Literals<readonly ["en", "id", "de"]>, "@NakafaAI/AksaraAppLocale">;
132
135
  readonly description: Schema.optional<Schema.String>;
@@ -142,6 +145,11 @@ export declare const TryoutSectionSchema: Schema.Struct<{
142
145
  readonly countryKey: Schema.String;
143
146
  readonly examKey: Schema.String;
144
147
  readonly kind: Schema.Literal<"section">;
148
+ readonly marks: Schema.optionalKey<Schema.Struct<{
149
+ readonly blank: Schema.Int;
150
+ readonly correct: Schema.Int;
151
+ readonly wrong: Schema.Int;
152
+ }>>;
145
153
  readonly order: Schema.Finite;
146
154
  readonly publicPath: Schema.optional<Schema.brand<Schema.String, "@NakafaAI/AksaraPublicPath">>;
147
155
  readonly questionCount: Schema.Finite;
@@ -188,7 +196,7 @@ export declare const TryoutCatalogRowSchema: Schema.Union<readonly [Schema.Struc
188
196
  readonly kind: Schema.Literal<"exam">;
189
197
  readonly order: Schema.Finite;
190
198
  readonly publicPath: Schema.brand<Schema.String, "@NakafaAI/AksaraPublicPath">;
191
- readonly scoringStrategy: Schema.Literals<readonly ["irt", "raw"]>;
199
+ readonly scoringStrategy: Schema.Literals<readonly ["irt", "penalized", "raw"]>;
192
200
  }>, Schema.Struct<{
193
201
  readonly appLocale: Schema.brand<Schema.Literals<readonly ["en", "id", "de"]>, "@NakafaAI/AksaraAppLocale">;
194
202
  readonly description: Schema.optional<Schema.String>;
@@ -210,7 +218,7 @@ export declare const TryoutCatalogRowSchema: Schema.Union<readonly [Schema.Struc
210
218
  readonly sectionCount: Schema.Finite;
211
219
  readonly setCount: Schema.Finite;
212
220
  readonly trackKey: Schema.String;
213
- readonly trackKind: Schema.Literals<readonly ["subject", "year"]>;
221
+ readonly trackKind: Schema.Literals<readonly ["institution", "subject", "year"]>;
214
222
  readonly visibleSectionCount: Schema.Finite;
215
223
  }>, Schema.Struct<{
216
224
  readonly appLocale: Schema.brand<Schema.Literals<readonly ["en", "id", "de"]>, "@NakafaAI/AksaraAppLocale">;
@@ -231,7 +239,7 @@ export declare const TryoutCatalogRowSchema: Schema.Union<readonly [Schema.Struc
231
239
  readonly order: Schema.Finite;
232
240
  readonly publicPath: Schema.brand<Schema.String, "@NakafaAI/AksaraPublicPath">;
233
241
  readonly questionCount: Schema.Finite;
234
- readonly scoringStrategy: Schema.Literals<readonly ["irt", "raw"]>;
242
+ readonly scoringStrategy: Schema.Literals<readonly ["irt", "penalized", "raw"]>;
235
243
  readonly sectionCount: Schema.Finite;
236
244
  readonly setKey: Schema.String;
237
245
  readonly trackKey: Schema.String;
@@ -251,6 +259,11 @@ export declare const TryoutCatalogRowSchema: Schema.Union<readonly [Schema.Struc
251
259
  readonly countryKey: Schema.String;
252
260
  readonly examKey: Schema.String;
253
261
  readonly kind: Schema.Literal<"section">;
262
+ readonly marks: Schema.optionalKey<Schema.Struct<{
263
+ readonly blank: Schema.Int;
264
+ readonly correct: Schema.Int;
265
+ readonly wrong: Schema.Int;
266
+ }>>;
254
267
  readonly order: Schema.Finite;
255
268
  readonly publicPath: Schema.optional<Schema.brand<Schema.String, "@NakafaAI/AksaraPublicPath">>;
256
269
  readonly questionCount: Schema.Finite;
@@ -298,7 +311,7 @@ export declare const TryoutCatalogRecordSchema: Schema.Struct<{
298
311
  readonly kind: Schema.Literal<"exam">;
299
312
  readonly order: Schema.Finite;
300
313
  readonly publicPath: Schema.brand<Schema.String, "@NakafaAI/AksaraPublicPath">;
301
- readonly scoringStrategy: Schema.Literals<readonly ["irt", "raw"]>;
314
+ readonly scoringStrategy: Schema.Literals<readonly ["irt", "penalized", "raw"]>;
302
315
  }>, Schema.Struct<{
303
316
  readonly appLocale: Schema.brand<Schema.Literals<readonly ["en", "id", "de"]>, "@NakafaAI/AksaraAppLocale">;
304
317
  readonly description: Schema.optional<Schema.String>;
@@ -320,7 +333,7 @@ export declare const TryoutCatalogRecordSchema: Schema.Struct<{
320
333
  readonly sectionCount: Schema.Finite;
321
334
  readonly setCount: Schema.Finite;
322
335
  readonly trackKey: Schema.String;
323
- readonly trackKind: Schema.Literals<readonly ["subject", "year"]>;
336
+ readonly trackKind: Schema.Literals<readonly ["institution", "subject", "year"]>;
324
337
  readonly visibleSectionCount: Schema.Finite;
325
338
  }>, Schema.Struct<{
326
339
  readonly appLocale: Schema.brand<Schema.Literals<readonly ["en", "id", "de"]>, "@NakafaAI/AksaraAppLocale">;
@@ -341,7 +354,7 @@ export declare const TryoutCatalogRecordSchema: Schema.Struct<{
341
354
  readonly order: Schema.Finite;
342
355
  readonly publicPath: Schema.brand<Schema.String, "@NakafaAI/AksaraPublicPath">;
343
356
  readonly questionCount: Schema.Finite;
344
- readonly scoringStrategy: Schema.Literals<readonly ["irt", "raw"]>;
357
+ readonly scoringStrategy: Schema.Literals<readonly ["irt", "penalized", "raw"]>;
345
358
  readonly sectionCount: Schema.Finite;
346
359
  readonly setKey: Schema.String;
347
360
  readonly trackKey: Schema.String;
@@ -361,6 +374,11 @@ export declare const TryoutCatalogRecordSchema: Schema.Struct<{
361
374
  readonly countryKey: Schema.String;
362
375
  readonly examKey: Schema.String;
363
376
  readonly kind: Schema.Literal<"section">;
377
+ readonly marks: Schema.optionalKey<Schema.Struct<{
378
+ readonly blank: Schema.Int;
379
+ readonly correct: Schema.Int;
380
+ readonly wrong: Schema.Int;
381
+ }>>;
364
382
  readonly order: Schema.Finite;
365
383
  readonly publicPath: Schema.optional<Schema.brand<Schema.String, "@NakafaAI/AksaraPublicPath">>;
366
384
  readonly questionCount: Schema.Finite;
@@ -4,7 +4,7 @@ import { LearningGraphIdentitySchema } from "#contracts/graph/spec";
4
4
  import { CorpusSourcePathSchema, PublicPathSchema, Sha256HashSchema, } from "#contracts/ids";
5
5
  import { AppLocaleSchema } from "#contracts/locale";
6
6
  import { TryoutKeySchema } from "#contracts/tryout/key";
7
- import { TryoutScoringSchema, TryoutSourceRevisionSchema, TryoutTrackKindSchema, TryoutVisibilitySchema, } from "#contracts/tryout/spec";
7
+ import { TryoutMarksSchema, TryoutScoringSchema, TryoutSourceRevisionSchema, TryoutTrackKindSchema, TryoutVisibilitySchema, } from "#contracts/tryout/spec";
8
8
  const PositiveCountSchema = Schema.Finite.pipe(Schema.check(Schema.isInt()), Schema.check(Schema.isGreaterThan(0)));
9
9
  const NonNegativeCountSchema = Schema.Finite.pipe(Schema.check(Schema.isInt()), Schema.check(Schema.isGreaterThanOrEqualTo(0)));
10
10
  const LocalizedFields = {
@@ -115,11 +115,15 @@ export const TryoutSetSchema = Schema.Struct({
115
115
  }).pipe(Schema.check(Schema.makeFilter(({ internalEntrySectionKey, sectionCount, visibleSectionCount }) => internalEntrySectionKey === undefined
116
116
  ? visibleSectionCount === sectionCount
117
117
  : sectionCount === 1 && visibleSectionCount === 0, { message: "Set section counts do not match their visibility." })));
118
- /** One localized section row with source ownership. */
118
+ /**
119
+ * One localized section row with source ownership. A section of a penalized
120
+ * set carries the marks that score its questions; no other section has marks.
121
+ */
119
122
  export const TryoutSectionSchema = Schema.Struct({
120
123
  ...LocalizedFields,
121
124
  ...ParentFields,
122
125
  kind: Schema.Literal("section"),
126
+ marks: Schema.optionalKey(TryoutMarksSchema),
123
127
  order: PositiveCountSchema,
124
128
  publicPath: Schema.optional(PublicPathSchema),
125
129
  questionCount: PositiveCountSchema,
@@ -0,0 +1,16 @@
1
+ import { Effect, Schema } from "effect";
2
+ import type { ActiveAppLocaleList, AppLocale } from "#contracts/locale";
3
+ declare const TryoutClosureError_base: Schema.Class<TryoutClosureError, Schema.TaggedStruct<"TryoutClosureError", {
4
+ readonly actual: Schema.String;
5
+ readonly code: Schema.Literals<readonly ["assessed-language", "duplicate-locale", "fact-mismatch", "inactive-locale", "missing-locale", "missing-section", "question-count"]>;
6
+ readonly expected: Schema.String;
7
+ readonly identity: Schema.String;
8
+ }>, import("effect/Cause").YieldableError>;
9
+ /** A try-out snapshot is incomplete or inconsistent across app locales. */
10
+ export declare class TryoutClosureError extends TryoutClosureError_base {
11
+ }
12
+ /** Adds one active locale to a logical identity without duplicates. */
13
+ export declare function addLocale(localesByIdentity: Map<string, Set<AppLocale>>, activeAppLocales: ActiveAppLocaleList, identity: string, appLocale: AppLocale): Effect.Effect<void, never, never> | Effect.Effect<never, TryoutClosureError, never>;
14
+ /** Confirms every logical row closes over the exact active locale list. */
15
+ export declare function validateLocales(localesByIdentity: Map<string, Set<AppLocale>>, activeAppLocales: ActiveAppLocaleList): Effect.Effect<void, TryoutClosureError, never>;
16
+ export {};
@@ -0,0 +1,68 @@
1
+ import { Effect, Schema } from "effect";
2
+ /** A try-out snapshot is incomplete or inconsistent across app locales. */
3
+ export class TryoutClosureError extends Schema.TaggedError()("TryoutClosureError", {
4
+ actual: Schema.String,
5
+ code: Schema.Literals([
6
+ "assessed-language",
7
+ "duplicate-locale",
8
+ "fact-mismatch",
9
+ "inactive-locale",
10
+ "missing-locale",
11
+ "missing-section",
12
+ "question-count",
13
+ ]),
14
+ expected: Schema.String,
15
+ identity: Schema.String,
16
+ }) {
17
+ }
18
+ /** Serializes locale sets through the active list's signed canonical order. */
19
+ function localeSetIdentity(locales, activeAppLocales) {
20
+ return JSON.stringify(activeAppLocales.filter((locale) => locales.has(locale)));
21
+ }
22
+ /** Adds one active locale to a logical identity without duplicates. */
23
+ export function addLocale(localesByIdentity, activeAppLocales, identity, appLocale) {
24
+ if (!activeAppLocales.includes(appLocale)) {
25
+ return Effect.fail(new TryoutClosureError({
26
+ actual: appLocale,
27
+ code: "inactive-locale",
28
+ expected: JSON.stringify(activeAppLocales),
29
+ identity,
30
+ }));
31
+ }
32
+ const locales = localesByIdentity.get(identity) ?? new Set();
33
+ if (locales.has(appLocale)) {
34
+ return Effect.fail(new TryoutClosureError({
35
+ actual: appLocale,
36
+ code: "duplicate-locale",
37
+ expected: "one row per active app locale",
38
+ identity,
39
+ }));
40
+ }
41
+ locales.add(appLocale);
42
+ localesByIdentity.set(identity, locales);
43
+ return Effect.void;
44
+ }
45
+ /** Confirms every logical row closes over the exact active locale list. */
46
+ export function validateLocales(localesByIdentity, activeAppLocales) {
47
+ if (localesByIdentity.size === 0) {
48
+ return Effect.fail(new TryoutClosureError({
49
+ actual: "[]",
50
+ code: "missing-locale",
51
+ expected: JSON.stringify(activeAppLocales),
52
+ identity: "empty",
53
+ }));
54
+ }
55
+ return Effect.forEach(localesByIdentity, ([identity, locales]) => {
56
+ const actual = localeSetIdentity(locales, activeAppLocales);
57
+ const expected = JSON.stringify(activeAppLocales);
58
+ if (actual === expected) {
59
+ return Effect.void;
60
+ }
61
+ return Effect.fail(new TryoutClosureError({
62
+ actual,
63
+ code: "missing-locale",
64
+ expected,
65
+ identity,
66
+ }));
67
+ }, { discard: true });
68
+ }
@@ -0,0 +1,14 @@
1
+ import { Effect, Stream } from "effect";
2
+ import type { ActiveAppLocaleList } from "#contracts/locale";
3
+ import type { TryoutCatalogRecord } from "#contracts/tryout/catalog";
4
+ import { TryoutClosureError } from "#contracts/tryout/closure/accounting";
5
+ import type { TryoutPlacementRecord } from "#contracts/tryout/placement";
6
+ /**
7
+ * Verifies catalog facts, language policy, inventory, and scoring across app
8
+ * locales in one pass over each stream.
9
+ */
10
+ export declare const verifyTryoutLocaleClosure: <CatalogError, CatalogContext, PlacementError, PlacementContext>(input: {
11
+ readonly activeAppLocales: ActiveAppLocaleList;
12
+ readonly catalog: Stream.Stream<TryoutCatalogRecord, CatalogError, CatalogContext>;
13
+ readonly placements: Stream.Stream<TryoutPlacementRecord, PlacementError, PlacementContext>;
14
+ }) => Effect.Effect<void, CatalogError | PlacementError | TryoutClosureError | import("#contracts/tryout/scoring").TryoutScoringError, CatalogContext | PlacementContext>;
@@ -1,74 +1,9 @@
1
- import { Effect, Schema, Stream } from "effect";
2
- import { canonicalizeTryoutCatalogFacts, tryoutCatalogLogicalIdentity, tryoutSectionLogicalIdentity, } from "#contracts/tryout/catalog-hash";
1
+ import { Effect, Stream } from "effect";
2
+ import { addLocale, TryoutClosureError, validateLocales, } from "#contracts/tryout/closure/accounting";
3
+ import { canonicalizeAssessedLanguagePlacementFacts, canonicalizeLocaleNeutralPlacementFacts, } from "#contracts/tryout/closure/placement";
4
+ import { canonicalizeTryoutCatalogFacts, tryoutCatalogLogicalIdentity, tryoutSectionLogicalIdentity, } from "#contracts/tryout/hash/catalog";
3
5
  import { tryoutPlacementLogicalIdentity } from "#contracts/tryout/identity";
4
- import { canonicalizeAssessedLanguagePlacementFacts, canonicalizeLocaleNeutralPlacementFacts, } from "#contracts/tryout/placement-closure";
5
- /** A try-out snapshot is incomplete or inconsistent across app locales. */
6
- export class TryoutClosureError extends Schema.TaggedError()("TryoutClosureError", {
7
- actual: Schema.String,
8
- code: Schema.Literals([
9
- "assessed-language",
10
- "duplicate-locale",
11
- "fact-mismatch",
12
- "inactive-locale",
13
- "missing-locale",
14
- "missing-section",
15
- "question-count",
16
- ]),
17
- expected: Schema.String,
18
- identity: Schema.String,
19
- }) {
20
- }
21
- /** Serializes locale sets through the active list's signed canonical order. */
22
- function localeSetIdentity(locales, activeAppLocales) {
23
- return JSON.stringify(activeAppLocales.filter((locale) => locales.has(locale)));
24
- }
25
- /** Adds one active locale to a logical identity without duplicates. */
26
- function addLocale(localesByIdentity, activeAppLocales, identity, appLocale) {
27
- if (!activeAppLocales.includes(appLocale)) {
28
- return Effect.fail(new TryoutClosureError({
29
- actual: appLocale,
30
- code: "inactive-locale",
31
- expected: JSON.stringify(activeAppLocales),
32
- identity,
33
- }));
34
- }
35
- const locales = localesByIdentity.get(identity) ?? new Set();
36
- if (locales.has(appLocale)) {
37
- return Effect.fail(new TryoutClosureError({
38
- actual: appLocale,
39
- code: "duplicate-locale",
40
- expected: "one row per active app locale",
41
- identity,
42
- }));
43
- }
44
- locales.add(appLocale);
45
- localesByIdentity.set(identity, locales);
46
- return Effect.void;
47
- }
48
- /** Confirms every logical row closes over the exact active locale list. */
49
- function validateLocales(localesByIdentity, activeAppLocales) {
50
- if (localesByIdentity.size === 0) {
51
- return Effect.fail(new TryoutClosureError({
52
- actual: "[]",
53
- code: "missing-locale",
54
- expected: JSON.stringify(activeAppLocales),
55
- identity: "empty",
56
- }));
57
- }
58
- return Effect.forEach(localesByIdentity, ([identity, locales]) => {
59
- const actual = localeSetIdentity(locales, activeAppLocales);
60
- const expected = JSON.stringify(activeAppLocales);
61
- if (actual === expected) {
62
- return Effect.void;
63
- }
64
- return Effect.fail(new TryoutClosureError({
65
- actual,
66
- code: "missing-locale",
67
- expected,
68
- identity,
69
- }));
70
- }, { discard: true });
71
- }
6
+ import { makeTryoutScoringFacts, recordTryoutScoringFacts, validateTryoutPlacementScoring, validateTryoutScoringFacts, } from "#contracts/tryout/scoring";
72
7
  /** Adds one catalog row and compares its locale-neutral facts. */
73
8
  function addCatalogRow(state, activeAppLocales, row) {
74
9
  const identity = tryoutCatalogLogicalIdentity(row);
@@ -83,6 +18,7 @@ function addCatalogRow(state, activeAppLocales, row) {
83
18
  }));
84
19
  }
85
20
  state.factsByIdentity.set(identity, facts);
21
+ recordTryoutScoringFacts(state.scoring, row);
86
22
  if (row.kind === "section") {
87
23
  state.sections.set(identity, row.questionCount);
88
24
  }
@@ -127,7 +63,7 @@ function addPlacement(state, catalog, activeAppLocales, row) {
127
63
  }
128
64
  const sectionLocaleIdentity = `${sectionIdentity}\0${row.appLocale}`;
129
65
  state.countsBySectionLocale.set(sectionLocaleIdentity, (state.countsBySectionLocale.get(sectionLocaleIdentity) ?? 0) + 1);
130
- return addLocale(state.localesByIdentity, activeAppLocales, identity, row.appLocale).pipe(Effect.as(state));
66
+ return validateTryoutPlacementScoring(catalog.scoring, row).pipe(Effect.andThen(addLocale(state.localesByIdentity, activeAppLocales, identity, row.appLocale)), Effect.as(state));
131
67
  }
132
68
  /** Confirms each localized section owns its declared question inventory. */
133
69
  function validateQuestionCounts(catalog, placements, activeAppLocales) {
@@ -145,14 +81,19 @@ function validateQuestionCounts(catalog, placements, activeAppLocales) {
145
81
  }));
146
82
  }, { discard: true }), { discard: true });
147
83
  }
148
- /** Verifies catalog facts, language policy, and inventory across app locales. */
84
+ /**
85
+ * Verifies catalog facts, language policy, inventory, and scoring across app
86
+ * locales in one pass over each stream.
87
+ */
149
88
  export const verifyTryoutLocaleClosure = Effect.fn("AksaraContracts.verifyTryoutLocaleClosure")(function* (input) {
150
89
  const catalog = yield* input.catalog.pipe(Stream.runFoldEffect(() => ({
151
90
  factsByIdentity: new Map(),
152
91
  localesByIdentity: new Map(),
92
+ scoring: makeTryoutScoringFacts(),
153
93
  sections: new Map(),
154
94
  }), (state, record) => addCatalogRow(state, input.activeAppLocales, record.row)));
155
95
  yield* validateLocales(catalog.localesByIdentity, input.activeAppLocales);
96
+ yield* validateTryoutScoringFacts(catalog.scoring);
156
97
  const placements = yield* input.placements.pipe(Stream.runFoldEffect(() => ({
157
98
  assessedFacts: new Map(),
158
99
  countsBySectionLocale: new Map(),
@@ -19,6 +19,7 @@ export function canonicalizeLocaleNeutralPlacementFacts(row) {
19
19
  ? {}
20
20
  : { blueprint: canonicalQuestionBlueprint(row.blueprint) }),
21
21
  languagePolicy: canonicalAssessmentLanguagePolicy(row.languagePolicy),
22
+ ...(row.points === undefined ? {} : { points: row.points }),
22
23
  questionContentKey: row.questionContentKey,
23
24
  questionSourcePath: row.questionSourcePath,
24
25
  rendererDomain: row.rendererDomain,