@hebcal/leyning 9.5.6 → 10.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.
Files changed (68) hide show
  1. package/dist/esm/aliyot.json.d.ts +1574 -0
  2. package/dist/esm/aliyot.json.js +1250 -5
  3. package/dist/esm/aliyot.json.js.map +1 -1
  4. package/dist/esm/ashkenazi.po.js +2 -5
  5. package/dist/esm/ashkenazi.po.js.map +1 -1
  6. package/dist/esm/calculateHaftarahNumVerses.d.ts +8 -0
  7. package/dist/esm/calculateHaftarahNumVerses.js +36 -0
  8. package/dist/esm/calculateHaftarahNumVerses.js.map +1 -0
  9. package/dist/esm/clone.d.ts +11 -7
  10. package/dist/esm/clone.js +11 -13
  11. package/dist/esm/clone.js.map +1 -1
  12. package/dist/esm/common.d.ts +15 -7
  13. package/dist/esm/common.js +22 -18
  14. package/dist/esm/common.js.map +1 -1
  15. package/dist/esm/csv.d.ts +35 -2
  16. package/dist/esm/csv.js +42 -13
  17. package/dist/esm/csv.js.map +1 -1
  18. package/dist/esm/festival.d.ts +12 -3
  19. package/dist/esm/festival.js +14 -9
  20. package/dist/esm/festival.js.map +1 -1
  21. package/dist/esm/format.d.ts +14 -2
  22. package/dist/esm/format.js +17 -10
  23. package/dist/esm/format.js.map +1 -1
  24. package/dist/esm/getLeyningForHoliday.d.ts +23 -14
  25. package/dist/esm/getLeyningForHoliday.js +29 -24
  26. package/dist/esm/getLeyningForHoliday.js.map +1 -1
  27. package/dist/esm/getLeyningKeyForEvent.d.ts +20 -3
  28. package/dist/esm/getLeyningKeyForEvent.js +28 -18
  29. package/dist/esm/getLeyningKeyForEvent.js.map +1 -1
  30. package/dist/esm/getLeyningOnDate.d.ts +7 -4
  31. package/dist/esm/getLeyningOnDate.js +5 -9
  32. package/dist/esm/getLeyningOnDate.js.map +1 -1
  33. package/dist/esm/he-x-NoNikud.po.js +2 -5
  34. package/dist/esm/he-x-NoNikud.po.js.map +1 -1
  35. package/dist/esm/he.po.js +2 -5
  36. package/dist/esm/he.po.js.map +1 -1
  37. package/dist/esm/holiday-readings.json.d.ts +2786 -0
  38. package/dist/esm/holiday-readings.json.js +650 -5
  39. package/dist/esm/holiday-readings.json.js.map +1 -1
  40. package/dist/esm/index.d.ts +13 -13
  41. package/dist/esm/index.js +12 -11
  42. package/dist/esm/index.js.map +1 -1
  43. package/dist/esm/internalTypes.d.ts +2 -1
  44. package/dist/esm/internalTypes.js +2 -0
  45. package/dist/esm/internalTypes.js.map +1 -0
  46. package/dist/esm/leyning.d.ts +42 -14
  47. package/dist/esm/leyning.js +75 -27
  48. package/dist/esm/leyning.js.map +1 -1
  49. package/dist/esm/locale.js +2 -4
  50. package/dist/esm/locale.js.map +1 -1
  51. package/dist/esm/numverses.json.d.ts +35 -0
  52. package/dist/esm/numverses.json.js +47 -5
  53. package/dist/esm/numverses.json.js.map +1 -1
  54. package/dist/esm/specialReadings.d.ts +6 -1
  55. package/dist/esm/specialReadings.js +8 -7
  56. package/dist/esm/specialReadings.js.map +1 -1
  57. package/dist/esm/summary.d.ts +21 -9
  58. package/dist/esm/summary.js +25 -18
  59. package/dist/esm/summary.js.map +1 -1
  60. package/dist/esm/translate.d.ts +10 -10
  61. package/dist/esm/translate.js +14 -19
  62. package/dist/esm/translate.js.map +1 -1
  63. package/dist/esm/types.d.ts +163 -51
  64. package/dist/esm/types.js +2 -0
  65. package/dist/esm/types.js.map +1 -0
  66. package/package.json +11 -25
  67. package/dist/bundle.js +0 -2965
  68. package/dist/bundle.min.js +0 -15
