thursday-agent 0.1.0 → 0.1.2

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.
Files changed (208) hide show
  1. package/.next/BUILD_ID +1 -1
  2. package/.next/build-manifest.json +3 -3
  3. package/.next/prerender-manifest.json +3 -3
  4. package/.next/server/app/_global-error.html +1 -1
  5. package/.next/server/app/_global-error.rsc +1 -1
  6. package/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
  7. package/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  8. package/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  9. package/.next/server/app/_not-found.html +1 -1
  10. package/.next/server/app/_not-found.rsc +1 -1
  11. package/.next/server/app/_not-found.segments/_full.segment.rsc +1 -1
  12. package/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
  13. package/.next/server/app/_not-found.segments/_tree.segment.rsc +1 -1
  14. package/.next/server/app/artifact/[...path]/page/server-reference-manifest.json +1 -1
  15. package/.next/server/app/artifact/[...path]/page.js.nft.json +1 -1
  16. package/.next/server/app/artifact/[...path]/page_client-reference-manifest.js +1 -1
  17. package/.next/server/app/page/server-reference-manifest.json +41 -41
  18. package/.next/server/app/page.js.nft.json +1 -1
  19. package/.next/server/app/page_client-reference-manifest.js +1 -1
  20. package/.next/server/chunks/ssr/[root-of-the-server]__01id-v3._.js +3 -0
  21. package/.next/server/chunks/ssr/[root-of-the-server]__0dfwvr4._.js +1 -1
  22. package/.next/server/chunks/ssr/[root-of-the-server]__1-mnhyd._.js +1 -1
  23. package/.next/server/chunks/ssr/{[root-of-the-server]__0ng1y5l._.js → [root-of-the-server]__185grso._.js} +2 -2
  24. package/.next/server/chunks/ssr/_077-g6s._.js +1 -1
  25. package/.next/server/chunks/ssr/_0ay6b01._.js +1 -1
  26. package/.next/server/chunks/ssr/{_1lz4t71._.js → _0j4v8of._.js} +2 -2
  27. package/.next/server/chunks/ssr/{_061oc5l._.js → _0l81bzy._.js} +2 -2
  28. package/.next/server/chunks/ssr/{_0-pwe74._.js → _0lc_7c8._.js} +2 -2
  29. package/.next/server/chunks/ssr/_0nso8tp._.js +3 -0
  30. package/.next/server/chunks/ssr/{_06l25rd._.js → _0q_2f2x._.js} +2 -2
  31. package/.next/server/chunks/ssr/_0sf1isi._.js +1 -1
  32. package/.next/server/chunks/ssr/{_0c2y8ks._.js → _10uvw3l._.js} +2 -2
  33. package/.next/server/chunks/ssr/{_1wlc_pv._.js → _19_o9d-._.js} +2 -2
  34. package/.next/server/chunks/ssr/{_0vbcev4._.js → _1dcxzqe._.js} +2 -2
  35. package/.next/server/chunks/ssr/_1e-dgz0._.js +1 -1
  36. package/.next/server/chunks/ssr/_1jbv7m1._.js +3 -0
  37. package/.next/server/chunks/ssr/features_bot_components_bot-setting_tsx_01ajft6._.js +1 -1
  38. package/.next/server/chunks/ssr/features_config_components_14jqgy4._.js +1 -1
  39. package/.next/server/chunks/ssr/features_config_components_config-setting_tsx_0xfwqdg._.js +1 -1
  40. package/.next/server/chunks/ssr/features_connectors_components_mcp-setting_tsx_0jmbgvp._.js +1 -1
  41. package/.next/server/chunks/ssr/features_memory_components_memory-setting_tsx_0oa43sw._.js +1 -1
  42. package/.next/server/chunks/ssr/{node_modules_0okab9u._.js → node_modules_00d6675._.js} +1 -1
  43. package/.next/server/chunks/ssr/{node_modules_0510bcb._.js → node_modules_043-236._.js} +1 -1
  44. package/.next/server/chunks/ssr/{node_modules_13r64hh._.js → node_modules_06kvvuo._.js} +1 -1
  45. package/.next/server/chunks/ssr/{node_modules_12ilj3x._.js → node_modules_0_fvxnt._.js} +1 -1
  46. package/.next/server/chunks/ssr/{node_modules_0n9m8ww._.js → node_modules_0_j7-g4._.js} +1 -1
  47. package/.next/server/chunks/ssr/{node_modules_1hfkkak._.js → node_modules_0bue6gy._.js} +1 -1
  48. package/.next/server/chunks/ssr/{node_modules_0o9cu2m._.js → node_modules_0fbw5-u._.js} +1 -1
  49. package/.next/server/chunks/ssr/{node_modules_01-lnjv._.js → node_modules_0ipn1ho._.js} +1 -1
  50. package/.next/server/chunks/ssr/{node_modules_1i1aztk._.js → node_modules_0ls96je._.js} +1 -1
  51. package/.next/server/chunks/ssr/{node_modules_18h15oi._.js → node_modules_0xwx4u-._.js} +1 -1
  52. package/.next/server/chunks/ssr/{node_modules_04m323e._.js → node_modules_0y2-av4._.js} +1 -1
  53. package/.next/server/chunks/ssr/{node_modules_1wya71n._.js → node_modules_108wd2o._.js} +1 -1
  54. package/.next/server/chunks/ssr/{node_modules_1bog3e3._.js → node_modules_13f2md6._.js} +1 -1
  55. package/.next/server/chunks/ssr/{node_modules_0cagd-a._.js → node_modules_16i4o_3._.js} +1 -1
  56. package/.next/server/chunks/ssr/{node_modules_1ekezwy._.js → node_modules_1_588_4._.js} +1 -1
  57. package/.next/server/chunks/ssr/{node_modules_126jgz-._.js → node_modules_1d-is1o._.js} +1 -1
  58. package/.next/server/chunks/ssr/{node_modules_20oe6vi._.js → node_modules_1ee8gav._.js} +1 -1
  59. package/.next/server/chunks/ssr/{node_modules_0kc8lu9._.js → node_modules_1hn_sd5._.js} +1 -1
  60. package/.next/server/chunks/ssr/{node_modules_1czzodm._.js → node_modules_1jatz7w._.js} +1 -1
  61. package/.next/server/chunks/ssr/{node_modules_0eq4z64._.js → node_modules_1k29j1j._.js} +1 -1
  62. package/.next/server/chunks/ssr/{node_modules_0snv8wz._.js → node_modules_1nhw9qg._.js} +1 -1
  63. package/.next/server/chunks/ssr/{node_modules_06gkc-1._.js → node_modules_1t0y5jt._.js} +1 -1
  64. package/.next/server/chunks/ssr/{node_modules_14qjnj6._.js → node_modules_1ub40gk._.js} +1 -1
  65. package/.next/server/chunks/ssr/{node_modules_1ci9xpq._.js → node_modules_1v0077l._.js} +1 -1
  66. package/.next/server/chunks/ssr/{node_modules_0egyezs._.js → node_modules_1y8_3vg._.js} +1 -1
  67. package/.next/server/chunks/ssr/{node_modules_0a7_hec._.js → node_modules_20ynonm._.js} +1 -1
  68. package/.next/server/chunks/ssr/{node_modules_@mermaid-js_parser_dist_chunks_mermaid-parser_core_0babb8b._.js → node_modules_@mermaid-js_parser_dist_chunks_mermaid-parser_core_092s8nx._.js} +1 -1
  69. package/.next/server/chunks/ssr/{node_modules_@mermaid-js_parser_dist_chunks_mermaid-parser_core_0jiglry._.js → node_modules_@mermaid-js_parser_dist_chunks_mermaid-parser_core_1nvexgu._.js} +1 -1
  70. package/.next/server/middleware-build-manifest.js +3 -3
  71. package/.next/server/pages/404.html +1 -1
  72. package/.next/server/pages/500.html +1 -1
  73. package/.next/server/server-reference-manifest.js +1 -1
  74. package/.next/server/server-reference-manifest.json +42 -42
  75. package/.next/static/chunks/{0qwvymwynno3x.js → 0yysv1gzin17t.js} +1 -1
  76. package/.next/static/chunks/{1ti6qqe8rxjc9.js → 1fr5m75pwtyic.js} +1 -1
  77. package/.next/static/chunks/{2tab0u1fay-lo.js → 1gy3bbv7usnjo.js} +1 -1
  78. package/.next/static/chunks/{1n1_b0m4z2r2l.js → 1keib_gt066gc.js} +1 -1
  79. package/.next/static/chunks/{17yxvpmlyxotg.js → 1khakdu_iuedc.js} +1 -1
  80. package/.next/static/chunks/{3a8ieqoovwtgg.js → 21rk8w7bda-su.js} +1 -1
  81. package/.next/static/chunks/{3imn63hmy-dvm.js → 247d-r95j8xs0.js} +1 -1
  82. package/.next/static/chunks/{3v_k5wbdx5z1e.js → 28g42tw8tsvhd.js} +1 -1
  83. package/.next/static/chunks/{26jl58p1cmfyz.js → 2fq_86jvq9ymq.js} +1 -1
  84. package/.next/static/chunks/{1ma7gsnw16oor.js → 2ihkf6l2jowo9.js} +3 -3
  85. package/.next/static/chunks/{16jdhpex5davi.js → 2wngeetfnzxkp.js} +1 -1
  86. package/.next/static/chunks/{225bcu0dkzwh9.js → 3aquirz5h71da.js} +1 -1
  87. package/.next/static/chunks/{3ktulatcmvs36.js → 3fqvc0cg-atq_.js} +1 -1
  88. package/.next/static/chunks/{0t7ve-t64i24a.js → 3p4egvfjxpatb.js} +1 -1
  89. package/.next/static/chunks/3qe1w1ei-huhl.js +1 -0
  90. package/.next/static/chunks/{0m28u02ktcwrt.js → 3xxa2j56-f3nm.js} +1 -1
  91. package/.next/static/chunks/{1n0rxcrn8v33a.js → 3y40riycdip-i.js} +1 -1
  92. package/.next/static/chunks/{07hfxlyqq92v-.js → 45a6zbtkelph9.js} +1 -1
  93. package/README.md +24 -1
  94. package/bin/thursday.mjs +50 -2
  95. package/package.json +3 -17
  96. package/.next/server/chunks/ssr/[root-of-the-server]__1d9rffu._.js +0 -3
  97. package/.next/server/chunks/ssr/_0g7xsms._.js +0 -3
  98. package/.next/server/chunks/ssr/_0n0wwfo._.js +0 -3
  99. package/.next/static/chunks/2bd12_uvbr996.js +0 -1
  100. package/node_modules/@img/sharp-libvips-linux-x64/README.md +0 -46
  101. package/node_modules/@img/sharp-libvips-linux-x64/lib/glib-2.0/include/glibconfig.h +0 -219
  102. package/node_modules/@img/sharp-libvips-linux-x64/lib/index.js +0 -1
  103. package/node_modules/@img/sharp-libvips-linux-x64/lib/libvips-cpp.so.8.18.6 +0 -0
  104. package/node_modules/@img/sharp-libvips-linux-x64/package.json +0 -43
  105. package/node_modules/@img/sharp-libvips-linux-x64/versions.json +0 -30
  106. package/node_modules/@img/sharp-libvips-linuxmusl-x64/README.md +0 -46
  107. package/node_modules/@img/sharp-libvips-linuxmusl-x64/lib/glib-2.0/include/glibconfig.h +0 -219
  108. package/node_modules/@img/sharp-libvips-linuxmusl-x64/lib/index.js +0 -1
  109. package/node_modules/@img/sharp-libvips-linuxmusl-x64/lib/libvips-cpp.so.8.18.6 +0 -0
  110. package/node_modules/@img/sharp-libvips-linuxmusl-x64/package.json +0 -43
  111. package/node_modules/@img/sharp-libvips-linuxmusl-x64/versions.json +0 -30
  112. package/node_modules/@img/sharp-linux-x64/index.cjs +0 -2
  113. package/node_modules/@img/sharp-linux-x64/lib/sharp-linux-x64-0.35.4.node +0 -0
  114. package/node_modules/@img/sharp-linux-x64/package.json +0 -47
  115. package/node_modules/@img/sharp-linuxmusl-x64/index.cjs +0 -2
  116. package/node_modules/@img/sharp-linuxmusl-x64/lib/sharp-linuxmusl-x64-0.35.4.node +0 -0
  117. package/node_modules/@img/sharp-linuxmusl-x64/package.json +0 -47
  118. package/node_modules/@libsql/linux-x64-gnu/index.node +0 -0
  119. package/node_modules/@libsql/linux-x64-gnu/package.json +0 -36
  120. package/node_modules/@libsql/linux-x64-musl/index.node +0 -0
  121. package/node_modules/@libsql/linux-x64-musl/package.json +0 -36
  122. package/node_modules/libsql/auth.js +0 -22
  123. package/node_modules/libsql/index.js +0 -441
  124. package/node_modules/libsql/node_modules/detect-libc/lib/detect-libc.js +0 -279
  125. package/node_modules/libsql/node_modules/detect-libc/lib/filesystem.js +0 -41
  126. package/node_modules/libsql/node_modules/detect-libc/lib/process.js +0 -19
  127. package/node_modules/libsql/node_modules/detect-libc/package.json +0 -40
  128. package/node_modules/libsql/package.json +0 -90
  129. package/node_modules/libsql/sqlite-error.js +0 -21
  130. package/node_modules/sharp/dist/channel.cjs +0 -177
  131. package/node_modules/sharp/dist/channel.mjs +0 -177
  132. package/node_modules/sharp/dist/colour.cjs +0 -199
  133. package/node_modules/sharp/dist/colour.mjs +0 -199
  134. package/node_modules/sharp/dist/composite.cjs +0 -213
  135. package/node_modules/sharp/dist/composite.mjs +0 -213
  136. package/node_modules/sharp/dist/constructor.cjs +0 -511
  137. package/node_modules/sharp/dist/constructor.mjs +0 -511
  138. package/node_modules/sharp/dist/index.cjs +0 -25
  139. package/node_modules/sharp/dist/index.d.cts +0 -1999
  140. package/node_modules/sharp/dist/index.d.mts +0 -2046
  141. package/node_modules/sharp/dist/index.mjs +0 -25
  142. package/node_modules/sharp/dist/input.cjs +0 -819
  143. package/node_modules/sharp/dist/input.mjs +0 -819
  144. package/node_modules/sharp/dist/is.cjs +0 -143
  145. package/node_modules/sharp/dist/is.mjs +0 -143
  146. package/node_modules/sharp/dist/libvips.cjs +0 -212
  147. package/node_modules/sharp/dist/libvips.mjs +0 -212
  148. package/node_modules/sharp/dist/operation.cjs +0 -1002
  149. package/node_modules/sharp/dist/operation.mjs +0 -1002
  150. package/node_modules/sharp/dist/output.cjs +0 -1785
  151. package/node_modules/sharp/dist/output.mjs +0 -1785
  152. package/node_modules/sharp/dist/resize.cjs +0 -617
  153. package/node_modules/sharp/dist/resize.mjs +0 -617
  154. package/node_modules/sharp/dist/sharp.cjs +0 -174
  155. package/node_modules/sharp/dist/sharp.mjs +0 -174
  156. package/node_modules/sharp/dist/utility.cjs +0 -301
  157. package/node_modules/sharp/dist/utility.mjs +0 -301
  158. package/node_modules/sharp/node_modules/semver/classes/comparator.js +0 -143
  159. package/node_modules/sharp/node_modules/semver/classes/range.js +0 -577
  160. package/node_modules/sharp/node_modules/semver/classes/semver.js +0 -350
  161. package/node_modules/sharp/node_modules/semver/functions/clean.js +0 -8
  162. package/node_modules/sharp/node_modules/semver/functions/cmp.js +0 -54
  163. package/node_modules/sharp/node_modules/semver/functions/coerce.js +0 -62
  164. package/node_modules/sharp/node_modules/semver/functions/compare-build.js +0 -9
  165. package/node_modules/sharp/node_modules/semver/functions/compare-loose.js +0 -5
  166. package/node_modules/sharp/node_modules/semver/functions/compare.js +0 -7
  167. package/node_modules/sharp/node_modules/semver/functions/diff.js +0 -60
  168. package/node_modules/sharp/node_modules/semver/functions/eq.js +0 -5
  169. package/node_modules/sharp/node_modules/semver/functions/gt.js +0 -5
  170. package/node_modules/sharp/node_modules/semver/functions/gte.js +0 -5
  171. package/node_modules/sharp/node_modules/semver/functions/inc.js +0 -21
  172. package/node_modules/sharp/node_modules/semver/functions/lt.js +0 -5
  173. package/node_modules/sharp/node_modules/semver/functions/lte.js +0 -5
  174. package/node_modules/sharp/node_modules/semver/functions/major.js +0 -5
  175. package/node_modules/sharp/node_modules/semver/functions/minor.js +0 -5
  176. package/node_modules/sharp/node_modules/semver/functions/neq.js +0 -5
  177. package/node_modules/sharp/node_modules/semver/functions/parse.js +0 -18
  178. package/node_modules/sharp/node_modules/semver/functions/patch.js +0 -5
  179. package/node_modules/sharp/node_modules/semver/functions/prerelease.js +0 -8
  180. package/node_modules/sharp/node_modules/semver/functions/rcompare.js +0 -5
  181. package/node_modules/sharp/node_modules/semver/functions/rsort.js +0 -5
  182. package/node_modules/sharp/node_modules/semver/functions/satisfies.js +0 -12
  183. package/node_modules/sharp/node_modules/semver/functions/sort.js +0 -5
  184. package/node_modules/sharp/node_modules/semver/functions/truncate.js +0 -48
  185. package/node_modules/sharp/node_modules/semver/functions/valid.js +0 -8
  186. package/node_modules/sharp/node_modules/semver/index.js +0 -93
  187. package/node_modules/sharp/node_modules/semver/internal/constants.js +0 -37
  188. package/node_modules/sharp/node_modules/semver/internal/debug.js +0 -11
  189. package/node_modules/sharp/node_modules/semver/internal/identifiers.js +0 -29
  190. package/node_modules/sharp/node_modules/semver/internal/lrucache.js +0 -42
  191. package/node_modules/sharp/node_modules/semver/internal/parse-options.js +0 -17
  192. package/node_modules/sharp/node_modules/semver/internal/re.js +0 -223
  193. package/node_modules/sharp/node_modules/semver/package.json +0 -78
  194. package/node_modules/sharp/node_modules/semver/ranges/gtr.js +0 -6
  195. package/node_modules/sharp/node_modules/semver/ranges/intersects.js +0 -9
  196. package/node_modules/sharp/node_modules/semver/ranges/ltr.js +0 -6
  197. package/node_modules/sharp/node_modules/semver/ranges/max-satisfying.js +0 -27
  198. package/node_modules/sharp/node_modules/semver/ranges/min-satisfying.js +0 -26
  199. package/node_modules/sharp/node_modules/semver/ranges/min-version.js +0 -63
  200. package/node_modules/sharp/node_modules/semver/ranges/outside.js +0 -82
  201. package/node_modules/sharp/node_modules/semver/ranges/simplify.js +0 -49
  202. package/node_modules/sharp/node_modules/semver/ranges/subset.js +0 -249
  203. package/node_modules/sharp/node_modules/semver/ranges/to-comparators.js +0 -10
  204. package/node_modules/sharp/node_modules/semver/ranges/valid.js +0 -13
  205. package/node_modules/sharp/package.json +0 -227
  206. /package/.next/static/{M8Zkbqz2M4SLzLsE8DC6V → X34BUd9bfdH27ripuwwBm}/_buildManifest.js +0 -0
  207. /package/.next/static/{M8Zkbqz2M4SLzLsE8DC6V → X34BUd9bfdH27ripuwwBm}/_clientMiddlewareManifest.js +0 -0
  208. /package/.next/static/{M8Zkbqz2M4SLzLsE8DC6V → X34BUd9bfdH27ripuwwBm}/_ssgManifest.js +0 -0
@@ -1,441 +0,0 @@
1
- "use strict";
2
-
3
- const { load, currentTarget } = require("@neon-rs/load");
4
- const { familySync, GLIBC, MUSL } = require("detect-libc");
5
-
6
- function requireNative() {
7
- if (process.env.LIBSQL_JS_DEV) {
8
- return load(__dirname)
9
- }
10
- let target = currentTarget();
11
- // Workaround for Bun, which reports a musl target, but really wants glibc...
12
- if (familySync() == GLIBC) {
13
- switch (target) {
14
- case "linux-x64-musl":
15
- target = "linux-x64-gnu";
16
- break;
17
- case "linux-arm64-musl":
18
- target = "linux-arm64-gnu";
19
- break;
20
- }
21
- }
22
- // @neon-rs/load doesn't detect arm musl
23
- if (target === "linux-arm-gnueabihf" && familySync() == MUSL) {
24
- target = "linux-arm-musleabihf";
25
- }
26
- return require(`@libsql/${target}`);
27
- }
28
-
29
- const {
30
- databaseOpen,
31
- databaseOpenWithSync,
32
- databaseInTransaction,
33
- databaseInterrupt,
34
- databaseClose,
35
- databaseSyncSync,
36
- databaseSyncUntilSync,
37
- databaseExecSync,
38
- databasePrepareSync,
39
- databaseDefaultSafeIntegers,
40
- databaseAuthorizer,
41
- databaseLoadExtension,
42
- databaseMaxWriteReplicationIndex,
43
- statementRaw,
44
- statementIsReader,
45
- statementGet,
46
- statementRun,
47
- statementInterrupt,
48
- statementRowsSync,
49
- statementColumns,
50
- statementSafeIntegers,
51
- rowsNext,
52
- } = requireNative();
53
-
54
- const Authorization = require("./auth");
55
- const SqliteError = require("./sqlite-error");
56
-
57
- function convertError(err) {
58
- if (err.libsqlError) {
59
- return new SqliteError(err.message, err.code, err.rawCode);
60
- }
61
- return err;
62
- }
63
-
64
- /**
65
- * Database represents a connection that can prepare and execute SQL statements.
66
- */
67
- class Database {
68
- /**
69
- * Creates a new database connection. If the database file pointed to by `path` does not exists, it will be created.
70
- *
71
- * @constructor
72
- * @param {string} path - Path to the database file.
73
- */
74
- constructor(path, opts) {
75
- const encryptionCipher = opts?.encryptionCipher ?? "aes256cbc";
76
- if (opts && opts.syncUrl) {
77
- var authToken = "";
78
- if (opts.syncAuth) {
79
- console.warn("Warning: The `syncAuth` option is deprecated, please use `authToken` option instead.");
80
- authToken = opts.syncAuth;
81
- } else if (opts.authToken) {
82
- authToken = opts.authToken;
83
- }
84
- const encryptionKey = opts?.encryptionKey ?? "";
85
- const syncPeriod = opts?.syncPeriod ?? 0.0;
86
- const readYourWrites = opts?.readYourWrites ?? true;
87
- const offline = opts?.offline ?? false;
88
- const remoteEncryptionKey = opts?.remoteEncryptionKey ?? "";
89
- this.db = databaseOpenWithSync(path, opts.syncUrl, authToken, encryptionCipher, encryptionKey, syncPeriod, readYourWrites, offline, remoteEncryptionKey);
90
- } else {
91
- const authToken = opts?.authToken ?? "";
92
- const encryptionKey = opts?.encryptionKey ?? "";
93
- const timeout = opts?.timeout ?? 0.0;
94
- const remoteEncryptionKey = opts?.remoteEncryptionKey ?? "";
95
- this.db = databaseOpen(path, authToken, encryptionCipher, encryptionKey, timeout, remoteEncryptionKey);
96
- }
97
- // TODO: Use a libSQL API for this?
98
- this.memory = path === ":memory:";
99
- this.readonly = false;
100
- this.name = "";
101
- this.open = true;
102
-
103
- const db = this.db;
104
- Object.defineProperties(this, {
105
- inTransaction: {
106
- get() {
107
- return databaseInTransaction(db);
108
- }
109
- },
110
- });
111
- }
112
-
113
- sync() {
114
- return databaseSyncSync.call(this.db);
115
- }
116
-
117
- syncUntil(replicationIndex) {
118
- return databaseSyncUntilSync.call(this.db, replicationIndex);
119
- }
120
-
121
- /**
122
- * Prepares a SQL statement for execution.
123
- *
124
- * @param {string} sql - The SQL statement string to prepare.
125
- */
126
- prepare(sql) {
127
- try {
128
- const stmt = databasePrepareSync.call(this.db, sql);
129
- return new Statement(stmt);
130
- } catch (err) {
131
- throw convertError(err);
132
- }
133
- }
134
-
135
- /**
136
- * Returns a function that executes the given function in a transaction.
137
- *
138
- * @param {function} fn - The function to wrap in a transaction.
139
- */
140
- transaction(fn) {
141
- if (typeof fn !== "function")
142
- throw new TypeError("Expected first argument to be a function");
143
-
144
- const db = this;
145
- const wrapTxn = (mode) => {
146
- return (...bindParameters) => {
147
- db.exec("BEGIN " + mode);
148
- try {
149
- const result = fn(...bindParameters);
150
- db.exec("COMMIT");
151
- return result;
152
- } catch (err) {
153
- db.exec("ROLLBACK");
154
- throw err;
155
- }
156
- };
157
- };
158
- const properties = {
159
- default: { value: wrapTxn("") },
160
- deferred: { value: wrapTxn("DEFERRED") },
161
- immediate: { value: wrapTxn("IMMEDIATE") },
162
- exclusive: { value: wrapTxn("EXCLUSIVE") },
163
- database: { value: this, enumerable: true },
164
- };
165
- Object.defineProperties(properties.default.value, properties);
166
- Object.defineProperties(properties.deferred.value, properties);
167
- Object.defineProperties(properties.immediate.value, properties);
168
- Object.defineProperties(properties.exclusive.value, properties);
169
- return properties.default.value;
170
- }
171
-
172
- pragma(source, options) {
173
- if (options == null) options = {};
174
- if (typeof source !== 'string') throw new TypeError('Expected first argument to be a string');
175
- if (typeof options !== 'object') throw new TypeError('Expected second argument to be an options object');
176
- const simple = options['simple'];
177
- const stmt = this.prepare(`PRAGMA ${source}`, this, true);
178
- return simple ? stmt.pluck().get() : stmt.all();
179
- }
180
-
181
- backup(filename, options) {
182
- throw new Error("not implemented");
183
- }
184
-
185
- serialize(options) {
186
- throw new Error("not implemented");
187
- }
188
-
189
- function(name, options, fn) {
190
- // Apply defaults
191
- if (options == null) options = {};
192
- if (typeof options === "function") {
193
- fn = options;
194
- options = {};
195
- }
196
-
197
- // Validate arguments
198
- if (typeof name !== "string")
199
- throw new TypeError("Expected first argument to be a string");
200
- if (typeof fn !== "function")
201
- throw new TypeError("Expected last argument to be a function");
202
- if (typeof options !== "object")
203
- throw new TypeError("Expected second argument to be an options object");
204
- if (!name)
205
- throw new TypeError(
206
- "User-defined function name cannot be an empty string"
207
- );
208
-
209
- throw new Error("not implemented");
210
- }
211
-
212
- aggregate(name, options) {
213
- // Validate arguments
214
- if (typeof name !== "string")
215
- throw new TypeError("Expected first argument to be a string");
216
- if (typeof options !== "object" || options === null)
217
- throw new TypeError("Expected second argument to be an options object");
218
- if (!name)
219
- throw new TypeError(
220
- "User-defined function name cannot be an empty string"
221
- );
222
-
223
- throw new Error("not implemented");
224
- }
225
-
226
- table(name, factory) {
227
- // Validate arguments
228
- if (typeof name !== "string")
229
- throw new TypeError("Expected first argument to be a string");
230
- if (!name)
231
- throw new TypeError(
232
- "Virtual table module name cannot be an empty string"
233
- );
234
-
235
- throw new Error("not implemented");
236
- }
237
-
238
- authorizer(rules) {
239
- databaseAuthorizer.call(this.db, rules);
240
- }
241
-
242
- loadExtension(...args) {
243
- databaseLoadExtension.call(this.db, ...args);
244
- }
245
-
246
- maxWriteReplicationIndex() {
247
- return databaseMaxWriteReplicationIndex.call(this.db)
248
- }
249
-
250
- /**
251
- * Executes a SQL statement.
252
- *
253
- * @param {string} sql - The SQL statement string to execute.
254
- */
255
- exec(sql) {
256
- try {
257
- databaseExecSync.call(this.db, sql);
258
- } catch (err) {
259
- throw convertError(err);
260
- }
261
- }
262
-
263
- /**
264
- * Interrupts the database connection.
265
- */
266
- interrupt() {
267
- databaseInterrupt.call(this.db);
268
- }
269
-
270
- /**
271
- * Closes the database connection.
272
- */
273
- close() {
274
- databaseClose.call(this.db);
275
- this.open = false;
276
- }
277
-
278
- /**
279
- * Toggle 64-bit integer support.
280
- */
281
- defaultSafeIntegers(toggle) {
282
- databaseDefaultSafeIntegers.call(this.db, toggle ?? true);
283
- return this;
284
- }
285
-
286
- unsafeMode(...args) {
287
- throw new Error("not implemented");
288
- }
289
- }
290
-
291
- /**
292
- * Statement represents a prepared SQL statement that can be executed.
293
- */
294
- class Statement {
295
- constructor(stmt) {
296
- this.stmt = stmt;
297
- this.pluckMode = false;
298
- }
299
-
300
- /**
301
- * Toggle raw mode.
302
- *
303
- * @param raw Enable or disable raw mode. If you don't pass the parameter, raw mode is enabled.
304
- */
305
- raw(raw) {
306
- statementRaw.call(this.stmt, raw ?? true);
307
- return this;
308
- }
309
-
310
- /**
311
- * Toggle pluck mode.
312
- *
313
- * @param pluckMode Enable or disable pluck mode. If you don't pass the parameter, pluck mode is enabled.
314
- */
315
- pluck(pluckMode) {
316
- this.pluckMode = pluckMode ?? true;
317
- return this;
318
- }
319
-
320
- get reader() {
321
- return statementIsReader.call(this.stmt);
322
- }
323
-
324
- /**
325
- * Executes the SQL statement and returns an info object.
326
- */
327
- run(...bindParameters) {
328
- try {
329
- if (bindParameters.length == 1 && typeof bindParameters[0] === "object") {
330
- return statementRun.call(this.stmt, bindParameters[0]);
331
- } else {
332
- return statementRun.call(this.stmt, bindParameters.flat());
333
- }
334
- } catch (err) {
335
- throw convertError(err);
336
- }
337
- }
338
-
339
- /**
340
- * Executes the SQL statement and returns the first row.
341
- *
342
- * @param bindParameters - The bind parameters for executing the statement.
343
- */
344
- get(...bindParameters) {
345
- try {
346
- if (bindParameters.length == 1 && typeof bindParameters[0] === "object") {
347
- return statementGet.call(this.stmt, bindParameters[0]);
348
- } else {
349
- return statementGet.call(this.stmt, bindParameters.flat());
350
- }
351
- } catch (err) {
352
- throw convertError(err);
353
- }
354
- }
355
-
356
- /**
357
- * Executes the SQL statement and returns an iterator to the resulting rows.
358
- *
359
- * @param bindParameters - The bind parameters for executing the statement.
360
- */
361
- iterate(...bindParameters) {
362
- var rows = undefined;
363
- if (bindParameters.length == 1 && typeof bindParameters[0] === "object") {
364
- rows = statementRowsSync.call(this.stmt, bindParameters[0]);
365
- } else {
366
- rows = statementRowsSync.call(this.stmt, bindParameters.flat());
367
- }
368
- const iter = {
369
- nextRows: Array(100),
370
- nextRowIndex: 100,
371
- next() {
372
- try {
373
- if (this.nextRowIndex === 100) {
374
- rowsNext.call(rows, this.nextRows);
375
- this.nextRowIndex = 0;
376
- }
377
- const row = this.nextRows[this.nextRowIndex];
378
- this.nextRows[this.nextRowIndex] = undefined;
379
- if (!row) {
380
- return { done: true };
381
- }
382
- this.nextRowIndex++;
383
- return { value: row, done: false };
384
- } catch (err) {
385
- throw convertError(err);
386
- }
387
- },
388
- [Symbol.iterator]() {
389
- return this;
390
- },
391
- };
392
- return iter;
393
- }
394
-
395
- /**
396
- * Executes the SQL statement and returns an array of the resulting rows.
397
- *
398
- * @param bindParameters - The bind parameters for executing the statement.
399
- */
400
- all(...bindParameters) {
401
- try {
402
- const result = [];
403
- for (const row of this.iterate(...bindParameters)) {
404
- if (this.pluckMode) {
405
- result.push(row[Object.keys(row)[0]]);
406
- } else {
407
- result.push(row);
408
- }
409
- }
410
- return result;
411
- } catch (err) {
412
- throw convertError(err);
413
- }
414
- }
415
-
416
- /**
417
- * Interrupts the statement.
418
- */
419
- interrupt() {
420
- statementInterrupt.call(this.stmt);
421
- }
422
-
423
- /**
424
- * Returns the columns in the result set returned by this prepared statement.
425
- */
426
- columns() {
427
- return statementColumns.call(this.stmt);
428
- }
429
-
430
- /**
431
- * Toggle 64-bit integer support.
432
- */
433
- safeIntegers(toggle) {
434
- statementSafeIntegers.call(this.stmt, toggle ?? true);
435
- return this;
436
- }
437
- }
438
-
439
- module.exports = Database;
440
- module.exports.Authorization = Authorization;
441
- module.exports.SqliteError = SqliteError;
@@ -1,279 +0,0 @@
1
- // Copyright 2017 Lovell Fuller and others.
2
- // SPDX-License-Identifier: Apache-2.0
3
-
4
- 'use strict';
5
-
6
- const childProcess = require('child_process');
7
- const { isLinux, getReport } = require('./process');
8
- const { LDD_PATH, readFile, readFileSync } = require('./filesystem');
9
-
10
- let cachedFamilyFilesystem;
11
- let cachedVersionFilesystem;
12
-
13
- const command = 'getconf GNU_LIBC_VERSION 2>&1 || true; ldd --version 2>&1 || true';
14
- let commandOut = '';
15
-
16
- const safeCommand = () => {
17
- if (!commandOut) {
18
- return new Promise((resolve) => {
19
- childProcess.exec(command, (err, out) => {
20
- commandOut = err ? ' ' : out;
21
- resolve(commandOut);
22
- });
23
- });
24
- }
25
- return commandOut;
26
- };
27
-
28
- const safeCommandSync = () => {
29
- if (!commandOut) {
30
- try {
31
- commandOut = childProcess.execSync(command, { encoding: 'utf8' });
32
- } catch (_err) {
33
- commandOut = ' ';
34
- }
35
- }
36
- return commandOut;
37
- };
38
-
39
- /**
40
- * A String constant containing the value `glibc`.
41
- * @type {string}
42
- * @public
43
- */
44
- const GLIBC = 'glibc';
45
-
46
- /**
47
- * A Regexp constant to get the GLIBC Version.
48
- * @type {string}
49
- */
50
- const RE_GLIBC_VERSION = /GLIBC\s(\d+\.\d+)/;
51
-
52
- /**
53
- * A String constant containing the value `musl`.
54
- * @type {string}
55
- * @public
56
- */
57
- const MUSL = 'musl';
58
-
59
- /**
60
- * This string is used to find if the {@link LDD_PATH} is GLIBC
61
- * @type {string}
62
- */
63
- const GLIBC_ON_LDD = GLIBC.toUpperCase();
64
-
65
- /**
66
- * This string is used to find if the {@link LDD_PATH} is musl
67
- * @type {string}
68
- */
69
- const MUSL_ON_LDD = MUSL.toLowerCase();
70
-
71
- const isFileMusl = (f) => f.includes('libc.musl-') || f.includes('ld-musl-');
72
-
73
- const familyFromReport = () => {
74
- const report = getReport();
75
- if (report.header && report.header.glibcVersionRuntime) {
76
- return GLIBC;
77
- }
78
- if (Array.isArray(report.sharedObjects)) {
79
- if (report.sharedObjects.some(isFileMusl)) {
80
- return MUSL;
81
- }
82
- }
83
- return null;
84
- };
85
-
86
- const familyFromCommand = (out) => {
87
- const [getconf, ldd1] = out.split(/[\r\n]+/);
88
- if (getconf && getconf.includes(GLIBC)) {
89
- return GLIBC;
90
- }
91
- if (ldd1 && ldd1.includes(MUSL)) {
92
- return MUSL;
93
- }
94
- return null;
95
- };
96
-
97
- const getFamilyFromLddContent = (content) => {
98
- if (content.includes(MUSL_ON_LDD)) {
99
- return MUSL;
100
- }
101
- if (content.includes(GLIBC_ON_LDD)) {
102
- return GLIBC;
103
- }
104
- return null;
105
- };
106
-
107
- const familyFromFilesystem = async () => {
108
- if (cachedFamilyFilesystem !== undefined) {
109
- return cachedFamilyFilesystem;
110
- }
111
- cachedFamilyFilesystem = null;
112
- try {
113
- const lddContent = await readFile(LDD_PATH);
114
- cachedFamilyFilesystem = getFamilyFromLddContent(lddContent);
115
- } catch (e) {}
116
- return cachedFamilyFilesystem;
117
- };
118
-
119
- const familyFromFilesystemSync = () => {
120
- if (cachedFamilyFilesystem !== undefined) {
121
- return cachedFamilyFilesystem;
122
- }
123
- cachedFamilyFilesystem = null;
124
- try {
125
- const lddContent = readFileSync(LDD_PATH);
126
- cachedFamilyFilesystem = getFamilyFromLddContent(lddContent);
127
- } catch (e) {}
128
- return cachedFamilyFilesystem;
129
- };
130
-
131
- /**
132
- * Resolves with the libc family when it can be determined, `null` otherwise.
133
- * @returns {Promise<?string>}
134
- */
135
- const family = async () => {
136
- let family = null;
137
- if (isLinux()) {
138
- family = await familyFromFilesystem();
139
- if (!family) {
140
- family = familyFromReport();
141
- }
142
- if (!family) {
143
- const out = await safeCommand();
144
- family = familyFromCommand(out);
145
- }
146
- }
147
- return family;
148
- };
149
-
150
- /**
151
- * Returns the libc family when it can be determined, `null` otherwise.
152
- * @returns {?string}
153
- */
154
- const familySync = () => {
155
- let family = null;
156
- if (isLinux()) {
157
- family = familyFromFilesystemSync();
158
- if (!family) {
159
- family = familyFromReport();
160
- }
161
- if (!family) {
162
- const out = safeCommandSync();
163
- family = familyFromCommand(out);
164
- }
165
- }
166
- return family;
167
- };
168
-
169
- /**
170
- * Resolves `true` only when the platform is Linux and the libc family is not `glibc`.
171
- * @returns {Promise<boolean>}
172
- */
173
- const isNonGlibcLinux = async () => isLinux() && await family() !== GLIBC;
174
-
175
- /**
176
- * Returns `true` only when the platform is Linux and the libc family is not `glibc`.
177
- * @returns {boolean}
178
- */
179
- const isNonGlibcLinuxSync = () => isLinux() && familySync() !== GLIBC;
180
-
181
- const versionFromFilesystem = async () => {
182
- if (cachedVersionFilesystem !== undefined) {
183
- return cachedVersionFilesystem;
184
- }
185
- cachedVersionFilesystem = null;
186
- try {
187
- const lddContent = await readFile(LDD_PATH);
188
- const versionMatch = lddContent.match(RE_GLIBC_VERSION);
189
- if (versionMatch) {
190
- cachedVersionFilesystem = versionMatch[1];
191
- }
192
- } catch (e) {}
193
- return cachedVersionFilesystem;
194
- };
195
-
196
- const versionFromFilesystemSync = () => {
197
- if (cachedVersionFilesystem !== undefined) {
198
- return cachedVersionFilesystem;
199
- }
200
- cachedVersionFilesystem = null;
201
- try {
202
- const lddContent = readFileSync(LDD_PATH);
203
- const versionMatch = lddContent.match(RE_GLIBC_VERSION);
204
- if (versionMatch) {
205
- cachedVersionFilesystem = versionMatch[1];
206
- }
207
- } catch (e) {}
208
- return cachedVersionFilesystem;
209
- };
210
-
211
- const versionFromReport = () => {
212
- const report = getReport();
213
- if (report.header && report.header.glibcVersionRuntime) {
214
- return report.header.glibcVersionRuntime;
215
- }
216
- return null;
217
- };
218
-
219
- const versionSuffix = (s) => s.trim().split(/\s+/)[1];
220
-
221
- const versionFromCommand = (out) => {
222
- const [getconf, ldd1, ldd2] = out.split(/[\r\n]+/);
223
- if (getconf && getconf.includes(GLIBC)) {
224
- return versionSuffix(getconf);
225
- }
226
- if (ldd1 && ldd2 && ldd1.includes(MUSL)) {
227
- return versionSuffix(ldd2);
228
- }
229
- return null;
230
- };
231
-
232
- /**
233
- * Resolves with the libc version when it can be determined, `null` otherwise.
234
- * @returns {Promise<?string>}
235
- */
236
- const version = async () => {
237
- let version = null;
238
- if (isLinux()) {
239
- version = await versionFromFilesystem();
240
- if (!version) {
241
- version = versionFromReport();
242
- }
243
- if (!version) {
244
- const out = await safeCommand();
245
- version = versionFromCommand(out);
246
- }
247
- }
248
- return version;
249
- };
250
-
251
- /**
252
- * Returns the libc version when it can be determined, `null` otherwise.
253
- * @returns {?string}
254
- */
255
- const versionSync = () => {
256
- let version = null;
257
- if (isLinux()) {
258
- version = versionFromFilesystemSync();
259
- if (!version) {
260
- version = versionFromReport();
261
- }
262
- if (!version) {
263
- const out = safeCommandSync();
264
- version = versionFromCommand(out);
265
- }
266
- }
267
- return version;
268
- };
269
-
270
- module.exports = {
271
- GLIBC,
272
- MUSL,
273
- family,
274
- familySync,
275
- isNonGlibcLinux,
276
- isNonGlibcLinuxSync,
277
- version,
278
- versionSync
279
- };