@opengeni/api-router 6.8.0 → 6.8.1-canary.41842879332001
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/app.js +1 -1
- package/dist/{chunk-A2VKA7K3.js → chunk-HG3ZBJ7P.js} +193 -25
- package/dist/{chunk-A2VKA7K3.js.map → chunk-HG3ZBJ7P.js.map} +1 -1
- package/dist/index.js +1 -1
- package/dist/mcp/server.d.ts +1 -0
- package/dist/mcp/session-view.d.ts +1 -0
- package/dist/meeting-calendar-title.d.ts +63 -6
- package/dist/meeting-join-links.d.ts +11 -0
- package/package.json +27 -26
- package/src/meeting-calendar-title.ts +227 -35
- package/src/meeting-join-links.ts +95 -0
- package/src/routes/recordings.ts +39 -3
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
// The link that joins a calendar event's call: Google Meet, Zoom, Microsoft
|
|
2
|
+
// Teams or Webex, from the event's own conference details or else from a link
|
|
3
|
+
// in its location or description. Only https links on those services count,
|
|
4
|
+
// so an event with some other link (a document, a map) is not a meeting to
|
|
5
|
+
// join.
|
|
6
|
+
|
|
7
|
+
/** A service whose meeting links the app knows, and how to tell them. */
|
|
8
|
+
type MeetingService = {
|
|
9
|
+
name: string;
|
|
10
|
+
matches: (url: URL) => boolean;
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
function hostIs(url: URL, domain: string): boolean {
|
|
14
|
+
const host = url.hostname.toLowerCase();
|
|
15
|
+
return host === domain || host.endsWith(`.${domain}`);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
const SERVICES: readonly MeetingService[] = [
|
|
19
|
+
{
|
|
20
|
+
name: "Google Meet",
|
|
21
|
+
// meet.google.com/abc-defg-hij or a lookup link; not /new, /landing or the home page.
|
|
22
|
+
matches: (url) =>
|
|
23
|
+
url.hostname.toLowerCase() === "meet.google.com" &&
|
|
24
|
+
/^\/([a-z]{3}-[a-z]{4}-[a-z]{3}|lookup\/[\w-]+)(\/|$)/iu.test(url.pathname),
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
name: "Zoom",
|
|
28
|
+
matches: (url) =>
|
|
29
|
+
(hostIs(url, "zoom.us") || hostIs(url, "zoom.com") || hostIs(url, "zoomgov.com")) &&
|
|
30
|
+
/^\/(j|my|w|wc\/join|s)\//iu.test(url.pathname),
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
name: "Microsoft Teams",
|
|
34
|
+
matches: (url) =>
|
|
35
|
+
(hostIs(url, "teams.microsoft.com") ||
|
|
36
|
+
hostIs(url, "teams.live.com") ||
|
|
37
|
+
hostIs(url, "teams.cloud.microsoft")) &&
|
|
38
|
+
/\/(l\/meetup-join|meet)\//iu.test(url.pathname),
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
name: "Webex",
|
|
42
|
+
// A meeting room or join link, not the site's other pages.
|
|
43
|
+
matches: (url) =>
|
|
44
|
+
hostIs(url, "webex.com") &&
|
|
45
|
+
/^\/(meet\/|join\/|[\w-]+\/j\.php|j\.php|wbxmjs\/joinservice\/)/iu.test(url.pathname),
|
|
46
|
+
},
|
|
47
|
+
];
|
|
48
|
+
|
|
49
|
+
/** A link to join a call, and the service it joins. */
|
|
50
|
+
export type MeetingJoinLink = { url: string; service: string };
|
|
51
|
+
|
|
52
|
+
/** `value` as a join link when it is an https link on a known meeting service. */
|
|
53
|
+
export function meetingJoinLink(value: unknown): MeetingJoinLink | null {
|
|
54
|
+
if (typeof value !== "string" || value.length > 2048) return null;
|
|
55
|
+
let url: URL;
|
|
56
|
+
try {
|
|
57
|
+
url = new URL(value.trim());
|
|
58
|
+
} catch {
|
|
59
|
+
return null;
|
|
60
|
+
}
|
|
61
|
+
if (url.protocol !== "https:" || url.username || url.password) return null;
|
|
62
|
+
const service = SERVICES.find((candidate) => candidate.matches(url));
|
|
63
|
+
return service ? { url: url.toString(), service: service.name } : null;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
const LINK = /https:\/\/[^\s<>"'()[\]{}]+/giu;
|
|
67
|
+
|
|
68
|
+
/** The first join link in free text, such as an event's location or description. */
|
|
69
|
+
export function meetingJoinLinkIn(text: unknown): MeetingJoinLink | null {
|
|
70
|
+
if (typeof text !== "string") return null;
|
|
71
|
+
// Google sends descriptions as HTML, where a link's & is &.
|
|
72
|
+
const plain = text.slice(0, 20_000).replace(/&/giu, "&");
|
|
73
|
+
for (const match of plain.matchAll(LINK)) {
|
|
74
|
+
// Trailing punctuation belongs to the sentence, not the link.
|
|
75
|
+
const found = meetingJoinLink(match[0].replace(/[.,;:!?]+$/u, ""));
|
|
76
|
+
if (found) return found;
|
|
77
|
+
}
|
|
78
|
+
return null;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
/** The first of `candidates` that is a join link, links before text. */
|
|
82
|
+
export function firstMeetingJoinLink(
|
|
83
|
+
links: readonly unknown[],
|
|
84
|
+
texts: readonly unknown[],
|
|
85
|
+
): MeetingJoinLink | null {
|
|
86
|
+
for (const link of links) {
|
|
87
|
+
const found = meetingJoinLink(link);
|
|
88
|
+
if (found) return found;
|
|
89
|
+
}
|
|
90
|
+
for (const text of texts) {
|
|
91
|
+
const found = meetingJoinLinkIn(text);
|
|
92
|
+
if (found) return found;
|
|
93
|
+
}
|
|
94
|
+
return null;
|
|
95
|
+
}
|
package/src/routes/recordings.ts
CHANGED
|
@@ -4,6 +4,7 @@ import {
|
|
|
4
4
|
CreateRecordingLiveSessionRequest,
|
|
5
5
|
CreateRecordingPersonRequest,
|
|
6
6
|
CreateRecordingRequest,
|
|
7
|
+
UpcomingMeetingsResponse,
|
|
7
8
|
CreateRecordingTranscriptRequest,
|
|
8
9
|
CreateRecordingUploadsRequest,
|
|
9
10
|
RecordingCapturePurpose,
|
|
@@ -100,7 +101,11 @@ import {
|
|
|
100
101
|
type SpeechToTextDeployment,
|
|
101
102
|
} from "@opengeni/core/transcription-service";
|
|
102
103
|
import { creditDebitAttributionForGrant } from "../access-grant-rls";
|
|
103
|
-
import {
|
|
104
|
+
import {
|
|
105
|
+
meetingCalendarLookup,
|
|
106
|
+
meetingCalendarTitle,
|
|
107
|
+
upcomingMeetings,
|
|
108
|
+
} from "../meeting-calendar-title";
|
|
104
109
|
import { errorMessage } from "@opengeni/contracts/values";
|
|
105
110
|
|
|
106
111
|
const UPLOAD_URL_SECONDS = 15 * 60;
|
|
@@ -925,7 +930,11 @@ export function registerRecordingRoutes(
|
|
|
925
930
|
reason: problem.reason,
|
|
926
931
|
}),
|
|
927
932
|
}),
|
|
928
|
-
{
|
|
933
|
+
{
|
|
934
|
+
subjectId: actor.subjectId,
|
|
935
|
+
at: startedAt,
|
|
936
|
+
...(body.calendarEvent ? { event: body.calendarEvent } : {}),
|
|
937
|
+
},
|
|
929
938
|
)
|
|
930
939
|
: null,
|
|
931
940
|
]);
|
|
@@ -942,7 +951,10 @@ export function registerRecordingRoutes(
|
|
|
942
951
|
visibility: body.visibility ?? settings.defaultVisibility ?? "private",
|
|
943
952
|
startedAt,
|
|
944
953
|
externalRef: body.externalRef,
|
|
945
|
-
|
|
954
|
+
// The calendar event it was started for stays with it.
|
|
955
|
+
metadata: body.calendarEvent
|
|
956
|
+
? { ...body.metadata, calendarEvent: body.calendarEvent }
|
|
957
|
+
: body.metadata,
|
|
946
958
|
tracks: body.tracks,
|
|
947
959
|
transcription,
|
|
948
960
|
ownerName,
|
|
@@ -959,6 +971,30 @@ export function registerRecordingRoutes(
|
|
|
959
971
|
return c.json(result.recording, result.created ? 201 : 200);
|
|
960
972
|
});
|
|
961
973
|
|
|
974
|
+
// The caller's own meetings about to start, with the links that join them,
|
|
975
|
+
// for a reminder that joins one and starts its recording (the desktop app's).
|
|
976
|
+
app.get("/v1/workspaces/:workspaceId/upcoming-meetings", async (c) => {
|
|
977
|
+
const actor = await actorFor(c, "sessions:read");
|
|
978
|
+
const result = await upcomingMeetings(
|
|
979
|
+
meetingCalendarLookup({
|
|
980
|
+
db,
|
|
981
|
+
settings: deps.settings,
|
|
982
|
+
workspaceId: actor.workspaceId,
|
|
983
|
+
subjectId: actor.subjectId,
|
|
984
|
+
...(deps.meetingCalendarFetch ? { fetch: deps.meetingCalendarFetch } : {}),
|
|
985
|
+
onProblem: (problem) =>
|
|
986
|
+
observability?.warn("couldn't read the caller's calendar for upcoming meetings", {
|
|
987
|
+
workspaceId: actor.workspaceId,
|
|
988
|
+
providerDomain: problem.providerDomain,
|
|
989
|
+
reason: problem.reason,
|
|
990
|
+
}),
|
|
991
|
+
}),
|
|
992
|
+
{ subjectId: actor.subjectId, now: new Date() },
|
|
993
|
+
);
|
|
994
|
+
c.header("Cache-Control", "no-store");
|
|
995
|
+
return c.json(UpcomingMeetingsResponse.parse(result));
|
|
996
|
+
});
|
|
997
|
+
|
|
962
998
|
app.get(`${base}/:recordingId`, async (c) => {
|
|
963
999
|
const actor = await actorFor(c, "sessions:read");
|
|
964
1000
|
return c.json(
|