66 * found in the LICENSE file at https://angular.io/license
77 */
88
9- import { analytics , experimental , json , logging } from '@angular-devkit/core' ;
9+ import { analytics , json , logging } from '@angular-devkit/core' ;
1010import { Observable , from , merge , of , onErrorResumeNext } from 'rxjs' ;
1111import {
1212 concatMap ,
@@ -28,6 +28,20 @@ import {
2828 targetStringFromTarget ,
2929} from './api' ;
3030import { ArchitectHost , BuilderDescription , BuilderJobHandler } from './internal' ;
31+ import {
32+ FallbackRegistry ,
33+ JobHandler ,
34+ JobHandlerContext ,
35+ JobInboundMessage ,
36+ JobInboundMessageKind ,
37+ JobName ,
38+ JobOutboundMessageKind ,
39+ Registry ,
40+ Scheduler ,
41+ SimpleJobRegistry ,
42+ SimpleScheduler ,
43+ createJobHandler ,
44+ } from './jobs' ;
3145import { scheduleByName , scheduleByTarget } from './schedule-by-name' ;
3246
3347const inputSchema = require ( './input-schema.json' ) ;
@@ -48,11 +62,11 @@ function _createJobHandlerFromBuilderInfo(
4862 info,
4963 } ;
5064
51- function handler ( argument : json . JsonObject , context : experimental . jobs . JobHandlerContext ) {
65+ function handler ( argument : json . JsonObject , context : JobHandlerContext ) {
5266 // Add input validation to the inbound bus.
5367 const inboundBusWithInputValidation = context . inboundBus . pipe (
5468 concatMap ( ( message ) => {
55- if ( message . kind === experimental . jobs . JobInboundMessageKind . Input ) {
69+ if ( message . kind === JobInboundMessageKind . Input ) {
5670 const v = message . value as BuilderInput ;
5771 const options = {
5872 ...baseOptions ,
@@ -73,7 +87,7 @@ function _createJobHandlerFromBuilderInfo(
7387 map ( ( value ) => ( { ...message , value } ) ) ,
7488 ) ;
7589 } else {
76- return of ( message as experimental . jobs . JobInboundMessage < BuilderInput > ) ;
90+ return of ( message as JobInboundMessage < BuilderInput > ) ;
7791 }
7892 } ) ,
7993 // Using a share replay because the job might be synchronously sending input, but
@@ -93,7 +107,7 @@ function _createJobHandlerFromBuilderInfo(
93107
94108 return builder . handler ( argument , { ...context , inboundBus } ) . pipe (
95109 map ( ( output ) => {
96- if ( output . kind === experimental . jobs . JobOutboundMessageKind . Output ) {
110+ if ( output . kind === JobOutboundMessageKind . Output ) {
97111 // Add target to it.
98112 return {
99113 ...output ,
@@ -198,7 +212,7 @@ class ArchitectBuilderJobRegistry implements BuilderRegistry {
198212
199213 get < A extends json . JsonObject , I extends BuilderInput , O extends BuilderOutput > (
200214 name : string ,
201- ) : Observable < experimental . jobs . JobHandler < A , I , O > | null > {
215+ ) : Observable < JobHandler < A , I , O > | null > {
202216 const m = name . match ( / ^ ( [ ^ : ] + ) : ( [ ^ : ] + ) $ / i) ;
203217 if ( ! m ) {
204218 return of ( null ) ;
@@ -207,7 +221,7 @@ class ArchitectBuilderJobRegistry implements BuilderRegistry {
207221 return from ( this . _resolveBuilder ( name ) ) . pipe (
208222 concatMap ( ( builderInfo ) => ( builderInfo ? this . _createBuilder ( builderInfo ) : of ( null ) ) ) ,
209223 first ( null , null ) ,
210- ) as Observable < experimental . jobs . JobHandler < A , I , O > | null > ;
224+ ) as Observable < JobHandler < A , I , O > | null > ;
211225 }
212226}
213227
@@ -217,7 +231,7 @@ class ArchitectBuilderJobRegistry implements BuilderRegistry {
217231class ArchitectTargetJobRegistry extends ArchitectBuilderJobRegistry {
218232 override get < A extends json . JsonObject , I extends BuilderInput , O extends BuilderOutput > (
219233 name : string ,
220- ) : Observable < experimental . jobs . JobHandler < A , I , O > | null > {
234+ ) : Observable < JobHandler < A , I , O > | null > {
221235 const m = name . match ( / ^ { ( [ ^ : ] + ) : ( [ ^ : ] + ) (?: : ( [ ^ : ] * ) ) ? } $ / i) ;
222236 if ( ! m ) {
223237 return of ( null ) ;
@@ -251,12 +265,12 @@ class ArchitectTargetJobRegistry extends ArchitectBuilderJobRegistry {
251265 ) ;
252266 } ) ,
253267 first ( null , null ) ,
254- ) as Observable < experimental . jobs . JobHandler < A , I , O > | null > ;
268+ ) as Observable < JobHandler < A , I , O > | null > ;
255269 }
256270}
257271
258272function _getTargetOptionsFactory ( host : ArchitectHost ) {
259- return experimental . jobs . createJobHandler < Target , json . JsonValue , json . JsonObject > (
273+ return createJobHandler < Target , json . JsonValue , json . JsonObject > (
260274 ( target ) => {
261275 return host . getOptionsForTarget ( target ) . then ( ( options ) => {
262276 if ( options === null ) {
@@ -275,7 +289,7 @@ function _getTargetOptionsFactory(host: ArchitectHost) {
275289}
276290
277291function _getProjectMetadataFactory ( host : ArchitectHost ) {
278- return experimental . jobs . createJobHandler < Target , json . JsonValue , json . JsonObject > (
292+ return createJobHandler < Target , json . JsonValue , json . JsonObject > (
279293 ( target ) => {
280294 return host . getProjectMetadata ( target ) . then ( ( options ) => {
281295 if ( options === null ) {
@@ -296,7 +310,7 @@ function _getProjectMetadataFactory(host: ArchitectHost) {
296310}
297311
298312function _getBuilderNameForTargetFactory ( host : ArchitectHost ) {
299- return experimental . jobs . createJobHandler < Target , never , string > (
313+ return createJobHandler < Target , never , string > (
300314 async ( target ) => {
301315 const builderName = await host . getBuilderNameForTarget ( target ) ;
302316 if ( ! builderName ) {
@@ -314,7 +328,7 @@ function _getBuilderNameForTargetFactory(host: ArchitectHost) {
314328}
315329
316330function _validateOptionsFactory ( host : ArchitectHost , registry : json . schema . SchemaRegistry ) {
317- return experimental . jobs . createJobHandler < [ string , json . JsonObject ] , never , json . JsonObject > (
331+ return createJobHandler < [ string , json . JsonObject ] , never , json . JsonObject > (
318332 async ( [ builderName , options ] ) => {
319333 // Get option schema from the host.
320334 const builderInfo = await host . resolveBuilder ( builderName ) ;
@@ -348,33 +362,33 @@ function _validateOptionsFactory(host: ArchitectHost, registry: json.schema.Sche
348362}
349363
350364export class Architect {
351- private readonly _scheduler : experimental . jobs . Scheduler ;
365+ private readonly _scheduler : Scheduler ;
352366 private readonly _jobCache = new Map < string , Observable < BuilderJobHandler > > ( ) ;
353367 private readonly _infoCache = new Map < string , Observable < BuilderInfo > > ( ) ;
354368
355369 constructor (
356370 private _host : ArchitectHost ,
357371 registry : json . schema . SchemaRegistry = new json . schema . CoreSchemaRegistry ( ) ,
358- additionalJobRegistry ?: experimental . jobs . Registry ,
372+ additionalJobRegistry ?: Registry ,
359373 ) {
360- const privateArchitectJobRegistry = new experimental . jobs . SimpleJobRegistry ( ) ;
374+ const privateArchitectJobRegistry = new SimpleJobRegistry ( ) ;
361375 // Create private jobs.
362376 privateArchitectJobRegistry . register ( _getTargetOptionsFactory ( _host ) ) ;
363377 privateArchitectJobRegistry . register ( _getBuilderNameForTargetFactory ( _host ) ) ;
364378 privateArchitectJobRegistry . register ( _validateOptionsFactory ( _host , registry ) ) ;
365379 privateArchitectJobRegistry . register ( _getProjectMetadataFactory ( _host ) ) ;
366380
367- const jobRegistry = new experimental . jobs . FallbackRegistry ( [
381+ const jobRegistry = new FallbackRegistry ( [
368382 new ArchitectTargetJobRegistry ( _host , registry , this . _jobCache , this . _infoCache ) ,
369383 new ArchitectBuilderJobRegistry ( _host , registry , this . _jobCache , this . _infoCache ) ,
370384 privateArchitectJobRegistry ,
371385 ...( additionalJobRegistry ? [ additionalJobRegistry ] : [ ] ) ,
372- ] as experimental . jobs . Registry [ ] ) ;
386+ ] as Registry [ ] ) ;
373387
374- this . _scheduler = new experimental . jobs . SimpleScheduler ( jobRegistry , registry ) ;
388+ this . _scheduler = new SimpleScheduler ( jobRegistry , registry ) ;
375389 }
376390
377- has ( name : experimental . jobs . JobName ) {
391+ has ( name : JobName ) {
378392 return this . _scheduler . has ( name ) ;
379393 }
380394
0 commit comments