@quranjs/api 3.5.0 → 3.7.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.mjs';
2
2
 
3
3
  /**
4
4
  * Maps chapter number to verse count
@@ -350,7 +350,7 @@ interface ChapterReciterResource {
350
350
  format?: string;
351
351
  filesSize?: number;
352
352
  }
353
- type ContentSyncResourceGroup = "articles" | "mushafs" | "recitations" | "tafsirs" | "translations" | "word_by_word_translations";
353
+ type ContentSyncResourceGroup = "articles" | "chapter_recitations" | "mushafs" | "recitations" | "tafsirs" | "translations" | "word_by_word_translations";
354
354
  interface MushafMetadataSnapshotRecord extends Record<string, unknown> {
355
355
  recordType: "mushaf";
356
356
  id: number;
@@ -430,7 +430,7 @@ interface WordByWordTranslationSnapshotRecord extends Record<string, unknown> {
430
430
  }
431
431
  type ContentSyncMutationType = "RESOURCE_CREATE" | "RESOURCE_UPDATE" | "RESOURCE_DELETE" | "ROW_CREATE" | "ROW_UPDATE" | "ROW_DELETE" | "RESOURCE_INVALIDATE";
432
432
  interface ContentSyncOptions extends ApiParams {
433
- /** Resource filter, e.g. `articles:*;mushafs:1;translations:1,6;word_by_word_translations:85`. */
433
+ /** Resource filter, e.g. `articles:*;chapter_recitations:159;mushafs:1;translations:1,6`. */
434
434
  resources?: string;
435
435
  /** Set to true for the initial sync. */
436
436
  bootstrap?: boolean;
@@ -647,6 +647,43 @@ interface Pagination {
647
647
  totalRecords: number;
648
648
  }
649
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
+
650
687
  type GetAnswersByAyahOptions = BaseApiParams & {
651
688
  page?: number;
652
689
  pageSize?: number;
@@ -935,7 +972,7 @@ declare class QuranResources {
935
972
  * @example
936
973
  * client.resources.sync({
937
974
  * bootstrap: true,
938
- * resources: "mushafs:1;translations:19;word_by_word_translations:85"
975
+ * resources: "chapter_recitations:159;mushafs:1;translations:19"
939
976
  * })
940
977
  */
941
978
  sync<TData extends Record<string, unknown> = Record<string, unknown>>(options?: ContentSyncOptions): Promise<ContentSyncResponse<TData>>;
@@ -945,7 +982,7 @@ declare class QuranResources {
945
982
  * @param {string | number} id
946
983
  * @param {ContentResourceSnapshotOptions} options
947
984
  * @example
948
- * client.resources.findSnapshot("mushafs", 1)
985
+ * client.resources.findSnapshot("chapter_recitations", 159)
949
986
  */
950
987
  findSnapshot<TRecord extends Record<string, unknown> = Record<string, unknown>>(resourceGroup: ContentSyncResourceGroup, id: string | number, options?: ContentResourceSnapshotOptions): Promise<ContentResourceSnapshot<TRecord>>;
951
988
  }
@@ -1053,4 +1090,4 @@ declare class QuranVerses {
1053
1090
  findRandom(options?: GetVerseOptions): Promise<Verse>;
1054
1091
  }
1055
1092
 
1056
- 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, 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.js';
2
2
 
3
3
  /**
4
4
  * Maps chapter number to verse count
@@ -350,7 +350,7 @@ interface ChapterReciterResource {
350
350
  format?: string;
351
351
  filesSize?: number;
352
352
  }
353
- type ContentSyncResourceGroup = "articles" | "mushafs" | "recitations" | "tafsirs" | "translations" | "word_by_word_translations";
353
+ type ContentSyncResourceGroup = "articles" | "chapter_recitations" | "mushafs" | "recitations" | "tafsirs" | "translations" | "word_by_word_translations";
354
354
  interface MushafMetadataSnapshotRecord extends Record<string, unknown> {
355
355
  recordType: "mushaf";
356
356
  id: number;
@@ -430,7 +430,7 @@ interface WordByWordTranslationSnapshotRecord extends Record<string, unknown> {
430
430
  }
431
431
  type ContentSyncMutationType = "RESOURCE_CREATE" | "RESOURCE_UPDATE" | "RESOURCE_DELETE" | "ROW_CREATE" | "ROW_UPDATE" | "ROW_DELETE" | "RESOURCE_INVALIDATE";
432
432
  interface ContentSyncOptions extends ApiParams {
433
- /** Resource filter, e.g. `articles:*;mushafs:1;translations:1,6;word_by_word_translations:85`. */
433
+ /** Resource filter, e.g. `articles:*;chapter_recitations:159;mushafs:1;translations:1,6`. */
434
434
  resources?: string;
435
435
  /** Set to true for the initial sync. */
436
436
  bootstrap?: boolean;
@@ -647,6 +647,43 @@ interface Pagination {
647
647
  totalRecords: number;
648
648
  }
649
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
+
650
687
  type GetAnswersByAyahOptions = BaseApiParams & {
651
688
  page?: number;
652
689
  pageSize?: number;
@@ -935,7 +972,7 @@ declare class QuranResources {
935
972
  * @example
936
973
  * client.resources.sync({
937
974
  * bootstrap: true,
938
- * resources: "mushafs:1;translations:19;word_by_word_translations:85"
975
+ * resources: "chapter_recitations:159;mushafs:1;translations:19"
939
976
  * })
940
977
  */
941
978
  sync<TData extends Record<string, unknown> = Record<string, unknown>>(options?: ContentSyncOptions): Promise<ContentSyncResponse<TData>>;
@@ -945,7 +982,7 @@ declare class QuranResources {
945
982
  * @param {string | number} id
946
983
  * @param {ContentResourceSnapshotOptions} options
947
984
  * @example
948
- * client.resources.findSnapshot("mushafs", 1)
985
+ * client.resources.findSnapshot("chapter_recitations", 159)
949
986
  */
950
987
  findSnapshot<TRecord extends Record<string, unknown> = Record<string, unknown>>(resourceGroup: ContentSyncResourceGroup, id: string | number, options?: ContentResourceSnapshotOptions): Promise<ContentResourceSnapshot<TRecord>>;
951
988
  }
@@ -1053,4 +1090,4 @@ declare class QuranVerses {
1053
1090
  findRandom(options?: GetVerseOptions): Promise<Verse>;
1054
1091
  }
1055
1092
 
1056
- 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, 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.5.0",
14
+ "version": "3.7.0",
15
15
  "main": "dist/index.min.js",
16
16
  "module": "dist/index.min.mjs",
17
17
  "types": "dist/index.d.ts",
@@ -58,8 +58,8 @@
58
58
  "typescript": "^5.9.2",
59
59
  "vitest": "^3.2.4",
60
60
  "@quranjs/eslint-config": "0.3.0",
61
- "@quranjs/prettier-config": "0.1.0",
62
- "@quranjs/tsconfig": "0.1.0"
61
+ "@quranjs/tsconfig": "0.1.0",
62
+ "@quranjs/prettier-config": "0.1.0"
63
63
  },
64
64
  "prettier": "@quranjs/prettier-config",
65
65
  "size-limit": [