Comparing version 0.0.53 to 0.0.54
@@ -60,4 +60,11 @@ "use strict"; | ||
} | ||
Float(_size) { | ||
const message = "Sedentary.Float: 'size' argument: Wrong value, expected 4 or 8"; | ||
_size = _size ? this.checkSize(_size, message) : 8; | ||
if (_size !== 4 && _size !== 8) | ||
throw new Error(message); | ||
return new db_1.Type({ [db_1.base]: Number, [db_1.size]: _size, type: "FLOAT" }); | ||
} | ||
Int(_size) { | ||
const message = "Sedentary.INT: 'size' argument: Wrong value, expected 2 or 4"; | ||
const message = "Sedentary.Int: 'size' argument: Wrong value, expected 2 or 4"; | ||
_size = _size ? this.checkSize(_size, message) : 4; | ||
@@ -81,3 +88,3 @@ if (_size !== 2 && _size !== 4) | ||
VarChar(_size) { | ||
const message = "Sedentary.VARCHAR: 'size' argument: Wrong value, expected positive integer"; | ||
const message = "Sedentary.VarChar: 'size' argument: Wrong value, expected positive integer"; | ||
_size = _size ? this.checkSize(_size, message) : undefined; | ||
@@ -277,3 +284,3 @@ return new db_1.Type({ [db_1.base]: String, [db_1.size]: _size, type: "VARCHAR" }); | ||
throw new Error(`${message1} 'this.FKey' can't be used directly`); | ||
if (![this.Boolean, this.DateTime, this.Int, this.JSON, this.Int8, this.None, this.Number, this.VarChar].includes(func)) | ||
if (![this.Boolean, this.DateTime, this.Float, this.Int, this.JSON, this.Int8, this.None, this.Number, this.VarChar].includes(func)) | ||
throw new Error(`${message1} ${message2}`); | ||
@@ -280,0 +287,0 @@ return new db_1.Attribute({ attributeName, defaultValue, fieldName, modelName, notNull, tableName, unique, ...func() }); |
@@ -48,4 +48,11 @@ import { actions, Attribute, base, EntryBase, loaded, size, Table, Transaction, transaction, Type } from "./db"; | ||
} | ||
Float(_size) { | ||
const message = "Sedentary.Float: 'size' argument: Wrong value, expected 4 or 8"; | ||
_size = _size ? this.checkSize(_size, message) : 8; | ||
if (_size !== 4 && _size !== 8) | ||
throw new Error(message); | ||
return new Type({ [base]: Number, [size]: _size, type: "FLOAT" }); | ||
} | ||
Int(_size) { | ||
const message = "Sedentary.INT: 'size' argument: Wrong value, expected 2 or 4"; | ||
const message = "Sedentary.Int: 'size' argument: Wrong value, expected 2 or 4"; | ||
_size = _size ? this.checkSize(_size, message) : 4; | ||
@@ -69,3 +76,3 @@ if (_size !== 2 && _size !== 4) | ||
VarChar(_size) { | ||
const message = "Sedentary.VARCHAR: 'size' argument: Wrong value, expected positive integer"; | ||
const message = "Sedentary.VarChar: 'size' argument: Wrong value, expected positive integer"; | ||
_size = _size ? this.checkSize(_size, message) : undefined; | ||
@@ -265,3 +272,3 @@ return new Type({ [base]: String, [size]: _size, type: "VARCHAR" }); | ||
throw new Error(`${message1} 'this.FKey' can't be used directly`); | ||
if (![this.Boolean, this.DateTime, this.Int, this.JSON, this.Int8, this.None, this.Number, this.VarChar].includes(func)) | ||
if (![this.Boolean, this.DateTime, this.Float, this.Int, this.JSON, this.Int8, this.None, this.Number, this.VarChar].includes(func)) | ||
throw new Error(`${message1} ${message2}`); | ||
@@ -268,0 +275,0 @@ return new Attribute({ attributeName, defaultValue, fieldName, modelName, notNull, tableName, unique, ...func() }); |
@@ -121,2 +121,3 @@ import { Attribute, DB, EntryBase, ForeignKeyOptions, Transaction, Type } from "./db"; | ||
FKey<T, E extends EntryBase>(attribute: Attribute<T, E>, options?: ForeignKeyOptions): Type<T, E>; | ||
Float(_size?: number): Type<number, unknown>; | ||
Int(_size?: number): Type<number, unknown>; | ||
@@ -123,0 +124,0 @@ Int8(): Type<bigint, unknown>; |
@@ -10,3 +10,3 @@ { | ||
"engines": { | ||
"node": ">=14.0" | ||
"node": ">=18.0" | ||
}, | ||
@@ -31,6 +31,9 @@ "funding": { | ||
"optionalDependencies": { | ||
"fsevents": "2.3.2" | ||
"fsevents": "^2.3.3" | ||
}, | ||
"readmeFilename": "README.md", | ||
"repository": "https://github.com/iccicci/sedentary", | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/iccicci/sedentary.git" | ||
}, | ||
"scripts": { | ||
@@ -63,3 +66,3 @@ "build": "make build", | ||
"types": "./dist/types/index.d.ts", | ||
"version": "0.0.53" | ||
"version": "0.0.54" | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
93245
1706
0