sedentary 0.0.33 → 0.0.36
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 +7 -1
- package/dist/es/index.js +7 -1
- package/dist/types/index.d.ts +2 -0
- package/package.json +3 -3
package/dist/cjs/index.js
CHANGED
|
@@ -39,6 +39,9 @@ class Sedentary {
|
|
|
39
39
|
this.log = log ? log : log === null ? () => { } : console.log;
|
|
40
40
|
this.doSync = sync;
|
|
41
41
|
}
|
|
42
|
+
BOOLEAN() {
|
|
43
|
+
return new db_1.Type({ base: Boolean, type: "BOOLEAN" });
|
|
44
|
+
}
|
|
42
45
|
DATETIME() {
|
|
43
46
|
return new db_1.Type({ base: Date, type: "DATETIME" });
|
|
44
47
|
}
|
|
@@ -56,6 +59,9 @@ class Sedentary {
|
|
|
56
59
|
INT8() {
|
|
57
60
|
return new db_1.Type({ base: BigInt, size: 8, type: "INT8" });
|
|
58
61
|
}
|
|
62
|
+
NUMBER() {
|
|
63
|
+
return new db_1.Type({ base: Number, type: "NUMBER" });
|
|
64
|
+
}
|
|
59
65
|
VARCHAR(size) {
|
|
60
66
|
const message = "Sedentary.VARCHAR: 'size' argument: Wrong value, expected positive integer";
|
|
61
67
|
size = size ? this.checkSize(size, message) : undefined;
|
|
@@ -247,7 +253,7 @@ class Sedentary {
|
|
|
247
253
|
const call = (defaultValue, fieldName, notNull, unique, func, message1, message2) => {
|
|
248
254
|
if (func === this.FKEY)
|
|
249
255
|
throw new Error(`${message1} 'this.FKEY' can't be used directly`);
|
|
250
|
-
if (
|
|
256
|
+
if (![this.BOOLEAN, this.DATETIME, this.NUMBER, this.INT, this.INT8, this.VARCHAR].includes(func))
|
|
251
257
|
throw new Error(`${message1} ${message2}`);
|
|
252
258
|
return new db_1.Attribute({ attributeName, defaultValue, fieldName, modelName, notNull, tableName, unique, ...func() });
|
|
253
259
|
};
|
package/dist/es/index.js
CHANGED
|
@@ -33,6 +33,9 @@ export class Sedentary {
|
|
|
33
33
|
this.log = log ? log : log === null ? () => { } : console.log;
|
|
34
34
|
this.doSync = sync;
|
|
35
35
|
}
|
|
36
|
+
BOOLEAN() {
|
|
37
|
+
return new Type({ base: Boolean, type: "BOOLEAN" });
|
|
38
|
+
}
|
|
36
39
|
DATETIME() {
|
|
37
40
|
return new Type({ base: Date, type: "DATETIME" });
|
|
38
41
|
}
|
|
@@ -50,6 +53,9 @@ export class Sedentary {
|
|
|
50
53
|
INT8() {
|
|
51
54
|
return new Type({ base: BigInt, size: 8, type: "INT8" });
|
|
52
55
|
}
|
|
56
|
+
NUMBER() {
|
|
57
|
+
return new Type({ base: Number, type: "NUMBER" });
|
|
58
|
+
}
|
|
53
59
|
VARCHAR(size) {
|
|
54
60
|
const message = "Sedentary.VARCHAR: 'size' argument: Wrong value, expected positive integer";
|
|
55
61
|
size = size ? this.checkSize(size, message) : undefined;
|
|
@@ -241,7 +247,7 @@ export class Sedentary {
|
|
|
241
247
|
const call = (defaultValue, fieldName, notNull, unique, func, message1, message2) => {
|
|
242
248
|
if (func === this.FKEY)
|
|
243
249
|
throw new Error(`${message1} 'this.FKEY' can't be used directly`);
|
|
244
|
-
if (
|
|
250
|
+
if (![this.BOOLEAN, this.DATETIME, this.NUMBER, this.INT, this.INT8, this.VARCHAR].includes(func))
|
|
245
251
|
throw new Error(`${message1} ${message2}`);
|
|
246
252
|
return new Attribute({ attributeName, defaultValue, fieldName, modelName, notNull, tableName, unique, ...func() });
|
|
247
253
|
};
|
package/dist/types/index.d.ts
CHANGED
|
@@ -103,10 +103,12 @@ export declare class Sedentary<D extends DB<T>, T extends Transaction> {
|
|
|
103
103
|
protected log: (message: string) => void;
|
|
104
104
|
private models;
|
|
105
105
|
constructor(options?: SedentaryOptions);
|
|
106
|
+
BOOLEAN(): Type<boolean, unknown>;
|
|
106
107
|
DATETIME(): Type<Date, unknown>;
|
|
107
108
|
FKEY<N extends Natural, E extends EntryBase>(attribute: Attribute<N, E>, options?: ForeignKeyOptions): Type<N, E>;
|
|
108
109
|
INT(size?: number): Type<number, unknown>;
|
|
109
110
|
INT8(): Type<BigInt, unknown>;
|
|
111
|
+
NUMBER(): Type<number, unknown>;
|
|
110
112
|
VARCHAR(size?: number): Type<string, unknown>;
|
|
111
113
|
private checkDB;
|
|
112
114
|
private checkOrderBy;
|
package/package.json
CHANGED
|
@@ -66,7 +66,7 @@
|
|
|
66
66
|
"compilerOptions": {
|
|
67
67
|
"alwaysStrict": true,
|
|
68
68
|
"esModuleInterop": true,
|
|
69
|
-
"moduleResolution": "
|
|
69
|
+
"moduleResolution": "Node",
|
|
70
70
|
"noImplicitAny": true,
|
|
71
71
|
"noImplicitReturns": true,
|
|
72
72
|
"noImplicitThis": true,
|
|
@@ -75,9 +75,9 @@
|
|
|
75
75
|
"strictFunctionTypes": true,
|
|
76
76
|
"strictNullChecks": true,
|
|
77
77
|
"strictPropertyInitialization": true,
|
|
78
|
-
"target": "
|
|
78
|
+
"target": "ESNext"
|
|
79
79
|
}
|
|
80
80
|
},
|
|
81
81
|
"types": "./dist/types/index.d.ts",
|
|
82
|
-
"version": "0.0.
|
|
82
|
+
"version": "0.0.36"
|
|
83
83
|
}
|