@contractspec/example.meeting-recorder-providers 3.7.6 → 3.7.10
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/.turbo/turbo-build.log +3 -3
- package/AGENTS.md +43 -19
- package/CHANGELOG.md +21 -0
- package/README.md +62 -16
- package/dist/browser/handlers/create-provider.js +2 -2
- package/dist/browser/handlers/get-transcript.js +2 -2
- package/dist/browser/handlers/list-meetings.js +2 -2
- package/dist/browser/handlers/webhook-handler.js +2 -2
- package/dist/browser/index.js +2 -2
- package/dist/handlers/create-provider.js +2 -2
- package/dist/handlers/get-transcript.js +2 -2
- package/dist/handlers/list-meetings.js +2 -2
- package/dist/handlers/webhook-handler.js +2 -2
- package/dist/index.d.ts +3 -3
- package/dist/index.js +2 -2
- package/dist/node/handlers/create-provider.js +2 -2
- package/dist/node/handlers/get-transcript.js +2 -2
- package/dist/node/handlers/list-meetings.js +2 -2
- package/dist/node/handlers/webhook-handler.js +2 -2
- package/dist/node/index.js +2 -2
- package/package.json +8 -8
- package/src/connection.sample.ts +102 -102
- package/src/docs/meeting-recorder-providers.docblock.ts +45 -45
- package/src/example.ts +26 -26
- package/src/handlers/create-provider.ts +84 -84
- package/src/handlers/get-transcript.ts +10 -9
- package/src/handlers/list-meetings.ts +10 -9
- package/src/handlers/webhook-handler.ts +49 -48
- package/src/index.ts +3 -3
- package/src/meeting-recorder-providers.feature.ts +18 -18
- package/tsconfig.json +7 -7
- package/tsdown.config.js +1 -1
|
@@ -1,73 +1,74 @@
|
|
|
1
1
|
import type {
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
MeetingRecorderWebhookEvent,
|
|
3
|
+
MeetingRecorderWebhookRequest,
|
|
4
4
|
} from '@contractspec/lib.contracts-integrations';
|
|
5
5
|
|
|
6
6
|
import {
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
createMeetingRecorderProvider,
|
|
8
|
+
type MeetingRecorderProviderFactoryInput,
|
|
9
9
|
} from './create-provider';
|
|
10
10
|
|
|
11
|
-
export interface MeetingRecorderWebhookHandlerInput
|
|
12
|
-
|
|
11
|
+
export interface MeetingRecorderWebhookHandlerInput
|
|
12
|
+
extends MeetingRecorderProviderFactoryInput {
|
|
13
|
+
request: Request;
|
|
13
14
|
}
|
|
14
15
|
|
|
15
16
|
export async function handleMeetingRecorderWebhook(
|
|
16
|
-
|
|
17
|
+
input: MeetingRecorderWebhookHandlerInput
|
|
17
18
|
): Promise<Response> {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
19
|
+
const { integrationKey, request } = input;
|
|
20
|
+
const provider = createMeetingRecorderProvider(input);
|
|
21
|
+
const rawBody = await request.text();
|
|
22
|
+
const parsedBody = safeJsonParse(rawBody);
|
|
23
|
+
const webhookRequest: MeetingRecorderWebhookRequest = {
|
|
24
|
+
headers: toHeaderRecord(request.headers),
|
|
25
|
+
rawBody,
|
|
26
|
+
parsedBody,
|
|
27
|
+
};
|
|
27
28
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
29
|
+
if (provider.verifyWebhook) {
|
|
30
|
+
const verified = await provider.verifyWebhook(webhookRequest);
|
|
31
|
+
if (!verified) {
|
|
32
|
+
return new Response('Invalid webhook signature', { status: 401 });
|
|
33
|
+
}
|
|
34
|
+
}
|
|
34
35
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
36
|
+
const event = provider.parseWebhook
|
|
37
|
+
? await provider.parseWebhook(webhookRequest)
|
|
38
|
+
: fallbackWebhookEvent(integrationKey, parsedBody ?? rawBody);
|
|
38
39
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
40
|
+
return new Response(JSON.stringify({ status: 'ok', event }), {
|
|
41
|
+
status: 200,
|
|
42
|
+
headers: { 'Content-Type': 'application/json' },
|
|
43
|
+
});
|
|
43
44
|
}
|
|
44
45
|
|
|
45
46
|
function toHeaderRecord(
|
|
46
|
-
|
|
47
|
+
headers: Headers
|
|
47
48
|
): Record<string, string | string[] | undefined> {
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
49
|
+
const record: Record<string, string | string[] | undefined> = {};
|
|
50
|
+
headers.forEach((value, key) => {
|
|
51
|
+
record[key] = value;
|
|
52
|
+
});
|
|
53
|
+
return record;
|
|
53
54
|
}
|
|
54
55
|
|
|
55
56
|
function safeJsonParse(payload: string): unknown | undefined {
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
57
|
+
if (!payload) return undefined;
|
|
58
|
+
try {
|
|
59
|
+
return JSON.parse(payload) as unknown;
|
|
60
|
+
} catch {
|
|
61
|
+
return undefined;
|
|
62
|
+
}
|
|
62
63
|
}
|
|
63
64
|
|
|
64
65
|
function fallbackWebhookEvent(
|
|
65
|
-
|
|
66
|
-
|
|
66
|
+
providerKey: string,
|
|
67
|
+
payload: unknown
|
|
67
68
|
): MeetingRecorderWebhookEvent {
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
69
|
+
return {
|
|
70
|
+
providerKey,
|
|
71
|
+
payload,
|
|
72
|
+
receivedAt: new Date().toISOString(),
|
|
73
|
+
};
|
|
73
74
|
}
|
package/src/index.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
+
export * from './connection.sample';
|
|
2
|
+
export { default as example } from './example';
|
|
1
3
|
export * from './handlers/create-provider';
|
|
2
|
-
export * from './handlers/list-meetings';
|
|
3
4
|
export * from './handlers/get-transcript';
|
|
5
|
+
export * from './handlers/list-meetings';
|
|
4
6
|
export * from './handlers/webhook-handler';
|
|
5
|
-
export * from './connection.sample';
|
|
6
7
|
export * from './meeting-recorder-providers.feature';
|
|
7
|
-
export { default as example } from './example';
|
|
8
8
|
import './docs';
|
|
@@ -1,24 +1,24 @@
|
|
|
1
1
|
import { defineFeature } from '@contractspec/lib.contracts-spec';
|
|
2
2
|
|
|
3
3
|
export const MeetingRecorderProvidersFeature = defineFeature({
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
4
|
+
meta: {
|
|
5
|
+
key: 'meeting-recorder-providers',
|
|
6
|
+
version: '1.0.0',
|
|
7
|
+
title: 'Meeting Recorder Providers',
|
|
8
|
+
description:
|
|
9
|
+
'Meeting recorder provider integration with transcripts and webhook handling',
|
|
10
|
+
domain: 'integration',
|
|
11
|
+
owners: ['@examples'],
|
|
12
|
+
tags: ['meeting', 'recorder', 'transcripts', 'webhooks'],
|
|
13
|
+
stability: 'experimental',
|
|
14
|
+
},
|
|
15
15
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
16
|
+
integrations: [
|
|
17
|
+
{ key: 'meeting-recorder.integration.provider', version: '1.0.0' },
|
|
18
|
+
],
|
|
19
19
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
20
|
+
docs: [
|
|
21
|
+
'docs.examples.meeting-recorder-providers',
|
|
22
|
+
'docs.examples.meeting-recorder-providers.usage',
|
|
23
|
+
],
|
|
24
24
|
});
|
package/tsconfig.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
2
|
+
"extends": "@contractspec/tool.typescript/react-library.json",
|
|
3
|
+
"include": ["src"],
|
|
4
|
+
"exclude": ["node_modules", "dist"],
|
|
5
|
+
"compilerOptions": {
|
|
6
|
+
"rootDir": "src",
|
|
7
|
+
"outDir": "dist"
|
|
8
|
+
}
|
|
9
9
|
}
|
package/tsdown.config.js
CHANGED