UNPKG

@orchestrator/core

Version:
1 lines 75.2 kB
{"version":3,"file":"orchestrator-core.mjs","sources":["../../../../libs/core/src/lib/component-map.ts","../../../../libs/core/src/lib/metadata/util.ts","../../../../libs/core/src/lib/metadata/dynamic-component.ts","../../../../libs/core/src/lib/component-locator/component-locator.service.ts","../../../../libs/core/src/lib/error-strategy/error-strategy.ts","../../../../libs/core/src/lib/metadata/configuration.ts","../../../../libs/core/src/lib/util.ts","../../../../libs/core/src/lib/config/function-error.ts","../../../../libs/core/src/lib/config/invalid-configuration-error.ts","../../../../libs/core/src/lib/config/option/function.ts","../../../../libs/core/src/lib/config/configuration.service.ts","../../../../libs/core/src/lib/error-strategy/throw-error-strategy.ts","../../../../libs/core/src/lib/render-component.ts","../../../../libs/core/src/lib/injectors/local-injector-map.ts","../../../../libs/core/src/lib/injectors/mapped-injector.ts","../../../../libs/core/src/lib/injectors/static-injector-map.ts","../../../../libs/core/src/lib/injectors/providers.ts","../../../../libs/core/src/lib/config/option/allowed-values.ts","../../../../libs/core/src/lib/config/option/integer.ts","../../../../libs/core/src/lib/config/option/range.ts","../../../../libs/core/src/lib/config/option/required.ts","../../../../libs/core/src/lib/config/option/type.ts","../../../../libs/core/src/lib/config/option/option.ts","../../../../libs/core/src/lib/config/option/type-factory.ts","../../../../libs/core/src/lib/config/option/not-present.ts","../../../../libs/core/src/lib/injectors/injector-registry.service.ts","../../../../libs/core/src/lib/injectors/local-injector.ts","../../../../libs/core/src/lib/render-item/components-registry.service.ts","../../../../libs/core/src/lib/render-item/render-item.component.ts","../../../../libs/core/src/lib/render-item/render-item.component.html","../../../../libs/core/src/lib/orchestrator/orchestrator.component.ts","../../../../libs/core/src/lib/orchestrator/orchestrator.component.html","../../../../libs/core/src/lib/core.module.ts","../../../../libs/core/src/lib/error-strategy/suppress-error-strategy.ts","../../../../libs/core/src/public_api.ts","../../../../libs/core/src/orchestrator-core.ts"],"sourcesContent":["import { InjectionToken, Type } from '@angular/core';\n\nimport { OrchestratorDynamicComponentType } from './types';\n\nexport type DefaultDynamicComponent = OrchestratorDynamicComponentType;\n\nexport interface ComponentMap<T extends Type<any> = DefaultDynamicComponent> {\n [k: string]: T;\n}\n\nexport type ComponentRegistry<T extends Type<any> = DefaultDynamicComponent> =\n | T[]\n | ComponentMap<T>;\n\nexport const COMPONENTS = new InjectionToken<ComponentRegistry[]>('COMPONENTS');\n","export function createMetadataGetSet<M = any>(key: string) {\n const k = Symbol(key);\n return {\n set: defineMetadata.bind(null, k) as <T>(value: M, target: T) => T,\n get: (type: any): M | undefined => type[k],\n };\n}\n\nexport function defineMetadata<T>(\n key: string | number | symbol,\n value: any,\n target: T,\n) {\n if (key in target === false) {\n Object.defineProperty(target, key, {\n enumerable: false,\n configurable: true,\n writable: true,\n value,\n });\n } else {\n target[key] = value;\n }\n return target;\n}\n","import { Type } from '@angular/core';\n\nimport { OrchestratorDynamicComponentType } from '../types';\nimport { createMetadataGetSet } from './util';\n\nexport interface DynamicComponentOptions<C> {\n config: Type<C>;\n}\n\nconst dynamicComponentMeta = createMetadataGetSet<DynamicComponentOptions<any>>(\n 'DynamicComponentMeta',\n);\n\nexport function DynamicComponent<C>(\n options: DynamicComponentOptions<C>,\n): ClassDecorator {\n return target => dynamicComponentMeta.set(options, target);\n}\n\nexport function getDynamicComponentMeta<C>(\n type: OrchestratorDynamicComponentType<C>,\n): DynamicComponentOptions<C> | undefined {\n return dynamicComponentMeta.get(type);\n}\n","import {\n ComponentFactoryResolver,\n Injectable,\n Injector,\n Type,\n} from '@angular/core';\n\nimport {\n ComponentMap,\n ComponentRegistry,\n COMPONENTS,\n DefaultDynamicComponent,\n} from '../component-map';\nimport { getDynamicComponentMeta } from '../metadata/dynamic-component';\nimport {\n GetOrchestratorDynamicComponentConfig,\n OrchestratorDynamicComponentType,\n} from '../types';\n\n@Injectable()\nexport class ComponentLocatorService {\n private componentRegistry = this.injector.get(COMPONENTS);\n\n private componentArray = this.componentRegistry\n .filter(isComponentArray)\n .reduce((arr, reg) => [...arr, ...reg], []);\n\n private componentArrayMap = this.componentArray\n .map(type => this.cfr.resolveComponentFactory(type))\n .reduce(\n (map, compFactory) => ({\n ...map,\n [compFactory.selector]: compFactory.componentType,\n }),\n Object.create(null) as ComponentMap,\n );\n\n private componentMaps = this.componentRegistry.filter(isComponentMap);\n private componentMap = this.componentMaps.reduce(\n (obj, map) => ({ ...obj, ...map }),\n this.componentArrayMap as ComponentMap,\n );\n\n constructor(\n private injector: Injector,\n private cfr: ComponentFactoryResolver,\n ) {}\n\n resolve<T, C = GetOrchestratorDynamicComponentConfig<T>>(\n component: string | OrchestratorDynamicComponentType<C>,\n ): OrchestratorDynamicComponentType<C> | undefined {\n if (typeof component === 'function') {\n return component;\n }\n\n return this.componentMap[component];\n }\n\n getDefaultConfig<C>(\n component: OrchestratorDynamicComponentType<C>,\n ): C | null {\n const configType = this.getConfigType(component);\n\n if (!configType) {\n return null;\n }\n\n return this.injector.get(configType, null);\n }\n\n getConfigType<C>(\n component: OrchestratorDynamicComponentType<C>,\n ): Type<C> | null {\n if (!component) {\n return null;\n }\n\n const meta = getDynamicComponentMeta(component);\n\n if (!meta) {\n return null;\n }\n\n return meta.config;\n }\n}\n\nfunction isComponentArray(\n reg: ComponentRegistry,\n): reg is DefaultDynamicComponent[] {\n return Array.isArray(reg);\n}\n\nfunction isComponentMap(reg: ComponentRegistry): reg is ComponentMap {\n return !!reg && !Array.isArray(reg);\n}\n","export abstract class ErrorStrategy {\n abstract handle(error: Error): void;\n}\n","import { Type } from '@angular/core';\n\nimport { createMetadataGetSet } from './util';\n\nexport interface ConfigurationMeta {\n prop: string | symbol;\n decorator: any;\n args: any[];\n}\n\nconst configurationMeta = createMetadataGetSet<ConfigurationMeta[]>(\n 'ConfigurationMeta',\n);\n\n/**\n * @internal\n */\nexport function addConfig(target: any, meta: ConfigurationMeta) {\n const configs = getConfigs(target);\n configurationMeta.set([...configs, meta], target);\n}\n\n/**\n * @internal\n */\nexport function getConfigs(type: Type<any>): ConfigurationMeta[] {\n return configurationMeta.get(type) || [];\n}\n","/**\n * @internal\n */\nexport function execRegex(regex: RegExp, val: string): string[] {\n const arr = [];\n let group: RegExpExecArray;\n\n while ((group = regex.exec(val)) !== null) {\n if (group.index === regex.lastIndex) {\n regex.lastIndex++;\n }\n\n arr.push(...group);\n }\n\n return !arr.length ? null : arr;\n}\n\n/**\n * @internal\n */\nexport function parseFunction(fnStr: string) {\n const fnRegex = /^function\\s*(?:[A-z0-9]+)?\\s*\\(([\\w\\W]*?)\\)\\s*\\{([\\w\\W]*)\\}$/gm;\n const arrowFnRegex = /^\\(?([\\w\\W]*?)\\)?\\s*=>\\s*\\{([\\w\\W]*)\\}$/gm;\n const returnArrowFnRegex = /^\\(?([\\w\\W]*?)\\)?\\s*=>\\s*([^}{]*)$/gm;\n\n fnStr = fnStr.trim();\n\n const fnInfo =\n execRegex(fnRegex, fnStr) ||\n execRegex(arrowFnRegex, fnStr) ||\n execRegex(returnArrowFnRegex, fnStr);\n\n if (!fnInfo || fnInfo.length < 2) {\n return null;\n }\n\n const _args = fnInfo.length > 2 ? fnInfo[1] || '' : '';\n const args = _args\n .split(',')\n .map(arg => arg.trim())\n .filter(arg => !!arg);\n\n const isReturnFunction = returnArrowFnRegex.test(fnStr);\n const _body = fnInfo[fnInfo.length - 1];\n\n if (!_body && isReturnFunction) {\n return null;\n }\n\n const body = isReturnFunction ? `return ${_body}` : _body || '';\n\n return { args, body };\n}\n\n/**\n * @internal\n */\nexport function isArgOptional(argExpr: string): boolean {\n return /^[^=]+\\s*=.+/.test(argExpr);\n}\n\n/**\n * @internal\n */\nexport function getArgName(argExpr: string): string {\n return argExpr.match(/^([^=\\s]+)(?:\\s*=.+)?/)[1];\n}\n","import { Type } from '@angular/core';\n\nexport class FunctionError<C> extends Error {\n constructor(\n public config: Type<C>,\n public error: Error,\n public fnName: string,\n public fnBody: string,\n public args: any[],\n ) {\n super(\n `During function execution ${fnName} from config ${config.name}:\n ${error}\n\n Stack:\n ${error.stack}\n\n Function Body:\n ${fnBody}\n\n Function Arguments: [${args.join('\\n')}]`,\n );\n }\n}\n","import { Type } from '@angular/core';\nimport { Validation } from 'io-ts';\nimport { PathReporter } from 'io-ts/lib/PathReporter';\n\nexport class InvalidConfigurationError<C> extends Error {\n component: Type<C>;\n validation: Validation<C>;\n config?: C;\n\n constructor(component: Type<C>, validation: Validation<any>, config?: any) {\n const paths = PathReporter.report(validation).join('\\n');\n\n super(\n `Invalid configuration for component ${component.name}'s config:\n ${paths}\n\n Actual config: ${config ? JSON.stringify(config, null, 2) : config}`,\n );\n\n this.component = component;\n this.validation = validation;\n this.config = config;\n }\n}\n","import { Injector } from '@angular/core';\nimport { Property } from '@orchestrator/gen-io-ts';\nimport { chain } from 'fp-ts/lib/Either';\nimport { pipe } from 'fp-ts/function';\nimport * as t from 'io-ts';\n\nimport { addConfig } from '../../metadata/configuration';\nimport { parseFunction } from '../../util';\n\nexport type CustomInjectorFactory = (parentInjector: Injector) => Injector;\n\nexport interface FunctionMeta {\n args: string[];\n body: string;\n}\n\nexport interface FunctionWithMeta extends Function, FunctionMeta {}\n\nexport const CUSTOM_FUNCTION_ARGUMENT_PREFIX = '$';\n\nexport const FunctionFromMeta = new t.Type<FunctionWithMeta, FunctionMeta>(\n 'FunctionFromMeta',\n isFunctionWithMeta,\n (m, c) =>\n pipe(\n t.UnknownRecord.validate(m, c),\n chain((obj) => {\n if (!hasFunctionMeta(obj)) {\n return t.failure(m, c);\n }\n\n // Move custom arguments to the end\n obj.args.sort((arg1, arg2) => {\n const is1Custom = arg1.startsWith(CUSTOM_FUNCTION_ARGUMENT_PREFIX);\n const is2Custom = arg2.startsWith(CUSTOM_FUNCTION_ARGUMENT_PREFIX);\n\n if (is1Custom === is2Custom) {\n return 0;\n }\n\n return is1Custom ? 1 : -1;\n });\n\n const fn = new Function(...obj.args, obj.body) as FunctionWithMeta;\n fn.args = obj.args;\n fn.body = obj.body;\n\n return t.success(fn);\n }),\n ),\n (fn) => ({ args: fn.args, body: fn.body }),\n);\n\nexport const FunctionFromString = new t.Type<FunctionWithMeta, string>(\n 'FunctionFromString',\n isFunctionWithMeta,\n (m, c) =>\n pipe(\n t.string.validate(m, c),\n chain((str) => {\n try {\n return FunctionFromMeta.validate(parseFunction(str), c);\n } catch {\n return t.failure(str, c);\n }\n }),\n ),\n (fn) => fn.toString(),\n);\n\n// eslint-disable-next-line @typescript-eslint/ban-types\nexport const FunctionWithMeta = new t.Type<FunctionWithMeta, Function>(\n 'FunctionWithMeta',\n isFunctionWithMeta,\n (m, c) =>\n pipe(\n t.Function.validate(m, c),\n chain((fn) => {\n try {\n // Reconstruct function from string to reorder arguments\n return FunctionFromString.validate(fn.toString(), c);\n } catch {\n return t.failure(fn, c);\n }\n }),\n ),\n (fn) => fn,\n);\n\nexport function OptionFunction(\n customInjector?: CustomInjectorFactory,\n): PropertyDecorator {\n const decorator = Property({\n typeFactory: () =>\n t.union([FunctionFromString, FunctionFromMeta, FunctionWithMeta]),\n });\n return (target, prop) => {\n decorator(target, prop);\n addConfig(target, {\n prop,\n decorator: OptionFunction,\n args: [customInjector],\n });\n };\n}\n\nfunction hasFunctionMeta(obj: any): obj is FunctionMeta {\n return obj && Array.isArray(obj.args) && typeof obj.body === 'string';\n}\n\nfunction isFunctionWithMeta(fn: any): fn is FunctionWithMeta {\n return typeof fn === 'function' && hasFunctionMeta(fn);\n}\n","import { Injectable, Injector, Type } from '@angular/core';\nimport { genIoType } from '@orchestrator/gen-io-ts';\nimport { fold as foldEither, isLeft, left, map } from 'fp-ts/lib/Either';\nimport { fold, none, Option, some } from 'fp-ts/lib/Option';\nimport { pipe } from 'fp-ts/function';\nimport { Errors, Type as IoCodec, Validation } from 'io-ts';\n\nimport { ErrorStrategy } from '../error-strategy/error-strategy';\nimport { ConfigurationMeta, getConfigs } from '../metadata/configuration';\nimport { getArgName, isArgOptional } from '../util';\nimport { FunctionError } from './function-error';\nimport { InvalidConfigurationError } from './invalid-configuration-error';\nimport {\n CustomInjectorFactory,\n FunctionWithMeta,\n OptionFunction,\n} from './option/function';\n\n@Injectable()\nexport class ConfigurationService {\n private codecMap = new Map<Type<any>, IoCodec<any>>();\n\n constructor(\n private errorStrategy: ErrorStrategy,\n private injector: Injector,\n ) {}\n\n decode<T>(type: Type<T>, config: T, injector?: Injector): T;\n decode<T, C>(type: Type<T>, config: C, injector?: Injector): T | C;\n decode<T, C>(type: Type<T>, config: C, injector?: Injector): T | C {\n return pipe(\n this.validate(type, config),\n map((c) => this.processFunctions(type, c, config, injector)),\n foldEither(\n () => config,\n (decodedConfig) => decodedConfig,\n ),\n );\n }\n\n validate<T, C>(type: Type<T>, config: C): Validation<T | C> {\n const validation = pipe(\n this.getCodecFor(type),\n fold(\n () => left<Errors, T>([]),\n (codec) => codec.decode(config),\n ),\n );\n\n if (isLeft(validation) && type) {\n this.errorStrategy.handle(\n new InvalidConfigurationError(type, validation, config),\n );\n }\n\n return validation;\n }\n\n getMetaOf(type: Type<any>): ConfigurationMeta[] {\n return getConfigs(type.prototype);\n }\n\n private getCodecFor<T>(type: Type<T>): Option<IoCodec<T>> {\n if (!type) {\n return none;\n }\n\n const codec = this.codecMap.get(type) || genIoType(type);\n this.codecMap.set(type, codec); // Set codec back to cache\n return some(codec);\n }\n\n private processFunctions<T>(\n type: Type<T>,\n config: T,\n originalConfig: any,\n injector = this.injector,\n ): T {\n const meta = this.getMetaOf(type);\n\n meta\n .filter((m) => m.decorator === OptionFunction && config[m.prop])\n .forEach((m) => {\n const customInjectorFactory = m.args[0] as CustomInjectorFactory;\n const customInjector = customInjectorFactory\n ? customInjectorFactory(injector)\n : injector;\n\n const { args, fn } = this.bindFunction(config[m.prop], customInjector);\n\n config[m.prop] = fn;\n config[m.prop] = this.guardFunction(\n config[m.prop],\n type,\n String(m.prop),\n originalConfig[m.prop],\n args,\n );\n });\n\n return config;\n }\n\n private bindFunction(\n fn: FunctionWithMeta,\n injector: Injector,\n ): { fn: FunctionWithMeta; args: any[] } {\n const { args, body } = fn;\n\n const resolvedArgs = args\n .filter((arg) => !arg.startsWith('$'))\n .map((arg) => this.resolveArg(arg, injector));\n\n const boundFn = fn.bind(null, ...resolvedArgs) as FunctionWithMeta;\n boundFn.args = args;\n boundFn.body = body;\n\n return { fn: boundFn, args: resolvedArgs };\n }\n\n private guardFunction(\n fn: FunctionWithMeta,\n configType: Type<any>,\n fnName: string,\n fnBody: string,\n boundArgs: any[],\n ): FunctionWithMeta {\n const guardedFn = ((...args: any[]) => {\n try {\n return fn(...args);\n } catch (e) {\n this.errorStrategy.handle(\n new FunctionError(configType, e, fnName, fnBody, [\n ...boundArgs,\n ...args,\n ]),\n );\n }\n }) as unknown as FunctionWithMeta;\n\n guardedFn.args = fn.args;\n guardedFn.body = fn.body;\n\n return guardedFn;\n }\n\n private resolveArg(argExpr: string, injector: Injector): any {\n const arg = getArgName(argExpr);\n const isOptional = isArgOptional(argExpr);\n\n // Dynamically resolve function arguments - no type info available\n const res = injector.get(\n arg,\n isOptional ? null : Injector.THROW_IF_NOT_FOUND,\n );\n\n return res === null && isOptional ? undefined : res;\n }\n}\n","import { ErrorStrategy } from './error-strategy';\n\nexport class ThrowErrorStrategy extends ErrorStrategy {\n handle(error: Error): void {\n throw error;\n }\n}\n","import { InjectorRegistryService } from './injectors/injector-registry.service';\nimport { OrchestratorConfigItem } from './types';\n\n/**\n * Abstract component type that is responsible to render dynamic component\n */\nexport abstract class RenderComponent {\n /**\n * Mark for check dynamic component\n */\n abstract markForCheck(): void;\n\n /**\n * Add new item to dynamic component `items` property\n * causing it to render new component if supported by component\n */\n abstract addItem(item: OrchestratorConfigItem<any>): void;\n\n /**\n * Remove item from dynamic component `item` property\n * causing it to remove rendered component from view\n */\n abstract removeItem(item: OrchestratorConfigItem<any>): void;\n\n /**\n * Remove all dynamic components from view\n */\n abstract clearItems(): void;\n\n /**\n * Get {@link InjectorRegistryService} to manage injector resolution\n */\n abstract getInjectorRegistryService(): InjectorRegistryService;\n}\n","import { InjectionToken, Injector, StaticProvider, Type } from '@angular/core';\n\nimport { RenderComponent } from '../render-component';\nimport { InjectorMap } from '../types';\n\nexport type LocalGetInjectorToken = () => Injector;\nexport type LocalGetComponentToken = () => any;\nexport type LocalGetConfigToken = () => any;\nexport type LocalUpdateConfigToken = (config: any) => any;\nexport type LocalIsConfigValidToken = () => boolean;\nexport type LocalGetContextToken = () => any;\n\nexport const LOCAL_GET_INJECTOR = new InjectionToken<LocalGetInjectorToken>(\n 'LOCAL_GET_INJECTOR',\n);\n\nexport const LOCAL_GET_COMPONENT = new InjectionToken<LocalGetComponentToken>(\n 'LOCAL_GET_COMPONENT',\n);\n\nexport const LOCAL_GET_CONFIG = new InjectionToken<LocalGetConfigToken>(\n 'LOCAL_GET_CONFIGURATION',\n);\n\nexport const LOCAL_UPDATE_CONFIG = new InjectionToken<LocalUpdateConfigToken>(\n 'LOCAL_GET_CONFIGURATION',\n);\n\nexport const LOCAL_GET_CONFIG_VALID = new InjectionToken<\n LocalIsConfigValidToken\n>('LOCAL_GET_CONFIGURATION_VALID');\n\nexport const LOCAL_GET_CONTEXT = new InjectionToken<LocalGetContextToken>(\n 'LOCAL_GET_CONTEXT',\n);\n\nexport const LOCAL_INJECTOR_MAP: InjectorMap = {\n getInjector: LOCAL_GET_INJECTOR,\n getComponent: LOCAL_GET_COMPONENT,\n getConfig: LOCAL_GET_CONFIG,\n updateConfig: LOCAL_UPDATE_CONFIG,\n isConfigValid: LOCAL_GET_CONFIG_VALID,\n renderComponent: RenderComponent as Type<RenderComponent>,\n getContext: LOCAL_GET_CONTEXT,\n};\n\nexport function getLocalProviders(data: {\n getInjector: LocalGetInjectorToken;\n getComponent: LocalGetComponentToken;\n getConfig: LocalGetConfigToken;\n updateConfig: LocalUpdateConfigToken;\n isConfigValid: LocalIsConfigValidToken;\n getContext: LocalGetContextToken;\n}): StaticProvider[] {\n return [\n {\n provide: LOCAL_GET_INJECTOR,\n useValue: data.getInjector,\n },\n {\n provide: LOCAL_GET_COMPONENT,\n useValue: data.getComponent,\n },\n {\n provide: LOCAL_GET_CONFIG,\n useValue: data.getConfig,\n },\n {\n provide: LOCAL_UPDATE_CONFIG,\n useValue: data.updateConfig,\n },\n {\n provide: LOCAL_GET_CONFIG_VALID,\n useValue: data.isConfigValid,\n },\n {\n provide: LOCAL_GET_CONTEXT,\n useValue: data.getContext,\n },\n ];\n}\n","import {\n Inject,\n Injectable,\n InjectFlags,\n InjectionToken,\n Injector,\n Provider,\n Type,\n} from '@angular/core';\n\nimport { InjectorMap } from '../types';\n\nexport interface InjectorMapToken extends Array<InjectorMap> {}\n\n/**\n * Multi-provider of {@link InjectorMap}\n */\nexport const INJECTOR_MAP_TOKEN = new InjectionToken<InjectorMapToken>(\n 'INJECTOR_MAP',\n);\n\n/**\n * Helper to provide {@link INJECTOR_MAP_TOKEN}\n */\nexport function provideInjectorMap(map: InjectorMap): Provider {\n return { provide: INJECTOR_MAP_TOKEN, useValue: map, multi: true };\n}\n\n/**\n * Maps tokens to other tokens and then executes parent injector.\n *\n * NOT a Service!\n * Use via {@link MappedInjectorFactory}\n */\nexport class MappedInjector implements Injector {\n private injectorMap: InjectorMap;\n\n constructor(\n private parent: Injector,\n private injectorMaps: InjectorMapToken,\n ) {}\n\n get<T>(\n token: Type<T> | InjectionToken<T>,\n notFoundValue?: T,\n flags?: InjectFlags,\n ): T;\n get(token: any, notFoundValue?: any, flags?: InjectFlags): any;\n get(token: any, notFoundValue?: any, flags?: any) {\n return this.parent.get(this.mapToken(token), notFoundValue, flags);\n }\n\n private mapToken(token: any): any {\n if (typeof token !== 'string') {\n return token;\n }\n\n this.maybeInitInjectorMap();\n\n token = this.processToken(token);\n\n return token in this.injectorMap ? this.injectorMap[token] : token;\n }\n\n private maybeInitInjectorMap() {\n if (!this.injectorMap) {\n this.injectorMap = this.injectorMaps.reduce(\n (acc, m) =>\n Object.keys(m).reduce(\n (obj, k) => ({ ...obj, [this.processToken(k)]: m[k] }),\n acc,\n ),\n Object.create(null),\n );\n }\n }\n\n private processToken(t: string) {\n return t.toLowerCase();\n }\n}\n\n/**\n * Factory for {@link MappedInjector}\n */\n@Injectable()\nexport class MappedInjectorFactory {\n constructor(\n @Inject(INJECTOR_MAP_TOKEN) private injectorMap: InjectorMapToken,\n ) {}\n\n /**\n * Creates MappedInjector with parent injector and {@link INJECTOR_MAP_TOKEN} from DI\n */\n create(parent: Injector): Injector {\n return new MappedInjector(parent, this.injectorMap);\n }\n}\n","import { InjectFlags, InjectionToken, StaticProvider } from '@angular/core';\n\nimport { InjectorMap } from '../types';\n\nexport const STATIC_INJECT_FLAGS = new InjectionToken<InjectFlags>(\n 'STATIC_INJECT_FLAGS',\n);\n\nexport const STATIC_INJECTOR_MAP: InjectorMap = {\n InjectFlags: STATIC_INJECT_FLAGS,\n};\n\nexport function getStaticProviders(): StaticProvider[] {\n return [{ provide: STATIC_INJECT_FLAGS, useValue: InjectFlags }];\n}\n","import { Provider } from '@angular/core';\n\nimport { LOCAL_INJECTOR_MAP } from './local-injector-map';\nimport { provideInjectorMap } from './mapped-injector';\nimport { getStaticProviders, STATIC_INJECTOR_MAP } from './static-injector-map';\n\n/**\n * Provides a map for injectors with providers\n *\n * @internal\n */\nexport const INJECTOR_MAP_PROVIDERS: Provider[] = [\n ...getStaticProviders(),\n provideInjectorMap(STATIC_INJECTOR_MAP),\n provideInjectorMap(LOCAL_INJECTOR_MAP),\n];\n","import { anyOf, Property } from '@orchestrator/gen-io-ts';\n\nimport { addConfig } from '../../metadata/configuration';\n\nexport function OptionAllowedValues(...values: any[]): PropertyDecorator {\n const decorator = Property({ type: anyOf(...values) });\n return (target, prop) => {\n decorator(target, prop);\n addConfig(target, { prop, decorator: OptionAllowedValues, args: [values] });\n };\n}\n","import { Property } from '@orchestrator/gen-io-ts';\nimport { Int } from 'io-ts';\n\nimport { addConfig } from '../../metadata/configuration';\n\nexport function OptionInteger(): PropertyDecorator {\n const decorator = Property({ typeFactory: () => Int });\n return (target, prop) => {\n decorator(target, prop);\n addConfig(target, { prop, decorator: OptionInteger, args: [] });\n };\n}\n","import { Property } from '@orchestrator/gen-io-ts';\nimport { brand, Branded } from 'io-ts';\n\nimport { addConfig } from '../../metadata/configuration';\n\nexport interface InRangeBrand {\n readonly InRange: unique symbol;\n}\n\nexport function OptionRange(\n min: number,\n max: number,\n step: number = 1,\n): PropertyDecorator {\n const typeFactory = (type: any) =>\n brand(\n type,\n (n): n is Branded<number, InRangeBrand> => n >= min && n <= max,\n 'InRange',\n );\n const decorator = Property({ type: Number, typeFactory });\n return (target, prop) => {\n decorator(target, prop);\n addConfig(target, { prop, decorator: OptionRange, args: [min, max, step] });\n };\n}\n","import { Property } from '@orchestrator/gen-io-ts';\n\nimport { addConfig } from '../../metadata/configuration';\n\nexport function OptionRequired(): PropertyDecorator {\n const decorator = Property({ isRequired: true });\n return (target, prop) => {\n decorator(target, prop);\n addConfig(target, { prop, decorator: OptionRequired, args: [] });\n };\n}\n","import { Property } from '@orchestrator/gen-io-ts';\n\nimport { addConfig } from '../../metadata/configuration';\n\nexport function OptionType(type: any): PropertyDecorator {\n const decorator = Property({ type });\n return (target, prop) => {\n decorator(target, prop);\n addConfig(target, { prop, decorator: OptionType, args: [type] });\n };\n}\n","/* eslint-disable @typescript-eslint/no-non-null-assertion */\nimport { Property } from '@orchestrator/gen-io-ts';\n\nimport { OptionAllowedValues } from './allowed-values';\nimport { OptionInteger } from './integer';\nimport { OptionRange } from './range';\nimport { OptionRequired } from './required';\nimport { OptionType } from './type';\n\nexport interface OptionConfig {\n required?: boolean;\n type?: any;\n range?: { min: number; max: number; step?: number };\n integer?: boolean;\n allowedValues?: any[];\n}\n\nexport function Option(config: OptionConfig = {}): PropertyDecorator {\n const decorator = Property();\n\n const decorators = (Object.keys(config) as (keyof OptionConfig)[])\n .map((key) => {\n switch (key) {\n case 'required':\n return config.required ? OptionRequired() : null;\n case 'type':\n return OptionType(config.type);\n case 'range':\n return OptionRange(\n config.range!.min,\n config.range!.max,\n config.range!.step,\n );\n case 'integer':\n return config.integer ? OptionInteger() : null;\n case 'allowedValues':\n return OptionAllowedValues(...config.allowedValues!);\n }\n })\n .filter(Boolean);\n\n return (target, prop) => {\n decorator(target, prop);\n decorators.forEach((d) => d!(target, prop));\n };\n}\n","import { Type } from '@angular/core';\nimport { genIoType, Property } from '@orchestrator/gen-io-ts';\nimport { TypeFactory } from '@orchestrator/gen-io-ts/lib/metadata';\n\nimport { addConfig } from '../../metadata/configuration';\n\nexport function OptionTypeFactory<T>(\n typeFactory: TypeFactory<T>,\n): PropertyDecorator {\n const decorator = Property({ typeFactory });\n return (target, prop) => {\n decorator(target, prop);\n addConfig(target, {\n prop,\n decorator: OptionTypeFactory,\n args: [typeFactory],\n });\n };\n}\n\nexport function classToType<T>(cls: Type<T>) {\n return genIoType<T>(cls);\n}\n","import { Property } from '@orchestrator/gen-io-ts';\nimport { null as nullType, undefined as undefinedType, union } from 'io-ts';\n\nimport { addConfig } from '../../metadata/configuration';\n\n/**\n * Will set type of property to `null | undefined`.\n *\n * Useful for cases when you have to explicitly exclude\n * specific property from type.\n *\n * **Example:**\n * ```ts\n * class A {\n * @Option()\n * prop1: string;\n * @Option()\n * prop2: string;\n * @OptionNotPresent()\n * prop3?: null | undefined; // This prop should be excluded!\n * }\n *\n * class B {\n * @Option()\n * prop1: string;\n * @Option()\n * prop2: string;\n * @Option()\n * prop3: string;\n * }\n *\n * type AorB = A | B;\n * ```\n */\nexport function OptionNotPresent(): PropertyDecorator {\n const decorator = Property({\n typeFactory: () => union([nullType, undefinedType]),\n });\n return (target, prop) => {\n decorator(target, prop);\n addConfig(target, { prop, decorator: OptionNotPresent, args: [] });\n };\n}\n","import {\n Injectable,\n InjectFlags,\n InjectionToken,\n Injector,\n StaticProvider,\n Type,\n} from '@angular/core';\n\n@Injectable()\nexport class InjectorRegistryService implements Injector {\n private injector = this.parentInjector;\n\n constructor(private parentInjector: Injector) {}\n\n get<T>(\n token: Type<T> | InjectionToken<T>,\n notFoundValue?: T,\n flags?: InjectFlags,\n ): T;\n get(token: any, notFoundValue?: any, flags?: InjectFlags): any;\n get(token: any, notFoundValue?: any, flags?: InjectFlags): any {\n return this.injector.get(token, notFoundValue, flags);\n }\n\n addProviders(providers: StaticProvider[]) {\n this.injector = Injector.create({\n providers,\n parent: this.injector,\n });\n }\n\n reset(parentInjector?: Injector) {\n this.injector = parentInjector || this.parentInjector;\n }\n}\n","import { Injector } from '@angular/core';\n\nimport {\n getLocalProviders,\n LocalGetComponentToken,\n LocalGetConfigToken,\n LocalGetContextToken,\n LocalIsConfigValidToken,\n LocalUpdateConfigToken,\n} from './local-injector-map';\n\n/**\n * @internal\n */\nexport interface LocalInjectorParams {\n parentInjector: Injector;\n getComponent: LocalGetComponentToken;\n getConfig: LocalGetConfigToken;\n updateConfig: LocalUpdateConfigToken;\n isConfigValid: LocalIsConfigValidToken;\n getContext: LocalGetContextToken;\n}\n\n/**\n * @internal\n */\nexport function createLocalInjector(params: LocalInjectorParams): Injector {\n const injector = Injector.create({\n providers: getLocalProviders({\n ...params,\n getInjector: () => injector,\n }),\n parent: params.parentInjector,\n });\n\n return injector;\n}\n","import {\n ComponentRef,\n Injectable,\n OnDestroy,\n Optional,\n SkipSelf,\n} from '@angular/core';\nimport { Subject } from 'rxjs';\n\n@Injectable()\nexport class ComponentsRegistryService implements OnDestroy {\n private _componentsReady$ = new Subject<ComponentRef<any>[]>();\n componentsReady$ = this._componentsReady$.asObservable();\n\n private count: number;\n private childComponents: ComponentRef<any>[] = [];\n private subChildComponents: ComponentRef<any>[] = [];\n\n constructor(\n @SkipSelf()\n @Optional()\n private parentComponentsRegistryService: ComponentsRegistryService,\n ) {}\n\n ngOnDestroy(): void {\n this.childComponents = [];\n this.subChildComponents = [];\n }\n\n waitFor(count: number) {\n this.count = count;\n this.childComponents = [];\n this.subChildComponents = [];\n }\n\n add(compRef: ComponentRef<any>) {\n if (this.parentComponentsRegistryService) {\n this.parentComponentsRegistryService.addChild(compRef);\n\n if (this.count === 0) {\n this.parentComponentsRegistryService.addSubChildren([]);\n }\n }\n }\n\n addChildren(compRefs: ComponentRef<any>[]) {\n if (this.parentComponentsRegistryService) {\n this.parentComponentsRegistryService.addSubChildren(compRefs);\n }\n }\n\n addChild(compRef: ComponentRef<any> | null | undefined) {\n this.childComponents.push(compRef);\n }\n\n addSubChildren(compRefs: ComponentRef<any>[]) {\n this.subChildComponents = this.subChildComponents.concat(compRefs);\n\n if (this.childComponents.length >= this.count) {\n this._componentsReady$.next(\n this.childComponents.concat(this.subChildComponents).filter(Boolean),\n );\n }\n }\n}\n","import { NgClass } from '@angular/common';\nimport {\n ChangeDetectionStrategy,\n ChangeDetectorRef,\n Component,\n ComponentFactory,\n ComponentFactoryResolver,\n ComponentRef,\n EventEmitter,\n Injector,\n Input,\n OnChanges,\n OnDestroy,\n OnInit,\n Output,\n Renderer2,\n SimpleChanges,\n} from '@angular/core';\nimport { isRight } from 'fp-ts/lib/Either';\nimport {\n AttributesMap,\n DynamicDirectiveDef,\n dynamicDirectiveDef,\n} from 'ng-dynamic-component';\nimport { Observable, Subject } from 'rxjs';\nimport { takeUntil } from 'rxjs/operators';\n\nimport { ComponentLocatorService } from '../component-locator/component-locator.service';\nimport { OptionFunction } from '../config';\nimport { ConfigurationService } from '../config/configuration.service';\nimport { InjectorRegistryService } from '../injectors/injector-registry.service';\nimport { createLocalInjector } from '../injectors/local-injector';\nimport { MappedInjectorFactory } from '../injectors/mapped-injector';\nimport { RenderComponent } from '../render-component';\nimport {\n OrchestratorConfigItem,\n OrchestratorDynamicComponentInputs,\n OrchestratorDynamicComponentType,\n} from '../types';\nimport { ComponentsRegistryService } from './components-registry.service';\n\nclass Handler {\n @OptionFunction() handler: Function | string;\n}\n\n@Component({\n selector: 'orc-render-item',\n templateUrl: './render-item.component.html',\n changeDetection: ChangeDetectionStrategy.OnPush,\n providers: [\n { provide: RenderComponent, useExisting: RenderItemComponent },\n ComponentsRegistryService,\n InjectorRegistryService,\n MappedInjectorFactory,\n ],\n})\nexport class RenderItemComponent\n extends RenderComponent\n implements OnInit, OnChanges, OnDestroy\n{\n @Input() item: OrchestratorConfigItem<any> | undefined;\n @Input() context: any;\n\n @Output() componentCreated = new EventEmitter<ComponentRef<any>>();\n @Output() childComponentsCreated = new EventEmitter<ComponentRef<any>[]>();\n\n destroyed$ = new Subject<void>();\n\n componentType: OrchestratorDynamicComponentType;\n\n inputs: OrchestratorDynamicComponentInputs = {\n items: undefined,\n config: undefined,\n context: undefined,\n };\n\n directives: DynamicDirectiveDef<any>[] = [];\n attributes: AttributesMap | null = null;\n\n injector: Injector;\n\n get itemsLength() {\n return this.item && this.item.items ? this.item.items.length : 0;\n }\n\n private compRef: ComponentRef<any>;\n private compCdr: ChangeDetectorRef;\n private compFactory: ComponentFactory<any>;\n private config: any;\n private disposableHandlers: Function[] = [];\n\n constructor(\n private cdr: ChangeDetectorRef,\n private renderer: Renderer2,\n private cfr: ComponentFactoryResolver,\n private componentLocatorService: ComponentLocatorService,\n private componentsRegistryService: ComponentsRegistryService,\n private configurationService: ConfigurationService,\n private mappedInjectorFactory: MappedInjectorFactory,\n private injectorRegistryService: InjectorRegistryService,\n ) {\n super();\n }\n\n ngOnInit() {\n this.componentsRegistryService.componentsReady$\n .pipe(takeUntil(this.destroyed$))\n .subscribe((compRefs) => {\n this.childComponentsCreated.emit(compRefs);\n this.componentsRegistryService.addChildren(compRefs);\n });\n\n this.update();\n }\n\n ngOnChanges(changes: SimpleChanges): void {\n if ('item' in changes && !changes.item.firstChange) {\n this.update();\n } else if ('context' in changes && !changes.context.firstChange) {\n this.updateContextInput();\n }\n }\n\n ngOnDestroy(): void {\n this.destroyed$.next();\n this.disposeHandlers();\n this.compRef = this.compCdr = this.compFactory = this.config = null;\n }\n\n onComponentCreated(compRef: ComponentRef<any>) {\n this.compRef = compRef;\n this.compFactory = this.cfr.resolveComponentFactory(this.componentType);\n this.componentCreated.emit(compRef);\n this.componentsRegistryService.add(compRef);\n this.updateHandlers();\n }\n\n getInjectorRegistryService() {\n return this.injectorRegistryService;\n }\n\n markForCheck() {\n if (!this.compCdr && this.compRef) {\n this.compCdr = this.compRef.injector.get(ChangeDetectorRef);\n }\n\n if (this.compCdr) {\n this.compCdr.markForCheck();\n }\n }\n\n addItem(item: OrchestratorConfigItem<any>) {\n if (this.inputs.items) {\n this.inputs.items = [...this.inputs.items, item];\n } else {\n this.inputs.items = [item];\n }\n\n this.cdr.markForCheck();\n }\n\n removeItem(item: OrchestratorConfigItem<any>) {\n const idx = this.inputs.items ? this.inputs.items.indexOf(item) : -1;\n\n if (idx === -1) {\n return;\n }\n\n this.inputs.items = this.inputs.items.filter((_, i) => i !== idx);\n\n this.cdr.markForCheck();\n }\n\n clearItems() {\n this.inputs.items = [];\n this.cdr.markForCheck();\n }\n\n private update() {\n this.updateComponent();\n this.updateConfig();\n this.updateInjector();\n this.updateInputs();\n this.updateContextInput();\n this.updateAttributes();\n this.updateDirectives();\n }\n\n private updateComponent() {\n // Invalidate late-component-refs immediately\n this.compRef = this.compCdr = this.compFactory = null;\n\n if (this.item) {\n this.componentType = this.componentLocatorService.resolve(\n this.item.component,\n );\n this.componentsRegistryService.waitFor(this.itemsLength);\n } else {\n this.componentType = null;\n this.componentsRegistryService.waitFor(0);\n }\n }\n\n private updateConfig() {\n if (this.componentType) {\n this.config = {\n ...this.componentLocatorService.getDefaultConfig(this.componentType),\n ...this.item.config,\n };\n } else {\n this.config = null;\n }\n }\n\n private updateInjector() {\n if (this.componentType) {\n this.injector = this.createInjector();\n } else {\n this.injector = null;\n }\n }\n\n private updateInputs() {\n if (this.componentType) {\n this.inputs.items = this.item.items;\n this.inputs.config = this.getConfig();\n } else {\n this.inputs.items = this.inputs.config = null;\n }\n }\n\n private updateAttributes() {\n if (this.componentType) {\n this.attributes = this.item.attributes || null;\n\n if (this.item.id) {\n this.attributes = { ...this.attributes, id: this.item.id };\n }\n }\n }\n\n private updateDirectives() {\n if (this.componentType && this.item.classes) {\n this.directives = [\n dynamicDirectiveDef(NgClass, { ngClass: this.item.classes }),\n ];\n } else {\n this.directives = [];\n }\n }\n\n private getConfig() {\n return (\n this.configurationService.decode(\n this.componentLocatorService.getConfigType(this.componentType),\n this.config,\n this.injector,\n ) || {}\n );\n }\n\n private createInjector() {\n return this.mappedInjectorFactory.create(this.createLocalInjector());\n }\n\n private createLocalInjector() {\n return createLocalInjector({\n parentInjector: this.injectorRegistryService,\n getComponent: () => this.compRef.instance,\n getConfig: () => this.inputs.config,\n updateConfig: (config) => {\n this.markForCheck();\n return (this.inputs.config = { ...this.inputs.config, ...config });\n },\n isConfigValid: () =>\n isRight(\n this.configurationService.validate(\n this.componentLocatorService.getConfigType(this.componentType),\n this.inputs.config,\n ),\n ),\n getContext: () => this.context,\n });\n }\n\n private updateHandlers() {\n this.disposeHandlers();\n\n if (!this.item.handlers || !this.compRef || !this.compFactory) {\n return;\n }\n\n const { handlers } = this.item;\n\n this.disposableHandlers = Object.keys(handlers)\n .map((event) => ({\n event,\n handler: this.decodeHandler(handlers[event]),\n }))\n .filter(({ handler }) => handler)\n .map(({ event, handler }) => this.attachHandler(event, handler));\n }\n\n private decodeHandler(handler: Function | string): Function {\n const fn = this.configurationService.decode(\n Handler,\n { handler },\n this.injector,\n ).handler;\n return typeof fn === 'function' ? fn : null;\n }\n\n private attachHandler(event: string, handler: Function): Function {\n const outputInfo = this.compFactory.outputs.find(\n (output) => output.templateName === event,\n );\n\n if (outputInfo) {\n const output = this.compRef.instance[\n outputInfo.propName\n ] as Observable<any>;\n const sub = output.subscribe(handler as any);\n return () => sub.unsubscribe();\n }\n\n return this.renderer.listen(\n this.compRef.location.nativeElement,\n event,\n handler as any,\n );\n }\n\n private disposeHandlers() {\n this.disposableHandlers.forEach((disposeHandler) => disposeHandler());\n this.disposableHandlers = [];\n }\n\n private updateContextInput() {\n if (this.componentType) {\n this.inputs.context = this.context;\n } else {\n this.inputs.context = null;\n }\n }\n}\n","<ndc-dynamic\n [ndcDynamicComponent]=\"componentType\"\n [ndcDynamicInputs]=\"inputs\"\n [ndcDynamicInjector]=\"injector\"\n [ndcDynamicAttributes]=\"attributes\"\n [ndcDynamicDirectives]=\"directives\"\n (ndcDynamicCreated)=\"onComponentCreated($event)\"\n></ndc-dynamic>\n","import {\n ChangeDetectionStrategy,\n Component,\n Input,\n Output,\n} from '@angular/core';\nimport { ComponentRef } from '@angular/core';\nimport { combineLatest, Subject } from 'rxjs';\nimport { map } from 'rxjs/operators';\n\nimport { OrchestratorConfigItem } from '../types';\n\n@Component({\n selector: 'orc-orchestrator',\n templateUrl: './orchestrator.component.html',\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class OrchestratorComponent {\n @Input() config: OrchestratorConfigItem<any>;\n @Input() context?: any;\n\n private compCreated$ = new Subject<ComponentRef<any>>();\n private childCompsCreated$ = new Subject<ComponentRef<any>[]>();\n\n @Output()\n componentsCreated = combineLatest([\n this.compCreated$,\n this.childCompsCreated$,\n ]).pipe(map(([comp, comps]) => [comp, ...comps]));\n\n compCreated(compRef: ComponentRef<any>) {\n this.compCreated$.next(compRef);\n }\n\n childCompsCreated(compRefs: ComponentRef<any>[]) {\n this.childCompsCreated$.next(compRefs);\n }\n}\n","<orc-render-item\n [item]=\"config\"\n [context]=\"context\"\n (componentCreated)=\"compCreated($event)\"\n (childComponentsCreated)=\"childCompsCreated($event)\"\n></orc-render-item>\n","import { CommonModule } from '@angular/common';\nimport { ModuleWithProviders, NgModule, Provider } from '@angular/core';\nimport {\n DynamicAttributesModule,\n DynamicDirectivesModule,\n DynamicModule,\n} from 'ng-dynamic-component';\n\nimport { ComponentLocatorService } from './component-locator/component-locator.service';\nimport { ComponentRegistry, COMPONENTS } from './component-map';\nimport { ConfigurationService } from './config/configuration.service';\nimport { ErrorStrategy } from './error-strategy/error-strategy';\nimport { ThrowErrorStrategy } from './error-strategy/throw-error-strategy';\nimport { INJECTOR_MAP_PROVIDERS } from './injectors/providers';\nimport { OrchestratorComponent } from './orchestrator/orchestrator.component';\nimport { RenderItemComponent } from './render-item/render-item.component';\nimport { OrchestratorDynamicComponentType } from './types';\n\n@NgModule({\n imports: [\n CommonModule,\n DynamicModule,\n DynamicAttributesModule,\n DynamicDirectivesModule,\n ],\n declarations: [OrchestratorComponent, RenderItemComponent],\n exports: [OrchestratorComponent, RenderItemComponent],\n})\nexport class OrchestratorCoreModule {\n /**\n * Use this to import module in root application only once\n */\n static forRoot(): ModuleWithProviders<OrchestratorCoreModule> {\n return {\n ngModule: OrchestratorCoreModule,\n providers: [...OrchestratorCoreModule.getRootProviders()],\n };\n }\n\n /**\n * Use this to import module with components in root application only once\n */\n static withComponents(\n components: ComponentRegistry<OrchestratorDynamicComponentType>,\n ): ModuleWithProviders<OrchestratorCoreModule> {\n return {\n ngModule: OrchestratorCoreModule,\n providers: [\n ...OrchestratorCoreModule.getRootProviders(),\n ...OrchestratorCoreModule.registerComponents(components),\n ],\n };\n }\n\n /**\n * Use this to provide custom components for {@link OrchestratorCoreModule}\n */\n static registerComponents(\n components: ComponentRegistry<OrchestratorDynamicComponentType>,\n ): Provider[] {\n return [{ provide: COMPONENTS, useValue: components, multi: true }];\n }\n\n private static getRootProviders(): Provider[] {\n return [\n { provide: ErrorStrategy, useClass: ThrowErrorStrategy },\n ...INJECTOR_MAP_PROVIDERS,\n ComponentLocatorService,\n ConfigurationService,\n ];\n }\n}\n","import { ErrorStrategy } from './error-strategy';\n\nexport class SuppressErrorStrategy extends ErrorStrategy {\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n handle(error: Error): void {\n // Not doing anything here...\n }\n}\n","// Core\nexport * from './lib/core.module';\nexport * from './lib/types';\nexport * from './lib/metadata';\nexport * from './lib/component-map';\n\n// Components\nexport * from './lib/orchestrator/orchestrator.component';\nexport * from './lib/render-component';\nexport * from './lib/render-item/render-item.component';\n\n// Errors\nexport * from './lib/error-strategy/error-strategy';\nexport * from './lib/error-strategy/throw-error-strategy';\nexport * from './lib/error-strategy/suppress-error-strategy';\n\n// Configuration\nexport * from './lib/config';\nexport * from './lib/config/configuration.service';\nexport * from './lib/config/invalid-configuration-error';\nexport * from './lib/config/function-error';\n\n// Injectors\nexport * from './lib/injectors/injector-registry.service';\nexport * from './lib/injectors/mapped-injector';\nexport * from './lib/injectors/static-injector-map';\nexport * from './lib/injectors/local-injector-map';\n\n// gen-io-ts lib re-export\nexport * from './lib/gen-io';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public_api';\n"],"names":["foldEither","fold","nullType","undefinedType","map"],"mappings":";;;;;;;;;;;;;;;;;;MAca,UAAU,GAAG,IAAI,cAAc,CAAsB,YAAY;;SCd9D,oBAAoB,CAAU,GAAW;IACvD,MAAM,CAAC,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC;IACtB,OAAO;QACL,GAAG,EAAE,cAAc,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,CAAkC;QAClE,GAAG,EAAE,CAAC,IAAS,KAAoB,IAAI,CAAC,CAAC,CAAC;KAC3C,CAAC;AACJ,CAAC;SAEe,cAAc,CAC5B,GAA6B,EAC7B,KAAU,EACV,MAAS;IAET,IAAI,GAAG,IAAI,MAAM,KAAK,KAAK,EAAE;QAC3B,MAAM,CAAC,cAAc,CAAC,MAAM,EAAE,GAAG,EAAE;YACjC,UAAU,EAAE,KAAK;YACjB,YAAY,EAAE,IAAI;YAClB,QAAQ,EAAE,IAAI;YACd,KAAK;SACN,CAAC,CAAC;KACJ;SAAM;QACL,MAAM,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;KACrB;IACD,OAAO,MAAM,CAAC;AAChB;;ACfA,MAAM,oBAAoB,GAAG,oBAAoB,CAC/C,sBAAsB,CACvB,CAAC;SAEc,gBAAgB,CAC9B,OAAmC;IAEnC,OAAO,MAAM,IAAI,oBAAoB,CAAC,GAAG,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;AAC7D,CAAC;SAEe,uBAAuB,CACrC,IAAyC;IAEzC,OAAO,oBAAoB,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;AACxC;;MCHa,uBAAuB;IAuBlC,YACU,QAAkB,EAClB,GAA6B;QAD7B,aAAQ,GAAR,QAAQ,CAAU;QAClB,QAAG,GAAH,GAAG,CAA0B;QAxB/B,sBAAiB,GAAG,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;QAElD,mBAAc,GAAG,IAAI,CAAC,iBAAiB;aAC5C,MAAM,CAAC,gBAAgB,CAAC;aACxB,MAAM,CAAC,CAAC,GAAG,EAAE,GAAG,KAAK,CAAC,GAAG,GAAG,EAAE,GAAG,GAAG,CAAC,EAAE,EAAE,CAAC,CAAC;QAEtC,sBAAiB,GAAG,IAAI,CAAC,cAAc;aAC5C,GAAG,CAAC,IAAI,IAAI,IAAI,CAAC,GAAG,CAAC,uBAAuB,CAAC,IAAI,CAAC,CAAC;aACnD,MAAM,CACL,CAAC,GAAG,EAAE,WAAW,MAAM;YACrB,GAAG,GAAG;YACN,CAAC,WAAW,CAAC,QAAQ,GAAG,WAAW,CAAC,aAAa;SAClD,CAAC,EACF,MAAM,CAAC,MAAM,CAAC,IAAI,CAAiB,CACpC,CAAC;QAEI,kBAAa,GAAG,IAAI,CAAC,iBAAiB,CAAC,MAAM,CAAC,cAAc,CAAC,CAAC;QAC9D,iBAAY,GAAG,IAAI,CAAC,aAAa,CAAC,MAAM,CAC9C,CAAC,GAAG,EAAE,GAAG,MAAM,EAAE,GAAG,GAAG,EAAE,GAAG,GAAG,EAAE,CAAC,EAClC,IAAI,CAAC,iBAAiC,CACvC,CAAC;KAKE;IAEJ,OAAO,CACL,SAAuD;QAEvD,IAAI,OAAO,SAAS,KAAK,UAAU,EAAE;YACnC,OAAO,SAAS,CAAC;SAClB;QAED,OAAO,IAAI,CAAC,YAAY,CAAC,SAAS,CAAC,CAAC;KACrC;IAED,gBAAgB,CACd,SAA8C;QAE9C,MAAM,UAAU,GAAG,IAAI,CAAC,aAAa,CAAC,SAAS,CAAC,CAAC;QAEjD,IAAI,CAAC,UAAU,EAAE;YACf,OAAO,IAAI,CAAC;SACb;QAED,OAAO,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,UAAU,EAAE,IAAI,CAAC,CAAC;KAC5C;IAED,aAAa,CACX,SAA8C;QAE9C,IAAI,CAAC,SAAS,EAAE;YACd,OAAO,IAAI,CA