@nakafa/aksara-contracts 0.48.3 → 0.48.5

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 (54) hide show
  1. package/dist/content.d.ts +2 -2
  2. package/dist/content.js +2 -1
  3. package/dist/date.js +5 -5
  4. package/dist/delivery.d.ts +3 -0
  5. package/dist/delivery.js +5 -0
  6. package/dist/math/base.d.ts +3 -0
  7. package/dist/math/base.js +2 -0
  8. package/dist/math/collision.js +2 -1
  9. package/dist/math/coordinate.d.ts +3 -3
  10. package/dist/math/coordinate.js +3 -2
  11. package/dist/math/extent.js +2 -2
  12. package/dist/math/intersection.d.ts +2 -1
  13. package/dist/math/intersection.js +1 -0
  14. package/dist/math/object.d.ts +24 -0
  15. package/dist/math/object.js +27 -0
  16. package/dist/math/plane.js +16 -24
  17. package/dist/math/precision.d.ts +2 -2
  18. package/dist/math/space.js +14 -22
  19. package/dist/projection/verify.d.ts +114 -114
  20. package/dist/projection/verify.js +9 -16
  21. package/dist/question/response.d.ts +20 -0
  22. package/dist/question/response.js +6 -3
  23. package/dist/quran/provenance.js +1 -1
  24. package/dist/quran/snapshot/row.d.ts +2 -0
  25. package/dist/quran/snapshot/row.js +3 -1
  26. package/dist/release/head.js +15 -33
  27. package/dist/release/items.js +14 -18
  28. package/dist/release/mismatch.d.ts +12 -0
  29. package/dist/release/mismatch.js +14 -0
  30. package/dist/release/result/digest.js +8 -17
  31. package/dist/release/rollback/digest.js +3 -10
  32. package/dist/release/route/verify.d.ts +1 -1
  33. package/dist/release/route/verify.js +8 -11
  34. package/dist/release/snapshot/evidence/requirement.d.ts +2 -1
  35. package/dist/release/snapshot/evidence/requirement.js +2 -1
  36. package/dist/release/snapshot/evidence/tryout.js +3 -3
  37. package/dist/release/snapshot/spec.d.ts +4 -1
  38. package/dist/release/snapshot/spec.js +6 -1
  39. package/dist/release/snapshot/verify.d.ts +52 -52
  40. package/dist/runtime/protected/spec.js +3 -2
  41. package/dist/runtime/spec.d.ts +23 -23
  42. package/dist/runtime/verify.d.ts +30 -30
  43. package/dist/signature/spec.d.ts +1 -1
  44. package/dist/signature/spec.js +1 -1
  45. package/dist/transport/group.js +2 -5
  46. package/dist/transport/request.d.ts +4442 -4442
  47. package/dist/transport/response.d.ts +56 -56
  48. package/dist/transport/response.js +22 -105
  49. package/dist/transport/success.d.ts +12 -0
  50. package/dist/transport/success.js +13 -0
  51. package/dist/tryout/catalog.d.ts +2 -0
  52. package/dist/tryout/catalog.js +5 -1
  53. package/dist/tryout/hash/catalog.d.ts +23 -23
  54. package/package.json +1 -1
@@ -1,5 +1,5 @@
1
1
  import { Effect, Schema, Stream } from "effect";
2
- import type { ContentReleaseManifest } from "#contracts/release/spec";
2
+ import { type ContentReleaseManifest } from "#contracts/release/spec";
3
3
  declare const ProjectionDecodeError_base: Schema.Class<ProjectionDecodeError, Schema.TaggedStruct<"ProjectionDecodeError", {
4
4
  readonly projectionIndex: Schema.Finite;
5
5
  }>, import("effect/Cause").YieldableError>;
