sedentary 0.0.53 → 0.0.54
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/index.js +10 -3
- package/dist/es/index.js +10 -3
- package/dist/types/index.d.ts +1 -0
- package/package.json +7 -4
package/dist/cjs/index.js
CHANGED
|
@@ -57,8 +57,15 @@ class Sedentary {
|
|
|
57
57
|
const { attributeName, fieldName, tableName, type, [db_1.base]: _base, [db_1.size]: _size } = attribute;
|
|
58
58
|
return new db_1.Type({ [db_1.base]: _base, foreignKey: { attributeName, fieldName, options, tableName }, [db_1.size]: _size, type });
|
|
59
59
|
}
|
|
60
|
+
Float(_size) {
|
|
61
|
+
const message = "Sedentary.Float: 'size' argument: Wrong value, expected 4 or 8";
|
|
62
|
+
_size = _size ? this.checkSize(_size, message) : 8;
|
|
63
|
+
if (_size !== 4 && _size !== 8)
|
|
64
|
+
throw new Error(message);
|
|
65
|
+
return new db_1.Type({ [db_1.base]: Number, [db_1.size]: _size, type: "FLOAT" });
|
|
66
|
+
}
|
|
60
67
|
Int(_size) {
|
|
61
|
-
const message = "Sedentary.
|
|
68
|
+
const message = "Sedentary.Int: 'size' argument: Wrong value, expected 2 or 4";
|
|
62
69
|
_size = _size ? this.checkSize(_size, message) : 4;
|
|
63
70
|
if (_size !== 2 && _size !== 4)
|
|
64
71
|
throw new Error(message);
|
|
@@ -77,7 +84,7 @@ class Sedentary {
|
|
|
77
84
|
return new db_1.Type({ [db_1.base]: undefined, type: "NONE" });
|
|
78
85
|
}
|
|
79
86
|
VarChar(_size) {
|
|
80
|
-
const message = "Sedentary.
|
|
87
|
+
const message = "Sedentary.VarChar: 'size' argument: Wrong value, expected positive integer";
|
|
81
88
|
_size = _size ? this.checkSize(_size, message) : undefined;
|
|
82
89
|
return new db_1.Type({ [db_1.base]: String, [db_1.size]: _size, type: "VARCHAR" });
|
|
83
90
|
}
|
|
@@ -272,7 +279,7 @@ class Sedentary {
|
|
|
272
279
|
const call = (defaultValue, fieldName, notNull, unique, func, message1, message2) => {
|
|
273
280
|
if (func === this.FKey)
|
|
274
281
|
throw new Error(`${message1} 'this.FKey' can't be used directly`);
|
|
275
|
-
if (![this.Boolean, this.DateTime, this.Int, this.JSON, this.Int8, this.None, this.Number, this.VarChar].includes(func))
|
|
282
|
+
if (![this.Boolean, this.DateTime, this.Float, this.Int, this.JSON, this.Int8, this.None, this.Number, this.VarChar].includes(func))
|
|
276
283
|
throw new Error(`${message1} ${message2}`);
|
|
277
284
|
return new db_1.Attribute({ attributeName, defaultValue, fieldName, modelName, notNull, tableName, unique, ...func() });
|
|
278
285
|
};
|
package/dist/es/index.js
CHANGED
|
@@ -45,8 +45,15 @@ export class Sedentary {
|
|
|
45
45
|
const { attributeName, fieldName, tableName, type, [base]: _base, [size]: _size } = attribute;
|
|
46
46
|
return new Type({ [base]: _base, foreignKey: { attributeName, fieldName, options, tableName }, [size]: _size, type });
|
|
47
47
|
}
|
|
48
|
+
Float(_size) {
|
|
49
|
+
const message = "Sedentary.Float: 'size' argument: Wrong value, expected 4 or 8";
|
|
50
|
+
_size = _size ? this.checkSize(_size, message) : 8;
|
|
51
|
+
if (_size !== 4 && _size !== 8)
|
|
52
|
+
throw new Error(message);
|
|
53
|
+
return new Type({ [base]: Number, [size]: _size, type: "FLOAT" });
|
|
54
|
+
}
|
|
48
55
|
Int(_size) {
|
|
49
|
-
const message = "Sedentary.
|
|
56
|
+
const message = "Sedentary.Int: 'size' argument: Wrong value, expected 2 or 4";
|
|
50
57
|
_size = _size ? this.checkSize(_size, message) : 4;
|
|
51
58
|
if (_size !== 2 && _size !== 4)
|
|
52
59
|
throw new Error(message);
|
|
@@ -65,7 +72,7 @@ export class Sedentary {
|
|
|
65
72
|
return new Type({ [base]: undefined, type: "NONE" });
|
|
66
73
|
}
|
|
67
74
|
VarChar(_size) {
|
|
68
|
-
const message = "Sedentary.
|
|
75
|
+
const message = "Sedentary.VarChar: 'size' argument: Wrong value, expected positive integer";
|
|
69
76
|
_size = _size ? this.checkSize(_size, message) : undefined;
|
|
70
77
|
return new Type({ [base]: String, [size]: _size, type: "VARCHAR" });
|
|
71
78
|
}
|
|
@@ -260,7 +267,7 @@ export class Sedentary {
|
|
|
260
267
|
const call = (defaultValue, fieldName, notNull, unique, func, message1, message2) => {
|
|
261
268
|
if (func === this.FKey)
|
|
262
269
|
throw new Error(`${message1} 'this.FKey' can't be used directly`);
|
|
263
|
-
if (![this.Boolean, this.DateTime, this.Int, this.JSON, this.Int8, this.None, this.Number, this.VarChar].includes(func))
|
|
270
|
+
if (![this.Boolean, this.DateTime, this.Float, this.Int, this.JSON, this.Int8, this.None, this.Number, this.VarChar].includes(func))
|
|
264
271
|
throw new Error(`${message1} ${message2}`);
|
|
265
272
|
return new Attribute({ attributeName, defaultValue, fieldName, modelName, notNull, tableName, unique, ...func() });
|
|
266
273
|
};
|
package/dist/types/index.d.ts
CHANGED
|
@@ -118,6 +118,7 @@ export declare class Sedentary<D extends DB<T>, T extends Transaction> {
|
|
|
118
118
|
Boolean(): Type<boolean, unknown>;
|
|
119
119
|
DateTime(): Type<Date, unknown>;
|
|
120
120
|
FKey<T, E extends EntryBase>(attribute: Attribute<T, E>, options?: ForeignKeyOptions): Type<T, E>;
|
|
121
|
+
Float(_size?: number): Type<number, unknown>;
|
|
121
122
|
Int(_size?: number): Type<number, unknown>;
|
|
122
123
|
Int8(): Type<bigint, unknown>;
|
|
123
124
|
JSON<T>(): Type<T, unknown>;
|
package/package.json
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
],
|
|
8
8
|
"description": "The ORM which never needs to migrate",
|
|
9
9
|
"engines": {
|
|
10
|
-
"node": ">=
|
|
10
|
+
"node": ">=18.0"
|
|
11
11
|
},
|
|
12
12
|
"funding": {
|
|
13
13
|
"url": "https://blockchain.info/address/1Md9WFAHrXTb3yPBwQWmUfv2RmzrtbHioB"
|
|
@@ -27,10 +27,13 @@
|
|
|
27
27
|
"module": "./dist/es/index.js",
|
|
28
28
|
"name": "sedentary",
|
|
29
29
|
"optionalDependencies": {
|
|
30
|
-
"fsevents": "2.3.
|
|
30
|
+
"fsevents": "^2.3.3"
|
|
31
31
|
},
|
|
32
32
|
"readmeFilename": "README.md",
|
|
33
|
-
"repository":
|
|
33
|
+
"repository": {
|
|
34
|
+
"type": "git",
|
|
35
|
+
"url": "git+https://github.com/iccicci/sedentary.git"
|
|
36
|
+
},
|
|
34
37
|
"scripts": {
|
|
35
38
|
"build": "make build",
|
|
36
39
|
"coverage": "jest --coverage --no-cache --runInBand",
|
|
@@ -58,5 +61,5 @@
|
|
|
58
61
|
}
|
|
59
62
|
},
|
|
60
63
|
"types": "./dist/types/index.d.ts",
|
|
61
|
-
"version": "0.0.
|
|
64
|
+
"version": "0.0.54"
|
|
62
65
|
}
|