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

better-sqlite3-schema

Package Overview
Dependencies
Maintainers
1
Versions
35
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

better-sqlite3-schema - npm Package Compare versions

Comparing version 2.3.4 to 2.3.5

42

codegen.js

@@ -9,4 +9,4 @@ "use strict";

function makeInsertSql(table, fields) {
table = helpers_1.escapeField(table);
const cols = fields.map(col => ' ' + helpers_1.escapeField(col)).join(',\n');
table = (0, helpers_1.escapeField)(table);
const cols = fields.map(col => ' ' + (0, helpers_1.escapeField)(col)).join(',\n');
const values = fields.map(() => '?').join(',');

@@ -24,3 +24,3 @@ return `insert into ${table} (

function toFieldNames(schema) {
return array_1.uniqueArray([
return (0, array_1.uniqueArray)([
schema.idField || '',

@@ -33,6 +33,6 @@ ...Object.keys(schema.fields || {}),

function toRowFieldNames(schema) {
return array_1.uniqueArray([
return (0, array_1.uniqueArray)([
schema.idField || '',
...Object.keys(schema.fields || {}),
...helpers_1.toRefIdFieldNames(schema),
...(0, helpers_1.toRefIdFieldNames)(schema),
...(schema.deduplicateFields || []),

@@ -43,6 +43,6 @@ ].filter(s => s));

function toDataFieldNames(schema) {
return array_1.uniqueArray([
return (0, array_1.uniqueArray)([
schema.idField || '',
...Object.keys(schema.fields || {}),
...helpers_1.toRefFieldNames(schema),
...(0, helpers_1.toRefFieldNames)(schema),
...(schema.deduplicateFields || []),

@@ -53,8 +53,8 @@ ].filter(s => s));

function makeCreateTableSql(schema) {
const table = helpers_1.escapeField(schema.table);
const table = (0, helpers_1.escapeField)(schema.table);
const cols = [];
Object.entries(schema.fields || {}).forEach(([field, type]) => {
cols.push(helpers_1.escapeField(field) + ' ' + type);
cols.push((0, helpers_1.escapeField)(field) + ' ' + type);
});
helpers_1.toRefIdFieldNames(schema).forEach(field => cols.push(helpers_1.escapeField(field) + ' integer'));
(0, helpers_1.toRefIdFieldNames)(schema).forEach(field => cols.push((0, helpers_1.escapeField)(field) + ' integer'));
if (schema.primaryKeys) {

@@ -95,6 +95,6 @@ const fields = schema.primaryKeys.map(helpers_1.escapeField).join(', ');

function makeTable(schema) {
const tableName = string_1.toCamelCase(schema.table);
const refSchemas = helpers_1.toRefSchemas(schema);
const tableName = (0, string_1.toCamelCase)(schema.table);
const refSchemas = (0, helpers_1.toRefSchemas)(schema);
const fields = toFieldNames(schema);
const refIdFields = helpers_1.toRefIdFieldNames(schema);
const refIdFields = (0, helpers_1.toRefIdFieldNames)(schema);
const rowFields = toRowFieldNames(schema);

@@ -174,3 +174,3 @@ const dataFields = toDataFieldNames(schema);

const refSchemas = [];
schemas.forEach(schema => refSchemas.push(...helpers_1.toRefSchemas(schema)));
schemas.forEach(schema => refSchemas.push(...(0, helpers_1.toRefSchemas)(schema)));
const createdTableSqls = new Set();

@@ -181,3 +181,3 @@ return refSchemas

const idField = refSchema.idField;
const createTableSql = helpers_1.makeCreateRefTableSql(refSchema);
const createTableSql = (0, helpers_1.makeCreateRefTableSql)(refSchema);
if (createdTableSqls.has(createTableSql)) {

@@ -216,3 +216,3 @@ return '';

function makeRefTableIndexSql(field) {
return helpers_1.makeUniqueIndexSql(field, [field]);
return (0, helpers_1.makeUniqueIndexSql)(field, [field]);
}

@@ -223,7 +223,7 @@ exports.makeRefTableIndexSql = makeRefTableIndexSql;

const table = schema.table;
const tableName = string_1.toCamelCase(table);
const tableName = (0, string_1.toCamelCase)(table);
const idField = schema.idField;
const deduplicateFields = schema.deduplicateFields;
const rowFields = toRowFieldNames(schema);
const indexSql = schema.createIndexSql || helpers_1.makeUniqueIndexSql(table, deduplicateFields);
const indexSql = schema.createIndexSql || (0, helpers_1.makeUniqueIndexSql)(table, deduplicateFields);
const select = makeCountStatementName(idField);

@@ -234,3 +234,3 @@ const selectSql = `select count(*) count from "${table}" where "${idField}" = ?`;

const fields = toFieldNames(schema);
const refIdFields = helpers_1.toRefIdFieldNames(schema);
const refIdFields = (0, helpers_1.toRefIdFieldNames)(schema);
const insertRowValues = [

@@ -240,3 +240,3 @@ ...fields.map(field => `data[${field}]`),

];
const refSchemas = helpers_1.toRefSchemas(schema);
const refSchemas = (0, helpers_1.toRefSchemas)(schema);
const getRefValues = refSchemas

@@ -294,5 +294,5 @@ .map(makeInlineGetRefId)

})
.sort((a, b) => compare_1.compare(a.module, b.module))
.sort((a, b) => (0, compare_1.compare)(a.module, b.module))
.map(a => a.code);
}
//# sourceMappingURL=codegen.js.map

@@ -23,3 +23,3 @@ "use strict";

delete options.mode;
return db_1.newDB(Object.assign({ path: file, migrate: false }, options));
return (0, db_1.newDB)(Object.assign({ path: file, migrate: false }, options));
}

@@ -33,17 +33,17 @@ exports.createDB = createDB;

const table = makeTableInfo(db, schema.table);
insertRowFn = function_1.chain(makeAutoAddFieldMapRowFn(db, table), insertRowFn);
insertRowFn = (0, function_1.chain)(makeAutoAddFieldMapRowFn(db, table), insertRowFn);
}
if (schema.refFields) {
const refFields = toRefSchemas(schema).map(refSchema => makeInsertRefField(db, refSchema));
insertRowFn = function_1.chain(makeInsertRefFieldsMapRowFn(refFields), insertRowFn);
insertRowFn = (0, function_1.chain)(makeInsertRefFieldsMapRowFn(refFields), insertRowFn);
}
if (schema.skipFields) {
insertRowFn = function_1.chain(makeSkipFieldsMapRowFn(schema.skipFields), insertRowFn);
insertRowFn = (0, function_1.chain)(makeSkipFieldsMapRowFn(schema.skipFields), insertRowFn);
}
const whitelistFields = getWhitelistFields(schema);
if (whitelistFields) {
insertRowFn = function_1.chain(makeWhitelistFieldsMapRowFn(whitelistFields), insertRowFn);
insertRowFn = (0, function_1.chain)(makeWhitelistFieldsMapRowFn(whitelistFields), insertRowFn);
}
if (!(schema === null || schema === void 0 ? void 0 : schema.inplaceUpdate)) {
insertRowFn = function_1.chain(cloneRowFn, insertRowFn);
insertRowFn = (0, function_1.chain)(cloneRowFn, insertRowFn);
}

@@ -391,3 +391,3 @@ return insertRowFn;

if (options.cacheSize) {
return cache_1.newCache({ resetSize: options.cacheSize });
return (0, cache_1.newCache)({ resetSize: options.cacheSize });
}

@@ -414,3 +414,3 @@ }

const refFields = toRefSchemas(schema).map(refSchema => makeSelectRefField(db, refSchema));
selectRowFn = function_1.chain(selectRowFn, makeSelectRefFieldsMapRowFn(refFields));
selectRowFn = (0, function_1.chain)(selectRowFn, makeSelectRefFieldsMapRowFn(refFields));
}

@@ -417,0 +417,0 @@ return selectRowFn;

{
"name": "better-sqlite3-schema",
"version": "2.3.4",
"version": "2.3.5",
"description": "Migrate (nested and multi-dimensional) json data to/from sqlite database with better-sqlite3-helper",

@@ -33,10 +33,14 @@ "keywords": [

"dependencies": {
"better-sqlite3": "^7.4.3",
"better-sqlite3-helper": "^3.1.4",
"tslib": "^2.3.1"
"better-sqlite3": "^7.6.2",
"better-sqlite3-helper": "^3.1.6",
"tslib": "^2.4.0"
},
"peerDependencies": {
"@types/better-sqlite3": "^7.4.0",
"@types/integer": "^4.0.1"
},
"peerDependenciesMeta": {
"@types/better-sqlite3": {
"optional": true
},
"@types/integer": {

@@ -43,0 +47,0 @@ "optional": true

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