@nakafa/aksara-contracts 0.27.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 (269) hide show
  1. package/LICENSE +185 -0
  2. package/README.md +73 -0
  3. package/dist/artifact/integrity.d.ts +29 -0
  4. package/dist/artifact/integrity.js +54 -0
  5. package/dist/artifact/limits.d.ts +26 -0
  6. package/dist/artifact/limits.js +46 -0
  7. package/dist/artifact/source.d.ts +21 -0
  8. package/dist/artifact/source.js +24 -0
  9. package/dist/artifact/spec.d.ts +148 -0
  10. package/dist/artifact/spec.js +92 -0
  11. package/dist/artifact/verify.d.ts +26 -0
  12. package/dist/artifact/verify.js +18 -0
  13. package/dist/cache/content.d.ts +52 -0
  14. package/dist/cache/content.js +80 -0
  15. package/dist/content.d.ts +168 -0
  16. package/dist/content.js +107 -0
  17. package/dist/country.d.ts +4 -0
  18. package/dist/country.js +8 -0
  19. package/dist/date.d.ts +24 -0
  20. package/dist/date.js +44 -0
  21. package/dist/decode.d.ts +4 -0
  22. package/dist/decode.js +8 -0
  23. package/dist/delivery.d.ts +4 -0
  24. package/dist/delivery.js +7 -0
  25. package/dist/errors.d.ts +10 -0
  26. package/dist/errors.js +8 -0
  27. package/dist/graph/family.d.ts +45 -0
  28. package/dist/graph/family.js +85 -0
  29. package/dist/graph/identity.d.ts +19 -0
  30. package/dist/graph/identity.js +39 -0
  31. package/dist/graph/spec.d.ts +20 -0
  32. package/dist/graph/spec.js +26 -0
  33. package/dist/hash/text.d.ts +10 -0
  34. package/dist/hash/text.js +20 -0
  35. package/dist/ids.d.ts +27 -0
  36. package/dist/ids.js +63 -0
  37. package/dist/limits.d.ts +10 -0
  38. package/dist/limits.js +10 -0
  39. package/dist/locale.d.ts +37 -0
  40. package/dist/locale.js +53 -0
  41. package/dist/material/domain.d.ts +4 -0
  42. package/dist/material/domain.js +8 -0
  43. package/dist/preview/artifact.d.ts +198 -0
  44. package/dist/preview/artifact.js +20 -0
  45. package/dist/preview/auth.d.ts +71 -0
  46. package/dist/preview/auth.js +49 -0
  47. package/dist/preview/document.d.ts +692 -0
  48. package/dist/preview/document.js +90 -0
  49. package/dist/preview/spec.d.ts +2517 -0
  50. package/dist/preview/spec.js +142 -0
  51. package/dist/preview/target.d.ts +172 -0
  52. package/dist/preview/target.js +70 -0
  53. package/dist/program/curriculum.d.ts +69 -0
  54. package/dist/program/curriculum.js +181 -0
  55. package/dist/program/snapshot/digest.d.ts +26 -0
  56. package/dist/program/snapshot/digest.js +220 -0
  57. package/dist/program/snapshot/hash.d.ts +31 -0
  58. package/dist/program/snapshot/hash.js +40 -0
  59. package/dist/program/snapshot/row-hash.d.ts +155 -0
  60. package/dist/program/snapshot/row-hash.js +34 -0
  61. package/dist/program/snapshot/row.d.ts +139 -0
  62. package/dist/program/snapshot/row.js +28 -0
  63. package/dist/program/snapshot/spec.d.ts +36 -0
  64. package/dist/program/snapshot/spec.js +39 -0
  65. package/dist/program/spec.d.ts +85 -0
  66. package/dist/program/spec.js +197 -0
  67. package/dist/projection/article.d.ts +145 -0
  68. package/dist/projection/article.js +150 -0
  69. package/dist/projection/digest.d.ts +261 -0
  70. package/dist/projection/digest.js +59 -0
  71. package/dist/projection/hash.d.ts +3 -0
  72. package/dist/projection/hash.js +10 -0
  73. package/dist/projection/material.d.ts +109 -0
  74. package/dist/projection/material.js +160 -0
  75. package/dist/projection/page.d.ts +112 -0
  76. package/dist/projection/page.js +106 -0
  77. package/dist/projection/question.d.ts +520 -0
  78. package/dist/projection/question.js +109 -0
  79. package/dist/projection/spec.d.ts +503 -0
  80. package/dist/projection/spec.js +56 -0
  81. package/dist/projection/verify.d.ts +281 -0
  82. package/dist/projection/verify.js +86 -0
  83. package/dist/question/identity.d.ts +175 -0
  84. package/dist/question/identity.js +205 -0
  85. package/dist/question/item.d.ts +453 -0
  86. package/dist/question/item.js +146 -0
  87. package/dist/question/response.d.ts +175 -0
  88. package/dist/question/response.js +150 -0
  89. package/dist/quran/attribution.d.ts +48 -0
  90. package/dist/quran/attribution.js +44 -0
  91. package/dist/quran/identity.d.ts +105 -0
  92. package/dist/quran/identity.js +100 -0
  93. package/dist/quran/notes.d.ts +56 -0
  94. package/dist/quran/notes.js +142 -0
  95. package/dist/quran/provenance.d.ts +257 -0
  96. package/dist/quran/provenance.js +144 -0
  97. package/dist/quran/snapshot/digest.d.ts +33 -0
  98. package/dist/quran/snapshot/digest.js +232 -0
  99. package/dist/quran/snapshot/hash.d.ts +51 -0
  100. package/dist/quran/snapshot/hash.js +50 -0
  101. package/dist/quran/snapshot/row/hash.d.ts +748 -0
  102. package/dist/quran/snapshot/row/hash.js +115 -0
  103. package/dist/quran/snapshot/row.d.ts +354 -0
  104. package/dist/quran/snapshot/row.js +91 -0
  105. package/dist/quran/snapshot/spec.d.ts +50 -0
  106. package/dist/quran/snapshot/spec.js +66 -0
  107. package/dist/quran/source.d.ts +206 -0
  108. package/dist/quran/source.js +153 -0
  109. package/dist/quran/spec.d.ts +47 -0
  110. package/dist/quran/spec.js +41 -0
  111. package/dist/quran/text.d.ts +7 -0
  112. package/dist/quran/text.js +11 -0
  113. package/dist/release/canonical.d.ts +23 -0
  114. package/dist/release/canonical.js +29 -0
  115. package/dist/release/current/evidence.d.ts +424 -0
  116. package/dist/release/current/evidence.js +41 -0
  117. package/dist/release/current/runtime.d.ts +4 -0
  118. package/dist/release/current/runtime.js +15 -0
  119. package/dist/release/current/state.d.ts +567 -0
  120. package/dist/release/current/state.js +91 -0
  121. package/dist/release/digest.d.ts +54 -0
  122. package/dist/release/digest.js +71 -0
  123. package/dist/release/hash.d.ts +72 -0
  124. package/dist/release/hash.js +14 -0
  125. package/dist/release/head.d.ts +206 -0
  126. package/dist/release/head.js +131 -0
  127. package/dist/release/items.d.ts +98 -0
  128. package/dist/release/items.js +114 -0
  129. package/dist/release/lifecycle.d.ts +297 -0
  130. package/dist/release/lifecycle.js +97 -0
  131. package/dist/release/origin.d.ts +30 -0
  132. package/dist/release/origin.js +24 -0
  133. package/dist/release/policy.d.ts +45 -0
  134. package/dist/release/policy.js +124 -0
  135. package/dist/release/result/digest.d.ts +127 -0
  136. package/dist/release/result/digest.js +140 -0
  137. package/dist/release/result/spec.d.ts +4 -0
  138. package/dist/release/result/spec.js +5 -0
  139. package/dist/release/rollback/digest.d.ts +126 -0
  140. package/dist/release/rollback/digest.js +92 -0
  141. package/dist/release/rollback/spec.d.ts +1729 -0
  142. package/dist/release/rollback/spec.js +156 -0
  143. package/dist/release/route/digest.d.ts +45 -0
  144. package/dist/release/route/digest.js +59 -0
  145. package/dist/release/route/page.d.ts +56 -0
  146. package/dist/release/route/page.js +46 -0
  147. package/dist/release/route/spec.d.ts +49 -0
  148. package/dist/release/route/spec.js +40 -0
  149. package/dist/release/route/verify.d.ts +66 -0
  150. package/dist/release/route/verify.js +67 -0
  151. package/dist/release/signing.d.ts +6 -0
  152. package/dist/release/signing.js +38 -0
  153. package/dist/release/snapshot/data.d.ts +475 -0
  154. package/dist/release/snapshot/data.js +74 -0
  155. package/dist/release/snapshot/evidence-requirement.d.ts +22 -0
  156. package/dist/release/snapshot/evidence-requirement.js +21 -0
  157. package/dist/release/snapshot/evidence.d.ts +58 -0
  158. package/dist/release/snapshot/evidence.js +14 -0
  159. package/dist/release/snapshot/program-evidence.d.ts +17 -0
  160. package/dist/release/snapshot/program-evidence.js +39 -0
  161. package/dist/release/snapshot/quran-evidence.d.ts +27 -0
  162. package/dist/release/snapshot/quran-evidence.js +43 -0
  163. package/dist/release/snapshot/scope.d.ts +60 -0
  164. package/dist/release/snapshot/scope.js +102 -0
  165. package/dist/release/snapshot/spec.d.ts +193 -0
  166. package/dist/release/snapshot/spec.js +139 -0
  167. package/dist/release/snapshot/tryout-evidence.d.ts +22 -0
  168. package/dist/release/snapshot/tryout-evidence.js +86 -0
  169. package/dist/release/snapshot/verify.d.ts +710 -0
  170. package/dist/release/snapshot/verify.js +147 -0
  171. package/dist/release/spec.d.ts +491 -0
  172. package/dist/release/spec.js +200 -0
  173. package/dist/release/verify.d.ts +98 -0
  174. package/dist/release/verify.js +70 -0
  175. package/dist/renderer/compatibility.d.ts +35 -0
  176. package/dist/renderer/compatibility.js +48 -0
  177. package/dist/renderer/component.d.ts +99 -0
  178. package/dist/renderer/component.js +102 -0
  179. package/dist/renderer/contract.d.ts +144 -0
  180. package/dist/renderer/contract.js +122 -0
  181. package/dist/renderer/domain.d.ts +6 -0
  182. package/dist/renderer/domain.js +18 -0
  183. package/dist/renderer/manifest.d.ts +86 -0
  184. package/dist/renderer/manifest.js +49 -0
  185. package/dist/renderer/selection.d.ts +39 -0
  186. package/dist/renderer/selection.js +87 -0
  187. package/dist/runtime/error.d.ts +8 -0
  188. package/dist/runtime/error.js +20 -0
  189. package/dist/runtime/protected/limits.d.ts +10 -0
  190. package/dist/runtime/protected/limits.js +15 -0
  191. package/dist/runtime/protected/spec.d.ts +328 -0
  192. package/dist/runtime/protected/spec.js +79 -0
  193. package/dist/runtime/protected/verify.d.ts +97 -0
  194. package/dist/runtime/protected/verify.js +72 -0
  195. package/dist/runtime/result.d.ts +12 -0
  196. package/dist/runtime/result.js +17 -0
  197. package/dist/runtime/spec.d.ts +705 -0
  198. package/dist/runtime/spec.js +61 -0
  199. package/dist/runtime/verify.d.ts +479 -0
  200. package/dist/runtime/verify.js +123 -0
  201. package/dist/signature/spec.d.ts +53 -0
  202. package/dist/signature/spec.js +29 -0
  203. package/dist/signature/trusted.d.ts +19 -0
  204. package/dist/signature/trusted.js +32 -0
  205. package/dist/signature/verify.d.ts +10 -0
  206. package/dist/signature/verify.js +82 -0
  207. package/dist/text/order.d.ts +2 -0
  208. package/dist/text/order.js +10 -0
  209. package/dist/text/syntax.d.ts +6 -0
  210. package/dist/text/syntax.js +15 -0
  211. package/dist/transport/batch.d.ts +971 -0
  212. package/dist/transport/batch.js +101 -0
  213. package/dist/transport/failure.d.ts +168 -0
  214. package/dist/transport/failure.js +194 -0
  215. package/dist/transport/group.d.ts +2946 -0
  216. package/dist/transport/group.js +47 -0
  217. package/dist/transport/limits.d.ts +30 -0
  218. package/dist/transport/limits.js +30 -0
  219. package/dist/transport/request.d.ts +9333 -0
  220. package/dist/transport/request.js +121 -0
  221. package/dist/transport/response.d.ts +6247 -0
  222. package/dist/transport/response.js +181 -0
  223. package/dist/transport/runtime.d.ts +77 -0
  224. package/dist/transport/runtime.js +33 -0
  225. package/dist/transport/snapshot.d.ts +978 -0
  226. package/dist/transport/snapshot.js +70 -0
  227. package/dist/tryout/canonical.d.ts +2 -0
  228. package/dist/tryout/canonical.js +11 -0
  229. package/dist/tryout/catalog-hash.d.ts +134 -0
  230. package/dist/tryout/catalog-hash.js +203 -0
  231. package/dist/tryout/catalog.d.ts +376 -0
  232. package/dist/tryout/catalog.js +147 -0
  233. package/dist/tryout/content-hash.d.ts +89 -0
  234. package/dist/tryout/content-hash.js +72 -0
  235. package/dist/tryout/identity.d.ts +12 -0
  236. package/dist/tryout/identity.js +46 -0
  237. package/dist/tryout/key.d.ts +4 -0
  238. package/dist/tryout/key.js +8 -0
  239. package/dist/tryout/language.d.ts +24 -0
  240. package/dist/tryout/language.js +32 -0
  241. package/dist/tryout/locale-closure.d.ts +20 -0
  242. package/dist/tryout/locale-closure.js +164 -0
  243. package/dist/tryout/placement-closure.d.ts +5 -0
  244. package/dist/tryout/placement-closure.js +30 -0
  245. package/dist/tryout/placement-hash.d.ts +11 -0
  246. package/dist/tryout/placement-hash.js +55 -0
  247. package/dist/tryout/placement.d.ts +280 -0
  248. package/dist/tryout/placement.js +82 -0
  249. package/dist/tryout/row-hash.d.ts +28 -0
  250. package/dist/tryout/row-hash.js +50 -0
  251. package/dist/tryout/runtime/canonical.d.ts +8 -0
  252. package/dist/tryout/runtime/canonical.js +33 -0
  253. package/dist/tryout/runtime/hash.d.ts +32 -0
  254. package/dist/tryout/runtime/hash.js +11 -0
  255. package/dist/tryout/runtime/source.d.ts +42 -0
  256. package/dist/tryout/runtime/source.js +47 -0
  257. package/dist/tryout/runtime/spec.d.ts +58 -0
  258. package/dist/tryout/runtime/spec.js +21 -0
  259. package/dist/tryout/runtime/verify.d.ts +61 -0
  260. package/dist/tryout/runtime/verify.js +69 -0
  261. package/dist/tryout/snapshot/canonical.d.ts +7 -0
  262. package/dist/tryout/snapshot/canonical.js +17 -0
  263. package/dist/tryout/snapshot/hash.d.ts +8 -0
  264. package/dist/tryout/snapshot/hash.js +19 -0
  265. package/dist/tryout/snapshot/spec.d.ts +46 -0
  266. package/dist/tryout/snapshot/spec.js +30 -0
  267. package/dist/tryout/spec.d.ts +13 -0
  268. package/dist/tryout/spec.js +15 -0
  269. package/package.json +506 -0
