frontend-plugin-api: plugins now have pluginId
Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
This commit is contained in:
@@ -252,11 +252,12 @@ function resolveV2Inputs(
|
||||
return mapValues(inputMap, (input, inputName) => {
|
||||
const allAttachedNodes = attachments.get(inputName) ?? [];
|
||||
const collector = parentCollector.child({ inputName });
|
||||
const inputPluginId = node.spec.plugin.id;
|
||||
const inputPluginId = node.spec.plugin.pluginId ?? node.spec.plugin.id;
|
||||
|
||||
const attachedNodes = input.config.internal
|
||||
? allAttachedNodes.filter(attachment => {
|
||||
const attachmentPluginId = attachment.spec.plugin.id;
|
||||
const attachmentPluginId =
|
||||
attachment.spec.plugin.pluginId ?? attachment.spec.plugin.id;
|
||||
if (attachmentPluginId !== inputPluginId) {
|
||||
collector.report({
|
||||
code: 'EXTENSION_INPUT_INTERNAL_IGNORED',
|
||||
|
||||
@@ -57,7 +57,11 @@ export function resolveAppNodeSpecs(options: {
|
||||
if (forbidden.has(extension.id)) {
|
||||
collector.report({
|
||||
code: 'EXTENSION_IGNORED',
|
||||
message: `It is forbidden to override the '${extension.id}' extension, attempted by the '${extension.plugin.id}' plugin`,
|
||||
message: `It is forbidden to override the '${
|
||||
extension.id
|
||||
}' extension, attempted by the '${
|
||||
extension.plugin.pluginId ?? extension.plugin.id
|
||||
}' plugin`,
|
||||
context: {
|
||||
plugin: extension.plugin,
|
||||
extensionId: extension.id,
|
||||
@@ -91,7 +95,7 @@ export function resolveAppNodeSpecs(options: {
|
||||
);
|
||||
|
||||
const appPlugin =
|
||||
plugins.find(plugin => plugin.id === 'app') ??
|
||||
plugins.find(plugin => (plugin.pluginId ?? plugin.id) === 'app') ??
|
||||
createFrontendPlugin({
|
||||
pluginId: 'app',
|
||||
});
|
||||
@@ -159,7 +163,9 @@ export function resolveAppNodeSpecs(options: {
|
||||
if (seenExtensionIds.has(extension.id)) {
|
||||
collector.report({
|
||||
code: 'EXTENSION_IGNORED',
|
||||
message: `The '${extension.id}' extension from the '${params.plugin.id}' plugin is a duplicate and will be ignored`,
|
||||
message: `The '${extension.id}' extension from the '${
|
||||
params.plugin.pluginId ?? params.plugin.id
|
||||
}' plugin is a duplicate and will be ignored`,
|
||||
context: {
|
||||
plugin: params.plugin,
|
||||
extensionId: extension.id,
|
||||
|
||||
@@ -77,7 +77,10 @@ export function createPluginInfoAttacher(
|
||||
}),
|
||||
});
|
||||
|
||||
const infoWithOverrides = applyInfoOverrides(plugin.id, resolvedInfo);
|
||||
const infoWithOverrides = applyInfoOverrides(
|
||||
plugin.pluginId ?? plugin.id,
|
||||
resolvedInfo,
|
||||
);
|
||||
return normalizePluginInfo(infoWithOverrides);
|
||||
}),
|
||||
};
|
||||
|
||||
@@ -401,7 +401,8 @@ function createApiFactories(options: {
|
||||
if (apiFactory) {
|
||||
const apiRefId = apiFactory.api.id;
|
||||
const ownerId = getApiOwnerId(apiRefId);
|
||||
const pluginId = apiNode.spec.plugin.id ?? 'app';
|
||||
const pluginId =
|
||||
apiNode.spec.plugin.pluginId ?? apiNode.spec.plugin.id ?? 'app';
|
||||
const existingFactory = factoriesById.get(apiRefId);
|
||||
|
||||
// This allows modules to override factories provided by the plugin, but
|
||||
|
||||
Reference in New Issue
Block a user