Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

@orchestrator/core

orchestratora12.2kMIT2.0.6TypeScript support: included

Core package of Orchestrator library.

rendering, extensions, orchestrator, components, angular

readme

@orchestrator/core

Core package of Orchestrator library.

@orchestrator/core

It is providing capabilities to render UIs dynamically from a JSON like configurations using Angular components that are registered with it.

Usage

Create dynamic component

First you should create some component that you want to be able to render.

To do that - just decorate your component with @DynamicComponent decorator and pass an object with required class that describes it's configuration and use interface OrchestratorDynamicComponent that describes inputs:

import { Component, Input } from '@angular/core';
import {
  DynamicComponent,
  OrchestratorDynamicComponent,
  Option,
} from '@orchestrator/core';

export class YourComponentConfig {
  @Option()
  title?: string;
}

@Component({
  selector: 'your-dynamic-component',
  template: `Title is {{ config?.title }}`,
})
@DynamicComponent({ config: YourComponentConfig })
export class YourDynamicComponent
  implements OrchestratorDynamicComponent<YourComponentConfig>
{
  @Input()
  items?: OrchestratorConfigItem<any>[];
  @Input()
  config?: YourComponentConfig;
  @Input()
  context?: any;
}
  • config input is a config validated at runtime of your component that is provided via the JSON like config for each component
  • context input is any object that is passed down as a context from the top
  • items input contains further children of a JSON like subtree that your component may or may not decide to render

Register dynamic component

Next, you should tell Orchestrator which components are available for render.

To do that - just call OrchestratorCoreModule.withComponents([...]) with your components in your application module:

import { NgModule } from '@angular/core';
import { OrchestratorCoreModule } from '@orchestrator/core';
import { YourDynamicComponent } from './your-dynamic.component.ts';

@NgModule({
  imports: [OrchestratorCoreModule.withComponents([YourDynamicComponent])],
})
export class AppModule {}

Render dynamic UI

Finally you are ready to render UI dynamically using <orc-orchestrator> component and passing to it JSON like configuration of your UI:

import { Component } from '@angular/core';
import { OrchestratorConfigItem } from '@orchestrator/core';

@Component({
  template: `<orc-orchestrator [config]="config"></orc-orchestrator>`,
})
export class MyComponent {
  config: OrchestratorConfigItem<any> = {
    component: 'your-dynamic-component',
    config: { title: 'Dynamic title' },
  };
}

changelog

Change Log

All notable changes to this project will be documented in this file. See Conventional Commits for commit guidelines.

2.0.6 (2024-03-24)

Bug Fixes

  • deps: allow angular peer deps until v17 (#82) (fe24b5c)

2.0.5 (2022-01-21)

Bug Fixes

  • core: update fp-ts and io-ts to minimum compatible versions (44fb079)

2.0.4 (2022-01-15)

Note: Version bump only for package @orchestrator/core

2.0.3 (2022-01-11)

Note: Version bump only for package @orchestrator/core

2.0.2 (2022-01-11)

Bug Fixes

  • deps: allow rxjs v7.0.0 to be used as peer dependency (2689146)

2.0.1 (2021-12-14)

Note: Version bump only for package @orchestrator/core

2.0.0 (2021-12-13)

Note: Version bump only for package @orchestrator/core

2.0.0-next.2 (2021-12-10)

Bug Fixes

  • core: re-export gen-io-ts lib (34d2268)

2.0.0-next.1 (2021-12-09)

Bug Fixes

  • core: replace deprecate pipe usage from fp-ts (cc8f1a3)
  • core: update peer dependencies (b8927dd)

2.0.0-next.0 (2021-12-06)

Features

  • ng: update to Angular v13 (a95e8d4)

BREAKING CHANGES

  • ng: Libraries updated to Angular v13 and compiled using partial compilation

1.0.0 (2020-08-15)

Note: Version bump only for package @orchestrator/core

1.0.0-next.0 (2020-06-30)

Features

  • deps: require Angular v10 as a peer dependency (d70f8de)
  • deps: upgrade to Angular v10 (469d382)

BREAKING CHANGES

  • deps: After the library migrated to Angular v10 - now you should use Angular v10 as a peer dependency.
  • deps: Now the library is built using Angular v10. No public API changes.

0.2.2-next.0 (2020-05-01)

Bug Fixes

  • core: remove try/catch from configuration codec generation (b095913), closes #47
  • lib: upgrade to latest Angular with libs (5921d28)

0.2.1 (2020-03-17)

Note: Version bump only for package @orchestrator/core

0.2.1-next.0 (2020-03-17)

Bug Fixes

  • core: metadata definition logic (ff9ebb7)

0.2.0 (2020-03-09)

Bug Fixes

  • core: export component map APIs (6b50faa)
  • core: remove deprecated token for dynamic components (4f77dd8)

Features

  • core: add context to local injector and orchestrator component (ad33c68), closes #39

0.1.0 (2020-03-09)

Note: Version bump only for package @orchestrator/core

0.1.0-next.1 (2020-03-08)

Bug Fixes

  • changelogs: mention removed NPM packages (50a04f5)
  • core: remove old $schema field from package.json (a02b34d)

0.1.0-next.0 (2020-03-08)

NOTE: This version was removed from NPM due to incomplete package

Bug Fixes

  • core: add dynamic module providers to withComponents static method (f8b2c20)
  • core: add static injector maps (dd48e1f)
  • core: export public API entities (051faf5)
  • core: local injector map multi token provider (66c0be2), closes #28
  • core: make INJECTOR_MAP_TOKEN factory AOT compliant (89ef05a), closes #28
  • core: pin fp-ts and io-ts libs to specifix v1 (61f2cf4)
  • core: update @orchestrator/gen-io-ts library (e598706)
  • core: update deprecated types from io-ts (8f369e6)
  • core: update usage of ng-dynamic-component lib (d719d3a)
  • core: upgrade @orchestrator/gen-io-ts to v2.0.2 (b98ee54)
  • modules: move providers to static methods (38f56f5)

Features

  • core: add context to dynamic component inputs (5b1b12a)
  • core: add handlers to config item (0df9b77), closes #28
  • core: add more config decorators (5cffaff)
  • core: capture errors from @OptionFunction functions (b443b4c), closes #28
  • core: support custom arguments with $ prefix in functions (da9efec), closes #28
  • core: support handlers to attach to component outputs (aca1284), closes #28
  • core: update io-ts to v2 with it's deps libs (89ed81a)
  • release: automate libs releases with lerna (b455742)
  • repo: update to NG n9 and NX v9 (e0555ae)
  • ui-web: add textWithCtx to config of text component (b0e1927)

Performance Improvements

  • core: cache token mappings in mapped injector (844f7ff), closes #30
  • core: optimize function parsing regexes (c9f3193), closes #28

Reverts