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

@blockprotocol/core

Package Overview
Dependencies
Maintainers
8
Versions
61
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@blockprotocol/core - npm Package Compare versions

Comparing version 0.1.0-canary-20230222150704 to 0.1.0-canary-20230223103409

15

dist/cjs/module-handler.d.ts

@@ -16,2 +16,9 @@ import { GenericMessageCallback, MessageContents, MessageData } from "./types";

private coreQueue;
/**
* If we register callbacks prior to creating the core handler, we want to
* register those on the core handler once it is available, but before we
* call initialize on it, to ensure callbacks which would catch messages sent
* during initialize are registered. To enable that, we have a separate queue.
*/
private preCoreInitializeQueue;
/** whether the instance of CoreHandler belongs to a block or embedding application */

@@ -67,2 +74,9 @@ protected readonly sourceType: "block" | "embedder";

}): void;
/**
* When adding/removing callbacks before calling the core handler is
* available, we want to queue these in a queue which will be processed before
* calling initializing once we create the core handler, to ensure callbacks
* are properly set up before calling initialize
*/
private getRelevantQueueForCallbacks;
/** Remove a callback from the CoreHandler for an incoming messages of a specific type */

@@ -74,2 +88,3 @@ protected removeCallback(this: ModuleHandler, { messageName, callback, }: {

private processCoreQueue;
private processCoreCallbackQueue;
protected sendMessage(this: ModuleHandler, args: {

@@ -76,0 +91,0 @@ message: MessageContents;

28

dist/cjs/module-handler.js

@@ -21,2 +21,9 @@ "use strict";

this.coreQueue = [];
/**
* If we register callbacks prior to creating the core handler, we want to
* register those on the core handler once it is available, but before we
* call initialize on it, to ensure callbacks which would catch messages sent
* during initialize are registered. To enable that, we have a separate queue.
*/
this.preCoreInitializeQueue = [];
this.moduleName = moduleName;

@@ -49,2 +56,3 @@ this.sourceType = sourceType;

}
this.processCoreCallbackQueue(this.preCoreInitializeQueue);
coreHandler.initialize();

@@ -102,3 +110,3 @@ this.processCoreQueue();

this.checkIfDestroyed();
this.coreQueue.push((coreHandler) => coreHandler.registerCallback({
this.getRelevantQueueForCallbacks().push((coreHandler) => coreHandler.registerCallback({
callback,

@@ -110,6 +118,15 @@ messageName,

}
/**
* When adding/removing callbacks before calling the core handler is
* available, we want to queue these in a queue which will be processed before
* calling initializing once we create the core handler, to ensure callbacks
* are properly set up before calling initialize
*/
getRelevantQueueForCallbacks() {
return this.coreHandler ? this.coreQueue : this.preCoreInitializeQueue;
}
/** Remove a callback from the CoreHandler for an incoming messages of a specific type */
removeCallback({ messageName, callback, }) {
this.checkIfDestroyed();
this.coreQueue.push((coreHandler) => coreHandler.removeCallback({
this.getRelevantQueueForCallbacks().push((coreHandler) => coreHandler.removeCallback({
callback,

@@ -122,6 +139,9 @@ messageName,

processCoreQueue() {
this.processCoreCallbackQueue(this.coreQueue);
}
processCoreCallbackQueue(queue) {
const coreHandler = this.coreHandler;
if (coreHandler) {
while (this.coreQueue.length) {
const callback = this.coreQueue.shift();
while (queue.length) {
const callback = queue.shift();
if (callback) {

@@ -128,0 +148,0 @@ callback(coreHandler);

@@ -16,2 +16,9 @@ import { GenericMessageCallback, MessageContents, MessageData } from "./types";

private coreQueue;
/**
* If we register callbacks prior to creating the core handler, we want to
* register those on the core handler once it is available, but before we
* call initialize on it, to ensure callbacks which would catch messages sent
* during initialize are registered. To enable that, we have a separate queue.
*/
private preCoreInitializeQueue;
/** whether the instance of CoreHandler belongs to a block or embedding application */

@@ -67,2 +74,9 @@ protected readonly sourceType: "block" | "embedder";

}): void;
/**
* When adding/removing callbacks before calling the core handler is
* available, we want to queue these in a queue which will be processed before
* calling initializing once we create the core handler, to ensure callbacks
* are properly set up before calling initialize
*/
private getRelevantQueueForCallbacks;
/** Remove a callback from the CoreHandler for an incoming messages of a specific type */

@@ -74,2 +88,3 @@ protected removeCallback(this: ModuleHandler, { messageName, callback, }: {

private processCoreQueue;
private processCoreCallbackQueue;
protected sendMessage(this: ModuleHandler, args: {

@@ -76,0 +91,0 @@ message: MessageContents;

@@ -18,2 +18,9 @@ import { CoreBlockHandler } from "./core-block-handler";

this.coreQueue = [];
/**
* If we register callbacks prior to creating the core handler, we want to
* register those on the core handler once it is available, but before we
* call initialize on it, to ensure callbacks which would catch messages sent
* during initialize are registered. To enable that, we have a separate queue.
*/
this.preCoreInitializeQueue = [];
this.moduleName = moduleName;

@@ -46,2 +53,3 @@ this.sourceType = sourceType;

}
this.processCoreCallbackQueue(this.preCoreInitializeQueue);
coreHandler.initialize();

@@ -99,3 +107,3 @@ this.processCoreQueue();

this.checkIfDestroyed();
this.coreQueue.push((coreHandler) => coreHandler.registerCallback({
this.getRelevantQueueForCallbacks().push((coreHandler) => coreHandler.registerCallback({
callback,

@@ -107,6 +115,15 @@ messageName,

}
/**
* When adding/removing callbacks before calling the core handler is
* available, we want to queue these in a queue which will be processed before
* calling initializing once we create the core handler, to ensure callbacks
* are properly set up before calling initialize
*/
getRelevantQueueForCallbacks() {
return this.coreHandler ? this.coreQueue : this.preCoreInitializeQueue;
}
/** Remove a callback from the CoreHandler for an incoming messages of a specific type */
removeCallback({ messageName, callback, }) {
this.checkIfDestroyed();
this.coreQueue.push((coreHandler) => coreHandler.removeCallback({
this.getRelevantQueueForCallbacks().push((coreHandler) => coreHandler.removeCallback({
callback,

@@ -119,6 +136,9 @@ messageName,

processCoreQueue() {
this.processCoreCallbackQueue(this.coreQueue);
}
processCoreCallbackQueue(queue) {
const coreHandler = this.coreHandler;
if (coreHandler) {
while (this.coreQueue.length) {
const callback = this.coreQueue.shift();
while (queue.length) {
const callback = queue.shift();
if (callback) {

@@ -125,0 +145,0 @@ callback(coreHandler);

2

package.json
{
"name": "@blockprotocol/core",
"version": "0.1.0-canary-20230222150704",
"version": "0.1.0-canary-20230223103409",
"description": "Implementation of the Block Protocol Core specification for blocks and embedding applications",

@@ -5,0 +5,0 @@ "keywords": [

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

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