@nakafa/aksara-contracts 1.0.0 → 2.0.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 (166) hide show
  1. package/README.md +15 -32
  2. package/dist/{question → assessment}/answer.d.ts +14 -58
  3. package/dist/{question → assessment}/answer.js +13 -60
  4. package/dist/assessment/catalog.d.ts +235 -0
  5. package/dist/assessment/catalog.js +115 -0
  6. package/dist/assessment/chart.d.ts +62 -0
  7. package/dist/assessment/chart.js +64 -0
  8. package/dist/assessment/closure.d.ts +28 -0
  9. package/dist/assessment/closure.js +164 -0
  10. package/dist/assessment/explanation.d.ts +13 -8
  11. package/dist/assessment/explanation.js +14 -8
  12. package/dist/assessment/figure.d.ts +140 -1
  13. package/dist/assessment/figure.js +9 -2
  14. package/dist/assessment/hash.d.ts +348 -208
  15. package/dist/assessment/hash.js +14 -0
  16. package/dist/assessment/inline.d.ts +3 -1
  17. package/dist/assessment/inline.js +20 -5
  18. package/dist/assessment/item.d.ts +8 -4
  19. package/dist/assessment/item.js +6 -2
  20. package/dist/assessment/key.js +6 -6
  21. package/dist/assessment/paper.d.ts +74 -74
  22. package/dist/assessment/snapshot.d.ts +3778 -0
  23. package/dist/assessment/snapshot.js +192 -0
  24. package/dist/cache/content.d.ts +4 -4
  25. package/dist/canonical.d.ts +6 -0
  26. package/dist/canonical.js +8 -1
  27. package/dist/content.d.ts +1 -1
  28. package/dist/content.js +0 -1
  29. package/dist/delivery.d.ts +0 -3
  30. package/dist/delivery.js +0 -5
  31. package/dist/preview/artifact.d.ts +1 -120
  32. package/dist/preview/document.d.ts +0 -586
  33. package/dist/preview/document.js +1 -47
  34. package/dist/preview/spec.d.ts +6 -1984
  35. package/dist/preview/spec.js +7 -47
  36. package/dist/preview/target.d.ts +0 -173
  37. package/dist/preview/target.js +1 -70
  38. package/dist/projection/digest.d.ts +0 -127
  39. package/dist/projection/hash.d.ts +0 -127
  40. package/dist/projection/spec.d.ts +6 -211
  41. package/dist/projection/spec.js +4 -18
  42. package/dist/projection/verify.d.ts +0 -127
  43. package/dist/projection/verify.js +0 -3
  44. package/dist/release/canonical.d.ts +2 -2
  45. package/dist/release/current/evidence.d.ts +24 -24
  46. package/dist/release/current/state.d.ts +28 -56
  47. package/dist/release/current/state.js +1 -6
  48. package/dist/release/digest.d.ts +2 -2
  49. package/dist/release/hash.d.ts +5 -5
  50. package/dist/release/head.d.ts +10 -57
  51. package/dist/release/head.js +3 -14
  52. package/dist/release/identity.d.ts +3 -3
  53. package/dist/release/items.d.ts +2 -2
  54. package/dist/release/lifecycle.d.ts +18 -18
  55. package/dist/release/policy.d.ts +3 -4
  56. package/dist/release/policy.js +2 -11
  57. package/dist/release/result/digest.d.ts +6 -18
  58. package/dist/release/result/digest.js +1 -2
  59. package/dist/release/rollback/digest.d.ts +4 -19
  60. package/dist/release/rollback/spec.d.ts +30 -792
  61. package/dist/release/rollback/spec.js +1 -4
  62. package/dist/release/snapshot/data.d.ts +599 -249
  63. package/dist/release/snapshot/data.js +11 -28
  64. package/dist/release/snapshot/evidence/assessment.d.ts +26 -0
  65. package/dist/release/snapshot/evidence/assessment.js +44 -0
  66. package/dist/release/snapshot/evidence/requirement.d.ts +1 -1
  67. package/dist/release/snapshot/evidence.d.ts +19 -19
  68. package/dist/release/snapshot/evidence.js +2 -2
  69. package/dist/release/snapshot/scope.d.ts +5 -5
  70. package/dist/release/snapshot/scope.js +1 -1
  71. package/dist/release/snapshot/spec.d.ts +15 -15
  72. package/dist/release/snapshot/spec.js +8 -8
  73. package/dist/release/snapshot/verify.d.ts +1278 -268
  74. package/dist/release/snapshot/verify.js +8 -5
  75. package/dist/release/spec.d.ts +33 -33
  76. package/dist/release/verify.d.ts +5 -5
  77. package/dist/runtime/spec.d.ts +38 -38
  78. package/dist/runtime/spec.js +4 -5
  79. package/dist/runtime/verify.d.ts +40 -40
  80. package/dist/signature/spec.d.ts +5 -5
  81. package/dist/signature/spec.js +0 -1
  82. package/dist/signature/trusted.d.ts +4 -1
  83. package/dist/signature/trusted.js +4 -1
  84. package/dist/transport/batch.d.ts +6 -244
  85. package/dist/transport/failure.d.ts +6 -20
  86. package/dist/transport/failure.js +0 -10
  87. package/dist/transport/group.d.ts +1969 -1369
  88. package/dist/transport/group.js +0 -2
  89. package/dist/transport/request.d.ts +10691 -5086
  90. package/dist/transport/request.js +0 -3
  91. package/dist/transport/response.d.ts +219 -1442
  92. package/dist/transport/response.js +0 -4
  93. package/dist/transport/snapshot.d.ts +1187 -487
  94. package/package.json +187 -295
  95. package/dist/projection/question.d.ts +0 -1067
  96. package/dist/projection/question.js +0 -121
  97. package/dist/question/identity.d.ts +0 -175
  98. package/dist/question/identity.js +0 -207
  99. package/dist/question/item.d.ts +0 -450
  100. package/dist/question/item.js +0 -174
  101. package/dist/question/label.d.ts +0 -3
  102. package/dist/question/label.js +0 -3
  103. package/dist/question/points.d.ts +0 -18
  104. package/dist/question/points.js +0 -22
  105. package/dist/question/response.d.ts +0 -289
  106. package/dist/question/response.js +0 -167
  107. package/dist/question/rubric.d.ts +0 -234
  108. package/dist/question/rubric.js +0 -186
  109. package/dist/release/current/runtime.d.ts +0 -4
  110. package/dist/release/current/runtime.js +0 -15
  111. package/dist/release/snapshot/evidence/tryout.d.ts +0 -22
  112. package/dist/release/snapshot/evidence/tryout.js +0 -91
  113. package/dist/runtime/protected/limits.d.ts +0 -10
  114. package/dist/runtime/protected/limits.js +0 -16
  115. package/dist/runtime/protected/spec.d.ts +0 -310
  116. package/dist/runtime/protected/spec.js +0 -80
  117. package/dist/runtime/protected/verify.d.ts +0 -83
  118. package/dist/runtime/protected/verify.js +0 -70
  119. package/dist/transport/runtime.d.ts +0 -77
  120. package/dist/transport/runtime.js +0 -33
  121. package/dist/tryout/canonical.d.ts +0 -12
  122. package/dist/tryout/canonical.js +0 -7
  123. package/dist/tryout/catalog.d.ts +0 -396
  124. package/dist/tryout/catalog.js +0 -155
  125. package/dist/tryout/closure/accounting.d.ts +0 -20
  126. package/dist/tryout/closure/accounting.js +0 -70
  127. package/dist/tryout/closure/locale.d.ts +0 -14
  128. package/dist/tryout/closure/locale.js +0 -113
  129. package/dist/tryout/closure/placement.d.ts +0 -5
  130. package/dist/tryout/closure/placement.js +0 -32
  131. package/dist/tryout/digest.d.ts +0 -34
  132. package/dist/tryout/digest.js +0 -57
  133. package/dist/tryout/hash/catalog.d.ts +0 -364
  134. package/dist/tryout/hash/catalog.js +0 -209
  135. package/dist/tryout/hash/content.d.ts +0 -215
  136. package/dist/tryout/hash/content.js +0 -75
  137. package/dist/tryout/hash/placement.d.ts +0 -242
  138. package/dist/tryout/hash/placement.js +0 -56
  139. package/dist/tryout/identity.d.ts +0 -12
  140. package/dist/tryout/identity.js +0 -47
  141. package/dist/tryout/key.d.ts +0 -4
  142. package/dist/tryout/key.js +0 -8
  143. package/dist/tryout/language.d.ts +0 -24
  144. package/dist/tryout/language.js +0 -30
  145. package/dist/tryout/placement.d.ts +0 -331
  146. package/dist/tryout/placement.js +0 -96
  147. package/dist/tryout/runtime/canonical.d.ts +0 -8
  148. package/dist/tryout/runtime/canonical.js +0 -34
  149. package/dist/tryout/runtime/hash.d.ts +0 -34
  150. package/dist/tryout/runtime/hash.js +0 -13
  151. package/dist/tryout/runtime/source.d.ts +0 -44
  152. package/dist/tryout/runtime/source.js +0 -47
  153. package/dist/tryout/runtime/spec.d.ts +0 -58
  154. package/dist/tryout/runtime/spec.js +0 -21
  155. package/dist/tryout/runtime/verify.d.ts +0 -69
  156. package/dist/tryout/runtime/verify.js +0 -67
  157. package/dist/tryout/scoring.d.ts +0 -148
  158. package/dist/tryout/scoring.js +0 -98
  159. package/dist/tryout/snapshot/canonical.d.ts +0 -7
  160. package/dist/tryout/snapshot/canonical.js +0 -18
  161. package/dist/tryout/snapshot/hash.d.ts +0 -49
  162. package/dist/tryout/snapshot/hash.js +0 -22
  163. package/dist/tryout/snapshot/spec.d.ts +0 -46
  164. package/dist/tryout/snapshot/spec.js +0 -30
  165. package/dist/tryout/spec.d.ts +0 -41
  166. package/dist/tryout/spec.js +0 -46