@@ -1,138 +1,250 @@
1
- /** English names of books of the Pentateuch */
1
+ /** English names of the five books of the Pentateuch (Torah) */
2
2
  export type TorahBook = 'Genesis' | 'Exodus' | 'Leviticus' | 'Numbers' | 'Deuteronomy';
3
- /** English names of books of the Prophets */
3
+ /** English names of the books of the Prophets (Nevi'im) */
4
4
  export type NeviimBook = 'Joshua' | 'Judges' | 'I Samuel' | 'II Samuel' | 'I Kings' | 'II Kings' | 'Isaiah' | 'Jeremiah' | 'Ezekiel' | 'Hosea' | 'Joel' | 'Amos' | 'Obadiah' | 'Jonah' | 'Micah' | 'Nachum' | 'Habakkuk' | 'Zephaniah' | 'Haggai' | 'Zechariah' | 'Malachi';
5
- /** English names of books of the Writings */
5
+ /** English names of the books of the Writings (Ketuvim) */
6
6
  export type KetuvimBook = 'Psalms' | 'Proverbs' | 'Job' | 'Song of Songs' | 'Ruth' | 'Lamentations' | 'Ecclesiastes' | 'Esther' | 'Daniel' | 'Ezra' | 'Nehemiah' | 'I Chronicles' | 'II Chronicles';
7
+ /**
8
+ * English name of any of the 39 books of the Hebrew Bible (Tanakh),
9
+ * spanning the Torah, Nevi'im (Prophets) and Ketuvim (Writings)
10
+ */
7
11
  export type TanakhBook = TorahBook | NeviimBook | KetuvimBook;
8
12
  /**
9
- * Represents an aliyah
13
+ * A contiguous passage from a single book of the Tanakh.
14
+ *
15
+ * Used to represent a single aliyah of the Torah reading, a maftir, or all
16
+ * or part of a Haftarah. A multi-part Haftarah is represented as an array of
17
+ * `Aliyah` objects (see {@link HaftarahProps}).
10
18
  */
11
19
  export type Aliyah = {
12
- /** Book (e.g. "Numbers") */
20
+ /** Book, e.g. `"Numbers"` */
13
21
  k: TanakhBook;
14
- /** beginning verse (e.g. "28:9") */
22
+ /** Beginning `chapter:verse`, e.g. `"28:9"` */
15
23
  b: string;
16
- /** ending verse (e.g. "28:15") */
24
+ /** Ending `chapter:verse`, e.g. `"28:15"` */
17
25
  e: string;
18
- /** number of verses */
26
+ /** Number of verses in this passage, when calculated */
19
27
  v?: number;
20
- /** parsha number (1=Bereshit, 54=Vezot HaBracha) */
28
+ /** Parsha number (`1`=Bereshit … `54`=Vezot HaBracha), set on holiday/festival aliyot */
21
29
  p?: number;
30
+ /**
31
+ * When this passage differs from the regular reading because of a special
32
+ * occasion, a human-readable explanation of why, such as
33
+ * `"Shabbat Rosh Chodesh"` (translated to the requested language)
34
+ */
22
35
  reason?: string;
23
36
  };
37
+ /** Generic map of string keys to string values */
24
38
  export type StringMap = Record<string, string>;
39
+ /**
40
+ * Map of Torah reading aliyot keyed by `"1"` through `"7"` for the seven
41
+ * aliyot, plus `"M"` for the maftir
42
+ */
25
43
  export type AliyotMap = Record<string, Aliyah>;
26
- /** Name of the parsha hashavua or holiday */
44
+ /** Transliterated English and Hebrew names of a parsha hashavua or holiday */
27
45
  export type LeyningNames = {
28
- /** English */
46
+ /** Transliterated English, e.g. `"Bereshit"` */
29
47
  en: string;
30
- /** Hebrew (with nikud) */
48
+ /** Hebrew with nikud (vowel points), e.g. `"בְּרֵאשִׁית"` */
31
49
  he: string;
32
50
  };
