dobo-extra 1.1.0 → 1.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.
@@ -1,7 +1,7 @@
1
1
  async function move (task) {
2
2
  const { importPkg } = this.app.bajo
3
- const { dayjs } = this.app.bajo.lib
4
- const { set } = this.app.bajo.lib._
3
+ const { dayjs } = this.lib
4
+ const { set } = this.lib._
5
5
  const { formatInteger } = this.app.bajoExtra
6
6
  const { recordFind, recordCreate, recordRemove, statAggregate } = this.app.dobo
7
7
  const prompts = await importPkg('bajoCli:@inquirer/prompts')
@@ -3,7 +3,7 @@ import _path from 'path'
3
3
  const batch = 100
4
4
 
5
5
  function makeProgress (spin) {
6
- const { secToHms } = this.app.bajo
6
+ const { secToHms } = this.lib.aneka
7
7
  return async function ({ batchNo, data, batchStart, batchEnd } = {}) {
8
8
  if (data.length === 0) return
9
9
  spin.setText('batch%d%s', batchNo, secToHms(batchEnd.toTime() - batchStart.toTime(), true))
@@ -12,8 +12,8 @@ function makeProgress (spin) {
12
12
 
13
13
  async function exportTo (...args) {
14
14
  const { importPkg } = this.app.bajo
15
- const { dayjs } = this.app.bajo.lib
16
- const { isEmpty, map } = this.app.bajo.lib._
15
+ const { dayjs } = this.lib
16
+ const { isEmpty, map } = this.lib._
17
17
  const { getInfo, start } = this.app.dobo
18
18
 
19
19
  const [input, select] = await importPkg('bajoCli:@inquirer/input',
@@ -3,7 +3,7 @@ import _path from 'path'
3
3
  const batch = 100
4
4
 
5
5
  function makeProgress (spin) {
6
- const { secToHms } = this.app.bajo
6
+ const { secToHms } = this.lib.aneka
7
7
  return async function ({ batchNo, data, batchStart, batchEnd } = {}) {
8
8
  spin.setText('batch%d%s', batchNo, secToHms(batchEnd.toTime() - batchStart.toTime(), true))
9
9
  }
@@ -11,7 +11,7 @@ function makeProgress (spin) {
11
11
 
12
12
  async function importFrom (...args) {
13
13
  const { importPkg } = this.app.bajo
14
- const { isEmpty, map } = this.app.bajo.lib._
14
+ const { isEmpty, map } = this.lib._
15
15
  const { getInfo, start } = this.app.dobo
16
16
 
17
17
  const [input, select, confirm] = await importPkg('bajoCli:@inquirer/input',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dobo-extra",
3
- "version": "1.1.0",
3
+ "version": "1.1.2",
4
4
  "description": "Bajo DB Extra Tools/Utility",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/plugin/init.js CHANGED
@@ -3,7 +3,7 @@ const types = ['datetime', 'date', 'timestamp']
3
3
  async function handler ({ item }) {
4
4
  const { join } = this.app.bajo
5
5
  const { getSchema } = this.app.dobo
6
- const { has } = this.app.bajo.lib._
6
+ const { has } = this.lib._
7
7
  for (const f of ['source', 'destination']) {
8
8
  if (!has(item, f)) throw this.error('taskMustHaveModel%s', f)
9
9
  const key = `${f}Field`
@@ -9,8 +9,8 @@ const { json, ndjson, csv, xlsx } = format
9
9
 
10
10
  async function getFile (dest, ensureDir) {
11
11
  const { importPkg, getPluginDataDir } = this.app.bajo
12
- const { fs } = this.app.bajo.lib
13
- const increment = await importPkg('add-filename-increment')
12
+ const { fs } = this.lib
13
+ const increment = await importPkg('bajo:add-filename-increment')
14
14
  let file
15
15
  if (path.isAbsolute(dest)) file = dest
16
16
  else {
@@ -51,8 +51,8 @@ async function getData ({ source, filter, count, stream, progressFn }) {
51
51
  }
52
52
 
53
53
  function exportTo (source, dest, { filter = {}, ensureDir, useHeader = true, batch = 500, progressFn } = {}, opts = {}) {
54
- const { fs } = this.app.bajo.lib
55
- const { merge } = this.app.bajo.lib._
54
+ const { fs } = this.lib
55
+ const { merge } = this.lib._
56
56
 
57
57
  filter.page = 1
58
58
  batch = parseInt(batch) ?? 500
@@ -10,8 +10,8 @@ const { json, ndjson, csv, xlsx } = format
10
10
  async function importFrom (source, dest, { trashOld = true, batch = 1, progressFn, converterFn, useHeader = true, fileType, createOpts = {} } = {}, opts = {}) {
11
11
  const { getPluginDataDir } = this.app.bajo
12
12
  const { recordCreate } = this.app.dobo
13
- const { merge } = this.app.bajo.lib._
14
- const { fs } = this.app.bajo.lib
13
+ const { merge } = this.lib._
14
+ const { fs } = this.lib
15
15
 
16
16
  if (dest !== false) this.app.dobo.getInfo(dest) // make sure dest model is valid
17
17
  let file