Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@blocksuite/store

Package Overview
Dependencies
Maintainers
0
Versions
1250
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@blocksuite/store - npm Package Compare versions

Comparing version 0.0.0-canary-20241021001443 to 0.0.0-canary-20241022001415

8

CHANGELOG.md
# @blocksuite/store
## 0.0.0-canary-20241021001443
## 0.0.0-canary-20241022001415

@@ -9,5 +9,5 @@ ### Patch Changes

- Updated dependencies
- @blocksuite/global@0.0.0-canary-20241021001443
- @blocksuite/inline@0.0.0-canary-20241021001443
- @blocksuite/sync@0.0.0-canary-20241021001443
- @blocksuite/global@0.0.0-canary-20241022001415
- @blocksuite/inline@0.0.0-canary-20241022001415
- @blocksuite/sync@0.0.0-canary-20241022001415

@@ -14,0 +14,0 @@ ## 0.17.19

@@ -54,2 +54,6 @@ import { type Disposable, Slot } from '@blocksuite/global/utils';

};
updateBlock: {
<T extends Partial<BlockProps>>(model: BlockModel, props: T): void;
(model: BlockModel, callback: () => void): void;
};
private get _yBlocks();

@@ -142,6 +146,4 @@ get awarenessStore(): import("../../index.js").AwarenessStore<import("@blocksuite/global/types").BlockSuiteFlags>;

moveBlocks(blocksToMove: BlockModel[], newParent: BlockModel, targetSibling?: BlockModel | null, shouldInsertBeforeSibling?: boolean): void;
updateBlock<T extends Partial<BlockProps>>(model: BlockModel, props: T): void;
updateBlock(model: BlockModel, callback: () => void): void;
}
export {};
//# sourceMappingURL=doc.d.ts.map

@@ -116,2 +116,37 @@ import { BlockSuiteError, ErrorCode } from '@blocksuite/global/exceptions';

};
this.updateBlock = (model, callBackOrProps) => {
if (this.readonly) {
console.error('cannot modify data in readonly mode');
return;
}
const isCallback = typeof callBackOrProps === 'function';
if (!isCallback) {
const parent = this.getParent(model);
this.schema.validate(model.flavour, parent?.flavour, callBackOrProps.children?.map(child => child.flavour));
}
const yBlock = this._yBlocks.get(model.id);
if (!yBlock) {
throw new BlockSuiteError(ErrorCode.ModelCRUDError, `updating block: ${model.id} not found`);
}
const block = this.getBlock(model.id);
if (!block)
return;
this.transact(() => {
if (isCallback) {
callBackOrProps();
this._runQuery(block);
return;
}
if (callBackOrProps.children) {
this._crud.updateBlockChildren(model.id, callBackOrProps.children.map(child => child.id));
}
const schema = this.schema.flavourSchemaMap.get(model.flavour);
if (!schema) {
throw new BlockSuiteError(ErrorCode.ModelCRUDError, `schema for flavour: ${model.flavour} not found`);
}
syncBlockProps(schema, model, yBlock, callBackOrProps);
this._runQuery(block);
return;
});
};
this._blockCollection = blockCollection;

