@heroiclands/package-build 23.6.0 → 23.7.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,15 +1,46 @@
1
1
  /**
2
- * A lookup from a built piece to its gloss, over one language's words (stems
3
- * included) and affixes.
2
+ * A lookup from a built piece to its gloss, over the words (stems included)
3
+ * and affixes of one or more languages.
4
4
  *
5
- * A piece matches a word or an affix written exactly as it is, and failing
5
+ * Languages are given nearest first: a language's own words, then its own
6
+ * affixes, then the next language's, so a daughter's entry wins over its
7
+ * parent's. A piece matches an entry written exactly as it is, and failing
6
8
  * that one written with the same letters and different joining hyphens, so
7
- * `wulf-` finds the word `wulf`. A word's own gloss wins over an affix's.
9
+ * `wulf-` finds the word `wulf`. Within a language a word's own gloss wins over
10
+ * an affix's.
8
11
  *
9
- * @param {object} data - The language note's `data`.
12
+ * @param {...object} datas - Each language note's `data`, nearest first.
10
13
  * @returns {(piece: string) => string|null} The gloss, or `null` where none resolves.
11
14
  */
12
- export function pieceGlosses(data: object): (piece: string) => string | null;
15
+ export function pieceGlosses(...datas: object[]): (piece: string) => string | null;
16
+ /**
17
+ * The chain of languages from one up through `data.family`: the language
18
+ * itself, then its parent, and so on. The chain stops at a parent that is no
19
+ * language, and before a language it has already reached, so a cycle the lint
20
+ * refuses still yields a finite chain. `language_lineage`, the dictionary and
21
+ * the resolution of built pieces all walk it.
22
+ *
23
+ * @param {string|undefined} start - The language's key.
24
+ * @param {object} reader
25
+ * @param {(key: string) => boolean} reader.has - Whether a key is a language.
26
+ * @param {(key: string) => string|undefined} reader.parentOf - A language's
27
+ * parent key, where it states one.
28
+ * @returns {string[]} The keys, nearest first.
29
+ */
30
+ export function lineageChain(start: string | undefined, { has, parentOf }: {
31
+ has: (key: string) => boolean;
32
+ parentOf: (key: string) => string | undefined;
33
+ }): string[];
34
+ /**
35
+ * A lookup of language records by Address, and the chain walk over them.
36
+ *
37
+ * @param {Iterable<Record<string, any>>} records - Index records.
38
+ * @returns {{languages: Map<string, object>, chain: (key: string) => string[]}}
39
+ */
40
+ export function languageLineages(records: Iterable<Record<string, any>>): {
41
+ languages: Map<string, object>;
42
+ chain: (key: string) => string[];
43
+ };
13
44
  /**
14
45
  * Whether a record is a language note's.
15
46
  *
@@ -17,6 +48,22 @@ export function pieceGlosses(data: object): (piece: string) => string | null;
17
48
  * @returns {boolean}
18
49
  */
19
50
  export function isLanguageRecord(record: Record<string, any>): boolean;
51
+ /**
52
+ * A record's Address as a reference to it is written: in the `note` system,
53
+ * so it compares equal to the Addresses other notes state.
54
+ *
55
+ * @param {Record<string, any>} record - An index record.
56
+ * @returns {string|null} The Address, or `null` for a record naming no note.
57
+ */
58
+ export function noteAddressOf(record: Record<string, any>): string | null;
59
+ /**
60
+ * A lookup of the notes citing a word, from records that carry `citations`.
61
+ *
62
+ * @param {Iterable<Record<string, any>>} records - Index records.
63
+ * @returns {(language: string, form: string) => string[]} The citing notes;
64
+ * empty where none cites the word.
65
+ */
66
+ export function citationLookup(records: Iterable<Record<string, any>>): (language: string, form: string) => string[];
20
67
  /**
21
68
  * The `words` rows of a set of index records.
22
69
  *
@@ -24,9 +71,29 @@ export function isLanguageRecord(record: Record<string, any>): boolean;
24
71
  *
25
72
  * @param {Iterable<Record<string, any>>} records - Index records, every
26
73
  * Address a string, already narrowed to the audience being published to.
74
+ * @param {Iterable<Record<string, any>>} [all] - Every record of the package,
75
+ * for resolving a built piece through an ancestor the audience does not see.
27
76
  * @returns {object[]} One row per word, in record then entry order.
28
77
  */
29
- export function wordRows(records: Iterable<Record<string, any>>): object[];
78
+ export function wordRows(records: Iterable<Record<string, any>>, all?: Iterable<Record<string, any>>): object[];
79
+ /**
80
+ * The `affixes` rows of a set of index records: one per `data.affixes` entry
81
+ * of a language note, which is the row's `language`.
82
+ *
83
+ * @param {Iterable<Record<string, any>>} records - Index records, every
84
+ * Address a string, already narrowed to the audience being published to.
85
+ * @returns {object[]} One row per affix, in record then entry order.
86
+ */
87
+ export function affixRows(records: Iterable<Record<string, any>>): object[];
88
+ /**
89
+ * The `fields` rows of a set of index records: one per `data.fields` entry of
90
+ * a language note, which is the row's `language`.
91
+ *
92
+ * @param {Iterable<Record<string, any>>} records - Index records, every
93
+ * Address a string, already narrowed to the audience being published to.
94
+ * @returns {object[]} One row per field, in record then entry order.
95
+ */
96
+ export function fieldRows(records: Iterable<Record<string, any>>): object[];
30
97
  /**
31
98
  * The `glossary` rows of a set of index records: one per entry of a culture's
32
99
  * or an affiliation's `data.glossary`, with `name_sort` the name and `common`
@@ -58,6 +125,10 @@ export function lineageRows(records: Iterable<Record<string, any>>, all?: Iterab
58
125
  export const WORD_COLUMNS: readonly string[];
59
126
  /** Every column of the `glossary` relation, in order. */
60
127
  export const GLOSSARY_COLUMNS: readonly string[];
128
+ /** Every column of the `affixes` relation, in order. */
129
+ export const AFFIX_COLUMNS: readonly string[];
130
+ /** Every column of the `fields` relation, in order. */
131
+ export const FIELD_COLUMNS: readonly string[];
61
132
  /** Every column of the `language_lineage` relation, in order. */
62
133
  export const LINEAGE_COLUMNS: readonly string[];
63
134
  /** The columns of any of these relations that hold a whole number. */
@@ -1,3 +1,19 @@
1
+ /**
2
+ * A word's senses: one for a string gloss, one per entry for a list, each
3
+ * trimmed, blanks dropped.
4
+ *
5
+ * @param {unknown} gloss - The word's `gloss`.
6
+ * @returns {string[]} The senses, in order.
7
+ */
8
+ export function glossSenses(gloss: unknown): string[];
9
+ /**
10
+ * A word's gloss as one line of text: its senses joined by `; `, or `null`
11
+ * where it states none.
12
+ *
13
+ * @param {unknown} gloss - The word's `gloss`.
14
+ * @returns {string|null}
15
+ */
16
+ export function glossText(gloss: unknown): string | null;
1
17
  /**
2
18
  * Why a pronunciation is not a respelling, or `undefined` when it is one.
3
19
  *
@@ -57,6 +73,10 @@ export const WORD_FIELD_FIELDS: readonly import("./data-keys.mjs").InnerKeySpec[
57
73
  * @type {readonly import("./data-keys.mjs").InnerKeySpec[]}
58
74
  */
59
75
  export const AFFIX_FIELDS: readonly import("./data-keys.mjs").InnerKeySpec[];
76
+ /** The keys of {@link WORD_FIELD_FIELDS}, in declared order. */
77
+ export const FIELD_KEYS: readonly string[];
78
+ /** The keys of {@link AFFIX_FIELDS}, in declared order. */
79
+ export const AFFIX_KEYS: readonly string[];
60
80
  /**
61
81
  * The keys one entry of a culture's or an affiliation's `data.glossary`
62
82
  * carries.