@faith-tools/bible-sdk 0.0.0-stage → 0.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.
- package/LICENSE.md +21 -0
- package/README.md +535 -2
- package/dist/bible-sdk.js +261 -0
- package/dist/data/effect.js +65 -0
- package/dist/data.js +16 -0
- package/dist/index.js +946 -0
- package/dist/providers/fetch-bible.js +254 -0
- package/dist/providers/helloao.js +1 -0
- package/dist/providers/youversion.js +1 -0
- package/dist/providers-D_4UrThl.js +431 -0
- package/dist/runtime-C-BCRjZd.js +220 -0
- package/dist/scripture-inline.js +261 -0
- package/dist/types/card.d.ts +20 -0
- package/dist/types/data-effect.d.ts +184 -0
- package/dist/types/data-helpers.d.ts +21 -0
- package/dist/types/data-types.d.ts +112 -0
- package/dist/types/data.d.ts +91 -0
- package/dist/types/dom-runtime.d.ts +5 -0
- package/dist/types/find.d.ts +12 -0
- package/dist/types/index.d.ts +31 -0
- package/dist/types/passage-input.d.ts +57 -0
- package/dist/types/providers/fetch-bible.d.ts +14 -0
- package/dist/types/providers/helloao.d.ts +1 -0
- package/dist/types/providers/youversion.d.ts +1 -0
- package/dist/types/providers.d.ts +62 -0
- package/dist/types/runtime.d.ts +18 -0
- package/dist/types/scan.d.ts +8 -0
- package/dist/types/scripture-passage.d.ts +61 -0
- package/dist/types/version-input.d.ts +64 -0
- package/package.json +78 -3
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { t as e } from "../providers-D_4UrThl.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-C-BCRjZd.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(), d = g.succeed(i, {
|
|
43
|
+
id: a.id,
|
|
44
|
+
defaultVersionId: a.defaultVersionId,
|
|
45
|
+
listVersions: () => u.get("versions", () => a.listVersions().pipe(h.tap(s(_.Array(r))))),
|
|
46
|
+
listBooks: (e) => u.get(JSON.stringify(["books", e]), () => a.listBooks(e).pipe(h.tap(s(_.Array(c))))),
|
|
47
|
+
listChapters: (e, t) => u.get(JSON.stringify([
|
|
48
|
+
"chapters",
|
|
49
|
+
e,
|
|
50
|
+
t
|
|
51
|
+
]), () => a.listChapters(e, t).pipe(h.tap(s(_.Array(o))))),
|
|
52
|
+
getPassageData: (e, t) => a.getPassageData(e, t),
|
|
53
|
+
clearCache: u.clear.pipe(h.andThen(a.clearCache))
|
|
54
|
+
});
|
|
55
|
+
return {
|
|
56
|
+
provider: a.id,
|
|
57
|
+
layer: d,
|
|
58
|
+
listVersions: () => b.listVersions().pipe(h.provide(d)),
|
|
59
|
+
listBooks: (e = {}) => b.listBooks(e).pipe(h.provide(d)),
|
|
60
|
+
listChapters: (e) => b.listChapters(e).pipe(h.provide(d)),
|
|
61
|
+
getPassage: (e) => b.getPassage(e).pipe(h.provide(d)),
|
|
62
|
+
clearCache: () => b.clearCache.pipe(h.provide(d))
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
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-C-BCRjZd.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 };
|