Socket
Socket
Sign inDemoInstall

knex

Package Overview
Dependencies
Maintainers
5
Versions
252
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

knex - npm Package Compare versions

Comparing version 2.4.1 to 2.4.2

11

bin/cli.js

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

const opts = commander.opts();
const instance = await initKnex(env, opts, true); // Skip config check, we don't really care about client when creating migrations
const instance = await initKnex(env, opts, true); // Skip config check, we don't really care about client when creating migrations
const ext = getMigrationExtension(env, opts);

@@ -237,3 +237,3 @@ const configOverrides = { extension: ext };

.catch(exit);
} catch(err) {
} catch (err) {
exit(err);

@@ -402,3 +402,4 @@ }

if (opts.timestampFilenamePrefix) {
configOverrides.timestampFilenamePrefix = opts.timestampFilenamePrefix;
configOverrides.timestampFilenamePrefix =
opts.timestampFilenamePrefix;
}

@@ -412,5 +413,5 @@

.catch(exit);
} catch(err) {
} catch (err) {
exit(err);
}
}
});

@@ -417,0 +418,0 @@

@@ -0,0 +0,0 @@ const { DEFAULT_EXT, DEFAULT_TABLE_NAME } = require('./constants');

@@ -0,0 +0,0 @@ const DEFAULT_EXT = 'js';

@@ -0,0 +0,0 @@ const color = require('colorette');

@@ -0,0 +0,0 @@ ## How to contribute to Knex.js

@@ -0,0 +0,0 @@ // Knex.js

@@ -0,0 +0,0 @@ const clone = require('lodash/clone');

@@ -0,0 +0,0 @@ const { Pool, TimeoutError } = require('tarn');

@@ -0,0 +0,0 @@ // The client names we'll allow in the `{name: lib}` pairing.

@@ -0,0 +0,0 @@ // better-sqlite3 Client

@@ -0,0 +0,0 @@ const ColumnCompiler_PG = require('../postgres/schema/pg-columncompiler.js');

@@ -0,0 +0,0 @@ const QueryBuilder = require('../../query/querybuilder');

@@ -0,0 +0,0 @@ const QueryCompiler_PG = require('../postgres/query/pg-querycompiler');

@@ -0,0 +0,0 @@ /* eslint max-len: 0 */

@@ -0,0 +0,0 @@ const ViewCompiler_PG = require('../postgres/schema/pg-viewcompiler.js');

@@ -0,0 +0,0 @@ // CockroachDB Client

@@ -0,0 +0,0 @@ // MSSQL Client

@@ -0,0 +0,0 @@ const Formatter = require('../../formatter');

@@ -0,0 +0,0 @@ // MSSQL Query Compiler

@@ -0,0 +0,0 @@ // MSSQL Column Compiler

@@ -0,0 +0,0 @@ // MySQL Schema Compiler

@@ -0,0 +0,0 @@ /* eslint max-len:0 */

@@ -0,0 +0,0 @@ /* eslint max-len: 0 */

@@ -0,0 +0,0 @@ const Transaction = require('../../execution/transaction');

@@ -0,0 +0,0 @@ // MySQL Client

@@ -0,0 +0,0 @@ // MySQL Query Compiler

@@ -0,0 +0,0 @@ // MySQL Column Compiler

@@ -0,0 +0,0 @@ // MySQL Schema Compiler

@@ -0,0 +0,0 @@ /* eslint max-len:0*/

@@ -0,0 +0,0 @@ const ViewBuilder = require('../../../schema/viewbuilder.js');

@@ -0,0 +0,0 @@ /* eslint max-len: 0 */

@@ -0,0 +0,0 @@ const Transaction = require('../../execution/transaction');

@@ -0,0 +0,0 @@ // MySQL2 Client

@@ -0,0 +0,0 @@ const Transaction = require('../../execution/transaction');

@@ -0,0 +0,0 @@ # Warning: Dead Code #

@@ -0,0 +0,0 @@ // Oracle Client

@@ -0,0 +0,0 @@ /* eslint max-len:0 */

@@ -0,0 +0,0 @@ const Trigger = require('./trigger');

@@ -0,0 +0,0 @@ const utils = require('../../utils');

@@ -0,0 +0,0 @@ const ColumnBuilder = require('../../../schema/columnbuilder');

@@ -0,0 +0,0 @@ const uniq = require('lodash/uniq');

@@ -0,0 +0,0 @@ // Oracle Schema Compiler

@@ -0,0 +0,0 @@ /* eslint max-len:0 */

