@kamilio/wire 0.1.22 → 0.1.23
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 -2
- package/dist/adapters/root.d.ts +5 -0
- package/dist/adapters/root.d.ts.map +1 -1
- package/dist/adapters/root.js +40 -4
- package/dist/adapters/root.js.map +1 -1
- package/dist/cli.js +1 -1
- package/dist/cli.js.map +1 -1
- package/dist/executable.d.ts.map +1 -1
- package/dist/executable.js +2 -1
- package/dist/executable.js.map +1 -1
- package/node_modules/@xmldom/xmldom/CHANGELOG.md +1132 -0
- package/node_modules/@xmldom/xmldom/LICENSE +8 -0
- package/node_modules/@xmldom/xmldom/SECURITY.md +50 -0
- package/node_modules/@xmldom/xmldom/index.d.ts +1843 -0
- package/node_modules/@xmldom/xmldom/lib/.eslintrc.yml +3 -0
- package/node_modules/@xmldom/xmldom/lib/conventions.js +429 -0
- package/node_modules/@xmldom/xmldom/lib/dom-parser.js +591 -0
- package/node_modules/@xmldom/xmldom/lib/dom.js +3759 -0
- package/node_modules/@xmldom/xmldom/lib/entities.js +2171 -0
- package/node_modules/@xmldom/xmldom/lib/errors.js +205 -0
- package/node_modules/@xmldom/xmldom/lib/grammar.js +559 -0
- package/node_modules/@xmldom/xmldom/lib/index.js +41 -0
- package/node_modules/@xmldom/xmldom/lib/sax.js +983 -0
- package/node_modules/@xmldom/xmldom/package.json +77 -0
- package/node_modules/@xmldom/xmldom/readme.md +366 -0
- package/node_modules/marked/LICENSE.md +44 -0
- package/node_modules/marked/README.md +107 -0
- package/node_modules/marked/bin/main.js +284 -0
- package/node_modules/marked/bin/marked.js +16 -0
- package/node_modules/marked/lib/marked.d.ts +759 -0
- package/node_modules/marked/lib/marked.esm.js +72 -0
- package/node_modules/marked/lib/marked.esm.js.map +7 -0
- package/node_modules/marked/lib/marked.umd.js +74 -0
- package/node_modules/marked/lib/marked.umd.js.map +7 -0
- package/node_modules/marked/man/marked.1 +113 -0
- package/node_modules/marked/man/marked.1.md +93 -0
- package/node_modules/marked/package.json +103 -0
- package/node_modules/provider-asana/dist/asana-markdown.d.ts +5 -0
- package/node_modules/provider-asana/dist/asana-markdown.d.ts.map +1 -0
- package/node_modules/provider-asana/dist/asana-markdown.js +127 -0
- package/node_modules/provider-asana/dist/asana-markdown.js.map +1 -0
- package/node_modules/provider-asana/dist/asana-task.d.ts +9 -4
- package/node_modules/provider-asana/dist/asana-task.d.ts.map +1 -1
- package/node_modules/provider-asana/dist/asana-task.js +92 -12
- package/node_modules/provider-asana/dist/asana-task.js.map +1 -1
- package/node_modules/provider-asana/dist/index.d.ts +1 -1
- package/node_modules/provider-asana/dist/index.d.ts.map +1 -1
- package/node_modules/provider-asana/dist/index.js +1 -1
- package/node_modules/provider-asana/dist/index.js.map +1 -1
- package/node_modules/provider-asana/package.json +2 -0
- package/node_modules/provider-asana/src/asana-markdown.ts +113 -0
- package/node_modules/provider-asana/src/asana-task.ts +80 -12
- package/node_modules/provider-asana/src/index.ts +1 -1
- package/package.json +12 -6
- package/src/adapters/root.ts +42 -4
- package/src/cli.ts +1 -1
- package/src/executable.ts +2 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"asana-task.js","sourceRoot":"","sources":["../src/asana-task.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"asana-task.js","sourceRoot":"","sources":["../src/asana-task.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACnE,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AACrD,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAI1C,SAAS,MAAM,CAAC,KAAgB;IAC9B,OAAO,KAAmB,CAAC;AAC7B,CAAC;AAED,SAAS,iBAAiB,CAAC,IAAgB;IACzC,MAAM,MAAM,GAAG,IAA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C;IACpF,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE;QAAE,MAAM,IAAI,KAAK,CAAC,+BAA+B,CAAC,CAAC;IACnE,OAAO,MAAM,CAAC,CAAC,MAAM,OAAO,CAAC,OAAO,EAAE,KAAK,EAAE,YAAY,OAAO,EAAE,EAAE,EAAE,UAAU,EAAE,MAAM,EAAE,EAAE,EAAE,SAAS,EAAE,aAAa,CAAC,IAAI,EAAE,SAAS,CAAC,EAAE,CAAC,CAAC,CAAC,MAAM,CAAE,CAAC,CAAC;AACxJ,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { asanaProjectService } from "./asana-project.js";
|
|
2
2
|
export { listAsanaProjects, listAsanaTasks } from "./asana-explore.js";
|
|
3
|
-
export { asanaTaskService, showAsanaTask } from "./asana-task.js";
|
|
3
|
+
export { addAsanaComment, asanaTaskService, editAsanaComment, editAsanaTask, showAsanaTask } from "./asana-task.js";
|
|
4
4
|
export { asanaChanges, asanaConflicts, asanaDocument, asanaSnapshot, parseAsanaMarkdown, renderAsanaMarkdown } from "./asana-sync.js";
|
|
5
5
|
export type { AsanaChange, AsanaDocument, AsanaEntity } from "./asana-sync.js";
|
|
6
6
|
export declare const asanaProvider: Readonly<{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AACzD,OAAO,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACvE,OAAO,EAAE,gBAAgB,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AACzD,OAAO,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACvE,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AACpH,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,aAAa,EAAE,aAAa,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AACtI,YAAY,EAAE,WAAW,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC/E,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAExB,CAAC"}
|
|
@@ -2,7 +2,7 @@ import { asanaProjectService } from "./asana-project.js";
|
|
|
2
2
|
import { asanaTaskService } from "./asana-task.js";
|
|
3
3
|
export { asanaProjectService } from "./asana-project.js";
|
|
4
4
|
export { listAsanaProjects, listAsanaTasks } from "./asana-explore.js";
|
|
5
|
-
export { asanaTaskService, showAsanaTask } from "./asana-task.js";
|
|
5
|
+
export { addAsanaComment, asanaTaskService, editAsanaComment, editAsanaTask, showAsanaTask } from "./asana-task.js";
|
|
6
6
|
export { asanaChanges, asanaConflicts, asanaDocument, asanaSnapshot, parseAsanaMarkdown, renderAsanaMarkdown } from "./asana-sync.js";
|
|
7
7
|
export const asanaProvider = Object.freeze({
|
|
8
8
|
services: [asanaProjectService, asanaTaskService],
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AACzD,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAEnD,OAAO,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AACzD,OAAO,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACvE,OAAO,EAAE,gBAAgB,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AACzD,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAEnD,OAAO,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AACzD,OAAO,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACvE,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AACpH,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,aAAa,EAAE,aAAa,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AAEtI,MAAM,CAAC,MAAM,aAAa,GAAG,MAAM,CAAC,MAAM,CAAC;IACzC,QAAQ,EAAE,CAAC,mBAAmB,EAAE,gBAAgB,CAAU;CAC3D,CAAC,CAAC"}
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import { DOMParser, type Element, type Node } from "@xmldom/xmldom";
|
|
2
|
+
import { marked, type Token, type Tokens } from "marked";
|
|
3
|
+
|
|
4
|
+
function xml(text: string): string {
|
|
5
|
+
return text.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """);
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
type Target = "task" | "comment" | "field";
|
|
9
|
+
|
|
10
|
+
export function asanaRichText(markdown: string, target: Target): string {
|
|
11
|
+
const render = (tokens: Token[]): string => tokens.map(token).join("");
|
|
12
|
+
const blocks = (tokens: Token[]): string => tokens.filter((t) => t.type !== "space" && t.type !== "def").map(token).join("\n\n");
|
|
13
|
+
function token(t: Token): string {
|
|
14
|
+
switch (t.type) {
|
|
15
|
+
case "paragraph": return render(t.tokens!);
|
|
16
|
+
case "text": return t.tokens ? render(t.tokens!) : xml(t.text);
|
|
17
|
+
case "escape": return xml(t.text);
|
|
18
|
+
case "html": return /^<\/?u>$/.test(t.text) ? t.text : xml(t.text);
|
|
19
|
+
case "br": return "\n";
|
|
20
|
+
case "strong": case "em": return `<${t.type}>${render(t.tokens!)}</${t.type}>`;
|
|
21
|
+
case "del": return `<s>${render(t.tokens!)}</s>`;
|
|
22
|
+
case "codespan": return `<code>${xml(t.text)}</code>`;
|
|
23
|
+
case "code": return `<pre${t.lang ? ` data-language="${xml(t.lang)}"` : ""}>${xml(t.text)}</pre>`;
|
|
24
|
+
case "blockquote": return `<blockquote>${blocks(t.tokens!)}</blockquote>`;
|
|
25
|
+
case "heading": {
|
|
26
|
+
const tag = target === "task" && t.depth <= 2 ? `h${t.depth}` : "strong";
|
|
27
|
+
return `<${tag}>${render(t.tokens!)}</${tag}>`;
|
|
28
|
+
}
|
|
29
|
+
case "hr": return target === "task" ? "<hr/>" : "———";
|
|
30
|
+
case "list": {
|
|
31
|
+
const tag = t.ordered ? "ol" : "ul";
|
|
32
|
+
return `<${tag}>${t.items.map((item: Tokens.ListItem) => `<li>${render(item.tokens)}</li>`).join("")}</${tag}>`;
|
|
33
|
+
}
|
|
34
|
+
case "checkbox": return t.checked ? "☑ " : "☐ ";
|
|
35
|
+
case "space": return "\n\n";
|
|
36
|
+
case "link": case "image": {
|
|
37
|
+
const gid = /^asana:(\d+)$/.exec(t.title ?? "")?.[1] ?? /^asana:\/\/(\d+)$/.exec(t.href)?.[1];
|
|
38
|
+
if (t.type === "image" && gid && target === "task") return `<img data-asana-gid="${gid}"/>`;
|
|
39
|
+
if (gid) return `<a data-asana-gid="${gid}"></a>`;
|
|
40
|
+
if (!/^(?:https?:\/\/|mailto:)/i.test(t.href)) throw new Error("Asana links need an absolute HTTP, HTTPS, or mailto URL.");
|
|
41
|
+
return `<a href="${xml(t.href)}">${t.type === "image" ? xml(t.text || t.href) : render(t.tokens!)}</a>`;
|
|
42
|
+
}
|
|
43
|
+
case "table": {
|
|
44
|
+
if (target !== "task") throw new Error("Asana supports Markdown tables in task descriptions only.");
|
|
45
|
+
return "<table>" + [t.header, ...t.rows].map((row: Tokens.TableCell[]) => "<tr>" + row.map((cell) => `<td>${render(cell.tokens)}</td>`).join("") + "</tr>").join("") + "</table>";
|
|
46
|
+
}
|
|
47
|
+
default: return xml(t.raw);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
const html = `<body>${blocks(marked.lexer(markdown))}</body>`;
|
|
51
|
+
if (/[\x00-\x08\x0b\x0c\x0e-\x1f]/.test(html)) throw new Error("Asana rich text cannot contain XML control characters.");
|
|
52
|
+
// Raw underline tags are allowed in Markdown, so validate their nesting.
|
|
53
|
+
if (/<\/?u>/.test(html)) new DOMParser({ onError: () => { throw new Error("Unbalanced underline tags in Markdown."); } }).parseFromString(html, "application/xml");
|
|
54
|
+
return html;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
function literal(value: string): string {
|
|
58
|
+
return value.replace(/([\\`*_\[\]~<>])/g, "\\$1").replace(/^(\s*)(#{1,6}|[-+=>])(?=\s)/gm, "$1\\$2").replace(/^(\s*\d+)([.)])(?=\s)/gm, "$1\\$2");
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export function asanaMarkdown(html: string): string {
|
|
62
|
+
const root = new DOMParser().parseFromString(html, "application/xml").documentElement!;
|
|
63
|
+
// Asana may supply its own newlines around block elements. Keep whichever
|
|
64
|
+
// boundary is wider rather than adding both to the Markdown.
|
|
65
|
+
const children = (node: Node): string => Array.from(node.childNodes ?? []).map(render).reduce((before, after) => {
|
|
66
|
+
const overlap = Math.min(before.match(/\n*$/)![0].length, after.match(/^\n*/)![0].length);
|
|
67
|
+
return before + after.slice(overlap);
|
|
68
|
+
}, "");
|
|
69
|
+
function render(node: Node): string {
|
|
70
|
+
if (node.nodeType === 3 || node.nodeType === 4) return literal(node.nodeValue ?? "");
|
|
71
|
+
if (node.nodeType !== 1) return "";
|
|
72
|
+
const el = node as Element;
|
|
73
|
+
const content = () => children(el);
|
|
74
|
+
switch (el.tagName) {
|
|
75
|
+
case "strong": case "b": return `**${content()}**`;
|
|
76
|
+
case "em": case "i": return `*${content()}*`;
|
|
77
|
+
case "s": return `~~${content()}~~`;
|
|
78
|
+
case "u": return `<u>${content()}</u>`;
|
|
79
|
+
case "br": return "\n";
|
|
80
|
+
case "a": case "img": {
|
|
81
|
+
const gid = el.getAttribute("data-asana-gid");
|
|
82
|
+
const href = el.getAttribute("href") || (gid ? `asana://${gid}` : el.getAttribute("src"));
|
|
83
|
+
if (!href) return content();
|
|
84
|
+
return `${el.tagName === "img" ? "!" : ""}[${content() || gid || "link"}](${href.replace(/[()\s<>]/g, c => "%" + c.charCodeAt(0).toString(16))}${gid && el.hasAttribute("href") ? ` "asana:${gid}"` : ""})`;
|
|
85
|
+
}
|
|
86
|
+
case "code": case "pre": {
|
|
87
|
+
const text = el.textContent ?? "";
|
|
88
|
+
const fence = "`".repeat(Math.max(el.tagName === "pre" ? 3 : 1, ...Array.from(text.matchAll(/`+/g), m => m[0].length + 1)));
|
|
89
|
+
if (el.tagName === "pre") return `\n\n${fence}${el.getAttribute("data-language") ?? ""}\n${text}\n${fence}\n\n`;
|
|
90
|
+
const pad = /^`|`$/.test(text) || /^ .* $/.test(text) && /\S/.test(text) ? " " : "";
|
|
91
|
+
return `${fence}${pad}${text}${pad}${fence}`;
|
|
92
|
+
}
|
|
93
|
+
case "h1": case "h2": return `\n\n${el.tagName === "h1" ? "#" : "##"} ${content()}\n\n`;
|
|
94
|
+
case "hr": return "\n\n---\n\n";
|
|
95
|
+
case "blockquote": return "\n\n" + content().trim().split("\n").map(line => "> " + line).join("\n") + "\n\n";
|
|
96
|
+
case "ul": case "ol": {
|
|
97
|
+
const rows = Array.from(el.childNodes).filter(item => item.nodeName === "li").map((li, i) => {
|
|
98
|
+
const prefix = el.tagName === "ol" ? `${i + 1}. ` : "- ";
|
|
99
|
+
return prefix + children(li).trim().replace(/\n/g, "\n" + " ".repeat(prefix.length));
|
|
100
|
+
});
|
|
101
|
+
return "\n" + rows.join("\n") + "\n";
|
|
102
|
+
}
|
|
103
|
+
case "table": {
|
|
104
|
+
const rows = Array.from(el.getElementsByTagName("tr")).map(row => Array.from(row.getElementsByTagName("td")).map(cell => children(cell).replace(/\|/g, "\\|").replace(/\n/g, " ")));
|
|
105
|
+
if (!rows.length) return "";
|
|
106
|
+
rows.splice(1, 0, rows[0]!.map(() => "---"));
|
|
107
|
+
return "\n\n" + rows.map(row => "| " + row.join(" | ") + " |").join("\n") + "\n\n";
|
|
108
|
+
}
|
|
109
|
+
default: return content();
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
return children(root).trim();
|
|
113
|
+
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { asanaMarkdown, asanaRichText } from "./asana-markdown.js";
|
|
2
|
+
import { asanaHttp, request } from "./asana-http.js";
|
|
2
3
|
import { defineService } from "wire-core";
|
|
3
4
|
import type { JsonObject, JsonValue } from "wire-core";
|
|
4
5
|
import type { RuntimeCapabilities } from "wire-core";
|
|
@@ -37,7 +38,7 @@ async function asana(runtime: RuntimeCapabilities, path: string, parameters: Rea
|
|
|
37
38
|
|
|
38
39
|
async function fetchTask(runtime: RuntimeCapabilities, identifier: string): Promise<JsonObject> {
|
|
39
40
|
return object((await asana(runtime, `/tasks/${identifier}`, {
|
|
40
|
-
opt_fields: "gid,name,notes,completed,completed_at,created_at,modified_at,due_on,due_at,permalink_url,assignee,assignee.name,assignee.email,memberships.project.gid,memberships.project.name,memberships.section.name,projects.name,tags.name",
|
|
41
|
+
opt_fields: "gid,name,notes,html_notes,completed,completed_at,created_at,modified_at,due_on,due_at,permalink_url,assignee,assignee.name,assignee.email,memberships.project.gid,memberships.project.name,memberships.section.name,projects.name,tags.name,start_on,start_at,resource_subtype,approval_status,custom_type.name,custom_type_status_option.name,custom_fields.name,custom_fields.resource_subtype,custom_fields.display_value,custom_fields.is_value_read_only,custom_fields.enabled,custom_fields.enum_options.name,custom_fields.enum_options.enabled,custom_fields.text_value,custom_fields.html_text_value,custom_fields.number_value,custom_fields.enum_value.name,custom_fields.multi_enum_values.name,custom_fields.date_value,custom_fields.people_value.name,custom_fields.reference_value.name",
|
|
41
42
|
}))["data"]!);
|
|
42
43
|
}
|
|
43
44
|
|
|
@@ -45,7 +46,7 @@ async function fetchStories(runtime: RuntimeCapabilities, identifier: string): P
|
|
|
45
46
|
const stories: JsonValue[] = [];
|
|
46
47
|
let offset: string | undefined;
|
|
47
48
|
do {
|
|
48
|
-
const parameters: Record<string, string> = { limit: "100", opt_fields: "gid,type,text,created_at,created_by.name,created_by.email,resource_subtype" };
|
|
49
|
+
const parameters: Record<string, string> = { limit: "100", opt_fields: "gid,type,text,html_text,is_editable,comment_gid,anchor_gid,created_at,created_by.name,created_by.email,resource_subtype" };
|
|
49
50
|
if (offset !== undefined) parameters["offset"] = offset;
|
|
50
51
|
const page = await asana(runtime, `/tasks/${identifier}/stories`, parameters);
|
|
51
52
|
stories.push(...page["data"] as readonly JsonValue[]);
|
|
@@ -82,15 +83,82 @@ export async function showAsanaTask(runtime: RuntimeCapabilities, identifier: st
|
|
|
82
83
|
const stories = await fetchStories(runtime, identifier);
|
|
83
84
|
const assignee = task["assignee"] as JsonObject | null;
|
|
84
85
|
const lines = [`# ${task["name"] as string}`, "", `- Source: ${task["permalink_url"] as string}`, `- Completed: ${task["completed"] as boolean ? "True" : "False"}`];
|
|
85
|
-
if (assignee !== null) lines.push(`- Assignee: ${assignee["name"]
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
86
|
+
if (assignee !== null) lines.push(`- Assignee: ${assignee["name"]}${assignee["email"] ? ` <${assignee["email"]}>` : ""}`);
|
|
87
|
+
for (const [label, value] of [
|
|
88
|
+
["Starts", task["start_at"] ?? task["start_on"]], ["Due", task["due_at"] ?? task["due_on"]],
|
|
89
|
+
["Approval", task["resource_subtype"] === "approval" ? task["approval_status"] : null],
|
|
90
|
+
["Task type", (task["custom_type"] as JsonObject | null)?.["name"]],
|
|
91
|
+
["Status", (task["custom_type_status_option"] as JsonObject | null)?.["name"]],
|
|
92
|
+
]) if (value) lines.push(`- ${label}: ${value}`);
|
|
93
|
+
const bodyMarkdown = task["html_notes"] ? asanaMarkdown(task["html_notes"] as string) : task["notes"] as string;
|
|
94
|
+
lines.push("", bodyMarkdown);
|
|
95
|
+
const fields = task["custom_fields"] as readonly JsonObject[] | undefined;
|
|
96
|
+
if (fields?.length) {
|
|
97
|
+
lines.push("", "## Custom fields", "");
|
|
98
|
+
for (const field of fields) {
|
|
99
|
+
const readOnly = field["is_value_read_only"] || field["enabled"] === false;
|
|
100
|
+
lines.push(`- ${field["name"]} (${field["gid"]}, ${field["resource_subtype"]}${readOnly ? ", read-only" : ""}): ${field["html_text_value"] ? asanaMarkdown(field["html_text_value"] as string) : field["display_value"] ?? "—"}`);
|
|
93
101
|
}
|
|
94
102
|
}
|
|
95
|
-
|
|
103
|
+
const comments: string[] = [];
|
|
104
|
+
const activity: string[] = [];
|
|
105
|
+
const storyData = stories.map((value) => {
|
|
106
|
+
const story = object(value);
|
|
107
|
+
const isComment = story["type"] === "comment" || story["resource_subtype"] === "comment_added";
|
|
108
|
+
const author = (story["created_by"] as JsonObject | null)?.["name"] ?? "System";
|
|
109
|
+
const id = isComment ? ` [${story["gid"]}${story["is_editable"] ? ", editable" : ""}]` : "";
|
|
110
|
+
if (isComment) {
|
|
111
|
+
const body = story["html_text"] ? asanaMarkdown(story["html_text"] as string) : story["text"] ?? "";
|
|
112
|
+
comments.push(`**${author}** · ${story["created_at"]}${id}\n\n${body}`);
|
|
113
|
+
return { ...story, body_markdown: body };
|
|
114
|
+
}
|
|
115
|
+
activity.push(`- ${story["created_at"]} — ${author}: ${story["text"] ?? ""}`);
|
|
116
|
+
return story;
|
|
117
|
+
});
|
|
118
|
+
if (comments.length) lines.push("", "## Comments", "", comments.join("\n\n"));
|
|
119
|
+
if (activity.length) lines.push("", "## Activity", "", ...activity);
|
|
120
|
+
return Object.freeze({ title: task["name"] as string, markdown: `${lines.join("\n").trimEnd()}\n`, data: { task: { ...task, body_markdown: bodyMarkdown }, stories: storyData } });
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
export async function editAsanaTask(runtime: RuntimeCapabilities, task: string, fields: JsonObject): Promise<JsonObject> {
|
|
124
|
+
if (!/^\d+$/.test(task)) throw new Error("Expected a numeric Asana task ID.");
|
|
125
|
+
if (!Object.keys(fields).length) throw new Error("No task fields to update.");
|
|
126
|
+
const data = { ...fields };
|
|
127
|
+
if ("html_notes" in data || "html_custom_fields" in data) throw new Error("Use Markdown in notes or custom_fields instead of HTML.");
|
|
128
|
+
if ("notes" in data) {
|
|
129
|
+
if (typeof data["notes"] !== "string") throw new Error("Task notes must be Markdown text.");
|
|
130
|
+
data["html_notes"] = asanaRichText(data["notes"], "task");
|
|
131
|
+
delete data["notes"];
|
|
132
|
+
}
|
|
133
|
+
const custom = data["custom_fields"];
|
|
134
|
+
if (custom && typeof custom === "object" && !Array.isArray(custom) && Object.values(custom).some(v => typeof v === "string")) {
|
|
135
|
+
const schema = object((await asana(runtime, `/tasks/${task}`, { opt_fields: "custom_fields.resource_subtype" }))["data"]!);
|
|
136
|
+
const values: Record<string, JsonValue> = { ...custom as JsonObject };
|
|
137
|
+
const rich: Record<string, string> = {};
|
|
138
|
+
for (const field of schema["custom_fields"] as readonly JsonObject[]) {
|
|
139
|
+
const key = field["gid"] as string;
|
|
140
|
+
const value = values[key];
|
|
141
|
+
if (field["resource_subtype"] !== "text" || typeof value !== "string") continue;
|
|
142
|
+
rich[key] = asanaRichText(value, "field");
|
|
143
|
+
delete values[key];
|
|
144
|
+
}
|
|
145
|
+
if (Object.keys(rich).length) {
|
|
146
|
+
data["html_custom_fields"] = rich;
|
|
147
|
+
if (Object.keys(values).length) data["custom_fields"] = values;
|
|
148
|
+
else delete data["custom_fields"];
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
return object((await request(runtime, "PUT", `/tasks/${task}`, { opt_fields: "name,permalink_url" }, data))["data"]!);
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
export async function addAsanaComment(runtime: RuntimeCapabilities, task: string, body: string): Promise<JsonObject> {
|
|
155
|
+
if (!/^\d+$/.test(task)) throw new Error("Expected a numeric Asana task ID.");
|
|
156
|
+
if (!body.trim()) throw new Error("Comment body cannot be empty.");
|
|
157
|
+
return object((await request(runtime, "POST", `/tasks/${task}/stories`, { opt_fields: "text" }, { html_text: asanaRichText(body, "comment") }))["data"]!);
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
export async function editAsanaComment(runtime: RuntimeCapabilities, comment: string, body: string): Promise<JsonObject> {
|
|
161
|
+
if (!/^\d+$/.test(comment)) throw new Error("Expected a numeric Asana comment ID.");
|
|
162
|
+
if (!body.trim()) throw new Error("Comment body cannot be empty.");
|
|
163
|
+
return object((await request(runtime, "PUT", `/stories/${comment}`, { opt_fields: "text" }, { html_text: asanaRichText(body, "comment") }))["data"]!);
|
|
96
164
|
}
|
|
@@ -3,7 +3,7 @@ import { asanaTaskService } from "./asana-task.js";
|
|
|
3
3
|
|
|
4
4
|
export { asanaProjectService } from "./asana-project.js";
|
|
5
5
|
export { listAsanaProjects, listAsanaTasks } from "./asana-explore.js";
|
|
6
|
-
export { asanaTaskService, showAsanaTask } from "./asana-task.js";
|
|
6
|
+
export { addAsanaComment, asanaTaskService, editAsanaComment, editAsanaTask, showAsanaTask } from "./asana-task.js";
|
|
7
7
|
export { asanaChanges, asanaConflicts, asanaDocument, asanaSnapshot, parseAsanaMarkdown, renderAsanaMarkdown } from "./asana-sync.js";
|
|
8
8
|
export type { AsanaChange, AsanaDocument, AsanaEntity } from "./asana-sync.js";
|
|
9
9
|
export const asanaProvider = Object.freeze({
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kamilio/wire",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.23",
|
|
4
4
|
"description": "Attach Notion, Google Docs, Slack, Gmail, Asana, ChatGPT, and Zoom resources as local Markdown you can sync.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"markdown",
|
|
@@ -54,17 +54,19 @@
|
|
|
54
54
|
"src"
|
|
55
55
|
],
|
|
56
56
|
"bundledDependencies": [
|
|
57
|
+
"@xmldom/xmldom",
|
|
57
58
|
"ajv",
|
|
58
59
|
"commander",
|
|
59
60
|
"fast-deep-equal",
|
|
60
61
|
"fast-string-truncated-width",
|
|
61
62
|
"fast-string-width",
|
|
62
|
-
"fast-wrap-ansi",
|
|
63
63
|
"fast-uri",
|
|
64
|
+
"fast-wrap-ansi",
|
|
64
65
|
"ignore",
|
|
65
66
|
"jose",
|
|
66
|
-
"jsonc-parser",
|
|
67
67
|
"json-schema-traverse",
|
|
68
|
+
"jsonc-parser",
|
|
69
|
+
"marked",
|
|
68
70
|
"pct-encode",
|
|
69
71
|
"provider-asana",
|
|
70
72
|
"provider-chatgpt",
|
|
@@ -87,13 +89,14 @@
|
|
|
87
89
|
"scripts": {
|
|
88
90
|
"build": "tsc -p tsconfig.json",
|
|
89
91
|
"dev-link": "npm link",
|
|
90
|
-
"prepack": "cp ../../README.md README.md && rm -rf node_modules && mkdir -p node_modules && for package in provider-asana provider-chatgpt provider-gmail provider-google-docs provider-notion provider-slack provider-zoom wire-core; do cp -R ../$package node_modules/$package; done && for package in ajv commander fast-deep-equal fast-string-truncated-width fast-string-width fast-wrap-ansi fast-uri ignore jose jsonc-parser json-schema-traverse pct-encode require-from-string sisteransi smol-toml tiny-stdio-mcp-server toolcraft toolcraft-schema uri-template uri-template-lite yaml; do cp -R ../../node_modules/$package node_modules/$package; done",
|
|
92
|
+
"prepack": "cp ../../README.md README.md && rm -rf node_modules && mkdir -p node_modules/@xmldom && for package in provider-asana provider-chatgpt provider-gmail provider-google-docs provider-notion provider-slack provider-zoom wire-core; do cp -R ../$package node_modules/$package; done && for package in @xmldom/xmldom marked ajv commander fast-deep-equal fast-string-truncated-width fast-string-width fast-wrap-ansi fast-uri ignore jose jsonc-parser json-schema-traverse pct-encode require-from-string sisteransi smol-toml tiny-stdio-mcp-server toolcraft toolcraft-schema uri-template uri-template-lite yaml; do cp -R ../../node_modules/$package node_modules/$package; done",
|
|
91
93
|
"postpack": "rm -rf node_modules README.md",
|
|
92
94
|
"test": "node --test --test-concurrency=1 test/**/*.test.mjs",
|
|
93
95
|
"typecheck": "tsc -p tsconfig.json --noEmit",
|
|
94
96
|
"check": "npm run typecheck && npm run build && npm test"
|
|
95
97
|
},
|
|
96
98
|
"dependencies": {
|
|
99
|
+
"@xmldom/xmldom": "^0.9.12",
|
|
97
100
|
"ajv": "^8.20.0",
|
|
98
101
|
"commander": "^14.0.3",
|
|
99
102
|
"fast-deep-equal": "^3.1.3",
|
|
@@ -105,6 +108,7 @@
|
|
|
105
108
|
"jose": "^6.1.2",
|
|
106
109
|
"json-schema-traverse": "^1.0.0",
|
|
107
110
|
"jsonc-parser": "^3.3.1",
|
|
111
|
+
"marked": "^17.0.6",
|
|
108
112
|
"pct-encode": "^1.0.3",
|
|
109
113
|
"provider-asana": "0.1.0",
|
|
110
114
|
"provider-chatgpt": "0.1.0",
|
|
@@ -132,17 +136,19 @@
|
|
|
132
136
|
"node": ">=20"
|
|
133
137
|
},
|
|
134
138
|
"bundleDependencies": [
|
|
139
|
+
"@xmldom/xmldom",
|
|
135
140
|
"ajv",
|
|
136
141
|
"commander",
|
|
137
142
|
"fast-deep-equal",
|
|
138
143
|
"fast-string-truncated-width",
|
|
139
144
|
"fast-string-width",
|
|
140
|
-
"fast-wrap-ansi",
|
|
141
145
|
"fast-uri",
|
|
146
|
+
"fast-wrap-ansi",
|
|
142
147
|
"ignore",
|
|
143
148
|
"jose",
|
|
144
|
-
"jsonc-parser",
|
|
145
149
|
"json-schema-traverse",
|
|
150
|
+
"jsonc-parser",
|
|
151
|
+
"marked",
|
|
146
152
|
"pct-encode",
|
|
147
153
|
"provider-asana",
|
|
148
154
|
"provider-chatgpt",
|
package/src/adapters/root.ts
CHANGED
|
@@ -420,6 +420,11 @@ type AsanaExplorer = {
|
|
|
420
420
|
projects(): ReturnType<typeof listAsanaProjects>;
|
|
421
421
|
tasks(project: string): ReturnType<typeof listAsanaTasks>;
|
|
422
422
|
show(task: string): Promise<FetchedDocument>;
|
|
423
|
+
writes?: {
|
|
424
|
+
edit(task: string, fields: JsonObject): Promise<JsonObject>;
|
|
425
|
+
comment(task: string, body: string): Promise<JsonObject>;
|
|
426
|
+
editComment(comment: string, body: string): Promise<JsonObject>;
|
|
427
|
+
};
|
|
423
428
|
};
|
|
424
429
|
|
|
425
430
|
export function createRoot(wire: Wire, currentDirectory: string, auth?: Auth, readInput?: TextInputReader, options: WireRootOptions = { allowPaste: true }, sendSlack?: (destination: string, markdown: string) => Promise<SlackSentMessage>, lookupSlack?: (query: string) => Promise<readonly JsonObject[]>, editSlack?: (url: string, markdown: string) => Promise<SlackSentMessage>, lookupNotion?: (query: string) => Promise<readonly JsonObject[]>, asana?: AsanaExplorer): WireRoot {
|
|
@@ -456,7 +461,8 @@ export function createRoot(wire: Wire, currentDirectory: string, auth?: Auth, re
|
|
|
456
461
|
const authCommand = (service: (typeof authServices)[number]) => {
|
|
457
462
|
const title = serviceTitle(service);
|
|
458
463
|
const group = authGroup(service, `Manage ${title} login.`, "Capture cookies once; normal commands reuse saved cookies.", auth!, readInput, options);
|
|
459
|
-
|
|
464
|
+
const writes = asana?.writes;
|
|
465
|
+
if (service === "asana" && asana !== undefined) return defineGroup({ ...group, description: "Browse Asana projects, edit tasks and comments, and manage login.", children: [...group.children,
|
|
460
466
|
defineGroup({ name: "projects", description: "Browse projects.", children: [defineCommand({
|
|
461
467
|
name: "list", description: "List active projects by workspace and team.", params: S.Object({}),
|
|
462
468
|
handler: () => userFacing(() => asana.projects()),
|
|
@@ -469,16 +475,48 @@ export function createRoot(wire: Wire, currentDirectory: string, auth?: Auth, re
|
|
|
469
475
|
})),
|
|
470
476
|
].join("\n")).join("\n\n") || "No workspaces"),
|
|
471
477
|
})] }),
|
|
472
|
-
defineGroup({ name: "tasks", description: "Browse tasks.", children: [defineCommand({
|
|
478
|
+
defineGroup({ name: "tasks", description: "Browse and edit tasks.", children: [defineCommand({
|
|
473
479
|
name: "list", description: "List tasks in a project, with completion status and task IDs.", positional: ["project"],
|
|
474
480
|
params: S.Object({ project: S.String({ description: "Asana project ID." }) }),
|
|
475
481
|
handler: ({ params }) => userFacing(() => asana.tasks(params.project)),
|
|
476
482
|
render: render<Awaited<ReturnType<typeof listAsanaTasks>>>((tasks) => tasks.map((task) => `- [${task.completed ? "x" : " "}] ${lineText(task.name)} ${task.gid}`).join("\n") || "No tasks"),
|
|
477
483
|
}), defineCommand({
|
|
478
|
-
name: "show", description: "Show a task's
|
|
484
|
+
name: "show", description: "Show a task's properties, custom field IDs, Markdown description, comments, and activity.", positional: ["task"],
|
|
479
485
|
params: S.Object({ task: S.String({ description: "Asana task ID." }) }),
|
|
480
486
|
handler: ({ params }) => userFacing(() => asana.show(params.task)), render: wirePresentation.view,
|
|
481
|
-
})
|
|
487
|
+
}), ...(writes ? [defineCommand({
|
|
488
|
+
name: "edit", description: "Update task properties. Use --fields with a JSON object for other writable Asana properties, including custom_fields keyed by ID.", positional: ["task"],
|
|
489
|
+
params: S.Object({
|
|
490
|
+
task: S.String({ description: "Asana task ID." }),
|
|
491
|
+
title: S.Optional(S.String({ description: "New task name." })),
|
|
492
|
+
body: S.Optional(S.String({ description: "New description in Markdown." })),
|
|
493
|
+
assignee: S.Optional(S.String({ description: "Email, user ID, or me." })),
|
|
494
|
+
due: S.Optional(S.String({ description: "Due date (YYYY-MM-DD)." })),
|
|
495
|
+
fields: S.Optional(S.Json()),
|
|
496
|
+
}),
|
|
497
|
+
handler: ({ params: { task, fields, title, body, assignee, due } }) => userFacing(async () => {
|
|
498
|
+
if (fields !== undefined && (!fields || typeof fields !== "object" || Array.isArray(fields))) throw new UserError("--fields requires a JSON object.");
|
|
499
|
+
const changes = { ...fields };
|
|
500
|
+
for (const [key, value] of Object.entries({ name: title, notes: body, assignee, due_on: due })) {
|
|
501
|
+
if (value === undefined) continue;
|
|
502
|
+
if (Object.hasOwn(changes, key)) throw new UserError(`Task field specified twice: ${key}.`);
|
|
503
|
+
changes[key] = value;
|
|
504
|
+
}
|
|
505
|
+
return writes.edit(task, changes);
|
|
506
|
+
}),
|
|
507
|
+
render: render<JsonObject>((task) => `Updated task ${task["gid"]}: ${task["permalink_url"]}`),
|
|
508
|
+
}), defineCommand({
|
|
509
|
+
name: "comment", description: "Add a Markdown comment to a task.", positional: ["task"],
|
|
510
|
+
params: S.Object({ task: S.String({ description: "Asana task ID." }), body: S.String({ description: "Comment in Markdown." }) }),
|
|
511
|
+
handler: ({ params }) => userFacing(() => writes.comment(params.task, params.body)),
|
|
512
|
+
render: render<JsonObject>((comment) => `Added comment ${comment["gid"]}`),
|
|
513
|
+
})] : [])] }),
|
|
514
|
+
...(writes ? [defineGroup({ name: "comments", description: "Edit Asana comments.", children: [defineCommand({
|
|
515
|
+
name: "edit", description: "Replace an editable comment using its story ID from tasks show.", positional: ["comment"],
|
|
516
|
+
params: S.Object({ comment: S.String({ description: "Comment ID from tasks show." }), body: S.String({ description: "Replacement comment in Markdown." }) }),
|
|
517
|
+
handler: ({ params }) => userFacing(() => writes.editComment(params.comment, params.body)),
|
|
518
|
+
render: render<JsonObject>((comment) => `Updated comment ${comment["gid"]}`),
|
|
519
|
+
})] })] : []),
|
|
482
520
|
] });
|
|
483
521
|
const lookup = service === "slack" ? lookupSlack : service === "notion" ? lookupNotion : undefined;
|
|
484
522
|
const users = lookup === undefined ? [] : [defineGroup({ name: "users", description: "Find people by email or name.", children: [defineCommand({
|
package/src/cli.ts
CHANGED
|
@@ -296,7 +296,7 @@ function renderRemovedCommand(argv: readonly string[]): boolean {
|
|
|
296
296
|
function renderUnknownAuthCommand(argv: readonly string[]): boolean {
|
|
297
297
|
if (hasRootSeparator(argv)) return false;
|
|
298
298
|
const words = positionalWords(argv);
|
|
299
|
-
if (words === null || words.length < 2 || !authServices.has(words[0]!) || authCommands.has(words[1]!) || words[0] === "asana" && (words[1] === "projects" || words[1] === "tasks") || (words[0] === "slack" || words[0] === "notion") && words[1] === "users" || words[0] === "slack" && (words[1] === "send" || words[1] === "edit" || slackResourceCommands.has(words[1]!))) return false;
|
|
299
|
+
if (words === null || words.length < 2 || !authServices.has(words[0]!) || authCommands.has(words[1]!) || words[0] === "asana" && (words[1] === "projects" || words[1] === "tasks" || words[1] === "comments") || (words[0] === "slack" || words[0] === "notion") && words[1] === "users" || words[0] === "slack" && (words[1] === "send" || words[1] === "edit" || slackResourceCommands.has(words[1]!))) return false;
|
|
300
300
|
renderCliError(argv, `Unknown command: ${words[1]}`, `wire ${words[0]} --help`, `Unknown command: ${cliValue(words[1]!)}`);
|
|
301
301
|
return true;
|
|
302
302
|
}
|
package/src/executable.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { existsSync, readFileSync, statSync } from "node:fs";
|
|
|
2
2
|
import { mkdir, writeFile } from "node:fs/promises";
|
|
3
3
|
import { dirname, isAbsolute, join, resolve } from "node:path";
|
|
4
4
|
|
|
5
|
-
import { listAsanaProjects, listAsanaTasks, showAsanaTask } from "provider-asana";
|
|
5
|
+
import { addAsanaComment, editAsanaComment, editAsanaTask, listAsanaProjects, listAsanaTasks, showAsanaTask } from "provider-asana";
|
|
6
6
|
import { sendSlackMessage, editSlackMessage, lookupSlackUsers } from "provider-slack";
|
|
7
7
|
|
|
8
8
|
import { lookupNotionUsers } from "provider-notion";
|
|
@@ -132,5 +132,6 @@ export function createExecutableRoot(environment: NodeEnvironment, currentDirect
|
|
|
132
132
|
const wire = withWireHooks(configuredWire, { currentDirectory, home, environment: configuredEnvironment() });
|
|
133
133
|
return createRoot(wire, currentDirectory, auth, readStandardInput, options, (destination, markdown) => sendSlackMessage(runtime, destination, markdown), (query) => lookupSlackUsers(runtime, query), (url, markdown) => editSlackMessage(runtime, url, markdown), (query) => lookupNotionUsers(runtime, query), {
|
|
134
134
|
projects: () => listAsanaProjects(runtime), tasks: (project) => listAsanaTasks(runtime, project), show: (task) => showAsanaTask(runtime, task),
|
|
135
|
+
writes: { edit: (task, fields) => editAsanaTask(runtime, task, fields), comment: (task, body) => addAsanaComment(runtime, task, body), editComment: (comment, body) => editAsanaComment(runtime, comment, body) },
|
|
135
136
|
});
|
|
136
137
|
}
|