sequelize-typescript-generator 8.0.0 → 8.1.2
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/README.md +1 -1
- package/build/builders/ModelBuilder.js +3 -1
- package/build/builders/utils.js +7 -2
- package/package.json +10 -10
package/README.md
CHANGED
|
@@ -148,7 +148,9 @@ class ModelBuilder extends Builder_1.Builder {
|
|
|
148
148
|
const attributesInterfaceName = `${name}Attributes`;
|
|
149
149
|
if (strict) {
|
|
150
150
|
generatedCode += '\n';
|
|
151
|
-
const attributesInterface = ts.createInterfaceDeclaration(undefined,
|
|
151
|
+
const attributesInterface = ts.createInterfaceDeclaration(undefined, [
|
|
152
|
+
ts.createToken(ts.SyntaxKind.ExportKeyword),
|
|
153
|
+
], ts.createIdentifier(attributesInterfaceName), undefined, undefined, [
|
|
152
154
|
...(Object.values(columns).map(c => {
|
|
153
155
|
var _a;
|
|
154
156
|
return ts.createPropertySignature(undefined, ts.createIdentifier(c.name), c.autoIncrement || c.allowNull || c.defaultValue !== undefined ?
|
package/build/builders/utils.js
CHANGED
|
@@ -25,7 +25,9 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
26
|
exports.generateArrowDecorator = exports.generateObjectLiteralDecorator = exports.generateIndexExport = exports.generateNamedImports = exports.nodeToString = void 0;
|
|
27
27
|
const ts = __importStar(require("typescript"));
|
|
28
|
-
const printer = ts.createPrinter({
|
|
28
|
+
const printer = ts.createPrinter({
|
|
29
|
+
newLine: ts.NewLineKind.LineFeed,
|
|
30
|
+
});
|
|
29
31
|
/**
|
|
30
32
|
* Returns string representation of typescript node
|
|
31
33
|
* @param node
|
|
@@ -33,7 +35,10 @@ const printer = ts.createPrinter({ newLine: ts.NewLineKind.LineFeed });
|
|
|
33
35
|
*/
|
|
34
36
|
const nodeToString = (node) => {
|
|
35
37
|
const sourceFile = ts.createSourceFile(`source.ts`, ``, ts.ScriptTarget.Latest, false, ts.ScriptKind.TS);
|
|
36
|
-
|
|
38
|
+
const sourceCode = printer.printNode(ts.EmitHint.Unspecified, node, sourceFile);
|
|
39
|
+
// Typescript automatically escape non ASCII characters like 哈 or 😂. This is a workaround to render them properly.
|
|
40
|
+
// Reference: https://github.com/microsoft/TypeScript/issues/36174
|
|
41
|
+
return unescape(sourceCode.replace(/\\u/g, "%u"));
|
|
37
42
|
};
|
|
38
43
|
exports.nodeToString = nodeToString;
|
|
39
44
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "sequelize-typescript-generator",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.1.2",
|
|
4
4
|
"description": "Automatically generates typescript models compatible with sequelize-typescript library (https://www.npmjs.com/package/sequelize-typescript) directly from your source database.",
|
|
5
5
|
"main": "build/index.js",
|
|
6
6
|
"types": "build/index.d.ts",
|
|
@@ -36,9 +36,9 @@
|
|
|
36
36
|
"devDependencies": {
|
|
37
37
|
"@types/bluebird": "^3.5.36",
|
|
38
38
|
"@types/jest": "^27.4.1",
|
|
39
|
-
"@types/node": "^17.0.
|
|
39
|
+
"@types/node": "^17.0.23",
|
|
40
40
|
"@types/pluralize": "0.0.29",
|
|
41
|
-
"@types/validator": "^13.7.
|
|
41
|
+
"@types/validator": "^13.7.2",
|
|
42
42
|
"@types/yargs": "^17.0.10",
|
|
43
43
|
"jest": "^27.5.1",
|
|
44
44
|
"mariadb": "^3.0.0",
|
|
@@ -47,21 +47,21 @@
|
|
|
47
47
|
"pg-hstore": "^2.3.4",
|
|
48
48
|
"reflect-metadata": "^0.1.13",
|
|
49
49
|
"sqlite3": "^4.2.0",
|
|
50
|
-
"tedious": "^14.
|
|
51
|
-
"ts-jest": "^27.1.
|
|
50
|
+
"tedious": "^14.4.0",
|
|
51
|
+
"ts-jest": "^27.1.4",
|
|
52
52
|
"ts-node-dev": "^1.1.8",
|
|
53
|
-
"typescript": "^4.6.
|
|
53
|
+
"typescript": "^4.6.3",
|
|
54
54
|
"wkx": "^0.5.0"
|
|
55
55
|
},
|
|
56
56
|
"dependencies": {
|
|
57
57
|
"@types/eslint": "^8.4.1",
|
|
58
|
-
"@typescript-eslint/parser": "^5.
|
|
58
|
+
"@typescript-eslint/parser": "^5.18.0",
|
|
59
59
|
"change-case": "^4.1.2",
|
|
60
|
-
"eslint": "^8.
|
|
60
|
+
"eslint": "^8.12.0",
|
|
61
61
|
"pluralize": "^8.0.0",
|
|
62
|
-
"sequelize": "^6.
|
|
62
|
+
"sequelize": "^6.18.0",
|
|
63
63
|
"sequelize-typescript": "^2.1.3",
|
|
64
|
-
"yargs": "^17.
|
|
64
|
+
"yargs": "^17.4.0"
|
|
65
65
|
},
|
|
66
66
|
"keywords": [
|
|
67
67
|
"sequelize",
|