@teever/ez-hook-effect 0.5.0 → 0.5.19

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.
Files changed (58) hide show
  1. package/dist/errors/WebhookError.d.ts +295 -0
  2. package/dist/errors/WebhookError.js +322 -0
  3. package/dist/errors/WebhookError.js.map +1 -0
  4. package/dist/errors/index.d.ts +1 -0
  5. package/dist/errors/index.js +2 -0
  6. package/dist/errors/index.js.map +1 -0
  7. package/dist/index.d.ts +89 -0
  8. package/dist/index.js +17 -965
  9. package/dist/index.js.map +5 -13
  10. package/dist/layers/Config.d.ts +48 -0
  11. package/dist/layers/Config.js +166 -0
  12. package/dist/layers/Config.js.map +1 -0
  13. package/dist/layers/Default.d.ts +6 -0
  14. package/dist/layers/Default.js +9 -0
  15. package/dist/layers/Default.js.map +1 -0
  16. package/dist/layers/HttpClient.d.ts +84 -0
  17. package/dist/layers/HttpClient.js +209 -0
  18. package/dist/layers/HttpClient.js.map +1 -0
  19. package/dist/layers/index.d.ts +2 -0
  20. package/dist/layers/index.js +3 -0
  21. package/dist/layers/index.js.map +1 -0
  22. package/dist/pipes/Embed.d.ts +51 -0
  23. package/dist/pipes/Embed.js +198 -0
  24. package/dist/pipes/Embed.js.map +1 -0
  25. package/dist/pipes/Webhook.d.ts +38 -0
  26. package/dist/pipes/Webhook.js +46 -0
  27. package/dist/pipes/Webhook.js.map +1 -0
  28. package/dist/pipes/index.d.ts +2 -0
  29. package/dist/pipes/index.js +3 -0
  30. package/dist/pipes/index.js.map +1 -0
  31. package/dist/schemas/Common.d.ts +10 -0
  32. package/dist/schemas/Common.js +30 -0
  33. package/dist/schemas/Common.js.map +1 -0
  34. package/dist/schemas/Discord.d.ts +16 -0
  35. package/dist/schemas/Discord.js +19 -0
  36. package/dist/schemas/Discord.js.map +1 -0
  37. package/dist/schemas/Embed.d.ts +143 -0
  38. package/dist/schemas/Embed.js +139 -0
  39. package/dist/schemas/Embed.js.map +1 -0
  40. package/dist/schemas/Field.d.ts +24 -0
  41. package/dist/schemas/Field.js +25 -0
  42. package/dist/schemas/Field.js.map +1 -0
  43. package/dist/schemas/Webhook.d.ts +88 -0
  44. package/dist/schemas/Webhook.js +87 -0
  45. package/dist/schemas/Webhook.js.map +1 -0
  46. package/dist/schemas/index.d.ts +5 -0
  47. package/dist/schemas/index.js +6 -0
  48. package/dist/schemas/index.js.map +1 -0
  49. package/dist/services/WebhookService.d.ts +94 -0
  50. package/dist/services/WebhookService.js +116 -0
  51. package/dist/services/WebhookService.js.map +1 -0
  52. package/dist/services/index.d.ts +1 -0
  53. package/dist/services/index.js +2 -0
  54. package/dist/services/index.js.map +1 -0
  55. package/dist/utils/normalize.d.ts +1 -0
  56. package/dist/utils/normalize.js +17 -0
  57. package/dist/utils/normalize.js.map +1 -0
  58. package/package.json +56 -55
