@taekwondo-db/database 0.0.0-stage → 0.2.3

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.
Files changed (52) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +282 -2
  3. package/db/chagi.json +720 -0
  4. package/db/chigi.json +1153 -0
  5. package/db/ditgi.json +101 -0
  6. package/db/japgi.json +154 -0
  7. package/db/jireugi.json +458 -0
  8. package/db/jjireugi.json +111 -0
  9. package/db/kkeokgi.json +58 -0
  10. package/db/makgi.json +1447 -0
  11. package/db/milgi.json +63 -0
  12. package/db/neomgigi.json +45 -0
  13. package/db/pihagi.json +68 -0
  14. package/db/ppaegi.json +174 -0
  15. package/db/schemas/grades.json +22 -0
  16. package/db/schemas/historic.json +21 -0
  17. package/db/schemas/image.json +24 -0
  18. package/db/schemas/include.json +31 -0
  19. package/db/schemas/localized-string.json +17 -0
  20. package/db/schemas/patches.json +12 -0
  21. package/db/schemas/source.json +12 -0
  22. package/db/schemas/sources.json +22 -0
  23. package/db/schemas/techniques.json +86 -0
  24. package/db/schemas/terms.json +52 -0
  25. package/db/seogi.json +602 -0
  26. package/db/sources.json +29 -0
  27. package/db/terms.json +995 -0
  28. package/db/ttwigi.json +59 -0
  29. package/dist/search.browser.js +1197 -0
  30. package/index.js +1 -0
  31. package/package.json +50 -5
  32. package/src/builtins-empty.d.ts +1 -0
  33. package/src/builtins-empty.js +10 -0
  34. package/src/builtins.d.ts +10 -0
  35. package/src/builtins.js +46 -0
  36. package/src/compose-builtins.d.ts +11 -0
  37. package/src/compose-builtins.js +39 -0
  38. package/src/compose.d.ts +76 -0
  39. package/src/compose.js +313 -0
  40. package/src/database.ts +457 -0
  41. package/src/description.d.ts +13 -0
  42. package/src/description.js +63 -0
  43. package/src/grade.d.ts +22 -0
  44. package/src/grade.js +44 -0
  45. package/src/search.d.ts +31 -0
  46. package/src/search.js +59 -0
  47. package/types/historic.d.ts +13 -0
  48. package/types/image.d.ts +9 -0
  49. package/types/localized-string.d.ts +3 -0
  50. package/types/source.d.ts +34 -0
  51. package/types/technique.d.ts +114 -0
  52. package/types/term.d.ts +38 -0
