dobo-extra 2.0.1 → 2.3.0
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/.github/FUNDING.yml +0 -0
- package/.github/workflows/repo-lockdown.yml +0 -0
- package/.jsdoc.conf.json +0 -0
- package/LICENSE +0 -0
- package/README.md +2 -2
- package/docs/DoboExtra.html +0 -0
- package/docs/data/search.json +0 -0
- package/docs/fonts/Inconsolata-Regular.ttf +0 -0
- package/docs/fonts/OpenSans-Regular.ttf +0 -0
- package/docs/fonts/WorkSans-Bold.ttf +0 -0
- package/docs/global.html +0 -0
- package/docs/index.html +0 -0
- package/docs/index.js.html +0 -0
- package/docs/scripts/core.js +476 -477
- package/docs/scripts/core.min.js +0 -0
- package/docs/scripts/resize.js +36 -36
- package/docs/scripts/search.js +105 -105
- package/docs/scripts/search.min.js +0 -0
- package/docs/scripts/third-party/Apache-License-2.0.txt +0 -0
- package/docs/scripts/third-party/fuse.js +1 -1
- package/docs/scripts/third-party/hljs-line-num-original.js +282 -285
- package/docs/scripts/third-party/hljs-line-num.js +1 -1
- package/docs/scripts/third-party/hljs-original.js +1195 -1202
- package/docs/scripts/third-party/hljs.js +1 -1
- package/docs/scripts/third-party/popper.js +1 -1
- package/docs/scripts/third-party/tippy.js +1 -1
- package/docs/scripts/third-party/tocbot.js +508 -509
- package/docs/scripts/third-party/tocbot.min.js +0 -0
- package/docs/static/bitcoin.jpeg +0 -0
- package/docs/static/home.md +0 -0
- package/docs/static/logo-ecosystem.png +0 -0
- package/docs/static/logo.png +0 -0
- package/docs/styles/clean-jsdoc-theme-base.css +0 -0
- package/docs/styles/clean-jsdoc-theme-dark.css +0 -0
- package/docs/styles/clean-jsdoc-theme-light.css +0 -0
- package/docs/styles/clean-jsdoc-theme-scrollbar.css +0 -0
- package/docs/styles/clean-jsdoc-theme-without-scrollbar.min.css +0 -0
- package/docs/styles/clean-jsdoc-theme.min.css +0 -0
- package/extend/bajo/config-handlers.js +42 -0
- package/extend/bajo/intl/en-US.json +0 -0
- package/extend/bajo/intl/id.json +0 -0
- package/extend/bajoCli/applet/archive.js +0 -0
- package/extend/bajoCli/applet/export-to.js +0 -0
- package/extend/bajoCli/applet/import-from.js +0 -0
- package/extend/bajoCli/applet.js +0 -0
- package/index.js +9 -4
- package/{method → lib}/export-to.js +2 -3
- package/{method → lib}/import-from.js +2 -3
- package/lib/io-exts.js +0 -0
- package/lib/ndjson-csv-xlsx.js +26 -25
- package/package.json +4 -2
- package/wiki/CHANGES.md +9 -0
- package/wiki/CONFIG.md +0 -0
- package/wiki/CONTRIBUTING.md +0 -0
|
File without changes
|
package/docs/static/bitcoin.jpeg
CHANGED
|
File without changes
|
package/docs/static/home.md
CHANGED
|
File without changes
|
|
File without changes
|
package/docs/static/logo.png
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import ndjson from 'ndjson'
|
|
2
|
+
import { Readable } from 'stream'
|
|
3
|
+
import fs from 'fs'
|
|
4
|
+
|
|
5
|
+
const ndjsonReadHandler = function (data, opts = {}) {
|
|
6
|
+
return new Promise((resolve, reject) => {
|
|
7
|
+
const reader = opts.readFromFile ? fs.createReadStream(data) : Readable.from(data)
|
|
8
|
+
const results = []
|
|
9
|
+
reader.pipe(ndjson.parse({ strict: opts.strict ?? true }))
|
|
10
|
+
.on('data', data => {
|
|
11
|
+
results.push(data)
|
|
12
|
+
})
|
|
13
|
+
.on('error', reject)
|
|
14
|
+
.on('end', () => {
|
|
15
|
+
resolve(results)
|
|
16
|
+
})
|
|
17
|
+
})
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
const ndjsonWriteHandler = function (data, opts = {}) {
|
|
21
|
+
return new Promise((resolve, reject) => {
|
|
22
|
+
const stream = ndjson.stringify()
|
|
23
|
+
const results = []
|
|
24
|
+
stream.on('data', line => {
|
|
25
|
+
results.push(line)
|
|
26
|
+
})
|
|
27
|
+
stream.on('finish', () => {
|
|
28
|
+
const items = results.join('\n')
|
|
29
|
+
if (opts.writeToFile) {
|
|
30
|
+
fs.writeFileSync(data, items, 'utf8')
|
|
31
|
+
resolve()
|
|
32
|
+
} else resolve(items)
|
|
33
|
+
})
|
|
34
|
+
stream.write(data)
|
|
35
|
+
stream.end()
|
|
36
|
+
})
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export default [
|
|
40
|
+
{ ext: '.ndjson', readHandler: ndjsonReadHandler, writeHandler: ndjsonWriteHandler },
|
|
41
|
+
{ ext: '.jsonl', readHandler: ndjsonReadHandler, writeHandler: ndjsonWriteHandler }
|
|
42
|
+
]
|
|
File without changes
|
package/extend/bajo/intl/id.json
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/extend/bajoCli/applet.js
CHANGED
|
File without changes
|
package/index.js
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import exportTo from './lib/export-to.js'
|
|
2
|
+
import importFrom from './lib/import-from.js'
|
|
3
|
+
|
|
1
4
|
/**
|
|
2
5
|
* Plugin factory
|
|
3
6
|
*
|
|
@@ -12,10 +15,7 @@ async function factory (pkgName) {
|
|
|
12
15
|
*
|
|
13
16
|
* @class
|
|
14
17
|
*/
|
|
15
|
-
class DoboExtra extends this.app.
|
|
16
|
-
static alias = 'dbx'
|
|
17
|
-
static dependencies = ['dobo', 'bajo-extra']
|
|
18
|
-
|
|
18
|
+
class DoboExtra extends this.app.baseClass.Base {
|
|
19
19
|
constructor () {
|
|
20
20
|
super(pkgName, me.app)
|
|
21
21
|
this.config = {
|
|
@@ -36,6 +36,8 @@ async function factory (pkgName) {
|
|
|
36
36
|
runEarly: true
|
|
37
37
|
}
|
|
38
38
|
}
|
|
39
|
+
|
|
40
|
+
this.selfBind(['exportTo', 'importFrom'])
|
|
39
41
|
}
|
|
40
42
|
|
|
41
43
|
init = async () => {
|
|
@@ -74,6 +76,9 @@ async function factory (pkgName) {
|
|
|
74
76
|
})
|
|
75
77
|
}, this.config.archive.checkInterval * 60 * 1000)
|
|
76
78
|
}
|
|
79
|
+
|
|
80
|
+
exportTo = exportTo
|
|
81
|
+
importFrom = importFrom
|
|
77
82
|
}
|
|
78
83
|
|
|
79
84
|
return DoboExtra
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import path from 'path'
|
|
2
|
-
import
|
|
2
|
+
import { json, ndjson, csv, xlsx } from './ndjson-csv-xlsx.js'
|
|
3
3
|
import { createGzip } from 'node:zlib'
|
|
4
4
|
import scramjet from 'scramjet'
|
|
5
|
-
import supportedExt from '
|
|
5
|
+
import supportedExt from './io-exts.js'
|
|
6
6
|
|
|
7
7
|
const { DataStream } = scramjet
|
|
8
|
-
const { json, ndjson, csv, xlsx } = format
|
|
9
8
|
|
|
10
9
|
async function getFile (dest, ensureDir) {
|
|
11
10
|
const { importPkg, getPluginDataDir } = this.app.bajo
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import path from 'path'
|
|
2
|
-
import
|
|
2
|
+
import { json, ndjson, csv, xlsx } from './ndjson-csv-xlsx.js'
|
|
3
3
|
import { createGunzip } from 'zlib'
|
|
4
|
-
import supportedExt from '
|
|
4
|
+
import supportedExt from './io-exts.js'
|
|
5
5
|
import scramjet from 'scramjet'
|
|
6
6
|
|
|
7
7
|
const { DataStream } = scramjet
|
|
8
|
-
const { json, ndjson, csv, xlsx } = format
|
|
9
8
|
|
|
10
9
|
async function importFrom (source, dest, { trashOld = true, batch = 1, progressFn, converterFn, useHeader = true, fileType, createOpts = {} } = {}, opts = {}) {
|
|
11
10
|
const { getPluginDataDir } = this.app.bajo
|
package/lib/io-exts.js
CHANGED
|
File without changes
|
package/lib/ndjson-csv-xlsx.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// Borrowed from: https://github.com/fanlia/ndjson-csv-xlsx/blob/main/index.js
|
|
2
2
|
|
|
3
|
-
import
|
|
4
|
-
import
|
|
3
|
+
import ndj from 'ndjson'
|
|
4
|
+
import fastCsv from 'fast-csv'
|
|
5
5
|
import xlsxparse from 'xlsx-parse-stream'
|
|
6
6
|
import XLSXWriteStream from '@atomictech/xlsx-write-stream'
|
|
7
7
|
import StreamArray from 'stream-json/streamers/StreamArray.js'
|
|
@@ -11,27 +11,28 @@ import chain from 'stream-chain'
|
|
|
11
11
|
|
|
12
12
|
const XLSXStreamer = XLSXWriteStream.default
|
|
13
13
|
|
|
14
|
-
export
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
14
|
+
export const ndjson = {
|
|
15
|
+
parse: (...args) => ndj.parse(...args),
|
|
16
|
+
stringify: (...args) => ndj.stringify(...args)
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export const csv = {
|
|
20
|
+
parse: (...args) => fastCsv.parse(...args),
|
|
21
|
+
stringify: (...args) => fastCsv.format(...args)
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export const xlsx = {
|
|
25
|
+
parse: (...args) => xlsxparse(...args),
|
|
26
|
+
stringify: (...args) => new XLSXStreamer(...args)
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export const json = {
|
|
30
|
+
parse: (...args) => chain([
|
|
31
|
+
StreamArray.withParser(...args),
|
|
32
|
+
data => data.value
|
|
33
|
+
]),
|
|
34
|
+
stringify: (options, ...args) => chain([
|
|
35
|
+
new Disassembler(),
|
|
36
|
+
new Stringer({ ...options, makeArray: true })
|
|
37
|
+
])
|
|
37
38
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dobo-extra",
|
|
3
|
-
"version": "2.0
|
|
3
|
+
"version": "2.3.0",
|
|
4
4
|
"description": "Bajo DB Extra Tools/Utility",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -9,7 +9,9 @@
|
|
|
9
9
|
},
|
|
10
10
|
"type": "module",
|
|
11
11
|
"bajo": {
|
|
12
|
-
"type": "plugin"
|
|
12
|
+
"type": "plugin",
|
|
13
|
+
"alias": "dbx",
|
|
14
|
+
"dependencies": ["dobo", "bajo-extra"]
|
|
13
15
|
},
|
|
14
16
|
"repository": {
|
|
15
17
|
"type": "git",
|
package/wiki/CHANGES.md
ADDED
package/wiki/CONFIG.md
CHANGED
|
File without changes
|
package/wiki/CONTRIBUTING.md
CHANGED
|
File without changes
|