@@ -0,0 +0,0 @@ function generateCombinedName(logger, postfix, name, subNames) {

@@ -0,0 +0,0 @@ // Oracledb Client

@@ -0,0 +0,0 @@ const clone = require('lodash/clone');

@@ -0,0 +0,0 @@ const ColumnCompiler_Oracle = require('../../oracle/schema/oracle-columncompiler');

@@ -0,0 +0,0 @@ const TableCompiler_Oracle = require('../../oracle/schema/oracle-tablecompiler');

@@ -0,0 +0,0 @@ const ViewBuilder = require('../../../schema/viewbuilder.js');

@@ -0,0 +0,0 @@ /* eslint max-len: 0 */

@@ -0,0 +0,0 @@ const Transaction = require('../../execution/transaction');

@@ -0,0 +0,0 @@ const Utils = require('../oracle/utils');

@@ -0,0 +0,0 @@ // PostgreSQL Native Driver (pg-native)

@@ -0,0 +0,0 @@ const Transaction = require('../../../execution/transaction');

@@ -0,0 +0,0 @@ // PostgreSQL

@@ -0,0 +0,0 @@ const QueryBuilder = require('../../../query/querybuilder.js');

@@ -0,0 +0,0 @@ // PostgreSQL Query Builder & Compiler

@@ -0,0 +0,0 @@ // PostgreSQL Column Compiler

@@ -123,3 +123,5 @@ // PostgreSQL Schema Compiler

this.pushQuery({
sql: `refresh materialized view${concurrently ? " concurrently" : ""} ${this.formatter.wrap(viewName)}`,
sql: `refresh materialized view${
concurrently ? ' concurrently' : ''
} ${this.formatter.wrap(viewName)}`,
});

@@ -126,0 +128,0 @@ }

@@ -0,0 +0,0 @@ /* eslint max-len: 0 */

@@ -0,0 +0,0 @@ const ViewBuilder = require('../../../schema/viewbuilder.js');

@@ -0,0 +0,0 @@ /* eslint max-len: 0 */

@@ -0,0 +0,0 @@ // Redshift

@@ -0,0 +0,0 @@ // Redshift Query Builder & Compiler

@@ -0,0 +0,0 @@ const ColumnBuilder = require('../../../schema/columnbuilder');

@@ -0,0 +0,0 @@ // Redshift Column Compiler

@@ -0,0 +0,0 @@ /* eslint max-len: 0 */

@@ -0,0 +0,0 @@ /* eslint max-len: 0 */

@@ -0,0 +0,0 @@ /* eslint max-len: 0 */

@@ -0,0 +0,0 @@ const Transaction = require('../../execution/transaction');

@@ -0,0 +0,0 @@ const Transaction = require('../../../execution/transaction');

@@ -0,0 +0,0 @@ // SQLite3

@@ -0,0 +0,0 @@ const QueryBuilder = require('../../../query/querybuilder.js');

@@ -0,0 +0,0 @@ // SQLite3 Query Builder & Compiler

@@ -0,0 +0,0 @@ // SQLite3_DDL

