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

larvituser

Package Overview
Dependencies
Maintainers
0
Versions
263
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

larvituser - npm Package Compare versions

Comparing version 0.23.40 to 0.24.0

dbmigration/4.sql

5

dist/dataWriter.js

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

const larvitdbmigration_1 = require("larvitdbmigration");
const luxon_1 = require("luxon");
const uuidLib = __importStar(require("uuid"));

@@ -78,2 +79,3 @@ const topLogPrefix = 'larvituser: dataWriter.ts -';

const logPrefix = `${topLogPrefix} addUserDataFields() -`;
const updatedUtc = luxon_1.DateTime.utc().toFormat('yyyy-MM-dd HH:mm:ss');
let sql = 'INSERT INTO user_users_data (userUuid, fieldUuid, data) VALUES';

@@ -98,2 +100,3 @@ if (!Object.keys(fields).length) {

await this.db.query(sql, dbValues);
await this.db.query('UPDATE user_users SET updated = ? WHERE uuid = ?', [updatedUtc, userUuidBuffer]);
}

@@ -133,2 +136,3 @@ }

const dbConn = await this.db.getConnection();
const updatedUtc = luxon_1.DateTime.utc().toFormat('yyyy-MM-dd HH:mm:ss');
async function commitAndRelease(dbConn) {

@@ -146,2 +150,3 @@ await dbConn.commit();

}
await dbConn.query('UPDATE user_users SET updated = ? WHERE uuid = ?', [updatedUtc, userUuidBuf]);
// Begin transaction

@@ -148,0 +153,0 @@ await dbConn.beginTransaction();

4

dist/index.js

@@ -291,2 +291,4 @@ "use strict";

' u.password,\n' +
' u.created,\n' +
' u.updated,\n' +
' uf.uuid AS fieldUuid,\n' +

@@ -325,2 +327,4 @@ ' uf.name AS fieldName,\n' +

passwordIsFalse: !rows[0].password,
created: rows[0].created,
updated: rows[0].updated,
fields,

@@ -327,0 +331,0 @@ };

@@ -10,2 +10,4 @@ import { LogInstance } from 'larvitutils';

passwordIsFalse: boolean;
created?: string;
updated?: string;
fields?: Record<string, string[]>;

@@ -20,2 +22,4 @@ };

passwordIsFalse: boolean;
created?: string;
updated?: string;
fields: Record<string, string[]>;

@@ -22,0 +26,0 @@ constructor(options: UserBaseOptions);

@@ -13,2 +13,4 @@ "use strict";

this.passwordIsFalse = options.passwordIsFalse;
this.created = options.created;
this.updated = options.updated;
this.fields = options.fields ?? {};

@@ -15,0 +17,0 @@ }

@@ -28,2 +28,4 @@ import { LogInstance } from 'larvitutils';

uuids?: string | string[];
createdAfter?: string;
updatedAfter?: string;
};

@@ -36,2 +38,4 @@ export type UserFields = {

username: string;
created?: string;
updated?: string;
fields: UserFields;

@@ -38,0 +42,0 @@ };

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

const helpers_1 = require("./helpers");
const luxon_1 = require("luxon");
const topLogPrefix = 'larvituser: users.ts';

@@ -44,2 +45,22 @@ class Users {

}
// Check createdAfter
if (options.createdAfter) {
if (isNaN(Date.parse(options.createdAfter))) {
sqlWhere += ' AND created IS NULL\n';
}
else {
sqlWhere += ' AND created >= ?\n';
dbFields.push(options.createdAfter);
}
}
// Check updatedAfter
if (options.updatedAfter) {
if (isNaN(Date.parse(options.updatedAfter))) {
sqlWhere += ' AND created IS NULL\n';
}
else {
sqlWhere += ' AND updated >= ?\n';
dbFields.push(options.updatedAfter);
}
}
// Build where-statement

@@ -219,2 +240,28 @@ if (options.matchExistingFields && options.matchExistingFields.length) {

};
if (row.created instanceof Date) {
user.created = luxon_1.DateTime
.fromJSDate(row.created)
.toUTC()
.toISO() || undefined;
}
else {
// We do this extra conversion since mariadb returns non-ISO format
// NOTE: THIS ASSUMES THAT MARIADB IS CONFIGURED FOR UTC TIMEZONE
// for a proper solution we have to look at the timezone in DB conf and
// handle it accordingly.
user.created = row.created ? `${row.created.replace(' ', 'T')}.000Z` : undefined;
}
if (row.updated instanceof Date) {
user.updated = luxon_1.DateTime
.fromJSDate(row.updated)
.toUTC()
.toISO() || undefined;
}
else {
// We do this extra conversion since mariadb returns non-ISO format
// NOTE: THIS ASSUMES THAT MARIADB IS CONFIGURED FOR UTC TIMEZONE
// for a proper solution we have to look at the timezone in DB conf and
// handle it accordingly.
user.updated = row.updated ? `${row.updated.replace(' ', 'T')}.000Z` : user.created;
}
users.push(user);

@@ -221,0 +268,0 @@ }

4

package.json
{
"name": "larvituser",
"version": "0.23.40",
"version": "0.24.0",
"author": {

@@ -14,2 +14,3 @@ "name": "Mikael 'Lilleman' Göransson",

"larvitutils": "5.1.123",
"luxon": "^3.1.1",
"uuid": "11.0.3"

@@ -21,2 +22,3 @@ },

"@types/bcryptjs": "2.4.6",
"@types/luxon": "^3.1.0",
"@types/mocha": "10.0.10",

@@ -23,0 +25,0 @@ "@types/node": "22.10.2",

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

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