@webhooks-cc/sdk 1.0.1 → 1.1.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.
@@ -131,7 +131,7 @@ interface SendOptions {
131
131
  /** Request body (will be JSON-serialized if not a string) */
132
132
  body?: unknown;
133
133
  }
134
- type TemplateProvider = "stripe" | "github" | "shopify" | "twilio" | "slack" | "paddle" | "linear" | "standard-webhooks";
134
+ type TemplateProvider = "stripe" | "github" | "shopify" | "twilio" | "slack" | "paddle" | "linear" | "sendgrid" | "clerk" | "discord" | "vercel" | "gitlab" | "standard-webhooks";
135
135
  /** Static metadata describing a supported template provider. */
136
136
  interface TemplateProviderInfo {
137
137
  /** Provider identifier used by sendTemplate()/sendTo() */
@@ -342,7 +342,7 @@ interface SignatureVerificationResult {
342
342
  valid: boolean;
343
343
  }
344
344
  /** Providers supported by verifySignature(). */
345
- type VerifyProvider = TemplateProvider | "discord";
345
+ type VerifyProvider = TemplateProvider;
346
346
  /**
347
347
  * Options for verifying a captured webhook signature.
348
348
  * For Twilio, `url` is required because the signature covers the full webhook URL.
@@ -131,7 +131,7 @@ interface SendOptions {
131
131
  /** Request body (will be JSON-serialized if not a string) */
132
132
  body?: unknown;
133
133
  }
134
- type TemplateProvider = "stripe" | "github" | "shopify" | "twilio" | "slack" | "paddle" | "linear" | "standard-webhooks";
134
+ type TemplateProvider = "stripe" | "github" | "shopify" | "twilio" | "slack" | "paddle" | "linear" | "sendgrid" | "clerk" | "discord" | "vercel" | "gitlab" | "standard-webhooks";
135
135
  /** Static metadata describing a supported template provider. */
