@wirecat/cli-core 0.666.0 → 0.668.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 +88 -0
- package/dist/calendar/cli/conference.d.ts +3 -0
- package/dist/calendar/cli/conference.js +7 -0
- package/dist/calendar/cli/index.d.ts +1 -0
- package/dist/calendar/cli/index.js +4 -2
- package/dist/calendar/mcp/index.d.ts +2944 -171
- package/dist/calendar/mcp/index.js +22 -3
- package/dist/calendar/testing/writer-contract.js +34 -0
- package/dist/calendar/testing/writer.d.ts +3 -0
- package/dist/calendar/testing/writer.js +9 -1
- package/dist/calendar/writer.d.ts +13 -0
- package/dist/calendar/writes.d.ts +3 -0
- package/dist/calendar/writes.js +21 -1
- package/dist/cli/documents/words.d.ts +1 -1
- package/dist/cli/meeting-batch.js +2 -2
- package/dist/domain/providers.js +2 -1
- package/dist/entities/index.d.ts +7 -0
- package/dist/errors/reasons.js +2 -0
- package/dist/meetings/answers.d.ts +12 -0
- package/dist/meetings/answers.js +27 -1
- package/dist/meetings/cli/index.d.ts +2 -0
- package/dist/meetings/cli/index.js +7 -3
- package/dist/meetings/cli/management.d.ts +3 -1
- package/dist/meetings/cli/management.js +73 -26
- package/dist/meetings/cli/passage.js +2 -2
- package/dist/meetings/export.d.ts +2 -0
- package/dist/meetings/export.js +1 -0
- package/dist/meetings/index.d.ts +3 -3
- package/dist/meetings/index.js +3 -3
- package/dist/meetings/mcp/passage.js +2 -2
- package/dist/meetings/meeting-management.d.ts +68 -3
- package/dist/meetings/meeting-management.js +134 -17
- package/dist/meetings/passage.d.ts +5 -0
- package/dist/meetings/passage.js +10 -0
- package/dist/meetings/read-answers.d.ts +3 -0
- package/dist/meetings/read-answers.js +3 -0
- package/dist/meetings/read-through.d.ts +1 -1
- package/dist/meetings/read-through.js +4 -0
- package/dist/meetings/reads.d.ts +16 -3
- package/dist/meetings/reads.js +12 -2
- package/dist/meetings/result-items.d.ts +3 -0
- package/dist/meetings/result-items.js +9 -1
- package/dist/meetings/store.d.ts +6 -0
- package/dist/meetings/store.js +13 -0
- package/dist/meetings/testing/management-contract.js +27 -5
- package/dist/store/sqlite/meeting-listing.js +28 -7
- package/package.json +3 -3
|
@@ -165,6 +165,7 @@ export const meetingParticipants = v.strictObject({
|
|
|
165
165
|
display_name: v.nullable(text),
|
|
166
166
|
email: v.nullable(text),
|
|
167
167
|
person: v.nullable(v.strictObject({ ref: text, name: v.nullable(text) })),
|
|
168
|
+
untrusted: v.optional(v.array(text)),
|
|
168
169
|
})),
|
|
169
170
|
/** Several identities on one page are observations, never speaker attribution or person links. */
|
|
170
171
|
ambiguity: v.strictObject({ scope: v.literal("page"), multiple_identities: v.boolean(), identity_ids: v.array(id) }),
|
|
@@ -218,6 +219,8 @@ export const meetingPassage = v.strictObject({
|
|
|
218
219
|
speaker_name: v.nullable(text),
|
|
219
220
|
text,
|
|
220
221
|
revision,
|
|
222
|
+
/** What people said: `speaker_name` and `text`. */
|
|
223
|
+
untrusted: v.optional(v.array(text)),
|
|
221
224
|
})),
|
|
222
225
|
});
|
|
223
226
|
/** A stored event a meeting belongs to; `id` is what `meetings update --event-id` takes. */
|
|
@@ -13,7 +13,7 @@ export declare const MEETING_SERVER_BOUNDS: {
|
|
|
13
13
|
calls: number;
|
|
14
14
|
pages: number;
|
|
15
15
|
};
|
|
16
|
-
export type MeetingServerSkip = "unsupported" | "offline" | "unreachable" | "not_signed_in" | "refused" | "failed" | "no_upcoming";
|
|
16
|
+
export type MeetingServerSkip = "unsupported" | "offline" | "unreachable" | "not_signed_in" | "refused" | "rate_limited" | "failed" | "no_upcoming";
|
|
17
17
|
/** What asking the service did, as messages search's `server` says it. */
|
|
18
18
|
export interface MeetingServerReport {
|
|
19
19
|
backend: "server" | "both";
|
|
@@ -16,6 +16,7 @@ const ISSUES = {
|
|
|
16
16
|
unreachable: ["network_error", "meetings.server-unreachable"],
|
|
17
17
|
not_signed_in: ["authentication_error", "meetings.server-signed-out"],
|
|
18
18
|
refused: ["permission_error", "meetings.server-refused"],
|
|
19
|
+
rate_limited: ["rate_limited", "meetings.server-rate-limited"],
|
|
19
20
|
failed: ["provider_error", "meetings.server-failed"],
|
|
20
21
|
};
|
|
21
22
|
const metaOf = (reason, provider) => {
|
|
@@ -28,6 +29,7 @@ const WHY = {
|
|
|
28
29
|
unreachable: (provider) => `${provider} could not be reached — the answer is the store's`,
|
|
29
30
|
not_signed_in: (provider) => `not signed in to ${provider} — the answer is the store's`,
|
|
30
31
|
refused: (provider) => `${provider} refused the request — the answer is the store's`,
|
|
32
|
+
rate_limited: (provider) => `${provider} asked to wait before more requests — the answer is the store's`,
|
|
31
33
|
failed: (provider) => `${provider} could not be read — the answer is the store's`,
|
|
32
34
|
no_upcoming: (provider) => `${provider} lists no meeting before it starts — upcoming ones are not in the answer`,
|
|
33
35
|
};
|
|
@@ -39,6 +41,8 @@ const reasonOf = (error) => {
|
|
|
39
41
|
return "refused";
|
|
40
42
|
if (code === "network_error")
|
|
41
43
|
return "unreachable";
|
|
44
|
+
if (code === "rate_limited")
|
|
45
|
+
return "rate_limited";
|
|
42
46
|
return "failed";
|
|
43
47
|
};
|
|
44
48
|
const refusal = (reason, provider, error) => error ??
|
package/dist/meetings/reads.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { type QueryAst } from "@wirecat/cli-base/query";
|
|
|
3
3
|
import { type ListEnvelope } from "@wirecat/cli-base/standards";
|
|
4
4
|
import { type MeetingDetailsItem, type MeetingItemBody, type MeetingListBody, type MeetingSummaryItem, type MeetingTranscriptItem } from "./answers.js";
|
|
5
5
|
import { type MeetingItem } from "./item.js";
|
|
6
|
-
import { type MeetingParticipantSearchOptions, type MeetingParticipantSearchStore } from "./participant-search.js";
|
|
6
|
+
import { type MeetingParticipantCandidate, type MeetingParticipantSearchOptions, type MeetingParticipantSearchStore } from "./participant-search.js";
|
|
7
7
|
import type { MeetingDetails, MeetingFilter, MeetingStore } from "./store.js";
|
|
8
8
|
export declare class MeetingError extends CliError {
|
|
9
9
|
constructor(code: "validation_error" | "not_found" | "configuration_error", message: string);
|
|
@@ -23,14 +23,15 @@ export declare const listed: <T>(items: T[], page?: {
|
|
|
23
23
|
export declare const meetingPeople: (store: MeetingStore & Partial<MeetingParticipantSearchStore>, query: string, accountId?: number, options?: Omit<MeetingParticipantSearchOptions, "accountId">) => Promise<{
|
|
24
24
|
limit: number;
|
|
25
25
|
hasMore: boolean;
|
|
26
|
-
items:
|
|
26
|
+
items: (Omit<MeetingParticipantCandidate, "person"> & {
|
|
27
|
+
untrusted: string[];
|
|
28
|
+
})[];
|
|
27
29
|
page: number;
|
|
28
30
|
} | {
|
|
29
31
|
schema_version: 1;
|
|
30
32
|
kind: "meeting_participants";
|
|
31
33
|
account_id: number;
|
|
32
34
|
query: string;
|
|
33
|
-
items: import("./participant-search.js").MeetingParticipantCandidate[];
|
|
34
35
|
ambiguity: {
|
|
35
36
|
scope: "page";
|
|
36
37
|
multiple_identities: boolean;
|
|
@@ -42,6 +43,18 @@ export declare const meetingPeople: (store: MeetingStore & Partial<MeetingPartic
|
|
|
42
43
|
archive_completeness: "unknown";
|
|
43
44
|
truncated_by: "limit" | "scan_limit" | "read_bytes" | null;
|
|
44
45
|
};
|
|
46
|
+
items: {
|
|
47
|
+
participant_id: number;
|
|
48
|
+
meeting_id: number;
|
|
49
|
+
identity_id: number;
|
|
50
|
+
display_name: string | null;
|
|
51
|
+
email: string | null;
|
|
52
|
+
person: {
|
|
53
|
+
ref: string;
|
|
54
|
+
name: string | null;
|
|
55
|
+
} | null;
|
|
56
|
+
untrusted: string[];
|
|
57
|
+
}[];
|
|
45
58
|
page: {
|
|
46
59
|
mode: string;
|
|
47
60
|
limit: number;
|
package/dist/meetings/reads.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { CliError } from "@wirecat/cli-base";
|
|
2
2
|
import { parseLucene, validateQuery } from "@wirecat/cli-base/query";
|
|
3
3
|
import { STEPS, stepOf } from "@wirecat/cli-base/standards";
|
|
4
|
-
import { meetingDetailsItem, meetingSummaryItem, meetingTranscriptItem, wholeList, } from "./answers.js";
|
|
4
|
+
import { meetingDetailsItem, meetingSummaryItem, meetingTranscriptItem, PARTICIPANT_UNTRUSTED, wholeList, } from "./answers.js";
|
|
5
5
|
import { MEETING_QUERY, meetingItem } from "./item.js";
|
|
6
6
|
import { validateMeetingParticipantQuery, validateMeetingParticipantSearch, } from "./participant-search.js";
|
|
7
7
|
export class MeetingError extends CliError {
|
|
@@ -52,6 +52,7 @@ export const meetingPeople = async (store, query, accountId, options = {}) => {
|
|
|
52
52
|
});
|
|
53
53
|
return {
|
|
54
54
|
...packet,
|
|
55
|
+
items: packet.items.map((one) => ({ ...one, untrusted: [...PARTICIPANT_UNTRUSTED] })),
|
|
55
56
|
page: { mode: "cursor", limit, has_more, ...(next_cursor ? { next_cursor } : {}) },
|
|
56
57
|
...(next_cursor
|
|
57
58
|
? {
|
|
@@ -74,7 +75,16 @@ export const meetingPeople = async (store, query, accountId, options = {}) => {
|
|
|
74
75
|
}
|
|
75
76
|
if (Object.values(options).some((value) => value !== undefined))
|
|
76
77
|
throw new MeetingError("configuration_error", "bounded participant lookup needs a selected account and capable store");
|
|
77
|
-
|
|
78
|
+
// The bounded path's row, so `untrusted` names keys that are there. This store cannot tell a person link, so no
|
|
79
|
+
// `person`: its null would say the identity is linked to no one.
|
|
80
|
+
return listed((await store.participants(query, accountId)).map((one) => ({
|
|
81
|
+
participant_id: one.id,
|
|
82
|
+
meeting_id: one.meetingId,
|
|
83
|
+
identity_id: one.identityId,
|
|
84
|
+
display_name: one.displayName,
|
|
85
|
+
email: one.email,
|
|
86
|
+
untrusted: [...PARTICIPANT_UNTRUSTED],
|
|
87
|
+
})));
|
|
78
88
|
};
|
|
79
89
|
const PAGE_NEXT = STEPS.find((step) => step.id === "page.next");
|
|
80
90
|
/** Newest first; `filter.query` is a list query `meetingsQuery` validated. The answer pages by `limit`. */
|
|
@@ -13,6 +13,7 @@ export declare const MEETING_RESULT_ENTITIES: {
|
|
|
13
13
|
readonly duration_minutes: v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>, undefined>;
|
|
14
14
|
readonly timezone: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
15
15
|
readonly agenda: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
16
|
+
readonly settings: v.OptionalSchema<v.RecordSchema<v.StringSchema<undefined>, v.UnionSchema<[v.StringSchema<undefined>, v.BooleanSchema<undefined>], undefined>, undefined>, undefined>;
|
|
16
17
|
}, undefined>, undefined>;
|
|
17
18
|
readonly applied: v.BooleanSchema<undefined>;
|
|
18
19
|
readonly meeting: v.OptionalSchema<v.StrictObjectSchema<{
|
|
@@ -25,6 +26,7 @@ export declare const MEETING_RESULT_ENTITIES: {
|
|
|
25
26
|
readonly agenda: v.NullableSchema<v.StringSchema<undefined>, undefined>;
|
|
26
27
|
readonly join_url: v.NullableSchema<v.StringSchema<undefined>, undefined>;
|
|
27
28
|
}, undefined>, undefined>;
|
|
29
|
+
readonly untrusted: v.OptionalSchema<v.ArraySchema<v.StringSchema<undefined>, undefined>, undefined>;
|
|
28
30
|
}, undefined>;
|
|
29
31
|
readonly meeting_invitation: v.StrictObjectSchema<{
|
|
30
32
|
readonly id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
|
|
@@ -47,6 +49,7 @@ export declare const MEETING_RESULT_ENTITIES: {
|
|
|
47
49
|
readonly format: v.PicklistSchema<["markdown", "vtt"], undefined>;
|
|
48
50
|
readonly filename: v.StringSchema<undefined>;
|
|
49
51
|
readonly content: v.StringSchema<undefined>;
|
|
52
|
+
readonly untrusted: v.OptionalSchema<v.ArraySchema<v.StringSchema<undefined>, undefined>, undefined>;
|
|
50
53
|
}, undefined>, v.StrictObjectSchema<{
|
|
51
54
|
readonly meeting_id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
|
|
52
55
|
readonly format: v.PicklistSchema<["markdown", "vtt"], undefined>;
|
|
@@ -14,7 +14,13 @@ const run = v.strictObject({
|
|
|
14
14
|
timezone: v.optional(text),
|
|
15
15
|
});
|
|
16
16
|
const exported = v.union([
|
|
17
|
-
v.strictObject({
|
|
17
|
+
v.strictObject({
|
|
18
|
+
meeting_id: identifier,
|
|
19
|
+
format: v.picklist(["markdown", "vtt"]),
|
|
20
|
+
filename: text,
|
|
21
|
+
content: text,
|
|
22
|
+
untrusted: v.optional(v.array(text)),
|
|
23
|
+
}),
|
|
18
24
|
v.strictObject({ meeting_id: identifier, format: v.picklist(["markdown", "vtt"]), output: text }),
|
|
19
25
|
]);
|
|
20
26
|
const eventChange = v.strictObject({
|
|
@@ -138,6 +144,7 @@ const managedChange = v.strictObject({
|
|
|
138
144
|
duration_minutes: v.optional(count),
|
|
139
145
|
timezone: v.optional(text),
|
|
140
146
|
agenda: v.optional(text),
|
|
147
|
+
settings: v.optional(v.record(text, v.union([text, flag]))),
|
|
141
148
|
})),
|
|
142
149
|
applied: flag,
|
|
143
150
|
meeting: v.optional(v.strictObject({
|
|
@@ -150,6 +157,7 @@ const managedChange = v.strictObject({
|
|
|
150
157
|
agenda: nullableText,
|
|
151
158
|
join_url: nullableText,
|
|
152
159
|
})),
|
|
160
|
+
untrusted: v.optional(v.array(text)),
|
|
153
161
|
});
|
|
154
162
|
const invitation = v.strictObject({ id: identifier, invitation: text, untrusted: v.optional(v.array(text)) });
|
|
155
163
|
export const MEETING_RESULT_ENTITIES = {
|
package/dist/meetings/store.d.ts
CHANGED
|
@@ -29,6 +29,12 @@ export interface TranscriptInput extends Omit<NewRecord<Transcript>, "meetingId"
|
|
|
29
29
|
driveFileId?: string;
|
|
30
30
|
}
|
|
31
31
|
export declare const MEETING_DOCUMENT_ROLES: readonly ["transcript", "recording", "notes"];
|
|
32
|
+
/**
|
|
33
|
+
* What Meet and Gemini put in the name of the Google Doc they save, the words drive finds them by. The English names
|
|
34
|
+
* are the ones in a real Drive; the Russian and Spanish ones are Google's localized forms as best known, not yet seen
|
|
35
|
+
* in one. Drive's files have no field that marks a document as Meet's, so the name is all there is.
|
|
36
|
+
*/
|
|
37
|
+
export declare const TRANSCRIPT_WORDS: readonly ["Transcript", "Notes by Gemini", "Транскрипт", "Заметки Gemini", "Transcripción", "Notas de Gemini"];
|
|
32
38
|
export type MeetingDocumentRole = (typeof MEETING_DOCUMENT_ROLES)[number];
|
|
33
39
|
/**
|
|
34
40
|
* A Drive file the meeting service saved for the meeting: its transcript, its recording or its notes (Meet's
|
package/dist/meetings/store.js
CHANGED
|
@@ -1,3 +1,16 @@
|
|
|
1
1
|
export const MEETING_DOCUMENT_ROLES = ["transcript", "recording", "notes"];
|
|
2
|
+
/**
|
|
3
|
+
* What Meet and Gemini put in the name of the Google Doc they save, the words drive finds them by. The English names
|
|
4
|
+
* are the ones in a real Drive; the Russian and Spanish ones are Google's localized forms as best known, not yet seen
|
|
5
|
+
* in one. Drive's files have no field that marks a document as Meet's, so the name is all there is.
|
|
6
|
+
*/
|
|
7
|
+
export const TRANSCRIPT_WORDS = [
|
|
8
|
+
"Transcript",
|
|
9
|
+
"Notes by Gemini",
|
|
10
|
+
"Транскрипт",
|
|
11
|
+
"Заметки Gemini",
|
|
12
|
+
"Transcripción",
|
|
13
|
+
"Notas de Gemini",
|
|
14
|
+
];
|
|
2
15
|
/** `searchHits`' refusal of a page whose stored text passes `maxReadBytes`; a reader may ask for fewer rows. */
|
|
3
16
|
export const READ_BUDGET_EXCEEDED = "Meeting search exceeds its stored text byte budget";
|
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
import assert from "node:assert/strict";
|
|
2
|
-
import { createMeetingManagement } from "../meeting-management.js";
|
|
2
|
+
import { createMeetingManagement, declareMeetingFields, } from "../meeting-management.js";
|
|
3
|
+
const sampleSetting = (setting) => setting.type === "choice" ? setting.values[0] : setting.type === "boolean" ? true : "Bob Sample note";
|
|
4
|
+
/** A change that uses only what the port declares, so a service without a title or an agenda is checked too. */
|
|
5
|
+
const sampleChange = (declared, create) => {
|
|
6
|
+
const has = (field) => declared.fields.includes(field);
|
|
7
|
+
const first = declared.settings[0];
|
|
8
|
+
const settings = first ? { settings: { [first.name]: sampleSetting(first) } } : {};
|
|
9
|
+
if (create)
|
|
10
|
+
return {
|
|
11
|
+
...(has("title") ? { title: "Alice Example planning" } : {}),
|
|
12
|
+
...(has("kind") ? { kind: "instant" } : has("startTime") ? { startTime: "2026-11-20T10:00:00Z" } : {}),
|
|
13
|
+
...settings,
|
|
14
|
+
};
|
|
15
|
+
if (has("agenda"))
|
|
16
|
+
return { agenda: "Bob Sample agenda" };
|
|
17
|
+
if (has("title"))
|
|
18
|
+
return { title: "Alice Example planning" };
|
|
19
|
+
return settings;
|
|
20
|
+
};
|
|
3
21
|
/** Factories must use invented fixtures and injected transports; cases can apply writes. */
|
|
4
22
|
export const meetingManagementContract = (make) => {
|
|
5
23
|
const test = (name, check) => ({
|
|
@@ -15,14 +33,15 @@ export const meetingManagementContract = (make) => {
|
|
|
15
33
|
...(ports.create ? { create: fail } : {}),
|
|
16
34
|
...(ports.update ? { update: fail } : {}),
|
|
17
35
|
...(ports.cancel ? { cancel: fail } : {}),
|
|
36
|
+
...(ports.fields ? { fields: ports.fields } : {}),
|
|
18
37
|
});
|
|
19
38
|
if (ports.create) {
|
|
20
|
-
const receipt = await sdk.create(
|
|
39
|
+
const receipt = await sdk.create(sampleChange(sdk.fields.create, true));
|
|
21
40
|
assert.equal(receipt.applied, false);
|
|
22
41
|
assert.deepEqual(receipt.scope, scope);
|
|
23
42
|
}
|
|
24
43
|
if (ports.update)
|
|
25
|
-
assert.equal((await sdk.update(id,
|
|
44
|
+
assert.equal((await sdk.update(id, sampleChange(sdk.fields.update, false))).applied, false);
|
|
26
45
|
if (ports.cancel)
|
|
27
46
|
assert.equal((await sdk.cancel(id, { apply: true, dryRun: true })).applied, false);
|
|
28
47
|
}),
|
|
@@ -38,8 +57,9 @@ export const meetingManagementContract = (make) => {
|
|
|
38
57
|
assert.equal(Object.isFrozen(context.scope), true);
|
|
39
58
|
return create(change, context);
|
|
40
59
|
},
|
|
60
|
+
...(ports.fields ? { fields: ports.fields } : {}),
|
|
41
61
|
});
|
|
42
|
-
const receipt = await sdk.create(
|
|
62
|
+
const receipt = await sdk.create(sampleChange(sdk.fields.create, true), { apply: true });
|
|
43
63
|
assert.equal(calls, 1);
|
|
44
64
|
assert.equal(receipt.applied, true);
|
|
45
65
|
assert.ok(receipt.meeting?.id);
|
|
@@ -80,9 +100,11 @@ export const meetingManagementContract = (make) => {
|
|
|
80
100
|
},
|
|
81
101
|
}
|
|
82
102
|
: {}),
|
|
103
|
+
...(ports.fields ? { fields: ports.fields } : {}),
|
|
83
104
|
});
|
|
84
105
|
if (update) {
|
|
85
|
-
|
|
106
|
+
const change = sampleChange(declareMeetingFields(ports.fields?.update, "update"), false);
|
|
107
|
+
assert.equal((await sdk.update(id, change, { apply: true })).applied, true);
|
|
86
108
|
assert.equal(updates, 1);
|
|
87
109
|
}
|
|
88
110
|
if (cancel) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { CliError } from "@wirecat/cli-base";
|
|
2
|
-
import { formatMeetingReference, joinKeyOf, MEETING_FINDINGS_KIND, parseMeetingReference, } from "../../meetings/index.js";
|
|
2
|
+
import { formatMeetingReference, joinKeyOf, MEETING_FINDINGS_KIND, parseMeetingReference, TRANSCRIPT_WORDS, } from "../../meetings/index.js";
|
|
3
3
|
import { fold } from "../normalize.js";
|
|
4
4
|
import { eventWindow } from "./calendar-events.js";
|
|
5
5
|
import { COUNTERPART_ROLE, linkKind } from "./link-kinds.js";
|
|
@@ -115,6 +115,28 @@ const rowsOf = (context, filter) => {
|
|
|
115
115
|
};
|
|
116
116
|
const ROW_MEETINGS = "r.meetings";
|
|
117
117
|
const inRowMeetings = (condition) => `EXISTS (SELECT 1 FROM json_each(${ROW_MEETINGS}) rm WHERE ${condition.replaceAll("{m}", "rm.value")})`;
|
|
118
|
+
/** The meeting's own transcript, or a Drive document Meet named as its transcript or Gemini notes, once imported. */
|
|
119
|
+
const MEETING_TRANSCRIPT = `(EXISTS (SELECT 1 FROM meeting_transcripts t WHERE t.meeting_id = {m} AND t.deleted_at IS NULL
|
|
120
|
+
AND t.superseded_at IS NULL)
|
|
121
|
+
OR EXISTS (SELECT 1 FROM links tl JOIN documents td ON td.id = tl.to_id WHERE tl.from_type = 'meeting'
|
|
122
|
+
AND tl.from_id = {m} AND tl.kind = 'attached' AND tl.to_type = 'document' AND tl.role IN ('transcript', 'notes')
|
|
123
|
+
AND td.deleted_at IS NULL))`;
|
|
124
|
+
const literal = (text) => `'${text.replaceAll("'", "''")}'`;
|
|
125
|
+
// LIKE folds ASCII case only, so the lower-cased word also catches a lower-cased Russian title.
|
|
126
|
+
const namedLikeTranscript = (title) => `(${TRANSCRIPT_WORDS.flatMap((word) => [
|
|
127
|
+
`${title} LIKE ${literal(`%${word}%`)}`,
|
|
128
|
+
`instr(${title}, ${literal(word.toLowerCase())}) > 0`,
|
|
129
|
+
]).join(" OR ")})`;
|
|
130
|
+
/**
|
|
131
|
+
* A calendar entry's attachment carries no role, so an imported Drive document counts by the words drive finds
|
|
132
|
+
* transcripts and Gemini notes by.
|
|
133
|
+
*/
|
|
134
|
+
const EVENT_TRANSCRIPT = `EXISTS (SELECT 1 FROM calendar_entries tc JOIN links tl ON tl.from_type = 'calendar_entry'
|
|
135
|
+
AND tl.from_id = tc.id AND tl.kind = 'attached' AND tl.to_type = 'document'
|
|
136
|
+
JOIN documents td ON td.id = tl.to_id WHERE tc.event_id = {e} AND td.deleted_at IS NULL
|
|
137
|
+
AND ${namedLikeTranscript("td.title")})`;
|
|
138
|
+
/** One rule for the row's flag and the `has_transcript` filter. */
|
|
139
|
+
const ROW_TRANSCRIPT = `((r.type = 'event' AND ${EVENT_TRANSCRIPT.replaceAll("{e}", "r.id")}) OR ${inRowMeetings(MEETING_TRANSCRIPT)})`;
|
|
118
140
|
const PHONE_MEETING = "(SELECT a.provider FROM meetings km JOIN accounts a ON a.id = km.account_id WHERE km.id = {m}) = 'phone'";
|
|
119
141
|
const KIND = `(CASE
|
|
120
142
|
WHEN (r.type = 'event' AND EXISTS (SELECT 1 FROM calendar_entries kc WHERE kc.event_id = r.id
|
|
@@ -149,8 +171,7 @@ const filtersOf = (database, filter) => {
|
|
|
149
171
|
params.push(people, people, people);
|
|
150
172
|
}
|
|
151
173
|
if (filter.hasTranscript !== undefined) {
|
|
152
|
-
clauses.push(`${filter.hasTranscript ? "" : "NOT "}${
|
|
153
|
-
"AND t.superseded_at IS NULL)")}`);
|
|
174
|
+
clauses.push(`${filter.hasTranscript ? "" : "NOT "}${ROW_TRANSCRIPT}`);
|
|
154
175
|
}
|
|
155
176
|
return { sql: clauses.length ? `WHERE ${clauses.join(" AND ")}` : "", params };
|
|
156
177
|
};
|
|
@@ -206,7 +227,8 @@ const hydrate = (database, page) => {
|
|
|
206
227
|
const eventIds = page.filter(({ type }) => type === "event").map(({ id }) => id);
|
|
207
228
|
const meetingIds = [...new Set(page.flatMap(({ meetingIds }) => meetingIds))];
|
|
208
229
|
const events = new Map(database
|
|
209
|
-
.prepare(
|
|
230
|
+
.prepare(`SELECT e.*, ${EVENT_TRANSCRIPT.replaceAll("{e}", "e.id")} AS has_transcript FROM events e
|
|
231
|
+
WHERE e.id IN (SELECT value FROM json_each(?))`)
|
|
210
232
|
.all(ids(eventIds))
|
|
211
233
|
.map((row) => [Number(row.id), row]));
|
|
212
234
|
const entries = database
|
|
@@ -222,8 +244,7 @@ const hydrate = (database, page) => {
|
|
|
222
244
|
.map((row) => [Number(row.id), row.recurrence == null ? null : JSON.parse(String(row.recurrence))]));
|
|
223
245
|
const meetings = new Map(database
|
|
224
246
|
.prepare(`SELECT m.*, a.provider, a.external_id AS account,
|
|
225
|
-
|
|
226
|
-
AND t.superseded_at IS NULL) AS has_transcript,
|
|
247
|
+
${MEETING_TRANSCRIPT.replaceAll("{m}", "m.id")} AS has_transcript,
|
|
227
248
|
EXISTS (SELECT 1 FROM meeting_summaries s WHERE s.meeting_id = m.id) AS has_summary,
|
|
228
249
|
(EXISTS (SELECT 1 FROM attachments ra WHERE ra.attachable_type = 'meeting' AND ra.attachable_id = m.id
|
|
229
250
|
AND (ra.kind IN ('audio', 'video') OR ra.mime LIKE 'audio/%' OR ra.mime LIKE 'video/%'))
|
|
@@ -358,7 +379,7 @@ const hydrate = (database, page) => {
|
|
|
358
379
|
sources,
|
|
359
380
|
participants: [...participants.values()],
|
|
360
381
|
hasRecording: held.some((meeting) => Number(meeting.has_recording) === 1),
|
|
361
|
-
hasTranscript: held.some((meeting) => Number(meeting.has_transcript) === 1),
|
|
382
|
+
hasTranscript: Number(event?.has_transcript ?? 0) === 1 || held.some((meeting) => Number(meeting.has_transcript) === 1),
|
|
362
383
|
hasSummary: held.some((meeting) => Number(meeting.has_summary) === 1),
|
|
363
384
|
documents: [...linked.values()],
|
|
364
385
|
seriesId: num(event?.event_series_id),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wirecat/cli-core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.668.0",
|
|
4
4
|
"description": "The messenger-neutral half of a messaging CLI: domain model, message locators, rendering, name resolution, the SQLite seam, the command skeleton and shared read commands, the send guard, run records and the message store",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": "Viacheslav Ptsarev",
|
|
@@ -300,7 +300,7 @@
|
|
|
300
300
|
"@types/pngjs": "6.0.5",
|
|
301
301
|
"@types/ssh2": "1.15.5",
|
|
302
302
|
"@vitest/coverage-v8": "^5.0.5",
|
|
303
|
-
"@wirecat/cli-base": "0.
|
|
303
|
+
"@wirecat/cli-base": "0.102.1",
|
|
304
304
|
"@wirecat/cli-core-legacy-tags": "npm:@wirecat/cli-core@0.414.0",
|
|
305
305
|
"ajv": "8.17.1",
|
|
306
306
|
"commander": "15.0.0",
|
|
@@ -324,7 +324,7 @@
|
|
|
324
324
|
},
|
|
325
325
|
"peerDependencies": {
|
|
326
326
|
"@napi-rs/canvas": ">=0.1.69 <2",
|
|
327
|
-
"@wirecat/cli-base": ">=0.
|
|
327
|
+
"@wirecat/cli-base": ">=0.102.1 <1.0.0",
|
|
328
328
|
"commander": ">=15",
|
|
329
329
|
"mysql2": "^3.24.6",
|
|
330
330
|
"pg": "^8.23.1",
|