@nakafa/aksara-contracts 1.0.1 → 3.0.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 +10 -27
- package/dist/artifact/integrity.d.ts +3 -3
- package/dist/artifact/integrity.js +2 -2
- package/dist/artifact/source.d.ts +2 -2
- package/dist/artifact/source.js +2 -8
- package/dist/artifact/spec.d.ts +0 -16
- package/dist/artifact/spec.js +0 -6
- package/dist/artifact/verify.d.ts +1 -1
- package/dist/{question → assessment}/answer.d.ts +14 -58
- package/dist/{question → assessment}/answer.js +13 -60
- package/dist/assessment/catalog.d.ts +235 -0
- package/dist/assessment/catalog.js +115 -0
- package/dist/assessment/chart.d.ts +62 -0
- package/dist/assessment/chart.js +64 -0
- package/dist/assessment/closure.d.ts +28 -0
- package/dist/assessment/closure.js +164 -0
- package/dist/assessment/explanation.d.ts +13 -8
- package/dist/assessment/explanation.js +14 -8
- package/dist/assessment/figure.d.ts +140 -1
- package/dist/assessment/figure.js +9 -2
- package/dist/assessment/hash.d.ts +352 -212
- package/dist/assessment/hash.js +14 -0
- package/dist/assessment/inline.d.ts +3 -1
- package/dist/assessment/inline.js +20 -5
- package/dist/assessment/item.d.ts +8 -4
- package/dist/assessment/item.js +6 -2
- package/dist/assessment/key.js +6 -6
- package/dist/assessment/paper.d.ts +74 -74
- package/dist/assessment/snapshot.d.ts +3778 -0
- package/dist/assessment/snapshot.js +192 -0
- package/dist/cache/content.d.ts +4 -4
- package/dist/canonical.d.ts +6 -0
- package/dist/canonical.js +8 -1
- package/dist/content.d.ts +1 -1
- package/dist/content.js +0 -1
- package/dist/delivery.d.ts +0 -3
- package/dist/delivery.js +0 -5
- package/dist/hash/digest.d.ts +7 -7
- package/dist/hash/digest.js +9 -30
- package/dist/hash/stream.d.ts +1 -1
- package/dist/hash/text.d.ts +3 -12
- package/dist/hash/text.js +3 -6
- package/dist/ids.js +8 -8
- package/dist/preview/artifact.d.ts +1 -120
- package/dist/preview/auth.d.ts +1 -1
- package/dist/preview/auth.js +29 -25
- package/dist/preview/document.d.ts +0 -586
- package/dist/preview/document.js +1 -47
- package/dist/preview/spec.d.ts +6 -1984
- package/dist/preview/spec.js +7 -47
- package/dist/preview/target.d.ts +0 -173
- package/dist/preview/target.js +1 -70
- package/dist/program/snapshot/digest.d.ts +1 -2
- package/dist/program/snapshot/digest.js +2 -4
- package/dist/program/snapshot/hash.d.ts +6 -21
- package/dist/program/snapshot/hash.js +3 -9
- package/dist/projection/digest.d.ts +7 -143
- package/dist/projection/digest.js +7 -13
- package/dist/projection/hash.d.ts +2 -138
- package/dist/projection/hash.js +2 -5
- package/dist/projection/material.js +1 -1
- package/dist/projection/spec.d.ts +6 -211
- package/dist/projection/spec.js +4 -18
- package/dist/projection/verify.d.ts +1 -128
- package/dist/projection/verify.js +1 -4
- package/dist/quran/provenance.d.ts +2 -8
- package/dist/quran/provenance.js +1 -4
- package/dist/quran/snapshot/digest.d.ts +1 -2
- package/dist/quran/snapshot/digest.js +2 -2
- package/dist/quran/snapshot/hash.d.ts +3 -10
- package/dist/quran/snapshot/hash.js +2 -5
- package/dist/quran/snapshot/row/hash.d.ts +3 -12
- package/dist/quran/snapshot/row/hash.js +2 -5
- package/dist/release/canonical.d.ts +2 -2
- package/dist/release/current/evidence.d.ts +24 -24
- package/dist/release/current/state.d.ts +28 -56
- package/dist/release/current/state.js +1 -6
- package/dist/release/digest.d.ts +9 -18
- package/dist/release/digest.js +7 -13
- package/dist/release/hash.d.ts +7 -16
- package/dist/release/hash.js +2 -6
- package/dist/release/head.d.ts +10 -57
- package/dist/release/head.js +3 -14
- package/dist/release/identity.d.ts +3 -3
- package/dist/release/items.d.ts +3 -3
- package/dist/release/items.js +1 -1
- package/dist/release/lifecycle.d.ts +18 -18
- package/dist/release/policy.d.ts +3 -4
- package/dist/release/policy.js +2 -11
- package/dist/release/result/digest.d.ts +11 -31
- package/dist/release/result/digest.js +5 -11
- package/dist/release/rollback/digest.d.ts +11 -35
- package/dist/release/rollback/digest.js +7 -13
- package/dist/release/rollback/spec.d.ts +30 -792
- package/dist/release/rollback/spec.js +1 -4
- package/dist/release/route/digest.d.ts +7 -16
- package/dist/release/route/digest.js +7 -13
- package/dist/release/route/verify.d.ts +1 -1
- package/dist/release/route/verify.js +1 -1
- package/dist/release/snapshot/data.d.ts +599 -249
- package/dist/release/snapshot/data.js +11 -28
- package/dist/release/snapshot/evidence/assessment.d.ts +26 -0
- package/dist/release/snapshot/evidence/assessment.js +44 -0
- package/dist/release/snapshot/evidence/program.d.ts +1 -1
- package/dist/release/snapshot/evidence/quran.d.ts +1 -1
- package/dist/release/snapshot/evidence/requirement.d.ts +1 -1
- package/dist/release/snapshot/evidence.d.ts +19 -19
- package/dist/release/snapshot/evidence.js +2 -2
- package/dist/release/snapshot/scope.d.ts +5 -5
- package/dist/release/snapshot/scope.js +1 -1
- package/dist/release/snapshot/spec.d.ts +15 -15
- package/dist/release/snapshot/spec.js +8 -8
- package/dist/release/snapshot/verify.d.ts +1278 -268
- package/dist/release/snapshot/verify.js +8 -5
- package/dist/release/spec.d.ts +33 -33
- package/dist/release/verify.d.ts +7 -7
- package/dist/renderer/compatibility.d.ts +1 -1
- package/dist/renderer/component.js +1 -1
- package/dist/renderer/contract.d.ts +0 -8
- package/dist/renderer/contract.js +0 -3
- package/dist/renderer/manifest.d.ts +3 -3
- package/dist/renderer/manifest.js +2 -2
- package/dist/runtime/spec.d.ts +38 -38
- package/dist/runtime/spec.js +4 -5
- package/dist/runtime/verify.d.ts +42 -42
- package/dist/signature/key.d.ts +0 -2
- package/dist/signature/key.js +37 -88
- package/dist/signature/spec.d.ts +5 -5
- package/dist/signature/spec.js +0 -1
- package/dist/signature/verify.js +31 -46
- package/dist/transport/batch.d.ts +6 -244
- package/dist/transport/failure.d.ts +6 -20
- package/dist/transport/failure.js +0 -10
- package/dist/transport/group.d.ts +1969 -1369
- package/dist/transport/group.js +0 -2
- package/dist/transport/request.d.ts +10691 -5086
- package/dist/transport/request.js +0 -3
- package/dist/transport/response.d.ts +219 -1442
- package/dist/transport/response.js +0 -4
- package/dist/transport/snapshot.d.ts +1187 -487
- package/dist/tree.js +1 -1
- package/package.json +188 -296
- package/dist/projection/question.d.ts +0 -1067
- package/dist/projection/question.js +0 -121
- package/dist/question/identity.d.ts +0 -175
- package/dist/question/identity.js +0 -207
- package/dist/question/item.d.ts +0 -450
- package/dist/question/item.js +0 -174
- package/dist/question/label.d.ts +0 -3
- package/dist/question/label.js +0 -3
- package/dist/question/points.d.ts +0 -18
- package/dist/question/points.js +0 -22
- package/dist/question/response.d.ts +0 -289
- package/dist/question/response.js +0 -167
- package/dist/question/rubric.d.ts +0 -234
- package/dist/question/rubric.js +0 -186
- package/dist/release/current/runtime.d.ts +0 -4
- package/dist/release/current/runtime.js +0 -15
- package/dist/release/snapshot/evidence/tryout.d.ts +0 -22
- package/dist/release/snapshot/evidence/tryout.js +0 -91
- package/dist/runtime/protected/limits.d.ts +0 -10
- package/dist/runtime/protected/limits.js +0 -16
- package/dist/runtime/protected/spec.d.ts +0 -310
- package/dist/runtime/protected/spec.js +0 -80
- package/dist/runtime/protected/verify.d.ts +0 -83
- package/dist/runtime/protected/verify.js +0 -70
- package/dist/transport/runtime.d.ts +0 -77
- package/dist/transport/runtime.js +0 -33
- package/dist/tryout/canonical.d.ts +0 -12
- package/dist/tryout/canonical.js +0 -7
- package/dist/tryout/catalog.d.ts +0 -396
- package/dist/tryout/catalog.js +0 -155
- package/dist/tryout/closure/accounting.d.ts +0 -20
- package/dist/tryout/closure/accounting.js +0 -70
- package/dist/tryout/closure/locale.d.ts +0 -14
- package/dist/tryout/closure/locale.js +0 -113
- package/dist/tryout/closure/placement.d.ts +0 -5
- package/dist/tryout/closure/placement.js +0 -32
- package/dist/tryout/digest.d.ts +0 -34
- package/dist/tryout/digest.js +0 -57
- package/dist/tryout/hash/catalog.d.ts +0 -364
- package/dist/tryout/hash/catalog.js +0 -209
- package/dist/tryout/hash/content.d.ts +0 -215
- package/dist/tryout/hash/content.js +0 -75
- package/dist/tryout/hash/placement.d.ts +0 -242
- package/dist/tryout/hash/placement.js +0 -56
- package/dist/tryout/identity.d.ts +0 -12
- package/dist/tryout/identity.js +0 -47
- package/dist/tryout/key.d.ts +0 -4
- package/dist/tryout/key.js +0 -8
- package/dist/tryout/language.d.ts +0 -24
- package/dist/tryout/language.js +0 -30
- package/dist/tryout/placement.d.ts +0 -331
- package/dist/tryout/placement.js +0 -96
- package/dist/tryout/runtime/canonical.d.ts +0 -8
- package/dist/tryout/runtime/canonical.js +0 -34
- package/dist/tryout/runtime/hash.d.ts +0 -34
- package/dist/tryout/runtime/hash.js +0 -13
- package/dist/tryout/runtime/source.d.ts +0 -44
- package/dist/tryout/runtime/source.js +0 -47
- package/dist/tryout/runtime/spec.d.ts +0 -58
- package/dist/tryout/runtime/spec.js +0 -21
- package/dist/tryout/runtime/verify.d.ts +0 -69
- package/dist/tryout/runtime/verify.js +0 -67
- package/dist/tryout/scoring.d.ts +0 -148
- package/dist/tryout/scoring.js +0 -98
- package/dist/tryout/snapshot/canonical.d.ts +0 -7
- package/dist/tryout/snapshot/canonical.js +0 -18
- package/dist/tryout/snapshot/hash.d.ts +0 -49
- package/dist/tryout/snapshot/hash.js +0 -22
- package/dist/tryout/snapshot/spec.d.ts +0 -46
- package/dist/tryout/snapshot/spec.js +0 -30
- package/dist/tryout/spec.d.ts +0 -41
- package/dist/tryout/spec.js +0 -46
|
@@ -1,11 +1,7 @@
|
|
|
1
|
-
import { Effect,
|
|
1
|
+
import { Effect, Stream } from "effect";
|
|
2
2
|
import { DigestStream } from "#contracts/hash/stream";
|
|
3
|
-
import { ReleaseIdSchema } from "#contracts/ids";
|
|
4
3
|
import { canonicalizeContentProjection, } from "#contracts/projection/spec";
|
|
5
4
|
const CONTENT_PROJECTION_DIGEST_DOMAIN = "nakafa.aksara.content-projections";
|
|
6
|
-
/** SHA-256 computation failed before projection integrity was established. */
|
|
7
|
-
export class ProjectionHashError extends Schema.TaggedError()("ProjectionHashError", { releaseId: ReleaseIdSchema }) {
|
|
8
|
-
}
|
|
9
5
|
/** Keeps the digest stream private while exposing only canonical counters. */
|
|
10
6
|
class ProjectionDigestState {
|
|
11
7
|
#stream = new DigestStream();
|
|
@@ -35,16 +31,14 @@ export function updateProjectionDigest(state, projection) {
|
|
|
35
31
|
return state;
|
|
36
32
|
});
|
|
37
33
|
}
|
|
38
|
-
/** Finalizes one projection digest
|
|
39
|
-
export function finalizeProjectionDigest(
|
|
40
|
-
return state
|
|
41
|
-
.digest()
|
|
42
|
-
.pipe(Effect.mapError(() => new ProjectionHashError({ releaseId })));
|
|
34
|
+
/** Finalizes one projection digest. */
|
|
35
|
+
export function finalizeProjectionDigest(state) {
|
|
36
|
+
return state.digest();
|
|
43
37
|
}
|
|
44
|
-
/** Digests a projection stream. Its canonical bytes are held until one
|
|
45
|
-
export const digestProjections = Effect.fn("AksaraContracts.digestProjections")(function* (
|
|
38
|
+
/** Digests a projection stream. Its canonical bytes are held until one digest runs. */
|
|
39
|
+
export const digestProjections = Effect.fn("AksaraContracts.digestProjections")(function* (projections) {
|
|
46
40
|
const initial = yield* createProjectionDigest;
|
|
47
41
|
const state = yield* projections.pipe(Stream.runFoldEffect(() => initial, (current, projection) => updateProjectionDigest(current, projection)));
|
|
48
|
-
const digest = yield* finalizeProjectionDigest(
|
|
42
|
+
const digest = yield* finalizeProjectionDigest(state);
|
|
49
43
|
return { count: state.count, digest };
|
|
50
44
|
});
|
|
@@ -1,12 +1,4 @@
|
|
|
1
|
-
import { 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
|
-
}
|
|
1
|
+
import { Effect } from "effect";
|
|
10
2
|
/** Hashes one canonical projection for authoritative content-head diffing. */
|
|
11
3
|
export declare const hashContentProjection: (projection: {
|
|
12
4
|
readonly appLocale: ("de" | "en" | "id") & import("effect/Brand").Brand<"@NakafaAI/AksaraAppLocale">;
|
|
@@ -92,132 +84,4 @@ export declare const hashContentProjection: (projection: {
|
|
|
92
84
|
};
|
|
93
85
|
readonly sitemap: true;
|
|
94
86
|
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 {};
|
|
87
|
+
}) => Effect.Effect<string & import("effect/Brand").Brand<"@NakafaAI/AksaraSha256Hash">, never, never>;
|
package/dist/projection/hash.js
CHANGED
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
import { Effect
|
|
1
|
+
import { Effect } from "effect";
|
|
2
2
|
import { hashText } from "#contracts/hash/text";
|
|
3
3
|
import { canonicalizeContentProjection, } from "#contracts/projection/spec";
|
|
4
|
-
/** The projection identity could not be computed for one content key. */
|
|
5
|
-
export class ContentProjectionHashError extends Schema.TaggedError()("ContentProjectionHashError", { contentKey: Schema.String }) {
|
|
6
|
-
}
|
|
7
4
|
/** Hashes one canonical projection for authoritative content-head diffing. */
|
|
8
|
-
export const hashContentProjection = Effect.fn("AksaraContracts.hashContentProjection")((projection) => hashText(canonicalizeContentProjection(projection))
|
|
5
|
+
export const hashContentProjection = Effect.fn("AksaraContracts.hashContentProjection")((projection) => hashText(canonicalizeContentProjection(projection)));
|
|
@@ -6,7 +6,7 @@ import { ContentKeySchema, PublicPathSchema } from "#contracts/ids";
|
|
|
6
6
|
import { AppLocaleSchema, ArtifactLocaleSchema, } from "#contracts/locale";
|
|
7
7
|
import { encodeJsonText } from "#contracts/text/json";
|
|
8
8
|
const MATERIAL_KEY_PATTERN = /^lesson\.[a-z0-9]+(?:-[a-z0-9]+)*\.[a-z0-9]+(?:-[a-z0-9]+)*$/u;
|
|
9
|
-
const SECTION_KEY_PATTERN = /^[a-z0-9]+(?:-[a-z0-9]+)
|
|
9
|
+
const SECTION_KEY_PATTERN = /^[a-z0-9]+(?:-[a-z0-9]+)*$/u;
|
|
10
10
|
const SEARCH_TITLE_MAX_LENGTH = 70;
|
|
11
11
|
const SINGLE_SPACED_LINE_PATTERN = /^[^\p{Cc}\p{Cf}\s]+(?: [^\p{Cc}\p{Cf}\s]+)*$/u;
|
|
12
12
|
const MaterialPublicPathSchema = PublicPathSchema.pipe(Schema.check(Schema.makeFilter((value) => value.includes("/"), {
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import { Schema } from "effect";
|
|
2
|
-
/**
|
|
2
|
+
/**
|
|
3
|
+
* Complete projection vocabulary backed by implemented content families. Every
|
|
4
|
+
* projection owns a public route, which Nakafa's path-based runtime serves.
|
|
5
|
+
*/
|
|
3
6
|
export declare const ContentProjectionSchema: Schema.Union<readonly [Schema.Struct<{
|
|
4
7
|
readonly appLocale: Schema.brand<Schema.Literals<readonly ["en", "id", "de"]>, "@NakafaAI/AksaraAppLocale">;
|
|
5
8
|
readonly articleRouteSlug: Schema.brand<Schema.String, "@NakafaAI/AksaraArticleRouteSlug">;
|
|
@@ -84,218 +87,10 @@ export declare const ContentProjectionSchema: Schema.Union<readonly [Schema.Stru
|
|
|
84
87
|
}>;
|
|
85
88
|
readonly sitemap: Schema.Literal<true>;
|
|
86
89
|
readonly sourcePath: Schema.brand<Schema.String, "@NakafaAI/AksaraCorpusSourcePath">;
|
|
87
|
-
}>, Schema.Union<readonly [Schema.Struct<{
|
|
88
|
-
readonly artifactLocale: Schema.brand<Schema.Literals<readonly ["en", "id", "de"]>, "@NakafaAI/AksaraArtifactLocale">;
|
|
89
|
-
readonly contentKey: Schema.brand<Schema.String, "@NakafaAI/AksaraContentKey">;
|
|
90
|
-
readonly peerContentKey: Schema.brand<Schema.String, "@NakafaAI/AksaraContentKey">;
|
|
91
|
-
readonly questionKey: Schema.brand<Schema.String, "@NakafaAI/AksaraQuestionKey">;
|
|
92
|
-
readonly questionNumber: Schema.Finite;
|
|
93
|
-
readonly setKey: Schema.brand<Schema.String, "@NakafaAI/AksaraQuestionSetKey">;
|
|
94
|
-
readonly bodyKind: Schema.Literal<"question">;
|
|
95
|
-
readonly blueprint: Schema.optionalKey<Schema.Struct<{
|
|
96
|
-
readonly cognitiveLevel: Schema.String;
|
|
97
|
-
readonly contentDomain: Schema.String;
|
|
98
|
-
readonly topic: Schema.String;
|
|
99
|
-
}>>;
|
|
100
|
-
readonly kind: Schema.Literal<"question-body">;
|
|
101
|
-
readonly metadata: Schema.Struct<{
|
|
102
|
-
readonly dateModified: Schema.optionalKey<Schema.String>;
|
|
103
|
-
readonly datePublished: Schema.String;
|
|
104
|
-
readonly authors: Schema.$Array<Schema.Struct<{
|
|
105
|
-
readonly name: Schema.String;
|
|
106
|
-
}>>;
|
|
107
|
-
readonly title: Schema.String;
|
|
108
|
-
}>;
|
|
109
|
-
readonly stimulusKey: Schema.optionalKey<Schema.String>;
|
|
110
|
-
readonly response: Schema.Union<readonly [Schema.Struct<{
|
|
111
|
-
readonly categories: Schema.$Array<Schema.Struct<{
|
|
112
|
-
readonly categoryKey: Schema.String;
|
|
113
|
-
readonly label: Schema.String;
|
|
114
|
-
readonly order: Schema.Int;
|
|
115
|
-
}>>;
|
|
116
|
-
readonly kind: Schema.Literal<"category">;
|
|
117
|
-
readonly statements: Schema.$Array<Schema.Struct<{
|
|
118
|
-
readonly correctCategoryKey: Schema.String;
|
|
119
|
-
readonly label: Schema.String;
|
|
120
|
-
readonly order: Schema.Int;
|
|
121
|
-
readonly statementKey: Schema.String;
|
|
122
|
-
}>>;
|
|
123
|
-
}>, Schema.Struct<{
|
|
124
|
-
readonly kind: Schema.Literal<"multiple-choice">;
|
|
125
|
-
readonly options: Schema.$Array<Schema.Struct<{
|
|
126
|
-
readonly isCorrect: Schema.Boolean;
|
|
127
|
-
readonly label: Schema.String;
|
|
128
|
-
readonly optionKey: Schema.String;
|
|
129
|
-
readonly order: Schema.Int;
|
|
130
|
-
}>>;
|
|
131
|
-
}>, Schema.Struct<{
|
|
132
|
-
readonly criteria: Schema.$Array<Schema.Struct<{
|
|
133
|
-
readonly criterionKey: Schema.String;
|
|
134
|
-
readonly finalAnswer: Schema.optionalKey<Schema.Union<readonly [Schema.Struct<{
|
|
135
|
-
readonly acceptsFractions: Schema.Boolean;
|
|
136
|
-
readonly kind: Schema.Literal<"number">;
|
|
137
|
-
readonly tolerance: Schema.optionalKey<Schema.Struct<{
|
|
138
|
-
readonly kind: Schema.Literals<readonly ["absolute", "relative"]>;
|
|
139
|
-
readonly value: Schema.String;
|
|
140
|
-
}>>;
|
|
141
|
-
readonly value: Schema.String;
|
|
142
|
-
}>, Schema.Struct<{
|
|
143
|
-
readonly acceptedAnswers: Schema.NonEmptyArray<Schema.Trimmed>;
|
|
144
|
-
readonly collapseWhitespace: Schema.Boolean;
|
|
145
|
-
readonly ignoreCase: Schema.Boolean;
|
|
146
|
-
readonly kind: Schema.Literal<"text">;
|
|
147
|
-
}>]>>;
|
|
148
|
-
readonly order: Schema.Int;
|
|
149
|
-
readonly label: Schema.$Record<Schema.Literals<readonly ["en", "id", "de"]>, Schema.String>;
|
|
150
|
-
readonly levels: Schema.$Array<Schema.Struct<{
|
|
151
|
-
readonly levelKey: Schema.String;
|
|
152
|
-
readonly order: Schema.Int;
|
|
153
|
-
readonly points: Schema.Int;
|
|
154
|
-
readonly label: Schema.$Record<Schema.Literals<readonly ["en", "id", "de"]>, Schema.String>;
|
|
155
|
-
}>>;
|
|
156
|
-
}>>;
|
|
157
|
-
readonly kind: Schema.Literal<"rubric">;
|
|
158
|
-
}>, Schema.Struct<{
|
|
159
|
-
readonly key: Schema.Union<readonly [Schema.Struct<{
|
|
160
|
-
readonly acceptsFractions: Schema.Boolean;
|
|
161
|
-
readonly kind: Schema.Literal<"number">;
|
|
162
|
-
readonly tolerance: Schema.optionalKey<Schema.Struct<{
|
|
163
|
-
readonly kind: Schema.Literals<readonly ["absolute", "relative"]>;
|
|
164
|
-
readonly value: Schema.String;
|
|
165
|
-
}>>;
|
|
166
|
-
readonly value: Schema.String;
|
|
167
|
-
}>, Schema.Struct<{
|
|
168
|
-
readonly acceptedAnswers: Schema.NonEmptyArray<Schema.Trimmed>;
|
|
169
|
-
readonly collapseWhitespace: Schema.Boolean;
|
|
170
|
-
readonly ignoreCase: Schema.Boolean;
|
|
171
|
-
readonly kind: Schema.Literal<"text">;
|
|
172
|
-
}>]>;
|
|
173
|
-
readonly kind: Schema.Literal<"short-answer">;
|
|
174
|
-
}>, Schema.Struct<{
|
|
175
|
-
readonly kind: Schema.Literal<"single-choice">;
|
|
176
|
-
readonly options: Schema.$Array<Schema.Struct<{
|
|
177
|
-
readonly isCorrect: Schema.Boolean;
|
|
178
|
-
readonly label: Schema.String;
|
|
179
|
-
readonly optionKey: Schema.String;
|
|
180
|
-
readonly order: Schema.Int;
|
|
181
|
-
}>>;
|
|
182
|
-
}>]>;
|
|
183
|
-
}>, Schema.Struct<{
|
|
184
|
-
readonly artifactLocale: Schema.brand<Schema.Literals<readonly ["en", "id", "de"]>, "@NakafaAI/AksaraArtifactLocale">;
|
|
185
|
-
readonly contentKey: Schema.brand<Schema.String, "@NakafaAI/AksaraContentKey">;
|
|
186
|
-
readonly peerContentKey: Schema.brand<Schema.String, "@NakafaAI/AksaraContentKey">;
|
|
187
|
-
readonly questionKey: Schema.brand<Schema.String, "@NakafaAI/AksaraQuestionKey">;
|
|
188
|
-
readonly questionNumber: Schema.Finite;
|
|
189
|
-
readonly setKey: Schema.brand<Schema.String, "@NakafaAI/AksaraQuestionSetKey">;
|
|
190
|
-
readonly bodyKind: Schema.Literal<"answer">;
|
|
191
|
-
readonly blueprint: Schema.optionalKey<Schema.Struct<{
|
|
192
|
-
readonly cognitiveLevel: Schema.String;
|
|
193
|
-
readonly contentDomain: Schema.String;
|
|
194
|
-
readonly topic: Schema.String;
|
|
195
|
-
}>>;
|
|
196
|
-
readonly kind: Schema.Literal<"question-body">;
|
|
197
|
-
readonly metadata: Schema.Struct<{
|
|
198
|
-
readonly dateModified: Schema.optionalKey<Schema.String>;
|
|
199
|
-
readonly datePublished: Schema.String;
|
|
200
|
-
readonly authors: Schema.$Array<Schema.Struct<{
|
|
201
|
-
readonly name: Schema.String;
|
|
202
|
-
}>>;
|
|
203
|
-
readonly title: Schema.String;
|
|
204
|
-
}>;
|
|
205
|
-
readonly stimulusKey: Schema.optionalKey<Schema.String>;
|
|
206
|
-
}>]>]>;
|
|
207
|
-
export type ContentProjection = typeof ContentProjectionSchema.Type;
|
|
208
|
-
/** Public-route projections accepted by Nakafa's path-based runtime seam. */
|
|
209
|
-
export declare const RoutedContentProjectionSchema: Schema.Union<readonly [Schema.Struct<{
|
|
210
|
-
readonly appLocale: Schema.brand<Schema.Literals<readonly ["en", "id", "de"]>, "@NakafaAI/AksaraAppLocale">;
|
|
211
|
-
readonly articleRouteSlug: Schema.brand<Schema.String, "@NakafaAI/AksaraArticleRouteSlug">;
|
|
212
|
-
readonly articleSlug: Schema.brand<Schema.String, "@NakafaAI/AksaraArticleSlug">;
|
|
213
|
-
readonly artifactLocale: Schema.brand<Schema.Literals<readonly ["en", "id", "de"]>, "@NakafaAI/AksaraArtifactLocale">;
|
|
214
|
-
readonly category: Schema.brand<Schema.String, "@NakafaAI/AksaraArticleCategory">;
|
|
215
|
-
readonly categoryRouteSlug: Schema.brand<Schema.String, "@NakafaAI/AksaraArticleRouteSlug">;
|
|
216
|
-
readonly contentKey: Schema.brand<Schema.String, "@NakafaAI/AksaraContentKey">;
|
|
217
|
-
readonly graph: Schema.Struct<{
|
|
218
|
-
readonly alignmentId: Schema.String;
|
|
219
|
-
readonly assetId: Schema.String;
|
|
220
|
-
readonly conceptId: Schema.String;
|
|
221
|
-
readonly learningObjectId: Schema.String;
|
|
222
|
-
readonly lensId: Schema.String;
|
|
223
|
-
}>;
|
|
224
|
-
readonly publicPath: Schema.brand<Schema.String, "@NakafaAI/AksaraPublicPath">;
|
|
225
|
-
readonly categoryTitle: Schema.Trimmed;
|
|
226
|
-
readonly kind: Schema.Literal<"article">;
|
|
227
|
-
readonly metadata: Schema.Struct<{
|
|
228
|
-
readonly dateModified: Schema.optionalKey<Schema.String>;
|
|
229
|
-
readonly datePublished: Schema.String;
|
|
230
|
-
readonly authors: Schema.$Array<Schema.Struct<{
|
|
231
|
-
readonly name: Schema.String;
|
|
232
|
-
}>>;
|
|
233
|
-
readonly description: Schema.optional<Schema.String>;
|
|
234
|
-
readonly title: Schema.String;
|
|
235
|
-
}>;
|
|
236
|
-
readonly official: Schema.Boolean;
|
|
237
|
-
readonly parentPath: Schema.brand<Schema.String, "@NakafaAI/AksaraPublicPath">;
|
|
238
|
-
readonly references: Schema.$Array<Schema.Struct<{
|
|
239
|
-
readonly authors: Schema.String;
|
|
240
|
-
readonly citation: Schema.optional<Schema.String>;
|
|
241
|
-
readonly details: Schema.optional<Schema.String>;
|
|
242
|
-
readonly publication: Schema.optional<Schema.String>;
|
|
243
|
-
readonly title: Schema.String;
|
|
244
|
-
readonly url: Schema.optional<Schema.String>;
|
|
245
|
-
readonly year: Schema.Finite;
|
|
246
|
-
}>>;
|
|
247
|
-
readonly sitemap: Schema.Literal<true>;
|
|
248
|
-
}>, Schema.Struct<{
|
|
249
|
-
readonly appLocale: Schema.brand<Schema.Literals<readonly ["en", "id", "de"]>, "@NakafaAI/AksaraAppLocale">;
|
|
250
|
-
readonly artifactLocale: Schema.brand<Schema.Literals<readonly ["en", "id", "de"]>, "@NakafaAI/AksaraArtifactLocale">;
|
|
251
|
-
readonly contentKey: Schema.brand<Schema.String, "@NakafaAI/AksaraContentKey">;
|
|
252
|
-
readonly graph: Schema.Struct<{
|
|
253
|
-
readonly alignmentId: Schema.String;
|
|
254
|
-
readonly assetId: Schema.String;
|
|
255
|
-
readonly conceptId: Schema.String;
|
|
256
|
-
readonly learningObjectId: Schema.String;
|
|
257
|
-
readonly lensId: Schema.String;
|
|
258
|
-
}>;
|
|
259
|
-
readonly materialKey: Schema.brand<Schema.String, "@NakafaAI/AksaraMaterialKey">;
|
|
260
|
-
readonly order: Schema.Finite;
|
|
261
|
-
readonly publicPath: Schema.brand<Schema.String, "@NakafaAI/AksaraPublicPath">;
|
|
262
|
-
readonly sectionKey: Schema.brand<Schema.String, "@NakafaAI/AksaraMaterialSection">;
|
|
263
|
-
readonly kind: Schema.Literal<"subject-lesson">;
|
|
264
|
-
readonly metadata: Schema.Struct<{
|
|
265
|
-
readonly dateModified: Schema.optionalKey<Schema.String>;
|
|
266
|
-
readonly datePublished: Schema.String;
|
|
267
|
-
readonly authors: Schema.$Array<Schema.Struct<{
|
|
268
|
-
readonly name: Schema.String;
|
|
269
|
-
}>>;
|
|
270
|
-
readonly description: Schema.optional<Schema.String>;
|
|
271
|
-
readonly searchTitle: Schema.optionalKey<Schema.Trimmed>;
|
|
272
|
-
readonly subject: Schema.optional<Schema.String>;
|
|
273
|
-
readonly title: Schema.String;
|
|
274
|
-
}>;
|
|
275
|
-
readonly parentPath: Schema.brand<Schema.String, "@NakafaAI/AksaraPublicPath">;
|
|
276
|
-
readonly sitemap: Schema.Literal<true>;
|
|
277
|
-
readonly topicTitle: Schema.String;
|
|
278
|
-
}>, Schema.Struct<{
|
|
279
|
-
readonly appLocale: Schema.brand<Schema.Literals<readonly ["en", "id", "de"]>, "@NakafaAI/AksaraAppLocale">;
|
|
280
|
-
readonly artifactLocale: Schema.brand<Schema.Literals<readonly ["en", "id", "de"]>, "@NakafaAI/AksaraArtifactLocale">;
|
|
281
|
-
readonly contentKey: Schema.brand<Schema.String, "@NakafaAI/AksaraContentKey">;
|
|
282
|
-
readonly pageKey: Schema.brand<Schema.String, "@NakafaAI/AksaraPageKey">;
|
|
283
|
-
readonly publicPath: Schema.brand<Schema.String, "@NakafaAI/AksaraPublicPath">;
|
|
284
|
-
readonly kind: Schema.Literal<"public-page">;
|
|
285
|
-
readonly metadata: Schema.Struct<{
|
|
286
|
-
readonly dateModified: Schema.optionalKey<Schema.String>;
|
|
287
|
-
readonly datePublished: Schema.String;
|
|
288
|
-
readonly description: Schema.Trimmed;
|
|
289
|
-
readonly title: Schema.Trimmed;
|
|
290
|
-
}>;
|
|
291
|
-
readonly sitemap: Schema.Literal<true>;
|
|
292
|
-
readonly sourcePath: Schema.brand<Schema.String, "@NakafaAI/AksaraCorpusSourcePath">;
|
|
293
90
|
}>]>;
|
|
294
|
-
export type
|
|
91
|
+
export type ContentProjection = typeof ContentProjectionSchema.Type;
|
|
295
92
|
/** Returns the release family that owns one discriminated projection. */
|
|
296
|
-
export declare function familyForProjection(projection: ContentProjection): "article" | "material" | "page"
|
|
297
|
-
/** Returns public route ownership only for route-bearing projections. */
|
|
298
|
-
export declare function projectionPublicPath(projection: ContentProjection): (string & import("effect/Brand").Brand<"@NakafaAI/AksaraPublicPath">) | undefined;
|
|
93
|
+
export declare function familyForProjection(projection: ContentProjection): "article" | "material" | "page";
|
|
299
94
|
/** Returns the exact compiled artifact locale owned by one projection. */
|
|
300
95
|
export declare function projectionArtifactLocale(projection: ContentProjection): ("de" | "en" | "id") & import("effect/Brand").Brand<"@NakafaAI/AksaraArtifactLocale">;
|
|
301
96
|
/** Serializes one projection through its exhaustive family-owned canonicalizer. */
|
package/dist/projection/spec.js
CHANGED
|
@@ -2,37 +2,24 @@ import { Match, Schema } from "effect";
|
|
|
2
2
|
import { ArticleProjectionSchema, canonicalizeArticleProjection, } from "#contracts/projection/article";
|
|
3
3
|
import { canonicalizeMaterialProjection, MaterialLessonProjectionSchema, } from "#contracts/projection/material";
|
|
4
4
|
import { canonicalizePublicPageProjection, PublicPageProjectionSchema, } from "#contracts/projection/page";
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
/**
|
|
6
|
+
* Complete projection vocabulary backed by implemented content families. Every
|
|
7
|
+
* projection owns a public route, which Nakafa's path-based runtime serves.
|
|
8
|
+
*/
|
|
7
9
|
export const ContentProjectionSchema = Schema.Union([
|
|
8
10
|
ArticleProjectionSchema,
|
|
9
11
|
MaterialLessonProjectionSchema,
|
|
10
12
|
PublicPageProjectionSchema,
|
|
11
|
-
QuestionBodyProjectionSchema,
|
|
12
|
-
]);
|
|
13
|
-
/** Public-route projections accepted by Nakafa's path-based runtime seam. */
|
|
14
|
-
export const RoutedContentProjectionSchema = Schema.Union([
|
|
15
|
-
ArticleProjectionSchema,
|
|
16
|
-
MaterialLessonProjectionSchema,
|
|
17
|
-
PublicPageProjectionSchema,
|
|
18
13
|
]);
|
|
19
14
|
const matchProjectionFamily = Match.type().pipe(Match.discriminatorsExhaustive("kind")({
|
|
20
15
|
article: () => "article",
|
|
21
16
|
"public-page": () => "page",
|
|
22
|
-
"question-body": () => "question",
|
|
23
17
|
"subject-lesson": () => "material",
|
|
24
18
|
}));
|
|
25
19
|
/** Returns the release family that owns one discriminated projection. */
|
|
26
20
|
export function familyForProjection(projection) {
|
|
27
21
|
return matchProjectionFamily(projection);
|
|
28
22
|
}
|
|
29
|
-
/** Returns public route ownership only for route-bearing projections. */
|
|
30
|
-
export function projectionPublicPath(projection) {
|
|
31
|
-
if (projection.kind === "question-body") {
|
|
32
|
-
return;
|
|
33
|
-
}
|
|
34
|
-
return projection.publicPath;
|
|
35
|
-
}
|
|
36
23
|
/** Returns the exact compiled artifact locale owned by one projection. */
|
|
37
24
|
export function projectionArtifactLocale(projection) {
|
|
38
25
|
return projection.artifactLocale;
|
|
@@ -40,7 +27,6 @@ export function projectionArtifactLocale(projection) {
|
|
|
40
27
|
const matchCanonicalProjection = Match.type().pipe(Match.discriminatorsExhaustive("kind")({
|
|
41
28
|
article: canonicalizeArticleProjection,
|
|
42
29
|
"public-page": canonicalizePublicPageProjection,
|
|
43
|
-
"question-body": canonicalizeQuestionProjection,
|
|
44
30
|
"subject-lesson": canonicalizeMaterialProjection,
|
|
45
31
|
}));
|
|
46
32
|
/** Serializes one projection through its exhaustive family-owned canonicalizer. */
|
|
@@ -136,133 +136,6 @@ export declare function decodeContentProjections<E, R>(projections: Stream.Strea
|
|
|
136
136
|
};
|
|
137
137
|
readonly sitemap: true;
|
|
138
138
|
readonly sourcePath: string & import("effect/Brand").Brand<"@NakafaAI/AksaraCorpusSourcePath">;
|
|
139
|
-
} | {
|
|
140
|
-
readonly artifactLocale: ("de" | "en" | "id") & import("effect/Brand").Brand<"@NakafaAI/AksaraArtifactLocale">;
|
|
141
|
-
readonly contentKey: string & import("effect/Brand").Brand<"@NakafaAI/AksaraContentKey">;
|
|
142
|
-
readonly peerContentKey: string & import("effect/Brand").Brand<"@NakafaAI/AksaraContentKey">;
|
|
143
|
-
readonly questionKey: string & import("effect/Brand").Brand<"@NakafaAI/AksaraQuestionKey">;
|
|
144
|
-
readonly questionNumber: number;
|
|
145
|
-
readonly setKey: string & import("effect/Brand").Brand<"@NakafaAI/AksaraQuestionSetKey">;
|
|
146
|
-
readonly bodyKind: "question";
|
|
147
|
-
readonly blueprint?: {
|
|
148
|
-
readonly cognitiveLevel: string;
|
|
149
|
-
readonly contentDomain: string;
|
|
150
|
-
readonly topic: string;
|
|
151
|
-
};
|
|
152
|
-
readonly kind: "question-body";
|
|
153
|
-
readonly metadata: {
|
|
154
|
-
readonly dateModified?: string;
|
|
155
|
-
readonly datePublished: string;
|
|
156
|
-
readonly authors: readonly {
|
|
157
|
-
readonly name: string;
|
|
158
|
-
}[];
|
|
159
|
-
readonly title: string;
|
|
160
|
-
};
|
|
161
|
-
readonly stimulusKey?: string;
|
|
162
|
-
readonly response: {
|
|
163
|
-
readonly categories: readonly {
|
|
164
|
-
readonly categoryKey: string;
|
|
165
|
-
readonly label: string;
|
|
166
|
-
readonly order: number;
|
|
167
|
-
}[];
|
|
168
|
-
readonly kind: "category";
|
|
169
|
-
readonly statements: readonly {
|
|
170
|
-
readonly correctCategoryKey: string;
|
|
171
|
-
readonly label: string;
|
|
172
|
-
readonly order: number;
|
|
173
|
-
readonly statementKey: string;
|
|
174
|
-
}[];
|
|
175
|
-
} | {
|
|
176
|
-
readonly kind: "multiple-choice";
|
|
177
|
-
readonly options: readonly {
|
|
178
|
-
readonly isCorrect: boolean;
|
|
179
|
-
readonly label: string;
|
|
180
|
-
readonly optionKey: string;
|
|
181
|
-
readonly order: number;
|
|
182
|
-
}[];
|
|
183
|
-
} | {
|
|
184
|
-
readonly kind: "single-choice";
|
|
185
|
-
readonly options: readonly {
|
|
186
|
-
readonly isCorrect: boolean;
|
|
187
|
-
readonly label: string;
|
|
188
|
-
readonly optionKey: string;
|
|
189
|
-
readonly order: number;
|
|
190
|
-
}[];
|
|
191
|
-
} | {
|
|
192
|
-
readonly criteria: readonly {
|
|
193
|
-
readonly criterionKey: string;
|
|
194
|
-
readonly finalAnswer?: {
|
|
195
|
-
readonly acceptsFractions: boolean;
|
|
196
|
-
readonly kind: "number";
|
|
197
|
-
readonly tolerance?: {
|
|
198
|
-
readonly kind: "absolute" | "relative";
|
|
199
|
-
readonly value: string;
|
|
200
|
-
};
|
|
201
|
-
readonly value: string;
|
|
202
|
-
} | {
|
|
203
|
-
readonly acceptedAnswers: readonly [string, ...string[]];
|
|
204
|
-
readonly collapseWhitespace: boolean;
|
|
205
|
-
readonly ignoreCase: boolean;
|
|
206
|
-
readonly kind: "text";
|
|
207
|
-
};
|
|
208
|
-
readonly order: number;
|
|
209
|
-
readonly label: {
|
|
210
|
-
readonly de: string;
|
|
211
|
-
readonly en: string;
|
|
212
|
-
readonly id: string;
|
|
213
|
-
};
|
|
214
|
-
readonly levels: readonly {
|
|
215
|
-
readonly levelKey: string;
|
|
216
|
-
readonly order: number;
|
|
217
|
-
readonly points: number;
|
|
218
|
-
readonly label: {
|
|
219
|
-
readonly de: string;
|
|
220
|
-
readonly en: string;
|
|
221
|
-
readonly id: string;
|
|
222
|
-
};
|
|
223
|
-
}[];
|
|
224
|
-
}[];
|
|
225
|
-
readonly kind: "rubric";
|
|
226
|
-
} | {
|
|
227
|
-
readonly key: {
|
|
228
|
-
readonly acceptsFractions: boolean;
|
|
229
|
-
readonly kind: "number";
|
|
230
|
-
readonly tolerance?: {
|
|
231
|
-
readonly kind: "absolute" | "relative";
|
|
232
|
-
readonly value: string;
|
|
233
|
-
};
|
|
234
|
-
readonly value: string;
|
|
235
|
-
} | {
|
|
236
|
-
readonly acceptedAnswers: readonly [string, ...string[]];
|
|
237
|
-
readonly collapseWhitespace: boolean;
|
|
238
|
-
readonly ignoreCase: boolean;
|
|
239
|
-
readonly kind: "text";
|
|
240
|
-
};
|
|
241
|
-
readonly kind: "short-answer";
|
|
242
|
-
};
|
|
243
|
-
} | {
|
|
244
|
-
readonly artifactLocale: ("de" | "en" | "id") & import("effect/Brand").Brand<"@NakafaAI/AksaraArtifactLocale">;
|
|
245
|
-
readonly contentKey: string & import("effect/Brand").Brand<"@NakafaAI/AksaraContentKey">;
|
|
246
|
-
readonly peerContentKey: string & import("effect/Brand").Brand<"@NakafaAI/AksaraContentKey">;
|
|
247
|
-
readonly questionKey: string & import("effect/Brand").Brand<"@NakafaAI/AksaraQuestionKey">;
|
|
248
|
-
readonly questionNumber: number;
|
|
249
|
-
readonly setKey: string & import("effect/Brand").Brand<"@NakafaAI/AksaraQuestionSetKey">;
|
|
250
|
-
readonly bodyKind: "answer";
|
|
251
|
-
readonly blueprint?: {
|
|
252
|
-
readonly cognitiveLevel: string;
|
|
253
|
-
readonly contentDomain: string;
|
|
254
|
-
readonly topic: string;
|
|
255
|
-
};
|
|
256
|
-
readonly kind: "question-body";
|
|
257
|
-
readonly metadata: {
|
|
258
|
-
readonly dateModified?: string;
|
|
259
|
-
readonly datePublished: string;
|
|
260
|
-
readonly authors: readonly {
|
|
261
|
-
readonly name: string;
|
|
262
|
-
}[];
|
|
263
|
-
readonly title: string;
|
|
264
|
-
};
|
|
265
|
-
readonly stimulusKey?: string;
|
|
266
139
|
}, E | ProjectionDecodeError | ProjectionOrderError | ProjectionRouteError, R>;
|
|
267
140
|
/** Authenticates a replayable projection stream against its signed manifest. */
|
|
268
141
|
export declare const verifyContentProjections: <E, R>(input: {
|
|
@@ -270,5 +143,5 @@ export declare const verifyContentProjections: <E, R>(input: {
|
|
|
270
143
|
readonly projections: Stream.Stream<unknown, E, R>;
|
|
271
144
|
}) => Effect.Effect<{
|
|
272
145
|
count: number;
|
|
273
|
-
}, E | ProjectionCountError | ProjectionDecodeError | ProjectionDigestError |
|
|
146
|
+
}, E | ProjectionCountError | ProjectionDecodeError | ProjectionDigestError | ProjectionOrderError | ProjectionRouteError, R>;
|
|
274
147
|
export {};
|
|
@@ -42,9 +42,6 @@ const decodeProjection = Effect.fn("AksaraContracts.decodeProjection")(function*
|
|
|
42
42
|
return yield* new ProjectionOrderError({ projectionIndex });
|
|
43
43
|
}
|
|
44
44
|
state.previous = Option.some(projection);
|
|
45
|
-
if (projection.kind === "question-body") {
|
|
46
|
-
return projection;
|
|
47
|
-
}
|
|
48
45
|
const { appLocale, publicPath } = projection;
|
|
49
46
|
const identity = routeIdentity({ appLocale, publicPath });
|
|
50
47
|
const firstIndex = Option.getOrUndefined(MutableHashMap.get(state.firstIndexByRoute, identity));
|
|
@@ -67,7 +64,7 @@ export function decodeContentProjections(projections) {
|
|
|
67
64
|
}
|
|
68
65
|
/** Authenticates a replayable projection stream against its signed manifest. */
|
|
69
66
|
export const verifyContentProjections = Effect.fn("AksaraContracts.verifyContentProjections")(function* (input) {
|
|
70
|
-
const summary = yield*
|
|
67
|
+
const summary = yield* input.projections.pipe(decodeContentProjections, digestProjections);
|
|
71
68
|
if (summary.count !== input.manifest.projectionCount) {
|
|
72
69
|
return yield* new ProjectionCountError({
|
|
73
70
|
actualCount: summary.count,
|