ActionsRegistry: Enable filtering of Actions from sources (#32134)
* feat(backend-defaults): add config schema for action filtering Signed-off-by: benjdlambert <ben@blam.sh> * feat(backend-defaults): implement action filtering with glob patterns and attributes Signed-off-by: benjdlambert <ben@blam.sh> * test(backend-defaults): add edge case tests for action filtering Signed-off-by: benjdlambert <ben@blam.sh> * chore: add changeset for action filtering feature Signed-off-by: benjdlambert <ben@blam.sh> * feat: code review comments Signed-off-by: benjdlambert <ben@blam.sh> * chore: should always exclude Signed-off-by: benjdlambert <ben@blam.sh> --------- Signed-off-by: benjdlambert <ben@blam.sh>
This commit is contained in:
+98
@@ -154,6 +154,104 @@ export interface Config {
|
||||
* List of plugin sources to load actions from.
|
||||
*/
|
||||
pluginSources?: string[];
|
||||
|
||||
/**
|
||||
* Filter configuration for actions. Allows controlling which actions
|
||||
* are exposed to consumers based on patterns and attributes.
|
||||
*/
|
||||
filter?: {
|
||||
/**
|
||||
* Rules for actions to include. An action must match at least one rule to be included.
|
||||
* Each rule can specify an id pattern and/or attribute constraints.
|
||||
* If no include rules are specified, all actions are included by default.
|
||||
*
|
||||
* @example
|
||||
* ```yaml
|
||||
* include:
|
||||
* - id: 'catalog:*'
|
||||
* attributes:
|
||||
* destructive: false
|
||||
* - id: 'scaffolder:*'
|
||||
* ```
|
||||
*/
|
||||
include?: Array<{
|
||||
/**
|
||||
* Glob pattern for action IDs to match.
|
||||
* Action IDs have the format `{pluginId}:{actionName}`.
|
||||
* @example 'catalog:*'
|
||||
*/
|
||||
id?: string;
|
||||
|
||||
/**
|
||||
* Attribute constraints. All specified attributes must match.
|
||||
* Actions are compared against their resolved attributes (with defaults applied).
|
||||
*/
|
||||
attributes?: {
|
||||
/**
|
||||
* If specified, only match actions where destructive matches this value.
|
||||
* Actions default to destructive: true if not explicitly set.
|
||||
*/
|
||||
destructive?: boolean;
|
||||
|
||||
/**
|
||||
* If specified, only match actions where readOnly matches this value.
|
||||
* Actions default to readOnly: false if not explicitly set.
|
||||
*/
|
||||
readOnly?: boolean;
|
||||
|
||||
/**
|
||||
* If specified, only match actions where idempotent matches this value.
|
||||
* Actions default to idempotent: false if not explicitly set.
|
||||
*/
|
||||
idempotent?: boolean;
|
||||
};
|
||||
}>;
|
||||
|
||||
/**
|
||||
* Rules for actions to exclude. Exclusions take precedence over inclusions.
|
||||
* Each rule can specify an id pattern and/or attribute constraints.
|
||||
*
|
||||
* @example
|
||||
* ```yaml
|
||||
* exclude:
|
||||
* - id: '*:delete-*'
|
||||
* - attributes:
|
||||
* readOnly: false
|
||||
* ```
|
||||
*/
|
||||
exclude?: Array<{
|
||||
/**
|
||||
* Glob pattern for action IDs to match.
|
||||
* Action IDs have the format `{pluginId}:{actionName}`.
|
||||
* @example '*:delete-*'
|
||||
*/
|
||||
id?: string;
|
||||
|
||||
/**
|
||||
* Attribute constraints. All specified attributes must match.
|
||||
* Actions are compared against their resolved attributes (with defaults applied).
|
||||
*/
|
||||
attributes?: {
|
||||
/**
|
||||
* If specified, only match actions where destructive matches this value.
|
||||
* Actions default to destructive: true if not explicitly set.
|
||||
*/
|
||||
destructive?: boolean;
|
||||
|
||||
/**
|
||||
* If specified, only match actions where readOnly matches this value.
|
||||
* Actions default to readOnly: false if not explicitly set.
|
||||
*/
|
||||
readOnly?: boolean;
|
||||
|
||||
/**
|
||||
* If specified, only match actions where idempotent matches this value.
|
||||
* Actions default to idempotent: false if not explicitly set.
|
||||
*/
|
||||
idempotent?: boolean;
|
||||
};
|
||||
}>;
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user