vertex-notes 0.3.0 → 0.3.3
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/dist/chunk-23CKP3YP.js +27 -0
- package/dist/{chunk-PBF5EE4Y.js → chunk-DRIWYEQE.js} +0 -1
- package/dist/{chunk-AU5U4RDS.js → chunk-K5SQERJ7.js} +151 -16
- package/dist/{chunk-4TVWJ4LN.js → chunk-LXT34CD7.js} +2 -3
- package/dist/commands/capture.js +3 -4
- package/dist/commands/daily.js +3 -4
- package/dist/commands/delete.js +3 -4
- package/dist/commands/edit.js +3 -8
- package/dist/commands/export.js +3 -4
- package/dist/commands/hello.js +1 -2
- package/dist/commands/help.js +1 -2
- package/dist/commands/howto.js +0 -1
- package/dist/commands/import.js +3 -4
- package/dist/commands/interactive.js +45 -4
- package/dist/commands/login.js +2 -3
- package/dist/commands/logout.js +1 -2
- package/dist/commands/new.js +3 -4
- package/dist/commands/notes.js +3 -4
- package/dist/commands/restore.js +3 -4
- package/dist/commands/search.js +3 -4
- package/dist/commands/status.js +3 -4
- package/dist/commands/syntax.js +0 -1
- package/dist/commands/tags.js +3 -4
- package/dist/commands/today.js +3 -4
- package/dist/commands/trash/empty.js +7 -5
- package/dist/commands/trash/index.js +3 -4
- package/dist/commands/view.js +3 -4
- package/dist/commands/whoami.js +1 -2
- package/dist/index.js +0 -1
- package/dist/lib/client.js +3 -4
- package/dist/lib/config.js +1 -2
- package/dist/lib/file-cleanup.js +7 -0
- package/package.json +1 -1
- package/dist/chunk-4TVWJ4LN.js.map +0 -1
- package/dist/chunk-AU5U4RDS.js.map +0 -1
- package/dist/chunk-PBF5EE4Y.js.map +0 -1
- package/dist/commands/capture.js.map +0 -1
- package/dist/commands/daily.js.map +0 -1
- package/dist/commands/delete.js.map +0 -1
- package/dist/commands/edit.js.map +0 -1
- package/dist/commands/export.js.map +0 -1
- package/dist/commands/hello.js.map +0 -1
- package/dist/commands/help.js.map +0 -1
- package/dist/commands/howto.js.map +0 -1
- package/dist/commands/import.js.map +0 -1
- package/dist/commands/interactive.js.map +0 -1
- package/dist/commands/login.js.map +0 -1
- package/dist/commands/logout.js.map +0 -1
- package/dist/commands/new.js.map +0 -1
- package/dist/commands/notes.js.map +0 -1
- package/dist/commands/restore.js.map +0 -1
- package/dist/commands/search.js.map +0 -1
- package/dist/commands/status.js.map +0 -1
- package/dist/commands/syntax.js.map +0 -1
- package/dist/commands/tags.js.map +0 -1
- package/dist/commands/today.js.map +0 -1
- package/dist/commands/trash/empty.js.map +0 -1
- package/dist/commands/trash/index.js.map +0 -1
- package/dist/commands/view.js.map +0 -1
- package/dist/commands/whoami.js.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/lib/client.js.map +0 -1
- package/dist/lib/config.js.map +0 -1
- package/dist/lib/md-to-tiptap.js +0 -250
- package/dist/lib/md-to-tiptap.js.map +0 -1
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import {
|
|
2
|
+
loadConfig
|
|
3
|
+
} from "./chunk-DRIWYEQE.js";
|
|
4
|
+
|
|
5
|
+
// src/lib/file-cleanup.ts
|
|
6
|
+
var R2_WORKER_URL = "https://vertex-r2.codessahil.workers.dev";
|
|
7
|
+
async function cleanupRemovedFiles(removedFiles) {
|
|
8
|
+
const config = loadConfig();
|
|
9
|
+
const token = config.accessToken;
|
|
10
|
+
if (!token) return;
|
|
11
|
+
for (const file of removedFiles) {
|
|
12
|
+
try {
|
|
13
|
+
const parsed = new URL(file.src);
|
|
14
|
+
if (parsed.origin === new URL(R2_WORKER_URL).origin) {
|
|
15
|
+
await fetch(file.src, {
|
|
16
|
+
method: "DELETE",
|
|
17
|
+
headers: { Authorization: `Bearer ${token}` }
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
} catch {
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export {
|
|
26
|
+
cleanupRemovedFiles
|
|
27
|
+
};
|
|
@@ -17,6 +17,14 @@ async function getStorageInfo(client, userId) {
|
|
|
17
17
|
cap: data.storage_cap ?? DEFAULT_STORAGE_CAP
|
|
18
18
|
};
|
|
19
19
|
}
|
|
20
|
+
async function getStorageUsed(client, userId) {
|
|
21
|
+
const { used } = await getStorageInfo(client, userId);
|
|
22
|
+
return used;
|
|
23
|
+
}
|
|
24
|
+
async function decrementStorageUsed(client, userId, bytes) {
|
|
25
|
+
const used = await getStorageUsed(client, userId);
|
|
26
|
+
await client.from("profiles").update({ storage_used: Math.max(0, used - bytes) }).eq("id", userId);
|
|
27
|
+
}
|
|
20
28
|
function formatFileSize(bytes) {
|
|
21
29
|
if (bytes === 0) return "0 B";
|
|
22
30
|
if (bytes < 1024) return `${bytes} B`;
|
|
@@ -58,12 +66,82 @@ async function restoreNote(client, noteId) {
|
|
|
58
66
|
const { error } = await client.from("notes").update({ deleted_at: null }).eq("id", noteId);
|
|
59
67
|
if (error) throw error;
|
|
60
68
|
}
|
|
61
|
-
async function
|
|
69
|
+
async function hardDeleteNote(client, noteId, onFilesRemoved) {
|
|
70
|
+
const { data: blocks } = await client.from("blocks").select("type, metadata, user_id").eq("note_id", noteId);
|
|
71
|
+
const fileUrls = [];
|
|
72
|
+
let userId = null;
|
|
73
|
+
for (const b of blocks ?? []) {
|
|
74
|
+
if (!userId) userId = b.user_id;
|
|
75
|
+
const tiptap = b.metadata?.tiptap;
|
|
76
|
+
const attrs = tiptap?.attrs ?? {};
|
|
77
|
+
const src = attrs.src;
|
|
78
|
+
if (src && (b.type === "file" || b.type === "image") && !src.startsWith("data:")) {
|
|
79
|
+
fileUrls.push({ src, filesize: attrs.filesize ?? 0 });
|
|
80
|
+
}
|
|
81
|
+
if (tiptap?.type === "excalidrawBlock" && attrs.data) {
|
|
82
|
+
try {
|
|
83
|
+
const excalidrawData = JSON.parse(attrs.data);
|
|
84
|
+
for (const file of Object.values(excalidrawData.files ?? {})) {
|
|
85
|
+
if (file.dataURL?.startsWith("https://")) {
|
|
86
|
+
fileUrls.push({ src: file.dataURL, filesize: 0 });
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
} catch {
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
for (const file of fileUrls) {
|
|
94
|
+
try {
|
|
95
|
+
const parsed = new URL(file.src);
|
|
96
|
+
if (parsed.pathname.includes("/storage/v1/object/public/")) {
|
|
97
|
+
const pathParts = parsed.pathname.split("/storage/v1/object/public/");
|
|
98
|
+
if (pathParts.length >= 2) {
|
|
99
|
+
const fullPath = decodeURIComponent(pathParts[1]);
|
|
100
|
+
const slashIdx = fullPath.indexOf("/");
|
|
101
|
+
if (slashIdx !== -1) {
|
|
102
|
+
await client.storage.from(fullPath.substring(0, slashIdx)).remove([fullPath.substring(slashIdx + 1)]);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
if (userId && file.filesize > 0) {
|
|
107
|
+
await decrementStorageUsed(client, userId, file.filesize).catch(() => {
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
} catch {
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
if (fileUrls.length > 0 && onFilesRemoved) {
|
|
114
|
+
await onFilesRemoved(fileUrls).catch(() => {
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
const { error } = await client.from("notes").delete().eq("id", noteId);
|
|
118
|
+
if (error) throw error;
|
|
119
|
+
if (userId) {
|
|
120
|
+
await cleanupOrphanedTags(client, userId);
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
async function cleanupOrphanedTags(client, userId) {
|
|
124
|
+
try {
|
|
125
|
+
const { data: tags } = await client.from("tags").select("id").eq("user_id", userId);
|
|
126
|
+
if (!tags || tags.length === 0) return;
|
|
127
|
+
for (const tag of tags) {
|
|
128
|
+
const { count: blockCount } = await client.from("block_tags").select("*", { count: "exact", head: true }).eq("tag_id", tag.id);
|
|
129
|
+
const { count: noteCount } = await client.from("note_tags").select("*", { count: "exact", head: true }).eq("tag_id", tag.id);
|
|
130
|
+
if ((blockCount ?? 0) === 0 && (noteCount ?? 0) === 0) {
|
|
131
|
+
await client.from("tag_edges").delete().or(`parent_id.eq.${tag.id},child_id.eq.${tag.id}`);
|
|
132
|
+
await client.from("tags").delete().eq("id", tag.id);
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
} catch {
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
async function emptyTrash(client, userId, onFilesRemoved) {
|
|
62
139
|
const { data } = await client.from("notes").select("id").eq("user_id", userId).not("deleted_at", "is", null);
|
|
63
140
|
if (!data || data.length === 0) return 0;
|
|
64
141
|
const ids = data.map((n) => n.id);
|
|
65
|
-
const
|
|
66
|
-
|
|
142
|
+
for (const id of ids) {
|
|
143
|
+
await hardDeleteNote(client, id, onFilesRemoved);
|
|
144
|
+
}
|
|
67
145
|
return ids.length;
|
|
68
146
|
}
|
|
69
147
|
async function listNotes(client, params) {
|
|
@@ -255,7 +333,11 @@ function mapTiptapTypeToBlockType(tiptapType) {
|
|
|
255
333
|
horizontalRule: "divider",
|
|
256
334
|
fileBlock: "file",
|
|
257
335
|
linkPreview: "text",
|
|
258
|
-
inlineMath: "text"
|
|
336
|
+
inlineMath: "text",
|
|
337
|
+
table: "text",
|
|
338
|
+
tableRow: "text",
|
|
339
|
+
tableCell: "text",
|
|
340
|
+
tableHeader: "text"
|
|
259
341
|
};
|
|
260
342
|
return MAP[tiptapType] ?? "text";
|
|
261
343
|
}
|
|
@@ -298,7 +380,7 @@ function extractWikiLinks(text) {
|
|
|
298
380
|
return [...new Set(matches.map((m) => m.slice(2, -2)))];
|
|
299
381
|
}
|
|
300
382
|
async function fullTextSearch(client, userId, query, limit = 30) {
|
|
301
|
-
const { data, error } = await client.from("blocks").select("*, notes!inner(id, title)").eq("user_id", userId).is("deleted_at", null).
|
|
383
|
+
const { data, error } = await client.from("blocks").select("*, notes!inner(id, title)").eq("user_id", userId).is("deleted_at", null).ilike("content", `%${query}%`).limit(limit);
|
|
302
384
|
if (error) throw error;
|
|
303
385
|
return (data ?? []).map((row) => {
|
|
304
386
|
const notes = row.notes;
|
|
@@ -311,15 +393,23 @@ async function fullTextSearch(client, userId, query, limit = 30) {
|
|
|
311
393
|
});
|
|
312
394
|
}
|
|
313
395
|
async function searchByTag(client, userId, tagName, includeDescendants = true) {
|
|
314
|
-
|
|
315
|
-
if (
|
|
316
|
-
|
|
317
|
-
let tagIds;
|
|
318
|
-
if (includeDescendants) {
|
|
319
|
-
tagIds = await getTagDescendants(client, tagId);
|
|
320
|
-
} else {
|
|
321
|
-
tagIds = [tagId];
|
|
396
|
+
let tagQuery = client.from("tags").select("id").eq("user_id", userId);
|
|
397
|
+
if (tagName) {
|
|
398
|
+
tagQuery = tagQuery.ilike("name", `${tagName}%`);
|
|
322
399
|
}
|
|
400
|
+
const { data: matchedTags } = await tagQuery;
|
|
401
|
+
if (!matchedTags || matchedTags.length === 0) return [];
|
|
402
|
+
const allTagIds = /* @__PURE__ */ new Set();
|
|
403
|
+
for (const tag of matchedTags) {
|
|
404
|
+
if (includeDescendants) {
|
|
405
|
+
const descendants = await getTagDescendants(client, tag.id);
|
|
406
|
+
for (const id of descendants) allTagIds.add(id);
|
|
407
|
+
} else {
|
|
408
|
+
allTagIds.add(tag.id);
|
|
409
|
+
}
|
|
410
|
+
}
|
|
411
|
+
const tagIds = [...allTagIds];
|
|
412
|
+
if (tagIds.length === 0) return [];
|
|
323
413
|
const { data, error } = await client.from("block_tags").select("block_id, blocks!inner(*, notes!inner(id, title))").in("tag_id", tagIds);
|
|
324
414
|
if (error) throw error;
|
|
325
415
|
return (data ?? []).map((row) => {
|
|
@@ -372,7 +462,7 @@ function parseQuery(input) {
|
|
|
372
462
|
async function executeQuery(client, userId, input, limit = 30) {
|
|
373
463
|
const filter = parseQuery(input);
|
|
374
464
|
let results = [];
|
|
375
|
-
if (filter.tag) {
|
|
465
|
+
if (filter.tag !== void 0) {
|
|
376
466
|
results = await searchByTag(client, userId, filter.tag);
|
|
377
467
|
} else if (filter.type) {
|
|
378
468
|
results = await searchByType(client, userId, filter.type, limit);
|
|
@@ -504,6 +594,25 @@ function tiptapNodeToMarkdown(node) {
|
|
|
504
594
|
lines.push(``);
|
|
505
595
|
break;
|
|
506
596
|
}
|
|
597
|
+
case "table": {
|
|
598
|
+
const rows = content.map((row) => row.content ?? []);
|
|
599
|
+
const colCount = Math.max(...rows.map((r) => r.length));
|
|
600
|
+
const colWidths = Array.from(
|
|
601
|
+
{ length: colCount },
|
|
602
|
+
(_, ci) => Math.max(3, ...rows.map((r) => (r[ci] ? extractTextFromNode(r[ci]) : "").length))
|
|
603
|
+
);
|
|
604
|
+
rows.forEach((cells, ri) => {
|
|
605
|
+
const line = "| " + colWidths.map((w, ci) => {
|
|
606
|
+
const text = cells[ci] ? extractTextFromNode(cells[ci]) : "";
|
|
607
|
+
return text.padEnd(w);
|
|
608
|
+
}).join(" | ") + " |";
|
|
609
|
+
lines.push(line);
|
|
610
|
+
if (ri === 0) {
|
|
611
|
+
lines.push("| " + colWidths.map((w) => "-".repeat(w)).join(" | ") + " |");
|
|
612
|
+
}
|
|
613
|
+
});
|
|
614
|
+
break;
|
|
615
|
+
}
|
|
507
616
|
case "linkPreview": {
|
|
508
617
|
const url = attrs.url ?? "";
|
|
509
618
|
lines.push(`> [!embed]`, `> ${url}`);
|
|
@@ -684,6 +793,33 @@ function markdownToTiptap(md) {
|
|
|
684
793
|
i++;
|
|
685
794
|
continue;
|
|
686
795
|
}
|
|
796
|
+
const trimmedLine = line.trimStart();
|
|
797
|
+
if (trimmedLine.startsWith("|") && lines[i + 1]?.trimStart().match(/^\|[\s\-|:]+\|/)) {
|
|
798
|
+
const parseRow = (raw) => raw.trimStart().split("|").slice(1, -1).map((c) => c.trim());
|
|
799
|
+
const headers = parseRow(lines[i]);
|
|
800
|
+
i += 2;
|
|
801
|
+
const rows = [];
|
|
802
|
+
while (i < lines.length && lines[i].trimStart().startsWith("|")) {
|
|
803
|
+
rows.push(parseRow(lines[i]));
|
|
804
|
+
i++;
|
|
805
|
+
}
|
|
806
|
+
const makeCell = (text, isHeader) => ({
|
|
807
|
+
type: isHeader ? "tableHeader" : "tableCell",
|
|
808
|
+
attrs: { colspan: 1, rowspan: 1, colwidth: null },
|
|
809
|
+
content: [{ type: "paragraph", content: parseInline(text) }]
|
|
810
|
+
});
|
|
811
|
+
nodes.push({
|
|
812
|
+
type: "table",
|
|
813
|
+
content: [
|
|
814
|
+
{ type: "tableRow", content: headers.map((h) => makeCell(h, true)) },
|
|
815
|
+
...rows.map((row) => ({
|
|
816
|
+
type: "tableRow",
|
|
817
|
+
content: headers.map((_, ci) => makeCell(row[ci] ?? "", false))
|
|
818
|
+
}))
|
|
819
|
+
]
|
|
820
|
+
});
|
|
821
|
+
continue;
|
|
822
|
+
}
|
|
687
823
|
if (line.match(/^!\[.*?\]\(.*?\)$/)) {
|
|
688
824
|
const imgMatch = line.match(/^!\[(.*?)\]\((.*?)\)$/);
|
|
689
825
|
if (imgMatch) {
|
|
@@ -742,7 +878,7 @@ function markdownToTiptap(md) {
|
|
|
742
878
|
continue;
|
|
743
879
|
}
|
|
744
880
|
const paraLines = [];
|
|
745
|
-
while (i < lines.length && lines[i].trim() !== "" && !lines[i].match(/^#{1,4}\s/) && !lines[i].match(/^```/) && !lines[i].match(/^\$\$/) && !lines[i].match(/^---\s*$/) && !lines[i].match(/^[-*]\s/) && !lines[i].match(/^\d+\.\s/) && !lines[i].match(/^>\s/) && !lines[i].match(/^!\[/)) {
|
|
881
|
+
while (i < lines.length && lines[i].trim() !== "" && !lines[i].match(/^#{1,4}\s/) && !lines[i].match(/^```/) && !lines[i].match(/^\$\$/) && !lines[i].match(/^---\s*$/) && !lines[i].match(/^[-*]\s/) && !lines[i].match(/^\d+\.\s/) && !lines[i].match(/^>\s/) && !lines[i].match(/^!\[/) && !lines[i].startsWith("|")) {
|
|
746
882
|
paraLines.push(lines[i]);
|
|
747
883
|
i++;
|
|
748
884
|
}
|
|
@@ -812,4 +948,3 @@ export {
|
|
|
812
948
|
markdownToTiptap,
|
|
813
949
|
VERTEX_VERSION
|
|
814
950
|
};
|
|
815
|
-
//# sourceMappingURL=chunk-AU5U4RDS.js.map
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
loadConfig,
|
|
3
3
|
saveConfig
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-DRIWYEQE.js";
|
|
5
5
|
import {
|
|
6
6
|
createSupabaseClient
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-K5SQERJ7.js";
|
|
8
8
|
|
|
9
9
|
// src/lib/client.ts
|
|
10
10
|
var cachedClient = null;
|
|
@@ -47,4 +47,3 @@ export {
|
|
|
47
47
|
getClient,
|
|
48
48
|
getUserId
|
|
49
49
|
};
|
|
50
|
-
//# sourceMappingURL=chunk-4TVWJ4LN.js.map
|
package/dist/commands/capture.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
getClient,
|
|
3
3
|
getUserId
|
|
4
|
-
} from "../chunk-
|
|
5
|
-
import "../chunk-
|
|
4
|
+
} from "../chunk-LXT34CD7.js";
|
|
5
|
+
import "../chunk-DRIWYEQE.js";
|
|
6
6
|
import {
|
|
7
7
|
getBlocksForNote,
|
|
8
8
|
listNotes,
|
|
9
9
|
saveNoteContent
|
|
10
|
-
} from "../chunk-
|
|
10
|
+
} from "../chunk-K5SQERJ7.js";
|
|
11
11
|
|
|
12
12
|
// src/commands/capture.ts
|
|
13
13
|
import { Command, Args } from "@oclif/core";
|
|
@@ -41,4 +41,3 @@ var Capture = class _Capture extends Command {
|
|
|
41
41
|
export {
|
|
42
42
|
Capture as default
|
|
43
43
|
};
|
|
44
|
-
//# sourceMappingURL=capture.js.map
|
package/dist/commands/daily.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
getClient,
|
|
3
3
|
getUserId
|
|
4
|
-
} from "../chunk-
|
|
5
|
-
import "../chunk-
|
|
4
|
+
} from "../chunk-LXT34CD7.js";
|
|
5
|
+
import "../chunk-DRIWYEQE.js";
|
|
6
6
|
import {
|
|
7
7
|
exportNoteAsMarkdown,
|
|
8
8
|
getOrCreateDailyNote,
|
|
9
9
|
listNotes
|
|
10
|
-
} from "../chunk-
|
|
10
|
+
} from "../chunk-K5SQERJ7.js";
|
|
11
11
|
|
|
12
12
|
// src/commands/daily.ts
|
|
13
13
|
import { Command, Flags } from "@oclif/core";
|
|
@@ -50,4 +50,3 @@ var Daily = class _Daily extends Command {
|
|
|
50
50
|
export {
|
|
51
51
|
Daily as default
|
|
52
52
|
};
|
|
53
|
-
//# sourceMappingURL=daily.js.map
|
package/dist/commands/delete.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
getClient,
|
|
3
3
|
getUserId
|
|
4
|
-
} from "../chunk-
|
|
5
|
-
import "../chunk-
|
|
4
|
+
} from "../chunk-LXT34CD7.js";
|
|
5
|
+
import "../chunk-DRIWYEQE.js";
|
|
6
6
|
import {
|
|
7
7
|
listNotes,
|
|
8
8
|
softDeleteNote
|
|
9
|
-
} from "../chunk-
|
|
9
|
+
} from "../chunk-K5SQERJ7.js";
|
|
10
10
|
|
|
11
11
|
// src/commands/delete.ts
|
|
12
12
|
import { Command, Args } from "@oclif/core";
|
|
@@ -35,4 +35,3 @@ var Delete = class _Delete extends Command {
|
|
|
35
35
|
export {
|
|
36
36
|
Delete as default
|
|
37
37
|
};
|
|
38
|
-
//# sourceMappingURL=delete.js.map
|
package/dist/commands/edit.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import {
|
|
2
2
|
getClient,
|
|
3
3
|
getUserId
|
|
4
|
-
} from "../chunk-
|
|
5
|
-
import "../chunk-
|
|
4
|
+
} from "../chunk-LXT34CD7.js";
|
|
5
|
+
import "../chunk-DRIWYEQE.js";
|
|
6
6
|
import {
|
|
7
7
|
exportNoteAsMarkdown,
|
|
8
8
|
listNotes,
|
|
9
9
|
markdownToTiptap,
|
|
10
10
|
saveNoteContent
|
|
11
|
-
} from "../chunk-
|
|
11
|
+
} from "../chunk-K5SQERJ7.js";
|
|
12
12
|
|
|
13
13
|
// src/commands/edit.ts
|
|
14
14
|
import { Command, Args } from "@oclif/core";
|
|
@@ -71,10 +71,6 @@ var Edit = class _Edit extends Command {
|
|
|
71
71
|
this.error("Editor exited with error");
|
|
72
72
|
}
|
|
73
73
|
const edited = readFileSync(tmpFile, "utf-8");
|
|
74
|
-
if (edited === md) {
|
|
75
|
-
this.log("No changes.");
|
|
76
|
-
return;
|
|
77
|
-
}
|
|
78
74
|
const tiptapJson = markdownToTiptap(edited);
|
|
79
75
|
await saveNoteContent(client, match.id, userId, tiptapJson);
|
|
80
76
|
this.log(`Saved: ${match.title}`);
|
|
@@ -83,4 +79,3 @@ var Edit = class _Edit extends Command {
|
|
|
83
79
|
export {
|
|
84
80
|
Edit as default
|
|
85
81
|
};
|
|
86
|
-
//# sourceMappingURL=edit.js.map
|
package/dist/commands/export.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
getClient,
|
|
3
3
|
getUserId
|
|
4
|
-
} from "../chunk-
|
|
5
|
-
import "../chunk-
|
|
4
|
+
} from "../chunk-LXT34CD7.js";
|
|
5
|
+
import "../chunk-DRIWYEQE.js";
|
|
6
6
|
import {
|
|
7
7
|
exportNoteAsJson,
|
|
8
8
|
exportNoteAsMarkdown,
|
|
9
9
|
listNotes
|
|
10
|
-
} from "../chunk-
|
|
10
|
+
} from "../chunk-K5SQERJ7.js";
|
|
11
11
|
|
|
12
12
|
// src/commands/export.ts
|
|
13
13
|
import { Command, Args, Flags } from "@oclif/core";
|
|
@@ -43,4 +43,3 @@ var Export = class _Export extends Command {
|
|
|
43
43
|
export {
|
|
44
44
|
Export as default
|
|
45
45
|
};
|
|
46
|
-
//# sourceMappingURL=export.js.map
|
package/dist/commands/hello.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
VERTEX_VERSION
|
|
3
|
-
} from "../chunk-
|
|
3
|
+
} from "../chunk-K5SQERJ7.js";
|
|
4
4
|
|
|
5
5
|
// src/commands/hello.ts
|
|
6
6
|
import { Command } from "@oclif/core";
|
|
@@ -13,4 +13,3 @@ var Hello = class extends Command {
|
|
|
13
13
|
export {
|
|
14
14
|
Hello as default
|
|
15
15
|
};
|
|
16
|
-
//# sourceMappingURL=hello.js.map
|
package/dist/commands/help.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
VERTEX_VERSION
|
|
3
|
-
} from "../chunk-
|
|
3
|
+
} from "../chunk-K5SQERJ7.js";
|
|
4
4
|
|
|
5
5
|
// src/commands/help.ts
|
|
6
6
|
import { Command } from "@oclif/core";
|
|
@@ -114,4 +114,3 @@ ${heading("EXAMPLES")}
|
|
|
114
114
|
export {
|
|
115
115
|
Help as default
|
|
116
116
|
};
|
|
117
|
-
//# sourceMappingURL=help.js.map
|
package/dist/commands/howto.js
CHANGED
package/dist/commands/import.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
getClient,
|
|
3
3
|
getUserId
|
|
4
|
-
} from "../chunk-
|
|
5
|
-
import "../chunk-
|
|
4
|
+
} from "../chunk-LXT34CD7.js";
|
|
5
|
+
import "../chunk-DRIWYEQE.js";
|
|
6
6
|
import {
|
|
7
7
|
createNote,
|
|
8
8
|
markdownToTiptap,
|
|
9
9
|
saveNoteContent
|
|
10
|
-
} from "../chunk-
|
|
10
|
+
} from "../chunk-K5SQERJ7.js";
|
|
11
11
|
|
|
12
12
|
// src/commands/import.ts
|
|
13
13
|
import { Command, Args, Flags } from "@oclif/core";
|
|
@@ -36,4 +36,3 @@ var Import = class _Import extends Command {
|
|
|
36
36
|
export {
|
|
37
37
|
Import as default
|
|
38
38
|
};
|
|
39
|
-
//# sourceMappingURL=import.js.map
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import {
|
|
2
2
|
getClient,
|
|
3
3
|
getUserId
|
|
4
|
-
} from "../chunk-
|
|
5
|
-
import "../chunk-
|
|
4
|
+
} from "../chunk-LXT34CD7.js";
|
|
5
|
+
import "../chunk-DRIWYEQE.js";
|
|
6
6
|
import {
|
|
7
7
|
exportNoteAsMarkdown,
|
|
8
8
|
getBlocksForNote,
|
|
9
9
|
listNotes,
|
|
10
10
|
markdownToTiptap,
|
|
11
11
|
saveNoteContent
|
|
12
|
-
} from "../chunk-
|
|
12
|
+
} from "../chunk-K5SQERJ7.js";
|
|
13
13
|
|
|
14
14
|
// src/commands/interactive.ts
|
|
15
15
|
import { Command, Args } from "@oclif/core";
|
|
@@ -82,6 +82,13 @@ function blocksToItems(blocks) {
|
|
|
82
82
|
case "fileBlock":
|
|
83
83
|
items.push({ kind: "file", text: attrs.filename || "file", checked: false });
|
|
84
84
|
break;
|
|
85
|
+
case "table": {
|
|
86
|
+
const tableRows = (tiptap.content ?? []).map(
|
|
87
|
+
(row) => (row.content ?? []).map((cell) => extractText(cell))
|
|
88
|
+
);
|
|
89
|
+
items.push({ kind: "table", text: "", checked: false, tableRows });
|
|
90
|
+
break;
|
|
91
|
+
}
|
|
85
92
|
default: {
|
|
86
93
|
const text = extractText(tiptap);
|
|
87
94
|
if (text.trim()) items.push({ kind: "text", text, checked: false });
|
|
@@ -126,6 +133,27 @@ ${item.text.split("\n").map((l) => ` ${YELLOW}\u2502${R} ${l}`).join("\n")}
|
|
|
126
133
|
return `${ptr}${DIM}[image: ${item.text}]${R}`;
|
|
127
134
|
case "file":
|
|
128
135
|
return `${ptr}${DIM}[file: ${item.text}]${R}`;
|
|
136
|
+
case "table": {
|
|
137
|
+
const rows = item.tableRows ?? [];
|
|
138
|
+
if (rows.length === 0) return `${ptr}${DIM}[empty table]${R}`;
|
|
139
|
+
const colCount = Math.max(...rows.map((r) => r.length));
|
|
140
|
+
const colWidths = Array.from(
|
|
141
|
+
{ length: colCount },
|
|
142
|
+
(_, ci) => Math.max(3, ...rows.map((r) => (r[ci] ?? "").length))
|
|
143
|
+
);
|
|
144
|
+
const hr = (l, m, r, s) => " " + l + colWidths.map((w) => s.repeat(w + 2)).join(m) + r;
|
|
145
|
+
const rowLine = (cells, bold) => " \u2502 " + colWidths.map((w, ci) => {
|
|
146
|
+
const text = (cells[ci] ?? "").padEnd(w);
|
|
147
|
+
return bold ? `${BOLD}${text}${R}` : text;
|
|
148
|
+
}).join(" \u2502 ") + " \u2502";
|
|
149
|
+
const lines = [hr("\u250C", "\u252C", "\u2510", "\u2500")];
|
|
150
|
+
rows.forEach((cells, ri) => {
|
|
151
|
+
lines.push(rowLine(cells, ri === 0));
|
|
152
|
+
if (ri === 0 && rows.length > 1) lines.push(hr("\u251C", "\u253C", "\u2524", "\u2500"));
|
|
153
|
+
});
|
|
154
|
+
lines.push(hr("\u2514", "\u2534", "\u2518", "\u2500"));
|
|
155
|
+
return ptr + lines.join("\n");
|
|
156
|
+
}
|
|
129
157
|
default:
|
|
130
158
|
return `${ptr}${item.text}`;
|
|
131
159
|
}
|
|
@@ -220,6 +248,20 @@ $$`;
|
|
|
220
248
|
case "file":
|
|
221
249
|
return `> [!file]
|
|
222
250
|
> ${item.text}`;
|
|
251
|
+
case "table": {
|
|
252
|
+
const rows = item.tableRows ?? [];
|
|
253
|
+
if (rows.length === 0) return "";
|
|
254
|
+
const colCount = Math.max(...rows.map((r) => r.length));
|
|
255
|
+
const colWidths = Array.from(
|
|
256
|
+
{ length: colCount },
|
|
257
|
+
(_, ci) => Math.max(3, ...rows.map((r) => (r[ci] ?? "").length))
|
|
258
|
+
);
|
|
259
|
+
return rows.map((cells, ri) => {
|
|
260
|
+
const line = "| " + colWidths.map((w, ci) => (cells[ci] ?? "").padEnd(w)).join(" | ") + " |";
|
|
261
|
+
if (ri === 0) return line + "\n| " + colWidths.map((w) => "-".repeat(w)).join(" | ") + " |";
|
|
262
|
+
return line;
|
|
263
|
+
}).join("\n");
|
|
264
|
+
}
|
|
223
265
|
default:
|
|
224
266
|
return item.text;
|
|
225
267
|
}
|
|
@@ -321,4 +363,3 @@ $$`;
|
|
|
321
363
|
export {
|
|
322
364
|
Interactive as default
|
|
323
365
|
};
|
|
324
|
-
//# sourceMappingURL=interactive.js.map
|
package/dist/commands/login.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
loadConfig,
|
|
3
3
|
saveConfig
|
|
4
|
-
} from "../chunk-
|
|
4
|
+
} from "../chunk-DRIWYEQE.js";
|
|
5
5
|
import {
|
|
6
6
|
createSupabaseClient
|
|
7
|
-
} from "../chunk-
|
|
7
|
+
} from "../chunk-K5SQERJ7.js";
|
|
8
8
|
|
|
9
9
|
// src/commands/login.ts
|
|
10
10
|
import { Command } from "@oclif/core";
|
|
@@ -163,4 +163,3 @@ var Login = class extends Command {
|
|
|
163
163
|
export {
|
|
164
164
|
Login as default
|
|
165
165
|
};
|
|
166
|
-
//# sourceMappingURL=login.js.map
|
package/dist/commands/logout.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
clearConfig
|
|
3
|
-
} from "../chunk-
|
|
3
|
+
} from "../chunk-DRIWYEQE.js";
|
|
4
4
|
|
|
5
5
|
// src/commands/logout.ts
|
|
6
6
|
import { Command } from "@oclif/core";
|
|
@@ -14,4 +14,3 @@ var Logout = class extends Command {
|
|
|
14
14
|
export {
|
|
15
15
|
Logout as default
|
|
16
16
|
};
|
|
17
|
-
//# sourceMappingURL=logout.js.map
|
package/dist/commands/new.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import {
|
|
2
2
|
getClient,
|
|
3
3
|
getUserId
|
|
4
|
-
} from "../chunk-
|
|
5
|
-
import "../chunk-
|
|
4
|
+
} from "../chunk-LXT34CD7.js";
|
|
5
|
+
import "../chunk-DRIWYEQE.js";
|
|
6
6
|
import {
|
|
7
7
|
createNote
|
|
8
|
-
} from "../chunk-
|
|
8
|
+
} from "../chunk-K5SQERJ7.js";
|
|
9
9
|
|
|
10
10
|
// src/commands/new.ts
|
|
11
11
|
import { Command, Args } from "@oclif/core";
|
|
@@ -25,4 +25,3 @@ var New = class _New extends Command {
|
|
|
25
25
|
export {
|
|
26
26
|
New as default
|
|
27
27
|
};
|
|
28
|
-
//# sourceMappingURL=new.js.map
|
package/dist/commands/notes.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import {
|
|
2
2
|
getClient,
|
|
3
3
|
getUserId
|
|
4
|
-
} from "../chunk-
|
|
5
|
-
import "../chunk-
|
|
4
|
+
} from "../chunk-LXT34CD7.js";
|
|
5
|
+
import "../chunk-DRIWYEQE.js";
|
|
6
6
|
import {
|
|
7
7
|
listNotes
|
|
8
|
-
} from "../chunk-
|
|
8
|
+
} from "../chunk-K5SQERJ7.js";
|
|
9
9
|
|
|
10
10
|
// src/commands/notes.ts
|
|
11
11
|
import { Command } from "@oclif/core";
|
|
@@ -42,4 +42,3 @@ var Notes = class extends Command {
|
|
|
42
42
|
export {
|
|
43
43
|
Notes as default
|
|
44
44
|
};
|
|
45
|
-
//# sourceMappingURL=notes.js.map
|
package/dist/commands/restore.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
getClient,
|
|
3
3
|
getUserId
|
|
4
|
-
} from "../chunk-
|
|
5
|
-
import "../chunk-
|
|
4
|
+
} from "../chunk-LXT34CD7.js";
|
|
5
|
+
import "../chunk-DRIWYEQE.js";
|
|
6
6
|
import {
|
|
7
7
|
listNotes,
|
|
8
8
|
restoreNote
|
|
9
|
-
} from "../chunk-
|
|
9
|
+
} from "../chunk-K5SQERJ7.js";
|
|
10
10
|
|
|
11
11
|
// src/commands/restore.ts
|
|
12
12
|
import { Command, Args } from "@oclif/core";
|
|
@@ -32,4 +32,3 @@ var Restore = class _Restore extends Command {
|
|
|
32
32
|
export {
|
|
33
33
|
Restore as default
|
|
34
34
|
};
|
|
35
|
-
//# sourceMappingURL=restore.js.map
|
package/dist/commands/search.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import {
|
|
2
2
|
getClient,
|
|
3
3
|
getUserId
|
|
4
|
-
} from "../chunk-
|
|
5
|
-
import "../chunk-
|
|
4
|
+
} from "../chunk-LXT34CD7.js";
|
|
5
|
+
import "../chunk-DRIWYEQE.js";
|
|
6
6
|
import {
|
|
7
7
|
executeQuery
|
|
8
|
-
} from "../chunk-
|
|
8
|
+
} from "../chunk-K5SQERJ7.js";
|
|
9
9
|
|
|
10
10
|
// src/commands/search.ts
|
|
11
11
|
import { Command, Args } from "@oclif/core";
|
|
@@ -35,4 +35,3 @@ var Search = class _Search extends Command {
|
|
|
35
35
|
export {
|
|
36
36
|
Search as default
|
|
37
37
|
};
|
|
38
|
-
//# sourceMappingURL=search.js.map
|