@ditojs/server 1.5.4 → 1.5.5

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ditojs/server",
3
- "version": "1.5.4",
3
+ "version": "1.5.5",
4
4
  "type": "module",
5
5
  "description": "Dito.js Server – Dito.js is a declarative and modern web framework, based on Objection.js, Koa.js and Vue.js",
6
6
  "repository": "https://github.com/ditojs/dito/tree/master/packages/server",
@@ -21,23 +21,23 @@
21
21
  "node >= 16"
22
22
  ],
23
23
  "dependencies": {
24
- "@ditojs/admin": "^1.5.0",
25
- "@ditojs/build": "^1.5.0",
26
- "@ditojs/router": "^1.5.0",
27
- "@ditojs/utils": "^1.5.0",
24
+ "@ditojs/admin": "^1.5.5",
25
+ "@ditojs/build": "^1.5.5",
26
+ "@ditojs/router": "^1.5.5",
27
+ "@ditojs/utils": "^1.5.5",
28
28
  "@koa/cors": "^3.3.0",
29
29
  "@koa/multer": "^3.0.0",
30
30
  "@originjs/vite-plugin-commonjs": "^1.0.3",
31
31
  "ajv": "^8.11.0",
32
32
  "ajv-formats": "^2.1.1",
33
- "aws-sdk": "^2.1108.0",
34
- "axios": "^0.26.1",
33
+ "aws-sdk": "^2.1131.0",
34
+ "axios": "^0.27.2",
35
35
  "bcryptjs": "^2.4.3",
36
36
  "bytes": "^3.1.2",
37
37
  "data-uri-to-buffer": "^4.0.0",
38
38
  "eventemitter2": "^6.4.5",
39
39
  "file-type": "^17.1.1",
40
- "fs-extra": "^10.0.1",
40
+ "fs-extra": "^10.1.0",
41
41
  "image-size": "^1.0.1",
42
42
  "is-svg": "^4.3.2",
43
43
  "koa": "^2.13.4",
@@ -55,31 +55,29 @@
55
55
  "mime-types": "^2.1.35",
56
56
  "multer": "^1.4.4",
57
57
  "multer-s3": "^2.10.0",
58
- "nanoid": "^3.3.2",
58
+ "nanoid": "^3.3.4",
59
59
  "parse-duration": "^1.0.2",
60
60
  "passport-local": "^1.0.0",
61
61
  "passthrough-counter": "^1.0.0",
62
62
  "picocolors": "^1.0.0",
63
63
  "picomatch": "^2.3.1",
64
- "pino": "^7.9.2",
65
- "pino-pretty": "^7.6.0",
64
+ "pino": "^7.11.0",
65
+ "pino-pretty": "^7.6.1",
66
66
  "pluralize": "^8.0.0",
67
67
  "repl": "^0.1.3",
68
68
  "uuid": "^8.3.2",
69
- "vite": "^2.9.1",
70
- "vite-plugin-vue2": "^1.9.3",
69
+ "vite": "^2.9.8",
70
+ "vite-plugin-vue2": "^2.0.0",
71
71
  "vue": "^2.6.14",
72
72
  "vue-template-compiler": "^2.6.14"
73
73
  },
74
74
  "peerDependencies": {
75
- "knex": "^1.0.4",
75
+ "knex": "^1.0.5",
76
76
  "objection": "^3.0.1"
77
77
  },
78
78
  "devDependencies": {
79
- "knex": "^1.0.5",
80
- "objection": "^3.0.1",
81
- "pg": "^8.7.3",
82
- "sqlite3": "^5.0.2"
79
+ "knex": "^2.0.0",
80
+ "objection": "^3.0.1"
83
81
  },
84
- "gitHead": "fa4ff0e996e9d043a226d54c5e9ab263ccf1ad5f"
82
+ "gitHead": "157b519f3f3552fb25b67adf7e0fd402485ac4c9"
85
83
  }
@@ -1,7 +1,7 @@
1
1
  import pico from 'picocolors'
2
2
 
3
- export async function migrate(knex) {
4
- const [batch, log] = await knex.migrate.latest()
3
+ export async function migrate(knex, config) {
4
+ const [batch, log] = await knex.migrate.latest(config)
5
5
  console.info(log.length === 0
6
6
  ? pico.cyan('Already up to date')
7
7
  : pico.green(`Batch ${batch} run: ${log.length} migrations\n`) +
@@ -1,11 +1,11 @@
1
1
  import pico from 'picocolors'
2
2
  import { migrate } from './migrate.js'
3
3
 
4
- export async function reset(knex) {
4
+ export async function reset(knex, config) {
5
5
  const batches = []
6
6
  const migrations = []
7
7
  while (true) {
8
- const [batch, log] = await knex.migrate.rollback()
8
+ const [batch, log] = await knex.migrate.rollback(config)
9
9
  if (log.length === 0) break
10
10
  batches.push(batch)
11
11
  migrations.push(...log)
@@ -1,7 +1,7 @@
1
1
  import pico from 'picocolors'
2
2
 
3
- export async function rollback(knex) {
4
- const [batch, log] = await knex.migrate.rollback()
3
+ export async function rollback(knex, config) {
4
+ const [batch, log] = await knex.migrate.rollback(config)
5
5
  console.info(log.length === 0
6
6
  ? pico.cyan('Already at the base migration')
7
7
  : pico.green(`Batch ${batch} rolled back: ${log.length} migrations\n`) +
@@ -1,7 +1,7 @@
1
1
  import pico from 'picocolors'
2
2
 
3
- export async function unlock(knex) {
4
- await knex.migrate.forceFreeMigrationsLock()
3
+ export async function unlock(knex, config) {
4
+ await knex.migrate.forceFreeMigrationsLock(config)
5
5
  console.info(
6
6
  pico.green(`Successfully unlocked the migrations lock table`)
7
7
  )
package/src/cli/index.js CHANGED
@@ -8,10 +8,6 @@ import { isPlainObject, isFunction, camelize } from '@ditojs/utils'
8
8
  import * as db from './db/index.js'
9
9
  import startConsole from './console.js'
10
10
 
11
- // Tell Knex to use ESM. TODO: Fix this properly in Knex itself, so it works
12
- // with Yarn too.
13
- process.env.npm_package_type = 'module'
14
-
15
11
  const commands = { db, console: startConsole }
16
12
 
17
13
  function getCommand(commands, parts) {
@@ -44,8 +40,14 @@ async function execute() {
44
40
  }
45
41
  if (isFunction(arg)) {
46
42
  arg = await arg()
47
- } else if (isPlainObject(arg) && arg.knex) {
43
+ }
44
+ if (isPlainObject(arg) && arg.knex) {
45
+ // A config object with a knex field was passed in, create a knex object
46
+ // from it to pass on to the execute function.
48
47
  arg = Knex(arg.knex)
48
+ // Also add `knex.migrations` config as the first argument to `execute()`,
49
+ // so db:migrate & co. can receive migration configuration settings.
50
+ args.unshift(arg.knex.migrations || null)
49
51
  }
50
52
  const res = await execute(arg, ...args)
51
53
  process.exit(res === true ? 0 : 1)