Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

kysely-ctl

Package Overview
Dependencies
Maintainers
0
Versions
29
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

kysely-ctl - npm Package Compare versions

Comparing version 0.8.10 to 0.8.11

165

dist/bin.js

@@ -22,3 +22,3 @@ #!/usr/bin/env node

import { showUsage as showUsage3 } from "citty";
import { LogLevels, consola as consola17 } from "consola";
import { LogLevels, consola as consola18 } from "consola";

@@ -297,3 +297,3 @@ // src/arguments/cwd.mts

// src/commands/migrate/down.mts
import { consola as consola6 } from "consola";
import { consola as consola7 } from "consola";

@@ -321,5 +321,19 @@ // src/arguments/migration-name.mts

// src/kysely/process-migration-result-set.mts
import { consola as consola5 } from "consola";
import { colorize } from "consola/utils";
// src/utils/error.mts
import { consola as consola4 } from "consola";
import { colorize } from "consola/utils";
import { process } from "std-env";
function handleAggregateError(error) {
if (error instanceof AggregateError) {
for (const subError of error.errors) {
consola4.error(subError);
}
}
}
function exitWithError(error) {
process.exit?.(1);
throw error;
}

@@ -334,24 +348,19 @@ // src/kysely/get-migrations.mts

async function processMigrationResultSet(resultSet, direction, migrator) {
consola4.debug(resultSet);
consola5.debug(resultSet);
let { error, results } = resultSet;
if (error) {
const failedMigration = results?.find((result) => result.status === "Error");
consola4.fail(
consola5.fail(
`Migration failed with \`${error}\`${failedMigration ? ` @ "${failedMigration.migrationName}"` : ""}`
);
if (error instanceof AggregateError) {
for (const subError of error.errors) {
consola4.error(subError);
}
}
process.exit?.(1);
throw error;
handleAggregateError(error);
exitWithError(error);
}
if (!results?.length) {
return consola4.info(
return consola5.info(
`Migration skipped: no ${direction === "up" ? "new" : "completed"} migrations found`
);
}
consola4.success("Migration complete");
consola4.info(
consola5.success("Migration complete");
consola5.info(
`${direction === "up" ? "Ran" : "Undone"} ${results.length} migration${results.length > 1 ? "s" : ""}:`

@@ -375,6 +384,6 @@ );

for (const migration of untouchedMigrationsBefore) {
consola4.log(`[\u2713] ${migration.name}`);
consola5.log(`[\u2713] ${migration.name}`);
}
for (const result of results) {
consola4.log(
consola5.log(
`[${colorize("green", result.direction === "Up" ? "\u2713" : "\u237B")}] ${result.migrationName}`

@@ -384,3 +393,3 @@ );

for (const migration of untouchedMigrationsAfter) {
consola4.log(`[ ] ${migration.name}`);
consola5.log(`[ ] ${migration.name}`);
}

@@ -411,3 +420,3 @@ }

// src/kysely/get-kysely.mts
import { consola as consola5 } from "consola";
import { consola as consola6 } from "consola";
import { Kysely } from "kysely";

@@ -460,5 +469,5 @@

if (event.level === "error") {
return consola5.error(event.error);
return consola6.error(event.error);
}
return consola5.log(
return consola6.log(
`executed \`${event.query.sql}\` in ${event.queryDurationMillis}ms`

@@ -521,10 +530,10 @@ );

const { migration_name } = context.args;
consola6.debug(context, []);
consola7.debug(context, []);
await usingMigrator(args12, async (migrator) => {
if (await isWrongDirection(migration_name, "down", migrator)) {
return consola6.info(
return consola7.info(
`Migration skipped: "${migration_name}" has not been run yet`
);
}
consola6.start("Starting migration down");
consola7.start("Starting migration down");
const resultSet = migration_name ? await migrator.migrateTo(migration_name) : await migrator.migrateDown();

@@ -542,3 +551,3 @@ await processMigrationResultSet(resultSet, "down", migrator);

// src/commands/migrate/latest.mts
import { consola as consola7 } from "consola";
import { consola as consola8 } from "consola";
var args3 = {

@@ -554,5 +563,5 @@ ...CommonArgs

async run(context) {
consola7.debug(context, []);
consola8.debug(context, []);
await usingMigrator(context.args, async (migrator) => {
consola7.start("Starting migration to latest");
consola8.start("Starting migration to latest");
const resultSet = await migrator.migrateToLatest();

@@ -570,3 +579,3 @@ await processMigrationResultSet(resultSet, "up", migrator);

// src/commands/migrate/list.mts
import { consola as consola8 } from "consola";
import { consola as consola9 } from "consola";
var args4 = {

@@ -582,13 +591,13 @@ ...CommonArgs

async run(context) {
consola8.debug(context, []);
consola9.debug(context, []);
const migrations2 = await usingMigrator(context.args, getMigrations);
consola8.debug(migrations2);
consola9.debug(migrations2);
if (!migrations2.length) {
return consola8.info("No migrations found.");
return consola9.info("No migrations found.");
}
consola8.info(
consola9.info(
`Found ${migrations2.length} migration${migrations2.length > 1 ? "s" : ""}:`
);
for (const migration of migrations2) {
consola8.log(`[${migration.executedAt ? "`\u2713`" : " "}] ${migration.name}`);
consola9.log(`[${migration.executedAt ? "`\u2713`" : " "}] ${migration.name}`);
}

@@ -605,3 +614,3 @@ }

import { copyFile as copyFile2, mkdir as mkdir2 } from "node:fs/promises";
import { consola as consola9 } from "consola";
import { consola as consola10 } from "consola";
import { join as join3 } from "pathe";

@@ -621,3 +630,3 @@ var args5 = {

const { extension } = args12;
consola9.debug(context, []);
consola10.debug(context, []);
assertExtension(extension);

@@ -629,3 +638,3 @@ const config = await getConfigOrFail(args12);

);
consola9.debug("Migrations folder path:", migrationsFolderPath);
consola10.debug("Migrations folder path:", migrationsFolderPath);
const wasMigrationsFolderCreated = Boolean(

@@ -635,10 +644,10 @@ await mkdir2(migrationsFolderPath, { recursive: true })

if (wasMigrationsFolderCreated) {
consola9.debug("Migrations folder created");
consola10.debug("Migrations folder created");
}
const filename = `${await config.migrations.getMigrationPrefix()}${args12.migration_name}.${extension}`;
consola9.debug("Filename:", filename);
consola10.debug("Filename:", filename);
const filePath = join3(migrationsFolderPath, filename);
consola9.debug("File path:", filePath);
consola10.debug("File path:", filePath);
await copyFile2(join3(__dirname, "templates/migration-template.ts"), filePath);
consola9.success(`Created migration file at ${filePath}`);
consola10.success(`Created migration file at ${filePath}`);
}

@@ -653,3 +662,3 @@ };

// src/commands/migrate/rollback.mts
import { consola as consola10 } from "consola";
import { consola as consola11 } from "consola";
import { NO_MIGRATIONS } from "kysely";

@@ -672,5 +681,5 @@ var args6 = {

async run(context) {
consola10.debug(context, []);
consola11.debug(context, []);
await usingMigrator(context.args, async (migrator) => {
consola10.start("Starting migration rollback");
consola11.start("Starting migration rollback");
const resultSet = await migrator.migrateTo(NO_MIGRATIONS);

@@ -689,6 +698,6 @@ await processMigrationResultSet(resultSet, "down", migrator);

import { showUsage } from "citty";
import { consola as consola12 } from "consola";
import { consola as consola13 } from "consola";
// src/commands/migrate/up.mts
import { consola as consola11 } from "consola";
import { consola as consola12 } from "consola";
var args7 = {

@@ -707,10 +716,10 @@ ...CommonArgs,

const { migration_name } = args12;
consola11.debug(context, []);
consola12.debug(context, []);
await usingMigrator(args12, async (migrator) => {
if (await isWrongDirection(migration_name, "up", migrator)) {
return consola11.info(
return consola12.info(
`Migration skipped: migration "${migration_name}" has already been run`
);
}
consola11.start("Starting migration up");
consola12.start("Starting migration up");
const resultSet = migration_name ? await migrator.migrateTo(migration_name) : await migrator.migrateUp();

@@ -742,3 +751,3 @@ await processMigrationResultSet(resultSet, "up", migrator);

if (!isInSubcommand(context)) {
consola12.debug(context, []);
consola13.debug(context, []);
await showUsage(context.cmd, RootCommand);

@@ -752,3 +761,3 @@ }

import { copyFile as copyFile3, mkdir as mkdir3 } from "node:fs/promises";
import { consola as consola13 } from "consola";
import { consola as consola14 } from "consola";
import { join as join4 } from "pathe";

@@ -772,7 +781,7 @@ var args8 = {

const { extension } = args12;
consola13.debug(context, []);
consola14.debug(context, []);
assertExtension(extension);
const config = await getConfigOrFail(args12);
const seedsFolderPath = join4(config.cwd, config.seeds.seedFolder);
consola13.debug("Seeds folder path:", seedsFolderPath);
consola14.debug("Seeds folder path:", seedsFolderPath);
const wasSeedsFolderCreated = Boolean(

@@ -782,10 +791,10 @@ await mkdir3(seedsFolderPath, { recursive: true })

if (wasSeedsFolderCreated) {
consola13.debug("Seeds folder created");
consola14.debug("Seeds folder created");
}
const filename = `${await config.seeds.getSeedPrefix()}${args12.seed_name}.${extension}`;
consola13.debug("Filename:", filename);
consola14.debug("Filename:", filename);
const filePath = join4(seedsFolderPath, filename);
consola13.debug("File path:", filePath);
consola14.debug("File path:", filePath);
await copyFile3(join4(__dirname, "templates/seed-template.ts"), filePath);
consola13.success(`Created seed file at ${filePath}`);
consola14.success(`Created seed file at ${filePath}`);
}

@@ -798,6 +807,6 @@ };

import { showUsage as showUsage2 } from "citty";
import { consola as consola16 } from "consola";
import { consola as consola17 } from "consola";
// src/commands/seed/list.mts
import { consola as consola14 } from "consola";
import { consola as consola15 } from "consola";

@@ -849,3 +858,3 @@ // src/seeds/get-seeder.mts

async run(context) {
consola14.debug(context, []);
consola15.debug(context, []);
const seeds = await usingSeeder(

@@ -855,9 +864,9 @@ context.args,

);
consola14.debug(seeds);
consola15.debug(seeds);
if (!seeds.length) {
return consola14.info("No seeds found.");
return consola15.info("No seeds found.");
}
consola14.info(`Found ${seeds.length} seed${seeds.length > 1 ? "s" : ""}:`);
consola15.info(`Found ${seeds.length} seed${seeds.length > 1 ? "s" : ""}:`);
for (const seed of seeds) {
consola14.log(seed.name);
consola15.log(seed.name);
}

@@ -869,3 +878,3 @@ }

// src/commands/seed/run.mts
import { consola as consola15 } from "consola";
import { consola as consola16 } from "consola";
import { colorize as colorize2 } from "consola/utils";

@@ -888,19 +897,19 @@ var args10 = {

const { specific } = args12;
consola15.debug(context, []);
consola15.start("Starting seed run");
consola16.debug(context, []);
consola16.start("Starting seed run");
const resultSet = await usingSeeder(args12, (seeder) => seeder.run(specific));
consola15.debug(resultSet);
consola16.debug(resultSet);
const { error, results } = resultSet;
if (!results.length) {
return consola15.info("No seeds found.");
return consola16.info("No seeds found.");
}
if (!error) {
consola15.success("Seed successful");
consola16.success("Seed successful");
}
const actuallyRan = error ? results.filter((result) => result.status !== "NotExecuted") : results;
consola15.info(
consola16.info(
`Ran ${actuallyRan.length} seed${actuallyRan.length > 1 ? "s" : ""}:`
);
for (const result of results) {
consola15.log(
consola16.log(
`[${{

@@ -913,2 +922,6 @@ Error: colorize2("red", "\u2717"),

}
if (error) {
handleAggregateError(error);
exitWithError(error);
}
}

@@ -934,3 +947,3 @@ };

if (!isInSubcommand(context)) {
consola16.debug(context, []);
consola17.debug(context, []);
await showUsage2(context.cmd, RootCommand);

@@ -973,5 +986,5 @@ }

if (context.args.debug) {
consola17.level = LogLevels.debug;
consola18.level = LogLevels.debug;
}
consola17.options.formatOptions.date = false;
consola18.options.formatOptions.date = false;
getCWD(context.args);

@@ -982,3 +995,3 @@ },

if (!isInSubcommand(context)) {
consola17.debug(context, []);
consola18.debug(context, []);
if (args12.version) {

@@ -990,3 +1003,3 @@ return await printInstalledVersions(args12);

await printUpgradeNotice(args12);
consola17.debug(`finished running from "${__filename}"`);
consola18.debug(`finished running from "${__filename}"`);
}

@@ -993,0 +1006,0 @@ };

{
"name": "kysely-ctl",
"version": "0.8.10",
"version": "0.8.11",
"type": "module",

@@ -57,5 +57,5 @@ "bin": {

"@types/better-sqlite3": "^7.6.11",
"@types/node": "^20.14.9",
"@types/node": "^20.14.10",
"better-sqlite3": "^11.1.2",
"kysely": "^0.27.3",
"kysely": "^0.27.4",
"kysely-postgres-js": "^2.0.0",

@@ -66,3 +66,3 @@ "postgres": "^3.4.4",

"typescript": "^5.5.3",
"vitest": "^1.6.0"
"vitest": "^2.0.2"
},

@@ -69,0 +69,0 @@ "engines": {

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc