@bernierllc/webhook-processor 1.3.1 → 1.3.3
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/types.js → LICENSE} +0 -4
- package/package.json +11 -11
- package/dist/errors.d.ts +0 -12
- package/dist/errors.d.ts.map +0 -1
- package/dist/errors.js +0 -21
- package/dist/errors.js.map +0 -1
- package/dist/factory.d.ts +0 -7
- package/dist/factory.d.ts.map +0 -1
- package/dist/factory.js +0 -15
- package/dist/factory.js.map +0 -1
- package/dist/index.d.ts +0 -5
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js +0 -11
- package/dist/index.js.map +0 -1
- package/dist/types.d.ts +0 -78
- package/dist/types.d.ts.map +0 -1
- package/dist/types.js.map +0 -1
- package/dist/webhook-processor.d.ts +0 -55
- package/dist/webhook-processor.d.ts.map +0 -1
- package/dist/webhook-processor.js +0 -310
- package/dist/webhook-processor.js.map +0 -1
|
@@ -1,9 +1,5 @@
|
|
|
1
|
-
/*
|
|
2
1
|
Copyright (c) 2025 Bernier LLC
|
|
3
2
|
|
|
4
3
|
This file is licensed to the client under a limited-use license.
|
|
5
4
|
The client may use and modify this code *only within the scope of the project it was delivered for*.
|
|
6
5
|
Redistribution or use in other products or commercial offerings is not permitted without written consent from Bernier LLC.
|
|
7
|
-
*/
|
|
8
|
-
export {};
|
|
9
|
-
//# sourceMappingURL=types.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bernierllc/webhook-processor",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.3",
|
|
4
4
|
"description": "Webhook event processing service with signature validation, retry logic, and event routing",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -22,16 +22,16 @@
|
|
|
22
22
|
"author": "Bernier LLC",
|
|
23
23
|
"license": "SEE LICENSE IN LICENSE",
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@bernierllc/
|
|
26
|
-
"@bernierllc/
|
|
27
|
-
"@bernierllc/
|
|
28
|
-
"@bernierllc/github-parser": "1.5.
|
|
29
|
-
"@bernierllc/logger": "
|
|
30
|
-
"@bernierllc/neverhub-adapter": "0.4.1",
|
|
31
|
-
"@bernierllc/
|
|
32
|
-
"@bernierllc/
|
|
33
|
-
"@bernierllc/
|
|
34
|
-
"@bernierllc/
|
|
25
|
+
"@bernierllc/crypto-utils": "^1.4.0",
|
|
26
|
+
"@bernierllc/event-emitter": "^1.4.2",
|
|
27
|
+
"@bernierllc/commit-analyzer": "^1.6.2",
|
|
28
|
+
"@bernierllc/github-parser": "^1.5.2",
|
|
29
|
+
"@bernierllc/logger": "^2.0.0",
|
|
30
|
+
"@bernierllc/neverhub-adapter": "^0.4.1",
|
|
31
|
+
"@bernierllc/retry-policy": "^0.7.0",
|
|
32
|
+
"@bernierllc/supabase-client": "^1.5.2",
|
|
33
|
+
"@bernierllc/task-queue-core": "^1.4.2",
|
|
34
|
+
"@bernierllc/webhook-receiver": "^1.5.0"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
37
|
"@types/jest": "^29.5.0",
|
package/dist/errors.d.ts
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
export type WebhookProcessorErrorCode = 'WEBHOOK_PROCESSOR_ERROR' | 'INVALID_INPUT' | 'OPERATION_FAILED';
|
|
2
|
-
export interface WebhookProcessorErrorOptions {
|
|
3
|
-
cause?: Error;
|
|
4
|
-
code?: WebhookProcessorErrorCode;
|
|
5
|
-
context?: Record<string, unknown>;
|
|
6
|
-
}
|
|
7
|
-
export declare class WebhookProcessorError extends Error {
|
|
8
|
-
readonly code: WebhookProcessorErrorCode;
|
|
9
|
-
readonly context?: Record<string, unknown>;
|
|
10
|
-
constructor(message: string, options?: WebhookProcessorErrorOptions);
|
|
11
|
-
}
|
|
12
|
-
//# sourceMappingURL=errors.d.ts.map
|
package/dist/errors.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAQA,MAAM,MAAM,yBAAyB,GACjC,yBAAyB,GACzB,eAAe,GACf,kBAAkB,CAAC;AAEvB,MAAM,WAAW,4BAA4B;IAC3C,KAAK,CAAC,EAAE,KAAK,CAAC;IACd,IAAI,CAAC,EAAE,yBAAyB,CAAC;IACjC,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACnC;AAED,qBAAa,qBAAsB,SAAQ,KAAK;IAC9C,QAAQ,CAAC,IAAI,EAAE,yBAAyB,CAAC;IACzC,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;gBAE/B,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,4BAA4B;CASpE"}
|
package/dist/errors.js
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
Copyright (c) 2025 Bernier LLC
|
|
3
|
-
|
|
4
|
-
This file is licensed to the client under a limited-use license.
|
|
5
|
-
The client may use and modify this code *only within the scope of the project it was delivered for*.
|
|
6
|
-
Redistribution or use in other products or commercial offerings is not permitted without written consent from Bernier LLC.
|
|
7
|
-
*/
|
|
8
|
-
export class WebhookProcessorError extends Error {
|
|
9
|
-
code;
|
|
10
|
-
context;
|
|
11
|
-
constructor(message, options) {
|
|
12
|
-
super(message, options?.cause ? { cause: options.cause } : undefined);
|
|
13
|
-
this.name = 'WebhookProcessorError';
|
|
14
|
-
this.code = options?.code ?? 'WEBHOOK_PROCESSOR_ERROR';
|
|
15
|
-
if (options?.context !== undefined) {
|
|
16
|
-
this.context = options.context;
|
|
17
|
-
}
|
|
18
|
-
Error.captureStackTrace?.(this, this.constructor);
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
//# sourceMappingURL=errors.js.map
|
package/dist/errors.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA;;;;;;EAME;AAaF,MAAM,OAAO,qBAAsB,SAAQ,KAAK;IACrC,IAAI,CAA4B;IAChC,OAAO,CAA2B;IAE3C,YAAY,OAAe,EAAE,OAAsC;QACjE,KAAK,CAAC,OAAO,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,OAAO,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC;QACtE,IAAI,CAAC,IAAI,GAAG,uBAAuB,CAAC;QACpC,IAAI,CAAC,IAAI,GAAG,OAAO,EAAE,IAAI,IAAI,yBAAyB,CAAC;QACvD,IAAI,OAAO,EAAE,OAAO,KAAK,SAAS,EAAE,CAAC;YACnC,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC;QACjC,CAAC;QACD,KAAK,CAAC,iBAAiB,EAAE,CAAC,IAAI,EAAE,IAAI,CAAC,WAAW,CAAC,CAAC;IACpD,CAAC;CACF"}
|
package/dist/factory.d.ts
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { WebhookProcessor } from './webhook-processor';
|
|
2
|
-
import type { WebhookProcessorConfig } from './types';
|
|
3
|
-
/**
|
|
4
|
-
* Create a new WebhookProcessor instance
|
|
5
|
-
*/
|
|
6
|
-
export declare function createWebhookProcessor(config?: WebhookProcessorConfig): WebhookProcessor;
|
|
7
|
-
//# sourceMappingURL=factory.d.ts.map
|
package/dist/factory.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"factory.d.ts","sourceRoot":"","sources":["../src/factory.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,SAAS,CAAC;AAEtD;;GAEG;AACH,wBAAgB,sBAAsB,CAAC,MAAM,CAAC,EAAE,sBAAsB,GAAG,gBAAgB,CAExF"}
|
package/dist/factory.js
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
Copyright (c) 2025 Bernier LLC
|
|
3
|
-
|
|
4
|
-
This file is licensed to the client under a limited-use license.
|
|
5
|
-
The client may use and modify this code *only within the scope of the project it was delivered for*.
|
|
6
|
-
Redistribution or use in other products or commercial offerings is not permitted without written consent from Bernier LLC.
|
|
7
|
-
*/
|
|
8
|
-
import { WebhookProcessor } from './webhook-processor';
|
|
9
|
-
/**
|
|
10
|
-
* Create a new WebhookProcessor instance
|
|
11
|
-
*/
|
|
12
|
-
export function createWebhookProcessor(config) {
|
|
13
|
-
return new WebhookProcessor(config);
|
|
14
|
-
}
|
|
15
|
-
//# sourceMappingURL=factory.js.map
|
package/dist/factory.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"factory.js","sourceRoot":"","sources":["../src/factory.ts"],"names":[],"mappings":"AAAA;;;;;;EAME;AAEF,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAGvD;;GAEG;AACH,MAAM,UAAU,sBAAsB,CAAC,MAA+B;IACpE,OAAO,IAAI,gBAAgB,CAAC,MAAM,CAAC,CAAC;AACtC,CAAC"}
|
package/dist/index.d.ts
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
export { WebhookProcessor } from './webhook-processor';
|
|
2
|
-
export { createWebhookProcessor } from './factory';
|
|
3
|
-
export type { WebhookProcessorConfig, WebhookEventHandler, ProcessedWebhookEvent, ProcessResult, EventRoutingConfig } from './types';
|
|
4
|
-
export { WebhookProcessorError, type WebhookProcessorErrorCode, type WebhookProcessorErrorOptions } from './errors';
|
|
5
|
-
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,EAAE,sBAAsB,EAAE,MAAM,WAAW,CAAC;AACnD,YAAY,EACV,sBAAsB,EACtB,mBAAmB,EACnB,qBAAqB,EACrB,aAAa,EACb,kBAAkB,EACnB,MAAM,SAAS,CAAC;AAEjB,OAAO,EAAE,qBAAqB,EAAE,KAAK,yBAAyB,EAAE,KAAK,4BAA4B,EAAE,MAAM,UAAU,CAAC"}
|
package/dist/index.js
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
Copyright (c) 2025 Bernier LLC
|
|
3
|
-
|
|
4
|
-
This file is licensed to the client under a limited-use license.
|
|
5
|
-
The client may use and modify this code *only within the scope of the project it was delivered for*.
|
|
6
|
-
Redistribution or use in other products or commercial offerings is not permitted without written consent from Bernier LLC.
|
|
7
|
-
*/
|
|
8
|
-
export { WebhookProcessor } from './webhook-processor';
|
|
9
|
-
export { createWebhookProcessor } from './factory';
|
|
10
|
-
export { WebhookProcessorError } from './errors';
|
|
11
|
-
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;EAME;AAEF,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,EAAE,sBAAsB,EAAE,MAAM,WAAW,CAAC;AASnD,OAAO,EAAE,qBAAqB,EAAqE,MAAM,UAAU,CAAC"}
|
package/dist/types.d.ts
DELETED
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
import type { WebhookPayload } from '@bernierllc/webhook-receiver';
|
|
2
|
-
import type { ParsedWebhookEvent } from '@bernierllc/github-parser';
|
|
3
|
-
import type { CommitAnalysisResult } from '@bernierllc/commit-analyzer';
|
|
4
|
-
/**
|
|
5
|
-
* Webhook processor configuration
|
|
6
|
-
*/
|
|
7
|
-
export interface WebhookProcessorConfig {
|
|
8
|
-
/** Enable signature validation */
|
|
9
|
-
enableSignatureValidation?: boolean;
|
|
10
|
-
/** Enable retry logic */
|
|
11
|
-
enableRetries?: boolean;
|
|
12
|
-
/** Maximum retry attempts */
|
|
13
|
-
maxRetries?: number;
|
|
14
|
-
/** Retry delay in milliseconds */
|
|
15
|
-
retryDelay?: number;
|
|
16
|
-
/** Secret key for signature validation */
|
|
17
|
-
secretKey?: string;
|
|
18
|
-
/** Supabase configuration */
|
|
19
|
-
supabaseUrl?: string;
|
|
20
|
-
supabaseAnonKey?: string;
|
|
21
|
-
/** Enable event persistence */
|
|
22
|
-
enablePersistence?: boolean;
|
|
23
|
-
/** Event handlers */
|
|
24
|
-
handlers?: WebhookEventHandler[];
|
|
25
|
-
}
|
|
26
|
-
/**
|
|
27
|
-
* Webhook event handler
|
|
28
|
-
*/
|
|
29
|
-
export interface WebhookEventHandler {
|
|
30
|
-
/** Source to match (e.g., 'github', 'stripe') */
|
|
31
|
-
source: string;
|
|
32
|
-
/** Event type to match (e.g., 'push', 'payment.succeeded') */
|
|
33
|
-
eventType?: string;
|
|
34
|
-
/** Handler function */
|
|
35
|
-
handler: (event: ProcessedWebhookEvent) => Promise<void>;
|
|
36
|
-
/** Priority (higher = executed first) */
|
|
37
|
-
priority?: number;
|
|
38
|
-
}
|
|
39
|
-
/**
|
|
40
|
-
* Processed webhook event
|
|
41
|
-
*/
|
|
42
|
-
export interface ProcessedWebhookEvent {
|
|
43
|
-
/** Original webhook payload */
|
|
44
|
-
payload: WebhookPayload;
|
|
45
|
-
/** Parsed event data (if applicable) */
|
|
46
|
-
parsed?: ParsedWebhookEvent;
|
|
47
|
-
/** Commit analysis result (if applicable) */
|
|
48
|
-
commitAnalysis?: CommitAnalysisResult;
|
|
49
|
-
/** Processing metadata */
|
|
50
|
-
metadata: {
|
|
51
|
-
processedAt: Date;
|
|
52
|
-
processingDuration: number;
|
|
53
|
-
handlerCount: number;
|
|
54
|
-
successCount: number;
|
|
55
|
-
failureCount: number;
|
|
56
|
-
};
|
|
57
|
-
}
|
|
58
|
-
/**
|
|
59
|
-
* Processing result
|
|
60
|
-
*/
|
|
61
|
-
export interface ProcessResult {
|
|
62
|
-
success: boolean;
|
|
63
|
-
eventId: string;
|
|
64
|
-
processedEvent?: ProcessedWebhookEvent;
|
|
65
|
-
error?: string;
|
|
66
|
-
retryCount?: number;
|
|
67
|
-
nextRetryAt?: Date;
|
|
68
|
-
}
|
|
69
|
-
/**
|
|
70
|
-
* Event routing configuration
|
|
71
|
-
*/
|
|
72
|
-
export interface EventRoutingConfig {
|
|
73
|
-
/** Default handler for unmatched events */
|
|
74
|
-
defaultHandler?: (event: ProcessedWebhookEvent) => Promise<void>;
|
|
75
|
-
/** Enable event broadcasting */
|
|
76
|
-
enableBroadcasting?: boolean;
|
|
77
|
-
}
|
|
78
|
-
//# sourceMappingURL=types.d.ts.map
|
package/dist/types.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AACnE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AACpE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AAExE;;GAEG;AACH,MAAM,WAAW,sBAAsB;IACrC,kCAAkC;IAClC,yBAAyB,CAAC,EAAE,OAAO,CAAC;IACpC,yBAAyB;IACzB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,6BAA6B;IAC7B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,kCAAkC;IAClC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,0CAA0C;IAC1C,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,6BAA6B;IAC7B,WAAW,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IAAI,CAAC,CAAC;IACjE,gCAAgC;IAChC,kBAAkB,CAAC,EAAE,OAAO,CAAC;CAC9B"}
|
package/dist/types.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;;;EAME"}
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
import { type WebhookRequest, type WebhookPayload } from '@bernierllc/webhook-receiver';
|
|
2
|
-
import type { WebhookProcessorConfig, WebhookEventHandler, ProcessResult } from './types';
|
|
3
|
-
export declare class WebhookProcessor {
|
|
4
|
-
private logger;
|
|
5
|
-
private receiver;
|
|
6
|
-
private githubParser;
|
|
7
|
-
private commitAnalyzer;
|
|
8
|
-
private taskQueue;
|
|
9
|
-
private eventEmitter;
|
|
10
|
-
private supabase?;
|
|
11
|
-
private handlers;
|
|
12
|
-
private config;
|
|
13
|
-
constructor(config?: WebhookProcessorConfig);
|
|
14
|
-
/**
|
|
15
|
-
* Register an event handler
|
|
16
|
-
*/
|
|
17
|
-
registerHandler(handler: WebhookEventHandler): void;
|
|
18
|
-
/**
|
|
19
|
-
* Remove an event handler
|
|
20
|
-
*/
|
|
21
|
-
removeHandler(handler: WebhookEventHandler): void;
|
|
22
|
-
/**
|
|
23
|
-
* Process a webhook request
|
|
24
|
-
*/
|
|
25
|
-
process(request: WebhookRequest): Promise<ProcessResult>;
|
|
26
|
-
/**
|
|
27
|
-
* Route event to appropriate handlers
|
|
28
|
-
*/
|
|
29
|
-
private routeEvent;
|
|
30
|
-
/**
|
|
31
|
-
* Schedule retry for failed webhook
|
|
32
|
-
*/
|
|
33
|
-
private scheduleRetry;
|
|
34
|
-
/**
|
|
35
|
-
* Persist event to database
|
|
36
|
-
*/
|
|
37
|
-
private persistEvent;
|
|
38
|
-
/**
|
|
39
|
-
* Validate webhook signature
|
|
40
|
-
*/
|
|
41
|
-
validateSignature(payload: WebhookPayload): Promise<boolean>;
|
|
42
|
-
/**
|
|
43
|
-
* Get processing statistics
|
|
44
|
-
*/
|
|
45
|
-
getStats(): {
|
|
46
|
-
totalProcessed: number;
|
|
47
|
-
successCount: number;
|
|
48
|
-
failureCount: number;
|
|
49
|
-
};
|
|
50
|
-
/**
|
|
51
|
-
* Shutdown processor
|
|
52
|
-
*/
|
|
53
|
-
shutdown(): Promise<void>;
|
|
54
|
-
}
|
|
55
|
-
//# sourceMappingURL=webhook-processor.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"webhook-processor.d.ts","sourceRoot":"","sources":["../src/webhook-processor.ts"],"names":[],"mappings":"AASA,OAAO,EAAmB,KAAK,cAAc,EAAE,KAAK,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAOzG,OAAO,KAAK,EACV,sBAAsB,EACtB,mBAAmB,EAEnB,aAAa,EACd,MAAM,SAAS,CAAC;AAEjB,qBAAa,gBAAgB;IAC3B,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,QAAQ,CAAkB;IAClC,OAAO,CAAC,YAAY,CAAe;IACnC,OAAO,CAAC,cAAc,CAAiB;IACvC,OAAO,CAAC,SAAS,CAAY;IAC7B,OAAO,CAAC,YAAY,CAAe;IACnC,OAAO,CAAC,QAAQ,CAAC,CAAiB;IAClC,OAAO,CAAC,QAAQ,CAA6B;IAC7C,OAAO,CAAC,MAAM,CAA8K;gBAEhL,MAAM,GAAE,sBAA2B;IA0D/C;;OAEG;IACH,eAAe,CAAC,OAAO,EAAE,mBAAmB,GAAG,IAAI;IAOnD;;OAEG;IACH,aAAa,CAAC,OAAO,EAAE,mBAAmB,GAAG,IAAI;IAQjD;;OAEG;IACG,OAAO,CAAC,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,aAAa,CAAC;IAuH9D;;OAEG;YACW,UAAU;IAuCxB;;OAEG;YACW,aAAa;IAgB3B;;OAEG;YACW,YAAY;IAwB1B;;OAEG;IACG,iBAAiB,CAAC,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,OAAO,CAAC;IASlE;;OAEG;IACH,QAAQ,IAAI;QAAE,cAAc,EAAE,MAAM,CAAC;QAAC,YAAY,EAAE,MAAM,CAAC;QAAC,YAAY,EAAE,MAAM,CAAA;KAAE;IASlF;;OAEG;IACG,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC;CAIhC"}
|
|
@@ -1,310 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
Copyright (c) 2025 Bernier LLC
|
|
3
|
-
|
|
4
|
-
This file is licensed to the client under a limited-use license.
|
|
5
|
-
The client may use and modify this code *only within the scope of the project it was delivered for*.
|
|
6
|
-
Redistribution or use in other products or commercial offerings is not permitted without written consent from Bernier LLC.
|
|
7
|
-
*/
|
|
8
|
-
import { createLogger } from '@bernierllc/logger';
|
|
9
|
-
import { WebhookReceiver } from '@bernierllc/webhook-receiver';
|
|
10
|
-
import { GitHubParser } from '@bernierllc/github-parser';
|
|
11
|
-
import { CommitAnalyzer } from '@bernierllc/commit-analyzer';
|
|
12
|
-
// Retry policy is used via task queue configuration
|
|
13
|
-
import { TaskQueue, TaskPriority } from '@bernierllc/task-queue-core';
|
|
14
|
-
import { createEventEmitter } from '@bernierllc/event-emitter';
|
|
15
|
-
import { SupabaseClient } from '@bernierllc/supabase-client';
|
|
16
|
-
export class WebhookProcessor {
|
|
17
|
-
logger;
|
|
18
|
-
receiver;
|
|
19
|
-
githubParser;
|
|
20
|
-
commitAnalyzer;
|
|
21
|
-
taskQueue;
|
|
22
|
-
eventEmitter;
|
|
23
|
-
supabase;
|
|
24
|
-
handlers = [];
|
|
25
|
-
config;
|
|
26
|
-
constructor(config = {}) {
|
|
27
|
-
this.logger = createLogger({
|
|
28
|
-
context: {
|
|
29
|
-
service: '@bernierllc/webhook-processor'
|
|
30
|
-
}
|
|
31
|
-
});
|
|
32
|
-
this.config = {
|
|
33
|
-
enableSignatureValidation: config.enableSignatureValidation ?? true,
|
|
34
|
-
enableRetries: config.enableRetries ?? true,
|
|
35
|
-
maxRetries: config.maxRetries ?? 3,
|
|
36
|
-
retryDelay: config.retryDelay ?? 1000,
|
|
37
|
-
enablePersistence: config.enablePersistence ?? false,
|
|
38
|
-
...config
|
|
39
|
-
};
|
|
40
|
-
// Initialize webhook receiver
|
|
41
|
-
this.receiver = new WebhookReceiver({
|
|
42
|
-
signatureSecret: this.config.secretKey,
|
|
43
|
-
signatureAlgorithm: 'hmac-sha256',
|
|
44
|
-
replayProtection: true
|
|
45
|
-
});
|
|
46
|
-
// Initialize parsers
|
|
47
|
-
this.githubParser = new GitHubParser();
|
|
48
|
-
this.commitAnalyzer = new CommitAnalyzer();
|
|
49
|
-
// Initialize task queue (retry policy configured via task queue)
|
|
50
|
-
this.taskQueue = new TaskQueue({
|
|
51
|
-
concurrency: 5,
|
|
52
|
-
enableEvents: true
|
|
53
|
-
});
|
|
54
|
-
// Initialize event emitter
|
|
55
|
-
this.eventEmitter = createEventEmitter();
|
|
56
|
-
// Initialize Supabase if persistence is enabled
|
|
57
|
-
if (this.config.enablePersistence && this.config.supabaseUrl && this.config.supabaseAnonKey) {
|
|
58
|
-
this.supabase = new SupabaseClient({
|
|
59
|
-
url: this.config.supabaseUrl,
|
|
60
|
-
anonKey: this.config.supabaseAnonKey
|
|
61
|
-
});
|
|
62
|
-
}
|
|
63
|
-
// Register handlers
|
|
64
|
-
if (config.handlers) {
|
|
65
|
-
for (const handler of config.handlers) {
|
|
66
|
-
this.registerHandler(handler);
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
this.logger.info('WebhookProcessor initialized', {
|
|
70
|
-
enableSignatureValidation: this.config.enableSignatureValidation,
|
|
71
|
-
enableRetries: this.config.enableRetries,
|
|
72
|
-
enablePersistence: this.config.enablePersistence
|
|
73
|
-
});
|
|
74
|
-
}
|
|
75
|
-
/**
|
|
76
|
-
* Register an event handler
|
|
77
|
-
*/
|
|
78
|
-
registerHandler(handler) {
|
|
79
|
-
this.handlers.push(handler);
|
|
80
|
-
// Sort by priority (higher first)
|
|
81
|
-
this.handlers.sort((a, b) => (b.priority ?? 0) - (a.priority ?? 0));
|
|
82
|
-
this.logger.debug('Handler registered', { source: handler.source, eventType: handler.eventType });
|
|
83
|
-
}
|
|
84
|
-
/**
|
|
85
|
-
* Remove an event handler
|
|
86
|
-
*/
|
|
87
|
-
removeHandler(handler) {
|
|
88
|
-
const index = this.handlers.indexOf(handler);
|
|
89
|
-
if (index > -1) {
|
|
90
|
-
this.handlers.splice(index, 1);
|
|
91
|
-
this.logger.debug('Handler removed', { source: handler.source, eventType: handler.eventType });
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
/**
|
|
95
|
-
* Process a webhook request
|
|
96
|
-
*/
|
|
97
|
-
async process(request) {
|
|
98
|
-
const startTime = Date.now();
|
|
99
|
-
let payload;
|
|
100
|
-
let processedEvent;
|
|
101
|
-
try {
|
|
102
|
-
// 1. Receive and validate webhook
|
|
103
|
-
payload = await this.receiver.processRequest(request);
|
|
104
|
-
if (!payload) {
|
|
105
|
-
return {
|
|
106
|
-
success: false,
|
|
107
|
-
eventId: '',
|
|
108
|
-
error: 'Failed to process webhook request'
|
|
109
|
-
};
|
|
110
|
-
}
|
|
111
|
-
// 2. Parse webhook based on source
|
|
112
|
-
let parsed;
|
|
113
|
-
let commitAnalysis;
|
|
114
|
-
if (payload.source === 'github') {
|
|
115
|
-
parsed = this.githubParser.parse(payload.data);
|
|
116
|
-
// Analyze commits if this is a push event
|
|
117
|
-
if (parsed.type === 'push' && parsed.commits) {
|
|
118
|
-
for (const commit of parsed.commits) {
|
|
119
|
-
const analysis = this.commitAnalyzer.analyze({
|
|
120
|
-
sha: commit.sha,
|
|
121
|
-
message: commit.message,
|
|
122
|
-
author: commit.author,
|
|
123
|
-
branch: parsed.branch || 'main',
|
|
124
|
-
additions: commit.additions,
|
|
125
|
-
deletions: commit.deletions,
|
|
126
|
-
files: commit.files,
|
|
127
|
-
timestamp: commit.timestamp
|
|
128
|
-
});
|
|
129
|
-
if (analysis.interesting) {
|
|
130
|
-
commitAnalysis = analysis;
|
|
131
|
-
break; // Use first interesting commit
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
}
|
|
136
|
-
// 3. Create processed event
|
|
137
|
-
processedEvent = {
|
|
138
|
-
payload,
|
|
139
|
-
parsed,
|
|
140
|
-
commitAnalysis,
|
|
141
|
-
metadata: {
|
|
142
|
-
processedAt: new Date(),
|
|
143
|
-
processingDuration: Date.now() - startTime,
|
|
144
|
-
handlerCount: 0,
|
|
145
|
-
successCount: 0,
|
|
146
|
-
failureCount: 0
|
|
147
|
-
}
|
|
148
|
-
};
|
|
149
|
-
// 4. Persist event if enabled
|
|
150
|
-
if (this.config.enablePersistence && this.supabase) {
|
|
151
|
-
await this.persistEvent(processedEvent);
|
|
152
|
-
}
|
|
153
|
-
// 5. Route to handlers
|
|
154
|
-
const routingResult = await this.routeEvent(processedEvent);
|
|
155
|
-
processedEvent.metadata.handlerCount = routingResult.handlerCount;
|
|
156
|
-
processedEvent.metadata.successCount = routingResult.successCount;
|
|
157
|
-
processedEvent.metadata.failureCount = routingResult.failureCount;
|
|
158
|
-
// 6. Emit event
|
|
159
|
-
this.eventEmitter.emit('webhook.processed', {
|
|
160
|
-
eventId: payload.id,
|
|
161
|
-
source: payload.source,
|
|
162
|
-
eventType: payload.event,
|
|
163
|
-
success: routingResult.successCount > 0
|
|
164
|
-
});
|
|
165
|
-
this.logger.info('Webhook processed successfully', {
|
|
166
|
-
eventId: payload.id,
|
|
167
|
-
source: payload.source,
|
|
168
|
-
eventType: payload.event,
|
|
169
|
-
handlerCount: routingResult.handlerCount,
|
|
170
|
-
successCount: routingResult.successCount
|
|
171
|
-
});
|
|
172
|
-
return {
|
|
173
|
-
success: true,
|
|
174
|
-
eventId: payload.id,
|
|
175
|
-
processedEvent
|
|
176
|
-
};
|
|
177
|
-
}
|
|
178
|
-
catch (error) {
|
|
179
|
-
const errorMessage = error instanceof Error ? error.message : 'Unknown error';
|
|
180
|
-
this.logger.error('Error processing webhook', error instanceof Error ? error : new Error(errorMessage), {
|
|
181
|
-
eventId: payload?.id
|
|
182
|
-
});
|
|
183
|
-
// Retry if enabled
|
|
184
|
-
if (this.config.enableRetries && payload) {
|
|
185
|
-
const retryResult = await this.scheduleRetry(payload, errorMessage);
|
|
186
|
-
return {
|
|
187
|
-
success: false,
|
|
188
|
-
eventId: payload.id,
|
|
189
|
-
error: errorMessage,
|
|
190
|
-
retryCount: retryResult.retryCount,
|
|
191
|
-
nextRetryAt: retryResult.nextRetryAt
|
|
192
|
-
};
|
|
193
|
-
}
|
|
194
|
-
return {
|
|
195
|
-
success: false,
|
|
196
|
-
eventId: payload?.id || '',
|
|
197
|
-
error: errorMessage
|
|
198
|
-
};
|
|
199
|
-
}
|
|
200
|
-
}
|
|
201
|
-
/**
|
|
202
|
-
* Route event to appropriate handlers
|
|
203
|
-
*/
|
|
204
|
-
async routeEvent(event) {
|
|
205
|
-
const matchingHandlers = this.handlers.filter(handler => {
|
|
206
|
-
if (handler.source !== event.payload.source) {
|
|
207
|
-
return false;
|
|
208
|
-
}
|
|
209
|
-
if (handler.eventType && handler.eventType !== event.payload.event) {
|
|
210
|
-
return false;
|
|
211
|
-
}
|
|
212
|
-
return true;
|
|
213
|
-
});
|
|
214
|
-
let successCount = 0;
|
|
215
|
-
let failureCount = 0;
|
|
216
|
-
// Execute handlers in parallel
|
|
217
|
-
const handlerPromises = matchingHandlers.map(async (handler) => {
|
|
218
|
-
try {
|
|
219
|
-
await handler.handler(event);
|
|
220
|
-
successCount++;
|
|
221
|
-
return { success: true };
|
|
222
|
-
}
|
|
223
|
-
catch (error) {
|
|
224
|
-
failureCount++;
|
|
225
|
-
this.logger.error('Handler execution failed', error instanceof Error ? error : new Error(String(error)), {
|
|
226
|
-
source: handler.source,
|
|
227
|
-
eventType: handler.eventType
|
|
228
|
-
});
|
|
229
|
-
return { success: false, error };
|
|
230
|
-
}
|
|
231
|
-
});
|
|
232
|
-
await Promise.allSettled(handlerPromises);
|
|
233
|
-
return {
|
|
234
|
-
handlerCount: matchingHandlers.length,
|
|
235
|
-
successCount,
|
|
236
|
-
failureCount
|
|
237
|
-
};
|
|
238
|
-
}
|
|
239
|
-
/**
|
|
240
|
-
* Schedule retry for failed webhook
|
|
241
|
-
*/
|
|
242
|
-
async scheduleRetry(payload, _error) {
|
|
243
|
-
// Add to task queue for retry
|
|
244
|
-
const retryCount = 0; // This would be tracked in a real implementation
|
|
245
|
-
const nextRetryAt = new Date(Date.now() + this.config.retryDelay);
|
|
246
|
-
await this.taskQueue.add({
|
|
247
|
-
id: `retry-${payload.id}-${Date.now()}`,
|
|
248
|
-
handler: async () => {
|
|
249
|
-
// Retry logic would go here
|
|
250
|
-
this.logger.debug('Retrying webhook', { eventId: payload.id, retryCount });
|
|
251
|
-
}
|
|
252
|
-
}, TaskPriority.LOW);
|
|
253
|
-
return { retryCount, nextRetryAt };
|
|
254
|
-
}
|
|
255
|
-
/**
|
|
256
|
-
* Persist event to database
|
|
257
|
-
*/
|
|
258
|
-
async persistEvent(event) {
|
|
259
|
-
if (!this.supabase) {
|
|
260
|
-
return;
|
|
261
|
-
}
|
|
262
|
-
try {
|
|
263
|
-
await this.supabase.insert('webhook_events', {
|
|
264
|
-
event_id: event.payload.id,
|
|
265
|
-
source: event.payload.source,
|
|
266
|
-
event_type: event.payload.event,
|
|
267
|
-
payload: event.payload.data,
|
|
268
|
-
processed_at: event.metadata.processedAt.toISOString(),
|
|
269
|
-
processing_duration: event.metadata.processingDuration,
|
|
270
|
-
handler_count: event.metadata.handlerCount,
|
|
271
|
-
success_count: event.metadata.successCount,
|
|
272
|
-
failure_count: event.metadata.failureCount
|
|
273
|
-
});
|
|
274
|
-
}
|
|
275
|
-
catch (error) {
|
|
276
|
-
this.logger.error('Failed to persist event', error instanceof Error ? error : new Error(String(error)), {
|
|
277
|
-
eventId: event.payload.id
|
|
278
|
-
});
|
|
279
|
-
}
|
|
280
|
-
}
|
|
281
|
-
/**
|
|
282
|
-
* Validate webhook signature
|
|
283
|
-
*/
|
|
284
|
-
async validateSignature(payload) {
|
|
285
|
-
if (!this.config.enableSignatureValidation || !this.config.secretKey) {
|
|
286
|
-
return true; // Skip validation if disabled
|
|
287
|
-
}
|
|
288
|
-
// Signature validation is handled by WebhookReceiver
|
|
289
|
-
return payload.signature !== undefined;
|
|
290
|
-
}
|
|
291
|
-
/**
|
|
292
|
-
* Get processing statistics
|
|
293
|
-
*/
|
|
294
|
-
getStats() {
|
|
295
|
-
// This would track statistics in a real implementation
|
|
296
|
-
return {
|
|
297
|
-
totalProcessed: 0,
|
|
298
|
-
successCount: 0,
|
|
299
|
-
failureCount: 0
|
|
300
|
-
};
|
|
301
|
-
}
|
|
302
|
-
/**
|
|
303
|
-
* Shutdown processor
|
|
304
|
-
*/
|
|
305
|
-
async shutdown() {
|
|
306
|
-
this.logger.info('Shutting down WebhookProcessor');
|
|
307
|
-
// Cleanup would go here
|
|
308
|
-
}
|
|
309
|
-
}
|
|
310
|
-
//# sourceMappingURL=webhook-processor.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"webhook-processor.js","sourceRoot":"","sources":["../src/webhook-processor.ts"],"names":[],"mappings":"AAAA;;;;;;EAME;AAEF,OAAO,EAAE,YAAY,EAAU,MAAM,oBAAoB,CAAC;AAC1D,OAAO,EAAE,eAAe,EAA4C,MAAM,8BAA8B,CAAC;AACzG,OAAO,EAAE,YAAY,EAA2B,MAAM,2BAA2B,CAAC;AAClF,OAAO,EAAE,cAAc,EAA6B,MAAM,6BAA6B,CAAC;AACxF,oDAAoD;AACpD,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AACtE,OAAO,EAAE,kBAAkB,EAAgB,MAAM,2BAA2B,CAAC;AAC7E,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAQ7D,MAAM,OAAO,gBAAgB;IACnB,MAAM,CAAS;IACf,QAAQ,CAAkB;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