@nakafa/aksara-contracts 0.47.0 → 0.47.2

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 (81) hide show
  1. package/dist/content.d.ts +8 -6
  2. package/dist/content.js +8 -3
  3. package/dist/math/arc.js +5 -1
  4. package/dist/math/base.js +6 -6
  5. package/dist/math/collision.d.ts +4 -4
  6. package/dist/math/collision.js +15 -9
  7. package/dist/math/coordinate.d.ts +24 -13
  8. package/dist/math/coordinate.js +16 -2
  9. package/dist/math/extent.d.ts +26 -17
  10. package/dist/math/extent.js +18 -2
  11. package/dist/math/intersection.d.ts +21 -11
  12. package/dist/math/intersection.js +14 -1
  13. package/dist/math/precision.js +3 -3
  14. package/dist/math/proximity.d.ts +11 -7
  15. package/dist/math/proximity.js +21 -4
  16. package/dist/math/rational.d.ts +6 -5
  17. package/dist/math/rational.js +6 -1
  18. package/dist/math/resolution.d.ts +1 -1
  19. package/dist/math/resolution.js +12 -4
  20. package/dist/math/scene.d.ts +22 -3
  21. package/dist/preview/auth.js +2 -1
  22. package/dist/preview/target.js +7 -0
  23. package/dist/program/curriculum.js +2 -1
  24. package/dist/program/snapshot/digest.js +32 -31
  25. package/dist/program/snapshot/hash.js +2 -1
  26. package/dist/program/spec.js +2 -1
  27. package/dist/projection/article.js +2 -1
  28. package/dist/projection/material.js +2 -1
  29. package/dist/projection/page.js +2 -1
  30. package/dist/projection/question.d.ts +544 -17
  31. package/dist/projection/question.js +17 -3
  32. package/dist/projection/verify.d.ts +4 -3
  33. package/dist/projection/verify.js +14 -7
  34. package/dist/question/answer.d.ts +12 -6
  35. package/dist/question/answer.js +17 -2
  36. package/dist/question/item.js +5 -4
  37. package/dist/question/response.js +3 -3
  38. package/dist/question/rubric.js +2 -1
  39. package/dist/quran/identity.js +11 -0
  40. package/dist/quran/notes.js +13 -0
  41. package/dist/quran/provenance.js +3 -2
  42. package/dist/quran/snapshot/digest.js +4 -3
  43. package/dist/quran/snapshot/hash.js +2 -1
  44. package/dist/quran/snapshot/row/hash.js +5 -4
  45. package/dist/quran/snapshot/spec.js +3 -2
  46. package/dist/release/canonical.js +2 -1
  47. package/dist/release/head.js +2 -1
  48. package/dist/release/items.d.ts +5 -4
  49. package/dist/release/items.js +14 -9
  50. package/dist/release/result/digest.js +4 -4
  51. package/dist/release/rollback/spec.js +6 -5
  52. package/dist/release/route/spec.js +4 -3
  53. package/dist/release/route/verify.d.ts +4 -3
  54. package/dist/release/route/verify.js +9 -6
  55. package/dist/release/signing.js +2 -1
  56. package/dist/release/snapshot/data.js +3 -2
  57. package/dist/release/snapshot/evidence/tryout.js +6 -1
  58. package/dist/release/snapshot/spec.js +7 -6
  59. package/dist/release/snapshot/verify.d.ts +27 -4
  60. package/dist/release/snapshot/verify.js +13 -9
  61. package/dist/renderer/compatibility.js +8 -5
  62. package/dist/renderer/contract.js +5 -4
  63. package/dist/runtime/protected/limits.js +2 -1
  64. package/dist/runtime/protected/spec.js +3 -3
  65. package/dist/text/json.d.ts +5 -0
  66. package/dist/text/json.js +5 -0
  67. package/dist/transport/request.d.ts +108 -108
  68. package/dist/tryout/closure/accounting.d.ts +5 -3
  69. package/dist/tryout/closure/accounting.js +12 -10
  70. package/dist/tryout/closure/locale.js +32 -24
  71. package/dist/tryout/closure/placement.js +3 -2
  72. package/dist/tryout/hash/catalog.js +11 -10
  73. package/dist/tryout/hash/content.js +2 -1
  74. package/dist/tryout/hash/placement.js +2 -1
  75. package/dist/tryout/language.js +2 -4
  76. package/dist/tryout/runtime/canonical.js +2 -1
  77. package/dist/tryout/scoring.d.ts +13 -9
  78. package/dist/tryout/scoring.js +17 -8
  79. package/dist/tryout/snapshot/canonical.js +2 -1
  80. package/dist/tryout/snapshot/hash.js +2 -1
  81. package/package.json +1 -1
@@ -1,10 +1,11 @@
1
1
  import { canonicalizeReleaseOrigin } from "#contracts/release/origin";
2
2
  import { canonicalizePublicationScope } from "#contracts/release/snapshot/scope";
3
3
  import { canonicalizeContentSnapshotSet } from "#contracts/release/snapshot/spec";
4
+ import { encodeJsonText } from "#contracts/text/json";
4
5
  const CONTENT_RELEASE_SIGNATURE_DOMAIN = "nakafa.aksara.localized-content-release";
5
6
  /** Produces stable manifest bytes including locale and source identity. */
