@faith-tools/bible-sdk 0.0.0-stage → 0.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.
@@ -0,0 +1,66 @@
1
+ import { t as e } from "../providers-Ci0Bdu9f.js";
2
+ import { _ as t, b as n, g as r, h as i, l as a, m as o, n as s, p as c, r as l, s as u, t as d, u as f, v as p, y as m } from "../runtime-CVlBLU4v.js";
3
+ import { Effect as h, Layer as g, Schema as _ } from "effect";
4
+ // src/data-effect.ts
5
+ var v = _.NonEmptyString.check(_.isTrimmed()), y = (e, t) => _.decodeUnknownEffect(v)(t ?? e.defaultVersionId).pipe(h.mapError((e) => new p({
6
+ code: "unavailable",
7
+ message: "Set a provider-specific version ID.",
8
+ cause: e
9
+ }))), b = {
10
+ listVersions: h.fn("scripture.listVersions")(function* () {
11
+ return yield* (yield* i).listVersions().pipe(h.flatMap(s(_.Array(r))));
12
+ }),
13
+ listBooks: h.fn("scripture.listBooks")(function* ({ versionId: e } = {}) {
14
+ let t = yield* i, n = yield* y(t, e);
15
+ return yield* t.listBooks(n).pipe(h.flatMap(s(_.Array(c))));
16
+ }),
17
+ listChapters: h.fn("scripture.listChapters")(function* ({ versionId: e, bookId: t }) {
18
+ let n = yield* i, r = yield* y(n, e);
19
+ return yield* u(t), yield* n.listChapters(r, t).pipe(h.flatMap(s(_.Array(o))));
20
+ }),
21
+ getPassage: h.fn("scripture.getPassage")(function* ({ versionId: e, passageId: t }) {
22
+ yield* a(t);
23
+ let r = yield* i, o = yield* y(r, e);
24
+ return yield* r.getPassageData(o, t).pipe(h.flatMap(s(n)));
25
+ }),
26
+ clearCache: h.gen(function* () {
27
+ yield* (yield* i).clearCache;
28
+ })
29
+ };
30
+ function x({ provider: t = e() } = {}) {
31
+ let n = () => h.fail(new p({
32
+ code: "unsupported",
33
+ message: "This provider does not support this data operation."
34
+ })), a = "getPassageData" in t ? t : t.effects ?? {
35
+ id: t.id,
36
+ defaultVersionId: t.defaultVersionId,
37
+ listVersions: () => t.listVersions ? l("custom.listVersions", () => t.listVersions(), !1) : n(),
38
+ listBooks: n,
39
+ listChapters: n,
40
+ getPassageData: n,
41
+ clearCache: h.void
42
+ }, u = f(a.cacheTimeToLive), d = g.succeed(i, {
43
+ id: a.id,
44
+ defaultVersionId: a.defaultVersionId,
45
+ cacheTimeToLive: a.cacheTimeToLive,
46
+ listVersions: () => u.get("versions", () => a.listVersions().pipe(h.tap(s(_.Array(r))))),
47
+ listBooks: (e) => u.get(JSON.stringify(["books", e]), () => a.listBooks(e).pipe(h.tap(s(_.Array(c))))),
48
+ listChapters: (e, t) => u.get(JSON.stringify([
49
+ "chapters",
50
+ e,
51
+ t
52
+ ]), () => a.listChapters(e, t).pipe(h.tap(s(_.Array(o))))),
53
+ getPassageData: (e, t) => a.getPassageData(e, t),
54
+ clearCache: u.clear.pipe(h.andThen(a.clearCache))
55
+ });
56
+ return {
57
+ provider: a.id,
58
+ layer: d,
59
+ listVersions: () => b.listVersions().pipe(h.provide(d)),
60
+ listBooks: (e = {}) => b.listBooks(e).pipe(h.provide(d)),
61
+ listChapters: (e) => b.listChapters(e).pipe(h.provide(d)),
62
+ getPassage: (e) => b.getPassage(e).pipe(h.provide(d)),
63
+ clearCache: () => b.clearCache.pipe(h.provide(d))
64
+ };
65
+ }
66
+ export { c as BibleBook, o as BibleChapter, i as BibleSource, r as BibleVersion, t as DisplayInstruction, d as RequestPolicy, p as ScriptureError, m as ScriptureErrorCode, n as ScripturePassage, x as createScriptureClient, b as scripture };
package/dist/data.js ADDED
@@ -0,0 +1,16 @@
1
+ import { createScriptureClient as e } from "./data/effect.js";
2
+ import { v as t } from "./runtime-CVlBLU4v.js";
3
+ import { Effect as n } from "effect";
4
+ // src/data.ts
5
+ function r(t = {}) {
6
+ let r = e(t);
7
+ return {
8
+ provider: r.provider,
9
+ listVersions: () => n.runPromise(r.listVersions()),
10
+ listBooks: (e = {}) => n.runPromise(r.listBooks(e)),
11
+ listChapters: (e) => n.runPromise(r.listChapters(e)),
12
+ getPassage: (e) => n.runPromise(r.getPassage(e)),
13
+ clearCache: () => n.runPromise(r.clearCache())
14
+ };
15
+ }
16
+ export { t as ScriptureError, r as createScriptureClient };