dblx 0.1.64 → 0.1.80
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/README.md +7 -0
- package/dist/index.js +66 -9
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -145,6 +145,13 @@ dblx create comment --thread <thread-id> --body "Hello"
|
|
|
145
145
|
dblx set comment <comment-id> --body "Updated text"
|
|
146
146
|
```
|
|
147
147
|
|
|
148
|
+
### Closing A Thread
|
|
149
|
+
|
|
150
|
+
```bash
|
|
151
|
+
dblx create comment --thread <thread-id> --body "Implemented and pushed."
|
|
152
|
+
dblx set thread <thread-id> --archived true
|
|
153
|
+
```
|
|
154
|
+
|
|
148
155
|
### Members
|
|
149
156
|
|
|
150
157
|
```bash
|
package/dist/index.js
CHANGED
|
@@ -5,15 +5,29 @@ var __getProtoOf = Object.getPrototypeOf;
|
|
|
5
5
|
var __defProp = Object.defineProperty;
|
|
6
6
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
7
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
function __accessProp(key) {
|
|
9
|
+
return this[key];
|
|
10
|
+
}
|
|
11
|
+
var __toESMCache_node;
|
|
12
|
+
var __toESMCache_esm;
|
|
8
13
|
var __toESM = (mod, isNodeMode, target) => {
|
|
14
|
+
var canCache = mod != null && typeof mod === "object";
|
|
15
|
+
if (canCache) {
|
|
16
|
+
var cache = isNodeMode ? __toESMCache_node ??= new WeakMap : __toESMCache_esm ??= new WeakMap;
|
|
17
|
+
var cached = cache.get(mod);
|
|
18
|
+
if (cached)
|
|
19
|
+
return cached;
|
|
20
|
+
}
|
|
9
21
|
target = mod != null ? __create(__getProtoOf(mod)) : {};
|
|
10
22
|
const to = isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target;
|
|
11
23
|
for (let key of __getOwnPropNames(mod))
|
|
12
24
|
if (!__hasOwnProp.call(to, key))
|
|
13
25
|
__defProp(to, key, {
|
|
14
|
-
get: (
|
|
26
|
+
get: __accessProp.bind(mod, key),
|
|
15
27
|
enumerable: true
|
|
16
28
|
});
|
|
29
|
+
if (canCache)
|
|
30
|
+
cache.set(mod, to);
|
|
17
31
|
return to;
|
|
18
32
|
};
|
|
19
33
|
var __commonJS = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
|
|
@@ -2604,10 +2618,27 @@ function parseBooleanish(value) {
|
|
|
2604
2618
|
throw new InvalidArgumentError('Expected "true" or "false".');
|
|
2605
2619
|
}
|
|
2606
2620
|
|
|
2621
|
+
// src/urls.ts
|
|
2622
|
+
function inferThreadUrl(apiUrl, threadId) {
|
|
2623
|
+
const { origin } = new URL(apiUrl);
|
|
2624
|
+
return `${origin}/dashboard/thread/${threadId}`;
|
|
2625
|
+
}
|
|
2626
|
+
|
|
2607
2627
|
// src/commands/get.ts
|
|
2608
2628
|
function relatedThreadLabel(thread) {
|
|
2609
2629
|
return `${thread.thread.id.slice(0, 8)} ${thread.thread.body}`;
|
|
2610
2630
|
}
|
|
2631
|
+
function groupAttachmentsByComment(attachments) {
|
|
2632
|
+
const map = new Map;
|
|
2633
|
+
for (const a2 of attachments) {
|
|
2634
|
+
if (!a2.thread_comment_id)
|
|
2635
|
+
continue;
|
|
2636
|
+
const list = map.get(a2.thread_comment_id) ?? [];
|
|
2637
|
+
list.push(a2);
|
|
2638
|
+
map.set(a2.thread_comment_id, list);
|
|
2639
|
+
}
|
|
2640
|
+
return map;
|
|
2641
|
+
}
|
|
2611
2642
|
var getCommand = new Command("get").description("Read data from dblebox").addCommand(new Command("threads").description("List or search your threads").argument("[thread-id]", "Thread ID").option("--q <query>", "Filter by partial title/body text").option("--json", "Output as JSON").option("--archived", "Include archived threads").option("--snoozed", "Include snoozed threads").action(async (threadId, opts) => {
|
|
2612
2643
|
const api = getApi();
|
|
2613
2644
|
if (threadId) {
|
|
@@ -2618,7 +2649,14 @@ var getCommand = new Command("get").description("Read data from dblebox").addCom
|
|
|
2618
2649
|
if (error2)
|
|
2619
2650
|
throw error2;
|
|
2620
2651
|
if (opts.json) {
|
|
2621
|
-
|
|
2652
|
+
const config = loadConfig();
|
|
2653
|
+
if (!config) {
|
|
2654
|
+
throw new Error("Not logged in. Run: dblx auth login");
|
|
2655
|
+
}
|
|
2656
|
+
output({
|
|
2657
|
+
...data2,
|
|
2658
|
+
url: inferThreadUrl(config.api_url, data2.thread.id)
|
|
2659
|
+
}, { json: true });
|
|
2622
2660
|
return;
|
|
2623
2661
|
}
|
|
2624
2662
|
console.log(`Thread: ${data2.thread.body}`);
|
|
@@ -2632,8 +2670,12 @@ Comments:`);
|
|
|
2632
2670
|
if (data2.comments.length === 0) {
|
|
2633
2671
|
console.log("(none)");
|
|
2634
2672
|
} else {
|
|
2673
|
+
const byComment = groupAttachmentsByComment(data2.attachments ?? []);
|
|
2635
2674
|
for (const comment of data2.comments) {
|
|
2636
2675
|
console.log(`- [${comment.created_at}] @${comment.creator_username}: ${comment.body}`);
|
|
2676
|
+
for (const a2 of byComment.get(comment.id) ?? []) {
|
|
2677
|
+
console.log(` \uD83D\uDCCE ${a2.filename} ${a2.url}`);
|
|
2678
|
+
}
|
|
2637
2679
|
}
|
|
2638
2680
|
}
|
|
2639
2681
|
console.log(`
|
|
@@ -2734,12 +2776,27 @@ Children:`);
|
|
|
2734
2776
|
output(data.comments, { json: true });
|
|
2735
2777
|
return;
|
|
2736
2778
|
}
|
|
2737
|
-
const
|
|
2738
|
-
|
|
2739
|
-
|
|
2740
|
-
|
|
2741
|
-
|
|
2742
|
-
|
|
2779
|
+
const byComment = groupAttachmentsByComment(data.attachments ?? []);
|
|
2780
|
+
const rows = data.comments.flatMap((c2) => {
|
|
2781
|
+
const base = {
|
|
2782
|
+
id: c2.id.slice(0, 8),
|
|
2783
|
+
user: c2.creator_username,
|
|
2784
|
+
body: c2.body.length > 60 ? c2.body.slice(0, 57) + "..." : c2.body,
|
|
2785
|
+
created_at: c2.created_at
|
|
2786
|
+
};
|
|
2787
|
+
const commentAttachments = byComment.get(c2.id) ?? [];
|
|
2788
|
+
if (!commentAttachments.length)
|
|
2789
|
+
return [base];
|
|
2790
|
+
return [
|
|
2791
|
+
base,
|
|
2792
|
+
...commentAttachments.map((a2) => ({
|
|
2793
|
+
id: "",
|
|
2794
|
+
user: "",
|
|
2795
|
+
body: `\uD83D\uDCCE ${a2.filename} ${a2.url}`,
|
|
2796
|
+
created_at: ""
|
|
2797
|
+
}))
|
|
2798
|
+
];
|
|
2799
|
+
});
|
|
2743
2800
|
output(rows, { json: false });
|
|
2744
2801
|
})).addCommand(new Command("members").description("List members of a thread").argument("<thread-id>", "Thread ID").option("--json", "Output as JSON").action(async (threadId, opts) => {
|
|
2745
2802
|
const api = getApi();
|
|
@@ -2919,7 +2976,7 @@ var inviteCommand = new Command("invite").description("Invite collaborators").ad
|
|
|
2919
2976
|
// package.json
|
|
2920
2977
|
var package_default = {
|
|
2921
2978
|
name: "dblx",
|
|
2922
|
-
version: "0.1.
|
|
2979
|
+
version: "0.1.80",
|
|
2923
2980
|
description: "CLI for dblebox — thread-first communication",
|
|
2924
2981
|
type: "module",
|
|
2925
2982
|
bin: {
|