From 6aa5edcbba46e5d1545634cb218df1f6dd398bd0 Mon Sep 17 00:00:00 2001 From: Chris Wilkinson Date: Wed, 25 Sep 2024 04:11:20 +0100 Subject: [PATCH] Add libSQL package (#3649) Co-authored-by: Tim --- .changeset/blue-jokes-kneel.md | 5 + packages/sql-libsql/LICENSE | 21 ++ packages/sql-libsql/README.md | 5 + packages/sql-libsql/docgen.json | 6 + packages/sql-libsql/package.json | 57 ++++++ packages/sql-libsql/src/LibsqlClient.ts | 207 ++++++++++++++++++++ packages/sql-libsql/src/LibsqlMigrator.ts | 38 ++++ packages/sql-libsql/src/index.ts | 9 + packages/sql-libsql/test/Client.test.ts | 90 +++++++++ packages/sql-libsql/test/Resolver.test.ts | 180 +++++++++++++++++ packages/sql-libsql/tsconfig.build.json | 13 ++ packages/sql-libsql/tsconfig.examples.json | 15 ++ packages/sql-libsql/tsconfig.json | 9 + packages/sql-libsql/tsconfig.src.json | 10 + packages/sql-libsql/tsconfig.test.json | 16 ++ packages/sql-libsql/vitest.config.ts | 6 + pnpm-lock.yaml | 215 ++++++++++++++++++++- tsconfig.base.json | 3 + tsconfig.build.json | 1 + tsconfig.json | 1 + vitest.shared.ts | 1 + 21 files changed, 906 insertions(+), 2 deletions(-) create mode 100644 .changeset/blue-jokes-kneel.md create mode 100644 packages/sql-libsql/LICENSE create mode 100644 packages/sql-libsql/README.md create mode 100644 packages/sql-libsql/docgen.json create mode 100644 packages/sql-libsql/package.json create mode 100644 packages/sql-libsql/src/LibsqlClient.ts create mode 100644 packages/sql-libsql/src/LibsqlMigrator.ts create mode 100644 packages/sql-libsql/src/index.ts create mode 100644 packages/sql-libsql/test/Client.test.ts create mode 100644 packages/sql-libsql/test/Resolver.test.ts create mode 100644 packages/sql-libsql/tsconfig.build.json create mode 100644 packages/sql-libsql/tsconfig.examples.json create mode 100644 packages/sql-libsql/tsconfig.json create mode 100644 packages/sql-libsql/tsconfig.src.json create mode 100644 packages/sql-libsql/tsconfig.test.json create mode 100644 packages/sql-libsql/vitest.config.ts diff --git a/.changeset/blue-jokes-kneel.md b/.changeset/blue-jokes-kneel.md new file mode 100644 index 0000000000..d9a9ac276a --- /dev/null +++ b/.changeset/blue-jokes-kneel.md @@ -0,0 +1,5 @@ +--- +"@effect/sql-libsql": patch +--- + +Add sql-libsql package diff --git a/packages/sql-libsql/LICENSE b/packages/sql-libsql/LICENSE new file mode 100644 index 0000000000..8967b4b176 --- /dev/null +++ b/packages/sql-libsql/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2024-present The Contributors + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/packages/sql-libsql/README.md b/packages/sql-libsql/README.md new file mode 100644 index 0000000000..fc260d8afc --- /dev/null +++ b/packages/sql-libsql/README.md @@ -0,0 +1,5 @@ +# Effect SQL - libSQL + +An @effect/sql implementation using the `@libsql/client` library. + +See here for more information: https://github.com/Effect-TS/effect/tree/main/packages/sql diff --git a/packages/sql-libsql/docgen.json b/packages/sql-libsql/docgen.json new file mode 100644 index 0000000000..f980a32f52 --- /dev/null +++ b/packages/sql-libsql/docgen.json @@ -0,0 +1,6 @@ +{ + "$schema": "../../node_modules/@effect/docgen/schema.json", + "exclude": [ + "src/internal/**/*.ts" + ] +} diff --git a/packages/sql-libsql/package.json b/packages/sql-libsql/package.json new file mode 100644 index 0000000000..b2428e519f --- /dev/null +++ b/packages/sql-libsql/package.json @@ -0,0 +1,57 @@ +{ + "name": "@effect/sql-libsql", + "version": "0.1.0", + "type": "module", + "license": "MIT", + "description": "A libSQL toolkit for Effect", + "homepage": "https://effect.website", + "repository": { + "type": "git", + "url": "https://github.com/Effect-TS/effect.git", + "directory": "packages/sql-libsql" + }, + "bugs": { + "url": "https://github.com/Effect-TS/effect/issues" + }, + "tags": [ + "typescript", + "sql", + "libsql", + "database" + ], + "keywords": [ + "typescript", + "sql", + "libsql", + "database" + ], + "publishConfig": { + "access": "public", + "directory": "dist", + "provenance": true + }, + "scripts": { + "codegen": "build-utils prepare-v2", + "build": "pnpm build-esm && pnpm build-annotate && pnpm build-cjs && build-utils pack-v2", + "build-esm": "tsc -b tsconfig.build.json", + "build-cjs": "babel build/esm --plugins @babel/transform-export-namespace-from --plugins @babel/transform-modules-commonjs --out-dir build/cjs --source-maps", + "build-annotate": "babel build/esm --plugins annotate-pure-calls --out-dir build/esm --source-maps", + "check": "tsc -b tsconfig.json", + "test": "vitest", + "coverage": "vitest --coverage" + }, + "devDependencies": { + "@effect/platform": "workspace:^", + "@effect/sql": "workspace:^", + "effect": "workspace:^" + }, + "peerDependencies": { + "@effect/platform": "workspace:^", + "@effect/sql": "workspace:^", + "effect": "workspace:^" + }, + "dependencies": { + "@libsql/client": "^0.12.0", + "@opentelemetry/semantic-conventions": "^1.25.1" + } +} diff --git a/packages/sql-libsql/src/LibsqlClient.ts b/packages/sql-libsql/src/LibsqlClient.ts new file mode 100644 index 0000000000..ea4e10e579 --- /dev/null +++ b/packages/sql-libsql/src/LibsqlClient.ts @@ -0,0 +1,207 @@ +/** + * @since 1.0.0 + */ +import * as Client from "@effect/sql/SqlClient" +import type { Connection } from "@effect/sql/SqlConnection" +import { SqlError } from "@effect/sql/SqlError" +import * as Statement from "@effect/sql/Statement" +import * as Libsql from "@libsql/client" +import * as Otel from "@opentelemetry/semantic-conventions" +import * as Config from "effect/Config" +import type { ConfigError } from "effect/ConfigError" +import * as Context from "effect/Context" +import * as Effect from "effect/Effect" +import { identity } from "effect/Function" +import * as Layer from "effect/Layer" +import * as Scope from "effect/Scope" + +/** + * @category type ids + * @since 1.0.0 + */ +export const TypeId: unique symbol = Symbol.for("@effect/sql-libsql/LibsqlClient") + +/** + * @category type ids + * @since 1.0.0 + */ +export type TypeId = typeof TypeId + +/** + * @category models + * @since 1.0.0 + */ +export interface LibsqlClient extends Client.SqlClient { + readonly [TypeId]: TypeId + readonly config: LibsqlClientConfig +} + +/** + * @category tags + * @since 1.0.0 + */ +export const LibsqlClient = Context.GenericTag("@effect/sql-libsql/LibsqlClient") + +/** + * @category models + * @since 1.0.0 + */ +export interface LibsqlClientConfig { + /** The database URL. + * + * The client supports `libsql:`, `http:`/`https:`, `ws:`/`wss:` and `file:` URL. For more infomation, + * please refer to the project README: + * + * https://github.com/libsql/libsql-client-ts#supported-urls + */ + readonly url: string + /** Authentication token for the database. */ + readonly authToken?: string | undefined + /** Encryption key for the database. */ + readonly encryptionKey?: string | undefined + /** URL of a remote server to synchronize database with. */ + readonly syncUrl?: string | undefined + /** Sync interval in seconds. */ + readonly syncInterval?: number | undefined + /** Enables or disables TLS for `libsql:` URLs. + * + * By default, `libsql:` URLs use TLS. You can set this option to `false` to disable TLS. + */ + readonly tls?: boolean | undefined + /** How to convert SQLite integers to JavaScript values: + * + * - `"number"` (default): returns SQLite integers as JavaScript `number`-s (double precision floats). + * `number` cannot precisely represent integers larger than 2^53-1 in absolute value, so attempting to read + * larger integers will throw a `RangeError`. + * - `"bigint"`: returns SQLite integers as JavaScript `bigint`-s (arbitrary precision integers). Bigints can + * precisely represent all SQLite integers. + * - `"string"`: returns SQLite integers as strings. + */ + readonly intMode?: "number" | "bigint" | "string" | undefined + /** Concurrency limit. + * + * By default, the client performs up to 20 concurrent requests. You can set this option to a higher + * number to increase the concurrency limit or set it to 0 to disable concurrency limits completely. + */ + readonly concurrency?: number | undefined + + readonly spanAttributes?: Record | undefined + + readonly transformResultNames?: ((str: string) => string) | undefined + readonly transformQueryNames?: ((str: string) => string) | undefined +} + +interface LibsqlConnection extends Connection {} + +/** + * @category constructor + * @since 1.0.0 + */ +export const make = ( + options: LibsqlClientConfig +): Effect.Effect => + Effect.gen(function*() { + const compiler = Statement.makeCompilerSqlite(options.transformQueryNames) + const transformRows = Statement.defaultTransforms( + options.transformResultNames! + ).array + + const makeConnection = Effect.gen(function*() { + const db = Libsql.createClient(options as Libsql.Config) + yield* Effect.addFinalizer(() => Effect.sync(() => db.close())) + + const run = ( + sql: string, + params: ReadonlyArray = [] + ) => + Effect.tryPromise({ + try: () => db.execute({ sql, args: params as Array }).then((results) => results.rows), + catch: (cause) => new SqlError({ cause, message: "Failed to execute statement" }) + }) + + const runRaw = ( + sql: string, + params: ReadonlyArray = [] + ) => + Effect.tryPromise({ + try: () => db.execute({ sql, args: params as Array }), + catch: (cause) => new SqlError({ cause, message: "Failed to execute statement" }) + }) + + const runTransform = options.transformResultNames + ? (sql: string, params?: ReadonlyArray) => Effect.map(run(sql, params), transformRows) + : run + + return identity({ + execute(sql, params) { + return runTransform(sql, params) + }, + executeRaw(sql, params) { + return runRaw(sql, params) + }, + executeValues(sql, params) { + return Effect.map(run(sql, params), (rows) => rows.map((row) => Array.from(row) as Array)) + }, + executeWithoutTransform(sql, params) { + return run(sql, params) + }, + executeUnprepared(sql, params) { + return run(sql, params) + }, + executeStream(_sql, _params) { + return Effect.dieMessage("executeStream not implemented") + } + }) + }) + + const semaphore = yield* Effect.makeSemaphore(1) + const connection = yield* makeConnection + + const acquirer = semaphore.withPermits(1)(Effect.succeed(connection)) + const transactionAcquirer = Effect.uninterruptibleMask((restore) => + Effect.as( + Effect.zipRight( + restore(semaphore.take(1)), + Effect.tap( + Effect.scope, + (scope) => Scope.addFinalizer(scope, semaphore.release(1)) + ) + ), + connection + ) + ) + + return Object.assign( + Client.make({ + acquirer, + compiler, + transactionAcquirer, + spanAttributes: [ + ...(options.spanAttributes ? Object.entries(options.spanAttributes) : []), + [Otel.SEMATTRS_DB_SYSTEM, Otel.DBSYSTEMVALUES_SQLITE] + ] + }) as LibsqlClient, + { + [TypeId]: TypeId as TypeId, + config: options + } + ) + }) + +/** + * @category layers + * @since 1.0.0 + */ +export const layer = ( + config: Config.Config.Wrap +): Layer.Layer => + Layer.scopedContext( + Config.unwrap(config).pipe( + Effect.flatMap(make), + Effect.map((client) => + Context.make(LibsqlClient, client).pipe( + Context.add(Client.SqlClient, client) + ) + ) + ) + ) diff --git a/packages/sql-libsql/src/LibsqlMigrator.ts b/packages/sql-libsql/src/LibsqlMigrator.ts new file mode 100644 index 0000000000..596d564292 --- /dev/null +++ b/packages/sql-libsql/src/LibsqlMigrator.ts @@ -0,0 +1,38 @@ +/** + * @since 1.0.0 + */ +import * as Migrator from "@effect/sql/Migrator" +import type * as Client from "@effect/sql/SqlClient" +import type { SqlError } from "@effect/sql/SqlError" +import type * as Effect from "effect/Effect" +import * as Layer from "effect/Layer" + +/** + * @since 1.0.0 + */ +export * from "@effect/sql/Migrator" + +/** + * @since 1.0.0 + */ +export * from "@effect/sql/Migrator/FileSystem" + +/** + * @category constructor + * @since 1.0.0 + */ +export const run: ( + options: Migrator.MigratorOptions +) => Effect.Effect< + ReadonlyArray, + Migrator.MigrationError | SqlError, + Client.SqlClient | R2 +> = Migrator.make({}) + +/** + * @category constructor + * @since 1.0.0 + */ +export const layer = ( + options: Migrator.MigratorOptions +): Layer.Layer => Layer.effectDiscard(run(options)) diff --git a/packages/sql-libsql/src/index.ts b/packages/sql-libsql/src/index.ts new file mode 100644 index 0000000000..f7644f4437 --- /dev/null +++ b/packages/sql-libsql/src/index.ts @@ -0,0 +1,9 @@ +/** + * @since 1.0.0 + */ +export * as LibsqlClient from "./LibsqlClient.js" + +/** + * @since 1.0.0 + */ +export * as LibsqlMigrator from "./LibsqlMigrator.js" diff --git a/packages/sql-libsql/test/Client.test.ts b/packages/sql-libsql/test/Client.test.ts new file mode 100644 index 0000000000..89bbad1d44 --- /dev/null +++ b/packages/sql-libsql/test/Client.test.ts @@ -0,0 +1,90 @@ +import { FileSystem } from "@effect/platform" +import { NodeFileSystem } from "@effect/platform-node" +import { LibsqlClient } from "@effect/sql-libsql" +import { assert, describe, it } from "@effect/vitest" +import { Effect } from "effect" + +const makeClient = Effect.gen(function*() { + const fs = yield* FileSystem.FileSystem + const dir = yield* fs.makeTempDirectoryScoped() + return yield* LibsqlClient.make({ + url: "file:" + dir + "/test.db" + }) +}).pipe(Effect.provide(NodeFileSystem.layer)) + +describe("Client", () => { + it.scoped("should work", () => + Effect.gen(function*() { + const sql = yield* makeClient + let response + response = yield* sql`CREATE TABLE test (id INTEGER PRIMARY KEY, name TEXT)` + assert.deepStrictEqual(response, []) + response = yield* sql`INSERT INTO test (name) VALUES ('hello')` + assert.deepStrictEqual(response, []) + response = yield* sql`SELECT * FROM test` + assert.deepStrictEqual(response, [{ id: 1, name: "hello" }]) + response = yield* sql.withTransaction(sql`INSERT INTO test (name) VALUES ('world')`) + assert.deepStrictEqual(response, []) + response = yield* sql`SELECT * FROM test` + assert.deepStrictEqual(response, [ + { id: 1, name: "hello" }, + { id: 2, name: "world" } + ]) + assert.deepStrictEqual(yield* sql`select * from test`.values, [ + [1, "hello"], + [2, "world"] + ]) + })) + + it.scoped("should work with raw", () => + Effect.gen(function*() { + const sql = yield* makeClient + let response: any + response = yield* sql`CREATE TABLE test (id INTEGER PRIMARY KEY, name TEXT)`.raw + assert.deepStrictEqual(response.toJSON(), { + columnTypes: [], + columns: [], + lastInsertRowid: "0", + rows: [], + rowsAffected: 0 + }) + response = yield* sql`INSERT INTO test (name) VALUES ('hello')`.raw + assert.deepStrictEqual(response.toJSON(), { + columnTypes: [], + columns: [], + lastInsertRowid: "1", + rows: [], + rowsAffected: 1 + }) + response = yield* sql`SELECT * FROM test`.raw + assert.deepStrictEqual(response.toJSON(), { + columnTypes: ["INTEGER", "TEXT"], + columns: ["id", "name"], + lastInsertRowid: null, + rows: [[1, "hello"]], + rowsAffected: 0 + }) + })) + + it.scoped("withTransaction", () => + Effect.gen(function*() { + const sql = yield* makeClient + yield* sql`CREATE TABLE test (id INTEGER PRIMARY KEY, name TEXT)` + yield* sql.withTransaction(sql`INSERT INTO test (name) VALUES ('hello')`) + const rows = yield* sql`SELECT * FROM test` + assert.deepStrictEqual(rows, [{ id: 1, name: "hello" }]) + })) + + it.scoped("withTransaction rollback", () => + Effect.gen(function*() { + const sql = yield* makeClient + yield* sql`CREATE TABLE test (id INTEGER PRIMARY KEY, name TEXT)` + yield* sql`INSERT INTO test (name) VALUES ('hello')`.pipe( + Effect.andThen(Effect.fail("boom")), + sql.withTransaction, + Effect.ignore + ) + const rows = yield* sql`SELECT * FROM test` + assert.deepStrictEqual(rows, []) + })) +}) diff --git a/packages/sql-libsql/test/Resolver.test.ts b/packages/sql-libsql/test/Resolver.test.ts new file mode 100644 index 0000000000..d010433f46 --- /dev/null +++ b/packages/sql-libsql/test/Resolver.test.ts @@ -0,0 +1,180 @@ +import { FileSystem } from "@effect/platform" +import { NodeFileSystem } from "@effect/platform-node" +import * as Schema from "@effect/schema/Schema" +import { SqlError, SqlResolver } from "@effect/sql" +import { LibsqlClient } from "@effect/sql-libsql" +import { assert, describe, it } from "@effect/vitest" +import { Array, Effect, Option } from "effect" + +const makeClient = Effect.gen(function*(_) { + const fs = yield* _(FileSystem.FileSystem) + const dir = yield* _(fs.makeTempDirectoryScoped()) + return yield* _(LibsqlClient.make({ + url: "file:" + dir + "/test.db" + })) +}).pipe(Effect.provide(NodeFileSystem.layer)) + +const seededClient = Effect.gen(function*(_) { + const sql = yield* _(makeClient) + yield* _(sql`CREATE TABLE test (id INTEGER PRIMARY KEY, name TEXT)`) + yield* _( + Effect.forEach(Array.range(1, 100), (id) => sql`INSERT INTO test ${sql.insert({ id, name: `name${id}` })}`) + ) + return sql +}) + +describe("Resolver", () => { + describe("ordered", () => { + it.scoped("insert", () => + Effect.gen(function*(_) { + const batches: Array> = [] + const sql = yield* _(seededClient) + const Insert = yield* _(SqlResolver.ordered("Insert", { + Request: Schema.String, + Result: Schema.Struct({ id: Schema.Number, name: Schema.String }), + execute: (names) => { + batches.push(names) + return sql`INSERT INTO test ${sql.insert(names.map((name) => ({ name })))} RETURNING *` + } + })) + assert.deepStrictEqual( + yield* _(Effect.all({ + one: Insert.execute("one"), + two: Insert.execute("two") + }, { batching: true })), + { + one: { id: 101, name: "one" }, + two: { id: 102, name: "two" } + } + ) + assert.deepStrictEqual(batches, [["one", "two"]]) + })) + + it.scoped("result length mismatch", () => + Effect.gen(function*(_) { + const batches: Array> = [] + const sql = yield* _(seededClient) + const Select = yield* _(SqlResolver.ordered("Select", { + Request: Schema.Number, + Result: Schema.Struct({ id: Schema.Number, name: Schema.String }), + execute: (ids) => { + batches.push(ids) + return sql`SELECT * FROM test WHERE id IN ${sql.in(ids)}` + } + })) + const error = yield* _( + Effect.all([ + Select.execute(1), + Select.execute(2), + Select.execute(3), + Select.execute(101) + ], { batching: true }), + Effect.flip + ) + assert(error instanceof SqlError.ResultLengthMismatch) + assert.strictEqual(error.actual, 3) + assert.strictEqual(error.expected, 4) + assert.deepStrictEqual(batches, [[1, 2, 3, 101]]) + })) + }) + + describe("grouped", () => { + it.scoped("find by name", () => + Effect.gen(function*(_) { + const sql = yield* _(seededClient) + const FindByName = yield* _(SqlResolver.grouped("FindByName", { + Request: Schema.String, + RequestGroupKey: (name) => name, + Result: Schema.Struct({ id: Schema.Number, name: Schema.String }), + ResultGroupKey: (result) => result.name, + execute: (names) => sql`SELECT * FROM test WHERE name IN ${sql.in(names)}` + })) + yield* _(sql`INSERT INTO test ${sql.insert({ name: "name1" })}`) + assert.deepStrictEqual( + yield* _(Effect.all({ + one: FindByName.execute("name1"), + two: FindByName.execute("name2"), + three: FindByName.execute("name0") + }, { batching: true })), + { + one: [{ id: 1, name: "name1" }, { id: 101, name: "name1" }], + two: [{ id: 2, name: "name2" }], + three: [] + } + ) + })) + + it.scoped("using raw rows", () => + Effect.gen(function*(_) { + const sql = yield* _(seededClient) + const FindByName = yield* _(SqlResolver.grouped("FindByName", { + Request: Schema.String, + RequestGroupKey: (name) => name, + Result: Schema.Struct({ id: Schema.Number, name: Schema.String }), + ResultGroupKey: (_, result: any) => result.name, + execute: (names) => sql`SELECT * FROM test WHERE name IN ${sql.in(names)}` + })) + yield* _(sql`INSERT INTO test ${sql.insert({ name: "name1" })}`) + assert.deepStrictEqual( + yield* _(Effect.all({ + one: FindByName.execute("name1"), + two: FindByName.execute("name2"), + three: FindByName.execute("name0") + }, { batching: true })), + { + one: [{ id: 1, name: "name1" }, { id: 101, name: "name1" }], + two: [{ id: 2, name: "name2" }], + three: [] + } + ) + })) + }) + + describe("findById", () => { + it.scoped("find by id", () => + Effect.gen(function*(_) { + const sql = yield* _(seededClient) + const FindById = yield* _(SqlResolver.findById("FindById", { + Id: Schema.Number, + Result: Schema.Struct({ id: Schema.Number, name: Schema.String }), + ResultId: (result) => result.id, + execute: (ids) => sql`SELECT * FROM test WHERE id IN ${sql.in(ids)}` + })) + assert.deepStrictEqual( + yield* _(Effect.all({ + one: FindById.execute(1), + two: FindById.execute(2), + three: FindById.execute(101) + }, { batching: true })), + { + one: Option.some({ id: 1, name: "name1" }), + two: Option.some({ id: 2, name: "name2" }), + three: Option.none() + } + ) + })) + + it.scoped("using raw rows", () => + Effect.gen(function*(_) { + const sql = yield* _(seededClient) + const FindById = yield* _(SqlResolver.findById("FindById", { + Id: Schema.Number, + Result: Schema.Struct({ id: Schema.Number, name: Schema.String }), + ResultId: (_, result: any) => result.id, + execute: (ids) => sql`SELECT * FROM test WHERE id IN ${sql.in(ids)}` + })) + assert.deepStrictEqual( + yield* _(Effect.all({ + one: FindById.execute(1), + two: FindById.execute(2), + three: FindById.execute(101) + }, { batching: true })), + { + one: Option.some({ id: 1, name: "name1" }), + two: Option.some({ id: 2, name: "name2" }), + three: Option.none() + } + ) + })) + }) +}) diff --git a/packages/sql-libsql/tsconfig.build.json b/packages/sql-libsql/tsconfig.build.json new file mode 100644 index 0000000000..8a5c6b4d6e --- /dev/null +++ b/packages/sql-libsql/tsconfig.build.json @@ -0,0 +1,13 @@ +{ + "extends": "./tsconfig.src.json", + "references": [ + { "path": "../effect/tsconfig.build.json" }, + { "path": "../sql/tsconfig.build.json" } + ], + "compilerOptions": { + "tsBuildInfoFile": ".tsbuildinfo/build.tsbuildinfo", + "outDir": "build/esm", + "declarationDir": "build/dts", + "stripInternal": true + } +} diff --git a/packages/sql-libsql/tsconfig.examples.json b/packages/sql-libsql/tsconfig.examples.json new file mode 100644 index 0000000000..119ff192eb --- /dev/null +++ b/packages/sql-libsql/tsconfig.examples.json @@ -0,0 +1,15 @@ +{ + "extends": "../../tsconfig.base.json", + "include": ["examples"], + "references": [ + { "path": "tsconfig.src.json" }, + { "path": "../effect" }, + { "path": "../experimental" }, + { "path": "../sql" } + ], + "compilerOptions": { + "tsBuildInfoFile": ".tsbuildinfo/examples.tsbuildinfo", + "rootDir": "examples", + "noEmit": true + } +} diff --git a/packages/sql-libsql/tsconfig.json b/packages/sql-libsql/tsconfig.json new file mode 100644 index 0000000000..3edbf6b8a5 --- /dev/null +++ b/packages/sql-libsql/tsconfig.json @@ -0,0 +1,9 @@ +{ + "extends": "../../tsconfig.base.json", + "include": [], + "references": [ + { "path": "tsconfig.src.json" }, + { "path": "tsconfig.test.json" }, + { "path": "tsconfig.examples.json" } + ] +} diff --git a/packages/sql-libsql/tsconfig.src.json b/packages/sql-libsql/tsconfig.src.json new file mode 100644 index 0000000000..424a843861 --- /dev/null +++ b/packages/sql-libsql/tsconfig.src.json @@ -0,0 +1,10 @@ +{ + "extends": "../../tsconfig.base.json", + "include": ["src"], + "references": [{ "path": "../effect" }, { "path": "../sql" }], + "compilerOptions": { + "tsBuildInfoFile": ".tsbuildinfo/src.tsbuildinfo", + "rootDir": "src", + "outDir": "build/src" + } +} diff --git a/packages/sql-libsql/tsconfig.test.json b/packages/sql-libsql/tsconfig.test.json new file mode 100644 index 0000000000..70103fe42a --- /dev/null +++ b/packages/sql-libsql/tsconfig.test.json @@ -0,0 +1,16 @@ +{ + "extends": "../../tsconfig.base.json", + "include": ["test"], + "references": [ + { "path": "tsconfig.src.json" }, + { "path": "../effect" }, + { "path": "../platform-node" }, + { "path": "../sql" }, + { "path": "../vitest" } + ], + "compilerOptions": { + "tsBuildInfoFile": ".tsbuildinfo/test.tsbuildinfo", + "rootDir": "test", + "noEmit": true + } +} diff --git a/packages/sql-libsql/vitest.config.ts b/packages/sql-libsql/vitest.config.ts new file mode 100644 index 0000000000..0411095f25 --- /dev/null +++ b/packages/sql-libsql/vitest.config.ts @@ -0,0 +1,6 @@ +import { mergeConfig, type UserConfigExport } from "vitest/config" +import shared from "../../vitest.shared.js" + +const config: UserConfigExport = {} + +export default mergeConfig(shared, config) diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index f380e34305..8f12c73dfe 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -636,7 +636,7 @@ importers: version: 10.11.0 drizzle-orm: specifier: ^0.31.0 - version: 0.31.4(@cloudflare/workers-types@4.20240903.0)(@op-engineering/op-sqlite@7.1.0(react-native@0.75.2(@babel/core@7.25.2)(@babel/preset-env@7.25.4(@babel/core@7.25.2))(react@18.3.1)(typescript@5.6.2))(react@18.3.1))(@opentelemetry/api@1.9.0)(@types/better-sqlite3@7.6.11)(better-sqlite3@11.2.1)(bun-types@1.1.22)(kysely@0.27.4)(mysql2@3.11.0)(postgres@3.4.4)(react@18.3.1) + version: 0.31.4(@cloudflare/workers-types@4.20240903.0)(@libsql/client@0.12.0)(@op-engineering/op-sqlite@7.1.0(react-native@0.75.2(@babel/core@7.25.2)(@babel/preset-env@7.25.4(@babel/core@7.25.2))(react@18.3.1)(typescript@5.6.2))(react@18.3.1))(@opentelemetry/api@1.9.0)(@types/better-sqlite3@7.6.11)(better-sqlite3@11.2.1)(bun-types@1.1.22)(kysely@0.27.4)(mysql2@3.11.0)(postgres@3.4.4)(react@18.3.1) effect: specifier: workspace:^ version: link:../effect/dist @@ -674,6 +674,26 @@ importers: version: 0.27.4 publishDirectory: dist + packages/sql-libsql: + dependencies: + '@libsql/client': + specifier: ^0.12.0 + version: 0.12.0 + '@opentelemetry/semantic-conventions': + specifier: ^1.25.1 + version: 1.25.1 + devDependencies: + '@effect/platform': + specifier: workspace:^ + version: link:../platform/dist + '@effect/sql': + specifier: workspace:^ + version: link:../sql/dist + effect: + specifier: workspace:^ + version: link:../effect/dist + publishDirectory: dist + packages/sql-mssql: dependencies: '@opentelemetry/semantic-conventions': @@ -2296,6 +2316,57 @@ packages: '@js-joda/core@5.6.3': resolution: {integrity: sha512-T1rRxzdqkEXcou0ZprN1q9yDRlvzCPLqmlNt5IIsGBzoEVgLCCYrKEwc84+TvsXuAc95VAZwtWD2zVsKPY4bcA==} + '@libsql/client@0.12.0': + resolution: {integrity: sha512-Jt9ijfzlmswZzxRRksEv8Igbw7ER9IX/RSrwzEIRyzwwQLcpeZGGrnDQP9S7UPCJ90uFDiaICFiyhvwO+60DmA==} + + '@libsql/core@0.12.0': + resolution: {integrity: sha512-PZJF4qvPbDWZfXk0Tr+O5xaMhFoetA1gIVPgYLH6Bc6gAeyYxhGw268p+95SkADZDjB5CYPcVLvfQEjSVeR3Zw==} + + '@libsql/darwin-arm64@0.4.5': + resolution: {integrity: sha512-xLdnn0NrgSk6OMi716FFs/27Hs33jtSd2fkKi/72Ey/qBtPWcB1BMurDQekzi0yAcfQTjGqIz7tpOibyjiEPyQ==} + cpu: [arm64] + os: [darwin] + + '@libsql/darwin-x64@0.4.5': + resolution: {integrity: sha512-rZsEWj0H7oCqd5Y2pe0RzKmuQXC2OB1RbnFy4CvjeAjT6MP6mFp+Vx9mTCAUuJMhuoSVMsFPUJRpAQznl9E3Tg==} + cpu: [x64] + os: [darwin] + + '@libsql/hrana-client@0.7.0': + resolution: {integrity: sha512-OF8fFQSkbL7vJY9rfuegK1R7sPgQ6kFMkDamiEccNUvieQ+3urzfDFI616oPl8V7T9zRmnTkSjMOImYCAVRVuw==} + + '@libsql/isomorphic-fetch@0.3.1': + resolution: {integrity: sha512-6kK3SUK5Uu56zPq/Las620n5aS9xJq+jMBcNSOmjhNf/MUvdyji4vrMTqD7ptY7/4/CAVEAYDeotUz60LNQHtw==} + engines: {node: '>=18.0.0'} + + '@libsql/isomorphic-ws@0.1.5': + resolution: {integrity: sha512-DtLWIH29onUYR00i0GlQ3UdcTRC6EP4u9w/h9LxpUZJWRMARk6dQwZ6Jkd+QdwVpuAOrdxt18v0K2uIYR3fwFg==} + + '@libsql/linux-arm64-gnu@0.4.5': + resolution: {integrity: sha512-VR09iu6KWGJ6fauCn59u/jJ9OA+/A2yQ0dr2HDN2zkRueLC6D2oGYt4gPfLZPFKf+WJpVMtIhNfd+Ru9MMaFkA==} + cpu: [arm64] + os: [linux] + + '@libsql/linux-arm64-musl@0.4.5': + resolution: {integrity: sha512-74hvD5ej4rBshhxFGNYU16a3m8B/NjIPvhlZ/flG1Oeydfo6AuUXSSNFi+H5+zi9/uWuzyz5TLVeQcraoUV10A==} + cpu: [arm64] + os: [linux] + + '@libsql/linux-x64-gnu@0.4.5': + resolution: {integrity: sha512-gb5WObGO3+rbuG8h9font1N02iF+zgYAgY0wNa8BNiZ5A9UolZKFxiqGFS7eHaAYfemHJKKTT+aAt3X2p5TibA==} + cpu: [x64] + os: [linux] + + '@libsql/linux-x64-musl@0.4.5': + resolution: {integrity: sha512-JfyE6OVC5X4Nr4cFF77VhB1o+hBRxAqYT9YdeqnWdAQSYc/ASi5HnRALLAQEsGacFPZZ32pixfraQmPE3iJFfw==} + cpu: [x64] + os: [linux] + + '@libsql/win32-x64-msvc@0.4.5': + resolution: {integrity: sha512-57GGurNJhOhq3XIopLdGnCoQ4kQAcmbmzzFoC4tpvDE/KSbwZ/13zqJWhQA41nMGk/PKM1XKfKmbIybKx1+eqA==} + cpu: [x64] + os: [win32] + '@lmdb/lmdb-darwin-arm64@3.0.13': resolution: {integrity: sha512-uiKPB0Fv6WEEOZjruu9a6wnW/8jrjzlZbxXscMB8kuCJ1k6kHpcBnuvaAWcqhbI7rqX5GKziwWEdD+wi2gNLfA==} cpu: [arm64] @@ -2366,6 +2437,9 @@ packages: resolution: {integrity: sha512-3rDakgJZ77+RiQUuSK69t1F0m8BQKA8Vh5DCS5V0DWvNY67zob2JhhQrhCO0AKLGINTRSFd1tBaHcJTkhefoSw==} engines: {node: '>=18'} + '@neon-rs/load@0.0.4': + resolution: {integrity: sha512-kTPhdZyTQxB+2wpiRcFWrDcejc4JI6tkPuS7UZCG4l6Zvc5kU/gGQ/ozvHTh1XR5tS+UlfAfGuPajjzQjCiHCw==} + '@nicolo-ribaudo/chokidar-2@2.1.8-no-fsevents.3': resolution: {integrity: sha512-s88O1aVtXftvp5bCPB7WnmXc5IwOZZ7YPuwNPt+GtOOXpPvad1LfbmjYv+qII7zP6RU2QGnqve27dnLycEnyEQ==} @@ -3659,6 +3733,10 @@ packages: data-uri-to-buffer@2.0.2: resolution: {integrity: sha512-ND9qDTLc6diwj+Xe5cdAgVTbLVdXbtxTJRXRhli8Mowuaan+0EJOtdqJ0QCHNSSPyoXGx9HX2/VMnKeC34AChA==} + data-uri-to-buffer@4.0.1: + resolution: {integrity: sha512-0R9ikRb668HB7QDxT1vkpuUBtqc53YyAwMwGeUFKRojY/NWKvdZ+9UYtRfGmhqNbRkTSVpMbmyhXipFFv2cb/A==} + engines: {node: '>= 12'} + data-view-buffer@1.0.1: resolution: {integrity: sha512-0lht7OugA5x3iJLOWFhWK/5ehONdprk0ISXqVFn/NFrDu+cuc8iADFrGQz5BnRK7LLU3JmkbXSxaqX+/mXYtUA==} engines: {node: '>= 0.4'} @@ -3799,6 +3877,10 @@ packages: engines: {node: '>=0.10'} hasBin: true + detect-libc@2.0.2: + resolution: {integrity: sha512-UX6sGumvvqSaXgdKGUsgZWqcUyIXZ/vZTrlRT/iobiKhGL0zL4d3osHj3uqllWJK+i+sixDS/3COVEOFbupFyw==} + engines: {node: '>=8'} + detect-libc@2.0.3: resolution: {integrity: sha512-bwy0MGW55bG41VqxxypOsdSdGqLwXPI/focwgTYCFMbdUiBAxLg9CFzG08sz2aqzknwiX7Hkl0bQENjg8iLByw==} engines: {node: '>=8'} @@ -4295,6 +4377,10 @@ packages: fb-watchman@2.0.2: resolution: {integrity: sha512-p5161BqbuCaSnB8jIbzQHOlpgsPmK5rJVDfDKO91Axs5NC1uu3HRQm6wt9cd9/+GtQQIO53JdGXXoyDpTAsgYA==} + fetch-blob@3.2.0: + resolution: {integrity: sha512-7yAQpD2UMJzLi1Dqv7qFYnPbaPx7ZfFK6PiIxQ4PfkGPyNyl2Ugx+a/umUonmKqjhM4DnfbMvdX6otXq83soQQ==} + engines: {node: ^12.20 || >= 14.13} + file-entry-cache@8.0.0: resolution: {integrity: sha512-XXTUwCvisa5oacNGRP9SfNtYBNAMi+RPwBFmblZEF7N7swHYQS6/Zfk7SRwx4D5j3CH211YNRco1DEMNVfZCnQ==} engines: {node: '>=16.0.0'} @@ -4370,6 +4456,10 @@ packages: resolution: {integrity: sha512-PXUUyLqrR2XCWICfv6ukppP96sdFwWbNEnfEMt7jNsISjMsvaLNinAHNDYyvkyU+SZG2BTSbT5NjG+vZslfGTA==} engines: {node: '>=14'} + formdata-polyfill@4.0.10: + resolution: {integrity: sha512-buewHzMvYL29jdeQTVILecSaZKnt/RJWjoZCF5OW60Z67/GmSLBkOFM7qh1PI3zFNtJbaZL5eQu1vLfazOwj4g==} + engines: {node: '>=12.20.0'} + fp-ts@2.16.8: resolution: {integrity: sha512-nmDtNqmMZkOxu0M5hkrS9YA15/KPkYkILb6Axg9XBAoUoYEtzg+LFmVWqZrl9FNttsW0qIUpx9RCA9INbv+Bxw==} @@ -4963,6 +5053,9 @@ packages: joi@17.13.3: resolution: {integrity: sha512-otDA4ldcIx+ZXsKHWmp0YizCweVRZG96J10b0FevjfuncLO1oX59THoAmHkNubYJ+9gWsYsp5k8v4ib6oDv1fA==} + js-base64@3.7.7: + resolution: {integrity: sha512-7rCnleh0z2CkXhH67J8K1Ytz0b2Y+yxTPL+/KOJoa20hfnVQ/3/T6W/KflYI4bRHRagNeXeU2bkNGI3v1oS/lw==} + js-md4@0.3.2: resolution: {integrity: sha512-/GDnfQYsltsjRswQhN9fhv3EMw2sCpUdrdxyWDOUK7eyD++r3gRhzgiQgc/x4MAv2i1iuQ4lxO5mvqM3vj4bwA==} @@ -5095,6 +5188,10 @@ packages: resolution: {integrity: sha512-+bT2uH4E5LGE7h/n3evcS/sQlJXCpIp6ym8OWJ5eV6+67Dsql/LaaT7qJBAt2rzfoa/5QBGBhxDix1dMt2kQKQ==} engines: {node: '>= 0.8.0'} + libsql@0.4.5: + resolution: {integrity: sha512-sorTJV6PNt94Wap27Sai5gtVLIea4Otb2LUiAUyr3p6BPOScGMKGt5F1b5X/XgkNtcsDKeX5qfeBDj+PdShclQ==} + os: [darwin, linux, win32] + lighthouse-logger@1.4.2: resolution: {integrity: sha512-gPWxznF6TKmUHrOQjlVo2UbaL2EJ71mb2CCeRs/2qBpi4L/g4LUVc9+3lKQ6DTUZwJswfM7ainGrLO1+fOqa2g==} @@ -5558,6 +5655,10 @@ packages: resolution: {integrity: sha512-tmPX422rYgofd4epzrNoOXiE8XFZYOcCq1vD7MAXCDO+O+zndlA2ztdKKMa+EeuBG5tHETpr4ml4RGgpqDCCAg==} engines: {node: '>= 0.10.5'} + node-domexception@1.0.0: + resolution: {integrity: sha512-/jKZoMpw0F8GRwl4/eLROPA3cfcXtLApP0QzLmUT/HuPCZWyB7IY9ZrMeKw2O/nFIqPQB3PVM9aYm0F312AXDQ==} + engines: {node: '>=10.5.0'} + node-fetch@2.7.0: resolution: {integrity: sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A==} engines: {node: 4.x || >=6.0.0} @@ -5567,6 +5668,10 @@ packages: encoding: optional: true + node-fetch@3.3.2: + resolution: {integrity: sha512-dRB78srN/l6gqWulah9SrxeYnxeddIG30+GOqK/9OlLVyLg3HPnr6SqOWTWOXKRwC2eGYCkZ59NNuSgvSrpgOA==} + engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} + node-forge@1.3.1: resolution: {integrity: sha512-dPEtOeMvF9VMcYV/1Wb8CPoVAXtp6MKMlcbAt4ddqmGqUJ6fQZFXkNZNkNlfevtNkGtaSoXf/vNNNSvgrdXwtA==} engines: {node: '>= 6.13.0'} @@ -5921,6 +6026,9 @@ packages: resolution: {integrity: sha512-cdGef/drWFoydD1JsMzuFf8100nZl+GT+yacc2bEced5f9Rjk4z+WtFUTBu9PhOi9j/jfmBPu0mMEY4wIdAF8A==} engines: {node: '>= 0.6.0'} + promise-limit@2.7.0: + resolution: {integrity: sha512-7nJ6v5lnJsXwGprnGXga4wx6d1POjvi5Qmf1ivTRxTjH4Z/9Czja/UCMLVmB9N93GeWOU93XaFaEt6jbuoagNw==} + promise@8.3.0: resolution: {integrity: sha512-rZPNPKTOYVNEEKFaq1HqTgOwZD+4/YHS5ukLzQCypkj+OkYx7iv0mA91lJlpPPZ8vMau3IIGj5Qlwrx+8iiSmg==} @@ -6909,6 +7017,10 @@ packages: weak-lru-cache@1.2.2: resolution: {integrity: sha512-DEAoo25RfSYMuTGc9vPJzZcZullwIqRDSI9LOy+fkCJPi6hykCnfKaXTuPBDuXAUcqHXyOgFtHNp/kB2FjYHbw==} + web-streams-polyfill@3.3.3: + resolution: {integrity: sha512-d2JWLCivmZYTSIoge9MsgFCZrt571BikcWGYkjC1khllbTeDlGqZ2D8vD8E/lJa8WGWbb7Plm8/XJYV7IJHZZw==} + engines: {node: '>= 8'} + webidl-conversions@3.0.1: resolution: {integrity: sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==} @@ -8860,6 +8972,62 @@ snapshots: '@js-joda/core@5.6.3': {} + '@libsql/client@0.12.0': + dependencies: + '@libsql/core': 0.12.0 + '@libsql/hrana-client': 0.7.0 + js-base64: 3.7.7 + libsql: 0.4.5 + promise-limit: 2.7.0 + transitivePeerDependencies: + - bufferutil + - utf-8-validate + + '@libsql/core@0.12.0': + dependencies: + js-base64: 3.7.7 + + '@libsql/darwin-arm64@0.4.5': + optional: true + + '@libsql/darwin-x64@0.4.5': + optional: true + + '@libsql/hrana-client@0.7.0': + dependencies: + '@libsql/isomorphic-fetch': 0.3.1 + '@libsql/isomorphic-ws': 0.1.5 + js-base64: 3.7.7 + node-fetch: 3.3.2 + transitivePeerDependencies: + - bufferutil + - utf-8-validate + + '@libsql/isomorphic-fetch@0.3.1': {} + + '@libsql/isomorphic-ws@0.1.5': + dependencies: + '@types/ws': 8.5.12 + ws: 8.18.0 + transitivePeerDependencies: + - bufferutil + - utf-8-validate + + '@libsql/linux-arm64-gnu@0.4.5': + optional: true + + '@libsql/linux-arm64-musl@0.4.5': + optional: true + + '@libsql/linux-x64-gnu@0.4.5': + optional: true + + '@libsql/linux-x64-musl@0.4.5': + optional: true + + '@libsql/win32-x64-msvc@0.4.5': + optional: true + '@lmdb/lmdb-darwin-arm64@3.0.13': optional: true @@ -8921,6 +9089,8 @@ snapshots: outvariant: 1.4.3 strict-event-emitter: 0.5.1 + '@neon-rs/load@0.0.4': {} + '@nicolo-ribaudo/chokidar-2@2.1.8-no-fsevents.3': optional: true @@ -10525,6 +10695,8 @@ snapshots: data-uri-to-buffer@2.0.2: {} + data-uri-to-buffer@4.0.1: {} + data-view-buffer@1.0.1: dependencies: call-bind: 1.0.7 @@ -10624,6 +10796,8 @@ snapshots: detect-libc@1.0.3: {} + detect-libc@2.0.2: {} + detect-libc@2.0.3: {} detective-amd@5.0.2: @@ -10712,9 +10886,10 @@ snapshots: dotenv@8.6.0: {} - drizzle-orm@0.31.4(@cloudflare/workers-types@4.20240903.0)(@op-engineering/op-sqlite@7.1.0(react-native@0.75.2(@babel/core@7.25.2)(@babel/preset-env@7.25.4(@babel/core@7.25.2))(react@18.3.1)(typescript@5.6.2))(react@18.3.1))(@opentelemetry/api@1.9.0)(@types/better-sqlite3@7.6.11)(better-sqlite3@11.2.1)(bun-types@1.1.22)(kysely@0.27.4)(mysql2@3.11.0)(postgres@3.4.4)(react@18.3.1): + drizzle-orm@0.31.4(@cloudflare/workers-types@4.20240903.0)(@libsql/client@0.12.0)(@op-engineering/op-sqlite@7.1.0(react-native@0.75.2(@babel/core@7.25.2)(@babel/preset-env@7.25.4(@babel/core@7.25.2))(react@18.3.1)(typescript@5.6.2))(react@18.3.1))(@opentelemetry/api@1.9.0)(@types/better-sqlite3@7.6.11)(better-sqlite3@11.2.1)(bun-types@1.1.22)(kysely@0.27.4)(mysql2@3.11.0)(postgres@3.4.4)(react@18.3.1): optionalDependencies: '@cloudflare/workers-types': 4.20240903.0 + '@libsql/client': 0.12.0 '@op-engineering/op-sqlite': 7.1.0(react-native@0.75.2(@babel/core@7.25.2)(@babel/preset-env@7.25.4(@babel/core@7.25.2))(react@18.3.1)(typescript@5.6.2))(react@18.3.1) '@opentelemetry/api': 1.9.0 '@types/better-sqlite3': 7.6.11 @@ -11208,6 +11383,11 @@ snapshots: dependencies: bser: 2.1.1 + fetch-blob@3.2.0: + dependencies: + node-domexception: 1.0.0 + web-streams-polyfill: 3.3.3 + file-entry-cache@8.0.0: dependencies: flat-cache: 4.0.1 @@ -11304,6 +11484,10 @@ snapshots: cross-spawn: 7.0.3 signal-exit: 4.1.0 + formdata-polyfill@4.0.10: + dependencies: + fetch-blob: 3.2.0 + fp-ts@2.16.8: {} fresh@0.5.2: {} @@ -11911,6 +12095,8 @@ snapshots: '@sideway/formula': 3.0.1 '@sideway/pinpoint': 2.0.0 + js-base64@3.7.7: {} + js-md4@0.3.2: {} js-tokens@4.0.0: {} @@ -12077,6 +12263,19 @@ snapshots: prelude-ls: 1.2.1 type-check: 0.4.0 + libsql@0.4.5: + dependencies: + '@neon-rs/load': 0.0.4 + detect-libc: 2.0.2 + optionalDependencies: + '@libsql/darwin-arm64': 0.4.5 + '@libsql/darwin-x64': 0.4.5 + '@libsql/linux-arm64-gnu': 0.4.5 + '@libsql/linux-arm64-musl': 0.4.5 + '@libsql/linux-x64-gnu': 0.4.5 + '@libsql/linux-x64-musl': 0.4.5 + '@libsql/win32-x64-msvc': 0.4.5 + lighthouse-logger@1.4.2: dependencies: debug: 2.6.9 @@ -12672,10 +12871,18 @@ snapshots: dependencies: minimatch: 3.1.2 + node-domexception@1.0.0: {} + node-fetch@2.7.0: dependencies: whatwg-url: 5.0.0 + node-fetch@3.3.2: + dependencies: + data-uri-to-buffer: 4.0.1 + fetch-blob: 3.2.0 + formdata-polyfill: 4.0.10 + node-forge@1.3.1: {} node-gyp-build-optional-packages@5.2.2: @@ -13035,6 +13242,8 @@ snapshots: process@0.11.10: {} + promise-limit@2.7.0: {} + promise@8.3.0: dependencies: asap: 2.0.6 @@ -14189,6 +14398,8 @@ snapshots: weak-lru-cache@1.2.2: {} + web-streams-polyfill@3.3.3: {} + webidl-conversions@3.0.1: {} webidl-conversions@7.0.0: {} diff --git a/tsconfig.base.json b/tsconfig.base.json index cd6b3a6af4..fe004b5dd2 100644 --- a/tsconfig.base.json +++ b/tsconfig.base.json @@ -115,6 +115,9 @@ "@effect/sql-kysely": ["./packages/sql-kysely/src/index.js"], "@effect/sql-kysely/*": ["./packages/sql-kysely/src/*.js"], "@effect/sql-kysely/test/*": ["./packages/sql-kysely/test/*.js"], + "@effect/sql-libsql": ["./packages/sql-libsql/src/index.js"], + "@effect/sql-libsql/*": ["./packages/sql-libsql/src/*.js"], + "@effect/sql-libsql/test/*": ["./packages/sql-libsql/test/*.js"], "@effect/sql-mssql": ["./packages/sql-mssql/src/index.js"], "@effect/sql-mssql/*": ["./packages/sql-mssql/src/*.js"], "@effect/sql-mssql/test/*": ["./packages/sql-mssql/test/*.js"], diff --git a/tsconfig.build.json b/tsconfig.build.json index 1ee4e135fc..5f1ce54b69 100644 --- a/tsconfig.build.json +++ b/tsconfig.build.json @@ -24,6 +24,7 @@ { "path": "packages/sql-d1/tsconfig.build.json" }, { "path": "packages/sql-drizzle/tsconfig.build.json" }, { "path": "packages/sql-kysely/tsconfig.build.json" }, + { "path": "packages/sql-libsql/tsconfig.build.json" }, { "path": "packages/sql-mysql2/tsconfig.build.json" }, { "path": "packages/sql-mssql/tsconfig.build.json" }, { "path": "packages/sql-pg/tsconfig.build.json" }, diff --git a/tsconfig.json b/tsconfig.json index ffdca6c967..6f76cec1e4 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -25,6 +25,7 @@ { "path": "packages/sql-d1" }, { "path": "packages/sql-drizzle" }, { "path": "packages/sql-kysely" }, + { "path": "packages/sql-libsql" }, { "path": "packages/sql-mssql" }, { "path": "packages/sql-mysql2" }, { "path": "packages/sql-pg" }, diff --git a/vitest.shared.ts b/vitest.shared.ts index cbc7e7cc9b..7509530320 100644 --- a/vitest.shared.ts +++ b/vitest.shared.ts @@ -50,6 +50,7 @@ const config: UserConfig = { ...alias("sql-d1"), ...alias("sql-drizzle"), ...alias("sql-kysely"), + ...alias("sql-libsql"), ...alias("sql-mssql"), ...alias("sql-mysql2"), ...alias("sql-pg"),