@nakafa/aksara-contracts 0.48.5 → 0.48.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/artifact/spec.js +6 -8
- package/dist/math/base.d.ts +3 -6
- package/dist/math/resolution.js +10 -7
- package/dist/projection/verify.js +4 -4
- package/dist/question/rubric.js +4 -1
- package/dist/quran/notes.js +5 -6
- package/dist/release/identity.d.ts +33 -0
- package/dist/release/identity.js +14 -0
- package/dist/release/mismatch.d.ts +6 -0
- package/dist/release/mismatch.js +6 -0
- package/dist/release/policy.js +3 -7
- package/dist/release/result/digest.d.ts +4 -4
- package/dist/release/rollback/spec.js +8 -16
- package/dist/release/snapshot/data.js +7 -12
- package/dist/release/snapshot/verify.d.ts +130 -130
- package/dist/release/verify.js +2 -6
- package/dist/runtime/protected/spec.js +1 -1
- package/dist/runtime/spec.d.ts +15 -15
- package/dist/runtime/verify.js +10 -9
- package/dist/transport/request.d.ts +1313 -1313
- package/dist/transport/response.d.ts +198 -198
- package/dist/tryout/hash/catalog.d.ts +26 -26
- package/dist/tryout/scoring.d.ts +113 -8
- package/package.json +5 -1
package/dist/artifact/spec.js
CHANGED
|
@@ -43,22 +43,20 @@ export class ArtifactPayloadFieldByteLimitError extends Schema.TaggedError()("Ar
|
|
|
43
43
|
/** SHA-256 computation failed before authenticity could be established. */
|
|
44
44
|
export class ArtifactHashComputationError extends Schema.TaggedError()("ArtifactHashComputationError", { contentKey: ContentKeySchema }) {
|
|
45
45
|
}
|
|
46
|
-
/**
|
|
47
|
-
|
|
46
|
+
/** Fields that name one content hash, its content key, and the hash that failed. */
|
|
47
|
+
const ContentHashMismatchFields = {
|
|
48
48
|
actualHash: Sha256HashSchema,
|
|
49
49
|
contentKey: ContentKeySchema,
|
|
50
50
|
expectedHash: Sha256HashSchema,
|
|
51
|
-
}
|
|
51
|
+
};
|
|
52
|
+
/** The signed artifact hash does not identify its canonical payload. */
|
|
53
|
+
export class ArtifactHashMismatchError extends Schema.TaggedError()("ArtifactHashMismatchError", { ...ContentHashMismatchFields }) {
|
|
52
54
|
}
|
|
53
55
|
/** SHA-256 could not be calculated for the authenticated authored source. */
|
|
54
56
|
export class ArtifactSourceHashComputationError extends Schema.TaggedError()("ArtifactSourceHashComputationError", { contentKey: ContentKeySchema }) {
|
|
55
57
|
}
|
|
56
58
|
/** The authenticated source hash does not identify the complete raw MDX. */
|
|
57
|
-
export class ArtifactSourceHashMismatchError extends Schema.TaggedError()("ArtifactSourceHashMismatchError", {
|
|
58
|
-
actualHash: Sha256HashSchema,
|
|
59
|
-
contentKey: ContentKeySchema,
|
|
60
|
-
expectedHash: Sha256HashSchema,
|
|
61
|
-
}) {
|
|
59
|
+
export class ArtifactSourceHashMismatchError extends Schema.TaggedError()("ArtifactSourceHashMismatchError", { ...ContentHashMismatchFields }) {
|
|
62
60
|
}
|
|
63
61
|
/** A custom component required by the artifact is absent from the renderer. */
|
|
64
62
|
export class ArtifactRendererComponentMissingError extends Schema.TaggedError()("ArtifactRendererComponentMissingError", {
|
package/dist/math/base.d.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { Schema } from "effect";
|
|
2
|
+
import type { PlaneLabelAnchor, PlaneMathObject } from "#contracts/math/plane";
|
|
3
|
+
import type { SpaceLabelAnchor, SpaceMathObject } from "#contracts/math/space";
|
|
2
4
|
/** Relative floating-point tolerance used by normalized geometry predicates. */
|
|
3
5
|
export declare const GEOMETRY_TOLERANCE: number;
|
|
4
6
|
/** Stable source identity shared by visual objects and rich-label anchors. */
|
|
@@ -41,11 +43,6 @@ export declare function samePlanePoint(left: PlanePoint, right: PlanePoint): boo
|
|
|
41
43
|
/** Returns whether two space positions are exactly the same authored point. */
|
|
42
44
|
export declare function sameSpacePoint(left: SpacePoint, right: SpacePoint): boolean;
|
|
43
45
|
/** Reports every repeated scene identity at its exact authored key path. */
|
|
44
|
-
export declare function mathVisualIdentityIssues(objects: readonly
|
|
45
|
-
readonly id: string;
|
|
46
|
-
}[], labels: readonly {
|
|
47
|
-
readonly key: string;
|
|
48
|
-
readonly objectId: string;
|
|
49
|
-
}[]): readonly Schema.FilterIssue[];
|
|
46
|
+
export declare function mathVisualIdentityIssues(objects: readonly Pick<PlaneMathObject | SpaceMathObject, "id">[], labels: readonly Pick<PlaneLabelAnchor | SpaceLabelAnchor, "key" | "objectId">[]): readonly Schema.FilterIssue[];
|
|
50
47
|
/** Checks that an authored coordinate sequence contains no repeated position. */
|
|
51
48
|
export declare function hasUniquePositions<T>(values: readonly T[], same: (left: T, right: T) => boolean): boolean;
|
package/dist/math/resolution.js
CHANGED
|
@@ -74,17 +74,20 @@ function planeObjectIssues(frame, object, index, threshold) {
|
|
|
74
74
|
}
|
|
75
75
|
return objectResolutionIssues(frame, object, index, threshold);
|
|
76
76
|
}
|
|
77
|
-
/**
|
|
77
|
+
/**
|
|
78
|
+
* Reports every frame axis whose non-zero span collapses in the envelope. Each
|
|
79
|
+
* entry pairs one axis with its range.
|
|
80
|
+
*/
|
|
78
81
|
function frameIssues(entries, threshold) {
|
|
79
|
-
return Arr.flatMap(entries, (
|
|
82
|
+
return Arr.flatMap(entries, ([axis, range]) => spanUnresolved(range, threshold) ? [issue(["frame", axis])] : []);
|
|
80
83
|
}
|
|
81
84
|
/** Reports every plane delta that a normalized renderer cannot preserve. */
|
|
82
85
|
export function planeResolutionIssues(frame, objects, labels, view) {
|
|
83
86
|
const threshold = renderThreshold([frame.x, frame.y], view.padding ?? 0);
|
|
84
87
|
return uniqueIssues([
|
|
85
88
|
...frameIssues([
|
|
86
|
-
|
|
87
|
-
|
|
89
|
+
["x", frame.x],
|
|
90
|
+
["y", frame.y],
|
|
88
91
|
], threshold),
|
|
89
92
|
...measureIssue(view.padding ?? 0, threshold, ["view", "padding"]),
|
|
90
93
|
...Arr.map(coordinateCollisionPaths(planeSceneCoordinates(frame, objects, labels, threshold), threshold), issue),
|
|
@@ -104,9 +107,9 @@ export function spaceResolutionIssues(frame, objects, labels, view) {
|
|
|
104
107
|
const threshold = renderThreshold([frame.x, frame.y, frame.z], view.kind === "fit" ? (view.padding ?? 0) : 0, envelopePairs);
|
|
105
108
|
return uniqueIssues([
|
|
106
109
|
...frameIssues([
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
+
["x", frame.x],
|
|
111
|
+
["y", frame.y],
|
|
112
|
+
["z", frame.z],
|
|
110
113
|
], threshold),
|
|
111
114
|
...measureIssue(view.kind === "fit" ? (view.padding ?? 0) : 0, threshold, [
|
|
112
115
|
"view",
|
|
@@ -28,7 +28,7 @@ export class ProjectionDigestError extends Schema.TaggedError()("ProjectionDiges
|
|
|
28
28
|
function projectionState() {
|
|
29
29
|
return {
|
|
30
30
|
firstIndexByRoute: MutableHashMap.empty(),
|
|
31
|
-
previous:
|
|
31
|
+
previous: Option.none(),
|
|
32
32
|
};
|
|
33
33
|
}
|
|
34
34
|
const VerifiedContentProjectionsSchema = Schema.Struct({
|
|
@@ -37,11 +37,11 @@ const VerifiedContentProjectionsSchema = Schema.Struct({
|
|
|
37
37
|
/** Decodes one row and applies canonical order and route uniqueness rules. */
|
|
38
38
|
const decodeProjection = Effect.fn("AksaraContracts.decodeProjection")(function* (state, source, projectionIndex) {
|
|
39
39
|
const projection = yield* Schema.decodeUnknownEffect(ContentProjectionSchema)(source, { onExcessProperty: "error" }).pipe(Effect.mapError(() => new ProjectionDecodeError({ projectionIndex })));
|
|
40
|
-
if (state.previous &&
|
|
41
|
-
compareContentHeads(state.previous, projection) >= 0) {
|
|
40
|
+
if (Option.isSome(state.previous) &&
|
|
41
|
+
compareContentHeads(state.previous.value, projection) >= 0) {
|
|
42
42
|
return yield* new ProjectionOrderError({ projectionIndex });
|
|
43
43
|
}
|
|
44
|
-
state.previous = projection;
|
|
44
|
+
state.previous = Option.some(projection);
|
|
45
45
|
if (projection.kind === "question-body") {
|
|
46
46
|
return projection;
|
|
47
47
|
}
|
package/dist/question/rubric.js
CHANGED
|
@@ -34,7 +34,10 @@ function hasOrderedScale(criterion) {
|
|
|
34
34
|
return criterion.levels.length === 2 && lower?.points === 0;
|
|
35
35
|
}
|
|
36
36
|
const ORDERED_SCALE_MESSAGE = "Rubric criteria need two or more levels whose points strictly ascend, and a final-answer criterion needs exactly a zero level and one higher level.";
|
|
37
|
-
/**
|
|
37
|
+
/**
|
|
38
|
+
* Checks one or more criteria and the stable keys derived from their order. A
|
|
39
|
+
* labeled criterion is a scale criterion with labels, so both kinds pass here.
|
|
40
|
+
*/
|
|
38
41
|
function hasCanonicalCriteria(criteria) {
|
|
39
42
|
return (criteria.length > 0 &&
|
|
40
43
|
Arr.every(criteria, ({ criterionKey, levels, order }, index) => order === index + 1 &&
|
package/dist/quran/notes.js
CHANGED
|
@@ -60,7 +60,7 @@ function readMarkers(source) {
|
|
|
60
60
|
const number = Number(rawNumber);
|
|
61
61
|
if (rawNumber !== String(number) ||
|
|
62
62
|
!Schema.is(QuranTranslationNoteNumberSchema)(number)) {
|
|
63
|
-
return
|
|
63
|
+
return Option.none();
|
|
64
64
|
}
|
|
65
65
|
MutableList.append(markers, {
|
|
66
66
|
end: start + match[0].length,
|
|
@@ -68,7 +68,7 @@ function readMarkers(source) {
|
|
|
68
68
|
start,
|
|
69
69
|
});
|
|
70
70
|
}
|
|
71
|
-
return
|
|
71
|
+
return Option.some(MutableList.toArray(markers));
|
|
72
72
|
}
|
|
73
73
|
/** Converts the translation body to text and note-reference segments. */
|
|
74
74
|
function segmentTranslation(source, markers) {
|
|
@@ -102,12 +102,11 @@ function segmentTranslation(source, markers) {
|
|
|
102
102
|
function analyzeTranslation(source) {
|
|
103
103
|
const referencesResult = readMarkers(source.text);
|
|
104
104
|
const definitionsResult = readMarkers(source.footnotes);
|
|
105
|
-
if (referencesResult
|
|
106
|
-
definitionsResult._tag === "Failure") {
|
|
105
|
+
if (Option.isNone(referencesResult) || Option.isNone(definitionsResult)) {
|
|
107
106
|
return { _tag: "Failure", reason: "invalid-marker" };
|
|
108
107
|
}
|
|
109
|
-
const references = referencesResult.
|
|
110
|
-
const definitions = definitionsResult.
|
|
108
|
+
const references = referencesResult.value;
|
|
109
|
+
const definitions = definitionsResult.value;
|
|
111
110
|
const uniqueReferences = Arr.filter(references, (reference, index) => Option.contains(Arr.findFirstIndex(references, ({ number }) => number === reference.number), index));
|
|
112
111
|
const noteCandidates = Arr.map(definitions, (definition, index) => ({
|
|
113
112
|
definition,
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { Schema } from "effect";
|
|
2
|
+
/** Immutable identity of the active content catalog that one release builds on or replaces. */
|
|
3
|
+
export declare const ActiveCatalogIdentitySchema: Schema.Struct<{
|
|
4
|
+
readonly activeAppLocales: Schema.NonEmptyArray<Schema.brand<Schema.Literals<readonly ["en", "id", "de"]>, "@NakafaAI/AksaraAppLocale">>;
|
|
5
|
+
readonly manifestHash: Schema.brand<Schema.String, "@NakafaAI/AksaraSha256Hash">;
|
|
6
|
+
readonly releaseId: Schema.brand<Schema.String, "@NakafaAI/AksaraReleaseId">;
|
|
7
|
+
readonly resultCount: Schema.Finite;
|
|
8
|
+
readonly resultDigest: Schema.brand<Schema.String, "@NakafaAI/AksaraSha256Hash">;
|
|
9
|
+
readonly snapshots: Schema.Struct<{
|
|
10
|
+
readonly program: Schema.Struct<{
|
|
11
|
+
readonly baseSnapshotId: Schema.NullOr<Schema.brand<Schema.String, "@NakafaAI/AksaraSha256Hash">>;
|
|
12
|
+
readonly mode: Schema.Literals<readonly ["inherit", "replace", "restore"]>;
|
|
13
|
+
readonly resultSnapshotId: Schema.NullOr<Schema.brand<Schema.String, "@NakafaAI/AksaraSha256Hash">>;
|
|
14
|
+
readonly rowCount: Schema.Int;
|
|
15
|
+
readonly rowDigest: Schema.brand<Schema.String, "@NakafaAI/AksaraSha256Hash">;
|
|
16
|
+
}>;
|
|
17
|
+
readonly quran: Schema.Struct<{
|
|
18
|
+
readonly baseSnapshotId: Schema.NullOr<Schema.brand<Schema.String, "@NakafaAI/AksaraSha256Hash">>;
|
|
19
|
+
readonly mode: Schema.Literals<readonly ["inherit", "replace", "restore"]>;
|
|
20
|
+
readonly resultSnapshotId: Schema.NullOr<Schema.brand<Schema.String, "@NakafaAI/AksaraSha256Hash">>;
|
|
21
|
+
readonly rowCount: Schema.Int;
|
|
22
|
+
readonly rowDigest: Schema.brand<Schema.String, "@NakafaAI/AksaraSha256Hash">;
|
|
23
|
+
}>;
|
|
24
|
+
readonly tryout: Schema.Struct<{
|
|
25
|
+
readonly baseSnapshotId: Schema.NullOr<Schema.brand<Schema.String, "@NakafaAI/AksaraSha256Hash">>;
|
|
26
|
+
readonly mode: Schema.Literals<readonly ["inherit", "replace", "restore"]>;
|
|
27
|
+
readonly resultSnapshotId: Schema.NullOr<Schema.brand<Schema.String, "@NakafaAI/AksaraSha256Hash">>;
|
|
28
|
+
readonly rowCount: Schema.Int;
|
|
29
|
+
readonly rowDigest: Schema.brand<Schema.String, "@NakafaAI/AksaraSha256Hash">;
|
|
30
|
+
}>;
|
|
31
|
+
}>;
|
|
32
|
+
}>;
|
|
33
|
+
export type ActiveCatalogIdentity = typeof ActiveCatalogIdentitySchema.Type;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Schema } from "effect";
|
|
2
|
+
import { ReleaseIdSchema, Sha256HashSchema } from "#contracts/ids";
|
|
3
|
+
import { ActiveAppLocaleListSchema } from "#contracts/locale";
|
|
4
|
+
import { ContentSnapshotSetSchema } from "#contracts/release/snapshot/spec";
|
|
5
|
+
import { ReleaseCountSchema } from "#contracts/release/spec";
|
|
6
|
+
/** Immutable identity of the active content catalog that one release builds on or replaces. */
|
|
7
|
+
export const ActiveCatalogIdentitySchema = Schema.Struct({
|
|
8
|
+
activeAppLocales: ActiveAppLocaleListSchema,
|
|
9
|
+
manifestHash: Sha256HashSchema,
|
|
10
|
+
releaseId: ReleaseIdSchema,
|
|
11
|
+
resultCount: ReleaseCountSchema,
|
|
12
|
+
resultDigest: Sha256HashSchema,
|
|
13
|
+
snapshots: ContentSnapshotSetSchema,
|
|
14
|
+
});
|
|
@@ -10,3 +10,9 @@ export declare const ReleaseCountMismatchFields: {
|
|
|
10
10
|
expectedCount: import("effect/Schema").Finite;
|
|
11
11
|
releaseId: import("effect/Schema").brand<import("effect/Schema").String, "@NakafaAI/AksaraReleaseId">;
|
|
12
12
|
};
|
|
13
|
+
/** Fields that name one signed release manifest hash and the recomputed hash that failed. */
|
|
14
|
+
export declare const ReleaseHashMismatchFields: {
|
|
15
|
+
actualHash: import("effect/Schema").brand<import("effect/Schema").String, "@NakafaAI/AksaraSha256Hash">;
|
|
16
|
+
expectedHash: import("effect/Schema").brand<import("effect/Schema").String, "@NakafaAI/AksaraSha256Hash">;
|
|
17
|
+
releaseId: import("effect/Schema").brand<import("effect/Schema").String, "@NakafaAI/AksaraReleaseId">;
|
|
18
|
+
};
|
package/dist/release/mismatch.js
CHANGED
|
@@ -12,3 +12,9 @@ export const ReleaseCountMismatchFields = {
|
|
|
12
12
|
expectedCount: ReleaseCountSchema,
|
|
13
13
|
releaseId: ReleaseIdSchema,
|
|
14
14
|
};
|
|
15
|
+
/** Fields that name one signed release manifest hash and the recomputed hash that failed. */
|
|
16
|
+
export const ReleaseHashMismatchFields = {
|
|
17
|
+
actualHash: Sha256HashSchema,
|
|
18
|
+
expectedHash: Sha256HashSchema,
|
|
19
|
+
releaseId: ReleaseIdSchema,
|
|
20
|
+
};
|
package/dist/release/policy.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Array as Arr, Effect, Schema } from "effect";
|
|
2
2
|
import { ContentFamilySchema } from "#contracts/content";
|
|
3
3
|
import { ActiveAppLocaleListSchema } from "#contracts/locale";
|
|
4
|
+
import { hasSameAppLocales } from "#contracts/release/current/evidence";
|
|
4
5
|
import { ContentSnapshotKindSchema, } from "#contracts/release/snapshot/scope";
|
|
5
6
|
const ClosureFieldSchema = Schema.Literals([
|
|
6
7
|
"activeAppLocales",
|
|
@@ -21,14 +22,9 @@ export class ReleasePolicyClosureError extends Schema.TaggedError()("ReleasePoli
|
|
|
21
22
|
field: ClosureFieldSchema,
|
|
22
23
|
}) {
|
|
23
24
|
}
|
|
24
|
-
/** Compares locale lists without exchanging their branded element roles. */
|
|
25
|
-
function hasSameLocaleCodes(left, right) {
|
|
26
|
-
return (left.length === right.length &&
|
|
27
|
-
Arr.every(left, (locale, index) => locale === right[index]));
|
|
28
|
-
}
|
|
29
25
|
/** Returns whether two release policies have the same signed identity. */
|
|
30
26
|
function hasSamePolicy(left, right) {
|
|
31
|
-
return
|
|
27
|
+
return hasSameAppLocales(left.activeAppLocales, right.activeAppLocales);
|
|
32
28
|
}
|
|
33
29
|
/** Fails with one exact structured-scope policy mismatch. */
|
|
34
30
|
function failClosure(input) {
|
|
@@ -36,7 +32,7 @@ function failClosure(input) {
|
|
|
36
32
|
}
|
|
37
33
|
/** Verifies one replacement snapshot against the new release policy. */
|
|
38
34
|
function verifyManifestPolicy(manifest, policy) {
|
|
39
|
-
if (!
|
|
35
|
+
if (!hasSameAppLocales(manifest.manifest.activeAppLocales, policy.activeAppLocales)) {
|
|
40
36
|
return failClosure({
|
|
41
37
|
actual: Arr.join(manifest.manifest.activeAppLocales, ","),
|
|
42
38
|
expected: Arr.join(policy.activeAppLocales, ","),
|
|
@@ -73,7 +73,7 @@ export declare const digestResultCatalog: <E, R>(releaseId: string & import("eff
|
|
|
73
73
|
readonly rendererDomain: "ai-ds" | "biology" | "chemistry" | "mathematics" | "physics" | "politics" | "site" | "snbt-general" | "snbt-math" | "snbt-plain" | "snbt-quant" | "tka-math";
|
|
74
74
|
readonly sourceHash: string & import("effect/Brand").Brand<"@NakafaAI/AksaraSha256Hash">;
|
|
75
75
|
readonly sourcePath: string & import("effect/Brand").Brand<"@NakafaAI/AksaraCorpusSourcePath">;
|
|
76
|
-
readonly family: "
|
|
76
|
+
readonly family: "article";
|
|
77
77
|
} | {
|
|
78
78
|
readonly artifactHash: string & import("effect/Brand").Brand<"@NakafaAI/AksaraSha256Hash">;
|
|
79
79
|
readonly artifactLocale: ("de" | "en" | "id") & import("effect/Brand").Brand<"@NakafaAI/AksaraArtifactLocale">;
|
|
@@ -85,7 +85,7 @@ export declare const digestResultCatalog: <E, R>(releaseId: string & import("eff
|
|
|
85
85
|
readonly rendererDomain: "ai-ds" | "biology" | "chemistry" | "mathematics" | "physics" | "politics" | "site" | "snbt-general" | "snbt-math" | "snbt-plain" | "snbt-quant" | "tka-math";
|
|
86
86
|
readonly sourceHash: string & import("effect/Brand").Brand<"@NakafaAI/AksaraSha256Hash">;
|
|
87
87
|
readonly sourcePath: string & import("effect/Brand").Brand<"@NakafaAI/AksaraCorpusSourcePath">;
|
|
88
|
-
readonly family: "
|
|
88
|
+
readonly family: "material";
|
|
89
89
|
} | {
|
|
90
90
|
readonly artifactHash: string & import("effect/Brand").Brand<"@NakafaAI/AksaraSha256Hash">;
|
|
91
91
|
readonly artifactLocale: ("de" | "en" | "id") & import("effect/Brand").Brand<"@NakafaAI/AksaraArtifactLocale">;
|
|
@@ -97,7 +97,7 @@ export declare const digestResultCatalog: <E, R>(releaseId: string & import("eff
|
|
|
97
97
|
readonly rendererDomain: "ai-ds" | "biology" | "chemistry" | "mathematics" | "physics" | "politics" | "site" | "snbt-general" | "snbt-math" | "snbt-plain" | "snbt-quant" | "tka-math";
|
|
98
98
|
readonly sourceHash: string & import("effect/Brand").Brand<"@NakafaAI/AksaraSha256Hash">;
|
|
99
99
|
readonly sourcePath: string & import("effect/Brand").Brand<"@NakafaAI/AksaraCorpusSourcePath">;
|
|
100
|
-
readonly family: "
|
|
100
|
+
readonly family: "page";
|
|
101
101
|
} | {
|
|
102
102
|
readonly artifactHash: string & import("effect/Brand").Brand<"@NakafaAI/AksaraSha256Hash">;
|
|
103
103
|
readonly artifactLocale: ("de" | "en" | "id") & import("effect/Brand").Brand<"@NakafaAI/AksaraArtifactLocale">;
|
|
@@ -109,7 +109,7 @@ export declare const digestResultCatalog: <E, R>(releaseId: string & import("eff
|
|
|
109
109
|
readonly rendererDomain: "ai-ds" | "biology" | "chemistry" | "mathematics" | "physics" | "politics" | "site" | "snbt-general" | "snbt-math" | "snbt-plain" | "snbt-quant" | "tka-math";
|
|
110
110
|
readonly sourceHash: string & import("effect/Brand").Brand<"@NakafaAI/AksaraSha256Hash">;
|
|
111
111
|
readonly sourcePath: string & import("effect/Brand").Brand<"@NakafaAI/AksaraCorpusSourcePath">;
|
|
112
|
-
readonly family: "
|
|
112
|
+
readonly family: "question";
|
|
113
113
|
}, E, R>) => Effect.Effect<{
|
|
114
114
|
count: number;
|
|
115
115
|
digest: string & import("effect/Brand").Brand<"@NakafaAI/AksaraSha256Hash">;
|
|
@@ -18,26 +18,18 @@ export const RollbackAbsentStateSchema = Schema.Struct({
|
|
|
18
18
|
family: ContentFamilySchema,
|
|
19
19
|
state: Schema.Literal("absent"),
|
|
20
20
|
});
|
|
21
|
+
/** Builds the compact prior state of one content family from its head schema. */
|
|
22
|
+
function headStateSchema(state, head) {
|
|
23
|
+
return Schema.Struct({ head, state: Schema.Literal(state) });
|
|
24
|
+
}
|
|
21
25
|
/** Compact authoritative prior article head protected by one rollback digest. */
|
|
22
|
-
export const RollbackArticleStateSchema =
|
|
23
|
-
head: ArticleHeadSchema,
|
|
24
|
-
state: Schema.Literal("article"),
|
|
25
|
-
});
|
|
26
|
+
export const RollbackArticleStateSchema = headStateSchema("article", ArticleHeadSchema);
|
|
26
27
|
/** Compact authoritative prior head protected by one rollback snapshot digest. */
|
|
27
|
-
export const RollbackMaterialStateSchema =
|
|
28
|
-
head: MaterialHeadSchema,
|
|
29
|
-
state: Schema.Literal("material"),
|
|
30
|
-
});
|
|
28
|
+
export const RollbackMaterialStateSchema = headStateSchema("material", MaterialHeadSchema);
|
|
31
29
|
/** Compact authoritative prior page head protected by one rollback digest. */
|
|
32
|
-
export const RollbackPageStateSchema =
|
|
33
|
-
head: PageHeadSchema,
|
|
34
|
-
state: Schema.Literal("page"),
|
|
35
|
-
});
|
|
30
|
+
export const RollbackPageStateSchema = headStateSchema("page", PageHeadSchema);
|
|
36
31
|
/** Compact authoritative prior question head protected by one rollback digest. */
|
|
37
|
-
export const RollbackQuestionStateSchema =
|
|
38
|
-
head: QuestionHeadSchema,
|
|
39
|
-
state: Schema.Literal("question"),
|
|
40
|
-
});
|
|
32
|
+
export const RollbackQuestionStateSchema = headStateSchema("question", QuestionHeadSchema);
|
|
41
33
|
/** Complete compact state vocabulary authenticated for one future rollback. */
|
|
42
34
|
export const RollbackSnapshotStateSchema = Schema.Union([
|
|
43
35
|
RollbackAbsentStateSchema,
|
|
@@ -8,21 +8,16 @@ import { encodeJsonText } from "#contracts/text/json";
|
|
|
8
8
|
import { TryoutCatalogRecordSchema } from "#contracts/tryout/catalog";
|
|
9
9
|
import { TryoutPlacementRecordSchema } from "#contracts/tryout/placement";
|
|
10
10
|
import { TryoutSnapshotSchema } from "#contracts/tryout/snapshot/spec";
|
|
11
|
+
/** Pairs one family literal with the snapshot manifest it selects. */
|
|
12
|
+
function familyManifestSchema(family, manifest) {
|
|
13
|
+
return Schema.Struct({ family: Schema.Literal(family), manifest });
|
|
14
|
+
}
|
|
11
15
|
/** Program manifest selected by one globally signed content release. */
|
|
12
|
-
const ProgramManifestSchema =
|
|
13
|
-
family: Schema.Literal("program"),
|
|
14
|
-
manifest: ProgramSnapshotSchema,
|
|
15
|
-
});
|
|
16
|
+
const ProgramManifestSchema = familyManifestSchema("program", ProgramSnapshotSchema);
|
|
16
17
|
/** Quran manifest selected by one globally signed content release. */
|
|
17
|
-
const QuranManifestSchema =
|
|
18
|
-
family: Schema.Literal("quran"),
|
|
19
|
-
manifest: QuranSnapshotSchema,
|
|
20
|
-
});
|
|
18
|
+
const QuranManifestSchema = familyManifestSchema("quran", QuranSnapshotSchema);
|
|
21
19
|
/** Try-out manifest selected by one globally signed content release. */
|
|
22
|
-
const TryoutManifestSchema =
|
|
23
|
-
family: Schema.Literal("tryout"),
|
|
24
|
-
manifest: TryoutSnapshotSchema,
|
|
25
|
-
});
|
|
20
|
+
const TryoutManifestSchema = familyManifestSchema("tryout", TryoutSnapshotSchema);
|
|
26
21
|
/** Complete structured snapshot manifest vocabulary staged before its rows. */
|
|
27
22
|
export const ContentSnapshotManifestSchema = Schema.Union([
|
|
28
23
|
ProgramManifestSchema,
|