@quranjs/api 3.4.1 → 3.6.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,4 +1,4 @@
1
- import { A as ApiParams, e as QuranFetchClient, B as BaseApiParams, b as VerseRecitationField, d as SearchParams, P as PaginationParams, W as WordField, T as TranslationField, V as VerseField } from './index-BgoJducH.js';
1
+ import { A as ApiParams, e as QuranFetchClient, B as BaseApiParams, b as VerseRecitationField, d as SearchParams, P as PaginationParams, W as WordField, T as TranslationField, V as VerseField } from './index-BJ5hWalX.js';
2
2
 
3
3
  /**
4
4
  * Maps chapter number to verse count
@@ -350,7 +350,73 @@ interface ChapterReciterResource {
350
350
  format?: string;
351
351
  filesSize?: number;
352
352
  }
353
- type ContentSyncResourceGroup = "articles" | "recitations" | "tafsirs" | "translations" | "word_by_word_translations";
353
+ type ContentSyncResourceGroup = "articles" | "mushafs" | "recitations" | "tafsirs" | "translations" | "word_by_word_translations";
354
+ interface MushafMetadataSnapshotRecord extends Record<string, unknown> {
355
+ recordType: "mushaf";
356
+ id: number;
357
+ resourceContentId: number;
358
+ name: string;
359
+ description: string | null;
360
+ pagesCount: number;
361
+ linesPerPage: number;
362
+ defaultFontName: string;
363
+ mappingMode: string;
364
+ qirat: {
365
+ id: number;
366
+ name: string;
367
+ } | null;
368
+ }
369
+ interface MushafPageSnapshotRecord extends Record<string, unknown> {
370
+ recordType: "mushaf_page";
371
+ id: number;
372
+ mushafId: number;
373
+ pageNumber: number;
374
+ firstVerseId: number | null;
375
+ lastVerseId: number | null;
376
+ firstWordId: number | null;
377
+ lastWordId: number | null;
378
+ versesCount: number | null;
379
+ verseMapping: Record<string, unknown> | null;
380
+ updatedAt: string;
381
+ }
382
+ interface MushafFontAssetSnapshotRecord extends Record<string, unknown> {
383
+ recordType: "font_asset";
384
+ id: number;
385
+ assetKey: string;
386
+ mushafId: number;
387
+ pageNumber: number | null;
388
+ fontFamily: string;
389
+ format: string;
390
+ mimeType: string;
391
+ url: string;
392
+ sha256: string;
393
+ byteSize: number;
394
+ version: string;
395
+ provider: string;
396
+ licenseName: string;
397
+ licenseUrl: string | null;
398
+ attribution: string | null;
399
+ updatedAt: string;
400
+ }
401
+ interface MushafWordSnapshotRecord extends Record<string, unknown> {
402
+ recordType: "mushaf_word";
403
+ id: number;
404
+ mushafId: number;
405
+ wordId: number;
406
+ verseId: number;
407
+ sourceVerseId: number | null;
408
+ text: string | null;
409
+ charTypeId: number | null;
410
+ charTypeName: string | null;
411
+ pageNumber: number | null;
412
+ lineNumber: number | null;
413
+ positionInVerse: number | null;
414
+ positionInLine: number | null;
415
+ positionInPage: number | null;
416
+ cssClass: string | null;
417
+ cssStyle: string | null;
418
+ }
419
+ type MushafSnapshotRecord = MushafMetadataSnapshotRecord | MushafPageSnapshotRecord | MushafFontAssetSnapshotRecord | MushafWordSnapshotRecord;
354
420
  interface WordByWordTranslationSnapshotRecord extends Record<string, unknown> {
355
421
  id: number;
356
422
  resourceContentId: number;
@@ -364,7 +430,7 @@ interface WordByWordTranslationSnapshotRecord extends Record<string, unknown> {
364
430
  }
365
431
  type ContentSyncMutationType = "RESOURCE_CREATE" | "RESOURCE_UPDATE" | "RESOURCE_DELETE" | "ROW_CREATE" | "ROW_UPDATE" | "ROW_DELETE" | "RESOURCE_INVALIDATE";
366
432
  interface ContentSyncOptions extends ApiParams {
367
- /** Resource filter, e.g. `articles:*;translations:1,6;word_by_word_translations:85`. */
433
+ /** Resource filter, e.g. `articles:*;mushafs:1;translations:1,6;word_by_word_translations:85`. */
368
434
  resources?: string;
