@telorun/sql 0.1.8 → 0.2.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/README.md CHANGED
@@ -1,6 +1,21 @@
1
- # ⚡ Telo
2
-
3
- Runtime for declarative backends.
1
+ <p align="center">
2
+ <img src="./assets/telo.png" alt="Telo" width="200" />
3
+ </p>
4
+
5
+ <h1 align="center">Telo</h1>
6
+
7
+ <p align="center">Runtime for declarative backends.</p>
8
+
9
+ <p align="center">
10
+ <a href="https://github.com/telorun/telo/actions/workflows/test.yml"><img alt="Tests" src="https://github.com/telorun/telo/actions/workflows/test.yml/badge.svg" /></a>
11
+ <a href="https://www.npmjs.com/package/@telorun/cli"><img alt="node" src="https://img.shields.io/node/v/@telorun/cli" /></a>
12
+ <br />
13
+ <a href="https://github.com/telorun/telo/commits/main"><img alt="Last commit" src="https://img.shields.io/github/last-commit/telorun/telo" /></a>
14
+ <a href="https://github.com/telorun/telo/issues"><img alt="Issues" src="https://img.shields.io/github/issues/telorun/telo" /></a>
15
+ <a href="https://github.com/telorun/telo/pulls"><img alt="Pull requests" src="https://img.shields.io/github/issues-pr/telorun/telo" /></a>
16
+ <br />
17
+ <img alt="Changesets" src="https://img.shields.io/badge/maintained%20with-changesets-176de3" />
18
+ </p>
4
19
 
5
20
  Telo is an execution engine (Micro-Kernel) that runs logic defined entirely in YAML manifests. Instead of writing imperative backend code, you define your routes, databases, schemas, and AI workflows as atomic, interconnected YAML documents. Telo takes those manifests and runs them.
6
21
 
@@ -102,6 +102,19 @@ export async function create(resource, ctx) {
102
102
  return new SqlConnectionResource(resource, sqlite);
103
103
  }
104
104
  async function openSqliteDatabase(file = ":memory:") {
105
+ // Auto-create the parent directory for file-backed databases. SQLite
106
+ // drivers fail-fast when the directory doesn't exist; mirroring `mkdir
107
+ // -p` here lets manifests use paths like `./tmp/foo.sqlite` without a
108
+ // separate filesystem-prep step. `:memory:` and `file::memory:?...`
109
+ // skip filesystem entirely.
110
+ if (file !== ":memory:" && !file.startsWith("file::memory:")) {
111
+ const { mkdir } = await import("node:fs/promises");
112
+ const { dirname } = await import("node:path");
113
+ const dir = dirname(file);
114
+ if (dir && dir !== "." && dir !== "/") {
115
+ await mkdir(dir, { recursive: true });
116
+ }
117
+ }
105
118
  if (typeof Bun !== "undefined") {
106
119
  const { openDatabase } = await import("./sqlite-driver-bun.js");
107
120
  return openDatabase(file);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@telorun/sql",
3
- "version": "0.1.8",
3
+ "version": "0.2.0",
4
4
  "description": "Telo SQL module - SQL database resource kinds for Telo manifests.",
5
5
  "keywords": [
6
6
  "telo",
@@ -63,7 +63,7 @@
63
63
  "better-sqlite3": "^12.8.0",
64
64
  "pg": "^8.20.0",
65
65
  "kysely": "^0.28.15",
66
- "@telorun/sdk": "0.6.0"
66
+ "@telorun/sdk": "0.7.0"
67
67
  },
68
68
  "devDependencies": {
69
69
  "@types/better-sqlite3": "^7.0.0",
@@ -159,6 +159,20 @@ export async function create(
159
159
  }
160
160
 
161
161
  async function openSqliteDatabase(file = ":memory:"): Promise<SqliteDb> {
162
+ // Auto-create the parent directory for file-backed databases. SQLite
163
+ // drivers fail-fast when the directory doesn't exist; mirroring `mkdir
164
+ // -p` here lets manifests use paths like `./tmp/foo.sqlite` without a
165
+ // separate filesystem-prep step. `:memory:` and `file::memory:?...`
166
+ // skip filesystem entirely.
167
+ if (file !== ":memory:" && !file.startsWith("file::memory:")) {
168
+ const { mkdir } = await import("node:fs/promises");
169
+ const { dirname } = await import("node:path");
170
+ const dir = dirname(file);
171
+ if (dir && dir !== "." && dir !== "/") {
172
+ await mkdir(dir, { recursive: true });
173
+ }
174
+ }
175
+
162
176
  if (typeof Bun !== "undefined") {
163
177
  const { openDatabase } = await import("./sqlite-driver-bun.js");
164
178
  return openDatabase(file);