velocious 1.0.106 → 1.0.108
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/package.json +3 -1
- package/peak_flow.yml +1 -0
- package/spec/cli/commands/db/migrate-spec.js +7 -2
- package/spec/cli/commands/test/test-files-finder-spec.js +2 -0
- package/spec/database/connection/drivers/mysql/query-parser-spec.js +3 -1
- package/spec/database/drivers/mysql/connection-spec.js +1 -1
- package/spec/database/record/find-or-create-spec.js +3 -3
- package/spec/database/record/find-spec.js +1 -1
- package/spec/database/record/instance-relationships/belongs-to-relationship-spec.js +1 -1
- package/spec/database/record/instance-relationships/has-many-relationship-spec.js +3 -3
- package/spec/database/record/instance-relationships/has-one-relationship-spec.js +1 -1
- package/spec/database/record/last-spec.js +2 -2
- package/spec/database/record/preloader/belongs-to-spec.js +1 -1
- package/spec/database/record/preloader/has-many-spec.js +4 -4
- package/spec/database/record/preloader/has-one-spec.js +1 -1
- package/spec/database/record/query-spec.js +8 -6
- package/spec/database/record/translation-fallbacks-spec.js +1 -1
- package/spec/dummy/src/config/configuration.example.js +1 -0
- package/spec/dummy/src/config/routes.js +4 -0
- package/spec/dummy/src/model-bases/account.js +2 -2
- package/spec/dummy/src/model-bases/authentication-token.js +3 -3
- package/spec/dummy/src/model-bases/project-detail.js +3 -3
- package/spec/dummy/src/model-bases/project-translation.js +3 -3
- package/spec/dummy/src/model-bases/project.js +12 -12
- package/spec/dummy/src/model-bases/task.js +3 -3
- package/spec/dummy/src/model-bases/user.js +9 -9
- package/spec/dummy/src/routes/api/controller.js +9 -0
- package/spec/dummy/src/routes/projects/controller.js +1 -1
- package/spec/dummy/src/routes/tasks/controller.js +1 -3
- package/spec/http-server/client-spec.js +1 -1
- package/spec/http-server/get-spec.js +1 -1
- package/spec/http-server/namespace-spec.js +17 -0
- package/spec/http-server/post-spec.js +9 -9
- package/spec/http-server/root-get-spec.js +2 -1
- package/src/application.js +1 -0
- package/src/cli/base-command.js +1 -1
- package/src/cli/commands/db/create.js +1 -1
- package/src/cli/use-browser-cli.js +2 -0
- package/src/configuration-types.js +11 -6
- package/src/controller.js +1 -2
- package/src/database/drivers/base.js +9 -9
- package/src/database/drivers/mssql/index.js +11 -11
- package/src/database/drivers/mssql/options.js +10 -6
- package/src/database/drivers/mysql/index.js +8 -8
- package/src/database/drivers/mysql/options.js +10 -6
- package/src/database/drivers/pgsql/index.js +10 -10
- package/src/database/drivers/pgsql/options.js +9 -6
- package/src/database/drivers/sqlite/base.js +10 -10
- package/src/database/drivers/sqlite/connection-sql-js.js +2 -0
- package/src/database/drivers/sqlite/index.js +8 -2
- package/src/database/drivers/sqlite/index.native.js +5 -1
- package/src/database/drivers/sqlite/index.web.js +2 -1
- package/src/database/drivers/sqlite/options.js +10 -7
- package/src/database/drivers/sqlite/sql/alter-table.js +3 -3
- package/src/database/migration/index.js +16 -5
- package/src/database/migrator.js +5 -1
- package/src/database/pool/base-methods-forward.js +0 -4
- package/src/database/query/alter-table-base.js +2 -2
- package/src/database/query/base.js +2 -2
- package/src/database/query/create-index-base.js +2 -2
- package/src/database/query/create-table-base.js +4 -4
- package/src/database/query/drop-table-base.js +2 -2
- package/src/database/query/index.js +2 -2
- package/src/database/record/index.js +11 -44
- package/src/database/record/instance-relationships/base.js +2 -2
- package/src/database/record/instance-relationships/has-many.js +1 -1
- package/src/database/use-database.js +1 -0
- package/src/environment-handlers/base.js +2 -2
- package/src/environment-handlers/browser.js +40 -18
- package/src/environment-handlers/node/cli/commands/destroy/migration.js +5 -1
- package/src/environment-handlers/node/cli/commands/generate/base-models.js +20 -9
- package/src/environment-handlers/node/cli/commands/generate/migration.js +5 -1
- package/src/environment-handlers/node/cli/commands/generate/model.js +5 -1
- package/src/environment-handlers/node/cli/commands/init.js +5 -1
- package/src/environment-handlers/node.js +1 -1
- package/src/http-server/client/index.js +2 -1
- package/src/http-server/client/params-to-object.js +0 -8
- package/src/http-server/client/request-buffer/index.js +1 -0
- package/src/routes/basic-route.js +1 -1
- package/src/routes/namespace-route.js +1 -1
- package/src/testing/test-files-finder.js +1 -1
- package/src/testing/test-runner.js +3 -0
- package/src/testing/test.js +0 -2
- package/src/utils/with-tracked-stack-async-hooks.js +0 -2
- package/src/utils/with-tracked-stack.js +0 -2
- package/tsconfig.json +15 -0
|
@@ -3,9 +3,13 @@ import fileExists from "../../../../../utils/file-exists.js"
|
|
|
3
3
|
import fs from "fs/promises"
|
|
4
4
|
import * as inflection from "inflection"
|
|
5
5
|
|
|
6
|
+
/**
|
|
7
|
+
* @typedef {{date: Date, modelContent: string, modelName: string, modelNameCamelized: string, modelPath: string}} DbGenerateModelResult
|
|
8
|
+
*/
|
|
9
|
+
|
|
6
10
|
export default class DbGenerateModel extends BaseCommand {
|
|
7
11
|
/**
|
|
8
|
-
* @returns {Promise<void>}
|
|
12
|
+
* @returns {Promise<void | DbGenerateModelResult>}
|
|
9
13
|
*/
|
|
10
14
|
async execute() {
|
|
11
15
|
const modelName = this.processArgs[1]
|
|
@@ -2,9 +2,13 @@ import BaseCommand from "../../../../cli/base-command.js"
|
|
|
2
2
|
import fileExists from "../../../../utils/file-exists.js"
|
|
3
3
|
import fs from "fs/promises"
|
|
4
4
|
|
|
5
|
+
/**
|
|
6
|
+
* @typedef {{source: string, target: string}} FileMappingType
|
|
7
|
+
*/
|
|
8
|
+
|
|
5
9
|
export default class VelociousCliCommandsInit extends BaseCommand {
|
|
6
10
|
/**
|
|
7
|
-
* @returns {Promise<void>}
|
|
11
|
+
* @returns {Promise<void | {fileMappings: FileMappingType[]}>}
|
|
8
12
|
*/
|
|
9
13
|
async execute() {
|
|
10
14
|
const velociousPath = await this.getEnvironmentHandler().getVelociousPath()
|
|
@@ -115,7 +115,7 @@ export default class VelociousEnvironmentHandlerNode extends Base{
|
|
|
115
115
|
/**
|
|
116
116
|
* @param {object} args
|
|
117
117
|
* @param {string[]} args.commandParts
|
|
118
|
-
* @returns {Promise<import ("../cli/base-command.js").default>}
|
|
118
|
+
* @returns {Promise<typeof import ("../cli/base-command.js").default>}
|
|
119
119
|
*/
|
|
120
120
|
async requireCommand({commandParts}) {
|
|
121
121
|
const commands = await this.findCommands()
|
|
@@ -36,21 +36,17 @@ export default class ParamsToObject {
|
|
|
36
36
|
let newResult
|
|
37
37
|
|
|
38
38
|
if (inputName in result) {
|
|
39
|
-
// @ts-expect-error
|
|
40
39
|
newResult = result[inputName]
|
|
41
40
|
} else if (rest == "[]") {
|
|
42
41
|
newResult = []
|
|
43
|
-
// @ts-expect-error
|
|
44
42
|
result[inputName] = newResult
|
|
45
43
|
} else {
|
|
46
44
|
newResult = {}
|
|
47
|
-
// @ts-expect-error
|
|
48
45
|
result[inputName] = newResult
|
|
49
46
|
}
|
|
50
47
|
|
|
51
48
|
this.treatSecond(value, rest, newResult)
|
|
52
49
|
} else {
|
|
53
|
-
// @ts-expect-error
|
|
54
50
|
result[key] = value
|
|
55
51
|
}
|
|
56
52
|
}
|
|
@@ -74,19 +70,15 @@ export default class ParamsToObject {
|
|
|
74
70
|
if (rest == "[]") {
|
|
75
71
|
result.push(value)
|
|
76
72
|
} else if (newRest == "") {
|
|
77
|
-
// @ts-expect-error
|
|
78
73
|
result[key] = value
|
|
79
74
|
} else {
|
|
80
75
|
if (typeof result == "object" && key in result) {
|
|
81
|
-
// @ts-expect-error
|
|
82
76
|
newResult = result[key]
|
|
83
77
|
} else if (newRest == "[]") {
|
|
84
78
|
newResult = []
|
|
85
|
-
// @ts-expect-error
|
|
86
79
|
result[key] = newResult
|
|
87
80
|
} else {
|
|
88
81
|
newResult = {}
|
|
89
|
-
// @ts-expect-error
|
|
90
82
|
result[key] = newResult
|
|
91
83
|
}
|
|
92
84
|
|
|
@@ -334,6 +334,7 @@ export default class RequestBuffer {
|
|
|
334
334
|
|
|
335
335
|
parseQueryStringPostParams() {
|
|
336
336
|
if (this.postBody) {
|
|
337
|
+
/** @type {Record<string, any>} */
|
|
337
338
|
const unparsedParams = querystring.parse(this.postBody)
|
|
338
339
|
const paramsToObject = new ParamsToObject(unparsedParams)
|
|
339
340
|
const newParams = paramsToObject.toObject()
|
|
@@ -57,7 +57,7 @@ export default class VelociousBasicRoute extends BaseRoute {
|
|
|
57
57
|
|
|
58
58
|
/**
|
|
59
59
|
* @param {string} name
|
|
60
|
-
* @param {function(import("./resource-route.js").default) : void} callback
|
|
60
|
+
* @param {function(import("./resource-route.js").default) : void} [callback]
|
|
61
61
|
* @returns {void}
|
|
62
62
|
*/
|
|
63
63
|
resources(name, callback) {
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import restArgsError from "../utils/rest-args-error.js"
|
|
4
4
|
import BaseRoute from "./base-route.js"
|
|
5
|
-
import BasicRoute from "./
|
|
5
|
+
import BasicRoute from "./basic-route.js"
|
|
6
6
|
import escapeStringRegexp from "escape-string-regexp"
|
|
7
7
|
|
|
8
8
|
class VelociousRouteNamespaceRoute extends BasicRoute {
|
|
@@ -13,7 +13,7 @@ export default class TestFilesFinder {
|
|
|
13
13
|
/**
|
|
14
14
|
* @param {object} args
|
|
15
15
|
* @param {string} args.directory
|
|
16
|
-
* @param {string[]} args.directories
|
|
16
|
+
* @param {string[]} [args.directories]
|
|
17
17
|
* @param {string[]} args.processArgs
|
|
18
18
|
*/
|
|
19
19
|
constructor({directory, directories, processArgs, ...restArgs}) {
|
|
@@ -11,6 +11,9 @@ import {tests} from "./test.js"
|
|
|
11
11
|
* @typedef {object} TestArgs
|
|
12
12
|
* @property {Application} [application]
|
|
13
13
|
* @property {RequestClient} [client]
|
|
14
|
+
* @property {object} [databaseCleaning]
|
|
15
|
+
* @property {boolean} [databaseCleaning.transaction]
|
|
16
|
+
* @property {boolean} [databaseCleaning.truncate]
|
|
14
17
|
* @property {boolean} [focus]
|
|
15
18
|
* @property {() => Promise<void>} [function]
|
|
16
19
|
* @property {string} [type]
|
package/src/testing/test.js
CHANGED
|
@@ -412,7 +412,6 @@ function it(description, arg1, arg2) {
|
|
|
412
412
|
let testFunction
|
|
413
413
|
|
|
414
414
|
if (typeof arg1 == "function") {
|
|
415
|
-
// @ts-expect-error
|
|
416
415
|
testFunction = arg1
|
|
417
416
|
testArgs = {}
|
|
418
417
|
} else if (typeof arg2 == "function") {
|
|
@@ -440,7 +439,6 @@ function fit(description, arg1, arg2) {
|
|
|
440
439
|
let testFunction
|
|
441
440
|
|
|
442
441
|
if (typeof arg1 == "function") {
|
|
443
|
-
// @ts-expect-error
|
|
444
442
|
testFunction = arg1
|
|
445
443
|
testArgs = {focus: true}
|
|
446
444
|
} else if (typeof arg2 == "function") {
|
|
@@ -76,11 +76,9 @@ async function withTrackedStack(arg1, arg2) {
|
|
|
76
76
|
})
|
|
77
77
|
}
|
|
78
78
|
|
|
79
|
-
// @ts-expect-error
|
|
80
79
|
if (globalThis.withTrackedStack) {
|
|
81
80
|
console.warn("globalThis.withTrackedStack was already defined")
|
|
82
81
|
} else {
|
|
83
|
-
// @ts-expect-error
|
|
84
82
|
globalThis.withTrackedStack = {addTrackedStackToError, withTrackedStack}
|
|
85
83
|
}
|
|
86
84
|
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
/** @param {Error} error */
|
|
4
4
|
function addTrackedStackToError(error) {
|
|
5
|
-
// @ts-expect-error
|
|
6
5
|
globalThis.withTrackedStack?.addTrackedStackToError(error)
|
|
7
6
|
}
|
|
8
7
|
|
|
@@ -11,7 +10,6 @@ function addTrackedStackToError(error) {
|
|
|
11
10
|
* @returns {Promise<any>}
|
|
12
11
|
*/
|
|
13
12
|
async function withTrackedStack(...args) {
|
|
14
|
-
// @ts-expect-error
|
|
15
13
|
const withTrackedStack = globalThis.withTrackedStack?.withTrackedStack
|
|
16
14
|
|
|
17
15
|
let callback
|
package/tsconfig.json
ADDED