@wirecat/cli-core 0.425.0 → 0.427.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 +45 -0
- package/dist/cli/commands-command.js +1 -1
- package/dist/cli/effects.d.ts +4 -0
- package/dist/cli/effects.js +5 -1
- package/dist/cli/guide.d.ts +1 -1
- package/dist/cli/guide.js +33 -5
- package/dist/cli/help/command-help.js +12 -7
- package/dist/cli/help/first-screen.js +2 -2
- package/dist/cli/index.d.ts +3 -2
- package/dist/cli/index.js +3 -2
- package/dist/cli/meeting-preparation-command.js +2 -2
- package/dist/cli/meeting-series-inventory-command.js +2 -2
- package/dist/cli/messenger/models-command.js +3 -2
- package/dist/cli/messenger/store-maintenance-command.d.ts +1 -1
- package/dist/cli/messenger/store-maintenance-command.js +9 -47
- package/dist/cli/messenger/store-tables-command.d.ts +5 -0
- package/dist/cli/messenger/store-tables-command.js +59 -0
- package/dist/cli/profile.d.ts +7 -0
- package/dist/cli/profile.js +19 -0
- package/dist/cli/program.js +12 -11
- package/dist/cli/store-info.d.ts +12 -0
- package/dist/cli/store-info.js +72 -0
- package/dist/entities/index.d.ts +54 -5
- package/dist/entities/index.js +3 -1
- package/dist/entities/store-maintenance.d.ts +48 -4
- package/dist/entities/store-maintenance.js +16 -3
- package/dist/entities/store-table.d.ts +8 -0
- package/dist/entities/store-table.js +9 -0
- package/dist/meetings/mcp/index.d.ts +15 -15
- package/dist/store/compatibility.d.ts +28 -0
- package/dist/store/compatibility.js +41 -0
- package/dist/store/exports.d.ts +1 -0
- package/dist/store/exports.js +1 -0
- package/dist/store/sqlite/store-tables.d.ts +43 -0
- package/dist/store/sqlite/store-tables.js +111 -0
- package/dist/store/store.d.ts +1 -0
- package/dist/store/store.js +1 -0
- package/package.json +3 -3
- package/parity.json +12 -0
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Command } from "commander";
|
|
2
|
+
import type * as v from "valibot";
|
|
3
|
+
import type { storeInfo as storeInfoEntity } from "../entities/store-maintenance.js";
|
|
4
|
+
export type StoreInfo = v.InferOutput<typeof storeInfoEntity>;
|
|
5
|
+
/**
|
|
6
|
+
* The shared store as this build sees it, for any WireCat tool. Opened read-only: it never migrates, never sets a
|
|
7
|
+
* journal mode, and answers for a file newer than this build instead of refusing it.
|
|
8
|
+
*/
|
|
9
|
+
export declare const storeInfo: (env: NodeJS.ProcessEnv) => Promise<StoreInfo>;
|
|
10
|
+
export declare const storeInfoCommand: () => Command;
|
|
11
|
+
/** `store info` for a tool with no `store` command of its own. */
|
|
12
|
+
export declare const sharedStoreCommand: () => Command;
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { existsSync, statSync } from "node:fs";
|
|
2
|
+
import { annotate } from "@wirecat/cli-base/commands";
|
|
3
|
+
import { Command } from "commander";
|
|
4
|
+
import { compatibilityOf, fileSchemaOf } from "../store/compatibility.js";
|
|
5
|
+
import { storePath } from "../store/path.js";
|
|
6
|
+
import { fileFacts, openSqlite, pendingNormalization, rowCounts, searchIndexState, stemsState, storeClients, storeContents, } from "../store/store.js";
|
|
7
|
+
import { environmentOf, outputFor } from "./context.js";
|
|
8
|
+
import { LOCAL_READ } from "./effects.js";
|
|
9
|
+
import { itemOf, renderAnswer, snakeKeys } from "./envelope.js";
|
|
10
|
+
/** Before version 6 the column does not exist, and a file behind this build is not migrated here. */
|
|
11
|
+
const pendingIfKnown = (database) => database.prepare("SELECT 1 FROM pragma_table_info('messages') WHERE name = 'normalized_text'").get()
|
|
12
|
+
? pendingNormalization(database)
|
|
13
|
+
: null;
|
|
14
|
+
const bytesOf = (path) => (existsSync(path) ? statSync(path).size : 0);
|
|
15
|
+
const messageOf = (error) => (error instanceof Error ? error.message : String(error));
|
|
16
|
+
/** A file this build may not open may have renamed what the counts read, so only its schema is reported. */
|
|
17
|
+
const contentsOf = (database, version, writable) => version > 0 && writable
|
|
18
|
+
? {
|
|
19
|
+
rows: rowCounts(database),
|
|
20
|
+
pendingNormalization: pendingIfKnown(database),
|
|
21
|
+
wordIndex: searchIndexState(database) ?? null,
|
|
22
|
+
stemIndex: stemsState(database) ?? null,
|
|
23
|
+
...storeContents(database),
|
|
24
|
+
}
|
|
25
|
+
: { rows: {}, pendingNormalization: null, wordIndex: null, stemIndex: null };
|
|
26
|
+
/**
|
|
27
|
+
* The shared store as this build sees it, for any WireCat tool. Opened read-only: it never migrates, never sets a
|
|
28
|
+
* journal mode, and answers for a file newer than this build instead of refusing it.
|
|
29
|
+
*/
|
|
30
|
+
export const storeInfo = async (env) => {
|
|
31
|
+
const path = storePath(env);
|
|
32
|
+
if (!existsSync(path))
|
|
33
|
+
return snakeKeys({ path, exists: false, schema: compatibilityOf(undefined) });
|
|
34
|
+
let schema = compatibilityOf(undefined);
|
|
35
|
+
try {
|
|
36
|
+
const { database } = await openSqlite(path, { readOnly: true });
|
|
37
|
+
try {
|
|
38
|
+
schema = compatibilityOf(fileSchemaOf(database));
|
|
39
|
+
const answer = {
|
|
40
|
+
path,
|
|
41
|
+
exists: true,
|
|
42
|
+
...fileFacts(database, path),
|
|
43
|
+
bytes: { file: bytesOf(path), wal: bytesOf(`${path}-wal`) },
|
|
44
|
+
schema,
|
|
45
|
+
clients: storeClients(database).map(({ seenAt, ...client }) => ({
|
|
46
|
+
...client,
|
|
47
|
+
seenAt: new Date(seenAt).toISOString(),
|
|
48
|
+
})),
|
|
49
|
+
...contentsOf(database, schema.version, schema.writable),
|
|
50
|
+
};
|
|
51
|
+
return snakeKeys(answer);
|
|
52
|
+
}
|
|
53
|
+
finally {
|
|
54
|
+
database.close();
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
catch (error) {
|
|
58
|
+
const { speaks } = schema;
|
|
59
|
+
return snakeKeys({ path, exists: true, opens: false, error: messageOf(error), schema: { speaks } });
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
export const storeInfoCommand = () => annotate(new Command("info"), { output: { entity: "store_info" }, effects: LOCAL_READ })
|
|
63
|
+
.summary("the shared store's format, size and contents, and whether this tool can read it")
|
|
64
|
+
.description("the store file: where it is, its size, its schema against the one this tool speaks, which tools used it and how many rows it holds, by provider, chat kind, account, year (UTC) and attachment kind, over every account; changes nothing")
|
|
65
|
+
.action(async function () {
|
|
66
|
+
const answer = await storeInfo(environmentOf(this).env ?? process.env);
|
|
67
|
+
renderAnswer(this, outputFor(this), itemOf(answer));
|
|
68
|
+
});
|
|
69
|
+
/** `store info` for a tool with no `store` command of its own. */
|
|
70
|
+
export const sharedStoreCommand = () => annotate(new Command("store"), { effects: LOCAL_READ })
|
|
71
|
+
.description("the shared local store every WireCat tool reads")
|
|
72
|
+
.addCommand(storeInfoCommand());
|
package/dist/entities/index.d.ts
CHANGED
|
@@ -75,6 +75,7 @@ import { savedSearch, searchHistoryClear } from "./saved-search.js";
|
|
|
75
75
|
import { sendAttempt } from "./send-attempt.js";
|
|
76
76
|
import { storeBackup, storeCheck, storeCopyRemoval, storeDecrypt, storeInfo, storeMigration, storeReindex, storeRepair, storeReset, storeRestore } from "./store-maintenance.js";
|
|
77
77
|
import { storeChatStatus, storeClear, storeExport, storeGapPlan, storeGapRepair, storeJobCancel, storeJobClear, storeJobDetails, storeJobRetry } from "./store-records.js";
|
|
78
|
+
import { storeTable } from "./store-table.js";
|
|
78
79
|
import { automaticTags, tagChange } from "./tag-change.js";
|
|
79
80
|
import { tagging } from "./tagging.js";
|
|
80
81
|
import { task } from "./task.js";
|
|
@@ -86,7 +87,7 @@ import { topic } from "./topic.js";
|
|
|
86
87
|
* subset of its fields, never a renamed one. Commands move onto these one by one; until then, a schema
|
|
87
88
|
* is the target, not a description of today's output.
|
|
88
89
|
*/
|
|
89
|
-
export { account, accountChange, accountPrivacy, accountPrivacyChange, accountProfile, accountSession, adminReport, agenda, analysisConsent, analysisConsentRevocation, attachment, attachmentBytes, attachmentExtraction, attachmentTextChange, automaticTags, botAdmin, botMenuEntry, botProfile, botSeenChat, botTemplate, botWebhook, cachedChatMetadata, callRecord, chart, chat, chatAdminChange, chatArchive, chatEvent, chatFolderChange, chatFolderOrder, chatFolderRemoval, chatGroupChange, chatInspection, chatInvite, chatInviteChange, chatMembersChange, chatMembersFetch, chatMetadata, chatMetadataRefresh, chatModeration, chatMuting, chatPin, chatRead, chatRemoval, chatRequestChange, chatRules, chatSender, chatStats, chatTracking, chatUnread, contact, contactActivity, contactAlias, contactCheck, contactContext, contactImport, contactLookup, contactNote, contactNoteRemoval, contactPreparation, contactProfile, contactStateChange, contactSync, contactUpdate, conversation, conversationBatch, conversationBatchStatus, conversationBuildResult, conversationChange, conversationDetails, conversationEmbedding, conversationEmbeddingStatus, conversationHit, conversationPreparation, conversationReadiness, counterRefresh, counters, document, documentLink, endedAccountSessions, evidence, evidencePacket, fact, folder, hit, identity, imageEmbedding, inviteLink, job, joinRequest, linkedPerson, mediaArchive, mediaArchiveCheck, mediaArchiveMove, mediaArchiveTimer, meeting, meetingProjectCandidates, meetingSeriesInventory, member, memory, mention, mentionDecision, mentionDetails, mentionDomain, mentionRebuild, message, messageContext, messageCounts, messageDeletion, messageDownload, messageEvent, messageLink, messageLinks, messagePin, messageStar, messageSync, messageTranscript, messageWrite, model, modelKey, note, officialStats, organization, person, place, poll, pollChange, pollVote, project, ranking, reactionChange, recipient, recipientAdded, recipientChange, recipientOff, recipientRemoved, recordedRun, reference, relationship, reminder, removedModelKey, retention, runDetails, runHit, runLocation, savedSearch, scheduledJob, searchHistoryClear, sendAttempt, serveSummary, stickerInventory, storeBackup, storeChatStatus, storeCheck, storeClear, storeCopyRemoval, storeDecrypt, storedModelKey, storeExport, storeGapPlan, storeGapRepair, storeInfo, storeJobCancel, storeJobClear, storeJobDetails, storeJobRetry, storeMigration, storeReindex, storeRepair, storeReset, storeRestore, tagChange, tagging, task, taskCard, taskCategories, taskClosed, taskCreated, taskLinks, taskMerge, taskPair, taskScan, taskSimilar, taskStats, taskUnmerge, topic, trackedChat, trackedChatHistory, watchedMessage, watchItem, };
|
|
90
|
+
export { account, accountChange, accountPrivacy, accountPrivacyChange, accountProfile, accountSession, adminReport, agenda, analysisConsent, analysisConsentRevocation, attachment, attachmentBytes, attachmentExtraction, attachmentTextChange, automaticTags, botAdmin, botMenuEntry, botProfile, botSeenChat, botTemplate, botWebhook, cachedChatMetadata, callRecord, chart, chat, chatAdminChange, chatArchive, chatEvent, chatFolderChange, chatFolderOrder, chatFolderRemoval, chatGroupChange, chatInspection, chatInvite, chatInviteChange, chatMembersChange, chatMembersFetch, chatMetadata, chatMetadataRefresh, chatModeration, chatMuting, chatPin, chatRead, chatRemoval, chatRequestChange, chatRules, chatSender, chatStats, chatTracking, chatUnread, contact, contactActivity, contactAlias, contactCheck, contactContext, contactImport, contactLookup, contactNote, contactNoteRemoval, contactPreparation, contactProfile, contactStateChange, contactSync, contactUpdate, conversation, conversationBatch, conversationBatchStatus, conversationBuildResult, conversationChange, conversationDetails, conversationEmbedding, conversationEmbeddingStatus, conversationHit, conversationPreparation, conversationReadiness, counterRefresh, counters, document, documentLink, endedAccountSessions, evidence, evidencePacket, fact, folder, hit, identity, imageEmbedding, inviteLink, job, joinRequest, linkedPerson, mediaArchive, mediaArchiveCheck, mediaArchiveMove, mediaArchiveTimer, meeting, meetingProjectCandidates, meetingSeriesInventory, member, memory, mention, mentionDecision, mentionDetails, mentionDomain, mentionRebuild, message, messageContext, messageCounts, messageDeletion, messageDownload, messageEvent, messageLink, messageLinks, messagePin, messageStar, messageSync, messageTranscript, messageWrite, model, modelKey, note, officialStats, organization, person, place, poll, pollChange, pollVote, project, ranking, reactionChange, recipient, recipientAdded, recipientChange, recipientOff, recipientRemoved, recordedRun, reference, relationship, reminder, removedModelKey, retention, runDetails, runHit, runLocation, savedSearch, scheduledJob, searchHistoryClear, sendAttempt, serveSummary, stickerInventory, storeBackup, storeChatStatus, storeCheck, storeClear, storeCopyRemoval, storeDecrypt, storedModelKey, storeExport, storeGapPlan, storeGapRepair, storeInfo, storeJobCancel, storeJobClear, storeJobDetails, storeJobRetry, storeMigration, storeReindex, storeRepair, storeReset, storeRestore, storeTable, tagChange, tagging, task, taskCard, taskCategories, taskClosed, taskCreated, taskLinks, taskMerge, taskPair, taskScan, taskSimilar, taskStats, taskUnmerge, topic, trackedChat, trackedChatHistory, watchedMessage, watchItem, };
|
|
90
91
|
export declare const ENTITIES: {
|
|
91
92
|
readonly meeting_ingestion: v.StrictObjectSchema<{
|
|
92
93
|
readonly meetings: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
|
|
@@ -9430,11 +9431,25 @@ export declare const ENTITIES: {
|
|
|
9430
9431
|
readonly store_info: v.UnionSchema<[v.StrictObjectSchema<{
|
|
9431
9432
|
readonly path: v.StringSchema<undefined>;
|
|
9432
9433
|
readonly exists: v.LiteralSchema<false, undefined>;
|
|
9434
|
+
readonly schema: v.StrictObjectSchema<{
|
|
9435
|
+
readonly version: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
|
|
9436
|
+
readonly min_compatible: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
|
|
9437
|
+
readonly writable: v.BooleanSchema<undefined>;
|
|
9438
|
+
readonly speaks: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
|
|
9439
|
+
readonly reason: v.PicklistSchema<["missing", "older", "current", "newer", "too_new"], undefined>;
|
|
9440
|
+
readonly upgrade: v.NullableSchema<v.StrictObjectSchema<{
|
|
9441
|
+
readonly version: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
|
|
9442
|
+
readonly min_compatible: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
|
|
9443
|
+
}, undefined>, undefined>;
|
|
9444
|
+
}, undefined>;
|
|
9433
9445
|
}, undefined>, v.StrictObjectSchema<{
|
|
9434
|
-
path: v.StringSchema<undefined>;
|
|
9435
|
-
exists: v.LiteralSchema<true, undefined>;
|
|
9436
|
-
opens: v.LiteralSchema<false, undefined>;
|
|
9437
|
-
error: v.StringSchema<undefined>;
|
|
9446
|
+
readonly path: v.StringSchema<undefined>;
|
|
9447
|
+
readonly exists: v.LiteralSchema<true, undefined>;
|
|
9448
|
+
readonly opens: v.LiteralSchema<false, undefined>;
|
|
9449
|
+
readonly error: v.StringSchema<undefined>;
|
|
9450
|
+
readonly schema: v.StrictObjectSchema<{
|
|
9451
|
+
readonly speaks: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
|
|
9452
|
+
}, undefined>;
|
|
9438
9453
|
}, undefined>, v.StrictObjectSchema<{
|
|
9439
9454
|
readonly by_provider: v.OptionalSchema<v.ArraySchema<v.StrictObjectSchema<{
|
|
9440
9455
|
readonly chats: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
|
|
@@ -9478,12 +9493,40 @@ export declare const ENTITIES: {
|
|
|
9478
9493
|
readonly file: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
|
|
9479
9494
|
readonly wal: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
|
|
9480
9495
|
}, undefined>;
|
|
9496
|
+
readonly journal_mode: v.StringSchema<undefined>;
|
|
9497
|
+
readonly pages: v.StrictObjectSchema<{
|
|
9498
|
+
readonly size: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
|
|
9499
|
+
readonly count: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
|
|
9500
|
+
readonly free: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
|
|
9501
|
+
}, undefined>;
|
|
9502
|
+
readonly migrations: v.ArraySchema<v.StrictObjectSchema<{
|
|
9503
|
+
readonly version: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
|
|
9504
|
+
readonly min_compatible: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
|
|
9505
|
+
readonly applied_at: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IsoTimestampAction<string, "an ISO 8601 time in UTC">, v.EndsWithAction<string, "Z", "an ISO 8601 time in UTC, ending in `Z`">]>;
|
|
9506
|
+
}, undefined>, undefined>;
|
|
9507
|
+
readonly backup: v.NullableSchema<v.StrictObjectSchema<{
|
|
9508
|
+
readonly at: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IsoTimestampAction<string, "an ISO 8601 time in UTC">, v.EndsWithAction<string, "Z", "an ISO 8601 time in UTC, ending in `Z`">]>;
|
|
9509
|
+
readonly file: v.NullableSchema<v.StringSchema<undefined>, undefined>;
|
|
9510
|
+
readonly checked: v.NullableSchema<v.StringSchema<undefined>, undefined>;
|
|
9511
|
+
}, undefined>, undefined>;
|
|
9481
9512
|
readonly schema: v.StrictObjectSchema<{
|
|
9482
9513
|
readonly version: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
|
|
9483
9514
|
readonly min_compatible: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
|
|
9484
9515
|
readonly writable: v.BooleanSchema<undefined>;
|
|
9485
9516
|
readonly speaks: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
|
|
9517
|
+
readonly reason: v.PicklistSchema<["missing", "older", "current", "newer", "too_new"], undefined>;
|
|
9518
|
+
readonly upgrade: v.NullableSchema<v.StrictObjectSchema<{
|
|
9519
|
+
readonly version: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
|
|
9520
|
+
readonly min_compatible: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
|
|
9521
|
+
}, undefined>, undefined>;
|
|
9486
9522
|
}, undefined>;
|
|
9523
|
+
readonly clients: v.ArraySchema<v.StrictObjectSchema<{
|
|
9524
|
+
readonly command: v.StringSchema<undefined>;
|
|
9525
|
+
readonly version: v.StringSchema<undefined>;
|
|
9526
|
+
readonly core: v.StringSchema<undefined>;
|
|
9527
|
+
readonly speaks: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
|
|
9528
|
+
readonly seen_at: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IsoTimestampAction<string, "an ISO 8601 time in UTC">, v.EndsWithAction<string, "Z", "an ISO 8601 time in UTC, ending in `Z`">]>;
|
|
9529
|
+
}, undefined>, undefined>;
|
|
9487
9530
|
readonly rows: Omit<v.StrictObjectSchema<{
|
|
9488
9531
|
readonly accounts: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
|
|
9489
9532
|
readonly chats: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
|
|
@@ -9809,6 +9852,12 @@ export declare const ENTITIES: {
|
|
|
9809
9852
|
readonly rows: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
|
|
9810
9853
|
}, undefined>;
|
|
9811
9854
|
}, undefined>;
|
|
9855
|
+
readonly store_table: v.StrictObjectSchema<{
|
|
9856
|
+
readonly name: v.StringSchema<undefined>;
|
|
9857
|
+
readonly kind: v.PicklistSchema<readonly ["data", "search_index", "search_index_part", "internal"], undefined>;
|
|
9858
|
+
readonly rows: v.NullableSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>, undefined>;
|
|
9859
|
+
readonly bytes: v.OptionalSchema<v.NullableSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>, undefined>, undefined>;
|
|
9860
|
+
}, undefined>;
|
|
9812
9861
|
readonly agenda: v.StrictObjectSchema<{
|
|
9813
9862
|
readonly at: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IsoTimestampAction<string, "an ISO 8601 time in UTC">, v.EndsWithAction<string, "Z", "an ISO 8601 time in UTC, ending in `Z`">]>;
|
|
9814
9863
|
readonly account: v.StringSchema<undefined>;
|
package/dist/entities/index.js
CHANGED
|
@@ -81,6 +81,7 @@ import { savedSearch, searchHistoryClear } from "./saved-search.js";
|
|
|
81
81
|
import { sendAttempt } from "./send-attempt.js";
|
|
82
82
|
import { storeBackup, storeCheck, storeCopyRemoval, storeDecrypt, storeInfo, storeMigration, storeReindex, storeRepair, storeReset, storeRestore, } from "./store-maintenance.js";
|
|
83
83
|
import { storeChatStatus, storeClear, storeExport, storeGapPlan, storeGapRepair, storeJobCancel, storeJobClear, storeJobDetails, storeJobRetry, syncProgress, } from "./store-records.js";
|
|
84
|
+
import { storeTable } from "./store-table.js";
|
|
84
85
|
import { automaticTags, tagChange } from "./tag-change.js";
|
|
85
86
|
import { tagging } from "./tagging.js";
|
|
86
87
|
import { task } from "./task.js";
|
|
@@ -92,7 +93,7 @@ import { topic } from "./topic.js";
|
|
|
92
93
|
* subset of its fields, never a renamed one. Commands move onto these one by one; until then, a schema
|
|
93
94
|
* is the target, not a description of today's output.
|
|
94
95
|
*/
|
|
95
|
-
export { account, accountChange, accountPrivacy, accountPrivacyChange, accountProfile, accountSession, adminReport, agenda, analysisConsent, analysisConsentRevocation, attachment, attachmentBytes, attachmentExtraction, attachmentTextChange, automaticTags, botAdmin, botMenuEntry, botProfile, botSeenChat, botTemplate, botWebhook, cachedChatMetadata, callRecord, chart, chat, chatAdminChange, chatArchive, chatEvent, chatFolderChange, chatFolderOrder, chatFolderRemoval, chatGroupChange, chatInspection, chatInvite, chatInviteChange, chatMembersChange, chatMembersFetch, chatMetadata, chatMetadataRefresh, chatModeration, chatMuting, chatPin, chatRead, chatRemoval, chatRequestChange, chatRules, chatSender, chatStats, chatTracking, chatUnread, contact, contactActivity, contactAlias, contactCheck, contactContext, contactImport, contactLookup, contactNote, contactNoteRemoval, contactPreparation, contactProfile, contactStateChange, contactSync, contactUpdate, conversation, conversationBatch, conversationBatchStatus, conversationBuildResult, conversationChange, conversationDetails, conversationEmbedding, conversationEmbeddingStatus, conversationHit, conversationPreparation, conversationReadiness, counterRefresh, counters, document, documentLink, endedAccountSessions, evidence, evidencePacket, fact, folder, hit, identity, imageEmbedding, inviteLink, job, joinRequest, linkedPerson, mediaArchive, mediaArchiveCheck, mediaArchiveMove, mediaArchiveTimer, meeting, meetingProjectCandidates, meetingSeriesInventory, member, memory, mention, mentionDecision, mentionDetails, mentionDomain, mentionRebuild, message, messageContext, messageCounts, messageDeletion, messageDownload, messageEvent, messageLink, messageLinks, messagePin, messageStar, messageSync, messageTranscript, messageWrite, model, modelKey, note, officialStats, organization, person, place, poll, pollChange, pollVote, project, ranking, reactionChange, recipient, recipientAdded, recipientChange, recipientOff, recipientRemoved, recordedRun, reference, relationship, reminder, removedModelKey, retention, runDetails, runHit, runLocation, savedSearch, scheduledJob, searchHistoryClear, sendAttempt, serveSummary, stickerInventory, storeBackup, storeChatStatus, storeCheck, storeClear, storeCopyRemoval, storeDecrypt, storedModelKey, storeExport, storeGapPlan, storeGapRepair, storeInfo, storeJobCancel, storeJobClear, storeJobDetails, storeJobRetry, storeMigration, storeReindex, storeRepair, storeReset, storeRestore, tagChange, tagging, task, taskCard, taskCategories, taskClosed, taskCreated, taskLinks, taskMerge, taskPair, taskScan, taskSimilar, taskStats, taskUnmerge, topic, trackedChat, trackedChatHistory, watchedMessage, watchItem, };
|
|
96
|
+
export { account, accountChange, accountPrivacy, accountPrivacyChange, accountProfile, accountSession, adminReport, agenda, analysisConsent, analysisConsentRevocation, attachment, attachmentBytes, attachmentExtraction, attachmentTextChange, automaticTags, botAdmin, botMenuEntry, botProfile, botSeenChat, botTemplate, botWebhook, cachedChatMetadata, callRecord, chart, chat, chatAdminChange, chatArchive, chatEvent, chatFolderChange, chatFolderOrder, chatFolderRemoval, chatGroupChange, chatInspection, chatInvite, chatInviteChange, chatMembersChange, chatMembersFetch, chatMetadata, chatMetadataRefresh, chatModeration, chatMuting, chatPin, chatRead, chatRemoval, chatRequestChange, chatRules, chatSender, chatStats, chatTracking, chatUnread, contact, contactActivity, contactAlias, contactCheck, contactContext, contactImport, contactLookup, contactNote, contactNoteRemoval, contactPreparation, contactProfile, contactStateChange, contactSync, contactUpdate, conversation, conversationBatch, conversationBatchStatus, conversationBuildResult, conversationChange, conversationDetails, conversationEmbedding, conversationEmbeddingStatus, conversationHit, conversationPreparation, conversationReadiness, counterRefresh, counters, document, documentLink, endedAccountSessions, evidence, evidencePacket, fact, folder, hit, identity, imageEmbedding, inviteLink, job, joinRequest, linkedPerson, mediaArchive, mediaArchiveCheck, mediaArchiveMove, mediaArchiveTimer, meeting, meetingProjectCandidates, meetingSeriesInventory, member, memory, mention, mentionDecision, mentionDetails, mentionDomain, mentionRebuild, message, messageContext, messageCounts, messageDeletion, messageDownload, messageEvent, messageLink, messageLinks, messagePin, messageStar, messageSync, messageTranscript, messageWrite, model, modelKey, note, officialStats, organization, person, place, poll, pollChange, pollVote, project, ranking, reactionChange, recipient, recipientAdded, recipientChange, recipientOff, recipientRemoved, recordedRun, reference, relationship, reminder, removedModelKey, retention, runDetails, runHit, runLocation, savedSearch, scheduledJob, searchHistoryClear, sendAttempt, serveSummary, stickerInventory, storeBackup, storeChatStatus, storeCheck, storeClear, storeCopyRemoval, storeDecrypt, storedModelKey, storeExport, storeGapPlan, storeGapRepair, storeInfo, storeJobCancel, storeJobClear, storeJobDetails, storeJobRetry, storeMigration, storeReindex, storeRepair, storeReset, storeRestore, storeTable, tagChange, tagging, task, taskCard, taskCategories, taskClosed, taskCreated, taskLinks, taskMerge, taskPair, taskScan, taskSimilar, taskStats, taskUnmerge, topic, trackedChat, trackedChatHistory, watchedMessage, watchItem, };
|
|
96
97
|
export const ENTITIES = {
|
|
97
98
|
sync_progress: syncProgress,
|
|
98
99
|
...MEETING_RESULT_ENTITIES,
|
|
@@ -291,6 +292,7 @@ export const ENTITIES = {
|
|
|
291
292
|
store_reset: storeReset,
|
|
292
293
|
store_repair: storeRepair,
|
|
293
294
|
store_copy_removal: storeCopyRemoval,
|
|
295
|
+
store_table: storeTable,
|
|
294
296
|
agenda,
|
|
295
297
|
model,
|
|
296
298
|
chat_group_change: chatGroupChange,
|
|
@@ -2,11 +2,25 @@ import * as v from "valibot";
|
|
|
2
2
|
export declare const storeInfo: v.UnionSchema<[v.StrictObjectSchema<{
|
|
3
3
|
readonly path: v.StringSchema<undefined>;
|
|
4
4
|
readonly exists: v.LiteralSchema<false, undefined>;
|
|
5
|
+
readonly schema: v.StrictObjectSchema<{
|
|
6
|
+
readonly version: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
|
|
7
|
+
readonly min_compatible: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
|
|
8
|
+
readonly writable: v.BooleanSchema<undefined>;
|
|
9
|
+
readonly speaks: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
|
|
10
|
+
readonly reason: v.PicklistSchema<["missing", "older", "current", "newer", "too_new"], undefined>;
|
|
11
|
+
readonly upgrade: v.NullableSchema<v.StrictObjectSchema<{
|
|
12
|
+
readonly version: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
|
|
13
|
+
readonly min_compatible: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
|
|
14
|
+
}, undefined>, undefined>;
|
|
15
|
+
}, undefined>;
|
|
5
16
|
}, undefined>, v.StrictObjectSchema<{
|
|
6
|
-
path: v.StringSchema<undefined>;
|
|
7
|
-
exists: v.LiteralSchema<true, undefined>;
|
|
8
|
-
opens: v.LiteralSchema<false, undefined>;
|
|
9
|
-
error: v.StringSchema<undefined>;
|
|
17
|
+
readonly path: v.StringSchema<undefined>;
|
|
18
|
+
readonly exists: v.LiteralSchema<true, undefined>;
|
|
19
|
+
readonly opens: v.LiteralSchema<false, undefined>;
|
|
20
|
+
readonly error: v.StringSchema<undefined>;
|
|
21
|
+
readonly schema: v.StrictObjectSchema<{
|
|
22
|
+
readonly speaks: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
|
|
23
|
+
}, undefined>;
|
|
10
24
|
}, undefined>, v.StrictObjectSchema<{
|
|
11
25
|
readonly by_provider: v.OptionalSchema<v.ArraySchema<v.StrictObjectSchema<{
|
|
12
26
|
readonly chats: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
|
|
@@ -50,12 +64,42 @@ export declare const storeInfo: v.UnionSchema<[v.StrictObjectSchema<{
|
|
|
50
64
|
readonly file: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
|
|
51
65
|
readonly wal: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
|
|
52
66
|
}, undefined>;
|
|
67
|
+
readonly journal_mode: v.StringSchema<undefined>;
|
|
68
|
+
/** `free` pages hold nothing; a `VACUUM` would give them back. */
|
|
69
|
+
readonly pages: v.StrictObjectSchema<{
|
|
70
|
+
readonly size: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
|
|
71
|
+
readonly count: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
|
|
72
|
+
readonly free: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
|
|
73
|
+
}, undefined>;
|
|
74
|
+
readonly migrations: v.ArraySchema<v.StrictObjectSchema<{
|
|
75
|
+
readonly version: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
|
|
76
|
+
readonly min_compatible: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
|
|
77
|
+
readonly applied_at: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IsoTimestampAction<string, "an ISO 8601 time in UTC">, v.EndsWithAction<string, "Z", "an ISO 8601 time in UTC, ending in `Z`">]>;
|
|
78
|
+
}, undefined>, undefined>;
|
|
79
|
+
/** From the marker a backup job leaves in `backups/last.json` beside the store; null without one. */
|
|
80
|
+
readonly backup: v.NullableSchema<v.StrictObjectSchema<{
|
|
81
|
+
readonly at: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IsoTimestampAction<string, "an ISO 8601 time in UTC">, v.EndsWithAction<string, "Z", "an ISO 8601 time in UTC, ending in `Z`">]>;
|
|
82
|
+
readonly file: v.NullableSchema<v.StringSchema<undefined>, undefined>;
|
|
83
|
+
readonly checked: v.NullableSchema<v.StringSchema<undefined>, undefined>;
|
|
84
|
+
}, undefined>, undefined>;
|
|
53
85
|
readonly schema: v.StrictObjectSchema<{
|
|
54
86
|
readonly version: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
|
|
55
87
|
readonly min_compatible: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
|
|
56
88
|
readonly writable: v.BooleanSchema<undefined>;
|
|
57
89
|
readonly speaks: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
|
|
90
|
+
readonly reason: v.PicklistSchema<["missing", "older", "current", "newer", "too_new"], undefined>;
|
|
91
|
+
readonly upgrade: v.NullableSchema<v.StrictObjectSchema<{
|
|
92
|
+
readonly version: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
|
|
93
|
+
readonly min_compatible: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
|
|
94
|
+
}, undefined>, undefined>;
|
|
58
95
|
}, undefined>;
|
|
96
|
+
readonly clients: v.ArraySchema<v.StrictObjectSchema<{
|
|
97
|
+
readonly command: v.StringSchema<undefined>;
|
|
98
|
+
readonly version: v.StringSchema<undefined>;
|
|
99
|
+
readonly core: v.StringSchema<undefined>;
|
|
100
|
+
readonly speaks: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
|
|
101
|
+
readonly seen_at: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IsoTimestampAction<string, "an ISO 8601 time in UTC">, v.EndsWithAction<string, "Z", "an ISO 8601 time in UTC, ending in `Z`">]>;
|
|
102
|
+
}, undefined>, undefined>;
|
|
59
103
|
readonly rows: Omit<v.StrictObjectSchema<{
|
|
60
104
|
readonly accounts: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
|
|
61
105
|
readonly chats: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
|
|
@@ -2,6 +2,12 @@ import * as v from "valibot";
|
|
|
2
2
|
import { count, text, time } from "./fields.js";
|
|
3
3
|
const absent = v.strictObject({ path: text, exists: v.literal(false) });
|
|
4
4
|
const schema = v.strictObject({ version: count, min_compatible: count, writable: v.boolean(), speaks: count });
|
|
5
|
+
const infoSchema = v.strictObject({
|
|
6
|
+
...schema.entries,
|
|
7
|
+
reason: v.picklist(["missing", "older", "current", "newer", "too_new"]),
|
|
8
|
+
upgrade: v.nullable(v.strictObject({ version: count, min_compatible: count })),
|
|
9
|
+
});
|
|
10
|
+
const client = v.strictObject({ command: text, version: text, core: text, speaks: count, seen_at: time });
|
|
5
11
|
const wordIndex = v.strictObject({
|
|
6
12
|
watermark: count,
|
|
7
13
|
filled_through: count,
|
|
@@ -47,13 +53,20 @@ const contents = {
|
|
|
47
53
|
by_attachment_kind: v.optional(v.array(v.strictObject({ type: text, kind: text, count, bytes: count }))),
|
|
48
54
|
};
|
|
49
55
|
export const storeInfo = v.union([
|
|
50
|
-
absent,
|
|
51
|
-
v.strictObject(readFailure),
|
|
56
|
+
v.strictObject({ ...absent.entries, schema: infoSchema }),
|
|
57
|
+
v.strictObject({ ...readFailure, schema: v.strictObject({ speaks: count }) }),
|
|
52
58
|
v.strictObject({
|
|
53
59
|
path: text,
|
|
54
60
|
exists: v.literal(true),
|
|
55
61
|
bytes: v.strictObject({ file: count, wal: count }),
|
|
56
|
-
|
|
62
|
+
journal_mode: text,
|
|
63
|
+
/** `free` pages hold nothing; a `VACUUM` would give them back. */
|
|
64
|
+
pages: v.strictObject({ size: count, count, free: count }),
|
|
65
|
+
migrations: v.array(v.strictObject({ version: count, min_compatible: count, applied_at: time })),
|
|
66
|
+
/** From the marker a backup job leaves in `backups/last.json` beside the store; null without one. */
|
|
67
|
+
backup: v.nullable(v.strictObject({ at: time, file: v.nullable(text), checked: v.nullable(text) })),
|
|
68
|
+
schema: infoSchema,
|
|
69
|
+
clients: v.array(client),
|
|
57
70
|
rows,
|
|
58
71
|
pending_normalization: v.nullable(count),
|
|
59
72
|
word_index: v.nullable(wordIndex),
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import * as v from "valibot";
|
|
2
|
+
export declare const TABLE_KINDS: readonly ["data", "search_index", "search_index_part", "internal"];
|
|
3
|
+
export declare const storeTable: v.StrictObjectSchema<{
|
|
4
|
+
readonly name: v.StringSchema<undefined>;
|
|
5
|
+
readonly kind: v.PicklistSchema<readonly ["data", "search_index", "search_index_part", "internal"], undefined>;
|
|
6
|
+
readonly rows: v.NullableSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>, undefined>;
|
|
7
|
+
readonly bytes: v.OptionalSchema<v.NullableSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>, undefined>, undefined>;
|
|
8
|
+
}, undefined>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import * as v from "valibot";
|
|
2
|
+
import { count, text } from "./fields.js";
|
|
3
|
+
export const TABLE_KINDS = ["data", "search_index", "search_index_part", "internal"];
|
|
4
|
+
export const storeTable = v.strictObject({
|
|
5
|
+
name: text,
|
|
6
|
+
kind: v.picklist(TABLE_KINDS),
|
|
7
|
+
rows: v.nullable(count),
|
|
8
|
+
bytes: v.optional(v.nullable(count)),
|
|
9
|
+
});
|
|
@@ -38,6 +38,7 @@ export declare const meetingTools: ({
|
|
|
38
38
|
max_read_bytes?: undefined;
|
|
39
39
|
cursor?: undefined;
|
|
40
40
|
} | {
|
|
41
|
+
limit?: undefined;
|
|
41
42
|
event_id?: undefined;
|
|
42
43
|
series_id?: undefined;
|
|
43
44
|
page?: undefined;
|
|
@@ -53,11 +54,11 @@ export declare const meetingTools: ({
|
|
|
53
54
|
format?: undefined;
|
|
54
55
|
transcript_id?: undefined;
|
|
55
56
|
query?: undefined;
|
|
56
|
-
limit?: undefined;
|
|
57
57
|
scan_limit?: undefined;
|
|
58
58
|
max_read_bytes?: undefined;
|
|
59
59
|
cursor?: undefined;
|
|
60
60
|
} | {
|
|
61
|
+
limit?: undefined;
|
|
61
62
|
event_id?: undefined;
|
|
62
63
|
series_id?: undefined;
|
|
63
64
|
page?: undefined;
|
|
@@ -75,11 +76,11 @@ export declare const meetingTools: ({
|
|
|
75
76
|
format?: undefined;
|
|
76
77
|
transcript_id?: undefined;
|
|
77
78
|
query?: undefined;
|
|
78
|
-
limit?: undefined;
|
|
79
79
|
scan_limit?: undefined;
|
|
80
80
|
max_read_bytes?: undefined;
|
|
81
81
|
cursor?: undefined;
|
|
82
82
|
} | {
|
|
83
|
+
limit?: undefined;
|
|
83
84
|
event_id?: undefined;
|
|
84
85
|
series_id?: undefined;
|
|
85
86
|
page?: undefined;
|
|
@@ -101,7 +102,6 @@ export declare const meetingTools: ({
|
|
|
101
102
|
minimum: number;
|
|
102
103
|
};
|
|
103
104
|
query?: undefined;
|
|
104
|
-
limit?: undefined;
|
|
105
105
|
scan_limit?: undefined;
|
|
106
106
|
max_read_bytes?: undefined;
|
|
107
107
|
cursor?: undefined;
|
|
@@ -188,6 +188,7 @@ export declare const meetingTools: ({
|
|
|
188
188
|
max_read_bytes?: undefined;
|
|
189
189
|
cursor?: undefined;
|
|
190
190
|
} | {
|
|
191
|
+
limit?: undefined;
|
|
191
192
|
event_id?: undefined;
|
|
192
193
|
series_id?: undefined;
|
|
193
194
|
page?: undefined;
|
|
@@ -203,11 +204,11 @@ export declare const meetingTools: ({
|
|
|
203
204
|
format?: undefined;
|
|
204
205
|
transcript_id?: undefined;
|
|
205
206
|
query?: undefined;
|
|
206
|
-
limit?: undefined;
|
|
207
207
|
scan_limit?: undefined;
|
|
208
208
|
max_read_bytes?: undefined;
|
|
209
209
|
cursor?: undefined;
|
|
210
210
|
} | {
|
|
211
|
+
limit?: undefined;
|
|
211
212
|
event_id?: undefined;
|
|
212
213
|
series_id?: undefined;
|
|
213
214
|
page?: undefined;
|
|
@@ -225,11 +226,11 @@ export declare const meetingTools: ({
|
|
|
225
226
|
format?: undefined;
|
|
226
227
|
transcript_id?: undefined;
|
|
227
228
|
query?: undefined;
|
|
228
|
-
limit?: undefined;
|
|
229
229
|
scan_limit?: undefined;
|
|
230
230
|
max_read_bytes?: undefined;
|
|
231
231
|
cursor?: undefined;
|
|
232
232
|
} | {
|
|
233
|
+
limit?: undefined;
|
|
233
234
|
event_id?: undefined;
|
|
234
235
|
series_id?: undefined;
|
|
235
236
|
page?: undefined;
|
|
@@ -251,7 +252,6 @@ export declare const meetingTools: ({
|
|
|
251
252
|
minimum: number;
|
|
252
253
|
};
|
|
253
254
|
query?: undefined;
|
|
254
|
-
limit?: undefined;
|
|
255
255
|
scan_limit?: undefined;
|
|
256
256
|
max_read_bytes?: undefined;
|
|
257
257
|
cursor?: undefined;
|
|
@@ -338,6 +338,7 @@ export declare const meetingTools: ({
|
|
|
338
338
|
max_read_bytes?: undefined;
|
|
339
339
|
cursor?: undefined;
|
|
340
340
|
} | {
|
|
341
|
+
limit?: undefined;
|
|
341
342
|
event_id?: undefined;
|
|
342
343
|
series_id?: undefined;
|
|
343
344
|
page?: undefined;
|
|
@@ -353,11 +354,11 @@ export declare const meetingTools: ({
|
|
|
353
354
|
format?: undefined;
|
|
354
355
|
transcript_id?: undefined;
|
|
355
356
|
query?: undefined;
|
|
356
|
-
limit?: undefined;
|
|
357
357
|
scan_limit?: undefined;
|
|
358
358
|
max_read_bytes?: undefined;
|
|
359
359
|
cursor?: undefined;
|
|
360
360
|
} | {
|
|
361
|
+
limit?: undefined;
|
|
361
362
|
event_id?: undefined;
|
|
362
363
|
series_id?: undefined;
|
|
363
364
|
page?: undefined;
|
|
@@ -375,11 +376,11 @@ export declare const meetingTools: ({
|
|
|
375
376
|
format?: undefined;
|
|
376
377
|
transcript_id?: undefined;
|
|
377
378
|
query?: undefined;
|
|
378
|
-
limit?: undefined;
|
|
379
379
|
scan_limit?: undefined;
|
|
380
380
|
max_read_bytes?: undefined;
|
|
381
381
|
cursor?: undefined;
|
|
382
382
|
} | {
|
|
383
|
+
limit?: undefined;
|
|
383
384
|
event_id?: undefined;
|
|
384
385
|
series_id?: undefined;
|
|
385
386
|
page?: undefined;
|
|
@@ -401,7 +402,6 @@ export declare const meetingTools: ({
|
|
|
401
402
|
minimum: number;
|
|
402
403
|
};
|
|
403
404
|
query?: undefined;
|
|
404
|
-
limit?: undefined;
|
|
405
405
|
scan_limit?: undefined;
|
|
406
406
|
max_read_bytes?: undefined;
|
|
407
407
|
cursor?: undefined;
|
|
@@ -488,6 +488,7 @@ export declare const meetingTools: ({
|
|
|
488
488
|
max_read_bytes?: undefined;
|
|
489
489
|
cursor?: undefined;
|
|
490
490
|
} | {
|
|
491
|
+
limit?: undefined;
|
|
491
492
|
event_id?: undefined;
|
|
492
493
|
series_id?: undefined;
|
|
493
494
|
page?: undefined;
|
|
@@ -503,11 +504,11 @@ export declare const meetingTools: ({
|
|
|
503
504
|
format?: undefined;
|
|
504
505
|
transcript_id?: undefined;
|
|
505
506
|
query?: undefined;
|
|
506
|
-
limit?: undefined;
|
|
507
507
|
scan_limit?: undefined;
|
|
508
508
|
max_read_bytes?: undefined;
|
|
509
509
|
cursor?: undefined;
|
|
510
510
|
} | {
|
|
511
|
+
limit?: undefined;
|
|
511
512
|
event_id?: undefined;
|
|
512
513
|
series_id?: undefined;
|
|
513
514
|
page?: undefined;
|
|
@@ -525,11 +526,11 @@ export declare const meetingTools: ({
|
|
|
525
526
|
format?: undefined;
|
|
526
527
|
transcript_id?: undefined;
|
|
527
528
|
query?: undefined;
|
|
528
|
-
limit?: undefined;
|
|
529
529
|
scan_limit?: undefined;
|
|
530
530
|
max_read_bytes?: undefined;
|
|
531
531
|
cursor?: undefined;
|
|
532
532
|
} | {
|
|
533
|
+
limit?: undefined;
|
|
533
534
|
event_id?: undefined;
|
|
534
535
|
series_id?: undefined;
|
|
535
536
|
page?: undefined;
|
|
@@ -551,7 +552,6 @@ export declare const meetingTools: ({
|
|
|
551
552
|
minimum: number;
|
|
552
553
|
};
|
|
553
554
|
query?: undefined;
|
|
554
|
-
limit?: undefined;
|
|
555
555
|
scan_limit?: undefined;
|
|
556
556
|
max_read_bytes?: undefined;
|
|
557
557
|
cursor?: undefined;
|
|
@@ -638,6 +638,7 @@ export declare const meetingTools: ({
|
|
|
638
638
|
max_read_bytes?: undefined;
|
|
639
639
|
cursor?: undefined;
|
|
640
640
|
} | {
|
|
641
|
+
limit?: undefined;
|
|
641
642
|
event_id?: undefined;
|
|
642
643
|
series_id?: undefined;
|
|
643
644
|
page?: undefined;
|
|
@@ -653,11 +654,11 @@ export declare const meetingTools: ({
|
|
|
653
654
|
format?: undefined;
|
|
654
655
|
transcript_id?: undefined;
|
|
655
656
|
query?: undefined;
|
|
656
|
-
limit?: undefined;
|
|
657
657
|
scan_limit?: undefined;
|
|
658
658
|
max_read_bytes?: undefined;
|
|
659
659
|
cursor?: undefined;
|
|
660
660
|
} | {
|
|
661
|
+
limit?: undefined;
|
|
661
662
|
event_id?: undefined;
|
|
662
663
|
series_id?: undefined;
|
|
663
664
|
page?: undefined;
|
|
@@ -675,11 +676,11 @@ export declare const meetingTools: ({
|
|
|
675
676
|
format?: undefined;
|
|
676
677
|
transcript_id?: undefined;
|
|
677
678
|
query?: undefined;
|
|
678
|
-
limit?: undefined;
|
|
679
679
|
scan_limit?: undefined;
|
|
680
680
|
max_read_bytes?: undefined;
|
|
681
681
|
cursor?: undefined;
|
|
682
682
|
} | {
|
|
683
|
+
limit?: undefined;
|
|
683
684
|
event_id?: undefined;
|
|
684
685
|
series_id?: undefined;
|
|
685
686
|
page?: undefined;
|
|
@@ -701,7 +702,6 @@ export declare const meetingTools: ({
|
|
|
701
702
|
minimum: number;
|
|
702
703
|
};
|
|
703
704
|
query?: undefined;
|
|
704
|
-
limit?: undefined;
|
|
705
705
|
scan_limit?: undefined;
|
|
706
706
|
max_read_bytes?: undefined;
|
|
707
707
|
cursor?: undefined;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { CacheDatabase } from "./driver.js";
|
|
2
|
+
import { type Migration } from "./migrations.js";
|
|
3
|
+
export declare const SPEAKS: number;
|
|
4
|
+
export interface FileSchema {
|
|
5
|
+
version: number;
|
|
6
|
+
minCompatible: number;
|
|
7
|
+
}
|
|
8
|
+
/** Where the file stands against this build: `missing` and `older` are what this build's next run migrates. */
|
|
9
|
+
export type SchemaReason = "missing" | "older" | "current" | "newer" | "too_new";
|
|
10
|
+
/** An empty file is normal: `openStore` creates it before the first migration runs. */
|
|
11
|
+
export declare const fileSchemaOf: (database: CacheDatabase) => FileSchema;
|
|
12
|
+
/** The negation of `migrate`'s refusal: a newer file stays open to this build until its minimum passes it. */
|
|
13
|
+
export declare const writableBy: ({ version, minCompatible }: FileSchema, speaks?: number) => boolean;
|
|
14
|
+
/**
|
|
15
|
+
* What this build makes of the file, and what its next run would leave behind: `upgrade.minCompatible` is the
|
|
16
|
+
* minimum the file will demand afterwards, so a caller can name every other tool that will then refuse it.
|
|
17
|
+
*/
|
|
18
|
+
export declare const compatibilityOf: (file: FileSchema | undefined, migrations?: readonly Migration[]) => {
|
|
19
|
+
version: number;
|
|
20
|
+
minCompatible: number;
|
|
21
|
+
speaks: number;
|
|
22
|
+
writable: boolean;
|
|
23
|
+
reason: SchemaReason;
|
|
24
|
+
upgrade: {
|
|
25
|
+
version: number;
|
|
26
|
+
minCompatible: number;
|
|
27
|
+
} | null;
|
|
28
|
+
};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { MIGRATIONS } from "./migrations.js";
|
|
2
|
+
export const SPEAKS = MIGRATIONS.at(-1)?.version ?? 0;
|
|
3
|
+
/** An empty file is normal: `openStore` creates it before the first migration runs. */
|
|
4
|
+
export const fileSchemaOf = (database) => {
|
|
5
|
+
const tracked = database.prepare("SELECT 1 FROM sqlite_master WHERE name = 'schema_migrations'").get();
|
|
6
|
+
const row = tracked
|
|
7
|
+
? database.prepare("SELECT version, min_compatible FROM schema_migrations ORDER BY version DESC LIMIT 1").get()
|
|
8
|
+
: undefined;
|
|
9
|
+
return { version: Number(row?.version ?? 0), minCompatible: Number(row?.min_compatible ?? 0) };
|
|
10
|
+
};
|
|
11
|
+
/** The negation of `migrate`'s refusal: a newer file stays open to this build until its minimum passes it. */
|
|
12
|
+
export const writableBy = ({ version, minCompatible }, speaks = SPEAKS) => version <= speaks || minCompatible <= speaks;
|
|
13
|
+
/**
|
|
14
|
+
* What this build makes of the file, and what its next run would leave behind: `upgrade.minCompatible` is the
|
|
15
|
+
* minimum the file will demand afterwards, so a caller can name every other tool that will then refuse it.
|
|
16
|
+
*/
|
|
17
|
+
export const compatibilityOf = (file, migrations = MIGRATIONS) => {
|
|
18
|
+
const speaks = migrations.at(-1)?.version ?? 0;
|
|
19
|
+
const { version, minCompatible } = file ?? { version: 0, minCompatible: 0 };
|
|
20
|
+
const writable = writableBy({ version, minCompatible }, speaks);
|
|
21
|
+
const reason = !file
|
|
22
|
+
? "missing"
|
|
23
|
+
: version < speaks
|
|
24
|
+
? "older"
|
|
25
|
+
: version === speaks
|
|
26
|
+
? "current"
|
|
27
|
+
: writable
|
|
28
|
+
? "newer"
|
|
29
|
+
: "too_new";
|
|
30
|
+
const raisedTo = migrations
|
|
31
|
+
.filter((migration) => migration.version > version)
|
|
32
|
+
.reduce((highest, migration) => Math.max(highest, migration.minCompatible), minCompatible);
|
|
33
|
+
return {
|
|
34
|
+
version,
|
|
35
|
+
minCompatible,
|
|
36
|
+
speaks,
|
|
37
|
+
writable,
|
|
38
|
+
reason,
|
|
39
|
+
upgrade: version < speaks ? { version: speaks, minCompatible: raisedTo } : null,
|
|
40
|
+
};
|
|
41
|
+
};
|