@snagset/server 0.1.55 → 0.1.57

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.
Files changed (98) hide show
  1. package/dist/app.js +4 -0
  2. package/dist/app.js.map +1 -1
  3. package/dist/config.generated.js +2 -1
  4. package/dist/config.generated.js.map +1 -1
  5. package/dist/db/migrations/0019_trello_provider.no-txn.sql +11 -0
  6. package/dist/integrations/inbound.js +2 -0
  7. package/dist/integrations/inbound.js.map +1 -1
  8. package/dist/integrations/jira.js +6 -2
  9. package/dist/integrations/jira.js.map +1 -1
  10. package/dist/integrations/linear.js +6 -2
  11. package/dist/integrations/linear.js.map +1 -1
  12. package/dist/integrations/outbox.js +27 -5
  13. package/dist/integrations/outbox.js.map +1 -1
  14. package/dist/integrations/store.js +2 -2
  15. package/dist/integrations/store.js.map +1 -1
  16. package/dist/integrations/trello.js +173 -0
  17. package/dist/integrations/trello.js.map +1 -0
  18. package/dist/jobs/set.js +2 -0
  19. package/dist/jobs/set.js.map +1 -1
  20. package/dist/routes/integrations.js +238 -15
  21. package/dist/routes/integrations.js.map +1 -1
  22. package/dist/routes/threads.js.map +1 -1
  23. package/package.json +1 -1
  24. package/static/dashboard/assets/{CompositeItem-CvulL3yx.js → CompositeItem-XBuzWv1L.js} +1 -1
  25. package/static/dashboard/assets/{CompositeList-Cc2N74pm.js → CompositeList-C2IVT2Po.js} +1 -1
  26. package/static/dashboard/assets/{ConfirmDialog-U7sGR-7r.js → ConfirmDialog-B9o4voIS.js} +1 -1
  27. package/static/dashboard/assets/{CopyButton-BPRG72bK.js → CopyButton-DLU4a9od.js} +1 -1
  28. package/static/dashboard/assets/{FieldItemContext-BB4olvUX.js → FieldItemContext-CM5jeOco.js} +1 -1
  29. package/static/dashboard/assets/{InstallTag-07IMzmgd.js → InstallTag-CZO85i-P.js} +1 -1
  30. package/static/dashboard/assets/{InstanceRows-2HV0g2Tc.js → InstanceRows-D-tveODw.js} +1 -1
  31. package/static/dashboard/assets/{McpTokens-j7R5vQdJ.js → McpTokens-DikOatOF.js} +1 -1
  32. package/static/dashboard/assets/{Picker-DWjVDWI6.js → Picker-lokRYiMC.js} +2 -2
  33. package/static/dashboard/assets/{SaveState-BhDPRdEB.js → SaveState-e4RnpJbD.js} +1 -1
  34. package/static/dashboard/assets/{_app-CmSSR7Fr.js → _app-6KTAiiJs.js} +1 -1
  35. package/static/dashboard/assets/{_app-CsF903Bg.js → _app-Dqyx0uzh.js} +1 -1
  36. package/static/dashboard/assets/{activity-CiElrW9b.js → activity-D87uMIpc.js} +1 -1
  37. package/static/dashboard/assets/{arrow-left-BpbzTF1L.js → arrow-left-Txus48to.js} +1 -1
  38. package/static/dashboard/assets/{avatar-B1TDu8wQ.js → avatar-d0V38Rww.js} +1 -1
  39. package/static/dashboard/assets/{badge-DNL0s8ND.js → badge-BpJT5EUT.js} +1 -1
  40. package/static/dashboard/assets/{card-BV6fjgTi.js → card-BqU7TCLe.js} +1 -1
  41. package/static/dashboard/assets/{check-nWqm4QA9.js → check-T8owKS6W.js} +1 -1
  42. package/static/dashboard/assets/{chevron-down-B0SxNOjK.js → chevron-down-CPxjYKx7.js} +1 -1
  43. package/static/dashboard/assets/{chevron-right-5IvSSfyx.js → chevron-right-BOLW380q.js} +1 -1
  44. package/static/dashboard/assets/{copy-BlkC45lz.js → copy-D7ySfk8w.js} +1 -1
  45. package/static/dashboard/assets/{createBaseUIEventDetails-DJQs5QD1.js → createBaseUIEventDetails-D5nICp6F.js} +1 -1
  46. package/static/dashboard/assets/{dialog-wNx4TYmI.js → dialog-C8j9bKc9.js} +1 -1
  47. package/static/dashboard/assets/{dropdown-menu-Dg6I8B9T.js → dropdown-menu-7_qYsjof.js} +1 -1
  48. package/static/dashboard/assets/{forgot-BskfFbWy.js → forgot-L_4h7Uc5.js} +1 -1
  49. package/static/dashboard/assets/{getPseudoElementBounds-BI6SgJKV.js → getPseudoElementBounds-r9s2Gh_c.js} +1 -1
  50. package/static/dashboard/assets/{image-off-CmXQl4Bm.js → image-off-DEk2KdgQ.js} +1 -1
  51. package/static/dashboard/assets/{index-DJIyUCPa.js → index-DBw3b5Rd.js} +9 -9
  52. package/static/dashboard/assets/{inertValue-DFM3yqxg.js → inertValue-DPJM1mgv.js} +1 -1
  53. package/static/dashboard/assets/{invite-Gb1SSWEm.js → invite-BQzST24s.js} +1 -1
  54. package/static/dashboard/assets/{label-BO35zXgP.js → label-BqqDq1Bf.js} +1 -1
  55. package/static/dashboard/assets/{layout-grid-DHSlCLw7.js → layout-grid-BaI-ZaQt.js} +1 -1
  56. package/static/dashboard/assets/me-BuXPSKyo.js +1 -0
  57. package/static/dashboard/assets/{parts-Cf55Yb70.js → parts-Dh3j93KT.js} +1 -1
  58. package/static/dashboard/assets/{plus-AlvHtj_r.js → plus-DLkZ3d4a.js} +1 -1
  59. package/static/dashboard/assets/{reset-VLjsnDUf.js → reset-25I5KwzQ.js} +1 -1
  60. package/static/dashboard/assets/{s._site-BOIQF8cS.js → s._site-AdxvCMDp.js} +1 -1
  61. package/static/dashboard/assets/s._site.comments-Bn8q0GfW.js +49 -0
  62. package/static/dashboard/assets/{s._site.reviewers-C2y2wYcP.js → s._site.reviewers-DhplEadn.js} +1 -1
  63. package/static/dashboard/assets/{s._site.settings-Cp8YeA4h.js → s._site.settings-DkxPhD29.js} +1 -1
  64. package/static/dashboard/assets/{setup-DZSbxR5u.js → setup-BT2ymvDA.js} +1 -1
  65. package/static/dashboard/assets/{sign-in-BP-OTd-h.js → sign-in--bQ1djiP.js} +1 -1
  66. package/static/dashboard/assets/{sign-up-Jei-X8L6.js → sign-up-Tosf460o.js} +1 -1
  67. package/static/dashboard/assets/{sites-nxU5wRJD.js → sites-Bk7faXQx.js} +1 -1
  68. package/static/dashboard/assets/{studio-BXjjp00e.js → studio-BXY-BYUr.js} +1 -1
  69. package/static/dashboard/assets/studio-C5_LeEu7.js +1 -0
  70. package/static/dashboard/assets/{studio.index-5Z2JWyir.js → studio.index-iCwNlbml.js} +1 -1
  71. package/static/dashboard/assets/studio.integrations-25ah_0to.js +16 -0
  72. package/static/dashboard/assets/{studio.members-UOCj4scg.js → studio.members-BnuODZjt.js} +1 -1
  73. package/static/dashboard/assets/{studio.plan-CXzTImV1.js → studio.plan-B2BnZVlI.js} +1 -1
  74. package/static/dashboard/assets/{sun-DhMBVtvb.js → sun-DZ77z3mK.js} +1 -1
  75. package/static/dashboard/assets/{switch-BbV1tcPM.js → switch-DNodWtiG.js} +1 -1
  76. package/static/dashboard/assets/{table-BlJV8zDx.js → table-_kCW8sw7.js} +1 -1
  77. package/static/dashboard/assets/{useAriaLabelledBy-DfnIJQvt.js → useAriaLabelledBy-CIrxFX1m.js} +1 -1
  78. package/static/dashboard/assets/{useBaseQuery-ic0hLoWO.js → useBaseQuery-n1C4QVXL.js} +1 -1
  79. package/static/dashboard/assets/{useCompositeItem-Dj-Nx-92.js → useCompositeItem-YAQuEkY3.js} +1 -1
  80. package/static/dashboard/assets/useQuery-rfvcXYjq.js +1 -0
  81. package/static/dashboard/assets/useRender-Rc2aDa9D.js +1 -0
  82. package/static/dashboard/assets/{useScrollLock-tzg3KUOw.js → useScrollLock-BPMFXP7l.js} +1 -1
  83. package/static/dashboard/assets/{useValueChanged-S18DT6ky.js → useValueChanged-w_Y86K5W.js} +1 -1
  84. package/static/dashboard/assets/{users-CklOnVh9.js → users-ZI_E8YXB.js} +1 -1
  85. package/static/dashboard/assets/{welcome-DmIcYw0Y.js → welcome-CBYYDde-.js} +1 -1
  86. package/static/dashboard/assets/{widget-signin-B3lImWqb.js → widget-signin-Of2xQvu-.js} +1 -1
  87. package/static/dashboard/assets/{you-CIO1vIEc.js → you-ey1-XO69.js} +1 -1
  88. package/static/dashboard/assets/{zod-C59-1wE1.js → zod-D8TwVQUn.js} +1 -1
  89. package/static/dashboard/index.html +1 -1
  90. package/static/widget/build.json +2 -2
  91. package/static/widget/snag.js +1 -1
  92. package/static/widget/snag.runtime.js +1 -1
  93. package/static/dashboard/assets/me-Bu3DC102.js +0 -1
  94. package/static/dashboard/assets/s._site.comments-CTk77ILo.js +0 -49
  95. package/static/dashboard/assets/studio-C1Um7zxi.js +0 -1
  96. package/static/dashboard/assets/studio.integrations-BjFXv6iz.js +0 -16
  97. package/static/dashboard/assets/useQuery-qBadQDJJ.js +0 -1
  98. package/static/dashboard/assets/useRender-TrgqqhB3.js +0 -1
