@angular-devkit/architect

  • Version 0.1500.2
  • Published
  • 200 kB
  • 2 dependencies
  • MIT license

Install

npm i @angular-devkit/architect
yarn add @angular-devkit/architect
pnpm add @angular-devkit/architect

Overview

Angular Build Facade

Index

Functions

Classes

Interfaces

Enums

Type Aliases

Namespaces

Functions

function createBuilder

createBuilder: <OptT = json.JsonObject, OutT extends unknown = any>(
fn: BuilderHandlerFn<OptT>
) => Builder<OptT & json.JsonObject>;

    function fromAsyncIterable

    fromAsyncIterable: <T>(iterable: AsyncIterable<T>) => Observable<T>;

      function isBuilderOutput

      isBuilderOutput: (obj: any) => obj is any;

        function scheduleTargetAndForget

        scheduleTargetAndForget: (
        context: BuilderContext,
        target: Target,
        overrides?: json.JsonObject,
        scheduleOptions?: ScheduleOptions
        ) => Observable<any>;
        • Schedule a target, and forget about its run. This will return an observable of outputs, that as a a teardown will stop the target from running. This means that the Run object this returns should not be shared.

          The reason this is not part of the Context interface is to keep the Context as normal form as possible. This is really an utility that people would implement in their project.

          Parameter context

          The context of your current execution.

          Parameter target

          The target to schedule.

          Parameter overrides

          Overrides that are used in the target.

          Parameter scheduleOptions

          Additional scheduling options.

        function targetFromTargetString

        targetFromTargetString: (str: string) => Target;
        • Return a Target tuple from a string.

        function targetStringFromTarget

        targetStringFromTarget: ({ project, target, configuration }: Target) => string;
        • Returns a string of "project:target[:configuration]" for the target object.

        Classes

        class Architect

        class Architect {}

          constructor

          constructor(
          _host: ArchitectHost<any>,
          registry?: json.schema.SchemaRegistry,
          additionalJobRegistry?: Registry<JsonValue, JsonValue, JsonValue>
          );

            method has

            has: (name: JobName) => Observable<boolean>;

              method scheduleBuilder

              scheduleBuilder: (
              name: string,
              options: json.JsonObject,
              scheduleOptions?: ScheduleOptions
              ) => Promise<BuilderRun>;

                method scheduleTarget

                scheduleTarget: (
                target: Target,
                overrides?: json.JsonObject,
                scheduleOptions?: ScheduleOptions
                ) => Promise<BuilderRun>;

                  Interfaces

                  interface BuilderContext

                  interface BuilderContext {}
                  • The context received as a second argument in your builder.

                  property builder

                  builder: BuilderInfo;
                  • The builder info that called your function. Since the builder info is from the builder.json (or the host), it could contain information that is different than expected.

                  property currentDirectory

                  currentDirectory: string;
                  • The current directory the user is in. This could be outside the workspace root. This is a system path and will not be normalized; ie. on Windows it will starts with C:\\ (or whatever drive).

                  property id

                  id: number;
                  • Unique amongst contexts. Contexts instances are not guaranteed to be the same (but it could be the same context), and all the fields in a context could be the same, yet the builder's context could be different. This is the same ID as the corresponding run.

                  property logger

                  logger: logging.LoggerApi;
                  • A logger that appends messages to a log. This could be a separate interface or completely ignored. console.log could also be completely ignored.

                  property target

                  target?: Target;
                  • The target that was used to run this builder. Target is optional if a builder was ran using scheduleBuilder().

                  property workspaceRoot

                  workspaceRoot: string;
                  • The absolute workspace root of this run. This is a system path and will not be normalized; ie. on Windows it will starts with C:\\ (or whatever drive).

                  method addTeardown

                  addTeardown: (teardown: () => Promise<void> | void) => void;
                  • Add teardown logic to this Context, so that when it's being stopped it will execute teardown.

                  method getBuilderNameForTarget

                  getBuilderNameForTarget: (target: Target) => Promise<string>;
                  • Resolves and return a builder name. The exact format of the name is up to the host, so it should not be parsed to gather information (it's free form). This string can be used to validate options or schedule a builder directly.

                    Parameter target

                    The target to resolve the builder name.

                  method getProjectMetadata

                  getProjectMetadata: {
                  (projectName: string): Promise<json.JsonObject>;
                  (target: any): Promise<json.JsonObject>;
                  };

                    method getTargetOptions

                    getTargetOptions: (target: Target) => Promise<json.JsonObject>;
                    • Resolve and return options for a specified target. If the target isn't defined in the workspace this will reject the promise. This object will be read directly from the workspace but not validated against the builder of the target.

                      Parameter target

                      The target to resolve the options of. A non-validated object resolved from the workspace.

                    method reportProgress

                    reportProgress: (current: number, total?: number, status?: string) => void;
                    • Update the progress for this builder run.

                      Parameter current

                      The current progress. This will be between 0 and total.

                      Parameter total

                      A new total to set. By default at the start of a run this is 1. If omitted it will use the same value as the last total.

                      Parameter status

                      Update the status string. If omitted the status string is not modified.

                    method reportRunning

                    reportRunning: () => void;
                    • Set the builder to running. This should be used if an external event triggered a re-run, e.g. a file watched was changed.

                    method reportStatus

                    reportStatus: (status: string) => void;
                    • Update the status string shown on the interface.

                      Parameter status

                      The status to set it to. An empty string can be used to remove the status.

                    method scheduleBuilder

                    scheduleBuilder: (
                    builderName: string,
                    options?: json.JsonObject,
                    scheduleOptions?: ScheduleOptions
                    ) => Promise<BuilderRun>;
                    • Schedule a builder by its name. This can be the same builder that is being executed.

                      Parameter builderName

                      The name of the builder, ie. its packageName:builderName tuple.

                      Parameter options

                      All options to use for the builder (by default empty object). There is no additional options added, e.g. from the workspace.

                      Parameter scheduleOptions

                      Additional optional scheduling options. A promise of a run. It will resolve when all the members of the run are available.

                    method scheduleTarget

                    scheduleTarget: (
                    target: Target,
                    overrides?: json.JsonObject,
                    scheduleOptions?: ScheduleOptions
                    ) => Promise<BuilderRun>;
                    • Schedule a target in the same workspace. This can be the same target that is being executed right now, but targets of the same name are serialized. Running the same target and waiting for it to end will result in a deadlocking scenario. Targets are considered the same if the project, the target AND the configuration are the same.

                      Parameter target

                      The target to schedule.

                      Parameter overrides

                      A set of options to override the workspace set of options.

                      Parameter scheduleOptions

                      Additional optional scheduling options. A promise of a run. It will resolve when all the members of the run are available.

                    method validateOptions

                    validateOptions: <T extends json.JsonObject = json.JsonObject>(
                    options: json.JsonObject,
                    builderName: string
                    ) => Promise<T>;
                    • Validates the options against a builder schema. This uses the same methods as the scheduleTarget and scheduleBrowser methods to validate and apply defaults to the options. It can be generically typed, if you know which interface it is supposed to validate against.

                      Parameter options

                      A generic option object to validate.

                      Parameter builderName

                      The name of a builder to use. This can be gotten for a target by using the getBuilderForTarget() method on the context.

                    interface BuilderHandlerFn

                    interface BuilderHandlerFn<A> {}
                    • A builder handler function. The function signature passed to createBuilder().

                    call signature

                    (input: A, context: BuilderContext): BuilderOutputLike;
                    • Builders are defined by users to perform any kind of task, like building, testing or linting, and should use this interface.

                      Parameter input

                      The options (a JsonObject), validated by the schema and received by the builder. This can include resolved options from the CLI or the workspace.

                      Parameter context

                      A context that can be used to interact with the Architect framework. One or many builder output.

                    interface BuilderRun

                    interface BuilderRun {}
                    • A Run, which is what is returned by scheduleBuilder or scheduleTarget functions. This should be reconstructed across memory boundaries (it's not serializable but all internal information are).

                    property id

                    id: number;
                    • Unique amongst runs. This is the same ID as the context generated for the run. It can be used to identify multiple unique runs. There is no guarantee that a run is a single output; a builder can rebuild on its own and will generate multiple outputs.

                    property info

                    info: BuilderInfo;
                    • The builder information.

                    property output

                    output: Observable<BuilderOutput>;
                    • The output(s) from the builder. A builder can have multiple outputs. This always replay the last output when subscribed.

                    property progress

                    progress: Observable<BuilderProgressReport>;
                    • The progress report. A progress also contains an ID, which can be different than this run's ID (if the builder calls scheduleBuilder or scheduleTarget). This will always replay the last progress on new subscriptions.

                    property result

                    result: Promise<BuilderOutput>;
                    • The next output from a builder. This is recommended when scheduling a builder and only being interested in the result of that single run, not of a watch-mode builder.

                    method stop

                    stop: () => Promise<void>;
                    • Stop the builder from running. Returns a promise that resolves when the builder is stopped. Some builders might not handle stopping properly and should have a timeout here.

                    interface ScheduleOptions

                    interface ScheduleOptions {}

                      property logger

                      logger?: logging.Logger;

                        Enums

                        enum BuilderProgressState

                        enum BuilderProgressState {
                        Error = 'error',
                        Running = 'running',
                        Stopped = 'stopped',
                        Waiting = 'waiting',
                        }

                          member Error

                          Error = 'error'

                            member Running

                            Running = 'running'

                              member Stopped

                              Stopped = 'stopped'

                                member Waiting

                                Waiting = 'waiting'

                                  Type Aliases

                                  type BuilderInfo

                                  type BuilderInfo = json.JsonObject & {
                                  builderName: string;
                                  description: string;
                                  optionSchema: json.schema.JsonSchema;
                                  };
                                  • A Builder general information. This is generated by the host and is expanded by the host, but the public API contains those fields.

                                  type BuilderInput

                                  type BuilderInput = json.JsonObject & RealBuilderInput;
                                  • Declaration of those types as JsonObject compatible. JsonObject is not compatible with optional members, so those wouldn't be directly assignable to our internal Json typings. Forcing the type to be both a JsonObject and the type from the Schema tells Typescript they are compatible (which they are). These types should be used everywhere.

                                  type BuilderOutput

                                  type BuilderOutput = json.JsonObject & RealBuilderOutput;

                                    type BuilderOutputLike

                                    type BuilderOutputLike =
                                    | AsyncIterable<BuilderOutput>
                                    | SubscribableOrPromise<BuilderOutput>
                                    | BuilderOutput;
                                    • An accepted return value from a builder. Can be either an Observable, a Promise or a vector.

                                    type BuilderProgress

                                    type BuilderProgress = json.JsonObject & RealBuilderProgress & TypedBuilderProgress;

                                      type BuilderProgressReport

                                      type BuilderProgressReport = BuilderProgress & {
                                      target?: Target;
                                      builder: BuilderInfo;
                                      };
                                      • A progress report is what the tooling will receive. It contains the builder info and the target. Although these are serializable, they are only exposed through the tooling interface, not the builder interface. The watch dog sends BuilderProgress and the Builder has a set of functions to manage the state.

                                      type BuilderRegistry

                                      type BuilderRegistry = Registry<json.JsonObject, BuilderInput, BuilderOutput>;

                                        type Target

                                        type Target = json.JsonObject & RealTarget;

                                          type TypedBuilderProgress

                                          type TypedBuilderProgress =
                                          | {
                                          state: BuilderProgressState.Stopped;
                                          }
                                          | {
                                          state: BuilderProgressState.Error;
                                          error: json.JsonValue;
                                          }
                                          | {
                                          state: BuilderProgressState.Waiting;
                                          status?: string;
                                          }
                                          | {
                                          state: BuilderProgressState.Running;
                                          status?: string;
                                          current: number;
                                          total?: number;
                                          };
                                          • An API typed BuilderProgress. The interface generated from the schema is too permissive, so this API is the one we show in our API. Please note that not all fields are in there; this is in addition to fields in the schema.

                                          Namespaces

                                          namespace jobs

                                          module 'src/jobs/index.d.ts' {}
                                          • Copyright Google LLC All Rights Reserved.

                                            Use of this source code is governed by an MIT-style license that can be found in the LICENSE file at https://angular.io/license

                                          function createDispatcher

                                          createDispatcher: <
                                          A extends JsonValue,
                                          I extends JsonValue,
                                          O extends JsonValue
                                          >(
                                          options?: Partial<Readwrite<JobDescription>>
                                          ) => JobDispatcher<A, I, O>;
                                          • OnReady a dispatcher that can dispatch to a sub job, depending on conditions.

                                            Parameter options

                                          function createJobFactory

                                          createJobFactory: <
                                          A extends JsonValue,
                                          I extends JsonValue,
                                          O extends JsonValue
                                          >(
                                          loader: () => Promise<JobHandler<A, I, O>>,
                                          options?: Partial<JobDescription>
                                          ) => JobHandler<A, I, O>;
                                          • Lazily create a job using a function.

                                            Parameter loader

                                            A factory function that returns a promise/observable of a JobHandler.

                                            Parameter options

                                            Same options as createJob.

                                          function createJobHandler

                                          createJobHandler: <
                                          A extends JsonValue,
                                          I extends JsonValue,
                                          O extends JsonValue
                                          >(
                                          fn: SimpleJobHandlerFn<A, I, O>,
                                          options?: Partial<JobDescription>
                                          ) => JobHandler<A, I, O>;
                                          • Make a simple job handler that sets start and end from a function that's synchronous.

                                            Parameter fn

                                            The function to create a handler for.

                                            Parameter options

                                            An optional set of properties to set on the handler. Some fields might be required by registry or schedulers.

                                          function createLoggerJob

                                          createLoggerJob: <A extends JsonValue, I extends JsonValue, O extends JsonValue>(
                                          job: JobHandler<A, I, O>,
                                          logger: logging.LoggerApi
                                          ) => JobHandler<A, I, O>;
                                          • Creates a job that logs out input/output messages of another Job. The messages are still propagated to the other job.

                                          function isJobHandler

                                          isJobHandler: <A extends JsonValue, I extends JsonValue, O extends JsonValue>(
                                          value: unknown
                                          ) => value is JobHandler<A, I, O>;

                                            class ChannelAlreadyExistException

                                            class ChannelAlreadyExistException extends BaseException {}

                                              constructor

                                              constructor(name: string);

                                                class FallbackRegistry

                                                class FallbackRegistry<
                                                MinimumArgumentValueT extends JsonValue = JsonValue,
                                                MinimumInputValueT extends JsonValue = JsonValue,
                                                MinimumOutputValueT extends JsonValue = JsonValue
                                                > implements
                                                Registry<MinimumArgumentValueT, MinimumInputValueT, MinimumOutputValueT> {}
                                                • A simple job registry that keep a map of JobName => JobHandler internally.

                                                constructor

                                                constructor(
                                                _fallbacks?: Registry<
                                                MinimumArgumentValueT,
                                                MinimumInputValueT,
                                                MinimumOutputValueT
                                                >[]
                                                );

                                                  method addFallback

                                                  addFallback: (registry: Registry) => void;

                                                    method get

                                                    get: <
                                                    A extends MinimumArgumentValueT = MinimumArgumentValueT,
                                                    I extends MinimumInputValueT = MinimumInputValueT,
                                                    O extends MinimumOutputValueT = MinimumOutputValueT
                                                    >(
                                                    name: JobName
                                                    ) => Observable<JobHandler<A, I, O>>;

                                                      class JobArgumentSchemaValidationError

                                                      class JobArgumentSchemaValidationError extends schema.SchemaValidationException {}

                                                        constructor

                                                        constructor(errors?: schema.SchemaValidatorError[]);

                                                          class JobDoesNotExistException

                                                          class JobDoesNotExistException extends BaseException {}

                                                            constructor

                                                            constructor(name: string);

                                                              class JobInboundMessageSchemaValidationError

                                                              class JobInboundMessageSchemaValidationError extends schema.SchemaValidationException {}

                                                                constructor

                                                                constructor(errors?: schema.SchemaValidatorError[]);

                                                                  class JobNameAlreadyRegisteredException

                                                                  class JobNameAlreadyRegisteredException extends BaseException {}

                                                                    constructor

                                                                    constructor(name: string);

                                                                      class JobOutputSchemaValidationError

                                                                      class JobOutputSchemaValidationError extends schema.SchemaValidationException {}

                                                                        constructor

                                                                        constructor(errors?: schema.SchemaValidatorError[]);

                                                                          class SimpleJobRegistry

                                                                          class SimpleJobRegistry<
                                                                          MinimumArgumentValueT extends JsonValue = JsonValue,
                                                                          MinimumInputValueT extends JsonValue = JsonValue,
                                                                          MinimumOutputValueT extends JsonValue = JsonValue
                                                                          > implements
                                                                          Registry<MinimumArgumentValueT, MinimumInputValueT, MinimumOutputValueT> {}
                                                                          • A simple job registry that keep a map of JobName => JobHandler internally.

                                                                          method get

                                                                          get: <
                                                                          A extends MinimumArgumentValueT = MinimumArgumentValueT,
                                                                          I extends MinimumInputValueT = MinimumInputValueT,
                                                                          O extends MinimumOutputValueT = MinimumOutputValueT
                                                                          >(
                                                                          name: JobName
                                                                          ) => Observable<JobHandler<A, I, O>>;

                                                                            method getJobNames

                                                                            getJobNames: () => JobName[];
                                                                            • Returns the job names of all jobs.

                                                                            method register

                                                                            register: {
                                                                            <
                                                                            A extends MinimumArgumentValueT,
                                                                            I extends MinimumInputValueT,
                                                                            O extends MinimumOutputValueT
                                                                            >(
                                                                            name: JobName,
                                                                            handler: JobHandler<A, I, O>,
                                                                            options?: RegisterJobOptions
                                                                            ): void;
                                                                            <
                                                                            ArgumentT extends JsonValue,
                                                                            InputT extends JsonValue,
                                                                            OutputT extends JsonValue
                                                                            >(
                                                                            handler: JobHandler<ArgumentT, InputT, OutputT>,
                                                                            options?: RegisterJobOptions & { name: string }
                                                                            ): void;
                                                                            };
                                                                            • Register a job handler. The name must be unique.

                                                                              Parameter name

                                                                              The name of the job.

                                                                              Parameter handler

                                                                              The function that will be called for the job.

                                                                              Parameter options

                                                                              An optional list of options to override the handler.

                                                                            • Register a job handler. The name must be unique.

                                                                              Parameter handler

                                                                              The function that will be called for the job.

                                                                              Parameter options

                                                                              An optional list of options to override the handler.

                                                                            class SimpleScheduler

                                                                            class SimpleScheduler<
                                                                            MinimumArgumentT extends JsonValue = JsonValue,
                                                                            MinimumInputT extends JsonValue = JsonValue,
                                                                            MinimumOutputT extends JsonValue = JsonValue
                                                                            > implements Scheduler<MinimumArgumentT, MinimumInputT, MinimumOutputT> {}
                                                                            • Simple scheduler. Should be the base of all registries and schedulers.

                                                                            constructor

                                                                            constructor(
                                                                            _jobRegistry: Registry<MinimumArgumentT, MinimumInputT, MinimumOutputT>,
                                                                            _schemaRegistry?: schema.SchemaRegistry
                                                                            );

                                                                              method getDescription

                                                                              getDescription: (name: JobName) => Observable<JobDescription>;
                                                                              • Get a job description for a named job.

                                                                                Parameter name

                                                                                The name of the job.

                                                                                Returns

                                                                                A description, or null if the job is not registered.

                                                                              method has

                                                                              has: (name: JobName) => Observable<boolean>;
                                                                              • Returns true if the job name has been registered.

                                                                                Parameter name

                                                                                The name of the job.

                                                                                Returns

                                                                                True if the job exists, false otherwise.

                                                                              method pause

                                                                              pause: () => () => void;
                                                                              • Pause the scheduler, temporary queueing _new_ jobs. Returns a resume function that should be used to resume execution. If multiple pause() were called, all their resume functions must be called before the Scheduler actually starts new jobs. Additional calls to the same resume function will have no effect.

                                                                                Jobs already running are NOT paused. This is pausing the scheduler only.

                                                                              method schedule

                                                                              schedule: <
                                                                              A extends MinimumArgumentT,
                                                                              I extends MinimumInputT,
                                                                              O extends MinimumOutputT
                                                                              >(
                                                                              name: JobName,
                                                                              argument: A,
                                                                              options?: ScheduleJobOptions
                                                                              ) => Job<A, I, O>;
                                                                              • Schedule a job to be run, using its name.

                                                                                Parameter name

                                                                                The name of job to be run.

                                                                                Parameter argument

                                                                                The argument to send to the job when starting it.

                                                                                Parameter options

                                                                                Scheduling options.

                                                                                Returns

                                                                                The Job being run.

                                                                              interface Job

                                                                              interface Job<
                                                                              ArgumentT extends JsonValue = JsonValue,
                                                                              InputT extends JsonValue = JsonValue,
                                                                              OutputT extends JsonValue = JsonValue
                                                                              > {}
                                                                              • A Job instance, returned from scheduling a job. A Job instance is _not_ serializable.

                                                                              property argument

                                                                              readonly argument: ArgumentT;
                                                                              • Argument sent when scheduling the job. This is a copy of the argument.

                                                                              property description

                                                                              readonly description: Observable<JobDescription>;
                                                                              • Description of the job. Resolving the job's description can be done asynchronously, so this is an observable that will resolve when it's ready.

                                                                              property inboundBus

                                                                              readonly inboundBus: Observer<JobInboundMessage<InputT>>;
                                                                              • The JobInboundMessage messages TO the job.

                                                                              property input

                                                                              readonly input: Observer<InputT>;
                                                                              • The input to the job. This goes through the input channel as messages.

                                                                              property outboundBus

                                                                              readonly outboundBus: Observable<JobOutboundMessage<OutputT>>;
                                                                              • The JobOutboundMessage FROM the job.

                                                                              property output

                                                                              readonly output: Observable<OutputT>;
                                                                              • Outputs of this job.

                                                                              property state

                                                                              readonly state: JobState;
                                                                              • The current state of the job.

                                                                              method getChannel

                                                                              getChannel: <T extends JsonValue>(
                                                                              name: string,
                                                                              schema?: schema.JsonSchema
                                                                              ) => Observable<T>;
                                                                              • Get a channel that validates against the schema. Messages will be filtered by the schema.

                                                                                Parameter name

                                                                                The name of the channel.

                                                                                Parameter schema

                                                                                A schema to use to validate messages.

                                                                              method ping

                                                                              ping: () => Observable<never>;
                                                                              • Pings the job and wait for the resulting Pong before completing.

                                                                              method stop

                                                                              stop: () => void;
                                                                              • Stops the job from running. This is different than unsubscribing from the output as in it sends the JobInboundMessageKind.Stop raw input to the job.

                                                                              interface JobDescription

                                                                              interface JobDescription extends JsonObject {}
                                                                              • Metadata associated with a job.

                                                                              property argument

                                                                              readonly argument: DeepReadonly<schema.JsonSchema>;

                                                                                property input

                                                                                readonly input: DeepReadonly<schema.JsonSchema>;

                                                                                  property name

                                                                                  readonly name: JobName;

                                                                                    property output

                                                                                    readonly output: DeepReadonly<schema.JsonSchema>;

                                                                                      interface JobDispatcher

                                                                                      interface JobDispatcher<
                                                                                      A extends JsonValue,
                                                                                      I extends JsonValue,
                                                                                      O extends JsonValue
                                                                                      > extends JobHandler<A, I, O> {}
                                                                                      • A JobDispatcher can be used to dispatch between multiple jobs.

                                                                                      method addConditionalJob

                                                                                      addConditionalJob: (predicate: (args: A) => boolean, name: string) => void;
                                                                                      • Add a conditional job that will be selected if the input fits a predicate.

                                                                                        Parameter predicate

                                                                                        Parameter name

                                                                                      method setDefaultJob

                                                                                      setDefaultJob: (
                                                                                      name: JobName | null | JobHandler<JsonValue, JsonValue, JsonValue>
                                                                                      ) => void;
                                                                                      • Set the default job if all conditionals failed.

                                                                                        Parameter name

                                                                                        The default name if all conditions are false.

                                                                                      interface JobHandler

                                                                                      interface JobHandler<
                                                                                      ArgT extends JsonValue,
                                                                                      InputT extends JsonValue,
                                                                                      OutputT extends JsonValue
                                                                                      > {}
                                                                                      • The job handler function, which is a method that's executed for the job.

                                                                                      property jobDescription

                                                                                      jobDescription: Partial<JobDescription>;

                                                                                        call signature

                                                                                        (argument: ArgT, context: JobHandlerContext<ArgT, InputT, OutputT>): Observable<
                                                                                        JobOutboundMessage<OutputT>
                                                                                        >;

                                                                                          interface JobHandlerContext

                                                                                          interface JobHandlerContext<
                                                                                          MinimumArgumentValueT extends JsonValue = JsonValue,
                                                                                          MinimumInputValueT extends JsonValue = JsonValue,
                                                                                          MinimumOutputValueT extends JsonValue = JsonValue
                                                                                          > {}
                                                                                          • The context in which the job is run.

                                                                                          property dependencies

                                                                                          readonly dependencies: Job<JsonValue, JsonValue, JsonValue>[];

                                                                                            property description

                                                                                            readonly description: JobDescription;

                                                                                              property inboundBus

                                                                                              readonly inboundBus: Observable<JobInboundMessage<MinimumInputValueT>>;

                                                                                                property scheduler

                                                                                                readonly scheduler: Scheduler<JsonValue, JsonValue, JsonValue>;

                                                                                                  interface JobInboundMessageBase

                                                                                                  interface JobInboundMessageBase extends JsonObject {}
                                                                                                  • Base interface for the all job inbound messages.

                                                                                                  property kind

                                                                                                  readonly kind: JobInboundMessageKind;
                                                                                                  • The kind of message this is.

                                                                                                  interface JobInboundMessageInput

                                                                                                  interface JobInboundMessageInput<InputT extends JsonValue>
                                                                                                  extends JobInboundMessageBase {}
                                                                                                  • A Job wants to send a message to a channel. This can be marshaled, and the Job object has helpers to transform this into an observable. The context also can create RxJS subjects that marshall messages through a channel.

                                                                                                  property kind

                                                                                                  readonly kind: JobInboundMessageKind.Input;

                                                                                                    property value

                                                                                                    readonly value: InputT;
                                                                                                    • The input being sent to the job.

                                                                                                    interface JobInboundMessagePing

                                                                                                    interface JobInboundMessagePing extends JobInboundMessageBase {}
                                                                                                    • A ping to the job. The job should reply with a pong as soon as possible.

                                                                                                    property id

                                                                                                    readonly id: number;
                                                                                                    • An ID that should be returned in the corresponding Pong.

                                                                                                    property kind

                                                                                                    readonly kind: JobInboundMessageKind.Ping;

                                                                                                      interface JobInboundMessageStop

                                                                                                      interface JobInboundMessageStop extends JobInboundMessageBase {}
                                                                                                      • Stop the job. This is handled by the job itself and jobs might not handle it. It will also unsubscribe from the Observable<>. This is equivalent to SIGTERM.

                                                                                                      property kind

                                                                                                      readonly kind: JobInboundMessageKind.Stop;

                                                                                                        interface JobOutboundMessageBase

                                                                                                        interface JobOutboundMessageBase {}
                                                                                                        • Base interface for the all job messages.

                                                                                                        property description

                                                                                                        readonly description: JobDescription;
                                                                                                        • The job description.

                                                                                                        property kind

                                                                                                        readonly kind: JobOutboundMessageKind;
                                                                                                        • The kind of message this is.

                                                                                                        interface JobOutboundMessageChannelBase

                                                                                                        interface JobOutboundMessageChannelBase extends JobOutboundMessageBase {}
                                                                                                        • Base interface for all job message related to channels.

                                                                                                        property name

                                                                                                        readonly name: string;
                                                                                                        • The name of the channel.

                                                                                                        interface JobOutboundMessageChannelComplete

                                                                                                        interface JobOutboundMessageChannelComplete extends JobOutboundMessageChannelBase {}
                                                                                                        • A job wants to close the channel, as completed. This is done automatically when the job ends, or can be done from the job to close it. A closed channel might be reopened, but the user need to recall getChannel().

                                                                                                        property kind

                                                                                                        readonly kind: JobOutboundMessageKind.ChannelComplete;

                                                                                                          interface JobOutboundMessageChannelCreate

                                                                                                          interface JobOutboundMessageChannelCreate extends JobOutboundMessageChannelBase {}
                                                                                                          • A job wants to create a new channel.

                                                                                                          property kind

                                                                                                          readonly kind: JobOutboundMessageKind.ChannelCreate;

                                                                                                            interface JobOutboundMessageChannelError

                                                                                                            interface JobOutboundMessageChannelError extends JobOutboundMessageChannelBase {}
                                                                                                            • A job wants to send an error to one of its channel. This is the equivalent of throwing through an Observable. The side channel will not receive any more messages after this, and will not complete.

                                                                                                            property error

                                                                                                            readonly error: JsonValue;
                                                                                                            • The error message being sent to the channel.

                                                                                                            property kind

                                                                                                            readonly kind: JobOutboundMessageKind.ChannelError;

                                                                                                              interface JobOutboundMessageChannelMessage

                                                                                                              interface JobOutboundMessageChannelMessage extends JobOutboundMessageChannelBase {}
                                                                                                              • A job wants to send a message to a channel. This can be marshaled, and the Job object has helpers to transform this into an observable. The context also can create RxJS subjects that marshall messages through a channel.

                                                                                                              property kind

                                                                                                              readonly kind: JobOutboundMessageKind.ChannelMessage;

                                                                                                                property message

                                                                                                                readonly message: JsonValue;
                                                                                                                • The message being sent to the channel.

                                                                                                                interface JobOutboundMessageEnd

                                                                                                                interface JobOutboundMessageEnd extends JobOutboundMessageBase {}
                                                                                                                • OnEnd of the job run.

                                                                                                                property kind

                                                                                                                readonly kind: JobOutboundMessageKind.End;

                                                                                                                  interface JobOutboundMessageOnReady

                                                                                                                  interface JobOutboundMessageOnReady extends JobOutboundMessageBase {}
                                                                                                                  • The job has been created and will validate its input.

                                                                                                                  property kind

                                                                                                                  readonly kind: JobOutboundMessageKind.OnReady;

                                                                                                                    interface JobOutboundMessageOutput

                                                                                                                    interface JobOutboundMessageOutput<OutputT extends JsonValue>
                                                                                                                    extends JobOutboundMessageBase {}
                                                                                                                    • An output value is available.

                                                                                                                    property kind

                                                                                                                    readonly kind: JobOutboundMessageKind.Output;

                                                                                                                      property value

                                                                                                                      readonly value: OutputT;
                                                                                                                      • The message being outputted from the job.

                                                                                                                      interface JobOutboundMessagePong

                                                                                                                      interface JobOutboundMessagePong extends JobOutboundMessageBase {}
                                                                                                                      • A pong response from a ping input. The id is the same as the one passed in.

                                                                                                                      property id

                                                                                                                      readonly id: number;
                                                                                                                      • The ID that was passed in the Ping messages.

                                                                                                                      property kind

                                                                                                                      readonly kind: JobOutboundMessageKind.Pong;

                                                                                                                        interface JobOutboundMessageStart

                                                                                                                        interface JobOutboundMessageStart extends JobOutboundMessageBase {}
                                                                                                                        • The job started. This is done by the job itself.

                                                                                                                        property kind

                                                                                                                        readonly kind: JobOutboundMessageKind.Start;

                                                                                                                          interface RegisterJobOptions

                                                                                                                          interface RegisterJobOptions extends Partial<JobDescription> {}
                                                                                                                          • SimpleJobRegistry job registration options.

                                                                                                                          interface Registry

                                                                                                                          interface Registry<
                                                                                                                          MinimumArgumentValueT extends JsonValue = JsonValue,
                                                                                                                          MinimumInputValueT extends JsonValue = JsonValue,
                                                                                                                          MinimumOutputValueT extends JsonValue = JsonValue
                                                                                                                          > {}

                                                                                                                            method get

                                                                                                                            get: <
                                                                                                                            A extends MinimumArgumentValueT,
                                                                                                                            I extends MinimumInputValueT,
                                                                                                                            O extends MinimumOutputValueT
                                                                                                                            >(
                                                                                                                            name: JobName
                                                                                                                            ) => Observable<JobHandler<A, I, O>>;
                                                                                                                            • Get a job handler.

                                                                                                                              Parameter name

                                                                                                                              The name of the job to get a handler from.

                                                                                                                            interface ScheduleJobOptions

                                                                                                                            interface ScheduleJobOptions {}
                                                                                                                            • Options for scheduling jobs.

                                                                                                                            property dependencies

                                                                                                                            dependencies?: Job | Job[];
                                                                                                                            • Jobs that need to finish before scheduling this job. These dependencies will be passed to the job itself in its context.

                                                                                                                            interface Scheduler

                                                                                                                            interface Scheduler<
                                                                                                                            MinimumArgumentValueT extends JsonValue = JsonValue,
                                                                                                                            MinimumInputValueT extends JsonValue = JsonValue,
                                                                                                                            MinimumOutputValueT extends JsonValue = JsonValue
                                                                                                                            > {}
                                                                                                                            • An interface that can schedule jobs.

                                                                                                                            method getDescription

                                                                                                                            getDescription: (name: JobName) => Observable<JobDescription>;
                                                                                                                            • Get a job description for a named job.

                                                                                                                              Parameter name

                                                                                                                              The name of the job.

                                                                                                                              Returns

                                                                                                                              A description, or null if no description is available for this job.

                                                                                                                            method has

                                                                                                                            has: (name: JobName) => Observable<boolean>;
                                                                                                                            • Returns true if the job name has been registered.

                                                                                                                              Parameter name

                                                                                                                              The name of the job.

                                                                                                                              Returns

                                                                                                                              True if the job exists, false otherwise.

                                                                                                                            method pause

                                                                                                                            pause: () => () => void;
                                                                                                                            • Pause the scheduler, temporary queueing _new_ jobs. Returns a resume function that should be used to resume execution. If multiple pause() were called, all their resume functions must be called before the Scheduler actually starts new jobs. Additional calls to the same resume function will have no effect.

                                                                                                                              Jobs already running are NOT paused. This is pausing the scheduler only.

                                                                                                                              Returns

                                                                                                                              A function that can be run to resume the scheduler. If multiple pause() calls were made, all their return function must be called (in any order) before the scheduler can resume.

                                                                                                                            method schedule

                                                                                                                            schedule: <
                                                                                                                            A extends MinimumArgumentValueT,
                                                                                                                            I extends MinimumInputValueT,
                                                                                                                            O extends MinimumOutputValueT
                                                                                                                            >(
                                                                                                                            name: JobName,
                                                                                                                            argument: A,
                                                                                                                            options?: ScheduleJobOptions
                                                                                                                            ) => Job<A, I, O>;
                                                                                                                            • Schedule a job to be run, using its name.

                                                                                                                              Parameter name

                                                                                                                              The name of job to be run.

                                                                                                                              Parameter argument

                                                                                                                              The argument to send to the job when starting it.

                                                                                                                              Parameter options

                                                                                                                              Scheduling options.

                                                                                                                              Returns

                                                                                                                              The job being run.

                                                                                                                            interface SimpleJobHandlerContext

                                                                                                                            interface SimpleJobHandlerContext<
                                                                                                                            A extends JsonValue,
                                                                                                                            I extends JsonValue,
                                                                                                                            O extends JsonValue
                                                                                                                            > extends JobHandlerContext<A, I, O> {}
                                                                                                                            • Interface for the JobHandler context that is used when using createJobHandler(). It extends the basic JobHandlerContext with additional functionality.

                                                                                                                            property createChannel

                                                                                                                            createChannel: (name: string) => Observer<JsonValue>;

                                                                                                                              property input

                                                                                                                              input: Observable<I>;

                                                                                                                                enum JobInboundMessageKind

                                                                                                                                enum JobInboundMessageKind {
                                                                                                                                Ping = 'ip',
                                                                                                                                Stop = 'is',
                                                                                                                                Input = 'in',
                                                                                                                                }
                                                                                                                                • Messages that can be sent TO a job. The job needs to listen to those.

                                                                                                                                member Input

                                                                                                                                Input = 'in'

                                                                                                                                  member Ping

                                                                                                                                  Ping = 'ip'

                                                                                                                                    member Stop

                                                                                                                                    Stop = 'is'

                                                                                                                                      enum JobOutboundMessageKind

                                                                                                                                      enum JobOutboundMessageKind {
                                                                                                                                      OnReady = 'c',
                                                                                                                                      Start = 's',
                                                                                                                                      End = 'e',
                                                                                                                                      Pong = 'p',
                                                                                                                                      Output = 'o',
                                                                                                                                      ChannelCreate = 'cn',
                                                                                                                                      ChannelMessage = 'cm',
                                                                                                                                      ChannelError = 'ce',
                                                                                                                                      ChannelComplete = 'cc',
                                                                                                                                      }
                                                                                                                                      • Kind of messages that can be outputted from a job.

                                                                                                                                      member ChannelComplete

                                                                                                                                      ChannelComplete = 'cc'

                                                                                                                                        member ChannelCreate

                                                                                                                                        ChannelCreate = 'cn'

                                                                                                                                          member ChannelError

                                                                                                                                          ChannelError = 'ce'

                                                                                                                                            member ChannelMessage

                                                                                                                                            ChannelMessage = 'cm'

                                                                                                                                              member End

                                                                                                                                              End = 'e'

                                                                                                                                                member OnReady

                                                                                                                                                OnReady = 'c'

                                                                                                                                                  member Output

                                                                                                                                                  Output = 'o'

                                                                                                                                                    member Pong

                                                                                                                                                    Pong = 'p'

                                                                                                                                                      member Start

                                                                                                                                                      Start = 's'

                                                                                                                                                        enum JobState

                                                                                                                                                        enum JobState {
                                                                                                                                                        Queued = 'queued',
                                                                                                                                                        Ready = 'ready',
                                                                                                                                                        Started = 'started',
                                                                                                                                                        Ended = 'ended',
                                                                                                                                                        Errored = 'errored',
                                                                                                                                                        }
                                                                                                                                                        • The state of a job. These are changed as the job reports a new state through its messages.

                                                                                                                                                        member Ended

                                                                                                                                                        Ended = 'ended'
                                                                                                                                                        • The job has ended and is done running.

                                                                                                                                                        member Errored

                                                                                                                                                        Errored = 'errored'
                                                                                                                                                        • An error occured and the job stopped because of internal state.

                                                                                                                                                        member Queued

                                                                                                                                                        Queued = 'queued'
                                                                                                                                                        • The job was queued and is waiting to start.

                                                                                                                                                        member Ready

                                                                                                                                                        Ready = 'ready'
                                                                                                                                                        • The job description was found, its dependencies (see "Synchronizing and Dependencies") are done running, and the job's argument is validated and the job's code will be executed.

                                                                                                                                                        member Started

                                                                                                                                                        Started = 'started'
                                                                                                                                                        • The job has been started. The job implementation is expected to send this as soon as its work is starting.

                                                                                                                                                        type JobInboundMessage

                                                                                                                                                        type JobInboundMessage<InputT extends JsonValue> =
                                                                                                                                                        | JobInboundMessagePing
                                                                                                                                                        | JobInboundMessageStop
                                                                                                                                                        | JobInboundMessageInput<InputT>;

                                                                                                                                                          type JobName

                                                                                                                                                          type JobName = string;
                                                                                                                                                          • A job name is just a string (needs to be serializable).

                                                                                                                                                          type JobOutboundMessage

                                                                                                                                                          type JobOutboundMessage<OutputT extends JsonValue> =
                                                                                                                                                          | JobOutboundMessageOnReady
                                                                                                                                                          | JobOutboundMessageStart
                                                                                                                                                          | JobOutboundMessageOutput<OutputT>
                                                                                                                                                          | JobOutboundMessageChannelCreate
                                                                                                                                                          | JobOutboundMessageChannelMessage
                                                                                                                                                          | JobOutboundMessageChannelError
                                                                                                                                                          | JobOutboundMessageChannelComplete
                                                                                                                                                          | JobOutboundMessageEnd
                                                                                                                                                          | JobOutboundMessagePong;
                                                                                                                                                          • Generic message type.

                                                                                                                                                          type SimpleJobHandlerFn

                                                                                                                                                          type SimpleJobHandlerFn<
                                                                                                                                                          A extends JsonValue,
                                                                                                                                                          I extends JsonValue,
                                                                                                                                                          O extends JsonValue
                                                                                                                                                          > = (
                                                                                                                                                          input: A,
                                                                                                                                                          context: SimpleJobHandlerContext<A, I, O>
                                                                                                                                                          ) => O | Promise<O> | Observable<O>;
                                                                                                                                                          • A simple version of the JobHandler. This simplifies a lot of the interaction with the job scheduler and registry. For example, instead of returning a JobOutboundMessage observable, you can directly return an output.

                                                                                                                                                          namespace jobs.strategy

                                                                                                                                                          namespace jobs.strategy {}

                                                                                                                                                            function memoize

                                                                                                                                                            memoize: <
                                                                                                                                                            A extends JsonValue = JsonValue,
                                                                                                                                                            I extends JsonValue = JsonValue,
                                                                                                                                                            O extends JsonValue = JsonValue
                                                                                                                                                            >(
                                                                                                                                                            replayMessages?: boolean
                                                                                                                                                            ) => JobStrategy<A, I, O>;
                                                                                                                                                            • Creates a JobStrategy that will reuse a running job if the argument matches.

                                                                                                                                                              Parameter replayMessages

                                                                                                                                                              Replay ALL messages if a job is reused, otherwise just hook up where it is.

                                                                                                                                                            function reuse

                                                                                                                                                            reuse: <
                                                                                                                                                            A extends JsonValue = JsonValue,
                                                                                                                                                            I extends JsonValue = JsonValue,
                                                                                                                                                            O extends JsonValue = JsonValue
                                                                                                                                                            >(
                                                                                                                                                            replayMessages?: boolean
                                                                                                                                                            ) => JobStrategy<A, I, O>;
                                                                                                                                                            • Creates a JobStrategy that will always reuse a running job, and restart it if the job ended.

                                                                                                                                                              Parameter replayMessages

                                                                                                                                                              Replay ALL messages if a job is reused, otherwise just hook up where it is.

                                                                                                                                                            function serialize

                                                                                                                                                            serialize: <
                                                                                                                                                            A extends JsonValue = JsonValue,
                                                                                                                                                            I extends JsonValue = JsonValue,
                                                                                                                                                            O extends JsonValue = JsonValue
                                                                                                                                                            >() => JobStrategy<A, I, O>;
                                                                                                                                                            • Creates a JobStrategy that serializes every call. This strategy can be mixed between jobs.

                                                                                                                                                            type JobStrategy

                                                                                                                                                            type JobStrategy<
                                                                                                                                                            A extends JsonValue = JsonValue,
                                                                                                                                                            I extends JsonValue = JsonValue,
                                                                                                                                                            O extends JsonValue = JsonValue
                                                                                                                                                            > = (
                                                                                                                                                            handler: JobHandler<A, I, O>,
                                                                                                                                                            options?: Partial<Readonly<JobDescription>>
                                                                                                                                                            ) => JobHandler<A, I, O>;

                                                                                                                                                              Package Files (14)

                                                                                                                                                              Dependencies (2)

                                                                                                                                                              Dev Dependencies (0)

                                                                                                                                                              No dev dependencies.

                                                                                                                                                              Peer Dependencies (0)

                                                                                                                                                              No peer dependencies.

                                                                                                                                                              Badge

                                                                                                                                                              To add a badge like this onejsDocs.io badgeto your package's README, use the codes available below.

                                                                                                                                                              You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/@angular-devkit/architect.

                                                                                                                                                              • Markdown
                                                                                                                                                                [![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](https://www.jsdocs.io/package/@angular-devkit/architect)
                                                                                                                                                              • HTML
                                                                                                                                                                <a href="https://www.jsdocs.io/package/@angular-devkit/architect"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>