@k-msg/webhook 0.15.0 → 0.17.0
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/README.md +31 -3
- package/README_ko.md +31 -4
- package/dist/dispatcher/batch.dispatcher.d.ts +1 -1
- package/dist/dispatcher/load-balancer.d.ts +1 -1
- package/dist/dispatcher/queue.manager.d.ts +2 -1
- package/dist/dispatcher/types.d.ts +2 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +32 -46
- package/dist/index.js.map +21 -17
- package/dist/index.mjs +32 -46
- package/dist/index.mjs.map +21 -17
- package/dist/registry/delivery.store.d.ts +1 -1
- package/dist/registry/endpoint.manager.d.ts +1 -1
- package/dist/registry/event.store.d.ts +1 -1
- package/dist/registry/types.d.ts +2 -0
- package/dist/security/security.manager.d.ts +2 -0
- package/dist/shared/event-emitter.d.ts +15 -0
- package/dist/shared/file-storage.d.ts +9 -0
- package/package.json +7 -7
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Delivery Store
|
|
3
3
|
* 웹훅 전달 기록 저장 및 관리
|
|
4
4
|
*/
|
|
5
|
-
import { EventEmitter } from "
|
|
5
|
+
import { EventEmitter } from "../shared/event-emitter";
|
|
6
6
|
import type { WebhookDelivery } from "../types/webhook.types";
|
|
7
7
|
import type { DeliveryFilter, PaginationOptions, SearchResult, StorageConfig } from "./types";
|
|
8
8
|
export declare class DeliveryStore extends EventEmitter {
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Endpoint Manager
|
|
3
3
|
* 웹훅 엔드포인트 관리를 위한 고급 기능 제공
|
|
4
4
|
*/
|
|
5
|
-
import { EventEmitter } from "
|
|
5
|
+
import { EventEmitter } from "../shared/event-emitter";
|
|
6
6
|
import type { WebhookEndpoint } from "../types/webhook.types";
|
|
7
7
|
import { WebhookEventType } from "../types/webhook.types";
|
|
8
8
|
import type { EndpointFilter, PaginationOptions, SearchResult, StorageConfig } from "./types";
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Event Store
|
|
3
3
|
* 웹훅 이벤트 저장 및 관리
|
|
4
4
|
*/
|
|
5
|
-
import { EventEmitter } from "
|
|
5
|
+
import { EventEmitter } from "../shared/event-emitter";
|
|
6
6
|
import type { WebhookEvent } from "../types/webhook.types";
|
|
7
7
|
import { WebhookEventType } from "../types/webhook.types";
|
|
8
8
|
import type { EventFilter, PaginationOptions, SearchResult, StorageConfig } from "./types";
|
package/dist/registry/types.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Registry Type Definitions
|
|
3
3
|
*/
|
|
4
|
+
import type { FileStorageAdapter } from "../shared/file-storage";
|
|
4
5
|
import type { WebhookEventType } from "../types/webhook.types";
|
|
5
6
|
export interface EndpointFilter {
|
|
6
7
|
status?: "active" | "inactive" | "error" | "suspended";
|
|
@@ -37,6 +38,7 @@ export interface EventFilter {
|
|
|
37
38
|
export interface StorageConfig {
|
|
38
39
|
type: "memory" | "file" | "database";
|
|
39
40
|
filePath?: string;
|
|
41
|
+
fileAdapter?: FileStorageAdapter;
|
|
40
42
|
enableCompression?: boolean;
|
|
41
43
|
maxFileSize?: number;
|
|
42
44
|
connectionString?: string;
|
|
@@ -10,6 +10,7 @@ export interface SecurityConfig {
|
|
|
10
10
|
*/
|
|
11
11
|
export declare class SecurityManager {
|
|
12
12
|
private config;
|
|
13
|
+
private encoder;
|
|
13
14
|
constructor(webhookConfig: Pick<WebhookConfig, "algorithm" | "signatureHeader" | "signaturePrefix">);
|
|
14
15
|
/**
|
|
15
16
|
* Canonical string to sign when a timestamp header is present.
|
|
@@ -49,6 +50,7 @@ export declare class SecurityManager {
|
|
|
49
50
|
* Webhook ID 생성 (추적용)
|
|
50
51
|
*/
|
|
51
52
|
private generateWebhookId;
|
|
53
|
+
private generateSignatureDigest;
|
|
52
54
|
/**
|
|
53
55
|
* Constant-time 문자열 비교 (타이밍 공격 방지)
|
|
54
56
|
*/
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
type Listener = (...args: unknown[]) => void;
|
|
2
|
+
/**
|
|
3
|
+
* Minimal event emitter implementation for runtime-neutral (Edge/Web) usage.
|
|
4
|
+
*/
|
|
5
|
+
export declare class EventEmitter {
|
|
6
|
+
private listenersMap;
|
|
7
|
+
on(eventName: string, listener: Listener): this;
|
|
8
|
+
addListener(eventName: string, listener: Listener): this;
|
|
9
|
+
off(eventName: string, listener: Listener): this;
|
|
10
|
+
removeListener(eventName: string, listener: Listener): this;
|
|
11
|
+
once(eventName: string, listener: Listener): this;
|
|
12
|
+
emit(eventName: string, ...args: unknown[]): boolean;
|
|
13
|
+
removeAllListeners(eventName?: string): this;
|
|
14
|
+
}
|
|
15
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export interface FileStorageAdapter {
|
|
2
|
+
appendFile(filePath: string, data: string): Promise<void>;
|
|
3
|
+
readFile(filePath: string): Promise<string>;
|
|
4
|
+
writeFile(filePath: string, data: string): Promise<void>;
|
|
5
|
+
ensureDirForFile(filePath: string): Promise<void>;
|
|
6
|
+
}
|
|
7
|
+
export declare function requireFileStorageAdapter(adapter: FileStorageAdapter | undefined): FileStorageAdapter;
|
|
8
|
+
export declare function resolveStoragePath(basePath: string, fileName: string): string;
|
|
9
|
+
export declare function isFileNotFoundError(error: unknown): boolean;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@k-msg/webhook",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.17.0",
|
|
4
4
|
"packageManager": "bun@1.3.8",
|
|
5
5
|
"description": "Webhook system for real-time message event notifications",
|
|
6
6
|
"type": "module",
|
|
@@ -18,24 +18,24 @@
|
|
|
18
18
|
"access": "public"
|
|
19
19
|
},
|
|
20
20
|
"scripts": {
|
|
21
|
-
"build": "bun run build:esm && bun run build:cjs && bun run build:types",
|
|
21
|
+
"build": "bun run clean && bun run build:esm && bun run build:cjs && bun run build:types",
|
|
22
22
|
"build:esm": "bun build ./src/index.ts --outdir ./dist --format esm --minify --sourcemap --entry-naming '[name].mjs' --external 'bun:test'",
|
|
23
23
|
"build:cjs": "bun build ./src/index.ts --outdir ./dist --format cjs --minify --sourcemap --entry-naming '[name].js' --external 'bun:test'",
|
|
24
24
|
"build:types": "tsc",
|
|
25
25
|
"dev": "tsc --watch",
|
|
26
26
|
"test": "bun test",
|
|
27
|
-
"clean": "rm -rf dist",
|
|
27
|
+
"clean": "rm -rf dist tsconfig.tsbuildinfo",
|
|
28
28
|
"pack": "bun pm pack",
|
|
29
29
|
"publish": "bun publish --access public"
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"
|
|
33
|
-
"@
|
|
32
|
+
"@k-msg/core": "0.17.0",
|
|
33
|
+
"@noble/hashes": "^1.8.0",
|
|
34
|
+
"zod": "^4.0.14"
|
|
34
35
|
},
|
|
35
36
|
"devDependencies": {
|
|
36
37
|
"typescript": "^5.7.2",
|
|
37
|
-
"@types/bun": "
|
|
38
|
-
"@types/node": "^22.0.0"
|
|
38
|
+
"@types/bun": "^1.3.9"
|
|
39
39
|
},
|
|
40
40
|
"keywords": [
|
|
41
41
|
"webhook",
|