feat(ui): add UI-level nodes denylist

This simply hides nodes from the workflow editor. The nodes will still work if an API request is made with them. For example, you could hide `iterate` nodes from the workflow editor, but if the Linear UI makes use of those nodes, they will still function.

- Update `AppConfig` with optional property `nodesDenylist: string[]`
- If provided, nodes are filtered out by `type` in the workflow editor
This commit is contained in:
psychedelicious
2023-09-06 11:56:53 +10:00
committed by Kent Keirsey
parent dc771d9645
commit 7254a6a517
4 changed files with 13 additions and 4 deletions

View File

@ -60,11 +60,15 @@ const isNotInDenylist = (schema: InvocationSchemaObject) =>
!invocationDenylist.includes(schema.properties.type.default);
export const parseSchema = (
openAPI: OpenAPIV3.Document
openAPI: OpenAPIV3.Document,
nodesDenylistExtra: string[] = []
): Record<string, InvocationTemplate> => {
const filteredSchemas = Object.values(openAPI.components?.schemas ?? {})
.filter(isInvocationSchemaObject)
.filter(isNotInDenylist);
.filter(isNotInDenylist)
.filter(
(schema) => !nodesDenylistExtra.includes(schema.properties.type.default)
);
const invocations = filteredSchemas.reduce<
Record<string, InvocationTemplate>