33
51
  /**
34
- * Parsha metadata (underlying JSON object)
52
+ * Raw metadata for a single parsha, as stored in `aliyot.json` and returned
53
+ * by {@link lookupParsha}.
54
+ *
55
+ * Note the raw JSON shapes differ from the richer types used in a computed
56
+ * {@link Leyning}: here `fullkriyah`/`weekday` map to `[begin, end]` (or
57
+ * `[begin, end, reason]`) string tuples rather than {@link Aliyah} objects,
58
+ * and the book is given once as a number in {@link ParshaMeta.book} rather
59
+ * than repeated on every passage.
35
60
  */
36
61
  export type ParshaMeta = {
37
- /** 1 for Bereshit, 2 for Noach, etc. `undefined` for holiday readings */
62
+ /**
63
+ * Parsha number: `1` for Bereshit, `2` for Noach, etc. For a doubled parsha
64
+ * this is a two-element array such as `[21, 22]` (Vayakhel-Pekudei)
65
+ */
38
66
  num: number | number[];
39
- /** parsha name in Hebrew with niqud */
67
+ /** Parsha name in Hebrew with nikud (vowel points) */
40
68
  hebrew: string;
41
- /** 1 for Genesis, 2 for Exodus, 5 for Deuteronomy */
69
+ /** Book number: `1` for Genesis, `2` for Exodus … `5` for Deuteronomy */
42
70
  book: number;
43
- /** Haftarah object(s) */
71
+ /** Haftarah, as a single passage or an array of passages */
44
72
  haft: Aliyah | Aliyah[];
45
- /** Haftarah object(s) for Sephardim */
73
+ /** Alternate Haftarah read by Sephardim, if different from `haft` */
46
74
  seph?: Aliyah | Aliyah[];
47
- /** Haftarah object(s) for Chabad */
75
+ /** Alternate Haftarah read by Chabad, if different from `haft` */
48
76
  chabad?: Aliyah | Aliyah[];
49
- /** Map of Shabbat aliyot `1` through `7` plus `M` for maftir */
77
+ /**
78
+ * Theme of the Haftarah when this parsha's Haftarah is one of the
79
+ * Haftarot of Admonition or Consolation around Tish'a B'Av. See
80
+ * {@link HaftTheme}.
81
+ */
82
+ haftTheme?: HaftTheme;
83
+ /**
84
+ * Shabbat Torah reading as `[begin, end]` (or `[begin, end, reason]`)
85
+ * verse tuples, keyed by `"1"` through `"7"` plus `"M"` for the maftir
86
+ */
50
87
  fullkriyah: Record<string, string[]>;
51
88
  /**
52
- * Map of weekday Torah Readings
53
- * aliyot `1` through `3` for Monday and Thursday
89
+ * Weekday (Monday & Thursday) Torah reading as `[begin, end]` verse
90
+ * tuples, keyed by `"1"` through `"3"`. Absent for parshiyot never read
91
+ * on a weekday.
54
92
  */
55
93
  weekday?: Record<string, string[]>;
94
+ /** `true` when this entry represents a doubled (combined) parsha */
56
95
  combined?: boolean;
96
+ /** For a combined parsha, the name of the first component, e.g. `"Vayakhel"` */
57
97
  p1?: string;
98
+ /** For a combined parsha, the name of the second component, e.g. `"Pekudei"` */
58
99
  p2?: string;
100
+ /** For a combined parsha, the parsha number of the first component */
59
101
  num1?: number;
102
+ /** For a combined parsha, the parsha number of the second component */
60
103
  num2?: number;
61
104
  };
