@quranjs/api 3.7.0 → 3.9.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,292 +0,0 @@
1
- type ApiParams = Record<string, string | number | boolean | unknown[] | undefined | Record<string, boolean>>;
2
- /**
3
- * Base parameters that are common across most API endpoints
4
- */
5
- interface BaseApiParams extends ApiParams {
6
- /** Language for the response */
7
- language?: Language;
8
- }
9
- /**
10
- * Pagination parameters
11
- */
12
- interface PaginationParams extends ApiParams {
13
- /** Page number for pagination */
14
- page?: number;
15
- /** Number of items per page */
16
- perPage?: number;
17
- }
18
- type BinaryString = "0" | "1";
19
- declare enum SearchMode {
20
- Advanced = "advanced",
21
- Quick = "quick"
22
- }
23
- /**
24
- * Search parameters
25
- */
26
- interface SearchParams extends BaseApiParams {
27
- /** Search mode */
28
- mode: SearchMode;
29
- /** Search query */
30
- query: string;
31
- /** Filter translations */
32
- filterTranslations?: string | string[];
33
- /** For advanced search, limit to exact matches */
34
- exactMatchesOnly?: BinaryString;
35
- /** Include text in the response */
36
- getText?: BinaryString;
37
- /** Include highlighted text */
38
- highlight?: BinaryString;
39
- /** Quick search navigational results count */
40
- navigationalResultsNumber?: number;
41
- /** Quick search verse results count */
42
- versesResultsNumber?: number;
43
- /** Comma-separated list of indexes */
44
- indexes?: string | string[];
45
- /** Page number for pagination */
46
- page?: number;
47
- /** Number of results to return */
48
- size?: number;
49
- /** Translation IDs to use for language detection */
50
- translationIds?: string | number | Array<string | number>;
51
- /** Quran fields to include in verse filters */
52
- fields?: Partial<Record<VerseField, boolean>>;
53
- /** Translation fields to include in verse filters */
54
- translationFields?: Partial<Record<TranslationField, boolean>>;
55
- /** Word fields to include in verse filters */
56
- wordFields?: Partial<Record<WordField, boolean>>;
57
- /** Include word data in verse filters */
58
- words?: boolean;
59
- }
60
-
61
- type AuthService = "auth" | "quranReflect";
62
-
63
- /**
64
- * Custom fetcher function type that matches the native fetch API
65
- */
66
- type CustomFetcher = typeof fetch;
67
- type RuntimeMode = "server" | "public";
68
- type HTTPMethod = "DELETE" | "GET" | "PATCH" | "POST" | "PUT";
69
- interface QuranFetchClient {
70
- fetch<T = unknown>(url: string, params?: ApiParams): Promise<T>;
71
- }
72
- type ApiService = "analytics" | "content" | "search" | AuthService | "oauth2";
73
- interface ServiceEnvironmentConfig {
74
- gatewayUrl?: string;
75
- tokenHost?: string;
76
- oauth2BaseUrl?: string;
77
- analyticsBaseUrl?: string;
78
- contentBaseUrl?: string;
79
- searchBaseUrl?: string;
80
- authBaseUrl?: string;
81
- quranReflectBaseUrl?: string;
82
- }
83
- interface QuranClientConfig {
84
- /** Client ID for authentication */
85
- clientId: string;
86
- /** Client secret for authentication */
87
- clientSecret: string;
88
- /** Legacy gateway base URL for content/search APIs */
89
- contentBaseUrl?: string;
90
- /** Legacy OAuth2 token host URL */
91
- authBaseUrl?: string;
92
- /** Custom fetch implementation */
93
- fetch?: CustomFetcher;
94
- /** Default parameters for all API calls */
95
- defaults?: Partial<BaseApiParams>;
96
- }
97
- interface UserSession {
98
- accessToken: string;
99
- refreshToken?: string;
100
- idToken?: string;
101
- scope?: string;
102
- tokenType?: string;
103
- expiresAt?: number;
104
- }
105
- interface TokenStorage {
106
- getSession?: () => UserSession | null | undefined | Promise<UserSession | null | undefined>;
107
- setSession?: (session: UserSession | null) => void | Promise<void>;
108
- clearSession?: () => void | Promise<void>;
109
- }
110
- interface BaseRuntimeClientConfig {
111
- clientId: string;
112
- fetch?: CustomFetcher;
113
- defaults?: Partial<BaseApiParams>;
114
- services?: ServiceEnvironmentConfig;
115
- userSession?: UserSession;
116
- storage?: TokenStorage;
117
- }
118
- interface ServerClientConfig extends BaseRuntimeClientConfig {
119
- clientSecret: string;
120
- }
121
- interface PublicClientConfig extends BaseRuntimeClientConfig {
122
- clientType: "public" | "confidential-proxy";
123
- }
124
- interface CachedToken {
125
- value: string;
126
- expiresAt: number;
127
- }
128
- interface TokenResponse {
129
- access_token: string;
130
- token_type?: string;
131
- expires_in: number;
132
- refresh_token?: string;
133
- id_token?: string;
134
- scope?: string;
135
- }
136
- interface OperationRequest {
137
- path?: Record<string, string | number>;
138
- query?: ApiParams;
139
- body?: string | URLSearchParams | Record<string, unknown> | null;
140
- headers?: Record<string, string>;
141
- method?: HTTPMethod;
142
- auth?: "auto" | "none" | "app" | "user";
143
- accessToken?: string;
144
- basicAuth?: {
145
- username: string;
146
- password: string;
147
- };
148
- contentType?: string;
149
- }
150
-
151
- interface QuranReflectPostReference {
152
- chapterId: number;
153
- from: number;
154
- to: number;
155
- id?: string;
156
- }
157
- interface QuranReflectPostMention {
158
- marker: string;
159
- userId: string;
160
- displayName: string;
161
- }
162
- type QuranReflectRoomPostStatus = 0 | 1 | 2;
163
- interface CreateQuranReflectPostPayload {
164
- body: string;
165
- draft: boolean;
166
- references: QuranReflectPostReference[];
167
- mentions: QuranReflectPostMention[];
168
- roomId?: number;
169
- roomPostStatus?: QuranReflectRoomPostStatus;
170
- postAsAuthorId?: string;
171
- publishedAt?: string | Date;
172
- }
173
- type UpdateQuranReflectPostPayload = Partial<CreateQuranReflectPostPayload>;
174
- interface QuranReflectPost {
175
- id: number | string;
176
- authorId?: string;
177
- body?: string;
178
- commentsCount?: number;
179
- createdAt?: string;
180
- discussionId?: number;
181
- draft?: boolean;
182
- estimatedReadingTime?: number;
183
- featuredAt?: string;
184
- global?: boolean;
185
- hidden?: boolean;
186
- languageId?: number;
187
- languageName?: string;
188
- likesCount?: number;
189
- mentions?: QuranReflectPostMention[];
190
- moderationStatus?: number;
191
- postTypeId?: number | null;
192
- postTypeName?: string;
193
- publishedAt?: string;
194
- pushedUpAt?: string;
195
- references?: QuranReflectPostReference[];
196
- removed?: boolean;
197
- reported?: boolean;
198
- reviewedAt?: string;
199
- roomId?: number | null;
200
- roomPostStatus?: number;
201
- toxicityScore?: number;
202
- updatedAt?: string;
203
- verified?: boolean;
204
- views?: number;
205
- viewsCount?: number;
206
- }
207
- interface QuranReflectPostMutationResponse {
208
- success: boolean;
209
- data?: QuranReflectPost;
210
- post?: QuranReflectPost;
211
- error?: unknown;
212
- }
213
-
214
- declare enum Language {
215
- ARABIC = "ar",
216
- ENGLISH = "en",
217
- URDU = "ur",
218
- BENGALI = "bn",
219
- TURKISH = "tr",
220
- SPANISH = "es",
221
- GERMAN = "de",
222
- BOSNIAN = "bs",
223
- RUSSIAN = "ru",
224
- ALBANIAN_AL = "al",
225
- FRENCH = "fr",
226
- DUTCH = "nl",
227
- TAMIL = "ta",
228
- TAJIK = "tg",
229
- INDONESIAN = "id",
230
- UZBEK = "uz",
231
- VIETNAMESE = "vi",
232
- CHINESE = "zh",
233
- ITALIAN = "it",
234
- JAPANESE = "ja",
235
- MALAYALAM = "ml",
236
- AMHARIC = "am",
237
- KAZAKH = "kk",
238
- PORTUGUESE = "pt",
239
- TAGALOG = "tl",
240
- THAI = "th",
241
- KOREAN = "ko",
242
- HINDI = "hi",
243
- KURDISH = "ku",
244
- HAUSA = "ha",
245
- AZERI = "az",
246
- SWAHILI = "sw",
247
- PERSIAN = "fa",
248
- SERBIAN = "sr",
249
- MARANAO = "mrn",
250
- AMAZIGH = "zgh",
251
- ASSAMESE = "as",
252
- BULGARIAN = "bg",
253
- CHECHEN = "ce",
254
- CZECH = "cs",
255
- DIVEHI = "dv",
256
- FINNISH = "fi",
257
- GUJAARATI = "gu",
258
- HEBREW = "he",
259
- GEORGIAN = "ka",
260
- CENTRAL_KHMER = "km",
261
- GANDA = "lg",
262
- MARATHI = "mr",
263
- YORUBA = "yo",
264
- MALAY = "ms",
265
- NEPALI = "ne",
266
- SWEDISH = "sv",
267
- TELUGU = "te",
268
- TATAR = "tt",
269
- UYGHUR = "ug",
270
- UKRAINIAN = "uk",
271
- NORWEGIAN = "no",
272
- OROMO = "om",
273
- POLISH = "pl",
274
- PASHTO = "ps",
275
- ROMANIAN = "ro",
276
- SINDHI = "sd",
277
- NORTHERN_SAMI = "se",
278
- SINHALA = "si",
279
- SOMALI = "so",
280
- ALBANIAN_SQ = "sq"
281
- }
282
- declare enum QuranFont {
283
- MadaniV1 = "code_v1",
284
- MadaniV2 = "code_v2",
285
- Uthmani = "text_uthmani"
286
- }
287
- type VerseField = "chapterId" | "textUthmani" | "textUthmaniSimple" | "textImlaei" | "textImlaeiSimple" | "textIndopak" | "textIndopakNastaleeq" | "textUthmaniTajweed" | "imageUrl" | "imageWidth" | "codeV1" | "codeV2" | "v1Page" | "v2Page";
288
- type WordField = "v1Page" | "v2Page" | "textUthmani" | "textImlaei" | "textIndopak" | "verseKey" | "location" | "codeV1" | "codeV2";
289
- type TranslationField = "resourceName" | "verseId" | "languageId" | "languageName" | "verseKey" | "chapterId" | "verseNumber" | "juzNumber" | "hizbNumber" | "rubNumber" | "pageNumber";
290
- type VerseRecitationField = "id" | "chapterId" | "segments" | "format";
291
-
292
- export { type ApiParams as A, type BaseApiParams as B, type CustomFetcher as C, type HTTPMethod as H, Language as L, type OperationRequest as O, type PaginationParams as P, type QuranClientConfig as Q, type RuntimeMode as R, SearchMode as S, type TranslationField as T, type UserSession as U, type VerseField as V, type WordField as W, QuranFont as a, type VerseRecitationField as b, type BinaryString as c, type SearchParams as d, type QuranFetchClient as e, type ApiService as f, type ServiceEnvironmentConfig as g, type TokenStorage as h, type ServerClientConfig as i, type PublicClientConfig as j, type CachedToken as k, type TokenResponse as l, type QuranReflectPostReference as m, type QuranReflectPostMention as n, type QuranReflectRoomPostStatus as o, type CreateQuranReflectPostPayload as p, type UpdateQuranReflectPostPayload as q, type QuranReflectPost as r, type QuranReflectPostMutationResponse as s };