@@ -0,0 +1,9 @@
1
+ import type { LocalizedString } from "./localized-string";
2
+
3
+ export interface Image {
4
+ /** Relative to an image directory, e.g. `"seogi/apgubi.jpg"`. */
5
+ src: string;
6
+ description?: LocalizedString;
7
+ /** AI-generated; omitted means `false`. */
8
+ ai?: boolean;
9
+ }
@@ -0,0 +1,3 @@
1
+ export interface LocalizedString {
2
+ [k: string]: string;
3
+ }
@@ -0,0 +1,34 @@
1
+ import type { Historic } from "./historic";
2
+ import type { LocalizedString } from "./localized-string";
3
+ import type { Ref, Technique } from "./technique";
4
+
5
+ export interface Source {
6
+ type: Sources;
7
+ page?: string;
8
+ }
9
+
10
+ export interface Sources {
11
+ name: string;
12
+ author?: string;
13
+ description?: LocalizedString;
14
+ isbn?: string;
15
+ title: string;
16
+ type: SourceType;
17
+ url?: string;
18
+ year?: number;
19
+ /** Backlink, populated while loading. */
20
+ techniques?: Technique[];
21
+ /** Backlink, populated while loading. */
22
+ historic?: Historic[];
23
+ }
24
+
25
+ export type SourceType = "book";
26
+
27
+ /** A source as written in `db/sources.json` — key and backlinks are added on load. */
28
+ export interface SourceEntryJson
29
+ extends Omit<Sources, "name" | "techniques" | "historic"> {}
30
+
31
+ /** The shape of `db/sources.json`; string values (`$schema`) are skipped on load. */
32
+ export type SourcesJson = Record<string, SourceEntryJson | string>;
33
+
34
+ export interface SourceJson extends Omit<Source & Ref, "type"> {}
@@ -0,0 +1,114 @@
1
+ import type { Grade } from "../src/grade";
2
+ import type { Historic, HistoricJson } from "./historic";
3
+ import type { Image } from "./image";
4
+ import type { LocalizedString } from "./localized-string";
5
+ import type { Source, SourceJson } from "./source";
6
+ import type { Term } from "./term";
7
+
8
+ /** The technique groups bundled with this package. */
9
+ export type BuiltinTechniqueGroup =
10
+ | "seogi"
11
+ | "makgi"
12
+ | "ditgi"
13
+ | "ttwigi"
14
+ | "jireugi"
15
+ | "chigi"
16
+ | "chagi"
17
+ | "milgi"
18
+ | "kkeokgi"
19
+ | "neomgigi"
20
+ | "pihagi"
21
+ | "japgi"
22
+ | "ppaegi"
23
+ | "jjireugi";
24
+
25
+ /**
26
+ * A technique group name. Consumers may define their own groups via
27
+ * `DatabaseOptions.techniqueGroups`, so this is not a closed union — the
28
+ * builtin names are listed only to keep autocompletion useful.
29
+ */
30
+ export type TechniqueGroup = BuiltinTechniqueGroup | (string & {});
31
+
32
+ export interface Technique {
33
+ /** The official Kukkiwon name in Revised Romanization — also the map key. */
34
+ name: string;
35
+ /** An alternative romanized name, where one is in use. */
36
+ supplementaryName?: string;
37
+ /** The name rendered in each language, e.g. `{ de: "Langer Vorwärtsstand" }`. */
38
+ translation: LocalizedString;
39
+ /** Free-form explanation. May be long, and may cover only some languages. */
40
+ description?: LocalizedString;
41
+ group: TechniqueGroup;
42
+ generic?: boolean;
43
+ references?: TechniqueReference[];
44
+ terms?: Term[];
45
+ historic?: Historic[];
46
+ weight?: {
47
+ front: number;
48
+ back: number;
49
+ };
50
+ sources?: Source[];
51
+ images?: Image[];
52
+ videos?: {
53
+ link: string;
54
+ name: string;
55
+ }[];
56
+ /** From which grade on the technique is relevant — set via `DatabaseOptions.grades`. */
57
+ grade?: Grade;
58
+ }
59
+
60
+ export interface TechniqueReference {
61
+ technique: Technique;
62
+ type: "specialization" | "generic";
63
+ description?: LocalizedString;
64
+ }
65
+
66
+ export type Ref = { $ref: string };
67
+
68
+ export interface TechniqueReferenceJson
69
+ extends Omit<TechniqueReference & Ref, "technique"> {}
70
+
71
+ export interface TechniqueJson
72
+ extends Omit<
73
+ Technique,
74
+ | "name"
75
+ | "terms"
76
+ | "mentions"
77
+ | "group"
78
+ | "references"
79
+ | "historic"
80
+ | "sources"
81
+ | "grade"
82
+ > {
83
+ terms: Ref[];
84
+ references?: TechniqueReferenceJson[];
85
+ historic?: HistoricJson[];
86
+ sources?: SourceJson[];
87
+ group?: TechniqueGroup;
88
+ }
89
+
90
+ export interface CustomTechniqueJson {
91
+ [k: string]: TechniqueJson | string;
92
+ }
93
+
94
+ /**
95
+ * A patch for one field: a (partial) value to merge, `null` to remove the
96
+ * field, `{ $replace }` to replace it as a whole, `{ $append }` to extend a text.
97
+ */
98
+ export type PatchValue<T> =
99
+ | (T extends string
100
+ ? T
101
+ : T extends unknown[]
102
+ ? T
103
+ : T extends object
104
+ ? { [K in keyof T]?: PatchValue<T[K]> }
105
+ : T)
106
+ | null
107
+ | { $replace: T }
108
+ | (T extends string ? { $append: string } : never);
109
+
110
+ export type PatchJson<T> = { [K in keyof T]?: PatchValue<NonNullable<T[K]>> };
111
+
112
+ export interface PatchTechniqueJson {
113
+ [k: string]: PatchJson<TechniqueJson>;
114
+ }
@@ -0,0 +1,38 @@
1
+ import type { Historic, HistoricJson } from "./historic";
2
+ import type { LocalizedString } from "./localized-string";
3
+ import type { PatchJson, Ref, Technique } from "./technique";
4
+
5
+ export type TermType = "noun" | "verb" | "adjective" | "adverb" | "modifier";
6
+
7
+ export interface Term {
8
+ name: string;
9
+ hangeul: string;
10
+ hanja?: string;
11
+ type?: TermType;
12
+ lemma?: Term;
13
+ description: LocalizedString;
14
+ forms?: Term[];
15
+ terms?: Term[];
16
+ combinations?: Term[];
17
+ historic?: Historic[];
18
+ techniques?: Technique[];
19
+ }
20
+
21
+ export interface TermJson
22
+ extends Omit<
23
+ Term,
24
+ "historic" | "name" | "lemma" | "type" | "forms" | "terms" | "combinations"
25
+ > {
26
+ historic?: HistoricJson[];
27
+ lemma?: Ref;
28
+ terms?: Ref[];
29
+ type?: string;
30
+ }
31
+
32
+ export interface CustomTermJson {
33
+ [k: string]: TermJson;
34
+ }
35
+
36
+ export interface PatchTermJson {
37
+ [k: string]: PatchJson<TermJson>;
38
+ }