import { ModuleHandler } from "@blockprotocol/core"; /** * There's an issue when importing useGraphEmbedderModule from @blockprotocol/graph/react in hashintel/hash: * NextJS's output file tracing does not include graph-module.json, and yet an import statement for it is preserved. * This leads to a 'module cannot be found error'. For now, commenting out the import of the JSON from this file. * @todo restore this when module resolution issue resolved * @see https://app.asana.com/0/1202542409311090/1202614421149286/f */ import type { CreateEntityData, CreateResourceError, DataTypeRootType, DeleteEntityData, EntityRootType, EntityTypeRootType, GetDataTypeData, GetEntityTypeData, GetPropertyTypeData, GraphBlockMessageCallbacks, GraphBlockMessages, PropertyTypeRootType, QueryDataTypesData, QueryDataTypesResult, QueryEntitiesResult, QueryEntityTypesData, QueryEntityTypesResult, QueryPropertyTypesData, QueryPropertyTypesResult, ReadOrModifyResourceError, Subgraph, UpdateEntityData, UploadFileData } from "./main.js"; import type { GetEntityData, QueryEntitiesData } from "./types/entity.js"; import type { Entity, PropertyObject } from "@blockprotocol/type-system"; /** * Creates a handler for the graph module for the block. * Register callbacks in the constructor or afterwards using the 'on' method to react to messages from the embedder. * Call the relevant methods to send messages to the embedder. */ export declare class GraphBlockHandler extends ModuleHandler implements Omit { constructor({ callbacks, element, }: { callbacks?: Partial; element?: HTMLElement | null; }); getInitPayload(): Record; /** * Registers multiple callbacks at once. * Useful for bulk updates to callbacks after the module is first initialised. */ registerCallbacks(callbacks: Partial): void; /** * Removes multiple callbacks at once. * Useful when replacing previously registered callbacks */ removeCallbacks(callbacks: Partial): void; /** * Call the provided function when the named message is received, passing the data/errors object from the message. * If the named message expects a response, the callback should provide the expected data/errors object as the return. * @param messageName the message name to listen for * @param handlerFunction the function to call when the message is received, with the message data / errors */ on(this: GraphBlockHandler, messageName: K, handlerFunction: GraphBlockMessageCallbacks[K]): void; createEntity({ data, }: { data?: CreateEntityData & { properties: ValidProperties; }; }): Promise, CreateResourceError>>; updateEntity({ data, }: { data?: UpdateEntityData & { properties: ValidProperties; }; }): Promise, ReadOrModifyResourceError>>; deleteEntity({ data }: { data?: DeleteEntityData; }): Promise>; getEntity({ data }: { data?: GetEntityData; }): Promise, ReadOrModifyResourceError>>; queryEntities({ data }: { data?: QueryEntitiesData; }): Promise>, ReadOrModifyResourceError>>; /** @todo - Add Type System mutation methods */ getEntityType({ data }: { data?: GetEntityTypeData; }): Promise, ReadOrModifyResourceError>>; queryEntityTypes({ data }: { data?: QueryEntityTypesData; }): Promise>, ReadOrModifyResourceError>>; getPropertyType({ data }: { data?: GetPropertyTypeData; }): Promise, ReadOrModifyResourceError>>; queryPropertyTypes({ data }: { data?: QueryPropertyTypesData; }): Promise>, ReadOrModifyResourceError>>; getDataType({ data }: { data?: GetDataTypeData; }): Promise, ReadOrModifyResourceError>>; queryDataTypes({ data }: { data?: QueryDataTypesData; }): Promise>, ReadOrModifyResourceError>>; requestLinkedQuery(): Promise>; /** @todo - Reimplement linked queries */ uploadFile({ data }: { data?: UploadFileData; }): Promise>; }