6
7
  export function canonicalizeContentReleaseManifest(manifest) {
7
- return JSON.stringify({
8
+ return encodeJsonText({
8
9
  activeAppLocales: manifest.activeAppLocales,
9
10
  baseActiveAppLocales: manifest.baseActiveAppLocales,
10
11
  baseManifestHash: manifest.baseManifestHash,
@@ -4,6 +4,7 @@ import { ProgramSnapshotRowSchema } from "#contracts/program/snapshot/row";
4
4
  import { ProgramSnapshotSchema } from "#contracts/program/snapshot/spec";
5
5
  import { QuranSnapshotRowSchema } from "#contracts/quran/snapshot/row";
6
6
  import { QuranSnapshotSchema } from "#contracts/quran/snapshot/spec";
7
+ import { encodeJsonText } from "#contracts/text/json";
7
8
  import { TryoutCatalogRecordSchema } from "#contracts/tryout/catalog";
8
9
  import { TryoutPlacementRecordSchema } from "#contracts/tryout/placement";
9
10
  import { TryoutSnapshotSchema } from "#contracts/tryout/snapshot/spec";
@@ -64,9 +65,9 @@ export function contentSnapshotId(snapshot) {
64
65
  /** Serializes one structured row with stable envelope field order. */
65
66
  export function canonicalizeContentSnapshotRow(row) {
66
67
  if (row.family === "program" || row.family === "quran") {
67
- return JSON.stringify({ family: row.family, record: row.record });
68
+ return encodeJsonText({ family: row.family, record: row.record });
68
69
  }
69
- return JSON.stringify({
70
+ return encodeJsonText({
70
71
  family: row.family,
71
72
  record: row.record,
72
73
  rowKind: row.rowKind,
@@ -1,9 +1,14 @@
1
- import { Effect, Result, Stream } from "effect";
1
+ import { Effect, Result, Schema, Stream } from "effect";
2
2
  import { requireSnapshotEvidence, } from "#contracts/release/snapshot/evidence/requirement";
3
3
  import { verifyTryoutLocaleClosure } from "#contracts/tryout/closure/locale";
4
4
  import { digestTryoutCatalog } from "#contracts/tryout/hash/catalog";
5
5
  import { digestTryoutPlacements } from "#contracts/tryout/hash/placement";
6
6
  import { makeTryoutSnapshot } from "#contracts/tryout/snapshot/hash";
7
+ import { TryoutCatalogCountsSchema } from "#contracts/tryout/snapshot/spec";
8
+ const TryoutCatalogEvidenceSchema = Schema.Struct({
9
+ counts: TryoutCatalogCountsSchema,
10
+ routeCount: Schema.Finite,
11
+ });
7
12
  /** Selects current hierarchy rows while preserving source failures. */
8
13
  function currentTryoutCatalog(rows) {
9
14
  return rows.pipe(Stream.filterMap((row) => row.family === "tryout" && row.rowKind === "catalog"
@@ -1,7 +1,8 @@
1
1
  /** Signed structured snapshot transition contracts. */
2
- import { Schema } from "effect";
2
+ import { Record as Rec, Schema } from "effect";
3
3
  import { Sha256HashSchema } from "#contracts/ids";
4
4
  import { ContentSnapshotKindSchema, } from "#contracts/release/snapshot/scope";
5
+ import { encodeJsonText } from "#contracts/text/json";
5
6
  /** Canonical digest for a release that stages no structured snapshot rows. */
6
7
  export const EMPTY_SNAPSHOT_ROW_DIGEST = Sha256HashSchema.make("sha256:eb27aa7f59e41b14a3f76d951c5a50cb954a19f3f6e6c44bc21a733f606e888f");
7
8
  const RowCountSchema = Schema.Int.pipe(Schema.check(Schema.isGreaterThanOrEqualTo(0)));
@@ -97,15 +98,15 @@ export function invertContentSnapshots(snapshots) {
97
98
  }
98
99
  /** Checks that an initial release does not claim an unstated snapshot base. */
99
100
  export function hasEmptySnapshotBases(snapshots) {
100
- return Object.values(snapshots).every(({ baseSnapshotId }) => baseSnapshotId === null);
101
+ return Rec.values(snapshots).every(({ baseSnapshotId }) => baseSnapshotId === null);
101
102
  }
102
103
  /** Checks that a rollback only inherits or restores immutable snapshots. */
103
104
  export function hasRollbackSnapshotModes(snapshots) {
104
- return Object.values(snapshots).every(({ mode }) => mode !== "replace");
105
+ return Rec.values(snapshots).every(({ mode }) => mode !== "replace");
105
106
  }
106
107
  /** Checks that reviewed Git sources only inherit or replace snapshots. */
107
108
  export function hasGitSnapshotModes(snapshots) {
108
- return Object.values(snapshots).every(({ mode }) => mode !== "restore");
109
+ return Rec.values(snapshots).every(({ mode }) => mode !== "restore");
109
110
  }
110
111
  /** Returns the number of rows that must be staged for this release. */
111
112
  export function snapshotRowCount(snapshots) {
@@ -133,6 +134,6 @@ export function canonicalizeContentSnapshotSet(snapshots) {
133
134
  }
134
135
  /** Compares two fixed snapshot sets through their stable signed form. */
135
136
  export function hasSameContentSnapshots(left, right) {
136
- return (JSON.stringify(canonicalizeContentSnapshotSet(left)) ===
137
- JSON.stringify(canonicalizeContentSnapshotSet(right)));
137
+ return (encodeJsonText(canonicalizeContentSnapshotSet(left)) ===
138
+ encodeJsonText(canonicalizeContentSnapshotSet(right)));
138
139
  }
@@ -41,11 +41,34 @@ declare const SnapshotStagedCountError_base: Schema.Class<SnapshotStagedCountErr
41
41
  /** The staged row stream count differs from all signed family evidence. */
42
42
  export declare class SnapshotStagedCountError extends SnapshotStagedCountError_base {
43
43
  }
44
+ declare const VerifiedContentSnapshotsSchema: Schema.Struct<{
45
+ readonly snapshots: Schema.Struct<{
46
+ readonly program: Schema.Struct<{
47
+ readonly baseSnapshotId: Schema.NullOr<Schema.brand<Schema.String, "@NakafaAI/AksaraSha256Hash">>;
48
+ readonly mode: Schema.Literals<readonly ["inherit", "replace", "restore"]>;
49
+ readonly resultSnapshotId: Schema.NullOr<Schema.brand<Schema.String, "@NakafaAI/AksaraSha256Hash">>;
50
+ readonly rowCount: Schema.Int;
51
+ readonly rowDigest: Schema.brand<Schema.String, "@NakafaAI/AksaraSha256Hash">;
52
+ }>;
53
+ readonly quran: Schema.Struct<{
54
+ readonly baseSnapshotId: Schema.NullOr<Schema.brand<Schema.String, "@NakafaAI/AksaraSha256Hash">>;
55
+ readonly mode: Schema.Literals<readonly ["inherit", "replace", "restore"]>;
56
+ readonly resultSnapshotId: Schema.NullOr<Schema.brand<Schema.String, "@NakafaAI/AksaraSha256Hash">>;
57
+ readonly rowCount: Schema.Int;
58
+ readonly rowDigest: Schema.brand<Schema.String, "@NakafaAI/AksaraSha256Hash">;
59
+ }>;
60
+ readonly tryout: Schema.Struct<{
61
+ readonly baseSnapshotId: Schema.NullOr<Schema.brand<Schema.String, "@NakafaAI/AksaraSha256Hash">>;
62
+ readonly mode: Schema.Literals<readonly ["inherit", "replace", "restore"]>;
63
+ readonly resultSnapshotId: Schema.NullOr<Schema.brand<Schema.String, "@NakafaAI/AksaraSha256Hash">>;
64
+ readonly rowCount: Schema.Int;
65
+ readonly rowDigest: Schema.brand<Schema.String, "@NakafaAI/AksaraSha256Hash">;
66
+ }>;
67
+ }>;
68
+ readonly stagedRows: Schema.Finite;
69
+ }>;
44
70
  /** Fixed verified snapshot state selected by one global release. */
45
- export interface VerifiedContentSnapshots {
46
- readonly snapshots: ContentSnapshotSet;
47
- readonly stagedRows: number;
48
- }
71
+ export type VerifiedContentSnapshots = typeof VerifiedContentSnapshotsSchema.Type;
49
72
  /** Strictly decodes replayable replacement manifests in canonical order. */
50
73
  export declare function decodeContentSnapshotManifests<E, R>(manifests: Stream.Stream<unknown, E, R>): Stream.Stream<{
51
74
  readonly family: "program";
@@ -1,4 +1,4 @@
1
- import { Effect, Schema, Stream } from "effect";
1
+ import { Effect, MutableRef, Option, Schema, Stream } from "effect";
2
2
  import { ContentSnapshotManifestSchema, ContentSnapshotRowSchema, } from "#contracts/release/snapshot/data";
3
3
  import { verifySnapshotRows } from "#contracts/release/snapshot/evidence";
4
4
  import { ContentSnapshotKindSchema, } from "#contracts/release/snapshot/scope";
@@ -34,6 +34,10 @@ export class SnapshotStagedCountError extends Schema.TaggedError()("SnapshotStag
34
34
  verifiedCount: StreamIndexSchema,
35
35
  }) {
36
36
  }
37
+ const VerifiedContentSnapshotsSchema = Schema.Struct({
38
+ snapshots: ContentSnapshotSetSchema,
39
+ stagedRows: Schema.Finite,
40
+ });
37
41
  const familyOrder = {
38
42
  program: 0,
39
43
  quran: 1,
@@ -56,28 +60,28 @@ function snapshotRowEvidence(snapshot) {
56
60
  return tryoutSnapshotRowEvidence(snapshot.manifest);
57
61
  }
58
62
  /** Strictly decodes one manifest and advances canonical family order. */
59
- function decodeManifest(state, source, manifestIndex) {
63
+ function decodeManifest(previous, source, manifestIndex) {
60
64
  return Schema.decodeUnknownEffect(ContentSnapshotManifestSchema)(source, {
61
65
  onExcessProperty: "error",
62
66
  }).pipe(Effect.mapError(() => new SnapshotManifestDecodeError({ manifestIndex })), Effect.tap((manifest) => {
63
- const { previous } = state;
64
- if (previous !== undefined &&
65
- familyOrder[previous] >= familyOrder[manifest.family]) {
67
+ const last = MutableRef.get(previous);
68
+ if (Option.isSome(last) &&
69
+ familyOrder[last.value] >= familyOrder[manifest.family]) {
66
70
  return Effect.fail(new SnapshotManifestOrderError({
67
71
  actualFamily: manifest.family,
68
72
  manifestIndex,
69
- previousFamily: previous,
73
+ previousFamily: last.value,
70
74
  }));
71
75
  }
72
- state.previous = manifest.family;
76
+ MutableRef.set(previous, Option.some(manifest.family));
73
77
  return Effect.void;
74
78
  }));
75
79
  }
76
80
  /** Strictly decodes replayable replacement manifests in canonical order. */
77
81
  export function decodeContentSnapshotManifests(manifests) {
78
82
  return Stream.unwrap(Effect.sync(() => {
79
- const state = { previous: undefined };
80
- return manifests.pipe(Stream.zipWithIndex, Stream.mapEffect(([source, manifestIndex]) => decodeManifest(state, source, manifestIndex)));
83
+ const previous = MutableRef.make(Option.none());
84
+ return manifests.pipe(Stream.zipWithIndex, Stream.mapEffect(([source, manifestIndex]) => decodeManifest(previous, source, manifestIndex)));
81
85
  }));
82
86
  }
83
87
  /** Strictly decodes replayable structured rows without retaining bodies. */
@@ -1,4 +1,4 @@
1
- import { Effect, Schema } from "effect";
1
+ import { Effect, HashSet, Schema } from "effect";
2
2
  import { ArtifactRendererComponentMissingError, ArtifactRendererDomainUnpublishedError, } from "#contracts/artifact/spec";
3
3
  import { RendererComponentNameSchema, } from "#contracts/renderer/component";
4
4
  import { selectRendererDomainCapability, } from "#contracts/renderer/contract";
@@ -19,9 +19,9 @@ export class RendererManifestComponentUnsupportedError extends Schema.TaggedErro
19
19
  }
20
20
  /** Requires every frozen renderer name from one physical registry. */
21
21
  const verifyCapabilitySuperset = Effect.fn("AksaraContracts.verifyRendererCapabilitySuperset")(function* (frozen, live, rendererScope) {
22
- const supported = new Set(live);
22
+ const supported = HashSet.fromIterable(live);
23
23
  for (const componentName of frozen) {
24
- if (supported.has(componentName)) {
24
+ if (HashSet.has(supported, componentName)) {
25
25
  continue;
26
26
  }
27
27
  return yield* new RendererManifestComponentUnsupportedError({
@@ -58,9 +58,12 @@ export const verifyContentRendererCompatibility = Effect.fn("AksaraContracts.ver
58
58
  });
59
59
  }
60
60
  const domain = yield* selectRendererDomainCapability(manifest, payload.rendererDomain);
61
- const available = new Set([...manifest.base, ...domain.components]);
61
+ const available = HashSet.fromIterable([
62
+ ...manifest.base,
63
+ ...domain.components,
64
+ ]);
62
65
  for (const componentName of payload.requiredComponents) {
63
- if (!available.has(componentName)) {
66
+ if (!HashSet.has(available, componentName)) {
64
67
  return yield* new ArtifactRendererComponentMissingError({
65
68
  componentName,
66
69
  contentKey: payload.contentKey,
@@ -1,7 +1,8 @@
1
- import { Effect, Schema } from "effect";
1
+ import { Effect, HashSet, Schema } from "effect";
2
2
  import { Sha256HashSchema } from "#contracts/ids";
3
3
  import { RendererComponentsSchema, } from "#contracts/renderer/component";
4
4
  import { RENDERER_DOMAINS, RendererDomainSchema, } from "#contracts/renderer/domain";
5
+ import { encodeJsonText } from "#contracts/text/json";
5
6
  import { compareCodeUnits } from "#contracts/text/order";
6
7
  /** Stable format for the one current domain-scoped renderer manifest. */
7
8
  export const RENDERER_MANIFEST_FORMAT = "nakafa-mdx-renderer";
@@ -30,10 +31,10 @@ export const RendererManifestDomainsSchema = Schema.Array(RendererDomainCapabili
30
31
  }));
31
32
  /** Keeps base component names out of every route-owned registry. */
32
33
  function hasDistinctBaseComponents(manifest) {
33
- const baseNames = new Set(manifest.base);
34
+ const baseNames = HashSet.fromIterable(manifest.base);
34
35
  for (const domain of manifest.domains) {
35
36
  for (const name of domain.components) {
36
- if (baseNames.has(name)) {
37
+ if (HashSet.has(baseNames, name)) {
37
38
  return false;
38
39
  }
39
40
  }
@@ -72,7 +73,7 @@ export class RendererManifestHashMismatchError extends Schema.TaggedError()("Ren
72
73
  }
73
74
  /** Serializes the exact domain-scoped renderer tuple covered by SHA-256. */
74
75
  export function canonicalizeRendererManifestContract(input) {
75
- return JSON.stringify([
76
+ return encodeJsonText([
76
77
  RENDERER_MANIFEST_FORMAT,
77
78
  input.base,
78
79
  sortRendererDomains(input.domains).map(({ name, components }) => ({
@@ -1,3 +1,4 @@
1
+ import { encodeJsonText } from "#contracts/text/json";
1
2
  /** Maximum protected selectors accepted in one retained-snapshot read. */
2
3
  export const MAX_PROTECTED_RUNTIME_SELECTORS = 64;
3
4
  /** Maximum UTF-8 bytes accepted by the protected batch endpoint. */
@@ -6,7 +7,7 @@ export const MAX_PROTECTED_RUNTIME_REQUEST_BYTES = 64 * 1024;
6
7
  export const MAX_PROTECTED_RUNTIME_RESPONSE_BYTES = 4 * 1024 * 1024;
7
8
  /** Measures the exact JSON bytes written by the protected HTTP response. */
8
9
  export function protectedRuntimeResponseBytes(response) {
9
- return new TextEncoder().encode(JSON.stringify(response)).byteLength;
10
+ return new TextEncoder().encode(encodeJsonText(response)).byteLength;
10
11
  }
11
12
  /** Keeps every found result inside the protected response wire ceiling. */
12
13
  export function hasBoundedProtectedRuntimeResponse(response) {
@@ -1,4 +1,4 @@
1
- import { Effect, Schema } from "effect";
1
+ import { Effect, HashSet, Schema } from "effect";
2
2
  import { SignedContentArtifactSchema, } from "#contracts/content";
3
3
  import { decodeContract } from "#contracts/decode";
4
4
  import { ContentKeySchema, CorpusSourcePathSchema, Sha256HashSchema, } from "#contracts/ids";
@@ -33,7 +33,7 @@ export const ProtectedContentRuntimeSelectorSchema = Schema.Struct({
33
33
  /** Checks a batch never requests the same immutable artifact twice. */
34
34
  function hasUniqueSelectors(selectors) {
35
35
  const hashes = selectors.map(({ artifactHash }) => artifactHash);
36
- return new Set(hashes).size === hashes.length;
36
+ return HashSet.size(HashSet.fromIterable(hashes)) === hashes.length;
37
37
  }
38
38
  const ProtectedContentRuntimeSelectorsSchema = Schema.Array(ProtectedContentRuntimeSelectorSchema).pipe(Schema.check(Schema.isMinLength(1)), Schema.check(Schema.isMaxLength(MAX_PROTECTED_RUNTIME_SELECTORS)), Schema.check(Schema.makeFilter(hasUniqueSelectors, {
39
39
  message: "Expected unique protected runtime artifact selectors.",
@@ -53,7 +53,7 @@ export const ProtectedContentRuntimeItemSchema = Schema.Struct({
53
53
  /** Checks one protected response never repeats an immutable artifact. */
54
54
  function hasUniqueArtifacts(items) {
55
55
  const hashes = items.map(({ artifact }) => artifact.artifactHash);
56
- return new Set(hashes).size === hashes.length;
56
+ return HashSet.size(HashSet.fromIterable(hashes)) === hashes.length;
57
57
  }
58
58
  const ProtectedContentRuntimeItemsSchema = Schema.Array(ProtectedContentRuntimeItemSchema).pipe(Schema.check(Schema.isMinLength(1)), Schema.check(Schema.isMaxLength(MAX_PROTECTED_RUNTIME_SELECTORS)), Schema.check(Schema.makeFilter(hasUniqueArtifacts, {
59
59
  message: "Expected unique protected runtime artifacts.",
@@ -0,0 +1,5 @@
1
+ import { Schema } from "effect";
2
+ /** The JSON text codec: JSON.stringify when encoding and JSON.parse when decoding, nothing else. */
3
+ export declare const JsonTextSchema: Schema.fromJsonString<Schema.Unknown>;
4
+ /** Writes a value as JSON text with exactly the bytes JSON.stringify writes. */
5
+ export declare const encodeJsonText: (input: unknown, options?: import("effect/SchemaAST").ParseOptions) => string;
@@ -0,0 +1,5 @@
1
+ import { Schema } from "effect";
2
+ /** The JSON text codec: JSON.stringify when encoding and JSON.parse when decoding, nothing else. */
3
+ export const JsonTextSchema = Schema.fromJsonString(Schema.Unknown);
4
+ /** Writes a value as JSON text with exactly the bytes JSON.stringify writes. */
5
+ export const encodeJsonText = Schema.encodeSync(JsonTextSchema);
@@ -3064,24 +3064,6 @@ export declare const decodePublicationRequest: (input: unknown) => Effect.Effect
3064
3064
  readonly family: "tryout";
3065
3065
  readonly record: {
3066
3066
  readonly row: {
3067
- readonly appLocale: ("de" | "en" | "id") & import("effect/Brand").Brand<"@NakafaAI/AksaraAppLocale">;
3068
- readonly description?: string | undefined;
3069
- readonly graph: {
3070
- readonly alignmentId: string;
3071
- readonly assetId: string;
3072
- readonly conceptId: string;
3073
- readonly learningObjectId: string;
3074
- readonly lensId: string;
3075
- };
3076
- readonly sourceRevision: string;
3077
- readonly title: string;
3078
- readonly countryKey: string;
3079
- readonly examKey: string;
3080
- readonly kind: "exam";
3081
- readonly order: number;
3082
- readonly publicPath: string & import("effect/Brand").Brand<"@NakafaAI/AksaraPublicPath">;
3083
- readonly scoringStrategy: "irt" | "penalized" | "raw";
3084
- } | {
3085
3067
  readonly appLocale: ("de" | "en" | "id") & import("effect/Brand").Brand<"@NakafaAI/AksaraAppLocale">;
3086
3068
  readonly description?: string | undefined;
3087
3069
  readonly graph: {
@@ -3157,6 +3139,24 @@ export declare const decodePublicationRequest: (input: unknown) => Effect.Effect
3157
3139
  readonly trackKey: string;
3158
3140
  readonly trackKind: "institution" | "subject" | "year";
3159
3141
  readonly visibleSectionCount: number;
3142
+ } | {
3143
+ readonly appLocale: ("de" | "en" | "id") & import("effect/Brand").Brand<"@NakafaAI/AksaraAppLocale">;
3144
+ readonly description?: string | undefined;
3145
+ readonly graph: {
3146
+ readonly alignmentId: string;
3147
+ readonly assetId: string;
3148
+ readonly conceptId: string;
3149
+ readonly learningObjectId: string;
3150
+ readonly lensId: string;
3151
+ };
3152
+ readonly sourceRevision: string;
3153
+ readonly title: string;
3154
+ readonly countryKey: string;
3155
+ readonly examKey: string;
3156
+ readonly kind: "exam";
3157
+ readonly order: number;
3158
+ readonly publicPath: string & import("effect/Brand").Brand<"@NakafaAI/AksaraPublicPath">;
3159
+ readonly scoringStrategy: "irt" | "penalized" | "raw";
3160
3160
  } | {
3161
3161
  readonly appLocale: ("de" | "en" | "id") & import("effect/Brand").Brand<"@NakafaAI/AksaraAppLocale">;
3162
3162
  readonly description?: string | undefined;
@@ -3630,24 +3630,6 @@ export declare const decodePublicationRequest: (input: unknown) => Effect.Effect
3630
3630
  readonly family: "tryout";
3631
3631
  readonly record: {
3632
3632
  readonly row: {
3633
- readonly appLocale: ("de" | "en" | "id") & import("effect/Brand").Brand<"@NakafaAI/AksaraAppLocale">;
3634
- readonly description?: string | undefined;
3635
- readonly graph: {
3636
- readonly alignmentId: string;
3637
- readonly assetId: string;
3638
- readonly conceptId: string;
3639
- readonly learningObjectId: string;
3640
- readonly lensId: string;
3641
- };
3642
- readonly sourceRevision: string;
3643
- readonly title: string;
3644
- readonly countryKey: string;
3645
- readonly examKey: string;
3646
- readonly kind: "exam";
3647
- readonly order: number;
3648
- readonly publicPath: string & import("effect/Brand").Brand<"@NakafaAI/AksaraPublicPath">;
3649
- readonly scoringStrategy: "irt" | "penalized" | "raw";
3650
- } | {
3651
3633
  readonly appLocale: ("de" | "en" | "id") & import("effect/Brand").Brand<"@NakafaAI/AksaraAppLocale">;
3652
3634
  readonly description?: string | undefined;
3653
3635
  readonly graph: {
@@ -3723,6 +3705,24 @@ export declare const decodePublicationRequest: (input: unknown) => Effect.Effect
3723
3705
  readonly trackKey: string;
3724
3706
  readonly trackKind: "institution" | "subject" | "year";
3725
3707
  readonly visibleSectionCount: number;
3708
+ } | {
3709
+ readonly appLocale: ("de" | "en" | "id") & import("effect/Brand").Brand<"@NakafaAI/AksaraAppLocale">;
3710
+ readonly description?: string | undefined;
3711
+ readonly graph: {
3712
+ readonly alignmentId: string;
3713
+ readonly assetId: string;
3714
+ readonly conceptId: string;
3715
+ readonly learningObjectId: string;
3716
+ readonly lensId: string;
3717
+ };
3718
+ readonly sourceRevision: string;
3719
+ readonly title: string;
3720
+ readonly countryKey: string;
3721
+ readonly examKey: string;
3722
+ readonly kind: "exam";
3723
+ readonly order: number;
3724
+ readonly publicPath: string & import("effect/Brand").Brand<"@NakafaAI/AksaraPublicPath">;
3725
+ readonly scoringStrategy: "irt" | "penalized" | "raw";
3726
3726
  } | {
3727
3727
  readonly appLocale: ("de" | "en" | "id") & import("effect/Brand").Brand<"@NakafaAI/AksaraAppLocale">;
3728
3728
  readonly description?: string | undefined;
@@ -4836,24 +4836,6 @@ export declare const decodePublicationRequest: (input: unknown) => Effect.Effect
4836
4836
  readonly family: "tryout";
4837
4837
  readonly record: {
4838
4838
  readonly row: {
4839
- readonly appLocale: ("de" | "en" | "id") & import("effect/Brand").Brand<"@NakafaAI/AksaraAppLocale">;
4840
- readonly description?: string | undefined;
4841
- readonly graph: {
4842
- readonly alignmentId: string;
4843
- readonly assetId: string;
4844
- readonly conceptId: string;
4845
- readonly learningObjectId: string;
4846
- readonly lensId: string;
4847
- };
4848
- readonly sourceRevision: string;
4849
- readonly title: string;
4850
- readonly countryKey: string;
4851
- readonly examKey: string;
4852
- readonly kind: "exam";
4853
- readonly order: number;
4854
- readonly publicPath: string & import("effect/Brand").Brand<"@NakafaAI/AksaraPublicPath">;
4855
- readonly scoringStrategy: "irt" | "penalized" | "raw";
4856
- } | {
4857
4839
  readonly appLocale: ("de" | "en" | "id") & import("effect/Brand").Brand<"@NakafaAI/AksaraAppLocale">;
4858
4840
  readonly description?: string | undefined;
4859
4841
  readonly graph: {
@@ -4929,6 +4911,24 @@ export declare const decodePublicationRequest: (input: unknown) => Effect.Effect
4929
4911
  readonly trackKey: string;
4930
4912
  readonly trackKind: "institution" | "subject" | "year";
4931
4913
  readonly visibleSectionCount: number;
4914
+ } | {
4915
+ readonly appLocale: ("de" | "en" | "id") & import("effect/Brand").Brand<"@NakafaAI/AksaraAppLocale">;
4916
+ readonly description?: string | undefined;
4917
+ readonly graph: {
4918
+ readonly alignmentId: string;
4919
+ readonly assetId: string;
4920
+ readonly conceptId: string;
4921
+ readonly learningObjectId: string;
4922
+ readonly lensId: string;
4923
+ };
4924
+ readonly sourceRevision: string;
4925
+ readonly title: string;
4926
+ readonly countryKey: string;
4927
+ readonly examKey: string;
4928
+ readonly kind: "exam";
4929
+ readonly order: number;
4930
+ readonly publicPath: string & import("effect/Brand").Brand<"@NakafaAI/AksaraPublicPath">;
4931
+ readonly scoringStrategy: "irt" | "penalized" | "raw";
4932
4932
  } | {
4933
4933
  readonly appLocale: ("de" | "en" | "id") & import("effect/Brand").Brand<"@NakafaAI/AksaraAppLocale">;
4934
4934
  readonly description?: string | undefined;
@@ -5402,24 +5402,6 @@ export declare const decodePublicationRequest: (input: unknown) => Effect.Effect
5402
5402
  readonly family: "tryout";
5403
5403
  readonly record: {
5404
5404
  readonly row: {
5405
- readonly appLocale: ("de" | "en" | "id") & import("effect/Brand").Brand<"@NakafaAI/AksaraAppLocale">;
5406
- readonly description?: string | undefined;
5407
- readonly graph: {
5408
- readonly alignmentId: string;
5409
- readonly assetId: string;
5410
- readonly conceptId: string;
5411
- readonly learningObjectId: string;
5412
- readonly lensId: string;
5413
- };
5414
- readonly sourceRevision: string;
5415
- readonly title: string;
5416
- readonly countryKey: string;
5417
- readonly examKey: string;
5418
- readonly kind: "exam";
5419
- readonly order: number;
5420
- readonly publicPath: string & import("effect/Brand").Brand<"@NakafaAI/AksaraPublicPath">;
5421
- readonly scoringStrategy: "irt" | "penalized" | "raw";
5422
- } | {
5423
5405
  readonly appLocale: ("de" | "en" | "id") & import("effect/Brand").Brand<"@NakafaAI/AksaraAppLocale">;
5424
5406
  readonly description?: string | undefined;
5425
5407
  readonly graph: {
@@ -5495,6 +5477,24 @@ export declare const decodePublicationRequest: (input: unknown) => Effect.Effect
5495
5477
  readonly trackKey: string;
5496
5478
  readonly trackKind: "institution" | "subject" | "year";
5497
5479
  readonly visibleSectionCount: number;
5480
+ } | {
5481
+ readonly appLocale: ("de" | "en" | "id") & import("effect/Brand").Brand<"@NakafaAI/AksaraAppLocale">;
5482
+ readonly description?: string | undefined;
5483
+ readonly graph: {
5484
+ readonly alignmentId: string;
5485
+ readonly assetId: string;
5486
+ readonly conceptId: string;
5487
+ readonly learningObjectId: string;
5488
+ readonly lensId: string;
5489
+ };
5490
+ readonly sourceRevision: string;
5491
+ readonly title: string;
5492
+ readonly countryKey: string;
5493
+ readonly examKey: string;
5494
+ readonly kind: "exam";
5495
+ readonly order: number;
5496
+ readonly publicPath: string & import("effect/Brand").Brand<"@NakafaAI/AksaraPublicPath">;
5497
+ readonly scoringStrategy: "irt" | "penalized" | "raw";
5498
5498
  } | {
5499
5499
  readonly appLocale: ("de" | "en" | "id") & import("effect/Brand").Brand<"@NakafaAI/AksaraAppLocale">;
5500
5500
  readonly description?: string | undefined;
@@ -6606,24 +6606,6 @@ export declare const decodePublicationRequest: (input: unknown) => Effect.Effect
6606
6606
  readonly family: "tryout";
6607
6607
  readonly record: {
6608
6608
  readonly row: {
6609
- readonly appLocale: ("de" | "en" | "id") & import("effect/Brand").Brand<"@NakafaAI/AksaraAppLocale">;
6610
- readonly description?: string | undefined;
6611
- readonly graph: {
6612
- readonly alignmentId: string;
6613
- readonly assetId: string;
6614
- readonly conceptId: string;
6615
- readonly learningObjectId: string;
6616
- readonly lensId: string;
6617
- };
6618
- readonly sourceRevision: string;
6619
- readonly title: string;
6620
- readonly countryKey: string;
6621
- readonly examKey: string;
6622
- readonly kind: "exam";
6623
- readonly order: number;
6624
- readonly publicPath: string & import("effect/Brand").Brand<"@NakafaAI/AksaraPublicPath">;
6625
- readonly scoringStrategy: "irt" | "penalized" | "raw";
6626
- } | {
6627
6609
  readonly appLocale: ("de" | "en" | "id") & import("effect/Brand").Brand<"@NakafaAI/AksaraAppLocale">;
6628
6610
  readonly description?: string | undefined;
6629
6611
  readonly graph: {
@@ -6699,6 +6681,24 @@ export declare const decodePublicationRequest: (input: unknown) => Effect.Effect
6699
6681
  readonly trackKey: string;
6700
6682
  readonly trackKind: "institution" | "subject" | "year";
6701
6683
  readonly visibleSectionCount: number;
6684
+ } | {
6685
+ readonly appLocale: ("de" | "en" | "id") & import("effect/Brand").Brand<"@NakafaAI/AksaraAppLocale">;
6686
+ readonly description?: string | undefined;
6687
+ readonly graph: {
6688
+ readonly alignmentId: string;
6689
+ readonly assetId: string;
6690
+ readonly conceptId: string;
6691
+ readonly learningObjectId: string;
6692
+ readonly lensId: string;
6693
+ };
6694
+ readonly sourceRevision: string;
6695
+ readonly title: string;
6696
+ readonly countryKey: string;
6697
+ readonly examKey: string;
6698
+ readonly kind: "exam";
6699
+ readonly order: number;
6700
+ readonly publicPath: string & import("effect/Brand").Brand<"@NakafaAI/AksaraPublicPath">;
6701
+ readonly scoringStrategy: "irt" | "penalized" | "raw";
6702
6702
  } | {
6703
6703
  readonly appLocale: ("de" | "en" | "id") & import("effect/Brand").Brand<"@NakafaAI/AksaraAppLocale">;
6704
6704
  readonly description?: string | undefined;
@@ -7172,24 +7172,6 @@ export declare const decodePublicationRequest: (input: unknown) => Effect.Effect
7172
7172
  readonly family: "tryout";
7173
7173
  readonly record: {
7174
7174
  readonly row: {
7175
- readonly appLocale: ("de" | "en" | "id") & import("effect/Brand").Brand<"@NakafaAI/AksaraAppLocale">;
7176
- readonly description?: string | undefined;
7177
- readonly graph: {
7178
- readonly alignmentId: string;
7179
- readonly assetId: string;
7180
- readonly conceptId: string;
7181
- readonly learningObjectId: string;
7182
- readonly lensId: string;
7183
- };
7184
- readonly sourceRevision: string;
7185
- readonly title: string;
7186
- readonly countryKey: string;
7187
- readonly examKey: string;
7188
- readonly kind: "exam";
7189
- readonly order: number;
7190
- readonly publicPath: string & import("effect/Brand").Brand<"@NakafaAI/AksaraPublicPath">;
7191
- readonly scoringStrategy: "irt" | "penalized" | "raw";
7192
- } | {
7193
7175
  readonly appLocale: ("de" | "en" | "id") & import("effect/Brand").Brand<"@NakafaAI/AksaraAppLocale">;
7194
7176
  readonly description?: string | undefined;
7195
7177
  readonly graph: {
@@ -7265,6 +7247,24 @@ export declare const decodePublicationRequest: (input: unknown) => Effect.Effect
7265
7247
  readonly trackKey: string;
7266
7248
  readonly trackKind: "institution" | "subject" | "year";
7267
7249
  readonly visibleSectionCount: number;
7250
+ } | {
7251
+ readonly appLocale: ("de" | "en" | "id") & import("effect/Brand").Brand<"@NakafaAI/AksaraAppLocale">;
7252
+ readonly description?: string | undefined;
7253
+ readonly graph: {
7254
+ readonly alignmentId: string;
7255
+ readonly assetId: string;
7256
+ readonly conceptId: string;
7257
+ readonly learningObjectId: string;
7258
+ readonly lensId: string;
7259
+ };
7260
+ readonly sourceRevision: string;
7261
+ readonly title: string;
7262
+ readonly countryKey: string;
7263
+ readonly examKey: string;
7264
+ readonly kind: "exam";
7265
+ readonly order: number;
7266
+ readonly publicPath: string & import("effect/Brand").Brand<"@NakafaAI/AksaraPublicPath">;
7267
+ readonly scoringStrategy: "irt" | "penalized" | "raw";
7268
7268
  } | {
7269
7269
  readonly appLocale: ("de" | "en" | "id") & import("effect/Brand").Brand<"@NakafaAI/AksaraAppLocale">;
7270
7270
  readonly description?: string | undefined;
@@ -1,5 +1,7 @@
1
- import { Effect, Schema } from "effect";
1
+ import { Effect, MutableHashMap, MutableHashSet, Schema } from "effect";
2
2
  import type { ActiveAppLocaleList, AppLocale } from "#contracts/locale";
3
+ /** The app locales seen for each logical row identity. */
4
+ type LocalesByIdentity = MutableHashMap.MutableHashMap<string, MutableHashSet.MutableHashSet<AppLocale>>;
3
5
  declare const TryoutClosureError_base: Schema.Class<TryoutClosureError, Schema.TaggedStruct<"TryoutClosureError", {
4
6
  readonly actual: Schema.String;
5
7
  readonly code: Schema.Literals<readonly ["assessed-language", "duplicate-locale", "fact-mismatch", "inactive-locale", "missing-locale", "missing-section", "question-count"]>;
@@ -10,7 +12,7 @@ declare const TryoutClosureError_base: Schema.Class<TryoutClosureError, Schema.T
10
12
  export declare class TryoutClosureError extends TryoutClosureError_base {
11
13
  }
12
14
  /** Adds one active locale to a logical identity without duplicates. */
13
- export declare function addLocale(localesByIdentity: Map<string, Set<AppLocale>>, activeAppLocales: ActiveAppLocaleList, identity: string, appLocale: AppLocale): Effect.Effect<void, never, never> | Effect.Effect<never, TryoutClosureError, never>;
15
+ export declare function addLocale(localesByIdentity: LocalesByIdentity, activeAppLocales: ActiveAppLocaleList, identity: string, appLocale: AppLocale): Effect.Effect<void, never, never> | Effect.Effect<never, TryoutClosureError, never>;
14
16
  /** Confirms every logical row closes over the exact active locale list. */
15
- export declare function validateLocales(localesByIdentity: Map<string, Set<AppLocale>>, activeAppLocales: ActiveAppLocaleList): Effect.Effect<void, TryoutClosureError, never>;
17
+ export declare function validateLocales(localesByIdentity: LocalesByIdentity, activeAppLocales: ActiveAppLocaleList): Effect.Effect<void, TryoutClosureError, never>;
16
18
  export {};