@@ -1,364 +0,0 @@
1
- import { Effect, type Stream } from "effect";
2
- import { type TryoutCatalogRow } from "#contracts/tryout/catalog";
3
- /** Compares localized hierarchy rows in their canonical digest order. */
4
- export declare function compareTryoutCatalog(left: TryoutCatalogRow, right: TryoutCatalogRow): -1 | 0 | 1;
5
- /** Builds one locale-neutral hierarchy identity for closure checks. */
6
- export declare function tryoutCatalogLogicalIdentity(row: TryoutCatalogRow): string;
7
- /** Builds the locale-neutral catalog identity of one section reference. */
8
- export declare function tryoutSectionLogicalIdentity(input: {
9
- readonly countryKey: string;
10
- readonly examKey: string;
11
- readonly sectionKey: string;
12
- readonly setKey: string;
13
- readonly trackKey: string;
14
- }): string;
15
- /** Serializes locale-neutral catalog facts for cross-locale closure checks. */
16
- export declare function canonicalizeTryoutCatalogFacts(row: TryoutCatalogRow): string;
17
- /** Serializes one current hierarchy row in stable field order. */
18
- export declare function canonicalizeTryoutCatalog(row: TryoutCatalogRow): string;
19
- /** Creates one authenticated current hierarchy record. */
20
- export declare const makeTryoutCatalogRecord: (row: {
21
- readonly appLocale: ("de" | "en" | "id") & import("effect/Brand").Brand<"@NakafaAI/AksaraAppLocale">;
22
- readonly description?: string | undefined;
23
- readonly graph: {
24
- readonly alignmentId: string;
25
- readonly assetId: string;
26
- readonly conceptId: string;
27
- readonly learningObjectId: string;
28
- readonly lensId: string;
29
- };
30
- readonly sourceRevision: string;
31
- readonly title: string;
32
- readonly countryKey: string;
33
- readonly examKey: string;
34
- readonly kind: "section";
35
- readonly marks?: {
36
- readonly blank: number;
37
- readonly correct: number;
38
- readonly wrong: number;
39
- };
40
- readonly order: number;
41
- readonly publicPath?: (string & import("effect/Brand").Brand<"@NakafaAI/AksaraPublicPath">) | undefined;
42
- readonly questionCount: number;
43
- readonly questionSourcePath: string & import("effect/Brand").Brand<"@NakafaAI/AksaraCorpusSourcePath">;
44
- readonly sectionKey: string;
45
- readonly setKey: string;
46
- readonly timeLimitSeconds: number;
47
- readonly trackKey: string;
48
- readonly visibility: "internal-entry" | "visible";
49
- } | {
50
- readonly appLocale: ("de" | "en" | "id") & import("effect/Brand").Brand<"@NakafaAI/AksaraAppLocale">;
51
- readonly description?: string | undefined;
52
- readonly graph: {
53
- readonly alignmentId: string;
54
- readonly assetId: string;
55
- readonly conceptId: string;
56
- readonly learningObjectId: string;
57
- readonly lensId: string;
58
- };
59
- readonly sourceRevision: string;
60
- readonly title: string;
61
- readonly countryKey: string;
62
- readonly examKey: string;
63
- readonly internalEntrySectionKey?: string | undefined;
64
- readonly kind: "set";
65
- readonly order: number;
66
- readonly publicPath: string & import("effect/Brand").Brand<"@NakafaAI/AksaraPublicPath">;
67
- readonly questionCount: number;
68
- readonly scoringStrategy: "irt" | "penalized" | "raw";
69
- readonly sectionCount: number;
70
- readonly setKey: string;
71
- readonly trackKey: string;
72
- readonly visibleSectionCount: number;
73
- } | {
74
- readonly appLocale: ("de" | "en" | "id") & import("effect/Brand").Brand<"@NakafaAI/AksaraAppLocale">;
75
- readonly description?: string | undefined;
76
- readonly graph: {
77
- readonly alignmentId: string;
78
- readonly assetId: string;
79
- readonly conceptId: string;
80
- readonly learningObjectId: string;
81
- readonly lensId: string;
82
- };
83
- readonly sourceRevision: string;
84
- readonly title: string;
85
- readonly countryKey: string;
86
- readonly examKey: string;
87
- readonly kind: "track";
88
- readonly order: number;
89
- readonly publicPath: string & import("effect/Brand").Brand<"@NakafaAI/AksaraPublicPath">;
90
- readonly questionCount: number;
91
- readonly sectionCount: number;
92
- readonly setCount: number;
93
- readonly trackKey: string;
94
- readonly trackKind: "institution" | "subject" | "year";
95
- readonly visibleSectionCount: number;
96
- } | {
97
- readonly appLocale: ("de" | "en" | "id") & import("effect/Brand").Brand<"@NakafaAI/AksaraAppLocale">;
98
- readonly description?: string | undefined;
99
- readonly graph: {
100
- readonly alignmentId: string;
101
- readonly assetId: string;
102
- readonly conceptId: string;
103
- readonly learningObjectId: string;
104
- readonly lensId: string;
105
- };
106
- readonly sourceRevision: string;
107
- readonly title: string;
108
- readonly countryKey: string;
109
- readonly examKey: string;
110
- readonly kind: "exam";
111
- readonly order: number;
112
- readonly publicPath: string & import("effect/Brand").Brand<"@NakafaAI/AksaraPublicPath">;
113
- readonly scoringStrategy: "irt" | "penalized" | "raw";
114
- } | {
115
- readonly appLocale: ("de" | "en" | "id") & import("effect/Brand").Brand<"@NakafaAI/AksaraAppLocale">;
116
- readonly description?: string | undefined;
117
- readonly graph: {
118
- readonly alignmentId: string;
119
- readonly assetId: string;
120
- readonly conceptId: string;
121
- readonly learningObjectId: string;
122
- readonly lensId: string;
123
- };
124
- readonly sourceRevision: string;
125
- readonly title: string;
126
- readonly countryCode: string;
127
- readonly countryKey: string;
128
- readonly kind: "country";
129
- readonly order: number;
130
- readonly publicPath: string & import("effect/Brand").Brand<"@NakafaAI/AksaraPublicPath">;
131
- }) => Effect.Effect<{
132
- readonly row: {
133
- readonly appLocale: ("de" | "en" | "id") & import("effect/Brand").Brand<"@NakafaAI/AksaraAppLocale">;
134
- readonly description?: string | undefined;
135
- readonly graph: {
136
- readonly alignmentId: string;
137
- readonly assetId: string;
138
- readonly conceptId: string;
139
- readonly learningObjectId: string;
140
- readonly lensId: string;
141
- };
142
- readonly sourceRevision: string;
143
- readonly title: string;
144
- readonly countryKey: string;
145
- readonly examKey: string;
146
- readonly kind: "section";
147
- readonly marks?: {
148
- readonly blank: number;
149
- readonly correct: number;
150
- readonly wrong: number;
151
- };
152
- readonly order: number;
153
- readonly publicPath?: (string & import("effect/Brand").Brand<"@NakafaAI/AksaraPublicPath">) | undefined;
154
- readonly questionCount: number;
155
- readonly questionSourcePath: string & import("effect/Brand").Brand<"@NakafaAI/AksaraCorpusSourcePath">;
156
- readonly sectionKey: string;
157
- readonly setKey: string;
158
- readonly timeLimitSeconds: number;
159
- readonly trackKey: string;
160
- readonly visibility: "internal-entry" | "visible";
161
- } | {
162
- readonly appLocale: ("de" | "en" | "id") & import("effect/Brand").Brand<"@NakafaAI/AksaraAppLocale">;
163
- readonly description?: string | undefined;
164
- readonly graph: {
165
- readonly alignmentId: string;
166
- readonly assetId: string;
167
- readonly conceptId: string;
168
- readonly learningObjectId: string;
169
- readonly lensId: string;
170
- };
171
- readonly sourceRevision: string;
172
- readonly title: string;
173
- readonly countryKey: string;
174
- readonly examKey: string;
175
- readonly internalEntrySectionKey?: string | undefined;
176
- readonly kind: "set";
177
- readonly order: number;
178
- readonly publicPath: string & import("effect/Brand").Brand<"@NakafaAI/AksaraPublicPath">;
179
- readonly questionCount: number;
180
- readonly scoringStrategy: "irt" | "penalized" | "raw";
181
- readonly sectionCount: number;
182
- readonly setKey: string;
183
- readonly trackKey: string;
184
- readonly visibleSectionCount: number;
185
- } | {
186
- readonly appLocale: ("de" | "en" | "id") & import("effect/Brand").Brand<"@NakafaAI/AksaraAppLocale">;
187
- readonly description?: string | undefined;
188
- readonly graph: {
189
- readonly alignmentId: string;
190
- readonly assetId: string;
191
- readonly conceptId: string;
192
- readonly learningObjectId: string;
193
- readonly lensId: string;
194
- };
195
- readonly sourceRevision: string;
196
- readonly title: string;
197
- readonly countryKey: string;
198
- readonly examKey: string;
199
- readonly kind: "track";
200
- readonly order: number;
201
- readonly publicPath: string & import("effect/Brand").Brand<"@NakafaAI/AksaraPublicPath">;
202
- readonly questionCount: number;
203
- readonly sectionCount: number;
204
- readonly setCount: number;
205
- readonly trackKey: string;
206
- readonly trackKind: "institution" | "subject" | "year";
207
- readonly visibleSectionCount: number;
208
- } | {
209
- readonly appLocale: ("de" | "en" | "id") & import("effect/Brand").Brand<"@NakafaAI/AksaraAppLocale">;
210
- readonly description?: string | undefined;
211
- readonly graph: {
212
- readonly alignmentId: string;
213
- readonly assetId: string;
214
- readonly conceptId: string;
215
- readonly learningObjectId: string;
216
- readonly lensId: string;
217
- };
218
- readonly sourceRevision: string;
219
- readonly title: string;
220
- readonly countryKey: string;
221
- readonly examKey: string;
222
- readonly kind: "exam";
223
- readonly order: number;
224
- readonly publicPath: string & import("effect/Brand").Brand<"@NakafaAI/AksaraPublicPath">;
225
- readonly scoringStrategy: "irt" | "penalized" | "raw";
226
- } | {
227
- readonly appLocale: ("de" | "en" | "id") & import("effect/Brand").Brand<"@NakafaAI/AksaraAppLocale">;
228
- readonly description?: string | undefined;
229
- readonly graph: {
230
- readonly alignmentId: string;
231
- readonly assetId: string;
232
- readonly conceptId: string;
233
- readonly learningObjectId: string;
234
- readonly lensId: string;
235
- };
236
- readonly sourceRevision: string;
237
- readonly title: string;
238
- readonly countryCode: string;
239
- readonly countryKey: string;
240
- readonly kind: "country";
241
- readonly order: number;
242
- readonly publicPath: string & import("effect/Brand").Brand<"@NakafaAI/AksaraPublicPath">;
243
- };
244
- readonly rowHash: string & import("effect/Brand").Brand<"@NakafaAI/AksaraSha256Hash">;
245
- }, import("#contracts/tryout/canonical").TryoutCanonicalHashError, never>;
246
- /** Digests canonically ordered current hierarchy records. */
247
- export declare const digestTryoutCatalog: <E, R>(records: Stream.Stream<{
248
- readonly row: {
249
- readonly appLocale: ("de" | "en" | "id") & import("effect/Brand").Brand<"@NakafaAI/AksaraAppLocale">;
250
- readonly description?: string | undefined;
251
- readonly graph: {
252
- readonly alignmentId: string;
253
- readonly assetId: string;
254
- readonly conceptId: string;
255
- readonly learningObjectId: string;
256
- readonly lensId: string;
257
- };
258
- readonly sourceRevision: string;
259
- readonly title: string;
260
- readonly countryKey: string;
261
- readonly examKey: string;
262
- readonly kind: "section";
263
- readonly marks?: {
264
- readonly blank: number;
265
- readonly correct: number;
266
- readonly wrong: number;
267
- };
268
- readonly order: number;
269
- readonly publicPath?: (string & import("effect/Brand").Brand<"@NakafaAI/AksaraPublicPath">) | undefined;
270
- readonly questionCount: number;
271
- readonly questionSourcePath: string & import("effect/Brand").Brand<"@NakafaAI/AksaraCorpusSourcePath">;
272
- readonly sectionKey: string;
273
- readonly setKey: string;
274
- readonly timeLimitSeconds: number;
275
- readonly trackKey: string;
276
- readonly visibility: "internal-entry" | "visible";
277
- } | {
278
- readonly appLocale: ("de" | "en" | "id") & import("effect/Brand").Brand<"@NakafaAI/AksaraAppLocale">;
279
- readonly description?: string | undefined;
280
- readonly graph: {
281
- readonly alignmentId: string;
282
- readonly assetId: string;
283
- readonly conceptId: string;
284
- readonly learningObjectId: string;
285
- readonly lensId: string;
286
- };
287
- readonly sourceRevision: string;
288
- readonly title: string;
289
- readonly countryKey: string;
290
- readonly examKey: string;
291
- readonly internalEntrySectionKey?: string | undefined;
292
- readonly kind: "set";
293
- readonly order: number;
294
- readonly publicPath: string & import("effect/Brand").Brand<"@NakafaAI/AksaraPublicPath">;
295
- readonly questionCount: number;
296
- readonly scoringStrategy: "irt" | "penalized" | "raw";
297
- readonly sectionCount: number;
298
- readonly setKey: string;
299
- readonly trackKey: string;
300
- readonly visibleSectionCount: number;
301
- } | {
302
- readonly appLocale: ("de" | "en" | "id") & import("effect/Brand").Brand<"@NakafaAI/AksaraAppLocale">;
303
- readonly description?: string | undefined;
304
- readonly graph: {
305
- readonly alignmentId: string;
306
- readonly assetId: string;
307
- readonly conceptId: string;
308
- readonly learningObjectId: string;
309
- readonly lensId: string;
310
- };
311
- readonly sourceRevision: string;
312
- readonly title: string;
313
- readonly countryKey: string;
314
- readonly examKey: string;
315
- readonly kind: "track";
316
- readonly order: number;
317
- readonly publicPath: string & import("effect/Brand").Brand<"@NakafaAI/AksaraPublicPath">;
318
- readonly questionCount: number;
319
- readonly sectionCount: number;
320
- readonly setCount: number;
321
- readonly trackKey: string;
322
- readonly trackKind: "institution" | "subject" | "year";
323
- readonly visibleSectionCount: number;
324
- } | {
325
- readonly appLocale: ("de" | "en" | "id") & import("effect/Brand").Brand<"@NakafaAI/AksaraAppLocale">;
326
- readonly description?: string | undefined;
327
- readonly graph: {
328
- readonly alignmentId: string;
329
- readonly assetId: string;
330
- readonly conceptId: string;
331
- readonly learningObjectId: string;
332
- readonly lensId: string;
333
- };
334
- readonly sourceRevision: string;
335
- readonly title: string;
336
- readonly countryKey: string;
337
- readonly examKey: string;
338
- readonly kind: "exam";
339
- readonly order: number;
340
- readonly publicPath: string & import("effect/Brand").Brand<"@NakafaAI/AksaraPublicPath">;
341
- readonly scoringStrategy: "irt" | "penalized" | "raw";
342
- } | {
343
- readonly appLocale: ("de" | "en" | "id") & import("effect/Brand").Brand<"@NakafaAI/AksaraAppLocale">;
344
- readonly description?: string | undefined;
345
- readonly graph: {
346
- readonly alignmentId: string;
347
- readonly assetId: string;
348
- readonly conceptId: string;
349
- readonly learningObjectId: string;
350
- readonly lensId: string;
351
- };
352
- readonly sourceRevision: string;
353
- readonly title: string;
354
- readonly countryCode: string;
355
- readonly countryKey: string;
356
- readonly kind: "country";
357
- readonly order: number;
358
- readonly publicPath: string & import("effect/Brand").Brand<"@NakafaAI/AksaraPublicPath">;
359
- };
360
- readonly rowHash: string & import("effect/Brand").Brand<"@NakafaAI/AksaraSha256Hash">;
361
- }, E, R>) => Effect.Effect<{
362
- count: number;
363
- digest: string & import("effect/Brand").Brand<"@NakafaAI/AksaraSha256Hash">;
364
- }, E | import("effect/PlatformError").PlatformError | import("#contracts/tryout/canonical").TryoutCanonicalHashError | import("#contracts/tryout/digest").TryoutDigestError, R>;
@@ -1,209 +0,0 @@
1
- import { Array as Arr, Effect } from "effect";
2
- import { canonicalizeLearningGraphIdentity } from "#contracts/graph/spec";
3
- import { encodeJsonText } from "#contracts/text/json";
4
- import { compareCodeUnits } from "#contracts/text/order";
5
- import { hashTryoutCanonical } from "#contracts/tryout/canonical";
6
- import { TryoutCatalogRecordSchema, } from "#contracts/tryout/catalog";
7
- import { digestTryoutRecords } from "#contracts/tryout/digest";
8
- import { tryoutCatalogIdentity } from "#contracts/tryout/identity";
9
- import { canonicalTryoutMarks } from "#contracts/tryout/spec";
10
- const CATALOG_DOMAIN = "nakafa.aksara.tryout-catalog";
11
- /** Includes an optional field without serializing absence as null. */
12
- function optionalField(key, value) {
13
- return value === undefined ? {} : { [key]: value };
14
- }
15
- /** Compares localized hierarchy rows in their canonical digest order. */
16
- export function compareTryoutCatalog(left, right) {
17
- return compareCodeUnits(tryoutCatalogIdentity(left), tryoutCatalogIdentity(right));
18
- }
19
- /** Builds one locale-neutral hierarchy identity for closure checks. */
20
- export function tryoutCatalogLogicalIdentity(row) {
21
- return Arr.join([
22
- row.kind,
23
- row.countryKey,
24
- "examKey" in row ? row.examKey : "",
25
- "trackKey" in row ? row.trackKey : "",
26
- "setKey" in row ? row.setKey : "",
27
- "sectionKey" in row ? row.sectionKey : "",
28
- ], "\0");
29
- }
30
- /** Builds the locale-neutral catalog identity of one section reference. */
31
- export function tryoutSectionLogicalIdentity(input) {
32
- return Arr.join([
33
- "section",
34
- input.countryKey,
35
- input.examKey,
36
- input.trackKey,
37
- input.setKey,
38
- input.sectionKey,
39
- ], "\0");
40
- }
41
- /** Serializes locale-neutral catalog facts for cross-locale closure checks. */
42
- export function canonicalizeTryoutCatalogFacts(row) {
43
- const graph = {
44
- alignmentId: row.graph.alignmentId,
45
- conceptId: row.graph.conceptId,
46
- learningObjectId: row.graph.learningObjectId,
47
- lensId: row.graph.lensId,
48
- };
49
- const shared = {
50
- graph,
51
- kind: row.kind,
52
- order: row.order,
53
- sourceRevision: row.sourceRevision,
54
- };
55
- if (row.kind === "country") {
56
- return encodeJsonText({
57
- ...shared,
58
- countryCode: row.countryCode,
59
- countryKey: row.countryKey,
60
- });
61
- }
62
- if (row.kind === "exam") {
63
- return encodeJsonText({
64
- ...shared,
65
- countryKey: row.countryKey,
66
- examKey: row.examKey,
67
- scoringStrategy: row.scoringStrategy,
68
- });
69
- }
70
- if (row.kind === "track") {
71
- return encodeJsonText({
72
- ...shared,
73
- countryKey: row.countryKey,
74
- examKey: row.examKey,
75
- questionCount: row.questionCount,
76
- sectionCount: row.sectionCount,
77
- setCount: row.setCount,
78
- trackKey: row.trackKey,
79
- trackKind: row.trackKind,
80
- visibleSectionCount: row.visibleSectionCount,
81
- });
82
- }
83
- if (row.kind === "set") {
84
- return encodeJsonText({
85
- ...shared,
86
- countryKey: row.countryKey,
87
- examKey: row.examKey,
88
- ...optionalField("internalEntrySectionKey", row.internalEntrySectionKey),
89
- questionCount: row.questionCount,
90
- scoringStrategy: row.scoringStrategy,
91
- sectionCount: row.sectionCount,
92
- setKey: row.setKey,
93
- trackKey: row.trackKey,
94
- visibleSectionCount: row.visibleSectionCount,
95
- });
96
- }
97
- return encodeJsonText({
98
- ...shared,
99
- countryKey: row.countryKey,
100
- examKey: row.examKey,
101
- ...(row.marks === undefined
102
- ? {}
103
- : { marks: canonicalTryoutMarks(row.marks) }),
104
- questionCount: row.questionCount,
105
- questionSourcePath: row.questionSourcePath,
106
- sectionKey: row.sectionKey,
107
- setKey: row.setKey,
108
- timeLimitSeconds: row.timeLimitSeconds,
109
- trackKey: row.trackKey,
110
- visibility: row.visibility,
111
- });
112
- }
113
- /** Serializes one current hierarchy row in stable field order. */
114
- export function canonicalizeTryoutCatalog(row) {
115
- const localized = {
116
- appLocale: row.appLocale,
117
- ...optionalField("description", row.description),
118
- graph: canonicalizeLearningGraphIdentity(row.graph),
119
- sourceRevision: row.sourceRevision,
120
- title: row.title,
121
- };
122
- if (row.kind === "country") {
123
- return encodeJsonText({
124
- ...localized,
125
- countryCode: row.countryCode,
126
- countryKey: row.countryKey,
127
- kind: row.kind,
128
- order: row.order,
129
- publicPath: row.publicPath,
130
- });
131
- }
132
- if (row.kind === "exam") {
133
- return encodeJsonText({
134
- ...localized,
135
- countryKey: row.countryKey,
136
- examKey: row.examKey,
137
- kind: row.kind,
138
- order: row.order,
139
- publicPath: row.publicPath,
140
- scoringStrategy: row.scoringStrategy,
141
- });
142
- }
143
- if (row.kind === "track") {
144
- return encodeJsonText({
145
- ...localized,
146
- countryKey: row.countryKey,
147
- examKey: row.examKey,
148
- kind: row.kind,
149
- order: row.order,
150
- publicPath: row.publicPath,
151
- questionCount: row.questionCount,
152
- sectionCount: row.sectionCount,
153
- setCount: row.setCount,
154
- trackKey: row.trackKey,
155
- trackKind: row.trackKind,
156
- visibleSectionCount: row.visibleSectionCount,
157
- });
158
- }
159
- if (row.kind === "set") {
160
- return encodeJsonText({
161
- ...localized,
162
- countryKey: row.countryKey,
163
- examKey: row.examKey,
164
- ...optionalField("internalEntrySectionKey", row.internalEntrySectionKey),
165
- kind: row.kind,
166
- order: row.order,
167
- publicPath: row.publicPath,
168
- questionCount: row.questionCount,
169
- scoringStrategy: row.scoringStrategy,
170
- sectionCount: row.sectionCount,
171
- setKey: row.setKey,
172
- trackKey: row.trackKey,
173
- visibleSectionCount: row.visibleSectionCount,
174
- });
175
- }
176
- return encodeJsonText({
177
- ...localized,
178
- countryKey: row.countryKey,
179
- examKey: row.examKey,
180
- kind: row.kind,
181
- ...(row.marks === undefined
182
- ? {}
183
- : { marks: canonicalTryoutMarks(row.marks) }),
184
- order: row.order,
185
- ...optionalField("publicPath", row.publicPath),
186
- questionCount: row.questionCount,
187
- questionSourcePath: row.questionSourcePath,
188
- sectionKey: row.sectionKey,
189
- setKey: row.setKey,
190
- timeLimitSeconds: row.timeLimitSeconds,
191
- trackKey: row.trackKey,
192
- visibility: row.visibility,
193
- });
194
- }
195
- /** Creates one authenticated current hierarchy record. */
196
- export const makeTryoutCatalogRecord = Effect.fn("AksaraContracts.makeTryoutCatalogRecord")(function* (row) {
197
- const rowHash = yield* hashTryoutCanonical(CATALOG_DOMAIN, canonicalizeTryoutCatalog(row));
198
- return TryoutCatalogRecordSchema.make({ row, rowHash });
199
- });
200
- /** Digests canonically ordered current hierarchy records. */
201
- export const digestTryoutCatalog = Effect.fn("AksaraContracts.digestTryoutCatalog")(function* (records) {
202
- return yield* digestTryoutRecords({
203
- canonicalize: canonicalizeTryoutCatalog,
204
- domain: CATALOG_DOMAIN,
205
- identity: tryoutCatalogIdentity,
206
- records,
207
- rowHash: (row) => makeTryoutCatalogRecord(row).pipe(Effect.map((record) => record.rowHash)),
208
- });
209
- });