@notable/dumper
Advanced tools
Comparing version 3.1.3 to 4.0.0
@@ -1,2 +0,2 @@ | ||
import { Options } from '@notable/html2markdown'; | ||
import type { Options } from 'html2markdown'; | ||
declare const Config: { | ||
@@ -3,0 +3,0 @@ note: { |
@@ -1,4 +0,2 @@ | ||
"use strict"; | ||
/* IMPORT */ | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
/* MAIN */ | ||
@@ -26,3 +24,2 @@ const Config = { | ||
/* EXPORT */ | ||
exports.default = Config; | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY29uZmlnLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vc3JjL2NvbmZpZy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiO0FBQ0EsWUFBWTs7QUFJWixVQUFVO0FBRVYsTUFBTSxNQUFNLEdBQUc7SUFDYixJQUFJLEVBQUU7UUFDSixZQUFZLEVBQUUsVUFBVTtLQUN6QjtJQUNELFVBQVUsRUFBRTtRQUNWLFdBQVcsRUFBRSxVQUFVO0tBQ3hCO0lBQ0QsYUFBYSxFQUFFO1FBQ2IsT0FBTyxFQUFZO1lBQ2pCLGdCQUFnQixFQUFFLEdBQUc7WUFDckIsY0FBYyxFQUFFLFFBQVE7WUFDeEIsV0FBVyxFQUFFLEdBQUc7WUFDaEIsS0FBSyxFQUFFLEtBQUs7WUFDWixZQUFZLEVBQUUsS0FBSztZQUNuQixFQUFFLEVBQUUsS0FBSztZQUNULFNBQVMsRUFBRSxTQUFTO1lBQ3BCLGVBQWUsRUFBRSxJQUFJO1NBQ3RCO0tBQ0Y7Q0FDRixDQUFDO0FBRUYsWUFBWTtBQUVaLGtCQUFlLE1BQU0sQ0FBQyJ9 | ||
export default Config; |
@@ -1,2 +0,2 @@ | ||
import { Source, Options } from './types'; | ||
import type { Source, Options } from './types'; | ||
declare const Dumper: { | ||
@@ -7,8 +7,2 @@ providers: (import("./providers/boostnote").BoostnoteProvider | import("./providers/enex").EnexProvider | import("./providers/html").HTMLProvider | import("./providers/markdown").MarkdownProvider)[]; | ||
}; | ||
declare const _default: typeof Dumper & { | ||
default: typeof Dumper; | ||
} | ||
declare namespace _default { | ||
export type type = Dumper; | ||
} | ||
export = _default; | ||
export default Dumper; |
@@ -1,6 +0,5 @@ | ||
"use strict"; | ||
/* IMPORT */ | ||
const config_1 = require("./config"); | ||
const providers_1 = require("./providers"); | ||
const utils_1 = require("./utils"); | ||
import Config from './config.js'; | ||
import { Boostnote, Enex, HTML, Markdown } from './providers/index.js'; | ||
import Utils from './utils.js'; | ||
/* MAIN */ | ||
@@ -10,6 +9,6 @@ const Dumper = { | ||
providers: [ | ||
providers_1.Boostnote, | ||
providers_1.Enex, | ||
providers_1.HTML, | ||
providers_1.Markdown | ||
Boostnote, | ||
Enex, | ||
HTML, | ||
Markdown | ||
], | ||
@@ -22,4 +21,4 @@ /* API */ | ||
if (options.DOMParser) | ||
config_1.default.html2markdown.options['parser'] = options.DOMParser; | ||
const sources = utils_1.default.lang.castArray(options.source); | ||
Config.html2markdown.options['parser'] = options.DOMParser; | ||
const sources = Utils.lang.castArray(options.source); | ||
const sourcesUnsupported = sources.filter(source => !Dumper.isSupported(source)); | ||
@@ -37,5 +36,2 @@ if (sourcesUnsupported.length) | ||
/* EXPORT */ | ||
module.exports = Dumper; | ||
module.exports.default = Dumper; | ||
Object.defineProperty(module.exports, "__esModule", { value: true }); | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi9zcmMvaW5kZXgudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUNBLFlBQVk7O0FBR1oscUNBQThCO0FBQzlCLDJDQUE0RDtBQUM1RCxtQ0FBNEI7QUFFNUIsVUFBVTtBQUVWLE1BQU0sTUFBTSxHQUFHO0lBRWIsZUFBZTtJQUVmLFN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yxDQUFHLE1BQU0sQ0FBRSxDQUFFLENBQUM7WUFFdkYsSUFBSyxDQUFDLFFBQVE7Z0JBQUcsTUFBTSxJQUFJLEtBQUssQ0FBRyxpQ0FBaUMsTUFBTSxFQUFFLENBQUUsQ0FBQztZQUUvRSxNQUFNLFFBQVEsQ0FBQyxJQUFJLENBQUcsTUFBTSxFQUFFLE9BQU8sQ0FBQyxJQUFJLENBQUUsQ0FBQztTQUU5QztJQUVILENBQUM7Q0FFRixDQUFDO0FBRUYsWUFBWTtBQUVaLGtCQUFlLE1BQU0sQ0FBQyJ9 | ||
export default Dumper; |
@@ -1,2 +0,2 @@ | ||
import { ConstructorWith, Promisable, Attachment, AttachmentMetadata, Note, NoteMetadata, Dump, Content, Source, SourceDetails } from '../../types'; | ||
import type { ConstructorWith, Promisable, Attachment, AttachmentMetadata, Note, NoteMetadata, Dump, Content, Source, SourceDetails } from '../../types'; | ||
declare abstract class AbstractProvider<NoteRaw, AttachmentRaw> { | ||
@@ -3,0 +3,0 @@ abstract name: string; |
@@ -1,9 +0,6 @@ | ||
"use strict"; | ||
/* IMPORT */ | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.AbstractAttachment = exports.AbstractNote = exports.AbstractProvider = void 0; | ||
const entities_decode_1 = require("entities-decode"); | ||
const sanitize_basename_1 = require("sanitize-basename"); | ||
const config_1 = require("../../config"); | ||
const utils_1 = require("../../utils"); | ||
import decode from 'entities-decode'; | ||
import sanitize from 'sanitize-basename'; | ||
import Config from '../../config.js'; | ||
import Utils from '../../utils.js'; | ||
/* MAIN */ | ||
@@ -18,9 +15,9 @@ class AbstractProvider { | ||
isSupported(source) { | ||
return utils_1.default.lang.isString(source) && !!this.extensions.find(ext => source.toLowerCase().endsWith(ext)); | ||
return Utils.lang.isString(source) && !!this.extensions.find(ext => source.toLowerCase().endsWith(ext)); | ||
} | ||
async getDetails(source) { | ||
if (!utils_1.default.lang.isString(source)) | ||
if (!Utils.lang.isString(source)) | ||
return {}; | ||
return { | ||
stats: await utils_1.default.file.stats(source), | ||
stats: await Utils.file.stats(source), | ||
filePath: source | ||
@@ -30,5 +27,5 @@ }; | ||
getContent(source) { | ||
if (utils_1.default.lang.isBuffer(source)) | ||
if (Utils.lang.isBuffer(source)) | ||
return source; | ||
return utils_1.default.file.read(source); | ||
return Utils.file.read(source); | ||
} | ||
@@ -48,3 +45,2 @@ getNotesRaw(content) { | ||
} | ||
exports.AbstractProvider = AbstractProvider; | ||
class AbstractNote { | ||
@@ -65,19 +61,19 @@ /* CONSTRUCTOR */ | ||
sanitizeMetadata(metadata, details) { | ||
const created = utils_1.default.lang.isDateValid(metadata.created) ? metadata.created : (details.stats ? details.stats.birthtime : new Date()); | ||
const modified = utils_1.default.lang.isDateValid(metadata.modified) ? metadata.modified : (details.stats ? details.stats.mtime : created); | ||
const titleFallback = details.filePath ? (0, sanitize_basename_1.default)(utils_1.default.path.name(details.filePath)) || config_1.default.note.defaultTitle : config_1.default.note.defaultTitle; | ||
const created = Utils.lang.isDateValid(metadata.created) ? metadata.created : (details.stats ? details.stats.birthtime : new Date()); | ||
const modified = Utils.lang.isDateValid(metadata.modified) ? metadata.modified : (details.stats ? details.stats.mtime : created); | ||
const titleFallback = details.filePath ? sanitize(Utils.path.name(details.filePath)) || Config.note.defaultTitle : Config.note.defaultTitle; | ||
return { | ||
title: metadata.title ? (0, sanitize_basename_1.default)((0, entities_decode_1.default)(String(metadata.title)).trim()) || titleFallback : titleFallback, | ||
title: metadata.title ? sanitize(decode(String(metadata.title)).trim()) || titleFallback : titleFallback, | ||
tags: metadata.tags ? metadata.tags.map(tag => String(tag).trim()).filter(tag => tag) : [], | ||
attachments: metadata.attachments ? metadata.attachments.map(attachment => { | ||
attachment.metadata.created = utils_1.default.lang.isDateValid(attachment.metadata.created) ? attachment.metadata.created : created; | ||
attachment.metadata.modified = utils_1.default.lang.isDateValid(attachment.metadata.modified) ? attachment.metadata.modified : modified; | ||
attachment.metadata.created = Utils.lang.isDateValid(attachment.metadata.created) ? attachment.metadata.created : created; | ||
attachment.metadata.modified = Utils.lang.isDateValid(attachment.metadata.modified) ? attachment.metadata.modified : modified; | ||
return attachment; | ||
}) : [], | ||
deleted: utils_1.default.lang.isBoolean(metadata.deleted) ? metadata.deleted : false, | ||
favorited: utils_1.default.lang.isBoolean(metadata.favorited) ? metadata.favorited : false, | ||
pinned: utils_1.default.lang.isBoolean(metadata.pinned) ? metadata.pinned : false, | ||
deleted: Utils.lang.isBoolean(metadata.deleted) ? metadata.deleted : false, | ||
favorited: Utils.lang.isBoolean(metadata.favorited) ? metadata.favorited : false, | ||
pinned: Utils.lang.isBoolean(metadata.pinned) ? metadata.pinned : false, | ||
created, | ||
modified, | ||
sourceUrl: utils_1.default.lang.isString(metadata.sourceUrl) ? metadata.sourceUrl : undefined | ||
sourceUrl: Utils.lang.isString(metadata.sourceUrl) ? metadata.sourceUrl : undefined | ||
}; | ||
@@ -89,6 +85,5 @@ } | ||
formatContent(content, metadata) { | ||
return utils_1.default.buffer.fromUtf8(utils_1.default.buffer.toUtf8(content).trim()); | ||
return Utils.buffer.fromUtf8(Utils.buffer.toUtf8(content).trim()); | ||
} | ||
} | ||
exports.AbstractNote = AbstractNote; | ||
class AbstractAttachment { | ||
@@ -101,3 +96,3 @@ /* CONSTRUCTOR */ | ||
async get(attachment) { | ||
const metadatas = utils_1.default.lang.castArray(await this.getMetadata(attachment)).map(metadata => this.sanitizeMetadata(metadata)); | ||
const metadatas = Utils.lang.castArray(await this.getMetadata(attachment)).map(metadata => this.sanitizeMetadata(metadata)); | ||
const contents = await Promise.all(metadatas.map(metadata => this.getContent(attachment, metadata))); | ||
@@ -112,5 +107,5 @@ const attachments = metadatas.map((metadata, i) => ({ metadata, content: contents[i] })); | ||
return { | ||
name: metadata.name ? (0, sanitize_basename_1.default)(String(metadata.name).trim()) || config_1.default.attachment.defaultName : config_1.default.attachment.defaultName, | ||
created: utils_1.default.lang.isDateValid(metadata.created) ? metadata.created : new Date('invalid'), | ||
modified: utils_1.default.lang.isDateValid(metadata.modified) ? metadata.modified : new Date('invalid'), | ||
name: metadata.name ? sanitize(String(metadata.name).trim()) || Config.attachment.defaultName : Config.attachment.defaultName, | ||
created: Utils.lang.isDateValid(metadata.created) ? metadata.created : new Date('invalid'), | ||
modified: Utils.lang.isDateValid(metadata.modified) ? metadata.modified : new Date('invalid'), | ||
mime: metadata.mime | ||
@@ -123,3 +118,3 @@ }; | ||
} | ||
exports.AbstractAttachment = AbstractAttachment; | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi9zcmMvcHJvdmlkZXJzL2Fic3RyYWN0L2luZGV4LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7QUFDQSxZQUFZOzs7QUFFWixxREFBcUM7QUFDckMseURBQXlDO0FBRXpDLHlDQUFrQztBQUNsQyx1Q0FBZ0M7QUFFaEMsVUFBVTtBQUVWLE1BQWUsZ0JBQWdCO0lBVTdCLGlCQUFpQjtJQUVqQixZQUFjLE9BQTBHLFlBQVksRUFBRSxhQUFzSCxrQkFBa0I7UUFFNVEsSUFBSSxDQUFDLElBQUksR0FBRyxJQUFJLElBQUksQ0FBRyxJQUFJLENBQUUsQ0FBQztRQUM5QixJQUFJLENBQUMsVUFBVSxHQUFHLElBQUksVUFBVSxDQUFHLElBQUksQ0FBRSxDQUFDO0lBRTVDLENBQUM7SUFFRCxTQUFTO0lBRVQsV0FBVyxDQUFHLE1BQWM7UUFFMUIsT0FBTyxlQUFLLENBQUMsSUFBSSxDQUFDLFFBQVEsQ0FBRyxNQUFNLENBQUUsSUFBSSxDQUFDLENBQUMsSUFBSSxDQUFDLFVBQVUsQ0FBQyxJQUFJLENBQUcsR0FBRyxDQUFDLEVBQUUsQ0FBQyxNQUFNLENBQUMsV0FBVyxFQUFHLENBQUMsUUFBUSxDQUFHLEdBQUcsQ0FBRS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sUUFBUSxFQUFFLGVBQUssQ0FBQyxJQUFJLENBQUMsV0FBVyxDQUFHLFFBQVEsQ0FBQyxRQUFRLENBQUUsQ0FBQyxDQUFDLENBQUMsUUFBUSxDQUFDLFFBQVEsQ0FBQyxDQUFDLENBQUMsSUFBSSxJQUFJLENBQUcsU0FBUyxDQUFFO1lBQ25HLElBQUksRUFBRSxRQUFRLENBQUMsSUFBSTtTQUNwQixDQUFDO0lBRUosQ0FBQztJQUVELFVBQVUsQ0FBRyxVQUF5QixFQUFFLFFBQTRCO1FBRWxFLE1BQU0sSUFBSSxLQUFLLENBQUcsK0NBQStDLENBQUUsQ0FBQztJQUV0RSxDQUFDO0NBRUY7QUFJdUMsZ0RBQWtCIn0= | ||
/* EXPORT */ | ||
export { AbstractProvider, AbstractNote, AbstractAttachment }; |
@@ -1,4 +0,4 @@ | ||
import { AttachmentMetadata, NoteMetadata, Content, SourceDetails } from '../../types'; | ||
import type { AttachmentMetadata, NoteMetadata, Content, SourceDetails } from '../../types'; | ||
import { AbstractProvider, AbstractNote, AbstractAttachment } from '../abstract'; | ||
import { AttachmentRaw, NoteRaw } from './types'; | ||
import type { AttachmentRaw, NoteRaw } from './types'; | ||
declare class BoostnoteProvider extends AbstractProvider<NoteRaw, AttachmentRaw> { | ||
@@ -5,0 +5,0 @@ name: string; |
@@ -1,11 +0,9 @@ | ||
"use strict"; | ||
/* IMPORT */ | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.BoostnoteAttachment = exports.BoostnoteNote = exports.BoostnoteProvider = void 0; | ||
const cson2json_1 = require("cson2json"); | ||
const path = require("path"); | ||
const utils_1 = require("../../utils"); | ||
const abstract_1 = require("../abstract"); | ||
import cson2json from 'cson2json'; | ||
import path from 'node:path'; | ||
import process from 'node:process'; | ||
import Utils from '../../utils.js'; | ||
import { AbstractProvider, AbstractNote, AbstractAttachment } from '../abstract/index.js'; | ||
/* MAIN */ | ||
class BoostnoteProvider extends abstract_1.AbstractProvider { | ||
class BoostnoteProvider extends AbstractProvider { | ||
constructor() { | ||
@@ -19,13 +17,12 @@ /* VARIABLES */ | ||
getNotesRaw(content) { | ||
return [(0, cson2json_1.default)(utils_1.default.buffer.toUtf8(content))]; | ||
return [cson2json(Utils.buffer.toUtf8(content))]; | ||
} | ||
} | ||
exports.BoostnoteProvider = BoostnoteProvider; | ||
class BoostnoteNote extends abstract_1.AbstractNote { | ||
class BoostnoteNote extends AbstractNote { | ||
async getMetadata(note, details) { | ||
const attachmentsPaths = this.getAttachmentsPaths(note, details); | ||
return { | ||
title: note.title || utils_1.default.format.markdown.inferTitle(note.content || ''), | ||
title: note.title || Utils.format.markdown.inferTitle(note.content || ''), | ||
tags: note.tags, | ||
attachments: utils_1.default.lang.flatten(await Promise.all(attachmentsPaths.map(attachmentPath => this.provider.attachment.get(attachmentPath)))), | ||
attachments: Utils.lang.flatten(await Promise.all(attachmentsPaths.map(attachmentPath => this.provider.attachment.get(attachmentPath)))), | ||
deleted: note.isTrashed, | ||
@@ -40,4 +37,4 @@ favorited: note.isStarred, | ||
return []; | ||
const attachmentsLinks = note.content ? utils_1.default.lang.matchAll(note.content, /\]\(:storage\/([^)]+)\)/gi) : []; | ||
const attachmentsCwd = process.env.IS_TEST ? path.resolve(details.filePath, '..', 'attachments') : path.resolve(details.filePath, '..', '..', 'attachments'); | ||
const attachmentsLinks = note.content ? Utils.lang.matchAll(note.content, /\]\(:storage\/([^)]+)\)/gi) : []; | ||
const attachmentsCwd = process.env['IS_TEST'] ? path.resolve(details.filePath, '..', 'attachments') : path.resolve(details.filePath, '..', '..', 'attachments'); | ||
const attachmentsPaths = attachmentsLinks.map(match => path.join(attachmentsCwd, match[1])); | ||
@@ -47,3 +44,3 @@ return attachmentsPaths; | ||
getContent(note) { | ||
return utils_1.default.buffer.fromUtf8(note.content || ''); | ||
return Utils.buffer.fromUtf8(note.content || ''); | ||
} | ||
@@ -54,9 +51,8 @@ formatAttachmentsLinks(content) { | ||
formatContent(content, metadata) { | ||
let str = utils_1.default.buffer.toUtf8(content).trim(); | ||
let str = Utils.buffer.toUtf8(content).trim(); | ||
str = this.formatAttachmentsLinks(str); | ||
return utils_1.default.buffer.fromUtf8(str); | ||
return Utils.buffer.fromUtf8(str); | ||
} | ||
} | ||
exports.BoostnoteNote = BoostnoteNote; | ||
class BoostnoteAttachment extends abstract_1.AbstractAttachment { | ||
class BoostnoteAttachment extends AbstractAttachment { | ||
getMetadata(attachment) { | ||
@@ -68,7 +64,7 @@ return { | ||
getContent(attachment) { | ||
return utils_1.default.file.read(attachment); | ||
return Utils.file.read(attachment); | ||
} | ||
} | ||
exports.BoostnoteAttachment = BoostnoteAttachment; | ||
exports.default = new BoostnoteProvider(BoostnoteNote, BoostnoteAttachment); | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi9zcmMvcHJvdmlkZXJzL2Jvb3N0bm90ZS9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiO0FBQ0EsWUFBWTs7O0FBRVoseUNBQWtDO0FBQ2xDLDZCQUE2QjtBQUU3Qix1Q0FBZ0M7QUFDaEMsMENBQStFO0FBRy9FLFVBQVU7QUFFVixNQUFNLGlCQUFrQixTQUFRLDJCQUF3QztJQUF4RTtRQUVFLGVBQWU7O1FBRWYsU0FBSSxHQUFHLFdBQVcsQ0FBQztRQUNuQixlQUFVLEdBQUcsQ0FBQyxPQUFPLENBQUMsQ0FBQztJQVV6QixDQUFDO0lBUkMsU0FBUztJQUVULFdBQVcsQ0FBRyxPQUFnQjtRQUU1QixPQUFPLENBQUMsSUFBQSxtQkFBUyxFQUFHLGVBQUssQ0FBQyxNQUFNLENBQUMsTUFBTSxDQUFHLE9BQU8sQ0FBRSxDQUFFLENBQUMsQ0FBQztJQUV6RCxDQUFDO0NBRUY7QUE0RU8sOENBQWlCO0FBMUV6QixNQUFNLGFBQW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DQUFDLElBQUksRUFBRyxDQUFDO1FBRWxELEdBQUcsR0FBRyxJQUFJLENBQUMsc0JBQXNCLENBQUcsR0FBRyxDQUFFLENBQUM7UUFFMUMsT0FBTyxlQUFLLENBQUMsTUFBTSxDQUFDLFFBQVEsQ0FBRyxHQUFHLENBQUUsQ0FBQztJQUV2QyxDQUFDO0NBRUY7QUFzQjBCLHNDQUFhO0FBcEJ4QyxNQUFNLG1CQUFvQixTQUFRLDZCQUEwQztJQUUxRSxXQUFXLENBQUcsVUFBeUI7UUFFckMsT0FBTztZQUNMLElBQUksRUFBRSxJQUFJLENBQUMsUUFBUSxDQUFHLFVBQVUsQ0FBRTtTQUNuQyxDQUFDO0lBRUosQ0FBQztJQUVELFVBQVUsQ0FBRyxVQUF5QjtRQUVwQyxPQUFPLGVBQUssQ0FBQyxJQUFJLENBQUMsSUFBSSxDQUFHLFVBQVUsQ0FBRSxDQUFDO0lBRXhDLENBQUM7Q0FFRjtBQUl5QyxrREFBbUI7QUFDN0Qsa0JBQWUsSUFBSSxpQkFBaUIsQ0FBRyxhQUFhLEVBQUUsbUJBQW1CLENBQUUsQ0FBQyJ9 | ||
/* EXPORT */ | ||
export { BoostnoteProvider, BoostnoteNote, BoostnoteAttachment }; | ||
export default new BoostnoteProvider(BoostnoteNote, BoostnoteAttachment); |
declare type AttachmentRaw = string; | ||
declare type NoteRaw = any; | ||
export { AttachmentRaw, NoteRaw }; | ||
export type { AttachmentRaw, NoteRaw }; |
@@ -1,4 +0,2 @@ | ||
"use strict"; | ||
/* MAIN */ | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidHlwZXMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi9zcmMvcHJvdmlkZXJzL2Jvb3N0bm90ZS90eXBlcy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiO0FBQ0EsVUFBVSJ9 | ||
export {}; |
@@ -1,4 +0,4 @@ | ||
import { AttachmentMetadata, NoteMetadata, Content } from '../../types'; | ||
import type { AttachmentMetadata, NoteMetadata, Content } from '../../types'; | ||
import { AbstractProvider, AbstractNote, AbstractAttachment } from '../abstract'; | ||
import { AttachmentRaw, NoteRaw } from './types'; | ||
import type { AttachmentRaw, NoteRaw } from './types'; | ||
declare class EnexProvider extends AbstractProvider<NoteRaw, AttachmentRaw> { | ||
@@ -5,0 +5,0 @@ name: string; |
@@ -1,10 +0,7 @@ | ||
"use strict"; | ||
/* IMPORT */ | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.EnexAttachment = exports.EnexNote = exports.EnexProvider = void 0; | ||
const fast_xml_parser_1 = require("fast-xml-parser"); | ||
const utils_1 = require("../../utils"); | ||
const abstract_1 = require("../abstract"); | ||
import { parse as xml2js } from 'fast-xml-parser'; | ||
import Utils from '../../utils.js'; | ||
import { AbstractProvider, AbstractNote, AbstractAttachment } from '../abstract/index.js'; | ||
/* MAIN */ | ||
class EnexProvider extends abstract_1.AbstractProvider { | ||
class EnexProvider extends AbstractProvider { | ||
constructor() { | ||
@@ -18,13 +15,12 @@ /* VARIABLES */ | ||
getNotesRaw(content) { | ||
return utils_1.default.lang.castArray((0, fast_xml_parser_1.parse)(utils_1.default.buffer.toUtf8(content))['en-export'].note); | ||
return Utils.lang.castArray(xml2js(Utils.buffer.toUtf8(content))['en-export'].note); | ||
} | ||
} | ||
exports.EnexProvider = EnexProvider; | ||
class EnexNote extends abstract_1.AbstractNote { | ||
class EnexNote extends AbstractNote { | ||
async getMetadata(note) { | ||
const resources = note.resource ? utils_1.default.lang.castArray(note.resource).filter(resource => !!resource && !!resource.data) : []; | ||
const resources = note.resource ? Utils.lang.castArray(note.resource).filter(resource => !!resource && !!resource.data) : []; | ||
return { | ||
title: note.title || utils_1.default.format.html.inferTitle(note.content || ''), | ||
tags: note.tag && utils_1.default.lang.castArray(note.tag), | ||
attachments: utils_1.default.lang.flatten(await Promise.all(resources.map(resource => this.provider.attachment.get(resource)))), | ||
title: note.title || Utils.format.html.inferTitle(note.content || ''), | ||
tags: note.tag && Utils.lang.castArray(note.tag), | ||
attachments: Utils.lang.flatten(await Promise.all(resources.map(resource => this.provider.attachment.get(resource)))), | ||
created: note.created && this.parseDate(note.created), | ||
@@ -44,3 +40,3 @@ modified: note.updated && this.parseDate(note.updated), | ||
getContent(note) { | ||
return utils_1.default.buffer.fromUtf8(note.content || ''); | ||
return Utils.buffer.fromUtf8(note.content || ''); | ||
} | ||
@@ -51,10 +47,9 @@ formatSourceUrl(content, sourceUrl) { | ||
formatContent(content, metadata) { | ||
let str = utils_1.default.format.html.convert(utils_1.default.buffer.toUtf8(content), metadata.title); | ||
let str = Utils.format.html.convert(Utils.buffer.toUtf8(content), metadata.title); | ||
if (metadata.sourceUrl) | ||
str = this.formatSourceUrl(str, metadata.sourceUrl); | ||
return utils_1.default.buffer.fromUtf8(str); | ||
return Utils.buffer.fromUtf8(str); | ||
} | ||
} | ||
exports.EnexNote = EnexNote; | ||
class EnexAttachment extends abstract_1.AbstractAttachment { | ||
class EnexAttachment extends AbstractAttachment { | ||
getMetadata(attachment) { | ||
@@ -68,5 +63,5 @@ const metadatas = []; | ||
if (attachment.recognition) { | ||
const recognition = (0, fast_xml_parser_1.parse)(attachment.recognition, { ignoreAttributes: false }); | ||
const recognition = xml2js(attachment.recognition, { ignoreAttributes: false }); | ||
if (recognition.recoIndex && recognition.recoIndex['@_objID']) { | ||
const ext = utils_1.default.mime.inferExtension(attachment.mime); | ||
const ext = Utils.mime.inferExtension(attachment.mime); | ||
const name = `${recognition.recoIndex['@_objID']}${ext}`; | ||
@@ -79,7 +74,7 @@ metadatas.push({ name, mime }); | ||
getContent(attachment) { | ||
return utils_1.default.buffer.fromBase64(attachment.data); | ||
return Utils.buffer.fromBase64(attachment.data); | ||
} | ||
} | ||
exports.EnexAttachment = EnexAttachment; | ||
exports.default = new EnexProvider(EnexNote, EnexAttachment); | ||
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BRXBDLE9BQU8sZUFBSyxDQUFDLE1BQU0sQ0FBQyxVQUFVLENBQUcsVUFBVSxDQUFDLElBQUksQ0FBRSxDQUFDO0lBRXJELENBQUM7Q0FFRjtBQUkrQix3Q0FBYztBQUM5QyxrQkFBZSxJQUFJLFlBQVksQ0FBRyxRQUFRLEVBQUUsY0FBYyxDQUFFLENBQUMifQ== | ||
/* EXPORT */ | ||
export { EnexProvider, EnexNote, EnexAttachment }; | ||
export default new EnexProvider(EnexNote, EnexAttachment); |
declare type AttachmentRaw = XML; | ||
declare type NoteRaw = XML; | ||
declare type XML = any; | ||
export { AttachmentRaw, NoteRaw }; | ||
export type { AttachmentRaw, NoteRaw }; |
@@ -1,4 +0,2 @@ | ||
"use strict"; | ||
/* MAIN */ | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidHlwZXMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi9zcmMvcHJvdmlkZXJzL2VuZXgvdHlwZXMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUNBLFVBQVUifQ== | ||
export {}; |
@@ -1,4 +0,4 @@ | ||
import { NoteMetadata, Content } from '../../types'; | ||
import type { NoteMetadata, Content } from '../../types'; | ||
import { AbstractProvider, AbstractNote } from '../abstract'; | ||
import { AttachmentRaw, NoteRaw } from './types'; | ||
import type { AttachmentRaw, NoteRaw } from './types'; | ||
declare class HTMLProvider extends AbstractProvider<NoteRaw, AttachmentRaw> { | ||
@@ -5,0 +5,0 @@ name: string; |
@@ -1,9 +0,6 @@ | ||
"use strict"; | ||
/* IMPORT */ | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.HTMLNote = exports.HTMLProvider = void 0; | ||
const utils_1 = require("../../utils"); | ||
const abstract_1 = require("../abstract"); | ||
import Utils from '../../utils.js'; | ||
import { AbstractProvider, AbstractNote } from '../abstract/index.js'; | ||
/* MAIN */ | ||
class HTMLProvider extends abstract_1.AbstractProvider { | ||
class HTMLProvider extends AbstractProvider { | ||
constructor() { | ||
@@ -16,15 +13,14 @@ /* VARIABLES */ | ||
} | ||
exports.HTMLProvider = HTMLProvider; | ||
class HTMLNote extends abstract_1.AbstractNote { | ||
class HTMLNote extends AbstractNote { | ||
getMetadata(note) { | ||
return { | ||
title: utils_1.default.format.html.inferTitle(utils_1.default.buffer.toUtf8(note)) | ||
title: Utils.format.html.inferTitle(Utils.buffer.toUtf8(note)) | ||
}; | ||
} | ||
formatContent(content, metadata) { | ||
return utils_1.default.buffer.fromUtf8(utils_1.default.format.html.convert(utils_1.default.buffer.toUtf8(content), metadata.title)); | ||
return Utils.buffer.fromUtf8(Utils.format.html.convert(Utils.buffer.toUtf8(content), metadata.title)); | ||
} | ||
} | ||
exports.HTMLNote = HTMLNote; | ||
exports.default = new HTMLProvider(HTMLNote); | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi9zcmMvcHJvdmlkZXJzL2h0bWwvaW5kZXgudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUNBLFlBQVk7OztBQUdaLHVDQUFnQztBQUNoQywwQ0FBMkQ7QUFHM0QsVUFBVTtBQUVWLE1BQU0sWUFBYSxTQUFRLDJCQUF3QztJQUFuRTtRQUVFLGVBQWU7O1FBRWYsU0FBSSxHQUFHLE1BQU0sQ0FBQztRQUNkLGVBQVUsR0FBRyxDQUFDLE9BQU8sRUFBRSxNQUFNLENBQUMsQ0FBQztJQUVqQyxDQUFDO0NBQUE7QUFzQk8sb0NBQVk7QUFwQnBCLE1BQU0sUUFBUyxTQUFRLHVCQUFvQztJQUV6RCxXQUFXLENBQUcsSUFBYTtRQUV6QixPQUFPO1lBQ0wsS0FBSyxFQUFFLGVBQUssQ0FBQyxNQUFNLENBQUMsSUFBSSxDQUFDLFVBQVUsQ0FBRyxlQUFLLENBQUMsTUFBTSxDQUFDLE1BQU0sQ0FBRyxJQUFJLENBQUUsQ0FBRTtTQUNyRSxDQUFDO0lBRUosQ0FBQztJQUVELGFBQWEsQ0FBRyxPQUFnQixFQUFFLFFBQXNCO1FBRXRELE9BQU8sZUFBSyxDQUFDLE1BQU0sQ0FBQyxRQUFRLENBQUcsZUFBSyxDQUFDLE1BQU0sQ0FBQyxJQUFJLENBQUMsT0FBTyxDQUFHLGVBQUssQ0FBQyxNQUFNLENBQUMsTUFBTSxDQUFHLE9BQU8sQ0FBRSxFQUFFLFFBQVEsQ0FBQyxLQUFLLENBQUUsQ0FBRSxDQUFDO0lBRWpILENBQUM7Q0FFRjtBQUlxQiw0QkFBUTtBQUM5QixrQkFBZSxJQUFJLFlBQVksQ0FBRyxRQUFRLENBQUUsQ0FBQyJ9 | ||
/* EXPORT */ | ||
export { HTMLProvider, HTMLNote }; | ||
export default new HTMLProvider(HTMLNote); |
declare type AttachmentRaw = undefined; | ||
declare type NoteRaw = Uint8Array; | ||
export { AttachmentRaw, NoteRaw }; | ||
export type { AttachmentRaw, NoteRaw }; |
@@ -1,4 +0,2 @@ | ||
"use strict"; | ||
/* MAIN */ | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidHlwZXMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi9zcmMvcHJvdmlkZXJzL2h0bWwvdHlwZXMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUNBLFVBQVUifQ== | ||
export {}; |
@@ -1,13 +0,7 @@ | ||
"use strict"; | ||
/* IMPORT */ | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.Markdown = exports.HTML = exports.Enex = exports.Boostnote = void 0; | ||
const boostnote_1 = require("./boostnote"); | ||
exports.Boostnote = boostnote_1.default; | ||
const enex_1 = require("./enex"); | ||
exports.Enex = enex_1.default; | ||
const html_1 = require("./html"); | ||
exports.HTML = html_1.default; | ||
const markdown_1 = require("./markdown"); | ||
exports.Markdown = markdown_1.default; | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvcHJvdmlkZXJzL2luZGV4LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7QUFDQSxZQUFZOzs7QUFFWiwyQ0FBb0M7QUFPNUIsb0JBUEQsbUJBQVMsQ0FPQztBQU5qQixpQ0FBMEI7QUFNUCxlQU5aLGNBQUksQ0FNWTtBQUx2QixpQ0FBMEI7QUFLRCxlQUxsQixjQUFJLENBS2tCO0FBSjdCLHlDQUFrQztBQUlILG1CQUp4QixrQkFBUSxDQUl3QiJ9 | ||
import Boostnote from './boostnote/index.js'; | ||
import Enex from './enex/index.js'; | ||
import HTML from './html/index.js'; | ||
import Markdown from './markdown/index.js'; | ||
/* EXPORT */ | ||
export { Boostnote, Enex, HTML, Markdown }; |
@@ -1,4 +0,4 @@ | ||
import { NoteMetadata } from '../../types'; | ||
import type { NoteMetadata } from '../../types'; | ||
import { AbstractProvider, AbstractNote } from '../abstract'; | ||
import { AttachmentRaw, NoteRaw } from './types'; | ||
import type { AttachmentRaw, NoteRaw } from './types'; | ||
declare class MarkdownProvider extends AbstractProvider<NoteRaw, AttachmentRaw> { | ||
@@ -5,0 +5,0 @@ name: string; |
@@ -1,9 +0,6 @@ | ||
"use strict"; | ||
/* IMPORT */ | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.MarkdownNote = exports.MarkdownProvider = void 0; | ||
const utils_1 = require("../../utils"); | ||
const abstract_1 = require("../abstract"); | ||
import Utils from '../../utils.js'; | ||
import { AbstractProvider, AbstractNote } from '../abstract/index.js'; | ||
/* MAIN */ | ||
class MarkdownProvider extends abstract_1.AbstractProvider { | ||
class MarkdownProvider extends AbstractProvider { | ||
constructor() { | ||
@@ -16,12 +13,11 @@ /* VARIABLES */ | ||
} | ||
exports.MarkdownProvider = MarkdownProvider; | ||
class MarkdownNote extends abstract_1.AbstractNote { | ||
class MarkdownNote extends AbstractNote { | ||
getMetadata(note) { | ||
return { | ||
title: utils_1.default.format.markdown.inferTitle(utils_1.default.buffer.toUtf8(note)) | ||
title: Utils.format.markdown.inferTitle(Utils.buffer.toUtf8(note)) | ||
}; | ||
} | ||
} | ||
exports.MarkdownNote = MarkdownNote; | ||
exports.default = new MarkdownProvider(MarkdownNote); | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi9zcmMvcHJvdmlkZXJzL21hcmtkb3duL2luZGV4LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7QUFDQSxZQUFZOzs7QUFHWix1Q0FBZ0M7QUFDaEMsMENBQTJEO0FBRzNELFVBQVU7QUFFVixNQUFNLGdCQUFpQixTQUFRLDJCQUF3QztJQUF2RTtRQUVFLGVBQWU7O1FBRWYsU0FBSSxHQUFHLFVBQVUsQ0FBQztRQUNsQixlQUFVLEdBQUcsQ0FBQyxLQUFLLEVBQUUsTUFBTSxFQUFFLE9BQU8sRUFBRSxPQUFPLEVBQUUsUUFBUSxFQUFFLFdBQVcsRUFBRSxTQUFTLEVBQUUsUUFBUSxFQUFFLFNBQVMsRUFBRSxNQUFNLEVBQUUsTUFBTSxFQUFFLE1BQU0sQ0FBQyxDQUFDO0lBRWhJLENBQUM7Q0FBQTtBQWdCTyw0Q0FBZ0I7QUFkeEIsTUFBTSxZQUFhLFNBQVEsdUJBQW9DO0lBRTdELFdBQVcsQ0FBRyxJQUFhO1FBRXpCLE9BQU87WUFDTCxLQUFLLEVBQUUsZUFBSyxDQUFDLE1BQU0sQ0FBQyxRQUFRLENBQUMsVUFBVSxDQUFHLGVBQUssQ0FBQyxNQUFNLENBQUMsTUFBTSxDQUFHLElBQUksQ0FBRSxDQUFFO1NBQ3pFLENBQUM7SUFFSixDQUFDO0NBRUY7QUFJeUIsb0NBQVk7QUFDdEMsa0JBQWUsSUFBSSxnQkFBZ0IsQ0FBRyxZQUFZLENBQUUsQ0FBQyJ9 | ||
/* EXPORT */ | ||
export { MarkdownProvider, MarkdownNote }; | ||
export default new MarkdownProvider(MarkdownNote); |
declare type AttachmentRaw = undefined; | ||
declare type NoteRaw = Uint8Array; | ||
export { AttachmentRaw, NoteRaw }; | ||
export type { AttachmentRaw, NoteRaw }; |
@@ -1,4 +0,2 @@ | ||
"use strict"; | ||
/* MAIN */ | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidHlwZXMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi9zcmMvcHJvdmlkZXJzL21hcmtkb3duL3R5cGVzLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7QUFDQSxVQUFVIn0= | ||
export {}; |
/// <reference types="node" /> | ||
import { Stats } from 'fs'; | ||
import type { Stats } from 'fs'; | ||
declare type Constructor<T> = { | ||
@@ -50,3 +50,3 @@ new (): T; | ||
}; | ||
export { Constructor, ConstructorWith, Promisable }; | ||
export { DOMParser, Attachment, AttachmentMetadata, Note, NoteMetadata, Dump, Source, SourceDetails, Content, Stats, Options }; | ||
export type { Constructor, ConstructorWith, Promisable }; | ||
export type { DOMParser, Attachment, AttachmentMetadata, Note, NoteMetadata, Dump, Source, SourceDetails, Content, Stats, Options }; |
@@ -1,7 +0,2 @@ | ||
"use strict"; | ||
/* IMPORT */ | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.Stats = void 0; | ||
const fs_1 = require("fs"); | ||
Object.defineProperty(exports, "Stats", { enumerable: true, get: function () { return fs_1.Stats; } }); | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidHlwZXMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi9zcmMvdHlwZXMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUNBLFlBQVk7OztBQUVaLDJCQUF5QjtBQWlFb0Ysc0ZBakVyRyxVQUFLLE9BaUVxRyJ9 | ||
export {}; |
@@ -1,2 +0,2 @@ | ||
import { Stats } from './types'; | ||
import type { Stats } from './types'; | ||
declare const Utils: { | ||
@@ -43,3 +43,3 @@ buffer: { | ||
ensureTitle: (content: string, title: string) => string; | ||
convert: (content: string, title?: string | undefined) => string; | ||
convert: (content: string, title?: string) => string; | ||
}; | ||
@@ -46,0 +46,0 @@ }; |
@@ -1,11 +0,9 @@ | ||
"use strict"; | ||
/* IMPORT */ | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const html2markdown_1 = require("@notable/html2markdown"); | ||
const decode_base64_1 = require("decode-base64"); | ||
const fs = require("fs"); | ||
const mime2ext_1 = require("mime2ext"); | ||
const path = require("path"); | ||
const uint8_encoding_1 = require("uint8-encoding"); | ||
const config_1 = require("./config"); | ||
import decodeBase64 from 'decode-base64'; | ||
import html2markdown from 'html2markdown'; | ||
import mime2ext from 'mime2ext'; | ||
import fs from 'node:fs'; | ||
import path from 'node:path'; | ||
import U8 from 'uint8-encoding'; | ||
import Config from './config.js'; | ||
/* MAIN */ | ||
@@ -17,9 +15,9 @@ const Utils = { | ||
string = string.replace(/\r?\n|\r/g, ''); // Sanitization for stupid inputs like Evernote's | ||
return (0, decode_base64_1.default)(string); | ||
return decodeBase64(string); | ||
}, | ||
fromUtf8: (string) => { | ||
return uint8_encoding_1.default.encode(string); | ||
return U8.encode(string); | ||
}, | ||
toUtf8: (buffer) => { | ||
return uint8_encoding_1.default.decode(buffer); | ||
return U8.decode(buffer); | ||
} | ||
@@ -29,3 +27,3 @@ }, | ||
isArray: (value) => { | ||
return value instanceof Array; | ||
return Array.isArray(value); | ||
}, | ||
@@ -48,3 +46,3 @@ isBoolean: (value) => { | ||
flatten: (value) => { | ||
return [].concat.apply([], value); | ||
return [].concat.apply([], value); //TSC | ||
}, | ||
@@ -57,3 +55,3 @@ matchAll: (str, re) => { | ||
inferExtension: (type) => { | ||
const ext = (0, mime2ext_1.default)(type); | ||
const ext = mime2ext(type); | ||
return ext ? `.${ext}` : ''; | ||
@@ -67,9 +65,4 @@ }, | ||
getMaxHeapSize: () => { | ||
try { | ||
return performance['memory'].jsHeapSizeLimit; | ||
} | ||
catch { | ||
return 2197815296; // Hard-coded for better web compatibility, source: "require ( 'v8' ).getHeapStatistics ().heap_size_limit" | ||
} | ||
}, | ||
return 2197815296; // Hard-coded for better web compatibility, source: "require ( 'v8' ).getHeapStatistics ().heap_size_limit" | ||
} | ||
}, | ||
@@ -150,3 +143,3 @@ file: { | ||
content = Utils.format.html.ensureTitle(content, title); | ||
return (0, html2markdown_1.default)(content, config_1.default.html2markdown.options); | ||
return html2markdown(content, Config.html2markdown.options); | ||
} | ||
@@ -157,3 +150,2 @@ } | ||
/* EXPORT */ | ||
exports.default = Utils; | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidXRpbHMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi9zcmMvdXRpbHMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUNBLFlBQVk7O0FBRVosMERBQW1EO0FBQ25ELGlEQUF5QztBQUN6Qyx5QkFBeUI7QUFDekIsdUNBQWdDO0FBQ2hDLDZCQUE2QjtBQUM3QixtREFBZ0M7QUFFaEMscUNBQThCO0FBRTlCLFVBQVU7QUFFVixNQUFNLEtBQUssR0FBRztJQUVaLFNBQVM7SUFFVCxNQUFNLEVBQUU7UUFFTixVQUFVLEVBQUUsQ0FBRSxNQUFjLEVBQWUsRUFBRTtZQU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lBRUgsQ0FBQztZQUVELE9BQU8sRUFBRSxDQUFFLE9BQWUsRUFBRSxLQUFjLEVBQVcsRUFBRTtnQkFFckQsS0FBSyxHQUFHLEtBQUssSUFBSSxLQUFLLENBQUMsTUFBTSxDQUFDLElBQUksQ0FBQyxVQUFVLENBQUcsT0FBTyxDQUFFLENBQUM7Z0JBRTFELElBQUssS0FBSztvQkFBRyxPQUFPLEdBQUcsS0FBSyxDQUFDLE1BQU0sQ0FBQyxJQUFJLENBQUMsV0FBVyxDQUFHLE9BQU8sRUFBRSxLQUFLLENBQUUsQ0FBQztnQkFFeEUsT0FBTyxJQUFBLHVCQUFhLEVBQUcsT0FBTyxFQUFFLGdCQUFNLENBQUMsYUFBYSxDQUFDLE9BQU8sQ0FBRSxDQUFDO1lBRWpFLENBQUM7U0FFRjtLQUVGO0NBRUYsQ0FBQztBQUVGLFlBQVk7QUFFWixrQkFBZSxLQUFLLENBQUMifQ== | ||
export default Utils; |
{ | ||
"name": "@notable/dumper", | ||
"repository": "github:fabiospampinato/@notable/dumper", | ||
"description": "Library for extracting attachments, notes and metadata out of formats used by popular note-taking apps.", | ||
"version": "3.1.3", | ||
"version": "4.0.0", | ||
"type": "module", | ||
"main": "dist/index.js", | ||
"exports": "./dist/index.js", | ||
"types": "./dist/index.d.ts", | ||
"files": [ | ||
@@ -10,22 +14,9 @@ "dist", | ||
], | ||
"types": "dist/index.d.ts", | ||
"scripts": { | ||
"clean": "rimraf dist", | ||
"compile": "tsc --skipLibCheck && tstei", | ||
"compile:watch": "tsc --skipLibCheck --watch", | ||
"clean": "tsex clean", | ||
"compile": "tsex compile", | ||
"compile:watch": "tsex compile --watch", | ||
"test": "node ./test/index.js", | ||
"prepublishOnly": "npm run clean && npm run compile && npm run test" | ||
}, | ||
"bugs": { | ||
"url": "https://github.com/notable/dumper/issues" | ||
}, | ||
"license": "MIT", | ||
"author": { | ||
"name": "Fabio Spampinato", | ||
"email": "spampinabio@gmail.com" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/notable/dumper.git" | ||
}, | ||
"keywords": [ | ||
@@ -40,22 +31,19 @@ "dump", | ||
"dependencies": { | ||
"@notable/html2markdown": "^1.1.3", | ||
"cson2json": "^1.0.0", | ||
"decode-base64": "^2.0.0", | ||
"entities-decode": "^1.0.0", | ||
"fast-xml-parser": "3.17.4", | ||
"mime2ext": "^1.0.1", | ||
"sanitize-basename": "^1.0.0", | ||
"uint8-encoding": "^1.0.0" | ||
"cson2json": "^2.0.0", | ||
"decode-base64": "^3.0.1", | ||
"entities-decode": "^2.0.0", | ||
"fast-xml-parser": "^3.21.1", | ||
"html2markdown": "npm:@notable/html2markdown@2.0.2", | ||
"mime2ext": "^2.0.0", | ||
"sanitize-basename": "^2.0.0", | ||
"uint8-encoding": "^2.0.0" | ||
}, | ||
"devDependencies": { | ||
"@types/node": "^17.0.23", | ||
"@types/turndown": "^5.0.1", | ||
"@types/node": "^18.11.9", | ||
"domino": "^2.1.6", | ||
"minimist": "^1.2.6", | ||
"mkdirp": "^1.0.4", | ||
"rimraf": "^3.0.2", | ||
"test-diff": "^1.1.0", | ||
"typescript": "^4.6.3", | ||
"typescript-transform-export-interop": "^1.0.4" | ||
"test-diff": "^2.0.2", | ||
"tiny-parse-argv": "^1.0.2", | ||
"tsex": "^1.1.2", | ||
"typescript": "^4.8.4" | ||
} | ||
} |
/* IMPORT */ | ||
import {Options} from '@notable/html2markdown'; | ||
import type {Options} from 'html2markdown'; | ||
@@ -6,0 +6,0 @@ /* MAIN */ |
/* IMPORT */ | ||
import {Source, Options} from './types'; | ||
import Config from './config'; | ||
import {Boostnote, Enex, HTML, Markdown} from './providers'; | ||
import Utils from './utils'; | ||
import type {Source, Options} from './types'; | ||
@@ -9,0 +9,0 @@ /* MAIN */ |
@@ -6,5 +6,5 @@ | ||
import sanitize from 'sanitize-basename'; | ||
import {ConstructorWith, Promisable, Attachment, AttachmentMetadata, Note, NoteMetadata, Dump, Content, Source, SourceDetails} from '../../types'; | ||
import Config from '../../config'; | ||
import Utils from '../../utils'; | ||
import type {ConstructorWith, Promisable, Attachment, AttachmentMetadata, Note, NoteMetadata, Dump, Content, Source, SourceDetails} from '../../types'; | ||
@@ -11,0 +11,0 @@ /* MAIN */ |
@@ -5,7 +5,8 @@ | ||
import cson2json from 'cson2json'; | ||
import * as path from 'path'; | ||
import {AttachmentMetadata, NoteMetadata, Content, SourceDetails} from '../../types'; | ||
import path from 'node:path'; | ||
import process from 'node:process'; | ||
import Utils from '../../utils'; | ||
import type {AttachmentMetadata, NoteMetadata, Content, SourceDetails} from '../../types'; | ||
import {AbstractProvider, AbstractNote, AbstractAttachment} from '../abstract'; | ||
import {AttachmentRaw, NoteRaw} from './types'; | ||
import type {AttachmentRaw, NoteRaw} from './types'; | ||
@@ -54,3 +55,3 @@ /* MAIN */ | ||
const attachmentsLinks = note.content ? Utils.lang.matchAll ( note.content, /\]\(:storage\/([^)]+)\)/gi ) : []; | ||
const attachmentsCwd = process.env.IS_TEST ? path.resolve ( details.filePath, '..', 'attachments' ) : path.resolve ( details.filePath, '..', '..', 'attachments' ); | ||
const attachmentsCwd = process.env['IS_TEST'] ? path.resolve ( details.filePath, '..', 'attachments' ) : path.resolve ( details.filePath, '..', '..', 'attachments' ); | ||
const attachmentsPaths = attachmentsLinks.map ( match => path.join ( attachmentsCwd, match[1] ) ); | ||
@@ -57,0 +58,0 @@ |
@@ -10,2 +10,2 @@ | ||
export {AttachmentRaw, NoteRaw}; | ||
export type {AttachmentRaw, NoteRaw}; |
@@ -5,6 +5,6 @@ | ||
import {parse as xml2js} from 'fast-xml-parser'; | ||
import {AttachmentMetadata, NoteMetadata, Content} from '../../types'; | ||
import Utils from '../../utils'; | ||
import type {AttachmentMetadata, NoteMetadata, Content} from '../../types'; | ||
import {AbstractProvider, AbstractNote, AbstractAttachment} from '../abstract'; | ||
import {AttachmentRaw, NoteRaw} from './types'; | ||
import type {AttachmentRaw, NoteRaw} from './types'; | ||
@@ -11,0 +11,0 @@ /* MAIN */ |
@@ -12,2 +12,2 @@ | ||
export {AttachmentRaw, NoteRaw}; | ||
export type {AttachmentRaw, NoteRaw}; |
/* IMPORT */ | ||
import {NoteMetadata, Content} from '../../types'; | ||
import Utils from '../../utils'; | ||
import type {NoteMetadata, Content} from '../../types'; | ||
import {AbstractProvider, AbstractNote} from '../abstract'; | ||
import {AttachmentRaw, NoteRaw} from './types'; | ||
import type {AttachmentRaw, NoteRaw} from './types'; | ||
@@ -9,0 +9,0 @@ /* MAIN */ |
@@ -10,2 +10,2 @@ | ||
export {AttachmentRaw, NoteRaw}; | ||
export type {AttachmentRaw, NoteRaw}; |
/* IMPORT */ | ||
import {NoteMetadata} from '../../types'; | ||
import Utils from '../../utils'; | ||
import type {NoteMetadata} from '../../types'; | ||
import {AbstractProvider, AbstractNote} from '../abstract'; | ||
import {AttachmentRaw, NoteRaw} from './types'; | ||
import type {AttachmentRaw, NoteRaw} from './types'; | ||
@@ -9,0 +9,0 @@ /* MAIN */ |
@@ -10,2 +10,2 @@ | ||
export {AttachmentRaw, NoteRaw}; | ||
export type {AttachmentRaw, NoteRaw}; |
/* IMPORT */ | ||
import {Stats} from 'fs'; | ||
import type {Stats} from 'fs'; | ||
@@ -68,3 +68,3 @@ /* HELPERS */ | ||
export {Constructor, ConstructorWith, Promisable}; | ||
export {DOMParser, Attachment, AttachmentMetadata, Note, NoteMetadata, Dump, Source, SourceDetails, Content, Stats, Options}; | ||
export type {Constructor, ConstructorWith, Promisable}; | ||
export type {DOMParser, Attachment, AttachmentMetadata, Note, NoteMetadata, Dump, Source, SourceDetails, Content, Stats, Options}; |
/* IMPORT */ | ||
import html2markdown from '@notable/html2markdown'; | ||
import decodeBase64 from 'decode-base64'; | ||
import * as fs from 'fs'; | ||
import html2markdown from 'html2markdown'; | ||
import mime2ext from 'mime2ext'; | ||
import * as path from 'path'; | ||
import fs from 'node:fs'; | ||
import path from 'node:path'; | ||
import U8 from 'uint8-encoding'; | ||
import {Stats} from './types'; | ||
import Config from './config'; | ||
import type {Stats} from './types'; | ||
@@ -47,3 +47,3 @@ /* MAIN */ | ||
return value instanceof Array; | ||
return Array.isArray ( value ); | ||
@@ -84,3 +84,3 @@ }, | ||
return [].concat.apply ( [], value ); | ||
return [].concat.apply ( [], value as any ); //TSC | ||
@@ -119,14 +119,6 @@ }, | ||
try { | ||
return 2197815296; // Hard-coded for better web compatibility, source: "require ( 'v8' ).getHeapStatistics ().heap_size_limit" | ||
return performance['memory'].jsHeapSizeLimit; | ||
} | ||
} catch { | ||
return 2197815296; // Hard-coded for better web compatibility, source: "require ( 'v8' ).getHeapStatistics ().heap_size_limit" | ||
} | ||
}, | ||
}, | ||
@@ -133,0 +125,0 @@ |
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
No contributors or author data
MaintenancePackage does not specify a list of contributors or an author in package.json.
Found 1 instance in 1 package
No bug tracker
MaintenancePackage does not have a linked bug tracker in package.json.
Found 1 instance in 1 package
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
6
2
Yes
56308
1328
2
+ Added@notable/html2markdown@2.0.2(transitive)
+ Addedcson2json@2.0.0(transitive)
+ Addeddecode-base64@3.0.2(transitive)
+ Addedentities-decode@2.0.1(transitive)
+ Addedentities-standard@1.0.1(transitive)
+ Addedfast-xml-parser@3.21.1(transitive)
+ Addedmime-standard@1.0.3(transitive)
+ Addedmime2ext@2.0.1(transitive)
+ Addednode-buffer-encoding@1.0.3(transitive)
+ Addedsanitize-basename@2.0.2(transitive)
+ Addedstrnum@1.0.5(transitive)
+ Addeduint8-encoding@2.0.1(transitive)
- Removed@notable/html2markdown@^1.1.3
- Removed@notable/html2markdown@1.1.3(transitive)
- Removedcson2json@1.0.0(transitive)
- Removeddecode-base64@2.0.0(transitive)
- Removedentities@2.2.0(transitive)
- Removedentities-decode@1.0.0(transitive)
- Removedfast-xml-parser@3.17.4(transitive)
- Removedmime2ext@1.0.1(transitive)
- Removedsanitize-basename@1.0.0(transitive)
- Removeduint8-encoding@1.0.0(transitive)
Updatedcson2json@^2.0.0
Updateddecode-base64@^3.0.1
Updatedentities-decode@^2.0.0
Updatedfast-xml-parser@^3.21.1
Updatedmime2ext@^2.0.0
Updatedsanitize-basename@^2.0.0
Updateduint8-encoding@^2.0.0