velocious 1.0.92 → 1.0.94

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.
Files changed (35) hide show
  1. package/package.json +1 -1
  2. package/src/application.js +19 -0
  3. package/src/cli/base-command.js +1 -0
  4. package/src/cli/commands/db/migrate.js +2 -0
  5. package/src/cli/commands/generate/base-models.js +7 -0
  6. package/src/cli/commands/generate/model.js +1 -1
  7. package/src/configuration-resolver.js +6 -3
  8. package/src/configuration.js +27 -4
  9. package/src/database/drivers/base-column.js +69 -0
  10. package/src/database/drivers/base-columns-index.js +19 -0
  11. package/src/database/drivers/base-foreign-key.js +12 -0
  12. package/src/database/drivers/base-table.js +32 -0
  13. package/src/database/drivers/base.js +125 -3
  14. package/src/database/drivers/mysql/index.js +89 -11
  15. package/src/database/migrator.js +17 -2
  16. package/src/database/query/drop-table-base.js +8 -0
  17. package/src/database/query/index.js +42 -0
  18. package/src/database/query-parser/from-parser.js +17 -6
  19. package/src/database/query-parser/group-parser.js +21 -8
  20. package/src/database/record/index.js +5 -0
  21. package/src/database/record/relationships/base.js +18 -3
  22. package/src/database/table-data/index.js +198 -6
  23. package/src/environment-handlers/base.js +58 -0
  24. package/src/environment-handlers/browser.js +0 -24
  25. package/src/environment-handlers/node/cli/commands/generate/base-models.js +80 -0
  26. package/src/environment-handlers/node.js +6 -1
  27. package/src/initializer.js +4 -0
  28. package/src/logger.js +54 -2
  29. package/src/routes/base-route.js +25 -4
  30. package/src/routes/get-route.js +3 -1
  31. package/src/routes/namespace-route.js +3 -1
  32. package/src/routes/post-route.js +3 -1
  33. package/src/routes/resource-route.js +3 -1
  34. package/src/utils/backtrace-cleaner.js +10 -0
  35. package/src/database/drivers/mysql/connect-connection.js +0 -12
@@ -1,24 +1,37 @@
1
- import {digs} from "diggerize"
1
+ // @ts-check
2
+
3
+ import restArgsError from "../../utils/rest-args-error.js"
2
4
 