@@ -0,0 +0,0 @@ function compileCreateTable(ast, wrap = (v) => v) {

@@ -0,0 +0,0 @@ // Sequence parser combinator

@@ -0,0 +0,0 @@ const { tokenize } = require('./tokenizer');

@@ -0,0 +0,0 @@ function copyData(sourceTable, targetTable, columns) {

@@ -0,0 +0,0 @@ function tokenize(text, tokens) {

@@ -0,0 +0,0 @@ function isEqualId(first, second) {

@@ -0,0 +0,0 @@ const ColumnCompiler = require('../../../schema/columncompiler');

@@ -0,0 +0,0 @@ // SQLite3: Column Builder & Compiler

@@ -0,0 +0,0 @@ const filter = require('lodash/filter');

@@ -0,0 +0,0 @@ /* eslint max-len: 0 */

@@ -0,0 +0,0 @@ const chunk = require('lodash/chunk');

@@ -0,0 +0,0 @@ function ensureConnectionCallback(runner) {

@@ -0,0 +0,0 @@ const _debugQuery = require('debug')('knex:query');

@@ -0,0 +0,0 @@ const { KnexTimeoutError } = require('../util/timeout');

@@ -0,0 +0,0 @@ // Transaction

@@ -0,0 +0,0 @@ const {

@@ -0,0 +0,0 @@ const { isObject } = require('../util/is');

@@ -0,0 +0,0 @@ const { columnize } = require('./wrappingFormatter');

@@ -0,0 +0,0 @@ const transform = require('lodash/transform');

const Knex = require('./knex-builder/Knex');
module.exports = Knex;

@@ -0,0 +0,0 @@ // FunctionHelper

@@ -0,0 +0,0 @@ const Client = require('../../client');

@@ -0,0 +0,0 @@ const { parse } = require('pg-connection-string');

@@ -53,3 +53,3 @@ const Client = require('../client');

knex.TableBuilder = {
knex.TableBuilder = {
extend: function (methodName, fn) {

@@ -56,0 +56,0 @@ TableBuilder.extend(methodName, fn);

@@ -0,0 +0,0 @@ const { EventEmitter } = require('events');

@@ -0,0 +0,0 @@ const color = require('colorette');

@@ -0,0 +0,0 @@ const path = require('path');

@@ -0,0 +0,0 @@ // Stub Migrate:

@@ -0,0 +0,0 @@ const { getTableName } = require('./table-resolver');

@@ -44,3 +44,5 @@ const path = require('path');

if (name[0] === '-') name = name.slice(1);
return yyyymmddhhmmss() + '_' + name + '.' + this.config.extension.split('-')[0];
return (
yyyymmddhhmmss() + '_' + name + '.' + this.config.extension.split('-')[0]
);
}

@@ -47,0 +49,0 @@

@@ -0,0 +0,0 @@ const { FsMigrations } = require('./sources/fs-migrations');

@@ -0,0 +0,0 @@ // Migrator

@@ -0,0 +0,0 @@ const path = require('path');

@@ -0,0 +0,0 @@ //Get schema-aware table name

@@ -0,0 +0,0 @@ // Stub Seed:

@@ -0,0 +0,0 @@ const { FsSeeds } = require('./sources/fs-seeds');

@@ -0,0 +0,0 @@ // Seeder

@@ -0,0 +0,0 @@ const path = require('path');

@@ -0,0 +0,0 @@ const fs = require('fs');

@@ -0,0 +0,0 @@ const isModuleType = require('./is-module-type');

@@ -0,0 +0,0 @@ const getPackageType = require('get-package-type');

@@ -0,0 +0,0 @@ const template = require('lodash/template');

@@ -0,0 +0,0 @@ function yyyymmddhhmmss() {

@@ -0,0 +0,0 @@ const assert = require('assert');

@@ -0,0 +0,0 @@ /**

@@ -0,0 +0,0 @@ const assert = require('assert');

@@ -0,0 +0,0 @@ // All properties we can use to start a query chain

@@ -0,0 +0,0 @@ // Builder

@@ -0,0 +0,0 @@ // Query Compiler

@@ -0,0 +0,0 @@ // Raw

@@ -0,0 +0,0 @@ const Raw = require('./raw');

@@ -100,5 +100,6 @@ const { EventEmitter } = require('events');

SchemaBuilder.extend = (methodName, fn) => {
if (Object.prototype.hasOwnProperty.call(SchemaBuilder.prototype, methodName)) {
if (
Object.prototype.hasOwnProperty.call(SchemaBuilder.prototype, methodName)
) {
throw new Error(

@@ -105,0 +106,0 @@ `Can't extend SchemaBuilder with existing method ('${methodName}').`

@@ -91,5 +91,6 @@ const extend = require('lodash/extend');

ColumnBuilder.extend = (methodName, fn) => {
if (Object.prototype.hasOwnProperty.call(ColumnBuilder.prototype, methodName)) {
if (
Object.prototype.hasOwnProperty.call(ColumnBuilder.prototype, methodName)
) {
throw new Error(

@@ -96,0 +97,0 @@ `Can't extend ColumnBuilder with existing method ('${methodName}').`

@@ -0,0 +0,0 @@ // Column Compiler

@@ -0,0 +0,0 @@ const {

@@ -0,0 +0,0 @@ const tail = require('lodash/tail');

@@ -364,5 +364,6 @@ // TableBuilder

TableBuilder.extend = (methodName, fn) => {
if (Object.prototype.hasOwnProperty.call(TableBuilder.prototype, methodName)) {
if (
Object.prototype.hasOwnProperty.call(TableBuilder.prototype, methodName)
) {
throw new Error(

@@ -369,0 +370,0 @@ `Can't extend TableBuilder with existing method ('${methodName}').`

@@ -0,0 +0,0 @@ /* eslint max-len:0 */

@@ -82,3 +82,2 @@ const helpers = require('../util/helpers');

ViewBuilder.extend = (methodName, fn) => {

@@ -85,0 +84,0 @@ if (Object.prototype.hasOwnProperty.call(ViewBuilder.prototype, methodName)) {

@@ -0,0 +0,0 @@ /* eslint max-len:0 */

@@ -0,0 +0,0 @@ const noop = require('./noop');

@@ -0,0 +0,0 @@ const isPlainObject = require('lodash/isPlainObject');

@@ -0,0 +0,0 @@ function isString(value) {

@@ -0,0 +0,0 @@ // This alphabet uses `A-Za-z0-9_-` symbols. The genetic algorithm helped

module.exports = function () {};

@@ -0,0 +0,0 @@ module.exports = function saveAsyncStack(instance, lines) {

@@ -0,0 +0,0 @@ /*eslint max-len: 0, no-var:0 */

@@ -0,0 +0,0 @@ class KnexTimeoutError extends Error {

{
"name": "knex",
"version": "2.4.1",
"version": "2.4.2",
"description": "A batteries-included SQL query & schema builder for PostgresSQL, MySQL, CockroachDB, MSSQL and SQLite3",

@@ -16,6 +16,7 @@ "main": "knex",

"format": "prettier --write \"{lib,bin,scripts,test}/**/*.js\"",
"format:check-difference": "prettier --list-different \"{lib,bin,scripts,test}/**/*.js\"",
"debug:test": "mocha --inspect-brk --exit -t 0 test/all-tests-suite.js",
"debug:tape": "node --inspect-brk test/tape/index.js",
"coveralls": "nyc report --reporter=lcov",
"lint": "eslint \"lib/**/*.js\" \"test/**/*.js\"",
"lint": "eslint \"lib/**/*.js\" \"test/**/*.js\" \"bin/**/*.js\"",
"lint:types": "tsd && dtslint types",

@@ -61,3 +62,3 @@ "lint:everything": "npm run lint:types && npm run lint",

"prepare": "husky install && npm run clean && npm run build",
"prepublishOnly": "npm run clean && npm run build"
"prepublishOnly": "npm run format:check-difference && npm run lint && npm run clean && npm run build"
},

@@ -119,6 +120,7 @@ "dependencies": {

"dtslint": "4.2.1",
"eslint": "^8.13.0",
"eslint-config-prettier": "^8.5.0",
"eslint": "^8.32.0",
"eslint-config-prettier": "^8.6.0",
"eslint-plugin-import": "^2.26.0",
"eslint-plugin-mocha-no-only": "^1.1.1",
"eslint-plugin-prettier": "^4.2.1",
"husky": "^8.0.1",

@@ -136,3 +138,3 @@ "jake": "^10.8.5",

"pg-query-stream": "^4.2.4",
"prettier": "2.6.2",
"prettier": "2.8.3",
"rimraf": "^3.0.2",

@@ -139,0 +141,0 @@ "sinon": "^15.0.1",

@@ -0,0 +0,0 @@ # [knex.js](https://knex.github.io/documentation/)

@@ -0,0 +0,0 @@ #!/usr/bin/env node

#!/usr/bin/env node
const fs = require('fs')
const path = require('path')
const { execSync } = require("child_process");
const fs = require('fs');
const path = require('path');
const { execSync } = require('child_process');
function main() {
const repoDir = path.dirname(__dirname)
const gitDir = path.join(repoDir, '.git')
const gitDirExists = doesDirectoryExist(gitDir)
const repoDir = path.dirname(__dirname);
const gitDir = path.join(repoDir, '.git');
const gitDirExists = doesDirectoryExist(gitDir);
if (!gitDirExists) {
console.log("No .git directory detected so can not clean 'lib/'. Exiting.")
process.exit(0)
console.log("No .git directory detected so can not clean 'lib/'. Exiting.");
process.exit(0);
}
console.log("Cleaning 'lib/' of outputted files from Typescript compilation ...")
const cmd = 'git clean -f -X lib/'
const output = execSync(cmd, { cwd: repoDir })
console.log(output.toString('utf8'))
console.log('Done')
console.log(
"Cleaning 'lib/' of outputted files from Typescript compilation ..."
);
const cmd = 'git clean -f -X lib/';
const output = execSync(cmd, { cwd: repoDir });
console.log(output.toString('utf8'));
console.log('Done');
}

@@ -24,7 +26,7 @@

if (fs.existsSync(p)) {
return fs.lstatSync(p).isDirectory()
return fs.lstatSync(p).isDirectory();
}
return false
return false;
}
main()
main();

@@ -0,0 +0,0 @@ # Checklist for crating knex @next releases

@@ -0,0 +0,0 @@ require('sqlite3');

@@ -0,0 +0,0 @@ const Knex = require('../../lib');

@@ -0,0 +0,0 @@ # Test scripts to evaluate stability of drivers / pool etc.

#!/usr/bin/env node
const path = require('path')
const fs = require('fs')
const path = require('path');
const fs = require('fs');
// Directory constants
const scriptDirectory = __dirname
const repoDirectory = path.join(scriptDirectory, '..')
const libDirectory = path.join(repoDirectory, 'lib')
const scriptDirectory = __dirname;
const repoDirectory = path.join(scriptDirectory, '..');
const libDirectory = path.join(repoDirectory, 'lib');

@@ -22,3 +22,3 @@ const helpText = `

1. This script is tested to work on Ubuntu 18.04 LTS.
`
`;

@@ -34,28 +34,28 @@ const gitignoreHeader = `# DO NOT EDIT, GENERATED BY: scripts/update_gitignore_for_tsc_output.js

# Do not include .js files from .ts files
`
`;
function main(cliCommand) {
if (cliCommand === 'run') {
console.log('Generating lib/.gitignore ...')
console.log('Generating lib/.gitignore ...');
// Find all .ts files in lib/
const directoriesToProcess = [libDirectory]
const tsFiles = []
const directoriesToProcess = [libDirectory];
const tsFiles = [];
while (directoriesToProcess.length > 0) {
const directory = directoriesToProcess.pop()
const directory = directoriesToProcess.pop();
if (!fs.existsSync(directory)) {
throw new Error("Directory doesn't exist:", directory)
throw new Error("Directory doesn't exist:", directory);
}
const files = fs.readdirSync(directory)
const files = fs.readdirSync(directory);
files.forEach((file) => {
const filename = path.join(directory, file)
const stat = fs.lstatSync(filename)
const filename = path.join(directory, file);
const stat = fs.lstatSync(filename);
if (stat.isDirectory()) {
directoriesToProcess.push(filename)
directoriesToProcess.push(filename);
} else if (filename.endsWith('.ts') && !filename.endsWith('.d.ts')) {
tsFiles.push(filename)
console.log('Found .ts file:', filename)
tsFiles.push(filename);
console.log('Found .ts file:', filename);
}
})
});
}

@@ -66,18 +66,22 @@

// Cuts off `${libDirectory}/`
const relativeTsPath = filepath.slice(libDirectory.length + 1)
const relativeTsPath = filepath.slice(libDirectory.length + 1);
// Swaps .ts for .js file ending
const relativeJsPath = relativeTsPath.slice(0, relativeTsPath.length - 3) + '.js'
const relativeJsPath =
relativeTsPath.slice(0, relativeTsPath.length - 3) + '.js';
// Always use POSIX-style path separators - .gitignore requires it
return relativeJsPath.split(path.sep).join(path.posix.sep);
})
const jsFilesToIgnoreString = jsFilesToIgnore.join('\n')
const libGitignorePath = path.join(libDirectory, '.gitignore')
fs.writeFileSync(libGitignorePath, gitignoreHeader + jsFilesToIgnoreString + '\n')
console.log('DONE')
});
const jsFilesToIgnoreString = jsFilesToIgnore.join('\n');
const libGitignorePath = path.join(libDirectory, '.gitignore');
fs.writeFileSync(
libGitignorePath,
gitignoreHeader + jsFilesToIgnoreString + '\n'
);
console.log('DONE');
} else if (['help', '--help', '-h', undefined].includes(cliCommand)) {
console.log(helpText)
console.log(helpText);
} else {
console.log(`Unsupported command: ${cliCommand}`)
console.log("Try running with 'help' to see supported commands.")
process.exit(1)
console.log(`Unsupported command: ${cliCommand}`);
console.log("Try running with 'help' to see supported commands.");
process.exit(1);
}

@@ -87,4 +91,4 @@ }

// Main script logic
const cliCommand = process.argv[2]
const cliCommand = process.argv[2];
// Start the bash app's main function
main(cliCommand)
main(cliCommand);

@@ -0,0 +0,0 @@ // This empty interface serves as a placeholder which userland code can augment to

@@ -0,0 +0,0 @@ // Placeholder interface for Table -> Record mapping

@@ -0,0 +0,0 @@ ## Upgrading to new knex.js versions

Sorry, the diff of this file is too big to display

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

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

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

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

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

Sorry, the diff of this file is too big to display

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