@wirecat/cli-core 1.0.0 → 1.2.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 +144 -0
- package/THIRD_PARTY_NOTICES +43 -0
- package/dist/background/daily-archive-timer.d.ts +1 -1
- package/dist/cli/account-remove.d.ts +3 -0
- package/dist/cli/account-remove.js +1 -1
- package/dist/cli/documents/index.d.ts +2 -1
- package/dist/cli/documents/index.js +4 -1
- package/dist/cli/documents/words.d.ts +1 -1
- package/dist/cli/domain-lists-command.d.ts +16 -0
- package/dist/cli/domain-lists-command.js +88 -0
- package/dist/cli/index.d.ts +4 -3
- package/dist/cli/index.js +4 -3
- package/dist/cli/messenger/conversation-answers.d.ts +2 -0
- package/dist/cli/messenger/message-answers.d.ts +2 -0
- package/dist/cli/messenger/message-items.js +2 -0
- package/dist/cli/messenger/message-writes.d.ts +4 -0
- package/dist/cli/messenger/search-answers.js +2 -0
- package/dist/cli/model-catalogue-command.d.ts +6 -0
- package/dist/cli/model-catalogue-command.js +1 -1
- package/dist/cli/oauth-session.d.ts +38 -4
- package/dist/cli/oauth-session.js +72 -25
- package/dist/cli/shared-command-exports.d.ts +4 -0
- package/dist/cli/shared-command-exports.js +6 -0
- package/dist/cli/token-session.d.ts +9 -3
- package/dist/cli/token-session.js +34 -3
- package/dist/domain/domain-lists.d.ts +86 -0
- package/dist/domain/domain-lists.js +110 -0
- package/dist/domain/free-mail-domains.generated.d.ts +1 -0
- package/dist/domain/free-mail-domains.generated.js +4 -0
- package/dist/domain/models.d.ts +5 -0
- package/dist/domain/organization-sectors.d.ts +9 -3
- package/dist/domain/organization-sectors.generated.d.ts +1 -0
- package/dist/domain/organization-sectors.generated.js +1 -0
- package/dist/domain/organization-sectors.js +16 -3
- package/dist/domain/person-kinds.d.ts +6 -1
- package/dist/domain/person-kinds.js +5 -0
- package/dist/entities/contact-context.d.ts +4 -0
- package/dist/entities/conversation-results.d.ts +4 -0
- package/dist/entities/domain-list.d.ts +27 -0
- package/dist/entities/domain-list.js +28 -0
- package/dist/entities/evidence.d.ts +16 -0
- package/dist/entities/index.d.ts +56 -2
- package/dist/entities/index.js +3 -1
- package/dist/entities/knowledge-lists.d.ts +1 -1
- package/dist/entities/listener.d.ts +8 -0
- package/dist/entities/message-change.d.ts +2 -0
- package/dist/entities/message-context.d.ts +6 -0
- package/dist/entities/message-write.d.ts +8 -0
- package/dist/entities/message.d.ts +4 -0
- package/dist/entities/message.js +4 -0
- package/dist/entities/store-records.d.ts +2 -0
- package/dist/errors/reasons.js +20 -2
- package/dist/mail/cli/index.js +1 -1
- package/dist/mail/headers.d.ts +2 -0
- package/dist/mail/headers.js +2 -1
- package/dist/mail/mail-types.d.ts +48 -0
- package/dist/mail/mail-types.js +218 -0
- package/dist/mail/read.js +1 -0
- package/dist/mail/sort-rules.d.ts +58 -0
- package/dist/mail/sort-rules.js +79 -0
- package/dist/oauth/index.d.ts +1 -1
- package/dist/oauth/storage.d.ts +10 -2
- package/dist/oauth/storage.js +23 -9
- package/dist/search/lucene/registry.js +24 -0
- package/dist/services/domain-lists-download.d.ts +26 -0
- package/dist/services/domain-lists-download.js +155 -0
- package/dist/services/messages-search.js +1 -1
- package/dist/services/metadata.d.ts +1 -1
- package/dist/store/areas.d.ts +3 -1
- package/dist/store/areas.js +2 -0
- package/dist/store/index.d.ts +2 -2
- package/dist/store/index.js +1 -1
- package/dist/store/people.d.ts +18 -9
- package/dist/store/people.js +8 -7
- package/dist/store/public.d.ts +1 -1
- package/dist/store/public.js +1 -1
- package/dist/store/queries.js +9 -2
- package/dist/store/sqlite/accounts.js +3 -1
- package/dist/store/sqlite/domain-organizations.d.ts +7 -4
- package/dist/store/sqlite/domain-organizations.js +94 -36
- package/dist/store/sqlite/email-types.d.ts +87 -0
- package/dist/store/sqlite/email-types.js +296 -0
- package/dist/store/sqlite/emails.d.ts +14 -2
- package/dist/store/sqlite/emails.js +32 -12
- package/dist/store/sqlite/identities.d.ts +4 -1
- package/dist/store/sqlite/identities.js +11 -2
- package/dist/store/sqlite/identity-rekey.js +2 -0
- package/dist/store/sqlite/lucene-fields.d.ts +6 -0
- package/dist/store/sqlite/lucene-fields.js +10 -0
- package/dist/store/sqlite/lucene.js +6 -0
- package/dist/store/sqlite/mail-sorting.d.ts +122 -0
- package/dist/store/sqlite/mail-sorting.js +482 -0
- package/dist/store/sqlite/manifest.js +6 -0
- package/dist/store/sqlite/merged-persons.d.ts +3 -2
- package/dist/store/sqlite/merged-persons.js +5 -3
- package/dist/store/sqlite/migrations.generated.js +76 -0
- package/dist/store/sqlite/people-list.d.ts +1 -6
- package/dist/store/sqlite/people-list.js +97 -42
- package/dist/store/sqlite/person-links.js +13 -3
- package/dist/store/sqlite/person-match-scan.js +5 -2
- package/dist/store/sqlite/schema/mail-sorting.d.ts +384 -0
- package/dist/store/sqlite/schema/mail-sorting.js +31 -0
- package/dist/store/sqlite/schema/sender-bots.d.ts +56 -0
- package/dist/store/sqlite/schema/sender-bots.js +9 -1
- package/dist/store/sqlite/schema.d.ts +66 -1
- package/dist/store/sqlite/schema.js +9 -1
- package/dist/store/sqlite/sender-bots.d.ts +89 -15
- package/dist/store/sqlite/sender-bots.js +417 -136
- package/dist/store/sqlite/sender-signals.d.ts +11 -4
- package/dist/store/sqlite/sender-signals.js +14 -10
- package/package.json +2 -2
|
@@ -1,41 +1,115 @@
|
|
|
1
1
|
import type { CacheDatabase } from "../driver.js";
|
|
2
2
|
import type { IdentityRef, PersonRecord } from "../types.js";
|
|
3
3
|
import type { StoreContext } from "./open.js";
|
|
4
|
-
|
|
4
|
+
import { type Reach, type SenderSignal } from "./sender-signals.js";
|
|
5
5
|
export type BotAuthor = "rules" | "owner";
|
|
6
|
-
/**
|
|
7
|
-
export interface
|
|
8
|
-
|
|
9
|
-
|
|
6
|
+
/** @experimental */
|
|
7
|
+
export interface BotIdentity {
|
|
8
|
+
provider: string;
|
|
9
|
+
id: string;
|
|
10
10
|
name: string | null;
|
|
11
|
+
username: string | null;
|
|
11
12
|
}
|
|
13
|
+
/** A program that writes to the owner, apart from people: it has no ties, no tasks and no merge review. @experimental */
|
|
12
14
|
export interface SenderBot {
|
|
15
|
+
/** `sender-bot:<id>`. */
|
|
13
16
|
bot: string;
|
|
14
|
-
/** The
|
|
15
|
-
person: string;
|
|
17
|
+
/** The owner's name for it; `displayName` falls back to its identities'. */
|
|
16
18
|
name: string | null;
|
|
19
|
+
displayName: string | null;
|
|
20
|
+
/** The organization it sends for (`organization:<id>`), from its mail domain or the owner. */
|
|
21
|
+
organization: string | null;
|
|
22
|
+
/** `owner` when the owner moved it: no rule gives it back to a person. */
|
|
23
|
+
author: BotAuthor;
|
|
24
|
+
/** The kind signals that sorted it, or the owner's words. */
|
|
25
|
+
reason: string | null;
|
|
26
|
+
identities: BotIdentity[];
|
|
27
|
+
/** Messages and mail it sent, every account together. */
|
|
28
|
+
messagesFrom: number;
|
|
29
|
+
lastContact: string | null;
|
|
30
|
+
reach: Reach | null;
|
|
31
|
+
signals: SenderSignal[];
|
|
32
|
+
}
|
|
33
|
+
/** One move of an identity between a person and a bot. @experimental */
|
|
34
|
+
export interface BotMove {
|
|
35
|
+
identity: IdentityRef;
|
|
36
|
+
/** `person:<uid>` or `sender-bot:<id>`; `null` for none. */
|
|
37
|
+
from: string | null;
|
|
38
|
+
to: string | null;
|
|
17
39
|
author: BotAuthor;
|
|
18
40
|
reason: string | null;
|
|
41
|
+
at: string;
|
|
19
42
|
}
|
|
20
|
-
|
|
43
|
+
/** @experimental */
|
|
44
|
+
export interface SenderBotDetails extends SenderBot {
|
|
45
|
+
/** Every move to or from this bot, oldest first. */
|
|
46
|
+
moves: BotMove[];
|
|
47
|
+
}
|
|
48
|
+
/** @experimental */
|
|
49
|
+
export interface BotListOptions {
|
|
50
|
+
/** Part of a name, address or username, at least 3 characters. */
|
|
51
|
+
query?: string;
|
|
52
|
+
/** `organization:<id>`: the bots that send for it. */
|
|
53
|
+
organization?: string;
|
|
54
|
+
limit: number;
|
|
55
|
+
offset?: number;
|
|
56
|
+
}
|
|
57
|
+
/** @experimental */
|
|
58
|
+
export interface BotList {
|
|
59
|
+
items: SenderBot[];
|
|
60
|
+
hasMore: boolean;
|
|
61
|
+
total: number;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* The source re-keyed `from` onto `to`, both stored: a bot holding `from` takes `to` from its person, since one
|
|
65
|
+
* account is one program. The person it leaves is hidden as `intoBot` hides one. The caller holds the write lock.
|
|
66
|
+
*/
|
|
67
|
+
export declare const rekeyIntoBot: (database: CacheDatabase, from: number, to: number, at: number) => void;
|
|
21
68
|
/** People holding an identity the owner last moved to a person, or kept as one: no rule makes them a bot. */
|
|
22
69
|
export declare const ownerPeopleOf: (database: CacheDatabase) => Set<number>;
|
|
70
|
+
/** A person every identity left for a bot is no one's assignee: the bot has no tasks. */
|
|
23
71
|
export declare const refuseBotAssignee: (database: CacheDatabase, person: number) => void;
|
|
24
|
-
/** A rule's move of a whole person to a bot
|
|
25
|
-
export declare const
|
|
72
|
+
/** A rule's move of a whole person to a new bot; answers the bot. The caller holds the write lock. */
|
|
73
|
+
export declare const ruleToBot: (database: CacheDatabase, person: number, reason: string, at: number) => number;
|
|
74
|
+
/** The reason of a bot that only sent a newsletter: a mail written to the owner alone gives it back to a person. */
|
|
75
|
+
export declare const NEWSLETTER_ONLY = "newsletter-only";
|
|
76
|
+
/**
|
|
77
|
+
* A rule's bot the owner wrote to, or a newsletter's that wrote to the owner alone, by mail or in a private chat both wrote in, goes back to the people its identities
|
|
78
|
+
* came from; a messenger's own bot flag holds anyway. The caller holds the write lock.
|
|
79
|
+
*/
|
|
80
|
+
export declare const ruleBotsBack: (database: CacheDatabase, at: number) => void;
|
|
81
|
+
/**
|
|
82
|
+
* Mail a newsletter's bot sent since the last check: no trigger makes a kind stale for it, so a 1-to-1 mail would wait
|
|
83
|
+
* for someone else's change to give the bot back. Answers the newest email id to check up to, or `undefined`.
|
|
84
|
+
*/
|
|
85
|
+
export declare const newsletterBotsMail: (database: CacheDatabase) => number | undefined;
|
|
86
|
+
/** Gives back the newsletter bots a 1-to-1 mail came from, and keeps how far the mail was checked. */
|
|
87
|
+
export declare const settleNewsletterBots: (database: CacheDatabase, newest: number, at: number) => void;
|
|
88
|
+
/** Whether a build before version 75 sorted a bot onto a person row since the last kept list. */
|
|
89
|
+
export declare const hasLegacyBots: (database: CacheDatabase) => boolean;
|
|
90
|
+
/**
|
|
91
|
+
* A bot a build before version 75 sorted after the upgrade holds its person row's identities there: they move to the
|
|
92
|
+
* bot, as the upgrade moved the others. The caller holds the write lock.
|
|
93
|
+
*/
|
|
94
|
+
export declare const settleLegacyBots: (database: CacheDatabase, at: number) => void;
|
|
95
|
+
/** The sender bots, by name; a bot a build before version 75 sorted shows once a list has settled it. */
|
|
96
|
+
export declare const listBots: (database: CacheDatabase, options: BotListOptions) => BotList;
|
|
97
|
+
/** One sender bot with its identities and every move to or from it. */
|
|
98
|
+
export declare const showBot: (database: CacheDatabase, ref: string) => SenderBotDetails;
|
|
26
99
|
/**
|
|
27
|
-
* The owner's word that a person, or one
|
|
28
|
-
*
|
|
29
|
-
*
|
|
100
|
+
* The owner's word that a person, a bot or one identity is a program, for its whole history: its messages stay where
|
|
101
|
+
* they are, and no rule gives it back. `bot` joins it to a stored bot; else a bot that already holds it keeps it, or a
|
|
102
|
+
* new one takes it. A person every identity left is hidden, and a move back gives their uid back.
|
|
30
103
|
*/
|
|
31
104
|
export declare const moveToBot: (context: StoreContext, subject: string | IdentityRef, options?: {
|
|
32
105
|
bot?: string;
|
|
33
106
|
name?: string;
|
|
34
107
|
reason?: string;
|
|
35
|
-
}) =>
|
|
108
|
+
}) => SenderBotDetails;
|
|
36
109
|
/**
|
|
37
110
|
* The owner's word that a bot, a person or one identity is a person, for its whole history; no rule makes it a bot
|
|
38
|
-
* again. `person`
|
|
111
|
+
* again. `person` takes it; else each identity goes back to the person it came from, or a person of its own. Said of a
|
|
112
|
+
* person, it keeps them one. Answers the person the first identity is on.
|
|
39
113
|
*/
|
|
40
114
|
export declare const moveToPerson: (context: StoreContext, subject: string | IdentityRef, options?: {
|
|
41
115
|
person?: string;
|