@hebcal/leyning 8.2.9 → 9.0.1

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 (49) hide show
  1. package/dist/bundle.js +1671 -2155
  2. package/dist/bundle.min.js +14 -2
  3. package/dist/esm/aliyot.json.js +4 -0
  4. package/dist/esm/calculateHaftarahNumVerses.d.ts +1 -0
  5. package/dist/esm/clone.d.ts +12 -0
  6. package/dist/esm/clone.js +32 -0
  7. package/dist/esm/common.d.ts +33 -0
  8. package/dist/esm/common.js +94 -0
  9. package/dist/esm/csv.d.ts +14 -0
  10. package/dist/esm/csv.js +153 -0
  11. package/dist/esm/festival.d.ts +9 -0
  12. package/dist/esm/festival.js +42 -0
  13. package/dist/esm/getLeyningForHoliday.d.ts +17 -0
  14. package/dist/esm/getLeyningForHoliday.js +106 -0
  15. package/dist/esm/getLeyningKeyForEvent.d.ts +9 -0
  16. package/dist/esm/getLeyningKeyForEvent.js +141 -0
  17. package/dist/esm/getLeyningOnDate.d.ts +21 -0
  18. package/dist/esm/getLeyningOnDate.js +134 -0
  19. package/dist/esm/he.po.d.ts +61 -0
  20. package/dist/esm/he.po.js +4 -0
  21. package/dist/esm/holiday-readings.json.js +4 -0
  22. package/dist/esm/index.d.ts +11 -0
  23. package/dist/esm/index.js +12 -0
  24. package/dist/esm/internalTypes.d.ts +20 -0
  25. package/dist/esm/leyning.d.ts +30 -0
  26. package/dist/esm/leyning.js +203 -0
  27. package/dist/esm/locale.d.ts +2 -0
  28. package/dist/esm/locale.js +17 -0
  29. package/dist/esm/numverses.json.js +4 -0
  30. package/dist/esm/specialReadings.d.ts +15 -0
  31. package/dist/esm/specialReadings.js +142 -0
  32. package/dist/esm/summary.d.ts +18 -0
  33. package/dist/esm/summary.js +83 -0
  34. package/dist/esm/types.d.ts +130 -0
  35. package/dist/getLeyningForHoliday.d.ts +1 -1
  36. package/dist/getLeyningKeyForEvent.d.ts +1 -1
  37. package/dist/getLeyningOnDate.d.ts +1 -1
  38. package/dist/index.d.ts +1 -2
  39. package/dist/leyning.d.ts +1 -1
  40. package/dist/locale.d.ts +2 -1
  41. package/dist/specialReadings.d.ts +1 -1
  42. package/package.json +23 -19
  43. package/bin/leyning-csv +0 -23
  44. package/dist/aliyot.json.d.ts +0 -1570
  45. package/dist/holiday-readings.json.d.ts +0 -2703
  46. package/dist/index.cjs +0 -3068
  47. package/dist/index.mjs +0 -3039
  48. package/dist/module.d.ts +0 -325
  49. package/dist/numverses.json.d.ts +0 -36
