@dendronhq/engine-server
Advanced tools
Comparing version 0.3.19 to 0.3.20
@@ -6,2 +6,8 @@ # Change Log | ||
## [0.3.20](https://github.com/dendronhq/dendron/compare/v0.3.19...v0.3.20) (2020-07-18) | ||
### Bug Fixes | ||
- handle special characters in file names when importing using LocalFilePod ([03e42b1](https://github.com/dendronhq/dendron/commit/03e42b167ac9f073cd56f10c4e31b5cecf66dabf)) | ||
## [0.3.19](https://github.com/dendronhq/dendron/compare/v0.3.18...v0.3.19) (2020-07-18) | ||
@@ -8,0 +14,0 @@ |
@@ -15,3 +15,3 @@ import { DEngineStore, DEngineStoreWriteOpts, DNodeData, DNodeRawProps, EngineQueryResp, IDNode, NoteRawProps, QueryMode, QueryOpts, SchemaRawProps, StoreGetResp, StoreQueryOpts } from "@dendronhq/common-all"; | ||
isRoot(id: string): boolean; | ||
getRoot(): Promise<any>; | ||
getRoot(): Promise<Required<import("@dendronhq/common-all").DNodeRawOpts<DNodeData>>>; | ||
get(id: string, _opts?: QueryOpts): Promise<StoreGetResp>; | ||
@@ -24,3 +24,3 @@ } | ||
_getSchemaAll(): Promise<SchemaRawProps[]>; | ||
_writeFile(node: IDNode): any; | ||
_writeFile(node: IDNode): void; | ||
isQueryAll(qs: string): boolean; | ||
@@ -27,0 +27,0 @@ /** |
@@ -49,3 +49,5 @@ import { DEngine, DEngineMode, DEngineOpts, DEngineStore, DNodeData, DNodeDict, DNodeRawProps, EngineDeleteOpts, EngineGetResp, EngineQueryResp, IDNode, NodeWriteOpts, Note, NoteDict, QueryMode, QueryOneOpts, QueryOpts, Schema, SchemaDict, UpdateNodesOpts } from "@dendronhq/common-all"; | ||
get(id: string, mode: QueryMode, opts?: QueryOpts): Promise<{ | ||
data: any; | ||
data: Schema; | ||
} | { | ||
data: Note; | ||
}>; | ||
@@ -52,0 +54,0 @@ query(queryString: string, mode: QueryMode, opts?: QueryOpts): Promise<EngineQueryResp<DNodeData>>; |
@@ -70,3 +70,5 @@ "use strict"; | ||
// check that assets are there | ||
const fileBody = fs_extra_1.default.readFileSync(path_1.posix.join(root, "project.p1.md"), { encoding: "utf8" }); | ||
const fileBody = fs_extra_1.default.readFileSync(path_1.posix.join(root, "project.p1.md"), { | ||
encoding: "utf8", | ||
}); | ||
expect(fileBody.match("n1.pdf")).toBeTruthy(); | ||
@@ -76,3 +78,10 @@ expect(fileBody.match("n3.pdf")).toBeTruthy(); | ||
}); | ||
test("harness1", async () => { | ||
const filesRoot = "/Users/kevinlin/tmp/kiran_test"; | ||
const uri = vscode_uri_1.URI.parse(filesRoot); | ||
const fp = new filePod_1.FilePod({ engine, root: uri }); | ||
await fp.import(); | ||
// testUtils.expectSnapshot(expect, "main", _.values(engine.notes)); | ||
}); | ||
}); | ||
//# sourceMappingURL=filePod.spec.js.map |
@@ -16,2 +16,6 @@ import { Note, NoteRawProps } from "@dendronhq/common-all"; | ||
export declare class FilePod extends BasePod { | ||
/** | ||
* Return list of note props keyed by level of hierarchy | ||
* @param files | ||
*/ | ||
files2HierarichalDict(files: DItem[]): HierarichalDict; | ||
@@ -18,0 +22,0 @@ hDict2Notes(hdict: HierarichalDict): Note[]; |
@@ -21,2 +21,6 @@ "use strict"; | ||
class FilePod extends base_1.BasePod { | ||
/** | ||
* Return list of note props keyed by level of hierarchy | ||
* @param files | ||
*/ | ||
files2HierarichalDict(files) { | ||
@@ -50,10 +54,11 @@ const out = {}; | ||
const mdLinks = []; | ||
item.entries.map((item) => { | ||
item.entries.map((_item) => { | ||
const uuid = common_all_1.genUUID(); | ||
const { ext, name } = path_1.posix.parse(item.path); | ||
const assetBaseNew = `${name}-${uuid}${ext}`; | ||
const { ext, name } = path_1.posix.parse(_item.path); | ||
// const { ext, name } = posix.parse(cleanFileName(_item.path)); | ||
const assetBaseNew = `${common_server_1.cleanFileName(name)}-${uuid}${ext}`; | ||
const assetPathFull = path_1.posix.join(assetDir, assetBaseNew); | ||
const assetPathRel = path_1.posix.join(assetDirName, assetBaseNew); | ||
// TODO: make sure to append uuid | ||
fs_extra_1.default.copyFileSync(path_1.posix.join(this.root.fsPath, item.path), assetPathFull); | ||
fs_extra_1.default.copyFileSync(path_1.posix.join(this.root.fsPath, _item.path), assetPathFull); | ||
mdLinks.push(toMarkdownLink(assetPathRel, { name: `${name}${ext}` })); | ||
@@ -105,6 +110,7 @@ }); | ||
const mask = uri.fsPath.endsWith("/") ? root.length : root.length + 1; | ||
const excludeFilter = through2_1.default.obj(function (item, enc, next) { | ||
const basename = path_1.posix.basename(item.path); | ||
if (!basename.startsWith(".")) | ||
const excludeFilter = through2_1.default.obj(function (item, _enc, next) { | ||
// check if hidden file | ||
if (!lodash_1.default.some(item.path.split("/"), (ent) => ent.startsWith("."))) { | ||
this.push(item); | ||
} | ||
next(); | ||
@@ -117,4 +123,5 @@ }); | ||
.pipe(excludeFilter) | ||
// eslint-disable-next-line prefer-arrow-callback | ||
.on("data", function (item) { | ||
let out = { ...item, entries: [] }; | ||
const out = { ...item, entries: [] }; | ||
if (item.path.endsWith(".md")) { | ||
@@ -121,0 +128,0 @@ const { data, content } = gray_matter_1.default.read(item.path, {}); |
{ | ||
"name": "@dendronhq/engine-server", | ||
"version": "0.3.19", | ||
"version": "0.3.20", | ||
"description": "dendron-engine", | ||
@@ -38,7 +38,7 @@ "license": "GPLv3", | ||
"test:watch": "npm run test -- --watch", | ||
"test:unit:debug": "NODE_ENV=test node --inspect-brk node_modules/.bin/jest --runInBand" | ||
"test:unit:debug": "NODE_ENV=test node --inspect node_modules/.bin/jest --runInBand" | ||
}, | ||
"dependencies": { | ||
"@dendronhq/common-all": "^0.3.19", | ||
"@dendronhq/common-server": "^0.3.19", | ||
"@dendronhq/common-server": "^0.3.20", | ||
"fs-extra": "^9.0.1", | ||
@@ -82,3 +82,3 @@ "fuse.js": "^6.3.0", | ||
}, | ||
"gitHead": "a1e4e56126ed8c687443bf00b9d135d2f7c123b0" | ||
"gitHead": "7e97914aa5aa51b68608ecbec3d27020d2ff0342" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
174980
1833