@wirecat/cli-core 0.724.0 → 0.725.0
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/CHANGELOG.md +36 -0
- package/dist/cli/documents/file-conflicts.d.ts +7 -2
- package/dist/cli/documents/file-conflicts.js +5 -4
- package/dist/cli/documents/file-edit.js +4 -4
- package/dist/cli/documents/index.d.ts +1 -1
- package/dist/cli/messenger/search-answers.js +4 -0
- package/dist/cli/search-left-out.d.ts +1 -0
- package/dist/cli/search-left-out.js +1 -0
- package/dist/crm/manifest/writer.js +1 -1
- package/dist/crm/testing/manifest-fake.js +2 -2
- package/dist/domain/providers.d.ts +1 -1
- package/dist/domain/providers.js +4 -1
- package/dist/entities/hit.d.ts +3 -2
- package/dist/entities/hit.js +5 -1
- package/dist/entities/index.d.ts +1 -1
- package/dist/errors/reasons.js +22 -1
- package/dist/office/docx.js +10 -10
- package/dist/office/xlsx.js +17 -17
- package/dist/search/account-list.js +1 -0
- package/dist/services/search-all.d.ts +7 -3
- package/dist/services/search-all.js +51 -1
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,42 @@ Notable changes to `@wirecat/cli-core` (`@wirecat/cli-messaging` up to 0.261.0,
|
|
|
5
5
|
minor version may break callers, and says how under "Changed — may break callers". `pnpm docs:check` checks the
|
|
6
6
|
shape of this file.
|
|
7
7
|
|
|
8
|
+
## 0.725.0 — 23.11.2026
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
|
|
12
|
+
- **`search all` finds a tracker's issues, projects and comments.** A new lane, `tracker`, reads every tracker
|
|
13
|
+
account's copy by the words of titles and text, as `issues search` does, beside messages, mail, notes and the rest.
|
|
14
|
+
Hits are `issue` (titled with the key, `ENG-12 Fix login`), `project` and `issue_comment`, with ref
|
|
15
|
+
`tracker:<provider>/<account>/<kind>/<id>`, their title and excerpt untrusted. A provider kind `tracker` joins the
|
|
16
|
+
registry, and `linear` is seeded as one. A CLI that gates `search all` lanes by list keys gates issues and comments
|
|
17
|
+
by `issues.list` and projects by `projects.list`: memo needs that gate in the bump that brings this lane
|
|
18
|
+
([TRACKER.md](docs/dev/TRACKER.md#search-all)).
|
|
19
|
+
|
|
20
|
+
### Changed — may break callers
|
|
21
|
+
|
|
22
|
+
- **`mirrors conflicts resolve` runs inside the app's run.** `FileConflictCommands.connect(command, mirror, body)` now
|
|
23
|
+
takes the body and runs it inside the app's run, so a resolve is bounded by `--timeout`, kept by `--record` under its
|
|
24
|
+
own name, and its requests land in that run. Before, `connect` answered the connection and the resolve ran outside
|
|
25
|
+
any run. A CLI that mounts `fileConflictsCommand` wraps `body(connection)` in its own run, as its `mirrors sync`
|
|
26
|
+
does; `FileConflictConnection` is the type it hands over (#3230).
|
|
27
|
+
- **The Office edit refusals keep their own reason, spelled like every other reason.** `office.formula_cell` and the
|
|
28
|
+
other `office.*` reasons were not registered, so the CLI and MCP showed `input.invalid` in their place, and the
|
|
29
|
+
registry refuses an underscore. They are registered now and use hyphens: `office.formula-cell`,
|
|
30
|
+
`office.wrong-format`, `office.invalid-cell`, `office.no-sheet` and the rest
|
|
31
|
+
([Editing Office files](docs/office.md)). Code that compared `details.reason` with the old spelling compares
|
|
32
|
+
with the new one.
|
|
33
|
+
|
|
34
|
+
### Fixed
|
|
35
|
+
|
|
36
|
+
- **The shared `changes` command passes the command lint.** With cli-base 0.129.0 or later, whose vocabulary has the
|
|
37
|
+
view `changes` and the flags `--since <time>` and `--event <events>`, and the `--until <time>` cli-core 0.724.0
|
|
38
|
+
takes, a documents CLI needs no lint override or audit difference for it. cli-core's own command lint now mounts
|
|
39
|
+
`documents history` and `changes`, so a new finding fails here first (#3229).
|
|
40
|
+
- **`crmManifestFake` keeps a written value at a place whose schema lists the values it takes.** It dropped every
|
|
41
|
+
value there and kept its sample, the list's first: a deal written in EUR read back in ARS from Attio's real
|
|
42
|
+
`currency_code`, so `crmManifestWriteContract` failed on Attio's own API description.
|
|
43
|
+
|
|
8
44
|
## 0.724.0 — 23.11.2026
|
|
9
45
|
|
|
10
46
|
### Added
|
|
@@ -15,9 +15,14 @@ export interface FileConflictCommands {
|
|
|
15
15
|
pathOf(mirror: Mirror, input: string): string;
|
|
16
16
|
stateOf(command: Command, mirror: Mirror): FileMirrorStatePort;
|
|
17
17
|
versionsOf(command: Command, mirror: Mirror): FileVersions;
|
|
18
|
-
/**
|
|
19
|
-
|
|
18
|
+
/**
|
|
19
|
+
* Runs `body` inside the app's run (its `--timeout`, run record and request log) with the remote signed in for the
|
|
20
|
+
* mirror's account, the write guard and the mirrors' sync lock; answers what `body` answered.
|
|
21
|
+
*/
|
|
22
|
+
connect<T>(command: Command, mirror: Mirror, body: (connection: FileConflictConnection) => Promise<T>): Promise<T>;
|
|
20
23
|
}
|
|
24
|
+
/** What `connect` hands `mirrors conflicts resolve`. */
|
|
25
|
+
export type FileConflictConnection = Pick<FileConflictResolveOptions, "target" | "principal" | "guard" | "operationId" | "lock" | "signal">;
|
|
21
26
|
/**
|
|
22
27
|
* `mirrors conflicts list|show|resolve` for a file mirror: the conflicts the last sync left, each with its three
|
|
23
28
|
* versions and the line merge that failed, and a resolution that writes one final content to both sides.
|
|
@@ -86,16 +86,17 @@ export const fileConflictsCommand = (helpers) => {
|
|
|
86
86
|
});
|
|
87
87
|
const mirror = one(this, id);
|
|
88
88
|
const keep = (args.keep === remote ? "remote" : args.keep);
|
|
89
|
-
const
|
|
90
|
-
|
|
89
|
+
const path = helpers.pathOf(mirror, input);
|
|
90
|
+
const resolved = await helpers.connect(this, mirror, (connection) => resolveFileConflict({
|
|
91
|
+
...connection,
|
|
91
92
|
root: mirror.path,
|
|
92
93
|
folder: mirror.folder,
|
|
93
|
-
path
|
|
94
|
+
path,
|
|
94
95
|
state: helpers.stateOf(this, mirror),
|
|
95
96
|
versions: helpers.versionsOf(this, mirror),
|
|
96
97
|
remote,
|
|
97
98
|
choice: keep ? { keep } : { file: file },
|
|
98
|
-
});
|
|
99
|
+
}));
|
|
99
100
|
const resolution = resolved.resolution === "remote" ? remote : resolved.resolution;
|
|
100
101
|
helpers.output(this, itemOf(snakeKeys({ id, ...resolved, resolution })));
|
|
101
102
|
}));
|
|
@@ -59,7 +59,7 @@ const columnName = (column) => {
|
|
|
59
59
|
const cornerOf = (address) => {
|
|
60
60
|
const match = ADDRESS.exec(address.toUpperCase());
|
|
61
61
|
if (!match)
|
|
62
|
-
throw new CliError("validation_error", `${address} is not a cell like B7`, { reason: "office.
|
|
62
|
+
throw new CliError("validation_error", `${address} is not a cell like B7`, { reason: "office.invalid-cell" });
|
|
63
63
|
const letters = match[1];
|
|
64
64
|
return {
|
|
65
65
|
column: [...letters].reduce((sum, letter) => sum * 26 + letter.charCodeAt(0) - 64, 0),
|
|
@@ -201,7 +201,7 @@ const addFileEditCommandsDefinition = (files, helpers) => {
|
|
|
201
201
|
const wanted = sheetRangeOf(range);
|
|
202
202
|
if (wanted.range === undefined)
|
|
203
203
|
throw new CliError("validation_error", `${range} names no cell; give one like Sheet1!B2`, {
|
|
204
|
-
reason: "office.
|
|
204
|
+
reason: "office.invalid-cell",
|
|
205
205
|
});
|
|
206
206
|
cellEditsOf("", wanted.range, values);
|
|
207
207
|
await editInPlace(this, "sheets", input, args.expectedFingerprint, async (bytes) => {
|
|
@@ -209,7 +209,7 @@ const addFileEditCommandsDefinition = (files, helpers) => {
|
|
|
209
209
|
if (sheet === undefined) {
|
|
210
210
|
const names = (await readXlsxCells(bytes, { range: "A1" })).map((one) => one.name);
|
|
211
211
|
if (names.length !== 1)
|
|
212
|
-
throw new CliError("validation_error", `the workbook has ${names.length} sheets (${names.map((name) => `"${name}"`).join(", ")}); name one, like ${names[0] ?? "Sheet1"}!${wanted.range}`, { reason: "office.
|
|
212
|
+
throw new CliError("validation_error", `the workbook has ${names.length} sheets (${names.map((name) => `"${name}"`).join(", ")}); name one, like ${names[0] ?? "Sheet1"}!${wanted.range}`, { reason: "office.no-sheet" });
|
|
213
213
|
sheet = names[0];
|
|
214
214
|
}
|
|
215
215
|
try {
|
|
@@ -228,7 +228,7 @@ const addFileEditCommandsDefinition = (files, helpers) => {
|
|
|
228
228
|
};
|
|
229
229
|
}
|
|
230
230
|
catch (error) {
|
|
231
|
-
if (isCliError(error) && error.details?.reason === "office.
|
|
231
|
+
if (isCliError(error) && error.details?.reason === "office.formula-cell")
|
|
232
232
|
throw new CliError("validation_error", error.message.replace("pass overwriteFormulas", "pass --replace"), error.details);
|
|
233
233
|
throw error;
|
|
234
234
|
}
|
|
@@ -10,7 +10,7 @@ import { type DocumentSyncCommands } from "./sync.js";
|
|
|
10
10
|
import type { DocumentWords } from "./words.js";
|
|
11
11
|
export { addDocumentCatalogCommands, CATALOG_FIELDS, type CatalogTree, type CatalogTreeSource, catalogId, catalogOutput, catalogSource, catalogTree, type DocumentCatalog, type DocumentCatalogCommands, type DocumentCatalogStores, } from "./catalog.js";
|
|
12
12
|
export { addLocalDocumentCommands, type ImportedDocument, type LocalDocumentCommands } from "./documents.js";
|
|
13
|
-
export { type FileConflictCommands, fileConflictsCommand } from "./file-conflicts.js";
|
|
13
|
+
export { type FileConflictCommands, type FileConflictConnection, fileConflictsCommand } from "./file-conflicts.js";
|
|
14
14
|
export { addFileEditCommands, type FileEditCommands } from "./file-edit.js";
|
|
15
15
|
export { addFileUpdateCommand, type FileUpdateCommands, type FileUpdatePort } from "./file-update.js";
|
|
16
16
|
export { addDocumentFolderCommands, type DocumentFolderCommands } from "./folders.js";
|
|
@@ -297,6 +297,10 @@ const ALL_HIT_UNTRUSTED = {
|
|
|
297
297
|
lead: ["title", "excerpt"],
|
|
298
298
|
// A client's file: its name and every word of it are someone else's.
|
|
299
299
|
crm_file: ["title", "excerpt"],
|
|
300
|
+
// Written by the tracker's users, the owner's colleagues or anyone a public issue lets in.
|
|
301
|
+
issue: ["title", "excerpt"],
|
|
302
|
+
project: ["title", "excerpt"],
|
|
303
|
+
issue_comment: ["title", "excerpt"],
|
|
300
304
|
...BUSINESS_UNTRUSTED,
|
|
301
305
|
};
|
|
302
306
|
export const allHitItem = (item) => item.kind === "meeting"
|
|
@@ -12,6 +12,7 @@ declare const LIST_KEYS: {
|
|
|
12
12
|
readonly events: "events.list";
|
|
13
13
|
readonly meetings: "meetings.list";
|
|
14
14
|
readonly crm_file: "files.list";
|
|
15
|
+
readonly tracker: "issues.list";
|
|
15
16
|
};
|
|
16
17
|
export type SearchedKind = keyof typeof LIST_KEYS;
|
|
17
18
|
export interface LeftOut<K extends SearchedKind> {
|
|
@@ -13,6 +13,7 @@ const LIST_KEYS = {
|
|
|
13
13
|
events: "events.list",
|
|
14
14
|
meetings: "meetings.list",
|
|
15
15
|
crm_file: "files.list",
|
|
16
|
+
tracker: "issues.list",
|
|
16
17
|
};
|
|
17
18
|
/**
|
|
18
19
|
* The kinds whose list `permissions` deny, for a CLI with levels of its own, such as memo's: `by` names who denies in
|
|
@@ -51,7 +51,6 @@ export const crmManifestWriteKeys = (input, api, bodyPermissions) => {
|
|
|
51
51
|
};
|
|
52
52
|
};
|
|
53
53
|
const refused = (message, param) => new CliError("validation_error", message, { reason: "crm.record-field", sent: false, ...(param ? { param } : {}) });
|
|
54
|
-
/** A merge of the entries rules that share a key give: each object's keys beside the others'. */
|
|
55
54
|
/** Our fields that write one key of the service together, by that key: Attio's name and its parts. */
|
|
56
55
|
const sharedOf = (one) => {
|
|
57
56
|
const by = new Map();
|
|
@@ -60,6 +59,7 @@ const sharedOf = (one) => {
|
|
|
60
59
|
by.set(rule.to, [...(by.get(rule.to) ?? []), field]);
|
|
61
60
|
return [...by.values()].filter((fields) => fields.length > 1);
|
|
62
61
|
};
|
|
62
|
+
/** A merge of the entries rules that share a key give: each object's keys beside the others'. */
|
|
63
63
|
const merged = (entries, list) => {
|
|
64
64
|
const given = entries.filter((one) => one !== CLEAR);
|
|
65
65
|
if (given.length === 0)
|
|
@@ -79,7 +79,7 @@ const givenOf = (spec, values) => {
|
|
|
79
79
|
.map(String);
|
|
80
80
|
if (list)
|
|
81
81
|
given[name] = field === "people" ? found.map((one) => ({ externalId: one, role: "contact" })) : found;
|
|
82
|
-
//
|
|
82
|
+
// One value replaces the field whole, so a part of a key several rules share that the write leaves out is gone.
|
|
83
83
|
else
|
|
84
84
|
given[name] = found[0] ?? null;
|
|
85
85
|
}
|
|
@@ -162,7 +162,7 @@ export const crmManifestFake = (input, options) => {
|
|
|
162
162
|
if (type === "integer" || type === "number")
|
|
163
163
|
return Number.isFinite(Number(value)) ? Number(value) : undefined;
|
|
164
164
|
if (type === "string" && found?.type === "string" && found.enum)
|
|
165
|
-
return undefined;
|
|
165
|
+
return found.enum.includes(String(value)) ? String(value) : undefined;
|
|
166
166
|
return ["string", "unknown"].includes(type) ? String(value) : undefined;
|
|
167
167
|
};
|
|
168
168
|
/**
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { Provider } from "./models.js";
|
|
2
2
|
import { type RefKindName } from "./references.js";
|
|
3
3
|
/** What a search reads; the same names `--only`, `searched` and `skipped` use. */
|
|
4
|
-
export declare const KINDS: readonly ["messages", "mail", "notes", "documents", "meetings", "events", "crm"];
|
|
4
|
+
export declare const KINDS: readonly ["messages", "mail", "notes", "documents", "meetings", "events", "crm", "tracker"];
|
|
5
5
|
export type Kind = (typeof KINDS)[number];
|
|
6
6
|
export interface ProviderEntry {
|
|
7
7
|
name: Provider;
|
package/dist/domain/providers.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { CliError } from "@wirecat/cli-base";
|
|
2
2
|
import { REF_KINDS } from "./references.js";
|
|
3
3
|
/** What a search reads; the same names `--only`, `searched` and `skipped` use. */
|
|
4
|
-
export const KINDS = ["messages", "mail", "notes", "documents", "meetings", "events", "crm"];
|
|
4
|
+
export const KINDS = ["messages", "mail", "notes", "documents", "meetings", "events", "crm", "tracker"];
|
|
5
5
|
const MESSENGER_OPENS = { chat: "messages list", message: "messages show", contact: "contacts show" };
|
|
6
6
|
/** What a CRM CLI's entry gives as `opens`: the read commands `addCrmCommands` mounts. */
|
|
7
7
|
export const CRM_OPENS = { deal: "deals show", lead: "leads show", pipeline: "pipelines show" };
|
|
@@ -22,6 +22,8 @@ export const PROVIDERS = [
|
|
|
22
22
|
// Google Meet has no tool of its own: its meetings are gcal's, since every meeting is on the calendar.
|
|
23
23
|
{ name: "google-meet", kind: "meetings", aliases: [], command: "gcal" },
|
|
24
24
|
{ name: "google-drive", kind: "documents", aliases: [] },
|
|
25
|
+
// Seeded: linear-cli registers no entry, and without one its accounts would count as a messenger's.
|
|
26
|
+
{ name: "linear", kind: "tracker", aliases: [], command: "linear" },
|
|
25
27
|
// Its meetings come from the notes Telemost mails (`keeper@telemost.yandex.ru`), read by a mail rule.
|
|
26
28
|
{ name: "telemost", kind: "meetings", aliases: [] },
|
|
27
29
|
// A phone export's records: its SMS and its calls in the one account the import names.
|
|
@@ -41,6 +43,7 @@ const LABELS = {
|
|
|
41
43
|
added: "added by hand",
|
|
42
44
|
email: "mail",
|
|
43
45
|
telemost: "Telemost",
|
|
46
|
+
linear: "Linear",
|
|
44
47
|
};
|
|
45
48
|
/** How a text names a provider to a person: `MAX`, not `max`. */
|
|
46
49
|
export const providerLabel = (provider) => LABELS[provider] ?? provider;
|
package/dist/entities/hit.d.ts
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import * as v from "valibot";
|
|
2
2
|
/**
|
|
3
3
|
* One result of `search all`: a message, a mail, a note, a calendar event, a meeting passage, a deal, a lead, the text
|
|
4
|
-
* of a downloaded CRM file, or an invoice, payment, order, contract,
|
|
4
|
+
* of a downloaded CRM file, a tracker's issue, project or issue comment, or an invoice, payment, order, contract,
|
|
5
|
+
* subscription, product or wallet.
|
|
5
6
|
*/
|
|
6
7
|
export declare const hit: v.StrictObjectSchema<{
|
|
7
|
-
readonly kind: v.PicklistSchema<["message", "mail", "note", "document", "event", "meeting", "deal", "lead", "crm_file", "invoice", "payment", "order", "contract", "subscription", "product", "wallet"], undefined>;
|
|
8
|
+
readonly kind: v.PicklistSchema<["message", "mail", "note", "document", "event", "meeting", "deal", "lead", "crm_file", "issue", "project", "issue_comment", "invoice", "payment", "order", "contract", "subscription", "product", "wallet"], undefined>;
|
|
8
9
|
readonly ref: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, "a reference such as `note:42`">]>;
|
|
9
10
|
readonly provider: v.StringSchema<undefined>;
|
|
10
11
|
readonly url: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
package/dist/entities/hit.js
CHANGED
|
@@ -4,7 +4,8 @@ import { hitFile } from "./attachment.js";
|
|
|
4
4
|
import { count, reference, text, time, untrusted } from "./fields.js";
|
|
5
5
|
/**
|
|
6
6
|
* One result of `search all`: a message, a mail, a note, a calendar event, a meeting passage, a deal, a lead, the text
|
|
7
|
-
* of a downloaded CRM file, or an invoice, payment, order, contract,
|
|
7
|
+
* of a downloaded CRM file, a tracker's issue, project or issue comment, or an invoice, payment, order, contract,
|
|
8
|
+
* subscription, product or wallet.
|
|
8
9
|
*/
|
|
9
10
|
export const hit = v.strictObject({
|
|
10
11
|
kind: v.picklist([
|
|
@@ -17,6 +18,9 @@ export const hit = v.strictObject({
|
|
|
17
18
|
"deal",
|
|
18
19
|
"lead",
|
|
19
20
|
"crm_file",
|
|
21
|
+
"issue",
|
|
22
|
+
"project",
|
|
23
|
+
"issue_comment",
|
|
20
24
|
...BUSINESS_KINDS,
|
|
21
25
|
]),
|
|
22
26
|
ref: reference,
|
package/dist/entities/index.d.ts
CHANGED
|
@@ -4326,7 +4326,7 @@ export declare const ENTITIES: {
|
|
|
4326
4326
|
readonly untrusted: v.OptionalSchema<v.ArraySchema<v.StringSchema<undefined>, undefined>, undefined>;
|
|
4327
4327
|
}, undefined>;
|
|
4328
4328
|
readonly hit: v.StrictObjectSchema<{
|
|
4329
|
-
readonly kind: v.PicklistSchema<["message", "mail", "note", "document", "event", "meeting", "deal", "lead", "crm_file", "invoice", "payment", "order", "contract", "subscription", "product", "wallet"], undefined>;
|
|
4329
|
+
readonly kind: v.PicklistSchema<["message", "mail", "note", "document", "event", "meeting", "deal", "lead", "crm_file", "issue", "project", "issue_comment", "invoice", "payment", "order", "contract", "subscription", "product", "wallet"], undefined>;
|
|
4330
4330
|
readonly ref: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, "a reference such as `note:42`">]>;
|
|
4331
4331
|
readonly provider: v.StringSchema<undefined>;
|
|
4332
4332
|
readonly url: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
package/dist/errors/reasons.js
CHANGED
|
@@ -123,6 +123,27 @@ const SQL = [
|
|
|
123
123
|
["db.timeout", "timeout", "the database server did not answer in time"],
|
|
124
124
|
["db.failed", "provider_error", "the database server failed the query"],
|
|
125
125
|
];
|
|
126
|
+
/** In-place Office edits (`./office`, `files sheets|documents update`); the names are documented in office.md. */
|
|
127
|
+
const OFFICE = [
|
|
128
|
+
["office.wrong-format", "the file is not the Office format the command edits, or its parts cannot be read"],
|
|
129
|
+
["office.invalid-cell", "a cell is not an address like B7"],
|
|
130
|
+
["office.invalid-value", "a cell value cannot be written: a number must be finite"],
|
|
131
|
+
["office.no-sheet", "the workbook has no such sheet, or several when none is named"],
|
|
132
|
+
["office.duplicate-edit", "the same cell or paragraph is changed twice in one call"],
|
|
133
|
+
["office.formula-cell", "the cell holds a formula; --replace writes the value over it"],
|
|
134
|
+
["office.shared-formula", "the cell holds a formula other cells share; replacing it would break theirs"],
|
|
135
|
+
["office.array-formula", "the cell is part of an array formula; change it in Excel"],
|
|
136
|
+
["office.rich-value", "the cell holds a picture or a linked data type, which the editor does not replace"],
|
|
137
|
+
["office.table-header", "the cell is a table's header or total, whose part repeats the text; change it in Excel"],
|
|
138
|
+
["office.implicit-rows", "the sheet has rows without numbers, so a row cannot be added"],
|
|
139
|
+
["office.implicit-cells", "the row has cells without addresses, so a cell cannot be added"],
|
|
140
|
+
["office.no-paragraph", "the document has no paragraph at that index"],
|
|
141
|
+
["office.unsafe-paragraph", "the paragraph cannot be edited safely; documents show gives the reason"],
|
|
142
|
+
["office.tracked-change", "the paragraph holds a tracked change"],
|
|
143
|
+
["office.section-break", "the paragraph ends a section; deleting it would merge two sections"],
|
|
144
|
+
["office.bookmark", "the paragraph holds a bookmark a cross-reference may point at"],
|
|
145
|
+
["office.last-paragraph", "the delete would leave the document or a table cell without a paragraph"],
|
|
146
|
+
].map(([reason, message]) => validation(reason, message));
|
|
126
147
|
const OTHERS = [
|
|
127
148
|
validation("doctor.report-exists", "the report's file exists; a problem report never overwrites a file"),
|
|
128
149
|
validation("usage.unknown-command", "no command by this name; the CLI's help lists them"),
|
|
@@ -769,7 +790,7 @@ const DETAILED = {
|
|
|
769
790
|
export const REASONS = defineReasons([
|
|
770
791
|
...QUERY_REASONS,
|
|
771
792
|
...INPUT_FIELD_REASONS,
|
|
772
|
-
...[...QUERY, ...SIGN_IN, ...PROVIDER_API, ...SFTP, ...SQL, ...OTHERS].map(([reason, code, message]) => ({
|
|
793
|
+
...[...QUERY, ...SIGN_IN, ...PROVIDER_API, ...SFTP, ...SQL, ...OFFICE, ...OTHERS].map(([reason, code, message]) => ({
|
|
773
794
|
reason,
|
|
774
795
|
code,
|
|
775
796
|
message,
|
package/dist/office/docx.js
CHANGED
|
@@ -66,10 +66,10 @@ class Document {
|
|
|
66
66
|
const root = this.part.root;
|
|
67
67
|
this.ns = root.ns;
|
|
68
68
|
if (root.local !== "document" || !WORD_NAMESPACES.includes(this.ns))
|
|
69
|
-
throw refuse("the file is not a Word document", "office.
|
|
69
|
+
throw refuse("the file is not a Word document", "office.wrong-format");
|
|
70
70
|
const body = childrenOf(root, this.ns, "body")[0];
|
|
71
71
|
if (!body)
|
|
72
|
-
throw refuse("the document has no body", "office.
|
|
72
|
+
throw refuse("the document has no body", "office.wrong-format");
|
|
73
73
|
this.walk(body, "body", false);
|
|
74
74
|
const styles = pack.related(this.part.path, "styles");
|
|
75
75
|
if (styles && pack.has(styles[1].path)) {
|
|
@@ -208,7 +208,7 @@ class Document {
|
|
|
208
208
|
if (!properties)
|
|
209
209
|
return "";
|
|
210
210
|
if (hasTracked(properties))
|
|
211
|
-
throw refuse("the paragraph to copy the style from holds a tracked change", "office.
|
|
211
|
+
throw refuse("the paragraph to copy the style from holds a tracked change", "office.tracked-change");
|
|
212
212
|
let raw = this.raw(properties);
|
|
213
213
|
for (const section of childrenOf(properties, this.ns, "sectPr").reverse())
|
|
214
214
|
raw = raw.slice(0, section.start - properties.start) + raw.slice(section.end - properties.start);
|
|
@@ -253,18 +253,18 @@ export const editDocxParagraphs = async (bytes, edits) => {
|
|
|
253
253
|
const infos = document.paragraphs();
|
|
254
254
|
const check = (index, what) => {
|
|
255
255
|
if (!Number.isInteger(index) || index < 0 || index >= found.length)
|
|
256
|
-
throw refuse(`${what} ${index} does not exist; the document has ${found.length} paragraphs`, "office.
|
|
256
|
+
throw refuse(`${what} ${index} does not exist; the document has ${found.length} paragraphs`, "office.no-paragraph");
|
|
257
257
|
return found[index];
|
|
258
258
|
};
|
|
259
259
|
const editable = (index, action) => {
|
|
260
260
|
const info = infos[index];
|
|
261
261
|
if (!info.editable)
|
|
262
|
-
throw refuse(`paragraph ${index} cannot be ${action}: ${info.reason}`, "office.
|
|
262
|
+
throw refuse(`paragraph ${index} cannot be ${action}: ${info.reason}`, "office.unsafe-paragraph");
|
|
263
263
|
};
|
|
264
264
|
const touched = new Set();
|
|
265
265
|
const once = (index) => {
|
|
266
266
|
if (touched.has(index))
|
|
267
|
-
throw refuse(`paragraph ${index} is changed twice in one call`, "office.
|
|
267
|
+
throw refuse(`paragraph ${index} is changed twice in one call`, "office.duplicate-edit");
|
|
268
268
|
touched.add(index);
|
|
269
269
|
};
|
|
270
270
|
const splices = [];
|
|
@@ -281,7 +281,7 @@ export const editDocxParagraphs = async (bytes, edits) => {
|
|
|
281
281
|
editable(edit.delete, "deleted");
|
|
282
282
|
const properties = childrenOf(target.element, document.ns, "pPr")[0];
|
|
283
283
|
if (properties && childrenOf(properties, document.ns, "sectPr").length)
|
|
284
|
-
throw refuse(`paragraph ${edit.delete} ends a section; deleting it would merge two sections`, "office.
|
|
284
|
+
throw refuse(`paragraph ${edit.delete} ends a section; deleting it would merge two sections`, "office.section-break");
|
|
285
285
|
if (target.element.children.some((child) => MARKERS.has(child.local)))
|
|
286
286
|
throw refuse(`paragraph ${edit.delete} holds a bookmark that a cross-reference may point at`, "office.bookmark");
|
|
287
287
|
splices.push({ start: target.element.start, end: target.element.end, text: "" });
|
|
@@ -307,10 +307,10 @@ export const editDocxParagraphs = async (bytes, edits) => {
|
|
|
307
307
|
if (edit.insertAfter !== -1)
|
|
308
308
|
check(edit.insertAfter, "paragraph");
|
|
309
309
|
if (!found.length)
|
|
310
|
-
throw refuse("the document has no paragraph to insert next to", "office.
|
|
310
|
+
throw refuse("the document has no paragraph to insert next to", "office.no-paragraph");
|
|
311
311
|
const neighbour = found[Math.max(0, edit.insertAfter)];
|
|
312
312
|
if (neighbour.lockedControl)
|
|
313
|
-
throw refuse(`paragraph ${edit.insertAfter} sits in a locked content control`, "office.
|
|
313
|
+
throw refuse(`paragraph ${edit.insertAfter} sits in a locked content control`, "office.unsafe-paragraph");
|
|
314
314
|
const source = check(edit.styleFrom ?? Math.max(0, edit.insertAfter), "styleFrom paragraph").element;
|
|
315
315
|
const element = neighbour.element;
|
|
316
316
|
const text = normalized(edit.text);
|
|
@@ -332,7 +332,7 @@ export const editDocxParagraphs = async (bytes, edits) => {
|
|
|
332
332
|
const remaining = blocks.filter((block) => !deleted.includes(found.findIndex((entry) => entry.element === block)));
|
|
333
333
|
const addsAtEnd = found.some((entry, index) => insertedAfter.has(index) && entry.element === blocks.at(-1));
|
|
334
334
|
if (!addsAtEnd && remaining.at(-1)?.local !== "p")
|
|
335
|
-
throw refuse(`${container.local === "tc" ? "a table cell" : "the document"} must end with a paragraph; this delete would leave it without one`, "office.
|
|
335
|
+
throw refuse(`${container.local === "tc" ? "a table cell" : "the document"} must end with a paragraph; this delete would leave it without one`, "office.last-paragraph");
|
|
336
336
|
}
|
|
337
337
|
if (!edits.length)
|
|
338
338
|
return { bytes: bytes.slice(), replaced, inserted, deleted, collapsed };
|
package/dist/office/xlsx.js
CHANGED
|
@@ -30,7 +30,7 @@ const parseAddress = (address) => {
|
|
|
30
30
|
const column = match ? [...match[1]].reduce((sum, letter) => sum * 26 + letter.charCodeAt(0) - 64, 0) : 0;
|
|
31
31
|
const row = Number(match?.[2]);
|
|
32
32
|
if (!match || column > MAX_COLUMN || row > MAX_ROW)
|
|
33
|
-
throw refuse(`${address} is not a cell address like B7`, "office.
|
|
33
|
+
throw refuse(`${address} is not a cell address like B7`, "office.invalid-cell");
|
|
34
34
|
return { row, column };
|
|
35
35
|
};
|
|
36
36
|
const parseRange = (range) => {
|
|
@@ -61,14 +61,14 @@ class Workbook {
|
|
|
61
61
|
this.workbook = pack.part(path);
|
|
62
62
|
this.ns = this.workbook.root.ns;
|
|
63
63
|
if (this.workbook.root.local !== "workbook" || !SHEET_NAMESPACES.includes(this.ns))
|
|
64
|
-
throw refuse("the file is not an Excel workbook", "office.
|
|
64
|
+
throw refuse("the file is not an Excel workbook", "office.wrong-format");
|
|
65
65
|
const rels = pack.relationships(path);
|
|
66
66
|
const sheetsElement = childrenOf(this.workbook.root, this.ns, "sheets")[0];
|
|
67
67
|
this.sheets = (sheetsElement ? childrenOf(sheetsElement, this.ns, "sheet") : []).map((sheet) => {
|
|
68
68
|
const id = attributeOf(sheet, REL, "id") ?? attributeOf(sheet, STRICT_REL, "id") ?? "";
|
|
69
69
|
const target = rels.get(id);
|
|
70
70
|
if (!target?.type.endsWith("/worksheet"))
|
|
71
|
-
throw refuse("a sheet of the workbook is not a worksheet (a chart sheet or a missing part)", "office.
|
|
71
|
+
throw refuse("a sheet of the workbook is not a worksheet (a chart sheet or a missing part)", "office.wrong-format");
|
|
72
72
|
return { name: attributeOf(sheet, "", "name") ?? "", path: target.path };
|
|
73
73
|
});
|
|
74
74
|
const shared = pack.related(path, "sharedStrings");
|
|
@@ -88,7 +88,7 @@ class Workbook {
|
|
|
88
88
|
sheet(name) {
|
|
89
89
|
const found = this.sheets.find((sheet) => sheet.name === name);
|
|
90
90
|
if (!found)
|
|
91
|
-
throw refuse(`the workbook has no sheet "${name}"; it has ${this.sheets.map((sheet) => `"${sheet.name}"`).join(", ")}`, "office.
|
|
91
|
+
throw refuse(`the workbook has no sheet "${name}"; it has ${this.sheets.map((sheet) => `"${sheet.name}"`).join(", ")}`, "office.no-sheet");
|
|
92
92
|
return found;
|
|
93
93
|
}
|
|
94
94
|
}
|
|
@@ -119,7 +119,7 @@ const rowsOf = (sheetData, ns) => {
|
|
|
119
119
|
if (reference) {
|
|
120
120
|
const address = parseAddress(reference);
|
|
121
121
|
if (address.row !== number)
|
|
122
|
-
throw refuse(`cell ${reference} sits in row ${number}`, "office.
|
|
122
|
+
throw refuse(`cell ${reference} sits in row ${number}`, "office.wrong-format");
|
|
123
123
|
column = address.column;
|
|
124
124
|
}
|
|
125
125
|
else
|
|
@@ -158,7 +158,7 @@ const cellOf = (workbook, text, node) => {
|
|
|
158
158
|
if (type === "s") {
|
|
159
159
|
const string = workbook.strings[Number(saved)];
|
|
160
160
|
if (!/^\d+$/.test(saved) || string === undefined)
|
|
161
|
-
throw refuse(`cell ${columnName(node.column)}${node.row} points at a missing shared string`, "office.
|
|
161
|
+
throw refuse(`cell ${columnName(node.column)}${node.row} points at a missing shared string`, "office.wrong-format");
|
|
162
162
|
value = string;
|
|
163
163
|
kind = "string";
|
|
164
164
|
}
|
|
@@ -195,10 +195,10 @@ const cellOf = (workbook, text, node) => {
|
|
|
195
195
|
};
|
|
196
196
|
const sheetDataOf = (part, ns) => {
|
|
197
197
|
if (part.root.local !== "worksheet" || part.root.ns !== ns)
|
|
198
|
-
throw refuse(`${part.path} is not a worksheet`, "office.
|
|
198
|
+
throw refuse(`${part.path} is not a worksheet`, "office.wrong-format");
|
|
199
199
|
const sheetData = childrenOf(part.root, ns, "sheetData")[0];
|
|
200
200
|
if (!sheetData)
|
|
201
|
-
throw refuse(`${part.path} has no cell data`, "office.
|
|
201
|
+
throw refuse(`${part.path} has no cell data`, "office.wrong-format");
|
|
202
202
|
return sheetData;
|
|
203
203
|
};
|
|
204
204
|
/** The workbook's sheets and their stored cells, with each cell's type, formula and format index. */
|
|
@@ -278,7 +278,7 @@ const valueXml = (cell, value, strings) => {
|
|
|
278
278
|
return { type: "b", content: `<${v}>${value ? 1 : 0}</${v}>` };
|
|
279
279
|
if (typeof value === "number") {
|
|
280
280
|
if (!Number.isFinite(value))
|
|
281
|
-
throw refuse("a cell number must be finite", "office.
|
|
281
|
+
throw refuse("a cell number must be finite", "office.invalid-value");
|
|
282
282
|
return { type: undefined, content: `<${v}>${String(value)}</${v}>` };
|
|
283
283
|
}
|
|
284
284
|
if (strings)
|
|
@@ -336,7 +336,7 @@ const editSheet = (workbook, sheet, planned, options, strings) => {
|
|
|
336
336
|
for (const label of tableLabels(workbook, sheet))
|
|
337
337
|
for (const item of planned)
|
|
338
338
|
if (item.row >= label.top && item.row <= label.bottom && item.column >= label.left && item.column <= label.right)
|
|
339
|
-
throw refuse(`${sheet.name}!${item.address} is a ${label.kind} of the table "${label.table}", whose part repeats the text; change it in Excel`, "office.
|
|
339
|
+
throw refuse(`${sheet.name}!${item.address} is a ${label.kind} of the table "${label.table}", whose part repeats the text; change it in Excel`, "office.table-header");
|
|
340
340
|
const splices = [];
|
|
341
341
|
const changed = [];
|
|
342
342
|
let formulaRemoved = false;
|
|
@@ -354,7 +354,7 @@ const editSheet = (workbook, sheet, planned, options, strings) => {
|
|
|
354
354
|
const row = rows.find((candidate) => candidate.row === rowNumber);
|
|
355
355
|
if (!row) {
|
|
356
356
|
if (rows.some((candidate) => !candidate.explicit))
|
|
357
|
-
throw refuse(`${sheet.name} has rows without numbers, so row ${rowNumber} cannot be added`, "office.
|
|
357
|
+
throw refuse(`${sheet.name} has rows without numbers, so row ${rowNumber} cannot be added`, "office.implicit-rows");
|
|
358
358
|
const next = rows.find((candidate) => candidate.row > rowNumber);
|
|
359
359
|
const r = qualified(sheetData, "row");
|
|
360
360
|
const xml = `<${r} r="${rowNumber}">${items.map((item) => newCell(item)).join("")}</${r}>`;
|
|
@@ -378,7 +378,7 @@ const editSheet = (workbook, sheet, planned, options, strings) => {
|
|
|
378
378
|
const existing = row.cells.find((cell) => cell.column === item.column);
|
|
379
379
|
if (!existing) {
|
|
380
380
|
if (row.cells.some((cell) => attributeOf(cell.element, "", "r") === undefined))
|
|
381
|
-
throw refuse(`row ${rowNumber} of ${sheet.name} has cells without addresses, so ${item.address} cannot be added`, "office.
|
|
381
|
+
throw refuse(`row ${rowNumber} of ${sheet.name} has cells without addresses, so ${item.address} cannot be added`, "office.implicit-cells");
|
|
382
382
|
const next = row.cells.find((cell) => cell.column > item.column);
|
|
383
383
|
inserts.push({ at: next ? next.element.start : -1, xml: newCell(item, rowStyle) });
|
|
384
384
|
changed.push({ sheet: sheet.name, cell: item.address, before: null, after: item.edit.value, created: true });
|
|
@@ -387,7 +387,7 @@ const editSheet = (workbook, sheet, planned, options, strings) => {
|
|
|
387
387
|
const before = cellOf(workbook, text, existing);
|
|
388
388
|
const element = existing.element;
|
|
389
389
|
if (attributeOf(element, "", "vm") !== undefined)
|
|
390
|
-
throw refuse(`${sheet.name}!${item.address} holds a picture or a linked data type, which this editor does not replace`, "office.
|
|
390
|
+
throw refuse(`${sheet.name}!${item.address} holds a picture or a linked data type, which this editor does not replace`, "office.rich-value");
|
|
391
391
|
const formula = childrenOf(element, ns, "f")[0];
|
|
392
392
|
const array = arrays.find((entry) => item.row >= entry.range.top &&
|
|
393
393
|
item.row <= entry.range.bottom &&
|
|
@@ -395,12 +395,12 @@ const editSheet = (workbook, sheet, planned, options, strings) => {
|
|
|
395
395
|
item.column <= entry.range.right &&
|
|
396
396
|
(entry.range.top !== entry.range.bottom || entry.range.left !== entry.range.right));
|
|
397
397
|
if (array)
|
|
398
|
-
throw refuse(`${sheet.name}!${item.address} is part of an array formula; change it in Excel`, "office.
|
|
398
|
+
throw refuse(`${sheet.name}!${item.address} is part of an array formula; change it in Excel`, "office.array-formula");
|
|
399
399
|
if (formula) {
|
|
400
400
|
if (!options.overwriteFormulas)
|
|
401
|
-
throw refuse(`${sheet.name}!${item.address} holds the formula =${before.formula}; pass overwriteFormulas to replace it with a value`, "office.
|
|
401
|
+
throw refuse(`${sheet.name}!${item.address} holds the formula =${before.formula}; pass overwriteFormulas to replace it with a value`, "office.formula-cell");
|
|
402
402
|
if (attributeOf(formula, "", "t") === "shared" && attributeOf(formula, "", "ref") !== undefined)
|
|
403
|
-
throw refuse(`${sheet.name}!${item.address} holds a formula that other cells share; replacing it would break theirs`, "office.
|
|
403
|
+
throw refuse(`${sheet.name}!${item.address} holds a formula that other cells share; replacing it would break theirs`, "office.shared-formula");
|
|
404
404
|
formulaRemoved = true;
|
|
405
405
|
}
|
|
406
406
|
if (attributeOf(element, "", "t") === "s" && strings)
|
|
@@ -516,7 +516,7 @@ export const editXlsxCells = async (bytes, edits, options = {}) => {
|
|
|
516
516
|
const address = `${columnName(column)}${row}`;
|
|
517
517
|
const key = `${sheet.name}!${address}`;
|
|
518
518
|
if (seen.has(key))
|
|
519
|
-
throw refuse(`${key} is edited twice in one call`, "office.
|
|
519
|
+
throw refuse(`${key} is edited twice in one call`, "office.duplicate-edit");
|
|
520
520
|
seen.add(key);
|
|
521
521
|
bySheet.set(sheet, [...(bySheet.get(sheet) ?? []), { edit, row, column, address }]);
|
|
522
522
|
}
|
|
@@ -246,6 +246,7 @@ const READS = {
|
|
|
246
246
|
meetings: "meetings — search all reads them",
|
|
247
247
|
events: "calendar events — no search reads them yet",
|
|
248
248
|
crm: "CRM deals and leads — search all reads them",
|
|
249
|
+
tracker: "a tracker's issues, projects and comments — search all reads them",
|
|
249
250
|
};
|
|
250
251
|
/**
|
|
251
252
|
* The accounts of `kinds` the entries name, and each entry that names none of them with the reason. A search
|
|
@@ -10,15 +10,15 @@ import type { SearchCoverage } from "./messages-search.js";
|
|
|
10
10
|
import { type MeetingAccountCoverage, type MeetingSearchItem } from "./search-all-meetings.js";
|
|
11
11
|
import { type HarderOptions, type HarderResult } from "./search-harder.js";
|
|
12
12
|
import type { Backend, ServerOptions, ServerSearched } from "./server-search.js";
|
|
13
|
-
export declare const RESOURCES_SEARCHED: readonly ["messages", "mail", "notes", "events", "crm", "business", "meetings"];
|
|
13
|
+
export declare const RESOURCES_SEARCHED: readonly ["messages", "mail", "notes", "events", "crm", "business", "meetings", "tracker"];
|
|
14
14
|
export type SearchedResource = (typeof RESOURCES_SEARCHED)[number];
|
|
15
15
|
/** One hit of `search all`: a stored record, or a passage of a meeting. */
|
|
16
16
|
export type SearchAllItem = SearchAllRecordItem | MeetingSearchItem;
|
|
17
17
|
export interface SearchAllRecordItem {
|
|
18
|
-
kind: "message" | "mail" | "note" | "document" | "event" | "deal" | "lead" | "crm_file" | BusinessKind;
|
|
18
|
+
kind: "message" | "mail" | "note" | "document" | "event" | "deal" | "lead" | "crm_file" | TrackerHitKind | BusinessKind;
|
|
19
19
|
/**
|
|
20
20
|
* `msg:…` for a message or a mail, `note:…`, `event:…`, `deal:…`, `lead:…`, `crmfile:<file id>` for a downloaded CRM
|
|
21
|
-
* file, or a business ref: `invoice:…`.
|
|
21
|
+
* file, `tracker:<provider>/<account>/<kind>/<id>` for an issue, a project or a comment, or a business ref: `invoice:…`.
|
|
22
22
|
*/
|
|
23
23
|
ref: string;
|
|
24
24
|
provider: string;
|
|
@@ -178,6 +178,10 @@ export declare const titleWords: (text: string, refused?: string) => {
|
|
|
178
178
|
words: string[];
|
|
179
179
|
anyWord: boolean;
|
|
180
180
|
};
|
|
181
|
+
/** A tracker hit's kind: a comment is named for the issue it is on, beside a CRM's and a message's kinds. */
|
|
182
|
+
export type TrackerHitKind = "issue" | "project" | "issue_comment";
|
|
183
|
+
/** The accounts of every tracker the store holds copies of. */
|
|
184
|
+
export declare const trackerAccounts: (store: MessageStore) => Promise<AccountKey[]>;
|
|
181
185
|
/** The accounts of every CRM the store holds copies of. */
|
|
182
186
|
export declare const crmAccounts: (store: MessageStore) => Promise<AccountKey[]>;
|
|
183
187
|
/**
|
|
@@ -5,6 +5,7 @@ import { hitFiles } from "../domain/attachments.js";
|
|
|
5
5
|
import { parseLocator } from "../domain/locator.js";
|
|
6
6
|
import { senderIsMe } from "../domain/models.js";
|
|
7
7
|
import { holdsKind, INTERNAL_NOTES } from "../domain/providers.js";
|
|
8
|
+
import { trackerTitleOf } from "../domain/tracker.js";
|
|
8
9
|
import { runEmbedders } from "../embeddings/embed.js";
|
|
9
10
|
import { chosenTextModel } from "../embeddings/models.js";
|
|
10
11
|
import { formatMeetingReference } from "../meetings/index.js";
|
|
@@ -23,7 +24,16 @@ import { BUSINESS_WORDS_ONLY, searchBusiness } from "./search-all-business.js";
|
|
|
23
24
|
import { meetingLane } from "./search-all-meetings.js";
|
|
24
25
|
import { HARDER_CANDIDATES, reorderHarder } from "./search-harder.js";
|
|
25
26
|
import { listContextOf } from "./search-kind.js";
|
|
26
|
-
export const RESOURCES_SEARCHED = [
|
|
27
|
+
export const RESOURCES_SEARCHED = [
|
|
28
|
+
"messages",
|
|
29
|
+
"mail",
|
|
30
|
+
"notes",
|
|
31
|
+
"events",
|
|
32
|
+
"crm",
|
|
33
|
+
"business",
|
|
34
|
+
"meetings",
|
|
35
|
+
"tracker",
|
|
36
|
+
];
|
|
27
37
|
const refusal = (error, text) => {
|
|
28
38
|
const { reason, span } = (error.details ?? {});
|
|
29
39
|
const why = typeof reason === "string" ? reason : undefined;
|
|
@@ -117,6 +127,15 @@ const copyViewers = async (store) => {
|
|
|
117
127
|
}
|
|
118
128
|
return viewers;
|
|
119
129
|
};
|
|
130
|
+
const TRACKER_HIT_KINDS = { issue: "issue", project: "project", comment: "issue_comment" };
|
|
131
|
+
/** The accounts of every tracker the store holds copies of. */
|
|
132
|
+
export const trackerAccounts = async (store) => (await store.accounts.accounts()).filter(({ provider }) => holdsKind(provider, "tracker"));
|
|
133
|
+
/** An issue is titled as people say it, `ENG-12 Fix login`; anything else by its name or its first line. */
|
|
134
|
+
const trackerTitle = ({ kind, record }) => {
|
|
135
|
+
const title = trackerTitleOf(kind, record);
|
|
136
|
+
const key = kind === "issue" ? record.key : undefined;
|
|
137
|
+
return key ? `${key} ${title}` : title;
|
|
138
|
+
};
|
|
120
139
|
/** The accounts of every CRM the store holds copies of. */
|
|
121
140
|
export const crmAccounts = async (store) => (await store.accounts.accounts()).filter(({ provider }) => holdsKind(provider, "crm"));
|
|
122
141
|
/**
|
|
@@ -388,6 +407,37 @@ export const searchAll = async (store, account, asked, messenger = {}, searchMes
|
|
|
388
407
|
for (const { provider, account } of read)
|
|
389
408
|
accounts.push({ resource, provider, account });
|
|
390
409
|
}
|
|
410
|
+
else if (resource === "tracker") {
|
|
411
|
+
// The registry says which providers are trackers; reading every account's rows would show hits the listed
|
|
412
|
+
// accounts do not account for.
|
|
413
|
+
const read = scope?.tracker ?? (await trackerAccounts(store));
|
|
414
|
+
if (!read.length)
|
|
415
|
+
continue;
|
|
416
|
+
const { words, anyWord } = titleWords(request.text, "issues, projects and comments are found by the words of their title and text only");
|
|
417
|
+
const found = await store.tracker.find({
|
|
418
|
+
words,
|
|
419
|
+
anyWord: anyWord || discover,
|
|
420
|
+
...(request.exact ? { exact: true } : {}),
|
|
421
|
+
kinds: ["issue", "project", "comment"],
|
|
422
|
+
limit: Math.min(depth, 500),
|
|
423
|
+
accounts: read,
|
|
424
|
+
});
|
|
425
|
+
hasMore ||= found.hasMore;
|
|
426
|
+
lists.push(found.items.map(({ account: at, item, excerpt: text }) => ({
|
|
427
|
+
kind: TRACKER_HIT_KINDS[item.kind],
|
|
428
|
+
// Two sign-ins see the same issue under the same id, so the account keeps their hits apart.
|
|
429
|
+
ref: `tracker:${at.provider}/${at.account}/${item.kind}/${item.record.externalId}`,
|
|
430
|
+
provider: at.provider,
|
|
431
|
+
account: at.account,
|
|
432
|
+
...(item.record.url ? { url: item.record.url } : {}),
|
|
433
|
+
title: trackerTitle(item),
|
|
434
|
+
timestamp: new Date(item.record.updatedAt ?? item.syncedAt).toISOString(),
|
|
435
|
+
text,
|
|
436
|
+
foundBy: ["words"],
|
|
437
|
+
})));
|
|
438
|
+
for (const { provider, account } of read)
|
|
439
|
+
accounts.push({ resource, provider, account });
|
|
440
|
+
}
|
|
391
441
|
else if (resource === "business") {
|
|
392
442
|
const { words, anyWord } = titleWords(request.text, BUSINESS_WORDS_ONLY);
|
|
393
443
|
const found = await searchBusiness(store, {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wirecat/cli-core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.725.0",
|
|
4
4
|
"description": "The messenger-neutral half of a messaging CLI: domain model, message locators, rendering, name resolution, the SQLite seam, the command skeleton and shared read commands, the send guard, run records and the message store",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": "Viacheslav Ptsarev",
|
|
@@ -334,7 +334,7 @@
|
|
|
334
334
|
"@types/pngjs": "6.0.5",
|
|
335
335
|
"@types/ssh2": "1.15.5",
|
|
336
336
|
"@vitest/coverage-v8": "^5.0.5",
|
|
337
|
-
"@wirecat/cli-base": "0.
|
|
337
|
+
"@wirecat/cli-base": "0.130.0",
|
|
338
338
|
"@wirecat/cli-core-legacy-tags": "npm:@wirecat/cli-core@0.414.0",
|
|
339
339
|
"ajv": "8.17.1",
|
|
340
340
|
"commander": "15.0.0",
|