@@ -43,90 +43,6 @@ declare const VerifiedContentProjectionsSchema: Schema.Struct<{
43
43
  export type VerifiedContentProjections = typeof VerifiedContentProjectionsSchema.Type;
44
44
  /** Strictly decodes a replayable canonical content projection stream. */
45
45
  export declare function decodeContentProjections<E, R>(projections: Stream.Stream<unknown, E, R>): Stream.Stream<{
46
- readonly appLocale: ("de" | "en" | "id") & import("effect/Brand").Brand<"@NakafaAI/AksaraAppLocale">;
47
- readonly artifactLocale: ("de" | "en" | "id") & import("effect/Brand").Brand<"@NakafaAI/AksaraArtifactLocale">;
48
- readonly contentKey: string & import("effect/Brand").Brand<"@NakafaAI/AksaraContentKey">;
49
- readonly pageKey: string & import("effect/Brand").Brand<"@NakafaAI/AksaraPageKey">;
50
- readonly publicPath: string & import("effect/Brand").Brand<"@NakafaAI/AksaraPublicPath">;
51
- readonly kind: "public-page";
52
- readonly metadata: {
53
- readonly dateModified?: string;
54
- readonly datePublished: string;
55
- readonly description: string;
56
- readonly title: string;
57
- };
58
- readonly sitemap: true;
59
- readonly sourcePath: string & import("effect/Brand").Brand<"@NakafaAI/AksaraCorpusSourcePath">;
60
- } | {
61
- readonly appLocale: ("de" | "en" | "id") & import("effect/Brand").Brand<"@NakafaAI/AksaraAppLocale">;
62
- readonly articleRouteSlug: string & import("effect/Brand").Brand<"@NakafaAI/AksaraArticleRouteSlug">;
63
- readonly articleSlug: string & import("effect/Brand").Brand<"@NakafaAI/AksaraArticleSlug">;
64
- readonly artifactLocale: ("de" | "en" | "id") & import("effect/Brand").Brand<"@NakafaAI/AksaraArtifactLocale">;
65
- readonly category: string & import("effect/Brand").Brand<"@NakafaAI/AksaraArticleCategory">;
66
- readonly categoryRouteSlug: string & import("effect/Brand").Brand<"@NakafaAI/AksaraArticleRouteSlug">;
67
- readonly contentKey: string & import("effect/Brand").Brand<"@NakafaAI/AksaraContentKey">;
68
- readonly graph: {
69
- readonly alignmentId: string;
70
- readonly assetId: string;
71
- readonly conceptId: string;
72
- readonly learningObjectId: string;
73
- readonly lensId: string;
74
- };
75
- readonly publicPath: string & import("effect/Brand").Brand<"@NakafaAI/AksaraPublicPath">;
76
- readonly categoryTitle: string;
77
- readonly kind: "article";
78
- readonly metadata: {
79
- readonly dateModified?: string;
80
- readonly datePublished: string;
81
- readonly authors: readonly {
82
- readonly name: string;
83
- }[];
84
- readonly description?: string | undefined;
85
- readonly title: string;
86
- };
87
- readonly official: boolean;
88
- readonly parentPath: string & import("effect/Brand").Brand<"@NakafaAI/AksaraPublicPath">;
89
- readonly references: readonly {
90
- readonly authors: string;
91
- readonly citation?: string | undefined;
92
- readonly details?: string | undefined;
93
- readonly publication?: string | undefined;
94
- readonly title: string;
95
- readonly url?: string | undefined;
96
- readonly year: number;
97
- }[];
98
- readonly sitemap: true;
99
- } | {
100
- readonly appLocale: ("de" | "en" | "id") & import("effect/Brand").Brand<"@NakafaAI/AksaraAppLocale">;
101
- readonly artifactLocale: ("de" | "en" | "id") & import("effect/Brand").Brand<"@NakafaAI/AksaraArtifactLocale">;
102
- readonly contentKey: string & import("effect/Brand").Brand<"@NakafaAI/AksaraContentKey">;
103
- readonly graph: {
104
- readonly alignmentId: string;
105
- readonly assetId: string;
106
- readonly conceptId: string;
107
- readonly learningObjectId: string;
108
- readonly lensId: string;
109
- };
110
- readonly materialKey: string & import("effect/Brand").Brand<"@NakafaAI/AksaraMaterialKey">;
111
- readonly order: number;
112
- readonly publicPath: string & import("effect/Brand").Brand<"@NakafaAI/AksaraPublicPath">;
113
- readonly sectionKey: string & import("effect/Brand").Brand<"@NakafaAI/AksaraMaterialSection">;
114
- readonly kind: "subject-lesson";
115
- readonly metadata: {
116
- readonly dateModified?: string;
117
- readonly datePublished: string;
118
- readonly authors: readonly {
119
- readonly name: string;
120
- }[];
121
- readonly description?: string | undefined;
122
- readonly searchTitle?: string;
123
- readonly subject?: string | undefined;
124
- readonly title: string;
125
- };
126
- readonly parentPath: string & import("effect/Brand").Brand<"@NakafaAI/AksaraPublicPath">;
127
- readonly sitemap: true;
128
- readonly topicTitle: string;
129
- } | {
130
46
  readonly artifactLocale: ("de" | "en" | "id") & import("effect/Brand").Brand<"@NakafaAI/AksaraArtifactLocale">;
131
47
  readonly contentKey: string & import("effect/Brand").Brand<"@NakafaAI/AksaraContentKey">;
132
48
  readonly peerContentKey: string & import("effect/Brand").Brand<"@NakafaAI/AksaraContentKey">;
@@ -150,35 +66,6 @@ export declare function decodeContentProjections<E, R>(projections: Stream.Strea
150
66
  };
151
67
  readonly stimulusKey?: string;
152
68
  readonly response: {
153
- readonly categories: readonly {
154
- readonly categoryKey: string;
155
- readonly label: string;
156
- readonly order: number;
157
- }[];
158
- readonly kind: "category";
159
- readonly statements: readonly {
160
- readonly correctCategoryKey: string;
161
- readonly label: string;
162
- readonly order: number;
163
- readonly statementKey: string;
164
- }[];
165
- } | {
166
- readonly kind: "multiple-choice";
167
- readonly options: readonly {
168
- readonly isCorrect: boolean;
169
- readonly label: string;
170
- readonly optionKey: string;
171
- readonly order: number;
172
- }[];
173
- } | {
174
- readonly kind: "single-choice";
175
- readonly options: readonly {
176
- readonly isCorrect: boolean;
177
- readonly label: string;
178
- readonly optionKey: string;
179
- readonly order: number;
180
- }[];
181
- } | {
182
69
  readonly criteria: readonly {
183
70
  readonly criterionKey: string;
184
71
  readonly finalAnswer?: {
@@ -213,6 +100,35 @@ export declare function decodeContentProjections<E, R>(projections: Stream.Strea
213
100
  }[];
214
101
  }[];
215
102
  readonly kind: "rubric";
103
+ } | {
104
+ readonly categories: readonly {
105
+ readonly categoryKey: string;
106
+ readonly label: string;
107
+ readonly order: number;
108
+ }[];
109
+ readonly kind: "category";
110
+ readonly statements: readonly {
111
+ readonly correctCategoryKey: string;
112
+ readonly label: string;
113
+ readonly order: number;
114
+ readonly statementKey: string;
115
+ }[];
116
+ } | {
117
+ readonly kind: "multiple-choice";
118
+ readonly options: readonly {
119
+ readonly isCorrect: boolean;
120
+ readonly label: string;
121
+ readonly optionKey: string;
122
+ readonly order: number;
123
+ }[];
124
+ } | {
125
+ readonly kind: "single-choice";
126
+ readonly options: readonly {
127
+ readonly isCorrect: boolean;
128
+ readonly label: string;
129
+ readonly optionKey: string;
130
+ readonly order: number;
131
+ }[];
216
132
  } | {
217
133
  readonly key: {
218
134
  readonly acceptsFractions: boolean;
@@ -253,6 +169,90 @@ export declare function decodeContentProjections<E, R>(projections: Stream.Strea
253
169
  readonly title: string;
254
170
  };
255
171
  readonly stimulusKey?: string;
172
+ } | {
173
+ readonly appLocale: ("de" | "en" | "id") & import("effect/Brand").Brand<"@NakafaAI/AksaraAppLocale">;
174
+ readonly articleRouteSlug: string & import("effect/Brand").Brand<"@NakafaAI/AksaraArticleRouteSlug">;
175
+ readonly articleSlug: string & import("effect/Brand").Brand<"@NakafaAI/AksaraArticleSlug">;
176
+ readonly artifactLocale: ("de" | "en" | "id") & import("effect/Brand").Brand<"@NakafaAI/AksaraArtifactLocale">;
177
+ readonly category: string & import("effect/Brand").Brand<"@NakafaAI/AksaraArticleCategory">;
178
+ readonly categoryRouteSlug: string & import("effect/Brand").Brand<"@NakafaAI/AksaraArticleRouteSlug">;
179
+ readonly contentKey: string & import("effect/Brand").Brand<"@NakafaAI/AksaraContentKey">;
180
+ readonly graph: {
181
+ readonly alignmentId: string;
182
+ readonly assetId: string;
183
+ readonly conceptId: string;
184
+ readonly learningObjectId: string;
185
+ readonly lensId: string;
186
+ };
187
+ readonly publicPath: string & import("effect/Brand").Brand<"@NakafaAI/AksaraPublicPath">;
188
+ readonly categoryTitle: string;
189
+ readonly kind: "article";
190
+ readonly metadata: {
191
+ readonly dateModified?: string;
192
+ readonly datePublished: string;
193
+ readonly authors: readonly {
194
+ readonly name: string;
195
+ }[];
196
+ readonly description?: string | undefined;
197
+ readonly title: string;
198
+ };
199
+ readonly official: boolean;
200
+ readonly parentPath: string & import("effect/Brand").Brand<"@NakafaAI/AksaraPublicPath">;
201
+ readonly references: readonly {
202
+ readonly authors: string;
203
+ readonly citation?: string | undefined;
204
+ readonly details?: string | undefined;
205
+ readonly publication?: string | undefined;
206
+ readonly title: string;
207
+ readonly url?: string | undefined;
208
+ readonly year: number;
209
+ }[];
210
+ readonly sitemap: true;
211
+ } | {
212
+ readonly appLocale: ("de" | "en" | "id") & import("effect/Brand").Brand<"@NakafaAI/AksaraAppLocale">;
213
+ readonly artifactLocale: ("de" | "en" | "id") & import("effect/Brand").Brand<"@NakafaAI/AksaraArtifactLocale">;
214
+ readonly contentKey: string & import("effect/Brand").Brand<"@NakafaAI/AksaraContentKey">;
215
+ readonly graph: {
216
+ readonly alignmentId: string;
217
+ readonly assetId: string;
218
+ readonly conceptId: string;
219
+ readonly learningObjectId: string;
220
+ readonly lensId: string;
221
+ };
222
+ readonly materialKey: string & import("effect/Brand").Brand<"@NakafaAI/AksaraMaterialKey">;
223
+ readonly order: number;
224
+ readonly publicPath: string & import("effect/Brand").Brand<"@NakafaAI/AksaraPublicPath">;
225
+ readonly sectionKey: string & import("effect/Brand").Brand<"@NakafaAI/AksaraMaterialSection">;
226
+ readonly kind: "subject-lesson";
227
+ readonly metadata: {
228
+ readonly dateModified?: string;
229
+ readonly datePublished: string;
230
+ readonly authors: readonly {
231
+ readonly name: string;
232
+ }[];
233
+ readonly description?: string | undefined;
234
+ readonly searchTitle?: string;
235
+ readonly subject?: string | undefined;
236
+ readonly title: string;
237
+ };
238
+ readonly parentPath: string & import("effect/Brand").Brand<"@NakafaAI/AksaraPublicPath">;
239
+ readonly sitemap: true;
240
+ readonly topicTitle: string;
241
+ } | {
242
+ readonly appLocale: ("de" | "en" | "id") & import("effect/Brand").Brand<"@NakafaAI/AksaraAppLocale">;
243
+ readonly artifactLocale: ("de" | "en" | "id") & import("effect/Brand").Brand<"@NakafaAI/AksaraArtifactLocale">;
244
+ readonly contentKey: string & import("effect/Brand").Brand<"@NakafaAI/AksaraContentKey">;
245
+ readonly pageKey: string & import("effect/Brand").Brand<"@NakafaAI/AksaraPageKey">;
246
+ readonly publicPath: string & import("effect/Brand").Brand<"@NakafaAI/AksaraPublicPath">;
247
+ readonly kind: "public-page";
248
+ readonly metadata: {
249
+ readonly dateModified?: string;
250
+ readonly datePublished: string;
251
+ readonly description: string;
252
+ readonly title: string;
253
+ };
254
+ readonly sitemap: true;
255
+ readonly sourcePath: string & import("effect/Brand").Brand<"@NakafaAI/AksaraCorpusSourcePath">;
256
256
  }, E | ProjectionDecodeError | ProjectionOrderError | ProjectionRouteError, R>;
257
257
  /** Authenticates a replayable projection stream against its signed manifest. */
258
258
  export declare const verifyContentProjections: <E, R>(input: {
@@ -1,35 +1,28 @@
1
1
  import { Effect, MutableHashMap, Option, Schema, Stream } from "effect";
2
2
  import { compareContentHeads, routeIdentity } from "#contracts/content";
3
- import { PublicPathSchema, ReleaseIdSchema, Sha256HashSchema, } from "#contracts/ids";
3
+ import { PublicPathSchema } from "#contracts/ids";
4
4
  import { digestProjections } from "#contracts/projection/digest";
5
5
  import { ContentProjectionSchema, } from "#contracts/projection/spec";
6
- const ProjectionIndexSchema = Schema.Finite.pipe(Schema.check(Schema.isInt()), Schema.check(Schema.isGreaterThanOrEqualTo(0)));
6
+ import { ReleaseCountMismatchFields, ReleaseDigestMismatchFields, } from "#contracts/release/mismatch";
7
+ import { ReleaseCountSchema, } from "#contracts/release/spec";
7
8
  /** One streamed projection failed strict schema decoding. */
8
- export class ProjectionDecodeError extends Schema.TaggedError()("ProjectionDecodeError", { projectionIndex: ProjectionIndexSchema }) {
9
+ export class ProjectionDecodeError extends Schema.TaggedError()("ProjectionDecodeError", { projectionIndex: ReleaseCountSchema }) {
9
10
  }
10
11
  /** Projections are duplicated or not in canonical content-head order. */
11
- export class ProjectionOrderError extends Schema.TaggedError()("ProjectionOrderError", { projectionIndex: ProjectionIndexSchema }) {
12
+ export class ProjectionOrderError extends Schema.TaggedError()("ProjectionOrderError", { projectionIndex: ReleaseCountSchema }) {
12
13
  }
13
14
  /** Two content projections claim the same locale-specific public route. */
14
15
  export class ProjectionRouteError extends Schema.TaggedError()("ProjectionRouteError", {
15
- duplicateIndex: ProjectionIndexSchema,
16
- firstIndex: ProjectionIndexSchema,
16
+ duplicateIndex: ReleaseCountSchema,
17
+ firstIndex: ReleaseCountSchema,
17
18
  publicPath: PublicPathSchema,
18
19
  }) {
19
20
  }
20
21
  /** The streamed projection count differs from the signed manifest. */
21
- export class ProjectionCountError extends Schema.TaggedError()("ProjectionCountError", {
22
- actualCount: ProjectionIndexSchema,
23
- expectedCount: ProjectionIndexSchema,
24
- releaseId: ReleaseIdSchema,
25
- }) {
22
+ export class ProjectionCountError extends Schema.TaggedError()("ProjectionCountError", { ...ReleaseCountMismatchFields }) {
26
23
  }
27
24
  /** The streamed projection digest differs from the signed manifest. */
28
- export class ProjectionDigestError extends Schema.TaggedError()("ProjectionDigestError", {
29
- actualDigest: Sha256HashSchema,
30
- expectedDigest: Sha256HashSchema,
31
- releaseId: ReleaseIdSchema,
32
- }) {
25
+ export class ProjectionDigestError extends Schema.TaggedError()("ProjectionDigestError", { ...ReleaseDigestMismatchFields }) {
33
26
  }
34
27
  /** Creates the replay state that one stream of projections shares while it decodes. */
35
28
  function projectionState() {
@@ -6,6 +6,26 @@ import { Schema } from "effect";
6
6
  */
7
7
  export declare const QuestionResponseKindSchema: Schema.Literals<readonly ["category", "multiple-choice", "rubric", "short-answer", "single-choice"]>;
8
8
  export type QuestionResponseKind = typeof QuestionResponseKindSchema.Type;
9
+ /** One option of a single or multiple choice response, keyed by its identity. */
10
+ export declare const QuestionOptionSchema: Schema.Struct<{
11
+ readonly isCorrect: Schema.Boolean;
12
+ readonly label: Schema.String;
13
+ readonly optionKey: Schema.String;
14
+ readonly order: Schema.Int;
15
+ }>;
16
+ /** One named category of a category response, keyed by its identity. */
17
+ export declare const QuestionCategorySchema: Schema.Struct<{
18
+ readonly categoryKey: Schema.String;
19
+ readonly label: Schema.String;
20
+ readonly order: Schema.Int;
21
+ }>;
22
+ /** One statement classified into one category, keyed by its identity. */
23
+ export declare const QuestionCategoryStatementSchema: Schema.Struct<{
24
+ readonly correctCategoryKey: Schema.String;
25
+ readonly label: Schema.String;
26
+ readonly order: Schema.Int;
27
+ readonly statementKey: Schema.String;
28
+ }>;
9
29
  /** Frozen locale-specific response used from publication through review. */
10
30
  export declare const QuestionResponseSchema: Schema.Union<readonly [Schema.Struct<{
11
31
  readonly categories: Schema.$Array<Schema.Struct<{
@@ -18,7 +18,8 @@ export const QuestionResponseKindSchema = Schema.Literals([
18
18
  "short-answer",
19
19
  "single-choice",
20
20
  ]);
21
- const QuestionOptionSchema = Schema.Struct({
21
+ /** One option of a single or multiple choice response, keyed by its identity. */
22
+ export const QuestionOptionSchema = Schema.Struct({
22
23
  isCorrect: Schema.Boolean,
23
24
  label: QuestionResponseLabelSchema,
24
25
  optionKey: Schema.String.pipe(Schema.check(Schema.isPattern(OPTION_KEY_PATTERN))),
@@ -45,12 +46,14 @@ const MultipleChoiceResponseSchema = Schema.Struct({
45
46
  }).pipe(Schema.check(Schema.makeFilter(({ options }) => hasCanonicalOptions(options, "multiple-choice"), {
46
47
  message: "Multiple-choice responses require canonical options, several correct answers, and one distractor.",
47
48
  })));
48
- const QuestionCategorySchema = Schema.Struct({
49
+ /** One named category of a category response, keyed by its identity. */
50
+ export const QuestionCategorySchema = Schema.Struct({
49
51
  categoryKey: Schema.String.pipe(Schema.check(Schema.isPattern(CATEGORY_KEY_PATTERN))),
50
52
  label: QuestionResponseLabelSchema,
51
53
  order: PositiveOrderSchema,
52
54
  });
53
- const QuestionCategoryStatementSchema = Schema.Struct({
55
+ /** One statement classified into one category, keyed by its identity. */
56
+ export const QuestionCategoryStatementSchema = Schema.Struct({
54
57
  correctCategoryKey: Schema.String.pipe(Schema.check(Schema.isPattern(CATEGORY_KEY_PATTERN))),
55
58
  label: QuestionResponseLabelSchema,
56
59
  order: PositiveOrderSchema,
@@ -4,7 +4,7 @@ import { Sha256HashSchema } from "#contracts/ids";
4
4
  import { ActiveAppLocaleListSchema, AppLocaleSchema, ENGLISH_APP_LOCALE_CODE, GERMAN_APP_LOCALE_CODE, INDONESIAN_APP_LOCALE_CODE, } from "#contracts/locale";
5
5
  import { canonicalizeQuranAttribution } from "#contracts/quran/attribution";
6
6
  import { QuranNameProvenanceScopeSchema, QuranTranslationProvenanceScopeSchema, quranNameProvenanceScope, quranNameSourceForScope, quranTafsirSourceId, quranTranslationProvenanceScope, quranTranslationSourceForScope, } from "#contracts/quran/identity";
7
- import { QuranProvenanceStatusSchema } from "#contracts/quran/snapshot/spec";
7
+ import { QuranProvenanceStatusSchema, } from "#contracts/quran/snapshot/spec";
8
8
  import { hasCompleteQuranSourceCopy, QuranSourceAttributionSchema, } from "#contracts/quran/source";
9
9
  import { encodeJsonText } from "#contracts/text/json";
10
10
  /** Quran source fields that require independent provenance decisions. */
@@ -8,6 +8,8 @@ export declare const QuranLocalizedTranslationSchema: Schema.Struct<{
8
8
  }>;
9
9
  }>;
10
10
  export type QuranLocalizedTranslation = typeof QuranLocalizedTranslationSchema.Type;
11
+ /** Sajda obligation of one verse, present only where the source assigns one. */
12
+ export declare const QuranSajdaSchema: Schema.Literals<readonly ["obligatory", "recommended"]>;
11
13
  /** One exact verse with explicit translation locale entries. */
12
14
  export declare const QuranRuntimeVerseSchema: Schema.Struct<{
13
15
  readonly meta: Schema.Struct<{
@@ -25,6 +25,8 @@ const QuranRuntimeTafsirSchema = Schema.Struct({
25
25
  footnotes: Schema.NullOr(Schema.String),
26
26
  text: QuranMeaningfulTextSchema,
27
27
  });
28
+ /** Sajda obligation of one verse, present only where the source assigns one. */
29
+ export const QuranSajdaSchema = Schema.Literals(["obligatory", "recommended"]);
28
30
  /** One exact verse with explicit translation locale entries. */
29
31
  export const QuranRuntimeVerseSchema = Schema.Struct({
30
32
  meta: Schema.Struct({
@@ -33,7 +35,7 @@ export const QuranRuntimeVerseSchema = Schema.Struct({
33
35
  manzil: Schema.Int.pipe(Schema.check(Schema.isGreaterThan(0))),
34
36
  page: Schema.Int.pipe(Schema.check(Schema.isGreaterThan(0))),
35
37
  ruku: Schema.Int.pipe(Schema.check(Schema.isGreaterThan(0))),
36
- sajda: Schema.NullOr(Schema.Literals(["obligatory", "recommended"])),
38
+ sajda: Schema.NullOr(QuranSajdaSchema),
37
39
  }),
38
40
  number: Schema.Struct({
39
41
  inQuran: Schema.Int.pipe(Schema.check(Schema.isGreaterThan(0))),
@@ -1,5 +1,5 @@
1
1
  import { Array as Arr, Schema } from "effect";
2
- import { ContentFamilySchema, compareContentHeads } from "#contracts/content";
2
+ import { ContentFamilySchema, compareContentHeads, } from "#contracts/content";
3
3
  import { ContentDeliveryClassSchema } from "#contracts/delivery";
4
4
  import { ContentKeySchema, CorpusSourcePathSchema, PublicPathSchema, ReleaseIdSchema, Sha256HashSchema, } from "#contracts/ids";
5
5
  import { ArtifactLocaleSchema } from "#contracts/locale";
@@ -95,38 +95,20 @@ const HeadPageFields = {
95
95
  done: Schema.Boolean,
96
96
  nextCursor: HeadCursorSchema,
97
97
  };
98
- const ArticleHeadPageSchema = Schema.Struct({
99
- ...HeadPageFields,
100
- family: Schema.Literal("article"),
101
- heads: Schema.Array(ArticleHeadSchema).pipe(Schema.check(Schema.isMaxLength(MAX_HEAD_PAGE_COUNT))),
102
- }).pipe(Schema.check(Schema.makeFilter(hasCanonicalHeadPage, {
103
- message: "Expected canonical article heads with coherent cursor progress.",
104
- })));
105
- const MaterialHeadPageSchema = Schema.Struct({
106
- ...HeadPageFields,
107
- family: Schema.Literal("material"),
108
- heads: Schema.Array(MaterialHeadSchema).pipe(Schema.check(Schema.isMaxLength(MAX_HEAD_PAGE_COUNT))),
109
- }).pipe(Schema.check(Schema.makeFilter(hasCanonicalHeadPage, {
110
- message: "Expected canonical material heads with coherent cursor progress.",
111
- })));
112
- const PageHeadPageSchema = Schema.Struct({
113
- ...HeadPageFields,
114
- family: Schema.Literal("page"),
115
- heads: Schema.Array(PageHeadSchema).pipe(Schema.check(Schema.isMaxLength(MAX_HEAD_PAGE_COUNT))),
116
- }).pipe(Schema.check(Schema.makeFilter(hasCanonicalHeadPage, {
117
- message: "Expected canonical page heads with coherent cursor progress.",
118
- })));
119
- const QuestionHeadPageSchema = Schema.Struct({
120
- ...HeadPageFields,
121
- family: Schema.Literal("question"),
122
- heads: Schema.Array(QuestionHeadSchema).pipe(Schema.check(Schema.isMaxLength(MAX_HEAD_PAGE_COUNT))),
123
- }).pipe(Schema.check(Schema.makeFilter(hasCanonicalHeadPage, {
124
- message: "Expected canonical question heads with coherent cursor progress.",
125
- })));
98
+ /** Builds one family-owned head page whose heads share that family's shape. */
99
+ function headPageSchema(family, head) {
100
+ return Schema.Struct({
101
+ ...HeadPageFields,
102
+ family: Schema.Literal(family),
103
+ heads: Schema.Array(head).pipe(Schema.check(Schema.isMaxLength(MAX_HEAD_PAGE_COUNT))),
104
+ }).pipe(Schema.check(Schema.makeFilter(hasCanonicalHeadPage, {
105
+ message: `Expected canonical ${family} heads with coherent cursor progress.`,
106
+ })));
107
+ }
126
108
  /** Bounded canonical page proving one exact family-owned head inventory. */
127
109
  export const HeadPageSchema = Schema.Union([
128
- ArticleHeadPageSchema,
129
- MaterialHeadPageSchema,
130
- PageHeadPageSchema,
131
- QuestionHeadPageSchema,
110
+ headPageSchema("article", ArticleHeadSchema),
111
+ headPageSchema("material", MaterialHeadSchema),
112
+ headPageSchema("page", PageHeadSchema),
113
+ headPageSchema("question", QuestionHeadSchema),
132
114
  ]);
@@ -1,41 +1,37 @@
1
1
  import { Array as Arr, Effect, MutableRef, Option, Schema, Stream, } from "effect";
2
2
  import { compareContentHeads } from "#contracts/content";
3
- import { ReleaseIdSchema, Sha256HashSchema } from "#contracts/ids";
3
+ import { ReleaseIdSchema } from "#contracts/ids";
4
4
  import { digestItems } from "#contracts/release/digest";
5
- import { ContentReleaseItemSchema, } from "#contracts/release/spec";
6
- const ItemCountSchema = Schema.Finite.pipe(Schema.check(Schema.isInt()), Schema.check(Schema.isGreaterThanOrEqualTo(0)));
5
+ import { ReleaseDigestMismatchFields } from "#contracts/release/mismatch";
6
+ import { ContentReleaseItemSchema, ReleaseCountSchema, } from "#contracts/release/spec";
7
7
  /** One release item failed strict wire decoding. */
8
- export class ReleaseItemDecodeError extends Schema.TaggedError()("ReleaseItemDecodeError", { itemOffset: ItemCountSchema }) {
8
+ export class ReleaseItemDecodeError extends Schema.TaggedError()("ReleaseItemDecodeError", { itemOffset: ReleaseCountSchema }) {
9
9
  }
10
10
  /** The separate item stream does not have the signed manifest length. */
11
- export class ReleaseItemCountMismatchError extends Schema.TaggedError()("ReleaseItemCountMismatchError", { actualCount: ItemCountSchema, expectedCount: ItemCountSchema }) {
11
+ export class ReleaseItemCountMismatchError extends Schema.TaggedError()("ReleaseItemCountMismatchError", { actualCount: ReleaseCountSchema, expectedCount: ReleaseCountSchema }) {
12
12
  }
13
13
  /** Upsert and delete totals do not match the counts signed by the manifest. */
14
14
  export class ReleaseItemOperationCountMismatchError extends Schema.TaggedError()("ReleaseItemOperationCountMismatchError", {
15
- actualDeletes: ItemCountSchema,
16
- actualUpserts: ItemCountSchema,
17
- expectedDeletes: ItemCountSchema,
18
- expectedUpserts: ItemCountSchema,
15
+ actualDeletes: ReleaseCountSchema,
16
+ actualUpserts: ReleaseCountSchema,
17
+ expectedDeletes: ReleaseCountSchema,
18
+ expectedUpserts: ReleaseCountSchema,
19
19
  }) {
20
20
  }
21
21
  /** An item belongs to another release envelope. */
22
- export class ReleaseItemReleaseMismatchError extends Schema.TaggedError()("ReleaseItemReleaseMismatchError", { itemOffset: ItemCountSchema, releaseId: ReleaseIdSchema }) {
22
+ export class ReleaseItemReleaseMismatchError extends Schema.TaggedError()("ReleaseItemReleaseMismatchError", { itemOffset: ReleaseCountSchema, releaseId: ReleaseIdSchema }) {
23
23
  }
24
24
  /** An item is missing, duplicated, or out of its signed sequence. */
25
- export class ReleaseItemIndexMismatchError extends Schema.TaggedError()("ReleaseItemIndexMismatchError", { actualIndex: ItemCountSchema, expectedIndex: ItemCountSchema }) {
25
+ export class ReleaseItemIndexMismatchError extends Schema.TaggedError()("ReleaseItemIndexMismatchError", { actualIndex: ReleaseCountSchema, expectedIndex: ReleaseCountSchema }) {
26
26
  }
27
27
  /** Item heads are duplicated or not in canonical content-head order. */
28
- export class ReleaseItemOrderError extends Schema.TaggedError()("ReleaseItemOrderError", { itemOffset: ItemCountSchema }) {
28
+ export class ReleaseItemOrderError extends Schema.TaggedError()("ReleaseItemOrderError", { itemOffset: ReleaseCountSchema }) {
29
29
  }
30
30
  /** One signed item falls outside the release's exact publication scope. */
31
- export class ReleaseItemScopeError extends Schema.TaggedError()("ReleaseItemScopeError", { itemOffset: ItemCountSchema }) {
31
+ export class ReleaseItemScopeError extends Schema.TaggedError()("ReleaseItemScopeError", { itemOffset: ReleaseCountSchema }) {
32
32
  }
33
33
  /** The separate ordered items do not match the signed digest. */
34
- export class ReleaseItemsDigestMismatchError extends Schema.TaggedError()("ReleaseItemsDigestMismatchError", {
35
- actualDigest: Sha256HashSchema,
36
- expectedDigest: Sha256HashSchema,
37
- releaseId: ReleaseIdSchema,
38
- }) {
34
+ export class ReleaseItemsDigestMismatchError extends Schema.TaggedError()("ReleaseItemsDigestMismatchError", { ...ReleaseDigestMismatchFields }) {
39
35
  }
40
36
  const VerifiedContentReleaseItemsSchema = Schema.Struct({
41
37
  deleteCount: Schema.Finite,
@@ -0,0 +1,12 @@
1
+ /** Fields that name one signed release digest and the replayed digest that failed. */
2
+ export declare const ReleaseDigestMismatchFields: {
3
+ actualDigest: import("effect/Schema").brand<import("effect/Schema").String, "@NakafaAI/AksaraSha256Hash">;
4
+ expectedDigest: import("effect/Schema").brand<import("effect/Schema").String, "@NakafaAI/AksaraSha256Hash">;
5
+ releaseId: import("effect/Schema").brand<import("effect/Schema").String, "@NakafaAI/AksaraReleaseId">;
6
+ };
7
+ /** Fields that name one signed release count and the replayed count that failed. */
8
+ export declare const ReleaseCountMismatchFields: {
9
+ actualCount: import("effect/Schema").Finite;
10
+ expectedCount: import("effect/Schema").Finite;
11
+ releaseId: import("effect/Schema").brand<import("effect/Schema").String, "@NakafaAI/AksaraReleaseId">;
12
+ };
@@ -0,0 +1,14 @@
1
+ import { ReleaseIdSchema, Sha256HashSchema } from "#contracts/ids";
2
+ import { ReleaseCountSchema } from "#contracts/release/spec";
3
+ /** Fields that name one signed release digest and the replayed digest that failed. */
4
+ export const ReleaseDigestMismatchFields = {
5
+ actualDigest: Sha256HashSchema,
6
+ expectedDigest: Sha256HashSchema,
7
+ releaseId: ReleaseIdSchema,
8
+ };
9
+ /** Fields that name one signed release count and the replayed count that failed. */
10
+ export const ReleaseCountMismatchFields = {
11
+ actualCount: ReleaseCountSchema,
12
+ expectedCount: ReleaseCountSchema,
13
+ releaseId: ReleaseIdSchema,
14
+ };
@@ -1,41 +1,32 @@
1
1
  import { createHash } from "node:crypto";
2
2
  import { Effect, MutableHashSet, Schema, Stream } from "effect";
3
- import { compareContentHeads, routeIdentity } from "#contracts/content";
4
- import { ContentKeySchema, PublicPathSchema, ReleaseIdSchema, Sha256HashSchema, } from "#contracts/ids";
5
- import { AppLocaleSchema, ArtifactLocaleSchema, } from "#contracts/locale";
3
+ import { ContentHeadIdentitySchema, compareContentHeads, routeIdentity, } from "#contracts/content";
4
+ import { PublicPathSchema, ReleaseIdSchema, Sha256HashSchema, } from "#contracts/ids";
5
+ import { AppLocaleSchema } from "#contracts/locale";
6
6
  import { canonicalizeContentHead, } from "#contracts/release/head";
7
+ import { ReleaseCountMismatchFields, ReleaseDigestMismatchFields, } from "#contracts/release/mismatch";
7
8
  import { RESULT_CATALOG_DIGEST_DOMAIN } from "#contracts/release/result/spec";
8
9
  /** SHA-256 computation failed before result-catalog integrity was established. */
9
10
  export class ResultCatalogHashError extends Schema.TaggedError()("ResultCatalogHashError", { releaseId: ReleaseIdSchema }) {
10
11
  }
11
12
  /** A result catalog is duplicated or outside canonical content-head order. */
12
13
  export class ResultCatalogOrderError extends Schema.TaggedError()("ResultCatalogOrderError", {
13
- artifactLocale: ArtifactLocaleSchema,
14
- contentKey: ContentKeySchema,
14
+ ...ContentHeadIdentitySchema.fields,
15
15
  releaseId: ReleaseIdSchema,
16
16
  }) {
17
17
  }
18
18
  /** Two complete result heads claim the same locale-specific public route. */
19
19
  export class ResultCatalogRouteError extends Schema.TaggedError()("ResultCatalogRouteError", {
20
- artifactLocale: ArtifactLocaleSchema,
21
- contentKey: ContentKeySchema,
20
+ ...ContentHeadIdentitySchema.fields,
22
21
  publicPath: PublicPathSchema,
23
22
  releaseId: ReleaseIdSchema,
24
23
  }) {
25
24
  }
26
25
  /** A replayed result catalog has a different signed head count. */
27
- export class ResultCatalogCountMismatchError extends Schema.TaggedError()("ResultCatalogCountMismatchError", {
28
- actualCount: Schema.Finite.pipe(Schema.check(Schema.isInt()), Schema.check(Schema.isGreaterThanOrEqualTo(0))),
29
- expectedCount: Schema.Finite.pipe(Schema.check(Schema.isInt()), Schema.check(Schema.isGreaterThanOrEqualTo(0))),
30
- releaseId: ReleaseIdSchema,
31
- }) {
26
+ export class ResultCatalogCountMismatchError extends Schema.TaggedError()("ResultCatalogCountMismatchError", { ...ReleaseCountMismatchFields }) {
32
27
  }
33
28
  /** A replayed result catalog does not match its signed digest. */
34
- export class ResultCatalogDigestMismatchError extends Schema.TaggedError()("ResultCatalogDigestMismatchError", {
35
- actualDigest: Sha256HashSchema,
36
- expectedDigest: Sha256HashSchema,
37
- releaseId: ReleaseIdSchema,
38
- }) {
29
+ export class ResultCatalogDigestMismatchError extends Schema.TaggedError()("ResultCatalogDigestMismatchError", { ...ReleaseDigestMismatchFields }) {
39
30
  }
40
31
  /** Keeps mutable hash and ordering state private to one catalog replay. */
41
32
  class ResultCatalogDigestState {
@@ -1,24 +1,17 @@
1
1
  import { createHash } from "node:crypto";
2
2
  import { Effect, Schema, Stream } from "effect";
3
3
  import { ReleaseIdSchema, Sha256HashSchema, } from "#contracts/ids";
4
+ import { ReleaseCountMismatchFields, ReleaseDigestMismatchFields, } from "#contracts/release/mismatch";
4
5
  import { canonicalizeRollbackSnapshotEntry, } from "#contracts/release/rollback/spec";
5
6
  const ROLLBACK_SNAPSHOT_DIGEST_DOMAIN = "nakafa.aksara.rollback-snapshot";
6
7
  /** SHA-256 computation failed before rollback-state integrity was established. */
7
8
  export class RollbackSnapshotHashError extends Schema.TaggedError()("RollbackSnapshotHashError", { releaseId: ReleaseIdSchema }) {
8
9
  }
9
10
  /** A replayed rollback snapshot has a different signed entry count. */
10
- export class RollbackSnapshotCountMismatchError extends Schema.TaggedError()("RollbackSnapshotCountMismatchError", {
11
- actualCount: Schema.Finite.pipe(Schema.check(Schema.isInt()), Schema.check(Schema.isGreaterThanOrEqualTo(0))),
12
- expectedCount: Schema.Finite.pipe(Schema.check(Schema.isInt()), Schema.check(Schema.isGreaterThanOrEqualTo(0))),
13
- releaseId: ReleaseIdSchema,
14
- }) {
11
+ export class RollbackSnapshotCountMismatchError extends Schema.TaggedError()("RollbackSnapshotCountMismatchError", { ...ReleaseCountMismatchFields }) {
15
12
  }
16
13
  /** A replayed rollback snapshot does not match its signed digest. */
17
- export class RollbackSnapshotDigestMismatchError extends Schema.TaggedError()("RollbackSnapshotDigestMismatchError", {
18
- actualDigest: Sha256HashSchema,
19
- expectedDigest: Sha256HashSchema,
20
- releaseId: ReleaseIdSchema,
21
- }) {
14
+ export class RollbackSnapshotDigestMismatchError extends Schema.TaggedError()("RollbackSnapshotDigestMismatchError", { ...ReleaseDigestMismatchFields }) {
22
15
  }
23
16
  /** Keeps mutable Node hash state private behind the incremental digest seam. */
24
17
  class RollbackSnapshotDigestState {
@@ -1,5 +1,5 @@
1
1
  import { Effect, Schema, Stream } from "effect";
2
- import type { ContentReleaseManifest } from "#contracts/release/spec";
2
+ import { type ContentReleaseManifest } from "#contracts/release/spec";
3
3
  declare const RouteDecodeError_base: Schema.Class<RouteDecodeError, Schema.TaggedStruct<"RouteDecodeError", {
4
4
  readonly routeOffset: Schema.Finite;
5
5
  }>, import("effect/Cause").YieldableError>;