@@ -0,0 +1,295 @@
1
+ import { type Schema } from "effect";
2
+ declare const WebhookError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => import("effect/Cause").YieldableError & {
3
+ readonly _tag: "WebhookError";
4
+ } & Readonly<A>;
5
+ /**
6
+ * Base error class for all webhook-related errors
7
+ */
8
+ export declare class WebhookError extends WebhookError_base<{
9
+ message: string;
10
+ cause?: unknown;
11
+ }> {
12
+ }
13
+ /**
14
+ * Structured validation issue with path and constraint details
15
+ */
16
+ export interface ValidationIssue {
17
+ /** JSONPath-style path to the invalid field, e.g. "$.embeds[0].fields[2].name" */
18
+ readonly path: string;
19
+ /** Human-readable error message */
20
+ readonly message: string;
21
+ /** Constraint name, e.g. "MaxLength", "MinItems", "Required" */
22
+ readonly constraint?: string;
23
+ /** Expected value or constraint description */
24
+ readonly expected?: string;
25
+ /** Actual value (truncated for large values) */
26
+ readonly actual?: unknown;
27
+ }
28
+ /**
29
+ * Convert Effect Schema ParseError to ValidationIssue array
30
+ */
31
+ export declare const parseErrorToIssues: (error: Schema.SchemaError) => ValidationIssue[];
32
+ /**
33
+ * Create a single ValidationIssue from simple field validation
34
+ */
35
+ export declare const makeIssue: (field: string, message: string, options?: {
36
+ constraint?: string;
37
+ expected?: string;
38
+ actual?: unknown;
39
+ }) => ValidationIssue;
40
+ declare const ValidationError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => import("effect/Cause").YieldableError & {
41
+ readonly _tag: "ValidationError";
42
+ } & Readonly<A>;
43
+ /**
44
+ * Validation errors for webhook data with structured issues
45
+ */
46
+ export declare class ValidationError extends ValidationError_base<{
47
+ /** Human-readable summary message */
48
+ message: string;
49
+ /** Structured validation issues */
50
+ issues: ReadonlyArray<ValidationIssue>;
51
+ /** Legacy: primary field that failed (for backward compatibility) */
52
+ field?: string;
53
+ /** Legacy: value that failed validation (for backward compatibility) */
54
+ value?: unknown;
55
+ }> {
56
+ /**
57
+ * Format issues as a human-readable string
58
+ */
59
+ format(options?: {
60
+ maxIssues?: number;
61
+ }): string;
62
+ /**
63
+ * Create ValidationError from Effect Schema ParseError
64
+ */
65
+ static fromParseError(parseError: Schema.SchemaError, context?: {
66
+ field?: string;
67
+ value?: unknown;
68
+ }): ValidationError;
69
+ /**
70
+ * Create ValidationError from a single issue
71
+ */
72
+ static fromIssue(field: string, message: string, options?: {
73
+ constraint?: string;
74
+ expected?: string;
75
+ actual?: unknown;
76
+ }): ValidationError;
77
+ }
78
+ declare const NetworkError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => import("effect/Cause").YieldableError & {
79
+ readonly _tag: "NetworkError";
80
+ } & Readonly<A>;
81
+ /**
82
+ * Network-related errors
83
+ */
84
+ export declare class NetworkError extends NetworkError_base<{
85
+ message: string;
86
+ statusCode?: number;
87
+ response?: unknown;
88
+ }> {
89
+ }
90
+ declare const RateLimitError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => import("effect/Cause").YieldableError & {
91
+ readonly _tag: "RateLimitError";
92
+ } & Readonly<A>;
93
+ /**
94
+ * Rate limit errors
95
+ */
96
+ export declare class RateLimitError extends RateLimitError_base<{
97
+ message: string;
98
+ retryAfter: number;
99
+ limit?: number;
100
+ remaining?: number;
101
+ reset?: Date;
102
+ }> {
103
+ }
104
+ declare const ConfigError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => import("effect/Cause").YieldableError & {
105
+ readonly _tag: "ConfigError";
106
+ } & Readonly<A>;
107
+ /**
108
+ * Configuration errors
109
+ */
110
+ export declare class ConfigError extends ConfigError_base<{
111
+ message: string;
112
+ parameter: string;
113
+ }> {
114
+ }
115
+ declare const FileError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => import("effect/Cause").YieldableError & {
116
+ readonly _tag: "FileError";
117
+ } & Readonly<A>;
118
+ /**
119
+ * File-related errors
120
+ */
121
+ export declare class FileError extends FileError_base<{
122
+ message: string;
123
+ filename?: string;
124
+ size?: number;
125
+ maxSize?: number;
126
+ }> {
127
+ }
128
+ /**
129
+ * HTTP response error details
130
+ */
131
+ export interface HttpErrorResponse {
132
+ status: number;
133
+ statusText: string;
134
+ headers: Record<string, string>;
135
+ body?: unknown;
136
+ }
137
+ declare const HttpError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => import("effect/Cause").YieldableError & {
138
+ readonly _tag: "HttpError";
139
+ } & Readonly<A>;
140
+ /**
141
+ * HTTP errors with detailed response information
142
+ */
143
+ export declare class HttpError extends HttpError_base<{
144
+ message: string;
145
+ request: {
146
+ method: string;
147
+ url: string;
148
+ };
149
+ response?: HttpErrorResponse;
150
+ }> {
151
+ }
152
+ /**
153
+ * All possible webhook errors
154
+ */
155
+ export type WebhookErrors = WebhookError | ValidationError | NetworkError | RateLimitError | ConfigError | FileError | HttpError;
156
+ /**
157
+ * Create a readable message for any webhook error.
158
+ */
159
+ export declare const formatWebhookError: (error: WebhookErrors, options?: {
160
+ maxIssues?: number;
161
+ }) => string;
162
+ /**
163
+ * Produce a structured log object for any webhook error.
164
+ */
165
+ export declare const webhookErrorToLogObject: (error: WebhookErrors) => {
166
+ tag: "ValidationError";
167
+ message: string;
168
+ issues: readonly ValidationIssue[];
169
+ field: string;
170
+ value: unknown;
171
+ retryAfter?: undefined;
172
+ limit?: undefined;
173
+ remaining?: undefined;
174
+ reset?: undefined;
175
+ request?: undefined;
176
+ response?: undefined;
177
+ statusCode?: undefined;
178
+ parameter?: undefined;
179
+ filename?: undefined;
180
+ size?: undefined;
181
+ maxSize?: undefined;
182
+ cause?: undefined;
183
+ } | {
184
+ tag: "RateLimitError";
185
+ message: string;
186
+ retryAfter: number;
187
+ limit: number;
188
+ remaining: number;
189
+ reset: Date;
190
+ issues?: undefined;
191
+ field?: undefined;
192
+ value?: undefined;
193
+ request?: undefined;
194
+ response?: undefined;
195
+ statusCode?: undefined;
196
+ parameter?: undefined;
197
+ filename?: undefined;
198
+ size?: undefined;
199
+ maxSize?: undefined;
200
+ cause?: undefined;
201
+ } | {
202
+ tag: "HttpError";
203
+ message: string;
204
+ request: {
205
+ method: string;
206
+ url: string;
207
+ };
208
+ response: HttpErrorResponse;
209
+ issues?: undefined;
210
+ field?: undefined;
211
+ value?: undefined;
212
+ retryAfter?: undefined;
213
+ limit?: undefined;
214
+ remaining?: undefined;
215
+ reset?: undefined;
216
+ statusCode?: undefined;
217
+ parameter?: undefined;
218
+ filename?: undefined;
219
+ size?: undefined;
220
+ maxSize?: undefined;
221
+ cause?: undefined;
222
+ } | {
223
+ tag: "NetworkError";
224
+ message: string;
225
+ statusCode: number;
226
+ response: unknown;
227
+ issues?: undefined;
228
+ field?: undefined;
229
+ value?: undefined;
230
+ retryAfter?: undefined;
231
+ limit?: undefined;
232
+ remaining?: undefined;
233
+ reset?: undefined;
234
+ request?: undefined;
235
+ parameter?: undefined;
236
+ filename?: undefined;
237
+ size?: undefined;
238
+ maxSize?: undefined;
239
+ cause?: undefined;
240
+ } | {
241
+ tag: "ConfigError";
242
+ message: string;
243
+ parameter: string;
244
+ issues?: undefined;
245
+ field?: undefined;
246
+ value?: undefined;
247
+ retryAfter?: undefined;
248
+ limit?: undefined;
249
+ remaining?: undefined;
250
+ reset?: undefined;
251
+ request?: undefined;
252
+ response?: undefined;
253
+ statusCode?: undefined;
254
+ filename?: undefined;
255
+ size?: undefined;
256
+ maxSize?: undefined;
257
+ cause?: undefined;
258
+ } | {
259
+ tag: "FileError";
260
+ message: string;
261
+ filename: string;
262
+ size: number;
263
+ maxSize: number;
264
+ issues?: undefined;
265
+ field?: undefined;
266
+ value?: undefined;
267
+ retryAfter?: undefined;
268
+ limit?: undefined;
269
+ remaining?: undefined;
270
+ reset?: undefined;
271
+ request?: undefined;
272
+ response?: undefined;
273
+ statusCode?: undefined;
274
+ parameter?: undefined;
275
+ cause?: undefined;
276
+ } | {
277
+ tag: "WebhookError";
278
+ message: string;
279
+ cause: unknown;
280
+ issues?: undefined;
281
+ field?: undefined;
282
+ value?: undefined;
283
+ retryAfter?: undefined;
284
+ limit?: undefined;
285
+ remaining?: undefined;
286
+ reset?: undefined;
287
+ request?: undefined;
288
+ response?: undefined;
289
+ statusCode?: undefined;
290
+ parameter?: undefined;
291
+ filename?: undefined;
292
+ size?: undefined;
293
+ maxSize?: undefined;
294
+ };
295
+ export {};
@@ -0,0 +1,322 @@
1
+ /* c8 ignore start */
2
+ import { Data } from "effect";
3
+ /**
4
+ * Base error class for all webhook-related errors
5
+ */
6
+ /* c8 ignore stop */
7
+ export class WebhookError extends Data.TaggedError("WebhookError") {
8
+ }
9
+ /**
10
+ * Extract constraint name from Effect Schema error message
11
+ */
12
+ const extractConstraint = (message) => {
13
+ if (message.includes("at most") || message.includes("maximum"))
14
+ return "MaxLength";
15
+ if (message.includes("at least") || message.includes("minimum"))
16
+ return "MinLength";
17
+ if (message.includes("required") || message.includes("missing"))
18
+ return "Required";
19
+ if (message.includes("expected") && message.includes("to be"))
20
+ return "Type";
21
+ if (message.includes("URL") || message.includes("url"))
22
+ return "URL";
23
+ if (message.includes("integer") || message.includes("number"))
24
+ return "Number";
25
+ return undefined;
26
+ };
27
+ /**
28
+ * Truncate large values for error display
29
+ */
30
+ const truncateValue = (value, maxLength = 100) => {
31
+ if (typeof value === "string" && value.length > maxLength) {
32
+ return `${value.slice(0, maxLength)}... (${value.length} chars)`;
33
+ }
34
+ if (Array.isArray(value) && value.length > 5) {
35
+ return `[Array with ${value.length} items]`;
36
+ }
37
+ if (typeof value === "object" && value !== null) {
38
+ const keys = Object.keys(value);
39
+ if (keys.length > 5) {
40
+ return `{Object with ${keys.length} keys}`;
41
+ }
42
+ }
43
+ return value;
44
+ };
45
+ /**
46
+ * Convert Effect Schema ParseIssue path to JSONPath string
47
+ */
48
+ const pathToString = (path) => {
49
+ if (path.length === 0)
50
+ return "$";
51
+ return path.reduce((acc, segment) => {
52
+ if (typeof segment === "number") {
53
+ return `${acc}[${segment}]`;
54
+ }
55
+ return `${acc}.${String(segment)}`;
56
+ }, "$");
57
+ };
58
+ const toArray = (value) => Array.isArray(value) ? value : [value];
59
+ // Helper to safely access issue properties via unknown
60
+ const getIssueProp = (issue, key) => issue[key];
61
+ const extractIssuesFromParseIssue = (issue, currentPath = []) => {
62
+ const issues = [];
63
+ switch (issue._tag) {
64
+ case "InvalidType": {
65
+ const ast = getIssueProp(issue, "ast");
66
+ const message = getIssueProp(issue, "message") ?? `Expected ${ast?._tag}`;
67
+ issues.push({
68
+ path: pathToString(currentPath),
69
+ message,
70
+ constraint: extractConstraint(message) ?? "Type",
71
+ actual: truncateValue(getIssueProp(issue, "actual")),
72
+ });
73
+ break;
74
+ }
75
+ case "Forbidden": {
76
+ issues.push({
77
+ path: pathToString(currentPath),
78
+ message: getIssueProp(issue, "message") ?? "Value is forbidden",
79
+ constraint: "Forbidden",
80
+ });
81
+ break;
82
+ }
83
+ case "MissingKey": {
84
+ issues.push({
85
+ path: pathToString(currentPath),
86
+ message: "Required field is missing",
87
+ constraint: "Required",
88
+ });
89
+ break;
90
+ }
91
+ case "UnexpectedKey": {
92
+ issues.push({
93
+ path: pathToString(currentPath),
94
+ message: getIssueProp(issue, "message") ?? "Unexpected field",
95
+ constraint: "Unexpected",
96
+ actual: truncateValue(getIssueProp(issue, "actual")),
97
+ });
98
+ break;
99
+ }
100
+ case "Pointer": {
101
+ const pathSegments = getIssueProp(issue, "path") ?? [];
102
+ const newPath = [...currentPath, ...pathSegments];
103
+ const nested = getIssueProp(issue, "issue");
104
+ if (nested)
105
+ issues.push(...extractIssuesFromParseIssue(nested, newPath));
106
+ break;
107
+ }
108
+ case "Composite": {
109
+ const rawIssues = getIssueProp(issue, "issues");
110
+ const subIssues = rawIssues ? toArray(rawIssues) : [];
111
+ for (const subIssue of subIssues) {
112
+ issues.push(...extractIssuesFromParseIssue(subIssue, currentPath));
113
+ }
114
+ break;
115
+ }
116
+ case "Filter":
117
+ case "Encoding": {
118
+ const nested = getIssueProp(issue, "issue");
119
+ if (nested)
120
+ issues.push(...extractIssuesFromParseIssue(nested, currentPath));
121
+ break;
122
+ }
123
+ case "InvalidValue":
124
+ case "OneOf":
125
+ case "AnyOf": {
126
+ issues.push({
127
+ path: pathToString(currentPath),
128
+ message: getIssueProp(issue, "message") ?? "Invalid value",
129
+ constraint: "Value",
130
+ actual: truncateValue(getIssueProp(issue, "actual")),
131
+ });
132
+ break;
133
+ }
134
+ default: {
135
+ const message = getIssueProp(issue, "message") ?? "Invalid value";
136
+ const constraint = extractConstraint(message);
137
+ issues.push({
138
+ path: pathToString(currentPath),
139
+ message,
140
+ ...(constraint !== undefined && { constraint }),
141
+ ...(getIssueProp(issue, "actual") !== undefined && {
142
+ actual: truncateValue(getIssueProp(issue, "actual")),
143
+ }),
144
+ });
145
+ break;
146
+ }
147
+ }
148
+ return issues;
149
+ };
150
+ /**
151
+ * Convert Effect Schema ParseError to ValidationIssue array
152
+ */
153
+ export const parseErrorToIssues = (error) => {
154
+ return extractIssuesFromParseIssue(error.issue);
155
+ };
156
+ /**
157
+ * Create a single ValidationIssue from simple field validation
158
+ */
159
+ export const makeIssue = (field, message, options) => {
160
+ const constraint = options?.constraint ?? extractConstraint(message);
161
+ return {
162
+ path: field.startsWith("$") ? field : `$.${field}`,
163
+ message,
164
+ ...(constraint !== undefined && { constraint }),
165
+ ...(options?.expected !== undefined && { expected: options.expected }),
166
+ ...(options?.actual !== undefined && {
167
+ actual: truncateValue(options.actual),
168
+ }),
169
+ };
170
+ };
171
+ /**
172
+ * Validation errors for webhook data with structured issues
173
+ */
174
+ export class ValidationError extends Data.TaggedError("ValidationError") {
175
+ /**
176
+ * Format issues as a human-readable string
177
+ */
178
+ format(options) {
179
+ const maxIssues = options?.maxIssues ?? 10;
180
+ const displayIssues = this.issues.slice(0, maxIssues);
181
+ const lines = displayIssues.map((issue) => {
182
+ let line = ` - ${issue.path}: ${issue.message}`;
183
+ if (issue.constraint) {
184
+ line += ` [${issue.constraint}]`;
185
+ }
186
+ return line;
187
+ });
188
+ if (this.issues.length > maxIssues) {
189
+ lines.push(` ... and ${this.issues.length - maxIssues} more issues`);
190
+ }
191
+ return `${this.message}\n${lines.join("\n")}`;
192
+ }
193
+ /**
194
+ * Create ValidationError from Effect Schema ParseError
195
+ */
196
+ static fromParseError(parseError, context) {
197
+ const issues = parseErrorToIssues(parseError);
198
+ const firstIssue = issues[0];
199
+ const message = issues.length === 1 && firstIssue
200
+ ? firstIssue.message
201
+ : `Validation failed (${issues.length} issues)`;
202
+ return new ValidationError({
203
+ message,
204
+ issues,
205
+ ...(context?.field !== undefined && { field: context.field }),
206
+ ...(context?.value !== undefined && { value: context.value }),
207
+ });
208
+ }
209
+ /**
210
+ * Create ValidationError from a single issue
211
+ */
212
+ static fromIssue(field, message, options) {
213
+ const issue = makeIssue(field, message, options);
214
+ return new ValidationError({
215
+ message,
216
+ issues: [issue],
217
+ field,
218
+ value: options?.actual,
219
+ });
220
+ }
221
+ }
222
+ /**
223
+ * Network-related errors
224
+ */
225
+ export class NetworkError extends Data.TaggedError("NetworkError") {
226
+ }
227
+ /**
228
+ * Rate limit errors
229
+ */
230
+ export class RateLimitError extends Data.TaggedError("RateLimitError") {
231
+ }
232
+ /**
233
+ * Configuration errors
234
+ */
235
+ export class ConfigError extends Data.TaggedError("ConfigError") {
236
+ }
237
+ /**
238
+ * File-related errors
239
+ */
240
+ export class FileError extends Data.TaggedError("FileError") {
241
+ }
242
+ /**
243
+ * HTTP errors with detailed response information
244
+ */
245
+ export class HttpError extends Data.TaggedError("HttpError") {
246
+ }
247
+ /**
248
+ * Create a readable message for any webhook error.
249
+ */
250
+ export const formatWebhookError = (error, options) => {
251
+ switch (error._tag) {
252
+ case "ValidationError":
253
+ return error.format(options);
254
+ case "RateLimitError":
255
+ return `${error.message} (retryAfter=${error.retryAfter}ms)`;
256
+ case "HttpError": {
257
+ const status = error.response?.status;
258
+ return status ? `${error.message} (status=${status})` : error.message;
259
+ }
260
+ default:
261
+ return error.message;
262
+ }
263
+ };
264
+ /**
265
+ * Produce a structured log object for any webhook error.
266
+ */
267
+ export const webhookErrorToLogObject = (error) => {
268
+ switch (error._tag) {
269
+ case "ValidationError":
270
+ return {
271
+ tag: error._tag,
272
+ message: error.message,
273
+ issues: error.issues,
274
+ field: error.field,
275
+ value: error.value,
276
+ };
277
+ case "RateLimitError":
278
+ return {
279
+ tag: error._tag,
280
+ message: error.message,
281
+ retryAfter: error.retryAfter,
282
+ limit: error.limit,
283
+ remaining: error.remaining,
284
+ reset: error.reset,
285
+ };
286
+ case "HttpError":
287
+ return {
288
+ tag: error._tag,
289
+ message: error.message,
290
+ request: error.request,
291
+ response: error.response,
292
+ };
293
+ case "NetworkError":
294
+ return {
295
+ tag: error._tag,
296
+ message: error.message,
297
+ statusCode: error.statusCode,
298
+ response: error.response,
299
+ };
300
+ case "ConfigError":
301
+ return {
302
+ tag: error._tag,
303
+ message: error.message,
304
+ parameter: error.parameter,
305
+ };
306
+ case "FileError":
307
+ return {
308
+ tag: error._tag,
309
+ message: error.message,
310
+ filename: error.filename,
311
+ size: error.size,
312
+ maxSize: error.maxSize,
313
+ };
314
+ default:
315
+ return {
316
+ tag: error._tag,
317
+ message: error.message,
318
+ cause: error.cause,
319
+ };
320
+ }
321
+ };
322
+ //# sourceMappingURL=WebhookError.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"WebhookError.js","sourceRoot":"","sources":["../../src/errors/WebhookError.ts"],"names":[],"mappings":"AAAA,qBAAqB;AACrB,OAAO,EAAE,IAAI,EAAe,MAAM,QAAQ,CAAC;AAE3C;;GAEG;AACH,oBAAoB;AACpB,MAAM,OAAO,YAAa,SAAQ,IAAI,CAAC,WAAW,CAAC,cAAc,CAG/D;CAAG;AAkBL;;GAEG;AACH,MAAM,iBAAiB,GAAG,CAAC,OAAe,EAAsB,EAAE;IACjE,IAAI,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAC,IAAI,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAC;QAC7D,OAAO,WAAW,CAAC;IACpB,IAAI,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAC,IAAI,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAC;QAC9D,OAAO,WAAW,CAAC;IACpB,IAAI,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAC,IAAI,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAC;QAC9D,OAAO,UAAU,CAAC;IACnB,IAAI,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAC,IAAI,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAC;QAAE,OAAO,MAAM,CAAC;IAC7E,IAAI,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC,I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AO;gBACtB,QAAQ,EAAE,KAAK,CAAC,QAAQ;gBACxB,IAAI,EAAE,KAAK,CAAC,IAAI;gBAChB,OAAO,EAAE,KAAK,CAAC,OAAO;aACtB,CAAC;QACH;YACC,OAAO;gBACN,GAAG,EAAE,KAAK,CAAC,IAAI;gBACf,OAAO,EAAE,KAAK,CAAC,OAAO;gBACtB,KAAK,EAAE,KAAK,CAAC,KAAK;aAClB,CAAC;IACJ,CAAC;AACF,CAAC,CAAC"}
@@ -0,0 +1 @@
1
+ export * from "./WebhookError";
@@ -0,0 +1,2 @@
1
+ export * from "./WebhookError";
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/errors/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC"}