koishi-plugin-github-webhook-pusher 0.0.1

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.
@@ -0,0 +1,6 @@
1
+ /**
2
+ * 命令模块入口
3
+ */
4
+ export { registerTrustCommands } from './trust';
5
+ export { registerSubscriptionCommands } from './subscription';
6
+ export { registerUtilCommands } from './utils';
@@ -0,0 +1,12 @@
1
+ /**
2
+ * 订阅管理命令
3
+ * 需求: 3.1-3.7
4
+ */
5
+ import { Context } from 'koishi';
6
+ import { Config } from '../config';
7
+ /**
8
+ * 注册订阅管理命令
9
+ * @param ctx Koishi 上下文
10
+ * @param config 插件配置
11
+ */
12
+ export declare function registerSubscriptionCommands(ctx: Context, config: Config): void;
@@ -0,0 +1,10 @@
1
+ /**
2
+ * 信任仓库管理命令
3
+ * 需求: 2.1-2.5, 8.3
4
+ */
5
+ import { Context } from 'koishi';
6
+ /**
7
+ * 注册信任仓库管理命令
8
+ * @param ctx Koishi 上下文
9
+ */
10
+ export declare function registerTrustCommands(ctx: Context): void;
@@ -0,0 +1,12 @@
1
+ /**
2
+ * 工具命令
3
+ * 需求: 8.1, 8.2
4
+ */
5
+ import { Context } from 'koishi';
6
+ import { Config } from '../config';
7
+ /**
8
+ * 注册工具命令
9
+ * @param ctx Koishi 上下文
10
+ * @param config 插件配置
11
+ */
12
+ export declare function registerUtilCommands(ctx: Context, config: Config): void;
@@ -0,0 +1,20 @@
1
+ import { Schema } from 'koishi';
2
+ import { EventType } from './types';
3
+ export { EventType };
4
+ export interface Config {
5
+ /** Webhook 接收路径 */
6
+ path: string;
7
+ /** GitHub Webhook Secret */
8
+ secret: string;
9
+ /** 显示用基础 URL */
10
+ baseUrl?: string;
11
+ /** 默认订阅事件 */
12
+ defaultEvents: EventType[];
13
+ /** 调试模式 */
14
+ debug: boolean;
15
+ /** 允许非信任仓库 */
16
+ allowUntrusted: boolean;
17
+ /** 推送并发数 */
18
+ concurrency: number;
19
+ }
20
+ export declare const Config: Schema<Config>;
@@ -0,0 +1,35 @@
1
+ import { Context } from 'koishi';
2
+ import { EventType } from './config';
3
+ declare module 'koishi' {
4
+ interface Tables {
5
+ github_trusted_repos: TrustedRepo;
6
+ github_subscriptions: Subscription;
7
+ github_deliveries: Delivery;
8
+ }
9
+ }
10
+ export interface TrustedRepo {
11
+ id: number;
12
+ repo: string;
13
+ enabled: boolean;
14
+ createdAt: Date;
15
+ updatedAt: Date;
16
+ }
17
+ export interface Subscription {
18
+ id: number;
19
+ platform: string;
20
+ channelId: string;
21
+ guildId: string;
22
+ userId: string;
23
+ repo: string;
24
+ events: EventType[];
25
+ enabled: boolean;
26
+ createdAt: Date;
27
+ updatedAt: Date;
28
+ }
29
+ export interface Delivery {
30
+ deliveryId: string;
31
+ repo: string;
32
+ event: string;
33
+ receivedAt: Date;
34
+ }
35
+ export declare function extendDatabase(ctx: Context): void;
package/lib/index.d.ts ADDED
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Koishi GitHub Webhook 推送插件入口
3
+ * 需求: 1.1, 7.1-7.7
4
+ */
5
+ import { Context } from 'koishi';
6
+ import { Config } from './config';
7
+ /** 插件名称 */
8
+ export declare const name = "github-webhook-pusher";
9
+ /** 声明服务依赖 - 需要 server 服务提供 router 和 database 服务 */
10
+ export declare const inject: string[];
11
+ /** 导出配置 Schema */
12
+ export { Config };
13
+ /**
14
+ * 插件入口函数
15
+ * @param ctx Koishi 上下文
16
+ * @param config 插件配置
17
+ */
18
+ export declare function apply(ctx: Context, config: Config): void;