@@ -0,0 +1,520 @@
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
+ /** Exact metadata authored by every current question and answer body. */
7
+ export declare const QuestionMetadataSchema: Schema.Struct<{
8
+ readonly dateModified: Schema.optionalKey<Schema.String>;
9
+ readonly datePublished: Schema.String;
10
+ readonly authors: Schema.$Array<Schema.Struct<{
11
+ readonly name: Schema.String;
12
+ }>>;
13
+ readonly title: Schema.String;
14
+ }>;
15
+ export type QuestionMetadata = typeof QuestionMetadataSchema.Type;
16
+ /** Published body and localized response for one authored question prompt. */
17
+ export declare const QuestionPromptProjectionSchema: Schema.Struct<{
18
+ readonly artifactLocale: Schema.brand<Schema.Literals<readonly ["en", "id", "de"]>, "@NakafaAI/AksaraArtifactLocale">;
19
+ readonly contentKey: Schema.brand<Schema.String, "@NakafaAI/AksaraContentKey">;
20
+ readonly peerContentKey: Schema.brand<Schema.String, "@NakafaAI/AksaraContentKey">;
21
+ readonly questionKey: Schema.brand<Schema.String, "@NakafaAI/AksaraQuestionKey">;
22
+ readonly questionNumber: Schema.Finite;
23
+ readonly setKey: Schema.brand<Schema.String, "@NakafaAI/AksaraQuestionSetKey">;
24
+ readonly bodyKind: Schema.Literal<"question">;
25
+ readonly blueprint: Schema.optionalKey<Schema.Struct<{
26
+ readonly cognitiveLevel: Schema.String;
27
+ readonly contentDomain: Schema.String;
28
+ readonly topic: Schema.String;
29
+ }>>;
30
+ readonly kind: Schema.Literal<"question-body">;
31
+ readonly metadata: Schema.Struct<{
32
+ readonly dateModified: Schema.optionalKey<Schema.String>;
33
+ readonly datePublished: Schema.String;
34
+ readonly authors: Schema.$Array<Schema.Struct<{
35
+ readonly name: Schema.String;
36
+ }>>;
37
+ readonly title: Schema.String;
38
+ }>;
39
+ readonly stimulusKey: Schema.optionalKey<Schema.String>;
40
+ readonly response: Schema.Union<readonly [Schema.Struct<{
41
+ readonly categories: Schema.$Array<Schema.Struct<{
42
+ readonly categoryKey: Schema.String;
43
+ readonly label: Schema.NonEmptyArray<Schema.Union<readonly [Schema.Struct<{
44
+ readonly display: Schema.Literals<readonly ["block", "inline"]>;
45
+ readonly kind: Schema.Literal<"math">;
46
+ readonly math: Schema.String;
47
+ }>, Schema.Struct<{
48
+ readonly kind: Schema.Literal<"text">;
49
+ readonly text: Schema.String;
50
+ }>]>>;
51
+ readonly order: Schema.Int;
52
+ }>>;
53
+ readonly kind: Schema.Literal<"category">;
54
+ readonly statements: Schema.$Array<Schema.Struct<{
55
+ readonly correctCategoryKey: Schema.String;
56
+ readonly label: Schema.NonEmptyArray<Schema.Union<readonly [Schema.Struct<{
57
+ readonly display: Schema.Literals<readonly ["block", "inline"]>;
58
+ readonly kind: Schema.Literal<"math">;
59
+ readonly math: Schema.String;
60
+ }>, Schema.Struct<{
61
+ readonly kind: Schema.Literal<"text">;
62
+ readonly text: Schema.String;
63
+ }>]>>;
64
+ readonly order: Schema.Int;
65
+ readonly statementKey: Schema.String;
66
+ }>>;
67
+ }>, Schema.Struct<{
68
+ readonly kind: Schema.Literal<"multiple-choice">;
69
+ readonly options: Schema.$Array<Schema.Struct<{
70
+ readonly isCorrect: Schema.Boolean;
71
+ readonly label: Schema.NonEmptyArray<Schema.Union<readonly [Schema.Struct<{
72
+ readonly display: Schema.Literals<readonly ["block", "inline"]>;
73
+ readonly kind: Schema.Literal<"math">;
74
+ readonly math: Schema.String;
75
+ }>, Schema.Struct<{
76
+ readonly kind: Schema.Literal<"text">;
77
+ readonly text: Schema.String;
78
+ }>]>>;
79
+ readonly optionKey: Schema.String;
80
+ readonly order: Schema.Int;
81
+ }>>;
82
+ }>, Schema.Struct<{
83
+ readonly kind: Schema.Literal<"single-choice">;
84
+ readonly options: Schema.$Array<Schema.Struct<{
85
+ readonly isCorrect: Schema.Boolean;
86
+ readonly label: Schema.NonEmptyArray<Schema.Union<readonly [Schema.Struct<{
87
+ readonly display: Schema.Literals<readonly ["block", "inline"]>;
88
+ readonly kind: Schema.Literal<"math">;
89
+ readonly math: Schema.String;
90
+ }>, Schema.Struct<{
91
+ readonly kind: Schema.Literal<"text">;
92
+ readonly text: Schema.String;
93
+ }>]>>;
94
+ readonly optionKey: Schema.String;
95
+ readonly order: Schema.Int;
96
+ }>>;
97
+ }>]>;
98
+ }>;
99
+ export type QuestionPromptProjection = typeof QuestionPromptProjectionSchema.Type;
100
+ /** Published body for one entitled answer without a duplicated response. */
101
+ export declare const QuestionAnswerProjectionSchema: Schema.Struct<{
102
+ readonly artifactLocale: Schema.brand<Schema.Literals<readonly ["en", "id", "de"]>, "@NakafaAI/AksaraArtifactLocale">;
103
+ readonly contentKey: Schema.brand<Schema.String, "@NakafaAI/AksaraContentKey">;
104
+ readonly peerContentKey: Schema.brand<Schema.String, "@NakafaAI/AksaraContentKey">;
105
+ readonly questionKey: Schema.brand<Schema.String, "@NakafaAI/AksaraQuestionKey">;
106
+ readonly questionNumber: Schema.Finite;
107
+ readonly setKey: Schema.brand<Schema.String, "@NakafaAI/AksaraQuestionSetKey">;
108
+ readonly bodyKind: Schema.Literal<"answer">;
109
+ readonly blueprint: Schema.optionalKey<Schema.Struct<{
110
+ readonly cognitiveLevel: Schema.String;
111
+ readonly contentDomain: Schema.String;
112
+ readonly topic: Schema.String;
113
+ }>>;
114
+ readonly kind: Schema.Literal<"question-body">;
115
+ readonly metadata: Schema.Struct<{
116
+ readonly dateModified: Schema.optionalKey<Schema.String>;
117
+ readonly datePublished: Schema.String;
118
+ readonly authors: Schema.$Array<Schema.Struct<{
119
+ readonly name: Schema.String;
120
+ }>>;
121
+ readonly title: Schema.String;
122
+ }>;
123
+ readonly stimulusKey: Schema.optionalKey<Schema.String>;
124
+ }>;
125
+ export type QuestionAnswerProjection = typeof QuestionAnswerProjectionSchema.Type;
126
+ /** Complete non-route projection vocabulary for question-bank MDX bodies. */
127
+ export declare const QuestionBodyProjectionSchema: Schema.Union<readonly [Schema.Struct<{
128
+ readonly artifactLocale: Schema.brand<Schema.Literals<readonly ["en", "id", "de"]>, "@NakafaAI/AksaraArtifactLocale">;
129
+ readonly contentKey: Schema.brand<Schema.String, "@NakafaAI/AksaraContentKey">;
130
+ readonly peerContentKey: Schema.brand<Schema.String, "@NakafaAI/AksaraContentKey">;
131
+ readonly questionKey: Schema.brand<Schema.String, "@NakafaAI/AksaraQuestionKey">;
132
+ readonly questionNumber: Schema.Finite;
133
+ readonly setKey: Schema.brand<Schema.String, "@NakafaAI/AksaraQuestionSetKey">;
134
+ readonly bodyKind: Schema.Literal<"question">;
135
+ readonly blueprint: Schema.optionalKey<Schema.Struct<{
136
+ readonly cognitiveLevel: Schema.String;
137
+ readonly contentDomain: Schema.String;
138
+ readonly topic: Schema.String;
139
+ }>>;
140
+ readonly kind: Schema.Literal<"question-body">;
141
+ readonly metadata: Schema.Struct<{
142
+ readonly dateModified: Schema.optionalKey<Schema.String>;
143
+ readonly datePublished: Schema.String;
144
+ readonly authors: Schema.$Array<Schema.Struct<{
145
+ readonly name: Schema.String;
146
+ }>>;
147
+ readonly title: Schema.String;
148
+ }>;
149
+ readonly stimulusKey: Schema.optionalKey<Schema.String>;
150
+ readonly response: Schema.Union<readonly [Schema.Struct<{
151
+ readonly categories: Schema.$Array<Schema.Struct<{
152
+ readonly categoryKey: Schema.String;
153
+ readonly label: Schema.NonEmptyArray<Schema.Union<readonly [Schema.Struct<{
154
+ readonly display: Schema.Literals<readonly ["block", "inline"]>;
155
+ readonly kind: Schema.Literal<"math">;
156
+ readonly math: Schema.String;
157
+ }>, Schema.Struct<{
158
+ readonly kind: Schema.Literal<"text">;
159
+ readonly text: Schema.String;
160
+ }>]>>;
161
+ readonly order: Schema.Int;
162
+ }>>;
163
+ readonly kind: Schema.Literal<"category">;
164
+ readonly statements: Schema.$Array<Schema.Struct<{
165
+ readonly correctCategoryKey: Schema.String;
166
+ readonly label: Schema.NonEmptyArray<Schema.Union<readonly [Schema.Struct<{
167
+ readonly display: Schema.Literals<readonly ["block", "inline"]>;
168
+ readonly kind: Schema.Literal<"math">;
169
+ readonly math: Schema.String;
170
+ }>, Schema.Struct<{
171
+ readonly kind: Schema.Literal<"text">;
172
+ readonly text: Schema.String;
173
+ }>]>>;
174
+ readonly order: Schema.Int;
175
+ readonly statementKey: Schema.String;
176
+ }>>;
177
+ }>, Schema.Struct<{
178
+ readonly kind: Schema.Literal<"multiple-choice">;
179
+ readonly options: Schema.$Array<Schema.Struct<{
180
+ readonly isCorrect: Schema.Boolean;
181
+ readonly label: Schema.NonEmptyArray<Schema.Union<readonly [Schema.Struct<{
182
+ readonly display: Schema.Literals<readonly ["block", "inline"]>;
183
+ readonly kind: Schema.Literal<"math">;
184
+ readonly math: Schema.String;
185
+ }>, Schema.Struct<{
186
+ readonly kind: Schema.Literal<"text">;
187
+ readonly text: Schema.String;
188
+ }>]>>;
189
+ readonly optionKey: Schema.String;
190
+ readonly order: Schema.Int;
191
+ }>>;
192
+ }>, Schema.Struct<{
193
+ readonly kind: Schema.Literal<"single-choice">;
194
+ readonly options: Schema.$Array<Schema.Struct<{
195
+ readonly isCorrect: Schema.Boolean;
196
+ readonly label: Schema.NonEmptyArray<Schema.Union<readonly [Schema.Struct<{
197
+ readonly display: Schema.Literals<readonly ["block", "inline"]>;
198
+ readonly kind: Schema.Literal<"math">;
199
+ readonly math: Schema.String;
200
+ }>, Schema.Struct<{
201
+ readonly kind: Schema.Literal<"text">;
202
+ readonly text: Schema.String;
203
+ }>]>>;
204
+ readonly optionKey: Schema.String;
205
+ readonly order: Schema.Int;
206
+ }>>;
207
+ }>]>;
208
+ }>, Schema.Struct<{
209
+ readonly artifactLocale: Schema.brand<Schema.Literals<readonly ["en", "id", "de"]>, "@NakafaAI/AksaraArtifactLocale">;
210
+ readonly contentKey: Schema.brand<Schema.String, "@NakafaAI/AksaraContentKey">;
211
+ readonly peerContentKey: Schema.brand<Schema.String, "@NakafaAI/AksaraContentKey">;
212
+ readonly questionKey: Schema.brand<Schema.String, "@NakafaAI/AksaraQuestionKey">;
213
+ readonly questionNumber: Schema.Finite;
214
+ readonly setKey: Schema.brand<Schema.String, "@NakafaAI/AksaraQuestionSetKey">;
215
+ readonly bodyKind: Schema.Literal<"answer">;
216
+ readonly blueprint: Schema.optionalKey<Schema.Struct<{
217
+ readonly cognitiveLevel: Schema.String;
218
+ readonly contentDomain: Schema.String;
219
+ readonly topic: Schema.String;
220
+ }>>;
221
+ readonly kind: Schema.Literal<"question-body">;
222
+ readonly metadata: Schema.Struct<{
223
+ readonly dateModified: Schema.optionalKey<Schema.String>;
224
+ readonly datePublished: Schema.String;
225
+ readonly authors: Schema.$Array<Schema.Struct<{
226
+ readonly name: Schema.String;
227
+ }>>;
228
+ readonly title: Schema.String;
229
+ }>;
230
+ readonly stimulusKey: Schema.optionalKey<Schema.String>;
231
+ }>]>;
232
+ export type QuestionBodyProjection = typeof QuestionBodyProjectionSchema.Type;
233
+ interface QuestionProjectionInput {
234
+ readonly artifactLocale: typeof ArtifactLocaleSchema.Type;
235
+ readonly bodyKind: QuestionBodyKind;
236
+ readonly contentKey: typeof ContentKeySchema.Type;
237
+ readonly item: QuestionItem;
238
+ readonly metadata: QuestionMetadata;
239
+ readonly peerContentKey: typeof ContentKeySchema.Type;
240
+ readonly questionKey: QuestionKey;
241
+ readonly questionNumber: number;
242
+ readonly setKey: QuestionSetKey;
243
+ }
244
+ /** Builds one prompt projection with its exact-locale frozen response. */
245
+ export declare const makeQuestionPromptProjection: (input: QuestionProjectionInput & {
246
+ readonly bodyKind: "question";
247
+ }) => Effect.Effect<{
248
+ artifactLocale: ("de" | "en" | "id") & import("effect/Brand").Brand<"@NakafaAI/AksaraArtifactLocale">;
249
+ contentKey: string & import("effect/Brand").Brand<"@NakafaAI/AksaraContentKey">;
250
+ metadata: {
251
+ readonly dateModified?: string;
252
+ readonly datePublished: string;
253
+ readonly authors: readonly {
254
+ readonly name: string;
255
+ }[];
256
+ readonly title: string;
257
+ };
258
+ peerContentKey: string & import("effect/Brand").Brand<"@NakafaAI/AksaraContentKey">;
259
+ questionKey: string & import("effect/Brand").Brand<"@NakafaAI/AksaraQuestionKey">;
260
+ questionNumber: number;
261
+ setKey: string & import("effect/Brand").Brand<"@NakafaAI/AksaraQuestionSetKey">;
262
+ blueprint?: {
263
+ readonly cognitiveLevel: string;
264
+ readonly contentDomain: string;
265
+ readonly topic: string;
266
+ };
267
+ stimulusKey?: string;
268
+ bodyKind: "question";
269
+ kind: "question-body";
270
+ response: {
271
+ readonly categories: readonly {
272
+ readonly categoryKey: string;
273
+ readonly label: readonly [{
274
+ readonly display: "block" | "inline";
275
+ readonly kind: "math";
276
+ readonly math: string;
277
+ } | {
278
+ readonly kind: "text";
279
+ readonly text: string;
280
+ }, ...({
281
+ readonly display: "block" | "inline";
282
+ readonly kind: "math";
283
+ readonly math: string;
284
+ } | {
285
+ readonly kind: "text";
286
+ readonly text: string;
287
+ })[]];
288
+ readonly order: number;
289
+ }[];
290
+ readonly kind: "category";
291
+ readonly statements: readonly {
292
+ readonly correctCategoryKey: string;
293
+ readonly label: readonly [{
294
+ readonly display: "block" | "inline";
295
+ readonly kind: "math";
296
+ readonly math: string;
297
+ } | {
298
+ readonly kind: "text";
299
+ readonly text: string;
300
+ }, ...({
301
+ readonly display: "block" | "inline";
302
+ readonly kind: "math";
303
+ readonly math: string;
304
+ } | {
305
+ readonly kind: "text";
306
+ readonly text: string;
307
+ })[]];
308
+ readonly order: number;
309
+ readonly statementKey: string;
310
+ }[];
311
+ } | {
312
+ readonly kind: "multiple-choice";
313
+ readonly options: readonly {
314
+ readonly isCorrect: boolean;
315
+ readonly label: readonly [{
316
+ readonly display: "block" | "inline";
317
+ readonly kind: "math";
318
+ readonly math: string;
319
+ } | {
320
+ readonly kind: "text";
321
+ readonly text: string;
322
+ }, ...({
323
+ readonly display: "block" | "inline";
324
+ readonly kind: "math";
325
+ readonly math: string;
326
+ } | {
327
+ readonly kind: "text";
328
+ readonly text: string;
329
+ })[]];
330
+ readonly optionKey: string;
331
+ readonly order: number;
332
+ }[];
333
+ } | {
334
+ readonly kind: "single-choice";
335
+ readonly options: readonly {
336
+ readonly isCorrect: boolean;
337
+ readonly label: readonly [{
338
+ readonly display: "block" | "inline";
339
+ readonly kind: "math";
340
+ readonly math: string;
341
+ } | {
342
+ readonly kind: "text";
343
+ readonly text: string;
344
+ }, ...({
345
+ readonly display: "block" | "inline";
346
+ readonly kind: "math";
347
+ readonly math: string;
348
+ } | {
349
+ readonly kind: "text";
350
+ readonly text: string;
351
+ })[]];
352
+ readonly optionKey: string;
353
+ readonly order: number;
354
+ }[];
355
+ };
356
+ }, import("#contracts/question/item").QuestionResponseLocaleMissingError, never>;
357
+ /** Builds one answer projection without duplicating the prompt response. */
358
+ export declare function makeQuestionAnswerProjection(input: QuestionProjectionInput & {
359
+ readonly bodyKind: "answer";
360
+ }): {
361
+ artifactLocale: ("de" | "en" | "id") & import("effect/Brand").Brand<"@NakafaAI/AksaraArtifactLocale">;
362
+ contentKey: string & import("effect/Brand").Brand<"@NakafaAI/AksaraContentKey">;
363
+ metadata: {
364
+ readonly dateModified?: string;
365
+ readonly datePublished: string;
366
+ readonly authors: readonly {
367
+ readonly name: string;
368
+ }[];
369
+ readonly title: string;
370
+ };
371
+ peerContentKey: string & import("effect/Brand").Brand<"@NakafaAI/AksaraContentKey">;
372
+ questionKey: string & import("effect/Brand").Brand<"@NakafaAI/AksaraQuestionKey">;
373
+ questionNumber: number;
374
+ setKey: string & import("effect/Brand").Brand<"@NakafaAI/AksaraQuestionSetKey">;
375
+ blueprint?: {
376
+ readonly cognitiveLevel: string;
377
+ readonly contentDomain: string;
378
+ readonly topic: string;
379
+ };
380
+ stimulusKey?: string;
381
+ bodyKind: "answer";
382
+ kind: "question-body";
383
+ };
384
+ /** Builds one strictly bound question or answer projection from authored facts. */
385
+ export declare const makeQuestionBodyProjection: (input: QuestionProjectionInput) => Effect.Effect<{
386
+ artifactLocale: ("de" | "en" | "id") & import("effect/Brand").Brand<"@NakafaAI/AksaraArtifactLocale">;
387
+ contentKey: string & import("effect/Brand").Brand<"@NakafaAI/AksaraContentKey">;
388
+ metadata: {
389
+ readonly dateModified?: string;
390
+ readonly datePublished: string;
391
+ readonly authors: readonly {
392
+ readonly name: string;
393
+ }[];
394
+ readonly title: string;
395
+ };
396
+ peerContentKey: string & import("effect/Brand").Brand<"@NakafaAI/AksaraContentKey">;
397
+ questionKey: string & import("effect/Brand").Brand<"@NakafaAI/AksaraQuestionKey">;
398
+ questionNumber: number;
399
+ setKey: string & import("effect/Brand").Brand<"@NakafaAI/AksaraQuestionSetKey">;
400
+ blueprint?: {
401
+ readonly cognitiveLevel: string;
402
+ readonly contentDomain: string;
403
+ readonly topic: string;
404
+ };
405
+ stimulusKey?: string;
406
+ bodyKind: "question";
407
+ kind: "question-body";
408
+ response: {
409
+ readonly categories: readonly {
410
+ readonly categoryKey: string;
411
+ readonly label: readonly [{
412
+ readonly display: "block" | "inline";
413
+ readonly kind: "math";
414
+ readonly math: string;
415
+ } | {
416
+ readonly kind: "text";
417
+ readonly text: string;
418
+ }, ...({
419
+ readonly display: "block" | "inline";
420
+ readonly kind: "math";
421
+ readonly math: string;
422
+ } | {
423
+ readonly kind: "text";
424
+ readonly text: string;
425
+ })[]];
426
+ readonly order: number;
427
+ }[];
428
+ readonly kind: "category";
429
+ readonly statements: readonly {
430
+ readonly correctCategoryKey: string;
431
+ readonly label: readonly [{
432
+ readonly display: "block" | "inline";
433
+ readonly kind: "math";
434
+ readonly math: string;
435
+ } | {
436
+ readonly kind: "text";
437
+ readonly text: string;
438
+ }, ...({
439
+ readonly display: "block" | "inline";
440
+ readonly kind: "math";
441
+ readonly math: string;
442
+ } | {
443
+ readonly kind: "text";
444
+ readonly text: string;
445
+ })[]];
446
+ readonly order: number;
447
+ readonly statementKey: string;
448
+ }[];
449
+ } | {
450
+ readonly kind: "multiple-choice";
451
+ readonly options: readonly {
452
+ readonly isCorrect: boolean;
453
+ readonly label: readonly [{
454
+ readonly display: "block" | "inline";
455
+ readonly kind: "math";
456
+ readonly math: string;
457
+ } | {
458
+ readonly kind: "text";
459
+ readonly text: string;
460
+ }, ...({
461
+ readonly display: "block" | "inline";
462
+ readonly kind: "math";
463
+ readonly math: string;
464
+ } | {
465
+ readonly kind: "text";
466
+ readonly text: string;
467
+ })[]];
468
+ readonly optionKey: string;
469
+ readonly order: number;
470
+ }[];
471
+ } | {
472
+ readonly kind: "single-choice";
473
+ readonly options: readonly {
474
+ readonly isCorrect: boolean;
475
+ readonly label: readonly [{
476
+ readonly display: "block" | "inline";
477
+ readonly kind: "math";
478
+ readonly math: string;
479
+ } | {
480
+ readonly kind: "text";
481
+ readonly text: string;
482
+ }, ...({
483
+ readonly display: "block" | "inline";
484
+ readonly kind: "math";
485
+ readonly math: string;
486
+ } | {
487
+ readonly kind: "text";
488
+ readonly text: string;
489
+ })[]];
490
+ readonly optionKey: string;
491
+ readonly order: number;
492
+ }[];
493
+ };
494
+ } | {
495
+ artifactLocale: ("de" | "en" | "id") & import("effect/Brand").Brand<"@NakafaAI/AksaraArtifactLocale">;
496
+ contentKey: string & import("effect/Brand").Brand<"@NakafaAI/AksaraContentKey">;
497
+ metadata: {
498
+ readonly dateModified?: string;
499
+ readonly datePublished: string;
500
+ readonly authors: readonly {
501
+ readonly name: string;
502
+ }[];
503
+ readonly title: string;
504
+ };
505
+ peerContentKey: string & import("effect/Brand").Brand<"@NakafaAI/AksaraContentKey">;
506
+ questionKey: string & import("effect/Brand").Brand<"@NakafaAI/AksaraQuestionKey">;
507
+ questionNumber: number;
508
+ setKey: string & import("effect/Brand").Brand<"@NakafaAI/AksaraQuestionSetKey">;
509
+ blueprint?: {
510
+ readonly cognitiveLevel: string;
511
+ readonly contentDomain: string;
512
+ readonly topic: string;
513
+ };
514
+ stimulusKey?: string;
515
+ bodyKind: "answer";
516
+ kind: "question-body";
517
+ }, import("#contracts/question/item").QuestionResponseLocaleMissingError, never>;
518
+ /** Serializes one question projection with stable signed field order. */
519
+ export declare function canonicalizeQuestionProjection(projection: QuestionBodyProjection): string;
520
+ export {};
@@ -0,0 +1,109 @@
1
+ import { Effect, Schema } from "effect";
2
+ import { ContentAuthorSchema } from "#contracts/content";
3
+ import { withPublicationDates } from "#contracts/date";
4
+ import { QuestionAnswerIdentitySchema, QuestionPromptIdentitySchema, } from "#contracts/question/identity";
5
+ import { canonicalQuestionBlueprint, QuestionBlueprintSchema, questionResponseFor, } from "#contracts/question/item";
6
+ import { canonicalQuestionResponse, QuestionResponseSchema, } from "#contracts/question/response";
7
+ import { TryoutKeySchema } from "#contracts/tryout/key";
8
+ /** Exact metadata authored by every current question and answer body. */
9
+ export const QuestionMetadataSchema = withPublicationDates({
10
+ authors: Schema.Array(ContentAuthorSchema),
11
+ title: Schema.String,
12
+ });
13
+ const QuestionProjectionFields = {
14
+ blueprint: Schema.optionalKey(QuestionBlueprintSchema),
15
+ kind: Schema.Literal("question-body"),
16
+ metadata: QuestionMetadataSchema,
17
+ stimulusKey: Schema.optionalKey(TryoutKeySchema),
18
+ };
19
+ /** Published body and localized response for one authored question prompt. */
20
+ export const QuestionPromptProjectionSchema = QuestionPromptIdentitySchema.mapFields((fields) => ({
21
+ ...fields,
22
+ ...QuestionProjectionFields,
23
+ response: QuestionResponseSchema,
24
+ }), { unsafePreserveChecks: true });
25
+ /** Published body for one entitled answer without a duplicated response. */
26
+ export const QuestionAnswerProjectionSchema = QuestionAnswerIdentitySchema.mapFields((fields) => ({ ...fields, ...QuestionProjectionFields }), { unsafePreserveChecks: true });
27
+ /** Complete non-route projection vocabulary for question-bank MDX bodies. */
28
+ export const QuestionBodyProjectionSchema = Schema.Union([
29
+ QuestionPromptProjectionSchema,
30
+ QuestionAnswerProjectionSchema,
31
+ ]);
32
+ /** Shared identity and metadata carried by both question body projections. */
33
+ function questionProjectionFields(input) {
34
+ return {
35
+ artifactLocale: input.artifactLocale,
36
+ contentKey: input.contentKey,
37
+ metadata: input.metadata,
38
+ peerContentKey: input.peerContentKey,
39
+ questionKey: input.questionKey,
40
+ questionNumber: input.questionNumber,
41
+ setKey: input.setKey,
42
+ ...(input.item.blueprint === undefined
43
+ ? {}
44
+ : { blueprint: input.item.blueprint }),
45
+ ...(input.item.stimulusKey === undefined
46
+ ? {}
47
+ : { stimulusKey: input.item.stimulusKey }),
48
+ };
49
+ }
50
+ /** Builds one prompt projection with its exact-locale frozen response. */
51
+ export const makeQuestionPromptProjection = Effect.fn("AksaraContracts.makeQuestionPromptProjection")(function* (input) {
52
+ const response = yield* questionResponseFor(input.item, input.artifactLocale);
53
+ return {
54
+ ...questionProjectionFields(input),
55
+ bodyKind: "question",
56
+ kind: "question-body",
57
+ response,
58
+ };
59
+ });
60
+ /** Builds one answer projection without duplicating the prompt response. */
61
+ export function makeQuestionAnswerProjection(input) {
62
+ return {
63
+ ...questionProjectionFields(input),
64
+ bodyKind: "answer",
65
+ kind: "question-body",
66
+ };
67
+ }
68
+ /** Builds one strictly bound question or answer projection from authored facts. */
69
+ export const makeQuestionBodyProjection = Effect.fn("AksaraContracts.makeQuestionBodyProjection")(function* (input) {
70
+ if (input.bodyKind === "question") {
71
+ return yield* makeQuestionPromptProjection({
72
+ ...input,
73
+ bodyKind: "question",
74
+ });
75
+ }
76
+ return makeQuestionAnswerProjection({ ...input, bodyKind: "answer" });
77
+ });
78
+ /** Serializes one question projection with stable signed field order. */
79
+ export function canonicalizeQuestionProjection(projection) {
80
+ return JSON.stringify({
81
+ bodyKind: projection.bodyKind,
82
+ ...(projection.bodyKind === "question"
83
+ ? {
84
+ response: canonicalQuestionResponse(projection.response),
85
+ }
86
+ : {}),
87
+ artifactLocale: projection.artifactLocale,
88
+ ...(projection.blueprint === undefined
89
+ ? {}
90
+ : { blueprint: canonicalQuestionBlueprint(projection.blueprint) }),
91
+ contentKey: projection.contentKey,
92
+ kind: projection.kind,
93
+ metadata: {
94
+ authors: projection.metadata.authors.map(({ name }) => ({ name })),
95
+ ...(projection.metadata.dateModified === undefined
96
+ ? {}
97
+ : { dateModified: projection.metadata.dateModified }),
98
+ datePublished: projection.metadata.datePublished,
99
+ title: projection.metadata.title,
100
+ },
101
+ peerContentKey: projection.peerContentKey,
102
+ questionKey: projection.questionKey,
103
+ questionNumber: projection.questionNumber,
104
+ setKey: projection.setKey,
105
+ ...(projection.stimulusKey === undefined
106
+ ? {}
107
+ : { stimulusKey: projection.stimulusKey }),
108
+ });
109
+ }