3
5
  export default class VelociousDatabaseQueryParserFromParser {
4
- constructor({pretty, query}) {
6
+ /**
7
+ * @param {object} args
8
+ * @param {boolean} args.pretty
9
+ * @param {import("../query/index.js").default} args.query
10
+ */
11
+ constructor({pretty, query, ...restArgs}) {
12
+ restArgsError(restArgs)
13
+
5
14
  this.pretty = pretty
6
15
  this.query = query
7
16
  }
8
17
 
18
+ /**
19
+ * @returns {string}
20
+ */
9
21
  toSql() {
10
- const {pretty, query} = digs(this, "pretty", "query")
22
+ const {pretty, query} = this
23
+ const groups = query.getGroups()
11
24
 
12
- if (query._groups.length == 0) {
25
+ if (groups.length == 0) {
13
26
  return ""
14
27
  }
15
28
 
16
29
  let sql = " GROUP BY"
17
30
 
18
- for (const groupKey in query._groups) {
19
- const group = query._groups[groupKey]
31
+ for (const groupKey in groups) {
32
+ const group = groups[groupKey]
20
33
 
21
- if (groupKey > 0) {
34
+ if (typeof groupKey == "number" && groupKey > 0) {
22
35
  sql += ","
23
36
  }
24
37
 
@@ -31,7 +44,7 @@ export default class VelociousDatabaseQueryParserFromParser {
31
44
  if (typeof group == "string") {
32
45
  sql += group
33
46
  } else {
34
- sql += group.toSql()
47
+ throw new Error(`Unsupported group type: ${typeof group}`)
35
48
  }
36
49
  }
37
50
 
@@ -306,6 +306,7 @@ class VelociousDatabaseRecord {
306
306
  * Adds a has-many-relationship to the model class.
307
307
  * @param {string} relationshipName The name of the relationship (e.g. "posts")
308
308
  * @param {object} options The options for the relationship (e.g. {className: "Post"})
309
+ * @returns {void}
309
310
  */
310
311
  static hasMany(relationshipName, options = {}) {
311
312
  return this._defineRelationship(relationshipName, Object.assign({type: "hasMany"}, options))
@@ -315,6 +316,7 @@ class VelociousDatabaseRecord {
315
316
  * Adds a has-one-relationship to the model class.
316
317
  * @param {string} relationshipName The name of the relationship (e.g. "post")
317
318
  * @param {object} options The options for the relationship (e.g. {className: "Post"})
319
+ * @returns {void}
318
320
  */
319
321
  static hasOne(relationshipName, options = {}) {
320
322
  return this._defineRelationship(relationshipName, Object.assign({type: "hasOne"}, options))
@@ -526,6 +528,9 @@ class VelociousDatabaseRecord {
526
528
  return this._columnNames
527
529
  }
528
530
 
531
+ /**
532
+ * @returns {import("../drivers/base-table.js").default}
533
+ */
529
534
  static _getTable() {
530
535
  if (!this._table) throw new Error(`${this.name} hasn't been initialized yet`)
531
536
 
@@ -1,7 +1,22 @@
1
1
  import restArgsError from "../../../utils/rest-args-error.js"
2
2
 
3
3
  export default class VelociousDatabaseRecordBaseRelationship {
4
- constructor({className, configuration, dependent, foreignKey, inverseOf, klass, modelClass, primaryKey = "id", relationshipName, through, type, ...restArgs}) { // eslint-disable-line no-unused-vars
4
+ /**
5
+ * @param {object} args
6
+ * @param {string} args.className
7
+ * @param {import("../../../configuration.js").default} args.configuration
8
+ * @param {string} args.dependent
9
+ * @param {boolean|object} args.foreignKey
10
+ * @param {string} args.inverseOf
11
+ * @param {typeof import("../index.js").default} args.klass
12
+ * @param {typeof import("../index.js").default} args.modelClass
13
+ * @param {string} args.primaryKey
14
+ * @param {boolean} args.polymorphic
15
+ * @param {string} args.relationshipName
16
+ * @param {string} args.through
17
+ * @param {string} args.type
18
+ */
19
+ constructor({className, configuration, dependent, foreignKey, inverseOf, klass, modelClass, primaryKey = "id", polymorphic, relationshipName, through, type, ...restArgs}) { // eslint-disable-line no-unused-vars
5
20
  restArgsError(restArgs)
6
21
 
7
22
  if (!modelClass) throw new Error(`'modelClass' wasn't given for ${relationshipName}`)
@@ -14,6 +29,7 @@ export default class VelociousDatabaseRecordBaseRelationship {
14
29
  this._inverseOf
15
30
  this.klass = klass
16
31
  this.modelClass = modelClass
32
+ this._polymorphic = polymorphic
17
33
  this._primaryKey = primaryKey
18
34
  this.relationshipName = relationshipName
19
35
  this.through = through
@@ -42,8 +58,7 @@ export default class VelociousDatabaseRecordBaseRelationship {
42
58
  }
43
59
 
44
60
  /**
45
- * @template T extends import("../index.js").default
46
- * @returns {typeof T}
61
+ * @returns {typeof import("../index.js").default}
47
62
  */
48
63
  getModelClass() { return this.modelClass }
49
64
 
@@ -25,20 +25,37 @@ export default class TableData {
25
25
  */
26
26
  addColumn(name, args = {}) {
27
27
  if (name instanceof TableColumn) {
28
- this._columns.push(name)
28
+ this.getColumns().push(name)
29
29
  } else {
30
30
  const column = new TableColumn(name, args)
31
31
 
32
- this._columns.push(column)
32
+ this.getColumns().push(column)
33
33
  }
34
34
  }
35
35
 
36
+ /**
37
+ * @returns {TableColumn[]}
38
+ */
36
39
  getColumns() { return this._columns }
37
40
 
41
+ /**
42
+ * @param {import("./table-foreign-key.js").default} foreignKey
43
+ */
38
44
  addForeignKey(foreignKey) { this._foreignKeys.push(foreignKey) }
45
+
46
+ /**
47
+ * @returns {import("./table-foreign-key.js").default[]}
48
+ */
39
49
  getForeignKeys() { return this._foreignKeys }
40
50
 
51
+ /**
52
+ * @param {TableIndex} index
53
+ */
41
54
  addIndex(index) { this._indexes.push(index) }
55
+
56
+ /**
57
+ * @returns {TableIndex[]}
58
+ */
42
59
  getIndexes() { return this._indexes }
43
60
 
44
61
  /**
@@ -56,34 +73,209 @@ export default class TableData {
56
73
  * @returns {boolean}
57
74
  */
58
75
  getIfNotExists() { return this.args.ifNotExists }
76
+
77
+ /**
78
+ * @returns {TableReference[]}
79
+ */
59
80
  getReferences() { return this._references }
60
81
 
82
+ /**
83
+ * @param {string} name
84
+ * @param {object} args
85
+ * @param {boolean} args.autoIncrement
86
+ * @param {any} args.default
87
+ * @param {boolean} args.dropColumn
88
+ * @param {boolean|object} args.foreignKey
89
+ * @param {boolean|object} args.index
90
+ * @param {number} args.maxLength
91
+ * @param {boolean} args.null
92
+ * @param {boolean} args.primaryKey
93
+ * @returns {void}
94
+ */
61
95
  bigint(name, args = {}) { this.addColumn(name, Object.assign({isNewColumn: true, type: "bigint"}, args)) }
96
+
97
+ /**
98
+ * @param {string} name
99
+ * @param {object} args
100
+ * @param {boolean} args.autoIncrement
101
+ * @param {any} args.default
102
+ * @param {boolean} args.dropColumn
103
+ * @param {boolean|object} args.foreignKey
104
+ * @param {boolean|object} args.index
105
+ * @param {number} args.maxLength
106
+ * @param {boolean} args.null
107
+ * @param {boolean} args.primaryKey
108
+ * @returns {void}
109
+ */
62
110
  blob(name, args = {}) { this.addColumn(name, Object.assign({isNewColumn: true, type: "blob"}, args)) }
111
+
112
+ /**
113
+ * @param {string} name
114
+ * @param {object} args
115
+ * @param {boolean} args.autoIncrement
116
+ * @param {any} args.default
117
+ * @param {boolean} args.dropColumn
118
+ * @param {boolean|object} args.foreignKey
119
+ * @param {boolean|object} args.index
120
+ * @param {number} args.maxLength
121
+ * @param {boolean} args.null
122
+ * @param {boolean} args.primaryKey
123
+ * @returns {void}
124
+ */
63
125
  boolean(name, args) { this.addColumn(name, Object.assign({isNewColumn: true, type: "boolean"}, args)) }
126
+
127
+ /**
128
+ * @param {string} name
129
+ * @param {object} args
130
+ * @param {boolean} args.autoIncrement
131
+ * @param {any} args.default
132
+ * @param {boolean} args.dropColumn
133
+ * @param {boolean|object} args.foreignKey
134
+ * @param {boolean|object} args.index
135
+ * @param {number} args.maxLength
136
+ * @param {boolean} args.null
137
+ * @param {boolean} args.primaryKey
138
+ * @returns {void}
139
+ */
64
140
  datetime(name, args) { this.addColumn(name, Object.assign({isNewColumn: true, type: "datetime"}, args)) }
141
+
142
+ /**
143
+ * @param {string} name
144
+ * @param {object} args
145
+ * @param {boolean} args.autoIncrement
146
+ * @param {any} args.default
147
+ * @param {boolean} args.dropColumn
148
+ * @param {boolean|object} args.foreignKey
149
+ * @param {boolean|object} args.index
150
+ * @param {number} args.maxLength
151
+ * @param {boolean} args.null
152
+ * @param {boolean} args.primaryKey
153
+ * @returns {void}
154
+ */
65
155
  integer(name, args = {}) { this.addColumn(name, Object.assign({isNewColumn: true, type: "integer"}, args)) }
156
+
157
+ /**
158
+ * @param {string} name
159
+ * @param {object} args
160
+ * @param {boolean} args.autoIncrement
161
+ * @param {any} args.default
162
+ * @param {boolean} args.dropColumn
163
+ * @param {boolean|object} args.foreignKey
164
+ * @param {boolean|object} args.index
165
+ * @param {number} args.maxLength
166
+ * @param {boolean} args.null
167
+ * @param {boolean} args.primaryKey
168
+ * @returns {void}
169
+ */
170
+ json(name, args = {}) { this.addColumn(name, Object.assign({isNewColumn: true, type: "json"}, args)) }
171
+
172
+ /**
173
+ * @param {string} name
174
+ * @param {object} args
175
+ * @param {boolean} args.autoIncrement
176
+ * @param {any} args.default
177
+ * @param {boolean} args.dropColumn
178
+ * @param {boolean|object} args.foreignKey
179
+ * @param {boolean|object} args.index
180
+ * @param {number} args.maxLength
181
+ * @param {boolean} args.null
182
+ * @param {boolean} args.primaryKey
183
+ * @returns {void}
184
+ */
66
185
  tinyint(name, args = {}) { this.addColumn(name, Object.assign({isNewColumn: true, type: "tinyint"}, args)) }
67
186
 
187
+ /**
188
+ * @param {string} name
189
+ * @param {object} args
190
+ * @param {boolean} args.autoIncrement
191
+ * @param {any} args.default
192
+ * @param {boolean} args.dropColumn
193
+ * @param {boolean|object} args.foreignKey
194
+ * @param {boolean|object} args.index
195
+ * @param {number} args.maxLength
196
+ * @param {boolean} args.null
197
+ * @param {boolean} args.primaryKey
198
+ * @returns {void}
199
+ */
68
200
  references(name, args = {}) {
69
201
  const columnName = `${name}_id`
70
202
  const reference = new TableReference(name, args)
71
- const columnArgs = Object.assign({isNewColumn: true, type: "bigint"}, args)
203
+ const {polymorphic, ...restArgs} = args
204
+ const columnArgs = Object.assign({isNewColumn: true, type: "bigint"}, restArgs)
72
205
  const column = new TableColumn(columnName, columnArgs)
73
206
  const index = new TableIndex([column])
74
207
 
75
- this._columns.push(column)
76
- this._indexes.push(index)
77
- this._references.push(reference)
208
+ this.getColumns().push(column)
209
+ this.getIndexes().push(index)
210
+ this.getReferences().push(reference)
211
+
212
+ if (polymorphic) {
213
+ const typeColumnName = `${name}_type`
214
+ const typeColumn = new TableColumn(typeColumnName, {isNewColumn: true, type: "string"})
215
+
216
+ this.getColumns().push(typeColumn)
217
+ }
78
218
  }
79
219
 
220
+ /**
221
+ * @param {string} name
222
+ * @param {object} args
223
+ * @param {boolean} args.autoIncrement
224
+ * @param {any} args.default
225
+ * @param {boolean} args.dropColumn
226
+ * @param {boolean|object} args.foreignKey
227
+ * @param {boolean|object} args.index
228
+ * @param {number} args.maxLength
229
+ * @param {boolean} args.null
230
+ * @param {boolean} args.primaryKey
231
+ * @returns {void}
232
+ */
80
233
  string(name, args) { this.addColumn(name, Object.assign({isNewColumn: true, type: "string"}, args)) }
234
+
235
+ /**
236
+ * @param {string} name
237
+ * @param {object} args
238
+ * @param {boolean} args.autoIncrement
239
+ * @param {any} args.default
240
+ * @param {boolean} args.dropColumn
241
+ * @param {boolean|object} args.foreignKey
242
+ * @param {boolean|object} args.index
243
+ * @param {number} args.maxLength
244
+ * @param {boolean} args.null
245
+ * @param {boolean} args.primaryKey
246
+ * @returns {void}
247
+ */
81
248
  text(name, args) { this.addColumn(name, Object.assign({isNewColumn: true, type: "text"}, args)) }
82
249
 
250
+ /**
251
+ * @param {object} args
252
+ * @param {boolean} args.autoIncrement
253
+ * @param {any} args.default
254
+ * @param {boolean} args.dropColumn
255
+ * @param {boolean|object} args.foreignKey
256
+ * @param {boolean|object} args.index
257
+ * @param {number} args.maxLength
258
+ * @param {boolean} args.null
259
+ * @param {boolean} args.primaryKey
260
+ * @returns {void}
261
+ */
83
262
  timestamps(args = {}) {
84
263
  this.datetime("created_at", args)
85
264
  this.datetime("updated_at", args)
86
265
  }
87
266
 
267
+ /**
268
+ * @param {string} name
269
+ * @param {object} args
270
+ * @param {boolean} args.autoIncrement
271
+ * @param {any} args.default
272
+ * @param {boolean} args.dropColumn
273
+ * @param {boolean|object} args.foreignKey
274
+ * @param {boolean|object} args.index
275
+ * @param {number} args.maxLength
276
+ * @param {boolean} args.null
277
+ * @param {boolean} args.primaryKey
278
+ * @returns {void}
279
+ */
88
280
  uuid(name, args) { this.addColumn(name, Object.assign({isNewColumn: true, type: "uuid"}, args)) }
89
281
  }
@@ -1,4 +1,60 @@
1
1
  export default class VelociousEnvironmentHandlerBase {
2
+ /**
3
+ * @param {import("../cli/base-command.js").default} _command
4
+ * @returns {Promise<void>}
5
+ */
6
+ async cliCommandsGenerateBaseModels(_command) { // eslint-disable-line no-unused-vars
7
+ throw new Error("cliCommandsGenerateBaseModels not implemented")
8
+ }
9
+
10
+ /**
11
+ * @param {import("../cli/base-command.js").default} _command
12
+ * @returns {Promise<void>}
13
+ */
14
+ async cliCommandsInit(_command) { // eslint-disable-line no-unused-vars
15
+ throw new Error("cliCommandsInit not implemented")
16
+ }
17
+
18
+ /**
19
+ * @param {import("../cli/base-command.js").default} _command
20
+ * @returns {Promise<void>}
21
+ */
22
+ async cliCommandsMigrationGenerate(_command) { // eslint-disable-line no-unused-vars
23
+ throw new Error("cliCommandsMigrationGenerate not implemented")
24
+ }
25
+
26
+ /**
27
+ * @param {import("../cli/base-command.js").default} _command
28
+ * @returns {Promise<void>}
29
+ */
30
+ async cliCommandsMigrationDestroy(_command) { // eslint-disable-line no-unused-vars
31
+ throw new Error("cliCommandsMigrationDestroy not implemented")
32
+ }
33
+
34
+ /**
35
+ * @param {import("../cli/base-command.js").default} _command
36
+ * @returns {Promise<void>}
37
+ */
38
+ async cliCommandsGenerateModel(_command) { // eslint-disable-line no-unused-vars
39
+ throw new Error("cliCommandsGenerateModel not implemented")
40
+ }
41
+
42
+ /**
43
+ * @param {import("../cli/base-command.js").default} _command
44
+ * @returns {Promise<void>}
45
+ */
46
+ async cliCommandsServer(_command) { // eslint-disable-line no-unused-vars
47
+ throw new Error("cliCommandsServer not implemented")
48
+ }
49
+
50
+ /**
51
+ * @param {import("../cli/base-command.js").default} _command
52
+ * @returns {Promise<void>}
53
+ */
54
+ async cliCommandsTest(_command) { // eslint-disable-line no-unused-vars
55
+ throw new Error("cliCommandsTest not implemented")
56
+ }
57
+
2
58
  /**
3
59
  * @interface
4
60
  */
@@ -34,6 +90,8 @@ export default class VelociousEnvironmentHandlerBase {
34
90
  async importApplicationRoutes() { throw new Error("importApplicationRoutes not implemented") }
35
91
 
36
92
  /**
93
+ * @param {object} args
94
+ * @param {string[]} args.commandParts
37
95
  * @interface
38
96
  */
39
97
  async requireCommand({commandParts}) { throw new Error("requireCommand not implemented") } // eslint-disable-line no-unused-vars
@@ -15,30 +15,6 @@ export default class VelociousEnvironmentsHandlerBrowser extends Base {
15
15
  this.migrationsRequireContextCallback = migrationsRequireContextCallback
16
16
  }
17
17
 
18
- async cliCommandsInit(_command) { // eslint-disable-line no-unused-vars
19
- throw new Error("Unsupported on browser")
20
- }
21
-
22
- async cliCommandsMigrationGenerate(_command) { // eslint-disable-line no-unused-vars
23
- throw new Error("Unsupported on browser")
24
- }
25
-
26
- async cliCommandsMigrationDestroy(_command) { // eslint-disable-line no-unused-vars
27
- throw new Error("Unsupported on browser")
28
- }
29
-
30
- async cliCommandsModelGenerate(_command) { // eslint-disable-line no-unused-vars
31
- throw new Error("Unsupported on browser")
32
- }
33
-
34
- async cliCommandsServer(_command) { // eslint-disable-line no-unused-vars
35
- throw new Error("Unsupported on browser")
36
- }
37
-
38
- async cliCommandsTest(_command) { // eslint-disable-line no-unused-vars
39
- throw new Error("Unsupported on browser")
40
- }
41
-
42
18
  /**
43
19
  * @returns {object}
44
20
  */
@@ -0,0 +1,80 @@
1
+ import BaseCommand from "../../../../../cli/base-command.js"
2
+ import fileExists from "../../../../../utils/file-exists.js"
3
+ import fs from "fs/promises"
4
+ import * as inflection from "inflection"
5
+
6
+ export default class DbGenerateModel extends BaseCommand {
7
+ async execute() {
8
+ await this.getConfiguration().initializeModels()
9
+
10
+ const modelsDir = `${process.cwd()}/src/model-bases`
11
+ const modelClasses = this.getConfiguration().getModelClasses()
12
+
13
+ if (!await fileExists(modelsDir)) {
14
+ await fs.mkdir(modelsDir, {recursive: true})
15
+ }
16
+
17
+ for (const modelClassName in modelClasses) {
18
+ const modelClass = modelClasses[modelClassName]
19
+ const modelName = inflection.dasherize(modelClassName)
20
+ const modelNameCamelized = inflection.camelize(modelName.replaceAll("-", "_"))
21
+ const modelBaseFileName = `${inflection.dasherize(inflection.underscore(modelName))}.js`
22
+ const modelPath = `${modelsDir}/${modelBaseFileName}`
23
+
24
+ console.log(`create src/model-bases/${modelBaseFileName}`)
25
+
26
+ let fileContent = `import Record from "velocious/src/database/record/index.js"\n\n`
27
+
28
+ fileContent += `export default class ${modelNameCamelized} extends Record {\n`
29
+
30
+ const columns = await modelClass._getTable().getColumns()
31
+ let methodsCount = 0
32
+
33
+ for (const column of columns) {
34
+ const camelizedColumnName = inflection.camelize(column.getName(), true)
35
+ const camelizedColumnNameBigFirst = inflection.camelize(column.getName())
36
+ let jsdocType
37
+
38
+ if (column.getType() == "varchar") {
39
+ jsdocType = "string"
40
+ } else if (["bigint", "int", "integer", "smallint"].includes(column.getType())) {
41
+ jsdocType = "number"
42
+ } else if (["date", "datetime"].includes(column.getType())) {
43
+ jsdocType = "Date"
44
+ }
45
+
46
+ if (methodsCount > 0) {
47
+ fileContent += "\n"
48
+ }
49
+
50
+ if (jsdocType) {
51
+ fileContent += " /**\n"
52
+ fileContent += ` * @returns {${jsdocType}}\n`
53
+ fileContent += " */\n"
54
+ }
55
+
56
+ fileContent += ` ${camelizedColumnName}() { return this.readAttribute("${camelizedColumnName}") }\n\n`
57
+
58
+ if (jsdocType) {
59
+ fileContent += " /**\n"
60
+ fileContent += ` * @param {${jsdocType}} newValue\n`
61
+ fileContent += " * @returns {void}\n"
62
+ fileContent += " */\n"
63
+ }
64
+
65
+ fileContent += ` set${camelizedColumnNameBigFirst}(newValue) { return this._setColumnAttribute("${camelizedColumnName}", newValue) }\n\n`
66
+
67
+ fileContent += " /**\n"
68
+ fileContent += " * @returns {boolean}\n"
69
+ fileContent += " */\n"
70
+ fileContent += ` has${camelizedColumnNameBigFirst}() { return this._hasAttribute(this.${camelizedColumnName}()) }\n`
71
+
72
+ methodsCount++
73
+ }
74
+
75
+ fileContent += "}\n"
76
+
77
+ await fs.writeFile(modelPath, fileContent)
78
+ }
79
+ }
80
+ }
@@ -1,6 +1,7 @@
1
1
  import Base from "./base.js"
2
2
  import CliCommandsDestroyMigration from "./node/cli/commands/destroy/migration.js"
3
3
  import CliCommandsInit from "./node/cli/commands/init.js"
4
+ import CliCommandsGenerateBaseModels from "./node/cli/commands/generate/base-models.js"
4
5
  import CliCommandsGenerateMigration from "./node/cli/commands/generate/migration.js"
5
6
  import CliCommandsGenerateModel from "./node/cli/commands/generate/model.js"
6
7
  import CliCommandsServer from "./node/cli/commands/server.js"
@@ -60,7 +61,11 @@ export default class VelociousEnvironmentHandlerNode extends Base{
60
61
  return await this.forwardCommand(command, CliCommandsDestroyMigration)
61
62
  }
62
63
 
63
- async cliCommandsModelGenerate(command) {
64
+ async cliCommandsGenerateBaseModels(command) {
65
+ return await this.forwardCommand(command, CliCommandsGenerateBaseModels)
66
+ }
67
+
68
+ async cliCommandsGenerateModel(command) {
64
69
  return await this.forwardCommand(command, CliCommandsGenerateModel)
65
70
  }
66
71
 
@@ -23,6 +23,10 @@ export default class VelociousInitializer {
23
23
  */
24
24
  getType() { return this._type }
25
25
 
26
+ /**
27
+ * @interface
28
+ * @returns {Promise<void>}
29
+ */
26
30
  run() {
27
31
  throw new Error(`'run' hasn't been implemented on ${this.constructor.name})`)
28
32
  }