-
Notifications
You must be signed in to change notification settings - Fork 12k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(core): Port nodes config (no-changelog) (#10140)
Co-authored-by: कारतोफ्फेलस्क्रिप्ट™ <[email protected]>
- Loading branch information
Showing
14 changed files
with
95 additions
and
65 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
import { Config, Env, Nested } from '../decorators'; | ||
|
||
function isStringArray(input: unknown): input is string[] { | ||
return Array.isArray(input) && input.every((item) => typeof item === 'string'); | ||
} | ||
|
||
class JsonStringArray extends Array<string> { | ||
constructor(str: string) { | ||
super(); | ||
|
||
let parsed: unknown; | ||
|
||
try { | ||
parsed = JSON.parse(str); | ||
} catch { | ||
return []; | ||
} | ||
|
||
return isStringArray(parsed) ? parsed : []; | ||
} | ||
} | ||
|
||
@Config | ||
class CommunityPackagesConfig { | ||
/** Whether to enable community packages */ | ||
@Env('N8N_COMMUNITY_PACKAGES_ENABLED') | ||
enabled: boolean = true; | ||
} | ||
|
||
@Config | ||
export class NodesConfig { | ||
/** Node types to load. Includes all if unspecified. @example '["n8n-nodes-base.hackerNews"]' */ | ||
@Env('NODES_INCLUDE') | ||
readonly include: JsonStringArray = []; | ||
|
||
/** Node types not to load. Excludes none if unspecified. @example '["n8n-nodes-base.hackerNews"]' */ | ||
@Env('NODES_EXCLUDE') | ||
readonly exclude: JsonStringArray = []; | ||
|
||
/** Node type to use as error trigger */ | ||
@Env('NODES_ERROR_TRIGGER_TYPE') | ||
readonly errorTriggerType: string = 'n8n-nodes-base.errorTrigger'; | ||
|
||
@Nested | ||
readonly communityPackages: CommunityPackagesConfig; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.