package/dist/module.d.ts DELETED
@@ -1,325 +0,0 @@
1
- import { Event, HDate, HolidayEvent } from '@hebcal/core';
2
- import { WriteStream } from 'node:fs';
3
-
4
- /**
5
- * Represents an aliyah
6
- */
7
- type Aliyah = {
8
- /** Book (e.g. "Numbers") */
9
- k: string;
10
- /** beginning verse (e.g. "28:9") */
11
- b: string;
12
- /** ending verse (e.g. "28:15") */
13
- e: string;
14
- /** number of verses */
15
- v?: number;
16
- /** parsha number (1=Bereshit, 54=Vezot HaBracha) */
17
- p?: number;
18
- reason?: string;
19
- };
20
- type StringMap = {
21
- [key: string]: string;
22
- };
23
- type AliyotMap = {
24
- [key: string]: Aliyah;
25
- };
26
- /** Name of the parsha hashavua or holiday */
27
- type LeyningNames = {
28
- /** English */
29
- en: string;
30
- /** Hebrew (with nikud) */
31
- he: string;
32
- };
33
- /**
34
- * Parsha metadata (underlying JSON object)
35
- */
36
- type ParshaMeta = {
37
- /** 1 for Bereshit, 2 for Noach, etc. `undefined` for holiday readings */
38
- num: number | number[];
39
- /** parsha name in Hebrew with niqud */
40
- hebrew: string;
41
- /** 1 for Genesis, 2 for Exodus, 5 for Deuteronomy */
42
- book: number;
43
- /** Haftarah object(s) */
44
- haft: Aliyah | Aliyah[];
45
- /** Haftarah object(s) for Sephardim */
46
- seph?: Aliyah | Aliyah[];
47
- /** Map of Shabbat aliyot `1` through `7` plus `M` for maftir */
48
- fullkriyah: {
49
- [key: string]: string[];
50
- };
51
- /**
52
- * Map of weekday Torah Readings
53
- * aliyot `1` through `3` for Monday and Thursday
54
- */
55
- weekday?: {
56
- [key: string]: string[];
57
- };
58
- combined?: boolean;
59
- p1?: string;
60
- p2?: string;
61
- num1?: number;
62
- num2?: number;
63
- };
64
- type SpecialReading = {
65
- /** Map of aliyot `1` through `7` plus `M` for maftir */
66
- aliyot: AliyotMap;
67
- /**
68
- * Explanations for special readings,
69
- * keyed by aliyah number, `M` for maftir or `haftara` for Haftarah
70
- */
71
- reason: StringMap;
72
- /** Haftarah object(s) */
73
- haft?: Aliyah | Aliyah[];
74
- /** Haftarah object(s) for Sephardim */
75
- seph?: Aliyah | Aliyah[];
76
- };
77
- /**
78
- * Leyning base - weekday, parsha hashavua or holiday
79
- */
80
- type LeyningBase = {
81
- /** Name of the parsha hashavua or holiday */
82
- name: LeyningNames;
83
- /** Such as `Genesis 1:1 - 6:8` */
84
- summary: string;
85
- summaryParts?: Aliyah[];
86
- note?: string;
87
- };
88
- /**
89
- * Parashat haShavua - weekday or Shabbat
90
- */
91
- type LeyningParshaHaShavua = LeyningBase & {
92
- /** An array of either 1 (regular) or 2 (doubled parsha). `undefined` for holiday readings */
93
- parsha?: string[];
94
- /** 1 for Bereshit, 2 for Noach, etc. `undefined` for holiday readings */
95
- parshaNum?: number | number[];
96
- };
97
- /**
98
- * Parashat haShavua - weekday
99
- */
100
- type LeyningWeekday = LeyningParshaHaShavua & {
101
- /** Optional map of weekday Torah Readings aliyot `1` through `3` for Monday and Thursday */
102
- weekday?: AliyotMap;
103
- };
104
- type HaftarahProps = {
105
- /** Haftarah object */
106
- haft: Aliyah | Aliyah[];
107
- /** Haftarah, such as `Isaiah 42:5 – 43:11` */
108
- haftara: string;
109
- /** Number of verses in the Haftarah */
110
- haftaraNumV?: number;
111
- };
112
- /**
113
- * Shabbat and holiday leyning always has full kriyah and haftarah
114
- */
115
- type LeyningShabbatHoliday = LeyningBase & HaftarahProps & {
116
- /** Map of aliyot `1` through `7` plus `M` for maftir */
117
- fullkriyah: AliyotMap;
118
- /** Haftarah object for Sephardim */
119
- seph?: Aliyah | Aliyah[];
120
- /** Haftarah for Sephardim, such as `Isaiah 42:5 - 42:21` */
121
- sephardic?: string;
122
- /** Number of verses in the Haftarah for Sephardim */
123
- sephardicNumV?: number;
124
- /** Explanations for special readings, keyed by aliyah number, `M` for maftir or `haftara` for Haftarah */
125
- reason?: StringMap;
126
- /** 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 */
127
- megillah?: AliyotMap;
128
- /** Triennial alternate Haftara */
129
- triHaftara?: string;
130
- /** Triennial alternate Haftara number of verses */
131
- triHaftaraNumV?: number;
132
- };
133
- type Leyning = LeyningBase & LeyningParshaHaShavua & LeyningShabbatHoliday & LeyningWeekday;
134
-
135
- /**
136
- * Names of the books of the Torah. BOOK[1] === 'Genesis'
137
- * @readonly
138
- */
139
- declare const BOOK: readonly ["", "Genesis", "Exodus", "Leviticus", "Numbers", "Deuteronomy"];
140
- /**
141
- * The number of verses in each book of the Tanakh.
142
- * @readonly
143
- */
144
- declare const NUM_VERSES: NumVerses;
145
- type NumVerses = {
146
- readonly [book: string]: readonly number[];
147
- };
148
- /**
149
- * Formats parsha as a string
150
- * @param parsha untranslated name like 'Pinchas' or ['Pinchas'] or ['Matot','Masei']
151
- */
152
- declare function parshaToString(parsha: string | string[]): string;
153
- /**
154
- * Calculates the number of verses in an aliyah or haftara based on
155
- * the `b` (begin verse), `e` (end verse) and `k` (book).
156
- * Modifies `aliyah` by setting the `v` field.
157
- */
158
- declare function calculateNumVerses(aliyah: Aliyah): number;
159
- /**
160
- * Formats an aliyah object like "Numbers 28:9-28:15"
161
- */
162
- declare function formatAliyahWithBook(a: Aliyah): string;
163
- /**
164
- * Formats an aliyah object like "Numbers 28:9-15"
165
- */
166
- declare function formatAliyahShort(aliyah: Aliyah, showBook: boolean): string;
167
-
168
- /**
169
- * Summarizes an `AliyotMap` by collapsing all adjacent aliyot.
170
- * Finds any non-overlapping parts (e.g. special 7th aliyah or maftir)
171
- */
172
- declare function makeLeyningParts(aliyot: AliyotMap): Aliyah[];
173
- /**
174
- * Returns a string representation of the leyning parts.
175
- * Separate verse ranges read from the same book are separated
176
- * by commas, e.g. `Isaiah 6:1-7:6, 9:5-6`.
177
- * Verse ranges from different books are separated by semicolons,
178
- * e.g. `Genesis 21:1-34; Numbers 29:1-6`.
179
- */
180
- declare function makeSummaryFromParts(parts: Aliyah | Aliyah[]): string;
181
- /**
182
- * Makes a summary of the leyning, like "Genesis 6:9-11:32"
183
- */
184
- declare function makeLeyningSummary(aliyot: AliyotMap): string;
185
-
186
- type JsonFestivalAliyah = {
187
- k: number | string;
188
- b: string;
189
- e: string;
190
- v?: number;
191
- p?: number;
192
- };
193
- type JsonFestivalAliyotMap = {
194
- [key: string]: JsonFestivalAliyah;
195
- };
196
- type JsonFestivalLeyning = {
197
- haft?: JsonFestivalAliyah | JsonFestivalAliyah[];
198
- seph?: JsonFestivalAliyah | JsonFestivalAliyah[];
199
- fullkriyah?: JsonFestivalAliyotMap;
200
- megillah?: string;
201
- alias?: boolean;
202
- key?: string;
203
- note?: string;
204
- il?: boolean;
205
- };
206
-
207
- /**
208
- * Is there a special festival Torah Reading for `holiday`?
209
- */
210
- declare function hasFestival(holiday: string): boolean;
211
- /**
212
- * Returns the raw metadata for festival reading for `holiday`
213
- */
214
- declare function lookupFestival(holiday: string): JsonFestivalLeyning | undefined;
215
-
216
- /**
217
- * Based on the event date, type and title, finds the relevant leyning key
218
- * @param ev event
219
- * @param [il] true if Israel holiday scheme
220
- * @returns key to look up in holiday-reading.json
221
- */
222
- declare function getLeyningKeyForEvent(ev: Event, il?: boolean): string | undefined;
223
-
224
- /**
225
- * Determines if the regular parashat haShavua coincides with an event that requires
226
- * a special maftir or Haftara (for example Shabbat HaGadol, Shabbat Chanukah, Rosh
227
- * Chodesh or Machar Chodesh, etc.).
228
- *
229
- * This function does not modify `aliyot`. Instead, it returns a deep copy
230
- * with `aliyot['M']` replaced and sets `reason.M`
231
- * (and in some cases the 6th and 7th aliyah, setting `reason['7']`).
232
- *
233
- * If a special Haftarah applies, the result will have a `haft` property
234
- * pointing to Haftarah object and sets `reason.haftara`.
235
- */
236
- declare function specialReadings2(parsha: string[], hd: HDate, il: boolean, aliyot: AliyotMap): SpecialReading;
237
-
238
- /**
239
- * Looks up leyning for a given holiday key. Key should be an
240
- * (untranslated) string used in holiday-readings.json. Returns some
241
- * of full kriyah aliyot, special Maftir, special Haftarah
242
- * @param key name from `holiday-readings.json` to find
243
- */
244
- declare function getLeyningForHolidayKey(key?: string, cholHaMoedDay?: number, il?: boolean): Leyning | undefined;
245
- /**
246
- * Looks up leyning for a given holiday. Returns some
247
- * of full kriyah aliyot, special Maftir, special Haftarah
248
- * @param ev the Hebcal event associated with this leyning
249
- * @param [il] true if Israel holiday scheme
250
- * @returns map of aliyot
251
- */
252
- declare function getLeyningForHoliday(ev: Event, il?: boolean): Leyning | undefined;
253
-
254
- /**
255
- * Transliterated English and Hebrew names of this parsha
256
- * @param parsha untranslated name like ['Pinchas'] or ['Matot','Masei']
257
- */
258
- declare function makeLeyningNames(parsha: string[]): LeyningNames;
259
- /**
260
- * Looks up Monday/Thursday aliyot for a regular parsha
261
- * @param parsha untranslated name like 'Pinchas' or ['Pinchas'] or ['Matot','Masei']
262
- */
263
- declare function getWeekdayReading(parsha: string | string[]): AliyotMap;
264
- /**
265
- * Looks up regular leyning for a weekly parsha with no special readings
266
- * @param parsha untranslated name like 'Pinchas' or ['Pinchas'] or ['Matot','Masei']
267
- */
268
- declare function getLeyningForParsha(parsha: string | string[]): Leyning;
269
- /**
270
- * Looks up leyning for a regular Shabbat parsha, including any special
271
- * maftir or Haftara.
272
- * @param ev the Hebcal event associated with this leyning
273
- * @param [il] in Israel
274
- * @returns map of aliyot
275
- */
276
- declare function getLeyningForParshaHaShavua(ev: Event, il?: boolean): Leyning;
277
- /**
278
- * Returns the parsha metadata
279
- * @param parsha untranslated name like 'Pinchas' or ['Pinchas'] or ['Matot','Masei']
280
- */
281
- declare function lookupParsha(parsha: string | string[]): ParshaMeta;
282
-
283
- /**
284
- * Looks up leyning for a regular Shabbat, Monday/Thursday weekday or holiday.
285
- *
286
- * If `hdate` coincides with a holiday that has Torah reading, returns the
287
- * reading for that day (see {@link getLeyningForHoliday})
288
- *
289
- * Otherwise, if `hdate` is a Saturday, returns {@link getLeyningForParshaHaShavua}
290
- *
291
- * Otherwise, if `hdate` is a Monday or Thursday, returns {@link Leyning} for the
292
- * Parashat haShavua, containing only the `weekday` aliyot (no `fullkriyah`).
293
- *
294
- * Otherwise, returns `undefined`.
295
- *
296
- * @param {HDate} hdate Hebrew Date
297
- * @param {boolean} il in Israel
298
- * @param {boolean} [wantarray] to return an array of 0 or more readings
299
- */
300
- declare function getLeyningOnDate(hdate: HDate, il: boolean, wantarray?: false): Leyning | LeyningWeekday | undefined;
301
- declare function getLeyningOnDate(hdate: HDate, il: boolean, wantarray: true): (Leyning | LeyningWeekday)[];
302
-
303
- interface StringToBoolMap {
304
- [key: string]: boolean;
305
- }
306
- declare function getParshaDates(events: Event[]): StringToBoolMap;
307
- declare function writeFullKriyahCsv(stream: WriteStream, hyear: number, il: boolean): void;
308
- declare function writeHolidayMincha(stream: WriteStream, ev: HolidayEvent, il: boolean): void;
309
- /**
310
- * Formats reading for CSV
311
- */
312
- declare function writeCsvLines(stream: WriteStream, ev: Event, reading: Leyning, il: boolean, isParsha: boolean): void;
313
-
314
- /**
315
- * Makes a deep copy of the src object using JSON stringify and parse
316
- */
317
- declare function clone(src: any): any;
318
- type Haftarah = Aliyah | Aliyah[] | JsonFestivalAliyah | JsonFestivalAliyah[];
319
- declare function cloneHaftara(haft: Haftarah): Aliyah | Aliyah[];
320
- /**
321
- * Returns the total number of verses in an array of Aliyah (or haftarah) objects
322
- */
323
- declare function sumVerses(aliyot: Haftarah): number;
324
-
325
- export { type Aliyah, type AliyotMap, BOOK, type Haftarah, type HaftarahProps, type Leyning, type LeyningBase, type LeyningNames, type LeyningParshaHaShavua, type LeyningShabbatHoliday, type LeyningWeekday, NUM_VERSES, type NumVerses, type ParshaMeta, type SpecialReading, type StringMap, type StringToBoolMap, calculateNumVerses, clone, cloneHaftara, formatAliyahShort, formatAliyahWithBook, getLeyningForHoliday, getLeyningForHolidayKey, getLeyningForParsha, getLeyningForParshaHaShavua, getLeyningKeyForEvent, getLeyningOnDate, getParshaDates, getWeekdayReading, hasFestival, lookupFestival, lookupParsha, makeLeyningNames, makeLeyningParts, makeLeyningSummary, makeSummaryFromParts, parshaToString, specialReadings2, sumVerses, writeCsvLines, writeFullKriyahCsv, writeHolidayMincha };
@@ -1,36 +0,0 @@
1
- declare const _default: {
2
- Genesis: number[];
3
- Exodus: number[];
4
- Leviticus: number[];
5
- Numbers: number[];
6
- Deuteronomy: number[];
7
- Joshua: number[];
8
- Judges: number[];
9
- Ruth: number[];
10
- "I Samuel": number[];
11
- "II Samuel": number[];
12
- "I Kings": number[];
13
- "II Kings": number[];
14
- Isaiah: number[];
15
- Jeremiah: number[];
16
- Lamentations: number[];
17
- Baruch: number[];
18
- Esther: number[];
19
- Ecclesiastes: number[];
20
- "Song of Songs": number[];
21
- Ezekiel: number[];
22
- Daniel: number[];
23
- Hosea: number[];
24
- Joel: number[];
25
- Amos: number[];
26
- Obadiah: number[];
27
- Jonah: number[];
28
- Micah: number[];
29
- Nachum: number[];
30
- Habakkuk: number[];
31
- Zephaniah: number[];
32
- Haggai: number[];
33
- Zechariah: number[];
34
- Malachi: number[];
35
- };
36
- export default _default;