@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
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import type { Sector } from "../domain/organization-sectors.js";
|
|
2
|
+
import { type Reach } from "../store/sqlite/sender-signals.js";
|
|
3
|
+
/**
|
|
4
|
+
* What one email is, apart from who sent it: a shop's receipt is an `order` and its sale a `promotion`. The first
|
|
5
|
+
* that matches wins, in this order, with one exception: an automated sender's List-Unsubscribe mail with no campaign
|
|
6
|
+
* marker is an `account_notice` before the list types are tried (Zero's rule that keeps receipts out of promotions).
|
|
7
|
+
* `system_alert` comes before `account_notice`: an alert carries Auto-Submitted too, and would never be reached.
|
|
8
|
+
* @experimental
|
|
9
|
+
*/
|
|
10
|
+
export declare const MAIL_TYPES: readonly ["auto_reply", "security", "calendar", "travel", "event_ticket", "order", "shipping", "bill", "social_notification", "discussion_list", "newsletter", "promotion", "system_alert", "account_notice", "personal", "other"];
|
|
11
|
+
/** @experimental */
|
|
12
|
+
export type MailType = (typeof MAIL_TYPES)[number];
|
|
13
|
+
/** What the store keeps of one email that its type is worked out from. @experimental */
|
|
14
|
+
export interface MailTypeInput {
|
|
15
|
+
from: string | null;
|
|
16
|
+
subject: string | null;
|
|
17
|
+
/** As `mailHeadersOf` keeps them: what marks a program or a list counts only under the From domain's DKIM. */
|
|
18
|
+
headers: Record<string, unknown>;
|
|
19
|
+
/** To and Cc together; `null` when the store holds no recipients (mail recorded as an envelope). */
|
|
20
|
+
recipients: number | null;
|
|
21
|
+
/** The media types of its parts the store keeps as attachments, lower case. */
|
|
22
|
+
parts: readonly string[];
|
|
23
|
+
/** schema.org types its HTML declares (`Order`, `FlightReservation`). */
|
|
24
|
+
schemaTypes: readonly string[];
|
|
25
|
+
/** Distinct addresses that send to its List-Id. */
|
|
26
|
+
listSenders: number;
|
|
27
|
+
/** The owner sent mail to this address, or this is the owner's own mail. */
|
|
28
|
+
ownerWrote: boolean;
|
|
29
|
+
/** The sender is a sender bot. */
|
|
30
|
+
bot: boolean;
|
|
31
|
+
/** The sector of the organization the sender's address belongs to. */
|
|
32
|
+
sector: Sector | null;
|
|
33
|
+
}
|
|
34
|
+
/** @experimental */
|
|
35
|
+
export interface MailTypeOf {
|
|
36
|
+
type: MailType;
|
|
37
|
+
reach: Reach;
|
|
38
|
+
/** What decided the type; `null` for `other`. */
|
|
39
|
+
signal: string | null;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* One email's type, reach and the signal behind the type, from what the store keeps of it alone: no lookup, no model.
|
|
43
|
+
* Mail from someone the owner writes to is typed by what the mail itself carries (a calendar or report part, schema.org
|
|
44
|
+
* markup, list headers), never by an address word or a subject alone: `info@` is often a person. @experimental
|
|
45
|
+
*/
|
|
46
|
+
export declare const mailTypeOf: (input: MailTypeInput) => MailTypeOf;
|
|
47
|
+
/** The schema.org types an email's HTML declares, in JSON-LD or microdata, as Gmail's markup reads them. @experimental */
|
|
48
|
+
export declare const schemaTypesOf: (html: string | null) => string[];
|
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* The order of the checks and the AUTOMATED_SENDER and MARKETING_SENDER patterns are ported from Zero's header
|
|
3
|
+
* classifier, apps/server/src/lib/imap/categorize.ts at commit 4b642dfd9890a1fdcb1b98a177fe74ca3142c445:
|
|
4
|
+
*
|
|
5
|
+
* MIT License
|
|
6
|
+
*
|
|
7
|
+
* Copyright (c) 2025 Zero Email
|
|
8
|
+
*
|
|
9
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
|
|
10
|
+
* documentation files (the "Software"), to deal in the Software without restriction, including without limitation the
|
|
11
|
+
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to
|
|
12
|
+
* permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
13
|
+
*
|
|
14
|
+
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the
|
|
15
|
+
* Software.
|
|
16
|
+
*
|
|
17
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
|
|
18
|
+
* WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
|
19
|
+
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
|
20
|
+
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
21
|
+
*/
|
|
22
|
+
import { isNoReplyAddress } from "../domain/addresses.js";
|
|
23
|
+
import { DISCUSSION_SENDERS, reachOfOne } from "../store/sqlite/sender-signals.js";
|
|
24
|
+
/**
|
|
25
|
+
* What one email is, apart from who sent it: a shop's receipt is an `order` and its sale a `promotion`. The first
|
|
26
|
+
* that matches wins, in this order, with one exception: an automated sender's List-Unsubscribe mail with no campaign
|
|
27
|
+
* marker is an `account_notice` before the list types are tried (Zero's rule that keeps receipts out of promotions).
|
|
28
|
+
* `system_alert` comes before `account_notice`: an alert carries Auto-Submitted too, and would never be reached.
|
|
29
|
+
* @experimental
|
|
30
|
+
*/
|
|
31
|
+
export const MAIL_TYPES = [
|
|
32
|
+
"auto_reply",
|
|
33
|
+
"security",
|
|
34
|
+
"calendar",
|
|
35
|
+
"travel",
|
|
36
|
+
"event_ticket",
|
|
37
|
+
"order",
|
|
38
|
+
"shipping",
|
|
39
|
+
"bill",
|
|
40
|
+
"social_notification",
|
|
41
|
+
"discussion_list",
|
|
42
|
+
"newsletter",
|
|
43
|
+
"promotion",
|
|
44
|
+
"system_alert",
|
|
45
|
+
"account_notice",
|
|
46
|
+
"personal",
|
|
47
|
+
"other",
|
|
48
|
+
];
|
|
49
|
+
/** Automated senders: notifications, receipts, alerts (Zero). */
|
|
50
|
+
const AUTOMATED_SENDER = /^(no-?reply|do-?not-?reply|donotreply|notifications?|notify|alerts?|mailer-daemon|postmaster|bounces?|automated|system|accounts?|security|billing|receipts?|orders?|shipping|support|service|updates?)([+._-].*)?@/i;
|
|
51
|
+
/** Marketing senders (Zero). */
|
|
52
|
+
const MARKETING_SENDER = /^(news(letters?)?|marketing|promo(tions?)?|offers?|deals?|sales|hello|hi|team|info|digest)([+._-].*)?@/i;
|
|
53
|
+
const local = (words) => new RegExp(`^(${words})([+._-].*)?@`, "i");
|
|
54
|
+
const MAILER_DAEMON = local("mailer-daemon|postmaster");
|
|
55
|
+
const SECURITY_SENDER = local("security|account-?security|verify|verification|auth|2fa|otp|login|signin|password");
|
|
56
|
+
const ORDER_SENDER = local("orders?|receipts?|order-?confirm(ation)?|purchases?");
|
|
57
|
+
const SHIPPING_SENDER = local("shipping|shipments?|tracking|deliver(y|ies)|dispatch");
|
|
58
|
+
const BILL_SENDER = local("billing|invoices?|payments?|statements?");
|
|
59
|
+
const ALERT_SENDER = local("alerts?|alertmanager|monitoring|monitor|cron|root|ci|builds?|jenkins|nagios|zabbix|sentry");
|
|
60
|
+
const NEWS_SENDER = local("news(letters?)?|digest|editors?|weekly");
|
|
61
|
+
const AUTO_REPLY_SUBJECT = /^(auto(matic)?[ -]?(reply|response)|out of (the )?office|abwesenheit|réponse automatique|respuesta automática|автоответ|автоматический ответ|undeliverable|undelivered mail|delivery status notification|mail delivery (failed|subsystem)|returned mail|failure notice|не доставлено)/iu;
|
|
62
|
+
const SECURITY_SUBJECT = /\b(verification code|security code|one[- ]time (pass)?code|sign[- ]?in (attempt|alert|code)|new (sign[- ]?in|login|device)|log[- ]?in (attempt|alert|code)|password (reset|change)|reset your password|two[- ]factor|2-step|confirm your (email|account)|verify your (email|account|identity))\b|код (подтверждения|для входа|безопасности)|вход в (аккаунт|учётную|учетную)|сброс пароля|código de (verificación|seguridad|acceso)|restablecer (tu |la )?contraseña|inicio de sesión/iu;
|
|
63
|
+
const TRAVEL_SUBJECT = /\b(boarding pass|e-?ticket|itinerary|flight (confirmation|booking|reservation)|booking confirm(ation|ed)|check[- ]in (now|is open|online))\b|посадочный талон|маршрутная квитанция|tarjeta de embarque|confirmación de (reserva|vuelo)/iu;
|
|
64
|
+
const EVENT_SUBJECT = /\b(your tickets?|ticket confirmation|tickets? for)\b|билеты? на|tus entradas|entradas para/iu;
|
|
65
|
+
const ORDER_SUBJECT = /\b(order (confirmation|confirmed|received|#|no\.?|number)|your order|thank(s| you) for your (order|purchase)|purchase confirmation|your receipt|receipt for|payment receipt)\b|ваш заказ|заказ (№|#|оформлен|принят)|tu pedido|confirmación de (pedido|compra)/iu;
|
|
66
|
+
const SHIPPING_SUBJECT = /\b(has (been )?shipped|out for delivery|has been delivered|on (its|the) way|tracking (number|info)|track your (order|package|parcel)|shipment|dispatched)\b|отправлен|доставлен|посылк|tu (pedido|paquete) (ha sido enviado|está en camino)|en camino/iu;
|
|
67
|
+
const BILL_SUBJECT = /\b(invoice|statement (is )?(ready|available)|your (monthly |account )?statement|payment (due|reminder|received|confirmation|failed)|bill (is )?(ready|due)|your bill)\b|сч[её]т (на оплату|№|#)|выписка|квитанция|factura|extracto|recibo de pago/iu;
|
|
68
|
+
const ALERT_SUBJECT = /^\[(firing|resolved|alert)|\b(build (failed|passed|fixed|broken)|pipeline (failed|succeeded)|cron <|is down|downtime)\b/iu;
|
|
69
|
+
const PROMOTION_SUBJECT = /\d+\s?%|\b(sale|discount|deals?|offers?|coupon|promo(code)?|free shipping|black friday|cyber monday|limited time|last chance)\b|скидк|распродаж|промокод|descuento|oferta|rebajas|cupón/iu;
|
|
70
|
+
const NEWS_SUBJECT = /\b(newsletter|digest|weekly|monthly|issue\s?#?\d+|edition)\b|рассылка|дайджест|boletín/iu;
|
|
71
|
+
const REPORT_PARTS = new Set(["message/delivery-status", "message/disposition-notification"]);
|
|
72
|
+
const CALENDAR_PARTS = new Set(["text/calendar", "application/ics"]);
|
|
73
|
+
const TRAVEL_SCHEMA = /^(Flight|Train|Bus|Lodging|RentalCar|Taxi|Boat)Reservation$/;
|
|
74
|
+
const schemaOf = (types, wanted) => types.find((one) => (typeof wanted === "string" ? one === wanted : wanted.test(one)));
|
|
75
|
+
/**
|
|
76
|
+
* One email's type, reach and the signal behind the type, from what the store keeps of it alone: no lookup, no model.
|
|
77
|
+
* Mail from someone the owner writes to is typed by what the mail itself carries (a calendar or report part, schema.org
|
|
78
|
+
* markup, list headers), never by an address word or a subject alone: `info@` is often a person. @experimental
|
|
79
|
+
*/
|
|
80
|
+
export const mailTypeOf = (input) => {
|
|
81
|
+
const { headers } = input;
|
|
82
|
+
const from = input.from ?? "";
|
|
83
|
+
const subject = input.subject ?? "";
|
|
84
|
+
const oneClick = headers["list-unsubscribe-post"] === true;
|
|
85
|
+
const feedbackId = headers["feedback-id"] === true;
|
|
86
|
+
const listUnsubscribe = headers["list-unsubscribe"] === true;
|
|
87
|
+
const listId = typeof headers["list-id"] === "string";
|
|
88
|
+
const precedence = typeof headers.precedence === "string" ? headers.precedence : "";
|
|
89
|
+
const bulkPrecedence = precedence === "bulk" || precedence === "junk";
|
|
90
|
+
const autoSubmitted = headers["auto-submitted"] !== undefined;
|
|
91
|
+
// With a List-Id, its senders decide: one sender, even under `+tag` addresses, writes a newsletter.
|
|
92
|
+
const discussion = listId
|
|
93
|
+
? input.listSenders >= DISCUSSION_SENDERS
|
|
94
|
+
: precedence === "list" && !feedbackId && !MARKETING_SENDER.test(from);
|
|
95
|
+
const mass = listUnsubscribe || bulkPrecedence || listId || oneClick;
|
|
96
|
+
const transactional = !mass && !feedbackId;
|
|
97
|
+
const noReply = from !== "" && isNoReplyAddress(from);
|
|
98
|
+
const person = input.ownerWrote && !input.bot;
|
|
99
|
+
// A forged `security@` would lend a phishing mail the look of a real alert.
|
|
100
|
+
const trusted = headers.dmarc !== "fail" && headers.dkim !== "fail";
|
|
101
|
+
const weak = !person && !oneClick && !listId;
|
|
102
|
+
const reach = reachOfOne({
|
|
103
|
+
autoSubmitted,
|
|
104
|
+
nullReturnPath: headers["null-return-path"] === true,
|
|
105
|
+
oneClick,
|
|
106
|
+
feedbackId,
|
|
107
|
+
bulk: mass || precedence === "list",
|
|
108
|
+
discussionList: discussion,
|
|
109
|
+
recipients: input.recipients,
|
|
110
|
+
}).reach;
|
|
111
|
+
const typed = (type, signal) => ({ type, reach, signal });
|
|
112
|
+
const schema = (wanted) => schemaOf(input.schemaTypes, wanted);
|
|
113
|
+
const report = input.parts.find((part) => REPORT_PARTS.has(part));
|
|
114
|
+
if (report !== undefined)
|
|
115
|
+
return typed("auto_reply", report);
|
|
116
|
+
if (MAILER_DAEMON.test(from))
|
|
117
|
+
return typed("auto_reply", "mailer-daemon");
|
|
118
|
+
if (!mass && AUTO_REPLY_SUBJECT.test(subject))
|
|
119
|
+
return typed("auto_reply", "auto-reply-subject");
|
|
120
|
+
if (weak && trusted && SECURITY_SENDER.test(from))
|
|
121
|
+
return typed("security", "security-address");
|
|
122
|
+
if (weak && trusted && SECURITY_SUBJECT.test(subject))
|
|
123
|
+
return typed("security", "security-subject");
|
|
124
|
+
const calendar = input.parts.find((part) => CALENDAR_PARTS.has(part));
|
|
125
|
+
if (calendar !== undefined)
|
|
126
|
+
return typed("calendar", calendar);
|
|
127
|
+
const travel = schema(TRAVEL_SCHEMA);
|
|
128
|
+
if (travel !== undefined)
|
|
129
|
+
return typed("travel", `schema:${travel}`);
|
|
130
|
+
if (weak && TRAVEL_SUBJECT.test(subject))
|
|
131
|
+
return typed("travel", "travel-subject");
|
|
132
|
+
if (weak && transactional && input.sector === "airline")
|
|
133
|
+
return typed("travel", "sector:airline");
|
|
134
|
+
if (schema("EventReservation") !== undefined)
|
|
135
|
+
return typed("event_ticket", "schema:EventReservation");
|
|
136
|
+
if (weak && EVENT_SUBJECT.test(subject))
|
|
137
|
+
return typed("event_ticket", "ticket-subject");
|
|
138
|
+
if (schema("Order") !== undefined)
|
|
139
|
+
return typed("order", "schema:Order");
|
|
140
|
+
if (weak && ORDER_SENDER.test(from))
|
|
141
|
+
return typed("order", "order-address");
|
|
142
|
+
// "Your order has shipped" names the order but reports the parcel.
|
|
143
|
+
if (weak && ORDER_SUBJECT.test(subject) && !SHIPPING_SUBJECT.test(subject))
|
|
144
|
+
return typed("order", "order-subject");
|
|
145
|
+
if (schema("ParcelDelivery") !== undefined)
|
|
146
|
+
return typed("shipping", "schema:ParcelDelivery");
|
|
147
|
+
if (weak && SHIPPING_SENDER.test(from))
|
|
148
|
+
return typed("shipping", "shipping-address");
|
|
149
|
+
if (weak && SHIPPING_SUBJECT.test(subject))
|
|
150
|
+
return typed("shipping", "shipping-subject");
|
|
151
|
+
if (weak && transactional && input.sector === "delivery")
|
|
152
|
+
return typed("shipping", "sector:delivery");
|
|
153
|
+
if (schema("Invoice") !== undefined)
|
|
154
|
+
return typed("bill", "schema:Invoice");
|
|
155
|
+
if (weak && BILL_SENDER.test(from))
|
|
156
|
+
return typed("bill", "bill-address");
|
|
157
|
+
if (weak && BILL_SUBJECT.test(subject))
|
|
158
|
+
return typed("bill", "bill-subject");
|
|
159
|
+
if (!person && input.sector === "social")
|
|
160
|
+
return typed("social_notification", "sector:social");
|
|
161
|
+
if (discussion)
|
|
162
|
+
return typed("discussion_list", listId ? "discussion-list" : "precedence-list");
|
|
163
|
+
// Transactional mail sometimes carries List-Unsubscribe: an automated sender with no campaign marker sends notices.
|
|
164
|
+
const automated = AUTOMATED_SENDER.test(from) && !MARKETING_SENDER.test(from);
|
|
165
|
+
if (listUnsubscribe && !oneClick && !feedbackId && !bulkPrecedence && automated)
|
|
166
|
+
return typed("account_notice", "automated-address");
|
|
167
|
+
if (mass || feedbackId) {
|
|
168
|
+
if (PROMOTION_SUBJECT.test(subject))
|
|
169
|
+
return typed("promotion", "promotion-subject");
|
|
170
|
+
if (MARKETING_SENDER.test(from) && !NEWS_SENDER.test(from))
|
|
171
|
+
return typed("promotion", "marketing-address");
|
|
172
|
+
if (listId)
|
|
173
|
+
return typed("newsletter", "list-id");
|
|
174
|
+
if (NEWS_SENDER.test(from))
|
|
175
|
+
return typed("newsletter", "newsletter-address");
|
|
176
|
+
if (NEWS_SUBJECT.test(subject))
|
|
177
|
+
return typed("newsletter", "newsletter-subject");
|
|
178
|
+
if (input.sector === "news")
|
|
179
|
+
return typed("newsletter", "sector:news");
|
|
180
|
+
if (!input.bot && !noReply)
|
|
181
|
+
return typed("newsletter", "person-sender");
|
|
182
|
+
return typed("promotion", oneClick ? "one-click-unsubscribe" : feedbackId ? "feedback-id" : "bulk-mail");
|
|
183
|
+
}
|
|
184
|
+
if (!person && (ALERT_SENDER.test(from) || ALERT_SUBJECT.test(subject)))
|
|
185
|
+
return typed("system_alert", ALERT_SENDER.test(from) ? "alert-address" : "alert-subject");
|
|
186
|
+
if (!person && autoSubmitted)
|
|
187
|
+
return typed("account_notice", "auto-submitted");
|
|
188
|
+
if (!person && noReply)
|
|
189
|
+
return typed("account_notice", "no-reply");
|
|
190
|
+
if (!person && AUTOMATED_SENDER.test(from))
|
|
191
|
+
return typed("account_notice", "automated-address");
|
|
192
|
+
if (person)
|
|
193
|
+
return typed("personal", "owner-wrote");
|
|
194
|
+
if (!input.bot && headers["null-return-path"] !== true)
|
|
195
|
+
return typed("personal", "person");
|
|
196
|
+
return typed("other", null);
|
|
197
|
+
};
|
|
198
|
+
const JSON_LD_OPEN = /<script[^>]*type\s*=\s*["']?application\/ld\+json[^>]*>/gi;
|
|
199
|
+
const ITEM_TYPE = /\bitemtype\s*=\s*["']?https?:\/\/schema\.org\/([A-Za-z]+)/gi;
|
|
200
|
+
const LD_TYPE = /"@type"\s*:\s*"(?:https?:\/\/schema\.org\/)?([A-Za-z]+)"/g;
|
|
201
|
+
/** The schema.org types an email's HTML declares, in JSON-LD or microdata, as Gmail's markup reads them. @experimental */
|
|
202
|
+
export const schemaTypesOf = (html) => {
|
|
203
|
+
if (html === null || html === "")
|
|
204
|
+
return [];
|
|
205
|
+
const found = new Set();
|
|
206
|
+
for (const open of html.matchAll(JSON_LD_OPEN)) {
|
|
207
|
+
const start = open.index + open[0].length;
|
|
208
|
+
const end = html.indexOf("</script>", start);
|
|
209
|
+
// An unclosed block ends the scan: every later opener would search to the end again.
|
|
210
|
+
if (end === -1)
|
|
211
|
+
break;
|
|
212
|
+
for (const [, type] of html.slice(start, end).matchAll(LD_TYPE))
|
|
213
|
+
found.add(type);
|
|
214
|
+
}
|
|
215
|
+
for (const [, type] of html.matchAll(ITEM_TYPE))
|
|
216
|
+
found.add(type);
|
|
217
|
+
return [...found];
|
|
218
|
+
};
|
package/dist/mail/read.js
CHANGED
|
@@ -90,6 +90,7 @@ export const hitText = (item, level, shown = (time) => time) => {
|
|
|
90
90
|
mail.to.length ? `to ${names(mail.to)}` : "",
|
|
91
91
|
mail.cc.length ? `cc ${names(mail.cc)}` : "",
|
|
92
92
|
mail.labels.join(", "),
|
|
93
|
+
[mail.mailType, mail.reach].filter(Boolean).join(", "),
|
|
93
94
|
]
|
|
94
95
|
.filter(Boolean)
|
|
95
96
|
.join(" · ")
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import type { MailType } from "./mail-types.js";
|
|
2
|
+
/** What a sorting rule names, most specific first. @experimental */
|
|
3
|
+
export declare const SORT_SCOPES: readonly ["mail", "list", "subject", "address", "domain"];
|
|
4
|
+
/** @experimental */
|
|
5
|
+
export type SortScope = (typeof SORT_SCOPES)[number];
|
|
6
|
+
/** @experimental */
|
|
7
|
+
export type SortAuthor = "owner" | "program";
|
|
8
|
+
/** One sorting rule as the matcher reads it. @experimental */
|
|
9
|
+
export interface SortRuleFacts {
|
|
10
|
+
id: number;
|
|
11
|
+
scope: SortScope;
|
|
12
|
+
value: string;
|
|
13
|
+
author: SortAuthor;
|
|
14
|
+
/** A domain rule that beats the address rules at its domain. */
|
|
15
|
+
overAddresses: boolean;
|
|
16
|
+
/** `false`: only mail dated from `createdAt` on. */
|
|
17
|
+
past: boolean;
|
|
18
|
+
createdAt: number;
|
|
19
|
+
}
|
|
20
|
+
/** What a rule is matched against for one email. @experimental */
|
|
21
|
+
export interface SortedMail {
|
|
22
|
+
id: number;
|
|
23
|
+
/** Lower case. */
|
|
24
|
+
from: string | null;
|
|
25
|
+
subject: string | null;
|
|
26
|
+
/** As `listIdOf` keeps it. */
|
|
27
|
+
list: string | null;
|
|
28
|
+
/** The mail's own date, ms. */
|
|
29
|
+
at: number | null;
|
|
30
|
+
}
|
|
31
|
+
/** A subject pattern: any case, and any number stands for any other, so "Order 4411" matches "order 9". */
|
|
32
|
+
export declare const subjectKeyOf: (text: string) => string;
|
|
33
|
+
/** Rules filed by what they name, each list in the order a match takes them. @experimental */
|
|
34
|
+
export interface SortIndex<R extends SortRuleFacts> {
|
|
35
|
+
byKey: Map<string, R[]>;
|
|
36
|
+
subjects: R[];
|
|
37
|
+
size: number;
|
|
38
|
+
}
|
|
39
|
+
/** @experimental */
|
|
40
|
+
export declare const sortIndexOf: <R extends SortRuleFacts>(rules: readonly R[]) => SortIndex<R>;
|
|
41
|
+
/**
|
|
42
|
+
* The rule that decides this email, the first scope that has one: the mail, its List-Id or a subject pattern, its
|
|
43
|
+
* address, its domain. Within a scope the owner's rule beats the program's and the newest wins. A domain rule marked
|
|
44
|
+
* `overAddresses` beats the address rules. Addresses match whole and domains on a label boundary, so `ann@` never
|
|
45
|
+
* matches `joann@` and `shop.example` never matches `myshop.example`. @experimental
|
|
46
|
+
*/
|
|
47
|
+
export declare const sortRuleFor: <R extends SortRuleFacts>(index: SortIndex<R>, mail: SortedMail) => R | undefined;
|
|
48
|
+
/** Whether a scope is more specific than another. @experimental */
|
|
49
|
+
export declare const narrower: (a: SortScope, b: SortScope) => boolean;
|
|
50
|
+
/** What a rule of this scope keeps as its value, or `undefined` when the value names nothing. @experimental */
|
|
51
|
+
export declare const sortValueOf: (scope: SortScope, value: string | number) => string | undefined;
|
|
52
|
+
/** What a rule sets on mail and on its sender. @experimental */
|
|
53
|
+
export interface SortAction {
|
|
54
|
+
mailType?: MailType;
|
|
55
|
+
sender?: "bot" | "person";
|
|
56
|
+
/** `organization:<id>`. */
|
|
57
|
+
organization?: string;
|
|
58
|
+
}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { getDomain } from "tldts";
|
|
2
|
+
import { listIdOf } from "./headers.js";
|
|
3
|
+
/** What a sorting rule names, most specific first. @experimental */
|
|
4
|
+
export const SORT_SCOPES = ["mail", "list", "subject", "address", "domain"];
|
|
5
|
+
/** A List-Id and a subject pattern are one level: neither is more specific than the other. */
|
|
6
|
+
const LEVEL = { mail: 1, list: 2, subject: 2, address: 3, domain: 4 };
|
|
7
|
+
/** A subject pattern: any case, and any number stands for any other, so "Order 4411" matches "order 9". */
|
|
8
|
+
export const subjectKeyOf = (text) => text.toLowerCase().replace(/\d+/g, "0").replace(/\s+/g, " ").trim();
|
|
9
|
+
const hostOf = (address) => address.slice(address.lastIndexOf("@") + 1);
|
|
10
|
+
/** The registrable domains a host sits under, itself first: `a.mail.shop.example` → `mail.shop.example`, `shop.example`… */
|
|
11
|
+
const suffixesOf = (host) => {
|
|
12
|
+
const labels = host.split(".");
|
|
13
|
+
return labels.slice(0, -1).map((_, at) => labels.slice(at).join("."));
|
|
14
|
+
};
|
|
15
|
+
/** The owner's rule first, then the newest. */
|
|
16
|
+
const before = (a, b) => (a.author === "owner" ? 0 : 1) - (b.author === "owner" ? 0 : 1) || b.createdAt - a.createdAt || b.id - a.id;
|
|
17
|
+
const keyOf = (scope, value) => `${scope}\u0000${value}`;
|
|
18
|
+
/** @experimental */
|
|
19
|
+
export const sortIndexOf = (rules) => {
|
|
20
|
+
const byKey = new Map();
|
|
21
|
+
const subjects = [];
|
|
22
|
+
for (const rule of rules) {
|
|
23
|
+
if (rule.scope === "subject")
|
|
24
|
+
subjects.push(rule);
|
|
25
|
+
else
|
|
26
|
+
byKey.set(keyOf(rule.scope, rule.value), [...(byKey.get(keyOf(rule.scope, rule.value)) ?? []), rule]);
|
|
27
|
+
}
|
|
28
|
+
for (const list of byKey.values())
|
|
29
|
+
list.sort(before);
|
|
30
|
+
return { byKey, subjects: subjects.sort(before), size: rules.length };
|
|
31
|
+
};
|
|
32
|
+
const applies = (rule, mail) => rule.past || (mail.at !== null && mail.at >= rule.createdAt);
|
|
33
|
+
const first = (rules, mail) => rules.find((rule) => applies(rule, mail));
|
|
34
|
+
/**
|
|
35
|
+
* The rule that decides this email, the first scope that has one: the mail, its List-Id or a subject pattern, its
|
|
36
|
+
* address, its domain. Within a scope the owner's rule beats the program's and the newest wins. A domain rule marked
|
|
37
|
+
* `overAddresses` beats the address rules. Addresses match whole and domains on a label boundary, so `ann@` never
|
|
38
|
+
* matches `joann@` and `shop.example` never matches `myshop.example`. @experimental
|
|
39
|
+
*/
|
|
40
|
+
export const sortRuleFor = (index, mail) => {
|
|
41
|
+
if (index.size === 0)
|
|
42
|
+
return undefined;
|
|
43
|
+
const at = (scope, value) => value === null ? undefined : first(index.byKey.get(keyOf(scope, value)) ?? [], mail);
|
|
44
|
+
const own = at("mail", String(mail.id));
|
|
45
|
+
if (own !== undefined)
|
|
46
|
+
return own;
|
|
47
|
+
const subject = mail.subject === null ? undefined : subjectKeyOf(mail.subject);
|
|
48
|
+
const second = [
|
|
49
|
+
at("list", mail.list),
|
|
50
|
+
subject === undefined
|
|
51
|
+
? undefined
|
|
52
|
+
: first(index.subjects.filter((rule) => subject.includes(rule.value)), mail),
|
|
53
|
+
].filter((rule) => rule !== undefined);
|
|
54
|
+
if (second.length > 0)
|
|
55
|
+
return second.sort(before)[0];
|
|
56
|
+
if (mail.from === null || !mail.from.includes("@"))
|
|
57
|
+
return undefined;
|
|
58
|
+
const domain = suffixesOf(hostOf(mail.from))
|
|
59
|
+
.map((host) => at("domain", host))
|
|
60
|
+
.find((rule) => rule !== undefined);
|
|
61
|
+
if (domain?.overAddresses)
|
|
62
|
+
return domain;
|
|
63
|
+
return at("address", mail.from) ?? domain;
|
|
64
|
+
};
|
|
65
|
+
/** Whether a scope is more specific than another. @experimental */
|
|
66
|
+
export const narrower = (a, b) => LEVEL[a] < LEVEL[b];
|
|
67
|
+
/** What a rule of this scope keeps as its value, or `undefined` when the value names nothing. @experimental */
|
|
68
|
+
export const sortValueOf = (scope, value) => {
|
|
69
|
+
const text = String(value).trim();
|
|
70
|
+
if (scope === "mail")
|
|
71
|
+
return /^[1-9]\d*$/.test(text) ? text : undefined;
|
|
72
|
+
if (scope === "list")
|
|
73
|
+
return listIdOf(text);
|
|
74
|
+
if (scope === "subject")
|
|
75
|
+
return subjectKeyOf(text) || undefined;
|
|
76
|
+
if (scope === "address")
|
|
77
|
+
return /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(text) ? text.toLowerCase() : undefined;
|
|
78
|
+
return getDomain(text.replace(/^.*@/, "").toLowerCase()) ?? undefined;
|
|
79
|
+
};
|
package/dist/oauth/index.d.ts
CHANGED
|
@@ -3,4 +3,4 @@ export { type ClientFileOptions, readClientFile } from "./client-file.js";
|
|
|
3
3
|
export { type SignInOptions, type TokenKeeper, type TokenKeeperOptions, type TokensOptions, tokenKeeper, } from "./keeper.js";
|
|
4
4
|
export { type AppSource, type ExchangeContext, googleProvider, type OAuthClient, type OAuthProvider, type RequestContext, type TokenSet, } from "./provider.js";
|
|
5
5
|
export { requestTokens, revokeToken, TOKEN_LOG_ALLOW, TOKEN_LOG_EVENT } from "./requests.js";
|
|
6
|
-
export { accountTokenCodec, type CredentialStorageOptions, credentialStorage, driveSessionCodec, type EncodeInput, googleTokenCodec, oauthAccount, type StoredTokens, standardCodec, type TokenCodec, type TokenStorage, zoomTokenCodec, } from "./storage.js";
|
|
6
|
+
export { accountTokenCodec, type CredentialStorageOptions, credentialStorage, driveSessionCodec, type EncodeInput, googleTokenCodec, type LegacyAccount, oauthAccount, type StoredTokens, standardCodec, type TokenCodec, type TokenStorage, zoomTokenCodec, } from "./storage.js";
|
package/dist/oauth/storage.d.ts
CHANGED
|
@@ -69,12 +69,20 @@ export declare const googleTokenCodec: TokenCodec;
|
|
|
69
69
|
export declare const accountTokenCodec: (providerId: string) => TokenCodec;
|
|
70
70
|
/** zm's entry as zoom-cli writes it today: `{accessToken, refreshToken, expiresAt, scopes}`, all four required. */
|
|
71
71
|
export declare const zoomTokenCodec: TokenCodec;
|
|
72
|
+
/** An older entry: an account under the same service, or one an older version kept under another service. */
|
|
73
|
+
export type LegacyAccount = string | {
|
|
74
|
+
service: string;
|
|
75
|
+
account: string;
|
|
76
|
+
};
|
|
72
77
|
export interface CredentialStorageOptions {
|
|
73
78
|
/** What the CLI passes `Credentials` today; the same options address the same entry. */
|
|
74
79
|
credentials: CredentialsOptions;
|
|
75
80
|
account: string;
|
|
76
|
-
/**
|
|
77
|
-
|
|
81
|
+
/**
|
|
82
|
+
* Older entries read when `account` is empty. A hit is copied to `account`, in the store it was read from, and left
|
|
83
|
+
* in place; `remove` removes them too. A run with moved folders only reads them.
|
|
84
|
+
*/
|
|
85
|
+
legacyAccounts?: readonly LegacyAccount[];
|
|
78
86
|
codec: TokenCodec;
|
|
79
87
|
}
|
|
80
88
|
export declare const credentialStorage: (options: CredentialStorageOptions) => TokenStorage;
|
package/dist/oauth/storage.js
CHANGED
|
@@ -217,9 +217,12 @@ export const credentialStorage = (options) => {
|
|
|
217
217
|
(options.credentials.keyring === systemKeyring &&
|
|
218
218
|
isMovedRun({ appName: options.credentials.service, env: options.credentials.env ?? process.env }));
|
|
219
219
|
const service = keyringService(options.credentials.service, options.credentials.configDir, options.credentials.isolated);
|
|
220
|
-
const
|
|
220
|
+
const legacies = (options.legacyAccounts ?? []).map((legacy) => typeof legacy === "string"
|
|
221
|
+
? { account: legacy, store: credentials }
|
|
222
|
+
: { account: legacy.account, store: new Credentials({ ...options.credentials, service: legacy.service }) });
|
|
223
|
+
const sourced = (name, store = credentials) => {
|
|
221
224
|
try {
|
|
222
|
-
return
|
|
225
|
+
return store.read(name);
|
|
223
226
|
}
|
|
224
227
|
catch (error) {
|
|
225
228
|
// cli-base's own error already says what to do, in words safe for the answer.
|
|
@@ -228,6 +231,7 @@ export const credentialStorage = (options) => {
|
|
|
228
231
|
throw keyringFailure(error);
|
|
229
232
|
}
|
|
230
233
|
};
|
|
234
|
+
const raw = (name) => sourced(name)?.secret;
|
|
231
235
|
// A sign-in on a machine with no keyring writes to the file, so an old entry it cannot read is no old entry. With
|
|
232
236
|
// `storage: "keyring"` there is no file to fall back on: the save would fail too, after the browser.
|
|
233
237
|
const fallsBack = options.credentials.storage !== "keyring";
|
|
@@ -253,14 +257,22 @@ export const credentialStorage = (options) => {
|
|
|
253
257
|
const own = raw(account);
|
|
254
258
|
if (own !== undefined)
|
|
255
259
|
return own;
|
|
256
|
-
for (const legacy of
|
|
257
|
-
const found =
|
|
260
|
+
for (const legacy of legacies) {
|
|
261
|
+
const found = sourced(legacy.account, legacy.store);
|
|
258
262
|
if (found === undefined)
|
|
259
263
|
continue;
|
|
260
|
-
codec.decode(found);
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
+
codec.decode(found.secret);
|
|
265
|
+
// A sign-in the owner kept in the file must not move to the keyring by being copied.
|
|
266
|
+
if (!moved && found.source === "file")
|
|
267
|
+
try {
|
|
268
|
+
new Credentials({ ...options.credentials, storage: "file" }).write(account, found.secret);
|
|
269
|
+
}
|
|
270
|
+
catch (error) {
|
|
271
|
+
throw keyringFailure(error, found.secret);
|
|
272
|
+
}
|
|
273
|
+
else if (!moved)
|
|
274
|
+
save(found.secret);
|
|
275
|
+
return found.secret;
|
|
264
276
|
}
|
|
265
277
|
return undefined;
|
|
266
278
|
};
|
|
@@ -278,7 +290,9 @@ export const credentialStorage = (options) => {
|
|
|
278
290
|
write: (input, writeOptions) => save(codec.encode({ ...input, previous: replaced(account), ...(writeOptions?.signIn ? { signIn: true } : {}) }), writeOptions),
|
|
279
291
|
remove: () => {
|
|
280
292
|
try {
|
|
281
|
-
|
|
293
|
+
// The next read would copy an older entry back and sign the profile in again.
|
|
294
|
+
const older = moved ? [] : legacies.flatMap((legacy) => legacy.store.remove(legacy.account));
|
|
295
|
+
return [...new Set([...credentials.remove(account), ...older])];
|
|
282
296
|
}
|
|
283
297
|
catch (error) {
|
|
284
298
|
throw keyringFailure(error);
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { queryAstSchema, validateQuery, walkQuery, } from "@wirecat/cli-base/query";
|
|
2
2
|
import * as v from "valibot";
|
|
3
3
|
import { tagOf } from "../../domain/tags.js";
|
|
4
|
+
import { MAIL_TYPES } from "../../mail/mail-types.js";
|
|
5
|
+
import { REACHES } from "../../store/sqlite/sender-signals.js";
|
|
4
6
|
import { MOST_WORDS_APART, QUERY_LIMITS, SEARCH_QUERY, searchError } from "./types.js";
|
|
5
7
|
export const FIELD_VERSION = 2;
|
|
6
8
|
const UNITS = {
|
|
@@ -149,6 +151,28 @@ export const QUERY_FIELDS = [
|
|
|
149
151
|
support: "A1",
|
|
150
152
|
values: ["unread", "read", "starred"],
|
|
151
153
|
},
|
|
154
|
+
{
|
|
155
|
+
name: "type",
|
|
156
|
+
example: "type:order OR type:bill",
|
|
157
|
+
index: "emails.mail_type (emails_by_mail_type)",
|
|
158
|
+
aliases: [],
|
|
159
|
+
type: "enum",
|
|
160
|
+
operators: terms,
|
|
161
|
+
normalization: "lowercase; what one email is, apart from its sender; mail not typed yet is typed before the search; mail only",
|
|
162
|
+
support: "A1",
|
|
163
|
+
values: MAIL_TYPES,
|
|
164
|
+
},
|
|
165
|
+
{
|
|
166
|
+
name: "reach",
|
|
167
|
+
example: "reach:direct",
|
|
168
|
+
index: "emails.reach",
|
|
169
|
+
aliases: [],
|
|
170
|
+
type: "enum",
|
|
171
|
+
operators: terms,
|
|
172
|
+
normalization: "lowercase; how one email reached the owner; mail only",
|
|
173
|
+
support: "A1",
|
|
174
|
+
values: REACHES,
|
|
175
|
+
},
|
|
152
176
|
{
|
|
153
177
|
name: "chat",
|
|
154
178
|
example: "chat:*fixture*",
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { type InstalledPack, type PackManifest } from "../domain/domain-lists.js";
|
|
2
|
+
import { type Fetch } from "../speech/install.js";
|
|
3
|
+
export interface DomainListsUpdateOptions {
|
|
4
|
+
env: NodeJS.ProcessEnv;
|
|
5
|
+
/** Leave out `non-commercial` sources, and remove those already here. */
|
|
6
|
+
commercialOnly?: boolean;
|
|
7
|
+
fetch?: Fetch;
|
|
8
|
+
manifestUrl?: string;
|
|
9
|
+
progress?: (line: string) => void;
|
|
10
|
+
bytes?: (done: number, total: number) => void;
|
|
11
|
+
}
|
|
12
|
+
export interface DomainListsUpdate {
|
|
13
|
+
pack: InstalledPack;
|
|
14
|
+
updated: boolean;
|
|
15
|
+
previous: string | null;
|
|
16
|
+
}
|
|
17
|
+
/** The hosts a download may reach, each once: `hostFetch` refuses a list that names one twice. */
|
|
18
|
+
export declare const packHosts: (urls: readonly string[]) => string[];
|
|
19
|
+
/** The manifest as a release serves it, refused whole when a source would write outside the pack or skip its check. */
|
|
20
|
+
export declare const parseManifest: (value: unknown) => PackManifest;
|
|
21
|
+
/**
|
|
22
|
+
* Brings the pack to the newest release: every file checked against the manifest's sha256 as it arrives, then the
|
|
23
|
+
* whole folder swapped at once, so a failed download leaves the pack as it was. Nothing is downloaded when the pack
|
|
24
|
+
* here is already that version with the same sources.
|
|
25
|
+
*/
|
|
26
|
+
export declare const updateDomainLists: ({ env, commercialOnly, fetch: given, manifestUrl, progress, bytes, }: DomainListsUpdateOptions) => Promise<DomainListsUpdate>;
|