@engine9-io/input-tools 1.9.0 → 1.9.1
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/index.js +17 -2
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -308,6 +308,20 @@ 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
|
+
if (id) return id;
|
|
317
|
+
|
|
318
|
+
if (!id) {
|
|
319
|
+
throw new Error('No entry_type, nor entry_type_id specified, specify a default.entry_type');
|
|
320
|
+
}
|
|
321
|
+
etype = TIMELINE_ENTRY_TYPES[id];
|
|
322
|
+
if (etype === undefined) throw new Error(`Invalid entry_type: ${etype}`);
|
|
323
|
+
return etype;
|
|
324
|
+
}
|
|
311
325
|
|
|
312
326
|
module.exports = {
|
|
313
327
|
appendPostfix,
|
|
@@ -320,8 +334,10 @@ module.exports = {
|
|
|
320
334
|
FileUtilities,
|
|
321
335
|
getBatchTransform,
|
|
322
336
|
getDebatchTransform,
|
|
323
|
-
|
|
337
|
+
getEntryType,
|
|
338
|
+
getEntryTypeId,
|
|
324
339
|
getFile,
|
|
340
|
+
getManifest,
|
|
325
341
|
getStringArray,
|
|
326
342
|
getTempDir,
|
|
327
343
|
getTempFilename,
|
|
@@ -331,7 +347,6 @@ module.exports = {
|
|
|
331
347
|
getInputUUID,
|
|
332
348
|
getUUIDv7,
|
|
333
349
|
getUUIDTimestamp,
|
|
334
|
-
getEntryTypeId,
|
|
335
350
|
handlebars,
|
|
336
351
|
isValidDate,
|
|
337
352
|
makeStrings,
|