@hirosystems/chainhook-client
Advanced tools
Comparing version 1.2.0 to 1.2.1
@@ -14,7 +14,7 @@ /// <reference types="node" /> | ||
/** Wait for the chainhook node to be available before submitting predicates */ | ||
wait_for_chainhook_node: import("@sinclair/typebox").TBoolean; | ||
wait_for_chainhook_node: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TBoolean>; | ||
/** Validate the JSON schema of received chainhook payloads and report errors when invalid */ | ||
validate_chainhook_payloads: import("@sinclair/typebox").TBoolean; | ||
validate_chainhook_payloads: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TBoolean>; | ||
/** Size limit for received chainhook payloads (default 40MB) */ | ||
body_limit: import("@sinclair/typebox").TNumber; | ||
body_limit: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TNumber>; | ||
}>; | ||
@@ -66,3 +66,3 @@ /** Local event server connection and authentication options */ | ||
}>, import("@sinclair/typebox").TObject<{ | ||
scope: import("@sinclair/typebox").TLiteral<"outputs">; /** Size limit for received chainhook payloads (default 40MB) */ | ||
scope: import("@sinclair/typebox").TLiteral<"outputs">; | ||
p2sh: import("@sinclair/typebox").TString<string>; | ||
@@ -114,3 +114,3 @@ }>, import("@sinclair/typebox").TObject<{ | ||
asset_identifier: import("@sinclair/typebox").TString<string>; | ||
actions: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TString<string>>; /** Validate the JSON schema of received chainhook payloads and report errors when invalid */ | ||
actions: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TString<string>>; | ||
}>, import("@sinclair/typebox").TObject<{ | ||
@@ -164,3 +164,3 @@ scope: import("@sinclair/typebox").TLiteral<"print_event">; | ||
}>, import("@sinclair/typebox").TObject<{ | ||
scope: import("@sinclair/typebox").TLiteral<"outputs">; /** Size limit for received chainhook payloads (default 40MB) */ | ||
scope: import("@sinclair/typebox").TLiteral<"outputs">; | ||
p2sh: import("@sinclair/typebox").TString<string>; | ||
@@ -212,3 +212,3 @@ }>, import("@sinclair/typebox").TObject<{ | ||
asset_identifier: import("@sinclair/typebox").TString<string>; | ||
actions: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TString<string>>; /** Validate the JSON schema of received chainhook payloads and report errors when invalid */ | ||
actions: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TString<string>>; | ||
}>, import("@sinclair/typebox").TObject<{ | ||
@@ -215,0 +215,0 @@ scope: import("@sinclair/typebox").TLiteral<"print_event">; |
@@ -20,7 +20,7 @@ "use strict"; | ||
/** Wait for the chainhook node to be available before submitting predicates */ | ||
wait_for_chainhook_node: type_provider_typebox_1.Type.Boolean({ default: true }), | ||
wait_for_chainhook_node: type_provider_typebox_1.Type.Optional(type_provider_typebox_1.Type.Boolean({ default: true })), | ||
/** Validate the JSON schema of received chainhook payloads and report errors when invalid */ | ||
validate_chainhook_payloads: type_provider_typebox_1.Type.Boolean({ default: false }), | ||
validate_chainhook_payloads: type_provider_typebox_1.Type.Optional(type_provider_typebox_1.Type.Boolean({ default: false })), | ||
/** Size limit for received chainhook payloads (default 40MB) */ | ||
body_limit: type_provider_typebox_1.Type.Number({ default: 41943040 }), | ||
body_limit: type_provider_typebox_1.Type.Optional(type_provider_typebox_1.Type.Number({ default: 41943040 })), | ||
}); | ||
@@ -152,3 +152,4 @@ const ChainhookNodeOptionsSchema = type_provider_typebox_1.Type.Object({ | ||
}, async (request, reply) => { | ||
if (serverOpts.validate_chainhook_payloads && !compiledSchema.Check(request.body)) { | ||
if ((serverOpts.validate_chainhook_payloads ?? false) && | ||
!compiledSchema.Check(request.body)) { | ||
logger_1.logger.error([...compiledSchema.Errors(request.body)], `ChainhookEventObserver received an invalid payload`); | ||
@@ -173,5 +174,5 @@ await reply.code(422).send(); | ||
pluginTimeout: 0, | ||
bodyLimit: serverOpts.body_limit, | ||
bodyLimit: serverOpts.body_limit ?? 41943040, // 40MB | ||
}).withTypeProvider(); | ||
if (serverOpts.wait_for_chainhook_node) { | ||
if (serverOpts.wait_for_chainhook_node ?? true) { | ||
fastify.addHook('onReady', waitForNode); | ||
@@ -178,0 +179,0 @@ } |
{ | ||
"name": "@hirosystems/chainhook-client", | ||
"version": "1.2.0", | ||
"version": "1.2.1", | ||
"description": "Chainhook TypeScript client", | ||
@@ -5,0 +5,0 @@ "main": "./dist/index.js", |
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
285952
4096