@pithy-sh/support 0.3.3 → 0.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ai/classify.d.ts.map +1 -1
- package/dist/ai/classify.js +3 -3
- package/dist/http/handlers.d.ts.map +1 -1
- package/dist/http/handlers.js +2 -3
- package/dist/http/routes.d.ts +4 -1
- package/dist/http/routes.d.ts.map +1 -1
- package/dist/http/routes.js +60 -12
- package/dist/inbound/handler.d.ts.map +1 -1
- package/dist/inbound/handler.js +0 -1
- package/dist/inbound/ingest.d.ts +0 -2
- package/dist/inbound/ingest.d.ts.map +1 -1
- package/dist/inbound/ingest.js +0 -14
- package/dist/provision/provisionSupport.d.ts +25 -4
- package/dist/provision/provisionSupport.d.ts.map +1 -1
- package/dist/provision/provisionSupport.js +18 -3
- package/dist/reply/send.d.ts +0 -2
- package/dist/reply/send.d.ts.map +1 -1
- package/dist/reply/send.js +2 -15
- package/dist/store/search.d.ts +16 -9
- package/dist/store/search.d.ts.map +1 -1
- package/dist/store/search.js +16 -9
- package/dist/store/searchIndex.d.ts +131 -5
- package/dist/store/searchIndex.d.ts.map +1 -1
- package/dist/store/searchIndex.js +151 -6
- package/dist/store/threads.d.ts.map +1 -1
- package/dist/store/threads.js +3 -2
- package/dist/submission/submit.d.ts +0 -2
- package/dist/submission/submit.d.ts.map +1 -1
- package/dist/submission/submit.js +0 -14
- package/dist/version.generated.d.ts +1 -1
- package/dist/version.generated.js +1 -1
- package/package.json +10 -10
- package/src/ai/classify.ts +7 -3
- package/src/http/handlers.ts +2 -3
- package/src/http/routes.ts +96 -19
- package/src/inbound/handler.ts +0 -1
- package/src/inbound/ingest.ts +0 -14
- package/src/provision/provisionSupport.ts +33 -7
- package/src/reply/send.ts +2 -13
- package/src/store/search.ts +16 -9
- package/src/store/searchIndex.ts +176 -5
- package/src/store/threads.ts +2 -1
- package/src/submission/submit.ts +0 -11
- package/src/version.generated.ts +1 -1
package/src/store/threads.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
// SPDX-FileCopyrightText: 2026 Pithy
|
|
2
2
|
// SPDX-License-Identifier: MIT
|
|
3
3
|
|
|
4
|
+
import { pithyCommandOf } from "@pithy-sh/core/src/cli/command";
|
|
4
5
|
import type { Logger } from "@pithy-sh/core/src/logger/logger";
|
|
5
6
|
import { type SqlBool, sql } from "kysely";
|
|
6
7
|
import { SupportAttachment } from "../data/attachment";
|
|
@@ -138,7 +139,7 @@ export async function listThreads(
|
|
|
138
139
|
// surfaces instead of silently degrading forever.
|
|
139
140
|
if (options.fts && isMissingSearchTable(error)) {
|
|
140
141
|
options.log?.warn("support FTS index is configured but absent — falling back to a LIKE scan", {
|
|
141
|
-
action:
|
|
142
|
+
action: `Run \`${pithyCommandOf("support provision", {}, { runtime: true })}\` to create and backfill it, or set \`search.fts: false\`.`,
|
|
142
143
|
});
|
|
143
144
|
return runListThreads(db, query, { ...options, fts: false });
|
|
144
145
|
}
|
package/src/submission/submit.ts
CHANGED
|
@@ -21,7 +21,6 @@ import {
|
|
|
21
21
|
import { SupportThread, UNCLASSIFIED } from "../data/thread";
|
|
22
22
|
import { SupportInvalidCategoryError, SupportNotFoundError, SupportRejectedError } from "../error/errors";
|
|
23
23
|
import { safeFilename } from "../mime/parse";
|
|
24
|
-
import { indexMessage } from "../store/search";
|
|
25
24
|
import { checkAccountRate, checkAttachment } from "./guard";
|
|
26
25
|
|
|
27
26
|
/**
|
|
@@ -110,8 +109,6 @@ export interface SubmitDeps {
|
|
|
110
109
|
categories: SupportCategories;
|
|
111
110
|
/** The R2 bucket attachments are written to. Absent means none are stored. */
|
|
112
111
|
bucket?: R2Bucket;
|
|
113
|
-
/** Whether the FTS5 index is composed. */
|
|
114
|
-
fts: boolean;
|
|
115
112
|
/**
|
|
116
113
|
* The submitter's account, by id. Returns null when `@pithy-sh/auth` is absent or the row is gone —
|
|
117
114
|
* both of which contradict the session that got here, so the caller treats it as a fault rather than
|
|
@@ -508,14 +505,6 @@ export async function submitFeedback(deps: SubmitDeps, input: SubmitInput): Prom
|
|
|
508
505
|
throw error;
|
|
509
506
|
}
|
|
510
507
|
|
|
511
|
-
if (deps.fts) {
|
|
512
|
-
try {
|
|
513
|
-
await indexMessage(deps.db, { threadId, messageId, subject: input.subject, body: input.body });
|
|
514
|
-
} catch (error) {
|
|
515
|
-
deps.log.warn("support submission not indexed", { messageId, error });
|
|
516
|
-
}
|
|
517
|
-
}
|
|
518
|
-
|
|
519
508
|
// Best-effort, like the mail path: a bucket that is briefly unavailable costs the attachments, never
|
|
520
509
|
// the report. The bytes were already checked, so nothing unbounded reaches R2 on this line.
|
|
521
510
|
let attachments = 0;
|
package/src/version.generated.ts
CHANGED