@nakafa/aksara-contracts 0.42.0 → 0.44.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/README.md +20 -1
- package/dist/math/resolution.js +1 -1
- package/dist/math/scene.js +1 -1
- package/dist/preview/artifact.d.ts +44 -0
- package/dist/preview/document.d.ts +36 -12
- package/dist/preview/spec.d.ts +196 -36
- package/dist/preview/target.d.ts +10 -3
- package/dist/program/snapshot/digest.d.ts +1 -1
- package/dist/program/snapshot/digest.js +1 -1
- package/dist/program/snapshot/hash.d.ts +153 -0
- package/dist/program/snapshot/hash.js +31 -0
- package/dist/projection/digest.d.ts +74 -22
- package/dist/projection/material.d.ts +10 -0
- package/dist/projection/material.js +15 -0
- package/dist/projection/question.d.ts +188 -0
- package/dist/projection/spec.d.ts +45 -0
- package/dist/projection/verify.d.ts +127 -75
- package/dist/question/answer.d.ts +141 -0
- package/dist/question/answer.js +238 -0
- package/dist/question/item.d.ts +276 -1
- package/dist/question/item.js +63 -38
- package/dist/question/label.d.ts +3 -0
- package/dist/question/label.js +3 -0
- package/dist/question/points.d.ts +18 -0
- package/dist/question/points.js +22 -0
- package/dist/question/response.d.ts +187 -5
- package/dist/question/response.js +41 -4
- package/dist/question/rubric.d.ts +234 -0
- package/dist/question/rubric.js +182 -0
- package/dist/release/rollback/spec.d.ts +264 -0
- package/dist/release/snapshot/data.d.ts +52 -3
- package/dist/release/snapshot/{program-evidence.d.ts → evidence/program.d.ts} +2 -2
- package/dist/release/snapshot/{program-evidence.js → evidence/program.js} +1 -1
- package/dist/release/snapshot/{quran-evidence.d.ts → evidence/quran.d.ts} +2 -2
- package/dist/release/snapshot/{quran-evidence.js → evidence/quran.js} +1 -1
- package/dist/release/snapshot/{tryout-evidence.d.ts → evidence/tryout.d.ts} +2 -2
- package/dist/release/snapshot/{tryout-evidence.js → evidence/tryout.js} +4 -4
- package/dist/release/snapshot/evidence.d.ts +2 -2
- package/dist/release/snapshot/evidence.js +3 -3
- package/dist/release/snapshot/verify.d.ts +88 -31
- package/dist/runtime/spec.d.ts +25 -22
- package/dist/runtime/verify.d.ts +46 -44
- package/dist/transport/batch.d.ts +88 -0
- package/dist/transport/group.d.ts +288 -9
- package/dist/transport/request.d.ts +1858 -1018
- package/dist/transport/response.d.ts +499 -131
- package/dist/transport/snapshot.d.ts +104 -6
- package/dist/tryout/catalog.d.ts +28 -10
- package/dist/tryout/catalog.js +6 -2
- package/dist/tryout/closure/accounting.d.ts +16 -0
- package/dist/tryout/closure/accounting.js +68 -0
- package/dist/tryout/closure/locale.d.ts +14 -0
- package/dist/tryout/{locale-closure.js → closure/locale.js} +13 -72
- package/dist/tryout/{placement-closure.js → closure/placement.js} +1 -0
- package/dist/tryout/{catalog-hash.d.ts → hash/catalog.d.ts} +25 -20
- package/dist/tryout/{catalog-hash.js → hash/catalog.js} +8 -1
- package/dist/tryout/{content-hash.d.ts → hash/content.d.ts} +43 -0
- package/dist/tryout/{placement-hash.d.ts → hash/placement.d.ts} +1 -1
- package/dist/tryout/{placement-hash.js → hash/placement.js} +2 -1
- package/dist/tryout/placement.d.ts +136 -1
- package/dist/tryout/placement.js +16 -2
- package/dist/tryout/scoring.d.ts +37 -0
- package/dist/tryout/scoring.js +89 -0
- package/dist/tryout/spec.d.ts +32 -4
- package/dist/tryout/spec.js +35 -4
- package/package.json +29 -21
- package/dist/program/snapshot/row-hash.d.ts +0 -155
- package/dist/program/snapshot/row-hash.js +0 -34
- package/dist/tryout/locale-closure.d.ts +0 -20
- /package/dist/math/{arc-precision.d.ts → arc.d.ts} +0 -0
- /package/dist/math/{arc-precision.js → arc.js} +0 -0
- /package/dist/release/snapshot/{evidence-requirement.d.ts → evidence/requirement.d.ts} +0 -0
- /package/dist/release/snapshot/{evidence-requirement.js → evidence/requirement.js} +0 -0
- /package/dist/tryout/{placement-closure.d.ts → closure/placement.d.ts} +0 -0
- /package/dist/tryout/{row-hash.d.ts → digest.d.ts} +0 -0
- /package/dist/tryout/{row-hash.js → digest.js} +0 -0
- /package/dist/tryout/{content-hash.js → hash/content.js} +0 -0
package/dist/preview/target.d.ts
CHANGED
|
@@ -26,6 +26,7 @@ export declare const TryoutPreviewPlacementSchema: Schema.Struct<{
|
|
|
26
26
|
readonly kind: Schema.Literal<"fixed">;
|
|
27
27
|
readonly language: Schema.brand<Schema.Literals<readonly ["en", "id", "de"]>, "@NakafaAI/AksaraDeliveryLanguage">;
|
|
28
28
|
}>]>;
|
|
29
|
+
readonly points: Schema.optionalKey<Schema.Int>;
|
|
29
30
|
readonly questionArtifactLocale: Schema.brand<Schema.Literals<readonly ["en", "id", "de"]>, "@NakafaAI/AksaraArtifactLocale">;
|
|
30
31
|
readonly questionContentKey: Schema.brand<Schema.String, "@NakafaAI/AksaraContentKey">;
|
|
31
32
|
readonly questionOrder: Schema.Finite;
|
|
@@ -57,7 +58,7 @@ export declare const TryoutPreviewTargetSchema: Schema.Struct<{
|
|
|
57
58
|
readonly kind: Schema.Literal<"exam">;
|
|
58
59
|
readonly order: Schema.Finite;
|
|
59
60
|
readonly publicPath: Schema.brand<Schema.String, "@NakafaAI/AksaraPublicPath">;
|
|
60
|
-
readonly scoringStrategy: Schema.Literals<readonly ["irt", "raw"]>;
|
|
61
|
+
readonly scoringStrategy: Schema.Literals<readonly ["irt", "penalized", "raw"]>;
|
|
61
62
|
}>;
|
|
62
63
|
readonly placement: Schema.Struct<{
|
|
63
64
|
readonly answerArtifactLocale: Schema.brand<Schema.Literals<readonly ["en", "id", "de"]>, "@NakafaAI/AksaraArtifactLocale">;
|
|
@@ -77,6 +78,7 @@ export declare const TryoutPreviewTargetSchema: Schema.Struct<{
|
|
|
77
78
|
readonly kind: Schema.Literal<"fixed">;
|
|
78
79
|
readonly language: Schema.brand<Schema.Literals<readonly ["en", "id", "de"]>, "@NakafaAI/AksaraDeliveryLanguage">;
|
|
79
80
|
}>]>;
|
|
81
|
+
readonly points: Schema.optionalKey<Schema.Int>;
|
|
80
82
|
readonly questionArtifactLocale: Schema.brand<Schema.Literals<readonly ["en", "id", "de"]>, "@NakafaAI/AksaraArtifactLocale">;
|
|
81
83
|
readonly questionContentKey: Schema.brand<Schema.String, "@NakafaAI/AksaraContentKey">;
|
|
82
84
|
readonly questionOrder: Schema.Finite;
|
|
@@ -104,6 +106,11 @@ export declare const TryoutPreviewTargetSchema: Schema.Struct<{
|
|
|
104
106
|
readonly countryKey: Schema.String;
|
|
105
107
|
readonly examKey: Schema.String;
|
|
106
108
|
readonly kind: Schema.Literal<"section">;
|
|
109
|
+
readonly marks: Schema.optionalKey<Schema.Struct<{
|
|
110
|
+
readonly blank: Schema.Int;
|
|
111
|
+
readonly correct: Schema.Int;
|
|
112
|
+
readonly wrong: Schema.Int;
|
|
113
|
+
}>>;
|
|
107
114
|
readonly order: Schema.Finite;
|
|
108
115
|
readonly publicPath: Schema.optional<Schema.brand<Schema.String, "@NakafaAI/AksaraPublicPath">>;
|
|
109
116
|
readonly questionCount: Schema.Finite;
|
|
@@ -133,7 +140,7 @@ export declare const TryoutPreviewTargetSchema: Schema.Struct<{
|
|
|
133
140
|
readonly order: Schema.Finite;
|
|
134
141
|
readonly publicPath: Schema.brand<Schema.String, "@NakafaAI/AksaraPublicPath">;
|
|
135
142
|
readonly questionCount: Schema.Finite;
|
|
136
|
-
readonly scoringStrategy: Schema.Literals<readonly ["irt", "raw"]>;
|
|
143
|
+
readonly scoringStrategy: Schema.Literals<readonly ["irt", "penalized", "raw"]>;
|
|
137
144
|
readonly sectionCount: Schema.Finite;
|
|
138
145
|
readonly setKey: Schema.String;
|
|
139
146
|
readonly trackKey: Schema.String;
|
|
@@ -160,7 +167,7 @@ export declare const TryoutPreviewTargetSchema: Schema.Struct<{
|
|
|
160
167
|
readonly sectionCount: Schema.Finite;
|
|
161
168
|
readonly setCount: Schema.Finite;
|
|
162
169
|
readonly trackKey: Schema.String;
|
|
163
|
-
readonly trackKind: Schema.Literals<readonly ["subject", "year"]>;
|
|
170
|
+
readonly trackKind: Schema.Literals<readonly ["institution", "subject", "year"]>;
|
|
164
171
|
readonly visibleSectionCount: Schema.Finite;
|
|
165
172
|
}>;
|
|
166
173
|
}>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Effect, Schema, Stream } from "effect";
|
|
2
2
|
import type { ActiveAppLocaleList } from "#contracts/locale";
|
|
3
|
+
import { ProgramRowHashError } from "#contracts/program/snapshot/hash";
|
|
3
4
|
import { type ProgramSnapshotRow } from "#contracts/program/snapshot/row";
|
|
4
|
-
import { ProgramRowHashError } from "#contracts/program/snapshot/row-hash";
|
|
5
5
|
import type { ProgramCounts } from "#contracts/program/snapshot/spec";
|
|
6
6
|
declare const ProgramDigestError_base: Schema.Class<ProgramDigestError, Schema.TaggedStruct<"ProgramDigestError", {
|
|
7
7
|
readonly code: Schema.Literals<readonly ["count", "integrity", "key", "order", "parent", "program", "route", "root", "slug"]>;
|
|
@@ -2,8 +2,8 @@ import { createHash } from "node:crypto";
|
|
|
2
2
|
import { Effect, Schema, Stream } from "effect";
|
|
3
3
|
import { Sha256HashSchema } from "#contracts/ids";
|
|
4
4
|
import { curriculumNamespace, } from "#contracts/program/curriculum";
|
|
5
|
+
import { ProgramRowHashError, verifyProgramSnapshotRowHash, } from "#contracts/program/snapshot/hash";
|
|
5
6
|
import { canonicalizeProgramSnapshotRow, } from "#contracts/program/snapshot/row";
|
|
6
|
-
import { ProgramRowHashError, verifyProgramSnapshotRowHash, } from "#contracts/program/snapshot/row-hash";
|
|
7
7
|
import { compareCodeUnits } from "#contracts/text/order";
|
|
8
8
|
const DIGEST_DOMAIN = "nakafa.aksara.program-rows";
|
|
9
9
|
/** An aggregate program stream is incomplete, duplicated, or tampered. */
|
|
@@ -1,9 +1,16 @@
|
|
|
1
1
|
import { Effect, Schema } from "effect";
|
|
2
|
+
import { type ProgramSnapshotRow } from "#contracts/program/snapshot/row";
|
|
2
3
|
import { type ProgramSnapshot, type ProgramSnapshotFacts } from "#contracts/program/snapshot/spec";
|
|
3
4
|
declare const ProgramSnapshotHashError_base: Schema.Class<ProgramSnapshotHashError, Schema.TaggedStruct<"ProgramSnapshotHashError", {}>, import("effect/Cause").YieldableError>;
|
|
4
5
|
/** Node could not compute a deterministic program snapshot identity. */
|
|
5
6
|
export declare class ProgramSnapshotHashError extends ProgramSnapshotHashError_base {
|
|
6
7
|
}
|
|
8
|
+
declare const ProgramRowHashError_base: Schema.Class<ProgramRowHashError, Schema.TaggedStruct<"ProgramRowHashError", {
|
|
9
|
+
readonly scope: Schema.Literals<readonly ["digest", "row"]>;
|
|
10
|
+
}>, import("effect/Cause").YieldableError>;
|
|
11
|
+
/** Node could not compute one deterministic program row identity. */
|
|
12
|
+
export declare class ProgramRowHashError extends ProgramRowHashError_base {
|
|
13
|
+
}
|
|
7
14
|
/** Serializes current program facts in stable signed field order. */
|
|
8
15
|
export declare function canonicalizeProgramSnapshot(input: ProgramSnapshotFacts): string;
|
|
9
16
|
/** Creates the content-addressed identity of one complete program snapshot. */
|
|
@@ -28,4 +35,150 @@ export declare const makeProgramSnapshot: (input: {
|
|
|
28
35
|
}, ProgramSnapshotHashError, never>;
|
|
29
36
|
/** Recomputes the content identity of one stored current snapshot. */
|
|
30
37
|
export declare function verifyProgramSnapshotHash(snapshot: ProgramSnapshot): Effect.Effect<string & import("effect/Brand").Brand<"@NakafaAI/AksaraSha256Hash">, ProgramSnapshotHashError, never>;
|
|
38
|
+
/** Creates one authenticated current program record. */
|
|
39
|
+
export declare const makeProgramSnapshotRow: (row: {
|
|
40
|
+
readonly defaultCoverageStatus: "archived" | "available" | "hidden" | "partial" | "planned";
|
|
41
|
+
readonly displayOrder: number;
|
|
42
|
+
readonly iconKey: "advanced" | "assessment" | "certificate" | "course" | "diploma" | "early-years" | "global-education" | "grade-1" | "grade-10" | "grade-11" | "grade-12" | "grade-2" | "grade-3" | "grade-4" | "grade-5" | "grade-6" | "grade-7" | "grade-8" | "grade-9" | "high-school" | "mathematics" | "middle-school" | "primary-school" | "school" | "science" | "standards" | "state";
|
|
43
|
+
readonly key: string & import("effect/Brand").Brand<"@NakafaAI/AksaraLearningProgramKey">;
|
|
44
|
+
readonly kind: "admission-exam" | "assessment" | "custom-program" | "institution-program" | "school-curriculum";
|
|
45
|
+
readonly navigation: {
|
|
46
|
+
readonly levels: readonly ["class" | "course" | "domain" | "lesson" | "phase" | "section" | "set" | "stage" | "subject" | "topic" | "track" | "unit", ...("class" | "course" | "domain" | "lesson" | "phase" | "section" | "set" | "stage" | "subject" | "topic" | "track" | "unit")[]];
|
|
47
|
+
readonly model: "course-unit-lesson" | "curriculum-tree" | "exam-domain-set" | "track-topic";
|
|
48
|
+
};
|
|
49
|
+
readonly provider: {
|
|
50
|
+
readonly homeCountry?: string | undefined;
|
|
51
|
+
readonly kind: "institution" | "learner" | "nakafa" | "official";
|
|
52
|
+
readonly name: string;
|
|
53
|
+
};
|
|
54
|
+
readonly recommendedCountry?: string | undefined;
|
|
55
|
+
readonly sources: readonly [{
|
|
56
|
+
readonly label: string;
|
|
57
|
+
readonly retrievedAt: string;
|
|
58
|
+
readonly reviewAfter?: string | undefined;
|
|
59
|
+
readonly type: "institution-document" | "nakafa-editorial" | "official-blueprint" | "official-policy" | "official-portal";
|
|
60
|
+
readonly url: string;
|
|
61
|
+
}, ...{
|
|
62
|
+
readonly label: string;
|
|
63
|
+
readonly retrievedAt: string;
|
|
64
|
+
readonly reviewAfter?: string | undefined;
|
|
65
|
+
readonly type: "institution-document" | "nakafa-editorial" | "official-blueprint" | "official-policy" | "official-portal";
|
|
66
|
+
readonly url: string;
|
|
67
|
+
}[]];
|
|
68
|
+
readonly translations: readonly [{
|
|
69
|
+
readonly appLocale: ("de" | "en" | "id") & import("effect/Brand").Brand<"@NakafaAI/AksaraAppLocale">;
|
|
70
|
+
readonly publicSlug: string;
|
|
71
|
+
readonly title: string;
|
|
72
|
+
}, ...{
|
|
73
|
+
readonly appLocale: ("de" | "en" | "id") & import("effect/Brand").Brand<"@NakafaAI/AksaraAppLocale">;
|
|
74
|
+
readonly publicSlug: string;
|
|
75
|
+
readonly title: string;
|
|
76
|
+
}[]];
|
|
77
|
+
readonly version: {
|
|
78
|
+
readonly endsAt?: string | undefined;
|
|
79
|
+
readonly label: string;
|
|
80
|
+
readonly startsAt?: string | undefined;
|
|
81
|
+
};
|
|
82
|
+
}) => Effect.Effect<{
|
|
83
|
+
readonly kind: "program";
|
|
84
|
+
readonly row: {
|
|
85
|
+
readonly defaultCoverageStatus: "archived" | "available" | "hidden" | "partial" | "planned";
|
|
86
|
+
readonly displayOrder: number;
|
|
87
|
+
readonly iconKey: "advanced" | "assessment" | "certificate" | "course" | "diploma" | "early-years" | "global-education" | "grade-1" | "grade-10" | "grade-11" | "grade-12" | "grade-2" | "grade-3" | "grade-4" | "grade-5" | "grade-6" | "grade-7" | "grade-8" | "grade-9" | "high-school" | "mathematics" | "middle-school" | "primary-school" | "school" | "science" | "standards" | "state";
|
|
88
|
+
readonly key: string & import("effect/Brand").Brand<"@NakafaAI/AksaraLearningProgramKey">;
|
|
89
|
+
readonly kind: "admission-exam" | "assessment" | "custom-program" | "institution-program" | "school-curriculum";
|
|
90
|
+
readonly navigation: {
|
|
91
|
+
readonly levels: readonly ["class" | "course" | "domain" | "lesson" | "phase" | "section" | "set" | "stage" | "subject" | "topic" | "track" | "unit", ...("class" | "course" | "domain" | "lesson" | "phase" | "section" | "set" | "stage" | "subject" | "topic" | "track" | "unit")[]];
|
|
92
|
+
readonly model: "course-unit-lesson" | "curriculum-tree" | "exam-domain-set" | "track-topic";
|
|
93
|
+
};
|
|
94
|
+
readonly provider: {
|
|
95
|
+
readonly homeCountry?: string | undefined;
|
|
96
|
+
readonly kind: "institution" | "learner" | "nakafa" | "official";
|
|
97
|
+
readonly name: string;
|
|
98
|
+
};
|
|
99
|
+
readonly recommendedCountry?: string | undefined;
|
|
100
|
+
readonly sources: readonly [{
|
|
101
|
+
readonly label: string;
|
|
102
|
+
readonly retrievedAt: string;
|
|
103
|
+
readonly reviewAfter?: string | undefined;
|
|
104
|
+
readonly type: "institution-document" | "nakafa-editorial" | "official-blueprint" | "official-policy" | "official-portal";
|
|
105
|
+
readonly url: string;
|
|
106
|
+
}, ...{
|
|
107
|
+
readonly label: string;
|
|
108
|
+
readonly retrievedAt: string;
|
|
109
|
+
readonly reviewAfter?: string | undefined;
|
|
110
|
+
readonly type: "institution-document" | "nakafa-editorial" | "official-blueprint" | "official-policy" | "official-portal";
|
|
111
|
+
readonly url: string;
|
|
112
|
+
}[]];
|
|
113
|
+
readonly translations: readonly [{
|
|
114
|
+
readonly appLocale: ("de" | "en" | "id") & import("effect/Brand").Brand<"@NakafaAI/AksaraAppLocale">;
|
|
115
|
+
readonly publicSlug: string;
|
|
116
|
+
readonly title: string;
|
|
117
|
+
}, ...{
|
|
118
|
+
readonly appLocale: ("de" | "en" | "id") & import("effect/Brand").Brand<"@NakafaAI/AksaraAppLocale">;
|
|
119
|
+
readonly publicSlug: string;
|
|
120
|
+
readonly title: string;
|
|
121
|
+
}[]];
|
|
122
|
+
readonly version: {
|
|
123
|
+
readonly endsAt?: string | undefined;
|
|
124
|
+
readonly label: string;
|
|
125
|
+
readonly startsAt?: string | undefined;
|
|
126
|
+
};
|
|
127
|
+
};
|
|
128
|
+
readonly rowHash: string & import("effect/Brand").Brand<"@NakafaAI/AksaraSha256Hash">;
|
|
129
|
+
}, ProgramRowHashError, never>;
|
|
130
|
+
/** Creates one authenticated current curriculum record. */
|
|
131
|
+
export declare const makeCurriculumSnapshotRow: (row: {
|
|
132
|
+
readonly appLocale: ("de" | "en" | "id") & import("effect/Brand").Brand<"@NakafaAI/AksaraAppLocale">;
|
|
133
|
+
readonly canonicalPath?: (string & import("effect/Brand").Brand<"@NakafaAI/AksaraPublicPath">) | undefined;
|
|
134
|
+
readonly displayGroupIconKey?: "advanced" | "assessment" | "certificate" | "course" | "diploma" | "early-years" | "global-education" | "grade-1" | "grade-10" | "grade-11" | "grade-12" | "grade-2" | "grade-3" | "grade-4" | "grade-5" | "grade-6" | "grade-7" | "grade-8" | "grade-9" | "high-school" | "mathematics" | "middle-school" | "primary-school" | "school" | "science" | "standards" | "state" | undefined;
|
|
135
|
+
readonly displayGroupTitle?: string | undefined;
|
|
136
|
+
readonly iconKey: "advanced" | "assessment" | "certificate" | "course" | "diploma" | "early-years" | "global-education" | "grade-1" | "grade-10" | "grade-11" | "grade-12" | "grade-2" | "grade-3" | "grade-4" | "grade-5" | "grade-6" | "grade-7" | "grade-8" | "grade-9" | "high-school" | "mathematics" | "middle-school" | "primary-school" | "school" | "science" | "standards" | "state";
|
|
137
|
+
readonly kind: "curriculum-context";
|
|
138
|
+
readonly level: "class" | "course" | "domain" | "lesson" | "phase" | "section" | "set" | "stage" | "subject" | "topic" | "track" | "unit";
|
|
139
|
+
readonly materialCardDescription?: string | undefined;
|
|
140
|
+
readonly materialCardTitle?: string | undefined;
|
|
141
|
+
readonly materialContextNodeKey?: (string & import("effect/Brand").Brand<"@NakafaAI/AksaraCurriculumNodeKey">) | undefined;
|
|
142
|
+
readonly materialContextParentPath?: (string & import("effect/Brand").Brand<"@NakafaAI/AksaraPublicPath">) | undefined;
|
|
143
|
+
readonly materialContextPublicPath?: (string & import("effect/Brand").Brand<"@NakafaAI/AksaraPublicPath">) | undefined;
|
|
144
|
+
readonly materialDomain?: (string & import("effect/Brand").Brand<"@NakafaAI/AksaraMaterialDomain">) | undefined;
|
|
145
|
+
readonly materialKey?: (string & import("effect/Brand").Brand<"@NakafaAI/AksaraMaterialKey">) | undefined;
|
|
146
|
+
readonly nodeKey: string;
|
|
147
|
+
readonly order: number;
|
|
148
|
+
readonly parentPath?: (string & import("effect/Brand").Brand<"@NakafaAI/AksaraPublicPath">) | undefined;
|
|
149
|
+
readonly programKey: string & import("effect/Brand").Brand<"@NakafaAI/AksaraLearningProgramKey">;
|
|
150
|
+
readonly publicPath: string & import("effect/Brand").Brand<"@NakafaAI/AksaraPublicPath">;
|
|
151
|
+
readonly sitemap: boolean;
|
|
152
|
+
readonly sourcePath: string & import("effect/Brand").Brand<"@NakafaAI/AksaraCorpusSourcePath">;
|
|
153
|
+
readonly title: string;
|
|
154
|
+
}) => Effect.Effect<{
|
|
155
|
+
readonly kind: "curriculum";
|
|
156
|
+
readonly row: {
|
|
157
|
+
readonly appLocale: ("de" | "en" | "id") & import("effect/Brand").Brand<"@NakafaAI/AksaraAppLocale">;
|
|
158
|
+
readonly canonicalPath?: (string & import("effect/Brand").Brand<"@NakafaAI/AksaraPublicPath">) | undefined;
|
|
159
|
+
readonly displayGroupIconKey?: "advanced" | "assessment" | "certificate" | "course" | "diploma" | "early-years" | "global-education" | "grade-1" | "grade-10" | "grade-11" | "grade-12" | "grade-2" | "grade-3" | "grade-4" | "grade-5" | "grade-6" | "grade-7" | "grade-8" | "grade-9" | "high-school" | "mathematics" | "middle-school" | "primary-school" | "school" | "science" | "standards" | "state" | undefined;
|
|
160
|
+
readonly displayGroupTitle?: string | undefined;
|
|
161
|
+
readonly iconKey: "advanced" | "assessment" | "certificate" | "course" | "diploma" | "early-years" | "global-education" | "grade-1" | "grade-10" | "grade-11" | "grade-12" | "grade-2" | "grade-3" | "grade-4" | "grade-5" | "grade-6" | "grade-7" | "grade-8" | "grade-9" | "high-school" | "mathematics" | "middle-school" | "primary-school" | "school" | "science" | "standards" | "state";
|
|
162
|
+
readonly kind: "curriculum-context";
|
|
163
|
+
readonly level: "class" | "course" | "domain" | "lesson" | "phase" | "section" | "set" | "stage" | "subject" | "topic" | "track" | "unit";
|
|
164
|
+
readonly materialCardDescription?: string | undefined;
|
|
165
|
+
readonly materialCardTitle?: string | undefined;
|
|
166
|
+
readonly materialContextNodeKey?: (string & import("effect/Brand").Brand<"@NakafaAI/AksaraCurriculumNodeKey">) | undefined;
|
|
167
|
+
readonly materialContextParentPath?: (string & import("effect/Brand").Brand<"@NakafaAI/AksaraPublicPath">) | undefined;
|
|
168
|
+
readonly materialContextPublicPath?: (string & import("effect/Brand").Brand<"@NakafaAI/AksaraPublicPath">) | undefined;
|
|
169
|
+
readonly materialDomain?: (string & import("effect/Brand").Brand<"@NakafaAI/AksaraMaterialDomain">) | undefined;
|
|
170
|
+
readonly materialKey?: (string & import("effect/Brand").Brand<"@NakafaAI/AksaraMaterialKey">) | undefined;
|
|
171
|
+
readonly nodeKey: string;
|
|
172
|
+
readonly order: number;
|
|
173
|
+
readonly parentPath?: (string & import("effect/Brand").Brand<"@NakafaAI/AksaraPublicPath">) | undefined;
|
|
174
|
+
readonly programKey: string & import("effect/Brand").Brand<"@NakafaAI/AksaraLearningProgramKey">;
|
|
175
|
+
readonly publicPath: string & import("effect/Brand").Brand<"@NakafaAI/AksaraPublicPath">;
|
|
176
|
+
readonly sitemap: boolean;
|
|
177
|
+
readonly sourcePath: string & import("effect/Brand").Brand<"@NakafaAI/AksaraCorpusSourcePath">;
|
|
178
|
+
readonly title: string;
|
|
179
|
+
};
|
|
180
|
+
readonly rowHash: string & import("effect/Brand").Brand<"@NakafaAI/AksaraSha256Hash">;
|
|
181
|
+
}, ProgramRowHashError, never>;
|
|
182
|
+
/** Recomputes one current row identity for streamed integrity checks. */
|
|
183
|
+
export declare function verifyProgramSnapshotRowHash(record: ProgramSnapshotRow): Effect.Effect<string & import("effect/Brand").Brand<"@NakafaAI/AksaraSha256Hash">, ProgramRowHashError, never>;
|
|
31
184
|
export {};
|
|
@@ -1,11 +1,16 @@
|
|
|
1
1
|
import { createHash } from "node:crypto";
|
|
2
2
|
import { Effect, Schema } from "effect";
|
|
3
3
|
import { Sha256HashSchema } from "#contracts/ids";
|
|
4
|
+
import { CurriculumRouteRecordSchema, canonicalizeProgramSnapshotRow, LearningProgramRecordSchema, } from "#contracts/program/snapshot/row";
|
|
4
5
|
import { PROGRAM_SNAPSHOT_FORMAT, ProgramSnapshotSchema, } from "#contracts/program/snapshot/spec";
|
|
5
6
|
const SNAPSHOT_DOMAIN = "nakafa.aksara.localized-program-snapshot";
|
|
7
|
+
const ROW_DOMAIN = "nakafa.aksara.program-row";
|
|
6
8
|
/** Node could not compute a deterministic program snapshot identity. */
|
|
7
9
|
export class ProgramSnapshotHashError extends Schema.TaggedError()("ProgramSnapshotHashError", {}) {
|
|
8
10
|
}
|
|
11
|
+
/** Node could not compute one deterministic program row identity. */
|
|
12
|
+
export class ProgramRowHashError extends Schema.TaggedError()("ProgramRowHashError", { scope: Schema.Literals(["digest", "row"]) }) {
|
|
13
|
+
}
|
|
9
14
|
/** Serializes current program facts in stable signed field order. */
|
|
10
15
|
export function canonicalizeProgramSnapshot(input) {
|
|
11
16
|
return JSON.stringify({
|
|
@@ -38,3 +43,29 @@ export function verifyProgramSnapshotHash(snapshot) {
|
|
|
38
43
|
const { format: _format, snapshotId: _snapshotId, ...facts } = snapshot;
|
|
39
44
|
return makeProgramSnapshot(facts).pipe(Effect.map((value) => value.snapshotId));
|
|
40
45
|
}
|
|
46
|
+
/** Hashes one current program or curriculum row. */
|
|
47
|
+
function hashProgramRow(record) {
|
|
48
|
+
return Effect.try({
|
|
49
|
+
catch: () => new ProgramRowHashError({ scope: "row" }),
|
|
50
|
+
try: () => Sha256HashSchema.make(`sha256:${createHash("sha256")
|
|
51
|
+
.update(`${ROW_DOMAIN}\n${canonicalizeProgramSnapshotRow(record)}`)
|
|
52
|
+
.digest("hex")}`),
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
/** Creates one authenticated current program record. */
|
|
56
|
+
export const makeProgramSnapshotRow = Effect.fn("AksaraContracts.makeProgramSnapshotRow")(function* (row) {
|
|
57
|
+
const input = { kind: "program", row };
|
|
58
|
+
const rowHash = yield* hashProgramRow(input);
|
|
59
|
+
return LearningProgramRecordSchema.make({ ...input, rowHash });
|
|
60
|
+
});
|
|
61
|
+
/** Creates one authenticated current curriculum record. */
|
|
62
|
+
export const makeCurriculumSnapshotRow = Effect.fn("AksaraContracts.makeCurriculumSnapshotRow")(function* (row) {
|
|
63
|
+
const input = { kind: "curriculum", row };
|
|
64
|
+
const rowHash = yield* hashProgramRow(input);
|
|
65
|
+
return CurriculumRouteRecordSchema.make({ ...input, rowHash });
|
|
66
|
+
});
|
|
67
|
+
/** Recomputes one current row identity for streamed integrity checks. */
|
|
68
|
+
export function verifyProgramSnapshotRowHash(record) {
|
|
69
|
+
const { rowHash: _rowHash, ...input } = record;
|
|
70
|
+
return hashProgramRow(input);
|
|
71
|
+
}
|
|
@@ -27,7 +27,11 @@ export declare function finalizeProjectionDigest(releaseId: typeof ReleaseIdSche
|
|
|
27
27
|
/** Digests a projection stream without retaining its content bodies. */
|
|
28
28
|
export declare const digestProjections: <E, R>(releaseId: string & import("effect/Brand").Brand<"@NakafaAI/AksaraReleaseId">, projections: Stream.Stream<{
|
|
29
29
|
readonly appLocale: ("de" | "en" | "id") & import("effect/Brand").Brand<"@NakafaAI/AksaraAppLocale">;
|
|
30
|
+
readonly articleRouteSlug: string & import("effect/Brand").Brand<"@NakafaAI/AksaraArticleRouteSlug">;
|
|
31
|
+
readonly articleSlug: string & import("effect/Brand").Brand<"@NakafaAI/AksaraArticleSlug">;
|
|
30
32
|
readonly artifactLocale: ("de" | "en" | "id") & import("effect/Brand").Brand<"@NakafaAI/AksaraArtifactLocale">;
|
|
33
|
+
readonly category: string & import("effect/Brand").Brand<"@NakafaAI/AksaraArticleCategory">;
|
|
34
|
+
readonly categoryRouteSlug: string & import("effect/Brand").Brand<"@NakafaAI/AksaraArticleRouteSlug">;
|
|
31
35
|
readonly contentKey: string & import("effect/Brand").Brand<"@NakafaAI/AksaraContentKey">;
|
|
32
36
|
readonly graph: {
|
|
33
37
|
readonly alignmentId: string;
|
|
@@ -36,11 +40,9 @@ export declare const digestProjections: <E, R>(releaseId: string & import("effec
|
|
|
36
40
|
readonly learningObjectId: string;
|
|
37
41
|
readonly lensId: string;
|
|
38
42
|
};
|
|
39
|
-
readonly materialKey: string & import("effect/Brand").Brand<"@NakafaAI/AksaraMaterialKey">;
|
|
40
|
-
readonly order: number;
|
|
41
43
|
readonly publicPath: string & import("effect/Brand").Brand<"@NakafaAI/AksaraPublicPath">;
|
|
42
|
-
readonly
|
|
43
|
-
readonly kind: "
|
|
44
|
+
readonly categoryTitle: string;
|
|
45
|
+
readonly kind: "article";
|
|
44
46
|
readonly metadata: {
|
|
45
47
|
readonly dateModified?: string;
|
|
46
48
|
readonly datePublished: string;
|
|
@@ -48,19 +50,23 @@ export declare const digestProjections: <E, R>(releaseId: string & import("effec
|
|
|
48
50
|
readonly name: string;
|
|
49
51
|
}[];
|
|
50
52
|
readonly description?: string | undefined;
|
|
51
|
-
readonly subject?: string | undefined;
|
|
52
53
|
readonly title: string;
|
|
53
54
|
};
|
|
55
|
+
readonly official: boolean;
|
|
54
56
|
readonly parentPath: string & import("effect/Brand").Brand<"@NakafaAI/AksaraPublicPath">;
|
|
57
|
+
readonly references: readonly {
|
|
58
|
+
readonly authors: string;
|
|
59
|
+
readonly citation?: string | undefined;
|
|
60
|
+
readonly details?: string | undefined;
|
|
61
|
+
readonly publication?: string | undefined;
|
|
62
|
+
readonly title: string;
|
|
63
|
+
readonly url?: string | undefined;
|
|
64
|
+
readonly year: number;
|
|
65
|
+
}[];
|
|
55
66
|
readonly sitemap: true;
|
|
56
|
-
readonly topicTitle: string;
|
|
57
67
|
} | {
|
|
58
68
|
readonly appLocale: ("de" | "en" | "id") & import("effect/Brand").Brand<"@NakafaAI/AksaraAppLocale">;
|
|
59
|
-
readonly articleRouteSlug: string & import("effect/Brand").Brand<"@NakafaAI/AksaraArticleRouteSlug">;
|
|
60
|
-
readonly articleSlug: string & import("effect/Brand").Brand<"@NakafaAI/AksaraArticleSlug">;
|
|
61
69
|
readonly artifactLocale: ("de" | "en" | "id") & import("effect/Brand").Brand<"@NakafaAI/AksaraArtifactLocale">;
|
|
62
|
-
readonly category: string & import("effect/Brand").Brand<"@NakafaAI/AksaraArticleCategory">;
|
|
63
|
-
readonly categoryRouteSlug: string & import("effect/Brand").Brand<"@NakafaAI/AksaraArticleRouteSlug">;
|
|
64
70
|
readonly contentKey: string & import("effect/Brand").Brand<"@NakafaAI/AksaraContentKey">;
|
|
65
71
|
readonly graph: {
|
|
66
72
|
readonly alignmentId: string;
|
|
@@ -69,9 +75,11 @@ export declare const digestProjections: <E, R>(releaseId: string & import("effec
|
|
|
69
75
|
readonly learningObjectId: string;
|
|
70
76
|
readonly lensId: string;
|
|
71
77
|
};
|
|
78
|
+
readonly materialKey: string & import("effect/Brand").Brand<"@NakafaAI/AksaraMaterialKey">;
|
|
79
|
+
readonly order: number;
|
|
72
80
|
readonly publicPath: string & import("effect/Brand").Brand<"@NakafaAI/AksaraPublicPath">;
|
|
73
|
-
readonly
|
|
74
|
-
readonly kind: "
|
|
81
|
+
readonly sectionKey: string & import("effect/Brand").Brand<"@NakafaAI/AksaraMaterialSection">;
|
|
82
|
+
readonly kind: "subject-lesson";
|
|
75
83
|
readonly metadata: {
|
|
76
84
|
readonly dateModified?: string;
|
|
77
85
|
readonly datePublished: string;
|
|
@@ -79,20 +87,13 @@ export declare const digestProjections: <E, R>(releaseId: string & import("effec
|
|
|
79
87
|
readonly name: string;
|
|
80
88
|
}[];
|
|
81
89
|
readonly description?: string | undefined;
|
|
90
|
+
readonly searchTitle?: string;
|
|
91
|
+
readonly subject?: string | undefined;
|
|
82
92
|
readonly title: string;
|
|
83
93
|
};
|
|
84
|
-
readonly official: boolean;
|
|
85
94
|
readonly parentPath: string & import("effect/Brand").Brand<"@NakafaAI/AksaraPublicPath">;
|
|
86
|
-
readonly references: readonly {
|
|
87
|
-
readonly authors: string;
|
|
88
|
-
readonly citation?: string | undefined;
|
|
89
|
-
readonly details?: string | undefined;
|
|
90
|
-
readonly publication?: string | undefined;
|
|
91
|
-
readonly title: string;
|
|
92
|
-
readonly url?: string | undefined;
|
|
93
|
-
readonly year: number;
|
|
94
|
-
}[];
|
|
95
95
|
readonly sitemap: true;
|
|
96
|
+
readonly topicTitle: string;
|
|
96
97
|
} | {
|
|
97
98
|
readonly appLocale: ("de" | "en" | "id") & import("effect/Brand").Brand<"@NakafaAI/AksaraAppLocale">;
|
|
98
99
|
readonly artifactLocale: ("de" | "en" | "id") & import("effect/Brand").Brand<"@NakafaAI/AksaraArtifactLocale">;
|
|
@@ -160,6 +161,57 @@ export declare const digestProjections: <E, R>(releaseId: string & import("effec
|
|
|
160
161
|
readonly order: number;
|
|
161
162
|
readonly statementKey: string;
|
|
162
163
|
}[];
|
|
164
|
+
} | {
|
|
165
|
+
readonly criteria: readonly {
|
|
166
|
+
readonly criterionKey: string;
|
|
167
|
+
readonly finalAnswer?: {
|
|
168
|
+
readonly acceptsFractions: boolean;
|
|
169
|
+
readonly kind: "number";
|
|
170
|
+
readonly tolerance?: {
|
|
171
|
+
readonly kind: "absolute" | "relative";
|
|
172
|
+
readonly value: string;
|
|
173
|
+
};
|
|
174
|
+
readonly value: string;
|
|
175
|
+
} | {
|
|
176
|
+
readonly acceptedAnswers: readonly [string, ...string[]];
|
|
177
|
+
readonly collapseWhitespace: boolean;
|
|
178
|
+
readonly ignoreCase: boolean;
|
|
179
|
+
readonly kind: "text";
|
|
180
|
+
};
|
|
181
|
+
readonly order: number;
|
|
182
|
+
readonly label: {
|
|
183
|
+
readonly de: string;
|
|
184
|
+
readonly en: string;
|
|
185
|
+
readonly id: string;
|
|
186
|
+
};
|
|
187
|
+
readonly levels: readonly {
|
|
188
|
+
readonly levelKey: string;
|
|
189
|
+
readonly order: number;
|
|
190
|
+
readonly points: number;
|
|
191
|
+
readonly label: {
|
|
192
|
+
readonly de: string;
|
|
193
|
+
readonly en: string;
|
|
194
|
+
readonly id: string;
|
|
195
|
+
};
|
|
196
|
+
}[];
|
|
197
|
+
}[];
|
|
198
|
+
readonly kind: "rubric";
|
|
199
|
+
} | {
|
|
200
|
+
readonly key: {
|
|
201
|
+
readonly acceptsFractions: boolean;
|
|
202
|
+
readonly kind: "number";
|
|
203
|
+
readonly tolerance?: {
|
|
204
|
+
readonly kind: "absolute" | "relative";
|
|
205
|
+
readonly value: string;
|
|
206
|
+
};
|
|
207
|
+
readonly value: string;
|
|
208
|
+
} | {
|
|
209
|
+
readonly acceptedAnswers: readonly [string, ...string[]];
|
|
210
|
+
readonly collapseWhitespace: boolean;
|
|
211
|
+
readonly ignoreCase: boolean;
|
|
212
|
+
readonly kind: "text";
|
|
213
|
+
};
|
|
214
|
+
readonly kind: "short-answer";
|
|
163
215
|
};
|
|
164
216
|
} | {
|
|
165
217
|
readonly artifactLocale: ("de" | "en" | "id") & import("effect/Brand").Brand<"@NakafaAI/AksaraArtifactLocale">;
|
|
@@ -11,6 +11,13 @@ export type MaterialKey = typeof MaterialKeySchema.Type;
|
|
|
11
11
|
/** Stable lesson-section identity preserved across localized public routes. */
|
|
12
12
|
export declare const MaterialSectionSchema: Schema.brand<Schema.String, "@NakafaAI/AksaraMaterialSection">;
|
|
13
13
|
export type MaterialSection = typeof MaterialSectionSchema.Type;
|
|
14
|
+
/**
|
|
15
|
+
* Readable HTML title for search results that names the lesson concept in the
|
|
16
|
+
* words its locale's learners search for. It is one trimmed line of single
|
|
17
|
+
* spaces and at most 70 characters, while `title` stays the short navigation
|
|
18
|
+
* name.
|
|
19
|
+
*/
|
|
20
|
+
export declare const MaterialSearchTitleSchema: Schema.Trimmed;
|
|
14
21
|
/** Exact metadata contract required from newly authored material sources. */
|
|
15
22
|
export declare const MaterialMetadataSchema: Schema.Struct<{
|
|
16
23
|
readonly dateModified: Schema.optionalKey<Schema.String>;
|
|
@@ -19,6 +26,7 @@ export declare const MaterialMetadataSchema: Schema.Struct<{
|
|
|
19
26
|
readonly name: Schema.String;
|
|
20
27
|
}>>;
|
|
21
28
|
readonly description: Schema.optional<Schema.String>;
|
|
29
|
+
readonly searchTitle: Schema.optionalKey<Schema.Trimmed>;
|
|
22
30
|
readonly subject: Schema.optional<Schema.String>;
|
|
23
31
|
readonly title: Schema.String;
|
|
24
32
|
}>;
|
|
@@ -66,6 +74,7 @@ export declare const MaterialLessonProjectionSchema: Schema.Struct<{
|
|
|
66
74
|
readonly name: Schema.String;
|
|
67
75
|
}>>;
|
|
68
76
|
readonly description: Schema.optional<Schema.String>;
|
|
77
|
+
readonly searchTitle: Schema.optionalKey<Schema.Trimmed>;
|
|
69
78
|
readonly subject: Schema.optional<Schema.String>;
|
|
70
79
|
readonly title: Schema.String;
|
|
71
80
|
}>;
|
|
@@ -98,6 +107,7 @@ export declare function makeMaterialLessonProjection(route: MaterialLessonRoute,
|
|
|
98
107
|
readonly name: string;
|
|
99
108
|
}[];
|
|
100
109
|
readonly description?: string | undefined;
|
|
110
|
+
readonly searchTitle?: string;
|
|
101
111
|
readonly subject?: string | undefined;
|
|
102
112
|
readonly title: string;
|
|
103
113
|
};
|
|
@@ -6,6 +6,8 @@ import { ContentKeySchema, PublicPathSchema } from "#contracts/ids";
|
|
|
6
6
|
import { AppLocaleSchema, ArtifactLocaleSchema, } from "#contracts/locale";
|
|
7
7
|
const MATERIAL_KEY_PATTERN = /^lesson\.[a-z0-9]+(?:-[a-z0-9]+)*\.[a-z0-9]+(?:-[a-z0-9]+)*$/u;
|
|
8
8
|
const SECTION_KEY_PATTERN = /^[a-z0-9]+(?:-[a-z0-9]+)*$/;
|
|
9
|
+
const SEARCH_TITLE_MAX_LENGTH = 70;
|
|
10
|
+
const SINGLE_SPACED_LINE_PATTERN = /^[^\p{Cc}\p{Cf}\s]+(?: [^\p{Cc}\p{Cf}\s]+)*$/u;
|
|
9
11
|
const MaterialPublicPathSchema = PublicPathSchema.pipe(Schema.check(Schema.makeFilter((value) => value.includes("/"), {
|
|
10
12
|
message: "Expected a material lesson path with a parent route.",
|
|
11
13
|
})));
|
|
@@ -33,9 +35,19 @@ export const MaterialKeySchema = Schema.String.pipe(Schema.check(Schema.isPatter
|
|
|
33
35
|
})), Schema.brand("@NakafaAI/AksaraMaterialKey"));
|
|
34
36
|
/** Stable lesson-section identity preserved across localized public routes. */
|
|
35
37
|
export const MaterialSectionSchema = Schema.String.pipe(Schema.check(Schema.isPattern(SECTION_KEY_PATTERN)), Schema.brand("@NakafaAI/AksaraMaterialSection"));
|
|
38
|
+
/**
|
|
39
|
+
* Readable HTML title for search results that names the lesson concept in the
|
|
40
|
+
* words its locale's learners search for. It is one trimmed line of single
|
|
41
|
+
* spaces and at most 70 characters, while `title` stays the short navigation
|
|
42
|
+
* name.
|
|
43
|
+
*/
|
|
44
|
+
export const MaterialSearchTitleSchema = Schema.Trimmed.check(Schema.isNonEmpty(), Schema.isMaxLength(SEARCH_TITLE_MAX_LENGTH), Schema.isPattern(SINGLE_SPACED_LINE_PATTERN, {
|
|
45
|
+
message: "Expected one line of words separated by single spaces.",
|
|
46
|
+
}));
|
|
36
47
|
const MaterialMetadataFields = {
|
|
37
48
|
authors: Schema.Array(ContentAuthorSchema),
|
|
38
49
|
description: Schema.optional(Schema.String),
|
|
50
|
+
searchTitle: Schema.optionalKey(MaterialSearchTitleSchema),
|
|
39
51
|
subject: Schema.optional(Schema.String),
|
|
40
52
|
title: Schema.String,
|
|
41
53
|
};
|
|
@@ -137,6 +149,9 @@ export function canonicalizeMaterialProjection(projection) {
|
|
|
137
149
|
...(projection.metadata.description === undefined
|
|
138
150
|
? {}
|
|
139
151
|
: { description: projection.metadata.description }),
|
|
152
|
+
...(projection.metadata.searchTitle === undefined
|
|
153
|
+
? {}
|
|
154
|
+
: { searchTitle: projection.metadata.searchTitle }),
|
|
140
155
|
...(projection.metadata.subject === undefined
|
|
141
156
|
? {}
|
|
142
157
|
: { subject: projection.metadata.subject }),
|