New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@effect/sql-sqlite-bun

Package Overview
Dependencies
Maintainers
0
Versions
254
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@effect/sql-sqlite-bun - npm Package Compare versions

Comparing version

to
0.29.0

10

dist/cjs/SqliteClient.js

@@ -39,6 +39,6 @@ "use strict";

*/
const make = options => Effect.gen(function* (_) {
const make = options => Effect.gen(function* () {
const compiler = Statement.makeCompilerSqlite(options.transformQueryNames);
const transformRows = options.transformResultNames ? Statement.defaultTransforms(options.transformResultNames).array : undefined;
const makeConnection = Effect.gen(function* (_) {
const makeConnection = Effect.gen(function* () {
const db = new _bunSqlite.Database(options.filename, {

@@ -49,3 +49,3 @@ readonly: options.readonly,

});
yield* _(Effect.addFinalizer(() => Effect.sync(() => db.close())));
yield* Effect.addFinalizer(() => Effect.sync(() => db.close()));
if (options.disableWAL !== true) {

@@ -100,4 +100,4 @@ db.run("PRAGMA journal_mode = WAL;");

});
const semaphore = yield* _(Effect.makeSemaphore(1));
const connection = yield* _(makeConnection);
const semaphore = yield* Effect.makeSemaphore(1);
const connection = yield* makeConnection;
const acquirer = semaphore.withPermits(1)(Effect.succeed(connection));

@@ -104,0 +104,0 @@ 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));

@@ -27,2 +27,3 @@ "use strict";

var Effect = _interopRequireWildcard(require("effect/Effect"));
var _Function = require("effect/Function");
var Layer = _interopRequireWildcard(require("effect/Layer"));

@@ -62,5 +63,5 @@ var _SqliteClient = require("./SqliteClient.js");

dumpSchema(path, table) {
const dump = args => Effect.gen(function* (_) {
const dump = args => Effect.gen(function* () {
const sql = yield* _SqliteClient.SqliteClient;
const dump = yield* _(Command.make("sqlite3", sql.config.filename, ...args), Command.string);
const dump = yield* (0, _Function.pipe)(Command.make("sqlite3", sql.config.filename, ...args), Command.string);
return dump.replace(/^create table sqlite_sequence\(.*$/im, "").replace(/\n{2,}/gm, "\n\n").trim();

@@ -76,10 +77,10 @@ }).pipe(Effect.mapError(error => new Migrator.MigrationError({

}), ([schema, migrations]) => schema + "\n\n" + migrations);
const dumpFile = file => Effect.gen(function* (_) {
const fs = yield* _(_FileSystem.FileSystem);
const path = yield* _(_Path.Path);
const dump = yield* _(dumpAll);
yield* _(fs.makeDirectory(path.dirname(file), {
const dumpFile = file => Effect.gen(function* () {
const fs = yield* _FileSystem.FileSystem;
const path = yield* _Path.Path;
const dump = yield* dumpAll;
yield* fs.makeDirectory(path.dirname(file), {
recursive: true
}));
yield* _(fs.writeFileString(file, dump));
});
yield* fs.writeFileString(file, dump);
}).pipe(Effect.mapError(error => new Migrator.MigrationError({

@@ -86,0 +87,0 @@ reason: "failed",

@@ -30,6 +30,6 @@ /**

*/
export const make = options => Effect.gen(function* (_) {
export const make = options => Effect.gen(function* () {
const compiler = Statement.makeCompilerSqlite(options.transformQueryNames);
const transformRows = options.transformResultNames ? Statement.defaultTransforms(options.transformResultNames).array : undefined;
const makeConnection = Effect.gen(function* (_) {
const makeConnection = Effect.gen(function* () {
const db = new Database(options.filename, {

@@ -40,3 +40,3 @@ readonly: options.readonly,

});
yield* _(Effect.addFinalizer(() => Effect.sync(() => db.close())));
yield* Effect.addFinalizer(() => Effect.sync(() => db.close()));
if (options.disableWAL !== true) {

@@ -91,4 +91,4 @@ db.run("PRAGMA journal_mode = WAL;");

});
const semaphore = yield* _(Effect.makeSemaphore(1));
const connection = yield* _(makeConnection);
const semaphore = yield* Effect.makeSemaphore(1);
const connection = yield* makeConnection;
const acquirer = semaphore.withPermits(1)(Effect.succeed(connection));

@@ -95,0 +95,0 @@ 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));

@@ -9,2 +9,3 @@ /**

import * as Effect from "effect/Effect";
import { pipe } from "effect/Function";
import * as Layer from "effect/Layer";

@@ -26,5 +27,5 @@ import { SqliteClient } from "./SqliteClient.js";

dumpSchema(path, table) {
const dump = args => Effect.gen(function* (_) {
const dump = args => Effect.gen(function* () {
const sql = yield* SqliteClient;
const dump = yield* _(Command.make("sqlite3", sql.config.filename, ...args), Command.string);
const dump = yield* pipe(Command.make("sqlite3", sql.config.filename, ...args), Command.string);
return dump.replace(/^create table sqlite_sequence\(.*$/im, "").replace(/\n{2,}/gm, "\n\n").trim();

@@ -40,10 +41,10 @@ }).pipe(Effect.mapError(error => new Migrator.MigrationError({

}), ([schema, migrations]) => schema + "\n\n" + migrations);
const dumpFile = file => Effect.gen(function* (_) {
const fs = yield* _(FileSystem);
const path = yield* _(Path);
const dump = yield* _(dumpAll);
yield* _(fs.makeDirectory(path.dirname(file), {
const dumpFile = file => Effect.gen(function* () {
const fs = yield* FileSystem;
const path = yield* Path;
const dump = yield* dumpAll;
yield* fs.makeDirectory(path.dirname(file), {
recursive: true
}));
yield* _(fs.writeFileString(file, dump));
});
yield* fs.writeFileString(file, dump);
}).pipe(Effect.mapError(error => new Migrator.MigrationError({

@@ -50,0 +51,0 @@ reason: "failed",

{
"name": "@effect/sql-sqlite-bun",
"version": "0.28.0",
"version": "0.29.0",
"description": "A SQLite toolkit for Effect",

@@ -16,6 +16,6 @@ "license": "MIT",

"peerDependencies": {
"@effect/experimental": "^0.38.0",
"@effect/platform": "^0.74.0",
"@effect/sql": "^0.27.0",
"effect": "^3.12.5"
"@effect/experimental": "^0.39.0",
"effect": "^3.12.6",
"@effect/sql": "^0.28.0",
"@effect/platform": "^0.75.0"
},

@@ -22,0 +22,0 @@ "publishConfig": {

@@ -80,3 +80,3 @@ /**

): Effect.Effect<SqliteClient, never, Scope.Scope | Reactivity.Reactivity> =>
Effect.gen(function*(_) {
Effect.gen(function*() {
const compiler = Statement.makeCompilerSqlite(options.transformQueryNames)

@@ -89,3 +89,3 @@ const transformRows = options.transformResultNames ?

const makeConnection = Effect.gen(function*(_) {
const makeConnection = Effect.gen(function*() {
const db = new Database(options.filename, {

@@ -96,3 +96,3 @@ readonly: options.readonly,

} as any)
yield* _(Effect.addFinalizer(() => Effect.sync(() => db.close())))
yield* Effect.addFinalizer(() => Effect.sync(() => db.close()))

@@ -151,4 +151,4 @@ if (options.disableWAL !== true) {

const semaphore = yield* _(Effect.makeSemaphore(1))
const connection = yield* _(makeConnection)
const semaphore = yield* Effect.makeSemaphore(1)
const connection = yield* makeConnection

@@ -155,0 +155,0 @@ const acquirer = semaphore.withPermits(1)(Effect.succeed(connection))

@@ -12,2 +12,3 @@ /**

import * as Effect from "effect/Effect"
import { pipe } from "effect/Function"
import * as Layer from "effect/Layer"

@@ -39,5 +40,5 @@ import { SqliteClient } from "./SqliteClient.js"

const dump = (args: Array<string>) =>
Effect.gen(function*(_) {
Effect.gen(function*() {
const sql = yield* SqliteClient
const dump = yield* _(
const dump = yield* pipe(
Command.make("sqlite3", (sql as SqliteClient).config.filename, ...args),

@@ -67,8 +68,8 @@ Command.string

const dumpFile = (file: string) =>
Effect.gen(function*(_) {
const fs = yield* _(FileSystem)
const path = yield* _(Path)
const dump = yield* _(dumpAll)
yield* _(fs.makeDirectory(path.dirname(file), { recursive: true }))
yield* _(fs.writeFileString(file, dump))
Effect.gen(function*() {
const fs = yield* FileSystem
const path = yield* Path
const dump = yield* dumpAll
yield* fs.makeDirectory(path.dirname(file), { recursive: true })
yield* fs.writeFileString(file, dump)
}).pipe(

@@ -75,0 +76,0 @@ Effect.mapError((error) => new Migrator.MigrationError({ reason: "failed", message: error.message }))

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet