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

@evs-chris/ts-pg-dao

Package Overview
Dependencies
Maintainers
1
Versions
60
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@evs-chris/ts-pg-dao - npm Package Compare versions

Comparing version

to
0.8.7

2

package.json
{
"name": "@evs-chris/ts-pg-dao",
"version": "0.8.6",
"version": "0.8.7",
"main": "runtime/main.js",

@@ -5,0 +5,0 @@ "typings": "runtime/main.d.ts",

@@ -5,3 +5,3 @@ import { BuildConfig, BuiltConfig } from './main';

}
export declare function config(file: any, opts?: ConfigOpts): Promise<BuildConfig | BuildConfig[]>;
export declare function config(file: string, opts?: ConfigOpts): Promise<BuildConfig | BuildConfig[]>;
export declare function write(config: BuiltConfig): Promise<void>;

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

${model.fields.find(f => f.optlock) ? `${model.fields.filter(f => f.optlock).map(f => `\n model.${f.alias || f.name} = lock;`).join('')}` : ''}
} else {${insertMembers(model, ' ')}${loadFlag ? `
} else {${insertMembers(config, model, ' ')}${loadFlag ? `
model.${loadFlag} = false;` : ''}${changeFlag ? `

@@ -269,3 +269,3 @@ model.${changeFlag} = false;` : ''}

`).join('')}
${insertMembers(model, ' ')}${loadFlag ? `
${insertMembers(config, model, ' ')}${loadFlag ? `
model.${loadFlag} = false;` : ''}

@@ -379,3 +379,3 @@ return model;

}
function modelProps(config, model, client = false) {
function modelProps(config, model, _client = false) {
let tpl = '';

@@ -419,3 +419,3 @@ let col;

}
function insertMembers(model, prefix) {
function insertMembers(config, model, prefix) {
let res = `\n${prefix}const params = [];\n${prefix}const sets = [];\n${prefix}let sql = 'INSERT INTO ${model.table} ';`;

@@ -431,3 +431,3 @@ for (const f of model.fields) {

const locks = model.fields.filter(f => f.optlock);
res += `\n${prefix}sql += \`(\${sets.map(s => \`"\${s}"\`).join(', ')}\${${locks.length} && sets.length ? ', ' : ''}${locks.map(l => l.name).join(', ')}) VALUES (\${sets.map((n, i) => \`$\${i + 1}\`)}\${${locks.length} && sets.length ? ', ' : ''}${locks.map(l => 'now()').join(', ')})${ret.length ? ` RETURNING ${ret.map(f => `"${f.name}"`).join(', ')}` : ''};\`;`;
res += `\n${prefix}sql += \`(\${sets.map(s => \`"\${s}"\`).join(', ')}\${${locks.length} && sets.length ? ', ' : ''}${locks.map(l => l.name).join(', ')}) VALUES (\${sets.map((n, i) => \`$\${i + 1}\`)}\${${locks.length} && sets.length ? ', ' : ''}${locks.map(_l => 'now()').join(', ')})${ret.length ? ` RETURNING ${ret.map(f => `"${f.name}"${model.cast(config, f)}`).join(', ')}` : ''};\`;`;
res += `\n\n${prefix}const res = (await con.query(sql, params)).rows[0];`;

@@ -473,3 +473,3 @@ res += ret.map(f => `\n${prefix}model.${f.alias || f.name} = res.${f.name};`).join('');

let fn = null;
const str = sql.replace(params, (str, name) => {
const str = sql.replace(params, (_str, name) => {
let p, i;

@@ -490,3 +490,3 @@ if (!query.params || !(p = query.params.find(p => p.name === name)))

let len = num;
const s = sql.replace(params, (str, name) => {
const s = sql.replace(params, (_str, name) => {
let i;

@@ -508,3 +508,3 @@ const p = query.params.find(p => p.name === name);

// map tables to models and record relevant aliases
sql = sql.replace(tableAliases, (m, tbl, alias) => {
sql = sql.replace(tableAliases, (_m, tbl, alias) => {
const mdl = findModel(tbl, config);

@@ -559,3 +559,3 @@ if (!mdl)

const [str, check] = mapParams(mapFields(sql), ps, 'ps.length');
const cond = condition.replace(params, (str, name) => {
const cond = condition.replace(params, (_str, name) => {
if (!start.params.find(p => p.name === name))

@@ -596,3 +596,3 @@ throw new Error(`Query ${query.owner.name}.${query.name} has an invalid part condition referencing unknown parameter $${name}.`);

const ps: any[] = [${getParamsValues(parms)}];
${parts.map((p, i) => p.code).join('\n ')}
${parts.map((p, _i) => p.code).join('\n ')}
const query = await con.query(sql, ps);

@@ -742,3 +742,3 @@ ${loader.loader}

let num = params;
res.push(sql + parts.filter((p, j) => (i + 1) & (j + 1)).map(p => {
res.push(sql + parts.filter((_p, j) => (i + 1) & (j + 1)).map(p => {
const [sql, count] = p(num);

@@ -745,0 +745,0 @@ num += count;