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

@forrestjs/core

Package Overview
Dependencies
Maintainers
1
Versions
213
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@forrestjs/core - npm Package Compare versions

Comparing version 4.5.0-alpha.5 to 4.5.0-alpha.6

4

package.json
{
"name": "@forrestjs/core",
"description": "ForrestJS is the Javascript plugin syste.",
"version": "4.5.0-alpha.5",
"version": "4.5.0-alpha.6",
"main": "src/index.js",

@@ -34,3 +34,3 @@ "author": "Marco Pegoraro <marco.pegoraro@gmail.com",

},
"gitHead": "f1aa7a142b38d4199002e29750f6215d35ddfc26",
"gitHead": "04b9346c96f83d3e490199ea06ae8c5b22b821da",
"devDependencies": {

@@ -37,0 +37,0 @@ "jest": "^28.1.0"

@@ -48,16 +48,62 @@ # @forrestjs/core

### ForrestJS Extension
### ForrestJS Extensions
Extensions are at the very core of any ForrestJS Application. You can create or implement (register) extensions, depending on what you want to achieve.
When you create a ForrestJS Feature, you **register extensions** in order to provide _custom business logic_ to existing Services (and Features).
> EXAMPLE: You can _register a new extension_ to `$FASTIFY_ROUTE`
> to provide a new Fastify route definition in your app.
When you create a new _ForrestJS Service_, you **create new extensions** as so to allow further specialization of your logic.
> EXAMPLE: When your Postgres connection is established, you _create
> a new extension_ so that other Features can run their initialization
> SQL queries.
### ForrestJS Feature
A **ForrestJS Feature** is a package of Extensions that serve the same goal.
> EXAMPLE: you can pack together a few `$FASTIFY_ROUTE` extensions into a Feature called "static-pages".
Such Feature has the goal to provide generic information to the website visitor.
### ForrestJS Service
A **ForrestJS Service** implements a generic piece of business logic that should extended by some Features in order to provide real user value.
> EXAMPLE: [`service-pg`](https://github.com/forrestjs/forrestjs/tree/master/packages/service-pg) keeps an active connection pool towards a PostgreSQL database.
>
> But without some Features that actually use it to run some SQL
> queries, it doesn't really do much for the end user.
Services are often thin wrappers around existing NPM Modules such [Fastify](https://www.fastify.io/) or [Node Postgres](https://node-postgres.com/).
### ForrestJS App
A **ForrestJS App** is a composition of Services and Features that provide some kind of User value.
### App Manifest
### ForrestJS Service
We call "App Manifest" the entry point of a ForrestJS App (usually `src/index.js`).
### ForrestJS Service
This piece of code is mostly declarative and implements some specific responsibilities:
1. Validate the App's Environment
2. Provide configuration to Services and Features
3. Compose the App with lists of Services and Features
4. Handle boot errors
### Service (or Feature) Manifest
We call "Service or Feature Manifest" the entry point of a ForrestJS Service or Feature. (usually: `src/(services|features)/xxx/index.js`).
This piece of code is mostly declarative and implements some specific responsibilities:
1. Register all the Extensions that are implemented by the Service/Feature
2. Declare new Extension's Targets for **new Extensions** provided by the Service/Feature
---
## App Boot Lifecycle
const dotted = require('@marcopeg/dotted').default;
const { createExtension } = require('./create-extension');
const { registerExtension } = require('./register-action');
const { registerAction, registerExtension } = require('./register-action');
const { traceHook } = require('./tracer');

@@ -54,6 +54,2 @@ const { createRegistry } = require('./create-targets-registry');

registerAction: (ag1, ag2, ag3 = {}) => {
console.warn(
`[DEPRECATED] "registerAction()" is deprecated and will be remove in version 5.0.0.\nPlease use "registerExtension()" instead."`,
);
// Handle positional arguments:

@@ -88,2 +84,6 @@ // registerAction('hook', () => {})

registerExtension: (extension) => {
console.warn(
`[DEPRECATED] "registerExtension()" is deprecated and will be remove in version 5.0.0.\nPlease use "registerAction()" instead."`,
);
return registeredExtensions.push({

@@ -157,3 +157,3 @@ ...extension,

// Register all the actions declared by the integrations that have been executed
registeredExtensions.forEach(context.registerExtension);
registeredExtensions.forEach(context.registerAction);
};

@@ -184,3 +184,3 @@

const registerSettingsExtension = (buildAppSettings) => {
registerExtension({
registerAction({
name: `${constants.BOOT} app/settings`,

@@ -239,3 +239,3 @@ target: constants.SETTINGS,

...targetsRegistry,
registerAction: (...args) => registerExtension(...args),
registerAction,
registerExtension,

@@ -242,0 +242,0 @@ setConfig,

@@ -18,10 +18,10 @@ /**

const registerExtension = (__arg1 = {}, __arg2 = null, __arg3 = {}) => {
const registerAction = (__arg1 = {}, __arg2 = null, __arg3 = {}) => {
// (name, handler, options)
if (typeof __arg1 === 'string') {
console.warn(
`[DEPRECATED] "registerExtension(name, handler, option)" is deprecated and will be remove in version 5.x.`,
`[DEPRECATED] "registerAction(name, handler, option)" is deprecated and will be remove in version 5.x.`,
);
return registerExtension({
return registerAction({
...__arg3,

@@ -36,5 +36,5 @@ target: __arg1,

console.warn(
`[DEPRECATED] "registerExtension([name, handler, option])" is deprecated and will be remove in version 5.x.`,
`[DEPRECATED] "registerAction([name, handler, option])" is deprecated and will be remove in version 5.x.`,
);
return registerExtension({
return registerAction({
...(__arg1[2] || {}),

@@ -124,7 +124,7 @@ target: __arg1[0],

const registerAction = (...args) => {
const registerExtension = (...args) => {
console.warn(
`[DEPRECATED] "registerAction()" will be removed from v5.0.0.\nUse "registerExtension()" instead.`,
`[DEPRECATED] "registerExtension()" will be removed from v5.0.0.\nUse "registerAction()" instead.`,
);
return registerExtension(...args);
return registerAction(...args);
};

@@ -131,0 +131,0 @@

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