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

@blocksuite/block-std

Package Overview
Dependencies
Maintainers
5
Versions
894
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@blocksuite/block-std - npm Package Compare versions

Comparing version 0.0.0-20230905170607-94acf22c-nightly to 0.0.0-20230906133203-d3774c2c-nightly

3

dist/command/index.d.ts

@@ -6,3 +6,3 @@ import type { BlockStore } from '../store/index.js';

export type CommandKeyToData<K extends BlockSuite.CommandDataName> = Pick<BlockSuite.CommandData, K>;
export type Command<In extends BlockSuite.CommandDataName = never, Out extends BlockSuite.CommandDataName = never, InData extends object = {}> = (ctx: CommandKeyToData<In> & InitCommandCtx & InData, next: (ctx: CommandKeyToData<Out>) => Promise<void>) => Promise<void>;
export type Command<In extends BlockSuite.CommandDataName = never, Out extends BlockSuite.CommandDataName = never, InData extends object = {}> = (ctx: CommandKeyToData<In> & InitCommandCtx & InData, next: (ctx?: CommandKeyToData<Out>) => Promise<void>) => Promise<void>;
type Omit1<A, B> = [keyof Omit<A, keyof B>] extends [never] ? void : Omit<A, keyof B>;

@@ -15,2 +15,3 @@ type InDataOfCommand<C> = C extends Command<infer K, any, infer R> ? CommandKeyToData<K> & R : never;

inline: <InlineOut extends BlockSuite.CommandDataName = never>(command: Command<Extract<keyof In, BlockSuite.CommandDataName>, InlineOut>) => Chain<In & CommandKeyToData<InlineOut>>;
try: (fn: (chain: Chain<In>) => Chain<In>[]) => Chain<In>;
};

@@ -17,0 +18,0 @@ type Chain<In extends object = {}> = CommonMethods<In> & {

@@ -32,2 +32,21 @@ const cmdSymbol = Symbol('cmds');

},
try: fn => {
let success = false;
const chains = fn(this.createChain(methods, cmds)).map(chain => chain.inline(async (_, next) => {
success = true;
await next();
}));
return this.createChain(methods, [
...cmds,
async (_, next) => {
for (const chain of chains) {
chain.run();
if (success) {
await next();
break;
}
}
},
]);
},
...methods,

@@ -34,0 +53,0 @@ };

{
"name": "@blocksuite/block-std",
"version": "0.0.0-20230905170607-94acf22c-nightly",
"version": "0.0.0-20230906133203-d3774c2c-nightly",
"description": "Std for blocksuite blocks",

@@ -12,10 +12,10 @@ "main": "dist/index.js",

"peerDependencies": {
"@blocksuite/store": "0.0.0-20230905170607-94acf22c-nightly"
"@blocksuite/store": "0.0.0-20230906133203-d3774c2c-nightly"
},
"dependencies": {
"w3c-keyname": "^2.2.8",
"@blocksuite/global": "0.0.0-20230905170607-94acf22c-nightly"
"@blocksuite/global": "0.0.0-20230906133203-d3774c2c-nightly"
},
"devDependencies": {
"@blocksuite/store": "0.0.0-20230905170607-94acf22c-nightly"
"@blocksuite/store": "0.0.0-20230906133203-d3774c2c-nightly"
},

@@ -22,0 +22,0 @@ "exports": {

@@ -18,3 +18,3 @@ import type { BlockStore } from '../store/index.js';

ctx: CommandKeyToData<In> & InitCommandCtx & InData,
next: (ctx: CommandKeyToData<Out>) => Promise<void>
next: (ctx?: CommandKeyToData<Out>) => Promise<void>
) => Promise<void>;

@@ -39,2 +39,3 @@ type Omit1<A, B> = [keyof Omit<A, keyof B>] extends [never]

) => Chain<In & CommandKeyToData<InlineOut>>;
try: (fn: (chain: Chain<In>) => Chain<In>[]) => Chain<In>;
};

@@ -96,2 +97,23 @@ const cmdSymbol = Symbol('cmds');

},
try: fn => {
let success = false;
const chains = fn(this.createChain(methods, cmds)).map(chain =>
chain.inline(async (_, next) => {
success = true;
await next();
})
);
return this.createChain(methods, [
...cmds,
async (_, next) => {
for (const chain of chains) {
chain.run();
if (success) {
await next();
break;
}
}
},
]) as never;
},
...methods,

@@ -98,0 +120,0 @@ } as Chain;

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