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.
Files changed (54) hide show
  1. package/.github/FUNDING.yml +0 -0
  2. package/.github/workflows/repo-lockdown.yml +0 -0
  3. package/.jsdoc.conf.json +0 -0
  4. package/LICENSE +0 -0
  5. package/README.md +2 -2
  6. package/docs/DoboExtra.html +0 -0
  7. package/docs/data/search.json +0 -0
  8. package/docs/fonts/Inconsolata-Regular.ttf +0 -0
  9. package/docs/fonts/OpenSans-Regular.ttf +0 -0
  10. package/docs/fonts/WorkSans-Bold.ttf +0 -0
  11. package/docs/global.html +0 -0
  12. package/docs/index.html +0 -0
  13. package/docs/index.js.html +0 -0
  14. package/docs/scripts/core.js +476 -477
  15. package/docs/scripts/core.min.js +0 -0
  16. package/docs/scripts/resize.js +36 -36
  17. package/docs/scripts/search.js +105 -105
  18. package/docs/scripts/search.min.js +0 -0
  19. package/docs/scripts/third-party/Apache-License-2.0.txt +0 -0
  20. package/docs/scripts/third-party/fuse.js +1 -1
  21. package/docs/scripts/third-party/hljs-line-num-original.js +282 -285
  22. package/docs/scripts/third-party/hljs-line-num.js +1 -1
  23. package/docs/scripts/third-party/hljs-original.js +1195 -1202
  24. package/docs/scripts/third-party/hljs.js +1 -1
  25. package/docs/scripts/third-party/popper.js +1 -1
  26. package/docs/scripts/third-party/tippy.js +1 -1
  27. package/docs/scripts/third-party/tocbot.js +508 -509
  28. package/docs/scripts/third-party/tocbot.min.js +0 -0
  29. package/docs/static/bitcoin.jpeg +0 -0
  30. package/docs/static/home.md +0 -0
  31. package/docs/static/logo-ecosystem.png +0 -0
  32. package/docs/static/logo.png +0 -0
  33. package/docs/styles/clean-jsdoc-theme-base.css +0 -0
  34. package/docs/styles/clean-jsdoc-theme-dark.css +0 -0
  35. package/docs/styles/clean-jsdoc-theme-light.css +0 -0
  36. package/docs/styles/clean-jsdoc-theme-scrollbar.css +0 -0
  37. package/docs/styles/clean-jsdoc-theme-without-scrollbar.min.css +0 -0
  38. package/docs/styles/clean-jsdoc-theme.min.css +0 -0
  39. package/extend/bajo/config-handlers.js +42 -0
  40. package/extend/bajo/intl/en-US.json +0 -0
  41. package/extend/bajo/intl/id.json +0 -0
  42. package/extend/bajoCli/applet/archive.js +0 -0
  43. package/extend/bajoCli/applet/export-to.js +0 -0
  44. package/extend/bajoCli/applet/import-from.js +0 -0
  45. package/extend/bajoCli/applet.js +0 -0
  46. package/index.js +9 -4
  47. package/{method → lib}/export-to.js +2 -3
  48. package/{method → lib}/import-from.js +2 -3
  49. package/lib/io-exts.js +0 -0
  50. package/lib/ndjson-csv-xlsx.js +26 -25
  51. package/package.json +4 -2
  52. package/wiki/CHANGES.md +9 -0
  53. package/wiki/CONFIG.md +0 -0
  54. package/wiki/CONTRIBUTING.md +0 -0
File without changes
File without changes
File without changes
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
File without changes
File without changes
File without changes
File without changes
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.pluginClass.base {
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 format from '../lib/ndjson-csv-xlsx.js'
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 '../lib/io-exts.js'
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 format from '../lib/ndjson-csv-xlsx.js'
2
+ import { json, ndjson, csv, xlsx } from './ndjson-csv-xlsx.js'
3
3
  import { createGunzip } from 'zlib'
4
- import supportedExt from '../lib/io-exts.js'
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
@@ -1,7 +1,7 @@
1
1
  // Borrowed from: https://github.com/fanlia/ndjson-csv-xlsx/blob/main/index.js
2
2
 
3
- import ndjson from 'ndjson'
4
- import csv from 'fast-csv'
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 default {
15
- ndjson: {
16
- parse: (...args) => ndjson.parse(...args),
17
- stringify: (...args) => ndjson.stringify(...args)
18
- },
19
- csv: {
20
- parse: (...args) => csv.parse(...args),
21
- stringify: (...args) => csv.format(...args)
22
- },
23
- xlsx: {
24
- parse: (...args) => xlsxparse(...args),
25
- stringify: (...args) => new XLSXStreamer(...args)
26
- },
27
- json: {
28
- parse: (...args) => chain([
29
- StreamArray.withParser(...args),
30
- data => data.value
31
- ]),
32
- stringify: (options, ...args) => chain([
33
- new Disassembler(),
34
- new Stringer({ ...options, makeArray: true })
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.1",
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",
@@ -0,0 +1,9 @@
1
+ # Changes
2
+
3
+ ## 2026-03-22
4
+
5
+ - [2.3.0] Add ```.ndjson``` and published to be a ```config handler```
6
+
7
+ ## 2025-12-28
8
+
9
+ - [2.1.0] Ported to ```bajo@2.2.x``` & ```dobo@2.2.x``` specs
package/wiki/CONFIG.md CHANGED
File without changes
File without changes