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

booture

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

booture - npm Package Compare versions

Comparing version 0.1.1 to 1.0.0

60

index.js

@@ -12,3 +12,49 @@ (function (global, factory) {

// callBootstrappers :: (Array (Bootstrapper), StrMap Resource) -> Hook (StrMap Resource)
const check = bootstrappers => {
const indexed = bootstrappers.reduce((acc, boot) => Object.assign({}, acc, {
[boot.name]: (acc[boot.name] || []).concat([boot])
}), {});
const doubles = Object.values(indexed).filter(({length}) => length > 1);
if (doubles.length > 0) {
throw new TypeError(`Flawed dependency graph:\n${
doubles.map(boots => ` - [${boots[0].name}] has ${boots.length} providers:\n${
boots.map(boot => ` - One depending on [${boot.needs.join('; ')}]`).join('; and\n')
}`).join('\n')
}`);
}
const validateTree = ({path, checked, flaws}, {name, needs}) => {
if (checked.includes(name)) {
return {path, flaws, checked};
}
if (path.includes(name)) {
return {path, checked: checked.concat([name]), flaws: flaws.concat([
`[${name}] circles around via [${path.slice(path.indexOf(name)).join(' -> ')} -> ${name}]`
])};
}
const subs = needs.reduce((acc, need) => (
indexed[need] ?
validateTree(acc, indexed[need][0]) :
{path: acc.path, checked: acc.checked.concat([need]), flaws: acc.flaws.concat([
`[${name}] needs [${need}], which has no provider`
])}
), {path: path.concat([name]), checked, flaws});
return {path, checked: subs.checked.concat([name]), flaws: subs.flaws};
};
const {flaws} = bootstrappers.reduce(validateTree, {path: [], flaws: [], checked: []});
if (flaws.length > 0) {
throw new TypeError(`Flawed dependency graph:\n${
flaws.map(flaw => ` - ${flaw}`).join('\n')
}`);
}
};
const callBootstrappers = (bootstrappers, resources) => (

@@ -27,9 +73,2 @@ fluture.map(

const layer = bootstrappers.filter(pred);
if (layer.length === 0) {
return flutureHooks.acquire(fluture.reject(new Error(
`Cannot bootstrap: unable to provide for: ${
bootstrappers.map(({name}) => name).join('; ')
}`
)));
}
const remainder = bootstrappers.filter(x => !pred(x));

@@ -50,3 +89,3 @@ return complete(remainder, callBootstrappers(layer, resources));

//. needs :: Array Name,
//. bootstrap :: Services b -> Hook (Future Error a) b
//. bootstrap :: Services b -> Hook (Future c a) b
//. }

@@ -57,3 +96,3 @@ //. ```

//.
//# bootstrap :: Array (Bootstrapper a b) -> Hook (Future Error a) (Services b)
//# bootstrap :: Array (Bootstrapper a b) -> Hook (Future c a) (Services b)
//.

@@ -64,2 +103,3 @@ //. Given a list of service bootstrappers, returns a `Hook` that represents the

const bootstrap = bootstrappers => {
check(bootstrappers);
return complete(bootstrappers, flutureHooks.Hook.of({}));

@@ -66,0 +106,0 @@ };

10

package.json
{
"name": "booture",
"version": "0.1.1",
"version": "1.0.0",
"description": "Application bootstrapping on top of Fluture Hooks",

@@ -27,8 +27,8 @@ "main": "index",

"peerDependencies": {
"fluture": ">=10.0.0 <11.0.0",
"fluture-hooks": ">=0.2.0 <0.3.0"
"fluture": ">=10.0.0 <12.0.0",
"fluture-hooks": ">=0.2.0 <2.0.0"
},
"devDependencies": {
"fluture": "^10.3.0",
"fluture-hooks": "^0.2.0",
"fluture": "^11.0.0",
"fluture-hooks": "^1.0.0",
"rollup": "^1.1.0",

@@ -35,0 +35,0 @@ "transcribe": "^1.1.1",

@@ -113,3 +113,3 @@ # Booture

needs :: Array Name,
bootstrap :: Services b -> Hook (Future Error a) b
bootstrap :: Services b -> Hook (Future c a) b
}

@@ -120,3 +120,3 @@ ```

#### <a name="bootstrap" href="https://github.com/fluture-js/booture/blob/master/index.mjs#L151">`bootstrap :: Array (Bootstrapper a b) -⁠> Hook (Future Error a) (Services b)`</a>
#### <a name="bootstrap" href="https://github.com/fluture-js/booture/blob/master/index.mjs#L190">`bootstrap :: Array (Bootstrapper a b) -⁠> Hook (Future c a) (Services b)`</a>

@@ -123,0 +123,0 @@ Given a list of service bootstrappers, returns a `Hook` that represents the

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