@nakafa/aksara-contracts 0.50.0 → 0.51.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/artifact/integrity.d.ts +15 -2
- package/dist/artifact/integrity.js +3 -15
- package/dist/artifact/limits.js +3 -4
- package/dist/artifact/source.js +4 -8
- package/dist/artifact/spec.d.ts +30 -10
- package/dist/assessment/hash.d.ts +3 -1
- package/dist/assessment/paper.d.ts +3 -1
- package/dist/errors.d.ts +3 -1
- package/dist/graph/family.d.ts +6 -2
- package/dist/graph/identity.d.ts +3 -1
- package/dist/hash/digest.d.ts +10 -0
- package/dist/hash/digest.js +40 -0
- package/dist/hash/stream.d.ts +12 -0
- package/dist/hash/stream.js +27 -0
- package/dist/hash/text.d.ts +3 -1
- package/dist/hash/text.js +2 -15
- package/dist/preview/auth.d.ts +4 -2
- package/dist/preview/auth.js +26 -12
- package/dist/program/snapshot/digest.d.ts +3 -1
- package/dist/program/snapshot/digest.js +14 -22
- package/dist/program/snapshot/hash.d.ts +6 -2
- package/dist/program/snapshot/hash.js +10 -21
- package/dist/projection/digest.d.ts +11 -9
- package/dist/projection/digest.js +23 -32
- package/dist/projection/hash.d.ts +222 -2
- package/dist/projection/hash.js +6 -8
- package/dist/projection/verify.d.ts +16 -6
- package/dist/question/item.d.ts +3 -1
- package/dist/question/item.js +3 -1
- package/dist/quran/notes.d.ts +3 -1
- package/dist/quran/provenance.d.ts +6 -2
- package/dist/quran/provenance.js +8 -15
- package/dist/quran/snapshot/digest.d.ts +9 -5
- package/dist/quran/snapshot/digest.js +33 -41
- package/dist/quran/snapshot/hash.d.ts +3 -1
- package/dist/quran/snapshot/hash.js +9 -15
- package/dist/quran/snapshot/row/hash.d.ts +3 -1
- package/dist/quran/snapshot/row/hash.js +2 -8
- package/dist/release/digest.d.ts +10 -8
- package/dist/release/digest.js +22 -31
- package/dist/release/hash.d.ts +3 -1
- package/dist/release/hash.js +3 -8
- package/dist/release/items.d.ts +25 -9
- package/dist/release/items.js +12 -3
- package/dist/release/policy.d.ts +3 -1
- package/dist/release/result/digest.d.ts +23 -13
- package/dist/release/result/digest.js +20 -29
- package/dist/release/rollback/digest.d.ts +16 -10
- package/dist/release/rollback/digest.js +25 -32
- package/dist/release/route/digest.d.ts +10 -8
- package/dist/release/route/digest.js +22 -31
- package/dist/release/route/verify.d.ts +16 -6
- package/dist/release/route/verify.js +8 -2
- package/dist/release/snapshot/evidence/requirement.d.ts +3 -1
- package/dist/release/snapshot/evidence/tryout.d.ts +1 -1
- package/dist/release/snapshot/evidence/tryout.js +1 -1
- package/dist/release/snapshot/evidence.d.ts +1 -1
- package/dist/release/snapshot/verify.d.ts +19 -7
- package/dist/release/snapshot/verify.js +20 -18
- package/dist/release/verify.d.ts +9 -3
- package/dist/renderer/compatibility.d.ts +6 -2
- package/dist/renderer/compatibility.js +3 -1
- package/dist/renderer/contract.d.ts +9 -3
- package/dist/renderer/contract.js +3 -1
- package/dist/runtime/error.d.ts +3 -1
- package/dist/runtime/protected/verify.d.ts +1 -1
- package/dist/runtime/verify.d.ts +2 -2
- package/dist/runtime/verify.js +2 -1
- package/dist/signature/key.d.ts +21 -0
- package/dist/signature/key.js +104 -0
- package/dist/signature/spec.d.ts +18 -6
- package/dist/signature/spec.js +16 -4
- package/dist/transport/request.d.ts +728 -728
- package/dist/transport/response.d.ts +26 -26
- package/dist/tryout/canonical.d.ts +11 -1
- package/dist/tryout/canonical.js +6 -10
- package/dist/tryout/closure/accounting.d.ts +3 -1
- package/dist/tryout/digest.d.ts +12 -6
- package/dist/tryout/digest.js +21 -14
- package/dist/tryout/hash/catalog.d.ts +228 -3
- package/dist/tryout/hash/catalog.js +5 -7
- package/dist/tryout/hash/content.d.ts +113 -2
- package/dist/tryout/hash/content.js +10 -8
- package/dist/tryout/hash/placement.d.ts +236 -5
- package/dist/tryout/hash/placement.js +7 -8
- package/dist/tryout/runtime/hash.d.ts +3 -1
- package/dist/tryout/runtime/hash.js +3 -1
- package/dist/tryout/runtime/source.d.ts +3 -1
- package/dist/tryout/runtime/verify.d.ts +13 -5
- package/dist/tryout/runtime/verify.js +1 -1
- package/dist/tryout/scoring.d.ts +3 -1
- package/dist/tryout/snapshot/hash.d.ts +45 -4
- package/dist/tryout/snapshot/hash.js +9 -7
- package/package.json +18 -2
|
@@ -5399,13 +5399,18 @@ export declare const decodePublicationResponse: (input: unknown) => Effect.Effec
|
|
|
5399
5399
|
};
|
|
5400
5400
|
readonly stimulusKey?: string;
|
|
5401
5401
|
readonly response: {
|
|
5402
|
-
readonly
|
|
5403
|
-
|
|
5404
|
-
readonly isCorrect: boolean;
|
|
5402
|
+
readonly categories: readonly {
|
|
5403
|
+
readonly categoryKey: string;
|
|
5405
5404
|
readonly label: string;
|
|
5406
|
-
readonly optionKey: string;
|
|
5407
5405
|
readonly order: number;
|
|
5408
5406
|
}[];
|
|
5407
|
+
readonly kind: "category";
|
|
5408
|
+
readonly statements: readonly {
|
|
5409
|
+
readonly correctCategoryKey: string;
|
|
5410
|
+
readonly label: string;
|
|
5411
|
+
readonly order: number;
|
|
5412
|
+
readonly statementKey: string;
|
|
5413
|
+
}[];
|
|
5409
5414
|
} | {
|
|
5410
5415
|
readonly kind: "multiple-choice";
|
|
5411
5416
|
readonly options: readonly {
|
|
@@ -5415,17 +5420,12 @@ export declare const decodePublicationResponse: (input: unknown) => Effect.Effec
|
|
|
5415
5420
|
readonly order: number;
|
|
5416
5421
|
}[];
|
|
5417
5422
|
} | {
|
|
5418
|
-
readonly
|
|
5419
|
-
|
|
5420
|
-
readonly
|
|
5421
|
-
readonly order: number;
|
|
5422
|
-
}[];
|
|
5423
|
-
readonly kind: "category";
|
|
5424
|
-
readonly statements: readonly {
|
|
5425
|
-
readonly correctCategoryKey: string;
|
|
5423
|
+
readonly kind: "single-choice";
|
|
5424
|
+
readonly options: readonly {
|
|
5425
|
+
readonly isCorrect: boolean;
|
|
5426
5426
|
readonly label: string;
|
|
5427
|
+
readonly optionKey: string;
|
|
5427
5428
|
readonly order: number;
|
|
5428
|
-
readonly statementKey: string;
|
|
5429
5429
|
}[];
|
|
5430
5430
|
} | {
|
|
5431
5431
|
readonly criteria: readonly {
|
|
@@ -5651,13 +5651,18 @@ export declare const decodePublicationResponse: (input: unknown) => Effect.Effec
|
|
|
5651
5651
|
};
|
|
5652
5652
|
readonly stimulusKey?: string;
|
|
5653
5653
|
readonly response: {
|
|
5654
|
-
readonly
|
|
5655
|
-
|
|
5656
|
-
readonly isCorrect: boolean;
|
|
5654
|
+
readonly categories: readonly {
|
|
5655
|
+
readonly categoryKey: string;
|
|
5657
5656
|
readonly label: string;
|
|
5658
|
-
readonly optionKey: string;
|
|
5659
5657
|
readonly order: number;
|
|
5660
5658
|
}[];
|
|
5659
|
+
readonly kind: "category";
|
|
5660
|
+
readonly statements: readonly {
|
|
5661
|
+
readonly correctCategoryKey: string;
|
|
5662
|
+
readonly label: string;
|
|
5663
|
+
readonly order: number;
|
|
5664
|
+
readonly statementKey: string;
|
|
5665
|
+
}[];
|
|
5661
5666
|
} | {
|
|
5662
5667
|
readonly kind: "multiple-choice";
|
|
5663
5668
|
readonly options: readonly {
|
|
@@ -5667,17 +5672,12 @@ export declare const decodePublicationResponse: (input: unknown) => Effect.Effec
|
|
|
5667
5672
|
readonly order: number;
|
|
5668
5673
|
}[];
|
|
5669
5674
|
} | {
|
|
5670
|
-
readonly
|
|
5671
|
-
|
|
5672
|
-
readonly
|
|
5673
|
-
readonly order: number;
|
|
5674
|
-
}[];
|
|
5675
|
-
readonly kind: "category";
|
|
5676
|
-
readonly statements: readonly {
|
|
5677
|
-
readonly correctCategoryKey: string;
|
|
5675
|
+
readonly kind: "single-choice";
|
|
5676
|
+
readonly options: readonly {
|
|
5677
|
+
readonly isCorrect: boolean;
|
|
5678
5678
|
readonly label: string;
|
|
5679
|
+
readonly optionKey: string;
|
|
5679
5680
|
readonly order: number;
|
|
5680
|
-
readonly statementKey: string;
|
|
5681
5681
|
}[];
|
|
5682
5682
|
} | {
|
|
5683
5683
|
readonly criteria: readonly {
|
|
@@ -1,2 +1,12 @@
|
|
|
1
|
+
import { Effect, Schema } from "effect";
|
|
2
|
+
declare const TryoutCanonicalHashError_base: Schema.Class<TryoutCanonicalHashError, Schema.TaggedStruct<"TryoutCanonicalHashError", {
|
|
3
|
+
readonly domain: Schema.String;
|
|
4
|
+
}>, import("effect/Cause").YieldableError & {
|
|
5
|
+
readonly brand: unique symbol;
|
|
6
|
+
}>;
|
|
7
|
+
/** Web Crypto could not hash one domain-separated try-out identity. */
|
|
8
|
+
export declare class TryoutCanonicalHashError extends TryoutCanonicalHashError_base {
|
|
9
|
+
}
|
|
1
10
|
/** Computes one domain-separated canonical try-out SHA-256 identity. */
|
|
2
|
-
export declare
|
|
11
|
+
export declare const hashTryoutCanonical: (domain: string, canonical: string) => Effect.Effect<string & import("effect/Brand").Brand<"@NakafaAI/AksaraSha256Hash">, TryoutCanonicalHashError, never>;
|
|
12
|
+
export {};
|
package/dist/tryout/canonical.js
CHANGED
|
@@ -1,11 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
/**
|
|
4
|
-
export
|
|
5
|
-
const digest = createHash("sha256")
|
|
6
|
-
.update(domain)
|
|
7
|
-
.update("\n")
|
|
8
|
-
.update(canonical)
|
|
9
|
-
.digest("hex");
|
|
10
|
-
return Sha256HashSchema.make(`sha256:${digest}`);
|
|
1
|
+
import { Effect, Schema } from "effect";
|
|
2
|
+
import { hashText } from "#contracts/hash/text";
|
|
3
|
+
/** Web Crypto could not hash one domain-separated try-out identity. */
|
|
4
|
+
export class TryoutCanonicalHashError extends Schema.TaggedError()("TryoutCanonicalHashError", { domain: Schema.String }) {
|
|
11
5
|
}
|
|
6
|
+
/** Computes one domain-separated canonical try-out SHA-256 identity. */
|
|
7
|
+
export const hashTryoutCanonical = Effect.fn("AksaraContracts.hashTryoutCanonical")((domain, canonical) => hashText(`${domain}\n${canonical}`).pipe(Effect.mapError(() => new TryoutCanonicalHashError({ domain }))));
|
|
@@ -7,7 +7,9 @@ declare const TryoutClosureError_base: Schema.Class<TryoutClosureError, Schema.T
|
|
|
7
7
|
readonly code: Schema.Literals<readonly ["assessed-language", "duplicate-locale", "fact-mismatch", "inactive-locale", "missing-locale", "missing-section", "question-count"]>;
|
|
8
8
|
readonly expected: Schema.String;
|
|
9
9
|
readonly identity: Schema.String;
|
|
10
|
-
}>, import("effect/Cause").YieldableError
|
|
10
|
+
}>, import("effect/Cause").YieldableError & {
|
|
11
|
+
readonly brand: unique symbol;
|
|
12
|
+
}>;
|
|
11
13
|
/** A try-out snapshot is incomplete or inconsistent across app locales. */
|
|
12
14
|
export declare class TryoutClosureError extends TryoutClosureError_base {
|
|
13
15
|
}
|
package/dist/tryout/digest.d.ts
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { Effect, Schema, Stream } from "effect";
|
|
2
|
-
import { Sha256HashSchema } from "#contracts/ids";
|
|
2
|
+
import type { Sha256HashSchema } from "#contracts/ids";
|
|
3
3
|
declare const TryoutDigestError_base: Schema.Class<TryoutDigestError, Schema.TaggedStruct<"TryoutDigestError", {
|
|
4
4
|
readonly code: Schema.Literals<readonly ["integrity", "order"]>;
|
|
5
5
|
readonly identity: Schema.String;
|
|
6
|
-
}>, import("effect/Cause").YieldableError
|
|
6
|
+
}>, import("effect/Cause").YieldableError & {
|
|
7
|
+
readonly brand: unique symbol;
|
|
8
|
+
}>;
|
|
7
9
|
/** A snapshot stream is duplicated, unsorted, or tampered. */
|
|
8
10
|
export declare class TryoutDigestError extends TryoutDigestError_base {
|
|
9
11
|
}
|
|
@@ -11,8 +13,12 @@ interface DigestRecord<Row> {
|
|
|
11
13
|
readonly row: Row;
|
|
12
14
|
readonly rowHash: typeof Sha256HashSchema.Type;
|
|
13
15
|
}
|
|
14
|
-
/**
|
|
15
|
-
|
|
16
|
+
/**
|
|
17
|
+
* Digests one canonically ordered record stream. The canonical bytes are held
|
|
18
|
+
* until one Web Crypto digest runs over them, because Web Crypto has no
|
|
19
|
+
* incremental form.
|
|
20
|
+
*/
|
|
21
|
+
export declare const digestTryoutRecords: <E, R, Row, HashError>(input: {
|
|
16
22
|
/** Serializes one row into its exact digest bytes. */
|
|
17
23
|
readonly canonicalize: (row: Row) => string;
|
|
18
24
|
readonly domain: string;
|
|
@@ -20,9 +26,9 @@ export declare const digestTryoutRecords: <E, R, Row>(input: {
|
|
|
20
26
|
readonly identity: (row: Row) => string;
|
|
21
27
|
readonly records: Stream.Stream<DigestRecord<Row>, E, R>;
|
|
22
28
|
/** Recomputes the authenticated row hash for integrity checking. */
|
|
23
|
-
readonly rowHash: (row: Row) => typeof Sha256HashSchema.Type
|
|
29
|
+
readonly rowHash: (row: Row) => Effect.Effect<typeof Sha256HashSchema.Type, HashError>;
|
|
24
30
|
}) => Effect.Effect<{
|
|
25
31
|
count: number;
|
|
26
32
|
digest: string & import("effect/Brand").Brand<"@NakafaAI/AksaraSha256Hash">;
|
|
27
|
-
}, E | TryoutDigestError, R>;
|
|
33
|
+
}, E | HashError | import("effect/PlatformError").PlatformError | TryoutDigestError, R>;
|
|
28
34
|
export {};
|
package/dist/tryout/digest.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { createHash } from "node:crypto";
|
|
2
1
|
import { Effect, Schema, Stream } from "effect";
|
|
3
|
-
import {
|
|
2
|
+
import { DigestStream } from "#contracts/hash/stream";
|
|
4
3
|
import { compareCodeUnits } from "#contracts/text/order";
|
|
5
4
|
/** A snapshot stream is duplicated, unsorted, or tampered. */
|
|
6
5
|
export class TryoutDigestError extends Schema.TaggedError()("TryoutDigestError", {
|
|
@@ -10,25 +9,27 @@ export class TryoutDigestError extends Schema.TaggedError()("TryoutDigestError",
|
|
|
10
9
|
}
|
|
11
10
|
/** Keeps one stream digest and previous identity private to its replay. */
|
|
12
11
|
class TryoutDigestState {
|
|
13
|
-
#
|
|
12
|
+
#stream = new DigestStream();
|
|
14
13
|
count = 0;
|
|
15
14
|
previous;
|
|
16
|
-
/**
|
|
15
|
+
/** Starts one fresh domain-separated digest stream. */
|
|
17
16
|
constructor(domain) {
|
|
18
|
-
this.#
|
|
17
|
+
this.#stream.add(domain);
|
|
18
|
+
this.#stream.add("\n");
|
|
19
19
|
}
|
|
20
20
|
/** Adds one verified canonical record to the digest. */
|
|
21
21
|
update(canonical, identity) {
|
|
22
|
-
this.#
|
|
22
|
+
this.#stream.add(canonical);
|
|
23
|
+
this.#stream.add("\n");
|
|
23
24
|
this.count += 1;
|
|
24
25
|
this.previous = identity;
|
|
25
26
|
}
|
|
26
|
-
/**
|
|
27
|
+
/** Digests the complete stream once and returns its branded value. */
|
|
27
28
|
digest() {
|
|
28
|
-
return
|
|
29
|
+
return this.#stream.digest();
|
|
29
30
|
}
|
|
30
31
|
}
|
|
31
|
-
/** Verifies and adds
|
|
32
|
+
/** Verifies one immutable record and adds its canonical bytes to the digest stream. */
|
|
32
33
|
function updateDigest(state, record, identity, expectedHash, canonical) {
|
|
33
34
|
if (record.rowHash !== expectedHash) {
|
|
34
35
|
return Effect.fail(new TryoutDigestError({ code: "integrity", identity }));
|
|
@@ -40,11 +41,17 @@ function updateDigest(state, record, identity, expectedHash, canonical) {
|
|
|
40
41
|
state.update(canonical, identity);
|
|
41
42
|
return Effect.succeed(state);
|
|
42
43
|
}
|
|
43
|
-
/**
|
|
44
|
+
/**
|
|
45
|
+
* Digests one canonically ordered record stream. The canonical bytes are held
|
|
46
|
+
* until one Web Crypto digest runs over them, because Web Crypto has no
|
|
47
|
+
* incremental form.
|
|
48
|
+
*/
|
|
44
49
|
export const digestTryoutRecords = Effect.fn("AksaraContracts.digestTryoutRecords")(function* (input) {
|
|
45
|
-
const state = yield* input.records.pipe(Stream.runFoldEffect(() => new TryoutDigestState(input.domain), (current, record) => {
|
|
50
|
+
const state = yield* input.records.pipe(Stream.runFoldEffect(() => new TryoutDigestState(input.domain), (current, record) => Effect.gen(function* () {
|
|
46
51
|
const canonical = input.canonicalize(record.row);
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
52
|
+
const expectedHash = yield* input.rowHash(record.row);
|
|
53
|
+
return yield* updateDigest(current, record, input.identity(record.row), expectedHash, `${canonical}\0${record.rowHash}`);
|
|
54
|
+
})));
|
|
55
|
+
const digest = yield* state.digest();
|
|
56
|
+
return { count: state.count, digest };
|
|
50
57
|
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Effect, type Stream } from "effect";
|
|
2
|
-
import { type
|
|
2
|
+
import { type TryoutCatalogRow } from "#contracts/tryout/catalog";
|
|
3
3
|
/** Compares localized hierarchy rows in their canonical digest order. */
|
|
4
4
|
export declare function compareTryoutCatalog(left: TryoutCatalogRow, right: TryoutCatalogRow): -1 | 0 | 1;
|
|
5
5
|
/** Builds one locale-neutral hierarchy identity for closure checks. */
|
|
@@ -17,7 +17,232 @@ export declare function canonicalizeTryoutCatalogFacts(row: TryoutCatalogRow): s
|
|
|
17
17
|
/** Serializes one current hierarchy row in stable field order. */
|
|
18
18
|
export declare function canonicalizeTryoutCatalog(row: TryoutCatalogRow): string;
|
|
19
19
|
/** Creates one authenticated current hierarchy record. */
|
|
20
|
-
export declare
|
|
20
|
+
export declare const makeTryoutCatalogRecord: (row: {
|
|
21
|
+
readonly appLocale: ("de" | "en" | "id") & import("effect/Brand").Brand<"@NakafaAI/AksaraAppLocale">;
|
|
22
|
+
readonly description?: string | undefined;
|
|
23
|
+
readonly graph: {
|
|
24
|
+
readonly alignmentId: string;
|
|
25
|
+
readonly assetId: string;
|
|
26
|
+
readonly conceptId: string;
|
|
27
|
+
readonly learningObjectId: string;
|
|
28
|
+
readonly lensId: string;
|
|
29
|
+
};
|
|
30
|
+
readonly sourceRevision: string;
|
|
31
|
+
readonly title: string;
|
|
32
|
+
readonly countryKey: string;
|
|
33
|
+
readonly examKey: string;
|
|
34
|
+
readonly kind: "section";
|
|
35
|
+
readonly marks?: {
|
|
36
|
+
readonly blank: number;
|
|
37
|
+
readonly correct: number;
|
|
38
|
+
readonly wrong: number;
|
|
39
|
+
};
|
|
40
|
+
readonly order: number;
|
|
41
|
+
readonly publicPath?: (string & import("effect/Brand").Brand<"@NakafaAI/AksaraPublicPath">) | undefined;
|
|
42
|
+
readonly questionCount: number;
|
|
43
|
+
readonly questionSourcePath: string & import("effect/Brand").Brand<"@NakafaAI/AksaraCorpusSourcePath">;
|
|
44
|
+
readonly sectionKey: string;
|
|
45
|
+
readonly setKey: string;
|
|
46
|
+
readonly timeLimitSeconds: number;
|
|
47
|
+
readonly trackKey: string;
|
|
48
|
+
readonly visibility: "internal-entry" | "visible";
|
|
49
|
+
} | {
|
|
50
|
+
readonly appLocale: ("de" | "en" | "id") & import("effect/Brand").Brand<"@NakafaAI/AksaraAppLocale">;
|
|
51
|
+
readonly description?: string | undefined;
|
|
52
|
+
readonly graph: {
|
|
53
|
+
readonly alignmentId: string;
|
|
54
|
+
readonly assetId: string;
|
|
55
|
+
readonly conceptId: string;
|
|
56
|
+
readonly learningObjectId: string;
|
|
57
|
+
readonly lensId: string;
|
|
58
|
+
};
|
|
59
|
+
readonly sourceRevision: string;
|
|
60
|
+
readonly title: string;
|
|
61
|
+
readonly countryKey: string;
|
|
62
|
+
readonly examKey: string;
|
|
63
|
+
readonly internalEntrySectionKey?: string | undefined;
|
|
64
|
+
readonly kind: "set";
|
|
65
|
+
readonly order: number;
|
|
66
|
+
readonly publicPath: string & import("effect/Brand").Brand<"@NakafaAI/AksaraPublicPath">;
|
|
67
|
+
readonly questionCount: number;
|
|
68
|
+
readonly scoringStrategy: "irt" | "penalized" | "raw";
|
|
69
|
+
readonly sectionCount: number;
|
|
70
|
+
readonly setKey: string;
|
|
71
|
+
readonly trackKey: string;
|
|
72
|
+
readonly visibleSectionCount: number;
|
|
73
|
+
} | {
|
|
74
|
+
readonly appLocale: ("de" | "en" | "id") & import("effect/Brand").Brand<"@NakafaAI/AksaraAppLocale">;
|
|
75
|
+
readonly description?: string | undefined;
|
|
76
|
+
readonly graph: {
|
|
77
|
+
readonly alignmentId: string;
|
|
78
|
+
readonly assetId: string;
|
|
79
|
+
readonly conceptId: string;
|
|
80
|
+
readonly learningObjectId: string;
|
|
81
|
+
readonly lensId: string;
|
|
82
|
+
};
|
|
83
|
+
readonly sourceRevision: string;
|
|
84
|
+
readonly title: string;
|
|
85
|
+
readonly countryKey: string;
|
|
86
|
+
readonly examKey: string;
|
|
87
|
+
readonly kind: "track";
|
|
88
|
+
readonly order: number;
|
|
89
|
+
readonly publicPath: string & import("effect/Brand").Brand<"@NakafaAI/AksaraPublicPath">;
|
|
90
|
+
readonly questionCount: number;
|
|
91
|
+
readonly sectionCount: number;
|
|
92
|
+
readonly setCount: number;
|
|
93
|
+
readonly trackKey: string;
|
|
94
|
+
readonly trackKind: "institution" | "subject" | "year";
|
|
95
|
+
readonly visibleSectionCount: number;
|
|
96
|
+
} | {
|
|
97
|
+
readonly appLocale: ("de" | "en" | "id") & import("effect/Brand").Brand<"@NakafaAI/AksaraAppLocale">;
|
|
98
|
+
readonly description?: string | undefined;
|
|
99
|
+
readonly graph: {
|
|
100
|
+
readonly alignmentId: string;
|
|
101
|
+
readonly assetId: string;
|
|
102
|
+
readonly conceptId: string;
|
|
103
|
+
readonly learningObjectId: string;
|
|
104
|
+
readonly lensId: string;
|
|
105
|
+
};
|
|
106
|
+
readonly sourceRevision: string;
|
|
107
|
+
readonly title: string;
|
|
108
|
+
readonly countryKey: string;
|
|
109
|
+
readonly examKey: string;
|
|
110
|
+
readonly kind: "exam";
|
|
111
|
+
readonly order: number;
|
|
112
|
+
readonly publicPath: string & import("effect/Brand").Brand<"@NakafaAI/AksaraPublicPath">;
|
|
113
|
+
readonly scoringStrategy: "irt" | "penalized" | "raw";
|
|
114
|
+
} | {
|
|
115
|
+
readonly appLocale: ("de" | "en" | "id") & import("effect/Brand").Brand<"@NakafaAI/AksaraAppLocale">;
|
|
116
|
+
readonly description?: string | undefined;
|
|
117
|
+
readonly graph: {
|
|
118
|
+
readonly alignmentId: string;
|
|
119
|
+
readonly assetId: string;
|
|
120
|
+
readonly conceptId: string;
|
|
121
|
+
readonly learningObjectId: string;
|
|
122
|
+
readonly lensId: string;
|
|
123
|
+
};
|
|
124
|
+
readonly sourceRevision: string;
|
|
125
|
+
readonly title: string;
|
|
126
|
+
readonly countryCode: string;
|
|
127
|
+
readonly countryKey: string;
|
|
128
|
+
readonly kind: "country";
|
|
129
|
+
readonly order: number;
|
|
130
|
+
readonly publicPath: string & import("effect/Brand").Brand<"@NakafaAI/AksaraPublicPath">;
|
|
131
|
+
}) => Effect.Effect<{
|
|
132
|
+
readonly row: {
|
|
133
|
+
readonly appLocale: ("de" | "en" | "id") & import("effect/Brand").Brand<"@NakafaAI/AksaraAppLocale">;
|
|
134
|
+
readonly description?: string | undefined;
|
|
135
|
+
readonly graph: {
|
|
136
|
+
readonly alignmentId: string;
|
|
137
|
+
readonly assetId: string;
|
|
138
|
+
readonly conceptId: string;
|
|
139
|
+
readonly learningObjectId: string;
|
|
140
|
+
readonly lensId: string;
|
|
141
|
+
};
|
|
142
|
+
readonly sourceRevision: string;
|
|
143
|
+
readonly title: string;
|
|
144
|
+
readonly countryKey: string;
|
|
145
|
+
readonly examKey: string;
|
|
146
|
+
readonly kind: "section";
|
|
147
|
+
readonly marks?: {
|
|
148
|
+
readonly blank: number;
|
|
149
|
+
readonly correct: number;
|
|
150
|
+
readonly wrong: number;
|
|
151
|
+
};
|
|
152
|
+
readonly order: number;
|
|
153
|
+
readonly publicPath?: (string & import("effect/Brand").Brand<"@NakafaAI/AksaraPublicPath">) | undefined;
|
|
154
|
+
readonly questionCount: number;
|
|
155
|
+
readonly questionSourcePath: string & import("effect/Brand").Brand<"@NakafaAI/AksaraCorpusSourcePath">;
|
|
156
|
+
readonly sectionKey: string;
|
|
157
|
+
readonly setKey: string;
|
|
158
|
+
readonly timeLimitSeconds: number;
|
|
159
|
+
readonly trackKey: string;
|
|
160
|
+
readonly visibility: "internal-entry" | "visible";
|
|
161
|
+
} | {
|
|
162
|
+
readonly appLocale: ("de" | "en" | "id") & import("effect/Brand").Brand<"@NakafaAI/AksaraAppLocale">;
|
|
163
|
+
readonly description?: string | undefined;
|
|
164
|
+
readonly graph: {
|
|
165
|
+
readonly alignmentId: string;
|
|
166
|
+
readonly assetId: string;
|
|
167
|
+
readonly conceptId: string;
|
|
168
|
+
readonly learningObjectId: string;
|
|
169
|
+
readonly lensId: string;
|
|
170
|
+
};
|
|
171
|
+
readonly sourceRevision: string;
|
|
172
|
+
readonly title: string;
|
|
173
|
+
readonly countryKey: string;
|
|
174
|
+
readonly examKey: string;
|
|
175
|
+
readonly internalEntrySectionKey?: string | undefined;
|
|
176
|
+
readonly kind: "set";
|
|
177
|
+
readonly order: number;
|
|
178
|
+
readonly publicPath: string & import("effect/Brand").Brand<"@NakafaAI/AksaraPublicPath">;
|
|
179
|
+
readonly questionCount: number;
|
|
180
|
+
readonly scoringStrategy: "irt" | "penalized" | "raw";
|
|
181
|
+
readonly sectionCount: number;
|
|
182
|
+
readonly setKey: string;
|
|
183
|
+
readonly trackKey: string;
|
|
184
|
+
readonly visibleSectionCount: number;
|
|
185
|
+
} | {
|
|
186
|
+
readonly appLocale: ("de" | "en" | "id") & import("effect/Brand").Brand<"@NakafaAI/AksaraAppLocale">;
|
|
187
|
+
readonly description?: string | undefined;
|
|
188
|
+
readonly graph: {
|
|
189
|
+
readonly alignmentId: string;
|
|
190
|
+
readonly assetId: string;
|
|
191
|
+
readonly conceptId: string;
|
|
192
|
+
readonly learningObjectId: string;
|
|
193
|
+
readonly lensId: string;
|
|
194
|
+
};
|
|
195
|
+
readonly sourceRevision: string;
|
|
196
|
+
readonly title: string;
|
|
197
|
+
readonly countryKey: string;
|
|
198
|
+
readonly examKey: string;
|
|
199
|
+
readonly kind: "track";
|
|
200
|
+
readonly order: number;
|
|
201
|
+
readonly publicPath: string & import("effect/Brand").Brand<"@NakafaAI/AksaraPublicPath">;
|
|
202
|
+
readonly questionCount: number;
|
|
203
|
+
readonly sectionCount: number;
|
|
204
|
+
readonly setCount: number;
|
|
205
|
+
readonly trackKey: string;
|
|
206
|
+
readonly trackKind: "institution" | "subject" | "year";
|
|
207
|
+
readonly visibleSectionCount: number;
|
|
208
|
+
} | {
|
|
209
|
+
readonly appLocale: ("de" | "en" | "id") & import("effect/Brand").Brand<"@NakafaAI/AksaraAppLocale">;
|
|
210
|
+
readonly description?: string | undefined;
|
|
211
|
+
readonly graph: {
|
|
212
|
+
readonly alignmentId: string;
|
|
213
|
+
readonly assetId: string;
|
|
214
|
+
readonly conceptId: string;
|
|
215
|
+
readonly learningObjectId: string;
|
|
216
|
+
readonly lensId: string;
|
|
217
|
+
};
|
|
218
|
+
readonly sourceRevision: string;
|
|
219
|
+
readonly title: string;
|
|
220
|
+
readonly countryKey: string;
|
|
221
|
+
readonly examKey: string;
|
|
222
|
+
readonly kind: "exam";
|
|
223
|
+
readonly order: number;
|
|
224
|
+
readonly publicPath: string & import("effect/Brand").Brand<"@NakafaAI/AksaraPublicPath">;
|
|
225
|
+
readonly scoringStrategy: "irt" | "penalized" | "raw";
|
|
226
|
+
} | {
|
|
227
|
+
readonly appLocale: ("de" | "en" | "id") & import("effect/Brand").Brand<"@NakafaAI/AksaraAppLocale">;
|
|
228
|
+
readonly description?: string | undefined;
|
|
229
|
+
readonly graph: {
|
|
230
|
+
readonly alignmentId: string;
|
|
231
|
+
readonly assetId: string;
|
|
232
|
+
readonly conceptId: string;
|
|
233
|
+
readonly learningObjectId: string;
|
|
234
|
+
readonly lensId: string;
|
|
235
|
+
};
|
|
236
|
+
readonly sourceRevision: string;
|
|
237
|
+
readonly title: string;
|
|
238
|
+
readonly countryCode: string;
|
|
239
|
+
readonly countryKey: string;
|
|
240
|
+
readonly kind: "country";
|
|
241
|
+
readonly order: number;
|
|
242
|
+
readonly publicPath: string & import("effect/Brand").Brand<"@NakafaAI/AksaraPublicPath">;
|
|
243
|
+
};
|
|
244
|
+
readonly rowHash: string & import("effect/Brand").Brand<"@NakafaAI/AksaraSha256Hash">;
|
|
245
|
+
}, import("#contracts/tryout/canonical").TryoutCanonicalHashError, never>;
|
|
21
246
|
/** Digests canonically ordered current hierarchy records. */
|
|
22
247
|
export declare const digestTryoutCatalog: <E, R>(records: Stream.Stream<{
|
|
23
248
|
readonly row: {
|
|
@@ -136,4 +361,4 @@ export declare const digestTryoutCatalog: <E, R>(records: Stream.Stream<{
|
|
|
136
361
|
}, E, R>) => Effect.Effect<{
|
|
137
362
|
count: number;
|
|
138
363
|
digest: string & import("effect/Brand").Brand<"@NakafaAI/AksaraSha256Hash">;
|
|
139
|
-
}, E | import("#contracts/tryout/digest").TryoutDigestError, R>;
|
|
364
|
+
}, E | import("effect/PlatformError").PlatformError | import("#contracts/tryout/canonical").TryoutCanonicalHashError | import("#contracts/tryout/digest").TryoutDigestError, R>;
|
|
@@ -193,12 +193,10 @@ export function canonicalizeTryoutCatalog(row) {
|
|
|
193
193
|
});
|
|
194
194
|
}
|
|
195
195
|
/** Creates one authenticated current hierarchy record. */
|
|
196
|
-
export
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
});
|
|
201
|
-
}
|
|
196
|
+
export const makeTryoutCatalogRecord = Effect.fn("AksaraContracts.makeTryoutCatalogRecord")(function* (row) {
|
|
197
|
+
const rowHash = yield* hashTryoutCanonical(CATALOG_DOMAIN, canonicalizeTryoutCatalog(row));
|
|
198
|
+
return TryoutCatalogRecordSchema.make({ row, rowHash });
|
|
199
|
+
});
|
|
202
200
|
/** Digests canonically ordered current hierarchy records. */
|
|
203
201
|
export const digestTryoutCatalog = Effect.fn("AksaraContracts.digestTryoutCatalog")(function* (records) {
|
|
204
202
|
return yield* digestTryoutRecords({
|
|
@@ -206,6 +204,6 @@ export const digestTryoutCatalog = Effect.fn("AksaraContracts.digestTryoutCatalo
|
|
|
206
204
|
domain: CATALOG_DOMAIN,
|
|
207
205
|
identity: tryoutCatalogIdentity,
|
|
208
206
|
records,
|
|
209
|
-
rowHash: (row) => makeTryoutCatalogRecord(row).rowHash,
|
|
207
|
+
rowHash: (row) => makeTryoutCatalogRecord(row).pipe(Effect.map((record) => record.rowHash)),
|
|
210
208
|
});
|
|
211
209
|
});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Schema } from "effect";
|
|
1
|
+
import { Effect, Schema } from "effect";
|
|
2
2
|
/** Exact authored facts that define one app and delivery-language question. */
|
|
3
3
|
export declare const TryoutContentInputSchema: Schema.Struct<{
|
|
4
4
|
readonly dateModified: Schema.optionalKey<Schema.String>;
|
|
@@ -100,5 +100,116 @@ export declare const TryoutContentInputSchema: Schema.Struct<{
|
|
|
100
100
|
export type TryoutContentInput = typeof TryoutContentInputSchema.Type;
|
|
101
101
|
/** Serializes every current question-pair identity field in stable order. */
|
|
102
102
|
export declare function canonicalizeTryoutContent(input: TryoutContentInput): string;
|
|
103
|
+
declare const TryoutContentHashError_base: Schema.Class<TryoutContentHashError, Schema.TaggedStruct<"TryoutContentHashError", {}>, import("effect/Cause").YieldableError & {
|
|
104
|
+
readonly brand: unique symbol;
|
|
105
|
+
}>;
|
|
106
|
+
/** Web Crypto could not hash one canonical try-out content identity. */
|
|
107
|
+
export declare class TryoutContentHashError extends TryoutContentHashError_base {
|
|
108
|
+
}
|
|
103
109
|
/** Hashes one complete current question pair through its canonical identity. */
|
|
104
|
-
export declare
|
|
110
|
+
export declare const hashTryoutContent: (input: {
|
|
111
|
+
readonly dateModified?: string;
|
|
112
|
+
readonly datePublished: string;
|
|
113
|
+
readonly answerArtifactLocale: ("de" | "en" | "id") & import("effect/Brand").Brand<"@NakafaAI/AksaraArtifactLocale">;
|
|
114
|
+
readonly answerBody: string;
|
|
115
|
+
readonly appLocale: ("de" | "en" | "id") & import("effect/Brand").Brand<"@NakafaAI/AksaraAppLocale">;
|
|
116
|
+
readonly blueprint?: {
|
|
117
|
+
readonly cognitiveLevel: string;
|
|
118
|
+
readonly contentDomain: string;
|
|
119
|
+
readonly topic: string;
|
|
120
|
+
};
|
|
121
|
+
readonly deliveryLanguage: ("de" | "en" | "id") & import("effect/Brand").Brand<"@NakafaAI/AksaraDeliveryLanguage">;
|
|
122
|
+
readonly languagePolicy: {
|
|
123
|
+
readonly kind: "app-locale";
|
|
124
|
+
} | {
|
|
125
|
+
readonly kind: "fixed";
|
|
126
|
+
readonly language: ("de" | "en" | "id") & import("effect/Brand").Brand<"@NakafaAI/AksaraDeliveryLanguage">;
|
|
127
|
+
};
|
|
128
|
+
readonly questionArtifactLocale: ("de" | "en" | "id") & import("effect/Brand").Brand<"@NakafaAI/AksaraArtifactLocale">;
|
|
129
|
+
readonly questionBody: string;
|
|
130
|
+
readonly response: {
|
|
131
|
+
readonly categories: readonly {
|
|
132
|
+
readonly categoryKey: string;
|
|
133
|
+
readonly label: string;
|
|
134
|
+
readonly order: number;
|
|
135
|
+
}[];
|
|
136
|
+
readonly kind: "category";
|
|
137
|
+
readonly statements: readonly {
|
|
138
|
+
readonly correctCategoryKey: string;
|
|
139
|
+
readonly label: string;
|
|
140
|
+
readonly order: number;
|
|
141
|
+
readonly statementKey: string;
|
|
142
|
+
}[];
|
|
143
|
+
} | {
|
|
144
|
+
readonly kind: "multiple-choice";
|
|
145
|
+
readonly options: readonly {
|
|
146
|
+
readonly isCorrect: boolean;
|
|
147
|
+
readonly label: string;
|
|
148
|
+
readonly optionKey: string;
|
|
149
|
+
readonly order: number;
|
|
150
|
+
}[];
|
|
151
|
+
} | {
|
|
152
|
+
readonly kind: "single-choice";
|
|
153
|
+
readonly options: readonly {
|
|
154
|
+
readonly isCorrect: boolean;
|
|
155
|
+
readonly label: string;
|
|
156
|
+
readonly optionKey: string;
|
|
157
|
+
readonly order: number;
|
|
158
|
+
}[];
|
|
159
|
+
} | {
|
|
160
|
+
readonly criteria: readonly {
|
|
161
|
+
readonly criterionKey: string;
|
|
162
|
+
readonly finalAnswer?: {
|
|
163
|
+
readonly acceptsFractions: boolean;
|
|
164
|
+
readonly kind: "number";
|
|
165
|
+
readonly tolerance?: {
|
|
166
|
+
readonly kind: "absolute" | "relative";
|
|
167
|
+
readonly value: string;
|
|
168
|
+
};
|
|
169
|
+
readonly value: string;
|
|
170
|
+
} | {
|
|
171
|
+
readonly acceptedAnswers: readonly [string, ...string[]];
|
|
172
|
+
readonly collapseWhitespace: boolean;
|
|
173
|
+
readonly ignoreCase: boolean;
|
|
174
|
+
readonly kind: "text";
|
|
175
|
+
};
|
|
176
|
+
readonly order: number;
|
|
177
|
+
readonly label: {
|
|
178
|
+
readonly de: string;
|
|
179
|
+
readonly en: string;
|
|
180
|
+
readonly id: string;
|
|
181
|
+
};
|
|
182
|
+
readonly levels: readonly {
|
|
183
|
+
readonly levelKey: string;
|
|
184
|
+
readonly order: number;
|
|
185
|
+
readonly points: number;
|
|
186
|
+
readonly label: {
|
|
187
|
+
readonly de: string;
|
|
188
|
+
readonly en: string;
|
|
189
|
+
readonly id: string;
|
|
190
|
+
};
|
|
191
|
+
}[];
|
|
192
|
+
}[];
|
|
193
|
+
readonly kind: "rubric";
|
|
194
|
+
} | {
|
|
195
|
+
readonly key: {
|
|
196
|
+
readonly acceptsFractions: boolean;
|
|
197
|
+
readonly kind: "number";
|
|
198
|
+
readonly tolerance?: {
|
|
199
|
+
readonly kind: "absolute" | "relative";
|
|
200
|
+
readonly value: string;
|
|
201
|
+
};
|
|
202
|
+
readonly value: string;
|
|
203
|
+
} | {
|
|
204
|
+
readonly acceptedAnswers: readonly [string, ...string[]];
|
|
205
|
+
readonly collapseWhitespace: boolean;
|
|
206
|
+
readonly ignoreCase: boolean;
|
|
207
|
+
readonly kind: "text";
|
|
208
|
+
};
|
|
209
|
+
readonly kind: "short-answer";
|
|
210
|
+
};
|
|
211
|
+
readonly sourcePath: string & import("effect/Brand").Brand<"@NakafaAI/AksaraQuestionKey">;
|
|
212
|
+
readonly sourceRevision: string;
|
|
213
|
+
readonly stimulusKey?: string;
|
|
214
|
+
}) => Effect.Effect<string & import("effect/Brand").Brand<"@NakafaAI/AksaraTryoutContentHash">, TryoutContentHashError, never>;
|
|
215
|
+
export {};
|