@engine9-io/input-tools 1.9.0 → 1.9.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.
- package/file/FileUtilities.js +2 -2
- package/index.js +13 -2
- package/package.json +1 -1
package/file/FileUtilities.js
CHANGED
|
@@ -248,8 +248,6 @@ Worker.prototype.fileToObjectStream = async function (options) {
|
|
|
248
248
|
|
|
249
249
|
let count = 0;
|
|
250
250
|
|
|
251
|
-
debug(`Reading file ${filename} with encoding:`, encoding);
|
|
252
|
-
|
|
253
251
|
let transforms = [];
|
|
254
252
|
|
|
255
253
|
if (postfix === 'gz') {
|
|
@@ -265,6 +263,8 @@ Worker.prototype.fileToObjectStream = async function (options) {
|
|
|
265
263
|
}
|
|
266
264
|
let format = formatOverride || postfix;
|
|
267
265
|
|
|
266
|
+
debug(`Reading file ${filename} with encoding: ${encoding} and format ${format}`);
|
|
267
|
+
|
|
268
268
|
if (format === 'csv') {
|
|
269
269
|
const csvTransforms = this.csvToObjectTransforms({ ...options });
|
|
270
270
|
transforms = transforms.concat(csvTransforms.transforms);
|
package/index.js
CHANGED
|
@@ -308,6 +308,16 @@ function getEntryTypeId(o, { defaults = {} } = {}) {
|
|
|
308
308
|
if (id === undefined) throw new Error(`Invalid entry_type: ${etype}`);
|
|
309
309
|
return id;
|
|
310
310
|
}
|
|
311
|
+
function getEntryType(o, defaults = {}) {
|
|
312
|
+
let etype = o.entry_type || defaults.entry_type;
|
|
313
|
+
if (etype) return etype;
|
|
314
|
+
|
|
315
|
+
const id = o.entry_type_id || defaults.entry_type_id;
|
|
316
|
+
|
|
317
|
+
etype = TIMELINE_ENTRY_TYPES[id];
|
|
318
|
+
if (etype === undefined) throw new Error(`Invalid entry_type: ${etype}`);
|
|
319
|
+
return etype;
|
|
320
|
+
}
|
|
311
321
|
|
|
312
322
|
module.exports = {
|
|
313
323
|
appendPostfix,
|
|
@@ -320,8 +330,10 @@ module.exports = {
|
|
|
320
330
|
FileUtilities,
|
|
321
331
|
getBatchTransform,
|
|
322
332
|
getDebatchTransform,
|
|
323
|
-
|
|
333
|
+
getEntryType,
|
|
334
|
+
getEntryTypeId,
|
|
324
335
|
getFile,
|
|
336
|
+
getManifest,
|
|
325
337
|
getStringArray,
|
|
326
338
|
getTempDir,
|
|
327
339
|
getTempFilename,
|
|
@@ -331,7 +343,6 @@ module.exports = {
|
|
|
331
343
|
getInputUUID,
|
|
332
344
|
getUUIDv7,
|
|
333
345
|
getUUIDTimestamp,
|
|
334
|
-
getEntryTypeId,
|
|
335
346
|
handlebars,
|
|
336
347
|
isValidDate,
|
|
337
348
|
makeStrings,
|