New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@blockprotocol/hook

Package Overview
Dependencies
Maintainers
8
Versions
83
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@blockprotocol/hook - npm Package Compare versions

Comparing version 0.0.7 to 0.0.8-canary.0

73

dist/react.js

@@ -123,3 +123,2 @@ import { useEffect, useLayoutEffect, useRef, useState } from "react";

const existingHookId = existingHookRef.current?.id;
const teardownPromise = existingHookRef.current?.teardown?.().catch() ?? Promise.resolve();
if (node && service) {

@@ -169,44 +168,44 @@ const controller = new AbortController();

existingHookRef.current = hook;
teardownPromise
.then(() => {
if (service.destroyed || controller.signal.aborted) {
return;
}
return service
.hook({
data: {
hookId: hook.id,
entityId,
node,
type,
path,
},
})
.then((response) => {
if (!controller.signal.aborted) {
if (response.errors) {
if (response.errors.length === 1 &&
response.errors[0]?.code === "NOT_IMPLEMENTED") {
const teardown = fallbackRef.current(node);
hook.teardown = async () => {
controller.abort();
teardown?.();
};
void service
.hook({
data: {
hookId: hook.id,
entityId,
node,
type,
path,
},
})
.then((response) => {
if (!controller.signal.aborted) {
if (response.errors) {
const firstError = response.errors[0];
if (firstError?.code === "NOT_IMPLEMENTED") {
const teardown = fallbackRef.current(node);
hook.teardown = async () => {
controller.abort();
teardown?.();
};
}
else if (firstError?.code === "NOT_FOUND") {
const errMsg = `Hook with id ${hook.id} was not found by embedding application`;
if (node === null) {
// don't throw if the request was for hook deletion – the embedding app can't find the hook, things can continue
// eslint-disable-next-line no-console -- useful for debugging
console.warn(`${errMsg} – no hook to remove`);
}
else {
// eslint-disable-next-line no-console
console.error(response.errors);
throw new Error("Unknown error in hook");
throw new Error(errMsg);
}
}
else if (response.data) {
hook.id = response.data.hookId;
else {
// eslint-disable-next-line no-console
console.error(response.errors);
throw new Error("Unknown error in hook");
}
}
});
})
.catch((err) => {
catchError(() => {
throw err;
});
else if (response.data) {
hook.id = response.data.hookId;
}
}
});

@@ -213,0 +212,0 @@ }

{
"name": "@blockprotocol/hook",
"version": "0.0.7",
"version": "0.0.8-canary.0",
"description": "Implementation of the Block Protocol Hook service specification for blocks and embedding applications",

@@ -60,3 +60,3 @@ "keywords": [

"@local/tsconfig": "0.0.0-private",
"eslint": "8.25.0",
"eslint": "8.26.0",
"rimraf": "^3.0.2",

@@ -63,0 +63,0 @@ "typescript": "4.8.4"

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc