shamela 1.0.2 → 1.0.4

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/README.md CHANGED
@@ -1,27 +1,37 @@
1
1
  # Shamela
2
2
 
3
- [![wakatime](https://wakatime.com/badge/user/a0b906ce-b8e7-4463-8bce-383238df6d4b/project/faef70ab-efdb-448b-ab83-0fc66c95888e.svg)](https://wakatime.com/badge/user/a0b906ce-b8e7-4463-8bce-383238df6d4b/project/faef70ab-efdb-448b-ab83-0fc66c95888e) [![E2E](https://github.com/ragaeeb/shamela/actions/workflows/e2e.yml/badge.svg)](https://github.com/ragaeeb/shamela/actions/workflows/e2e.yml) [![Node.js CI](https://github.com/ragaeeb/shamela/actions/workflows/build.yml/badge.svg)](https://github.com/ragaeeb/shamela/actions/workflows/build.yml) ![GitHub License](https://img.shields.io/github/license/ragaeeb/shamela) ![GitHub Release](https://img.shields.io/github/v/release/ragaeeb/shamela) [![codecov](https://codecov.io/gh/ragaeeb/shamela/graph/badge.svg?token=PK55V1R324)](https://codecov.io/gh/ragaeeb/shamela) [![Size](https://deno.bundlejs.com/badge?q=shamela@1.0.2)](https://bundlejs.com/?q=shamela%401.0.2) ![typescript](https://badgen.net/badge/icon/typescript?icon=typescript&label&color=blue) ![npm](https://img.shields.io/npm/v/bitaboom) ![npm](https://img.shields.io/npm/dm/bitaboom) ![GitHub issues](https://img.shields.io/github/issues/ragaeeb/bitaboom) ![GitHub stars](https://img.shields.io/github/stars/ragaeeb/bitaboom?style=social)
3
+ [![wakatime](https://wakatime.com/badge/user/a0b906ce-b8e7-4463-8bce-383238df6d4b/project/faef70ab-efdb-448b-ab83-0fc66c95888e.svg)](https://wakatime.com/badge/user/a0b906ce-b8e7-4463-8bce-383238df6d4b/project/faef70ab-efdb-448b-ab83-0fc66c95888e)
4
+ [![E2E](https://github.com/ragaeeb/shamela/actions/workflows/e2e.yml/badge.svg)](https://github.com/ragaeeb/shamela/actions/workflows/e2e.yml)
5
+ [![Node.js CI](https://github.com/ragaeeb/shamela/actions/workflows/build.yml/badge.svg)](https://github.com/ragaeeb/shamela/actions/workflows/build.yml) ![GitHub License](https://img.shields.io/github/license/ragaeeb/shamela)
6
+ ![GitHub Release](https://img.shields.io/github/v/release/ragaeeb/shamela)
7
+ [![codecov](https://codecov.io/gh/ragaeeb/shamela/graph/badge.svg?token=PK55V1R324)](https://codecov.io/gh/ragaeeb/shamela)
8
+ [![Size](https://deno.bundlejs.com/badge?q=shamela@1.0.5)](https://bundlejs.com/?q=shamela%401.0.5)
9
+ ![typescript](https://badgen.net/badge/icon/typescript?icon=typescript&label&color=blue)
10
+ ![npm](https://img.shields.io/npm/v/shamela)
11
+ ![npm](https://img.shields.io/npm/dm/shamela)
12
+ ![GitHub issues](https://img.shields.io/github/issues/ragaeeb/shamela)
13
+ ![GitHub stars](https://img.shields.io/github/stars/ragaeeb/shamela?style=social)
4
14
 
5
15
  A `NodeJS` library for accessing and downloading Maktabah Shamela v4 APIs. This library provides easy-to-use functions to interact with the Shamela API, download master and book databases, and retrieve book data programmatically.
6
16
 
7
17
  ## Table of Contents
8
18
 
9
- - [Installation](#installation)
10
- - [Environment Variables](#environment-variables)
11
- - [Usage](#usage)
12
- - [Getting Started](#getting-started)
13
- - [API Functions](#api-functions)
14
- - [getMasterMetadata](#getmastermetadata)
15
- - [downloadMasterDatabase](#downloadmasterdatabase)
16
- - [getBookMetadata](#getbookmetadata)
17
- - [downloadBook](#downloadbook)
18
- - [getBook](#getbook)
19
- - [Examples](#examples)
20
- - [Downloading the Master Database](#downloading-the-master-database)
21
- - [Downloading a Book](#downloading-a-book)
22
- - [Retrieving Book Data](#retrieving-book-data)
23
- - [Testing](#testing)
24
- - [License](#license)
19
+ - [Installation](#installation)
20
+ - [Environment Variables](#environment-variables)
21
+ - [Usage](#usage)
22
+ - [Getting Started](#getting-started)
23
+ - [API Functions](#api-functions)
24
+ - [getMasterMetadata](#getmastermetadata)
25
+ - [downloadMasterDatabase](#downloadmasterdatabase)
26
+ - [getBookMetadata](#getbookmetadata)
27
+ - [downloadBook](#downloadbook)
28
+ - [getBook](#getbook)
29
+ - [Examples](#examples)
30
+ - [Downloading the Master Database](#downloading-the-master-database)
31
+ - [Downloading a Book](#downloading-a-book)
32
+ - [Retrieving Book Data](#retrieving-book-data)
33
+ - [Testing](#testing)
34
+ - [License](#license)
25
35
 
26
36
  ## Installation
27
37
 
@@ -77,7 +87,7 @@ getMasterMetadata(version?: number): Promise<GetMasterMetadataResponsePayload>
77
87
 
78
88
  ```
79
89
 
80
- - version (optional): The version number of the master database you want to fetch.
90
+ - version (optional): The version number of the master database you want to fetch.
81
91
 
82
92
  Example:
83
93
 
@@ -94,9 +104,9 @@ downloadMasterDatabase(options: DownloadMasterOptions): Promise<string>
94
104
 
95
105
  ```
96
106
 
97
- - options: An object containing:
98
- - masterMetadata (optional): The metadata obtained from getMasterMetadata.
99
- - outputFile: An object specifying the output path.
107
+ - options: An object containing:
108
+ - masterMetadata (optional): The metadata obtained from getMasterMetadata.
109
+ - outputFile: An object specifying the output path.
100
110
 
101
111
  Example:
102
112
 
@@ -114,10 +124,10 @@ Fetches metadata for a specific book.
114
124
  getBookMetadata(id: number, options?: GetBookMetadataOptions): Promise<GetBookMetadataResponsePayload>
115
125
  ```
116
126
 
117
- - id: The ID of the book.
118
- - options (optional): An object containing:
119
- - majorVersion: The major version of the book.
120
- - minorVersion: The minor version of the book.
127
+ - id: The ID of the book.
128
+ - options (optional): An object containing:
129
+ - majorVersion: The major version of the book.
130
+ - minorVersion: The minor version of the book.
121
131
 
122
132
  Example:
123
133
 
@@ -135,7 +145,7 @@ Retrieves the data of a book as a JavaScript object.
135
145
  getBook(id: number): Promise<BookData>
136
146
  ```
137
147
 
138
- - id: The ID of the book.
148
+ - id: The ID of the book.
139
149
 
140
150
  Example:
141
151
 
package/dist/index.d.ts CHANGED
@@ -1,42 +1,95 @@
1
- type GetMasterMetadataResponsePayload = {
1
+ export type GetMasterMetadataResponsePayload = {
2
2
  url: string;
3
3
  version: number;
4
4
  };
5
- interface OutputOptions {
5
+ export interface OutputOptions {
6
6
  path: string;
7
7
  }
8
- type DownloadMasterOptions = {
8
+ export type DownloadMasterOptions = {
9
9
  masterMetadata?: GetMasterMetadataResponsePayload;
10
10
  outputFile: OutputOptions;
11
11
  };
12
- type GetBookMetadataOptions = {
12
+ export type GetBookMetadataOptions = {
13
13
  majorVersion: number;
14
14
  minorVersion: number;
15
15
  };
16
- type GetBookMetadataResponsePayload = {
16
+ export type GetBookMetadataResponsePayload = {
17
17
  majorRelease: number;
18
18
  majorReleaseUrl: string;
19
19
  minorRelease?: number;
20
20
  minorReleaseUrl?: string;
21
21
  };
22
- type DownloadBookOptions = {
22
+ export type DownloadBookOptions = {
23
23
  bookMetadata?: GetBookMetadataResponsePayload;
24
24
  outputFile: OutputOptions;
25
25
  };
26
- type Page = {
26
+ export type Author = {
27
+ biography?: string;
28
+ death?: number;
29
+ id: number;
30
+ name: string;
31
+ };
32
+ type PDFFile = {
33
+ file: string;
34
+ id?: string;
35
+ };
36
+ export type PDFLinks = {
37
+ alias?: number;
38
+ cover?: number;
39
+ cover_alias?: number;
40
+ files?: PDFFile[];
41
+ root?: string;
42
+ size?: number;
43
+ };
44
+ export type Metadata = {
45
+ coauthor?: number[];
46
+ date: string;
47
+ group?: number;
48
+ hide_diacritic?: boolean;
49
+ min_ver?: number;
50
+ prefix?: string;
51
+ shorts: Record<string, string>;
52
+ sub_books: number[];
53
+ suffix?: string;
54
+ };
55
+ export type Book = {
56
+ author: number | number[];
57
+ bibliography: string;
58
+ category: number;
59
+ date?: number;
60
+ hint?: string;
61
+ id: number;
62
+ major: number;
63
+ metadata: Metadata;
64
+ minor?: number;
65
+ name: string;
66
+ pdfLinks?: PDFLinks;
67
+ printed: number;
68
+ type: number;
69
+ };
70
+ export type Category = {
71
+ id: number;
72
+ name: string;
73
+ };
74
+ export type MasterData = {
75
+ authors: Author[];
76
+ books: Book[];
77
+ categories: Category[];
78
+ };
79
+ export type Page = {
27
80
  content: string;
28
81
  id: number;
29
82
  number?: number;
30
83
  page?: number;
31
84
  part?: number;
32
85
  };
33
- type Title = {
86
+ export type Title = {
34
87
  content: string;
35
88
  id: number;
36
89
  page: number;
37
90
  parent?: number;
38
91
  };
39
- type BookData = {
92
+ export type BookData = {
40
93
  pages: Page[];
41
94
  titles?: Title[];
42
95
  };