* A helper function to build constructor args for `Context` * @param configOrParent - Application config or parent context * @param parent - Parent context if the first arg is application config
( configOrParent?: ApplicationConfig | Context, parent?: Context, )
| 42 | * @param parent - Parent context if the first arg is application config |
| 43 | */ |
| 44 | function buildConstructorArgs( |
| 45 | configOrParent?: ApplicationConfig | Context, |
| 46 | parent?: Context, |
| 47 | ) { |
| 48 | let name: string | undefined; |
| 49 | let parentCtx: Context | undefined; |
| 50 | |
| 51 | if (configOrParent instanceof Context) { |
| 52 | parentCtx = configOrParent; |
| 53 | name = undefined; |
| 54 | } else { |
| 55 | parentCtx = parent; |
| 56 | name = configOrParent?.name; |
| 57 | } |
| 58 | return [parentCtx, name]; |
| 59 | } |
| 60 | |
| 61 | /** |
| 62 | * Application is the container for various types of artifacts, such as |