@anvia/studio 0.2.5 → 0.2.7

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 ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Indra Zulfi
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/dist/index.js CHANGED
@@ -794,9 +794,7 @@ import { join } from "path";
794
794
  import { mkdirSync } from "fs";
795
795
  import { createRequire } from "module";
796
796
  import { dirname, resolve } from "path";
797
- var { DatabaseSync } = createRequire(import.meta.url)(
798
- "node:sqlite"
799
- );
797
+ var DatabaseSync;
800
798
  function createSqliteSessionStore(options = {}) {
801
799
  return new SqliteSessionStore(options.path ?? ":memory:");
802
800
  }
@@ -1396,7 +1394,7 @@ var SqliteSessionStore = class {
1396
1394
  if (this.path !== ":memory:") {
1397
1395
  mkdirSync(dirname(resolve(this.path)), { recursive: true });
1398
1396
  }
1399
- const db = new DatabaseSync(this.path, {
1397
+ const db = new (loadDatabaseSync())(this.path, {
1400
1398
  allowUnknownNamedParameters: true,
1401
1399
  timeout: 5e3
1402
1400
  });
@@ -1752,6 +1750,22 @@ function guardAgainstLegacySessionSchema(db) {
1752
1750
  );
1753
1751
  }
1754
1752
  }
1753
+ function loadDatabaseSync() {
1754
+ if (DatabaseSync !== void 0) {
1755
+ return DatabaseSync;
1756
+ }
1757
+ try {
1758
+ ({ DatabaseSync } = createRequire(import.meta.url)(
1759
+ "node:sqlite"
1760
+ ));
1761
+ return DatabaseSync;
1762
+ } catch (error) {
1763
+ throw new Error(
1764
+ "The default Studio SQLite store requires Node.js with node:sqlite support. Provide custom Studio stores or disable persisted stores when running Studio in a runtime without node:sqlite.",
1765
+ { cause: error }
1766
+ );
1767
+ }
1768
+ }
1755
1769
  function toTrace(row) {
1756
1770
  const trace = parseJsonValue(row.trace_json);
1757
1771
  const input = parseJsonValue(row.input_json);