105
+ /**
106
+ * Result of {@link specialReadings2}: the overrides that apply when the
107
+ * weekly parsha coincides with a special occasion (Shabbat Rosh Chodesh,
108
+ * Shabbat Chanukah, one of the four special Shabbatot, etc.).
109
+ */
62
110
  export type SpecialReading = {
63
- /** Map of aliyot `1` through `7` plus `M` for maftir */
111
+ /**
112
+ * The Torah reading with any special maftir or 7th aliyah already merged
113
+ * in, keyed by `"1"` through `"7"` plus `"M"` for the maftir
114
+ */
64
115
  aliyot: AliyotMap;
65
116
  /**
66
- * Explanations for special readings,
67
- * keyed by aliyah number, `M` for maftir or `haftara` for Haftarah
117
+ * Explanations for the overrides, keyed by aliyah number (`"1"`–`"7"`),
118
+ * `"M"` for the maftir, or `"haftara"`/`"sephardic"`/`"chabad"` for the
119
+ * corresponding Haftarah. The value is an untranslated reason key.
68
120
  */
69
121
  reason: StringMap;
70
- /** Haftarah object(s) */
122
+ /** Overriding Haftarah, if the special occasion replaces the regular one */
71
123
  haft?: Aliyah | Aliyah[];
72
- /** Haftarah object(s) for Sephardim */
124
+ /** Overriding Haftarah for Sephardim, if applicable */
73
125
  seph?: Aliyah | Aliyah[];
74
- /** Haftarah object(s) for Chabad */
126
+ /** Overriding Haftarah for Chabad, if applicable */
75
127
  chabad?: Aliyah | Aliyah[];
76
128
  };
77
129
  /**
78
- * Leyning base - weekday, parsha hashavua or holiday
130
+ * Fields common to every leyning result, whether for a weekday, a parashat
131
+ * hashavua, or a holiday.
79
132
  */
80
133
  export type LeyningBase = {
81
- /** Name of the parsha hashavua or holiday */
134
+ /** Transliterated English and Hebrew name of the parsha or holiday */
82
135
  name: LeyningNames;
83
- /** Such as `Genesis 1:1 - 6:8` */
136
+ /** One-line summary of the Torah reading, such as `"Genesis 1:1-6:8"` */
84
137
  summary: string;
138
+ /** Whether this reading is for a Shabbat, a holiday, or a weekday */
85
139
  type: 'shabbat' | 'holiday' | 'weekday';
140
+ /**
141
+ * When the reading spans more than one book or non-contiguous section,
142
+ * the parts that make up {@link LeyningBase.summary}
143
+ */
86
144
  summaryParts?: Aliyah[];
145
+ /** Free-form explanatory note about this reading, if any */
87
146
  note?: string;
88
147
  };
89
148
  /**
90
- * Parashat haShavua - weekday or Shabbat
149
+ * A parashat hashavua reading (weekday or Shabbat), adding the parsha
150
+ * identity to {@link LeyningBase}.
91
151
  */
92
152
  export type LeyningParshaHaShavua = LeyningBase & {
93
- /** An array of either 1 (regular) or 2 (doubled parsha). `undefined` for holiday readings */
153
+ /**
154
+ * Parsha name(s): a one-element array for a regular parsha (`["Pinchas"]`)
155
+ * or a two-element array for a doubled parsha (`["Matot", "Masei"]`).
156
+ * `undefined` for holiday readings.
157
+ */
94
158
  parsha?: string[];
95
- /** 1 for Bereshit, 2 for Noach, etc. `undefined` for holiday readings */
159
+ /**
160
+ * Parsha number (`1`=Bereshit … `54`=Vezot HaBracha), or a two-element
161
+ * array for a doubled parsha. `undefined` for holiday readings.
162
+ */
96
163
  parshaNum?: number | number[];
97
164
  };
98
165
  /**
99
- * Parashat haShavua - weekday
166
+ * A weekday (Monday & Thursday) parashat hashavua reading.
100
167
  */
101
168
  export type LeyningWeekday = LeyningParshaHaShavua & {
102
- /** Optional map of weekday Torah Readings aliyot `1` through `3` for Monday and Thursday */
169
+ /**
170
+ * Weekday Torah reading, keyed by `"1"` through `"3"`. Present on weekday
171
+ * readings and also attached to a Shabbat reading by {@link getLeyningForParsha}.
172
+ */
103
173
  weekday?: AliyotMap;
104
174
  };
