@nakafa/aksara-contracts 6.3.0 → 6.4.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.
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
import { Schema } from "effect";
|
|
2
2
|
import { type AppLocale } from "#contracts/locale";
|
|
3
|
-
/**
|
|
3
|
+
/**
|
|
4
|
+
* Localized public route namespaces shared by projection and verification. A
|
|
5
|
+
* declared locale fails to compile until it names its own namespace here.
|
|
6
|
+
*/
|
|
4
7
|
export declare const CURRICULUM_NAMESPACES: {
|
|
5
8
|
readonly de: "lehrplaene";
|
|
6
9
|
readonly en: "curriculum";
|
|
7
10
|
readonly id: "kurikulum";
|
|
11
|
+
readonly ms: "kurikulum";
|
|
8
12
|
};
|
|
9
13
|
/** Resolves the route namespace owned by one application locale. */
|
|
10
14
|
export declare function curriculumNamespace(appLocale: AppLocale): "curriculum" | "kurikulum" | "lehrplaene";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Array as Arr, Schema } from "effect";
|
|
2
2
|
import { CorpusSourcePathSchema, PublicPathSchema } from "#contracts/ids";
|
|
3
|
-
import { AppLocaleSchema } from "#contracts/locale";
|
|
3
|
+
import { AppLocaleSchema, } from "#contracts/locale";
|
|
4
4
|
import { MaterialDomainSchema } from "#contracts/material/domain";
|
|
5
5
|
import { LearningProgramKeySchema, ProgramNavigationIconKeySchema, ProgramNavigationLevelSchema, } from "#contracts/program/spec";
|
|
6
6
|
import { MaterialKeySchema } from "#contracts/projection/material";
|
|
@@ -10,6 +10,7 @@ const CurriculumNamespaceMapSchema = Schema.Struct({
|
|
|
10
10
|
de: Schema.Literal("lehrplaene"),
|
|
11
11
|
en: Schema.Literal("curriculum"),
|
|
12
12
|
id: Schema.Literal("kurikulum"),
|
|
13
|
+
ms: Schema.Literal("kurikulum"),
|
|
13
14
|
});
|
|
14
15
|
const RenderableCurriculumLevelSchema = Schema.Literals([
|
|
15
16
|
"class",
|
|
@@ -23,22 +24,19 @@ function isCurriculumRouteNodeKey(value) {
|
|
|
23
24
|
const rootSuffix = ":root";
|
|
24
25
|
return isLowerKebab(value.endsWith(rootSuffix) ? value.slice(0, -rootSuffix.length) : value);
|
|
25
26
|
}
|
|
26
|
-
/**
|
|
27
|
+
/**
|
|
28
|
+
* Localized public route namespaces shared by projection and verification. A
|
|
29
|
+
* declared locale fails to compile until it names its own namespace here.
|
|
30
|
+
*/
|
|
27
31
|
export const CURRICULUM_NAMESPACES = CurriculumNamespaceMapSchema.make({
|
|
28
32
|
de: "lehrplaene",
|
|
29
33
|
en: "curriculum",
|
|
30
34
|
id: "kurikulum",
|
|
35
|
+
ms: "kurikulum",
|
|
31
36
|
});
|
|
32
37
|
/** Resolves the route namespace owned by one application locale. */
|
|
33
38
|
export function curriculumNamespace(appLocale) {
|
|
34
|
-
|
|
35
|
-
if (localeCode === "de") {
|
|
36
|
-
return CURRICULUM_NAMESPACES.de;
|
|
37
|
-
}
|
|
38
|
-
if (localeCode === "id") {
|
|
39
|
-
return CURRICULUM_NAMESPACES.id;
|
|
40
|
-
}
|
|
41
|
-
return CURRICULUM_NAMESPACES.en;
|
|
39
|
+
return CURRICULUM_NAMESPACES[Schema.encodeSync(AppLocaleSchema)(appLocale)];
|
|
42
40
|
}
|
|
43
41
|
/** Checks whether one curriculum level owns a learner-renderable route. */
|
|
44
42
|
export const isRenderableCurriculumLevel = Schema.is(RenderableCurriculumLevelSchema);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Schema } from "effect";
|
|
2
2
|
import { type AppLocale } from "#contracts/locale";
|
|
3
3
|
/** Locale-owned root namespace for public material routes. */
|
|
4
|
-
export declare const MaterialPublicNamespaceSchema: Schema.Literals<readonly ["subjects", "materi", "faecher"]>;
|
|
4
|
+
export declare const MaterialPublicNamespaceSchema: Schema.Literals<readonly ["subjects", "materi", "faecher", "subjek"]>;
|
|
5
5
|
export type MaterialPublicNamespace = typeof MaterialPublicNamespaceSchema.Type;
|
|
6
6
|
/** Resolves the only public material namespace owned by one app locale. */
|
|
7
7
|
export declare function materialPublicNamespace(appLocale: AppLocale): MaterialPublicNamespace;
|
|
@@ -17,16 +17,21 @@ export const MaterialPublicNamespaceSchema = Schema.Literals([
|
|
|
17
17
|
"subjects",
|
|
18
18
|
"materi",
|
|
19
19
|
"faecher",
|
|
20
|
+
"subjek",
|
|
20
21
|
]);
|
|
22
|
+
/**
|
|
23
|
+
* The public material namespace of every declared app locale. Declaring a
|
|
24
|
+
* locale fails to compile until it names its own namespace here.
|
|
25
|
+
*/
|
|
26
|
+
const MATERIAL_PUBLIC_NAMESPACES = {
|
|
27
|
+
de: "faecher",
|
|
28
|
+
en: "subjects",
|
|
29
|
+
id: "materi",
|
|
30
|
+
ms: "subjek",
|
|
31
|
+
};
|
|
21
32
|
/** Resolves the only public material namespace owned by one app locale. */
|
|
22
33
|
export function materialPublicNamespace(appLocale) {
|
|
23
|
-
|
|
24
|
-
return "subjects";
|
|
25
|
-
}
|
|
26
|
-
if (appLocale === AppLocaleSchema.make("id")) {
|
|
27
|
-
return "materi";
|
|
28
|
-
}
|
|
29
|
-
return "faecher";
|
|
34
|
+
return MATERIAL_PUBLIC_NAMESPACES[Schema.encodeSync(AppLocaleSchema)(appLocale)];
|
|
30
35
|
}
|
|
31
36
|
/** Stable reusable material identity preserved from Nakafa's source registry. */
|
|
32
37
|
export const MaterialKeySchema = Schema.String.pipe(Schema.check(Schema.isPattern(MATERIAL_KEY_PATTERN, {
|
package/dist/quran/provenance.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Array as Arr, Effect, MutableList, Schema } from "effect";
|
|
2
2
|
import { hashText } from "#contracts/hash/text";
|
|
3
3
|
import { Sha256HashSchema } from "#contracts/ids";
|
|
4
|
-
import { ActiveAppLocaleListSchema,
|
|
4
|
+
import { ActiveAppLocaleListSchema, activeAppLocaleCode, ENGLISH_APP_LOCALE_CODE, GERMAN_APP_LOCALE_CODE, INDONESIAN_APP_LOCALE_CODE, } from "#contracts/locale";
|
|
5
5
|
import { canonicalizeQuranAttribution } from "#contracts/quran/attribution";
|
|
6
6
|
import { QuranNameProvenanceScopeSchema, QuranTranslationProvenanceScopeSchema, quranNameProvenanceScope, quranNameSourceForScope, quranTafsirSourceId, quranTranslationProvenanceScope, quranTranslationSourceForScope, } from "#contracts/quran/identity";
|
|
7
7
|
import { QuranProvenanceStatusSchema, } from "#contracts/quran/snapshot/spec";
|
|
@@ -27,6 +27,15 @@ export const QuranProvenanceScopeSchema = Schema.Union([
|
|
|
27
27
|
QuranNameProvenanceScopeSchema,
|
|
28
28
|
QuranTranslationProvenanceScopeSchema,
|
|
29
29
|
]);
|
|
30
|
+
/**
|
|
31
|
+
* The tafsir scope of every active app locale. Activating a locale fails to
|
|
32
|
+
* compile until its tafsir source is named here.
|
|
33
|
+
*/
|
|
34
|
+
const QURAN_TAFSIR_PROVENANCE_SCOPES = {
|
|
35
|
+
de: "de-tafsir-access",
|
|
36
|
+
en: "en-tafsir-access",
|
|
37
|
+
id: "id-tafsir",
|
|
38
|
+
};
|
|
30
39
|
/** Derives the exact provenance scope order for one active locale set. */
|
|
31
40
|
export function quranProvenanceScopes(activeAppLocales) {
|
|
32
41
|
const scopes = MutableList.make();
|
|
@@ -34,15 +43,7 @@ export function quranProvenanceScopes(activeAppLocales) {
|
|
|
34
43
|
for (const appLocale of activeAppLocales) {
|
|
35
44
|
MutableList.append(scopes, quranNameProvenanceScope(appLocale));
|
|
36
45
|
MutableList.append(scopes, quranTranslationProvenanceScope(appLocale));
|
|
37
|
-
|
|
38
|
-
MutableList.append(scopes, "en-tafsir-access");
|
|
39
|
-
}
|
|
40
|
-
else if (appLocale === AppLocaleSchema.make("id")) {
|
|
41
|
-
MutableList.append(scopes, "id-tafsir");
|
|
42
|
-
}
|
|
43
|
-
else {
|
|
44
|
-
MutableList.append(scopes, "de-tafsir-access");
|
|
45
|
-
}
|
|
46
|
+
MutableList.append(scopes, QURAN_TAFSIR_PROVENANCE_SCOPES[activeAppLocaleCode(appLocale)]);
|
|
46
47
|
}
|
|
47
48
|
MutableList.append(scopes, "metadata");
|
|
48
49
|
return MutableList.toArray(scopes);
|
package/package.json
CHANGED