@nakafa/aksara-contracts 1.0.0 → 2.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 +15 -32
- 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 +348 -208
- 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/preview/artifact.d.ts +1 -120
- 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/projection/digest.d.ts +0 -127
- package/dist/projection/hash.d.ts +0 -127
- package/dist/projection/spec.d.ts +6 -211
- package/dist/projection/spec.js +4 -18
- package/dist/projection/verify.d.ts +0 -127
- package/dist/projection/verify.js +0 -3
- 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 +2 -2
- package/dist/release/hash.d.ts +5 -5
- 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 +2 -2
- 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 +6 -18
- package/dist/release/result/digest.js +1 -2
- package/dist/release/rollback/digest.d.ts +4 -19
- package/dist/release/rollback/spec.d.ts +30 -792
- package/dist/release/rollback/spec.js +1 -4
- 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/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 +5 -5
- package/dist/runtime/spec.d.ts +38 -38
- package/dist/runtime/spec.js +4 -5
- package/dist/runtime/verify.d.ts +40 -40
- package/dist/signature/spec.d.ts +5 -5
- package/dist/signature/spec.js +0 -1
- package/dist/signature/trusted.d.ts +4 -1
- package/dist/signature/trusted.js +4 -1
- 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/package.json +187 -295
- 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,215 +0,0 @@
|
|
|
1
|
-
import { Effect, Schema } from "effect";
|
|
2
|
-
/** Exact authored facts that define one app and delivery-language question. */
|
|
3
|
-
export declare const TryoutContentInputSchema: Schema.Struct<{
|
|
4
|
-
readonly dateModified: Schema.optionalKey<Schema.String>;
|
|
5
|
-
readonly datePublished: Schema.String;
|
|
6
|
-
readonly answerArtifactLocale: Schema.brand<Schema.Literals<readonly ["en", "id", "de"]>, "@NakafaAI/AksaraArtifactLocale">;
|
|
7
|
-
readonly answerBody: Schema.String;
|
|
8
|
-
readonly appLocale: Schema.brand<Schema.Literals<readonly ["en", "id", "de"]>, "@NakafaAI/AksaraAppLocale">;
|
|
9
|
-
readonly blueprint: Schema.optionalKey<Schema.Struct<{
|
|
10
|
-
readonly cognitiveLevel: Schema.String;
|
|
11
|
-
readonly contentDomain: Schema.String;
|
|
12
|
-
readonly topic: Schema.String;
|
|
13
|
-
}>>;
|
|
14
|
-
readonly deliveryLanguage: Schema.brand<Schema.Literals<readonly ["en", "id", "de"]>, "@NakafaAI/AksaraDeliveryLanguage">;
|
|
15
|
-
readonly languagePolicy: Schema.Union<readonly [Schema.Struct<{
|
|
16
|
-
readonly kind: Schema.Literal<"app-locale">;
|
|
17
|
-
}>, Schema.Struct<{
|
|
18
|
-
readonly kind: Schema.Literal<"fixed">;
|
|
19
|
-
readonly language: Schema.brand<Schema.Literals<readonly ["en", "id", "de"]>, "@NakafaAI/AksaraDeliveryLanguage">;
|
|
20
|
-
}>]>;
|
|
21
|
-
readonly questionArtifactLocale: Schema.brand<Schema.Literals<readonly ["en", "id", "de"]>, "@NakafaAI/AksaraArtifactLocale">;
|
|
22
|
-
readonly questionBody: Schema.String;
|
|
23
|
-
readonly response: Schema.Union<readonly [Schema.Struct<{
|
|
24
|
-
readonly categories: Schema.$Array<Schema.Struct<{
|
|
25
|
-
readonly categoryKey: Schema.String;
|
|
26
|
-
readonly label: Schema.String;
|
|
27
|
-
readonly order: Schema.Int;
|
|
28
|
-
}>>;
|
|
29
|
-
readonly kind: Schema.Literal<"category">;
|
|
30
|
-
readonly statements: Schema.$Array<Schema.Struct<{
|
|
31
|
-
readonly correctCategoryKey: Schema.String;
|
|
32
|
-
readonly label: Schema.String;
|
|
33
|
-
readonly order: Schema.Int;
|
|
34
|
-
readonly statementKey: Schema.String;
|
|
35
|
-
}>>;
|
|
36
|
-
}>, Schema.Struct<{
|
|
37
|
-
readonly kind: Schema.Literal<"multiple-choice">;
|
|
38
|
-
readonly options: Schema.$Array<Schema.Struct<{
|
|
39
|
-
readonly isCorrect: Schema.Boolean;
|
|
40
|
-
readonly label: Schema.String;
|
|
41
|
-
readonly optionKey: Schema.String;
|
|
42
|
-
readonly order: Schema.Int;
|
|
43
|
-
}>>;
|
|
44
|
-
}>, Schema.Struct<{
|
|
45
|
-
readonly criteria: Schema.$Array<Schema.Struct<{
|
|
46
|
-
readonly criterionKey: Schema.String;
|
|
47
|
-
readonly finalAnswer: Schema.optionalKey<Schema.Union<readonly [Schema.Struct<{
|
|
48
|
-
readonly acceptsFractions: Schema.Boolean;
|
|
49
|
-
readonly kind: Schema.Literal<"number">;
|
|
50
|
-
readonly tolerance: Schema.optionalKey<Schema.Struct<{
|
|
51
|
-
readonly kind: Schema.Literals<readonly ["absolute", "relative"]>;
|
|
52
|
-
readonly value: Schema.String;
|
|
53
|
-
}>>;
|
|
54
|
-
readonly value: Schema.String;
|
|
55
|
-
}>, Schema.Struct<{
|
|
56
|
-
readonly acceptedAnswers: Schema.NonEmptyArray<Schema.Trimmed>;
|
|
57
|
-
readonly collapseWhitespace: Schema.Boolean;
|
|
58
|
-
readonly ignoreCase: Schema.Boolean;
|
|
59
|
-
readonly kind: Schema.Literal<"text">;
|
|
60
|
-
}>]>>;
|
|
61
|
-
readonly order: Schema.Int;
|
|
62
|
-
readonly label: Schema.$Record<Schema.Literals<readonly ["en", "id", "de"]>, Schema.String>;
|
|
63
|
-
readonly levels: Schema.$Array<Schema.Struct<{
|
|
64
|
-
readonly levelKey: Schema.String;
|
|
65
|
-
readonly order: Schema.Int;
|
|
66
|
-
readonly points: Schema.Int;
|
|
67
|
-
readonly label: Schema.$Record<Schema.Literals<readonly ["en", "id", "de"]>, Schema.String>;
|
|
68
|
-
}>>;
|
|
69
|
-
}>>;
|
|
70
|
-
readonly kind: Schema.Literal<"rubric">;
|
|
71
|
-
}>, Schema.Struct<{
|
|
72
|
-
readonly key: Schema.Union<readonly [Schema.Struct<{
|
|
73
|
-
readonly acceptsFractions: Schema.Boolean;
|
|
74
|
-
readonly kind: Schema.Literal<"number">;
|
|
75
|
-
readonly tolerance: Schema.optionalKey<Schema.Struct<{
|
|
76
|
-
readonly kind: Schema.Literals<readonly ["absolute", "relative"]>;
|
|
77
|
-
readonly value: Schema.String;
|
|
78
|
-
}>>;
|
|
79
|
-
readonly value: Schema.String;
|
|
80
|
-
}>, Schema.Struct<{
|
|
81
|
-
readonly acceptedAnswers: Schema.NonEmptyArray<Schema.Trimmed>;
|
|
82
|
-
readonly collapseWhitespace: Schema.Boolean;
|
|
83
|
-
readonly ignoreCase: Schema.Boolean;
|
|
84
|
-
readonly kind: Schema.Literal<"text">;
|
|
85
|
-
}>]>;
|
|
86
|
-
readonly kind: Schema.Literal<"short-answer">;
|
|
87
|
-
}>, Schema.Struct<{
|
|
88
|
-
readonly kind: Schema.Literal<"single-choice">;
|
|
89
|
-
readonly options: Schema.$Array<Schema.Struct<{
|
|
90
|
-
readonly isCorrect: Schema.Boolean;
|
|
91
|
-
readonly label: Schema.String;
|
|
92
|
-
readonly optionKey: Schema.String;
|
|
93
|
-
readonly order: Schema.Int;
|
|
94
|
-
}>>;
|
|
95
|
-
}>]>;
|
|
96
|
-
readonly sourcePath: Schema.brand<Schema.String, "@NakafaAI/AksaraQuestionKey">;
|
|
97
|
-
readonly sourceRevision: Schema.Trimmed;
|
|
98
|
-
readonly stimulusKey: Schema.optionalKey<Schema.String>;
|
|
99
|
-
}>;
|
|
100
|
-
export type TryoutContentInput = typeof TryoutContentInputSchema.Type;
|
|
101
|
-
/** Serializes every current question-pair identity field in stable order. */
|
|
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
|
-
}
|
|
109
|
-
/** Hashes one complete current question pair through its canonical identity. */
|
|
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 {};
|
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
import { Effect, Schema } from "effect";
|
|
2
|
-
import { Hex } from "effect/encoding";
|
|
3
|
-
import { withPublicationDates } from "#contracts/date";
|
|
4
|
-
import { digestSha256 } from "#contracts/hash/digest";
|
|
5
|
-
import { AppLocaleSchema, ArtifactLocaleSchema, DeliveryLanguageSchema, } from "#contracts/locale";
|
|
6
|
-
import { QuestionKeySchema } from "#contracts/question/identity";
|
|
7
|
-
import { canonicalQuestionBlueprint, QuestionBlueprintSchema, } from "#contracts/question/item";
|
|
8
|
-
import { canonicalQuestionResponse, QuestionResponseSchema, } from "#contracts/question/response";
|
|
9
|
-
import { encodeJsonText } from "#contracts/text/json";
|
|
10
|
-
import { TryoutKeySchema } from "#contracts/tryout/key";
|
|
11
|
-
import { AssessmentLanguagePolicySchema, canonicalAssessmentLanguagePolicy, } from "#contracts/tryout/language";
|
|
12
|
-
import { TryoutContentHashSchema, TryoutSourceRevisionSchema, } from "#contracts/tryout/spec";
|
|
13
|
-
const MULTIPLE_NEWLINES = /\n{3,}/gu;
|
|
14
|
-
/** Exact authored facts that define one app and delivery-language question. */
|
|
15
|
-
export const TryoutContentInputSchema = withPublicationDates({
|
|
16
|
-
answerArtifactLocale: ArtifactLocaleSchema,
|
|
17
|
-
answerBody: Schema.String,
|
|
18
|
-
appLocale: AppLocaleSchema,
|
|
19
|
-
blueprint: Schema.optionalKey(QuestionBlueprintSchema),
|
|
20
|
-
deliveryLanguage: DeliveryLanguageSchema,
|
|
21
|
-
languagePolicy: AssessmentLanguagePolicySchema,
|
|
22
|
-
questionArtifactLocale: ArtifactLocaleSchema,
|
|
23
|
-
questionBody: Schema.String,
|
|
24
|
-
response: QuestionResponseSchema,
|
|
25
|
-
sourcePath: QuestionKeySchema,
|
|
26
|
-
sourceRevision: TryoutSourceRevisionSchema,
|
|
27
|
-
stimulusKey: Schema.optionalKey(TryoutKeySchema),
|
|
28
|
-
}).pipe(Schema.check(Schema.makeFilter(({ answerArtifactLocale, appLocale, deliveryLanguage, questionArtifactLocale, }) => String(answerArtifactLocale) === String(appLocale) &&
|
|
29
|
-
String(questionArtifactLocale) === String(deliveryLanguage), {
|
|
30
|
-
message: "Expected answer locale to match app locale and question locale to match delivery language.",
|
|
31
|
-
})));
|
|
32
|
-
/** Normalizes authored body spacing without changing MDX markup. */
|
|
33
|
-
function normalizeBody(body) {
|
|
34
|
-
return body.replace(MULTIPLE_NEWLINES, "\n\n").trim();
|
|
35
|
-
}
|
|
36
|
-
/** Converts one validated date-only value to its UTC midnight epoch. */
|
|
37
|
-
function dateEpoch(date) {
|
|
38
|
-
const year = Number.parseInt(date.slice(0, 4), 10);
|
|
39
|
-
const month = Number.parseInt(date.slice(5, 7), 10);
|
|
40
|
-
const day = Number.parseInt(date.slice(8, 10), 10);
|
|
41
|
-
return Date.UTC(year, month - 1, day);
|
|
42
|
-
}
|
|
43
|
-
/** Serializes every current question-pair identity field in stable order. */
|
|
44
|
-
export function canonicalizeTryoutContent(input) {
|
|
45
|
-
return encodeJsonText({
|
|
46
|
-
answerArtifactLocale: input.answerArtifactLocale,
|
|
47
|
-
answerBody: normalizeBody(input.answerBody),
|
|
48
|
-
appLocale: input.appLocale,
|
|
49
|
-
...(input.blueprint === undefined
|
|
50
|
-
? {}
|
|
51
|
-
: { blueprint: canonicalQuestionBlueprint(input.blueprint) }),
|
|
52
|
-
...(input.dateModified === undefined
|
|
53
|
-
? {}
|
|
54
|
-
: { dateModified: dateEpoch(input.dateModified) }),
|
|
55
|
-
datePublished: dateEpoch(input.datePublished),
|
|
56
|
-
deliveryLanguage: input.deliveryLanguage,
|
|
57
|
-
languagePolicy: canonicalAssessmentLanguagePolicy(input.languagePolicy),
|
|
58
|
-
questionArtifactLocale: input.questionArtifactLocale,
|
|
59
|
-
questionBody: normalizeBody(input.questionBody),
|
|
60
|
-
response: canonicalQuestionResponse(input.response),
|
|
61
|
-
sourcePath: input.sourcePath,
|
|
62
|
-
sourceRevision: input.sourceRevision,
|
|
63
|
-
...(input.stimulusKey === undefined
|
|
64
|
-
? {}
|
|
65
|
-
: { stimulusKey: input.stimulusKey }),
|
|
66
|
-
});
|
|
67
|
-
}
|
|
68
|
-
/** Web Crypto could not hash one canonical try-out content identity. */
|
|
69
|
-
export class TryoutContentHashError extends Schema.TaggedError()("TryoutContentHashError", {}) {
|
|
70
|
-
}
|
|
71
|
-
/** Hashes one complete current question pair through its canonical identity. */
|
|
72
|
-
export const hashTryoutContent = Effect.fn("AksaraContracts.hashTryoutContent")(function* (input) {
|
|
73
|
-
const digest = yield* digestSha256(new TextEncoder().encode(canonicalizeTryoutContent(input))).pipe(Effect.mapError(() => new TryoutContentHashError()));
|
|
74
|
-
return TryoutContentHashSchema.make(Hex.encode(digest));
|
|
75
|
-
});
|
|
@@ -1,242 +0,0 @@
|
|
|
1
|
-
import { Effect, type Stream } from "effect";
|
|
2
|
-
import { type TryoutPlacement, type TryoutPlacementRecord } from "#contracts/tryout/placement";
|
|
3
|
-
/** Serializes one artifact-bound placement with stable field order. */
|
|
4
|
-
export declare function canonicalizeTryoutPlacement(row: TryoutPlacement): string;
|
|
5
|
-
/** Creates one immutable authenticated placement record. */
|
|
6
|
-
export declare const makeTryoutPlacementRecord: (row: {
|
|
7
|
-
readonly answerArtifactLocale: ("de" | "en" | "id") & import("effect/Brand").Brand<"@NakafaAI/AksaraArtifactLocale">;
|
|
8
|
-
readonly answerContentKey: string & import("effect/Brand").Brand<"@NakafaAI/AksaraContentKey">;
|
|
9
|
-
readonly appLocale: ("de" | "en" | "id") & import("effect/Brand").Brand<"@NakafaAI/AksaraAppLocale">;
|
|
10
|
-
readonly blueprint?: {
|
|
11
|
-
readonly cognitiveLevel: string;
|
|
12
|
-
readonly contentDomain: string;
|
|
13
|
-
readonly topic: string;
|
|
14
|
-
};
|
|
15
|
-
readonly countryKey: string;
|
|
16
|
-
readonly deliveryLanguage: ("de" | "en" | "id") & import("effect/Brand").Brand<"@NakafaAI/AksaraDeliveryLanguage">;
|
|
17
|
-
readonly examKey: string;
|
|
18
|
-
readonly languagePolicy: {
|
|
19
|
-
readonly kind: "app-locale";
|
|
20
|
-
} | {
|
|
21
|
-
readonly kind: "fixed";
|
|
22
|
-
readonly language: ("de" | "en" | "id") & import("effect/Brand").Brand<"@NakafaAI/AksaraDeliveryLanguage">;
|
|
23
|
-
};
|
|
24
|
-
readonly points?: number;
|
|
25
|
-
readonly questionArtifactLocale: ("de" | "en" | "id") & import("effect/Brand").Brand<"@NakafaAI/AksaraArtifactLocale">;
|
|
26
|
-
readonly questionContentKey: string & import("effect/Brand").Brand<"@NakafaAI/AksaraContentKey">;
|
|
27
|
-
readonly questionOrder: number;
|
|
28
|
-
readonly questionSourcePath: string & import("effect/Brand").Brand<"@NakafaAI/AksaraCorpusSourcePath">;
|
|
29
|
-
readonly rendererDomain: "ai-ds" | "biology" | "chemistry" | "mathematics" | "physics" | "politics" | "site" | "snbt-general" | "snbt-math" | "snbt-plain" | "snbt-quant" | "tka-math";
|
|
30
|
-
readonly response: {
|
|
31
|
-
readonly kind: "single-choice";
|
|
32
|
-
readonly options: readonly {
|
|
33
|
-
readonly isCorrect: boolean;
|
|
34
|
-
readonly label: string;
|
|
35
|
-
readonly optionKey: string;
|
|
36
|
-
readonly order: number;
|
|
37
|
-
}[];
|
|
38
|
-
} | {
|
|
39
|
-
readonly kind: "multiple-choice";
|
|
40
|
-
readonly options: readonly {
|
|
41
|
-
readonly isCorrect: boolean;
|
|
42
|
-
readonly label: string;
|
|
43
|
-
readonly optionKey: string;
|
|
44
|
-
readonly order: number;
|
|
45
|
-
}[];
|
|
46
|
-
} | {
|
|
47
|
-
readonly categories: readonly {
|
|
48
|
-
readonly categoryKey: string;
|
|
49
|
-
readonly label: string;
|
|
50
|
-
readonly order: number;
|
|
51
|
-
}[];
|
|
52
|
-
readonly kind: "category";
|
|
53
|
-
readonly statements: readonly {
|
|
54
|
-
readonly correctCategoryKey: string;
|
|
55
|
-
readonly label: string;
|
|
56
|
-
readonly order: number;
|
|
57
|
-
readonly statementKey: string;
|
|
58
|
-
}[];
|
|
59
|
-
} | {
|
|
60
|
-
readonly criteria: readonly {
|
|
61
|
-
readonly criterionKey: string;
|
|
62
|
-
readonly finalAnswer?: {
|
|
63
|
-
readonly acceptsFractions: boolean;
|
|
64
|
-
readonly kind: "number";
|
|
65
|
-
readonly tolerance?: {
|
|
66
|
-
readonly kind: "absolute" | "relative";
|
|
67
|
-
readonly value: string;
|
|
68
|
-
};
|
|
69
|
-
readonly value: string;
|
|
70
|
-
} | {
|
|
71
|
-
readonly acceptedAnswers: readonly [string, ...string[]];
|
|
72
|
-
readonly collapseWhitespace: boolean;
|
|
73
|
-
readonly ignoreCase: boolean;
|
|
74
|
-
readonly kind: "text";
|
|
75
|
-
};
|
|
76
|
-
readonly order: number;
|
|
77
|
-
readonly label: {
|
|
78
|
-
readonly de: string;
|
|
79
|
-
readonly en: string;
|
|
80
|
-
readonly id: string;
|
|
81
|
-
};
|
|
82
|
-
readonly levels: readonly {
|
|
83
|
-
readonly levelKey: string;
|
|
84
|
-
readonly order: number;
|
|
85
|
-
readonly points: number;
|
|
86
|
-
readonly label: {
|
|
87
|
-
readonly de: string;
|
|
88
|
-
readonly en: string;
|
|
89
|
-
readonly id: string;
|
|
90
|
-
};
|
|
91
|
-
}[];
|
|
92
|
-
}[];
|
|
93
|
-
readonly kind: "rubric";
|
|
94
|
-
} | {
|
|
95
|
-
readonly key: {
|
|
96
|
-
readonly acceptsFractions: boolean;
|
|
97
|
-
readonly kind: "number";
|
|
98
|
-
readonly tolerance?: {
|
|
99
|
-
readonly kind: "absolute" | "relative";
|
|
100
|
-
readonly value: string;
|
|
101
|
-
};
|
|
102
|
-
readonly value: string;
|
|
103
|
-
} | {
|
|
104
|
-
readonly acceptedAnswers: readonly [string, ...string[]];
|
|
105
|
-
readonly collapseWhitespace: boolean;
|
|
106
|
-
readonly ignoreCase: boolean;
|
|
107
|
-
readonly kind: "text";
|
|
108
|
-
};
|
|
109
|
-
readonly kind: "short-answer";
|
|
110
|
-
};
|
|
111
|
-
readonly scope: "server";
|
|
112
|
-
readonly sectionKey: string;
|
|
113
|
-
readonly setKey: string;
|
|
114
|
-
readonly sourceRevision: string;
|
|
115
|
-
readonly stimulusKey?: string;
|
|
116
|
-
readonly trackKey: string;
|
|
117
|
-
readonly answerArtifactHash: string & import("effect/Brand").Brand<"@NakafaAI/AksaraSha256Hash">;
|
|
118
|
-
readonly contentHash: string & import("effect/Brand").Brand<"@NakafaAI/AksaraTryoutContentHash">;
|
|
119
|
-
readonly questionArtifactHash: string & import("effect/Brand").Brand<"@NakafaAI/AksaraSha256Hash">;
|
|
120
|
-
}) => Effect.Effect<{
|
|
121
|
-
readonly row: {
|
|
122
|
-
readonly answerArtifactLocale: ("de" | "en" | "id") & import("effect/Brand").Brand<"@NakafaAI/AksaraArtifactLocale">;
|
|
123
|
-
readonly answerContentKey: string & import("effect/Brand").Brand<"@NakafaAI/AksaraContentKey">;
|
|
124
|
-
readonly appLocale: ("de" | "en" | "id") & import("effect/Brand").Brand<"@NakafaAI/AksaraAppLocale">;
|
|
125
|
-
readonly blueprint?: {
|
|
126
|
-
readonly cognitiveLevel: string;
|
|
127
|
-
readonly contentDomain: string;
|
|
128
|
-
readonly topic: string;
|
|
129
|
-
};
|
|
130
|
-
readonly countryKey: string;
|
|
131
|
-
readonly deliveryLanguage: ("de" | "en" | "id") & import("effect/Brand").Brand<"@NakafaAI/AksaraDeliveryLanguage">;
|
|
132
|
-
readonly examKey: string;
|
|
133
|
-
readonly languagePolicy: {
|
|
134
|
-
readonly kind: "app-locale";
|
|
135
|
-
} | {
|
|
136
|
-
readonly kind: "fixed";
|
|
137
|
-
readonly language: ("de" | "en" | "id") & import("effect/Brand").Brand<"@NakafaAI/AksaraDeliveryLanguage">;
|
|
138
|
-
};
|
|
139
|
-
readonly points?: number;
|
|
140
|
-
readonly questionArtifactLocale: ("de" | "en" | "id") & import("effect/Brand").Brand<"@NakafaAI/AksaraArtifactLocale">;
|
|
141
|
-
readonly questionContentKey: string & import("effect/Brand").Brand<"@NakafaAI/AksaraContentKey">;
|
|
142
|
-
readonly questionOrder: number;
|
|
143
|
-
readonly questionSourcePath: string & import("effect/Brand").Brand<"@NakafaAI/AksaraCorpusSourcePath">;
|
|
144
|
-
readonly rendererDomain: "ai-ds" | "biology" | "chemistry" | "mathematics" | "physics" | "politics" | "site" | "snbt-general" | "snbt-math" | "snbt-plain" | "snbt-quant" | "tka-math";
|
|
145
|
-
readonly response: {
|
|
146
|
-
readonly kind: "single-choice";
|
|
147
|
-
readonly options: readonly {
|
|
148
|
-
readonly isCorrect: boolean;
|
|
149
|
-
readonly label: string;
|
|
150
|
-
readonly optionKey: string;
|
|
151
|
-
readonly order: number;
|
|
152
|
-
}[];
|
|
153
|
-
} | {
|
|
154
|
-
readonly kind: "multiple-choice";
|
|
155
|
-
readonly options: readonly {
|
|
156
|
-
readonly isCorrect: boolean;
|
|
157
|
-
readonly label: string;
|
|
158
|
-
readonly optionKey: string;
|
|
159
|
-
readonly order: number;
|
|
160
|
-
}[];
|
|
161
|
-
} | {
|
|
162
|
-
readonly categories: readonly {
|
|
163
|
-
readonly categoryKey: string;
|
|
164
|
-
readonly label: string;
|
|
165
|
-
readonly order: number;
|
|
166
|
-
}[];
|
|
167
|
-
readonly kind: "category";
|
|
168
|
-
readonly statements: readonly {
|
|
169
|
-
readonly correctCategoryKey: string;
|
|
170
|
-
readonly label: string;
|
|
171
|
-
readonly order: number;
|
|
172
|
-
readonly statementKey: string;
|
|
173
|
-
}[];
|
|
174
|
-
} | {
|
|
175
|
-
readonly criteria: readonly {
|
|
176
|
-
readonly criterionKey: string;
|
|
177
|
-
readonly finalAnswer?: {
|
|
178
|
-
readonly acceptsFractions: boolean;
|
|
179
|
-
readonly kind: "number";
|
|
180
|
-
readonly tolerance?: {
|
|
181
|
-
readonly kind: "absolute" | "relative";
|
|
182
|
-
readonly value: string;
|
|
183
|
-
};
|
|
184
|
-
readonly value: string;
|
|
185
|
-
} | {
|
|
186
|
-
readonly acceptedAnswers: readonly [string, ...string[]];
|
|
187
|
-
readonly collapseWhitespace: boolean;
|
|
188
|
-
readonly ignoreCase: boolean;
|
|
189
|
-
readonly kind: "text";
|
|
190
|
-
};
|
|
191
|
-
readonly order: number;
|
|
192
|
-
readonly label: {
|
|
193
|
-
readonly de: string;
|
|
194
|
-
readonly en: string;
|
|
195
|
-
readonly id: string;
|
|
196
|
-
};
|
|
197
|
-
readonly levels: readonly {
|
|
198
|
-
readonly levelKey: string;
|
|
199
|
-
readonly order: number;
|
|
200
|
-
readonly points: number;
|
|
201
|
-
readonly label: {
|
|
202
|
-
readonly de: string;
|
|
203
|
-
readonly en: string;
|
|
204
|
-
readonly id: string;
|
|
205
|
-
};
|
|
206
|
-
}[];
|
|
207
|
-
}[];
|
|
208
|
-
readonly kind: "rubric";
|
|
209
|
-
} | {
|
|
210
|
-
readonly key: {
|
|
211
|
-
readonly acceptsFractions: boolean;
|
|
212
|
-
readonly kind: "number";
|
|
213
|
-
readonly tolerance?: {
|
|
214
|
-
readonly kind: "absolute" | "relative";
|
|
215
|
-
readonly value: string;
|
|
216
|
-
};
|
|
217
|
-
readonly value: string;
|
|
218
|
-
} | {
|
|
219
|
-
readonly acceptedAnswers: readonly [string, ...string[]];
|
|
220
|
-
readonly collapseWhitespace: boolean;
|
|
221
|
-
readonly ignoreCase: boolean;
|
|
222
|
-
readonly kind: "text";
|
|
223
|
-
};
|
|
224
|
-
readonly kind: "short-answer";
|
|
225
|
-
};
|
|
226
|
-
readonly scope: "server";
|
|
227
|
-
readonly sectionKey: string;
|
|
228
|
-
readonly setKey: string;
|
|
229
|
-
readonly sourceRevision: string;
|
|
230
|
-
readonly stimulusKey?: string;
|
|
231
|
-
readonly trackKey: string;
|
|
232
|
-
readonly answerArtifactHash: string & import("effect/Brand").Brand<"@NakafaAI/AksaraSha256Hash">;
|
|
233
|
-
readonly contentHash: string & import("effect/Brand").Brand<"@NakafaAI/AksaraTryoutContentHash">;
|
|
234
|
-
readonly questionArtifactHash: string & import("effect/Brand").Brand<"@NakafaAI/AksaraSha256Hash">;
|
|
235
|
-
};
|
|
236
|
-
readonly rowHash: string & import("effect/Brand").Brand<"@NakafaAI/AksaraSha256Hash">;
|
|
237
|
-
}, import("#contracts/tryout/canonical").TryoutCanonicalHashError, never>;
|
|
238
|
-
/** Digests canonically ordered placements. Their canonical bytes are held until one Web Crypto digest runs. */
|
|
239
|
-
export declare function digestTryoutPlacements<E, R>(records: Stream.Stream<TryoutPlacementRecord, E, R>): Effect.Effect<{
|
|
240
|
-
count: number;
|
|
241
|
-
digest: string & import("effect/Brand").Brand<"@NakafaAI/AksaraSha256Hash">;
|
|
242
|
-
}, E | import("effect/PlatformError").PlatformError | import("#contracts/tryout/canonical").TryoutCanonicalHashError | import("#contracts/tryout/digest").TryoutDigestError, R>;
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
import { Effect } from "effect";
|
|
2
|
-
import { canonicalQuestionBlueprint } from "#contracts/question/item";
|
|
3
|
-
import { canonicalQuestionResponse } from "#contracts/question/response";
|
|
4
|
-
import { encodeJsonText } from "#contracts/text/json";
|
|
5
|
-
import { hashTryoutCanonical } from "#contracts/tryout/canonical";
|
|
6
|
-
import { digestTryoutRecords } from "#contracts/tryout/digest";
|
|
7
|
-
import { tryoutPlacementIdentity } from "#contracts/tryout/identity";
|
|
8
|
-
import { canonicalAssessmentLanguagePolicy } from "#contracts/tryout/language";
|
|
9
|
-
import { TryoutPlacementRecordSchema, } from "#contracts/tryout/placement";
|
|
10
|
-
const PLACEMENT_DOMAIN = "nakafa.aksara.tryout-placements";
|
|
11
|
-
/** Serializes one artifact-bound placement with stable field order. */
|
|
12
|
-
export function canonicalizeTryoutPlacement(row) {
|
|
13
|
-
return encodeJsonText({
|
|
14
|
-
answerArtifactHash: row.answerArtifactHash,
|
|
15
|
-
answerArtifactLocale: row.answerArtifactLocale,
|
|
16
|
-
answerContentKey: row.answerContentKey,
|
|
17
|
-
appLocale: row.appLocale,
|
|
18
|
-
...(row.blueprint === undefined
|
|
19
|
-
? {}
|
|
20
|
-
: { blueprint: canonicalQuestionBlueprint(row.blueprint) }),
|
|
21
|
-
contentHash: row.contentHash,
|
|
22
|
-
countryKey: row.countryKey,
|
|
23
|
-
deliveryLanguage: row.deliveryLanguage,
|
|
24
|
-
examKey: row.examKey,
|
|
25
|
-
languagePolicy: canonicalAssessmentLanguagePolicy(row.languagePolicy),
|
|
26
|
-
...(row.points === undefined ? {} : { points: row.points }),
|
|
27
|
-
questionArtifactHash: row.questionArtifactHash,
|
|
28
|
-
questionArtifactLocale: row.questionArtifactLocale,
|
|
29
|
-
questionContentKey: row.questionContentKey,
|
|
30
|
-
questionOrder: row.questionOrder,
|
|
31
|
-
questionSourcePath: row.questionSourcePath,
|
|
32
|
-
rendererDomain: row.rendererDomain,
|
|
33
|
-
response: canonicalQuestionResponse(row.response),
|
|
34
|
-
scope: row.scope,
|
|
35
|
-
sectionKey: row.sectionKey,
|
|
36
|
-
setKey: row.setKey,
|
|
37
|
-
sourceRevision: row.sourceRevision,
|
|
38
|
-
...(row.stimulusKey === undefined ? {} : { stimulusKey: row.stimulusKey }),
|
|
39
|
-
trackKey: row.trackKey,
|
|
40
|
-
});
|
|
41
|
-
}
|
|
42
|
-
/** Creates one immutable authenticated placement record. */
|
|
43
|
-
export const makeTryoutPlacementRecord = Effect.fn("AksaraContracts.makeTryoutPlacementRecord")(function* (row) {
|
|
44
|
-
const rowHash = yield* hashTryoutCanonical(PLACEMENT_DOMAIN, canonicalizeTryoutPlacement(row));
|
|
45
|
-
return TryoutPlacementRecordSchema.make({ row, rowHash });
|
|
46
|
-
});
|
|
47
|
-
/** Digests canonically ordered placements. Their canonical bytes are held until one Web Crypto digest runs. */
|
|
48
|
-
export function digestTryoutPlacements(records) {
|
|
49
|
-
return digestTryoutRecords({
|
|
50
|
-
canonicalize: canonicalizeTryoutPlacement,
|
|
51
|
-
domain: PLACEMENT_DOMAIN,
|
|
52
|
-
identity: tryoutPlacementIdentity,
|
|
53
|
-
records,
|
|
54
|
-
rowHash: (row) => makeTryoutPlacementRecord(row).pipe(Effect.map((record) => record.rowHash)),
|
|
55
|
-
});
|
|
56
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import type { TryoutCatalogNodeIdentity, TryoutCatalogRow } from "#contracts/tryout/catalog";
|
|
2
|
-
import type { TryoutPlacementSource } from "#contracts/tryout/placement";
|
|
3
|
-
/** Builds one deterministic current node identity before its row is loaded. */
|
|
4
|
-
export declare function tryoutCatalogNodeIdentity(input: TryoutCatalogNodeIdentity): string;
|
|
5
|
-
/** Builds one deterministic current hierarchy identity from its signed row. */
|
|
6
|
-
export declare function tryoutCatalogIdentity(row: TryoutCatalogRow): string;
|
|
7
|
-
/** Builds the deterministic placement identity across application locales. */
|
|
8
|
-
export declare function tryoutPlacementIdentity(row: TryoutPlacementSource): string;
|
|
9
|
-
/** Builds one locale-neutral placement identity for closure checks. */
|
|
10
|
-
export declare function tryoutPlacementLogicalIdentity(row: TryoutPlacementSource): string;
|
|
11
|
-
/** Compares placements in the order used by question-head binding. */
|
|
12
|
-
export declare function compareTryoutPlacements(left: TryoutPlacementSource, right: TryoutPlacementSource): -1 | 0 | 1;
|
package/dist/tryout/identity.js
DELETED
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import { Array as Arr } from "effect";
|
|
2
|
-
import { compareCodeUnits } from "#contracts/text/order";
|
|
3
|
-
/** Builds one deterministic current node identity before its row is loaded. */
|
|
4
|
-
export function tryoutCatalogNodeIdentity(input) {
|
|
5
|
-
return Arr.join([
|
|
6
|
-
input.appLocale,
|
|
7
|
-
input.kind,
|
|
8
|
-
input.countryKey,
|
|
9
|
-
"examKey" in input ? input.examKey : "",
|
|
10
|
-
"trackKey" in input ? input.trackKey : "",
|
|
11
|
-
"setKey" in input ? input.setKey : "",
|
|
12
|
-
"sectionKey" in input ? input.sectionKey : "",
|
|
13
|
-
], "\0");
|
|
14
|
-
}
|
|
15
|
-
/** Builds one deterministic current hierarchy identity from its signed row. */
|
|
16
|
-
export function tryoutCatalogIdentity(row) {
|
|
17
|
-
return tryoutCatalogNodeIdentity(row);
|
|
18
|
-
}
|
|
19
|
-
/** Builds the deterministic placement identity across application locales. */
|
|
20
|
-
export function tryoutPlacementIdentity(row) {
|
|
21
|
-
return Arr.join(Arr.map([
|
|
22
|
-
row.countryKey,
|
|
23
|
-
row.examKey,
|
|
24
|
-
row.trackKey,
|
|
25
|
-
row.setKey,
|
|
26
|
-
row.sectionKey,
|
|
27
|
-
row.questionOrder,
|
|
28
|
-
row.questionContentKey,
|
|
29
|
-
row.appLocale,
|
|
30
|
-
], String), "\0");
|
|
31
|
-
}
|
|
32
|
-
/** Builds one locale-neutral placement identity for closure checks. */
|
|
33
|
-
export function tryoutPlacementLogicalIdentity(row) {
|
|
34
|
-
return Arr.join(Arr.map([
|
|
35
|
-
row.countryKey,
|
|
36
|
-
row.examKey,
|
|
37
|
-
row.trackKey,
|
|
38
|
-
row.setKey,
|
|
39
|
-
row.sectionKey,
|
|
40
|
-
row.questionOrder,
|
|
41
|
-
row.questionContentKey,
|
|
42
|
-
], String), "\0");
|
|
43
|
-
}
|
|
44
|
-
/** Compares placements in the order used by question-head binding. */
|
|
45
|
-
export function compareTryoutPlacements(left, right) {
|
|
46
|
-
return compareCodeUnits(tryoutPlacementIdentity(left), tryoutPlacementIdentity(right));
|
|
47
|
-
}
|
package/dist/tryout/key.d.ts
DELETED
package/dist/tryout/key.js
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { Schema } from "effect";
|
|
2
|
-
import { isLowerKebab } from "#contracts/text/syntax";
|
|
3
|
-
/** Stable lowercase identity for one try-out hierarchy node. */
|
|
4
|
-
export const TryoutKeySchema = Schema.String.pipe(Schema.check(Schema.makeFilter(isLowerKebab, {
|
|
5
|
-
description: "Lowercase kebab-case try-out source key.",
|
|
6
|
-
identifier: "TryoutKey",
|
|
7
|
-
message: "Invalid try-out key.",
|
|
8
|
-
})), Schema.check(Schema.isMaxLength(128)));
|