Core

The Core package is a functionality composed by other utilities that brings the minimum tools required to create a plugin. It exposes an API using helpers that are accessible using the coreKernel, implemented by the @orion/core module.

Packages

Description

Deprecations

Responsible to handle deprecations alerts

DI

Responsible to manage dependency injection

Dispatchers

Responsible to fire Redux's actions

Error

Responsible to throw application errors

Globals

Responsible to manage the globals of the application

Kernel

Responsible to define, use and run a set of functionalities

Plugins

Responsible to manage interactions with the plugins

Selectors

Responsible to deal with Redux's selectors

Store

Responsible to handle Redux's store data

With-Factory

Responsible to give factories for dependency injection

Definitions summary

This module produces Action Creators and Selectors definitions by default to be consumed on the plugins, but you can also produce Action Handlers at plugin level to be consumed by itself or other plugins:

Action Creators

Copy
"orion": {
  "dispatchersHelper": {
    "actionCreators": {
      "produces": [
        "pluginAdded",
        "pluginShutdown",
        "pluginStarted",
        "startPlugin",
        "shutdownPlugin",
      ],
    }
  }
}

Selectors

Copy
"orion": {
  "selectorsHelper": {
    "selectorFactories": {
      "produces": [
        "existsPlugin",
        "getAllPluginsByPriority"
        "getAllPluginsName",
        "getPlugin",
        "getPluginProperty",
        "isPluginOn",
        "isPluginPrefersOn",
      ],
    }
  }
}

Example

To consume any of those definitions you should specify them on your plugin's metadata.

Important: Use only the ones your plugin really needs.

Copy
{
"name": "my-plugin",
  "version": "1.0.0",
  "pluginDependencies": { "action-handler-plugin": "1.0.0" },
  "orion": {
    "selectorsHelper": {
      "selectorFactories": {
        "consumes": { "@orion/core": ["isPluginOn"] }
      }
    },
    "dispatchersHelper": {
      "actionCreators": {
        "consumes": { "@orion/core": ["startPlugin"] }
      }
    },
    "storeHelper": {
      "actionHandlers": {
        "consumes": { "action-handler-plugin": ["myHandlerAction"] }
      }
    }
  }
}
Copy
{
  "name": "action-handler-plugin",
  "version": "1.0.0",
  "orion": {
    "storeHelper": {
      "actionHandlers": {
        "produces": ["myHandleAction"]
      }
    }
  }
}