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

@pan-os/heimdall

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@pan-os/heimdall - npm Package Compare versions

Comparing version 1.0.0 to 1.0.2

__tests__/__snapshots__/index.spec.js.md

17

index.js
/**
* Helper function to get the microsservice id.
* @param {Object} microService - The microservice object
* @returns {String} - The microService id
*/
const getMicrosserviceId = (microsservice) => {
const { id, name, path } = microsservice;
const getMicroServiceId = (microService) => {
const { id, name, path } = microService;

@@ -14,4 +16,5 @@ return id || name || path;

* with routing matching
* on restify routes
* @memberof pan-os
* @param {Object} server - The restify instance
* @param {Array} services - The packages list
*/

@@ -25,5 +28,2 @@ const attachMicroservice = (server, services) => {

*
* This had to change, since verifying cerberus should not be a
* responsibility of the service itself. This gives Heimdall a
* single responsibility of handling the server integration.
* This hides access to the server instance on the microsservies,

@@ -35,6 +35,7 @@ * which makes sense, since microsservices should not be aware of

server[method](path, action);
} catch (e) {
} catch (error) {
// Should be a configuration error, this validation doesn't happen
// at "runtime".
throw new Error(`Server configuration failed to register ${getMicrosserviceId(path)}`);
console.error(error);
throw new Error(`Server configuration failed to register ${getMicroServiceId(path)}`);
}

@@ -41,0 +42,0 @@ });

{
"name": "@pan-os/heimdall",
"version": "1.0.0",
"version": "1.0.2",
"description": "A modular approach to add pseudo microservices organization into restify apps",
"main": "index.js",
"scripts": {
"test": "yarn test"
"test": "xo && ava --tap | tap-nyan"
},
"repository": {
"type": "git",
"url": "https://github.com/clucasalcantara/heimdall"
"url": "https://github.com/pan-os/heimdall/heimdall"
},

@@ -20,8 +20,27 @@ "keywords": [

],
"author": "Caio Alcantara",
"author": "Pan Engineering",
"license": "MIT",
"bugs": {
"url": "https://github.com/clucasalcantara/heimdall/issues"
"url": "https://github.com/pan-os/heimdall/issues"
},
"homepage": "https://github.com/clucasalcantara/heimdall#readme"
"homepage": "https://github.com/pan-os/heimdall#readme",
"devDependencies": {
"ava": "1.0.0-beta.8",
"tap-nyan": "^1.1.0",
"xo": "^0.23.0"
},
"xo": {
"extends": [
"prettier"
],
"globals": [
"it",
"describe",
"before"
],
"rules": {
"prefer-promise-reject-errors": 0,
"no-use-extend-native/no-use-extend-native": 0
}
}
}

@@ -9,2 +9,3 @@ # Heimdall ![CI status](https://img.shields.io/badge/build-passing-brightgreen.svg)

## Installation
`$ yarn add @pan-os/heimdall`

@@ -18,2 +19,4 @@ ### Requirements

### Routes entrypoint
```javascript

@@ -24,18 +27,31 @@ /**

const Heimdall = require('heimdall');
const { protect: withCerberus } = require('cerberus');
/**
* Pseudo microservices
*/
const {
terms, auth, config, user,
} = require('../services');
const { user } = require('../services');
module.exports = (server) => {
// Attach microservices to /
Heimdall.attachMicroservice(server, auth);
Heimdall.attachMicroservice(server, user);
Heimdall.attachMicroservice(server, terms);
Heimdall.attachMicroservice(server, withCerberus(config));
};
```
## Services folder structure
Represents your microservices
Example Service Structure
```javascript
// index.js
module.exports = [
{
method: 'post',
path: '/user/register',
action: (req, res, next) => { ... }
}
];
// And you will be able to do a post to http://localhost:3000/user/register and
// also should be able to manipulate/create your response into your action callback
```

@@ -48,3 +64,9 @@

```
## Contributors 🎉
Thanks goes out to all these wonderful people ([emoji key](https://github.com/kentcdodds/all-contributors#emoji-key)):
<!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->
<!-- prettier-ignore -->
[<img src="https://avatars0.githubusercontent.com/u/15777306?s=460&v=4" width="100px;"/><br /><sub><b>Sérgio Freitas</b></sub>](https://github.com/sergioFreitas1990)<br />
## Contributing

@@ -56,2 +78,2 @@ Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

## License
[MIT](https://choosealicense.com/licenses/mit/)
[MIT](https://choosealicense.com/licenses/mit/)
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