@nakafa/aksara-contracts 4.1.2 → 5.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.
@@ -2,10 +2,11 @@ import { Schema } from "effect";
2
2
  /** Bounded authored revision shared by one catalog source hierarchy. */
3
3
  export declare const CatalogRevisionSchema: Schema.Trimmed;
4
4
  /**
5
- * Navigation role of one track: one exam `year`, one `subject`, or the sets of
6
- * one `institution`, such as a Studienkolleg.
5
+ * The one axis by which an exam divides its tracks into groups: the `year` of
6
+ * a sitting (SNBT), the school `grade` a test is set for (TKA), or the
7
+ * `institution` that sets it, such as a Studienkolleg.
7
8
  */
8
- export declare const TrackKindSchema: Schema.Literals<readonly ["institution", "subject", "year"]>;
9
+ export declare const GroupAxisSchema: Schema.Literals<readonly ["grade", "institution", "year"]>;
9
10
  /**
10
11
  * Public route behavior of one section: `visible` sections have a page of
11
12
  * their own, and an `internal-entry` section is entered from its set.
@@ -30,7 +31,7 @@ export declare const CatalogCountrySchema: Schema.Struct<{
30
31
  readonly order: Schema.Int;
31
32
  readonly publicPath: Schema.brand<Schema.String, "@NakafaAI/AksaraPublicPath">;
32
33
  }>;
33
- /** One localized exam of a country. */
34
+ /** One localized exam of a country, and the axis that divides its tracks into groups. */
34
35
  export declare const CatalogExamSchema: Schema.Struct<{
35
36
  readonly appLocale: Schema.brand<Schema.Literals<readonly ["en", "id", "de"]>, "@NakafaAI/AksaraAppLocale">;
36
37
  readonly description: Schema.optionalKey<Schema.String>;
@@ -45,11 +46,37 @@ export declare const CatalogExamSchema: Schema.Struct<{
45
46
  readonly title: Schema.String;
46
47
  readonly countryKey: Schema.String;
47
48
  readonly examKey: Schema.String;
49
+ readonly groupAxis: Schema.Literals<readonly ["grade", "institution", "year"]>;
48
50
  readonly kind: Schema.Literal<"exam">;
49
51
  readonly order: Schema.Int;
50
52
  readonly publicPath: Schema.brand<Schema.String, "@NakafaAI/AksaraPublicPath">;
51
53
  }>;
52
- /** One localized track of an exam: a year, a subject, or an institution. */
54
+ /** One localized group of an exam on its axis: a year, a grade, or an institution. */
55
+ export declare const CatalogGroupSchema: Schema.Struct<{
56
+ readonly appLocale: Schema.brand<Schema.Literals<readonly ["en", "id", "de"]>, "@NakafaAI/AksaraAppLocale">;
57
+ readonly description: Schema.optionalKey<Schema.String>;
58
+ readonly graph: Schema.Struct<{
59
+ readonly alignmentId: Schema.String;
60
+ readonly assetId: Schema.String;
61
+ readonly conceptId: Schema.String;
62
+ readonly learningObjectId: Schema.String;
63
+ readonly lensId: Schema.String;
64
+ }>;
65
+ readonly sourceRevision: Schema.Trimmed;
66
+ readonly title: Schema.String;
67
+ readonly countryKey: Schema.String;
68
+ readonly examKey: Schema.String;
69
+ readonly groupKey: Schema.String;
70
+ readonly kind: Schema.Literal<"group">;
71
+ readonly order: Schema.Int;
72
+ readonly publicPath: Schema.brand<Schema.String, "@NakafaAI/AksaraPublicPath">;
73
+ }>;
74
+ /**
75
+ * One localized track of an exam, in the group that holds it: one paper
76
+ * format with its sets, such as a subject or a year's test. A track key is
77
+ * unique within its exam, so the rows of a track and of its sets name the
78
+ * track without its group.
79
+ */
53
80
  export declare const CatalogTrackSchema: Schema.Struct<{
54
81
  readonly appLocale: Schema.brand<Schema.Literals<readonly ["en", "id", "de"]>, "@NakafaAI/AksaraAppLocale">;
55
82
  readonly description: Schema.optionalKey<Schema.String>;
@@ -65,10 +92,10 @@ export declare const CatalogTrackSchema: Schema.Struct<{
65
92
  readonly countryKey: Schema.String;
66
93
  readonly examKey: Schema.String;
67
94
  readonly trackKey: Schema.String;
95
+ readonly groupKey: Schema.String;
68
96
  readonly kind: Schema.Literal<"track">;
69
97
  readonly order: Schema.Int;
70
98
  readonly publicPath: Schema.brand<Schema.String, "@NakafaAI/AksaraPublicPath">;
71
- readonly trackKind: Schema.Literals<readonly ["institution", "subject", "year"]>;
72
99
  }>;
73
100
  /**
74
101
  * One localized set of a track, and the paper a learner sits for it, by
@@ -159,9 +186,28 @@ export declare const CatalogRowSchema: Schema.Union<readonly [Schema.Struct<{
159
186
  readonly title: Schema.String;
160
187
  readonly countryKey: Schema.String;
161
188
  readonly examKey: Schema.String;
189
+ readonly groupAxis: Schema.Literals<readonly ["grade", "institution", "year"]>;
162
190
  readonly kind: Schema.Literal<"exam">;
163
191
  readonly order: Schema.Int;
164
192
  readonly publicPath: Schema.brand<Schema.String, "@NakafaAI/AksaraPublicPath">;
193
+ }>, Schema.Struct<{
194
+ readonly appLocale: Schema.brand<Schema.Literals<readonly ["en", "id", "de"]>, "@NakafaAI/AksaraAppLocale">;
195
+ readonly description: Schema.optionalKey<Schema.String>;
196
+ readonly graph: Schema.Struct<{
197
+ readonly alignmentId: Schema.String;
198
+ readonly assetId: Schema.String;
199
+ readonly conceptId: Schema.String;
200
+ readonly learningObjectId: Schema.String;
201
+ readonly lensId: Schema.String;
202
+ }>;
203
+ readonly sourceRevision: Schema.Trimmed;
204
+ readonly title: Schema.String;
205
+ readonly countryKey: Schema.String;
206
+ readonly examKey: Schema.String;
207
+ readonly groupKey: Schema.String;
208
+ readonly kind: Schema.Literal<"group">;
209
+ readonly order: Schema.Int;
210
+ readonly publicPath: Schema.brand<Schema.String, "@NakafaAI/AksaraPublicPath">;
165
211
  }>, Schema.Struct<{
166
212
  readonly appLocale: Schema.brand<Schema.Literals<readonly ["en", "id", "de"]>, "@NakafaAI/AksaraAppLocale">;
167
213
  readonly description: Schema.optionalKey<Schema.String>;
@@ -177,10 +223,10 @@ export declare const CatalogRowSchema: Schema.Union<readonly [Schema.Struct<{
177
223
  readonly countryKey: Schema.String;
178
224
  readonly examKey: Schema.String;
179
225
  readonly trackKey: Schema.String;
226
+ readonly groupKey: Schema.String;
180
227
  readonly kind: Schema.Literal<"track">;
181
228
  readonly order: Schema.Int;
182
229
  readonly publicPath: Schema.brand<Schema.String, "@NakafaAI/AksaraPublicPath">;
183
- readonly trackKind: Schema.Literals<readonly ["institution", "subject", "year"]>;
184
230
  }>, Schema.Struct<{
185
231
  readonly appLocale: Schema.brand<Schema.Literals<readonly ["en", "id", "de"]>, "@NakafaAI/AksaraAppLocale">;
186
232
  readonly description: Schema.optionalKey<Schema.String>;
@@ -230,6 +276,8 @@ export declare const CatalogRowSchema: Schema.Union<readonly [Schema.Struct<{
230
276
  export type CatalogRow = typeof CatalogRowSchema.Type;
231
277
  /**
232
278
  * The identity of one catalog row, unique within a snapshot: its locale, its
233
- * kind, and the keys of its node and of every node above it.
279
+ * kind, and the keys of its node and of every node above it. A group names
280
+ * its own key; a track is unique within its exam, so a track and the rows
281
+ * under it leave their group out.
234
282
  */
235
283
  export declare function catalogRowIdentity(row: CatalogRow): string;
@@ -8,12 +8,13 @@ const PositiveCountSchema = Schema.Int.check(Schema.isGreaterThan(0));
8
8
  /** Bounded authored revision shared by one catalog source hierarchy. */
9
9
  export const CatalogRevisionSchema = Schema.Trimmed.check(Schema.isNonEmpty(), Schema.isMaxLength(128));
10
10
  /**
11
- * Navigation role of one track: one exam `year`, one `subject`, or the sets of
12
- * one `institution`, such as a Studienkolleg.
11
+ * The one axis by which an exam divides its tracks into groups: the `year` of
12
+ * a sitting (SNBT), the school `grade` a test is set for (TKA), or the
13
+ * `institution` that sets it, such as a Studienkolleg.
13
14
  */
14
- export const TrackKindSchema = Schema.Literals([
15
+ export const GroupAxisSchema = Schema.Literals([
16
+ "grade",
15
17
  "institution",
16
- "subject",
17
18
  "year",
18
19
  ]);
19
20
  /**
@@ -34,6 +35,7 @@ const LocalizedFields = {
34
35
  };
35
36
  const CountryFields = { countryKey: KebabKeySchema };
36
37
  const ExamFields = { ...CountryFields, examKey: KebabKeySchema };
38
+ const GroupFields = { ...ExamFields, groupKey: KebabKeySchema };
37
39
  const TrackFields = { ...ExamFields, trackKey: KebabKeySchema };
38
40
  const SetFields = { ...TrackFields, setKey: KebabKeySchema };
39
41
  /** One localized country of the catalog. */
@@ -45,22 +47,36 @@ export const CatalogCountrySchema = Schema.Struct({
45
47
  order: PositiveCountSchema,
46
48
  publicPath: PublicPathSchema,
47
49
  });
48
- /** One localized exam of a country. */
50
+ /** One localized exam of a country, and the axis that divides its tracks into groups. */
49
51
  export const CatalogExamSchema = Schema.Struct({
50
52
  ...LocalizedFields,
51
53
  ...ExamFields,
54
+ groupAxis: GroupAxisSchema,
52
55
  kind: Schema.Literal("exam"),
53
56
  order: PositiveCountSchema,
54
57
  publicPath: PublicPathSchema,
55
58
  });
56
- /** One localized track of an exam: a year, a subject, or an institution. */
59
+ /** One localized group of an exam on its axis: a year, a grade, or an institution. */
60
+ export const CatalogGroupSchema = Schema.Struct({
61
+ ...LocalizedFields,
62
+ ...GroupFields,
63
+ kind: Schema.Literal("group"),
64
+ order: PositiveCountSchema,
65
+ publicPath: PublicPathSchema,
66
+ });
67
+ /**
68
+ * One localized track of an exam, in the group that holds it: one paper
69
+ * format with its sets, such as a subject or a year's test. A track key is
70
+ * unique within its exam, so the rows of a track and of its sets name the
71
+ * track without its group.
72
+ */
57
73
  export const CatalogTrackSchema = Schema.Struct({
58
74
  ...LocalizedFields,
59
75
  ...TrackFields,
76
+ groupKey: KebabKeySchema,
60
77
  kind: Schema.Literal("track"),
61
78
  order: PositiveCountSchema,
62
79
  publicPath: PublicPathSchema,
63
- trackKind: TrackKindSchema,
64
80
  });
65
81
  /**
66
82
  * One localized set of a track, and the paper a learner sits for it, by
@@ -94,13 +110,16 @@ export const CatalogSectionSchema = Schema.Struct({
94
110
  export const CatalogRowSchema = Schema.Union([
95
111
  CatalogCountrySchema,
96
112
  CatalogExamSchema,
113
+ CatalogGroupSchema,
97
114
  CatalogTrackSchema,
98
115
  CatalogSetSchema,
99
116
  CatalogSectionSchema,
100
117
  ]);
101
118
  /**
102
119
  * The identity of one catalog row, unique within a snapshot: its locale, its
103
- * kind, and the keys of its node and of every node above it.
120
+ * kind, and the keys of its node and of every node above it. A group names
121
+ * its own key; a track is unique within its exam, so a track and the rows
122
+ * under it leave their group out.
104
123
  */
105
124
  export function catalogRowIdentity(row) {
106
125
  return Arr.join([
@@ -108,6 +127,7 @@ export function catalogRowIdentity(row) {
108
127
  row.kind,
109
128
  row.countryKey,
110
129
  "examKey" in row ? row.examKey : "",
130
+ row.kind === "group" ? row.groupKey : "",
111
131
  "trackKey" in row ? row.trackKey : "",
112
132
  "setKey" in row ? row.setKey : "",
113
133
  "sectionKey" in row ? row.sectionKey : "",