105
- export type HaftarahProps = {
106
- /** Haftarah object */
175
+ /**
176
+ * Identifies a Haftarah tied to the weeks around Tish'a B'Av: one of the
177
+ * three Haftarot of Admonition (the "Three Weeks" before Tish'a B'Av) or the
178
+ * seven Haftarot of Consolation (the seven Shabbatot after it). At most one
179
+ * of the two fields is set.
180
+ */
181
+ export type HaftTheme = {
182
+ /**
183
+ * For the three Haftarot of Admonition (תְּלָתָא דְּפוּרְעָנוּתָא) read on the
184
+ * three Shabbatot before Tish'a B'Av: `1`, `2` or `3`.
185
+ */
186
+ admonition?: number;
187
+ /**
188
+ * For the seven Haftarot of Consolation (שֶׁבַע דְּנֶחָמְתָא) read on the seven
189
+ * Shabbatot after Tish'a B'Av: `1` through `7`. In the rare year when
190
+ * Parashat Re'eh coincides with Rosh Chodesh, the 3rd Haftarah of
191
+ * Consolation is displaced and later chanted together with the 5th on
192
+ * Parashat Ki Teitzei, in which case the value is the string `"3,5"`.
193
+ */
194
+ consolation?: number | string;
195
+ };
196
+ /**
197
+ * The Haftarah portion of a leyning result, including its formatted summary
198
+ * and any Tish'a B'Av theme (via {@link HaftTheme}).
199
+ */
200
+ export type HaftarahProps = HaftTheme & {
201
+ /** Haftarah, as a single passage or an array of passages */
107
202
  haft: Aliyah | Aliyah[];
108
- /** Haftarah, such as `Isaiah 42:5 – 43:11` */
203
+ /** Formatted Haftarah citation, such as `"Isaiah 42:5 - 43:11"` */
109
204
  haftara: string;
110
- /** Number of verses in the Haftarah */
205
+ /** Total number of verses in the Haftarah */
111
206
  haftaraNumV?: number;
112
207
  };
113
208
  /**
114
- * Shabbat and holiday leyning always has full kriyah and haftarah
209
+ * A complete Shabbat or holiday leyning, which always has a full kriyah
210
+ * (seven aliyot plus maftir) and a Haftarah.
115
211
  */
116
212
  export type LeyningShabbatHoliday = LeyningBase & HaftarahProps & {
117
- /** Map of aliyot `1` through `7` plus `M` for maftir */
213
+ /**
214
+ * Torah reading keyed by `"1"` through `"7"` plus `"M"` for the maftir
215
+ */
118
216
  fullkriyah: AliyotMap;
119
- /** Alternate full kriyah */
217
+ /** Alternate full kriyah, when a second valid custom exists */
120
218
  alt?: AliyotMap;
121
- /** Haftarah object for Sephardim */
219
+ /** Haftarah for Sephardim, when different from the Ashkenazi `haft` */
122
220
  seph?: Aliyah | Aliyah[];
123
- /** Haftarah object(s) for Chabad */
221
+ /** Haftarah for Chabad, when different from the Ashkenazi `haft` */
124
222
  chabad?: Aliyah | Aliyah[];
125
- /** Haftarah for Sephardim, such as `Isaiah 42:5 - 42:21` */
223
+ /** Formatted Sephardic Haftarah citation, such as `"Isaiah 42:5 - 42:21"` */
126
224
  sephardic?: string;
127
- /** Number of verses in the Haftarah for Sephardim */
225
+ /** Total number of verses in the Sephardic Haftarah */
128
226
  sephardicNumV?: number;
129
- /** Explanations for special readings, keyed by aliyah number, `M` for maftir or `haftara` for Haftarah */
227
+ /**
228
+ * Explanations for special readings, keyed by aliyah number (`"1"`–`"7"`),
229
+ * `"M"` for the maftir, or `"haftara"` for the Haftarah. Values are
230
+ * translated to the requested language.
231
+ */
130
232
  reason?: StringMap;
131
- /** Song of Songs is read on the sabbath of Passover week, the Book of Ruth on Shavuot, Lamentations on Tisha be-Av, Ecclesiastes on the sabbath of the week of Sukkoth, and the Book of Esther on Purim */
233
+ /**
234
+ * The Five Scrolls (megillot) read on certain holidays: Song of Songs on
235
+ * the Shabbat of Passover week, Ruth on Shavuot, Lamentations on Tish'a
236
+ * B'Av, Ecclesiastes on the Shabbat of Sukkot, and Esther on Purim.
237
+ */
132
238
  megillah?: AliyotMap;
133
- /** Triennial alternate Haftara */
239
+ /** Alternate Haftarah for the triennial reading cycle, if different */
134
240
  triHaftara?: string;
135
- /** Triennial alternate Haftara number of verses */
241
+ /** Number of verses in the triennial alternate Haftarah */
136
242
  triHaftaraNumV?: number;
137
243
  };
244
+ /**
245
+ * A fully-computed leyning. This is the union of every leyning shape —
246
+ * weekday, parashat hashavua, and Shabbat/holiday — so any field that can
247
+ * appear on a reading is present here as optional. Inspect
248
+ * {@link LeyningBase.type} to know which fields to expect.
249
+ */
138
250
  export type Leyning = LeyningBase & LeyningParshaHaShavua & LeyningShabbatHoliday & LeyningWeekday;
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":""}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hebcal/leyning",
3
- "version": "9.5.6",
3
+ "version": "10.0.0",
4
4
  "author": "Michael J. Radwin (https://github.com/mjradwin)",
5
5
  "keywords": [
6
6
  "hebcal",
@@ -33,25 +33,21 @@
33
33
  },
34
34
  "files": [
35
35
  "dist/esm",
36
- "po",
37
- "dist/bundle.js",
38
- "dist/bundle.min.js"
36
+ "po"
39
37
  ],
40
38
  "engines": {
41
39
  "node": ">=18"
42
40
  },
43
41
  "dependencies": {
44
- "@hebcal/core": "^6.8.2",
45
- "@hebcal/hdate": "^0.22.5"
42
+ "@hebcal/core": "^6.9.1",
43
+ "@hebcal/hdate": "^0.22.7"
46
44
  },
47
45
  "scripts": {
48
46
  "po2json": "node ./po2json.js po/he.po po/he-x-NoNikud.po po/ashkenazi.po",
49
- "size-demo:rollup": "rollup -c size-demo/rollup.config.ts --configPlugin typescript",
50
- "size-demo": "npm run build && npm run size-demo:rollup",
51
- "build:rollup": "rollup -c",
52
- "build": "npm run po2json && npm run build:rollup",
53
- "prepublish": "npm run build",
54
- "docs": "typedoc",
47
+ "build:json2js": "for f in src/*.json; do echo 'export default' > \"$f.ts\" && cat \"$f\" >> \"$f.ts\"; done",
48
+ "build:tsc": "tsc -p tsconfig.json",
49
+ "build": "npm run po2json && npm run build:json2js && npm run build:tsc",
50
+ "docs": "npx -y typedoc",
55
51
  "pretest": "npm run build",
56
52
  "lint": "oxlint .",
57
53
  "test": "vitest",
@@ -63,22 +59,12 @@
63
59
  },
64
60
  "license": "BSD-2-Clause",
65
61
  "devDependencies": {
66
- "@rollup/plugin-json": "^6.1.0",
67
- "@rollup/plugin-node-resolve": "^16.0.3",
68
- "@rollup/plugin-terser": "^1.0.0",
69
- "@rollup/plugin-typescript": "^12.3.0",
70
- "@types/node": "^26.1.1",
62
+ "@types/node": "^26.1.2",
71
63
  "@vitest/coverage-v8": "^4.1.10",
72
64
  "gettext-parser": "^9.1.1",
73
- "oxlint": "^1.74.0",
65
+ "oxlint": "^1.76.0",
74
66
  "prettier": "^3.9.6",
75
- "pretty-bytes": "^7.1.1",
76
- "rollup": "^4.62.2",
77
- "rollup-plugin-bundle-size": "^1.0.3",
78
- "rollup-plugin-visualizer": "^7.0.1",
79
- "tslib": "^2.8.1",
80
- "typedoc": "^0.28.20",
81
- "typescript": "^6.0.3",
67
+ "typescript": "^7.0.2",
82
68
  "vitest": "^4.1.10"
83
69
  }
84
70
  }