bajo-extra 0.2.3 → 0.2.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.
|
@@ -20,11 +20,12 @@ async function fetchAndSave ({ source = {}, converter, coll, current = {}, optio
|
|
|
20
20
|
await recordCreate(coll, r)
|
|
21
21
|
if (current.coll && current.query) {
|
|
22
22
|
const recs = await recordFind(current.coll, current.query)
|
|
23
|
+
const rc = current.converter ? await current.converter.call(this, r, options) : r
|
|
23
24
|
if (recs.length > 0) {
|
|
24
25
|
const id = recs[0].id
|
|
25
|
-
await recordUpdate(current.coll, id,
|
|
26
|
+
await recordUpdate(current.coll, id, rc)
|
|
26
27
|
} else {
|
|
27
|
-
await recordCreate(current.coll,
|
|
28
|
+
await recordCreate(current.coll, rc)
|
|
28
29
|
}
|
|
29
30
|
}
|
|
30
31
|
if (options.printCount && (count % options.printCount === 0)) print.succeed(`[${spinner.getElapsed()}] Batch line %d/%d`, count, resp.response.length, { showDatetime: true })
|