@webhooks-cc/sdk 0.3.0 → 0.4.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/dist/index.d.mts CHANGED
@@ -73,6 +73,28 @@ interface SendOptions {
73
73
  /** Request body (will be JSON-serialized if not a string) */
74
74
  body?: unknown;
75
75
  }
76
+ type TemplateProvider = "stripe" | "github" | "shopify" | "twilio";
77
+ /**
78
+ * Options for sending a provider template webhook with signed headers.
79
+ */
80
+ interface SendTemplateOptions {
81
+ /** Provider template to use */
82
+ provider: TemplateProvider;
83
+ /** Provider-specific template preset (uses provider default if omitted) */
84
+ template?: string;
85
+ /** Shared secret used for provider signature generation */
86
+ secret: string;
87
+ /** Provider event/topic name (provider default used if omitted) */
88
+ event?: string;
89
+ /** HTTP method override (default: "POST") */
90
+ method?: string;
91
+ /** Additional headers merged after template headers */
92
+ headers?: Record<string, string>;
93
+ /** Body override; if omitted a provider-specific template body is generated */
94
+ body?: unknown;
95
+ /** Unix timestamp (seconds) override for deterministic signatures in tests */
96
+ timestamp?: number;
97
+ }
76
98
  /**
77
99
  * Options for listing captured requests.
78
100
  */
@@ -228,6 +250,7 @@ declare class WebhooksCC {
228
250
  update: (slug: string, options: UpdateEndpointOptions) => Promise<Endpoint>;
229
251
  delete: (slug: string) => Promise<void>;
230
252
  send: (slug: string, options?: SendOptions) => Promise<Response>;
253
+ sendTemplate: (slug: string, options: SendTemplateOptions) => Promise<Response>;
231
254
  };
232
255
  requests: {
233
256
  list: (endpointSlug: string, options?: ListRequestsOptions) => Promise<Request[]>;
@@ -353,4 +376,4 @@ interface SSEFrame {
353
376
  */
354
377
  declare function parseSSE(stream: ReadableStream<Uint8Array>): AsyncGenerator<SSEFrame, void, undefined>;
355
378
 
356
- export { ApiError, type ClientHooks, type ClientOptions, type CreateEndpointOptions, type Endpoint, type ErrorHookInfo, type ListRequestsOptions, NotFoundError, type OperationDescription, RateLimitError, type Request, type RequestHookInfo, type ResponseHookInfo, type SDKDescription, type SSEFrame, type SendOptions, type SubscribeOptions, TimeoutError, UnauthorizedError, type UpdateEndpointOptions, type WaitForOptions, WebhooksCC, WebhooksCCError, isGitHubWebhook, isLinearWebhook, isPaddleWebhook, isShopifyWebhook, isSlackWebhook, isStripeWebhook, isTwilioWebhook, matchAll, matchAny, matchBodyPath, matchHeader, matchJsonField, matchMethod, parseDuration, parseJsonBody, parseSSE };
379
+ export { ApiError, type ClientHooks, type ClientOptions, type CreateEndpointOptions, type Endpoint, type ErrorHookInfo, type ListRequestsOptions, NotFoundError, type OperationDescription, RateLimitError, type Request, type RequestHookInfo, type ResponseHookInfo, type SDKDescription, type SSEFrame, type SendOptions, type SendTemplateOptions, type SubscribeOptions, type TemplateProvider, TimeoutError, UnauthorizedError, type UpdateEndpointOptions, type WaitForOptions, WebhooksCC, WebhooksCCError, isGitHubWebhook, isLinearWebhook, isPaddleWebhook, isShopifyWebhook, isSlackWebhook, isStripeWebhook, isTwilioWebhook, matchAll, matchAny, matchBodyPath, matchHeader, matchJsonField, matchMethod, parseDuration, parseJsonBody, parseSSE };
package/dist/index.d.ts CHANGED
@@ -73,6 +73,28 @@ interface SendOptions {
73
73
  /** Request body (will be JSON-serialized if not a string) */
74
74
  body?: unknown;
75
75
  }
76
+ type TemplateProvider = "stripe" | "github" | "shopify" | "twilio";
77
+ /**
78
+ * Options for sending a provider template webhook with signed headers.
79
+ */
80
+ interface SendTemplateOptions {
81
+ /** Provider template to use */
82
+ provider: TemplateProvider;
83
+ /** Provider-specific template preset (uses provider default if omitted) */
84
+ template?: string;
85
+ /** Shared secret used for provider signature generation */
86
+ secret: string;
87
+ /** Provider event/topic name (provider default used if omitted) */
88
+ event?: string;
89
+ /** HTTP method override (default: "POST") */
90
+ method?: string;
91
+ /** Additional headers merged after template headers */
92
+ headers?: Record<string, string>;
93
+ /** Body override; if omitted a provider-specific template body is generated */
94
+ body?: unknown;
95
+ /** Unix timestamp (seconds) override for deterministic signatures in tests */
96
+ timestamp?: number;
97
+ }
76
98
  /**
77
99
  * Options for listing captured requests.
78
100
  */
@@ -228,6 +250,7 @@ declare class WebhooksCC {
228
250
  update: (slug: string, options: UpdateEndpointOptions) => Promise<Endpoint>;
229
251
  delete: (slug: string) => Promise<void>;
230
252
  send: (slug: string, options?: SendOptions) => Promise<Response>;
253
+ sendTemplate: (slug: string, options: SendTemplateOptions) => Promise<Response>;
231
254
  };
232
255
  requests: {
233
256
  list: (endpointSlug: string, options?: ListRequestsOptions) => Promise<Request[]>;
@@ -353,4 +376,4 @@ interface SSEFrame {
353
376
  */
354
377
  declare function parseSSE(stream: ReadableStream<Uint8Array>): AsyncGenerator<SSEFrame, void, undefined>;
355
378
 
356
- export { ApiError, type ClientHooks, type ClientOptions, type CreateEndpointOptions, type Endpoint, type ErrorHookInfo, type ListRequestsOptions, NotFoundError, type OperationDescription, RateLimitError, type Request, type RequestHookInfo, type ResponseHookInfo, type SDKDescription, type SSEFrame, type SendOptions, type SubscribeOptions, TimeoutError, UnauthorizedError, type UpdateEndpointOptions, type WaitForOptions, WebhooksCC, WebhooksCCError, isGitHubWebhook, isLinearWebhook, isPaddleWebhook, isShopifyWebhook, isSlackWebhook, isStripeWebhook, isTwilioWebhook, matchAll, matchAny, matchBodyPath, matchHeader, matchJsonField, matchMethod, parseDuration, parseJsonBody, parseSSE };
379
+ export { ApiError, type ClientHooks, type ClientOptions, type CreateEndpointOptions, type Endpoint, type ErrorHookInfo, type ListRequestsOptions, NotFoundError, type OperationDescription, RateLimitError, type Request, type RequestHookInfo, type ResponseHookInfo, type SDKDescription, type SSEFrame, type SendOptions, type SendTemplateOptions, type SubscribeOptions, type TemplateProvider, TimeoutError, UnauthorizedError, type UpdateEndpointOptions, type WaitForOptions, WebhooksCC, WebhooksCCError, isGitHubWebhook, isLinearWebhook, isPaddleWebhook, isShopifyWebhook, isSlackWebhook, isStripeWebhook, isTwilioWebhook, matchAll, matchAny, matchBodyPath, matchHeader, matchJsonField, matchMethod, parseDuration, parseJsonBody, parseSSE };