@nakafa/aksara-contracts 0.48.5 → 0.48.7

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.
@@ -207,6 +207,81 @@ export declare function decodeContentSnapshotRows<E, R>(rows: Stream.Stream<unkn
207
207
  readonly family: "quran";
208
208
  readonly record: {
209
209
  readonly payload: {
210
+ readonly firstQuranNumber: number;
211
+ readonly firstVerse: number;
212
+ readonly kind: "quran-chunk";
213
+ readonly lastVerse: number;
214
+ readonly surahNumber: number;
215
+ readonly verses: readonly [{
216
+ readonly meta: {
217
+ readonly hizbQuarter: number;
218
+ readonly juz: number;
219
+ readonly manzil: number;
220
+ readonly page: number;
221
+ readonly ruku: number;
222
+ readonly sajda: "obligatory" | "recommended" | null;
223
+ };
224
+ readonly number: {
225
+ readonly inQuran: number;
226
+ readonly inSurah: number;
227
+ };
228
+ readonly tafsir: readonly {
229
+ readonly appLocale: "id";
230
+ readonly footnotes: string | null;
231
+ readonly text: string;
232
+ }[];
233
+ readonly text: {
234
+ readonly arabic: string;
235
+ };
236
+ readonly translations: readonly [{
237
+ readonly appLocale: ("de" | "en" | "id") & import("effect/Brand").Brand<"@NakafaAI/AksaraAppLocale">;
238
+ readonly value: {
239
+ readonly footnotes: string;
240
+ readonly text: string;
241
+ };
242
+ }, ...{
243
+ readonly appLocale: ("de" | "en" | "id") & import("effect/Brand").Brand<"@NakafaAI/AksaraAppLocale">;
244
+ readonly value: {
245
+ readonly footnotes: string;
246
+ readonly text: string;
247
+ };
248
+ }[]];
249
+ }, ...{
250
+ readonly meta: {
251
+ readonly hizbQuarter: number;
252
+ readonly juz: number;
253
+ readonly manzil: number;
254
+ readonly page: number;
255
+ readonly ruku: number;
256
+ readonly sajda: "obligatory" | "recommended" | null;
257
+ };
258
+ readonly number: {
259
+ readonly inQuran: number;
260
+ readonly inSurah: number;
261
+ };
262
+ readonly tafsir: readonly {
263
+ readonly appLocale: "id";
264
+ readonly footnotes: string | null;
265
+ readonly text: string;
266
+ }[];
267
+ readonly text: {
268
+ readonly arabic: string;
269
+ };
270
+ readonly translations: readonly [{
271
+ readonly appLocale: ("de" | "en" | "id") & import("effect/Brand").Brand<"@NakafaAI/AksaraAppLocale">;
272
+ readonly value: {
273
+ readonly footnotes: string;
274
+ readonly text: string;
275
+ };
276
+ }, ...{
277
+ readonly appLocale: ("de" | "en" | "id") & import("effect/Brand").Brand<"@NakafaAI/AksaraAppLocale">;
278
+ readonly value: {
279
+ readonly footnotes: string;
280
+ readonly text: string;
281
+ };
282
+ }[]];
283
+ }[]];
284
+ } | {
210
285
  readonly activeAppLocales: readonly [("de" | "en" | "id") & import("effect/Brand").Brand<"@NakafaAI/AksaraAppLocale">, ...(("de" | "en" | "id") & import("effect/Brand").Brand<"@NakafaAI/AksaraAppLocale">)[]];
211
286
  readonly kind: "quran-attribution";
212
287
  readonly sources: readonly [{
@@ -343,81 +418,6 @@ export declare function decodeContentSnapshotRows<E, R>(rows: Stream.Stream<unkn
343
418
  readonly notice: string;
344
419
  readonly sourceId: "mokhtasar-german";
345
420
  })[]];
346
- } | {
347
- readonly firstQuranNumber: number;
348
- readonly firstVerse: number;
349
- readonly kind: "quran-chunk";
350
- readonly lastVerse: number;
351
- readonly surahNumber: number;
352
- readonly verses: readonly [{
353
- readonly meta: {
354
- readonly hizbQuarter: number;
355
- readonly juz: number;
356
- readonly manzil: number;
357
- readonly page: number;
358
- readonly ruku: number;
359
- readonly sajda: "obligatory" | "recommended" | null;
360
- };
361
- readonly number: {
362
- readonly inQuran: number;
363
- readonly inSurah: number;
364
- };
365
- readonly tafsir: readonly {
366
- readonly appLocale: "id";
367
- readonly footnotes: string | null;
368
- readonly text: string;
369
- }[];
370
- readonly text: {
371
- readonly arabic: string;
372
- };
373
- readonly translations: readonly [{
374
- readonly appLocale: ("de" | "en" | "id") & import("effect/Brand").Brand<"@NakafaAI/AksaraAppLocale">;
375
- readonly value: {
376
- readonly footnotes: string;
377
- readonly text: string;
378
- };
379
- }, ...{
380
- readonly appLocale: ("de" | "en" | "id") & import("effect/Brand").Brand<"@NakafaAI/AksaraAppLocale">;
381
- readonly value: {
382
- readonly footnotes: string;
383
- readonly text: string;
384
- };
385
- }[]];
386
- }, ...{
387
- readonly meta: {
388
- readonly hizbQuarter: number;
389
- readonly juz: number;
390
- readonly manzil: number;
391
- readonly page: number;
392
- readonly ruku: number;
393
- readonly sajda: "obligatory" | "recommended" | null;
394
- };
395
- readonly number: {
396
- readonly inQuran: number;
397
- readonly inSurah: number;
398
- };
399
- readonly tafsir: readonly {
400
- readonly appLocale: "id";
401
- readonly footnotes: string | null;
402
- readonly text: string;
403
- }[];
404
- readonly text: {
405
- readonly arabic: string;
406
- };
407
- readonly translations: readonly [{
408
- readonly appLocale: ("de" | "en" | "id") & import("effect/Brand").Brand<"@NakafaAI/AksaraAppLocale">;
409
- readonly value: {
410
- readonly footnotes: string;
411
- readonly text: string;
412
- };
413
- }, ...{
414
- readonly appLocale: ("de" | "en" | "id") & import("effect/Brand").Brand<"@NakafaAI/AksaraAppLocale">;
415
- readonly value: {
416
- readonly footnotes: string;
417
- readonly text: string;
418
- };
419
- }[]];
420
- }[]];
421
421
  } | {
422
422
  readonly name: {
423
423
  readonly arabic: string;
@@ -468,23 +468,11 @@ export declare function decodeContentSnapshotRows<E, R>(rows: Stream.Stream<unkn
468
468
  };
469
469
  readonly sourceRevision: string;
470
470
  readonly title: string;
471
+ readonly countryCode: string;
471
472
  readonly countryKey: string;
472
- readonly examKey: string;
473
- readonly kind: "section";
474
- readonly marks?: {
475
- readonly blank: number;
476
- readonly correct: number;
477
- readonly wrong: number;
478
- };
473
+ readonly kind: "country";
479
474
  readonly order: number;
480
- readonly publicPath?: (string & import("effect/Brand").Brand<"@NakafaAI/AksaraPublicPath">) | undefined;
481
- readonly questionCount: number;
482
- readonly questionSourcePath: string & import("effect/Brand").Brand<"@NakafaAI/AksaraCorpusSourcePath">;
483
- readonly sectionKey: string;
484
- readonly setKey: string;
485
- readonly timeLimitSeconds: number;
486
- readonly trackKey: string;
487
- readonly visibility: "internal-entry" | "visible";
475
+ readonly publicPath: string & import("effect/Brand").Brand<"@NakafaAI/AksaraPublicPath">;
488
476
  } | {
489
477
  readonly appLocale: ("de" | "en" | "id") & import("effect/Brand").Brand<"@NakafaAI/AksaraAppLocale">;
490
478
  readonly description?: string | undefined;
@@ -499,16 +487,10 @@ export declare function decodeContentSnapshotRows<E, R>(rows: Stream.Stream<unkn
499
487
  readonly title: string;
500
488
  readonly countryKey: string;
501
489
  readonly examKey: string;
502
- readonly internalEntrySectionKey?: string | undefined;
503
- readonly kind: "set";
490
+ readonly kind: "exam";
504
491
  readonly order: number;
505
492
  readonly publicPath: string & import("effect/Brand").Brand<"@NakafaAI/AksaraPublicPath">;
506
- readonly questionCount: number;
507
493
  readonly scoringStrategy: "irt" | "penalized" | "raw";
508
- readonly sectionCount: number;
509
- readonly setKey: string;
510
- readonly trackKey: string;
511
- readonly visibleSectionCount: number;
512
494
  } | {
513
495
  readonly appLocale: ("de" | "en" | "id") & import("effect/Brand").Brand<"@NakafaAI/AksaraAppLocale">;
514
496
  readonly description?: string | undefined;
@@ -546,10 +528,16 @@ export declare function decodeContentSnapshotRows<E, R>(rows: Stream.Stream<unkn
546
528
  readonly title: string;
547
529
  readonly countryKey: string;
548
530
  readonly examKey: string;
549
- readonly kind: "exam";
531
+ readonly internalEntrySectionKey?: string | undefined;
532
+ readonly kind: "set";
550
533
  readonly order: number;
551
534
  readonly publicPath: string & import("effect/Brand").Brand<"@NakafaAI/AksaraPublicPath">;
535
+ readonly questionCount: number;
552
536
  readonly scoringStrategy: "irt" | "penalized" | "raw";
537
+ readonly sectionCount: number;
538
+ readonly setKey: string;
539
+ readonly trackKey: string;
540
+ readonly visibleSectionCount: number;
553
541
  } | {
554
542
  readonly appLocale: ("de" | "en" | "id") & import("effect/Brand").Brand<"@NakafaAI/AksaraAppLocale">;
555
543
  readonly description?: string | undefined;
@@ -562,11 +550,23 @@ export declare function decodeContentSnapshotRows<E, R>(rows: Stream.Stream<unkn
562
550
  };
563
551
  readonly sourceRevision: string;
564
552
  readonly title: string;
565
- readonly countryCode: string;
566
553
  readonly countryKey: string;
567
- readonly kind: "country";
554
+ readonly examKey: string;
555
+ readonly kind: "section";
556
+ readonly marks?: {
557
+ readonly blank: number;
558
+ readonly correct: number;
559
+ readonly wrong: number;
560
+ };
568
561
  readonly order: number;
569
- readonly publicPath: string & import("effect/Brand").Brand<"@NakafaAI/AksaraPublicPath">;
562
+ readonly publicPath?: (string & import("effect/Brand").Brand<"@NakafaAI/AksaraPublicPath">) | undefined;
563
+ readonly questionCount: number;
564
+ readonly questionSourcePath: string & import("effect/Brand").Brand<"@NakafaAI/AksaraCorpusSourcePath">;
565
+ readonly sectionKey: string;
566
+ readonly setKey: string;
567
+ readonly timeLimitSeconds: number;
568
+ readonly trackKey: string;
569
+ readonly visibility: "internal-entry" | "visible";
570
570
  };
571
571
  readonly rowHash: string & import("effect/Brand").Brand<"@NakafaAI/AksaraSha256Hash">;
572
572
  };
@@ -599,6 +599,35 @@ export declare function decodeContentSnapshotRows<E, R>(rows: Stream.Stream<unkn
599
599
  readonly questionSourcePath: string & import("effect/Brand").Brand<"@NakafaAI/AksaraCorpusSourcePath">;
600
600
  readonly rendererDomain: "ai-ds" | "biology" | "chemistry" | "mathematics" | "physics" | "politics" | "site" | "snbt-general" | "snbt-math" | "snbt-plain" | "snbt-quant" | "tka-math";
601
601
  readonly response: {
602
+ readonly kind: "single-choice";
603
+ readonly options: readonly {
604
+ readonly isCorrect: boolean;
605
+ readonly label: string;
606
+ readonly optionKey: string;
607
+ readonly order: number;
608
+ }[];
609
+ } | {
610
+ readonly kind: "multiple-choice";
611
+ readonly options: readonly {
612
+ readonly isCorrect: boolean;
613
+ readonly label: string;
614
+ readonly optionKey: string;
615
+ readonly order: number;
616
+ }[];
617
+ } | {
618
+ readonly categories: readonly {
619
+ readonly categoryKey: string;
620
+ readonly label: string;
621
+ readonly order: number;
622
+ }[];
623
+ readonly kind: "category";
624
+ readonly statements: readonly {
625
+ readonly correctCategoryKey: string;
626
+ readonly label: string;
627
+ readonly order: number;
628
+ readonly statementKey: string;
629
+ }[];
630
+ } | {
602
631
  readonly criteria: readonly {
603
632
  readonly criterionKey: string;
604
633
  readonly finalAnswer?: {
@@ -633,35 +662,6 @@ export declare function decodeContentSnapshotRows<E, R>(rows: Stream.Stream<unkn
633
662
  }[];
634
663
  }[];
635
664
  readonly kind: "rubric";
636
- } | {
637
- readonly categories: readonly {
638
- readonly categoryKey: string;
639
- readonly label: string;
640
- readonly order: number;
641
- }[];
642
- readonly kind: "category";
643
- readonly statements: readonly {
644
- readonly correctCategoryKey: string;
645
- readonly label: string;
646
- readonly order: number;
647
- readonly statementKey: string;
648
- }[];
649
- } | {
650
- readonly kind: "multiple-choice";
651
- readonly options: readonly {
652
- readonly isCorrect: boolean;
653
- readonly label: string;
654
- readonly optionKey: string;
655
- readonly order: number;
656
- }[];
657
- } | {
658
- readonly kind: "single-choice";
659
- readonly options: readonly {
660
- readonly isCorrect: boolean;
661
- readonly label: string;
662
- readonly optionKey: string;
663
- readonly order: number;
664
- }[];
665
665
  } | {
666
666
  readonly key: {
667
667
  readonly acceptsFractions: boolean;
@@ -1,7 +1,7 @@
1
1
  import { Effect, Schema } from "effect";
2
- import { ReleaseIdSchema, Sha256HashSchema } from "#contracts/ids";
3
2
  import { hashContentReleaseManifest } from "#contracts/release/hash";
4
3
  import { ContentReleaseBundleSchema, RollbackContentReleaseBundleSchema, } from "#contracts/release/lifecycle";
4
+ import { ReleaseHashMismatchFields } from "#contracts/release/mismatch";
5
5
  import { canonicalizeContentReleaseSigningInput } from "#contracts/release/signing";
6
6
  import { SignedContentReleaseSchema, } from "#contracts/release/spec";
7
7
  import { validateRendererManifestHash } from "#contracts/renderer/manifest";
@@ -12,11 +12,7 @@ export class ReleaseVerificationDecodeError extends Schema.TaggedError()("Releas
12
12
  }) {
13
13
  }
14
14
  /** The envelope hash does not identify its complete canonical manifest. */
15
- export class ReleaseManifestHashMismatchError extends Schema.TaggedError()("ReleaseManifestHashMismatchError", {
16
- actualHash: Sha256HashSchema,
17
- expectedHash: Sha256HashSchema,
18
- releaseId: ReleaseIdSchema,
19
- }) {
15
+ export class ReleaseManifestHashMismatchError extends Schema.TaggedError()("ReleaseManifestHashMismatchError", { ...ReleaseHashMismatchFields }) {
20
16
  }
21
17
  /** Stored release recovery input does not satisfy its exact bundle contract. */
22
18
  export class ReleaseBundleVerificationDecodeError extends Schema.TaggedError()("ReleaseBundleVerificationDecodeError", {
@@ -1,5 +1,5 @@
1
1
  import { Array as Arr, Effect, HashSet, Schema } from "effect";
2
- import { SignedContentArtifactSchema, } from "#contracts/content";
2
+ import { SignedContentArtifactSchema } from "#contracts/content";
3
3
  import { decodeContract } from "#contracts/decode";
4
4
  import { ProtectedContentDeliverySchema, } from "#contracts/delivery";
5
5
  import { ContentKeySchema, CorpusSourcePathSchema, Sha256HashSchema, } from "#contracts/ids";
@@ -495,21 +495,6 @@ export declare const decodePublicContentRuntimeResponse: (input: unknown) => Eff
495
495
  readonly activeReleaseId: string & import("effect/Brand").Brand<"@NakafaAI/AksaraReleaseId">;
496
496
  readonly delivery: "public";
497
497
  readonly projection: {
498
- readonly appLocale: ("de" | "en" | "id") & import("effect/Brand").Brand<"@NakafaAI/AksaraAppLocale">;
499
- readonly artifactLocale: ("de" | "en" | "id") & import("effect/Brand").Brand<"@NakafaAI/AksaraArtifactLocale">;
500
- readonly contentKey: string & import("effect/Brand").Brand<"@NakafaAI/AksaraContentKey">;
501
- readonly pageKey: string & import("effect/Brand").Brand<"@NakafaAI/AksaraPageKey">;
502
- readonly publicPath: string & import("effect/Brand").Brand<"@NakafaAI/AksaraPublicPath">;
503
- readonly kind: "public-page";
504
- readonly metadata: {
505
- readonly dateModified?: string;
506
- readonly datePublished: string;
507
- readonly description: string;
508
- readonly title: string;
509
- };
510
- readonly sitemap: true;
511
- readonly sourcePath: string & import("effect/Brand").Brand<"@NakafaAI/AksaraCorpusSourcePath">;
512
- } | {
513
498
  readonly appLocale: ("de" | "en" | "id") & import("effect/Brand").Brand<"@NakafaAI/AksaraAppLocale">;
514
499
  readonly articleRouteSlug: string & import("effect/Brand").Brand<"@NakafaAI/AksaraArticleRouteSlug">;
515
500
  readonly articleSlug: string & import("effect/Brand").Brand<"@NakafaAI/AksaraArticleSlug">;
@@ -578,6 +563,21 @@ export declare const decodePublicContentRuntimeResponse: (input: unknown) => Eff
578
563
  readonly parentPath: string & import("effect/Brand").Brand<"@NakafaAI/AksaraPublicPath">;
579
564
  readonly sitemap: true;
580
565
  readonly topicTitle: string;
566
+ } | {
567
+ readonly appLocale: ("de" | "en" | "id") & import("effect/Brand").Brand<"@NakafaAI/AksaraAppLocale">;
568
+ readonly artifactLocale: ("de" | "en" | "id") & import("effect/Brand").Brand<"@NakafaAI/AksaraArtifactLocale">;
569
+ readonly contentKey: string & import("effect/Brand").Brand<"@NakafaAI/AksaraContentKey">;
570
+ readonly pageKey: string & import("effect/Brand").Brand<"@NakafaAI/AksaraPageKey">;
571
+ readonly publicPath: string & import("effect/Brand").Brand<"@NakafaAI/AksaraPublicPath">;
572
+ readonly kind: "public-page";
573
+ readonly metadata: {
574
+ readonly dateModified?: string;
575
+ readonly datePublished: string;
576
+ readonly description: string;
577
+ readonly title: string;
578
+ };
579
+ readonly sitemap: true;
580
+ readonly sourcePath: string & import("effect/Brand").Brand<"@NakafaAI/AksaraCorpusSourcePath">;
581
581
  };
582
582
  readonly projectionHash: string & import("effect/Brand").Brand<"@NakafaAI/AksaraSha256Hash">;
583
583
  } | {
@@ -1,4 +1,4 @@
1
- import { Array as Arr, Effect } from "effect";
1
+ import { Array as Arr, Effect, Option } from "effect";
2
2
  import { verifySignedContentArtifact } from "#contracts/artifact/verify";
3
3
  import { hashContentProjection } from "#contracts/projection/hash";
4
4
  import { verifyContentReleaseBundle } from "#contracts/release/verify";
@@ -62,7 +62,11 @@ const verifyPublicRelease = Effect.fn("AksaraContracts.verifyPublicRelease")(fun
62
62
  });
63
63
  }
64
64
  });
65
- /** Authenticates one public response and applies its explicit use policy. */
65
+ /**
66
+ * Authenticates one public response. With a live renderer manifest it also
67
+ * proves that the renderer can execute the artifact; without one the response
68
+ * is evidence only.
69
+ */
66
70
  const verifyPublicRuntimeExchange = Effect.fn("AksaraContracts.verifyPublicRuntimeExchange")(function* (input) {
67
71
  const request = yield* decodePublicContentRuntimeRequest(input.request);
68
72
  const response = yield* decodePublicContentRuntimeResponse(input.response);
@@ -79,10 +83,10 @@ const verifyPublicRuntimeExchange = Effect.fn("AksaraContracts.verifyPublicRunti
79
83
  artifact: response.artifact,
80
84
  rendererManifest: bundle.rendererManifest,
81
85
  });
82
- if (input.policy.kind === "evidence") {
86
+ if (Option.isNone(input.rendererManifest)) {
83
87
  return response;
84
88
  }
85
- const liveRenderer = yield* validateRendererManifestHash(input.policy.rendererManifest);
89
+ const liveRenderer = yield* validateRendererManifestHash(input.rendererManifest.value);
86
90
  if (liveRenderer.hash !== bundle.rendererManifest.hash) {
87
91
  yield* verifyContentRendererCompatibility({
88
92
  payload: artifact.payload,
@@ -100,7 +104,7 @@ const verifyPublicRuntimeExchange = Effect.fn("AksaraContracts.verifyPublicRunti
100
104
  export const verifyContentRuntimeEvidenceExchange = Effect.fn("AksaraContracts.verifyContentRuntimeEvidenceExchange")(function* (input) {
101
105
  return yield* verifyPublicRuntimeExchange({
102
106
  ...input,
103
- policy: { kind: "evidence" },
107
+ rendererManifest: Option.none(),
104
108
  });
105
109
  });
106
110
  /**
@@ -111,10 +115,7 @@ export const verifyContentRuntimeEvidenceExchange = Effect.fn("AksaraContracts.v
111
115
  */
112
116
  export const verifyContentRuntimeExchange = Effect.fn("AksaraContracts.verifyContentRuntimeExchange")(function* (input) {
113
117
  return yield* verifyPublicRuntimeExchange({
114
- policy: {
115
- kind: "execution",
116
- rendererManifest: input.rendererManifest,
117
- },
118
+ rendererManifest: Option.some(input.rendererManifest),
118
119
  request: input.request,
119
120
  response: input.response,
120
121
  });