136
136
  interface TemplateProviderInfo {
137
137
  /** Provider identifier used by sendTemplate()/sendTo() */
@@ -342,7 +342,7 @@ interface SignatureVerificationResult {
342
342
  valid: boolean;
343
343
  }
344
344
  /** Providers supported by verifySignature(). */
345
- type VerifyProvider = TemplateProvider | "discord";
345
+ type VerifyProvider = TemplateProvider;
346
346
  /**
347
347
  * Options for verifying a captured webhook signature.
348
348
  * For Twilio, `url` is required because the signature covers the full webhook URL.
package/dist/index.d.mts CHANGED
@@ -1,5 +1,5 @@
1
- import { R as Request, P as ParsedBody, a as ParsedFormBody, S as SearchResult, V as VerifySignatureOptions, b as SignatureVerificationResult } from './diff-BlDnipA4.mjs';
2
- export { A as ApiError, B as BodyDiff, C as ClearRequestsOptions, c as ClientHooks, d as ClientOptions, e as CreateEndpointOptions, f as CurlExport, D as DiffRequestsOptions, g as DiffResult, E as Endpoint, h as ErrorHookInfo, i as ExportRequestsOptions, F as FormBodyValue, H as HarExport, j as HeaderDiff, J as JsonBodyDiff, L as ListPaginatedRequestsOptions, k as ListRequestsOptions, M as MockResponse, N as NotFoundError, O as OperationDescription, l as PaginatedResult, m as RateLimitError, n as RequestDifferences, o as RequestHookInfo, p as RequestsExport, q as ResponseHookInfo, r as RetryOptions, s as SDKDescription, t as SearchFilters, u as SendOptions, v as SendTemplateOptions, w as SendToOptions, x as SubscribeOptions, T as TemplateProvider, y as TemplateProviderInfo, z as TextBodyDiff, G as TimeoutError, U as UnauthorizedError, I as UpdateEndpointOptions, K as UsageInfo, Q as ValueDifference, W as VerifyProvider, X as WaitForAllOptions, Y as WaitForOptions, Z as WebhookFlowBuilder, _ as WebhookFlowResult, $ as WebhookFlowVerifyOptions, a0 as WebhooksCC, a1 as WebhooksCCError, a2 as diffRequests } from './diff-BlDnipA4.mjs';
1
+ import { R as Request, P as ParsedBody, a as ParsedFormBody, S as SearchResult, V as VerifySignatureOptions, b as SignatureVerificationResult } from './diff-C6vrhcEq.mjs';
2
+ export { A as ApiError, B as BodyDiff, C as ClearRequestsOptions, c as ClientHooks, d as ClientOptions, e as CreateEndpointOptions, f as CurlExport, D as DiffRequestsOptions, g as DiffResult, E as Endpoint, h as ErrorHookInfo, i as ExportRequestsOptions, F as FormBodyValue, H as HarExport, j as HeaderDiff, J as JsonBodyDiff, L as ListPaginatedRequestsOptions, k as ListRequestsOptions, M as MockResponse, N as NotFoundError, O as OperationDescription, l as PaginatedResult, m as RateLimitError, n as RequestDifferences, o as RequestHookInfo, p as RequestsExport, q as ResponseHookInfo, r as RetryOptions, s as SDKDescription, t as SearchFilters, u as SendOptions, v as SendTemplateOptions, w as SendToOptions, x as SubscribeOptions, T as TemplateProvider, y as TemplateProviderInfo, z as TextBodyDiff, G as TimeoutError, U as UnauthorizedError, I as UpdateEndpointOptions, K as UsageInfo, Q as ValueDifference, W as VerifyProvider, X as WaitForAllOptions, Y as WaitForOptions, Z as WebhookFlowBuilder, _ as WebhookFlowResult, $ as WebhookFlowVerifyOptions, a0 as WebhooksCC, a1 as WebhooksCCError, a2 as diffRequests } from './diff-C6vrhcEq.mjs';
3
3
 
4
4
  /**
5
5
  * Safely parse a JSON request body.
@@ -55,6 +55,26 @@ declare function isPaddleWebhook(request: Request): boolean;
55
55
  declare function isLinearWebhook(request: Request): boolean;
56
56
  /** Check if a request looks like a Discord interaction webhook. */
57
57
  declare function isDiscordWebhook(request: Request): boolean;
58
+ /**
59
+ * Check if a request looks like a SendGrid event webhook.
60
+ * Matches on the body being a JSON array with an sg_event_id field.
61
+ */
62
+ declare function isSendGridWebhook(request: Request): boolean;
63
+ /**
64
+ * Check if a request looks like a Clerk webhook.
65
+ * Matches on the `svix-id` header being present.
66
+ */
67
+ declare function isClerkWebhook(request: Request): boolean;
68
+ /**
69
+ * Check if a request looks like a Vercel webhook.
70
+ * Matches on the `x-vercel-signature` header being present.
71
+ */
72
+ declare function isVercelWebhook(request: Request): boolean;
73
+ /**
74
+ * Check if a request looks like a GitLab webhook.
75
+ * Matches on the `x-gitlab-event` or `x-gitlab-token` header being present.
76
+ */
77
+ declare function isGitLabWebhook(request: Request): boolean;
58
78
  /**
59
79
  * Check if a request looks like a Standard Webhooks request.
60
80
  * Matches on the presence of all three Standard Webhooks headers:
@@ -177,6 +197,42 @@ declare const TEMPLATE_METADATA: Readonly<{
177
197
  signatureHeader: "linear-signature";
178
198
  signatureAlgorithm: "hmac-sha256";
179
199
  }>;
200
+ sendgrid: Readonly<{
201
+ provider: "sendgrid";
202
+ templates: readonly ("delivered" | "open" | "bounce" | "spam_report")[];
203
+ defaultTemplate: "delivered";
204
+ secretRequired: false;
205
+ }>;
206
+ clerk: Readonly<{
207
+ provider: "clerk";
208
+ templates: readonly ("user.created" | "user.updated" | "user.deleted" | "session.created")[];
209
+ defaultTemplate: "user.created";
210
+ secretRequired: true;
211
+ signatureHeader: "webhook-signature";
212
+ signatureAlgorithm: "hmac-sha256";
213
+ }>;
214
+ discord: Readonly<{
215
+ provider: "discord";
216
+ templates: readonly ("interaction_create" | "ping" | "message_component")[];
217
+ defaultTemplate: "interaction_create";
218
+ secretRequired: false;
219
+ }>;
220
+ vercel: Readonly<{
221
+ provider: "vercel";
222
+ templates: readonly ("deployment.created" | "deployment.succeeded" | "deployment.error")[];
223
+ defaultTemplate: "deployment.created";
224
+ secretRequired: true;
225
+ signatureHeader: "x-vercel-signature";
226
+ signatureAlgorithm: "hmac-sha1";
227
+ }>;
228
+ gitlab: Readonly<{
229
+ provider: "gitlab";
230
+ templates: readonly ("push" | "merge_request")[];
231
+ defaultTemplate: "push";
232
+ secretRequired: true;
233
+ signatureHeader: "x-gitlab-token";
234
+ signatureAlgorithm: "token";
235
+ }>;
180
236
  "standard-webhooks": Readonly<{
181
237
  provider: "standard-webhooks";
182
238
  templates: readonly never[];
@@ -215,6 +271,21 @@ declare function verifyPaddleSignature(body: string | undefined, signatureHeader
215
271
  * Verify a Linear webhook signature against the raw request body.
216
272
  */
217
273
  declare function verifyLinearSignature(body: string | undefined, signatureHeader: string | null | undefined, secret: string): Promise<boolean>;
274
+ /**
275
+ * Verify a Vercel webhook signature against the raw request body.
276
+ * Vercel signs with HMAC-SHA1 and sends the hex-encoded signature in x-vercel-signature.
277
+ */
278
+ declare function verifyVercelSignature(body: string | undefined, signatureHeader: string | null | undefined, secret: string): Promise<boolean>;
279
+ /**
280
+ * Verify a GitLab webhook token against the x-gitlab-token header.
281
+ * GitLab sends the raw secret in the header — no HMAC involved.
282
+ */
283
+ declare function verifyGitLabSignature(_body: string | undefined, tokenHeader: string | null | undefined, secret: string): Promise<boolean>;
284
+ /**
285
+ * Verify a Clerk webhook signature using Standard Webhooks (Svix) signing.
286
+ * Delegates to verifyStandardWebhookSignature.
287
+ */
288
+ declare function verifyClerkSignature(body: string | undefined, headers: Record<string, string>, secret: string): Promise<boolean>;
218
289
  /**
219
290
  * Verify a Discord interaction signature using the application's Ed25519 public key.
220
291
  */
@@ -228,4 +299,4 @@ declare function verifyStandardWebhookSignature(body: string | undefined, header
228
299
  */
229
300
  declare function verifySignature(request: VerifyableRequest, options: VerifySignatureOptions): Promise<SignatureVerificationResult>;
230
301
 
231
- export { ParsedBody, ParsedFormBody, Request, type SSEFrame, SearchResult, SignatureVerificationResult, TEMPLATE_METADATA, VerifySignatureOptions, extractJsonField, isDiscordWebhook, isGitHubWebhook, isLinearWebhook, isPaddleWebhook, isShopifyWebhook, isSlackWebhook, isStandardWebhook, isStripeWebhook, isTwilioWebhook, matchAll, matchAny, matchBodyPath, matchBodySubset, matchContentType, matchHeader, matchJsonField, matchMethod, matchPath, matchQueryParam, parseBody, parseDuration, parseFormBody, parseJsonBody, parseSSE, verifyDiscordSignature, verifyGitHubSignature, verifyLinearSignature, verifyPaddleSignature, verifyShopifySignature, verifySignature, verifySlackSignature, verifyStandardWebhookSignature, verifyStripeSignature, verifyTwilioSignature };
302
+ export { ParsedBody, ParsedFormBody, Request, type SSEFrame, SearchResult, SignatureVerificationResult, TEMPLATE_METADATA, VerifySignatureOptions, extractJsonField, isClerkWebhook, isDiscordWebhook, isGitHubWebhook, isGitLabWebhook, isLinearWebhook, isPaddleWebhook, isSendGridWebhook, isShopifyWebhook, isSlackWebhook, isStandardWebhook, isStripeWebhook, isTwilioWebhook, isVercelWebhook, matchAll, matchAny, matchBodyPath, matchBodySubset, matchContentType, matchHeader, matchJsonField, matchMethod, matchPath, matchQueryParam, parseBody, parseDuration, parseFormBody, parseJsonBody, parseSSE, verifyClerkSignature, verifyDiscordSignature, verifyGitHubSignature, verifyGitLabSignature, verifyLinearSignature, verifyPaddleSignature, verifyShopifySignature, verifySignature, verifySlackSignature, verifyStandardWebhookSignature, verifyStripeSignature, verifyTwilioSignature, verifyVercelSignature };
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { R as Request, P as ParsedBody, a as ParsedFormBody, S as SearchResult, V as VerifySignatureOptions, b as SignatureVerificationResult } from './diff-BlDnipA4.js';
2
- export { A as ApiError, B as BodyDiff, C as ClearRequestsOptions, c as ClientHooks, d as ClientOptions, e as CreateEndpointOptions, f as CurlExport, D as DiffRequestsOptions, g as DiffResult, E as Endpoint, h as ErrorHookInfo, i as ExportRequestsOptions, F as FormBodyValue, H as HarExport, j as HeaderDiff, J as JsonBodyDiff, L as ListPaginatedRequestsOptions, k as ListRequestsOptions, M as MockResponse, N as NotFoundError, O as OperationDescription, l as PaginatedResult, m as RateLimitError, n as RequestDifferences, o as RequestHookInfo, p as RequestsExport, q as ResponseHookInfo, r as RetryOptions, s as SDKDescription, t as SearchFilters, u as SendOptions, v as SendTemplateOptions, w as SendToOptions, x as SubscribeOptions, T as TemplateProvider, y as TemplateProviderInfo, z as TextBodyDiff, G as TimeoutError, U as UnauthorizedError, I as UpdateEndpointOptions, K as UsageInfo, Q as ValueDifference, W as VerifyProvider, X as WaitForAllOptions, Y as WaitForOptions, Z as WebhookFlowBuilder, _ as WebhookFlowResult, $ as WebhookFlowVerifyOptions, a0 as WebhooksCC, a1 as WebhooksCCError, a2 as diffRequests } from './diff-BlDnipA4.js';
1
+ import { R as Request, P as ParsedBody, a as ParsedFormBody, S as SearchResult, V as VerifySignatureOptions, b as SignatureVerificationResult } from './diff-C6vrhcEq.js';
2
+ export { A as ApiError, B as BodyDiff, C as ClearRequestsOptions, c as ClientHooks, d as ClientOptions, e as CreateEndpointOptions, f as CurlExport, D as DiffRequestsOptions, g as DiffResult, E as Endpoint, h as ErrorHookInfo, i as ExportRequestsOptions, F as FormBodyValue, H as HarExport, j as HeaderDiff, J as JsonBodyDiff, L as ListPaginatedRequestsOptions, k as ListRequestsOptions, M as MockResponse, N as NotFoundError, O as OperationDescription, l as PaginatedResult, m as RateLimitError, n as RequestDifferences, o as RequestHookInfo, p as RequestsExport, q as ResponseHookInfo, r as RetryOptions, s as SDKDescription, t as SearchFilters, u as SendOptions, v as SendTemplateOptions, w as SendToOptions, x as SubscribeOptions, T as TemplateProvider, y as TemplateProviderInfo, z as TextBodyDiff, G as TimeoutError, U as UnauthorizedError, I as UpdateEndpointOptions, K as UsageInfo, Q as ValueDifference, W as VerifyProvider, X as WaitForAllOptions, Y as WaitForOptions, Z as WebhookFlowBuilder, _ as WebhookFlowResult, $ as WebhookFlowVerifyOptions, a0 as WebhooksCC, a1 as WebhooksCCError, a2 as diffRequests } from './diff-C6vrhcEq.js';
3
3
 
4
4
  /**
5
5
  * Safely parse a JSON request body.
@@ -55,6 +55,26 @@ declare function isPaddleWebhook(request: Request): boolean;
55
55
  declare function isLinearWebhook(request: Request): boolean;
56
56
  /** Check if a request looks like a Discord interaction webhook. */
57
57
  declare function isDiscordWebhook(request: Request): boolean;
58
+ /**
59
+ * Check if a request looks like a SendGrid event webhook.
60
+ * Matches on the body being a JSON array with an sg_event_id field.
61
+ */
62
+ declare function isSendGridWebhook(request: Request): boolean;
63
+ /**
64
+ * Check if a request looks like a Clerk webhook.
65
+ * Matches on the `svix-id` header being present.
66
+ */
67
+ declare function isClerkWebhook(request: Request): boolean;
68
+ /**
69
+ * Check if a request looks like a Vercel webhook.
70
+ * Matches on the `x-vercel-signature` header being present.
71
+ */
72
+ declare function isVercelWebhook(request: Request): boolean;
73
+ /**
74
+ * Check if a request looks like a GitLab webhook.
75
+ * Matches on the `x-gitlab-event` or `x-gitlab-token` header being present.
76
+ */
77
+ declare function isGitLabWebhook(request: Request): boolean;
58
78
  /**
59
79
  * Check if a request looks like a Standard Webhooks request.
60
80
  * Matches on the presence of all three Standard Webhooks headers:
@@ -177,6 +197,42 @@ declare const TEMPLATE_METADATA: Readonly<{
177
197
  signatureHeader: "linear-signature";
178
198
  signatureAlgorithm: "hmac-sha256";
179
199
  }>;
200
+ sendgrid: Readonly<{
201
+ provider: "sendgrid";
202
+ templates: readonly ("delivered" | "open" | "bounce" | "spam_report")[];
203
+ defaultTemplate: "delivered";
204
+ secretRequired: false;
205
+ }>;
206
+ clerk: Readonly<{
207
+ provider: "clerk";
208
+ templates: readonly ("user.created" | "user.updated" | "user.deleted" | "session.created")[];
209
+ defaultTemplate: "user.created";
210
+ secretRequired: true;
211
+ signatureHeader: "webhook-signature";
212
+ signatureAlgorithm: "hmac-sha256";
213
+ }>;
214
+ discord: Readonly<{
215
+ provider: "discord";
216
+ templates: readonly ("interaction_create" | "ping" | "message_component")[];
217
+ defaultTemplate: "interaction_create";
218
+ secretRequired: false;
219
+ }>;
220
+ vercel: Readonly<{
221
+ provider: "vercel";
222
+ templates: readonly ("deployment.created" | "deployment.succeeded" | "deployment.error")[];
223
+ defaultTemplate: "deployment.created";
224
+ secretRequired: true;
225
+ signatureHeader: "x-vercel-signature";
226
+ signatureAlgorithm: "hmac-sha1";
227
+ }>;
228
+ gitlab: Readonly<{
229
+ provider: "gitlab";
230
+ templates: readonly ("push" | "merge_request")[];
231
+ defaultTemplate: "push";
232
+ secretRequired: true;
233
+ signatureHeader: "x-gitlab-token";
234
+ signatureAlgorithm: "token";
235
+ }>;
180
236
  "standard-webhooks": Readonly<{
181
237
  provider: "standard-webhooks";
182
238
  templates: readonly never[];
@@ -215,6 +271,21 @@ declare function verifyPaddleSignature(body: string | undefined, signatureHeader
215
271
  * Verify a Linear webhook signature against the raw request body.
216
272
  */
217
273
  declare function verifyLinearSignature(body: string | undefined, signatureHeader: string | null | undefined, secret: string): Promise<boolean>;
274
+ /**
275
+ * Verify a Vercel webhook signature against the raw request body.
276
+ * Vercel signs with HMAC-SHA1 and sends the hex-encoded signature in x-vercel-signature.
277
+ */
278
+ declare function verifyVercelSignature(body: string | undefined, signatureHeader: string | null | undefined, secret: string): Promise<boolean>;
279
+ /**
280
+ * Verify a GitLab webhook token against the x-gitlab-token header.
281
+ * GitLab sends the raw secret in the header — no HMAC involved.
282
+ */
283
+ declare function verifyGitLabSignature(_body: string | undefined, tokenHeader: string | null | undefined, secret: string): Promise<boolean>;
284
+ /**
285
+ * Verify a Clerk webhook signature using Standard Webhooks (Svix) signing.
286
+ * Delegates to verifyStandardWebhookSignature.
287
+ */
288
+ declare function verifyClerkSignature(body: string | undefined, headers: Record<string, string>, secret: string): Promise<boolean>;
218
289
  /**
219
290
  * Verify a Discord interaction signature using the application's Ed25519 public key.
220
291
  */
@@ -228,4 +299,4 @@ declare function verifyStandardWebhookSignature(body: string | undefined, header
228
299
  */
229
300
  declare function verifySignature(request: VerifyableRequest, options: VerifySignatureOptions): Promise<SignatureVerificationResult>;
230
301
 
231
- export { ParsedBody, ParsedFormBody, Request, type SSEFrame, SearchResult, SignatureVerificationResult, TEMPLATE_METADATA, VerifySignatureOptions, extractJsonField, isDiscordWebhook, isGitHubWebhook, isLinearWebhook, isPaddleWebhook, isShopifyWebhook, isSlackWebhook, isStandardWebhook, isStripeWebhook, isTwilioWebhook, matchAll, matchAny, matchBodyPath, matchBodySubset, matchContentType, matchHeader, matchJsonField, matchMethod, matchPath, matchQueryParam, parseBody, parseDuration, parseFormBody, parseJsonBody, parseSSE, verifyDiscordSignature, verifyGitHubSignature, verifyLinearSignature, verifyPaddleSignature, verifyShopifySignature, verifySignature, verifySlackSignature, verifyStandardWebhookSignature, verifyStripeSignature, verifyTwilioSignature };
302
+ export { ParsedBody, ParsedFormBody, Request, type SSEFrame, SearchResult, SignatureVerificationResult, TEMPLATE_METADATA, VerifySignatureOptions, extractJsonField, isClerkWebhook, isDiscordWebhook, isGitHubWebhook, isGitLabWebhook, isLinearWebhook, isPaddleWebhook, isSendGridWebhook, isShopifyWebhook, isSlackWebhook, isStandardWebhook, isStripeWebhook, isTwilioWebhook, isVercelWebhook, matchAll, matchAny, matchBodyPath, matchBodySubset, matchContentType, matchHeader, matchJsonField, matchMethod, matchPath, matchQueryParam, parseBody, parseDuration, parseFormBody, parseJsonBody, parseSSE, verifyClerkSignature, verifyDiscordSignature, verifyGitHubSignature, verifyGitLabSignature, verifyLinearSignature, verifyPaddleSignature, verifyShopifySignature, verifySignature, verifySlackSignature, verifyStandardWebhookSignature, verifyStripeSignature, verifyTwilioSignature, verifyVercelSignature };