Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Background
API.md
is documenting the plugin-facing API of OpenSCD core and is not related to how a distribution might use OpenSCD core. We hope to keep this plugin-facing API stable (i.e. to only undergo fully backwards-compatible changes) for as long as we can. Broadly, the change we're suggesting here has two goals:In order to reach these goals, we propose the following
Changes
File name and preamble
API.md
todocs/API.plugins.md
, to more clearly indicate its purposeProperties passed to plugins
editable
, because which file types can be edited is the distribution's concerneditCount: number
todocVersion: unknown
as the community has already agreed onplugins
andhistory
Since we will be removing the ability for plugins to configure plugins (see below), the
plugins
property is no longer needed for that purpose. We hope to fulfill the second purpose of allowing plugins to amend edits by other plugins with the proposed Transactor API by means of itspast
andsquash
properties.Configuring plugins
We removed the entire section on
ConfigurePluginEvent
. Its main purpose was to enable a "plugin manager" / "app store" plugin which is needed in the community edition, but would be an active disadvantage in most other distributions (e.g. vendor tools and system operator's internal distributions). We therefore propose to handle this requirement at the distribution level. We at OMICRON, for example, would intend to provide a fully static version of OpenSCD core with no run-time extensibility as a base, and to provide a thin wrapper around that which does dynamic loading of plugins and provides an "app store" experience to the user.This way we keep the API surface minimal and don't needlessly restrict OpenSCD core implementations or distributions for the time being. If another different use case for allowing plugins to configure other plugins should arise in the future, we can always extend the API to include this facility again.
Minor adjustments
Edit
->EditV2
Potential further changes
As the need arises in the future, we might
customProperties: Record<string, unknown>
property to allow a distribution to pass further information to plugins which support ittransactor: Transactor<EditV2>
property