aboutsummaryrefslogtreecommitdiff
path: root/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/sink
diff options
context:
space:
mode:
authorDanijel Andjelkovic <adanijel99@gmail.com>2022-03-01 21:54:41 +0100
committerDanijel Andjelkovic <adanijel99@gmail.com>2022-03-01 21:54:41 +0100
commit6c8128f9fd5a5d0be115806c35a21b3d683df8d6 (patch)
treef46c2f6b3b9b294ff32bd75c08ccdc9e7a8cc4ef /sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/sink
parent2400b84e95913665da6279114168148444b8f9ab (diff)
parent7d3640f824f46490b47bd95f1c5a16644f712068 (diff)
Merge branch 'dev' of http://gitlab.pmf.kg.ac.rs/igrannonica/neuronstellar into logo
Diffstat (limited to 'sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/sink')
-rw-r--r--sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/sink/dryrun.d.ts50
-rw-r--r--sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/sink/dryrun.js80
-rw-r--r--sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/sink/host.d.ts29
-rw-r--r--sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/sink/host.js76
-rw-r--r--sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/sink/sink.d.ts35
-rw-r--r--sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/sink/sink.js116
6 files changed, 386 insertions, 0 deletions
diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/sink/dryrun.d.ts b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/sink/dryrun.d.ts
new file mode 100644
index 00000000..bb7ab7d1
--- /dev/null
+++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/sink/dryrun.d.ts
@@ -0,0 +1,50 @@
+/**
+ * @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
+ */
+/// <reference types="node" />
+import { virtualFs } from '@angular-devkit/core';
+import { Observable, Subject } from 'rxjs';
+import { HostSink } from './host';
+export interface DryRunErrorEvent {
+ kind: 'error';
+ description: 'alreadyExist' | 'doesNotExist';
+ path: string;
+}
+export interface DryRunDeleteEvent {
+ kind: 'delete';
+ path: string;
+}
+export interface DryRunCreateEvent {
+ kind: 'create';
+ path: string;
+ content: Buffer;
+}
+export interface DryRunUpdateEvent {
+ kind: 'update';
+ path: string;
+ content: Buffer;
+}
+export interface DryRunRenameEvent {
+ kind: 'rename';
+ path: string;
+ to: string;
+}
+export declare type DryRunEvent = DryRunErrorEvent | DryRunDeleteEvent | DryRunCreateEvent | DryRunUpdateEvent | DryRunRenameEvent;
+export declare class DryRunSink extends HostSink {
+ protected _subject: Subject<DryRunEvent>;
+ protected _fileDoesNotExistExceptionSet: Set<string>;
+ protected _fileAlreadyExistExceptionSet: Set<string>;
+ readonly reporter: Observable<DryRunEvent>;
+ /**
+ * @param {host} dir The host to use to output. This should be scoped.
+ * @param {boolean} force Whether to force overwriting files that already exist.
+ */
+ constructor(host: virtualFs.Host, force?: boolean);
+ protected _fileAlreadyExistException(path: string): void;
+ protected _fileDoesNotExistException(path: string): void;
+ _done(): Observable<void>;
+}
diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/sink/dryrun.js b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/sink/dryrun.js
new file mode 100644
index 00000000..7ff91540
--- /dev/null
+++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/sink/dryrun.js
@@ -0,0 +1,80 @@
+"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.DryRunSink = void 0;
+const core_1 = require("@angular-devkit/core");
+const node_1 = require("@angular-devkit/core/node");
+const rxjs_1 = require("rxjs");
+const host_1 = require("./host");
+class DryRunSink extends host_1.HostSink {
+ constructor(host, force = false) {
+ super(typeof host == 'string'
+ ? new core_1.virtualFs.ScopedHost(new node_1.NodeJsSyncHost(), (0, core_1.normalize)(host))
+ : host, force);
+ this._subject = new rxjs_1.Subject();
+ this._fileDoesNotExistExceptionSet = new Set();
+ this._fileAlreadyExistExceptionSet = new Set();
+ this.reporter = this._subject.asObservable();
+ }
+ _fileAlreadyExistException(path) {
+ this._fileAlreadyExistExceptionSet.add(path);
+ }
+ _fileDoesNotExistException(path) {
+ this._fileDoesNotExistExceptionSet.add(path);
+ }
+ _done() {
+ this._fileAlreadyExistExceptionSet.forEach((path) => {
+ this._subject.next({
+ kind: 'error',
+ description: 'alreadyExist',
+ path,
+ });
+ });
+ this._fileDoesNotExistExceptionSet.forEach((path) => {
+ this._subject.next({
+ kind: 'error',
+ description: 'doesNotExist',
+ path,
+ });
+ });
+ this._filesToDelete.forEach((path) => {
+ // Check if this is a renaming.
+ for (const [from] of this._filesToRename) {
+ if (from == path) {
+ // The event is sent later on.
+ return;
+ }
+ }
+ this._subject.next({ kind: 'delete', path });
+ });
+ this._filesToRename.forEach(([path, to]) => {
+ this._subject.next({ kind: 'rename', path, to });
+ });
+ this._filesToCreate.forEach((content, path) => {
+ // Check if this is a renaming.
+ for (const [, to] of this._filesToRename) {
+ if (to == path) {
+ // The event is sent later on.
+ return;
+ }
+ }
+ if (this._fileAlreadyExistExceptionSet.has(path) ||
+ this._fileDoesNotExistExceptionSet.has(path)) {
+ return;
+ }
+ this._subject.next({ kind: 'create', path, content: content.generate() });
+ });
+ this._filesToUpdate.forEach((content, path) => {
+ this._subject.next({ kind: 'update', path, content: content.generate() });
+ });
+ this._subject.complete();
+ return (0, rxjs_1.of)(undefined);
+ }
+}
+exports.DryRunSink = DryRunSink;
diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/sink/host.d.ts b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/sink/host.d.ts
new file mode 100644
index 00000000..3f2934c4
--- /dev/null
+++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/sink/host.d.ts
@@ -0,0 +1,29 @@
+/**
+ * @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
+ */
+/// <reference types="node" />
+import { Path, virtualFs } from '@angular-devkit/core';
+import { Observable } from 'rxjs';
+import { CreateFileAction } from '../tree/action';
+import { UpdateBufferBase } from '../utility/update-buffer';
+import { SimpleSinkBase } from './sink';
+export declare class HostSink extends SimpleSinkBase {
+ protected _host: virtualFs.Host;
+ protected _force: boolean;
+ protected _filesToDelete: Set<Path>;
+ protected _filesToRename: Set<[Path, Path]>;
+ protected _filesToCreate: Map<Path, UpdateBufferBase>;
+ protected _filesToUpdate: Map<Path, UpdateBufferBase>;
+ constructor(_host: virtualFs.Host, _force?: boolean);
+ protected _validateCreateAction(action: CreateFileAction): Observable<void>;
+ protected _validateFileExists(p: Path): Observable<boolean>;
+ protected _overwriteFile(path: Path, content: Buffer): Observable<void>;
+ protected _createFile(path: Path, content: Buffer): Observable<void>;
+ protected _renameFile(from: Path, to: Path): Observable<void>;
+ protected _deleteFile(path: Path): Observable<void>;
+ _done(): Observable<void>;
+}
diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/sink/host.js b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/sink/host.js
new file mode 100644
index 00000000..a5bb10b3
--- /dev/null
+++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/sink/host.js
@@ -0,0 +1,76 @@
+"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.HostSink = void 0;
+const rxjs_1 = require("rxjs");
+const operators_1 = require("rxjs/operators");
+const update_buffer_1 = require("../utility/update-buffer");
+const sink_1 = require("./sink");
+class HostSink extends sink_1.SimpleSinkBase {
+ constructor(_host, _force = false) {
+ super();
+ this._host = _host;
+ this._force = _force;
+ this._filesToDelete = new Set();
+ this._filesToRename = new Set();
+ this._filesToCreate = new Map();
+ this._filesToUpdate = new Map();
+ }
+ _validateCreateAction(action) {
+ return this._force ? rxjs_1.EMPTY : super._validateCreateAction(action);
+ }
+ _validateFileExists(p) {
+ if (this._filesToCreate.has(p) || this._filesToUpdate.has(p)) {
+ return (0, rxjs_1.of)(true);
+ }
+ if (this._filesToDelete.has(p)) {
+ return (0, rxjs_1.of)(false);
+ }
+ for (const [from, to] of this._filesToRename.values()) {
+ switch (p) {
+ case from:
+ return (0, rxjs_1.of)(false);
+ case to:
+ return (0, rxjs_1.of)(true);
+ }
+ }
+ return this._host.exists(p);
+ }
+ _overwriteFile(path, content) {
+ this._filesToUpdate.set(path, update_buffer_1.UpdateBufferBase.create(content));
+ return rxjs_1.EMPTY;
+ }
+ _createFile(path, content) {
+ this._filesToCreate.set(path, update_buffer_1.UpdateBufferBase.create(content));
+ return rxjs_1.EMPTY;
+ }
+ _renameFile(from, to) {
+ this._filesToRename.add([from, to]);
+ return rxjs_1.EMPTY;
+ }
+ _deleteFile(path) {
+ if (this._filesToCreate.has(path)) {
+ this._filesToCreate.delete(path);
+ this._filesToUpdate.delete(path);
+ }
+ else {
+ this._filesToDelete.add(path);
+ }
+ return rxjs_1.EMPTY;
+ }
+ _done() {
+ // Really commit everything to the actual filesystem.
+ return (0, rxjs_1.concat)((0, rxjs_1.from)([...this._filesToDelete.values()]).pipe((0, operators_1.concatMap)((path) => this._host.delete(path))), (0, rxjs_1.from)([...this._filesToRename.entries()]).pipe((0, operators_1.concatMap)(([_, [path, to]]) => this._host.rename(path, to))), (0, rxjs_1.from)([...this._filesToCreate.entries()]).pipe((0, operators_1.concatMap)(([path, buffer]) => {
+ return this._host.write(path, buffer.generate());
+ })), (0, rxjs_1.from)([...this._filesToUpdate.entries()]).pipe((0, operators_1.concatMap)(([path, buffer]) => {
+ return this._host.write(path, buffer.generate());
+ }))).pipe((0, operators_1.reduce)(() => { }));
+ }
+}
+exports.HostSink = HostSink;
diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/sink/sink.d.ts b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/sink/sink.d.ts
new file mode 100644
index 00000000..9e441f2a
--- /dev/null
+++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/sink/sink.d.ts
@@ -0,0 +1,35 @@
+/**
+ * @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
+ */
+/// <reference types="node" />
+import { Observable } from 'rxjs';
+import { Action, CreateFileAction, DeleteFileAction, OverwriteFileAction, RenameFileAction } from '../tree/action';
+import { Tree } from '../tree/interface';
+export interface Sink {
+ commit(tree: Tree): Observable<void>;
+}
+export declare abstract class SimpleSinkBase implements Sink {
+ preCommitAction: (action: Action) => void | Action | PromiseLike<Action> | Observable<Action>;
+ postCommitAction: (action: Action) => void | Observable<void>;
+ preCommit: () => void | Observable<void>;
+ postCommit: () => void | Observable<void>;
+ protected abstract _validateFileExists(p: string): Observable<boolean>;
+ protected abstract _overwriteFile(path: string, content: Buffer): Observable<void>;
+ protected abstract _createFile(path: string, content: Buffer): Observable<void>;
+ protected abstract _renameFile(path: string, to: string): Observable<void>;
+ protected abstract _deleteFile(path: string): Observable<void>;
+ protected abstract _done(): Observable<void>;
+ protected _fileAlreadyExistException(path: string): void;
+ protected _fileDoesNotExistException(path: string): void;
+ protected _validateOverwriteAction(action: OverwriteFileAction): Observable<void>;
+ protected _validateCreateAction(action: CreateFileAction): Observable<void>;
+ protected _validateRenameAction(action: RenameFileAction): Observable<void>;
+ protected _validateDeleteAction(action: DeleteFileAction): Observable<void>;
+ validateSingleAction(action: Action): Observable<void>;
+ commitSingleAction(action: Action): Observable<void>;
+ commit(tree: Tree): Observable<void>;
+}
diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/sink/sink.js b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/sink/sink.js
new file mode 100644
index 00000000..80b42052
--- /dev/null
+++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/sink/sink.js
@@ -0,0 +1,116 @@
+"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.SimpleSinkBase = void 0;
+const rxjs_1 = require("rxjs");
+const operators_1 = require("rxjs/operators");
+const exception_1 = require("../exception/exception");
+const action_1 = require("../tree/action");
+const Noop = function () { };
+class SimpleSinkBase {
+ constructor() {
+ this.preCommitAction = Noop;
+ this.postCommitAction = Noop;
+ this.preCommit = Noop;
+ this.postCommit = Noop;
+ }
+ _fileAlreadyExistException(path) {
+ throw new exception_1.FileAlreadyExistException(path);
+ }
+ _fileDoesNotExistException(path) {
+ throw new exception_1.FileDoesNotExistException(path);
+ }
+ _validateOverwriteAction(action) {
+ return this._validateFileExists(action.path).pipe((0, operators_1.map)((b) => {
+ if (!b) {
+ this._fileDoesNotExistException(action.path);
+ }
+ }));
+ }
+ _validateCreateAction(action) {
+ return this._validateFileExists(action.path).pipe((0, operators_1.map)((b) => {
+ if (b) {
+ this._fileAlreadyExistException(action.path);
+ }
+ }));
+ }
+ _validateRenameAction(action) {
+ return this._validateFileExists(action.path).pipe((0, operators_1.map)((b) => {
+ if (!b) {
+ this._fileDoesNotExistException(action.path);
+ }
+ }), (0, operators_1.mergeMap)(() => this._validateFileExists(action.to)), (0, operators_1.map)((b) => {
+ if (b) {
+ this._fileAlreadyExistException(action.to);
+ }
+ }));
+ }
+ _validateDeleteAction(action) {
+ return this._validateFileExists(action.path).pipe((0, operators_1.map)((b) => {
+ if (!b) {
+ this._fileDoesNotExistException(action.path);
+ }
+ }));
+ }
+ validateSingleAction(action) {
+ switch (action.kind) {
+ case 'o':
+ return this._validateOverwriteAction(action);
+ case 'c':
+ return this._validateCreateAction(action);
+ case 'r':
+ return this._validateRenameAction(action);
+ case 'd':
+ return this._validateDeleteAction(action);
+ default:
+ throw new action_1.UnknownActionException(action);
+ }
+ }
+ commitSingleAction(action) {
+ return (0, rxjs_1.concat)(this.validateSingleAction(action), new rxjs_1.Observable((observer) => {
+ let committed = null;
+ switch (action.kind) {
+ case 'o':
+ committed = this._overwriteFile(action.path, action.content);
+ break;
+ case 'c':
+ committed = this._createFile(action.path, action.content);
+ break;
+ case 'r':
+ committed = this._renameFile(action.path, action.to);
+ break;
+ case 'd':
+ committed = this._deleteFile(action.path);
+ break;
+ }
+ if (committed) {
+ committed.subscribe(observer);
+ }
+ else {
+ observer.complete();
+ }
+ })).pipe((0, operators_1.ignoreElements)());
+ }
+ commit(tree) {
+ const actions = (0, rxjs_1.from)(tree.actions);
+ return (0, rxjs_1.concat)(this.preCommit() || (0, rxjs_1.of)(null), (0, rxjs_1.defer)(() => actions).pipe((0, operators_1.concatMap)((action) => {
+ const maybeAction = this.preCommitAction(action);
+ if ((0, rxjs_1.isObservable)(maybeAction) || isPromiseLike(maybeAction)) {
+ return maybeAction;
+ }
+ return (0, rxjs_1.of)(maybeAction || action);
+ }), (0, operators_1.concatMap)((action) => {
+ return (0, rxjs_1.concat)(this.commitSingleAction(action).pipe((0, operators_1.ignoreElements)()), (0, rxjs_1.of)(action));
+ }), (0, operators_1.concatMap)((action) => this.postCommitAction(action) || (0, rxjs_1.of)(null))), (0, rxjs_1.defer)(() => this._done()), (0, rxjs_1.defer)(() => this.postCommit() || (0, rxjs_1.of)(null))).pipe((0, operators_1.ignoreElements)());
+ }
+}
+exports.SimpleSinkBase = SimpleSinkBase;
+function isPromiseLike(value) {
+ return !!value && typeof value.then === 'function';
+}