bajo-extra 1.1.3 → 1.1.4
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 +1 -1
- package/plugin/factory.js +9 -9
package/package.json
CHANGED
package/plugin/factory.js
CHANGED
|
@@ -9,7 +9,7 @@ import { ShortCrypt } from 'short-crypt'
|
|
|
9
9
|
|
|
10
10
|
async function fetching ({ url, opts, bulk, spin }) {
|
|
11
11
|
const { setImmediate, print } = this.app.bajo
|
|
12
|
-
const { isEmpty, isFunction, has } = this.
|
|
12
|
+
const { isEmpty, isFunction, has } = this.lib._
|
|
13
13
|
const { validationErrorMessage } = this.app.bajoDb
|
|
14
14
|
const resp = await this.fetch(url, opts ?? {})
|
|
15
15
|
if (isEmpty(resp)) {
|
|
@@ -57,7 +57,7 @@ async function fetching ({ url, opts, bulk, spin }) {
|
|
|
57
57
|
}
|
|
58
58
|
|
|
59
59
|
async function handler (rec, bulk) {
|
|
60
|
-
const { isFunction, set } = this.
|
|
60
|
+
const { isFunction, set } = this.lib._
|
|
61
61
|
const { recordCreate, recordFind, recordUpdate } = this.app.bajoDb
|
|
62
62
|
const save = bulk.save ?? {}
|
|
63
63
|
const current = save.current ?? {}
|
|
@@ -152,7 +152,7 @@ async function factory (pkgName) {
|
|
|
152
152
|
|
|
153
153
|
// taken from: https://stackoverflow.com/a/41439945
|
|
154
154
|
countFileLines = async (file) => {
|
|
155
|
-
const { fs } = this.
|
|
155
|
+
const { fs } = this.lib
|
|
156
156
|
return new Promise((resolve, reject) => {
|
|
157
157
|
let lineCount = 0
|
|
158
158
|
fs.createReadStream(file)
|
|
@@ -173,10 +173,10 @@ async function factory (pkgName) {
|
|
|
173
173
|
|
|
174
174
|
download = async (url, opts = {}, extra = {}) => {
|
|
175
175
|
const { getPluginDataDir, importPkg, generateId } = this.app.bajo
|
|
176
|
-
const { fs } = this.
|
|
177
|
-
const { isFunction, merge } = this.
|
|
176
|
+
const { fs } = this.lib
|
|
177
|
+
const { isFunction, merge } = this.lib._
|
|
178
178
|
if (typeof opts === 'string') extra = { dir: opts }
|
|
179
|
-
const increment = await importPkg('add-filename-increment')
|
|
179
|
+
const increment = await importPkg('bajo:add-filename-increment')
|
|
180
180
|
if (!extra.dir) {
|
|
181
181
|
extra.dir = `${getPluginDataDir('bajoExtra')}/download`
|
|
182
182
|
fs.ensureDirSync(extra.dir)
|
|
@@ -252,8 +252,8 @@ async function factory (pkgName) {
|
|
|
252
252
|
|
|
253
253
|
fetchUrl = async (url, opts = {}, extra = {}) => {
|
|
254
254
|
const { isSet } = this.app.bajo
|
|
255
|
-
const { fs } = this.
|
|
256
|
-
const { isEmpty, has, isArray, isPlainObject, isString, cloneDeep, merge } = this.
|
|
255
|
+
const { fs } = this.lib
|
|
256
|
+
const { isEmpty, has, isArray, isPlainObject, isString, cloneDeep, merge } = this.lib._
|
|
257
257
|
if (isPlainObject(url)) {
|
|
258
258
|
extra = cloneDeep(opts)
|
|
259
259
|
opts = cloneDeep(url)
|
|
@@ -305,7 +305,7 @@ async function factory (pkgName) {
|
|
|
305
305
|
}
|
|
306
306
|
|
|
307
307
|
gzip = async (file, deleteOld, expand) => {
|
|
308
|
-
const { fs } = this.
|
|
308
|
+
const { fs } = this.lib
|
|
309
309
|
return new Promise((resolve, reject) => {
|
|
310
310
|
const newFile = expand ? file.slice(0, file.length - 3) : (file + '.gz')
|
|
311
311
|
const reader = fs.createReadStream(file)
|