@nakafa/aksara-contracts 0.49.0 → 0.51.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/artifact/integrity.d.ts +15 -2
- package/dist/artifact/integrity.js +3 -15
- package/dist/artifact/limits.js +3 -4
- package/dist/artifact/source.js +4 -8
- package/dist/artifact/spec.d.ts +30 -10
- package/dist/assessment/hash.d.ts +251 -213
- package/dist/assessment/item.d.ts +44 -7
- package/dist/assessment/item.js +19 -9
- package/dist/assessment/joint.d.ts +62 -0
- package/dist/assessment/joint.js +85 -0
- package/dist/assessment/paper.d.ts +22 -2
- package/dist/assessment/profile.d.ts +6 -0
- package/dist/assessment/scoring.d.ts +55 -2
- package/dist/assessment/scoring.js +63 -8
- package/dist/assessment/stimulus.d.ts +3 -3
- package/dist/assessment/stimulus.js +2 -2
- package/dist/errors.d.ts +3 -1
- package/dist/graph/family.d.ts +6 -2
- package/dist/graph/identity.d.ts +3 -1
- package/dist/hash/digest.d.ts +10 -0
- package/dist/hash/digest.js +40 -0
- package/dist/hash/stream.d.ts +12 -0
- package/dist/hash/stream.js +27 -0
- package/dist/hash/text.d.ts +3 -1
- package/dist/hash/text.js +2 -15
- package/dist/locale.d.ts +9 -0
- package/dist/locale.js +25 -1
- package/dist/preview/auth.d.ts +4 -2
- package/dist/preview/auth.js +26 -12
- package/dist/program/snapshot/digest.d.ts +3 -1
- package/dist/program/snapshot/digest.js +14 -22
- package/dist/program/snapshot/hash.d.ts +6 -2
- package/dist/program/snapshot/hash.js +10 -21
- package/dist/projection/digest.d.ts +11 -9
- package/dist/projection/digest.js +23 -32
- package/dist/projection/hash.d.ts +222 -2
- package/dist/projection/hash.js +6 -8
- package/dist/projection/verify.d.ts +16 -6
- package/dist/question/item.d.ts +3 -1
- package/dist/question/item.js +3 -1
- package/dist/quran/notes.d.ts +3 -1
- package/dist/quran/provenance.d.ts +6 -2
- package/dist/quran/provenance.js +8 -15
- package/dist/quran/snapshot/digest.d.ts +9 -5
- package/dist/quran/snapshot/digest.js +33 -41
- package/dist/quran/snapshot/hash.d.ts +3 -1
- package/dist/quran/snapshot/hash.js +9 -15
- package/dist/quran/snapshot/row/hash.d.ts +3 -1
- package/dist/quran/snapshot/row/hash.js +2 -8
- package/dist/release/digest.d.ts +10 -8
- package/dist/release/digest.js +22 -31
- package/dist/release/hash.d.ts +3 -1
- package/dist/release/hash.js +3 -8
- package/dist/release/items.d.ts +25 -9
- package/dist/release/items.js +12 -3
- package/dist/release/policy.d.ts +3 -1
- package/dist/release/result/digest.d.ts +23 -13
- package/dist/release/result/digest.js +20 -29
- package/dist/release/rollback/digest.d.ts +16 -10
- package/dist/release/rollback/digest.js +25 -32
- package/dist/release/route/digest.d.ts +10 -8
- package/dist/release/route/digest.js +22 -31
- package/dist/release/route/verify.d.ts +16 -6
- package/dist/release/route/verify.js +8 -2
- package/dist/release/snapshot/evidence/requirement.d.ts +3 -1
- package/dist/release/snapshot/evidence/tryout.d.ts +1 -1
- package/dist/release/snapshot/evidence/tryout.js +1 -1
- package/dist/release/snapshot/evidence.d.ts +1 -1
- package/dist/release/snapshot/verify.d.ts +19 -7
- package/dist/release/snapshot/verify.js +20 -18
- package/dist/release/verify.d.ts +9 -3
- package/dist/renderer/compatibility.d.ts +6 -2
- package/dist/renderer/compatibility.js +3 -1
- package/dist/renderer/contract.d.ts +9 -3
- package/dist/renderer/contract.js +3 -1
- package/dist/runtime/error.d.ts +3 -1
- package/dist/runtime/protected/verify.d.ts +1 -1
- package/dist/runtime/verify.d.ts +2 -2
- package/dist/runtime/verify.js +2 -1
- package/dist/signature/key.d.ts +21 -0
- package/dist/signature/key.js +104 -0
- package/dist/signature/spec.d.ts +18 -6
- package/dist/signature/spec.js +16 -4
- package/dist/transport/request.d.ts +728 -728
- package/dist/transport/response.d.ts +26 -26
- package/dist/tryout/canonical.d.ts +11 -1
- package/dist/tryout/canonical.js +6 -10
- package/dist/tryout/closure/accounting.d.ts +3 -1
- package/dist/tryout/digest.d.ts +12 -6
- package/dist/tryout/digest.js +21 -14
- package/dist/tryout/hash/catalog.d.ts +228 -3
- package/dist/tryout/hash/catalog.js +5 -7
- package/dist/tryout/hash/content.d.ts +113 -2
- package/dist/tryout/hash/content.js +10 -8
- package/dist/tryout/hash/placement.d.ts +236 -5
- package/dist/tryout/hash/placement.js +7 -8
- package/dist/tryout/runtime/hash.d.ts +3 -1
- package/dist/tryout/runtime/hash.js +3 -1
- package/dist/tryout/runtime/source.d.ts +3 -1
- package/dist/tryout/runtime/verify.d.ts +13 -5
- package/dist/tryout/runtime/verify.js +1 -1
- package/dist/tryout/scoring.d.ts +3 -1
- package/dist/tryout/snapshot/hash.d.ts +45 -4
- package/dist/tryout/snapshot/hash.js +9 -7
- package/package.json +22 -2
|
@@ -1,3 +1,223 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Effect, Schema } from "effect";
|
|
2
|
+
declare const ContentProjectionHashError_base: Schema.Class<ContentProjectionHashError, Schema.TaggedStruct<"ContentProjectionHashError", {
|
|
3
|
+
readonly contentKey: Schema.String;
|
|
4
|
+
}>, import("effect/Cause").YieldableError & {
|
|
5
|
+
readonly brand: unique symbol;
|
|
6
|
+
}>;
|
|
7
|
+
/** The projection identity could not be computed for one content key. */
|
|
8
|
+
export declare class ContentProjectionHashError extends ContentProjectionHashError_base {
|
|
9
|
+
}
|
|
2
10
|
/** Hashes one canonical projection for authoritative content-head diffing. */
|
|
3
|
-
export declare
|
|
11
|
+
export declare const hashContentProjection: (projection: {
|
|
12
|
+
readonly appLocale: ("de" | "en" | "id") & import("effect/Brand").Brand<"@NakafaAI/AksaraAppLocale">;
|
|
13
|
+
readonly articleRouteSlug: string & import("effect/Brand").Brand<"@NakafaAI/AksaraArticleRouteSlug">;
|
|
14
|
+
readonly articleSlug: string & import("effect/Brand").Brand<"@NakafaAI/AksaraArticleSlug">;
|
|
15
|
+
readonly artifactLocale: ("de" | "en" | "id") & import("effect/Brand").Brand<"@NakafaAI/AksaraArtifactLocale">;
|
|
16
|
+
readonly category: string & import("effect/Brand").Brand<"@NakafaAI/AksaraArticleCategory">;
|
|
17
|
+
readonly categoryRouteSlug: string & import("effect/Brand").Brand<"@NakafaAI/AksaraArticleRouteSlug">;
|
|
18
|
+
readonly contentKey: string & import("effect/Brand").Brand<"@NakafaAI/AksaraContentKey">;
|
|
19
|
+
readonly graph: {
|
|
20
|
+
readonly alignmentId: string;
|
|
21
|
+
readonly assetId: string;
|
|
22
|
+
readonly conceptId: string;
|
|
23
|
+
readonly learningObjectId: string;
|
|
24
|
+
readonly lensId: string;
|
|
25
|
+
};
|
|
26
|
+
readonly publicPath: string & import("effect/Brand").Brand<"@NakafaAI/AksaraPublicPath">;
|
|
27
|
+
readonly categoryTitle: string;
|
|
28
|
+
readonly kind: "article";
|
|
29
|
+
readonly metadata: {
|
|
30
|
+
readonly dateModified?: string;
|
|
31
|
+
readonly datePublished: string;
|
|
32
|
+
readonly authors: readonly {
|
|
33
|
+
readonly name: string;
|
|
34
|
+
}[];
|
|
35
|
+
readonly description?: string | undefined;
|
|
36
|
+
readonly title: string;
|
|
37
|
+
};
|
|
38
|
+
readonly official: boolean;
|
|
39
|
+
readonly parentPath: string & import("effect/Brand").Brand<"@NakafaAI/AksaraPublicPath">;
|
|
40
|
+
readonly references: readonly {
|
|
41
|
+
readonly authors: string;
|
|
42
|
+
readonly citation?: string | undefined;
|
|
43
|
+
readonly details?: string | undefined;
|
|
44
|
+
readonly publication?: string | undefined;
|
|
45
|
+
readonly title: string;
|
|
46
|
+
readonly url?: string | undefined;
|
|
47
|
+
readonly year: number;
|
|
48
|
+
}[];
|
|
49
|
+
readonly sitemap: true;
|
|
50
|
+
} | {
|
|
51
|
+
readonly appLocale: ("de" | "en" | "id") & import("effect/Brand").Brand<"@NakafaAI/AksaraAppLocale">;
|
|
52
|
+
readonly artifactLocale: ("de" | "en" | "id") & import("effect/Brand").Brand<"@NakafaAI/AksaraArtifactLocale">;
|
|
53
|
+
readonly contentKey: string & import("effect/Brand").Brand<"@NakafaAI/AksaraContentKey">;
|
|
54
|
+
readonly graph: {
|
|
55
|
+
readonly alignmentId: string;
|
|
56
|
+
readonly assetId: string;
|
|
57
|
+
readonly conceptId: string;
|
|
58
|
+
readonly learningObjectId: string;
|
|
59
|
+
readonly lensId: string;
|
|
60
|
+
};
|
|
61
|
+
readonly materialKey: string & import("effect/Brand").Brand<"@NakafaAI/AksaraMaterialKey">;
|
|
62
|
+
readonly order: number;
|
|
63
|
+
readonly publicPath: string & import("effect/Brand").Brand<"@NakafaAI/AksaraPublicPath">;
|
|
64
|
+
readonly sectionKey: string & import("effect/Brand").Brand<"@NakafaAI/AksaraMaterialSection">;
|
|
65
|
+
readonly kind: "subject-lesson";
|
|
66
|
+
readonly metadata: {
|
|
67
|
+
readonly dateModified?: string;
|
|
68
|
+
readonly datePublished: string;
|
|
69
|
+
readonly authors: readonly {
|
|
70
|
+
readonly name: string;
|
|
71
|
+
}[];
|
|
72
|
+
readonly description?: string | undefined;
|
|
73
|
+
readonly searchTitle?: string;
|
|
74
|
+
readonly subject?: string | undefined;
|
|
75
|
+
readonly title: string;
|
|
76
|
+
};
|
|
77
|
+
readonly parentPath: string & import("effect/Brand").Brand<"@NakafaAI/AksaraPublicPath">;
|
|
78
|
+
readonly sitemap: true;
|
|
79
|
+
readonly topicTitle: string;
|
|
80
|
+
} | {
|
|
81
|
+
readonly appLocale: ("de" | "en" | "id") & import("effect/Brand").Brand<"@NakafaAI/AksaraAppLocale">;
|
|
82
|
+
readonly artifactLocale: ("de" | "en" | "id") & import("effect/Brand").Brand<"@NakafaAI/AksaraArtifactLocale">;
|
|
83
|
+
readonly contentKey: string & import("effect/Brand").Brand<"@NakafaAI/AksaraContentKey">;
|
|
84
|
+
readonly pageKey: string & import("effect/Brand").Brand<"@NakafaAI/AksaraPageKey">;
|
|
85
|
+
readonly publicPath: string & import("effect/Brand").Brand<"@NakafaAI/AksaraPublicPath">;
|
|
86
|
+
readonly kind: "public-page";
|
|
87
|
+
readonly metadata: {
|
|
88
|
+
readonly dateModified?: string;
|
|
89
|
+
readonly datePublished: string;
|
|
90
|
+
readonly description: string;
|
|
91
|
+
readonly title: string;
|
|
92
|
+
};
|
|
93
|
+
readonly sitemap: true;
|
|
94
|
+
readonly sourcePath: string & import("effect/Brand").Brand<"@NakafaAI/AksaraCorpusSourcePath">;
|
|
95
|
+
} | {
|
|
96
|
+
readonly artifactLocale: ("de" | "en" | "id") & import("effect/Brand").Brand<"@NakafaAI/AksaraArtifactLocale">;
|
|
97
|
+
readonly contentKey: string & import("effect/Brand").Brand<"@NakafaAI/AksaraContentKey">;
|
|
98
|
+
readonly peerContentKey: string & import("effect/Brand").Brand<"@NakafaAI/AksaraContentKey">;
|
|
99
|
+
readonly questionKey: string & import("effect/Brand").Brand<"@NakafaAI/AksaraQuestionKey">;
|
|
100
|
+
readonly questionNumber: number;
|
|
101
|
+
readonly setKey: string & import("effect/Brand").Brand<"@NakafaAI/AksaraQuestionSetKey">;
|
|
102
|
+
readonly bodyKind: "question";
|
|
103
|
+
readonly blueprint?: {
|
|
104
|
+
readonly cognitiveLevel: string;
|
|
105
|
+
readonly contentDomain: string;
|
|
106
|
+
readonly topic: string;
|
|
107
|
+
};
|
|
108
|
+
readonly kind: "question-body";
|
|
109
|
+
readonly metadata: {
|
|
110
|
+
readonly dateModified?: string;
|
|
111
|
+
readonly datePublished: string;
|
|
112
|
+
readonly authors: readonly {
|
|
113
|
+
readonly name: string;
|
|
114
|
+
}[];
|
|
115
|
+
readonly title: string;
|
|
116
|
+
};
|
|
117
|
+
readonly stimulusKey?: string;
|
|
118
|
+
readonly response: {
|
|
119
|
+
readonly categories: readonly {
|
|
120
|
+
readonly categoryKey: string;
|
|
121
|
+
readonly label: string;
|
|
122
|
+
readonly order: number;
|
|
123
|
+
}[];
|
|
124
|
+
readonly kind: "category";
|
|
125
|
+
readonly statements: readonly {
|
|
126
|
+
readonly correctCategoryKey: string;
|
|
127
|
+
readonly label: string;
|
|
128
|
+
readonly order: number;
|
|
129
|
+
readonly statementKey: string;
|
|
130
|
+
}[];
|
|
131
|
+
} | {
|
|
132
|
+
readonly kind: "multiple-choice";
|
|
133
|
+
readonly options: readonly {
|
|
134
|
+
readonly isCorrect: boolean;
|
|
135
|
+
readonly label: string;
|
|
136
|
+
readonly optionKey: string;
|
|
137
|
+
readonly order: number;
|
|
138
|
+
}[];
|
|
139
|
+
} | {
|
|
140
|
+
readonly kind: "single-choice";
|
|
141
|
+
readonly options: readonly {
|
|
142
|
+
readonly isCorrect: boolean;
|
|
143
|
+
readonly label: string;
|
|
144
|
+
readonly optionKey: string;
|
|
145
|
+
readonly order: number;
|
|
146
|
+
}[];
|
|
147
|
+
} | {
|
|
148
|
+
readonly criteria: readonly {
|
|
149
|
+
readonly criterionKey: string;
|
|
150
|
+
readonly finalAnswer?: {
|
|
151
|
+
readonly acceptsFractions: boolean;
|
|
152
|
+
readonly kind: "number";
|
|
153
|
+
readonly tolerance?: {
|
|
154
|
+
readonly kind: "absolute" | "relative";
|
|
155
|
+
readonly value: string;
|
|
156
|
+
};
|
|
157
|
+
readonly value: string;
|
|
158
|
+
} | {
|
|
159
|
+
readonly acceptedAnswers: readonly [string, ...string[]];
|
|
160
|
+
readonly collapseWhitespace: boolean;
|
|
161
|
+
readonly ignoreCase: boolean;
|
|
162
|
+
readonly kind: "text";
|
|
163
|
+
};
|
|
164
|
+
readonly order: number;
|
|
165
|
+
readonly label: {
|
|
166
|
+
readonly de: string;
|
|
167
|
+
readonly en: string;
|
|
168
|
+
readonly id: string;
|
|
169
|
+
};
|
|
170
|
+
readonly levels: readonly {
|
|
171
|
+
readonly levelKey: string;
|
|
172
|
+
readonly order: number;
|
|
173
|
+
readonly points: number;
|
|
174
|
+
readonly label: {
|
|
175
|
+
readonly de: string;
|
|
176
|
+
readonly en: string;
|
|
177
|
+
readonly id: string;
|
|
178
|
+
};
|
|
179
|
+
}[];
|
|
180
|
+
}[];
|
|
181
|
+
readonly kind: "rubric";
|
|
182
|
+
} | {
|
|
183
|
+
readonly key: {
|
|
184
|
+
readonly acceptsFractions: boolean;
|
|
185
|
+
readonly kind: "number";
|
|
186
|
+
readonly tolerance?: {
|
|
187
|
+
readonly kind: "absolute" | "relative";
|
|
188
|
+
readonly value: string;
|
|
189
|
+
};
|
|
190
|
+
readonly value: string;
|
|
191
|
+
} | {
|
|
192
|
+
readonly acceptedAnswers: readonly [string, ...string[]];
|
|
193
|
+
readonly collapseWhitespace: boolean;
|
|
194
|
+
readonly ignoreCase: boolean;
|
|
195
|
+
readonly kind: "text";
|
|
196
|
+
};
|
|
197
|
+
readonly kind: "short-answer";
|
|
198
|
+
};
|
|
199
|
+
} | {
|
|
200
|
+
readonly artifactLocale: ("de" | "en" | "id") & import("effect/Brand").Brand<"@NakafaAI/AksaraArtifactLocale">;
|
|
201
|
+
readonly contentKey: string & import("effect/Brand").Brand<"@NakafaAI/AksaraContentKey">;
|
|
202
|
+
readonly peerContentKey: string & import("effect/Brand").Brand<"@NakafaAI/AksaraContentKey">;
|
|
203
|
+
readonly questionKey: string & import("effect/Brand").Brand<"@NakafaAI/AksaraQuestionKey">;
|
|
204
|
+
readonly questionNumber: number;
|
|
205
|
+
readonly setKey: string & import("effect/Brand").Brand<"@NakafaAI/AksaraQuestionSetKey">;
|
|
206
|
+
readonly bodyKind: "answer";
|
|
207
|
+
readonly blueprint?: {
|
|
208
|
+
readonly cognitiveLevel: string;
|
|
209
|
+
readonly contentDomain: string;
|
|
210
|
+
readonly topic: string;
|
|
211
|
+
};
|
|
212
|
+
readonly kind: "question-body";
|
|
213
|
+
readonly metadata: {
|
|
214
|
+
readonly dateModified?: string;
|
|
215
|
+
readonly datePublished: string;
|
|
216
|
+
readonly authors: readonly {
|
|
217
|
+
readonly name: string;
|
|
218
|
+
}[];
|
|
219
|
+
readonly title: string;
|
|
220
|
+
};
|
|
221
|
+
readonly stimulusKey?: string;
|
|
222
|
+
}) => Effect.Effect<string & import("effect/Brand").Brand<"@NakafaAI/AksaraSha256Hash">, ContentProjectionHashError, never>;
|
|
223
|
+
export {};
|
package/dist/projection/hash.js
CHANGED
|
@@ -1,10 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { Effect, Schema } from "effect";
|
|
2
|
+
import { hashText } from "#contracts/hash/text";
|
|
3
3
|
import { canonicalizeContentProjection, } from "#contracts/projection/spec";
|
|
4
|
-
/**
|
|
5
|
-
export
|
|
6
|
-
const digest = createHash("sha256")
|
|
7
|
-
.update(canonicalizeContentProjection(projection))
|
|
8
|
-
.digest("hex");
|
|
9
|
-
return Sha256HashSchema.make(`sha256:${digest}`);
|
|
4
|
+
/** The projection identity could not be computed for one content key. */
|
|
5
|
+
export class ContentProjectionHashError extends Schema.TaggedError()("ContentProjectionHashError", { contentKey: Schema.String }) {
|
|
10
6
|
}
|
|
7
|
+
/** Hashes one canonical projection for authoritative content-head diffing. */
|
|
8
|
+
export const hashContentProjection = Effect.fn("AksaraContracts.hashContentProjection")((projection) => hashText(canonicalizeContentProjection(projection)).pipe(Effect.mapError(() => new ContentProjectionHashError({ contentKey: projection.contentKey }))));
|
|
@@ -2,13 +2,17 @@ import { Effect, Schema, Stream } from "effect";
|
|
|
2
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
|
-
}>, import("effect/Cause").YieldableError
|
|
5
|
+
}>, import("effect/Cause").YieldableError & {
|
|
6
|
+
readonly brand: unique symbol;
|
|
7
|
+
}>;
|
|
6
8
|
/** One streamed projection failed strict schema decoding. */
|
|
7
9
|
export declare class ProjectionDecodeError extends ProjectionDecodeError_base {
|
|
8
10
|
}
|
|
9
11
|
declare const ProjectionOrderError_base: Schema.Class<ProjectionOrderError, Schema.TaggedStruct<"ProjectionOrderError", {
|
|
10
12
|
readonly projectionIndex: Schema.Finite;
|
|
11
|
-
}>, import("effect/Cause").YieldableError
|
|
13
|
+
}>, import("effect/Cause").YieldableError & {
|
|
14
|
+
readonly brand: unique symbol;
|
|
15
|
+
}>;
|
|
12
16
|
/** Projections are duplicated or not in canonical content-head order. */
|
|
13
17
|
export declare class ProjectionOrderError extends ProjectionOrderError_base {
|
|
14
18
|
}
|
|
@@ -16,7 +20,9 @@ declare const ProjectionRouteError_base: Schema.Class<ProjectionRouteError, Sche
|
|
|
16
20
|
readonly duplicateIndex: Schema.Finite;
|
|
17
21
|
readonly firstIndex: Schema.Finite;
|
|
18
22
|
readonly publicPath: Schema.brand<Schema.String, "@NakafaAI/AksaraPublicPath">;
|
|
19
|
-
}>, import("effect/Cause").YieldableError
|
|
23
|
+
}>, import("effect/Cause").YieldableError & {
|
|
24
|
+
readonly brand: unique symbol;
|
|
25
|
+
}>;
|
|
20
26
|
/** Two content projections claim the same locale-specific public route. */
|
|
21
27
|
export declare class ProjectionRouteError extends ProjectionRouteError_base {
|
|
22
28
|
}
|
|
@@ -24,7 +30,9 @@ declare const ProjectionCountError_base: Schema.Class<ProjectionCountError, Sche
|
|
|
24
30
|
readonly actualCount: Schema.Finite;
|
|
25
31
|
readonly expectedCount: Schema.Finite;
|
|
26
32
|
readonly releaseId: Schema.brand<Schema.String, "@NakafaAI/AksaraReleaseId">;
|
|
27
|
-
}>, import("effect/Cause").YieldableError
|
|
33
|
+
}>, import("effect/Cause").YieldableError & {
|
|
34
|
+
readonly brand: unique symbol;
|
|
35
|
+
}>;
|
|
28
36
|
/** The streamed projection count differs from the signed manifest. */
|
|
29
37
|
export declare class ProjectionCountError extends ProjectionCountError_base {
|
|
30
38
|
}
|
|
@@ -32,14 +40,16 @@ declare const ProjectionDigestError_base: Schema.Class<ProjectionDigestError, Sc
|
|
|
32
40
|
readonly actualDigest: Schema.brand<Schema.String, "@NakafaAI/AksaraSha256Hash">;
|
|
33
41
|
readonly expectedDigest: Schema.brand<Schema.String, "@NakafaAI/AksaraSha256Hash">;
|
|
34
42
|
readonly releaseId: Schema.brand<Schema.String, "@NakafaAI/AksaraReleaseId">;
|
|
35
|
-
}>, import("effect/Cause").YieldableError
|
|
43
|
+
}>, import("effect/Cause").YieldableError & {
|
|
44
|
+
readonly brand: unique symbol;
|
|
45
|
+
}>;
|
|
36
46
|
/** The streamed projection digest differs from the signed manifest. */
|
|
37
47
|
export declare class ProjectionDigestError extends ProjectionDigestError_base {
|
|
38
48
|
}
|
|
39
49
|
declare const VerifiedContentProjectionsSchema: Schema.Struct<{
|
|
40
50
|
readonly count: Schema.Finite;
|
|
41
51
|
}>;
|
|
42
|
-
/** Count authenticated
|
|
52
|
+
/** Count authenticated against the signed manifest. The digest holds every canonical byte until its one final call, so its memory grows with the stream. */
|
|
43
53
|
export type VerifiedContentProjections = typeof VerifiedContentProjectionsSchema.Type;
|
|
44
54
|
/** Strictly decodes a replayable canonical content projection stream. */
|
|
45
55
|
export declare function decodeContentProjections<E, R>(projections: Stream.Stream<unknown, E, R>): Stream.Stream<{
|
package/dist/question/item.d.ts
CHANGED
|
@@ -148,7 +148,9 @@ export declare function canonicalQuestionBlueprint(blueprint: QuestionBlueprint)
|
|
|
148
148
|
};
|
|
149
149
|
declare const QuestionResponseLocaleMissingError_base: Schema.Class<QuestionResponseLocaleMissingError, Schema.TaggedStruct<"QuestionResponseLocaleMissingError", {
|
|
150
150
|
readonly artifactLocale: Schema.brand<Schema.Literals<readonly ["en", "id", "de"]>, "@NakafaAI/AksaraArtifactLocale">;
|
|
151
|
-
}>, import("effect/Cause").YieldableError
|
|
151
|
+
}>, import("effect/Cause").YieldableError & {
|
|
152
|
+
readonly brand: unique symbol;
|
|
153
|
+
}>;
|
|
152
154
|
/** One item does not contain the exact artifact locale it must assess. */
|
|
153
155
|
export declare class QuestionResponseLocaleMissingError extends QuestionResponseLocaleMissingError_base {
|
|
154
156
|
}
|
package/dist/question/item.js
CHANGED
|
@@ -160,7 +160,9 @@ export function canonicalQuestionBlueprint(blueprint) {
|
|
|
160
160
|
};
|
|
161
161
|
}
|
|
162
162
|
/** One item does not contain the exact artifact locale it must assess. */
|
|
163
|
-
export class QuestionResponseLocaleMissingError extends Schema.TaggedError()("QuestionResponseLocaleMissingError", {
|
|
163
|
+
export class QuestionResponseLocaleMissingError extends Schema.TaggedError()("QuestionResponseLocaleMissingError", {
|
|
164
|
+
artifactLocale: ArtifactLocaleSchema,
|
|
165
|
+
}) {
|
|
164
166
|
}
|
|
165
167
|
/** Resolves and freezes one exact-locale response from an authored item. */
|
|
166
168
|
export const questionResponseFor = Effect.fn("AksaraContracts.questionResponseFor")(function* (item, artifactLocale) {
|
package/dist/quran/notes.d.ts
CHANGED
|
@@ -19,7 +19,9 @@ export declare const QuranTranslationDocumentSchema: Schema.Struct<{
|
|
|
19
19
|
export type QuranTranslationDocument = typeof QuranTranslationDocumentSchema.Type;
|
|
20
20
|
declare const QuranTranslationNotesError_base: Schema.Class<QuranTranslationNotesError, Schema.TaggedStruct<"QuranTranslationNotesError", {
|
|
21
21
|
readonly reason: Schema.Literals<readonly ["empty-note", "invalid-marker", "invalid-source", "mismatched-markers"]>;
|
|
22
|
-
}>, import("effect/Cause").YieldableError
|
|
22
|
+
}>, import("effect/Cause").YieldableError & {
|
|
23
|
+
readonly brand: unique symbol;
|
|
24
|
+
}>;
|
|
23
25
|
/** The translation and note markers do not form one exact projection. */
|
|
24
26
|
export declare class QuranTranslationNotesError extends QuranTranslationNotesError_base {
|
|
25
27
|
}
|
|
@@ -117,11 +117,15 @@ export declare const QuranProvenanceManifestSchema: Schema.Struct<{
|
|
|
117
117
|
export type QuranProvenanceManifest = typeof QuranProvenanceManifestSchema.Type;
|
|
118
118
|
declare const QuranProvenanceCoverageError_base: Schema.Class<QuranProvenanceCoverageError, Schema.TaggedStruct<"QuranProvenanceCoverageError", {
|
|
119
119
|
readonly actualScopes: Schema.$Array<Schema.Union<readonly [Schema.Union<readonly [Schema.Literals<readonly ["arabic-text", "metadata"]>, Schema.Literals<readonly ["en-tafsir-access", "de-tafsir-access"]>, Schema.Literal<"id-tafsir">]>, Schema.TemplateLiteral<readonly [Schema.Literals<readonly ["en", "id", "de"]>, "-surah-name"]>, Schema.TemplateLiteral<readonly [Schema.Literals<readonly ["en", "id", "de"]>, "-translation"]>]>>;
|
|
120
|
-
}>, import("effect/Cause").YieldableError
|
|
120
|
+
}>, import("effect/Cause").YieldableError & {
|
|
121
|
+
readonly brand: unique symbol;
|
|
122
|
+
}>;
|
|
121
123
|
/** Quran provenance omitted or misordered an active-locale scope. */
|
|
122
124
|
export declare class QuranProvenanceCoverageError extends QuranProvenanceCoverageError_base {
|
|
123
125
|
}
|
|
124
|
-
declare const QuranProvenanceHashError_base: Schema.Class<QuranProvenanceHashError, Schema.TaggedStruct<"QuranProvenanceHashError", {}>, import("effect/Cause").YieldableError
|
|
126
|
+
declare const QuranProvenanceHashError_base: Schema.Class<QuranProvenanceHashError, Schema.TaggedStruct<"QuranProvenanceHashError", {}>, import("effect/Cause").YieldableError & {
|
|
127
|
+
readonly brand: unique symbol;
|
|
128
|
+
}>;
|
|
125
129
|
/** Node could not compute the deterministic provenance digest. */
|
|
126
130
|
export declare class QuranProvenanceHashError extends QuranProvenanceHashError_base {
|
|
127
131
|
}
|
package/dist/quran/provenance.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { createHash } from "node:crypto";
|
|
2
1
|
import { Array as Arr, Effect, MutableList, Schema } from "effect";
|
|
2
|
+
import { hashText } from "#contracts/hash/text";
|
|
3
3
|
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";
|
|
@@ -116,20 +116,13 @@ export function canonicalizeQuranProvenance(record) {
|
|
|
116
116
|
});
|
|
117
117
|
}
|
|
118
118
|
/** Digests exact ordered provenance records under their active locale set. */
|
|
119
|
-
export const hashQuranProvenance = Effect.fn("AksaraContracts.hashQuranProvenance")((input)
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
for (const record of input.records) {
|
|
127
|
-
hash.update(canonicalizeQuranProvenance(record));
|
|
128
|
-
hash.update("\n");
|
|
129
|
-
}
|
|
130
|
-
return Sha256HashSchema.make(`sha256:${hash.digest("hex")}`);
|
|
131
|
-
},
|
|
132
|
-
}));
|
|
119
|
+
export const hashQuranProvenance = Effect.fn("AksaraContracts.hashQuranProvenance")(function* (input) {
|
|
120
|
+
let canonical = `${PROVENANCE_DOMAIN}\n${encodeJsonText(input.activeAppLocales)}\n`;
|
|
121
|
+
for (const record of input.records) {
|
|
122
|
+
canonical += `${canonicalizeQuranProvenance(record)}\n`;
|
|
123
|
+
}
|
|
124
|
+
return yield* hashText(canonical).pipe(Effect.mapError(() => new QuranProvenanceHashError()));
|
|
125
|
+
});
|
|
133
126
|
/** Builds a snapshot provenance gate from exact reviewed source records. */
|
|
134
127
|
export const makeQuranProvenanceManifest = Effect.fn("AksaraContracts.makeQuranProvenanceManifest")(function* (input) {
|
|
135
128
|
const decoded = yield* Schema.decodeUnknownEffect(Schema.Struct({
|
|
@@ -5,14 +5,18 @@ import { QuranRowHashError } from "#contracts/quran/snapshot/row/hash";
|
|
|
5
5
|
declare const QuranRowIntegrityError_base: Schema.Class<QuranRowIntegrityError, Schema.TaggedStruct<"QuranRowIntegrityError", {
|
|
6
6
|
readonly actual: Schema.brand<Schema.String, "@NakafaAI/AksaraSha256Hash">;
|
|
7
7
|
readonly expected: Schema.brand<Schema.String, "@NakafaAI/AksaraSha256Hash">;
|
|
8
|
-
}>, import("effect/Cause").YieldableError
|
|
8
|
+
}>, import("effect/Cause").YieldableError & {
|
|
9
|
+
readonly brand: unique symbol;
|
|
10
|
+
}>;
|
|
9
11
|
/** A current row hash does not authenticate its structured payload. */
|
|
10
12
|
export declare class QuranRowIntegrityError extends QuranRowIntegrityError_base {
|
|
11
13
|
}
|
|
12
14
|
declare const QuranRowOrderError_base: Schema.Class<QuranRowOrderError, Schema.TaggedStruct<"QuranRowOrderError", {
|
|
13
15
|
readonly actual: Schema.String;
|
|
14
16
|
readonly expected: Schema.String;
|
|
15
|
-
}>, import("effect/Cause").YieldableError
|
|
17
|
+
}>, import("effect/Cause").YieldableError & {
|
|
18
|
+
readonly brand: unique symbol;
|
|
19
|
+
}>;
|
|
16
20
|
/** A current row does not match the next deterministic snapshot identity. */
|
|
17
21
|
export declare class QuranRowOrderError extends QuranRowOrderError_base {
|
|
18
22
|
}
|
|
@@ -21,13 +25,13 @@ export declare const digestQuranRows: <E, R>(input: {
|
|
|
21
25
|
readonly activeAppLocales: ActiveAppLocaleList;
|
|
22
26
|
readonly rows: Stream.Stream<Pick<QuranSnapshotRow, "payload" | "rowHash">, E, R>;
|
|
23
27
|
}) => Effect.Effect<{
|
|
28
|
+
projectionDigest: string & import("effect/Brand").Brand<"@NakafaAI/AksaraSha256Hash">;
|
|
29
|
+
runtimeDigest: string & import("effect/Brand").Brand<"@NakafaAI/AksaraSha256Hash">;
|
|
30
|
+
searchDigest: string & import("effect/Brand").Brand<"@NakafaAI/AksaraSha256Hash">;
|
|
24
31
|
attributionCount: number;
|
|
25
32
|
chunkCount: number;
|
|
26
33
|
projectionCount: number;
|
|
27
|
-
projectionDigest: string & import("effect/Brand").Brand<"@NakafaAI/AksaraSha256Hash">;
|
|
28
34
|
runtimeCount: number;
|
|
29
|
-
runtimeDigest: string & import("effect/Brand").Brand<"@NakafaAI/AksaraSha256Hash">;
|
|
30
35
|
searchCount: number;
|
|
31
|
-
searchDigest: string & import("effect/Brand").Brand<"@NakafaAI/AksaraSha256Hash">;
|
|
32
36
|
}, E | QuranRowHashError | QuranRowIntegrityError | QuranRowOrderError, R>;
|
|
33
37
|
export {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { createHash } from "node:crypto";
|
|
2
1
|
import { Array as Arr, Effect, Option, Schema, Stream } from "effect";
|
|
2
|
+
import { DigestStream } from "#contracts/hash/stream";
|
|
3
3
|
import { Sha256HashSchema } from "#contracts/ids";
|
|
4
4
|
import { AppLocaleSchema } from "#contracts/locale";
|
|
5
5
|
import { hashQuranRow, QuranRowHashError, } from "#contracts/quran/snapshot/row/hash";
|
|
@@ -25,10 +25,6 @@ export class QuranRowOrderError extends Schema.TaggedError()("QuranRowOrderError
|
|
|
25
25
|
function joinIdentity(parts) {
|
|
26
26
|
return Arr.join(Arr.map(parts, String), ":");
|
|
27
27
|
}
|
|
28
|
-
/** Formats one finished digest as the signed sha256 hash of a Quran domain. */
|
|
29
|
-
function sha256Digest(hash) {
|
|
30
|
-
return Sha256HashSchema.make(`sha256:${hash.digest("hex")}`);
|
|
31
|
-
}
|
|
32
28
|
/** Resolves one complete stable current row identity. */
|
|
33
29
|
function rowIdentity(payload) {
|
|
34
30
|
if (payload.kind === "quran-attribution") {
|
|
@@ -62,9 +58,9 @@ function rowIdentity(payload) {
|
|
|
62
58
|
/** Keeps current locale closure and digest state private to one replay. */
|
|
63
59
|
class QuranDigestState {
|
|
64
60
|
#activeAppLocales;
|
|
65
|
-
#runtime =
|
|
66
|
-
#search =
|
|
67
|
-
#projection =
|
|
61
|
+
#runtime = new DigestStream();
|
|
62
|
+
#search = new DigestStream();
|
|
63
|
+
#projection = new DigestStream();
|
|
68
64
|
#nextQuranNumber = 1;
|
|
69
65
|
#nextSearchLocale;
|
|
70
66
|
#nextSearchSurah = 1;
|
|
@@ -76,10 +72,13 @@ class QuranDigestState {
|
|
|
76
72
|
projectionCount = 0;
|
|
77
73
|
runtimeCount = 0;
|
|
78
74
|
searchCount = 0;
|
|
79
|
-
/**
|
|
75
|
+
/** Starts one isolated replay under the signed active locale set. */
|
|
80
76
|
constructor(activeAppLocales) {
|
|
81
77
|
this.#activeAppLocales = activeAppLocales;
|
|
82
78
|
this.#nextSearchLocale = activeAppLocales[0];
|
|
79
|
+
this.#runtime.add(`${RUNTIME_DOMAIN}\n`);
|
|
80
|
+
this.#search.add(`${SEARCH_DOMAIN}\n`);
|
|
81
|
+
this.#projection.add(`${PROJECTION_DOMAIN}\n`);
|
|
83
82
|
}
|
|
84
83
|
/** Returns the only row identity valid at the current stream position. */
|
|
85
84
|
expectedIdentity() {
|
|
@@ -164,25 +163,22 @@ class QuranDigestState {
|
|
|
164
163
|
}
|
|
165
164
|
this.advance(row.payload);
|
|
166
165
|
const canonical = `${row.payload.kind}\n${row.rowHash}\n`;
|
|
167
|
-
return Effect.
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
this.
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
this.
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
this.chunkCount += 1;
|
|
184
|
-
}
|
|
185
|
-
},
|
|
166
|
+
return Effect.sync(() => {
|
|
167
|
+
this.#projection.add(canonical);
|
|
168
|
+
this.projectionCount += 1;
|
|
169
|
+
if (row.payload.kind === "quran-search") {
|
|
170
|
+
this.#search.add(canonical);
|
|
171
|
+
this.searchCount += 1;
|
|
172
|
+
return;
|
|
173
|
+
}
|
|
174
|
+
this.#runtime.add(canonical);
|
|
175
|
+
this.runtimeCount += 1;
|
|
176
|
+
if (row.payload.kind === "quran-attribution") {
|
|
177
|
+
this.attributionCount += 1;
|
|
178
|
+
}
|
|
179
|
+
if (row.payload.kind === "quran-chunk") {
|
|
180
|
+
this.chunkCount += 1;
|
|
181
|
+
}
|
|
186
182
|
});
|
|
187
183
|
}
|
|
188
184
|
/** Rejects an incomplete stream before consuming digest state. */
|
|
@@ -204,16 +200,18 @@ class QuranDigestState {
|
|
|
204
200
|
}
|
|
205
201
|
/** Finalizes all ordered current Quran digest domains. */
|
|
206
202
|
digest() {
|
|
207
|
-
return {
|
|
203
|
+
return Effect.all({
|
|
204
|
+
projectionDigest: this.#projection.digest(),
|
|
205
|
+
runtimeDigest: this.#runtime.digest(),
|
|
206
|
+
searchDigest: this.#search.digest(),
|
|
207
|
+
}).pipe(Effect.map((digests) => ({
|
|
208
208
|
attributionCount: this.attributionCount,
|
|
209
209
|
chunkCount: this.chunkCount,
|
|
210
210
|
projectionCount: this.projectionCount,
|
|
211
|
-
projectionDigest: sha256Digest(this.#projection),
|
|
212
211
|
runtimeCount: this.runtimeCount,
|
|
213
|
-
runtimeDigest: sha256Digest(this.#runtime),
|
|
214
212
|
searchCount: this.searchCount,
|
|
215
|
-
|
|
216
|
-
};
|
|
213
|
+
...digests,
|
|
214
|
+
})), Effect.mapError(() => new QuranRowHashError({ scope: "row" })));
|
|
217
215
|
}
|
|
218
216
|
}
|
|
219
217
|
/** Authenticates one current row before advancing ordered state. */
|
|
@@ -229,14 +227,8 @@ const updateQuranDigest = Effect.fn("AksaraContracts.updateQuranDigest")(functio
|
|
|
229
227
|
});
|
|
230
228
|
/** Digests authenticated current rows under one active locale set. */
|
|
231
229
|
export const digestQuranRows = Effect.fn("AksaraContracts.digestQuranRows")(function* (input) {
|
|
232
|
-
const state =
|
|
233
|
-
catch: () => new QuranRowHashError({ scope: "row" }),
|
|
234
|
-
try: () => new QuranDigestState(input.activeAppLocales),
|
|
235
|
-
});
|
|
230
|
+
const state = new QuranDigestState(input.activeAppLocales);
|
|
236
231
|
yield* input.rows.pipe(Stream.runForEach((row) => updateQuranDigest(state, row)));
|
|
237
232
|
yield* state.validateComplete();
|
|
238
|
-
return yield*
|
|
239
|
-
catch: () => new QuranRowHashError({ scope: "row" }),
|
|
240
|
-
try: () => state.digest(),
|
|
241
|
-
});
|
|
233
|
+
return yield* state.digest();
|
|
242
234
|
});
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { Effect, Schema } from "effect";
|
|
2
2
|
import { type QuranSnapshot, type QuranSnapshotFacts } from "#contracts/quran/snapshot/spec";
|
|
3
|
-
declare const QuranSnapshotHashError_base: Schema.Class<QuranSnapshotHashError, Schema.TaggedStruct<"QuranSnapshotHashError", {}>, import("effect/Cause").YieldableError
|
|
3
|
+
declare const QuranSnapshotHashError_base: Schema.Class<QuranSnapshotHashError, Schema.TaggedStruct<"QuranSnapshotHashError", {}>, import("effect/Cause").YieldableError & {
|
|
4
|
+
readonly brand: unique symbol;
|
|
5
|
+
}>;
|
|
4
6
|
/** Node could not compute a deterministic Quran snapshot identity. */
|
|
5
7
|
export declare class QuranSnapshotHashError extends QuranSnapshotHashError_base {
|
|
6
8
|
}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { createHash } from "node:crypto";
|
|
2
1
|
import { Effect, Schema } from "effect";
|
|
3
|
-
import {
|
|
2
|
+
import { hashText } from "#contracts/hash/text";
|
|
4
3
|
import { QURAN_SNAPSHOT_FORMAT, QuranSnapshotSchema, } from "#contracts/quran/snapshot/spec";
|
|
5
4
|
import { encodeJsonText } from "#contracts/text/json";
|
|
6
5
|
const SNAPSHOT_DOMAIN = "nakafa.aksara.localized-quran-snapshot";
|
|
@@ -31,19 +30,14 @@ export function canonicalizeQuranSnapshot(input) {
|
|
|
31
30
|
});
|
|
32
31
|
}
|
|
33
32
|
/** Creates the content-addressed identity of one complete Quran snapshot. */
|
|
34
|
-
export const makeQuranSnapshot = Effect.fn("AksaraContracts.makeQuranSnapshot")((input)
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
format: QURAN_SNAPSHOT_FORMAT,
|
|
43
|
-
snapshotId,
|
|
44
|
-
});
|
|
45
|
-
},
|
|
46
|
-
}));
|
|
33
|
+
export const makeQuranSnapshot = Effect.fn("AksaraContracts.makeQuranSnapshot")(function* (input) {
|
|
34
|
+
const snapshotId = yield* hashText(`${SNAPSHOT_DOMAIN}\n${canonicalizeQuranSnapshot(input)}`).pipe(Effect.mapError(() => new QuranSnapshotHashError()));
|
|
35
|
+
return QuranSnapshotSchema.make({
|
|
36
|
+
...input,
|
|
37
|
+
format: QURAN_SNAPSHOT_FORMAT,
|
|
38
|
+
snapshotId,
|
|
39
|
+
});
|
|
40
|
+
});
|
|
47
41
|
/** Recomputes the content identity of one stored current snapshot. */
|
|
48
42
|
export function verifyQuranSnapshotHash(snapshot) {
|
|
49
43
|
const { format: _format, snapshotId: _snapshotId, ...facts } = snapshot;
|
|
@@ -2,7 +2,9 @@ import { Effect, Schema } from "effect";
|
|
|
2
2
|
import { type QuranRowPayload } from "#contracts/quran/snapshot/row";
|
|
3
3
|
declare const QuranRowHashError_base: Schema.Class<QuranRowHashError, Schema.TaggedStruct<"QuranRowHashError", {
|
|
4
4
|
readonly scope: Schema.Literals<readonly ["digest", "row"]>;
|
|
5
|
-
}>, import("effect/Cause").YieldableError
|
|
5
|
+
}>, import("effect/Cause").YieldableError & {
|
|
6
|
+
readonly brand: unique symbol;
|
|
7
|
+
}>;
|
|
6
8
|
/** Node could not compute a deterministic Quran row identity. */
|
|
7
9
|
export declare class QuranRowHashError extends QuranRowHashError_base {
|
|
8
10
|
}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { createHash } from "node:crypto";
|
|
2
1
|
import { Array as Arr, Effect, Schema } from "effect";
|
|
3
2
|
import { canonicalizeLearningGraphIdentity } from "#contracts/graph/spec";
|
|
4
|
-
import {
|
|
3
|
+
import { hashText } from "#contracts/hash/text";
|
|
5
4
|
import { canonicalizeQuranAttribution } from "#contracts/quran/attribution";
|
|
6
5
|
import { QuranSnapshotRowSchema, } from "#contracts/quran/snapshot/row";
|
|
7
6
|
import { encodeJsonText } from "#contracts/text/json";
|
|
@@ -103,12 +102,7 @@ export function canonicalizeQuranRow(payload) {
|
|
|
103
102
|
});
|
|
104
103
|
}
|
|
105
104
|
/** Computes one current row's domain-separated identity. */
|
|
106
|
-
export const hashQuranRow = Effect.fn("AksaraContracts.hashQuranRow")((payload) => Effect.
|
|
107
|
-
catch: () => new QuranRowHashError({ scope: "row" }),
|
|
108
|
-
try: () => Sha256HashSchema.make(`sha256:${createHash("sha256")
|
|
109
|
-
.update(`${ROW_DOMAIN}\n${canonicalizeQuranRow(payload)}`)
|
|
110
|
-
.digest("hex")}`),
|
|
111
|
-
}));
|
|
105
|
+
export const hashQuranRow = Effect.fn("AksaraContracts.hashQuranRow")((payload) => hashText(`${ROW_DOMAIN}\n${canonicalizeQuranRow(payload)}`).pipe(Effect.mapError(() => new QuranRowHashError({ scope: "row" }))));
|
|
112
106
|
/** Creates one snapshot-bound current row. */
|
|
113
107
|
export const bindQuranRow = Effect.fn("AksaraContracts.bindQuranRow")(function* (snapshotId, payload) {
|
|
114
108
|
const rowHash = yield* hashQuranRow(payload);
|