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

@fxjs/orm-property

Package Overview
Dependencies
Maintainers
2
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@fxjs/orm-property - npm Package Compare versions

Comparing version 0.3.2 to 0.3.3-alpha.0

42

lib/transformers/mysql.js

@@ -16,2 +16,3 @@ Object.defineProperty(exports, "__esModule", { value: true });

function colInfoToProperty(colInfo) {
var _a, _b;
const property = {};

@@ -21,18 +22,20 @@ colInfo = Object.assign({}, colInfo);

let Type = colInfo.Type + '';
if (Type.indexOf(" ") > 0) {
colInfo.SubType = Type.substr(Type.indexOf(" ") + 1).split(/\s+/);
Type = Type.substr(0, Type.indexOf(" "));
const spaceIdx = Type.indexOf(" ");
if (spaceIdx > 0) {
colInfo.SubType = Type.slice(spaceIdx + 1).split(/\s+/);
Type = Type.slice(0, spaceIdx);
}
// match_result
let [_, _type, _size] = Type.match(/^(.+)\((\d+)\)$/) || [];
if (_) {
if (_)
colInfo.Size = parseInt(_size, 10);
Type = _type;
}
const narrowType = !_ ? Type.toUpperCase() : _type.toUpperCase();
if (colInfo.Extra.toUpperCase() == "AUTO_INCREMENT") {
property.serial = true;
property.key = true;
property.unsigned = true;
}
if (colInfo.Key == "PRI") {
if (colInfo.Key === "PRI") {
property.primary = true;
property.key = true;
}

@@ -45,3 +48,3 @@ if (colInfo.Null.toUpperCase() == "NO") {

}
switch (Type.toUpperCase()) {
switch (narrowType) {
case "SMALLINT":

@@ -53,4 +56,6 @@ case "INTEGER":

property.size = 4; // INT
if ((_a = colInfo.SubType) === null || _a === void 0 ? void 0 : _a.includes('unsigned'))
property.unsigned = true;
for (let k in columnSizes.integer) {
if (columnSizes.integer[k] == Type.toUpperCase()) {
if (columnSizes.integer[k] == narrowType) {
property.size = k;

@@ -65,4 +70,6 @@ break;

property.rational = true;
if ((_b = colInfo.SubType) === null || _b === void 0 ? void 0 : _b.includes('unsigned'))
property.unsigned = true;
for (let k in columnSizes.floating) {
if (columnSizes.floating[k] == Type.toUpperCase()) {
if (columnSizes.floating[k] == narrowType) {
property.size = k;

@@ -104,3 +111,3 @@ break;

default:
let [_2, _enum_value_str] = Type.match(/^enum\('(.+)'\)$/) || [];
let [_2, _enum_value_str] = narrowType.toLowerCase().match(/^enum\('(.+)'\)$/) || [];
if (_2) {

@@ -111,3 +118,3 @@ property.type = "enum";

}
throw new Error(`Unknown property type '${Type}'`);
throw new Error(`Unknown property type '${narrowType}'`);
}

@@ -155,5 +162,16 @@ if (property.serial) {

result.typeValue = columnSizes.integer[property.size] || columnSizes.integer[4 /* INTEGER */];
if (property.unsigned) {
result.typeValue += " UNSIGNED";
}
break;
/**
* @notice As of MySQL 8.0.17, the UNSIGNED attribute is deprecated for columns of type FLOAT, DOUBLE, and DECIMAL (and any synonyms); you should expect support for it to be removed in a future version of MySQL. Consider using a simple CHECK constraint instead for such columns.
*
* @see https://dev.mysql.com/doc/refman/8.0/en/numeric-type-syntax.html
*/
case "number":
result.typeValue = columnSizes.floating[property.size] || columnSizes.floating[4 /* INTEGER */];
if (property.unsigned) {
result.typeValue += " UNSIGNED";
}
break;

@@ -160,0 +178,0 @@ case "serial":

@@ -39,2 +39,4 @@ Object.defineProperty(exports, "__esModule", { value: true });

property.type = "serial";
property.key = true;
property.serial = true;
}

@@ -41,0 +43,0 @@ else {

@@ -28,2 +28,4 @@ Object.defineProperty(exports, "__esModule", { value: true });

prop.type = "serial";
prop.serial = true;
prop.key = true;
}

@@ -30,0 +32,0 @@ else {

{
"name": "@fxjs/orm-property",
"version": "0.3.2",
"version": "0.3.3-alpha.0",
"private": false,

@@ -35,5 +35,5 @@ "description": "",

"dependencies": {
"@fxjs/sql-query": "^0.9.2"
"@fxjs/sql-query": "^0.9.3-alpha.0"
},
"gitHead": "5a01697a13bd480d0fece95ace55f1b968c65455"
"gitHead": "34ef694b334be3f4af278b2ed3ce32f2008117ce"
}
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