@@ -377,38 +412,3 @@ this.slots = {

}
updateBlock(model, callBackOrProps) {
if (this.readonly) {
console.error('cannot modify data in readonly mode');
return;
}
const isCallback = typeof callBackOrProps === 'function';
if (!isCallback) {
const parent = this.getParent(model);
this.schema.validate(model.flavour, parent?.flavour, callBackOrProps.children?.map(child => child.flavour));
}
const yBlock = this._yBlocks.get(model.id);
if (!yBlock) {
throw new BlockSuiteError(ErrorCode.ModelCRUDError, `updating block: ${model.id} not found`);
}
const block = this.getBlock(model.id);
if (!block)
return;
this.transact(() => {
if (isCallback) {
callBackOrProps();
this._runQuery(block);
return;
}
if (callBackOrProps.children) {
this._crud.updateBlockChildren(model.id, callBackOrProps.children.map(child => child.id));
}
const schema = this.schema.flavourSchemaMap.get(model.flavour);
if (!schema) {
throw new BlockSuiteError(ErrorCode.ModelCRUDError, `schema for flavour: ${model.flavour} not found`);
}
syncBlockProps(schema, model, yBlock, callBackOrProps);
this._runQuery(block);
return;
});
}
}
//# sourceMappingURL=doc.js.map
{
"name": "@blocksuite/store",
"version": "0.0.0-canary-20241021001443",
"version": "0.0.0-canary-20241022001415",
"description": "BlockSuite data store built for general purpose state management.",

@@ -23,5 +23,5 @@ "type": "module",

"dependencies": {
"@blocksuite/global": "0.0.0-canary-20241021001443",
"@blocksuite/inline": "0.0.0-canary-20241021001443",
"@blocksuite/sync": "0.0.0-canary-20241021001443",
"@blocksuite/global": "0.0.0-canary-20241022001415",
"@blocksuite/inline": "0.0.0-canary-20241022001415",
"@blocksuite/sync": "0.0.0-canary-20241022001415",
"@preact/signals-core": "^1.8.0",

@@ -28,0 +28,0 @@ "@types/flexsearch": "^0.7.6",

@@ -78,2 +78,63 @@ import { BlockSuiteError, ErrorCode } from '@blocksuite/global/exceptions';

updateBlock: {
<T extends Partial<BlockProps>>(model: BlockModel, props: T): void;
(model: BlockModel, callback: () => void): void;
} = (
model: BlockModel,
callBackOrProps: (() => void) | Partial<BlockProps>
) => {
if (this.readonly) {
console.error('cannot modify data in readonly mode');
return;
}
const isCallback = typeof callBackOrProps === 'function';
if (!isCallback) {
const parent = this.getParent(model);
this.schema.validate(
model.flavour,
parent?.flavour,
callBackOrProps.children?.map(child => child.flavour)
);
}
const yBlock = this._yBlocks.get(model.id);
if (!yBlock) {
throw new BlockSuiteError(
ErrorCode.ModelCRUDError,
`updating block: ${model.id} not found`
);
}
const block = this.getBlock(model.id);
if (!block) return;
this.transact(() => {
if (isCallback) {
callBackOrProps();
this._runQuery(block);
return;
}
if (callBackOrProps.children) {
this._crud.updateBlockChildren(
model.id,
callBackOrProps.children.map(child => child.id)
);
}
const schema = this.schema.flavourSchemaMap.get(model.flavour);
if (!schema) {
throw new BlockSuiteError(
ErrorCode.ModelCRUDError,
`schema for flavour: ${model.flavour} not found`
);
}
syncBlockProps(schema, model, yBlock, callBackOrProps);
this._runQuery(block);
return;
});
};
private get _yBlocks() {

@@ -610,64 +671,2 @@ return this._blockCollection.yBlocks;

}
updateBlock<T extends Partial<BlockProps>>(model: BlockModel, props: T): void;
updateBlock(model: BlockModel, callback: () => void): void;
updateBlock(
model: BlockModel,
callBackOrProps: (() => void) | Partial<BlockProps>
): void {
if (this.readonly) {
console.error('cannot modify data in readonly mode');
return;
}
const isCallback = typeof callBackOrProps === 'function';
if (!isCallback) {
const parent = this.getParent(model);
this.schema.validate(
model.flavour,
parent?.flavour,
callBackOrProps.children?.map(child => child.flavour)
);
}
const yBlock = this._yBlocks.get(model.id);
if (!yBlock) {
throw new BlockSuiteError(
ErrorCode.ModelCRUDError,
`updating block: ${model.id} not found`
);
}
const block = this.getBlock(model.id);
if (!block) return;
this.transact(() => {
if (isCallback) {
callBackOrProps();
this._runQuery(block);
return;
}
if (callBackOrProps.children) {
this._crud.updateBlockChildren(
model.id,
callBackOrProps.children.map(child => child.id)
);
}
const schema = this.schema.flavourSchemaMap.get(model.flavour);
if (!schema) {
throw new BlockSuiteError(
ErrorCode.ModelCRUDError,
`schema for flavour: ${model.flavour} not found`
);
}
syncBlockProps(schema, model, yBlock, callBackOrProps);
this._runQuery(block);
return;
});
}
}

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