orqevio 1.3.0 → 1.4.1
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/web/assets/AccessKeyReveal-BhGhJ9TO.js +2 -0
- package/dist/web/assets/{AccessRows-BvqV7IBl.js → AccessRows-BukzKFuJ.js} +1 -1
- package/dist/web/assets/ActivityList-TVMXixkB.js +1 -0
- package/dist/web/assets/AgentsPage-lZ18h_Fd.js +1 -0
- package/dist/web/assets/Avatar-B1img0gb.js +1 -0
- package/dist/web/assets/BoardPage-DiTjq46K.js +1 -0
- package/dist/web/assets/{Button-DFtiJeUa.js → Button-CHkkj3LG.js} +1 -1
- package/dist/web/assets/CardItem-BAkxFtTs.js +5 -0
- package/dist/web/assets/{Checkbox-D2glB_5Z.js → Checkbox-S2SJTJty.js} +1 -1
- package/dist/web/assets/ColorPicker-DSVbH2ix.js +1 -0
- package/dist/web/assets/ConsentPage-CXS-bOLl.js +1 -0
- package/dist/web/assets/{CopyButton-DPGirLsh.js → CopyButton-BDbxvAXk.js} +1 -1
- package/dist/web/assets/DocPage-8QmjOXZg.js +1 -0
- package/dist/web/assets/{EmptyState-NLNYFMbg.js → EmptyState-D6CMbgBz.js} +1 -1
- package/dist/web/assets/Field-BsUKJQ-4.js +1 -0
- package/dist/web/assets/HomePage-Bm_gsAiP.js +1 -0
- package/dist/web/assets/{Menu-D1dtpXQc.js → Menu-CzgZwzmu.js} +2 -2
- package/dist/web/assets/{PageHeader-6CKm6Nmk.js → PageHeader-DJdrnGpr.js} +1 -1
- package/dist/web/assets/Phrases-C89QdC4L.js +1 -0
- package/dist/web/assets/Popover-BVPB22vZ.js +1 -0
- package/dist/web/assets/ProjectPage-hVAuJHb8.js +1 -0
- package/dist/web/assets/ProjectSettingsDialog-ekHTFmaO.js +1 -0
- package/dist/web/assets/Segmented-BibQ5uCT.js +1 -0
- package/dist/web/assets/SettingsPage-BlACK1Ir.js +1 -0
- package/dist/web/assets/{States-YdzeahGB.js → States-D9T0E3QG.js} +1 -1
- package/dist/web/assets/TokenCard-DcxUdsB4.js +1 -0
- package/dist/web/assets/{Trans-BeLoTtlV.js → Trans-CA0OvHif.js} +1 -1
- package/dist/web/assets/TrashPage-DtEce2C1.js +1 -0
- package/dist/web/assets/VaultPage-BXNKzLjV.js +9 -0
- package/dist/web/assets/actions-TwDLbdln.js +1 -0
- package/dist/web/assets/activity-B1PkPN4e.js +1 -0
- package/dist/web/assets/activity-BRWOTTDg.js +1 -0
- package/dist/web/assets/activity-C0-uReAO.js +1 -0
- package/dist/web/assets/activity-C3YOucKo.js +1 -0
- package/dist/web/assets/activity-C48FEjNJ.js +1 -0
- package/dist/web/assets/activity-DdBRZVdk.js +1 -0
- package/dist/web/assets/activity-DquwEWD-.js +1 -0
- package/dist/web/assets/activity-SBZ_4XNf.js +1 -0
- package/dist/web/assets/agents-Buz9Zce-.js +1 -0
- package/dist/web/assets/{agents-D2HbGZdI.js → agents-BxCzIQgy.js} +1 -1
- package/dist/web/assets/agents-BzG9ir4p.js +1 -0
- package/dist/web/assets/agents-C7L2c8Cf.js +1 -0
- package/dist/web/assets/agents-CyUmWDtj.js +1 -0
- package/dist/web/assets/agents-D1YGo2XZ.js +1 -0
- package/dist/web/assets/agents-koE0DpBZ.js +1 -0
- package/dist/web/assets/{arrow-up-right-CZaZGd2b.js → arrow-up-right-GSt0z737.js} +1 -1
- package/dist/web/assets/boards-B-WHIuH2.js +1 -0
- package/dist/web/assets/boards-B3p4wLVZ.js +1 -0
- package/dist/web/assets/boards-CP12iEvX.js +1 -0
- package/dist/web/assets/boards-CYp6cMIS.js +1 -0
- package/dist/web/assets/boards-Ca3KSy81.js +1 -0
- package/dist/web/assets/boards-OpNgmCCm.js +1 -0
- package/dist/web/assets/boards-foiEeGvs.js +1 -0
- package/dist/web/assets/check-A2t_TRNF.js +1 -0
- package/dist/web/assets/chevron-down-MyAtFaeL.js +1 -0
- package/dist/web/assets/chevron-right-BGyQzokh.js +1 -0
- package/dist/web/assets/{clock-Or1e2dj9.js → clock-Dat3GIX9.js} +1 -1
- package/dist/web/assets/{common-DL87-WQe.js → common-BLSBOlPd.js} +1 -1
- package/dist/web/assets/{common-BQxUpELz.js → common-BZo-O4r0.js} +1 -1
- package/dist/web/assets/{common-DB87cQ0w.js → common-BvUgU13J.js} +1 -1
- package/dist/web/assets/{common-BEzNU6dg.js → common-CDo5Zjav.js} +1 -1
- package/dist/web/assets/{common-pmlLlsX2.js → common-CXXpaLMm.js} +1 -1
- package/dist/web/assets/{common-BVdHyWon.js → common-Dl9_WOhO.js} +1 -1
- package/dist/web/assets/{common-DIIWFfP1.js → common-LzzrLTeh.js} +1 -1
- package/dist/web/assets/dist-DFO0RDUp.js +1 -0
- package/dist/web/assets/docs-BFui74ut.js +1 -0
- package/dist/web/assets/docs-BGjDA7YS.js +1 -0
- package/dist/web/assets/docs-BZzvZnYG.js +1 -0
- package/dist/web/assets/docs-Bs3C4UtI.js +1 -0
- package/dist/web/assets/docs-CWqekQ-5.js +1 -0
- package/dist/web/assets/docs-Dt4EOOY5.js +1 -0
- package/dist/web/assets/docs-a_cikk8v.js +1 -0
- package/dist/web/assets/download-CHH-5Z1W.js +1 -0
- package/dist/web/assets/{download-DeNtxt4D.js → download-CRdduKx2.js} +1 -1
- package/dist/web/assets/{eye-DqmmpIUP.js → eye-CkYWwyJN.js} +1 -1
- package/dist/web/assets/{file-plus-B9RcccJq.js → file-plus-B9m4uZcE.js} +1 -1
- package/dist/web/assets/{folder-open-B5eZ7cqb.js → folder-open-DCuG03EB.js} +1 -1
- package/dist/web/assets/{format-DEwJtk6a.js → format-Dk1nO38Z.js} +6 -6
- package/dist/web/assets/history-B_oC_ChK.js +1 -0
- package/dist/web/assets/history-BdWMN_eX.js +1 -0
- package/dist/web/assets/history-CUVz8O2h.js +1 -0
- package/dist/web/assets/history-DSrp6n_e.js +1 -0
- package/dist/web/assets/history-EriRbg5Q.js +1 -0
- package/dist/web/assets/history-QanrHfJr.js +1 -0
- package/dist/web/assets/history-wSBPUVnX.js +1 -0
- package/dist/web/assets/{index-DXZdSAQ6.js → index-DaNg7x81.js} +3 -3
- package/dist/web/assets/index-NdrHk7JO.css +2 -0
- package/dist/web/assets/{lock-keyhole-BSIBvxdl.js → lock-keyhole-DVrMCpqy.js} +1 -1
- package/dist/web/assets/markdown-html-3z2pX2_I.css +1 -0
- package/dist/web/assets/{Attachments-Ehl3SEHq.js → markdown-html-Bbis0Fwx.js} +31 -31
- package/dist/web/assets/module-Drxjodh-.js +1 -0
- package/dist/web/assets/paperclip-BnASHXPW.js +1 -0
- package/dist/web/assets/{pencil-BgKjfUw7.js → pencil-C37OTkSN.js} +1 -1
- package/dist/web/assets/plus-DcOCeQtr.js +1 -0
- package/dist/web/assets/realtime-Dn6o1BHn.js +1 -0
- package/dist/web/assets/restore-CAzTqClb.js +1 -0
- package/dist/web/assets/router-BVJjZgrw.js +1 -0
- package/dist/web/assets/router-C3-WXlLY.js +6 -0
- package/dist/web/assets/{search-THqOJIwW.js → search-6TSW8Big.js} +1 -1
- package/dist/web/assets/session-BdZhhrrQ.js +1 -0
- package/dist/web/assets/settings-BfiF3vRe.js +1 -0
- package/dist/web/assets/settings-C6avg4dt.js +1 -0
- package/dist/web/assets/settings-CxYlS5HR.js +1 -0
- package/dist/web/assets/settings-D2SYA_T6.js +1 -0
- package/dist/web/assets/settings-DGz7mzx_.js +1 -0
- package/dist/web/assets/settings-Dlc_FiDv.js +1 -0
- package/dist/web/assets/settings-UmVB6e9k.js +1 -0
- package/dist/web/assets/{shield-exclamation-point-XUMrMBnT.js → shield-exclamation-point-sqW5yuTY.js} +1 -1
- package/dist/web/assets/{square-kanban-CMvSaNex.js → square-kanban-Cd_tPOtx.js} +1 -1
- package/dist/web/assets/{sticky-note-DQns5zF8.js → sticky-note-hvgZ-pol.js} +1 -1
- package/dist/web/assets/sync-Byk1kJR_.js +1 -0
- package/dist/web/assets/{tag-5EiSR0t7.js → tag-CBK0qBXV.js} +1 -1
- package/dist/web/assets/trash-BCjrjoKX.js +1 -0
- package/dist/web/assets/trash-BtTKuFPT.js +2 -0
- package/dist/web/assets/trash-CODwqcnD.js +1 -0
- package/dist/web/assets/{trash-CBo3hCgY.js → trash-CkQBpprn.js} +1 -1
- package/dist/web/assets/trash-DfFAQqPy.js +1 -0
- package/dist/web/assets/trash-on2wbvUn.js +1 -0
- package/dist/web/assets/trash-s5Pa3Sa3.js +1 -0
- package/dist/web/assets/trash-s8qvLvgr.js +1 -0
- package/dist/web/assets/trash-sikRutjz.js +1 -0
- package/dist/web/assets/{triangle-exclamation-point-fRu34PHx.js → triangle-exclamation-point-BTUlFMkc.js} +1 -1
- package/dist/web/index.html +34 -34
- package/dist/worker/index.js +630 -131
- package/package.json +1 -1
- package/dist/web/assets/AccessKeyReveal-B8-53IsG.js +0 -2
- package/dist/web/assets/ActivityList-CMeaCWkv.js +0 -1
- package/dist/web/assets/AgentsPage-BFV4Irgu.js +0 -1
- package/dist/web/assets/Attachments-BWc36ATf.css +0 -1
- package/dist/web/assets/Avatar-XLUId3O5.js +0 -1
- package/dist/web/assets/BoardPage-yeO36gca.js +0 -1
- package/dist/web/assets/CardItem-BJSe5Yys.js +0 -5
- package/dist/web/assets/ColorPicker-DXWll90z.js +0 -1
- package/dist/web/assets/ConsentPage-LsyaMLAu.js +0 -1
- package/dist/web/assets/DocPage-LDbLYm22.js +0 -1
- package/dist/web/assets/Field-CJ08Txzu.js +0 -1
- package/dist/web/assets/HomePage-C5tasScn.js +0 -1
- package/dist/web/assets/Popover-rUw84XS3.js +0 -1
- package/dist/web/assets/ProjectPage-sRIqleNm.js +0 -1
- package/dist/web/assets/ProjectSettingsDialog-Bu9Nh_f1.js +0 -1
- package/dist/web/assets/Segmented-CkRO6dAI.js +0 -1
- package/dist/web/assets/SettingsPage--HzCtlxW.js +0 -1
- package/dist/web/assets/TokenCard-Cxa4noi9.js +0 -1
- package/dist/web/assets/TrashPage-eI708eSb.js +0 -1
- package/dist/web/assets/VaultPage-DZ8whuhV.js +0 -9
- package/dist/web/assets/actions-BHpEdIG-.js +0 -1
- package/dist/web/assets/activity-B9yvTGRK.js +0 -1
- package/dist/web/assets/activity-BhJh5gr8.js +0 -1
- package/dist/web/assets/activity-C6uHBG-k.js +0 -1
- package/dist/web/assets/activity-C_Gj6kNm.js +0 -1
- package/dist/web/assets/activity-DE5W3_Zl.js +0 -1
- package/dist/web/assets/activity-Da3DZwfO.js +0 -1
- package/dist/web/assets/activity-DklyxS1p.js +0 -1
- package/dist/web/assets/activity-DqxJDBNZ.js +0 -1
- package/dist/web/assets/agents-BT7hhkmJ.js +0 -1
- package/dist/web/assets/agents-CH9hiW4n.js +0 -1
- package/dist/web/assets/agents-dOyd7e_g.js +0 -1
- package/dist/web/assets/agents-hwFgCutb.js +0 -1
- package/dist/web/assets/agents-mGUE0KF4.js +0 -1
- package/dist/web/assets/agents-rpBGYkV5.js +0 -1
- package/dist/web/assets/boards-B55T0dLc.js +0 -1
- package/dist/web/assets/boards-BJtzDCZ4.js +0 -1
- package/dist/web/assets/boards-BK-HIes0.js +0 -1
- package/dist/web/assets/boards-BRGCpMCs.js +0 -1
- package/dist/web/assets/boards-D9ITCVkH.js +0 -1
- package/dist/web/assets/boards-DAtCVLZ8.js +0 -1
- package/dist/web/assets/boards-DkGEJNsi.js +0 -1
- package/dist/web/assets/check-zaEYRgm_.js +0 -1
- package/dist/web/assets/chevron-right-CKppr8-s.js +0 -1
- package/dist/web/assets/dist-BXudX2C8.js +0 -1
- package/dist/web/assets/docs-CdU1zlr_.js +0 -1
- package/dist/web/assets/docs-CozS3xm2.js +0 -1
- package/dist/web/assets/docs-DL4bSiKv.js +0 -1
- package/dist/web/assets/docs-DdRzy2fY.js +0 -1
- package/dist/web/assets/docs-DjihmilZ.js +0 -1
- package/dist/web/assets/docs-DkxJ3bH2.js +0 -1
- package/dist/web/assets/docs-Duf_UKKw.js +0 -1
- package/dist/web/assets/history-BTSLGRUd.js +0 -1
- package/dist/web/assets/history-BYQKniZP.js +0 -1
- package/dist/web/assets/history-CCBPyinv.js +0 -1
- package/dist/web/assets/history-DJRWWqQM.js +0 -1
- package/dist/web/assets/history-DKzmm79r.js +0 -1
- package/dist/web/assets/history-DTKtuTix.js +0 -1
- package/dist/web/assets/history-DiKunONf.js +0 -1
- package/dist/web/assets/index-JKAKpcGm.css +0 -2
- package/dist/web/assets/paperclip-45hm0LEK.js +0 -1
- package/dist/web/assets/plus-DkN0_LKK.js +0 -1
- package/dist/web/assets/realtime-D4IlZ7la.js +0 -1
- package/dist/web/assets/restore-2dQEOQsU.js +0 -1
- package/dist/web/assets/router-Dq52n_dF.js +0 -1
- package/dist/web/assets/router-i53kBtjJ.js +0 -6
- package/dist/web/assets/session-BuK7KqOl.js +0 -1
- package/dist/web/assets/settings-B2K0CC6S.js +0 -1
- package/dist/web/assets/settings-C6mEKUST.js +0 -1
- package/dist/web/assets/settings-CHHy3vrT.js +0 -1
- package/dist/web/assets/settings-CcG0OlNC.js +0 -1
- package/dist/web/assets/settings-Clq39MFV.js +0 -1
- package/dist/web/assets/settings-D5LDNHZs.js +0 -1
- package/dist/web/assets/settings-DOUFAQf_.js +0 -1
- package/dist/web/assets/sync-7NhCAmaJ.js +0 -1
- package/dist/web/assets/trash-BS2DxHiH.js +0 -1
- package/dist/web/assets/trash-Blx5xyGN.js +0 -1
- package/dist/web/assets/trash-C8iQ5jx0.js +0 -1
- package/dist/web/assets/trash-D4IUwUwV.js +0 -1
- package/dist/web/assets/trash-D6VCYSPP.js +0 -1
- package/dist/web/assets/trash-DHTLFm0L.js +0 -1
- package/dist/web/assets/trash-DlhKL2Eo.js +0 -2
- package/dist/web/assets/trash-Duy-tBWH.js +0 -1
package/dist/worker/index.js
CHANGED
|
@@ -1724,13 +1724,13 @@ var require_applicability = __commonJS({
|
|
|
1724
1724
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1725
1725
|
exports.shouldUseRule = exports.shouldUseGroup = exports.schemaHasRulesForType = void 0;
|
|
1726
1726
|
function schemaHasRulesForType({ schema, self }, type) {
|
|
1727
|
-
const
|
|
1728
|
-
return
|
|
1727
|
+
const group2 = self.RULES.types[type];
|
|
1728
|
+
return group2 && group2 !== true && shouldUseGroup(schema, group2);
|
|
1729
1729
|
}
|
|
1730
1730
|
__name(schemaHasRulesForType, "schemaHasRulesForType");
|
|
1731
1731
|
exports.schemaHasRulesForType = schemaHasRulesForType;
|
|
1732
|
-
function shouldUseGroup(schema,
|
|
1733
|
-
return
|
|
1732
|
+
function shouldUseGroup(schema, group2) {
|
|
1733
|
+
return group2.rules.some((rule) => shouldUseRule(schema, rule));
|
|
1734
1734
|
}
|
|
1735
1735
|
__name(shouldUseGroup, "shouldUseGroup");
|
|
1736
1736
|
exports.shouldUseGroup = shouldUseGroup;
|
|
@@ -2841,23 +2841,23 @@ var require_validate = __commonJS({
|
|
|
2841
2841
|
if (!opts.jtd)
|
|
2842
2842
|
checkStrictTypes(it, types);
|
|
2843
2843
|
gen.block(() => {
|
|
2844
|
-
for (const
|
|
2845
|
-
groupKeywords(
|
|
2844
|
+
for (const group2 of RULES.rules)
|
|
2845
|
+
groupKeywords(group2);
|
|
2846
2846
|
groupKeywords(RULES.post);
|
|
2847
2847
|
});
|
|
2848
|
-
function groupKeywords(
|
|
2849
|
-
if (!(0, applicability_1.shouldUseGroup)(schema,
|
|
2848
|
+
function groupKeywords(group2) {
|
|
2849
|
+
if (!(0, applicability_1.shouldUseGroup)(schema, group2))
|
|
2850
2850
|
return;
|
|
2851
|
-
if (
|
|
2852
|
-
gen.if((0, dataType_2.checkDataType)(
|
|
2853
|
-
iterateKeywords(it,
|
|
2854
|
-
if (types.length === 1 && types[0] ===
|
|
2851
|
+
if (group2.type) {
|
|
2852
|
+
gen.if((0, dataType_2.checkDataType)(group2.type, data, opts.strictNumbers));
|
|
2853
|
+
iterateKeywords(it, group2);
|
|
2854
|
+
if (types.length === 1 && types[0] === group2.type && typeErrors) {
|
|
2855
2855
|
gen.else();
|
|
2856
2856
|
(0, dataType_2.reportTypeError)(it);
|
|
2857
2857
|
}
|
|
2858
2858
|
gen.endIf();
|
|
2859
2859
|
} else {
|
|
2860
|
-
iterateKeywords(it,
|
|
2860
|
+
iterateKeywords(it, group2);
|
|
2861
2861
|
}
|
|
2862
2862
|
if (!allErrors)
|
|
2863
2863
|
gen.if((0, codegen_1._)`${names_1.default.errors} === ${errsCount || 0}`);
|
|
@@ -2865,14 +2865,14 @@ var require_validate = __commonJS({
|
|
|
2865
2865
|
__name(groupKeywords, "groupKeywords");
|
|
2866
2866
|
}
|
|
2867
2867
|
__name(schemaKeywords, "schemaKeywords");
|
|
2868
|
-
function iterateKeywords(it,
|
|
2868
|
+
function iterateKeywords(it, group2) {
|
|
2869
2869
|
const { gen, schema, opts: { useDefaults } } = it;
|
|
2870
2870
|
if (useDefaults)
|
|
2871
|
-
(0, defaults_1.assignDefaults)(it,
|
|
2871
|
+
(0, defaults_1.assignDefaults)(it, group2.type);
|
|
2872
2872
|
gen.block(() => {
|
|
2873
|
-
for (const rule of
|
|
2873
|
+
for (const rule of group2.rules) {
|
|
2874
2874
|
if ((0, applicability_1.shouldUseRule)(schema, rule)) {
|
|
2875
|
-
keywordCode(it, rule.keyword, rule.definition,
|
|
2875
|
+
keywordCode(it, rule.keyword, rule.definition, group2.type);
|
|
2876
2876
|
}
|
|
2877
2877
|
}
|
|
2878
2878
|
});
|
|
@@ -5097,10 +5097,10 @@ var require_core = __commonJS({
|
|
|
5097
5097
|
const { RULES } = this;
|
|
5098
5098
|
delete RULES.keywords[keyword];
|
|
5099
5099
|
delete RULES.all[keyword];
|
|
5100
|
-
for (const
|
|
5101
|
-
const i2 =
|
|
5100
|
+
for (const group2 of RULES.rules) {
|
|
5101
|
+
const i2 = group2.rules.findIndex((rule) => rule.keyword === keyword);
|
|
5102
5102
|
if (i2 >= 0)
|
|
5103
|
-
|
|
5103
|
+
group2.rules.splice(i2, 1);
|
|
5104
5104
|
}
|
|
5105
5105
|
return this;
|
|
5106
5106
|
}
|
|
@@ -7822,6 +7822,7 @@ __name(securityHeaders, "securityHeaders");
|
|
|
7822
7822
|
|
|
7823
7823
|
// ../../packages/shared/src/colors.ts
|
|
7824
7824
|
var PALETTE = ["tomato", "amber", "lime", "jade", "teal", "cobalt", "iris", "rose", "slate"];
|
|
7825
|
+
var CUSTOM_COLOR = /^#[0-9a-f]{6}$/;
|
|
7825
7826
|
|
|
7826
7827
|
// ../../packages/shared/src/diff.ts
|
|
7827
7828
|
var splitLines = /* @__PURE__ */ __name((text2) => text2 === "" ? [] : text2.split("\n"), "splitLines");
|
|
@@ -7858,6 +7859,11 @@ function markdownToPlainText(markdown) {
|
|
|
7858
7859
|
return markdown.replace(/```[\s\S]*?```/g, " ").replace(/!\[([^\]]*)\]\([^)]*\)/g, "$1").replace(/\[([^\]]*)\]\([^)]*\)/g, "$1").replace(/^\s{0,3}(#{1,6}|>|[-*+]|\d+\.)\s+(\[[ xX]\]\s+)?/gm, "").replace(/[*_~`|]/g, "").replace(/^-{3,}$/gm, " ").replace(/\s+/g, " ").trim();
|
|
7859
7860
|
}
|
|
7860
7861
|
__name(markdownToPlainText, "markdownToPlainText");
|
|
7862
|
+
function commentExcerpt(body, max2 = 120) {
|
|
7863
|
+
const plain = markdownToPlainText(body) || body.replace(/\s+/g, " ").trim();
|
|
7864
|
+
return [...plain].length > max2 ? `${[...plain].slice(0, max2 - 1).join("")}\u2026` : plain;
|
|
7865
|
+
}
|
|
7866
|
+
__name(commentExcerpt, "commentExcerpt");
|
|
7861
7867
|
|
|
7862
7868
|
// ../../packages/shared/src/live.ts
|
|
7863
7869
|
var LIVE_CLOSE = {
|
|
@@ -28294,6 +28300,10 @@ var VISIBLE = /[^\s\p{Cc}\p{Cf}\p{Z}\p{M}\u115F\u1160\u3164\uFFA0\u2800]/u;
|
|
|
28294
28300
|
var name = /* @__PURE__ */ __name((max2 = 120) => external_exports.string().overwrite((value) => value.replace(/\p{Cc}+/gu, " ")).trim().min(1, { message: "Required", abort: true }).max(max2).refine((value) => VISIBLE.test(value), "Required"), "name");
|
|
28295
28301
|
var optionalName = /* @__PURE__ */ __name((max2) => external_exports.string().overwrite((value) => value.replace(/\p{Cc}+/gu, " ")).trim().overwrite((value) => VISIBLE.test(value) ? value : "").max(max2), "optionalName");
|
|
28296
28302
|
var color = external_exports.enum(PALETTE);
|
|
28303
|
+
var projectColor = external_exports.union([
|
|
28304
|
+
color,
|
|
28305
|
+
external_exports.string().trim().toLowerCase().regex(CUSTOM_COLOR, "A color is one of the palette or #rrggbb").transform((value) => value)
|
|
28306
|
+
]);
|
|
28297
28307
|
var index = external_exports.number().int().min(0).max(1e5);
|
|
28298
28308
|
var DUE_YEARS = { min: 1900, max: 2199 };
|
|
28299
28309
|
var DUE_FORMAT = /^(\d{4})-(\d{2})-(\d{2})(?:T(?:[01]\d|2[0-3]):[0-5]\d(?::[0-5]\d(?:\.\d{1,9})?)?(?:Z|[+-](?:[01]\d|2[0-3]):?[0-5]\d)?)?$/i;
|
|
@@ -28315,6 +28325,7 @@ var dueAt = external_exports.string().transform((value, ctx) => {
|
|
|
28315
28325
|
return external_exports.NEVER;
|
|
28316
28326
|
});
|
|
28317
28327
|
var MAX_MARKDOWN = 2e5;
|
|
28328
|
+
var MAX_COMMENT = 2e4;
|
|
28318
28329
|
function characters(text2) {
|
|
28319
28330
|
let count2 = text2.length;
|
|
28320
28331
|
for (let i2 = 0; i2 < text2.length - 1; i2++) {
|
|
@@ -28344,12 +28355,12 @@ var updateAccountInput = external_exports.object({
|
|
|
28344
28355
|
var workspaceInput = external_exports.object({ name: name(60) });
|
|
28345
28356
|
var projectCreateInput = external_exports.object({
|
|
28346
28357
|
name: name(80),
|
|
28347
|
-
color:
|
|
28358
|
+
color: projectColor.default("cobalt"),
|
|
28348
28359
|
description: external_exports.string().trim().max(500).optional()
|
|
28349
28360
|
});
|
|
28350
28361
|
var projectUpdateInput = external_exports.object({
|
|
28351
28362
|
name: name(80).optional(),
|
|
28352
|
-
color:
|
|
28363
|
+
color: projectColor.optional(),
|
|
28353
28364
|
description: external_exports.string().trim().max(500).optional()
|
|
28354
28365
|
});
|
|
28355
28366
|
var MAX_COLUMNS = 20;
|
|
@@ -28387,6 +28398,9 @@ var checklistItemUpdateInput = external_exports.object({
|
|
|
28387
28398
|
index: index.optional()
|
|
28388
28399
|
});
|
|
28389
28400
|
var linkPageInput = external_exports.object({ pageId: id });
|
|
28401
|
+
var commentBody = external_exports.string().overwrite((value) => value.replace(/^(?:[^\S\n]*\n)+/, "").trimEnd()).min(1, { message: "Required", abort: true }).max(MAX_COMMENT).refine((value) => VISIBLE.test(value), "Required");
|
|
28402
|
+
var commentCreateInput = external_exports.object({ body: commentBody });
|
|
28403
|
+
var commentUpdateInput = external_exports.object({ body: commentBody });
|
|
28390
28404
|
var pageCreateInput = external_exports.object({
|
|
28391
28405
|
title: optionalName(200).default(""),
|
|
28392
28406
|
icon: external_exports.string().max(16).nullable().optional(),
|
|
@@ -28447,7 +28461,7 @@ var undoInput = external_exports.object({
|
|
|
28447
28461
|
dryRun: external_exports.boolean().default(false)
|
|
28448
28462
|
}).refine((v) => v.ids === void 0 !== (v.since === void 0), { message: "Send either ids or since" }).refine((v) => v.until === void 0 || v.since !== void 0, { message: "until goes with since" });
|
|
28449
28463
|
var UUID2 = "[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}";
|
|
28450
|
-
var TRASH_KEY = new RegExp(`^(?:(?:project|board|column|card|page|attachment|label|checklist|checklist_item):${UUID2}|link:${UUID2}:${UUID2})$`, "i");
|
|
28464
|
+
var TRASH_KEY = new RegExp(`^(?:(?:project|board|column|card|page|attachment|label|checklist|checklist_item|comment):${UUID2}|link:${UUID2}:${UUID2})$`, "i");
|
|
28451
28465
|
var trashKey = external_exports.string().regex(TRASH_KEY, "Not a trash key");
|
|
28452
28466
|
var trashRestoreInput = external_exports.object({
|
|
28453
28467
|
key: trashKey,
|
|
@@ -28474,7 +28488,8 @@ var trashPurgeManyInput = external_exports.object({ keys: external_exports.array
|
|
|
28474
28488
|
var INSTALL_KINDS = ["cli", "button", "docker", "source", "cloudflare"];
|
|
28475
28489
|
var installKind = /* @__PURE__ */ __name((value, fallback) => INSTALL_KINDS.includes(value ?? "") ? value : fallback, "installKind");
|
|
28476
28490
|
var ARCHIVED_PAGE = 50;
|
|
28477
|
-
var
|
|
28491
|
+
var COMMENTS_PAGE = 50;
|
|
28492
|
+
var TRASH_KINDS = ["project", "board", "column", "card", "page", "attachment", "label", "checklist", "checklist_item", "link", "comment"];
|
|
28478
28493
|
var TRASH_DAYS = 30;
|
|
28479
28494
|
var HISTORY_KINDS = [
|
|
28480
28495
|
"page.created",
|
|
@@ -28504,6 +28519,10 @@ var HISTORY_KINDS = [
|
|
|
28504
28519
|
"item.done",
|
|
28505
28520
|
"item.deleted",
|
|
28506
28521
|
"item.restored",
|
|
28522
|
+
"comment.created",
|
|
28523
|
+
"comment.body",
|
|
28524
|
+
"comment.deleted",
|
|
28525
|
+
"comment.restored",
|
|
28507
28526
|
"attachment.created",
|
|
28508
28527
|
"attachment.deleted",
|
|
28509
28528
|
"attachment.restored",
|
|
@@ -28517,9 +28536,11 @@ var HISTORY_TEXT_KINDS = /* @__PURE__ */ new Set([
|
|
|
28517
28536
|
"card.description",
|
|
28518
28537
|
"card.due",
|
|
28519
28538
|
"checklist.title",
|
|
28520
|
-
"item.text"
|
|
28539
|
+
"item.text",
|
|
28540
|
+
"comment.body"
|
|
28521
28541
|
]);
|
|
28522
28542
|
var HISTORY_BODY_KINDS = /* @__PURE__ */ new Set(["page.content", "card.description"]);
|
|
28543
|
+
var HISTORY_LONG_KINDS = /* @__PURE__ */ new Set([...HISTORY_BODY_KINDS, "comment.body"]);
|
|
28523
28544
|
var HISTORY_DAYS = 30;
|
|
28524
28545
|
|
|
28525
28546
|
// ../../packages/shared/src/uploads.ts
|
|
@@ -29796,7 +29817,7 @@ __name(sql, "sql");
|
|
|
29796
29817
|
}
|
|
29797
29818
|
__name(raw2, "raw");
|
|
29798
29819
|
sql2.raw = raw2;
|
|
29799
|
-
function
|
|
29820
|
+
function join2(chunks, separator) {
|
|
29800
29821
|
const result = [];
|
|
29801
29822
|
for (const [i2, chunk] of chunks.entries()) {
|
|
29802
29823
|
if (i2 > 0 && separator !== void 0) {
|
|
@@ -29806,8 +29827,8 @@ __name(sql, "sql");
|
|
|
29806
29827
|
}
|
|
29807
29828
|
return new SQL(result);
|
|
29808
29829
|
}
|
|
29809
|
-
__name(
|
|
29810
|
-
sql2.join =
|
|
29830
|
+
__name(join2, "join");
|
|
29831
|
+
sql2.join = join2;
|
|
29811
29832
|
function identifier(value) {
|
|
29812
29833
|
return new Name(value);
|
|
29813
29834
|
}
|
|
@@ -32656,7 +32677,7 @@ var SQLiteSelectQueryBuilderBase = class extends TypedQueryBuilder {
|
|
|
32656
32677
|
const baseTableName = this.tableName;
|
|
32657
32678
|
const tableName = getTableLikeName(table);
|
|
32658
32679
|
for (const item of extractUsedTable(table)) this.usedTables.add(item);
|
|
32659
|
-
if (typeof tableName === "string" && this.config.joins?.some((
|
|
32680
|
+
if (typeof tableName === "string" && this.config.joins?.some((join2) => join2.alias === tableName)) {
|
|
32660
32681
|
throw new Error(`Alias "${tableName}" is already used in this query`);
|
|
32661
32682
|
}
|
|
32662
32683
|
if (!this.isPartialSelect) {
|
|
@@ -33536,7 +33557,7 @@ var SQLiteUpdateBase = class extends QueryPromise {
|
|
|
33536
33557
|
createJoin(joinType) {
|
|
33537
33558
|
return (table, on) => {
|
|
33538
33559
|
const tableName = getTableLikeName(table);
|
|
33539
|
-
if (typeof tableName === "string" && this.config.joins.some((
|
|
33560
|
+
if (typeof tableName === "string" && this.config.joins.some((join2) => join2.alias === tableName)) {
|
|
33540
33561
|
throw new Error(`Alias "${tableName}" is already used in this query`);
|
|
33541
33562
|
}
|
|
33542
33563
|
if (typeof on === "function") {
|
|
@@ -36654,6 +36675,7 @@ __export(schema_exports, {
|
|
|
36654
36675
|
apiTokens: () => apiTokens,
|
|
36655
36676
|
attachments: () => attachments,
|
|
36656
36677
|
boards: () => boards,
|
|
36678
|
+
cardComments: () => cardComments,
|
|
36657
36679
|
cardLabels: () => cardLabels,
|
|
36658
36680
|
cardPageLinks: () => cardPageLinks,
|
|
36659
36681
|
cards: () => cards,
|
|
@@ -36912,6 +36934,27 @@ var checklistItems = sqliteTable(
|
|
|
36912
36934
|
},
|
|
36913
36935
|
(t) => [index2("checklist_items_checklist_idx").on(t.checklistId)]
|
|
36914
36936
|
);
|
|
36937
|
+
var cardComments = sqliteTable(
|
|
36938
|
+
"card_comments",
|
|
36939
|
+
{
|
|
36940
|
+
id: id2(),
|
|
36941
|
+
workspaceId: text("workspace_id").notNull().references(() => workspaces.id, { onDelete: "cascade" }),
|
|
36942
|
+
cardId: text("card_id").notNull().references(() => cards.id, { onDelete: "cascade" }),
|
|
36943
|
+
/** Markdown, up to MAX_COMMENT characters. */
|
|
36944
|
+
body: text("body").notNull(),
|
|
36945
|
+
authorKind: text("author_kind", { enum: ["user", "agent"] }).notNull(),
|
|
36946
|
+
/** Set for a person's comments only. */
|
|
36947
|
+
authorUserId: text("author_user_id").references(() => users.id, { onDelete: "set null" }),
|
|
36948
|
+
/** Set for an agent's comments only. */
|
|
36949
|
+
authorTokenId: text("author_token_id").references(() => apiTokens.id, { onDelete: "set null" }),
|
|
36950
|
+
authorName: text("author_name").notNull(),
|
|
36951
|
+
createdAt: createdAt(),
|
|
36952
|
+
updatedAt: updatedAt(),
|
|
36953
|
+
/** When its text last changed; null while it is as written. */
|
|
36954
|
+
editedAt: timestamp("edited_at")
|
|
36955
|
+
},
|
|
36956
|
+
(t) => [index2("card_comments_card_idx").on(t.cardId, t.createdAt), index2("card_comments_token_idx").on(t.authorTokenId)]
|
|
36957
|
+
);
|
|
36915
36958
|
var pages = sqliteTable(
|
|
36916
36959
|
"pages",
|
|
36917
36960
|
{
|
|
@@ -38713,7 +38756,7 @@ var PageService = class {
|
|
|
38713
38756
|
const valid = db.select({ id: cards.id }).from(cards).where(and(inList(cards.id, referenced.slice(0, 200)), eq(cards.workspaceId, page.workspaceId))).all();
|
|
38714
38757
|
if (valid.length === 0) return;
|
|
38715
38758
|
const links = valid.map((c) => ({ cardId: c.id, pageId: page.id, workspaceId: page.workspaceId, source: "mention" }));
|
|
38716
|
-
for (const
|
|
38759
|
+
for (const group2 of inGroups(cardPageLinks, links)) db.insert(cardPageLinks).values(group2).onConflictDoNothing().run();
|
|
38717
38760
|
}
|
|
38718
38761
|
};
|
|
38719
38762
|
|
|
@@ -38736,6 +38779,7 @@ var UNINSTALL_ORDER = [
|
|
|
38736
38779
|
cardLabels,
|
|
38737
38780
|
checklistItems,
|
|
38738
38781
|
checklists,
|
|
38782
|
+
cardComments,
|
|
38739
38783
|
cardPageLinks,
|
|
38740
38784
|
attachments,
|
|
38741
38785
|
activity,
|
|
@@ -39535,12 +39579,23 @@ function createApi(env) {
|
|
|
39535
39579
|
async (c) => c.json(await c.get("services").cards.updateItem(requireActor(c), c.req.param("id"), await json2(c)))
|
|
39536
39580
|
);
|
|
39537
39581
|
api.delete("/checklist-items/:id", async (c) => c.json({ trashId: await c.get("services").cards.removeItem(requireActor(c), c.req.param("id")) }));
|
|
39582
|
+
api.get("/cards/:id/comments", async (c) => c.json(await c.get("services").comments.list(requireActor(c), c.req.param("id"), historyPage(c))));
|
|
39583
|
+
api.post("/cards/:id/comments", async (c) => c.json(await c.get("services").comments.create(requireActor(c), c.req.param("id"), await json2(c)), 201));
|
|
39584
|
+
api.patch("/comments/:id", async (c) => c.json(await c.get("services").comments.update(requireActor(c), c.req.param("id"), await json2(c))));
|
|
39585
|
+
api.delete("/comments/:id", async (c) => c.json({ trashId: await c.get("services").comments.remove(requireActor(c), c.req.param("id")) }));
|
|
39538
39586
|
api.post("/cards/:id/pages", async (c) => {
|
|
39539
39587
|
await c.get("services").cards.linkPage(requireActor(c), c.req.param("id"), await json2(c));
|
|
39540
39588
|
return c.body(null, 204);
|
|
39541
39589
|
});
|
|
39542
39590
|
api.delete("/cards/:id/pages/:pageId", async (c) => c.json({ trashId: await c.get("services").cards.unlinkPage(requireActor(c), c.req.param("id"), c.req.param("pageId")) }));
|
|
39543
39591
|
api.get("/pages/:id", async (c) => c.json(await c.get("services").pages.get(requireActor(c), c.req.param("id"))));
|
|
39592
|
+
api.get("/pages/:id/download", async (c) => {
|
|
39593
|
+
const origin = endpointFor(c.get("config"), c.req.url).issuer;
|
|
39594
|
+
const { body, filename, type } = await c.get("services").export.page(requireActor(c), c.req.param("id"), { subpages: c.req.query("subpages") === "1", origin });
|
|
39595
|
+
return new Response(body, {
|
|
39596
|
+
headers: { "Content-Type": type, "Content-Disposition": contentDisposition("attachment", filename), "Cache-Control": "no-store", "X-Content-Type-Options": "nosniff" }
|
|
39597
|
+
});
|
|
39598
|
+
});
|
|
39544
39599
|
api.get("/pages/:id/history", async (c) => c.json(await c.get("services").history.list(requireActor(c), "page", c.req.param("id"), historyPage(c))));
|
|
39545
39600
|
api.patch("/pages/:id", async (c) => c.json(await c.get("services").pages.update(requireActor(c), c.req.param("id"), await json2(c))));
|
|
39546
39601
|
api.post("/pages/:id/move", async (c) => {
|
|
@@ -50281,7 +50336,7 @@ var EMPTY_COMPLETION_RESULT = {
|
|
|
50281
50336
|
};
|
|
50282
50337
|
|
|
50283
50338
|
// src/version.ts
|
|
50284
|
-
var VERSION = "1.
|
|
50339
|
+
var VERSION = "1.4.1";
|
|
50285
50340
|
|
|
50286
50341
|
// src/mcp/server.ts
|
|
50287
50342
|
var MCP_SERVER_NAME = "orqevio";
|
|
@@ -50299,6 +50354,7 @@ How to work with it:
|
|
|
50299
50354
|
- To reference a card inside a document write a Markdown link: [Card title](/card/<card_id>). To reference a page: [Page title](/doc/<page_id>). Card references inside a page automatically link that card to the page.
|
|
50300
50355
|
- update_page with mode "replace" should include base_version (from read_page) to avoid overwriting someone else's edits. Use mode "append" to add content safely.
|
|
50301
50356
|
- Likewise, update_card with a description should include base_version (the version from get_card).
|
|
50357
|
+
- To leave a note for people on a card (progress, a question, a result), use add_comment rather than editing its description. get_card shows the latest comments; list_comments pages through older ones. You can change or delete only the comments written with this same access.
|
|
50302
50358
|
- Every change is recorded in the history of its card or page, and people can undo it from there.
|
|
50303
50359
|
- When a card is done or no longer needed, prefer archive_card: it leaves the board but stays findable. Delete what was a mistake or a duplicate.
|
|
50304
50360
|
- Tokens allowed to delete and move also have delete_* tools, move_attachment and move_card to another board. Deleting always moves things to the trash, where a person can bring them back for ${TRASH_DAYS} days. Agents can never empty the trash or delete anything for good.
|
|
@@ -50330,6 +50386,7 @@ async function readAll(body, max2) {
|
|
|
50330
50386
|
}
|
|
50331
50387
|
__name(readAll, "readAll");
|
|
50332
50388
|
var attachmentSummary = /* @__PURE__ */ __name((a) => ({ id: a.id, name: a.filename, type: a.mimeType, size: a.size }), "attachmentSummary");
|
|
50389
|
+
var CARD_COMMENTS = 10;
|
|
50333
50390
|
var dueDate = external_exports.string().describe("Due date: the day as YYYY-MM-DD (a full ISO 8601 date-time also works; its date is the day). Use null to clear it.");
|
|
50334
50391
|
function normaliseDue(value) {
|
|
50335
50392
|
if (value === void 0 || value === null) return value;
|
|
@@ -50366,6 +50423,16 @@ function createMcpServer(services, actor) {
|
|
|
50366
50423
|
const canWriteDocs = hasScope(actor, "docs:write");
|
|
50367
50424
|
const canOrganize = hasScope(actor, "organize") && (canWriteTasks || canWriteDocs);
|
|
50368
50425
|
const ws = actor.workspaceId;
|
|
50426
|
+
const commentSummary = /* @__PURE__ */ __name((c) => ({
|
|
50427
|
+
id: c.id,
|
|
50428
|
+
author: c.author.name,
|
|
50429
|
+
author_kind: c.author.kind,
|
|
50430
|
+
/** Written with this access: only those can it change or delete. */
|
|
50431
|
+
yours: c.author.kind === "agent" && c.author.id === actor.tokenId,
|
|
50432
|
+
body: c.body,
|
|
50433
|
+
created_at: c.createdAt,
|
|
50434
|
+
edited_at: c.editedAt
|
|
50435
|
+
}), "commentSummary");
|
|
50369
50436
|
server.registerTool(
|
|
50370
50437
|
"list_projects",
|
|
50371
50438
|
{
|
|
@@ -50395,7 +50462,7 @@ function createMcpServer(services, actor) {
|
|
|
50395
50462
|
"search",
|
|
50396
50463
|
{
|
|
50397
50464
|
title: "Search",
|
|
50398
|
-
description: "Full-text search across card titles
|
|
50465
|
+
description: "Full-text search across card titles, descriptions and comments, and page titles and contents, in the workspace.",
|
|
50399
50466
|
inputSchema: {
|
|
50400
50467
|
query: external_exports.string().min(1).max(100),
|
|
50401
50468
|
type: external_exports.enum(["all", "cards", "pages"]).default("all"),
|
|
@@ -50407,7 +50474,17 @@ function createMcpServer(services, actor) {
|
|
|
50407
50474
|
const types = type === "cards" ? ["card"] : type === "pages" ? ["page"] : void 0;
|
|
50408
50475
|
const results = await services.search.search(actor, ws, query, { types: types ? [...types] : void 0, limit: 15, archived: include_archived });
|
|
50409
50476
|
return results.map(
|
|
50410
|
-
(r) => r.type === "card" ? {
|
|
50477
|
+
(r) => r.type === "card" ? {
|
|
50478
|
+
type: "card",
|
|
50479
|
+
id: r.id,
|
|
50480
|
+
title: r.title,
|
|
50481
|
+
board: r.boardName,
|
|
50482
|
+
board_id: r.boardId,
|
|
50483
|
+
column: r.columnName,
|
|
50484
|
+
excerpt: r.excerpt,
|
|
50485
|
+
...r.comment ? { in_comment: { comment_id: r.comment.id, author: r.comment.author } } : {},
|
|
50486
|
+
...r.archived ? { archived: true } : {}
|
|
50487
|
+
} : { type: "page", id: r.id, title: r.title || "Untitled", project: r.projectName, excerpt: r.excerpt }
|
|
50411
50488
|
);
|
|
50412
50489
|
})
|
|
50413
50490
|
);
|
|
@@ -50420,7 +50497,7 @@ function createMcpServer(services, actor) {
|
|
|
50420
50497
|
inputSchema: {
|
|
50421
50498
|
name: external_exports.string().min(1).max(80),
|
|
50422
50499
|
description: external_exports.string().max(500).optional(),
|
|
50423
|
-
color: external_exports.enum(PALETTE).optional()
|
|
50500
|
+
color: external_exports.union([external_exports.enum(PALETTE), external_exports.string().regex(/^#[0-9a-fA-F]{6}$/)]).optional().describe(`One of ${PALETTE.join(", ")}, or a color of its own as #rrggbb (to keep a color from another tool). Cobalt if left out.`)
|
|
50424
50501
|
},
|
|
50425
50502
|
annotations: WRITE
|
|
50426
50503
|
},
|
|
@@ -50456,7 +50533,8 @@ function createMcpServer(services, actor) {
|
|
|
50456
50533
|
due: card.dueAt,
|
|
50457
50534
|
labels: card.labelIds.map((id3) => labelName.get(id3) ?? id3),
|
|
50458
50535
|
checklist: card.checklist.total ? `${card.checklist.done}/${card.checklist.total}` : null,
|
|
50459
|
-
linked_pages: card.linkedPages
|
|
50536
|
+
linked_pages: card.linkedPages,
|
|
50537
|
+
comments: card.comments
|
|
50460
50538
|
}))
|
|
50461
50539
|
}))
|
|
50462
50540
|
};
|
|
@@ -50466,12 +50544,12 @@ function createMcpServer(services, actor) {
|
|
|
50466
50544
|
"get_card",
|
|
50467
50545
|
{
|
|
50468
50546
|
title: "Get card",
|
|
50469
|
-
description:
|
|
50547
|
+
description: `Returns a card in full: Markdown description and its version, labels, due date, checklists (with item ids), linked pages, attachments, its latest ${CARD_COMMENTS} comments (newest first; list_comments gives older ones) and recent activity.`,
|
|
50470
50548
|
inputSchema: { card_id: uuid3 },
|
|
50471
50549
|
annotations: READ
|
|
50472
50550
|
},
|
|
50473
50551
|
({ card_id }) => run(async () => {
|
|
50474
|
-
const card = await services.cards.detail(actor, card_id);
|
|
50552
|
+
const [card, comments] = await Promise.all([services.cards.detail(actor, card_id), services.comments.list(actor, card_id, { limit: CARD_COMMENTS })]);
|
|
50475
50553
|
return {
|
|
50476
50554
|
id: card.id,
|
|
50477
50555
|
title: card.title,
|
|
@@ -50489,10 +50567,32 @@ function createMcpServer(services, actor) {
|
|
|
50489
50567
|
})),
|
|
50490
50568
|
linked_pages: card.pages.map((p) => ({ id: p.id, title: p.title || "Untitled" })),
|
|
50491
50569
|
attachments: card.attachmentList.map(attachmentSummary),
|
|
50570
|
+
comments: { total: comments.total, latest: comments.comments.map(commentSummary), more: comments.hasMore },
|
|
50492
50571
|
recent_activity: card.activity.slice(0, 10).map((a) => ({ action: a.action, by: a.actor.name, at: a.createdAt }))
|
|
50493
50572
|
};
|
|
50494
50573
|
})
|
|
50495
50574
|
);
|
|
50575
|
+
server.registerTool(
|
|
50576
|
+
"list_comments",
|
|
50577
|
+
{
|
|
50578
|
+
title: "List comments",
|
|
50579
|
+
description: "Lists the comments on a card, newest first, a page at a time. For the next (older) page, pass the next_before of this one as before.",
|
|
50580
|
+
inputSchema: {
|
|
50581
|
+
card_id: uuid3,
|
|
50582
|
+
before: external_exports.string().max(100).optional().describe("The next_before of the previous page: list the comments written before its last one."),
|
|
50583
|
+
limit: external_exports.number().int().min(1).max(50).default(20)
|
|
50584
|
+
},
|
|
50585
|
+
annotations: READ
|
|
50586
|
+
},
|
|
50587
|
+
({ card_id, before, limit: limit2 }) => run(async () => {
|
|
50588
|
+
const cursor = before === void 0 ? void 0 : /^(.+)\|([0-9a-f-]{36})$/i.exec(before);
|
|
50589
|
+
const at = cursor ? new Date(cursor[1]) : void 0;
|
|
50590
|
+
if (before !== void 0 && (!cursor || Number.isNaN(at.getTime()))) throw new AppError(400, "bad_request", "before must be the next_before of a previous page.");
|
|
50591
|
+
const page = await services.comments.list(actor, card_id, { before: at, beforeId: cursor?.[2], limit: limit2 });
|
|
50592
|
+
const last = page.comments.at(-1);
|
|
50593
|
+
return { total: page.total, comments: page.comments.map(commentSummary), next_before: page.hasMore && last ? `${last.createdAt}|${last.id}` : null };
|
|
50594
|
+
})
|
|
50595
|
+
);
|
|
50496
50596
|
}
|
|
50497
50597
|
if (canWriteTasks) {
|
|
50498
50598
|
server.registerTool(
|
|
@@ -50674,6 +50774,32 @@ function createMcpServer(services, actor) {
|
|
|
50674
50774
|
return { updated: true, item_id: item.id, done: item.done };
|
|
50675
50775
|
})
|
|
50676
50776
|
);
|
|
50777
|
+
server.registerTool(
|
|
50778
|
+
"add_comment",
|
|
50779
|
+
{
|
|
50780
|
+
title: "Add comment",
|
|
50781
|
+
description: `Adds a comment to a card, signed with this access's name, for people to read: progress, a question, a result. body is Markdown, up to ${MAX_COMMENT} characters.`,
|
|
50782
|
+
inputSchema: { card_id: uuid3, body: external_exports.string().min(1).max(MAX_COMMENT) },
|
|
50783
|
+
annotations: WRITE
|
|
50784
|
+
},
|
|
50785
|
+
({ card_id, body }) => run(async () => {
|
|
50786
|
+
const comment = await services.comments.create(actor, card_id, { body });
|
|
50787
|
+
return { created: true, comment_id: comment.id };
|
|
50788
|
+
})
|
|
50789
|
+
);
|
|
50790
|
+
server.registerTool(
|
|
50791
|
+
"update_comment",
|
|
50792
|
+
{
|
|
50793
|
+
title: "Update comment",
|
|
50794
|
+
description: `Replaces the text of a comment written with this access (others' comments, and those written with an earlier access, can't be changed). body is Markdown, up to ${MAX_COMMENT} characters.`,
|
|
50795
|
+
inputSchema: { comment_id: uuid3, body: external_exports.string().min(1).max(MAX_COMMENT) },
|
|
50796
|
+
annotations: { ...WRITE, idempotentHint: true }
|
|
50797
|
+
},
|
|
50798
|
+
({ comment_id, body }) => run(async () => {
|
|
50799
|
+
const comment = await services.comments.update(actor, comment_id, { body });
|
|
50800
|
+
return { updated: true, comment_id: comment.id, edited_at: comment.editedAt };
|
|
50801
|
+
})
|
|
50802
|
+
);
|
|
50677
50803
|
}
|
|
50678
50804
|
if (canReadDocs) {
|
|
50679
50805
|
server.registerTool(
|
|
@@ -50848,12 +50974,13 @@ function createMcpServer(services, actor) {
|
|
|
50848
50974
|
(args) => run(async () => ({ deleted: true, trash_id: await fn(args) }))
|
|
50849
50975
|
), "remove");
|
|
50850
50976
|
if (canWriteTasks) {
|
|
50851
|
-
remove("delete_card", "Delete card", "Moves a card to the trash, with its checklists, links and attachments.", { card_id: uuid3 }, (a) => services.cards.remove(actor, a.card_id));
|
|
50977
|
+
remove("delete_card", "Delete card", "Moves a card to the trash, with its checklists, comments, links and attachments.", { card_id: uuid3 }, (a) => services.cards.remove(actor, a.card_id));
|
|
50852
50978
|
remove("delete_board", "Delete board", "Moves a board to the trash, with its columns and cards.", { board_id: uuid3 }, (a) => services.boards.remove(actor, a.board_id));
|
|
50853
50979
|
remove("delete_column", "Delete column", "Moves a column to the trash, with all its cards.", { column_id: uuid3 }, (a) => services.boards.removeColumn(actor, a.column_id));
|
|
50854
50980
|
remove("delete_label", "Delete label", "Moves a label of a board to the trash; it comes off every card that had it.", { label_id: uuid3 }, (a) => services.boards.removeLabel(actor, a.label_id));
|
|
50855
50981
|
remove("delete_checklist", "Delete checklist", "Moves a checklist of a card to the trash, with its items.", { checklist_id: uuid3 }, (a) => services.cards.removeChecklist(actor, a.checklist_id));
|
|
50856
50982
|
remove("delete_checklist_item", "Delete checklist item", "Moves a checklist item to the trash.", { item_id: uuid3 }, (a) => services.cards.removeItem(actor, a.item_id));
|
|
50983
|
+
remove("delete_comment", "Delete comment", "Moves a comment written with this access to the trash (others' comments can't be deleted).", { comment_id: uuid3 }, (a) => services.comments.remove(actor, a.comment_id));
|
|
50857
50984
|
}
|
|
50858
50985
|
if (canWriteDocs) {
|
|
50859
50986
|
remove("delete_page", "Delete page", "Moves a page to the trash, with its sub-pages and attachments.", { page_id: uuid3 }, (a) => services.pages.remove(actor, a.page_id));
|
|
@@ -52935,7 +53062,7 @@ var CardService = class {
|
|
|
52935
53062
|
async summarize(rows, db = this.deps.db) {
|
|
52936
53063
|
if (rows.length === 0) return [];
|
|
52937
53064
|
const ids = rows.map((r) => r.id);
|
|
52938
|
-
const [labelRows, checklistRows, linkRows, attachmentRows, creators] = await Promise.all([
|
|
53065
|
+
const [labelRows, checklistRows, linkRows, attachmentRows, commentRows, creators] = await Promise.all([
|
|
52939
53066
|
db.select().from(cardLabels).where(inList(cardLabels.cardId, ids)),
|
|
52940
53067
|
db.select({
|
|
52941
53068
|
cardId: checklists.cardId,
|
|
@@ -52944,6 +53071,7 @@ var CardService = class {
|
|
|
52944
53071
|
}).from(checklists).leftJoin(checklistItems, eq(checklistItems.checklistId, checklists.id)).where(inList(checklists.cardId, ids)).groupBy(checklists.cardId),
|
|
52945
53072
|
db.select({ cardId: cardPageLinks.cardId, total: sql`count(distinct ${cardPageLinks.pageId})` }).from(cardPageLinks).where(inList(cardPageLinks.cardId, ids)).groupBy(cardPageLinks.cardId),
|
|
52946
53073
|
db.select({ cardId: attachments.cardId, total: sql`count(*)` }).from(attachments).where(inList(attachments.cardId, ids)).groupBy(attachments.cardId),
|
|
53074
|
+
db.select({ cardId: cardComments.cardId, total: sql`count(*)` }).from(cardComments).where(inList(cardComments.cardId, ids)).groupBy(cardComments.cardId),
|
|
52947
53075
|
this.creatorNames(rows, db)
|
|
52948
53076
|
]);
|
|
52949
53077
|
return rows.map((card) => {
|
|
@@ -52961,6 +53089,7 @@ var CardService = class {
|
|
|
52961
53089
|
checklist: { done: progress?.done ?? 0, total: progress?.total ?? 0 },
|
|
52962
53090
|
linkedPages: linkRows.find((l) => l.cardId === card.id)?.total ?? 0,
|
|
52963
53091
|
attachments: attachmentRows.find((a) => a.cardId === card.id)?.total ?? 0,
|
|
53092
|
+
comments: commentRows.find((c) => c.cardId === card.id)?.total ?? 0,
|
|
52964
53093
|
createdBy: creators.get(card.id) ?? null,
|
|
52965
53094
|
createdAt: card.createdAt.toISOString(),
|
|
52966
53095
|
updatedAt: card.updatedAt.toISOString(),
|
|
@@ -53017,6 +53146,7 @@ var CardService = class {
|
|
|
53017
53146
|
checklists: checklistData,
|
|
53018
53147
|
pages: [...linked.values()],
|
|
53019
53148
|
attachmentList: files.map(toAttachmentDTO),
|
|
53149
|
+
commentCount: summary.comments,
|
|
53020
53150
|
// Without docs:read, not even the titles of the pages it was linked to.
|
|
53021
53151
|
activity: hasScope(actor, "docs:read") ? history2 : history2.map((entry) => ({ ...entry, meta: Object.fromEntries(Object.entries(entry.meta).filter(([key]) => key !== "page")) }))
|
|
53022
53152
|
};
|
|
@@ -53209,7 +53339,7 @@ var CardService = class {
|
|
|
53209
53339
|
{ boardId: card.boardId, cardId, structure: true }
|
|
53210
53340
|
);
|
|
53211
53341
|
}
|
|
53212
|
-
/** Moves the card to the trash, with its checklists, labels, links and attachments. */
|
|
53342
|
+
/** Moves the card to the trash, with its checklists, comments, labels, links and attachments. */
|
|
53213
53343
|
async remove(actor, cardId) {
|
|
53214
53344
|
this.access.requireScope(actor, "organize");
|
|
53215
53345
|
const card = await this.load(actor, cardId, "tasks:write");
|
|
@@ -53443,7 +53573,7 @@ var BoardService = class {
|
|
|
53443
53573
|
const b = tx.insert(boards).values({ workspaceId: project.workspaceId, projectId, name: data.name, position: position2 }).returning().get();
|
|
53444
53574
|
const keys = evenlySpacedKeys(columnNames.length);
|
|
53445
53575
|
const rows = columnNames.map((name2, i2) => ({ workspaceId: project.workspaceId, boardId: b.id, name: name2, position: keys[i2] }));
|
|
53446
|
-
for (const
|
|
53576
|
+
for (const group2 of inGroups(columns, rows)) tx.insert(columns).values(group2).run();
|
|
53447
53577
|
return b;
|
|
53448
53578
|
});
|
|
53449
53579
|
await this.activity.record(
|
|
@@ -53623,6 +53753,143 @@ var BoardService = class {
|
|
|
53623
53753
|
}
|
|
53624
53754
|
};
|
|
53625
53755
|
|
|
53756
|
+
// src/services/comments.ts
|
|
53757
|
+
var isAuthor = /* @__PURE__ */ __name((actor, row) => actor.kind === "agent" ? row.authorKind === "agent" && row.authorTokenId === actor.tokenId : row.authorKind === "user" && row.authorUserId === actor.userId, "isAuthor");
|
|
53758
|
+
var CommentService = class {
|
|
53759
|
+
constructor(deps, access, activity2, trash2, history2) {
|
|
53760
|
+
this.deps = deps;
|
|
53761
|
+
this.access = access;
|
|
53762
|
+
this.activity = activity2;
|
|
53763
|
+
this.trash = trash2;
|
|
53764
|
+
this.history = history2;
|
|
53765
|
+
}
|
|
53766
|
+
deps;
|
|
53767
|
+
access;
|
|
53768
|
+
activity;
|
|
53769
|
+
trash;
|
|
53770
|
+
history;
|
|
53771
|
+
static {
|
|
53772
|
+
__name(this, "CommentService");
|
|
53773
|
+
}
|
|
53774
|
+
/** The card, if the actor can reach it with `scope`, and whether they are its workspace's owner (a person). */
|
|
53775
|
+
async card(actor, cardId, scope) {
|
|
53776
|
+
this.access.requireScope(actor, scope);
|
|
53777
|
+
const [card] = await this.deps.db.select().from(cards).where(eq(cards.id, cardId));
|
|
53778
|
+
if (!card) throw notFound("Card");
|
|
53779
|
+
const role = await this.access.workspace(actor, card.workspaceId);
|
|
53780
|
+
return { card, owner: actor.kind === "user" && role === "owner" };
|
|
53781
|
+
}
|
|
53782
|
+
async load(actor, commentId, scope) {
|
|
53783
|
+
const [row] = await this.deps.db.select().from(cardComments).where(eq(cardComments.id, commentId));
|
|
53784
|
+
if (!row) throw notFound("Comment");
|
|
53785
|
+
const { card, owner } = await this.card(actor, row.cardId, scope).catch((error62) => {
|
|
53786
|
+
throw error62 instanceof AppError && error62.status === 404 ? notFound("Comment") : error62;
|
|
53787
|
+
});
|
|
53788
|
+
return { row, card, owner };
|
|
53789
|
+
}
|
|
53790
|
+
toDTO(actor, row, owner) {
|
|
53791
|
+
const mine = isAuthor(actor, row);
|
|
53792
|
+
return {
|
|
53793
|
+
id: row.id,
|
|
53794
|
+
cardId: row.cardId,
|
|
53795
|
+
body: row.body,
|
|
53796
|
+
author: { kind: row.authorKind, id: (row.authorKind === "agent" ? row.authorTokenId : row.authorUserId) ?? "", name: row.authorName },
|
|
53797
|
+
createdAt: row.createdAt.toISOString(),
|
|
53798
|
+
updatedAt: row.updatedAt.toISOString(),
|
|
53799
|
+
editedAt: row.editedAt?.toISOString() ?? null,
|
|
53800
|
+
canEdit: mine && hasScope(actor, "tasks:write"),
|
|
53801
|
+
// An agent deletes only with leave to delete things, as anything else it deletes.
|
|
53802
|
+
canDelete: mine && hasScope(actor, "tasks:write") && hasScope(actor, "organize") || owner
|
|
53803
|
+
};
|
|
53804
|
+
}
|
|
53805
|
+
/** Records a change in the card's history; run it in the transaction that makes the change. */
|
|
53806
|
+
change(db, actor, card, change) {
|
|
53807
|
+
this.history.record(db, actor, card.workspaceId, { entityType: "card", entityId: card.id, ...change });
|
|
53808
|
+
}
|
|
53809
|
+
/**
|
|
53810
|
+
* A card's comments, newest first, a page at a time: after the comment `beforeId`, written at
|
|
53811
|
+
* `before`, when given (the last of the page before). `beforeId` alone is enough.
|
|
53812
|
+
*/
|
|
53813
|
+
async list(actor, cardId, page = {}) {
|
|
53814
|
+
const { owner } = await this.card(actor, cardId, "tasks:read");
|
|
53815
|
+
const db = this.deps.db;
|
|
53816
|
+
const limit2 = Math.min(Math.max(1, Math.floor(page.limit ?? COMMENTS_PAGE)), COMMENTS_PAGE);
|
|
53817
|
+
let before = page.before;
|
|
53818
|
+
if (page.beforeId && !before) {
|
|
53819
|
+
const [from] = await db.select({ createdAt: cardComments.createdAt }).from(cardComments).where(and(eq(cardComments.id, page.beforeId), eq(cardComments.cardId, cardId)));
|
|
53820
|
+
if (!from) throw notFound("Comment");
|
|
53821
|
+
before = from.createdAt;
|
|
53822
|
+
}
|
|
53823
|
+
const after = before && page.beforeId ? or(lt(cardComments.createdAt, before), and(eq(cardComments.createdAt, before), lt(cardComments.id, page.beforeId))) : before ? lt(cardComments.createdAt, before) : void 0;
|
|
53824
|
+
const [rows, [total]] = await Promise.all([
|
|
53825
|
+
db.select().from(cardComments).where(and(eq(cardComments.cardId, cardId), after)).orderBy(desc(cardComments.createdAt), desc(cardComments.id)).limit(limit2 + 1),
|
|
53826
|
+
db.select({ total: count() }).from(cardComments).where(eq(cardComments.cardId, cardId))
|
|
53827
|
+
]);
|
|
53828
|
+
return { comments: rows.slice(0, limit2).map((row) => this.toDTO(actor, row, owner)), total: total?.total ?? 0, hasMore: rows.length > limit2 };
|
|
53829
|
+
}
|
|
53830
|
+
async create(actor, cardId, input2) {
|
|
53831
|
+
const { body } = parse3(commentCreateInput, input2);
|
|
53832
|
+
const { card, owner } = await this.card(actor, cardId, "tasks:write");
|
|
53833
|
+
const now = /* @__PURE__ */ new Date();
|
|
53834
|
+
const row = this.deps.db.transaction((tx) => {
|
|
53835
|
+
const row2 = tx.insert(cardComments).values({
|
|
53836
|
+
workspaceId: card.workspaceId,
|
|
53837
|
+
cardId,
|
|
53838
|
+
body,
|
|
53839
|
+
authorKind: actor.kind,
|
|
53840
|
+
authorUserId: actor.kind === "user" ? actor.userId : null,
|
|
53841
|
+
authorTokenId: actor.kind === "agent" ? actor.tokenId : null,
|
|
53842
|
+
authorName: actor.name,
|
|
53843
|
+
createdAt: now,
|
|
53844
|
+
updatedAt: now
|
|
53845
|
+
}).returning().get();
|
|
53846
|
+
this.change(tx, actor, card, { kind: "comment.created", subjectId: row2.id, meta: { text: commentExcerpt(body) } });
|
|
53847
|
+
return row2;
|
|
53848
|
+
});
|
|
53849
|
+
await this.activity.record(
|
|
53850
|
+
actor,
|
|
53851
|
+
card.workspaceId,
|
|
53852
|
+
{ action: "card.commented", entityType: "card", entityId: cardId, summary: card.title, meta: { commentId: row.id } },
|
|
53853
|
+
{ boardId: card.boardId, cardId }
|
|
53854
|
+
);
|
|
53855
|
+
return this.toDTO(actor, row, owner);
|
|
53856
|
+
}
|
|
53857
|
+
/** Changes a comment's text: only its author can, or undoing a change by the owner of the workspace. */
|
|
53858
|
+
async update(actor, commentId, input2) {
|
|
53859
|
+
const { body } = parse3(commentUpdateInput, input2);
|
|
53860
|
+
const { row, card, owner } = await this.load(actor, commentId, "tasks:write");
|
|
53861
|
+
const undoing = actor.kind === "user" && owner && actor.note?.undoOf !== void 0;
|
|
53862
|
+
if (!isAuthor(actor, row) && !undoing) throw forbidden("Only the author of a comment can change it.", "not_comment_author");
|
|
53863
|
+
if (body === row.body) return this.toDTO(actor, row, owner);
|
|
53864
|
+
const now = /* @__PURE__ */ new Date();
|
|
53865
|
+
const updated = this.deps.db.transaction((tx) => {
|
|
53866
|
+
const prev = tx.select({ body: cardComments.body }).from(cardComments).where(eq(cardComments.id, commentId)).get();
|
|
53867
|
+
if (!prev) throw notFound("Comment");
|
|
53868
|
+
const updated2 = tx.update(cardComments).set({ body, updatedAt: now, editedAt: now }).where(eq(cardComments.id, commentId)).returning().get();
|
|
53869
|
+
this.change(tx, actor, card, { kind: "comment.body", subjectId: commentId, before: prev.body, after: body, meta: { text: commentExcerpt(body) } });
|
|
53870
|
+
return updated2;
|
|
53871
|
+
});
|
|
53872
|
+
await this.activity.emit(card.workspaceId, { action: "card.comment_edited", actor: actorRef(actor), summary: card.title, boardId: card.boardId, cardId: card.id });
|
|
53873
|
+
return this.toDTO(actor, updated, owner);
|
|
53874
|
+
}
|
|
53875
|
+
/**
|
|
53876
|
+
* Moves a comment to the trash: its author can, an agent only with leave to delete things, and
|
|
53877
|
+
* the workspace's owner can delete anyone's.
|
|
53878
|
+
*/
|
|
53879
|
+
async remove(actor, commentId) {
|
|
53880
|
+
this.access.requireScope(actor, "organize");
|
|
53881
|
+
const { row, card, owner } = await this.load(actor, commentId, "tasks:write");
|
|
53882
|
+
if (!isAuthor(actor, row) && !owner) throw forbidden("Only the author of a comment, or the workspace's owner, can delete it.", "not_comment_author");
|
|
53883
|
+
const trashId = this.deps.db.transaction((tx) => {
|
|
53884
|
+
const trashId2 = this.trash.move(tx, actor, card.workspaceId, { kind: "comment", id: commentId });
|
|
53885
|
+
this.change(tx, actor, card, { kind: "comment.deleted", subjectId: commentId, meta: { text: commentExcerpt(row.body), trashId: trashId2 } });
|
|
53886
|
+
return trashId2;
|
|
53887
|
+
});
|
|
53888
|
+
await this.activity.emit(card.workspaceId, { action: "card.comment_deleted", actor: actorRef(actor), summary: card.title, boardId: card.boardId, cardId: card.id });
|
|
53889
|
+
return trashId;
|
|
53890
|
+
}
|
|
53891
|
+
};
|
|
53892
|
+
|
|
53626
53893
|
// src/lib/zip.ts
|
|
53627
53894
|
var MAX32 = 4294967295;
|
|
53628
53895
|
var MAX16 = 65535;
|
|
@@ -53959,6 +54226,81 @@ function outsideInlineCode(text2, change) {
|
|
|
53959
54226
|
__name(outsideInlineCode, "outsideInlineCode");
|
|
53960
54227
|
var iso = /* @__PURE__ */ __name((date5) => date5 ? date5.toISOString() : null, "iso");
|
|
53961
54228
|
var day = /* @__PURE__ */ __name((date5) => date5 ? date5.toISOString().slice(0, 10) : null, "day");
|
|
54229
|
+
var EXISTS_AT_ONCE = 8;
|
|
54230
|
+
function group(rows, key) {
|
|
54231
|
+
const groups = /* @__PURE__ */ new Map();
|
|
54232
|
+
for (const row of rows) {
|
|
54233
|
+
const bucket = groups.get(key(row));
|
|
54234
|
+
if (bucket) bucket.push(row);
|
|
54235
|
+
else groups.set(key(row), [row]);
|
|
54236
|
+
}
|
|
54237
|
+
return (k) => groups.get(k) ?? [];
|
|
54238
|
+
}
|
|
54239
|
+
__name(group, "group");
|
|
54240
|
+
var join = /* @__PURE__ */ __name((folder, name2) => folder ? `${folder}/${name2}` : name2, "join");
|
|
54241
|
+
function folderNamers() {
|
|
54242
|
+
const names = /* @__PURE__ */ new Map();
|
|
54243
|
+
return (folder) => {
|
|
54244
|
+
let namer_ = names.get(folder);
|
|
54245
|
+
if (!namer_) names.set(folder, namer_ = namer());
|
|
54246
|
+
return namer_;
|
|
54247
|
+
};
|
|
54248
|
+
}
|
|
54249
|
+
__name(folderNamers, "folderNamers");
|
|
54250
|
+
function pageLayout(pageRows, withFiles, namesIn) {
|
|
54251
|
+
const pagePath = /* @__PURE__ */ new Map();
|
|
54252
|
+
const filesFolder = /* @__PURE__ */ new Map();
|
|
54253
|
+
const byParent = group(pageRows, (page) => page.parentId ?? `project:${page.projectId}`);
|
|
54254
|
+
const place = /* @__PURE__ */ __name((page, folder) => {
|
|
54255
|
+
const names = namesIn(folder);
|
|
54256
|
+
const stem = names(safeName(page.title), [".md", ""]);
|
|
54257
|
+
pagePath.set(page.id, join(folder, `${stem}.md`));
|
|
54258
|
+
if (withFiles.has(page.id)) filesFolder.set(page.id, join(folder, names(`${stem} (files)`)));
|
|
54259
|
+
return join(folder, stem);
|
|
54260
|
+
}, "place");
|
|
54261
|
+
const placeUnder = /* @__PURE__ */ __name((key, folder) => {
|
|
54262
|
+
const pending = [{ key, folder }];
|
|
54263
|
+
while (pending.length) {
|
|
54264
|
+
const next = pending.pop();
|
|
54265
|
+
for (const page of byParent(next.key)) {
|
|
54266
|
+
if (pagePath.has(page.id)) continue;
|
|
54267
|
+
pending.push({ key: page.id, folder: place(page, next.folder) });
|
|
54268
|
+
}
|
|
54269
|
+
}
|
|
54270
|
+
}, "placeUnder");
|
|
54271
|
+
return { pagePath, filesFolder, byParent, place, placeUnder };
|
|
54272
|
+
}
|
|
54273
|
+
__name(pageLayout, "pageLayout");
|
|
54274
|
+
function placeFile(file2, folder, namesIn) {
|
|
54275
|
+
const dot = file2.filename.lastIndexOf(".");
|
|
54276
|
+
const stem = dot > 0 ? file2.filename.slice(0, dot) : file2.filename;
|
|
54277
|
+
const ending = dot > 0 ? cleanName2(file2.filename.slice(dot + 1), 16) : "";
|
|
54278
|
+
const extension = ending ? `.${ending}` : "";
|
|
54279
|
+
return join(folder, `${namesIn(folder)(safeName(stem, "file"), [extension])}${extension}`);
|
|
54280
|
+
}
|
|
54281
|
+
__name(placeFile, "placeFile");
|
|
54282
|
+
function relink(markdown, to) {
|
|
54283
|
+
return outsideCode(
|
|
54284
|
+
markdown,
|
|
54285
|
+
(text2) => text2.replace(ATTACHMENT_LINK, (link, open2, id3) => {
|
|
54286
|
+
const destination = to.attachment(id3.toLowerCase(), !link.slice(open2.length).startsWith("/"));
|
|
54287
|
+
return destination === void 0 ? link : `${open2}${destination}`;
|
|
54288
|
+
}).replace(REFERENCE, (link, open2, type, id3) => {
|
|
54289
|
+
const destination = to.reference(type.toLowerCase(), id3.toLowerCase());
|
|
54290
|
+
return destination === void 0 ? link : `${open2}${destination}`;
|
|
54291
|
+
})
|
|
54292
|
+
);
|
|
54293
|
+
}
|
|
54294
|
+
__name(relink, "relink");
|
|
54295
|
+
function linkedAttachments(markdown) {
|
|
54296
|
+
const ids = /* @__PURE__ */ new Set();
|
|
54297
|
+
outsideCode(markdown, (text2) => {
|
|
54298
|
+
for (const match2 of text2.matchAll(ATTACHMENT_LINK)) ids.add(match2[2].toLowerCase());
|
|
54299
|
+
return text2;
|
|
54300
|
+
});
|
|
54301
|
+
return ids;
|
|
54302
|
+
}
|
|
54303
|
+
__name(linkedAttachments, "linkedAttachments");
|
|
53962
54304
|
var ExportService = class {
|
|
53963
54305
|
constructor(deps, access) {
|
|
53964
54306
|
this.deps = deps;
|
|
@@ -53975,22 +54317,96 @@ var ExportService = class {
|
|
|
53975
54317
|
const now = /* @__PURE__ */ new Date();
|
|
53976
54318
|
const root = `orqevio-${now.toISOString().slice(0, 10)}`;
|
|
53977
54319
|
const { texts, files, summary } = this.snapshot(actor.userId, root);
|
|
54320
|
+
const body = this.zip(async (zip) => {
|
|
54321
|
+
const missing = /* @__PURE__ */ new Set();
|
|
54322
|
+
for (const file2 of files) if (!await this.deps.storage.exists(file2.storageKey)) missing.add(file2.path);
|
|
54323
|
+
const about = { format: EXPORT_FORMAT, version: 1, app: VERSION, exportedAt: now.toISOString(), workspaces: summary, missingAttachments: [...missing].map((path2) => path2.slice(root.length + 1)) };
|
|
54324
|
+
await zip.add(`${root}/export.json`, utf8.encode(`${JSON.stringify(about, null, 2)}
|
|
54325
|
+
`), now);
|
|
54326
|
+
for (const [path2, content] of texts) await zip.add(path2, utf8.encode(content), now);
|
|
54327
|
+
await this.addFiles(
|
|
54328
|
+
zip,
|
|
54329
|
+
files.filter((file2) => !missing.has(file2.path)),
|
|
54330
|
+
now
|
|
54331
|
+
);
|
|
54332
|
+
});
|
|
54333
|
+
return { body, filename: `${root}.zip` };
|
|
54334
|
+
}
|
|
54335
|
+
/**
|
|
54336
|
+
* One page to take elsewhere, written as the export writes it: its Markdown alone when that is all
|
|
54337
|
+
* it is; otherwise a ZIP with the attachments it shows or links to next to it, and with its
|
|
54338
|
+
* subpages in folders when asked. Links to anything that doesn't go with it (tasks, other pages,
|
|
54339
|
+
* other files) point at this copy, `origin`. People only, as the export.
|
|
54340
|
+
*/
|
|
54341
|
+
async page(actor, pageId, options) {
|
|
54342
|
+
this.access.requireUser(actor);
|
|
54343
|
+
const db = this.deps.db;
|
|
54344
|
+
const [root] = await db.select().from(pages).where(eq(pages.id, pageId));
|
|
54345
|
+
if (!root) throw notFound("Page");
|
|
54346
|
+
await this.access.workspace(actor, root.workspaceId);
|
|
54347
|
+
const included = [root];
|
|
54348
|
+
const seen = /* @__PURE__ */ new Set([root.id]);
|
|
54349
|
+
if (options.subpages) {
|
|
54350
|
+
const projectPages = await db.select().from(pages).where(eq(pages.projectId, root.projectId)).orderBy(asc(pages.position), asc(pages.id));
|
|
54351
|
+
const childrenOf = group(projectPages, (page) => page.parentId);
|
|
54352
|
+
for (let i2 = 0; i2 < included.length; i2++)
|
|
54353
|
+
for (const child of childrenOf(included[i2].id))
|
|
54354
|
+
if (!seen.has(child.id)) {
|
|
54355
|
+
seen.add(child.id);
|
|
54356
|
+
included.push(child);
|
|
54357
|
+
}
|
|
54358
|
+
}
|
|
54359
|
+
const fileRows = await db.select().from(attachments).where(eq(attachments.workspaceId, root.workspaceId)).orderBy(asc(attachments.createdAt), asc(attachments.id));
|
|
54360
|
+
const fileById = new Map(fileRows.map((file2) => [file2.id, file2]));
|
|
54361
|
+
const nextTo = /* @__PURE__ */ new Map();
|
|
54362
|
+
for (const file2 of fileRows) if (file2.pageId && seen.has(file2.pageId)) nextTo.set(file2.id, file2.pageId);
|
|
54363
|
+
for (const page of included) for (const id3 of linkedAttachments(page.content)) if (fileById.has(id3) && !nextTo.has(id3)) nextTo.set(id3, page.id);
|
|
54364
|
+
const ids = [...nextTo.keys()];
|
|
54365
|
+
for (let i2 = 0; i2 < ids.length; i2 += EXISTS_AT_ONCE) {
|
|
54366
|
+
const batch = ids.slice(i2, i2 + EXISTS_AT_ONCE);
|
|
54367
|
+
const there = await Promise.all(batch.map((id3) => this.deps.storage.exists(fileById.get(id3).storageKey)));
|
|
54368
|
+
batch.forEach((id3, k) => !there[k] && nextTo.delete(id3));
|
|
54369
|
+
}
|
|
54370
|
+
const namesIn = folderNamers();
|
|
54371
|
+
const layout = pageLayout(included, new Set(nextTo.values()), namesIn);
|
|
54372
|
+
const under = layout.place(root, "");
|
|
54373
|
+
if (options.subpages) layout.placeUnder(root.id, under);
|
|
54374
|
+
const filePath = /* @__PURE__ */ new Map();
|
|
54375
|
+
const files = [];
|
|
54376
|
+
for (const [id3, pageId2] of nextTo) {
|
|
54377
|
+
const file2 = fileById.get(id3);
|
|
54378
|
+
const path2 = placeFile(file2, layout.filesFolder.get(pageId2), namesIn);
|
|
54379
|
+
filePath.set(id3, path2);
|
|
54380
|
+
files.push({ path: path2, storageKey: file2.storageKey, size: file2.size });
|
|
54381
|
+
}
|
|
54382
|
+
const copy = /* @__PURE__ */ __name((path2) => `${options.origin}${path2}`, "copy");
|
|
54383
|
+
const texts = included.map((page) => {
|
|
54384
|
+
const path2 = layout.pagePath.get(page.id);
|
|
54385
|
+
const fromDir = path2.includes("/") ? path2.slice(0, path2.lastIndexOf("/")) : "";
|
|
54386
|
+
const markdown = relink(page.content, {
|
|
54387
|
+
// A link with an address of its own already leads somewhere without this copy's.
|
|
54388
|
+
attachment: /* @__PURE__ */ __name((id3, absolute) => filePath.has(id3) ? linkTo(fromDir, filePath.get(id3)) : absolute ? void 0 : copy(`/api/attachments/${id3}`), "attachment"),
|
|
54389
|
+
reference: /* @__PURE__ */ __name((type, id3) => type === "doc" && layout.pagePath.has(id3) ? linkTo(fromDir, layout.pagePath.get(id3)) : copy(`/${type}/${id3}`), "reference")
|
|
54390
|
+
});
|
|
54391
|
+
return [path2, markdown];
|
|
54392
|
+
});
|
|
54393
|
+
const stem = layout.pagePath.get(root.id).slice(0, -".md".length);
|
|
54394
|
+
if (texts.length === 1 && files.length === 0) return { body: texts[0][1], filename: `${stem}.md`, type: "text/markdown; charset=utf-8" };
|
|
54395
|
+
const now = /* @__PURE__ */ new Date();
|
|
54396
|
+
const body = this.zip(async (zip) => {
|
|
54397
|
+
for (const [path2, content] of texts) await zip.add(path2, utf8.encode(content), now);
|
|
54398
|
+
await this.addFiles(zip, files, now);
|
|
54399
|
+
});
|
|
54400
|
+
return { body, filename: `${stem}.zip`, type: "application/zip" };
|
|
54401
|
+
}
|
|
54402
|
+
/** A ZIP written by `fill`, as a stream: each piece waits for the reader to take the last one, so memory stays flat whatever the size. */
|
|
54403
|
+
zip(fill) {
|
|
53978
54404
|
const { readable, writable } = new TransformStream();
|
|
53979
54405
|
const writer = writable.getWriter();
|
|
53980
54406
|
const zip = new ZipWriter((chunk) => writer.write(chunk));
|
|
53981
|
-
const text2 = /* @__PURE__ */ __name((value) => new TextEncoder().encode(value), "text");
|
|
53982
54407
|
void (async () => {
|
|
53983
54408
|
try {
|
|
53984
|
-
|
|
53985
|
-
for (const file2 of files) if (!await this.deps.storage.exists(file2.storageKey)) missing.add(file2.path);
|
|
53986
|
-
const about = { format: EXPORT_FORMAT, version: 1, app: VERSION, exportedAt: now.toISOString(), workspaces: summary, missingAttachments: [...missing].map((path2) => path2.slice(root.length + 1)) };
|
|
53987
|
-
await zip.add(`${root}/export.json`, text2(`${JSON.stringify(about, null, 2)}
|
|
53988
|
-
`), now);
|
|
53989
|
-
for (const [path2, content] of texts) await zip.add(path2, text2(content), now);
|
|
53990
|
-
for (const file2 of files) {
|
|
53991
|
-
const body = missing.has(file2.path) ? null : await this.deps.storage.stream(file2.storageKey);
|
|
53992
|
-
if (body) await zip.addStream(file2.path, file2.size, body, now);
|
|
53993
|
-
}
|
|
54409
|
+
await fill(zip);
|
|
53994
54410
|
await zip.end();
|
|
53995
54411
|
await writer.close();
|
|
53996
54412
|
} catch (error62) {
|
|
@@ -53999,7 +54415,14 @@ var ExportService = class {
|
|
|
53999
54415
|
});
|
|
54000
54416
|
}
|
|
54001
54417
|
})();
|
|
54002
|
-
return
|
|
54418
|
+
return readable;
|
|
54419
|
+
}
|
|
54420
|
+
/** The attachments' files, streamed one by one from storage. One gone meanwhile is left out. */
|
|
54421
|
+
async addFiles(zip, files, now) {
|
|
54422
|
+
for (const file2 of files) {
|
|
54423
|
+
const body = await this.deps.storage.stream(file2.storageKey);
|
|
54424
|
+
if (body) await zip.addStream(file2.path, file2.size, body, now);
|
|
54425
|
+
}
|
|
54003
54426
|
}
|
|
54004
54427
|
/** Every text of the export and the list of attachments to add, read at once from the database. */
|
|
54005
54428
|
snapshot(userId, root) {
|
|
@@ -54022,17 +54445,9 @@ var ExportService = class {
|
|
|
54022
54445
|
const itemRows = db.select().from(checklistItems).where(eq(checklistItems.workspaceId, workspace.id)).orderBy(asc(checklistItems.position), asc(checklistItems.id)).all();
|
|
54023
54446
|
const pageRows = db.select().from(pages).where(eq(pages.workspaceId, workspace.id)).orderBy(asc(pages.position), asc(pages.id)).all();
|
|
54024
54447
|
const fileRows = db.select().from(attachments).where(eq(attachments.workspaceId, workspace.id)).orderBy(asc(attachments.createdAt), asc(attachments.id)).all();
|
|
54448
|
+
const commentRows = db.select().from(cardComments).where(eq(cardComments.workspaceId, workspace.id)).orderBy(asc(cardComments.createdAt), asc(cardComments.id)).all();
|
|
54025
54449
|
const cardLabelRows = db.select({ cardId: cardLabels.cardId, labelId: cardLabels.labelId }).from(cardLabels).innerJoin(cards, eq(cards.id, cardLabels.cardId)).where(eq(cards.workspaceId, workspace.id)).all();
|
|
54026
54450
|
const linkRows = db.select({ cardId: cardPageLinks.cardId, pageId: cardPageLinks.pageId }).from(cardPageLinks).innerJoin(cards, eq(cards.id, cardPageLinks.cardId)).where(eq(cards.workspaceId, workspace.id)).all();
|
|
54027
|
-
const group = /* @__PURE__ */ __name((rows, key) => {
|
|
54028
|
-
const groups = /* @__PURE__ */ new Map();
|
|
54029
|
-
for (const row of rows) {
|
|
54030
|
-
const bucket = groups.get(key(row));
|
|
54031
|
-
if (bucket) bucket.push(row);
|
|
54032
|
-
else groups.set(key(row), [row]);
|
|
54033
|
-
}
|
|
54034
|
-
return (k) => groups.get(k) ?? [];
|
|
54035
|
-
}, "group");
|
|
54036
54451
|
const cardById = new Map(cardRows.map((c) => [c.id, c]));
|
|
54037
54452
|
const labelById = new Map(labelRows.map((l) => [l.id, l]));
|
|
54038
54453
|
const boardsOf = group(boardRows, (b) => b.projectId);
|
|
@@ -54044,33 +54459,13 @@ var ExportService = class {
|
|
|
54044
54459
|
const itemsOf = group(itemRows, (i2) => i2.checklistId);
|
|
54045
54460
|
const linksOf = group(linkRows, (l) => l.cardId);
|
|
54046
54461
|
const filesOf = group(fileRows, (f) => f.cardId);
|
|
54047
|
-
const
|
|
54048
|
-
const
|
|
54462
|
+
const commentsOf = group(commentRows, (c) => c.cardId);
|
|
54463
|
+
const namesIn = folderNamers();
|
|
54049
54464
|
const projectFolders = namer();
|
|
54050
54465
|
const projectFolder = new Map(projectRows.map((p) => [p.id, projectFolders(safeName(p.name))]));
|
|
54051
|
-
const byParent = group(pageRows, (page) => page.parentId ?? `project:${page.projectId}`);
|
|
54052
54466
|
const withFiles = new Set(fileRows.map((f) => f.pageId).filter((id3) => Boolean(id3)));
|
|
54053
|
-
const
|
|
54054
|
-
const
|
|
54055
|
-
let names = folderNames.get(folder2);
|
|
54056
|
-
if (!names) folderNames.set(folder2, names = namer());
|
|
54057
|
-
return names;
|
|
54058
|
-
}, "namesIn");
|
|
54059
|
-
const place = /* @__PURE__ */ __name((page, folder2) => {
|
|
54060
|
-
const names = namesIn(folder2);
|
|
54061
|
-
const stem = names(safeName(page.title), [".md", ""]);
|
|
54062
|
-
pagePath.set(page.id, `${folder2}/${stem}.md`);
|
|
54063
|
-
if (withFiles.has(page.id)) pageFilesFolder.set(page.id, `${folder2}/${names(`${stem} (files)`)}`);
|
|
54064
|
-
return `${folder2}/${stem}`;
|
|
54065
|
-
}, "place");
|
|
54066
|
-
const pending = projectRows.map((p) => ({ key: `project:${p.id}`, folder: `documents/${projectFolder.get(p.id)}` }));
|
|
54067
|
-
while (pending.length) {
|
|
54068
|
-
const { key, folder: folder2 } = pending.pop();
|
|
54069
|
-
for (const page of byParent(key)) {
|
|
54070
|
-
if (pagePath.has(page.id)) continue;
|
|
54071
|
-
pending.push({ key: page.id, folder: place(page, folder2) });
|
|
54072
|
-
}
|
|
54073
|
-
}
|
|
54467
|
+
const { pagePath, filesFolder: pageFilesFolder, place, placeUnder } = pageLayout(pageRows, withFiles, namesIn);
|
|
54468
|
+
for (const project of projectRows) placeUnder(`project:${project.id}`, `documents/${projectFolder.get(project.id)}`);
|
|
54074
54469
|
for (const page of pageRows) if (!pagePath.has(page.id) && projectFolder.has(page.projectId)) place(page, `documents/${projectFolder.get(page.projectId)}`);
|
|
54075
54470
|
const filePath = /* @__PURE__ */ new Map();
|
|
54076
54471
|
const cardFolder = /* @__PURE__ */ new Map();
|
|
@@ -54087,26 +54482,20 @@ var ExportService = class {
|
|
|
54087
54482
|
} else {
|
|
54088
54483
|
folder2 = pageFilesFolder.get(file2.pageId ?? "") ?? (orphans ??= `attachments/${cardFolderNames("pages")}`);
|
|
54089
54484
|
}
|
|
54090
|
-
const
|
|
54091
|
-
const stem = dot > 0 ? file2.filename.slice(0, dot) : file2.filename;
|
|
54092
|
-
const ending = dot > 0 ? cleanName2(file2.filename.slice(dot + 1), 16) : "";
|
|
54093
|
-
const extension = ending ? `.${ending}` : "";
|
|
54094
|
-
const path2 = `${folder2}/${namesIn(folder2)(safeName(stem, "file"), [extension])}${extension}`;
|
|
54485
|
+
const path2 = placeFile(file2, folder2, namesIn);
|
|
54095
54486
|
filePath.set(file2.id, path2);
|
|
54096
54487
|
files.push({ path: `${base}/${path2}`, storageKey: file2.storageKey, size: file2.size });
|
|
54097
54488
|
}
|
|
54098
|
-
const
|
|
54099
|
-
|
|
54100
|
-
|
|
54101
|
-
|
|
54102
|
-
|
|
54103
|
-
|
|
54104
|
-
|
|
54105
|
-
})
|
|
54106
|
-
), "relink");
|
|
54489
|
+
const relinked = /* @__PURE__ */ __name((markdown, fromDir) => relink(markdown, {
|
|
54490
|
+
attachment: /* @__PURE__ */ __name((id3) => filePath.has(id3) ? linkTo(fromDir, filePath.get(id3)) : void 0, "attachment"),
|
|
54491
|
+
reference: /* @__PURE__ */ __name((type, id3) => {
|
|
54492
|
+
if (type === "doc") return pagePath.has(id3) ? linkTo(fromDir, pagePath.get(id3)) : void 0;
|
|
54493
|
+
return cardById.has(id3) ? `${linkTo(fromDir, "tasks.json")}#${id3}` : void 0;
|
|
54494
|
+
}, "reference")
|
|
54495
|
+
}), "relinked");
|
|
54107
54496
|
for (const page of pageRows) {
|
|
54108
54497
|
const path2 = pagePath.get(page.id);
|
|
54109
|
-
if (path2) texts.push([`${base}/${path2}`,
|
|
54498
|
+
if (path2) texts.push([`${base}/${path2}`, relinked(page.content, path2.slice(0, path2.lastIndexOf("/")))]);
|
|
54110
54499
|
}
|
|
54111
54500
|
const tasks = {
|
|
54112
54501
|
workspace: workspace.name,
|
|
@@ -54124,7 +54513,7 @@ var ExportService = class {
|
|
|
54124
54513
|
// What references to this task (#<id> after tasks.json) point at.
|
|
54125
54514
|
id: card.id,
|
|
54126
54515
|
title: card.title,
|
|
54127
|
-
description:
|
|
54516
|
+
description: relinked(card.description, ""),
|
|
54128
54517
|
labels: labelsOfCard(card.id).map((cl) => labelById.get(cl.labelId)?.name).filter(Boolean),
|
|
54129
54518
|
due: day(card.dueAt),
|
|
54130
54519
|
archived: card.archivedAt !== null,
|
|
@@ -54132,6 +54521,14 @@ var ExportService = class {
|
|
|
54132
54521
|
// A document linked by hand and mentioned too is one document.
|
|
54133
54522
|
documents: [...new Set(linksOf(card.id).map((link) => pagePath.get(link.pageId)))].filter(Boolean),
|
|
54134
54523
|
attachments: filesOf(card.id).map((f) => filePath.get(f.id)),
|
|
54524
|
+
// Oldest first, as a conversation reads.
|
|
54525
|
+
comments: commentsOf(card.id).map((c) => ({
|
|
54526
|
+
author: c.authorName,
|
|
54527
|
+
by: c.authorKind === "agent" ? "agent" : "person",
|
|
54528
|
+
body: relinked(c.body, ""),
|
|
54529
|
+
createdAt: iso(c.createdAt),
|
|
54530
|
+
editedAt: c.editedAt ? iso(c.editedAt) : null
|
|
54531
|
+
})),
|
|
54135
54532
|
createdAt: iso(card.createdAt),
|
|
54136
54533
|
updatedAt: iso(card.updatedAt)
|
|
54137
54534
|
}))
|
|
@@ -54151,7 +54548,7 @@ var STRETCH_MS = 10 * 60 * 1e3;
|
|
|
54151
54548
|
var DAY_MS = 864e5;
|
|
54152
54549
|
var MARK = /\.(created|deleted|restored|linked|unlinked)$/;
|
|
54153
54550
|
var LIST_COLUMNS = (() => {
|
|
54154
|
-
const body = inArray(history.kind, [...
|
|
54551
|
+
const body = inArray(history.kind, [...HISTORY_LONG_KINDS]);
|
|
54155
54552
|
return {
|
|
54156
54553
|
...getTableColumns(history),
|
|
54157
54554
|
before: sql`CASE WHEN ${body} THEN NULL ELSE ${history.before} END`,
|
|
@@ -54166,7 +54563,7 @@ var bodyMeta = /* @__PURE__ */ __name((kind, before, after) => {
|
|
|
54166
54563
|
return { linesAdded: added, linesRemoved: removed };
|
|
54167
54564
|
}, "bodyMeta");
|
|
54168
54565
|
function toHistoryEntryDTO(row, withBodies) {
|
|
54169
|
-
const hidden = !withBodies &&
|
|
54566
|
+
const hidden = !withBodies && HISTORY_LONG_KINDS.has(row.kind);
|
|
54170
54567
|
return {
|
|
54171
54568
|
id: row.id,
|
|
54172
54569
|
entityType: row.entityType,
|
|
@@ -54340,7 +54737,7 @@ var SearchService = class {
|
|
|
54340
54737
|
static {
|
|
54341
54738
|
__name(this, "SearchService");
|
|
54342
54739
|
}
|
|
54343
|
-
/** Full-text search over card and page titles and bodies (FTS5), titles ranked first. */
|
|
54740
|
+
/** Full-text search over card and page titles and bodies (FTS5), titles ranked first, and card comments after them. */
|
|
54344
54741
|
/** `archived`: archived cards are found too, and say so; otherwise only those on their boards. */
|
|
54345
54742
|
async search(actor, workspaceId, rawQuery, opts = {}) {
|
|
54346
54743
|
await this.access.workspace(actor, workspaceId);
|
|
@@ -54380,6 +54777,44 @@ var SearchService = class {
|
|
|
54380
54777
|
...r.archivedAt !== null ? { archived: true } : {}
|
|
54381
54778
|
});
|
|
54382
54779
|
}
|
|
54780
|
+
const room = limit2 - results.length;
|
|
54781
|
+
if (room > 0) {
|
|
54782
|
+
const comments = this.deps.db.all(sql`
|
|
54783
|
+
SELECT id, body, authorName, cardId, title, boardId, boardName, columnName, projectId, projectName, archivedAt FROM (
|
|
54784
|
+
SELECT cm.id, cm.body, cm.author_name AS authorName, c.id AS cardId, c.title, b.id AS boardId, b.name AS boardName,
|
|
54785
|
+
col.name AS columnName, p.id AS projectId, p.name AS projectName, c.archived_at AS archivedAt,
|
|
54786
|
+
f.rank, cm.created_at AS createdAt,
|
|
54787
|
+
row_number() OVER (PARTITION BY cm.card_id ORDER BY f.rank, cm.created_at DESC, cm.id) AS place
|
|
54788
|
+
FROM (SELECT rowid, bm25(card_comments_fts) AS rank FROM card_comments_fts WHERE card_comments_fts MATCH ${match2}) f
|
|
54789
|
+
JOIN card_comments_fts_map m ON m.id = f.rowid
|
|
54790
|
+
JOIN card_comments cm ON cm.id = m.entity_id
|
|
54791
|
+
JOIN cards c ON c.id = cm.card_id
|
|
54792
|
+
JOIN boards b ON b.id = c.board_id
|
|
54793
|
+
JOIN board_columns col ON col.id = c.column_id
|
|
54794
|
+
JOIN projects p ON p.id = b.project_id
|
|
54795
|
+
WHERE cm.workspace_id = ${workspaceId} AND (${opts.archived ? 1 : 0} OR c.archived_at IS NULL)
|
|
54796
|
+
AND NOT ${inList(sql`c.id`, results.map((r) => r.id))}
|
|
54797
|
+
)
|
|
54798
|
+
WHERE place = 1
|
|
54799
|
+
ORDER BY rank, createdAt DESC
|
|
54800
|
+
LIMIT ${room}`);
|
|
54801
|
+
for (const r of comments) {
|
|
54802
|
+
results.push({
|
|
54803
|
+
type: "card",
|
|
54804
|
+
id: r.cardId,
|
|
54805
|
+
title: r.title,
|
|
54806
|
+
excerpt: excerpt(r.body, terms),
|
|
54807
|
+
icon: null,
|
|
54808
|
+
projectId: r.projectId,
|
|
54809
|
+
projectName: r.projectName,
|
|
54810
|
+
boardId: r.boardId,
|
|
54811
|
+
boardName: r.boardName,
|
|
54812
|
+
columnName: r.columnName,
|
|
54813
|
+
comment: { id: r.id, author: r.authorName },
|
|
54814
|
+
...r.archivedAt !== null ? { archived: true } : {}
|
|
54815
|
+
});
|
|
54816
|
+
}
|
|
54817
|
+
}
|
|
54383
54818
|
}
|
|
54384
54819
|
if (types.includes("page") && hasScope(actor, "docs:read")) {
|
|
54385
54820
|
const rows = this.deps.db.all(sql`
|
|
@@ -54421,6 +54856,7 @@ var NODE_KIND = {
|
|
|
54421
54856
|
cards: "card",
|
|
54422
54857
|
checklists: "checklist",
|
|
54423
54858
|
checklist_items: "checklist_item",
|
|
54859
|
+
card_comments: "comment",
|
|
54424
54860
|
pages: "page",
|
|
54425
54861
|
attachments: "attachment"
|
|
54426
54862
|
};
|
|
@@ -54432,6 +54868,7 @@ var LIVE_TABLE = {
|
|
|
54432
54868
|
card: "cards",
|
|
54433
54869
|
checklist: "checklists",
|
|
54434
54870
|
checklist_item: "checklist_items",
|
|
54871
|
+
comment: "card_comments",
|
|
54435
54872
|
page: "pages",
|
|
54436
54873
|
attachment: "attachments"
|
|
54437
54874
|
};
|
|
@@ -54443,10 +54880,11 @@ var LIVE_COLUMNS = {
|
|
|
54443
54880
|
card: sql`id, title AS name, column_id, board_id`,
|
|
54444
54881
|
checklist: sql`id, title AS name, card_id`,
|
|
54445
54882
|
checklist_item: sql`id, text AS name, checklist_id`,
|
|
54883
|
+
comment: sql`id, substr(body, 1, 400) AS name, card_id`,
|
|
54446
54884
|
page: sql`id, title AS name, project_id, parent_id`,
|
|
54447
54885
|
attachment: sql`id, filename AS name, card_id, page_id`
|
|
54448
54886
|
};
|
|
54449
|
-
var RANK = { project: 0, board: 1, column: 2, label: 3, card: 4, checklist: 5, checklist_item: 6,
|
|
54887
|
+
var RANK = { project: 0, board: 1, column: 2, label: 3, card: 4, checklist: 5, checklist_item: 6, comment: 7, page: 8, attachment: 9, link: 10 };
|
|
54450
54888
|
var COUNTED = {
|
|
54451
54889
|
project: "projects",
|
|
54452
54890
|
board: "boards",
|
|
@@ -54457,7 +54895,8 @@ var COUNTED = {
|
|
|
54457
54895
|
checklist: "checklists",
|
|
54458
54896
|
checklist_item: "items",
|
|
54459
54897
|
label: "labels",
|
|
54460
|
-
link: "links"
|
|
54898
|
+
link: "links",
|
|
54899
|
+
comment: "comments"
|
|
54461
54900
|
};
|
|
54462
54901
|
var CHOOSE = {
|
|
54463
54902
|
project: [],
|
|
@@ -54467,6 +54906,7 @@ var CHOOSE = {
|
|
|
54467
54906
|
card: ["column"],
|
|
54468
54907
|
checklist: ["card"],
|
|
54469
54908
|
checklist_item: ["checklist"],
|
|
54909
|
+
comment: ["card"],
|
|
54470
54910
|
page: ["project", "page"],
|
|
54471
54911
|
attachment: ["card", "page"],
|
|
54472
54912
|
link: []
|
|
@@ -54529,6 +54969,8 @@ var Live = class {
|
|
|
54529
54969
|
return [...up("card", row.card_id), name2];
|
|
54530
54970
|
case "checklist_item":
|
|
54531
54971
|
return [...up("checklist", row.checklist_id), name2];
|
|
54972
|
+
case "comment":
|
|
54973
|
+
return [...up("card", row.card_id), commentExcerpt(name2)];
|
|
54532
54974
|
case "page":
|
|
54533
54975
|
return [...row.parent_id ? up("page", row.parent_id) : up("project", row.project_id), name2];
|
|
54534
54976
|
case "attachment":
|
|
@@ -54581,6 +55023,8 @@ function parentRef(kind, row) {
|
|
|
54581
55023
|
return ref("card", row.cardId);
|
|
54582
55024
|
case "checklist_item":
|
|
54583
55025
|
return ref("checklist", row.checklistId);
|
|
55026
|
+
case "comment":
|
|
55027
|
+
return ref("card", row.cardId);
|
|
54584
55028
|
case "page":
|
|
54585
55029
|
return row.parentId ? ref("page", row.parentId) : ref("project", row.projectId);
|
|
54586
55030
|
case "attachment":
|
|
@@ -54612,7 +55056,7 @@ var TrashIndex = class _TrashIndex {
|
|
|
54612
55056
|
const rows = db.all(sql`
|
|
54613
55057
|
SELECT r.id AS rowId, r.trash_id AS trashId, r.table_name AS tableName,
|
|
54614
55058
|
json_extract(r.data, '$.id') AS id,
|
|
54615
|
-
coalesce(json_extract(r.data, '$.name'), json_extract(r.data, '$.title'), json_extract(r.data, '$.filename'), json_extract(r.data, '$.text')) AS name,
|
|
55059
|
+
coalesce(json_extract(r.data, '$.name'), json_extract(r.data, '$.title'), json_extract(r.data, '$.filename'), json_extract(r.data, '$.text'), substr(json_extract(r.data, '$.body'), 1, 400)) AS name,
|
|
54616
55060
|
json_extract(r.data, '$.project_id') AS projectId,
|
|
54617
55061
|
json_extract(r.data, '$.board_id') AS boardId,
|
|
54618
55062
|
json_extract(r.data, '$.column_id') AS columnId,
|
|
@@ -54623,7 +55067,9 @@ var TrashIndex = class _TrashIndex {
|
|
|
54623
55067
|
json_extract(r.data, '$.label_id') AS labelId,
|
|
54624
55068
|
json_extract(r.data, '$.size') AS size,
|
|
54625
55069
|
json_extract(r.data, '$.source') AS source,
|
|
54626
|
-
|
|
55070
|
+
-- Comments have no place of their own: they go in the order they were written (and, within
|
|
55071
|
+
-- a millisecond, in the order they were kept, which is that of their rows).
|
|
55072
|
+
coalesce(json_extract(r.data, '$.position'), CASE WHEN r.table_name = 'card_comments' THEN printf('%015d%012d', json_extract(r.data, '$.created_at'), r.id) END) AS position,
|
|
54627
55073
|
r.storage_key AS storageKey
|
|
54628
55074
|
FROM trash_rows r JOIN trash t ON t.id = r.trash_id
|
|
54629
55075
|
WHERE t.workspace_id = ${workspaceId}
|
|
@@ -54654,7 +55100,8 @@ var TrashIndex = class _TrashIndex {
|
|
|
54654
55100
|
id: id3,
|
|
54655
55101
|
row,
|
|
54656
55102
|
entry,
|
|
54657
|
-
|
|
55103
|
+
// A comment shows as a line of its text, without the Markdown.
|
|
55104
|
+
title: kind === "comment" ? commentExcerpt(row.name ?? "") : row.name ?? "",
|
|
54658
55105
|
ref: parentRef(kind, row),
|
|
54659
55106
|
parent: null,
|
|
54660
55107
|
children: [],
|
|
@@ -54958,6 +55405,7 @@ function planRestore(index3, input2) {
|
|
|
54958
55405
|
break;
|
|
54959
55406
|
}
|
|
54960
55407
|
case "checklist":
|
|
55408
|
+
case "comment":
|
|
54961
55409
|
sets.card_id = container.id;
|
|
54962
55410
|
break;
|
|
54963
55411
|
case "checklist_item":
|
|
@@ -54996,11 +55444,11 @@ function planRestore(index3, input2) {
|
|
|
54996
55444
|
const wait = [];
|
|
54997
55445
|
const drop = [];
|
|
54998
55446
|
const groups = /* @__PURE__ */ new Map();
|
|
54999
|
-
const note = /* @__PURE__ */ __name((
|
|
55000
|
-
const id3 = `${
|
|
55447
|
+
const note = /* @__PURE__ */ __name((group2, first) => {
|
|
55448
|
+
const id3 = `${group2.state}|${group2.kind}|${group2.key ?? group2.title}`;
|
|
55001
55449
|
const found = groups.get(id3);
|
|
55002
55450
|
if (found) found.count++;
|
|
55003
|
-
else groups.set(id3, { ...
|
|
55451
|
+
else groups.set(id3, { ...group2, count: 1, first });
|
|
55004
55452
|
}, "note");
|
|
55005
55453
|
for (const r of rows) {
|
|
55006
55454
|
const cardId = r.cardId ?? "";
|
|
@@ -55059,9 +55507,9 @@ function planRestore(index3, input2) {
|
|
|
55059
55507
|
if (!NAMED.has(n.kind)) continue;
|
|
55060
55508
|
const container = n.kind === "project" ? null : placement.get(n.key)?.container ?? null;
|
|
55061
55509
|
const id3 = `${n.kind}@${container ? refKey(container) : "workspace"}`;
|
|
55062
|
-
const
|
|
55063
|
-
|
|
55064
|
-
byContainer.set(id3,
|
|
55510
|
+
const group2 = byContainer.get(id3) ?? { kind: n.kind, container, nodes: [] };
|
|
55511
|
+
group2.nodes.push(n);
|
|
55512
|
+
byContainer.set(id3, group2);
|
|
55065
55513
|
}
|
|
55066
55514
|
for (const { kind, container, nodes } of byContainer.values()) {
|
|
55067
55515
|
const isLive = container === null || !comingKeys.has(refKey(container)) && !madeIds.has(container.id);
|
|
@@ -55176,6 +55624,7 @@ var TABLES2 = {
|
|
|
55176
55624
|
card_labels: cardLabels,
|
|
55177
55625
|
checklists,
|
|
55178
55626
|
checklist_items: checklistItems,
|
|
55627
|
+
card_comments: cardComments,
|
|
55179
55628
|
pages,
|
|
55180
55629
|
card_page_links: cardPageLinks,
|
|
55181
55630
|
attachments
|
|
@@ -55191,7 +55640,8 @@ var ROOT_TABLE = {
|
|
|
55191
55640
|
label: "labels",
|
|
55192
55641
|
checklist: "checklists",
|
|
55193
55642
|
checklist_item: "checklist_items",
|
|
55194
|
-
link: "card_page_links"
|
|
55643
|
+
link: "card_page_links",
|
|
55644
|
+
comment: "card_comments"
|
|
55195
55645
|
};
|
|
55196
55646
|
var COUNTED2 = {
|
|
55197
55647
|
boards: "boards",
|
|
@@ -55201,7 +55651,8 @@ var COUNTED2 = {
|
|
|
55201
55651
|
attachments: "attachments",
|
|
55202
55652
|
checklists: "checklists",
|
|
55203
55653
|
checklist_items: "items",
|
|
55204
|
-
labels: "labels"
|
|
55654
|
+
labels: "labels",
|
|
55655
|
+
card_comments: "comments"
|
|
55205
55656
|
};
|
|
55206
55657
|
var DAY_MS2 = 24 * 60 * 60 * 1e3;
|
|
55207
55658
|
var SEPARATOR2 = " \u203A ";
|
|
@@ -55232,6 +55683,7 @@ var Snapshot = class {
|
|
|
55232
55683
|
this.where("card_labels", sql`card_id IN (${scope})`);
|
|
55233
55684
|
this.where("checklists", sql`card_id IN (${scope})`);
|
|
55234
55685
|
this.where("checklist_items", sql`checklist_id IN (SELECT id FROM checklists WHERE card_id IN (${scope}))`);
|
|
55686
|
+
this.where("card_comments", sql`card_id IN (${scope})`);
|
|
55235
55687
|
this.where("card_page_links", sql`card_id IN (${scope})`);
|
|
55236
55688
|
this.where("attachments", sql`card_id IN (${scope})`);
|
|
55237
55689
|
}
|
|
@@ -55287,6 +55739,8 @@ var TrashService = class {
|
|
|
55287
55739
|
const page = tx.get(sql`SELECT title FROM pages WHERE id = ${text2(data.page_id)}`);
|
|
55288
55740
|
return { entityType: "card", entityId: text2(data.card_id), kind: "card.linked", subjectId: text2(data.page_id), meta: { ...meta3, page: page?.title ?? "" } };
|
|
55289
55741
|
}
|
|
55742
|
+
case "comment":
|
|
55743
|
+
return { entityType: "card", entityId: text2(data.card_id), kind: "comment.restored", subjectId: id3, meta: { ...meta3, text: commentExcerpt(text2(data.body)) } };
|
|
55290
55744
|
default:
|
|
55291
55745
|
return null;
|
|
55292
55746
|
}
|
|
@@ -55415,6 +55869,12 @@ var TrashService = class {
|
|
|
55415
55869
|
const list = db.get(sql`SELECT card_id, title FROM checklists WHERE id = ${row.checklist_id}`);
|
|
55416
55870
|
return { data: snapshot.rows[0].data, title: String(row.text), location: list ? path2(cardPath(list.card_id), list.title) : "" };
|
|
55417
55871
|
}
|
|
55872
|
+
case "comment": {
|
|
55873
|
+
const row = one("card_comments", target.id);
|
|
55874
|
+
if (!row) return null;
|
|
55875
|
+
snapshot.where("card_comments", sql`id = ${target.id}`);
|
|
55876
|
+
return { data: snapshot.rows[0].data, title: commentExcerpt(String(row.body)), location: cardPath(row.card_id) };
|
|
55877
|
+
}
|
|
55418
55878
|
case "link": {
|
|
55419
55879
|
snapshot.where("card_page_links", sql`card_id = ${target.cardId} AND page_id = ${target.pageId} AND source = 'manual'`);
|
|
55420
55880
|
if (snapshot.rows.length === 0) return null;
|
|
@@ -55723,8 +56183,19 @@ var TrashService = class {
|
|
|
55723
56183
|
}
|
|
55724
56184
|
case "link":
|
|
55725
56185
|
return onCard(text2(row.card_id), { pageId: text2(row.page_id) });
|
|
56186
|
+
case "comment":
|
|
56187
|
+
return onCard(text2(row.card_id));
|
|
55726
56188
|
}
|
|
55727
56189
|
}
|
|
56190
|
+
/**
|
|
56191
|
+
* What the activity calls something from the trash: its name, but a comment by the title of its
|
|
56192
|
+
* card, never by what it says, as the activity outlives it (see `meta.kind`).
|
|
56193
|
+
*/
|
|
56194
|
+
activityName(node2) {
|
|
56195
|
+
if (node2.kind !== "comment") return node2.title;
|
|
56196
|
+
if (node2.parent?.kind === "card") return node2.parent.title;
|
|
56197
|
+
return this.deps.db.get(sql`SELECT title FROM cards WHERE id = ${node2.row.cardId}`)?.title ?? "";
|
|
56198
|
+
}
|
|
55728
56199
|
/** Records and announces what came back. */
|
|
55729
56200
|
async announce(actor, workspaceId, applied) {
|
|
55730
56201
|
if (applied.waiting && applied.targets.length === 1) {
|
|
@@ -55740,7 +56211,7 @@ var TrashService = class {
|
|
|
55740
56211
|
action: "trash.restored",
|
|
55741
56212
|
entityType: target.entityType,
|
|
55742
56213
|
entityId: target.entityId,
|
|
55743
|
-
summary: target.node.title,
|
|
56214
|
+
summary: target.node.kind === "comment" ? this.deps.db.get(sql`SELECT title FROM cards WHERE id = ${target.entityId}`)?.title ?? "" : target.node.title,
|
|
55744
56215
|
meta: { kind: target.node.kind, ...i2 === 0 && applied.movedTo ? { movedTo: applied.movedTo } : {} }
|
|
55745
56216
|
},
|
|
55746
56217
|
target.event
|
|
@@ -55757,7 +56228,7 @@ var TrashService = class {
|
|
|
55757
56228
|
});
|
|
55758
56229
|
if (!erased) throw notFound("Trash item");
|
|
55759
56230
|
const [node2] = erased;
|
|
55760
|
-
await this.activity.record(actor, workspaceId, { action: "trash.purged", entityType: purgedEntityType(node2.kind), entityId: node2.id, summary: node2
|
|
56231
|
+
await this.activity.record(actor, workspaceId, { action: "trash.purged", entityType: purgedEntityType(node2.kind), entityId: node2.id, summary: this.activityName(node2), meta: { kind: node2.kind } });
|
|
55761
56232
|
}
|
|
55762
56233
|
/**
|
|
55763
56234
|
* Deletes several things for good, with everything below them; what is below another one of
|
|
@@ -55782,7 +56253,7 @@ var TrashService = class {
|
|
|
55782
56253
|
});
|
|
55783
56254
|
if (!erased?.length || !went) throw notFound("Trash item");
|
|
55784
56255
|
for (const node2 of erased) {
|
|
55785
|
-
await this.activity.record(actor, workspaceId, { action: "trash.purged", entityType: purgedEntityType(node2.kind), entityId: node2.id, summary: node2
|
|
56256
|
+
await this.activity.record(actor, workspaceId, { action: "trash.purged", entityType: purgedEntityType(node2.kind), entityId: node2.id, summary: this.activityName(node2), meta: { kind: node2.kind } });
|
|
55786
56257
|
}
|
|
55787
56258
|
return went;
|
|
55788
56259
|
}
|
|
@@ -55791,11 +56262,12 @@ var TrashService = class {
|
|
|
55791
56262
|
const entry = await this.load(actor, trashId);
|
|
55792
56263
|
const erased = await this.erase(entry.workspaceId, (index3) => [...index3.nodes.values()].filter((n) => n.entry.id === trashId), [trashId]);
|
|
55793
56264
|
if (!erased) throw notFound("Trash entry");
|
|
56265
|
+
const root = erased.find((node2) => node2.entryRoot);
|
|
55794
56266
|
await this.activity.record(actor, entry.workspaceId, {
|
|
55795
56267
|
action: "trash.purged",
|
|
55796
56268
|
entityType: purgedEntityType(entry.kind),
|
|
55797
56269
|
entityId: entry.entityId,
|
|
55798
|
-
summary: entry.title,
|
|
56270
|
+
summary: root ? this.activityName(root) : entry.kind === "comment" ? "" : entry.title,
|
|
55799
56271
|
meta: { kind: entry.kind }
|
|
55800
56272
|
});
|
|
55801
56273
|
}
|
|
@@ -55959,7 +56431,7 @@ var LEFT_ACTIONS = ["created", "updated", "moved", "deleted"];
|
|
|
55959
56431
|
var TRASH_TABLES = { project: "projects", board: "boards", column: "board_columns", label: "labels", page: "pages", card: "cards" };
|
|
55960
56432
|
var CHUNK = 90;
|
|
55961
56433
|
var LIGHT_COLUMNS = (() => {
|
|
55962
|
-
const body = inArray(history.kind, [...
|
|
56434
|
+
const body = inArray(history.kind, [...HISTORY_LONG_KINDS]);
|
|
55963
56435
|
return {
|
|
55964
56436
|
...getTableColumns(history),
|
|
55965
56437
|
before: sql`CASE WHEN ${body} THEN NULL ELSE ${history.before} END`,
|
|
@@ -56211,7 +56683,7 @@ var UndoService = class {
|
|
|
56211
56683
|
const ids = [...restoring];
|
|
56212
56684
|
const found = [];
|
|
56213
56685
|
for (let i2 = 0; i2 < ids.length; i2 += CHUNK) {
|
|
56214
|
-
const rows = this.deps.db.select({ trashId: trashRows.trashId, data: sql`json_remove(${trashRows.data}, '$.content', '$.description')` }).from(trashRows).where(and(inArray(trashRows.trashId, ids.slice(i2, i2 + CHUNK)), eq(trashRows.tableName, table), sql`json_extract(${trashRows.data}, ${`$.${column2}`}) = ${value}`)).all();
|
|
56686
|
+
const rows = this.deps.db.select({ trashId: trashRows.trashId, data: sql`json_remove(${trashRows.data}, '$.content', '$.description', '$.body')` }).from(trashRows).where(and(inArray(trashRows.trashId, ids.slice(i2, i2 + CHUNK)), eq(trashRows.tableName, table), sql`json_extract(${trashRows.data}, ${`$.${column2}`}) = ${value}`)).all();
|
|
56215
56687
|
found.push(...rows.map((r) => ({ trashId: r.trashId, data: JSON.parse(r.data) })));
|
|
56216
56688
|
}
|
|
56217
56689
|
return found;
|
|
@@ -56301,10 +56773,10 @@ var UndoService = class {
|
|
|
56301
56773
|
if (status === "ready") state.values.set(key, back);
|
|
56302
56774
|
return { status, current: now };
|
|
56303
56775
|
}, "value");
|
|
56304
|
-
const body = /* @__PURE__ */ __name((table, column2, trashId) => {
|
|
56776
|
+
const body = /* @__PURE__ */ __name((table, column2, trashId, id3 = row.entityId) => {
|
|
56305
56777
|
const key = fieldKey(row);
|
|
56306
56778
|
const ref = state.bodies.get(key);
|
|
56307
|
-
const now = ref ? sql`(SELECT "before" FROM history WHERE id = ${ref})` : trashId ? sql`(SELECT json_extract(data, ${`$.${column2}`}) FROM trash_rows WHERE trash_id = ${trashId} AND table_name = ${table} AND json_extract(data, '$.id') = ${
|
|
56779
|
+
const now = ref ? sql`(SELECT "before" FROM history WHERE id = ${ref})` : trashId ? sql`(SELECT json_extract(data, ${`$.${column2}`}) FROM trash_rows WHERE trash_id = ${trashId} AND table_name = ${table} AND json_extract(data, '$.id') = ${id3})` : sql`(SELECT ${sql.identifier(column2)} FROM ${sql.identifier(table)} WHERE id = ${id3})`;
|
|
56308
56780
|
const found = db.get(
|
|
56309
56781
|
sql`SELECT ${now} IS h."before" AS isBefore, ${now} IS h."after" AS isAfter, substr(${now}, 1, 200) AS current FROM history h WHERE h.id = ${row.id}`
|
|
56310
56782
|
);
|
|
@@ -56457,6 +56929,7 @@ var UndoService = class {
|
|
|
56457
56929
|
}
|
|
56458
56930
|
const checklist = /* @__PURE__ */ __name(() => one(db.select({ title: checklists.title }).from(checklists).where(and(eq(checklists.id, subject), eq(checklists.cardId, card.id)))) ?? kept("checklists", subject).filter(({ data }) => data.card_id === card.id).map(({ data }) => ({ title: String(data.title) }))[0], "checklist");
|
|
56459
56931
|
const item = /* @__PURE__ */ __name(() => one(db.select({ text: checklistItems.text, done: checklistItems.done }).from(checklistItems).where(eq(checklistItems.id, subject))) ?? kept("checklist_items", subject).map(({ data }) => ({ text: String(data.text), done: Boolean(data.done) }))[0], "item");
|
|
56932
|
+
const comment = /* @__PURE__ */ __name(() => one(db.select({ id: cardComments.id }).from(cardComments).where(and(eq(cardComments.id, subject), eq(cardComments.cardId, card.id)))) ?? kept("card_comments", subject).find(({ data }) => data.card_id === card.id), "comment");
|
|
56460
56933
|
switch (kind) {
|
|
56461
56934
|
case "checklist.created":
|
|
56462
56935
|
case "checklist.restored":
|
|
@@ -56477,15 +56950,25 @@ var UndoService = class {
|
|
|
56477
56950
|
const it = item();
|
|
56478
56951
|
return it ? value(kind === "item.text" ? it.text : it.done) : { status: "impossible", reason: "gone" };
|
|
56479
56952
|
}
|
|
56953
|
+
case "comment.created":
|
|
56954
|
+
case "comment.restored":
|
|
56955
|
+
return takeAway(`comment:${subject}`, () => Boolean(comment()) || returning(subject));
|
|
56956
|
+
case "comment.deleted":
|
|
56957
|
+
return bringBack(`comment:${subject}`, () => Boolean(comment()));
|
|
56958
|
+
case "comment.body": {
|
|
56959
|
+
const it = comment();
|
|
56960
|
+
if (!it && !state.bodies.has(fieldKey(row))) return { status: "impossible", reason: "gone" };
|
|
56961
|
+
return body("card_comments", "body", it && "trashId" in it ? it.trashId : void 0, subject);
|
|
56962
|
+
}
|
|
56480
56963
|
}
|
|
56481
56964
|
}
|
|
56482
56965
|
return { status: "impossible", reason: "refused" };
|
|
56483
56966
|
}
|
|
56484
56967
|
/** Undoes one change, through the services that make changes, so it is checked and recorded as any other. */
|
|
56485
56968
|
async apply(row, actor) {
|
|
56486
|
-
const { cards: cardService, pages: pageService, attachments: attachmentService, trash: trashService } = this.services;
|
|
56969
|
+
const { cards: cardService, pages: pageService, attachments: attachmentService, trash: trashService, comments: commentService } = this.services;
|
|
56487
56970
|
const kind = row.kind;
|
|
56488
|
-
const raw2 =
|
|
56971
|
+
const raw2 = HISTORY_LONG_KINDS.has(kind) ? this.deps.db.get(sql`SELECT "before" AS text FROM history WHERE id = ${row.id}`)?.text ?? null : row.before;
|
|
56489
56972
|
const before = decode4(kind, raw2);
|
|
56490
56973
|
const subject = row.subjectId ?? "";
|
|
56491
56974
|
const trashId = typeof row.meta.trashId === "string" ? row.meta.trashId : "";
|
|
@@ -56547,6 +57030,11 @@ var UndoService = class {
|
|
|
56547
57030
|
return cardService.updateItem(actor, subject, { text: String(before ?? "") });
|
|
56548
57031
|
case "item.done":
|
|
56549
57032
|
return cardService.updateItem(actor, subject, { done: before === true });
|
|
57033
|
+
case "comment.created":
|
|
57034
|
+
case "comment.restored":
|
|
57035
|
+
return commentService.remove(actor, subject);
|
|
57036
|
+
case "comment.body":
|
|
57037
|
+
return commentService.update(actor, subject, { body: String(before ?? "") });
|
|
56550
57038
|
case "attachment.created":
|
|
56551
57039
|
case "attachment.restored":
|
|
56552
57040
|
return attachmentService.remove(actor, subject);
|
|
@@ -56559,6 +57047,7 @@ var UndoService = class {
|
|
|
56559
57047
|
case "card.unlinked":
|
|
56560
57048
|
case "checklist.deleted":
|
|
56561
57049
|
case "item.deleted":
|
|
57050
|
+
case "comment.deleted":
|
|
56562
57051
|
case "attachment.deleted":
|
|
56563
57052
|
return trashService.restore(actor, trashId);
|
|
56564
57053
|
}
|
|
@@ -56945,6 +57434,7 @@ function createServices(deps) {
|
|
|
56945
57434
|
const history2 = new HistoryService(deps, access);
|
|
56946
57435
|
const trash2 = new TrashService(deps, access, activity2, history2);
|
|
56947
57436
|
const cards2 = new CardService(deps, access, activity2, trash2, history2);
|
|
57437
|
+
const comments = new CommentService(deps, access, activity2, trash2, history2);
|
|
56948
57438
|
const workspaces2 = new WorkspaceService(deps, access, activity2, cards2, trash2);
|
|
56949
57439
|
const tokens = new TokenService(deps, access);
|
|
56950
57440
|
const attachments2 = new AttachmentService(deps, access, activity2, trash2, history2);
|
|
@@ -56959,10 +57449,11 @@ function createServices(deps) {
|
|
|
56959
57449
|
history: history2,
|
|
56960
57450
|
trash: trash2,
|
|
56961
57451
|
cards: cards2,
|
|
57452
|
+
comments,
|
|
56962
57453
|
workspaces: workspaces2,
|
|
56963
57454
|
boards: new BoardService(deps, access, activity2, cards2, trash2),
|
|
56964
57455
|
pages: pages2,
|
|
56965
|
-
undo: new UndoService(deps, access, { cards: cards2, pages: pages2, attachments: attachments2, trash: trash2 }),
|
|
57456
|
+
undo: new UndoService(deps, access, { cards: cards2, pages: pages2, attachments: attachments2, trash: trash2, comments }),
|
|
56966
57457
|
search: new SearchService(deps, access),
|
|
56967
57458
|
attachments: attachments2,
|
|
56968
57459
|
tokens,
|
|
@@ -57071,6 +57562,13 @@ var migrations_gen_default = {
|
|
|
57071
57562
|
"when": 1794969843692,
|
|
57072
57563
|
"tag": "0010_vault_key_version",
|
|
57073
57564
|
"breakpoints": true
|
|
57565
|
+
},
|
|
57566
|
+
{
|
|
57567
|
+
"idx": 11,
|
|
57568
|
+
"version": "6",
|
|
57569
|
+
"when": 1795270929363,
|
|
57570
|
+
"tag": "0011_card_comments",
|
|
57571
|
+
"breakpoints": true
|
|
57074
57572
|
}
|
|
57075
57573
|
]
|
|
57076
57574
|
},
|
|
@@ -57085,7 +57583,8 @@ var migrations_gen_default = {
|
|
|
57085
57583
|
"m0007": "CREATE TABLE `trash` (\n `id` text PRIMARY KEY NOT NULL,\n `workspace_id` text NOT NULL,\n `kind` text NOT NULL,\n `entity_id` text NOT NULL,\n `title` text NOT NULL,\n `location` text DEFAULT '' NOT NULL,\n `contents` text NOT NULL,\n `bytes` integer DEFAULT 0 NOT NULL,\n `actor_kind` text NOT NULL,\n `actor_user_id` text,\n `actor_token_id` text,\n `actor_name` text NOT NULL,\n `deleted_at` integer NOT NULL,\n `expires_at` integer NOT NULL,\n FOREIGN KEY (`workspace_id`) REFERENCES `workspaces`(`id`) ON UPDATE no action ON DELETE cascade,\n FOREIGN KEY (`actor_user_id`) REFERENCES `users`(`id`) ON UPDATE no action ON DELETE set null,\n FOREIGN KEY (`actor_token_id`) REFERENCES `api_tokens`(`id`) ON UPDATE no action ON DELETE set null\n);\n--> statement-breakpoint\nCREATE INDEX `trash_workspace_idx` ON `trash` (`workspace_id`,`deleted_at`);--> statement-breakpoint\nCREATE INDEX `trash_expires_idx` ON `trash` (`expires_at`);--> statement-breakpoint\nCREATE TABLE `trash_rows` (\n `id` integer PRIMARY KEY NOT NULL,\n `trash_id` text NOT NULL,\n `table_name` text NOT NULL,\n `data` text NOT NULL,\n `storage_key` text,\n FOREIGN KEY (`trash_id`) REFERENCES `trash`(`id`) ON UPDATE no action ON DELETE cascade\n);\n--> statement-breakpoint\nCREATE INDEX `trash_rows_trash_idx` ON `trash_rows` (`trash_id`,`id`);--> statement-breakpoint\nCREATE INDEX `trash_rows_storage_idx` ON `trash_rows` (`storage_key`);",
|
|
57086
57584
|
"m0008": "CREATE TABLE `history` (\n `id` text PRIMARY KEY NOT NULL,\n `workspace_id` text NOT NULL,\n `entity_type` text NOT NULL,\n `entity_id` text NOT NULL,\n `kind` text NOT NULL,\n `subject_id` text,\n `before` text,\n `after` text,\n `meta` text NOT NULL,\n `actor_kind` text NOT NULL,\n `actor_user_id` text,\n `actor_token_id` text,\n `actor_name` text NOT NULL,\n `batch_id` text NOT NULL,\n `created_at` integer NOT NULL,\n `updated_at` integer NOT NULL,\n FOREIGN KEY (`workspace_id`) REFERENCES `workspaces`(`id`) ON UPDATE no action ON DELETE cascade,\n FOREIGN KEY (`actor_user_id`) REFERENCES `users`(`id`) ON UPDATE no action ON DELETE set null,\n FOREIGN KEY (`actor_token_id`) REFERENCES `api_tokens`(`id`) ON UPDATE no action ON DELETE set null\n);\n--> statement-breakpoint\nCREATE INDEX `history_entity_idx` ON `history` (`entity_id`,`updated_at`);--> statement-breakpoint\nCREATE INDEX `history_subject_idx` ON `history` (`subject_id`);--> statement-breakpoint\nCREATE INDEX `history_user_idx` ON `history` (`actor_user_id`,`updated_at`);--> statement-breakpoint\nCREATE INDEX `history_token_idx` ON `history` (`actor_token_id`,`updated_at`);--> statement-breakpoint\nCREATE INDEX `history_updated_idx` ON `history` (`updated_at`);--> statement-breakpoint\nCREATE INDEX `history_batch_idx` ON `history` (`batch_id`);",
|
|
57087
57585
|
"m0009": "ALTER TABLE `oauth_tokens` ADD `scopes` text;",
|
|
57088
|
-
"m0010": "ALTER TABLE `vault_items` ADD `key_version` integer DEFAULT 0 NOT NULL;--> statement-breakpoint\nALTER TABLE `vaults` ADD `key_version` integer DEFAULT 0 NOT NULL;"
|
|
57586
|
+
"m0010": "ALTER TABLE `vault_items` ADD `key_version` integer DEFAULT 0 NOT NULL;--> statement-breakpoint\nALTER TABLE `vaults` ADD `key_version` integer DEFAULT 0 NOT NULL;",
|
|
57587
|
+
"m0011": "CREATE TABLE `card_comments` (\n `id` text PRIMARY KEY NOT NULL,\n `workspace_id` text NOT NULL,\n `card_id` text NOT NULL,\n `body` text NOT NULL,\n `author_kind` text NOT NULL,\n `author_user_id` text,\n `author_token_id` text,\n `author_name` text NOT NULL,\n `created_at` integer NOT NULL,\n `updated_at` integer NOT NULL,\n `edited_at` integer,\n FOREIGN KEY (`workspace_id`) REFERENCES `workspaces`(`id`) ON UPDATE no action ON DELETE cascade,\n FOREIGN KEY (`card_id`) REFERENCES `cards`(`id`) ON UPDATE no action ON DELETE cascade,\n FOREIGN KEY (`author_user_id`) REFERENCES `users`(`id`) ON UPDATE no action ON DELETE set null,\n FOREIGN KEY (`author_token_id`) REFERENCES `api_tokens`(`id`) ON UPDATE no action ON DELETE set null\n);\n--> statement-breakpoint\nCREATE INDEX `card_comments_card_idx` ON `card_comments` (`card_id`,`created_at`);--> statement-breakpoint\nCREATE INDEX `card_comments_token_idx` ON `card_comments` (`author_token_id`);--> statement-breakpoint\n-- Full-text search over comments, as for cards and pages (0001_search): each FTS row is linked to\n-- its comment through a mapping table whose INTEGER PRIMARY KEY is the FTS rowid.\nCREATE TABLE `card_comments_fts_map` (`id` integer PRIMARY KEY, `entity_id` text NOT NULL UNIQUE);\n--> statement-breakpoint\nCREATE VIRTUAL TABLE `card_comments_fts` USING fts5(body, tokenize = 'unicode61 remove_diacritics 2');\n--> statement-breakpoint\nCREATE TRIGGER `card_comments_fts_insert` AFTER INSERT ON `card_comments` BEGIN\n INSERT INTO card_comments_fts_map (entity_id) VALUES (new.id);\n INSERT INTO card_comments_fts (rowid, body)\n VALUES ((SELECT id FROM card_comments_fts_map WHERE entity_id = new.id), new.body);\nEND;\n--> statement-breakpoint\nCREATE TRIGGER `card_comments_fts_update` AFTER UPDATE OF body ON `card_comments` BEGIN\n UPDATE card_comments_fts SET body = new.body\n WHERE rowid = (SELECT id FROM card_comments_fts_map WHERE entity_id = new.id);\nEND;\n--> statement-breakpoint\nCREATE TRIGGER `card_comments_fts_delete` AFTER DELETE ON `card_comments` BEGIN\n DELETE FROM card_comments_fts WHERE rowid = (SELECT id FROM card_comments_fts_map WHERE entity_id = old.id);\n DELETE FROM card_comments_fts_map WHERE entity_id = old.id;\nEND;\n"
|
|
57089
57588
|
}
|
|
57090
57589
|
};
|
|
57091
57590
|
|