@@ -0,0 +1,173 @@
1
+ import { createHmac, timingSafeEqual } from "node:crypto";
2
+ export class TrelloError extends Error {
3
+ status;
4
+ retryable;
5
+ constructor(status, message) {
6
+ super(message);
7
+ this.status = status;
8
+ this.retryable = status >= 500 || status === 429;
9
+ }
10
+ }
11
+ export function trelloClient(opts) {
12
+ const base = (opts.apiBase ?? "https://api.trello.com/1").replace(/\/+$/, "");
13
+ const f = opts.fetch ?? globalThis.fetch;
14
+ const q = (s) => s.replace(/["\\]/g, "");
15
+ const auth = `OAuth oauth_consumer_key="${q(opts.apiKey)}", oauth_token="${q(opts.token)}"`;
16
+ async function call(method, path, body) {
17
+ let res;
18
+ try {
19
+ res = await f(`${base}${path}`, {
20
+ method,
21
+ headers: { authorization: auth, accept: "application/json", "user-agent": "snagset", ...(body ? { "content-type": "application/json" } : {}) },
22
+ ...(body ? { body: JSON.stringify(body) } : {}),
23
+ });
24
+ }
25
+ catch (e) {
26
+ throw new TrelloError(0, `could not reach Trello: ${e instanceof Error ? e.message : String(e)}`);
27
+ }
28
+ const text = await res.text().catch(() => "");
29
+ if (res.status === 401)
30
+ throw new TrelloError(401, "the API key and token were refused (revoked, expired, or from another key)");
31
+ if (res.status === 403)
32
+ throw new TrelloError(403, "the token is not allowed to do that on this board (it needs read and write)");
33
+ if (res.status === 404)
34
+ throw new TrelloError(404, "the board, list or card was not found, or the token cannot see it");
35
+ if (!res.ok)
36
+ throw new TrelloError(res.status, `Trello answered ${res.status}${text ? `: ${text.slice(0, 200)}` : ""}`);
37
+ if (!text)
38
+ return undefined;
39
+ try {
40
+ return JSON.parse(text);
41
+ }
42
+ catch {
43
+ throw new TrelloError(502, "Trello answered with something that is not JSON");
44
+ }
45
+ }
46
+ const fail = (e) => ({ ok: false, detail: e instanceof Error ? e.message : String(e) });
47
+ return {
48
+ /**
49
+ * What the connect dialog offers. With no board: who the token is and the
50
+ * open boards it can see. With a board: that board's open lists.
51
+ */
52
+ async discover(boardId) {
53
+ try {
54
+ const me = await call("GET", "/members/me?fields=fullName,username");
55
+ const who = me.fullName || me.username || "Trello";
56
+ if (boardId) {
57
+ const lists = await call("GET", `/boards/${encodeURIComponent(boardId)}/lists?filter=open&fields=name`);
58
+ return { ok: true, who, options: lists.map((l) => ({ value: l.id, label: l.name })) };
59
+ }
60
+ const boards = await call("GET", "/members/me/boards?filter=open&fields=name");
61
+ return { ok: true, who, options: boards.map((b) => ({ value: b.id, label: b.name })) };
62
+ }
63
+ catch (e) {
64
+ return fail(e);
65
+ }
66
+ },
67
+ /** The board and its three lists, checked: each list open, on that board, and the three distinct. */
68
+ async probe(boardId, lists) {
69
+ try {
70
+ const me = await call("GET", "/members/me?fields=fullName,username");
71
+ const board = await call("GET", `/boards/${encodeURIComponent(boardId)}?fields=name,url`);
72
+ const open = await call("GET", `/boards/${encodeURIComponent(boardId)}/lists?filter=open&fields=name`);
73
+ const ids = [lists.open, lists.progress, lists.resolved];
74
+ if (new Set(ids).size !== 3)
75
+ return { ok: false, detail: "pick three different lists: one each for open, in progress and resolved" };
76
+ const name = (id) => open.find((l) => l.id === id)?.name;
77
+ const missing = ids.find((id) => !name(id));
78
+ if (missing)
79
+ return { ok: false, detail: `the list ${missing} is not an open list on the board ${board.name}` };
80
+ return {
81
+ ok: true,
82
+ board: { id: board.id, name: board.name, url: board.url },
83
+ names: { open: name(lists.open), progress: name(lists.progress), resolved: name(lists.resolved) },
84
+ who: me.fullName || me.username || "Trello",
85
+ };
86
+ }
87
+ catch (e) {
88
+ return fail(e);
89
+ }
90
+ },
91
+ /**
92
+ * A new board with exactly the three lists Snagset needs, To do, Doing and
93
+ * Done, so the studio picks nothing (0.1.57). Trello's default lists are
94
+ * left out; the board is private to the token's member.
95
+ */
96
+ async createBoard(name) {
97
+ try {
98
+ const board = await call("POST", "/boards", { name: name.slice(0, 16384), defaultLists: false, prefs_permissionLevel: "private" });
99
+ const lists = [];
100
+ try {
101
+ for (const listName of ["To do", "Doing", "Done"]) {
102
+ const l = await call("POST", "/lists", { name: listName, idBoard: board.id, pos: "bottom" });
103
+ lists.push({ id: l.id, name: l.name });
104
+ }
105
+ }
106
+ catch (e) {
107
+ // A half-made board is no use to anybody: take it down again.
108
+ await call("DELETE", `/boards/${encodeURIComponent(board.id)}`).catch(() => { });
109
+ throw e;
110
+ }
111
+ return { ok: true, board: { id: board.id, name: board.name }, lists };
112
+ }
113
+ catch (e) {
114
+ return fail(e);
115
+ }
116
+ },
117
+ async createCard(input) {
118
+ const made = await call("POST", "/cards", {
119
+ idList: input.listId,
120
+ name: input.name.slice(0, 16384),
121
+ desc: input.desc.slice(0, 16384),
122
+ pos: "top",
123
+ });
124
+ return { id: made.id, url: made.shortUrl ?? made.url ?? "" };
125
+ },
126
+ async moveCard(cardId, listId) {
127
+ await call("PUT", `/cards/${encodeURIComponent(cardId)}`, { idList: listId });
128
+ },
129
+ /**
130
+ * The way back: a webhook on the board, owned by this token. Trello
131
+ * calls the address with HEAD first and refuses to register if it does
132
+ * not answer 200. One that already exists for the same address, board
133
+ * and token is found and reused rather than refused.
134
+ */
135
+ async registerWebhook(boardId, callbackURL) {
136
+ try {
137
+ const made = await call("POST", "/webhooks", { callbackURL, idModel: boardId, description: "Snagset" });
138
+ return { id: made.id };
139
+ }
140
+ catch (e) {
141
+ if (!(e instanceof TrelloError) || e.status !== 400 || !/already exists/i.test(e.message))
142
+ throw e;
143
+ const mine = await call("GET", `/tokens/${encodeURIComponent(opts.token)}/webhooks`);
144
+ const found = mine.find((w) => w.idModel === boardId && w.callbackURL === callbackURL);
145
+ if (!found)
146
+ throw e;
147
+ return { id: found.id };
148
+ }
149
+ },
150
+ async removeWebhook(id) {
151
+ await call("DELETE", `/webhooks/${encodeURIComponent(id)}`);
152
+ },
153
+ };
154
+ }
155
+ /**
156
+ * `X-Trello-Webhook` is the base64 HMAC-SHA1 of the raw body followed by the
157
+ * callback URL, keyed with the Power-Up's secret.
158
+ */
159
+ export function verifyTrelloSignature(raw, callbackURL, header, secret) {
160
+ if (!header)
161
+ return false;
162
+ const given = Buffer.from(header.trim(), "base64");
163
+ const want = createHmac("sha1", secret).update(raw + callbackURL, "utf8").digest();
164
+ return given.length === want.length && timingSafeEqual(given, want);
165
+ }
166
+ /** Our status → the list a card belongs in; a list → our status, or null for any other list. */
167
+ export function trelloListFor(status, lists) {
168
+ return status === "resolved" ? lists.resolved : status === "progress" || status === "review" ? lists.progress : lists.open;
169
+ }
170
+ export function statusForTrelloList(listId, lists) {
171
+ return listId === lists.resolved ? "resolved" : listId === lists.progress ? "progress" : listId === lists.open ? "open" : null;
172
+ }
173
+ //# sourceMappingURL=trello.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"trello.js","sourceRoot":"","sources":["../../src/integrations/trello.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAiC1D,MAAM,OAAO,WAAY,SAAQ,KAAK;IAC3B,MAAM,CAAS;IACf,SAAS,CAAU;IAC5B,YAAY,MAAc,EAAE,OAAe;QACzC,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,SAAS,GAAG,MAAM,IAAI,GAAG,IAAI,MAAM,KAAK,GAAG,CAAC;IACnD,CAAC;CACF;AAED,MAAM,UAAU,YAAY,CAAC,IAAyB;IACpD,MAAM,IAAI,GAAG,CAAC,IAAI,CAAC,OAAO,IAAI,0BAA0B,CAAC,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;IAC9E,MAAM,CAAC,GAAG,IAAI,CAAC,KAAK,IAAI,UA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AAK,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,MAAM,KAAK,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,MAAM,KAAK,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC;AACjI,CAAC"}
package/dist/jobs/set.js CHANGED
@@ -12,12 +12,14 @@ export function jobSet(d) {
12
12
  const githubApiBase = d.githubApiBase ?? d.cfg.get("SNAGSET_GITHUB_API_BASE");
13
13
  const linearApiBase = d.linearApiBase ?? d.cfg.get("SNAGSET_LINEAR_API_BASE");
14
14
  const slackApiBase = d.slackApiBase ?? d.cfg.get("SNAGSET_SLACK_API_BASE");
15
+ const trelloApiBase = d.trelloApiBase ?? d.cfg.get("SNAGSET_TRELLO_API_BASE");
15
16
  const push = {
16
17
  keys: d.keys,
17
18
  baseUrl: address,
18
19
  ...(githubApiBase ? { githubApiBase } : {}),
19
20
  ...(linearApiBase ? { linearApiBase } : {}),
20
21
  ...(slackApiBase ? { slackApiBase } : {}),
22
+ ...(trelloApiBase ? { trelloApiBase } : {}),
21
23
  jiraPrivate: d.cfg.bool("SNAGSET_JIRA_PRIVATE_ADDRESSES"),
22
24
  };
23
25
  // How the owner hears about comments. The registry validated it and
@@ -1 +1 @@
1
- {"version":3,"file":"set.js","sourceRoot":"","sources":["../../src/jobs/set.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACvD,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,YAAY,EAAmB,MAAM,mBAAmB,CAAC;AAClE,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC7C,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,cAAc,EAAiB,MAAM,2BAA2B,CAAC;AAC1E,OAAO,EA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earClient, statusForLinearState, verifyLinearSignature } from "../integrations/linear.js";
6
6
  import { jiraClient, statusForJiraCategory, verifyJiraSignature } from "../integrations/jira.js";
7
7
  import { slackClient, slackManifest } from "../integrations/slack.js";
8
+ import { statusForTrelloList, trelloClient, verifyTrelloSignature } from "../integrations/trello.js";
8
9
  import { LimitReached, planLimitReached } from "../plan.js";
9
10
  import { getIntegration, isTracker, listIntegrations, markDelivered, replaceCredentials, markRefused, markIntegration, mintWebhookSecret, putIntegration, removeIntegration, trackerSecrets, REF_KIND, } from "../integrations/store.js";
10
11
  import { applyGitHubIssueEvent, applyIssueState, verifyGitHubSignature } from "../integrations/inbound.js";
@@ -17,20 +18,24 @@ function fail(c, status, code, message, details) {
17
18
  return c.json({ error: { code, message, ...(details ? { details } : {}), requestId: c.get("requestId") } }, status);
18
19
  }
19
20
  const UUID = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
20
- const NAME = { github: "GitHub", linear: "Linear", jira: "Jira", slack: "Slack" };
21
- /** What the card says when a delivery arrived but its signature did not match: the fix, in words. */
21
+ /** How long "Create … issue" waits on its own row before answering that it is queued. */
22
+ const CREATE_WAIT_MS = 10_000;
23
+ const NAME = { github: "GitHub", linear: "Linear", jira: "Jira", trello: "Trello", slack: "Slack" };
22
24
  /** Access checks a studio may make in a minute. */
23
25
  const DISCOVER_PER_MINUTE = 20;
26
+ /** What the card says when a delivery arrived but its signature did not match: the fix, in words. */
24
27
  const SIGNATURE_REFUSED = {
25
28
  github: "GitHub's delivery was signed with a different secret. Make a new secret here and give it to the repository's webhook.",
26
29
  linear: "Linear's delivery was signed with a different secret. Copy the signing secret from Linear's webhook and paste it here.",
27
30
  jira: "Jira's delivery was signed with a different secret. Give Jira's webhook the secret Snagset shows, or make a new one here.",
31
+ trello: "Trello's delivery was signed with a different secret. Copy the secret from your Power-Up's API key page in Trello and paste it here.",
28
32
  };
29
33
  export function integrationRoutes(deps) {
30
34
  const { sql, keys, projects } = deps;
31
35
  const app = new Hono();
32
36
  const webhookUrl = async (provider) => `${(await deps.baseUrl()).replace(/\/+$/, "")}/api/v1/integrations/${provider}/inbound`;
33
37
  const ghOpts = () => ({ ...(deps.push.githubApiBase ? { apiBase: deps.push.githubApiBase } : {}), ...(deps.push.fetch ? { fetch: deps.push.fetch } : {}) });
38
+ const trOpts = () => ({ ...(deps.push.trelloApiBase ? { apiBase: deps.push.trelloApiBase } : {}), ...(deps.push.fetch ? { fetch: deps.push.fetch } : {}) });
34
39
  const lnOpts = () => ({ ...(deps.push.linearApiBase ? { apiBase: deps.push.linearApiBase } : {}), ...(deps.push.fetch ? { fetch: deps.push.fetch } : {}) });
35
40
  const mustBeOwner = (c) => {
36
41
  const owner = c.get("owner");
@@ -54,7 +59,7 @@ export function integrationRoutes(deps) {
54
59
  };
55
60
  const provider = (c) => {
56
61
  const v = c.req.param("provider") ?? "";
57
- return isTracker(v) ? v : fail(c, 404, "integration_not_configured", `No tracker called ${JSON.stringify(v)}. This build speaks: github, linear, jira, slack.`);
62
+ return isTracker(v) ? v : fail(c, 404, "integration_not_configured", `No tracker called ${JSON.stringify(v)}. This build speaks: github, linear, jira, trello, slack.`);
58
63
  };
59
64
  /** The card's view of a connection — never a token. */
60
65
  const shape = (i, projectUid) => {
@@ -79,6 +84,10 @@ export function integrationRoutes(deps) {
79
84
  const cfg = i.config;
80
85
  return { provider: "jira", ...base, siteUrl: cfg.siteUrl, projectKey: cfg.projectKey, projectName: cfg.projectName, issueType: cfg.issueTypeName, email: cfg.email };
81
86
  }
87
+ if (i.provider === "trello") {
88
+ const cfg = i.config;
89
+ return { provider: "trello", ...base, boardName: cfg.boardName, boardUrl: cfg.boardUrl, listNames: cfg.listNames, webhookRegistered: !!cfg.webhookId };
90
+ }
82
91
  if (i.provider === "slack") {
83
92
  const cfg = i.config;
84
93
  return { provider: "slack", ...base, teamName: cfg.teamName, teamUrl: cfg.teamUrl, channelId: cfg.channelId, channelName: cfg.channelName };
@@ -176,6 +185,32 @@ export function integrationRoutes(deps) {
176
185
  const r = await linearClient({ apiKey, ...lnOpts() }).discover();
177
186
  return r.ok ? c.json({ who: r.who, options: r.options }) : fail(c, 422, "validation_failed", r.detail, { field: "apiKey" });
178
187
  }
188
+ if (pv === "trello") {
189
+ const apiKey = str("apiKey");
190
+ if (!apiKey)
191
+ return fail(c, 422, "validation_failed", "Paste your Power-Up's API key first.", { field: "apiKey" });
192
+ const token = str("token");
193
+ if (!token)
194
+ return fail(c, 422, "validation_failed", "Paste a token first — the Token link beside your API key in Trello makes one.", { field: "token" });
195
+ // "New board…": Snagset makes the board with its three lists, and the
196
+ // answer is that board with them, ready to connect (0.1.57).
197
+ const newBoard = str("newBoard");
198
+ if (newBoard) {
199
+ if (newBoard.length > 200)
200
+ return fail(c, 422, "validation_failed", "A board name of 200 characters or fewer.", { field: "newBoard" });
201
+ const made = await trelloClient({ apiKey, token, ...trOpts() }).createBoard(newBoard);
202
+ if (!made.ok)
203
+ return fail(c, 422, "validation_failed", made.detail, { field: "newBoard" });
204
+ return c.json({ who: "", board: { value: made.board.id, label: made.board.name }, options: made.lists.map((l) => ({ value: l.id, label: l.name })) });
205
+ }
206
+ // A board id narrows the answer to that board's lists: the second
207
+ // half of the Connect step, asked once a board is picked.
208
+ const boardId = str("boardId");
209
+ if (boardId && !/^[0-9a-f]{24}$/i.test(boardId))
210
+ return fail(c, 422, "validation_failed", "That is not a Trello board id.", { field: "boardId" });
211
+ const r = await trelloClient({ apiKey, token, ...trOpts() }).discover(boardId || undefined);
212
+ return r.ok ? c.json({ who: r.who, options: r.options }) : fail(c, 422, "validation_failed", r.detail, { field: "token" });
213
+ }
179
214
  const siteUrl = str("siteUrl").replace(/\/+$/, "");
180
215
  if (!/^https?:\/\/[^\s/]+$/.test(siteUrl))
181
216
  return fail(c, 422, "validation_failed", "Give the site's address, like https://kilnwork.atlassian.net.", { field: "siteUrl" });
@@ -228,6 +263,72 @@ export function integrationRoutes(deps) {
228
263
  const createOn = body?.["createOn"] === "thread.created" ? "thread.created" : body?.["createOn"] === "manual" ? "manual" : pv === "slack" ? "thread.created" : "manual";
229
264
  const existing = await getIntegration(sql, keys, p.org_id, p.id, pv);
230
265
  const had = trackerSecrets(existing?.secret ?? null);
266
+ if (pv === "trello") {
267
+ // Trello (0.1.56): an API key and a token, a board, and three of its
268
+ // lists for open, in progress and resolved — probed before anything
269
+ // is stored. The way back is a webhook we register on the board
270
+ // ourselves; Trello signs deliveries with the Power-Up's secret, which
271
+ // the owner pastes on the next step (or here).
272
+ const prev = existing?.config;
273
+ const apiKey = str("apiKey") || prev?.apiKey || "";
274
+ if (!apiKey)
275
+ return fail(c, 422, "validation_failed", "Paste your Power-Up's API key.", { field: "apiKey" });
276
+ const token = str("token") || had.token || "";
277
+ if (!token)
278
+ return fail(c, 422, "validation_failed", "Paste a token — the Generate a token link makes one.", { field: "token" });
279
+ const boardId = str("boardId");
280
+ if (!/^[0-9a-f]{24}$/i.test(boardId))
281
+ return fail(c, 422, "validation_failed", "Pick a board.", { field: "boardId" });
282
+ const lists = { open: str("openList"), progress: str("progressList"), resolved: str("resolvedList") };
283
+ for (const [k, v] of Object.entries(lists)) {
284
+ if (!/^[0-9a-f]{24}$/i.test(v))
285
+ return fail(c, 422, "validation_failed", "Pick a list for open, in progress and resolved.", { field: `${k}List` });
286
+ }
287
+ const tc = trelloClient({ apiKey, token, ...trOpts() });
288
+ const probe = await tc.probe(boardId, lists);
289
+ if (!probe.ok)
290
+ return fail(c, 422, "validation_failed", `Trello: ${probe.detail}.`, { field: "boardId" });
291
+ const url = await webhookUrl("trello");
292
+ let webhookId = null;
293
+ let webhookError = null;
294
+ try {
295
+ webhookId = (await tc.registerWebhook(boardId, url)).id;
296
+ }
297
+ catch (e) {
298
+ // Trello checks the address with a HEAD before it registers, so a
299
+ // server it cannot reach (a laptop, a private network) lands here.
300
+ // The connection still works one way; the dialog says why the way
301
+ // back does not.
302
+ webhookError = e instanceof Error ? e.message : String(e);
303
+ }
304
+ // Re-registering on the same board failed: the webhook that was working
305
+ // stays, rather than being taken down with nothing in its place.
306
+ if (!webhookId && prev?.webhookId && prev.boardId === boardId)
307
+ webhookId = prev.webhookId;
308
+ // A board change leaves the old board's webhook behind: take it down,
309
+ // unless another connection holds the same webhook (one token, one
310
+ // board, one callback is one webhook at Trello).
311
+ if (prev?.webhookId && prev.webhookId !== webhookId && !(await webhookShared(prev.webhookId, p.id)))
312
+ await tc.removeWebhook(prev.webhookId).catch(() => { });
313
+ await putIntegration(sql, keys, {
314
+ orgId: p.org_id,
315
+ projectId: p.id,
316
+ provider: "trello",
317
+ config: {
318
+ apiKey,
319
+ boardId: probe.board.id,
320
+ boardName: probe.board.name,
321
+ boardUrl: probe.board.url,
322
+ lists,
323
+ listNames: probe.names,
324
+ webhookId,
325
+ createOn,
326
+ },
327
+ secret: JSON.stringify({ token, webhookSecret: str("webhookSecret") || had.webhookSecret }),
328
+ });
329
+ const i = await getIntegration(sql, keys, p.org_id, p.id, "trello");
330
+ return c.json({ integration: i ? shape(i, p.uid) : null, webhook: { url, registered: !!webhookId, ...(webhookError ? { error: webhookError } : {}) } });
331
+ }
231
332
  if (pv === "slack") {
232
333
  // Slack: a bot token from the app the operator created from our
233
334
  // manifest, and a channel by #name or id. Probed — the token, then the
@@ -385,6 +486,15 @@ export function integrationRoutes(deps) {
385
486
  const p = await site(c, owner);
386
487
  if (!p)
387
488
  return fail(c, 404, "project_not_found", "No project with that uid.");
489
+ if (pv === "trello") {
490
+ // The board's webhook is ours to take down; best effort, since a
491
+ // revoked token cannot, and Trello drops a webhook whose token goes.
492
+ const i = await getIntegration(sql, keys, p.org_id, p.id, "trello");
493
+ const cfg = i?.config;
494
+ const token = trackerSecrets(i?.secret ?? null).token;
495
+ if (cfg?.webhookId && token && !(await webhookShared(cfg.webhookId, p.id)))
496
+ await trelloClient({ apiKey: cfg.apiKey, token, ...trOpts() }).removeWebhook(cfg.webhookId).catch(() => { });
497
+ }
388
498
  await removeIntegration(sql, p.org_id, p.id, pv);
389
499
  return c.json({ integration: null });
390
500
  });
@@ -413,6 +523,11 @@ export function integrationRoutes(deps) {
413
523
  const r = await jiraClient({ siteUrl: cfg.siteUrl, email: cfg.email, apiToken: token, allowPrivate: !!deps.push.jiraPrivate, ...(deps.push.fetch ? { fetch: deps.push.fetch } : {}) }).probe(cfg.projectKey);
414
524
  ok = r.ok ? { ok: true, target: `${r.project.key} · ${r.project.name}` } : r;
415
525
  }
526
+ else if (pv === "trello") {
527
+ const cfg = i.config;
528
+ const r = await trelloClient({ apiKey: cfg.apiKey, token, ...trOpts() }).probe(cfg.boardId, cfg.lists);
529
+ ok = r.ok ? { ok: true, target: r.board.name } : r;
530
+ }
416
531
  else if (pv === "slack") {
417
532
  const cfg = i.config;
418
533
  try {
@@ -457,11 +572,15 @@ export function integrationRoutes(deps) {
457
572
  return fail(c, 409, "integration_not_configured", `${NAME[pv]} is not connected on this site.`);
458
573
  let secret;
459
574
  let show = true;
460
- if (pv === "linear") {
575
+ if (pv === "linear" || pv === "trello") {
576
+ // Theirs, not ours: Linear's webhook shows its signing secret, and
577
+ // Trello signs with the Power-Up's secret. Pasted, and never echoed.
461
578
  const body = (await c.req.json().catch(() => null));
462
579
  secret = typeof body?.["secret"] === "string" ? body["secret"].trim() : "";
463
- if (!secret)
464
- return fail(c, 422, "validation_failed", "Paste the signing secret Linear shows on the webhook.", { field: "secret" });
580
+ if (!secret) {
581
+ const how = pv === "linear" ? "Paste the signing secret Linear shows on the webhook." : "Paste the secret from your Power-Up's API key page in Trello.";
582
+ return fail(c, 422, "validation_failed", how, { field: "secret" });
583
+ }
465
584
  show = false;
466
585
  }
467
586
  else {
@@ -508,6 +627,11 @@ export function integrationRoutes(deps) {
508
627
  return where(tx);
509
628
  });
510
629
  const secretOf = (r) => trackerSecrets(r.credentials && r.credentials_iv ? open(keys, { ciphertext: r.credentials, iv: r.credentials_iv }) : null).webhookSecret;
630
+ /** Whether a live Trello connection on another site holds this webhook (Trello hands one token the same webhook for the same board and callback). */
631
+ const webhookShared = async (webhookId, exceptProjectId) => (await candidatesFor("trello", (tx) => tx `
632
+ SELECT id, org_id, project_id, credentials, credentials_iv FROM integrations
633
+ WHERE provider = 'trello' AND deleted_at IS NULL AND config->>'webhookId' = ${webhookId} AND project_id <> ${exceptProjectId}::uuid
634
+ `)).length > 0;
511
635
  /**
512
636
  * The tracker → us (05 endpoint 25c). Unauthenticated in the session
513
637
  * sense; authenticated by the provider's signature over the RAW body with
@@ -515,6 +639,10 @@ export function integrationRoutes(deps) {
515
639
  * pasted from Linear's form for Linear. The target named in the
516
640
  * payload picks the candidate connections; the signature picks the one.
517
641
  */
642
+ // Trello checks the address with a HEAD before it will register a webhook
643
+ // (and again from time to time). Nothing is read or written. Hono answers a
644
+ // HEAD from the GET route, so the route is a GET.
645
+ app.get("/api/v1/integrations/trello/inbound", (c) => c.body(null, 200));
518
646
  app.post("/api/v1/integrations/:provider/inbound", async (c) => {
519
647
  const pv = provider(c);
520
648
  if (pv instanceof Response)
@@ -606,7 +734,9 @@ export function integrationRoutes(deps) {
606
734
  let status = null;
607
735
  if (event === "jira:issue_deleted")
608
736
  status = "detach";
609
- else if (event === "jira:issue_updated" || event === "jira:issue_created") {
737
+ // issue_created is ignored: an issue Snagset made carries its creation-time
738
+ // status there, and applying it undid the move that followed (0.1.57).
739
+ else if (event === "jira:issue_updated") {
610
740
  const category = String(issue?.fields?.status?.statusCategory?.key ?? "");
611
741
  if (category)
612
742
  status = statusForJiraCategory(category);
@@ -620,10 +750,71 @@ export function integrationRoutes(deps) {
620
750
  deliveryId: delivery || `${issueKey}:${event}:${String(issue?.fields?.updated ?? Date.now())}`,
621
751
  externalId: issueKey,
622
752
  status,
753
+ progressHoldsReview: true,
623
754
  });
624
755
  await noticeIfResolved(applied, match.org_id, match.project_id, "Jira");
625
756
  return c.json({ ok: true, applied: applied.kind, ...("why" in applied ? { why: applied.why } : {}) });
626
757
  }
758
+ if (pv === "trello") {
759
+ // Trello (0.1.56): X-Trello-Webhook is the base64 HMAC-SHA1 of the raw
760
+ // body followed by the callback URL, keyed with the Power-Up's secret;
761
+ // the action's id is the replay key. The board picks the candidates.
762
+ const signature = c.req.header("x-trello-webhook");
763
+ const action = payload?.action;
764
+ const boardId = String(payload?.model?.id ?? action?.data?.board?.id ?? "");
765
+ if (!/^[0-9a-f]{24}$/i.test(boardId))
766
+ return fail(c, 400, "validation_failed", "The payload names no board.");
767
+ const callbackURL = await webhookUrl("trello");
768
+ const candidates = await candidatesFor("trello", (tx) => tx `
769
+ SELECT id, org_id, project_id, credentials, credentials_iv, config FROM integrations
770
+ WHERE provider = 'trello' AND deleted_at IS NULL AND enabled AND config->>'boardId' = ${boardId}
771
+ `);
772
+ // Several connections can share one board, and one Power-Up's secret
773
+ // (a studio's staging and live sites; one token's single webhook). The
774
+ // delivery is applied to EVERY connection it verifies for, each with
775
+ // its own ledger key: Trello's action id is the same in every
776
+ // webhook's delivery of that action, so a bare id would let one
777
+ // connection's delivery spend another's.
778
+ const matches = candidates.filter((r) => {
779
+ const s = secretOf(r);
780
+ return !!s && verifyTrelloSignature(raw, callbackURL, signature, s);
781
+ });
782
+ if (!matches.length) {
783
+ if (candidates.length === 1)
784
+ await markRefused(sql, candidates[0].id, SIGNATURE_REFUSED.trello);
785
+ return fail(c, 401, "provider_signature_invalid", "The signature does not match this board's secret — paste the Power-Up's secret from Trello into Snagset.");
786
+ }
787
+ const type = String(action?.type ?? "");
788
+ const cardId = String(action?.data?.card?.id ?? "");
789
+ const actionId = String(action?.id ?? "") || `${cardId}:${type}:${Date.now()}`;
790
+ let shown = null;
791
+ for (const match of matches) {
792
+ await markDelivered(sql, match.id);
793
+ const cfg = match.config;
794
+ let status = null;
795
+ if (type === "deleteCard")
796
+ status = "detach";
797
+ else if (type === "updateCard" && action?.data?.listAfter?.id)
798
+ status = statusForTrelloList(String(action.data.listAfter.id), cfg.lists);
799
+ if (!status || !cardId)
800
+ continue;
801
+ const applied = await applyIssueState(sql, {
802
+ provider: "trello",
803
+ orgId: match.org_id,
804
+ projectId: match.project_id,
805
+ deliveryId: `${match.id}:${actionId}`,
806
+ externalId: cardId,
807
+ status,
808
+ progressHoldsReview: true,
809
+ });
810
+ await noticeIfResolved(applied, match.org_id, match.project_id, "Trello");
811
+ if (!shown || (shown.kind === "ignored" && shown.why === "no-thread"))
812
+ shown = applied;
813
+ }
814
+ if (!shown)
815
+ return c.json({ ok: true, applied: "ignored", why: "action" });
816
+ return c.json({ ok: true, applied: shown.kind, ...("why" in shown ? { why: shown.why } : {}) });
817
+ }
627
818
  // Linear: Linear-Signature is the hex HMAC over the raw body
628
819
  // with the webhook's signing secret; Linear-Delivery is the replay key;
629
820
  // webhookTimestamp guards a captured body replayed much later.
@@ -671,6 +862,7 @@ export function integrationRoutes(deps) {
671
862
  deliveryId: delivery || `${issueId}:${action}:${Date.now()}`,
672
863
  externalId: issueId,
673
864
  status,
865
+ progressHoldsReview: true,
674
866
  });
675
867
  await noticeIfResolved(applied, match.org_id, match.project_id, "Linear");
676
868
  return c.json({ ok: true, applied: applied.kind, ...("why" in applied ? { why: applied.why } : {}) });
@@ -723,14 +915,45 @@ export function integrationRoutes(deps) {
723
915
  if (!queued)
724
916
  return fail(c, 404, "thread_not_found", "No such thread in this project.");
725
917
  await drainNow(sql, deps.push);
726
- const [ref] = await inOrg(sql, p.org_id, (tx) => tx `
727
- SELECT external_id, url, status FROM external_refs
728
- WHERE thread_id = ${threadRow}::uuid AND provider = ${pv}::snag_provider AND kind = ${REF_KIND[pv]}::snag_ref_kind AND status <> 'detached'
729
- `);
730
- if (ref)
731
- return c.json({ ref: { provider: pv, kind: REF_KIND[pv], externalId: ref.external_id, url: ref.url, status: ref.status } });
732
- const fresh = await getIntegration(sql, keys, p.org_id, p.id, pv);
733
- return fail(c, 502, "integration_push_failed", fresh?.lastError ?? `${NAME[pv]} did not take the ${REF_KIND[pv]}. The card on Studio › Integrations says why.`);
918
+ // The drain above may not be the one that takes this thread's row: the
919
+ // minute worker, or another request's drain, can hold it in flight, and
920
+ // other rows can be ahead of it. So the answer waits on THIS thread's own
921
+ // create row, a few seconds at most, rather than calling a row still being
922
+ // worked a failure (seen live: a 502, and the card on the board a moment
923
+ // later).
924
+ const deadline = Date.now() + (deps.push.createWaitMs ?? CREATE_WAIT_MS);
925
+ for (;;) {
926
+ const [ref] = await inOrg(sql, p.org_id, (tx) => tx `
927
+ SELECT external_id, url, status FROM external_refs
928
+ WHERE thread_id = ${threadRow}::uuid AND provider = ${pv}::snag_provider AND kind = ${REF_KIND[pv]}::snag_ref_kind AND status <> 'detached'
929
+ `);
930
+ if (ref)
931
+ return c.json({ ref: { provider: pv, kind: REF_KIND[pv], externalId: ref.external_id, url: ref.url, status: ref.status } });
932
+ const [row] = await inOrg(sql, p.org_id, (tx) => tx `
933
+ SELECT status, last_error FROM outbox
934
+ WHERE thread_id = ${threadRow}::uuid AND provider = ${pv}::snag_provider AND topic = 'issue.create'
935
+ ORDER BY created_at DESC LIMIT 1
936
+ `);
937
+ const settled = !row || row.status === "failed" || row.status === "dropped" || row.status === "done" || (row.status === "pending" && !!row.last_error);
938
+ if (settled) {
939
+ // The worker writes the ref, then marks the row done: a ref missed on
940
+ // the read above can have landed since.
941
+ if (row?.status === "done") {
942
+ const [late] = await inOrg(sql, p.org_id, (tx) => tx `
943
+ SELECT external_id, url, status FROM external_refs
944
+ WHERE thread_id = ${threadRow}::uuid AND provider = ${pv}::snag_provider AND kind = ${REF_KIND[pv]}::snag_ref_kind AND status <> 'detached'
945
+ `);
946
+ if (late)
947
+ return c.json({ ref: { provider: pv, kind: REF_KIND[pv], externalId: late.external_id, url: late.url, status: late.status } });
948
+ }
949
+ return fail(c, 502, "integration_push_failed", row?.last_error ?? `${NAME[pv]} did not take the ${REF_KIND[pv]}. The card on Studio › Integrations says why.`);
950
+ }
951
+ if (Date.now() >= deadline) {
952
+ return c.json({ ref: null, queued: true, message: `${NAME[pv]} is still being asked. The link appears on this comment when it answers.` }, 202);
953
+ }
954
+ await new Promise((r) => setTimeout(r, 250));
955
+ await drainNow(sql, deps.push, 1);
956
+ }
734
957
  });
735
958
  return app;
736
959
  }