wideholy 0.1.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.
- package/LICENSE +21 -0
- package/README.md +315 -0
- package/dist/index.d.ts +201 -0
- package/dist/index.js +125 -0
- package/package.json +45 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 WideHoly
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,315 @@
|
|
|
1
|
+
# wideholy
|
|
2
|
+
|
|
3
|
+
[](https://www.npmjs.com/package/wideholy)
|
|
4
|
+
[](https://www.typescriptlang.org/)
|
|
5
|
+
[](https://opensource.org/licenses/MIT)
|
|
6
|
+
[](https://www.npmjs.com/package/wideholy)
|
|
7
|
+
|
|
8
|
+
TypeScript SDK for **WideHoly** — cross-religion scripture search, verse comparison, verse of the day, religious calendar, and commentary across 5 world religions. Access 236,866 scripture records spanning Christianity (124K verses), Islam (31K ayahs), Judaism (69K verses), Hinduism (6,800 verses), and Buddhism (5,326 texts) through a unified, zero-dependency API client.
|
|
9
|
+
|
|
10
|
+
Built on the [WideHoly](https://wideholy.com) platform, which aggregates scripture data from 5 religion-specific sites — [WideBible](https://widebible.com), [WideQuran](https://widequran.com), [WideTorah](https://widetorah.com), [WideGita](https://widegita.com), and [WideSutra](https://widesutra.com) — into a single cross-religion hub with comparison tools, shared topics, and a unified religious calendar.
|
|
11
|
+
|
|
12
|
+
> **Explore the interactive tools at [wideholy.com](https://wideholy.com)** — [Compare Verses](https://wideholy.com/compare/), [Religious Calendar](https://wideholy.com/calendar/), [Cross-Religion Topics](https://wideholy.com/topics/)
|
|
13
|
+
|
|
14
|
+
## Table of Contents
|
|
15
|
+
|
|
16
|
+
- [Install](#install)
|
|
17
|
+
- [Quick Start](#quick-start)
|
|
18
|
+
- [What You'll Find on WideHoly](#what-youll-find-on-wideholy)
|
|
19
|
+
- [Five World Scriptures](#five-world-scriptures)
|
|
20
|
+
- [Cross-Religion Comparison](#cross-religion-comparison)
|
|
21
|
+
- [Religious Calendar](#religious-calendar)
|
|
22
|
+
- [API Reference](#api-reference)
|
|
23
|
+
- [TypeScript Types](#typescript-types)
|
|
24
|
+
- [Learn More About World Scriptures](#learn-more-about-world-scriptures)
|
|
25
|
+
- [Also Available for Python](#also-available-for-python)
|
|
26
|
+
- [WideHoly Family](#wideholy-family)
|
|
27
|
+
- [License](#license)
|
|
28
|
+
|
|
29
|
+
## Install
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
npm install wideholy
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
yarn add wideholy
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
pnpm add wideholy
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
Zero runtime dependencies. Uses native `fetch` (Node 18+, Deno, Bun, browsers).
|
|
44
|
+
|
|
45
|
+
Works in any JavaScript runtime with global `fetch`:
|
|
46
|
+
|
|
47
|
+
| Runtime | Version |
|
|
48
|
+
|---------|---------|
|
|
49
|
+
| Node.js | 18+ |
|
|
50
|
+
| Deno | 1.0+ |
|
|
51
|
+
| Bun | 1.0+ |
|
|
52
|
+
| Browsers | All modern (Chrome, Firefox, Safari, Edge) |
|
|
53
|
+
|
|
54
|
+
## Quick Start
|
|
55
|
+
|
|
56
|
+
```typescript
|
|
57
|
+
import { WideHoly } from "wideholy";
|
|
58
|
+
|
|
59
|
+
const api = new WideHoly();
|
|
60
|
+
|
|
61
|
+
// Get today's verse of the day from the Bible
|
|
62
|
+
const votd = await api.verseOfTheDay("bible");
|
|
63
|
+
console.log(votd.reference); // e.g. "Psalm 23:1"
|
|
64
|
+
console.log(votd.text); // "The LORD is my shepherd; I shall not want."
|
|
65
|
+
|
|
66
|
+
// Compare Genesis 1:1 with Quran Al-Fatihah 1
|
|
67
|
+
const result = await api.compare("bible:genesis.1.1", "quran:al-fatihah.1");
|
|
68
|
+
console.log(result.verse_a.text); // "In the beginning God created..."
|
|
69
|
+
console.log(result.verse_b.text); // "In the name of Allah..."
|
|
70
|
+
|
|
71
|
+
// Search across all religions
|
|
72
|
+
const suggestions = await api.searchSuggest("love");
|
|
73
|
+
for (const s of suggestions.suggestions) {
|
|
74
|
+
console.log(` ${s.religion}: ${s.text} (${s.type})`);
|
|
75
|
+
}
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
## What You'll Find on WideHoly
|
|
79
|
+
|
|
80
|
+
### Five World Scriptures
|
|
81
|
+
|
|
82
|
+
WideHoly aggregates scripture data from 5 major world religions, each with its own dedicated site for deep exploration. The hub API provides unified cross-religion access to all 236,866 records.
|
|
83
|
+
|
|
84
|
+
| Religion | Scripture | Books | Records | Translations | Native Script |
|
|
85
|
+
|----------|-----------|-------|---------|-------------|---------------|
|
|
86
|
+
| Christianity | Holy Bible | 66 books (OT + NT) | 124,425 verses | KJV, NIV, ESV, NASB, NLT, ASV | English (Greek/Hebrew source) |
|
|
87
|
+
| Islam | Holy Quran | 114 surahs | 31,102 ayahs | Sahih International, Pickthall, Yusuf Ali | Arabic |
|
|
88
|
+
| Judaism | Tanakh + Talmud | 24 books + 63 tractates | 69,213 verses + 2,121 dapim | JPS, Koren, Artscroll | Hebrew / Aramaic |
|
|
89
|
+
| Hinduism | Bhagavad Gita | 18 chapters | 6,800 verses | Swami Mukundananda, Eknath Easwaran | Sanskrit / Devanagari |
|
|
90
|
+
| Buddhism | Tripitaka + Mahayana | 5 collections | 5,326 texts | Thanissaro Bhikkhu, Bhikkhu Bodhi | Pali / Sanskrit |
|
|
91
|
+
|
|
92
|
+
Each religion's data includes structured metadata: book/surah/chapter hierarchy, verse references, multiple translation editions, original language text, and cross-referenced topics for thematic exploration.
|
|
93
|
+
|
|
94
|
+
```typescript
|
|
95
|
+
import { WideHoly } from "wideholy";
|
|
96
|
+
|
|
97
|
+
const api = new WideHoly();
|
|
98
|
+
|
|
99
|
+
// Get a random verse from any religion
|
|
100
|
+
const verse = await api.randomVerse();
|
|
101
|
+
console.log(`[${verse.religion}] ${verse.reference}: ${verse.text}`);
|
|
102
|
+
|
|
103
|
+
// Get today's Quran verse of the day
|
|
104
|
+
const quranVotd = await api.verseOfTheDay("quran");
|
|
105
|
+
console.log(quranVotd.text); // Today's selected ayah in English
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
The 5 religions use different verse reference formats. WideHoly normalizes all references to a `religion:book.chapter.verse` pattern for unified access:
|
|
109
|
+
|
|
110
|
+
| Religion | Reference Format | Example |
|
|
111
|
+
|----------|-----------------|---------|
|
|
112
|
+
| Bible | `bible:book.chapter.verse` | `bible:genesis.1.1` |
|
|
113
|
+
| Quran | `quran:surah.ayah` | `quran:al-fatihah.1` |
|
|
114
|
+
| Torah | `torah:book.chapter.verse` | `torah:genesis.1.1` |
|
|
115
|
+
| Gita | `gita:chapter.verse` | `gita:2.47` |
|
|
116
|
+
| Sutra | `sutra:collection.text` | `sutra:dhammapada.1` |
|
|
117
|
+
|
|
118
|
+
Learn more: [WideBible](https://widebible.com) · [WideQuran](https://widequran.com) · [WideTorah](https://widetorah.com) · [WideGita](https://widegita.com) · [WideSutra](https://widesutra.com)
|
|
119
|
+
|
|
120
|
+
### Cross-Religion Comparison
|
|
121
|
+
|
|
122
|
+
WideHoly provides 10 universal spiritual themes for cross-religion comparison, showing how different traditions address the same fundamental questions of human existence. Each theme includes curated verses and scholarly summaries from all 5 religions.
|
|
123
|
+
|
|
124
|
+
| Topic | Description | Religions |
|
|
125
|
+
|-------|-------------|-----------|
|
|
126
|
+
| Creation | Origin of the universe and humanity | Bible, Quran, Torah, Gita, Sutra |
|
|
127
|
+
| Prayer | Communication with the divine | Bible, Quran, Torah, Gita, Sutra |
|
|
128
|
+
| Love | Divine and human love | Bible, Quran, Torah, Gita, Sutra |
|
|
129
|
+
| Afterlife | Death, judgment, and eternal life | Bible, Quran, Torah, Gita, Sutra |
|
|
130
|
+
| Compassion | Mercy, kindness, and empathy | Bible, Quran, Torah, Gita, Sutra |
|
|
131
|
+
| Fasting | Spiritual discipline and abstinence | Bible, Quran, Torah, Gita, Sutra |
|
|
132
|
+
| Forgiveness | Repentance and divine pardon | Bible, Quran, Torah, Gita, Sutra |
|
|
133
|
+
| Gratitude | Thankfulness and praise | Bible, Quran, Torah, Gita, Sutra |
|
|
134
|
+
| Justice | Righteousness and moral law | Bible, Quran, Torah, Gita, Sutra |
|
|
135
|
+
| Wisdom | Knowledge, understanding, and truth | Bible, Quran, Torah, Gita, Sutra |
|
|
136
|
+
|
|
137
|
+
```typescript
|
|
138
|
+
import { WideHoly } from "wideholy";
|
|
139
|
+
|
|
140
|
+
const api = new WideHoly();
|
|
141
|
+
|
|
142
|
+
// Compare how religions discuss creation
|
|
143
|
+
const creation = await api.crossReligion("creation");
|
|
144
|
+
console.log(creation.title); // "Creation"
|
|
145
|
+
console.log(creation.summary); // Scholarly overview
|
|
146
|
+
for (const entry of creation.religions) {
|
|
147
|
+
console.log(`${entry.religion}: ${entry.summary}`);
|
|
148
|
+
console.log(` Key verse: [${entry.key_verse.reference}] ${entry.key_verse.text}`);
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
// Compare specific verses side by side — Genesis vs Al-Fatihah
|
|
152
|
+
const result = await api.compare("bible:genesis.1.1", "quran:al-fatihah.1");
|
|
153
|
+
console.log(`Bible: ${result.verse_a.text}`);
|
|
154
|
+
console.log(`Quran: ${result.verse_b.text}`);
|
|
155
|
+
console.log(`Cross-religion: ${!result.same_religion}`); // true
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
Learn more: [Compare Verses](https://wideholy.com/compare/) · [Cross-Religion Topics](https://wideholy.com/topics/)
|
|
159
|
+
|
|
160
|
+
### Religious Calendar
|
|
161
|
+
|
|
162
|
+
WideHoly tracks 50 major religious events across all 5 traditions for 2026, including holidays, fasts, festivals, and observances. Events are sourced from each religion's liturgical calendar.
|
|
163
|
+
|
|
164
|
+
| Religion | Events | Examples |
|
|
165
|
+
|----------|--------|---------|
|
|
166
|
+
| Christianity | Easter, Christmas, Lent, Pentecost, Advent | Easter: April 5, 2026 |
|
|
167
|
+
| Islam | Ramadan, Eid al-Fitr, Eid al-Adha, Mawlid | Ramadan begins: February 18, 2026 |
|
|
168
|
+
| Judaism | Passover, Rosh Hashanah, Yom Kippur, Sukkot | Passover: April 2-9, 2026 |
|
|
169
|
+
| Hinduism | Diwali, Holi, Navratri, Maha Shivaratri | Diwali: October 20, 2026 |
|
|
170
|
+
| Buddhism | Vesak, Asalha Puja, Kathina, Magha Puja | Vesak: May 12, 2026 |
|
|
171
|
+
|
|
172
|
+
```typescript
|
|
173
|
+
import { WideHoly } from "wideholy";
|
|
174
|
+
|
|
175
|
+
const api = new WideHoly();
|
|
176
|
+
|
|
177
|
+
// Get all religious events for March 2026
|
|
178
|
+
const events = await api.calendar({ month: 3 });
|
|
179
|
+
for (const e of events.events) {
|
|
180
|
+
console.log(` ${e.date} ${e.religion.padEnd(10)} ${e.name}`);
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
// Get only Jewish holidays for 2026
|
|
184
|
+
const torahEvents = await api.calendar({ religion: "torah" });
|
|
185
|
+
for (const e of torahEvents.events) {
|
|
186
|
+
console.log(` ${e.date} ${e.name}`);
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
// Get Islamic events in December
|
|
190
|
+
const islamDec = await api.calendar({ religion: "quran", month: 12 });
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
Learn more: [Religious Calendar](https://wideholy.com/calendar/)
|
|
194
|
+
|
|
195
|
+
## Features
|
|
196
|
+
|
|
197
|
+
- **Zero dependencies** -- uses native `fetch`, no axios/node-fetch/undici
|
|
198
|
+
- **Fully typed** -- all 8 endpoints return typed response interfaces
|
|
199
|
+
- **Cross-religion** -- unified API across Bible, Quran, Torah, Gita, and Sutra
|
|
200
|
+
- **Tree-shakeable** -- ESM-only output, import only what you need
|
|
201
|
+
- **Configurable** -- custom base URL for local development or self-hosted instances
|
|
202
|
+
- **Lightweight** -- under 4 KB bundled, no bloat
|
|
203
|
+
|
|
204
|
+
## API Reference
|
|
205
|
+
|
|
206
|
+
| Method | Endpoint | Description |
|
|
207
|
+
|--------|----------|-------------|
|
|
208
|
+
| `verseOfTheDay(religion?)` | `GET /api/v1/verse-of-the-day/` | Curated verse of the day, deterministic per date |
|
|
209
|
+
| `randomVerse(religion?)` | `GET /api/v1/random/` | Random verse, optionally filtered by religion |
|
|
210
|
+
| `compare(refA, refB)` | `GET /api/v1/compare/` | Side-by-side verse comparison |
|
|
211
|
+
| `searchSuggest(query, religion?)` | `GET /api/v1/search/suggest/` | Autocomplete across topics, people, glossary |
|
|
212
|
+
| `topicVerses(topic)` | `GET /api/v1/topics/{slug}/verses/` | Verses for a topic across religions |
|
|
213
|
+
| `crossReligion(topic)` | `GET /api/v1/cross-religion/{topic}/` | Thematic comparison with summaries |
|
|
214
|
+
| `calendar(options?)` | `GET /api/v1/calendar/` | Religious holidays and observances |
|
|
215
|
+
| `commentary(verseRef)` | `GET /api/v1/commentary/{verseRef}/` | Scholarly commentary (tafsir, Rashi, Gita) |
|
|
216
|
+
|
|
217
|
+
### Example: Commentary
|
|
218
|
+
|
|
219
|
+
```typescript
|
|
220
|
+
import { WideHoly } from "wideholy";
|
|
221
|
+
|
|
222
|
+
const api = new WideHoly();
|
|
223
|
+
|
|
224
|
+
// Get Quran tafsir for Al-Fatihah verse 1
|
|
225
|
+
const comm = await api.commentary("quran:al-fatihah.1");
|
|
226
|
+
console.log(comm.religion); // "quran"
|
|
227
|
+
for (const c of comm.commentaries) {
|
|
228
|
+
console.log(`[${c.source}] ${c.author}: ${c.text.slice(0, 100)}...`);
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
// Get Torah Rashi commentary for Genesis 1:1
|
|
232
|
+
const rashi = await api.commentary("torah:genesis.1.1");
|
|
233
|
+
for (const c of rashi.commentaries) {
|
|
234
|
+
console.log(`${c.author}: ${c.text}`);
|
|
235
|
+
}
|
|
236
|
+
```
|
|
237
|
+
|
|
238
|
+
### Custom Base URL
|
|
239
|
+
|
|
240
|
+
```typescript
|
|
241
|
+
// Use a local development server
|
|
242
|
+
const dev = new WideHoly("http://localhost:8000");
|
|
243
|
+
|
|
244
|
+
// Use a self-hosted instance
|
|
245
|
+
const selfHosted = new WideHoly("https://scripture.internal.company.com");
|
|
246
|
+
```
|
|
247
|
+
|
|
248
|
+
Full API documentation at [wideholy.com/developers/](https://wideholy.com/developers/).
|
|
249
|
+
OpenAPI 3.1.0 spec: [wideholy.com/api/schema/](https://wideholy.com/api/schema/).
|
|
250
|
+
|
|
251
|
+
## TypeScript Types
|
|
252
|
+
|
|
253
|
+
All API responses are fully typed. Import individual types as needed:
|
|
254
|
+
|
|
255
|
+
```typescript
|
|
256
|
+
import type {
|
|
257
|
+
VerseOfTheDay,
|
|
258
|
+
RandomVerse,
|
|
259
|
+
CompareResult,
|
|
260
|
+
Suggestions,
|
|
261
|
+
TopicVerses,
|
|
262
|
+
CrossReligionResult,
|
|
263
|
+
CalendarEvents,
|
|
264
|
+
CalendarOptions,
|
|
265
|
+
Commentary,
|
|
266
|
+
Verse,
|
|
267
|
+
CalendarEvent,
|
|
268
|
+
CommentaryEntry,
|
|
269
|
+
} from "wideholy";
|
|
270
|
+
```
|
|
271
|
+
|
|
272
|
+
### Key Types
|
|
273
|
+
|
|
274
|
+
| Type | Description |
|
|
275
|
+
|------|-------------|
|
|
276
|
+
| `VerseOfTheDay` | Daily verse with religion, reference, text, translation, date |
|
|
277
|
+
| `RandomVerse` | Random verse with full metadata |
|
|
278
|
+
| `CompareResult` | Two verses side-by-side with `same_religion` flag |
|
|
279
|
+
| `Suggestions` | Search autocomplete with query and suggestion list |
|
|
280
|
+
| `TopicVerses` | Per-religion verse collections for a topic |
|
|
281
|
+
| `CrossReligionResult` | Thematic comparison with summaries per religion |
|
|
282
|
+
| `CalendarEvents` | Religious events filtered by year, month, religion |
|
|
283
|
+
| `Commentary` | Scholarly annotations (tafsir, Rashi, Gita commentaries) |
|
|
284
|
+
| `Verse` | Base verse type: religion, reference, text, book, chapter, verse |
|
|
285
|
+
| `CalendarOptions` | Query options: `{ religion?, year?, month? }` |
|
|
286
|
+
|
|
287
|
+
## Learn More About World Scriptures
|
|
288
|
+
|
|
289
|
+
- **Compare**: [Verse Comparison Tool](https://wideholy.com/compare/) · [Cross-Religion Topics](https://wideholy.com/topics/)
|
|
290
|
+
- **Calendar**: [Religious Calendar 2026](https://wideholy.com/calendar/)
|
|
291
|
+
- **Browse**: [Bible Books](https://widebible.com) · [Quran Surahs](https://widequran.com) · [Torah Books](https://widetorah.com) · [Gita Chapters](https://widegita.com) · [Buddhist Sutras](https://widesutra.com)
|
|
292
|
+
- **API**: [REST API Docs](https://wideholy.com/developers/) · [OpenAPI Spec](https://wideholy.com/api/schema/)
|
|
293
|
+
- **Python**: [PyPI Package](https://pypi.org/project/wideholy/)
|
|
294
|
+
|
|
295
|
+
## Also Available for Python
|
|
296
|
+
|
|
297
|
+
| Platform | Install | Link |
|
|
298
|
+
|----------|---------|------|
|
|
299
|
+
| **PyPI** | `pip install wideholy` | [PyPI](https://pypi.org/project/wideholy/) |
|
|
300
|
+
| **MCP** | `uvx --from "wideholy[mcp]" python -m wideholy.mcp_server` | [Config](#) |
|
|
301
|
+
|
|
302
|
+
## WideHoly Family
|
|
303
|
+
|
|
304
|
+
| Site | Domain | Focus |
|
|
305
|
+
|------|--------|-------|
|
|
306
|
+
| WideBible | [widebible.com](https://widebible.com) | 66 books, 124K verses, 6 translations, commentaries |
|
|
307
|
+
| WideQuran | [widequran.com](https://widequran.com) | 114 surahs, 31K ayahs, tafsir, hadith collections |
|
|
308
|
+
| WideTorah | [widetorah.com](https://widetorah.com) | 24 Tanakh books, 63 Talmud tractates, Rashi commentary |
|
|
309
|
+
| WideGita | [widegita.com](https://widegita.com) | 18 chapters, 6,800 verses, Sanskrit, multiple commentaries |
|
|
310
|
+
| WideSutra | [widesutra.com](https://widesutra.com) | 5 collections, 5,326 texts, Pali/Sanskrit traditions |
|
|
311
|
+
| **WideHoly** | [**wideholy.com**](https://wideholy.com) | **Cross-religion hub -- comparison, calendar, unified search** |
|
|
312
|
+
|
|
313
|
+
## License
|
|
314
|
+
|
|
315
|
+
MIT License. See [LICENSE](LICENSE) for details.
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* TypeScript interfaces for WideHoly API responses.
|
|
3
|
+
*
|
|
4
|
+
* All types mirror the wideholy.com REST API JSON structure.
|
|
5
|
+
* See https://wideholy.com/api/schema/ for the OpenAPI 3.1.0 spec.
|
|
6
|
+
*/
|
|
7
|
+
/** A scripture verse from any of the 5 world religions. */
|
|
8
|
+
interface Verse {
|
|
9
|
+
religion: string;
|
|
10
|
+
reference: string;
|
|
11
|
+
text: string;
|
|
12
|
+
translation: string;
|
|
13
|
+
book: string;
|
|
14
|
+
chapter: number;
|
|
15
|
+
verse: number;
|
|
16
|
+
}
|
|
17
|
+
/** Verse of the day response. */
|
|
18
|
+
interface VerseOfTheDay {
|
|
19
|
+
religion: string;
|
|
20
|
+
reference: string;
|
|
21
|
+
text: string;
|
|
22
|
+
translation: string;
|
|
23
|
+
book: string;
|
|
24
|
+
chapter: number;
|
|
25
|
+
verse: number;
|
|
26
|
+
date: string;
|
|
27
|
+
}
|
|
28
|
+
/** Random verse response. */
|
|
29
|
+
interface RandomVerse {
|
|
30
|
+
religion: string;
|
|
31
|
+
reference: string;
|
|
32
|
+
text: string;
|
|
33
|
+
translation: string;
|
|
34
|
+
book: string;
|
|
35
|
+
chapter: number;
|
|
36
|
+
verse: number;
|
|
37
|
+
}
|
|
38
|
+
/** Side-by-side verse comparison result. */
|
|
39
|
+
interface CompareResult {
|
|
40
|
+
verse_a: Verse;
|
|
41
|
+
verse_b: Verse;
|
|
42
|
+
same_religion: boolean;
|
|
43
|
+
}
|
|
44
|
+
/** A single search suggestion. */
|
|
45
|
+
interface Suggestion {
|
|
46
|
+
text: string;
|
|
47
|
+
type: string;
|
|
48
|
+
religion: string;
|
|
49
|
+
url: string;
|
|
50
|
+
}
|
|
51
|
+
/** Search suggestions response. */
|
|
52
|
+
interface Suggestions {
|
|
53
|
+
query: string;
|
|
54
|
+
suggestions: Suggestion[];
|
|
55
|
+
}
|
|
56
|
+
/** Per-religion data within a topic. */
|
|
57
|
+
interface TopicReligionData {
|
|
58
|
+
religion: string;
|
|
59
|
+
verses: Verse[];
|
|
60
|
+
verse_count: number;
|
|
61
|
+
}
|
|
62
|
+
/** Topic verses response. */
|
|
63
|
+
interface TopicVerses {
|
|
64
|
+
topic: string;
|
|
65
|
+
religions_found: number;
|
|
66
|
+
verses: TopicReligionData[];
|
|
67
|
+
}
|
|
68
|
+
/** Per-religion summary for cross-religion comparison. */
|
|
69
|
+
interface CrossReligionEntry {
|
|
70
|
+
religion: string;
|
|
71
|
+
summary: string;
|
|
72
|
+
key_verse: Verse;
|
|
73
|
+
}
|
|
74
|
+
/** Cross-religion topic comparison result. */
|
|
75
|
+
interface CrossReligionResult {
|
|
76
|
+
topic: string;
|
|
77
|
+
title: string;
|
|
78
|
+
summary: string;
|
|
79
|
+
religions: CrossReligionEntry[];
|
|
80
|
+
}
|
|
81
|
+
/** A religious calendar event. */
|
|
82
|
+
interface CalendarEvent {
|
|
83
|
+
name: string;
|
|
84
|
+
date: string;
|
|
85
|
+
religion: string;
|
|
86
|
+
description: string;
|
|
87
|
+
}
|
|
88
|
+
/** Calendar response. */
|
|
89
|
+
interface CalendarEvents {
|
|
90
|
+
year: number;
|
|
91
|
+
month: number | null;
|
|
92
|
+
religion: string | null;
|
|
93
|
+
events: CalendarEvent[];
|
|
94
|
+
}
|
|
95
|
+
/** A commentary entry for a verse. */
|
|
96
|
+
interface CommentaryEntry {
|
|
97
|
+
source: string;
|
|
98
|
+
author: string;
|
|
99
|
+
text: string;
|
|
100
|
+
}
|
|
101
|
+
/** Commentary response. */
|
|
102
|
+
interface Commentary {
|
|
103
|
+
verse_ref: string;
|
|
104
|
+
religion: string;
|
|
105
|
+
commentaries: CommentaryEntry[];
|
|
106
|
+
}
|
|
107
|
+
/** Calendar query options. */
|
|
108
|
+
interface CalendarOptions {
|
|
109
|
+
religion?: string;
|
|
110
|
+
year?: number;
|
|
111
|
+
month?: number;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
* WideHoly API client — TypeScript wrapper for wideholy.com REST API.
|
|
116
|
+
*
|
|
117
|
+
* Zero dependencies. Uses native `fetch`.
|
|
118
|
+
*
|
|
119
|
+
* @example
|
|
120
|
+
* ```ts
|
|
121
|
+
* import { WideHoly } from "wideholy";
|
|
122
|
+
*
|
|
123
|
+
* const api = new WideHoly();
|
|
124
|
+
* const votd = await api.verseOfTheDay("bible");
|
|
125
|
+
* console.log(votd.reference); // Genesis 1:1
|
|
126
|
+
*
|
|
127
|
+
* const result = await api.compare("bible:genesis.1.1", "quran:al-fatihah.1");
|
|
128
|
+
* console.log(result.verse_a.text);
|
|
129
|
+
* ```
|
|
130
|
+
*/
|
|
131
|
+
|
|
132
|
+
declare class WideHoly {
|
|
133
|
+
private baseUrl;
|
|
134
|
+
/**
|
|
135
|
+
* Create a new WideHoly API client.
|
|
136
|
+
*
|
|
137
|
+
* @param baseUrl - API base URL. Defaults to `https://wideholy.com`.
|
|
138
|
+
*/
|
|
139
|
+
constructor(baseUrl?: string);
|
|
140
|
+
private get;
|
|
141
|
+
/**
|
|
142
|
+
* Get the verse of the day for a religion.
|
|
143
|
+
*
|
|
144
|
+
* Returns a curated verse, deterministic per religion per date.
|
|
145
|
+
*
|
|
146
|
+
* @param religion - Religion key (bible, quran, torah, gita, sutra).
|
|
147
|
+
*/
|
|
148
|
+
verseOfTheDay(religion?: string): Promise<VerseOfTheDay>;
|
|
149
|
+
/**
|
|
150
|
+
* Get a random verse, optionally filtered by religion.
|
|
151
|
+
*
|
|
152
|
+
* @param religion - Religion key. If omitted, picks a random religion.
|
|
153
|
+
*/
|
|
154
|
+
randomVerse(religion?: string): Promise<RandomVerse>;
|
|
155
|
+
/**
|
|
156
|
+
* Compare two verses side-by-side (same or cross-religion).
|
|
157
|
+
*
|
|
158
|
+
* Use `religion:ref` format for cross-religion comparison.
|
|
159
|
+
*
|
|
160
|
+
* @param refA - First verse reference (e.g. `"bible:genesis.1.1"`).
|
|
161
|
+
* @param refB - Second verse reference (e.g. `"quran:al-fatihah.1"`).
|
|
162
|
+
*/
|
|
163
|
+
compare(refA: string, refB: string): Promise<CompareResult>;
|
|
164
|
+
/**
|
|
165
|
+
* Autocomplete suggestions across religions.
|
|
166
|
+
*
|
|
167
|
+
* Returns topic, person, and glossary term suggestions matching the query.
|
|
168
|
+
*
|
|
169
|
+
* @param query - Search query prefix (minimum 2 characters).
|
|
170
|
+
* @param religion - Filter to a specific religion.
|
|
171
|
+
*/
|
|
172
|
+
searchSuggest(query: string, religion?: string): Promise<Suggestions>;
|
|
173
|
+
/**
|
|
174
|
+
* Get verses for a topic across all religions.
|
|
175
|
+
*
|
|
176
|
+
* @param topic - Topic slug (e.g. `"love"`, `"creation"`, `"prayer"`).
|
|
177
|
+
*/
|
|
178
|
+
topicVerses(topic: string): Promise<TopicVerses>;
|
|
179
|
+
/**
|
|
180
|
+
* Get cross-religion comparison for a universal spiritual theme.
|
|
181
|
+
*
|
|
182
|
+
* @param topic - Topic key (e.g. `"creation"`, `"prayer"`, `"love"`).
|
|
183
|
+
*/
|
|
184
|
+
crossReligion(topic: string): Promise<CrossReligionResult>;
|
|
185
|
+
/**
|
|
186
|
+
* Get religious calendar events.
|
|
187
|
+
*
|
|
188
|
+
* @param options - Optional filters: religion, year, month.
|
|
189
|
+
*/
|
|
190
|
+
calendar(options?: CalendarOptions): Promise<CalendarEvents>;
|
|
191
|
+
/**
|
|
192
|
+
* Get commentary for a verse.
|
|
193
|
+
*
|
|
194
|
+
* Supports Quran (tafsir), Torah (Rashi), and Gita commentaries.
|
|
195
|
+
*
|
|
196
|
+
* @param verseRef - Verse reference (e.g. `"quran:al-fatihah.1"`).
|
|
197
|
+
*/
|
|
198
|
+
commentary(verseRef: string): Promise<Commentary>;
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
export { type CalendarEvent, type CalendarEvents, type CalendarOptions, type Commentary, type CommentaryEntry, type CompareResult, type CrossReligionEntry, type CrossReligionResult, type RandomVerse, type Suggestion, type Suggestions, type TopicReligionData, type TopicVerses, type Verse, type VerseOfTheDay, WideHoly };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
// src/client.ts
|
|
2
|
+
var WideHoly = class {
|
|
3
|
+
baseUrl;
|
|
4
|
+
/**
|
|
5
|
+
* Create a new WideHoly API client.
|
|
6
|
+
*
|
|
7
|
+
* @param baseUrl - API base URL. Defaults to `https://wideholy.com`.
|
|
8
|
+
*/
|
|
9
|
+
constructor(baseUrl = "https://wideholy.com") {
|
|
10
|
+
this.baseUrl = baseUrl.replace(/\/+$/, "");
|
|
11
|
+
}
|
|
12
|
+
async get(path, params) {
|
|
13
|
+
const url = new URL(`/api/v1/${path}`, this.baseUrl);
|
|
14
|
+
if (params) {
|
|
15
|
+
Object.entries(params).forEach(([k, v]) => {
|
|
16
|
+
if (v !== void 0 && v !== null) {
|
|
17
|
+
url.searchParams.set(k, v);
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
const res = await fetch(url.toString());
|
|
22
|
+
if (!res.ok) throw new Error(`HTTP ${res.status}`);
|
|
23
|
+
return res.json();
|
|
24
|
+
}
|
|
25
|
+
// -- 1. Verse of the Day --------------------------------------------------
|
|
26
|
+
/**
|
|
27
|
+
* Get the verse of the day for a religion.
|
|
28
|
+
*
|
|
29
|
+
* Returns a curated verse, deterministic per religion per date.
|
|
30
|
+
*
|
|
31
|
+
* @param religion - Religion key (bible, quran, torah, gita, sutra).
|
|
32
|
+
*/
|
|
33
|
+
async verseOfTheDay(religion) {
|
|
34
|
+
return this.get(
|
|
35
|
+
"verse-of-the-day/",
|
|
36
|
+
religion ? { religion } : void 0
|
|
37
|
+
);
|
|
38
|
+
}
|
|
39
|
+
// -- 2. Random Verse ------------------------------------------------------
|
|
40
|
+
/**
|
|
41
|
+
* Get a random verse, optionally filtered by religion.
|
|
42
|
+
*
|
|
43
|
+
* @param religion - Religion key. If omitted, picks a random religion.
|
|
44
|
+
*/
|
|
45
|
+
async randomVerse(religion) {
|
|
46
|
+
return this.get(
|
|
47
|
+
"random/",
|
|
48
|
+
religion ? { religion } : void 0
|
|
49
|
+
);
|
|
50
|
+
}
|
|
51
|
+
// -- 3. Compare Verses ----------------------------------------------------
|
|
52
|
+
/**
|
|
53
|
+
* Compare two verses side-by-side (same or cross-religion).
|
|
54
|
+
*
|
|
55
|
+
* Use `religion:ref` format for cross-religion comparison.
|
|
56
|
+
*
|
|
57
|
+
* @param refA - First verse reference (e.g. `"bible:genesis.1.1"`).
|
|
58
|
+
* @param refB - Second verse reference (e.g. `"quran:al-fatihah.1"`).
|
|
59
|
+
*/
|
|
60
|
+
async compare(refA, refB) {
|
|
61
|
+
return this.get("compare/", { a: refA, b: refB });
|
|
62
|
+
}
|
|
63
|
+
// -- 4. Search Suggest ----------------------------------------------------
|
|
64
|
+
/**
|
|
65
|
+
* Autocomplete suggestions across religions.
|
|
66
|
+
*
|
|
67
|
+
* Returns topic, person, and glossary term suggestions matching the query.
|
|
68
|
+
*
|
|
69
|
+
* @param query - Search query prefix (minimum 2 characters).
|
|
70
|
+
* @param religion - Filter to a specific religion.
|
|
71
|
+
*/
|
|
72
|
+
async searchSuggest(query, religion) {
|
|
73
|
+
const params = { q: query };
|
|
74
|
+
if (religion) params.religion = religion;
|
|
75
|
+
return this.get("search/suggest/", params);
|
|
76
|
+
}
|
|
77
|
+
// -- 5. Topic Verses ------------------------------------------------------
|
|
78
|
+
/**
|
|
79
|
+
* Get verses for a topic across all religions.
|
|
80
|
+
*
|
|
81
|
+
* @param topic - Topic slug (e.g. `"love"`, `"creation"`, `"prayer"`).
|
|
82
|
+
*/
|
|
83
|
+
async topicVerses(topic) {
|
|
84
|
+
return this.get(`topics/${topic}/verses/`);
|
|
85
|
+
}
|
|
86
|
+
// -- 6. Cross-Religion Topic ----------------------------------------------
|
|
87
|
+
/**
|
|
88
|
+
* Get cross-religion comparison for a universal spiritual theme.
|
|
89
|
+
*
|
|
90
|
+
* @param topic - Topic key (e.g. `"creation"`, `"prayer"`, `"love"`).
|
|
91
|
+
*/
|
|
92
|
+
async crossReligion(topic) {
|
|
93
|
+
return this.get(`cross-religion/${topic}/`);
|
|
94
|
+
}
|
|
95
|
+
// -- 7. Religious Calendar ------------------------------------------------
|
|
96
|
+
/**
|
|
97
|
+
* Get religious calendar events.
|
|
98
|
+
*
|
|
99
|
+
* @param options - Optional filters: religion, year, month.
|
|
100
|
+
*/
|
|
101
|
+
async calendar(options) {
|
|
102
|
+
const params = {};
|
|
103
|
+
if (options?.religion) params.religion = options.religion;
|
|
104
|
+
if (options?.year) params.year = String(options.year);
|
|
105
|
+
if (options?.month) params.month = String(options.month);
|
|
106
|
+
return this.get(
|
|
107
|
+
"calendar/",
|
|
108
|
+
Object.keys(params).length > 0 ? params : void 0
|
|
109
|
+
);
|
|
110
|
+
}
|
|
111
|
+
// -- 8. Commentary --------------------------------------------------------
|
|
112
|
+
/**
|
|
113
|
+
* Get commentary for a verse.
|
|
114
|
+
*
|
|
115
|
+
* Supports Quran (tafsir), Torah (Rashi), and Gita commentaries.
|
|
116
|
+
*
|
|
117
|
+
* @param verseRef - Verse reference (e.g. `"quran:al-fatihah.1"`).
|
|
118
|
+
*/
|
|
119
|
+
async commentary(verseRef) {
|
|
120
|
+
return this.get(`commentary/${verseRef}/`);
|
|
121
|
+
}
|
|
122
|
+
};
|
|
123
|
+
export {
|
|
124
|
+
WideHoly
|
|
125
|
+
};
|
package/package.json
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "wideholy",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "TypeScript SDK for WideHoly -- cross-religion scripture search, verse comparison, verse of the day, religious calendar, and commentary across 5 world religions",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "dist/index.js",
|
|
7
|
+
"types": "dist/index.d.ts",
|
|
8
|
+
"files": [
|
|
9
|
+
"dist"
|
|
10
|
+
],
|
|
11
|
+
"scripts": {
|
|
12
|
+
"build": "tsup src/index.ts --format esm --dts",
|
|
13
|
+
"test": "vitest run"
|
|
14
|
+
},
|
|
15
|
+
"keywords": [
|
|
16
|
+
"bible",
|
|
17
|
+
"quran",
|
|
18
|
+
"torah",
|
|
19
|
+
"gita",
|
|
20
|
+
"sutra",
|
|
21
|
+
"scripture",
|
|
22
|
+
"religion",
|
|
23
|
+
"verse",
|
|
24
|
+
"cross-religion",
|
|
25
|
+
"comparison",
|
|
26
|
+
"commentary",
|
|
27
|
+
"calendar",
|
|
28
|
+
"verse-of-the-day",
|
|
29
|
+
"interfaith",
|
|
30
|
+
"typescript"
|
|
31
|
+
],
|
|
32
|
+
"author": "WideHoly",
|
|
33
|
+
"license": "MIT",
|
|
34
|
+
"homepage": "https://wideholy.com",
|
|
35
|
+
"repository": {
|
|
36
|
+
"type": "git",
|
|
37
|
+
"url": "https://github.com/dobestan/wideholy-js"
|
|
38
|
+
},
|
|
39
|
+
"dependencies": {},
|
|
40
|
+
"devDependencies": {
|
|
41
|
+
"tsup": "^8.0",
|
|
42
|
+
"typescript": "^5.7",
|
|
43
|
+
"vitest": "^2.0"
|
|
44
|
+
}
|
|
45
|
+
}
|