@nakafa/aksara-contracts 0.31.0 → 0.32.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.
@@ -1,6 +1,6 @@
1
1
  import { Schema } from "effect";
2
2
  import { Sha256HashSchema } from "#contracts/ids";
3
- import { ContentProjectionSchema } from "#contracts/projection/spec";
3
+ import { CurrentContentProjectionSchema } from "#contracts/projection/spec";
4
4
  export const LOCAL_PREVIEW_ARTIFACT_PREFIX = "/v1/artifacts/";
5
5
  /** Builds the one content-addressed path owned by the preview protocol. */
6
6
  export function localPreviewArtifactPath(artifactHash) {
@@ -14,7 +14,7 @@ function hasCoherentArtifactPath(input) {
14
14
  export const PreviewArtifactSchema = Schema.Struct({
15
15
  artifactHash: Sha256HashSchema,
16
16
  artifactPath: Schema.Trimmed.check(Schema.isNonEmpty()),
17
- projection: ContentProjectionSchema,
17
+ projection: CurrentContentProjectionSchema,
18
18
  }).pipe(Schema.check(Schema.makeFilter(hasCoherentArtifactPath, {
19
19
  message: "Expected the artifact path to match its signed hash.",
20
20
  })));
@@ -184,6 +184,42 @@ export declare const digestProjections: <E, R>(releaseId: string & import("effec
184
184
  readonly title: string;
185
185
  };
186
186
  readonly stimulusKey?: string;
187
+ } | {
188
+ readonly artifactLocale: ("de" | "en" | "id") & import("effect/Brand").Brand<"@NakafaAI/AksaraArtifactLocale">;
189
+ readonly contentKey: string & import("effect/Brand").Brand<"@NakafaAI/AksaraContentKey">;
190
+ readonly peerContentKey: string & import("effect/Brand").Brand<"@NakafaAI/AksaraContentKey">;
191
+ readonly questionKey: string & import("effect/Brand").Brand<"@NakafaAI/AksaraQuestionKey">;
192
+ readonly questionNumber: number;
193
+ readonly setKey: string & import("effect/Brand").Brand<"@NakafaAI/AksaraQuestionSetKey">;
194
+ readonly bodyKind: "question";
195
+ readonly kind: "question-body";
196
+ readonly metadata: {
197
+ readonly authors: readonly {
198
+ readonly name: string;
199
+ }[];
200
+ readonly date: string;
201
+ readonly title: string;
202
+ };
203
+ readonly choices: {
204
+ label: string;
205
+ value: boolean;
206
+ }[];
207
+ } | {
208
+ readonly artifactLocale: ("de" | "en" | "id") & import("effect/Brand").Brand<"@NakafaAI/AksaraArtifactLocale">;
209
+ readonly contentKey: string & import("effect/Brand").Brand<"@NakafaAI/AksaraContentKey">;
210
+ readonly peerContentKey: string & import("effect/Brand").Brand<"@NakafaAI/AksaraContentKey">;
211
+ readonly questionKey: string & import("effect/Brand").Brand<"@NakafaAI/AksaraQuestionKey">;
212
+ readonly questionNumber: number;
213
+ readonly setKey: string & import("effect/Brand").Brand<"@NakafaAI/AksaraQuestionSetKey">;
214
+ readonly bodyKind: "answer";
215
+ readonly kind: "question-body";
216
+ readonly metadata: {
217
+ readonly authors: readonly {
218
+ readonly name: string;
219
+ }[];
220
+ readonly date: string;
221
+ readonly title: string;
222
+ };
187
223
  }, E, R>) => Effect.Effect<{
188
224
  count: number;
189
225
  digest: string & import("effect/Brand").Brand<"@NakafaAI/AksaraSha256Hash">;
@@ -174,6 +174,164 @@ export declare const QuestionBodyProjectionSchema: Schema.Union<readonly [Schema
174
174
  readonly stimulusKey: Schema.optionalKey<Schema.String>;
175
175
  }>]>;
176
176
  export type QuestionBodyProjection = typeof QuestionBodyProjectionSchema.Type;
177
+ /**
178
+ * Exact predecessor Question bytes retained for authenticated rollback reads.
179
+ * Delete only after two accepted scoped rebuilds and an authoritative
180
+ * current/prior audit reports zero `choices` and `date` projections.
181
+ */
182
+ export declare const HistoricalQuestionBodyProjectionSchema: Schema.Union<readonly [Schema.Struct<{
183
+ readonly artifactLocale: Schema.brand<Schema.Literals<readonly ["en", "id", "de"]>, "@NakafaAI/AksaraArtifactLocale">;
184
+ readonly contentKey: Schema.brand<Schema.String, "@NakafaAI/AksaraContentKey">;
185
+ readonly peerContentKey: Schema.brand<Schema.String, "@NakafaAI/AksaraContentKey">;
186
+ readonly questionKey: Schema.brand<Schema.String, "@NakafaAI/AksaraQuestionKey">;
187
+ readonly questionNumber: Schema.Finite;
188
+ readonly setKey: Schema.brand<Schema.String, "@NakafaAI/AksaraQuestionSetKey">;
189
+ readonly bodyKind: Schema.Literal<"question">;
190
+ readonly kind: Schema.Literal<"question-body">;
191
+ readonly metadata: Schema.Struct<{
192
+ readonly authors: Schema.$Array<Schema.Struct<{
193
+ readonly name: Schema.String;
194
+ }>>;
195
+ readonly date: Schema.String;
196
+ readonly title: Schema.String;
197
+ }>;
198
+ readonly choices: Schema.mutable<Schema.$Array<Schema.Struct<{
199
+ readonly label: Schema.mutableKey<Schema.String>;
200
+ readonly value: Schema.mutableKey<Schema.Boolean>;
201
+ }>>>;
202
+ }>, Schema.Struct<{
203
+ readonly artifactLocale: Schema.brand<Schema.Literals<readonly ["en", "id", "de"]>, "@NakafaAI/AksaraArtifactLocale">;
204
+ readonly contentKey: Schema.brand<Schema.String, "@NakafaAI/AksaraContentKey">;
205
+ readonly peerContentKey: Schema.brand<Schema.String, "@NakafaAI/AksaraContentKey">;
206
+ readonly questionKey: Schema.brand<Schema.String, "@NakafaAI/AksaraQuestionKey">;
207
+ readonly questionNumber: Schema.Finite;
208
+ readonly setKey: Schema.brand<Schema.String, "@NakafaAI/AksaraQuestionSetKey">;
209
+ readonly bodyKind: Schema.Literal<"answer">;
210
+ readonly kind: Schema.Literal<"question-body">;
211
+ readonly metadata: Schema.Struct<{
212
+ readonly authors: Schema.$Array<Schema.Struct<{
213
+ readonly name: Schema.String;
214
+ }>>;
215
+ readonly date: Schema.String;
216
+ readonly title: Schema.String;
217
+ }>;
218
+ }>]>;
219
+ export type HistoricalQuestionBodyProjection = typeof HistoricalQuestionBodyProjectionSchema.Type;
220
+ /** Current Question values plus exact predecessor rollback bytes. */
221
+ export declare const ReadableQuestionBodyProjectionSchema: Schema.Union<readonly [Schema.Union<readonly [Schema.Struct<{
222
+ readonly artifactLocale: Schema.brand<Schema.Literals<readonly ["en", "id", "de"]>, "@NakafaAI/AksaraArtifactLocale">;
223
+ readonly contentKey: Schema.brand<Schema.String, "@NakafaAI/AksaraContentKey">;
224
+ readonly peerContentKey: Schema.brand<Schema.String, "@NakafaAI/AksaraContentKey">;
225
+ readonly questionKey: Schema.brand<Schema.String, "@NakafaAI/AksaraQuestionKey">;
226
+ readonly questionNumber: Schema.Finite;
227
+ readonly setKey: Schema.brand<Schema.String, "@NakafaAI/AksaraQuestionSetKey">;
228
+ readonly bodyKind: Schema.Literal<"question">;
229
+ readonly blueprint: Schema.optionalKey<Schema.Struct<{
230
+ readonly cognitiveLevel: Schema.String;
231
+ readonly contentDomain: Schema.String;
232
+ readonly topic: Schema.String;
233
+ }>>;
234
+ readonly kind: Schema.Literal<"question-body">;
235
+ readonly metadata: Schema.Struct<{
236
+ readonly dateModified: Schema.optionalKey<Schema.String>;
237
+ readonly datePublished: Schema.String;
238
+ readonly authors: Schema.$Array<Schema.Struct<{
239
+ readonly name: Schema.String;
240
+ }>>;
241
+ readonly title: Schema.String;
242
+ }>;
243
+ readonly stimulusKey: Schema.optionalKey<Schema.String>;
244
+ readonly response: Schema.Union<readonly [Schema.Struct<{
245
+ readonly categories: Schema.$Array<Schema.Struct<{
246
+ readonly categoryKey: Schema.String;
247
+ readonly label: Schema.String;
248
+ readonly order: Schema.Int;
249
+ }>>;
250
+ readonly kind: Schema.Literal<"category">;
251
+ readonly statements: Schema.$Array<Schema.Struct<{
252
+ readonly correctCategoryKey: Schema.String;
253
+ readonly label: Schema.String;
254
+ readonly order: Schema.Int;
255
+ readonly statementKey: Schema.String;
256
+ }>>;
257
+ }>, Schema.Struct<{
258
+ readonly kind: Schema.Literal<"multiple-choice">;
259
+ readonly options: Schema.$Array<Schema.Struct<{
260
+ readonly isCorrect: Schema.Boolean;
261
+ readonly label: Schema.String;
262
+ readonly optionKey: Schema.String;
263
+ readonly order: Schema.Int;
264
+ }>>;
265
+ }>, Schema.Struct<{
266
+ readonly kind: Schema.Literal<"single-choice">;
267
+ readonly options: Schema.$Array<Schema.Struct<{
268
+ readonly isCorrect: Schema.Boolean;
269
+ readonly label: Schema.String;
270
+ readonly optionKey: Schema.String;
271
+ readonly order: Schema.Int;
272
+ }>>;
273
+ }>]>;
274
+ }>, Schema.Struct<{
275
+ readonly artifactLocale: Schema.brand<Schema.Literals<readonly ["en", "id", "de"]>, "@NakafaAI/AksaraArtifactLocale">;
276
+ readonly contentKey: Schema.brand<Schema.String, "@NakafaAI/AksaraContentKey">;
277
+ readonly peerContentKey: Schema.brand<Schema.String, "@NakafaAI/AksaraContentKey">;
278
+ readonly questionKey: Schema.brand<Schema.String, "@NakafaAI/AksaraQuestionKey">;
279
+ readonly questionNumber: Schema.Finite;
280
+ readonly setKey: Schema.brand<Schema.String, "@NakafaAI/AksaraQuestionSetKey">;
281
+ readonly bodyKind: Schema.Literal<"answer">;
282
+ readonly blueprint: Schema.optionalKey<Schema.Struct<{
283
+ readonly cognitiveLevel: Schema.String;
284
+ readonly contentDomain: Schema.String;
285
+ readonly topic: Schema.String;
286
+ }>>;
287
+ readonly kind: Schema.Literal<"question-body">;
288
+ readonly metadata: Schema.Struct<{
289
+ readonly dateModified: Schema.optionalKey<Schema.String>;
290
+ readonly datePublished: Schema.String;
291
+ readonly authors: Schema.$Array<Schema.Struct<{
292
+ readonly name: Schema.String;
293
+ }>>;
294
+ readonly title: Schema.String;
295
+ }>;
296
+ readonly stimulusKey: Schema.optionalKey<Schema.String>;
297
+ }>]>, Schema.Union<readonly [Schema.Struct<{
298
+ readonly artifactLocale: Schema.brand<Schema.Literals<readonly ["en", "id", "de"]>, "@NakafaAI/AksaraArtifactLocale">;
299
+ readonly contentKey: Schema.brand<Schema.String, "@NakafaAI/AksaraContentKey">;
300
+ readonly peerContentKey: Schema.brand<Schema.String, "@NakafaAI/AksaraContentKey">;
301
+ readonly questionKey: Schema.brand<Schema.String, "@NakafaAI/AksaraQuestionKey">;
302
+ readonly questionNumber: Schema.Finite;
303
+ readonly setKey: Schema.brand<Schema.String, "@NakafaAI/AksaraQuestionSetKey">;
304
+ readonly bodyKind: Schema.Literal<"question">;
305
+ readonly kind: Schema.Literal<"question-body">;
306
+ readonly metadata: Schema.Struct<{
307
+ readonly authors: Schema.$Array<Schema.Struct<{
308
+ readonly name: Schema.String;
309
+ }>>;
310
+ readonly date: Schema.String;
311
+ readonly title: Schema.String;
312
+ }>;
313
+ readonly choices: Schema.mutable<Schema.$Array<Schema.Struct<{
314
+ readonly label: Schema.mutableKey<Schema.String>;
315
+ readonly value: Schema.mutableKey<Schema.Boolean>;
316
+ }>>>;
317
+ }>, Schema.Struct<{
318
+ readonly artifactLocale: Schema.brand<Schema.Literals<readonly ["en", "id", "de"]>, "@NakafaAI/AksaraArtifactLocale">;
319
+ readonly contentKey: Schema.brand<Schema.String, "@NakafaAI/AksaraContentKey">;
320
+ readonly peerContentKey: Schema.brand<Schema.String, "@NakafaAI/AksaraContentKey">;
321
+ readonly questionKey: Schema.brand<Schema.String, "@NakafaAI/AksaraQuestionKey">;
322
+ readonly questionNumber: Schema.Finite;
323
+ readonly setKey: Schema.brand<Schema.String, "@NakafaAI/AksaraQuestionSetKey">;
324
+ readonly bodyKind: Schema.Literal<"answer">;
325
+ readonly kind: Schema.Literal<"question-body">;
326
+ readonly metadata: Schema.Struct<{
327
+ readonly authors: Schema.$Array<Schema.Struct<{
328
+ readonly name: Schema.String;
329
+ }>>;
330
+ readonly date: Schema.String;
331
+ readonly title: Schema.String;
332
+ }>;
333
+ }>]>]>;
334
+ export type ReadableQuestionBodyProjection = typeof ReadableQuestionBodyProjectionSchema.Type;
177
335
  interface QuestionProjectionInput {
178
336
  readonly artifactLocale: typeof ArtifactLocaleSchema.Type;
179
337
  readonly bodyKind: QuestionBodyKind;
@@ -348,5 +506,5 @@ export declare const makeQuestionBodyProjection: (input: QuestionProjectionInput
348
506
  kind: "question-body";
349
507
  }, import("#contracts/question/item").QuestionResponseLocaleMissingError, never>;
350
508
  /** Serializes one question projection with stable signed field order. */
351
- export declare function canonicalizeQuestionProjection(projection: QuestionBodyProjection): string;
509
+ export declare function canonicalizeQuestionProjection(projection: ReadableQuestionBodyProjection): string;
352
510
  export {};
@@ -1,6 +1,6 @@
1
- import { Effect, Schema } from "effect";
1
+ import { Effect, Schema, Struct } from "effect";
2
2
  import { ContentAuthorSchema } from "#contracts/content";
3
- import { withPublicationDates } from "#contracts/date";
3
+ import { DateOnlySchema, withPublicationDates } from "#contracts/date";
4
4
  import { QuestionAnswerIdentitySchema, QuestionPromptIdentitySchema, } from "#contracts/question/identity";
5
5
  import { canonicalQuestionBlueprint, QuestionBlueprintSchema, questionResponseFor, } from "#contracts/question/item";
6
6
  import { canonicalQuestionResponse, QuestionResponseSchema, } from "#contracts/question/response";
@@ -29,6 +29,48 @@ export const QuestionBodyProjectionSchema = Schema.Union([
29
29
  QuestionPromptProjectionSchema,
30
30
  QuestionAnswerProjectionSchema,
31
31
  ]);
32
+ /** One predecessor choice retained only while authenticated rollback needs it. */
33
+ const HistoricalQuestionChoiceSchema = Schema.Struct({
34
+ label: Schema.String,
35
+ value: Schema.Boolean,
36
+ }).mapFields(Struct.map(Schema.mutableKey));
37
+ /** Checks that one predecessor prompt preserves exactly one correct choice. */
38
+ function hasExactlyOneCorrectChoice(choices) {
39
+ return choices.filter(({ value }) => value).length === 1;
40
+ }
41
+ const HistoricalQuestionChoiceListSchema = Schema.Array(HistoricalQuestionChoiceSchema).pipe(Schema.mutable, Schema.check(Schema.makeFilter(hasExactlyOneCorrectChoice, {
42
+ identifier: "HistoricalQuestionChoiceList",
43
+ message: "Expected exactly one correct historical choice.",
44
+ })));
45
+ const HistoricalQuestionMetadataSchema = Schema.Struct({
46
+ authors: Schema.Array(ContentAuthorSchema),
47
+ date: DateOnlySchema,
48
+ title: Schema.String,
49
+ });
50
+ const HistoricalQuestionProjectionFields = {
51
+ kind: Schema.Literal("question-body"),
52
+ metadata: HistoricalQuestionMetadataSchema,
53
+ };
54
+ const HistoricalQuestionPromptProjectionSchema = QuestionPromptIdentitySchema.mapFields((fields) => ({
55
+ ...fields,
56
+ ...HistoricalQuestionProjectionFields,
57
+ choices: HistoricalQuestionChoiceListSchema,
58
+ }), { unsafePreserveChecks: true });
59
+ const HistoricalQuestionAnswerProjectionSchema = QuestionAnswerIdentitySchema.mapFields((fields) => ({ ...fields, ...HistoricalQuestionProjectionFields }), { unsafePreserveChecks: true });
60
+ /**
61
+ * Exact predecessor Question bytes retained for authenticated rollback reads.
62
+ * Delete only after two accepted scoped rebuilds and an authoritative
63
+ * current/prior audit reports zero `choices` and `date` projections.
64
+ */
65
+ export const HistoricalQuestionBodyProjectionSchema = Schema.Union([
66
+ HistoricalQuestionPromptProjectionSchema,
67
+ HistoricalQuestionAnswerProjectionSchema,
68
+ ]);
69
+ /** Current Question values plus exact predecessor rollback bytes. */
70
+ export const ReadableQuestionBodyProjectionSchema = Schema.Union([
71
+ QuestionBodyProjectionSchema,
72
+ HistoricalQuestionBodyProjectionSchema,
73
+ ]);
32
74
  /** Shared identity and metadata carried by both question body projections. */
33
75
  function questionProjectionFields(input) {
34
76
  return {
@@ -75,34 +117,50 @@ export const makeQuestionBodyProjection = Effect.fn("AksaraContracts.makeQuestio
75
117
  }
76
118
  return makeQuestionAnswerProjection({ ...input, bodyKind: "answer" });
77
119
  });
120
+ /** Preserves the exact response fields owned by each readable prompt format. */
121
+ function canonicalQuestionBody(projection) {
122
+ if (projection.bodyKind === "answer") {
123
+ return {};
124
+ }
125
+ if ("response" in projection) {
126
+ return { response: canonicalQuestionResponse(projection.response) };
127
+ }
128
+ return {
129
+ choices: projection.choices.map(({ label, value }) => ({ label, value })),
130
+ };
131
+ }
78
132
  /** Serializes one question projection with stable signed field order. */
79
133
  export function canonicalizeQuestionProjection(projection) {
134
+ const body = canonicalQuestionBody(projection);
135
+ const metadata = "date" in projection.metadata
136
+ ? {
137
+ authors: projection.metadata.authors.map(({ name }) => ({ name })),
138
+ date: projection.metadata.date,
139
+ title: projection.metadata.title,
140
+ }
141
+ : {
142
+ authors: projection.metadata.authors.map(({ name }) => ({ name })),
143
+ ...(projection.metadata.dateModified === undefined
144
+ ? {}
145
+ : { dateModified: projection.metadata.dateModified }),
146
+ datePublished: projection.metadata.datePublished,
147
+ title: projection.metadata.title,
148
+ };
80
149
  return JSON.stringify({
81
150
  bodyKind: projection.bodyKind,
82
- ...(projection.bodyKind === "question"
83
- ? {
84
- response: canonicalQuestionResponse(projection.response),
85
- }
86
- : {}),
151
+ ...body,
87
152
  artifactLocale: projection.artifactLocale,
88
- ...(projection.blueprint === undefined
153
+ ...(!("blueprint" in projection) || projection.blueprint === undefined
89
154
  ? {}
90
155
  : { blueprint: canonicalQuestionBlueprint(projection.blueprint) }),
91
156
  contentKey: projection.contentKey,
92
157
  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
- },
158
+ metadata,
101
159
  peerContentKey: projection.peerContentKey,
102
160
  questionKey: projection.questionKey,
103
161
  questionNumber: projection.questionNumber,
104
162
  setKey: projection.setKey,
105
- ...(projection.stimulusKey === undefined
163
+ ...(!("stimulusKey" in projection) || projection.stimulusKey === undefined
106
164
  ? {}
107
165
  : { stimulusKey: projection.stimulusKey }),
108
166
  });
@@ -83,6 +83,204 @@ export declare const ContentProjectionSchema: Schema.Union<readonly [Schema.Stru
83
83
  }>;
84
84
  readonly sitemap: Schema.Literal<true>;
85
85
  readonly sourcePath: Schema.brand<Schema.String, "@NakafaAI/AksaraCorpusSourcePath">;
86
+ }>, Schema.Union<readonly [Schema.Union<readonly [Schema.Struct<{
87
+ readonly artifactLocale: Schema.brand<Schema.Literals<readonly ["en", "id", "de"]>, "@NakafaAI/AksaraArtifactLocale">;
88
+ readonly contentKey: Schema.brand<Schema.String, "@NakafaAI/AksaraContentKey">;
89
+ readonly peerContentKey: Schema.brand<Schema.String, "@NakafaAI/AksaraContentKey">;
90
+ readonly questionKey: Schema.brand<Schema.String, "@NakafaAI/AksaraQuestionKey">;
91
+ readonly questionNumber: Schema.Finite;
92
+ readonly setKey: Schema.brand<Schema.String, "@NakafaAI/AksaraQuestionSetKey">;
93
+ readonly bodyKind: Schema.Literal<"question">;
94
+ readonly blueprint: Schema.optionalKey<Schema.Struct<{
95
+ readonly cognitiveLevel: Schema.String;
96
+ readonly contentDomain: Schema.String;
97
+ readonly topic: Schema.String;
98
+ }>>;
99
+ readonly kind: Schema.Literal<"question-body">;
100
+ readonly metadata: Schema.Struct<{
101
+ readonly dateModified: Schema.optionalKey<Schema.String>;
102
+ readonly datePublished: Schema.String;
103
+ readonly authors: Schema.$Array<Schema.Struct<{
104
+ readonly name: Schema.String;
105
+ }>>;
106
+ readonly title: Schema.String;
107
+ }>;
108
+ readonly stimulusKey: Schema.optionalKey<Schema.String>;
109
+ readonly response: Schema.Union<readonly [Schema.Struct<{
110
+ readonly categories: Schema.$Array<Schema.Struct<{
111
+ readonly categoryKey: Schema.String;
112
+ readonly label: Schema.String;
113
+ readonly order: Schema.Int;
114
+ }>>;
115
+ readonly kind: Schema.Literal<"category">;
116
+ readonly statements: Schema.$Array<Schema.Struct<{
117
+ readonly correctCategoryKey: Schema.String;
118
+ readonly label: Schema.String;
119
+ readonly order: Schema.Int;
120
+ readonly statementKey: Schema.String;
121
+ }>>;
122
+ }>, Schema.Struct<{
123
+ readonly kind: Schema.Literal<"multiple-choice">;
124
+ readonly options: Schema.$Array<Schema.Struct<{
125
+ readonly isCorrect: Schema.Boolean;
126
+ readonly label: Schema.String;
127
+ readonly optionKey: Schema.String;
128
+ readonly order: Schema.Int;
129
+ }>>;
130
+ }>, Schema.Struct<{
131
+ readonly kind: Schema.Literal<"single-choice">;
132
+ readonly options: Schema.$Array<Schema.Struct<{
133
+ readonly isCorrect: Schema.Boolean;
134
+ readonly label: Schema.String;
135
+ readonly optionKey: Schema.String;
136
+ readonly order: Schema.Int;
137
+ }>>;
138
+ }>]>;
139
+ }>, Schema.Struct<{
140
+ readonly artifactLocale: Schema.brand<Schema.Literals<readonly ["en", "id", "de"]>, "@NakafaAI/AksaraArtifactLocale">;
141
+ readonly contentKey: Schema.brand<Schema.String, "@NakafaAI/AksaraContentKey">;
142
+ readonly peerContentKey: Schema.brand<Schema.String, "@NakafaAI/AksaraContentKey">;
143
+ readonly questionKey: Schema.brand<Schema.String, "@NakafaAI/AksaraQuestionKey">;
144
+ readonly questionNumber: Schema.Finite;
145
+ readonly setKey: Schema.brand<Schema.String, "@NakafaAI/AksaraQuestionSetKey">;
146
+ readonly bodyKind: Schema.Literal<"answer">;
147
+ readonly blueprint: Schema.optionalKey<Schema.Struct<{
148
+ readonly cognitiveLevel: Schema.String;
149
+ readonly contentDomain: Schema.String;
150
+ readonly topic: Schema.String;
151
+ }>>;
152
+ readonly kind: Schema.Literal<"question-body">;
153
+ readonly metadata: Schema.Struct<{
154
+ readonly dateModified: Schema.optionalKey<Schema.String>;
155
+ readonly datePublished: Schema.String;
156
+ readonly authors: Schema.$Array<Schema.Struct<{
157
+ readonly name: Schema.String;
158
+ }>>;
159
+ readonly title: Schema.String;
160
+ }>;
161
+ readonly stimulusKey: Schema.optionalKey<Schema.String>;
162
+ }>]>, Schema.Union<readonly [Schema.Struct<{
163
+ readonly artifactLocale: Schema.brand<Schema.Literals<readonly ["en", "id", "de"]>, "@NakafaAI/AksaraArtifactLocale">;
164
+ readonly contentKey: Schema.brand<Schema.String, "@NakafaAI/AksaraContentKey">;
165
+ readonly peerContentKey: Schema.brand<Schema.String, "@NakafaAI/AksaraContentKey">;
166
+ readonly questionKey: Schema.brand<Schema.String, "@NakafaAI/AksaraQuestionKey">;
167
+ readonly questionNumber: Schema.Finite;
168
+ readonly setKey: Schema.brand<Schema.String, "@NakafaAI/AksaraQuestionSetKey">;
169
+ readonly bodyKind: Schema.Literal<"question">;
170
+ readonly kind: Schema.Literal<"question-body">;
171
+ readonly metadata: Schema.Struct<{
172
+ readonly authors: Schema.$Array<Schema.Struct<{
173
+ readonly name: Schema.String;
174
+ }>>;
175
+ readonly date: Schema.String;
176
+ readonly title: Schema.String;
177
+ }>;
178
+ readonly choices: Schema.mutable<Schema.$Array<Schema.Struct<{
179
+ readonly label: Schema.mutableKey<Schema.String>;
180
+ readonly value: Schema.mutableKey<Schema.Boolean>;
181
+ }>>>;
182
+ }>, Schema.Struct<{
183
+ readonly artifactLocale: Schema.brand<Schema.Literals<readonly ["en", "id", "de"]>, "@NakafaAI/AksaraArtifactLocale">;
184
+ readonly contentKey: Schema.brand<Schema.String, "@NakafaAI/AksaraContentKey">;
185
+ readonly peerContentKey: Schema.brand<Schema.String, "@NakafaAI/AksaraContentKey">;
186
+ readonly questionKey: Schema.brand<Schema.String, "@NakafaAI/AksaraQuestionKey">;
187
+ readonly questionNumber: Schema.Finite;
188
+ readonly setKey: Schema.brand<Schema.String, "@NakafaAI/AksaraQuestionSetKey">;
189
+ readonly bodyKind: Schema.Literal<"answer">;
190
+ readonly kind: Schema.Literal<"question-body">;
191
+ readonly metadata: Schema.Struct<{
192
+ readonly authors: Schema.$Array<Schema.Struct<{
193
+ readonly name: Schema.String;
194
+ }>>;
195
+ readonly date: Schema.String;
196
+ readonly title: Schema.String;
197
+ }>;
198
+ }>]>]>]>;
199
+ export type ContentProjection = typeof ContentProjectionSchema.Type;
200
+ /** Current projection vocabulary accepted for newly staged content. */
201
+ export declare const CurrentContentProjectionSchema: Schema.Union<readonly [Schema.Struct<{
202
+ readonly appLocale: Schema.brand<Schema.Literals<readonly ["en", "id", "de"]>, "@NakafaAI/AksaraAppLocale">;
203
+ readonly articleRouteSlug: Schema.brand<Schema.String, "@NakafaAI/AksaraArticleRouteSlug">;
204
+ readonly articleSlug: Schema.brand<Schema.String, "@NakafaAI/AksaraArticleSlug">;
205
+ readonly artifactLocale: Schema.brand<Schema.Literals<readonly ["en", "id", "de"]>, "@NakafaAI/AksaraArtifactLocale">;
206
+ readonly category: Schema.brand<Schema.String, "@NakafaAI/AksaraArticleCategory">;
207
+ readonly categoryRouteSlug: Schema.brand<Schema.String, "@NakafaAI/AksaraArticleRouteSlug">;
208
+ readonly contentKey: Schema.brand<Schema.String, "@NakafaAI/AksaraContentKey">;
209
+ readonly graph: Schema.Struct<{
210
+ readonly alignmentId: Schema.String;
211
+ readonly assetId: Schema.String;
212
+ readonly conceptId: Schema.String;
213
+ readonly learningObjectId: Schema.String;
214
+ readonly lensId: Schema.String;
215
+ }>;
216
+ readonly publicPath: Schema.brand<Schema.String, "@NakafaAI/AksaraPublicPath">;
217
+ readonly categoryTitle: Schema.Trimmed;
218
+ readonly kind: Schema.Literal<"article">;
219
+ readonly metadata: Schema.Struct<{
220
+ readonly dateModified: Schema.optionalKey<Schema.String>;
221
+ readonly datePublished: Schema.String;
222
+ readonly authors: Schema.$Array<Schema.Struct<{
223
+ readonly name: Schema.String;
224
+ }>>;
225
+ readonly description: Schema.optional<Schema.String>;
226
+ readonly title: Schema.String;
227
+ }>;
228
+ readonly official: Schema.Boolean;
229
+ readonly parentPath: Schema.brand<Schema.String, "@NakafaAI/AksaraPublicPath">;
230
+ readonly references: Schema.$Array<Schema.Struct<{
231
+ readonly authors: Schema.String;
232
+ readonly citation: Schema.optional<Schema.String>;
233
+ readonly details: Schema.optional<Schema.String>;
234
+ readonly publication: Schema.optional<Schema.String>;
235
+ readonly title: Schema.String;
236
+ readonly url: Schema.optional<Schema.String>;
237
+ readonly year: Schema.Finite;
238
+ }>>;
239
+ readonly sitemap: Schema.Literal<true>;
240
+ }>, Schema.Struct<{
241
+ readonly appLocale: Schema.brand<Schema.Literals<readonly ["en", "id", "de"]>, "@NakafaAI/AksaraAppLocale">;
242
+ readonly artifactLocale: Schema.brand<Schema.Literals<readonly ["en", "id", "de"]>, "@NakafaAI/AksaraArtifactLocale">;
243
+ readonly contentKey: Schema.brand<Schema.String, "@NakafaAI/AksaraContentKey">;
244
+ readonly graph: Schema.Struct<{
245
+ readonly alignmentId: Schema.String;
246
+ readonly assetId: Schema.String;
247
+ readonly conceptId: Schema.String;
248
+ readonly learningObjectId: Schema.String;
249
+ readonly lensId: Schema.String;
250
+ }>;
251
+ readonly materialKey: Schema.brand<Schema.String, "@NakafaAI/AksaraMaterialKey">;
252
+ readonly order: Schema.Finite;
253
+ readonly publicPath: Schema.brand<Schema.String, "@NakafaAI/AksaraPublicPath">;
254
+ readonly sectionKey: Schema.brand<Schema.String, "@NakafaAI/AksaraMaterialSection">;
255
+ readonly kind: Schema.Literal<"subject-lesson">;
256
+ readonly metadata: Schema.Struct<{
257
+ readonly dateModified: Schema.optionalKey<Schema.String>;
258
+ readonly datePublished: Schema.String;
259
+ readonly authors: Schema.$Array<Schema.Struct<{
260
+ readonly name: Schema.String;
261
+ }>>;
262
+ readonly description: Schema.optional<Schema.String>;
263
+ readonly subject: Schema.optional<Schema.String>;
264
+ readonly title: Schema.String;
265
+ }>;
266
+ readonly parentPath: Schema.brand<Schema.String, "@NakafaAI/AksaraPublicPath">;
267
+ readonly sitemap: Schema.Literal<true>;
268
+ readonly topicTitle: Schema.String;
269
+ }>, Schema.Struct<{
270
+ readonly appLocale: Schema.brand<Schema.Literals<readonly ["en", "id", "de"]>, "@NakafaAI/AksaraAppLocale">;
271
+ readonly artifactLocale: Schema.brand<Schema.Literals<readonly ["en", "id", "de"]>, "@NakafaAI/AksaraArtifactLocale">;
272
+ readonly contentKey: Schema.brand<Schema.String, "@NakafaAI/AksaraContentKey">;
273
+ readonly pageKey: Schema.brand<Schema.String, "@NakafaAI/AksaraPageKey">;
274
+ readonly publicPath: Schema.brand<Schema.String, "@NakafaAI/AksaraPublicPath">;
275
+ readonly kind: Schema.Literal<"public-page">;
276
+ readonly metadata: Schema.Struct<{
277
+ readonly dateModified: Schema.optionalKey<Schema.String>;
278
+ readonly datePublished: Schema.String;
279
+ readonly description: Schema.Trimmed;
280
+ readonly title: Schema.Trimmed;
281
+ }>;
282
+ readonly sitemap: Schema.Literal<true>;
283
+ readonly sourcePath: Schema.brand<Schema.String, "@NakafaAI/AksaraCorpusSourcePath">;
86
284
  }>, Schema.Union<readonly [Schema.Struct<{
87
285
  readonly artifactLocale: Schema.brand<Schema.Literals<readonly ["en", "id", "de"]>, "@NakafaAI/AksaraArtifactLocale">;
88
286
  readonly contentKey: Schema.brand<Schema.String, "@NakafaAI/AksaraContentKey">;
@@ -160,7 +358,7 @@ export declare const ContentProjectionSchema: Schema.Union<readonly [Schema.Stru
160
358
  }>;
161
359
  readonly stimulusKey: Schema.optionalKey<Schema.String>;
162
360
  }>]>]>;
163
- export type ContentProjection = typeof ContentProjectionSchema.Type;
361
+ export type CurrentContentProjection = typeof CurrentContentProjectionSchema.Type;
164
362
  /** Public-route projections accepted by Nakafa's path-based runtime seam. */
165
363
  export declare const RoutedContentProjectionSchema: Schema.Union<readonly [Schema.Struct<{
166
364
  readonly appLocale: Schema.brand<Schema.Literals<readonly ["en", "id", "de"]>, "@NakafaAI/AksaraAppLocale">;
@@ -2,9 +2,16 @@ import { Match, Schema } from "effect";
2
2
  import { ArticleProjectionSchema, canonicalizeArticleProjection, } from "#contracts/projection/article";
3
3
  import { canonicalizeMaterialProjection, MaterialLessonProjectionSchema, } from "#contracts/projection/material";
4
4
  import { canonicalizePublicPageProjection, PublicPageProjectionSchema, } from "#contracts/projection/page";
5
- import { canonicalizeQuestionProjection, QuestionBodyProjectionSchema, } from "#contracts/projection/question";
5
+ import { canonicalizeQuestionProjection, QuestionBodyProjectionSchema, ReadableQuestionBodyProjectionSchema, } from "#contracts/projection/question";
6
6
  /** Complete projection vocabulary backed by implemented content families. */
7
7
  export const ContentProjectionSchema = Schema.Union([
8
+ ArticleProjectionSchema,
9
+ MaterialLessonProjectionSchema,
10
+ PublicPageProjectionSchema,
11
+ ReadableQuestionBodyProjectionSchema,
12
+ ]);
13
+ /** Current projection vocabulary accepted for newly staged content. */
14
+ export const CurrentContentProjectionSchema = Schema.Union([
8
15
  ArticleProjectionSchema,
9
16
  MaterialLessonProjectionSchema,
10
17
  PublicPageProjectionSchema,
@@ -200,6 +200,42 @@ export declare function decodeContentProjections<E, R>(projections: Stream.Strea
200
200
  readonly title: string;
201
201
  };
202
202
  readonly stimulusKey?: string;
203
+ } | {
204
+ readonly artifactLocale: ("de" | "en" | "id") & import("effect/Brand").Brand<"@NakafaAI/AksaraArtifactLocale">;
205
+ readonly contentKey: string & import("effect/Brand").Brand<"@NakafaAI/AksaraContentKey">;
206
+ readonly peerContentKey: string & import("effect/Brand").Brand<"@NakafaAI/AksaraContentKey">;
207
+ readonly questionKey: string & import("effect/Brand").Brand<"@NakafaAI/AksaraQuestionKey">;
208
+ readonly questionNumber: number;
209
+ readonly setKey: string & import("effect/Brand").Brand<"@NakafaAI/AksaraQuestionSetKey">;
210
+ readonly bodyKind: "question";
211
+ readonly kind: "question-body";
212
+ readonly metadata: {
213
+ readonly authors: readonly {
214
+ readonly name: string;
215
+ }[];
216
+ readonly date: string;
217
+ readonly title: string;
218
+ };
219
+ readonly choices: {
220
+ label: string;
221
+ value: boolean;
222
+ }[];
223
+ } | {
224
+ readonly artifactLocale: ("de" | "en" | "id") & import("effect/Brand").Brand<"@NakafaAI/AksaraArtifactLocale">;
225
+ readonly contentKey: string & import("effect/Brand").Brand<"@NakafaAI/AksaraContentKey">;
226
+ readonly peerContentKey: string & import("effect/Brand").Brand<"@NakafaAI/AksaraContentKey">;
227
+ readonly questionKey: string & import("effect/Brand").Brand<"@NakafaAI/AksaraQuestionKey">;
228
+ readonly questionNumber: number;
229
+ readonly setKey: string & import("effect/Brand").Brand<"@NakafaAI/AksaraQuestionSetKey">;
230
+ readonly bodyKind: "answer";
231
+ readonly kind: "question-body";
232
+ readonly metadata: {
233
+ readonly authors: readonly {
234
+ readonly name: string;
235
+ }[];
236
+ readonly date: string;
237
+ readonly title: string;
238
+ };
203
239
  }, E | ProjectionDecodeError | ProjectionOrderError | ProjectionRouteError, R>;
204
240
  /** Authenticates a replayable projection stream against its signed manifest. */
205
241
  export declare const verifyContentProjections: <E, R>(input: {