You're Invited: Meet the Socket team at BSidesSF and RSAC - April 27 - May 1.RSVP
Socket
Sign inDemoInstall
Socket

@blockprotocol/graph

Package Overview
Dependencies
Maintainers
8
Versions
112
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@blockprotocol/graph - npm Package Compare versions

Comparing version

to
0.0.11-canary.24

23

dist/graph-block-handler.js
import { ServiceHandler } from "@blockprotocol/core";
/**
* We should be able to import via
*/
import graphServiceJson from "./graph-service.json" assert { type: "json" };
/**
* Creates a handler for the graph service for the block.

@@ -24,8 +20,15 @@ * Register callbacks in the constructor or afterwards using the 'on' method to react to messages from the embedder.

on(messageName, handlerFunction) {
const expectedMessageSource = "embedder";
const messageJsonDefinition = graphServiceJson.messages.find((message) => message.messageName === messageName &&
message.source === expectedMessageSource);
if (!messageJsonDefinition) {
throw new Error(`No message with name '${messageName}' expected from ${expectedMessageSource}.`);
}
// @todo restore this when module resolution issue resolved
// @see https://app.asana.com/0/1202542409311090/1202614421149286/f
// const expectedMessageSource = "embedder";
// const messageJsonDefinition = graphServiceJson.messages.find(
// (message) =>
// message.messageName === messageName &&
// message.source === expectedMessageSource,
// );
// if (!messageJsonDefinition) {
// throw new Error(
// `No message with name '${messageName}' expected from ${expectedMessageSource}.`,
// );
// }
this.registerCallback({

@@ -32,0 +35,0 @@ callback: handlerFunction,

import { ServiceHandler } from "@blockprotocol/core";
import graphServiceJson from "./graph-service.json" assert { type: "json" };
/**

@@ -26,8 +25,15 @@ * Creates a handler for the graph service for the embedder.

on(messageName, handlerFunction) {
const expectedMessageSource = "block";
const messageJsonDefinition = graphServiceJson.messages.find((message) => message.messageName === messageName &&
message.source === expectedMessageSource);
if (!messageJsonDefinition) {
throw new Error(`No message with name '${messageName}' expected from ${expectedMessageSource}.`);
}
// @todo restore this when module resolution issue resolved
// @see https://app.asana.com/0/1202542409311090/1202614421149286/f
// const expectedMessageSource = "block";
// const messageJsonDefinition = graphServiceJson.messages.find(
// (message) =>
// message.messageName === messageName &&
// message.source === expectedMessageSource,
// );
// if (!messageJsonDefinition) {
// throw new Error(
// `No message with name '${messageName}' expected from ${expectedMessageSource}.`,
// );
// }
this.registerCallback({

@@ -34,0 +40,0 @@ callback: handlerFunction,

export { GraphBlockHandler } from "./graph-block-handler.js";
export { GraphEmbedderHandler } from "./graph-embedder-handler.js";
/**
* We shouldn't need to do this, since the hooks are exported via the subpath too,
* e.g. import { useGraphBlockService } from "@blockprotocol/graph/react"
* There's an issue in hashintel/hash where importing via the subpath means an import
* statement for 'graph-service.json' is preserved, but the file isn't.
* @todo fix it so we can remove this export
* @see
*/
export { useGraphBlockService, useGraphEmbedderService } from "./react.js";
export * from "./types.js";
export { GraphBlockHandler } from "./graph-block-handler.js";
export { GraphEmbedderHandler } from "./graph-embedder-handler.js";
/**
* We shouldn't need to do this, since the hooks are exported via the subpath too,
* e.g. import { useGraphBlockService } from "@blockprotocol/graph/react"
* There's an issue in hashintel/hash where importing via the subpath means an import
* statement for 'graph-service.json' is preserved, but the file isn't.
* @todo fix it so we can remove this export
* @see
*/
export { useGraphBlockService, useGraphEmbedderService } from "./react.js";
export * from "./types.js";
//# sourceMappingURL=index.js.map
{
"name": "@blockprotocol/graph",
"version": "0.0.11-canary.23",
"version": "0.0.11-canary.24",
"description": "Implementation of the Block Protocol Graph service specification for blocks and embedding applications",

@@ -29,4 +29,3 @@ "keywords": [

"./custom-element": "./dist/custom-element.js",
"./graph-service-json": "./dist/graph-service-json.js",
"./graph-service.json": "./dist/graph-service.json"
"./graph-service-json": "./dist/graph-service-json.js"
},

@@ -33,0 +32,0 @@ "types": "./dist/index.d.ts",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet