fix: clean daily/note output and confirm writes
Build and Push Docker Container / build-and-push (push) Successful in 4m26s
Build and Push Docker Container / build-and-push (push) Successful in 4m26s
- dailyPath returns { path }
- dailyRead and note:read return { content }
- vault and vaults return parsed structured JSON
- write operations return { ok: true }
- keep stderr/timed_out only when present
- bump n8n node package to 0.2.4
This commit is contained in:
@@ -264,9 +264,49 @@ export class ObsidianApi implements INodeType {
|
||||
// Always keep n8n output minimal/clean.
|
||||
// - Prefer parsed stdout (e.g. vault/vaults)
|
||||
// - Otherwise keep stdout as-is
|
||||
// Build a stable, minimal output shape for n8n.
|
||||
// We try to expose the single most useful field name per operation.
|
||||
const stdout = result.stdout ?? '';
|
||||
|
||||
// Daily notes
|
||||
if (resource === 'daily' && operation === 'dailyPath') {
|
||||
const out: any = { path: stdout };
|
||||
if (result.stderr) out.stderr = result.stderr;
|
||||
if (result.timed_out) out.timed_out = result.timed_out;
|
||||
returnData.push({ json: out, pairedItem: { item: itemIndex } });
|
||||
continue;
|
||||
}
|
||||
if (resource === 'daily' && operation === 'dailyRead') {
|
||||
const out: any = { content: stdout };
|
||||
if (result.stderr) out.stderr = result.stderr;
|
||||
if (result.timed_out) out.timed_out = result.timed_out;
|
||||
returnData.push({ json: out, pairedItem: { item: itemIndex } });
|
||||
continue;
|
||||
}
|
||||
|
||||
// Notes
|
||||
if (resource === 'note' && operation === 'read') {
|
||||
const out: any = { content: stdout };
|
||||
if (result.stderr) out.stderr = result.stderr;
|
||||
if (result.timed_out) out.timed_out = result.timed_out;
|
||||
returnData.push({ json: out, pairedItem: { item: itemIndex } });
|
||||
continue;
|
||||
}
|
||||
|
||||
// vault and vaults are parsed as structured JSON
|
||||
const parsed = (result as any).parsed_stdout;
|
||||
const out: any = parsed ? parsed : { stdout: result.stdout };
|
||||
if (!parsed && result.stderr) out.stderr = result.stderr;
|
||||
if (parsed) {
|
||||
const out: any = parsed;
|
||||
if (result.timed_out) out.timed_out = result.timed_out;
|
||||
if (result.stderr) out.stderr = result.stderr;
|
||||
returnData.push({ json: out, pairedItem: { item: itemIndex } });
|
||||
continue;
|
||||
}
|
||||
|
||||
// Everything else (writes, deletes, rename, list files, etc.):
|
||||
// keep output clean/stable and only confirm success.
|
||||
const out: any = { ok: true };
|
||||
if (result.stderr) out.stderr = result.stderr;
|
||||
if (result.timed_out) out.timed_out = result.timed_out;
|
||||
|
||||
returnData.push({ json: out, pairedItem: { item: itemIndex } });
|
||||
|
||||
+2
-2
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "n8n-nodes-obsidian-cli-api",
|
||||
"version": "0.2.3",
|
||||
"version": "0.2.4",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "n8n-nodes-obsidian-cli-api",
|
||||
"version": "0.2.3",
|
||||
"version": "0.2.4",
|
||||
"license": "MIT",
|
||||
"devDependencies": {
|
||||
"@types/node": "^24.0.0",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "n8n-nodes-obsidian-cli-api",
|
||||
"version": "0.2.3",
|
||||
"version": "0.2.4",
|
||||
"description": "n8n community nodes for the Obsidian API Docker service backed by the official Obsidian CLI.",
|
||||
"license": "MIT",
|
||||
"homepage": "https://git.yiprawr.dev/Docker/obsidian-api",
|
||||
|
||||
Reference in New Issue
Block a user