Add LINE channel adapter with webhook ingress and gating
This commit is contained in:
@@ -581,6 +581,33 @@ describe('configSchema — bluebubbles', () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe('configSchema — line', () => {
|
||||
const minimalConfig = {
|
||||
telegram: { bot_token: 'test', allowed_chat_ids: [1] },
|
||||
models: { default: { provider: 'anthropic', model: 'claude-3' } },
|
||||
};
|
||||
|
||||
it('accepts line config and defaults optional fields', () => {
|
||||
const result = configSchema.parse({
|
||||
...minimalConfig,
|
||||
line: {
|
||||
channel_access_token: 'line-token',
|
||||
channel_secret: 'line-secret',
|
||||
},
|
||||
});
|
||||
|
||||
expect(result.line).toBeDefined();
|
||||
if (!result.line) {
|
||||
throw new Error('Expected line config');
|
||||
}
|
||||
expect(result.line.channel_access_token).toBe('line-token');
|
||||
expect(result.line.channel_secret).toBe('line-secret');
|
||||
expect(result.line.allowed_source_ids).toEqual([]);
|
||||
expect(result.line.require_mention).toBe(true);
|
||||
expect(result.line.mention_name).toBe('flynn');
|
||||
});
|
||||
});
|
||||
|
||||
describe('configSchema — whatsapp', () => {
|
||||
const minimalConfig = {
|
||||
telegram: { bot_token: 'test', allowed_chat_ids: [1] },
|
||||
|
||||
@@ -503,6 +503,14 @@ const bluebubblesSchema = z.object({
|
||||
mention_name: z.string().default('flynn'),
|
||||
}).optional();
|
||||
|
||||
const lineSchema = z.object({
|
||||
channel_access_token: z.string().min(1, 'LINE channel_access_token is required'),
|
||||
channel_secret: z.string().min(1, 'LINE channel_secret is required'),
|
||||
allowed_source_ids: z.array(z.string()).default([]),
|
||||
require_mention: z.boolean().default(true),
|
||||
mention_name: z.string().default('flynn'),
|
||||
}).optional();
|
||||
|
||||
const browserSchema = z.object({
|
||||
enabled: z.boolean().default(false),
|
||||
executable_path: z.string().optional(),
|
||||
@@ -682,6 +690,7 @@ export const configSchema = z.object({
|
||||
teams: teamsSchema,
|
||||
google_chat: googleChatSchema,
|
||||
bluebubbles: bluebubblesSchema,
|
||||
line: lineSchema,
|
||||
server: serverSchema.default({}),
|
||||
models: modelsSchema,
|
||||
backends: backendsSchema.default({}),
|
||||
|
||||
Reference in New Issue
Block a user