@octokit/webhooks
Advanced tools
Comparing version 13.2.8 to 13.3.0
@@ -351,5 +351,2 @@ // pkg/dist-src/createLogger.js | ||
// pkg/dist-src/event-handler/receive.js | ||
import AggregateError from "aggregate-error"; | ||
// pkg/dist-src/event-handler/wrap-error-handler.js | ||
@@ -383,3 +380,3 @@ function wrapErrorHandler(handler, error) { | ||
if (event instanceof Error) { | ||
const error = Object.assign(new AggregateError([event]), { | ||
const error = Object.assign(new AggregateError([event], event.message), { | ||
event | ||
@@ -391,6 +388,8 @@ }); | ||
if (!event || !event.name) { | ||
throw new AggregateError(["Event name not passed"]); | ||
const error = new Error("Event name not passed"); | ||
throw new AggregateError([error], error.message); | ||
} | ||
if (!event.payload) { | ||
throw new AggregateError(["Event payload not passed"]); | ||
const error = new Error("Event name not passed"); | ||
throw new AggregateError([error], error.message); | ||
} | ||
@@ -419,3 +418,6 @@ const hooks = getHooks( | ||
} | ||
const error = new AggregateError(errors); | ||
const error = new AggregateError( | ||
errors, | ||
errors.map((error2) => error2.message).join("\n") | ||
); | ||
Object.assign(error, { | ||
@@ -470,3 +472,2 @@ event | ||
// pkg/dist-src/verify-and-receive.js | ||
import AggregateError2 from "aggregate-error"; | ||
import { verify } from "@octokit/webhooks-methods"; | ||
@@ -493,3 +494,3 @@ async function verifyAndReceive(state, event) { | ||
error.status = 400; | ||
throw new AggregateError2([error]); | ||
throw new AggregateError([error], error.message); | ||
} | ||
@@ -514,3 +515,2 @@ return state.eventHandler.receive({ | ||
// pkg/dist-src/middleware/node/get-payload.js | ||
import AggregateError3 from "aggregate-error"; | ||
function getPayload(request) { | ||
@@ -524,3 +524,6 @@ if (typeof request.body === "object" && "rawBody" in request && request.rawBody instanceof Buffer) { | ||
let data = []; | ||
request.on("error", (error) => reject(new AggregateError3([error]))); | ||
request.on( | ||
"error", | ||
(error) => reject(new AggregateError([error], error.message)) | ||
); | ||
request.on("data", (chunk) => data.push(chunk)); | ||
@@ -527,0 +530,0 @@ request.on( |
@@ -1,2 +0,1 @@ | ||
import AggregateError from "aggregate-error"; | ||
import { wrapErrorHandler } from "./wrap-error-handler.js"; | ||
@@ -13,3 +12,3 @@ function getHooks(state, eventPayloadAction, eventName) { | ||
if (event instanceof Error) { | ||
const error = Object.assign(new AggregateError([event]), { | ||
const error = Object.assign(new AggregateError([event], event.message), { | ||
event | ||
@@ -21,6 +20,8 @@ }); | ||
if (!event || !event.name) { | ||
throw new AggregateError(["Event name not passed"]); | ||
const error = new Error("Event name not passed"); | ||
throw new AggregateError([error], error.message); | ||
} | ||
if (!event.payload) { | ||
throw new AggregateError(["Event payload not passed"]); | ||
const error = new Error("Event name not passed"); | ||
throw new AggregateError([error], error.message); | ||
} | ||
@@ -49,3 +50,6 @@ const hooks = getHooks( | ||
} | ||
const error = new AggregateError(errors); | ||
const error = new AggregateError( | ||
errors, | ||
errors.map((error2) => error2.message).join("\n") | ||
); | ||
Object.assign(error, { | ||
@@ -52,0 +56,0 @@ event |
@@ -1,2 +0,1 @@ | ||
import AggregateError from "aggregate-error"; | ||
function getPayload(request) { | ||
@@ -10,3 +9,6 @@ if (typeof request.body === "object" && "rawBody" in request && request.rawBody instanceof Buffer) { | ||
let data = []; | ||
request.on("error", (error) => reject(new AggregateError([error]))); | ||
request.on( | ||
"error", | ||
(error) => reject(new AggregateError([error], error.message)) | ||
); | ||
request.on("data", (chunk) => data.push(chunk)); | ||
@@ -13,0 +15,0 @@ request.on( |
@@ -1,2 +0,1 @@ | ||
import AggregateError from "aggregate-error"; | ||
import { verify } from "@octokit/webhooks-methods"; | ||
@@ -23,3 +22,3 @@ async function verifyAndReceive(state, event) { | ||
error.status = 400; | ||
throw new AggregateError([error]); | ||
throw new AggregateError([error], error.message); | ||
} | ||
@@ -26,0 +25,0 @@ return state.eventHandler.receive({ |
@@ -7,3 +7,2 @@ import type { RequestError } from "@octokit/request-error"; | ||
import type { emitterEventNames } from "./generated/webhook-names.js"; | ||
import type AggregateError from "aggregate-error"; | ||
export type WebhookEventName = keyof EventPayloadMap; | ||
@@ -50,5 +49,8 @@ export type ExtractEvents<TEventName> = TEventName extends `${infer _TWebhookEvent}.${infer _TAction}` ? never : TEventName; | ||
export type WebhookError = Error & Partial<RequestError>; | ||
export interface WebhookEventHandlerError<TTransformed = unknown> extends AggregateError<WebhookError> { | ||
export interface AggregateWebhookError extends AggregateError { | ||
errors: WebhookError[]; | ||
} | ||
export interface WebhookEventHandlerError<TTransformed = unknown> extends AggregateWebhookError { | ||
event: TTransformed extends unknown ? EmitterWebhookEvent : EmitterWebhookEvent & TTransformed; | ||
} | ||
export {}; |
{ | ||
"name": "@octokit/webhooks", | ||
"version": "13.2.8", | ||
"type": "module", | ||
"version": "13.3.0", | ||
"description": "GitHub webhook events toolset for Node.js", | ||
@@ -10,24 +9,21 @@ "keywords": [], | ||
"author": "Gregor Martynus (https://twitter.com/gr2m)", | ||
"type": "module", | ||
"dependencies": { | ||
"@octokit/openapi-webhooks-types": "8.3.0", | ||
"@octokit/request-error": "^6.0.1", | ||
"@octokit/webhooks-methods": "^5.0.0", | ||
"aggregate-error": "^5.0.0" | ||
"@octokit/webhooks-methods": "^5.0.0" | ||
}, | ||
"devDependencies": { | ||
"@jest/types": "^29.0.0", | ||
"@octokit/openapi-webhooks": "8.3.0", | ||
"@octokit/tsconfig": "^3.0.0", | ||
"@types/jest": "^29.0.0", | ||
"@types/node": "^20.0.0", | ||
"axios": "^1.0.0", | ||
"@vitest/coverage-v8": "^2.0.2", | ||
"esbuild": "^0.23.0", | ||
"express": "^4.17.1", | ||
"glob": "^11.0.0", | ||
"jest": "^29.0.0", | ||
"prettier": "3.3.2", | ||
"prettier": "3.3.3", | ||
"prettier-plugin-packagejson": "^2.2.9", | ||
"ts-jest": "^29.0.0", | ||
"ts-node": "^10.0.0", | ||
"typescript": "^5.0.0" | ||
"typescript": "^5.0.0", | ||
"vitest": "^2.0.2" | ||
}, | ||
@@ -34,0 +30,0 @@ "engines": { |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
157280
3
12
1627
- Removedaggregate-error@^5.0.0
- Removedaggregate-error@5.0.0(transitive)
- Removedclean-stack@5.2.0(transitive)
- Removedescape-string-regexp@5.0.0(transitive)
- Removedindent-string@5.0.0(transitive)