369
435
  /** Set to true for the initial sync. */
370
436
  bootstrap?: boolean;
@@ -581,6 +647,43 @@ interface Pagination {
581
647
  totalRecords: number;
582
648
  }
583
649
 
650
+ /** A JSON value accepted in an analytics event's properties object. */
651
+ type AnalyticsJsonValue = boolean | null | number | string | AnalyticsJsonValue[] | {
652
+ [key: string]: AnalyticsJsonValue;
653
+ };
654
+ interface AnalyticsEvent {
655
+ /** Stable caller-generated ID. Reuse it when retrying this event. */
656
+ eventId: string;
657
+ /** Namespaced event name, for example `quran.reader.verse_viewed`. */
658
+ name: string;
659
+ /** When the event happened. Date values are serialized as RFC 3339. */
660
+ occurredAt: Date | string;
661
+ /** Version of this event's property structure, starting at 1. */
662
+ version: number;
663
+ /** Optional ID linking the event to a specific action. */
664
+ actionId?: null | string;
665
+ /** Application-generated ID for a person who is not signed in. */
666
+ anonymousId?: null | string;
667
+ /** Event-specific JSON. Caller-defined property names are preserved. */
668
+ properties?: {
669
+ [key: string]: AnalyticsJsonValue;
670
+ };
671
+ /** Application-generated ID grouping events from one usage session. */
672
+ sessionId?: null | string;
673
+ /** Quran Foundation OAuth user ID. Do not send an application-local ID. */
674
+ userId?: null | string;
675
+ }
676
+ interface AnalyticsBatchRequest {
677
+ /** The API accepts between 1 and 100 events as one all-or-nothing batch. */
678
+ events: AnalyticsEvent[];
679
+ }
680
+ interface AnalyticsBatchAccepted {
681
+ /** Number of accepted events; this equals the submitted count on HTTP 202. */
682
+ accepted: number;
683
+ /** Server-generated identifier shared by all events in this batch. */
684
+ batchId: string;
685
+ }
686
+
584
687
  type GetAnswersByAyahOptions = BaseApiParams & {
585
688
  page?: number;
586
689
  pageSize?: number;
@@ -869,7 +972,7 @@ declare class QuranResources {
869
972
  * @example
870
973
  * client.resources.sync({
871
974
  * bootstrap: true,
872
- * resources: "translations:19;word_by_word_translations:85"
975
+ * resources: "mushafs:1;translations:19;word_by_word_translations:85"
873
976
  * })
874
977
  */
875
978
  sync<TData extends Record<string, unknown> = Record<string, unknown>>(options?: ContentSyncOptions): Promise<ContentSyncResponse<TData>>;
@@ -879,7 +982,7 @@ declare class QuranResources {
879
982
  * @param {string | number} id
880
983
  * @param {ContentResourceSnapshotOptions} options
881
984
  * @example
882
- * client.resources.findSnapshot("word_by_word_translations", 85)
985
+ * client.resources.findSnapshot("mushafs", 1)
883
986
  */
884
987
  findSnapshot<TRecord extends Record<string, unknown> = Record<string, unknown>>(resourceGroup: ContentSyncResourceGroup, id: string | number, options?: ContentResourceSnapshotOptions): Promise<ContentResourceSnapshot<TRecord>>;
885
988
  }
@@ -987,4 +1090,4 @@ declare class QuranVerses {
987
1090
  findRandom(options?: GetVerseOptions): Promise<Verse>;
988
1091
  }
989
1092
 
990
- export { type VerseMediaResource as $, type Answer as A, type Translation as B, type ChapterId as C, type Transliteration as D, type Verse as E, CharType as F, type Juz as G, type HizbNumber as H, type Pagination as I, type JuzNumber as J, type RecitationResource as K, type RecitationInfoResource as L, type TranslationResource as M, type NormalizedVerseRecitation as N, type TranslationInfoResource as O, type PageNumber as P, QuranChapters as Q, type RubNumber as R, type SearchResponse as S, type TranslatedName as T, type TafsirResource as U, type VerseKey as V, type Word as W, type TafsirInfoResource as X, type RecitationStylesResource as Y, type LanguageResource as Z, type ChapterInfoResource as _, QuranAnswers as a, type ChapterReciterResource as a0, type ContentSyncResourceGroup as a1, type WordByWordTranslationSnapshotRecord as a2, type ContentSyncMutationType as a3, type ContentSyncOptions as a4, type ContentResourceSnapshotOptions as a5, type ContentSyncMutation as a6, type ContentSyncResponse as a7, type ContentResourceSnapshot as a8, SearchNavigationType as a9, type SearchResult as aa, QuranVerses as b, QuranJuzs as c, QuranAudio as d, QuranHadithReferences as e, QuranResources as f, QuranSearch as g, type AnswerQuestion as h, type AnswersByAyahResponse as i, type AnswerCount as j, type AnswerCountWithinRangeResponse as k, type ChapterRecitation as l, type VerseRecitation as m, type AudioResponse as n, type Chapter as o, type ChapterInfo as p, type ChapterInfoResponse as q, type HadithReference as r, type HadithReferencesByAyahResponse as s, type HadithGrade as t, type HadithContent as u, type Hadith as v, type HadithsByAyahResponse as w, type HadithCountWithinRangeResponse as x, type Segment as y, type Tafsir as z };
1093
+ export { type VerseMediaResource as $, type Answer as A, type Translation as B, type ChapterId as C, type Transliteration as D, type Verse as E, CharType as F, type Juz as G, type HizbNumber as H, type Pagination as I, type JuzNumber as J, type RecitationResource as K, type RecitationInfoResource as L, type TranslationResource as M, type NormalizedVerseRecitation as N, type TranslationInfoResource as O, type PageNumber as P, QuranChapters as Q, type RubNumber as R, type SearchResponse as S, type TranslatedName as T, type TafsirResource as U, type VerseKey as V, type Word as W, type TafsirInfoResource as X, type RecitationStylesResource as Y, type LanguageResource as Z, type ChapterInfoResource as _, QuranAnswers as a, type ChapterReciterResource as a0, type ContentSyncResourceGroup as a1, type MushafMetadataSnapshotRecord as a2, type MushafPageSnapshotRecord as a3, type MushafFontAssetSnapshotRecord as a4, type MushafWordSnapshotRecord as a5, type MushafSnapshotRecord as a6, type WordByWordTranslationSnapshotRecord as a7, type ContentSyncMutationType as a8, type ContentSyncOptions as a9, type ContentResourceSnapshotOptions as aa, type ContentSyncMutation as ab, type ContentSyncResponse as ac, type ContentResourceSnapshot as ad, SearchNavigationType as ae, type SearchResult as af, type AnalyticsJsonValue as ag, type AnalyticsEvent as ah, type AnalyticsBatchRequest as ai, type AnalyticsBatchAccepted as aj, QuranVerses as b, QuranJuzs as c, QuranAudio as d, QuranHadithReferences as e, QuranResources as f, QuranSearch as g, type AnswerQuestion as h, type AnswersByAyahResponse as i, type AnswerCount as j, type AnswerCountWithinRangeResponse as k, type ChapterRecitation as l, type VerseRecitation as m, type AudioResponse as n, type Chapter as o, type ChapterInfo as p, type ChapterInfoResponse as q, type HadithReference as r, type HadithReferencesByAyahResponse as s, type HadithGrade as t, type HadithContent as u, type Hadith as v, type HadithsByAyahResponse as w, type HadithCountWithinRangeResponse as x, type Segment as y, type Tafsir as z };
@@ -1,4 +1,4 @@
1
- import { A as ApiParams, e as QuranFetchClient, B as BaseApiParams, b as VerseRecitationField, d as SearchParams, P as PaginationParams, W as WordField, T as TranslationField, V as VerseField } from './index-BgoJducH.mjs';
1
+ import { A as ApiParams, e as QuranFetchClient, B as BaseApiParams, b as VerseRecitationField, d as SearchParams, P as PaginationParams, W as WordField, T as TranslationField, V as VerseField } from './index-BJ5hWalX.mjs';
2
2
 
3
3
  /**
4
4
  * Maps chapter number to verse count
@@ -350,7 +350,73 @@ interface ChapterReciterResource {
350
350
  format?: string;
351
351
  filesSize?: number;
352
352
  }
353
- type ContentSyncResourceGroup = "articles" | "recitations" | "tafsirs" | "translations" | "word_by_word_translations";
353
+ type ContentSyncResourceGroup = "articles" | "mushafs" | "recitations" | "tafsirs" | "translations" | "word_by_word_translations";
354
+ interface MushafMetadataSnapshotRecord extends Record<string, unknown> {
355
+ recordType: "mushaf";
356
+ id: number;
357
+ resourceContentId: number;
358
+ name: string;
359
+ description: string | null;
360
+ pagesCount: number;
361
+ linesPerPage: number;
362
+ defaultFontName: string;
363
+ mappingMode: string;
364
+ qirat: {
365
+ id: number;
366
+ name: string;
367
+ } | null;
368
+ }
369
+ interface MushafPageSnapshotRecord extends Record<string, unknown> {
370
+ recordType: "mushaf_page";
371
+ id: number;
372
+ mushafId: number;
373
+ pageNumber: number;
374
+ firstVerseId: number | null;
375
+ lastVerseId: number | null;
376
+ firstWordId: number | null;
377
+ lastWordId: number | null;
378
+ versesCount: number | null;
379
+ verseMapping: Record<string, unknown> | null;
380
+ updatedAt: string;
381
+ }
382
+ interface MushafFontAssetSnapshotRecord extends Record<string, unknown> {
383
+ recordType: "font_asset";
384
+ id: number;
385
+ assetKey: string;
386
+ mushafId: number;
387
+ pageNumber: number | null;
388
+ fontFamily: string;
389
+ format: string;
390
+ mimeType: string;
391
+ url: string;
392
+ sha256: string;
393
+ byteSize: number;
394
+ version: string;
395
+ provider: string;
396
+ licenseName: string;
397
+ licenseUrl: string | null;
398
+ attribution: string | null;
399
+ updatedAt: string;
400
+ }
401
+ interface MushafWordSnapshotRecord extends Record<string, unknown> {
402
+ recordType: "mushaf_word";
403
+ id: number;
404
+ mushafId: number;
405
+ wordId: number;
406
+ verseId: number;
407
+ sourceVerseId: number | null;
408
+ text: string | null;
409
+ charTypeId: number | null;
410
+ charTypeName: string | null;
411
+ pageNumber: number | null;
412
+ lineNumber: number | null;
413
+ positionInVerse: number | null;
414
+ positionInLine: number | null;
415
+ positionInPage: number | null;
416
+ cssClass: string | null;
417
+ cssStyle: string | null;
418
+ }
419
+ type MushafSnapshotRecord = MushafMetadataSnapshotRecord | MushafPageSnapshotRecord | MushafFontAssetSnapshotRecord | MushafWordSnapshotRecord;
354
420
  interface WordByWordTranslationSnapshotRecord extends Record<string, unknown> {
355
421
  id: number;
356
422
  resourceContentId: number;
@@ -364,7 +430,7 @@ interface WordByWordTranslationSnapshotRecord extends Record<string, unknown> {
364
430
  }
365
431
  type ContentSyncMutationType = "RESOURCE_CREATE" | "RESOURCE_UPDATE" | "RESOURCE_DELETE" | "ROW_CREATE" | "ROW_UPDATE" | "ROW_DELETE" | "RESOURCE_INVALIDATE";
366
432
  interface ContentSyncOptions extends ApiParams {
367
- /** Resource filter, e.g. `articles:*;translations:1,6;word_by_word_translations:85`. */
433
+ /** Resource filter, e.g. `articles:*;mushafs:1;translations:1,6;word_by_word_translations:85`. */
368
434
  resources?: string;
369
435
  /** Set to true for the initial sync. */
370
436
  bootstrap?: boolean;
@@ -581,6 +647,43 @@ interface Pagination {
581
647
  totalRecords: number;
582
648
  }
583
649
 
650
+ /** A JSON value accepted in an analytics event's properties object. */
651
+ type AnalyticsJsonValue = boolean | null | number | string | AnalyticsJsonValue[] | {
652
+ [key: string]: AnalyticsJsonValue;
653
+ };
654
+ interface AnalyticsEvent {
655
+ /** Stable caller-generated ID. Reuse it when retrying this event. */
656
+ eventId: string;
657
+ /** Namespaced event name, for example `quran.reader.verse_viewed`. */
658
+ name: string;
659
+ /** When the event happened. Date values are serialized as RFC 3339. */
660
+ occurredAt: Date | string;
661
+ /** Version of this event's property structure, starting at 1. */
662
+ version: number;
663
+ /** Optional ID linking the event to a specific action. */
664
+ actionId?: null | string;
665
+ /** Application-generated ID for a person who is not signed in. */
666
+ anonymousId?: null | string;
667
+ /** Event-specific JSON. Caller-defined property names are preserved. */
668
+ properties?: {
669
+ [key: string]: AnalyticsJsonValue;
670
+ };
671
+ /** Application-generated ID grouping events from one usage session. */
672
+ sessionId?: null | string;
673
+ /** Quran Foundation OAuth user ID. Do not send an application-local ID. */
674
+ userId?: null | string;
675
+ }
676
+ interface AnalyticsBatchRequest {
677
+ /** The API accepts between 1 and 100 events as one all-or-nothing batch. */
678
+ events: AnalyticsEvent[];
679
+ }
680
+ interface AnalyticsBatchAccepted {
681
+ /** Number of accepted events; this equals the submitted count on HTTP 202. */
682
+ accepted: number;
683
+ /** Server-generated identifier shared by all events in this batch. */
684
+ batchId: string;
685
+ }
686
+
584
687
  type GetAnswersByAyahOptions = BaseApiParams & {
585
688
  page?: number;
586
689
  pageSize?: number;
@@ -869,7 +972,7 @@ declare class QuranResources {
869
972
  * @example
870
973
  * client.resources.sync({
871
974
  * bootstrap: true,
872
- * resources: "translations:19;word_by_word_translations:85"
975
+ * resources: "mushafs:1;translations:19;word_by_word_translations:85"
873
976
  * })
874
977
  */
875
978
  sync<TData extends Record<string, unknown> = Record<string, unknown>>(options?: ContentSyncOptions): Promise<ContentSyncResponse<TData>>;
@@ -879,7 +982,7 @@ declare class QuranResources {
879
982
  * @param {string | number} id
880
983
  * @param {ContentResourceSnapshotOptions} options
881
984
  * @example
882
- * client.resources.findSnapshot("word_by_word_translations", 85)
985
+ * client.resources.findSnapshot("mushafs", 1)
883
986
  */
884
987
  findSnapshot<TRecord extends Record<string, unknown> = Record<string, unknown>>(resourceGroup: ContentSyncResourceGroup, id: string | number, options?: ContentResourceSnapshotOptions): Promise<ContentResourceSnapshot<TRecord>>;
885
988
  }
@@ -987,4 +1090,4 @@ declare class QuranVerses {
987
1090
  findRandom(options?: GetVerseOptions): Promise<Verse>;
988
1091
  }
989
1092
 
990
- export { type VerseMediaResource as $, type Answer as A, type Translation as B, type ChapterId as C, type Transliteration as D, type Verse as E, CharType as F, type Juz as G, type HizbNumber as H, type Pagination as I, type JuzNumber as J, type RecitationResource as K, type RecitationInfoResource as L, type TranslationResource as M, type NormalizedVerseRecitation as N, type TranslationInfoResource as O, type PageNumber as P, QuranChapters as Q, type RubNumber as R, type SearchResponse as S, type TranslatedName as T, type TafsirResource as U, type VerseKey as V, type Word as W, type TafsirInfoResource as X, type RecitationStylesResource as Y, type LanguageResource as Z, type ChapterInfoResource as _, QuranAnswers as a, type ChapterReciterResource as a0, type ContentSyncResourceGroup as a1, type WordByWordTranslationSnapshotRecord as a2, type ContentSyncMutationType as a3, type ContentSyncOptions as a4, type ContentResourceSnapshotOptions as a5, type ContentSyncMutation as a6, type ContentSyncResponse as a7, type ContentResourceSnapshot as a8, SearchNavigationType as a9, type SearchResult as aa, QuranVerses as b, QuranJuzs as c, QuranAudio as d, QuranHadithReferences as e, QuranResources as f, QuranSearch as g, type AnswerQuestion as h, type AnswersByAyahResponse as i, type AnswerCount as j, type AnswerCountWithinRangeResponse as k, type ChapterRecitation as l, type VerseRecitation as m, type AudioResponse as n, type Chapter as o, type ChapterInfo as p, type ChapterInfoResponse as q, type HadithReference as r, type HadithReferencesByAyahResponse as s, type HadithGrade as t, type HadithContent as u, type Hadith as v, type HadithsByAyahResponse as w, type HadithCountWithinRangeResponse as x, type Segment as y, type Tafsir as z };
1093
+ export { type VerseMediaResource as $, type Answer as A, type Translation as B, type ChapterId as C, type Transliteration as D, type Verse as E, CharType as F, type Juz as G, type HizbNumber as H, type Pagination as I, type JuzNumber as J, type RecitationResource as K, type RecitationInfoResource as L, type TranslationResource as M, type NormalizedVerseRecitation as N, type TranslationInfoResource as O, type PageNumber as P, QuranChapters as Q, type RubNumber as R, type SearchResponse as S, type TranslatedName as T, type TafsirResource as U, type VerseKey as V, type Word as W, type TafsirInfoResource as X, type RecitationStylesResource as Y, type LanguageResource as Z, type ChapterInfoResource as _, QuranAnswers as a, type ChapterReciterResource as a0, type ContentSyncResourceGroup as a1, type MushafMetadataSnapshotRecord as a2, type MushafPageSnapshotRecord as a3, type MushafFontAssetSnapshotRecord as a4, type MushafWordSnapshotRecord as a5, type MushafSnapshotRecord as a6, type WordByWordTranslationSnapshotRecord as a7, type ContentSyncMutationType as a8, type ContentSyncOptions as a9, type ContentResourceSnapshotOptions as aa, type ContentSyncMutation as ab, type ContentSyncResponse as ac, type ContentResourceSnapshot as ad, SearchNavigationType as ae, type SearchResult as af, type AnalyticsJsonValue as ag, type AnalyticsEvent as ah, type AnalyticsBatchRequest as ai, type AnalyticsBatchAccepted as aj, QuranVerses as b, QuranJuzs as c, QuranAudio as d, QuranHadithReferences as e, QuranResources as f, QuranSearch as g, type AnswerQuestion as h, type AnswersByAyahResponse as i, type AnswerCount as j, type AnswerCountWithinRangeResponse as k, type ChapterRecitation as l, type VerseRecitation as m, type AudioResponse as n, type Chapter as o, type ChapterInfo as p, type ChapterInfoResponse as q, type HadithReference as r, type HadithReferencesByAyahResponse as s, type HadithGrade as t, type HadithContent as u, type Hadith as v, type HadithsByAyahResponse as w, type HadithCountWithinRangeResponse as x, type Segment as y, type Tafsir as z };
package/package.json CHANGED
@@ -11,7 +11,7 @@
11
11
  "publishConfig": {
12
12
  "access": "public"
13
13
  },
14
- "version": "3.4.1",
14
+ "version": "3.6.0",
15
15
  "main": "dist/index.min.js",
16
16
  "module": "dist/index.min.mjs",
17
17
  "types": "dist/index.d.ts",
@@ -57,9 +57,9 @@
57
57
  "tsup": "^8.5.0",
58
58
  "typescript": "^5.9.2",
59
59
  "vitest": "^3.2.4",
60
- "@quranjs/prettier-config": "0.1.0",
60
+ "@quranjs/tsconfig": "0.1.0",
61
61
  "@quranjs/eslint-config": "0.3.0",
62
- "@quranjs/tsconfig": "0.1.0"
62
+ "@quranjs/prettier-config": "0.1.0"
63
63
  },
64
64
  "prettier": "@quranjs/prettier-config",
65
65
  "size-limit": [