@wirecat/cli-core 0.695.0 → 0.697.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 +60 -0
- package/dist/cli/bot/api-http.d.ts +1 -1
- package/dist/cli/bot/api-http.js +77 -5
- package/dist/cli/bot/api-input.d.ts +5 -0
- package/dist/cli/bot/api-input.js +55 -0
- package/dist/cli/bot/api.d.ts +2 -0
- package/dist/cli/bot/api.js +22 -4
- package/dist/cli/index.d.ts +3 -3
- package/dist/cli/index.js +3 -3
- package/dist/cli/messenger/store-maintenance-command.js +3 -2
- package/dist/cli/profile-token.d.ts +10 -2
- package/dist/cli/profile-token.js +19 -3
- package/dist/cli/service-api-call.d.ts +2 -0
- package/dist/cli/service-api-call.js +1 -1
- package/dist/cli/service-api-manifest.d.ts +9 -3
- package/dist/cli/service-api-manifest.js +70 -11
- package/dist/cli/service-api.d.ts +5 -0
- package/dist/cli/service-api.js +13 -6
- package/dist/cli/token-session.d.ts +27 -1
- package/dist/cli/token-session.js +52 -13
- package/dist/crm/manifest/manifest.d.ts +2 -0
- package/dist/crm/manifest/manifest.js +2 -1
- package/dist/crm/manifest/map.d.ts +2 -1
- package/dist/crm/manifest/map.js +2 -1
- package/dist/domain/tracker.d.ts +100 -0
- package/dist/domain/tracker.js +28 -0
- package/dist/errors/reasons.js +1 -0
- package/dist/manifest/index.d.ts +9 -5
- package/dist/manifest/index.js +18 -7
- package/dist/store/exports.d.ts +1 -0
- package/dist/store/exports.js +1 -0
- package/dist/store/recover.js +2 -0
- package/dist/store/sqlite/account-purge.js +1 -0
- package/dist/store/sqlite/crm-files.d.ts +3 -0
- package/dist/store/sqlite/crm-files.js +2 -2
- package/dist/store/sqlite/manifest.js +2 -0
- package/dist/store/sqlite/migrations.generated.js +17 -0
- package/dist/store/sqlite/schema.d.ts +252 -0
- package/dist/store/sqlite/schema.js +28 -0
- package/dist/store/sqlite/tracker.d.ts +82 -0
- package/dist/store/sqlite/tracker.js +210 -0
- package/dist/store/store.d.ts +3 -0
- package/dist/store/store.js +5 -0
- package/dist/tracker/cli/index.d.ts +24 -0
- package/dist/tracker/cli/index.js +279 -0
- package/dist/tracker/index.d.ts +8 -0
- package/dist/tracker/index.js +7 -0
- package/dist/tracker/manifest/manifest.d.ts +76 -0
- package/dist/tracker/manifest/manifest.js +139 -0
- package/dist/tracker/manifest/map.d.ts +10 -0
- package/dist/tracker/manifest/map.js +86 -0
- package/dist/tracker/manifest/source.d.ts +18 -0
- package/dist/tracker/manifest/source.js +174 -0
- package/dist/tracker/source.d.ts +55 -0
- package/dist/tracker/source.js +1 -0
- package/dist/tracker/sync.d.ts +60 -0
- package/dist/tracker/sync.js +254 -0
- package/dist/tracker/tasks.d.ts +18 -0
- package/dist/tracker/tasks.js +29 -0
- package/dist/tracker/testing/index.d.ts +2 -0
- package/dist/tracker/testing/index.js +2 -0
- package/dist/tracker/testing/source-contract.d.ts +46 -0
- package/dist/tracker/testing/source-contract.js +246 -0
- package/dist/tracker/testing/source.d.ts +31 -0
- package/dist/tracker/testing/source.js +141 -0
- package/package.json +12 -4
package/dist/manifest/index.js
CHANGED
|
@@ -1,6 +1,16 @@
|
|
|
1
1
|
import { CliError } from "@wirecat/cli-base";
|
|
2
2
|
import * as v from "valibot";
|
|
3
|
-
export const CLI_CATEGORIES = [
|
|
3
|
+
export const CLI_CATEGORIES = [
|
|
4
|
+
"messenger",
|
|
5
|
+
"mail",
|
|
6
|
+
"notes",
|
|
7
|
+
"files",
|
|
8
|
+
"meetings",
|
|
9
|
+
"calendar",
|
|
10
|
+
"crm",
|
|
11
|
+
"tracker",
|
|
12
|
+
"other",
|
|
13
|
+
];
|
|
4
14
|
/** Types the config in the editor; it returns what it is given. */
|
|
5
15
|
export const defineCli = (config) => config;
|
|
6
16
|
const word = v.pipe(v.string(), v.regex(/^[a-z][a-z0-9]*(-[a-z0-9]+)*$/, "lower-case letters and digits, words joined by one dash"));
|
|
@@ -47,7 +57,7 @@ const schema = v.strictObject({
|
|
|
47
57
|
owner: v.pipe(v.string(), v.regex(/^[A-Za-z0-9](?:-?[A-Za-z0-9]){0,38}$/, "a GitHub owner")),
|
|
48
58
|
}),
|
|
49
59
|
spec: v.strictObject({
|
|
50
|
-
kind: v.picklist(["openapi", "swagger"]),
|
|
60
|
+
kind: v.picklist(["openapi", "swagger", "graphql"]),
|
|
51
61
|
from: httpsUrl,
|
|
52
62
|
}),
|
|
53
63
|
auth: v.variant("preset", [
|
|
@@ -72,7 +82,7 @@ const schema = v.strictObject({
|
|
|
72
82
|
hooks: v.optional(v.pipe(v.string(), v.regex(/^\.\/([^\s]*\/)?[^/\s.][^/\s]*\.[cm]?[jt]s$/, "a module in the project, such as ./src/hooks.ts"), v.check((text) => !/\.d\.[cm]?ts$/.test(text), "a module, not a .d.ts declaration file"), v.check((text) => !text.split(/[\\/]/).includes(".."), "a module in the project, without .."))),
|
|
73
83
|
});
|
|
74
84
|
/**
|
|
75
|
-
* The config checked against its shape; every error names where it is. A
|
|
85
|
+
* The config checked against its shape; every error names where it is. A crm or tracker CLI needs its source. `source` comes back
|
|
76
86
|
* unchecked: `parseCrmManifest` checks it against the generated API.
|
|
77
87
|
*/
|
|
78
88
|
export const parseCliConfig = (input) => {
|
|
@@ -94,12 +104,13 @@ export const parseCliConfig = (input) => {
|
|
|
94
104
|
// Typed, not cast: a field CliConfig needs that the schema lacks or types otherwise fails to compile (not the reverse).
|
|
95
105
|
const output = parsed.output;
|
|
96
106
|
const config = output;
|
|
97
|
-
|
|
98
|
-
|
|
107
|
+
const sourced = config.category === "crm" || config.category === "tracker";
|
|
108
|
+
if (!sourced && config.source)
|
|
109
|
+
throw new CliError("configuration_error", "wirecat.config: source: only a crm or tracker CLI reads a source yet", {
|
|
99
110
|
reason: "manifest.invalid",
|
|
100
111
|
});
|
|
101
|
-
if (
|
|
102
|
-
throw new CliError("configuration_error",
|
|
112
|
+
if (sourced && !config.source)
|
|
113
|
+
throw new CliError("configuration_error", `wirecat.config: source: a ${config.category} CLI needs its source`, {
|
|
103
114
|
reason: "manifest.invalid",
|
|
104
115
|
});
|
|
105
116
|
return config;
|
package/dist/store/exports.d.ts
CHANGED
|
@@ -67,6 +67,7 @@ export { DEFAULT_FIRST_PASS_PER_CHAT, firstPassPerChatOf, savedFirstPassPerChat
|
|
|
67
67
|
export { inboxKey } from "./sqlite/tasks.js";
|
|
68
68
|
export { storedTemplateBodies, type TemplateAddress } from "./sqlite/templates.js";
|
|
69
69
|
export { THREAD_COLUMNS } from "./sqlite/thread-columns.js";
|
|
70
|
+
export { resetTrackerItemWords, type TrackerFilter, type TrackerHit, type TrackerItem, type TrackerPerson, type TrackerSearch, type TrackerStore, } from "./sqlite/tracker.js";
|
|
70
71
|
export { dropAllUnusedVectors, vectorIndexCounts } from "./sqlite/vector-index.js";
|
|
71
72
|
export type { MatchPlace, ScoredHit } from "./sqlite/words.js";
|
|
72
73
|
export type { TaskDetails } from "./sqlite/work-tasks.js";
|
package/dist/store/exports.js
CHANGED
|
@@ -35,4 +35,5 @@ export { DEFAULT_FIRST_PASS_PER_CHAT, firstPassPerChatOf, savedFirstPassPerChat
|
|
|
35
35
|
export { inboxKey } from "./sqlite/tasks.js";
|
|
36
36
|
export { storedTemplateBodies } from "./sqlite/templates.js";
|
|
37
37
|
export { THREAD_COLUMNS } from "./sqlite/thread-columns.js";
|
|
38
|
+
export { resetTrackerItemWords, } from "./sqlite/tracker.js";
|
|
38
39
|
export { dropAllUnusedVectors, vectorIndexCounts } from "./sqlite/vector-index.js";
|
package/dist/store/recover.js
CHANGED
|
@@ -21,6 +21,7 @@ import { isDerivedTable } from "./sqlite/rollback-copy.js";
|
|
|
21
21
|
import { fillSearchIndex, resetSearchIndex } from "./sqlite/search-index.js";
|
|
22
22
|
import { stemmerCache } from "./sqlite/stems.js";
|
|
23
23
|
import { fillStems, resetStems } from "./sqlite/stems-fill.js";
|
|
24
|
+
import { resetTrackerItemWords } from "./sqlite/tracker.js";
|
|
24
25
|
import { fillVectorIndexes } from "./sqlite/vector-index.js";
|
|
25
26
|
/** `contentless_delete`, which every word index uses, came in SQLite 3.43. */
|
|
26
27
|
export const SQLITE3_MINIMUM = [3, 43, 0];
|
|
@@ -383,6 +384,7 @@ const FILLERS = {
|
|
|
383
384
|
},
|
|
384
385
|
attachment_words: (database) => void resetAttachmentWords(database),
|
|
385
386
|
crm_file_words: (database) => void resetCrmFileWords(database),
|
|
387
|
+
tracker_item_words: (database) => void resetTrackerItemWords(database),
|
|
386
388
|
attachment_name_words: (database) =>
|
|
387
389
|
// As migration 20 filled it: й and ё fold as the triggers fold them.
|
|
388
390
|
database.exec("INSERT INTO attachment_name_words (rowid, name) SELECT id, " +
|
|
@@ -97,6 +97,7 @@ export const purgeAccount = (context, accountKey) => {
|
|
|
97
97
|
purgeCrmCopies(database, accountKey);
|
|
98
98
|
orm.run(sql `DELETE FROM crm_fields WHERE account_id = ${accountKey}`);
|
|
99
99
|
orm.run(sql `DELETE FROM crm_files WHERE account_id = ${accountKey}`);
|
|
100
|
+
orm.run(sql `DELETE FROM tracker_items WHERE account_id = ${accountKey}`);
|
|
100
101
|
// An entity made from a record is the owner's and stays; only what the source said goes.
|
|
101
102
|
const recordsOf = sql `(SELECT id FROM records WHERE account_id = ${accountKey})`;
|
|
102
103
|
orm.run(sql `DELETE FROM record_relations WHERE record_id IN ${recordsOf} OR target_id IN ${recordsOf}`);
|
|
@@ -65,6 +65,9 @@ export interface CrmFileStore {
|
|
|
65
65
|
/** The account's `files.*` settings, each its default unless the owner set one in range. */
|
|
66
66
|
limits(key: AccountKey): Promise<CrmFileLimits>;
|
|
67
67
|
}
|
|
68
|
+
/** One FTS5 phrase per word, quoted so no word is read as syntax; a word may start a longer one unless `exact`. */
|
|
69
|
+
export declare const matchOf: (words: readonly string[], anyWord: boolean, exact: boolean) => string | undefined;
|
|
70
|
+
export declare const excerptOf: (body: string, words: readonly string[]) => string;
|
|
68
71
|
/** `store rebuild`: the normalized copies follow the current normalizer, then the word index is filled again. */
|
|
69
72
|
export declare const resetCrmFileWords: (database: CacheDatabase) => number;
|
|
70
73
|
export declare const crmFilesOver: (context: StoreContext) => CrmFileStore;
|
|
@@ -31,7 +31,7 @@ const rowOf = (row) => ({
|
|
|
31
31
|
downloadedAt: Number(row.downloaded_at),
|
|
32
32
|
});
|
|
33
33
|
/** One FTS5 phrase per word, quoted so no word is read as syntax; a word may start a longer one unless `exact`. */
|
|
34
|
-
const matchOf = (words, anyWord, exact) => {
|
|
34
|
+
export const matchOf = (words, anyWord, exact) => {
|
|
35
35
|
const phrases = words
|
|
36
36
|
.map((word) => normalize(word).trim())
|
|
37
37
|
.filter(Boolean)
|
|
@@ -41,7 +41,7 @@ const matchOf = (words, anyWord, exact) => {
|
|
|
41
41
|
});
|
|
42
42
|
return phrases.length ? [...new Set(phrases)].join(anyWord ? " OR " : " AND ") : undefined;
|
|
43
43
|
};
|
|
44
|
-
const excerptOf = (body, words) => {
|
|
44
|
+
export const excerptOf = (body, words) => {
|
|
45
45
|
const folded = fold(body);
|
|
46
46
|
const at = words
|
|
47
47
|
.map((word) => folded.indexOf(fold(word).trim()))
|
|
@@ -136,6 +136,8 @@ export const MANIFEST = [
|
|
|
136
136
|
{ name: "20261116204204_version-68-crm-file-words", version: 68, minCompatible: 56 },
|
|
137
137
|
{ name: "20261117015456_version-69-conversation-readiness", version: 69, minCompatible: 56 },
|
|
138
138
|
{ name: "20261117015457_version-69-conversation-readiness-triggers", version: 69, minCompatible: 56 },
|
|
139
|
+
{ name: "20261117211410_version-70-tracker-items", version: 70, minCompatible: 56 },
|
|
140
|
+
{ name: "20261117211414_version-70-tracker-item-words", version: 70, minCompatible: 56 },
|
|
139
141
|
];
|
|
140
142
|
export const generatedMigrations = (manifest = MANIFEST, generated = GENERATED) => {
|
|
141
143
|
const migrations = [];
|
|
@@ -1381,5 +1381,22 @@ export const GENERATED = [
|
|
|
1381
1381
|
"-- A chat whose every chunk text already has a vector cannot gain from a new one: (model, content_hash) is unique.\nCREATE TRIGGER conversation_readiness_embedding_ai AFTER INSERT ON embeddings BEGIN\n DELETE FROM conversation_readiness WHERE model = NEW.model AND embedded_count < chunks;\nEND;",
|
|
1382
1382
|
"CREATE TRIGGER conversation_readiness_embedding_ad AFTER DELETE ON embeddings BEGIN\n DELETE FROM conversation_readiness WHERE model = OLD.model AND embedded_count > 0;\nEND;"
|
|
1383
1383
|
]
|
|
1384
|
+
},
|
|
1385
|
+
{
|
|
1386
|
+
"name": "20261117211410_version-70-tracker-items",
|
|
1387
|
+
"statements": [
|
|
1388
|
+
"CREATE TABLE `tracker_items` (\n\t`id` integer PRIMARY KEY,\n\t`account_id` integer NOT NULL,\n\t`kind` text NOT NULL,\n\t`external_id` text NOT NULL,\n\t`parent_id` text,\n\t`title` text NOT NULL,\n\t`title_folded` text NOT NULL,\n\t`body` text,\n\t`normalized_text` text NOT NULL,\n\t`data` text NOT NULL,\n\t`source_created_at` integer,\n\t`source_updated_at` integer,\n\t`archived_at` integer,\n\t`deleted_at` integer,\n\t`synced_at` integer NOT NULL,\n\tCONSTRAINT `fk_tracker_items_account_id_accounts_id_fk` FOREIGN KEY (`account_id`) REFERENCES `accounts`(`id`),\n\tCONSTRAINT `tracker_items_account_id_kind_external_id_unique` UNIQUE(`account_id`,`kind`,`external_id`)\n);",
|
|
1389
|
+
"CREATE INDEX `tracker_items_by_account_id_kind_parent_id` ON `tracker_items` (`account_id`,`kind`,`parent_id`);"
|
|
1390
|
+
]
|
|
1391
|
+
},
|
|
1392
|
+
{
|
|
1393
|
+
"name": "20261117211414_version-70-tracker-item-words",
|
|
1394
|
+
"statements": [
|
|
1395
|
+
"-- Words of a tracker item's title and text, rowid = tracker_items.id: issues, projects and comments found by any word.\nCREATE VIRTUAL TABLE tracker_item_words USING fts5(\n normalized_text,\n content = '', contentless_delete = 1,\n tokenize = 'unicode61 remove_diacritics 2', prefix = '3');",
|
|
1396
|
+
"CREATE VIRTUAL TABLE tracker_item_words_vocab USING fts5vocab(tracker_item_words, 'col');",
|
|
1397
|
+
"CREATE TRIGGER tracker_item_words_ai AFTER INSERT ON tracker_items WHEN new.normalized_text <> '' BEGIN\n INSERT INTO tracker_item_words (rowid, normalized_text) VALUES (new.id, new.normalized_text);\nEND;",
|
|
1398
|
+
"CREATE TRIGGER tracker_item_words_au AFTER UPDATE OF normalized_text ON tracker_items\n WHEN old.normalized_text IS NOT new.normalized_text BEGIN\n DELETE FROM tracker_item_words WHERE rowid = old.id;\n INSERT INTO tracker_item_words (rowid, normalized_text)\n SELECT new.id, new.normalized_text WHERE new.normalized_text <> '';\nEND;",
|
|
1399
|
+
"CREATE TRIGGER tracker_item_words_ad AFTER DELETE ON tracker_items BEGIN\n DELETE FROM tracker_item_words WHERE rowid = old.id;\nEND;"
|
|
1400
|
+
]
|
|
1384
1401
|
}
|
|
1385
1402
|
];
|
|
@@ -23560,6 +23560,258 @@ export declare const conversationReadiness: import("drizzle-orm/sqlite-core").SQ
|
|
|
23560
23560
|
dialect: 'sqlite';
|
|
23561
23561
|
isAlias: false;
|
|
23562
23562
|
}>;
|
|
23563
|
+
/**
|
|
23564
|
+
* One team, user, workflow state, label, project, issue or comment of an issue tracker account, as last synced. The
|
|
23565
|
+
* columns are what lists, filters and search read; the rest of the record is `data`, JSON in the domain's field names.
|
|
23566
|
+
*/
|
|
23567
|
+
export declare const trackerItems: import("drizzle-orm/sqlite-core").SQLiteTableWithColumns<{
|
|
23568
|
+
name: "tracker_items";
|
|
23569
|
+
schema: undefined;
|
|
23570
|
+
columns: {
|
|
23571
|
+
id: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
23572
|
+
name: string;
|
|
23573
|
+
tableName: "tracker_items";
|
|
23574
|
+
dataType: "number int53";
|
|
23575
|
+
data: number;
|
|
23576
|
+
driverParam: number;
|
|
23577
|
+
notNull: true;
|
|
23578
|
+
hasDefault: true;
|
|
23579
|
+
isPrimaryKey: true;
|
|
23580
|
+
isAutoincrement: false;
|
|
23581
|
+
hasRuntimeDefault: false;
|
|
23582
|
+
enumValues: undefined;
|
|
23583
|
+
baseColumn: never;
|
|
23584
|
+
identity: undefined;
|
|
23585
|
+
generated: undefined;
|
|
23586
|
+
}, {}>;
|
|
23587
|
+
accountId: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
23588
|
+
name: string;
|
|
23589
|
+
tableName: "tracker_items";
|
|
23590
|
+
dataType: "number int53";
|
|
23591
|
+
data: number;
|
|
23592
|
+
driverParam: number;
|
|
23593
|
+
notNull: true;
|
|
23594
|
+
hasDefault: false;
|
|
23595
|
+
isPrimaryKey: false;
|
|
23596
|
+
isAutoincrement: false;
|
|
23597
|
+
hasRuntimeDefault: false;
|
|
23598
|
+
enumValues: undefined;
|
|
23599
|
+
baseColumn: never;
|
|
23600
|
+
identity: undefined;
|
|
23601
|
+
generated: undefined;
|
|
23602
|
+
}, {}>;
|
|
23603
|
+
kind: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
23604
|
+
name: string;
|
|
23605
|
+
tableName: "tracker_items";
|
|
23606
|
+
dataType: "string";
|
|
23607
|
+
data: string;
|
|
23608
|
+
driverParam: string;
|
|
23609
|
+
notNull: true;
|
|
23610
|
+
hasDefault: false;
|
|
23611
|
+
isPrimaryKey: false;
|
|
23612
|
+
isAutoincrement: false;
|
|
23613
|
+
hasRuntimeDefault: false;
|
|
23614
|
+
enumValues: [string, ...string[]];
|
|
23615
|
+
baseColumn: never;
|
|
23616
|
+
identity: undefined;
|
|
23617
|
+
generated: undefined;
|
|
23618
|
+
}, {}>;
|
|
23619
|
+
externalId: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
23620
|
+
name: string;
|
|
23621
|
+
tableName: "tracker_items";
|
|
23622
|
+
dataType: "string";
|
|
23623
|
+
data: string;
|
|
23624
|
+
driverParam: string;
|
|
23625
|
+
notNull: true;
|
|
23626
|
+
hasDefault: false;
|
|
23627
|
+
isPrimaryKey: false;
|
|
23628
|
+
isAutoincrement: false;
|
|
23629
|
+
hasRuntimeDefault: false;
|
|
23630
|
+
enumValues: [string, ...string[]];
|
|
23631
|
+
baseColumn: never;
|
|
23632
|
+
identity: undefined;
|
|
23633
|
+
generated: undefined;
|
|
23634
|
+
}, {}>;
|
|
23635
|
+
parentId: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
23636
|
+
name: string;
|
|
23637
|
+
tableName: "tracker_items";
|
|
23638
|
+
dataType: "string";
|
|
23639
|
+
data: string;
|
|
23640
|
+
driverParam: string;
|
|
23641
|
+
notNull: false;
|
|
23642
|
+
hasDefault: false;
|
|
23643
|
+
isPrimaryKey: false;
|
|
23644
|
+
isAutoincrement: false;
|
|
23645
|
+
hasRuntimeDefault: false;
|
|
23646
|
+
enumValues: [string, ...string[]];
|
|
23647
|
+
baseColumn: never;
|
|
23648
|
+
identity: undefined;
|
|
23649
|
+
generated: undefined;
|
|
23650
|
+
}, {}>;
|
|
23651
|
+
title: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
23652
|
+
name: string;
|
|
23653
|
+
tableName: "tracker_items";
|
|
23654
|
+
dataType: "string";
|
|
23655
|
+
data: string;
|
|
23656
|
+
driverParam: string;
|
|
23657
|
+
notNull: true;
|
|
23658
|
+
hasDefault: false;
|
|
23659
|
+
isPrimaryKey: false;
|
|
23660
|
+
isAutoincrement: false;
|
|
23661
|
+
hasRuntimeDefault: false;
|
|
23662
|
+
enumValues: [string, ...string[]];
|
|
23663
|
+
baseColumn: never;
|
|
23664
|
+
identity: undefined;
|
|
23665
|
+
generated: undefined;
|
|
23666
|
+
}, {}>;
|
|
23667
|
+
titleFolded: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
23668
|
+
name: string;
|
|
23669
|
+
tableName: "tracker_items";
|
|
23670
|
+
dataType: "string";
|
|
23671
|
+
data: string;
|
|
23672
|
+
driverParam: string;
|
|
23673
|
+
notNull: true;
|
|
23674
|
+
hasDefault: false;
|
|
23675
|
+
isPrimaryKey: false;
|
|
23676
|
+
isAutoincrement: false;
|
|
23677
|
+
hasRuntimeDefault: false;
|
|
23678
|
+
enumValues: [string, ...string[]];
|
|
23679
|
+
baseColumn: never;
|
|
23680
|
+
identity: undefined;
|
|
23681
|
+
generated: undefined;
|
|
23682
|
+
}, {}>;
|
|
23683
|
+
body: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
23684
|
+
name: string;
|
|
23685
|
+
tableName: "tracker_items";
|
|
23686
|
+
dataType: "string";
|
|
23687
|
+
data: string;
|
|
23688
|
+
driverParam: string;
|
|
23689
|
+
notNull: false;
|
|
23690
|
+
hasDefault: false;
|
|
23691
|
+
isPrimaryKey: false;
|
|
23692
|
+
isAutoincrement: false;
|
|
23693
|
+
hasRuntimeDefault: false;
|
|
23694
|
+
enumValues: [string, ...string[]];
|
|
23695
|
+
baseColumn: never;
|
|
23696
|
+
identity: undefined;
|
|
23697
|
+
generated: undefined;
|
|
23698
|
+
}, {}>;
|
|
23699
|
+
normalizedText: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
23700
|
+
name: string;
|
|
23701
|
+
tableName: "tracker_items";
|
|
23702
|
+
dataType: "string";
|
|
23703
|
+
data: string;
|
|
23704
|
+
driverParam: string;
|
|
23705
|
+
notNull: true;
|
|
23706
|
+
hasDefault: false;
|
|
23707
|
+
isPrimaryKey: false;
|
|
23708
|
+
isAutoincrement: false;
|
|
23709
|
+
hasRuntimeDefault: false;
|
|
23710
|
+
enumValues: [string, ...string[]];
|
|
23711
|
+
baseColumn: never;
|
|
23712
|
+
identity: undefined;
|
|
23713
|
+
generated: undefined;
|
|
23714
|
+
}, {}>;
|
|
23715
|
+
data: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
23716
|
+
name: string;
|
|
23717
|
+
tableName: "tracker_items";
|
|
23718
|
+
dataType: "string";
|
|
23719
|
+
data: string;
|
|
23720
|
+
driverParam: string;
|
|
23721
|
+
notNull: true;
|
|
23722
|
+
hasDefault: false;
|
|
23723
|
+
isPrimaryKey: false;
|
|
23724
|
+
isAutoincrement: false;
|
|
23725
|
+
hasRuntimeDefault: false;
|
|
23726
|
+
enumValues: [string, ...string[]];
|
|
23727
|
+
baseColumn: never;
|
|
23728
|
+
identity: undefined;
|
|
23729
|
+
generated: undefined;
|
|
23730
|
+
}, {}>;
|
|
23731
|
+
sourceCreatedAt: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
23732
|
+
name: string;
|
|
23733
|
+
tableName: "tracker_items";
|
|
23734
|
+
dataType: "number int53";
|
|
23735
|
+
data: number;
|
|
23736
|
+
driverParam: number;
|
|
23737
|
+
notNull: false;
|
|
23738
|
+
hasDefault: false;
|
|
23739
|
+
isPrimaryKey: false;
|
|
23740
|
+
isAutoincrement: false;
|
|
23741
|
+
hasRuntimeDefault: false;
|
|
23742
|
+
enumValues: undefined;
|
|
23743
|
+
baseColumn: never;
|
|
23744
|
+
identity: undefined;
|
|
23745
|
+
generated: undefined;
|
|
23746
|
+
}, {}>;
|
|
23747
|
+
sourceUpdatedAt: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
23748
|
+
name: string;
|
|
23749
|
+
tableName: "tracker_items";
|
|
23750
|
+
dataType: "number int53";
|
|
23751
|
+
data: number;
|
|
23752
|
+
driverParam: number;
|
|
23753
|
+
notNull: false;
|
|
23754
|
+
hasDefault: false;
|
|
23755
|
+
isPrimaryKey: false;
|
|
23756
|
+
isAutoincrement: false;
|
|
23757
|
+
hasRuntimeDefault: false;
|
|
23758
|
+
enumValues: undefined;
|
|
23759
|
+
baseColumn: never;
|
|
23760
|
+
identity: undefined;
|
|
23761
|
+
generated: undefined;
|
|
23762
|
+
}, {}>;
|
|
23763
|
+
archivedAt: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
23764
|
+
name: string;
|
|
23765
|
+
tableName: "tracker_items";
|
|
23766
|
+
dataType: "number int53";
|
|
23767
|
+
data: number;
|
|
23768
|
+
driverParam: number;
|
|
23769
|
+
notNull: false;
|
|
23770
|
+
hasDefault: false;
|
|
23771
|
+
isPrimaryKey: false;
|
|
23772
|
+
isAutoincrement: false;
|
|
23773
|
+
hasRuntimeDefault: false;
|
|
23774
|
+
enumValues: undefined;
|
|
23775
|
+
baseColumn: never;
|
|
23776
|
+
identity: undefined;
|
|
23777
|
+
generated: undefined;
|
|
23778
|
+
}, {}>;
|
|
23779
|
+
deletedAt: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
23780
|
+
name: string;
|
|
23781
|
+
tableName: "tracker_items";
|
|
23782
|
+
dataType: "number int53";
|
|
23783
|
+
data: number;
|
|
23784
|
+
driverParam: number;
|
|
23785
|
+
notNull: false;
|
|
23786
|
+
hasDefault: false;
|
|
23787
|
+
isPrimaryKey: false;
|
|
23788
|
+
isAutoincrement: false;
|
|
23789
|
+
hasRuntimeDefault: false;
|
|
23790
|
+
enumValues: undefined;
|
|
23791
|
+
baseColumn: never;
|
|
23792
|
+
identity: undefined;
|
|
23793
|
+
generated: undefined;
|
|
23794
|
+
}, {}>;
|
|
23795
|
+
syncedAt: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
23796
|
+
name: string;
|
|
23797
|
+
tableName: "tracker_items";
|
|
23798
|
+
dataType: "number int53";
|
|
23799
|
+
data: number;
|
|
23800
|
+
driverParam: number;
|
|
23801
|
+
notNull: true;
|
|
23802
|
+
hasDefault: false;
|
|
23803
|
+
isPrimaryKey: false;
|
|
23804
|
+
isAutoincrement: false;
|
|
23805
|
+
hasRuntimeDefault: false;
|
|
23806
|
+
enumValues: undefined;
|
|
23807
|
+
baseColumn: never;
|
|
23808
|
+
identity: undefined;
|
|
23809
|
+
generated: undefined;
|
|
23810
|
+
}, {}>;
|
|
23811
|
+
};
|
|
23812
|
+
dialect: 'sqlite';
|
|
23813
|
+
isAlias: false;
|
|
23814
|
+
}>;
|
|
23563
23815
|
/** Settings of the store file itself, shared by every profile, tg and MAX — unlike a profile's config file. */
|
|
23564
23816
|
export declare const storeSettings: import("drizzle-orm/sqlite-core").SQLiteTableWithColumns<{
|
|
23565
23817
|
name: "store_settings";
|
|
@@ -2373,6 +2373,34 @@ export const conversationReadiness = sqliteTable("conversation_readiness", {
|
|
|
2373
2373
|
primaryKey({ columns: [table.chatId, table.model] }),
|
|
2374
2374
|
index("conversation_readiness_by_model").on(table.model),
|
|
2375
2375
|
]);
|
|
2376
|
+
/**
|
|
2377
|
+
* One team, user, workflow state, label, project, issue or comment of an issue tracker account, as last synced. The
|
|
2378
|
+
* columns are what lists, filters and search read; the rest of the record is `data`, JSON in the domain's field names.
|
|
2379
|
+
*/
|
|
2380
|
+
export const trackerItems = sqliteTable("tracker_items", {
|
|
2381
|
+
id: integer("id").primaryKey(),
|
|
2382
|
+
accountId: integer("account_id")
|
|
2383
|
+
.notNull()
|
|
2384
|
+
.references(() => accounts.id),
|
|
2385
|
+
kind: text("kind").notNull(),
|
|
2386
|
+
externalId: text("external_id").notNull(),
|
|
2387
|
+
/** A comment's issue, an issue's team, a state's or a label's team: the tracker's id. */
|
|
2388
|
+
parentId: text("parent_id"),
|
|
2389
|
+
title: text("title").notNull(),
|
|
2390
|
+
titleFolded: text("title_folded").notNull(),
|
|
2391
|
+
body: text("body"),
|
|
2392
|
+
normalizedText: text("normalized_text").notNull(),
|
|
2393
|
+
data: text("data").notNull(),
|
|
2394
|
+
sourceCreatedAt: integer("source_created_at"),
|
|
2395
|
+
sourceUpdatedAt: integer("source_updated_at"),
|
|
2396
|
+
archivedAt: integer("archived_at"),
|
|
2397
|
+
/** The tracker no longer lists it. */
|
|
2398
|
+
deletedAt: integer("deleted_at"),
|
|
2399
|
+
syncedAt: integer("synced_at").notNull(),
|
|
2400
|
+
}, (table) => [
|
|
2401
|
+
unique().on(table.accountId, table.kind, table.externalId),
|
|
2402
|
+
index("tracker_items_by_account_id_kind_parent_id").on(table.accountId, table.kind, table.parentId),
|
|
2403
|
+
]);
|
|
2376
2404
|
/** Settings of the store file itself, shared by every profile, tg and MAX — unlike a profile's config file. */
|
|
2377
2405
|
export const storeSettings = sqliteTable("store_settings", {
|
|
2378
2406
|
key: text("key").primaryKey(),
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { type StateType, type TrackerKind, type TrackerRecords } from "../../domain/tracker.js";
|
|
2
|
+
import type { CacheDatabase } from "../driver.js";
|
|
3
|
+
import type { AccountKey } from "../types.js";
|
|
4
|
+
import type { StoreContext } from "./open.js";
|
|
5
|
+
/** One stored tracker record with what the store keeps beside it. */
|
|
6
|
+
export interface TrackerItem<K extends TrackerKind = TrackerKind> {
|
|
7
|
+
kind: K;
|
|
8
|
+
record: TrackerRecords[K];
|
|
9
|
+
/** The tracker no longer lists it. */
|
|
10
|
+
deletedAt: number | null;
|
|
11
|
+
syncedAt: number;
|
|
12
|
+
}
|
|
13
|
+
/** What `list` narrows to; an issue filter names the tracker's ids, as the records hold them. */
|
|
14
|
+
export interface TrackerFilter {
|
|
15
|
+
/** A comment's issue, an issue's, a state's or a label's team. */
|
|
16
|
+
parent?: string;
|
|
17
|
+
/** Issues only. */
|
|
18
|
+
assignee?: string | null;
|
|
19
|
+
project?: string;
|
|
20
|
+
state?: string;
|
|
21
|
+
/** Issues whose state is of one of these types. */
|
|
22
|
+
stateTypes?: readonly StateType[];
|
|
23
|
+
label?: string;
|
|
24
|
+
/** Archived rows too; absent, only the live ones. */
|
|
25
|
+
archived?: boolean;
|
|
26
|
+
limit?: number;
|
|
27
|
+
offset?: number;
|
|
28
|
+
}
|
|
29
|
+
export interface TrackerHit {
|
|
30
|
+
account: AccountKey;
|
|
31
|
+
item: TrackerItem;
|
|
32
|
+
excerpt: string;
|
|
33
|
+
}
|
|
34
|
+
export interface TrackerSearch {
|
|
35
|
+
words: string[];
|
|
36
|
+
anyWord?: boolean;
|
|
37
|
+
exact?: boolean;
|
|
38
|
+
/** Absent: every tracker account's. */
|
|
39
|
+
accounts?: AccountKey[];
|
|
40
|
+
kinds?: readonly TrackerKind[];
|
|
41
|
+
limit?: number;
|
|
42
|
+
offset?: number;
|
|
43
|
+
}
|
|
44
|
+
/** A tracker user joined to the one person the store knows by the same e-mail. */
|
|
45
|
+
export interface TrackerPerson {
|
|
46
|
+
user: string;
|
|
47
|
+
person: string;
|
|
48
|
+
name: string | null;
|
|
49
|
+
}
|
|
50
|
+
export interface TrackerStore {
|
|
51
|
+
/**
|
|
52
|
+
* Upserts records of one kind; a field a record leaves out keeps its stored value, and a record listed again after
|
|
53
|
+
* the tracker stopped listing it comes back. Answers how many were written.
|
|
54
|
+
*/
|
|
55
|
+
save<K extends TrackerKind>(key: AccountKey, kind: K, records: readonly TrackerRecords[K][], now: number): Promise<number>;
|
|
56
|
+
/**
|
|
57
|
+
* After a complete list of the kind's ids: marks deleted every stored one the list lacks that has not been synced
|
|
58
|
+
* since `before`, so a row saved while the list was read is never taken for a deleted one. Answers how many.
|
|
59
|
+
*/
|
|
60
|
+
removeUnlisted(key: AccountKey, kind: TrackerKind, listed: readonly string[], before: number, now: number, options?: {
|
|
61
|
+
dryRun?: boolean;
|
|
62
|
+
}): Promise<number>;
|
|
63
|
+
get<K extends TrackerKind>(key: AccountKey, kind: K, externalId: string): Promise<TrackerItem<K> | undefined>;
|
|
64
|
+
/** An issue by its readable key (`ENG-12`), in any letter case. */
|
|
65
|
+
issueByKey(key: AccountKey, issueKey: string): Promise<TrackerItem<"issue"> | undefined>;
|
|
66
|
+
/** Live rows of a kind, newest change first; deleted ones never. */
|
|
67
|
+
list<K extends TrackerKind>(key: AccountKey, kind: K, filter?: TrackerFilter): Promise<{
|
|
68
|
+
items: TrackerItem<K>[];
|
|
69
|
+
hasMore: boolean;
|
|
70
|
+
}>;
|
|
71
|
+
find(search: TrackerSearch): Promise<{
|
|
72
|
+
items: TrackerHit[];
|
|
73
|
+
hasMore: boolean;
|
|
74
|
+
}>;
|
|
75
|
+
/** Live rows of the kind, archived ones included. */
|
|
76
|
+
count(key: AccountKey, kind: TrackerKind): Promise<number>;
|
|
77
|
+
/** The tracker users among `users` whose e-mail, in any letter case, an identity linked to one person has. */
|
|
78
|
+
people(key: AccountKey, users: readonly string[]): Promise<TrackerPerson[]>;
|
|
79
|
+
}
|
|
80
|
+
/** `store rebuild`: the normalized copies follow the current normalizer, then the word index is filled again. */
|
|
81
|
+
export declare const resetTrackerItemWords: (database: CacheDatabase) => number;
|
|
82
|
+
export declare const trackerStoreOver: (context: StoreContext) => TrackerStore;
|