diff options
author | Danijel Andjelkovic <adanijel99@gmail.com> | 2022-03-01 20:21:29 +0000 |
---|---|---|
committer | Danijel Andjelkovic <adanijel99@gmail.com> | 2022-03-01 20:21:29 +0000 |
commit | 61cb1570a3410c85a4489b97c172e3a50715f36c (patch) | |
tree | 8fe4a5b77ea54bba80abc817ce2c9ef0e79e7e66 /sandbox/testAppNevena/Front/node_modules/@angular-devkit/architect/src/schedule-by-name.js | |
parent | 21a53d349788c99d2007cba91a923db982353b31 (diff) | |
parent | a9ee9e0a500a4a15bd0b5dcaf041f827228ed309 (diff) |
Merge branch 'researchML' into 'dev'
Research ml
See merge request igrannonica/neuronstellar!6
Diffstat (limited to 'sandbox/testAppNevena/Front/node_modules/@angular-devkit/architect/src/schedule-by-name.js')
-rw-r--r-- | sandbox/testAppNevena/Front/node_modules/@angular-devkit/architect/src/schedule-by-name.js | 102 |
1 files changed, 102 insertions, 0 deletions
diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/architect/src/schedule-by-name.js b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/architect/src/schedule-by-name.js new file mode 100644 index 00000000..b3dbac77 --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/architect/src/schedule-by-name.js @@ -0,0 +1,102 @@ +"use strict"; +/** + * @license + * 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 + */ +Object.defineProperty(exports, "__esModule", { value: true }); +exports.scheduleByTarget = exports.scheduleByName = void 0; +const core_1 = require("@angular-devkit/core"); +const rxjs_1 = require("rxjs"); +const operators_1 = require("rxjs/operators"); +const api_1 = require("./api"); +const progressSchema = require('./progress-schema.json'); +let _uniqueId = 0; +async function scheduleByName(name, buildOptions, options) { + const childLoggerName = options.target ? `{${(0, api_1.targetStringFromTarget)(options.target)}}` : name; + const logger = options.logger.createChild(childLoggerName); + const job = options.scheduler.schedule(name, {}); + let stateSubscription; + const workspaceRoot = await options.workspaceRoot; + const currentDirectory = await options.currentDirectory; + const description = await job.description.toPromise(); + const info = description.info; + const id = ++_uniqueId; + const message = { + id, + currentDirectory, + workspaceRoot, + info: info, + options: buildOptions, + ...(options.target ? { target: options.target } : {}), + }; + // Wait for the job to be ready. + if (job.state !== core_1.experimental.jobs.JobState.Started) { + stateSubscription = job.outboundBus.subscribe((event) => { + if (event.kind === core_1.experimental.jobs.JobOutboundMessageKind.Start) { + job.input.next(message); + } + }, () => { }); + } + else { + job.input.next(message); + } + const logChannelSub = job.getChannel('log').subscribe((entry) => { + logger.next(entry); + }, () => { }); + const s = job.outboundBus.subscribe({ + error() { }, + complete() { + s.unsubscribe(); + logChannelSub.unsubscribe(); + if (stateSubscription) { + stateSubscription.unsubscribe(); + } + }, + }); + const output = job.output.pipe((0, operators_1.map)((output) => ({ + ...output, + ...(options.target ? { target: options.target } : 0), + info, + })), (0, operators_1.shareReplay)()); + // If there's an analytics object, take the job channel and report it to the analytics. + if (options.analytics) { + const reporter = new core_1.analytics.AnalyticsReporter(options.analytics); + job + .getChannel('analytics') + .subscribe((report) => reporter.report(report)); + } + // Start the builder. + output.pipe((0, operators_1.first)()).subscribe({ + error() { }, + }); + return { + id, + info, + // This is a getter so that it always returns the next output, and not the same one. + get result() { + return output.pipe((0, operators_1.first)()).toPromise(); + }, + output, + progress: job + .getChannel('progress', progressSchema) + .pipe((0, operators_1.shareReplay)(1)), + stop() { + job.stop(); + return job.outboundBus + .pipe((0, operators_1.ignoreElements)(), (0, operators_1.catchError)(() => rxjs_1.EMPTY)) + .toPromise(); + }, + }; +} +exports.scheduleByName = scheduleByName; +async function scheduleByTarget(target, overrides, options) { + return scheduleByName(`{${(0, api_1.targetStringFromTarget)(target)}}`, overrides, { + ...options, + target, + logger: options.logger, + }); +} +exports.scheduleByTarget = scheduleByTarget; |