diff options
author | Danijel Andjelkovic <adanijel99@gmail.com> | 2022-03-01 21:54:41 +0100 |
---|---|---|
committer | Danijel Andjelkovic <adanijel99@gmail.com> | 2022-03-01 21:54:41 +0100 |
commit | 6c8128f9fd5a5d0be115806c35a21b3d683df8d6 (patch) | |
tree | f46c2f6b3b9b294ff32bd75c08ccdc9e7a8cc4ef /sandbox/testAppNevena/Front/node_modules/@angular-devkit | |
parent | 2400b84e95913665da6279114168148444b8f9ab (diff) | |
parent | 7d3640f824f46490b47bd95f1c5a16644f712068 (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')
352 files changed, 21053 insertions, 0 deletions
diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/architect/LICENSE b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/architect/LICENSE new file mode 100644 index 00000000..8876c32c --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/architect/LICENSE @@ -0,0 +1,21 @@ +The MIT License + +Copyright (c) 2017 Google, Inc. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/architect/README.md b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/architect/README.md new file mode 100644 index 00000000..3cfd7516 --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/architect/README.md @@ -0,0 +1,3 @@ +# Angular Build Facade + +WIP diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/architect/builders/all-of.d.ts b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/architect/builders/all-of.d.ts new file mode 100644 index 00000000..1db82959 --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/architect/builders/all-of.d.ts @@ -0,0 +1,11 @@ +/** + * @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 + */ +import { json } from '@angular-devkit/core'; +import { Schema as OperatorSchema } from './operator-schema'; +declare const _default: import("../src/internal").Builder<json.JsonObject & OperatorSchema>; +export default _default; diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/architect/builders/all-of.js b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/architect/builders/all-of.js new file mode 100644 index 00000000..fd085e6a --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/architect/builders/all-of.js @@ -0,0 +1,48 @@ +"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 }); +const rxjs_1 = require("rxjs"); +const operators_1 = require("rxjs/operators"); +const src_1 = require("../src"); +exports.default = (0, src_1.createBuilder)((options, context) => { + const allRuns = []; + context.reportProgress(0, (options.targets ? options.targets.length : 0) + + (options.builders ? options.builders.length : 0)); + if (options.targets) { + allRuns.push(...options.targets.map(({ target: targetStr, overrides }, i) => { + const [project, target, configuration] = targetStr.split(/:/g, 3); + return context + .scheduleTarget({ project, target, configuration }, overrides || {}) + .then((run) => [i, run]); + })); + } + if (options.builders) { + allRuns.push(...options.builders.map(({ builder, options }, i) => { + return context + .scheduleBuilder(builder, options || {}) + .then((run) => [i, run]); + })); + } + const allResults = allRuns.map(() => null); + let n = 0; + context.reportProgress(n++, allRuns.length); + return (0, rxjs_1.from)(allRuns).pipe((0, operators_1.mergeMap)((runPromise) => (0, rxjs_1.from)(runPromise)), (0, operators_1.mergeMap)(([i, run]) => run.output.pipe((0, operators_1.map)((output) => [i, output]))), (0, operators_1.mergeMap)(([i, output]) => { + allResults[i] = output; + context.reportProgress(n++, allRuns.length); + if (allResults.some((x) => x === null)) { + // Some builders aren't done running yet. + return rxjs_1.EMPTY; + } + else { + return (0, rxjs_1.of)({ + success: allResults.every((x) => (x ? x.success : false)), + }); + } + })); +}); diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/architect/builders/builders.json b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/architect/builders/builders.json new file mode 100644 index 00000000..5bbff828 --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/architect/builders/builders.json @@ -0,0 +1,25 @@ +{ + "$schema": "../src/builders-schema.json", + "builders": { + "true": { + "implementation": "./true", + "schema": "./noop-schema.json", + "description": "Always succeed." + }, + "false": { + "implementation": "./false", + "schema": "./noop-schema.json", + "description": "Always fails." + }, + "allOf": { + "implementation": "./all-of", + "schema": "./operator-schema.json", + "description": "A builder that executes many builders in parallel, and succeed if both succeeds." + }, + "concat": { + "implementation": "./concat", + "schema": "./operator-schema.json", + "description": "A builder that executes many builders one after the other, and stops when one fail. It will succeed if all builders succeeds (and return the last output)" + } + } +} diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/architect/builders/concat.d.ts b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/architect/builders/concat.d.ts new file mode 100644 index 00000000..1db82959 --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/architect/builders/concat.d.ts @@ -0,0 +1,11 @@ +/** + * @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 + */ +import { json } from '@angular-devkit/core'; +import { Schema as OperatorSchema } from './operator-schema'; +declare const _default: import("../src/internal").Builder<json.JsonObject & OperatorSchema>; +export default _default; diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/architect/builders/concat.js b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/architect/builders/concat.js new file mode 100644 index 00000000..747fefac --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/architect/builders/concat.js @@ -0,0 +1,45 @@ +"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 }); +const rxjs_1 = require("rxjs"); +const operators_1 = require("rxjs/operators"); +const src_1 = require("../src"); +exports.default = (0, src_1.createBuilder)((options, context) => { + const allRuns = []; + context.reportProgress(0, (options.targets ? options.targets.length : 0) + + (options.builders ? options.builders.length : 0)); + if (options.targets) { + allRuns.push(...options.targets.map(({ target: targetStr, overrides }) => { + const [project, target, configuration] = targetStr.split(/:/g, 3); + return () => context.scheduleTarget({ project, target, configuration }, overrides || {}); + })); + } + if (options.builders) { + allRuns.push(...options.builders.map(({ builder, options }) => { + return () => context.scheduleBuilder(builder, options || {}); + })); + } + let stop = null; + let i = 0; + context.reportProgress(i++, allRuns.length); + return (0, rxjs_1.from)(allRuns).pipe((0, operators_1.concatMap)((fn) => stop + ? (0, rxjs_1.of)(null) + : (0, rxjs_1.from)(fn()).pipe((0, operators_1.switchMap)((run) => (run === null ? (0, rxjs_1.of)(null) : run.output.pipe((0, operators_1.first)()))))), (0, operators_1.map)((output) => { + context.reportProgress(i++, allRuns.length); + if (output === null || stop !== null) { + return stop || { success: false }; + } + else if (output.success === false) { + return (stop = output); + } + else { + return output; + } + }), (0, operators_1.last)()); +}); diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/architect/builders/false.d.ts b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/architect/builders/false.d.ts new file mode 100644 index 00000000..cef2dd8a --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/architect/builders/false.d.ts @@ -0,0 +1,9 @@ +/** + * @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 + */ +declare const _default: import("../src/internal").Builder<import("../../core/src").JsonObject>; +export default _default; diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/architect/builders/false.js b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/architect/builders/false.js new file mode 100644 index 00000000..590e6c17 --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/architect/builders/false.js @@ -0,0 +1,14 @@ +"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 }); +const src_1 = require("../src"); +exports.default = (0, src_1.createBuilder)(() => ({ + success: false, + error: 'False builder always errors.', +})); diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/architect/builders/noop-schema.json b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/architect/builders/noop-schema.json new file mode 100644 index 00000000..77dd56a3 --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/architect/builders/noop-schema.json @@ -0,0 +1,4 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema", + "type": "object" +} diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/architect/builders/operator-schema.d.ts b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/architect/builders/operator-schema.d.ts new file mode 100644 index 00000000..9bc83751 --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/architect/builders/operator-schema.d.ts @@ -0,0 +1,19 @@ +/** + * All input types of builders that perform operations on one or multiple sub-builders. + */ +export interface Schema { + builders?: Builder[]; + targets?: Target[]; +} +export interface Builder { + builder: string; + options?: { + [key: string]: any; + }; +} +export interface Target { + overrides?: { + [key: string]: any; + }; + target: string; +} diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/architect/builders/operator-schema.js b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/architect/builders/operator-schema.js new file mode 100644 index 00000000..4fb6d3d1 --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/architect/builders/operator-schema.js @@ -0,0 +1,4 @@ +"use strict"; +// THIS FILE IS AUTOMATICALLY GENERATED. TO UPDATE THIS FILE YOU NEED TO CHANGE THE +// CORRESPONDING JSON SCHEMA FILE, THEN RUN devkit-admin build (or bazel build ...). +Object.defineProperty(exports, "__esModule", { value: true }); diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/architect/builders/operator-schema.json b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/architect/builders/operator-schema.json new file mode 100644 index 00000000..1de86018 --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/architect/builders/operator-schema.json @@ -0,0 +1,41 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema", + "description": "All input types of builders that perform operations on one or multiple sub-builders.", + "type": "object", + "properties": { + "builders": { + "type": "array", + "items": { + "type": "object", + "properties": { + "builder": { + "type": "string", + "pattern": ".*:.*" + }, + "options": { + "type": "object" + } + }, + "required": ["builder"] + }, + "minItems": 1 + }, + "targets": { + "type": "array", + "items": { + "type": "object", + "properties": { + "target": { + "type": "string", + "pattern": ".*:.*" + }, + "overrides": { + "type": "object" + } + }, + "required": ["target"] + }, + "minItems": 1 + } + } +} diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/architect/builders/true.d.ts b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/architect/builders/true.d.ts new file mode 100644 index 00000000..cef2dd8a --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/architect/builders/true.d.ts @@ -0,0 +1,9 @@ +/** + * @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 + */ +declare const _default: import("../src/internal").Builder<import("../../core/src").JsonObject>; +export default _default; diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/architect/builders/true.js b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/architect/builders/true.js new file mode 100644 index 00000000..32a3fbcc --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/architect/builders/true.js @@ -0,0 +1,11 @@ +"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 }); +const src_1 = require("../src"); +exports.default = (0, src_1.createBuilder)(() => ({ success: true })); diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/architect/node/BUILD.bazel b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/architect/node/BUILD.bazel new file mode 100644 index 00000000..672e73d7 --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/architect/node/BUILD.bazel @@ -0,0 +1,28 @@ +# Copyright Google Inc. 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 + +load("//tools:defaults.bzl", "ts_library") + +licenses(["notice"]) # MIT + +package(default_visibility = ["//visibility:public"]) + +ts_library( + name = "node", + srcs = glob( + include = ["**/*.ts"], + exclude = ["**/*_spec.ts"], + ), + module_name = "@angular-devkit/architect/node", + module_root = "index.d.ts", + # strict_checks = False, + deps = [ + "//packages/angular_devkit/architect", + "//packages/angular_devkit/core", + "//packages/angular_devkit/core/node", + "@npm//@types/node", + "@npm//rxjs", + ], +) diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/architect/node/index.d.ts b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/architect/node/index.d.ts new file mode 100644 index 00000000..ab719a3f --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/architect/node/index.d.ts @@ -0,0 +1,8 @@ +/** + * @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 + */ +export * from './node-modules-architect-host'; diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/architect/node/index.js b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/architect/node/index.js new file mode 100644 index 00000000..95a64785 --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/architect/node/index.js @@ -0,0 +1,20 @@ +"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 + */ +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __exportStar = (this && this.__exportStar) || function(m, exports) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +__exportStar(require("./node-modules-architect-host"), exports); diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/architect/node/node-modules-architect-host.d.ts b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/architect/node/node-modules-architect-host.d.ts new file mode 100644 index 00000000..809a0e72 --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/architect/node/node-modules-architect-host.d.ts @@ -0,0 +1,41 @@ +/** + * @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 + */ +import { json, workspaces } from '@angular-devkit/core'; +import { BuilderInfo } from '../src'; +import { Target } from '../src/input-schema'; +import { ArchitectHost, Builder } from '../src/internal'; +export declare type NodeModulesBuilderInfo = BuilderInfo & { + import: string; +}; +export interface WorkspaceHost { + getBuilderName(project: string, target: string): Promise<string>; + getMetadata(project: string): Promise<json.JsonObject>; + getOptions(project: string, target: string, configuration?: string): Promise<json.JsonObject>; + hasTarget(project: string, target: string): Promise<boolean>; + getDefaultConfigurationName(project: string, target: string): Promise<string | undefined>; +} +export declare class WorkspaceNodeModulesArchitectHost implements ArchitectHost<NodeModulesBuilderInfo> { + protected _root: string; + private workspaceHost; + constructor(workspaceHost: WorkspaceHost, _root: string); + constructor(workspace: workspaces.WorkspaceDefinition, _root: string); + getBuilderNameForTarget(target: Target): Promise<string>; + /** + * Resolve a builder. This needs to be a string which will be used in a dynamic `import()` + * clause. This should throw if no builder can be found. The dynamic import will throw if + * it is unsupported. + * @param builderStr The name of the builder to be used. + * @returns All the info needed for the builder itself. + */ + resolveBuilder(builderStr: string): Promise<NodeModulesBuilderInfo>; + getCurrentDirectory(): Promise<string>; + getWorkspaceRoot(): Promise<string>; + getOptionsForTarget(target: Target): Promise<json.JsonObject | null>; + getProjectMetadata(target: Target | string): Promise<json.JsonObject | null>; + loadBuilder(info: NodeModulesBuilderInfo): Promise<Builder>; +} diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/architect/node/node-modules-architect-host.js b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/architect/node/node-modules-architect-host.js new file mode 100644 index 00000000..30fadb54 --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/architect/node/node-modules-architect-host.js @@ -0,0 +1,223 @@ +"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 + */ +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.WorkspaceNodeModulesArchitectHost = void 0; +const path = __importStar(require("path")); +const url_1 = require("url"); +const v8_1 = require("v8"); +const internal_1 = require("../src/internal"); +function clone(obj) { + try { + return (0, v8_1.deserialize)((0, v8_1.serialize)(obj)); + } + catch { + return JSON.parse(JSON.stringify(obj)); + } +} +function findProjectTarget(workspace, project, target) { + const projectDefinition = workspace.projects.get(project); + if (!projectDefinition) { + throw new Error(`Project "${project}" does not exist.`); + } + const targetDefinition = projectDefinition.targets.get(target); + if (!targetDefinition) { + throw new Error('Project target does not exist.'); + } + return targetDefinition; +} +class WorkspaceNodeModulesArchitectHost { + constructor(workspaceOrHost, _root) { + this._root = _root; + if ('getBuilderName' in workspaceOrHost) { + this.workspaceHost = workspaceOrHost; + } + else { + this.workspaceHost = { + async getBuilderName(project, target) { + const targetDefinition = findProjectTarget(workspaceOrHost, project, target); + return targetDefinition.builder; + }, + async getOptions(project, target, configuration) { + var _a, _b, _c, _d; + const targetDefinition = findProjectTarget(workspaceOrHost, project, target); + if (configuration === undefined) { + return ((_a = targetDefinition.options) !== null && _a !== void 0 ? _a : {}); + } + if (!((_b = targetDefinition.configurations) === null || _b === void 0 ? void 0 : _b[configuration])) { + throw new Error(`Configuration '${configuration}' is not set in the workspace.`); + } + return ((_d = (_c = targetDefinition.configurations) === null || _c === void 0 ? void 0 : _c[configuration]) !== null && _d !== void 0 ? _d : {}); + }, + async getMetadata(project) { + const projectDefinition = workspaceOrHost.projects.get(project); + if (!projectDefinition) { + throw new Error(`Project "${project}" does not exist.`); + } + return { + root: projectDefinition.root, + sourceRoot: projectDefinition.sourceRoot, + prefix: projectDefinition.prefix, + ...clone(workspaceOrHost.extensions), + ...clone(projectDefinition.extensions), + }; + }, + async hasTarget(project, target) { + var _a; + return !!((_a = workspaceOrHost.projects.get(project)) === null || _a === void 0 ? void 0 : _a.targets.has(target)); + }, + async getDefaultConfigurationName(project, target) { + var _a, _b; + return (_b = (_a = workspaceOrHost.projects.get(project)) === null || _a === void 0 ? void 0 : _a.targets.get(target)) === null || _b === void 0 ? void 0 : _b.defaultConfiguration; + }, + }; + } + } + async getBuilderNameForTarget(target) { + return this.workspaceHost.getBuilderName(target.project, target.target); + } + /** + * Resolve a builder. This needs to be a string which will be used in a dynamic `import()` + * clause. This should throw if no builder can be found. The dynamic import will throw if + * it is unsupported. + * @param builderStr The name of the builder to be used. + * @returns All the info needed for the builder itself. + */ + resolveBuilder(builderStr) { + const [packageName, builderName] = builderStr.split(':', 2); + if (!builderName) { + throw new Error('No builder name specified.'); + } + const packageJsonPath = require.resolve(packageName + '/package.json', { + paths: [this._root], + }); + const packageJson = require(packageJsonPath); + if (!packageJson['builders']) { + throw new Error(`Package ${JSON.stringify(packageName)} has no builders defined.`); + } + const builderJsonPath = path.resolve(path.dirname(packageJsonPath), packageJson['builders']); + const builderJson = require(builderJsonPath); + const builder = builderJson.builders && builderJson.builders[builderName]; + if (!builder) { + throw new Error(`Cannot find builder ${JSON.stringify(builderStr)}.`); + } + const importPath = builder.implementation; + if (!importPath) { + throw new Error('Could not find the implementation for builder ' + builderStr); + } + return Promise.resolve({ + name: builderStr, + builderName, + description: builder['description'], + optionSchema: require(path.resolve(path.dirname(builderJsonPath), builder.schema)), + import: path.resolve(path.dirname(builderJsonPath), importPath), + }); + } + async getCurrentDirectory() { + return process.cwd(); + } + async getWorkspaceRoot() { + return this._root; + } + async getOptionsForTarget(target) { + if (!(await this.workspaceHost.hasTarget(target.project, target.target))) { + return null; + } + let options = await this.workspaceHost.getOptions(target.project, target.target); + const targetConfiguration = target.configuration || + (await this.workspaceHost.getDefaultConfigurationName(target.project, target.target)); + if (targetConfiguration) { + const configurations = targetConfiguration.split(',').map((c) => c.trim()); + for (const configuration of configurations) { + options = { + ...options, + ...(await this.workspaceHost.getOptions(target.project, target.target, configuration)), + }; + } + } + return clone(options); + } + async getProjectMetadata(target) { + const projectName = typeof target === 'string' ? target : target.project; + const metadata = this.workspaceHost.getMetadata(projectName); + return metadata; + } + async loadBuilder(info) { + const builder = await getBuilder(info.import); + if (builder[internal_1.BuilderSymbol]) { + return builder; + } + // Default handling code is for old builders that incorrectly export `default` with non-ESM module + if (builder === null || builder === void 0 ? void 0 : builder.default[internal_1.BuilderSymbol]) { + return builder.default; + } + throw new Error('Builder is not a builder'); + } +} +exports.WorkspaceNodeModulesArchitectHost = WorkspaceNodeModulesArchitectHost; +/** + * This uses a dynamic import to load a module which may be ESM. + * CommonJS code can load ESM code via a dynamic import. Unfortunately, TypeScript + * will currently, unconditionally downlevel dynamic import into a require call. + * require calls cannot load ESM code and will result in a runtime error. To workaround + * this, a Function constructor is used to prevent TypeScript from changing the dynamic import. + * Once TypeScript provides support for keeping the dynamic import this workaround can + * be dropped. + * + * @param modulePath The path of the module to load. + * @returns A Promise that resolves to the dynamically imported module. + */ +function loadEsmModule(modulePath) { + return new Function('modulePath', `return import(modulePath);`)(modulePath); +} +// eslint-disable-next-line @typescript-eslint/no-explicit-any +async function getBuilder(builderPath) { + switch (path.extname(builderPath)) { + case '.mjs': + // Load the ESM configuration file using the TypeScript dynamic import workaround. + // Once TypeScript provides support for keeping the dynamic import this workaround can be + // changed to a direct dynamic import. + return (await loadEsmModule((0, url_1.pathToFileURL)(builderPath))).default; + case '.cjs': + return require(builderPath); + default: + // The file could be either CommonJS or ESM. + // CommonJS is tried first then ESM if loading fails. + try { + return require(builderPath); + } + catch (e) { + if (e.code === 'ERR_REQUIRE_ESM') { + // Load the ESM configuration file using the TypeScript dynamic import workaround. + // Once TypeScript provides support for keeping the dynamic import this workaround can be + // changed to a direct dynamic import. + return (await loadEsmModule((0, url_1.pathToFileURL)(builderPath))).default; + } + throw e; + } + } +} diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/architect/package.json b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/architect/package.json new file mode 100644 index 00000000..f3099ad7 --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/architect/package.json @@ -0,0 +1,35 @@ +{ + "name": "@angular-devkit/architect", + "version": "0.1302.5", + "description": "Angular Build Facade", + "experimental": true, + "main": "src/index.js", + "typings": "src/index.d.ts", + "dependencies": { + "@angular-devkit/core": "13.2.5", + "rxjs": "6.6.7" + }, + "builders": "./builders/builders.json", + "keywords": [ + "angular", + "Angular CLI", + "devkit", + "sdk", + "Angular DevKit" + ], + "repository": { + "type": "git", + "url": "https://github.com/angular/angular-cli.git" + }, + "engines": { + "node": "^12.20.0 || ^14.15.0 || >=16.10.0", + "npm": "^6.11.0 || ^7.5.6 || >=8.0.0", + "yarn": ">= 1.13.0" + }, + "author": "Angular Authors", + "license": "MIT", + "bugs": { + "url": "https://github.com/angular/angular-cli/issues" + }, + "homepage": "https://github.com/angular/angular-cli" +} diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/architect/src/api.d.ts b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/architect/src/api.d.ts new file mode 100644 index 00000000..dd238a9d --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/architect/src/api.d.ts @@ -0,0 +1,267 @@ +/** + * @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 + */ +import { analytics, experimental, json, logging } from '@angular-devkit/core'; +import { Observable, SubscribableOrPromise } from 'rxjs'; +import { Schema as RealBuilderInput, Target as RealTarget } from './input-schema'; +import { Schema as RealBuilderOutput } from './output-schema'; +import { State as BuilderProgressState, Schema as RealBuilderProgress } from './progress-schema'; +export declare type Target = json.JsonObject & RealTarget; +export { BuilderProgressState }; +export declare type BuilderRegistry = experimental.jobs.Registry<json.JsonObject, BuilderInput, BuilderOutput>; +/** + * 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. + */ +export declare 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; +}; +/** + * 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. + */ +export declare type BuilderInput = json.JsonObject & RealBuilderInput; +export declare type BuilderOutput = json.JsonObject & RealBuilderOutput; +export declare type BuilderProgress = json.JsonObject & RealBuilderProgress & TypedBuilderProgress; +/** + * 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. + */ +export declare type BuilderProgressReport = BuilderProgress & { + target?: Target; + builder: BuilderInfo; +}; +/** + * 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). + */ +export interface BuilderRun { + /** + * 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. + */ + id: number; + /** + * The builder information. + */ + info: BuilderInfo; + /** + * 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. + */ + result: Promise<BuilderOutput>; + /** + * The output(s) from the builder. A builder can have multiple outputs. + * This always replay the last output when subscribed. + */ + output: Observable<BuilderOutput>; + /** + * 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. + */ + progress: Observable<BuilderProgressReport>; + /** + * 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. + */ + stop(): Promise<void>; +} +/** + * Additional optional scheduling options. + */ +export interface ScheduleOptions { + /** + * Logger to pass to the builder. Note that messages will stop being forwarded, and if you want + * to log a builder scheduled from your builder you should forward log events yourself. + */ + logger?: logging.Logger; + /** + * Target to pass to the builder. + */ + target?: Target; +} +/** + * The context received as a second argument in your builder. + */ +export interface BuilderContext { + /** + * 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. + */ + id: number; + /** + * 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. + */ + builder: BuilderInfo; + /** + * A logger that appends messages to a log. This could be a separate interface or completely + * ignored. `console.log` could also be completely ignored. + */ + logger: logging.LoggerApi; + /** + * 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). + */ + workspaceRoot: 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). + */ + currentDirectory: string; + /** + * The target that was used to run this builder. + * Target is optional if a builder was ran using `scheduleBuilder()`. + */ + target?: Target; + /** + * 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. + * @param target The target to schedule. + * @param overrides A set of options to override the workspace set of options. + * @param scheduleOptions Additional optional scheduling options. + * @return A promise of a run. It will resolve when all the members of the run are available. + */ + scheduleTarget(target: Target, overrides?: json.JsonObject, scheduleOptions?: ScheduleOptions): Promise<BuilderRun>; + /** + * Schedule a builder by its name. This can be the same builder that is being executed. + * @param builderName The name of the builder, ie. its `packageName:builderName` tuple. + * @param options All options to use for the builder (by default empty object). There is no + * additional options added, e.g. from the workspace. + * @param scheduleOptions Additional optional scheduling options. + * @return A promise of a run. It will resolve when all the members of the run are available. + */ + scheduleBuilder(builderName: string, options?: json.JsonObject, scheduleOptions?: ScheduleOptions): Promise<BuilderRun>; + /** + * 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. + * @param target The target to resolve the options of. + * @return A non-validated object resolved from the workspace. + */ + getTargetOptions(target: Target): Promise<json.JsonObject>; + getProjectMetadata(projectName: string): Promise<json.JsonObject>; + getProjectMetadata(target: Target): Promise<json.JsonObject>; + /** + * 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. + * @param target The target to resolve the builder name. + */ + getBuilderNameForTarget(target: Target): Promise<string>; + /** + * 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. + * @param options A generic option object to validate. + * @param builderName The name of a builder to use. This can be gotten for a target by using the + * getBuilderForTarget() method on the context. + */ + validateOptions<T extends json.JsonObject = json.JsonObject>(options: json.JsonObject, builderName: string): Promise<T>; + /** + * Set the builder to running. This should be used if an external event triggered a re-run, + * e.g. a file watched was changed. + */ + reportRunning(): void; + /** + * Update the status string shown on the interface. + * @param status The status to set it to. An empty string can be used to remove the status. + */ + reportStatus(status: string): void; + /** + * Update the progress for this builder run. + * @param current The current progress. This will be between 0 and total. + * @param 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. + * @param status Update the status string. If omitted the status string is not modified. + */ + reportProgress(current: number, total?: number, status?: string): void; + /** + * API to report analytics. This might be undefined if the feature is unsupported. This might + * not be undefined, but the backend could also not report anything. + */ + readonly analytics: analytics.Analytics; + /** + * Add teardown logic to this Context, so that when it's being stopped it will execute teardown. + */ + addTeardown(teardown: () => Promise<void> | void): void; +} +/** + * An accepted return value from a builder. Can be either an Observable, a Promise or a vector. + */ +export declare type BuilderOutputLike = AsyncIterable<BuilderOutput> | SubscribableOrPromise<BuilderOutput> | BuilderOutput; +export declare function isBuilderOutput(obj: any): obj is BuilderOutput; +export declare function fromAsyncIterable<T>(iterable: AsyncIterable<T>): Observable<T>; +/** + * A builder handler function. The function signature passed to `createBuilder()`. + */ +export interface BuilderHandlerFn<A> { + /** + * Builders are defined by users to perform any kind of task, like building, testing or linting, + * and should use this interface. + * @param 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. + * @param context A context that can be used to interact with the Architect framework. + * @return One or many builder output. + */ + (input: A, context: BuilderContext): BuilderOutputLike; +} +/** + * A Builder general information. This is generated by the host and is expanded by the host, but + * the public API contains those fields. + */ +export declare type BuilderInfo = json.JsonObject & { + builderName: string; + description: string; + optionSchema: json.schema.JsonSchema; +}; +/** + * Returns a string of "project:target[:configuration]" for the target object. + */ +export declare function targetStringFromTarget({ project, target, configuration }: Target): string; +/** + * Return a Target tuple from a string. + */ +export declare function targetFromTargetString(str: string): Target; +/** + * 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. + * + * @param context The context of your current execution. + * @param target The target to schedule. + * @param overrides Overrides that are used in the target. + * @param scheduleOptions Additional scheduling options. + */ +export declare function scheduleTargetAndForget(context: BuilderContext, target: Target, overrides?: json.JsonObject, scheduleOptions?: ScheduleOptions): Observable<BuilderOutput>; diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/architect/src/api.js b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/architect/src/api.js new file mode 100644 index 00000000..b780d744 --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/architect/src/api.js @@ -0,0 +1,98 @@ +"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.scheduleTargetAndForget = exports.targetFromTargetString = exports.targetStringFromTarget = exports.fromAsyncIterable = exports.isBuilderOutput = exports.BuilderProgressState = void 0; +const rxjs_1 = require("rxjs"); +const operators_1 = require("rxjs/operators"); +const progress_schema_1 = require("./progress-schema"); +Object.defineProperty(exports, "BuilderProgressState", { enumerable: true, get: function () { return progress_schema_1.State; } }); +// eslint-disable-next-line @typescript-eslint/no-explicit-any +function isBuilderOutput(obj) { + if (!obj || typeof obj.then === 'function' || typeof obj.subscribe === 'function') { + return false; + } + if (typeof obj[Symbol.asyncIterator] === 'function') { + return false; + } + return typeof obj.success === 'boolean'; +} +exports.isBuilderOutput = isBuilderOutput; +function fromAsyncIterable(iterable) { + return new rxjs_1.Observable((subscriber) => { + handleAsyncIterator(subscriber, iterable[Symbol.asyncIterator]()).then(() => subscriber.complete(), (error) => subscriber.error(error)); + }); +} +exports.fromAsyncIterable = fromAsyncIterable; +async function handleAsyncIterator(subscriber, iterator) { + var _a; + const teardown = new Promise((resolve) => subscriber.add(() => resolve())); + try { + while (!subscriber.closed) { + const result = await Promise.race([teardown, iterator.next()]); + if (!result || result.done) { + break; + } + subscriber.next(result.value); + } + } + finally { + await ((_a = iterator.return) === null || _a === void 0 ? void 0 : _a.call(iterator)); + } +} +/** + * Returns a string of "project:target[:configuration]" for the target object. + */ +function targetStringFromTarget({ project, target, configuration }) { + return `${project}:${target}${configuration !== undefined ? ':' + configuration : ''}`; +} +exports.targetStringFromTarget = targetStringFromTarget; +/** + * Return a Target tuple from a string. + */ +function targetFromTargetString(str) { + const tuple = str.split(/:/, 3); + if (tuple.length < 2) { + throw new Error('Invalid target string: ' + JSON.stringify(str)); + } + return { + project: tuple[0], + target: tuple[1], + ...(tuple[2] !== undefined && { configuration: tuple[2] }), + }; +} +exports.targetFromTargetString = targetFromTargetString; +/** + * 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. + * + * @param context The context of your current execution. + * @param target The target to schedule. + * @param overrides Overrides that are used in the target. + * @param scheduleOptions Additional scheduling options. + */ +function scheduleTargetAndForget(context, target, overrides, scheduleOptions) { + let resolve = null; + const promise = new Promise((r) => (resolve = r)); + context.addTeardown(() => promise); + return (0, rxjs_1.from)(context.scheduleTarget(target, overrides, scheduleOptions)).pipe((0, operators_1.switchMap)((run) => new rxjs_1.Observable((observer) => { + const subscription = run.output.subscribe(observer); + return () => { + subscription.unsubscribe(); + // We can properly ignore the floating promise as it's a "reverse" promise; the teardown + // is waiting for the resolve. + // eslint-disable-next-line @typescript-eslint/no-floating-promises + run.stop().then(resolve); + }; + }))); +} +exports.scheduleTargetAndForget = scheduleTargetAndForget; diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/architect/src/architect.d.ts b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/architect/src/architect.d.ts new file mode 100644 index 00000000..eeec89df --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/architect/src/architect.d.ts @@ -0,0 +1,25 @@ +/** + * @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 + */ +import { analytics, experimental, json, logging } from '@angular-devkit/core'; +import { Observable } from 'rxjs'; +import { BuilderRun, Target } from './api'; +import { ArchitectHost } from './internal'; +export interface ScheduleOptions { + logger?: logging.Logger; + analytics?: analytics.Analytics; +} +export declare class Architect { + private _host; + private readonly _scheduler; + private readonly _jobCache; + private readonly _infoCache; + constructor(_host: ArchitectHost, registry?: json.schema.SchemaRegistry, additionalJobRegistry?: experimental.jobs.Registry); + has(name: experimental.jobs.JobName): Observable<boolean>; + scheduleBuilder(name: string, options: json.JsonObject, scheduleOptions?: ScheduleOptions): Promise<BuilderRun>; + scheduleTarget(target: Target, overrides?: json.JsonObject, scheduleOptions?: ScheduleOptions): Promise<BuilderRun>; +} diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/architect/src/architect.js b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/architect/src/architect.js new file mode 100644 index 00000000..93bb5db9 --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/architect/src/architect.js @@ -0,0 +1,283 @@ +"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.Architect = 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 schedule_by_name_1 = require("./schedule-by-name"); +const inputSchema = require('./input-schema.json'); +const outputSchema = require('./output-schema.json'); +function _createJobHandlerFromBuilderInfo(info, target, host, registry, baseOptions) { + const jobDescription = { + name: target ? `{${(0, api_1.targetStringFromTarget)(target)}}` : info.builderName, + argument: { type: 'object' }, + input: inputSchema, + output: outputSchema, + info, + }; + function handler(argument, context) { + // Add input validation to the inbound bus. + const inboundBusWithInputValidation = context.inboundBus.pipe((0, operators_1.concatMap)((message) => { + if (message.kind === core_1.experimental.jobs.JobInboundMessageKind.Input) { + const v = message.value; + const options = { + ...baseOptions, + ...v.options, + }; + // Validate v against the options schema. + return registry.compile(info.optionSchema).pipe((0, operators_1.concatMap)((validation) => validation(options)), (0, operators_1.map)((validationResult) => { + const { data, success, errors } = validationResult; + if (success) { + return { ...v, options: data }; + } + throw new core_1.json.schema.SchemaValidationException(errors); + }), (0, operators_1.map)((value) => ({ ...message, value }))); + } + else { + return (0, rxjs_1.of)(message); + } + }), + // Using a share replay because the job might be synchronously sending input, but + // asynchronously listening to it. + (0, operators_1.shareReplay)(1)); + // Make an inboundBus that completes instead of erroring out. + // We'll merge the errors into the output instead. + const inboundBus = (0, rxjs_1.onErrorResumeNext)(inboundBusWithInputValidation); + const output = (0, rxjs_1.from)(host.loadBuilder(info)).pipe((0, operators_1.concatMap)((builder) => { + if (builder === null) { + throw new Error(`Cannot load builder for builderInfo ${JSON.stringify(info, null, 2)}`); + } + return builder.handler(argument, { ...context, inboundBus }).pipe((0, operators_1.map)((output) => { + if (output.kind === core_1.experimental.jobs.JobOutboundMessageKind.Output) { + // Add target to it. + return { + ...output, + value: { + ...output.value, + ...(target ? { target } : 0), + }, + }; + } + else { + return output; + } + })); + }), + // Share subscriptions to the output, otherwise the the handler will be re-run. + (0, operators_1.shareReplay)()); + // Separate the errors from the inbound bus into their own observable that completes when the + // builder output does. + const inboundBusErrors = inboundBusWithInputValidation.pipe((0, operators_1.ignoreElements)(), (0, operators_1.takeUntil)((0, rxjs_1.onErrorResumeNext)(output.pipe((0, operators_1.last)())))); + // Return the builder output plus any input errors. + return (0, rxjs_1.merge)(inboundBusErrors, output); + } + return (0, rxjs_1.of)(Object.assign(handler, { jobDescription })); +} +/** + * A JobRegistry that resolves builder targets from the host. + */ +class ArchitectBuilderJobRegistry { + constructor(_host, _registry, _jobCache, _infoCache) { + this._host = _host; + this._registry = _registry; + this._jobCache = _jobCache; + this._infoCache = _infoCache; + } + _resolveBuilder(name) { + const cache = this._infoCache; + if (cache) { + const maybeCache = cache.get(name); + if (maybeCache !== undefined) { + return maybeCache; + } + const info = (0, rxjs_1.from)(this._host.resolveBuilder(name)).pipe((0, operators_1.shareReplay)(1)); + cache.set(name, info); + return info; + } + return (0, rxjs_1.from)(this._host.resolveBuilder(name)); + } + _createBuilder(info, target, options) { + const cache = this._jobCache; + if (target) { + const maybeHit = cache && cache.get((0, api_1.targetStringFromTarget)(target)); + if (maybeHit) { + return maybeHit; + } + } + else { + const maybeHit = cache && cache.get(info.builderName); + if (maybeHit) { + return maybeHit; + } + } + const result = _createJobHandlerFromBuilderInfo(info, target, this._host, this._registry, options || {}); + if (cache) { + if (target) { + cache.set((0, api_1.targetStringFromTarget)(target), result.pipe((0, operators_1.shareReplay)(1))); + } + else { + cache.set(info.builderName, result.pipe((0, operators_1.shareReplay)(1))); + } + } + return result; + } + get(name) { + const m = name.match(/^([^:]+):([^:]+)$/i); + if (!m) { + return (0, rxjs_1.of)(null); + } + return (0, rxjs_1.from)(this._resolveBuilder(name)).pipe((0, operators_1.concatMap)((builderInfo) => (builderInfo ? this._createBuilder(builderInfo) : (0, rxjs_1.of)(null))), (0, operators_1.first)(null, null)); + } +} +/** + * A JobRegistry that resolves targets from the host. + */ +class ArchitectTargetJobRegistry extends ArchitectBuilderJobRegistry { + get(name) { + const m = name.match(/^{([^:]+):([^:]+)(?::([^:]*))?}$/i); + if (!m) { + return (0, rxjs_1.of)(null); + } + const target = { + project: m[1], + target: m[2], + configuration: m[3], + }; + return (0, rxjs_1.from)(Promise.all([ + this._host.getBuilderNameForTarget(target), + this._host.getOptionsForTarget(target), + ])).pipe((0, operators_1.concatMap)(([builderStr, options]) => { + if (builderStr === null || options === null) { + return (0, rxjs_1.of)(null); + } + return this._resolveBuilder(builderStr).pipe((0, operators_1.concatMap)((builderInfo) => { + if (builderInfo === null) { + return (0, rxjs_1.of)(null); + } + return this._createBuilder(builderInfo, target, options); + })); + }), (0, operators_1.first)(null, null)); + } +} +function _getTargetOptionsFactory(host) { + return core_1.experimental.jobs.createJobHandler((target) => { + return host.getOptionsForTarget(target).then((options) => { + if (options === null) { + throw new Error(`Invalid target: ${JSON.stringify(target)}.`); + } + return options; + }); + }, { + name: '..getTargetOptions', + output: { type: 'object' }, + argument: inputSchema.properties.target, + }); +} +function _getProjectMetadataFactory(host) { + return core_1.experimental.jobs.createJobHandler((target) => { + return host.getProjectMetadata(target).then((options) => { + if (options === null) { + throw new Error(`Invalid target: ${JSON.stringify(target)}.`); + } + return options; + }); + }, { + name: '..getProjectMetadata', + output: { type: 'object' }, + argument: { + oneOf: [{ type: 'string' }, inputSchema.properties.target], + }, + }); +} +function _getBuilderNameForTargetFactory(host) { + return core_1.experimental.jobs.createJobHandler(async (target) => { + const builderName = await host.getBuilderNameForTarget(target); + if (!builderName) { + throw new Error(`No builder were found for target ${(0, api_1.targetStringFromTarget)(target)}.`); + } + return builderName; + }, { + name: '..getBuilderNameForTarget', + output: { type: 'string' }, + argument: inputSchema.properties.target, + }); +} +function _validateOptionsFactory(host, registry) { + return core_1.experimental.jobs.createJobHandler(async ([builderName, options]) => { + // Get option schema from the host. + const builderInfo = await host.resolveBuilder(builderName); + if (!builderInfo) { + throw new Error(`No builder info were found for builder ${JSON.stringify(builderName)}.`); + } + return registry + .compile(builderInfo.optionSchema) + .pipe((0, operators_1.concatMap)((validation) => validation(options)), (0, operators_1.switchMap)(({ data, success, errors }) => { + if (success) { + return (0, rxjs_1.of)(data); + } + throw new core_1.json.schema.SchemaValidationException(errors); + })) + .toPromise(); + }, { + name: '..validateOptions', + output: { type: 'object' }, + argument: { + type: 'array', + items: [{ type: 'string' }, { type: 'object' }], + }, + }); +} +class Architect { + constructor(_host, registry = new core_1.json.schema.CoreSchemaRegistry(), additionalJobRegistry) { + this._host = _host; + this._jobCache = new Map(); + this._infoCache = new Map(); + const privateArchitectJobRegistry = new core_1.experimental.jobs.SimpleJobRegistry(); + // Create private jobs. + privateArchitectJobRegistry.register(_getTargetOptionsFactory(_host)); + privateArchitectJobRegistry.register(_getBuilderNameForTargetFactory(_host)); + privateArchitectJobRegistry.register(_validateOptionsFactory(_host, registry)); + privateArchitectJobRegistry.register(_getProjectMetadataFactory(_host)); + const jobRegistry = new core_1.experimental.jobs.FallbackRegistry([ + new ArchitectTargetJobRegistry(_host, registry, this._jobCache, this._infoCache), + new ArchitectBuilderJobRegistry(_host, registry, this._jobCache, this._infoCache), + privateArchitectJobRegistry, + ...(additionalJobRegistry ? [additionalJobRegistry] : []), + ]); + this._scheduler = new core_1.experimental.jobs.SimpleScheduler(jobRegistry, registry); + } + has(name) { + return this._scheduler.has(name); + } + scheduleBuilder(name, options, scheduleOptions = {}) { + // The below will match 'project:target:configuration' + if (!/^[^:]+:[^:]+(:[^:]+)?$/.test(name)) { + throw new Error('Invalid builder name: ' + JSON.stringify(name)); + } + return (0, schedule_by_name_1.scheduleByName)(name, options, { + scheduler: this._scheduler, + logger: scheduleOptions.logger || new core_1.logging.NullLogger(), + currentDirectory: this._host.getCurrentDirectory(), + workspaceRoot: this._host.getWorkspaceRoot(), + analytics: scheduleOptions.analytics, + }); + } + scheduleTarget(target, overrides = {}, scheduleOptions = {}) { + return (0, schedule_by_name_1.scheduleByTarget)(target, overrides, { + scheduler: this._scheduler, + logger: scheduleOptions.logger || new core_1.logging.NullLogger(), + currentDirectory: this._host.getCurrentDirectory(), + workspaceRoot: this._host.getWorkspaceRoot(), + analytics: scheduleOptions.analytics, + }); + } +} +exports.Architect = Architect; diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/architect/src/builders-schema.d.ts b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/architect/src/builders-schema.d.ts new file mode 100644 index 00000000..b9c5b7e4 --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/architect/src/builders-schema.d.ts @@ -0,0 +1,30 @@ +export interface Schema { + /** + * Link to schema. + */ + $schema?: string; + builders: { + [key: string]: Builder; + }; +} +/** + * Target options for Builders. + */ +export interface Builder { + /** + * The builder class module. + */ + class?: string; + /** + * Builder description. + */ + description: string; + /** + * The next generation builder module. + */ + implementation?: string; + /** + * Schema for builder option validation. + */ + schema: string; +} diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/architect/src/builders-schema.js b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/architect/src/builders-schema.js new file mode 100644 index 00000000..4fb6d3d1 --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/architect/src/builders-schema.js @@ -0,0 +1,4 @@ +"use strict"; +// THIS FILE IS AUTOMATICALLY GENERATED. TO UPDATE THIS FILE YOU NEED TO CHANGE THE +// CORRESPONDING JSON SCHEMA FILE, THEN RUN devkit-admin build (or bazel build ...). +Object.defineProperty(exports, "__esModule", { value: true }); diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/architect/src/builders-schema.json b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/architect/src/builders-schema.json new file mode 100644 index 00000000..c71ef86e --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/architect/src/builders-schema.json @@ -0,0 +1,62 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema", + "$id": "BuildersSchema", + "title": "Builders schema for validating a list of builders.", + "type": "object", + "properties": { + "$schema": { + "type": "string", + "description": "Link to schema." + }, + "builders": { + "type": "object", + "additionalProperties": { + "$ref": "#/definitions/builder" + } + } + }, + "required": ["builders"], + "definitions": { + "builder": { + "type": "object", + "description": "Target options for Builders.", + "allOf": [ + { + "properties": { + "schema": { + "type": "string", + "description": "Schema for builder option validation." + }, + "description": { + "type": "string", + "description": "Builder description." + } + }, + "required": ["schema", "description"] + }, + { + "anyOf": [ + { + "properties": { + "implementation": { + "type": "string", + "description": "The next generation builder module." + } + }, + "required": ["implementation"] + }, + { + "properties": { + "class": { + "type": "string", + "description": "The builder class module." + } + }, + "required": ["class"] + } + ] + } + ] + } + } +} diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/architect/src/create-builder.d.ts b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/architect/src/create-builder.d.ts new file mode 100644 index 00000000..99cf3494 --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/architect/src/create-builder.d.ts @@ -0,0 +1,11 @@ +/** + * @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 + */ +import { json } from '@angular-devkit/core'; +import { BuilderHandlerFn, BuilderOutput } from './api'; +import { Builder } from './internal'; +export declare function createBuilder<OptT = json.JsonObject, OutT extends BuilderOutput = BuilderOutput>(fn: BuilderHandlerFn<OptT>): Builder<OptT & json.JsonObject>; diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/architect/src/create-builder.js b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/architect/src/create-builder.js new file mode 100644 index 00000000..bcff4656 --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/architect/src/create-builder.js @@ -0,0 +1,200 @@ +"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.createBuilder = 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 internal_1 = require("./internal"); +const schedule_by_name_1 = require("./schedule-by-name"); +// eslint-disable-next-line max-lines-per-function +function createBuilder(fn) { + const cjh = core_1.experimental.jobs.createJobHandler; + // eslint-disable-next-line max-lines-per-function + const handler = cjh((options, context) => { + const scheduler = context.scheduler; + const progressChannel = context.createChannel('progress'); + const logChannel = context.createChannel('log'); + const analyticsChannel = context.createChannel('analytics'); + let currentState = api_1.BuilderProgressState.Stopped; + const teardownLogics = []; + let tearingDown = false; + let current = 0; + let status = ''; + let total = 1; + function log(entry) { + logChannel.next(entry); + } + function progress(progress, context) { + currentState = progress.state; + if (progress.state === api_1.BuilderProgressState.Running) { + current = progress.current; + total = progress.total !== undefined ? progress.total : total; + if (progress.status === undefined) { + progress.status = status; + } + else { + status = progress.status; + } + } + progressChannel.next({ + ...progress, + ...(context.target && { target: context.target }), + ...(context.builder && { builder: context.builder }), + id: context.id, + }); + } + return new rxjs_1.Observable((observer) => { + const subscriptions = []; + const inputSubscription = context.inboundBus.subscribe((i) => { + switch (i.kind) { + case core_1.experimental.jobs.JobInboundMessageKind.Stop: + // Run teardown logic then complete. + tearingDown = true; + Promise.all(teardownLogics.map((fn) => fn() || Promise.resolve())).then(() => observer.complete(), (err) => observer.error(err)); + break; + case core_1.experimental.jobs.JobInboundMessageKind.Input: + if (!tearingDown) { + onInput(i.value); + } + break; + } + }); + function onInput(i) { + const builder = i.info; + const loggerName = i.target + ? (0, api_1.targetStringFromTarget)(i.target) + : builder.builderName; + const logger = new core_1.logging.Logger(loggerName); + subscriptions.push(logger.subscribe((entry) => log(entry))); + const context = { + builder, + workspaceRoot: i.workspaceRoot, + currentDirectory: i.currentDirectory, + target: i.target, + logger: logger, + id: i.id, + async scheduleTarget(target, overrides = {}, scheduleOptions = {}) { + const run = await (0, schedule_by_name_1.scheduleByTarget)(target, overrides, { + scheduler, + logger: scheduleOptions.logger || logger.createChild(''), + workspaceRoot: i.workspaceRoot, + currentDirectory: i.currentDirectory, + }); + // We don't want to subscribe errors and complete. + subscriptions.push(run.progress.subscribe((event) => progressChannel.next(event))); + return run; + }, + async scheduleBuilder(builderName, options = {}, scheduleOptions = {}) { + const run = await (0, schedule_by_name_1.scheduleByName)(builderName, options, { + scheduler, + target: scheduleOptions.target, + logger: scheduleOptions.logger || logger.createChild(''), + workspaceRoot: i.workspaceRoot, + currentDirectory: i.currentDirectory, + }); + // We don't want to subscribe errors and complete. + subscriptions.push(run.progress.subscribe((event) => progressChannel.next(event))); + return run; + }, + async getTargetOptions(target) { + return scheduler + .schedule('..getTargetOptions', target) + .output.toPromise(); + }, + async getProjectMetadata(target) { + return scheduler + .schedule('..getProjectMetadata', target) + .output.toPromise(); + }, + async getBuilderNameForTarget(target) { + return scheduler + .schedule('..getBuilderNameForTarget', target) + .output.toPromise(); + }, + async validateOptions(options, builderName) { + return scheduler + .schedule('..validateOptions', [ + builderName, + options, + ]) + .output.toPromise(); + }, + reportRunning() { + switch (currentState) { + case api_1.BuilderProgressState.Waiting: + case api_1.BuilderProgressState.Stopped: + progress({ state: api_1.BuilderProgressState.Running, current: 0, total }, context); + break; + } + }, + reportStatus(status) { + switch (currentState) { + case api_1.BuilderProgressState.Running: + progress({ state: currentState, status, current, total }, context); + break; + case api_1.BuilderProgressState.Waiting: + progress({ state: currentState, status }, context); + break; + } + }, + reportProgress(current, total, status) { + switch (currentState) { + case api_1.BuilderProgressState.Running: + progress({ state: currentState, current, total, status }, context); + } + }, + analytics: new core_1.analytics.ForwardingAnalytics((report) => analyticsChannel.next(report)), + addTeardown(teardown) { + teardownLogics.push(teardown); + }, + }; + context.reportRunning(); + let result; + try { + result = fn(i.options, context); + if ((0, api_1.isBuilderOutput)(result)) { + result = (0, rxjs_1.of)(result); + } + else if (!(0, rxjs_1.isObservable)(result) && isAsyncIterable(result)) { + result = (0, api_1.fromAsyncIterable)(result); + } + else { + result = (0, rxjs_1.from)(result); + } + } + catch (e) { + result = (0, rxjs_1.throwError)(e); + } + // Manage some state automatically. + progress({ state: api_1.BuilderProgressState.Running, current: 0, total: 1 }, context); + subscriptions.push(result + .pipe((0, operators_1.tap)(() => { + progress({ state: api_1.BuilderProgressState.Running, current: total }, context); + progress({ state: api_1.BuilderProgressState.Stopped }, context); + })) + .subscribe((message) => observer.next(message), (error) => observer.error(error), () => observer.complete())); + } + return () => { + subscriptions.forEach((x) => x.unsubscribe()); + inputSubscription.unsubscribe(); + }; + }); + }); + return { + handler, + [internal_1.BuilderSymbol]: true, + [internal_1.BuilderVersionSymbol]: require('../package.json').version, + }; +} +exports.createBuilder = createBuilder; +function isAsyncIterable(obj) { + return !!obj && typeof obj[Symbol.asyncIterator] === 'function'; +} diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/architect/src/index.d.ts b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/architect/src/index.d.ts new file mode 100644 index 00000000..dcfbb9d7 --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/architect/src/index.d.ts @@ -0,0 +1,10 @@ +/** + * @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 + */ +export * from './api'; +export { Architect, ScheduleOptions } from './architect'; +export { createBuilder } from './create-builder'; diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/architect/src/index.js b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/architect/src/index.js new file mode 100644 index 00000000..8dbdd392 --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/architect/src/index.js @@ -0,0 +1,25 @@ +"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 + */ +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __exportStar = (this && this.__exportStar) || function(m, exports) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.createBuilder = exports.Architect = void 0; +__exportStar(require("./api"), exports); +var architect_1 = require("./architect"); +Object.defineProperty(exports, "Architect", { enumerable: true, get: function () { return architect_1.Architect; } }); +var create_builder_1 = require("./create-builder"); +Object.defineProperty(exports, "createBuilder", { enumerable: true, get: function () { return create_builder_1.createBuilder; } }); diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/architect/src/input-schema.d.ts b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/architect/src/input-schema.d.ts new file mode 100644 index 00000000..614d5ed1 --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/architect/src/input-schema.d.ts @@ -0,0 +1,17 @@ +export interface Schema { + currentDirectory: string; + id: number; + info: { + [key: string]: any; + }; + options?: { + [key: string]: any; + }; + target?: Target; + workspaceRoot: string; +} +export interface Target { + configuration?: string; + project: string; + target: string; +} diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/architect/src/input-schema.js b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/architect/src/input-schema.js new file mode 100644 index 00000000..4fb6d3d1 --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/architect/src/input-schema.js @@ -0,0 +1,4 @@ +"use strict"; +// THIS FILE IS AUTOMATICALLY GENERATED. TO UPDATE THIS FILE YOU NEED TO CHANGE THE +// CORRESPONDING JSON SCHEMA FILE, THEN RUN devkit-admin build (or bazel build ...). +Object.defineProperty(exports, "__esModule", { value: true }); diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/architect/src/input-schema.json b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/architect/src/input-schema.json new file mode 100644 index 00000000..7559c096 --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/architect/src/input-schema.json @@ -0,0 +1,39 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema", + "$id": "BuilderInputSchema", + "title": "Input schema for builders.", + "type": "object", + "properties": { + "workspaceRoot": { + "type": "string" + }, + "currentDirectory": { + "type": "string" + }, + "id": { + "type": "number" + }, + "target": { + "type": "object", + "properties": { + "project": { + "type": "string" + }, + "target": { + "type": "string" + }, + "configuration": { + "type": "string" + } + }, + "required": ["project", "target"] + }, + "info": { + "type": "object" + }, + "options": { + "type": "object" + } + }, + "required": ["currentDirectory", "id", "info", "workspaceRoot"] +} diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/architect/src/internal.d.ts b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/architect/src/internal.d.ts new file mode 100644 index 00000000..c1364fa1 --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/architect/src/internal.d.ts @@ -0,0 +1,66 @@ +/** + * @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 + */ +import { experimental, json } from '@angular-devkit/core'; +import { BuilderInfo, BuilderInput, BuilderOutput, Target } from './api'; +/** + * BuilderSymbol used for knowing if a function was created using createBuilder(). This is a + * property set on the function that should be `true`. + * Using Symbol.for() as it's a global registry that's the same for all installations of + * Architect (if some libraries depends directly on architect instead of sharing the files). + */ +export declare const BuilderSymbol: unique symbol; +/** + * BuilderVersionSymbol used for knowing which version of the library createBuilder() came from. + * This is to make sure we don't try to use an incompatible builder. + * Using Symbol.for() as it's a global registry that's the same for all installations of + * Architect (if some libraries depends directly on architect instead of sharing the files). + */ +export declare const BuilderVersionSymbol: unique symbol; +/** + * A Specialization of the JobHandler type. This exposes BuilderDescription as the job description + * type. + */ +export declare type BuilderJobHandler<A extends json.JsonObject = json.JsonObject, I extends BuilderInput = BuilderInput, O extends BuilderOutput = BuilderOutput> = experimental.jobs.JobHandler<A, I, O> & { + jobDescription: BuilderDescription; +}; +/** + * A Builder description, which is used internally. Adds the builder info which is the + * metadata attached to a builder in Architect. + */ +export interface BuilderDescription extends experimental.jobs.JobDescription { + info: BuilderInfo; +} +/** + * A Builder instance. Use createBuilder() to create one of these. + */ +export interface Builder<OptionT extends json.JsonObject = json.JsonObject> { + handler: experimental.jobs.JobHandler<json.JsonObject, BuilderInput, BuilderOutput>; + [BuilderSymbol]: true; + [BuilderVersionSymbol]: string; +} +export interface ArchitectHost<BuilderInfoT extends BuilderInfo = BuilderInfo> { + /** + * Get the builder name for a target. + * @param target The target to inspect. + */ + getBuilderNameForTarget(target: Target): Promise<string | null>; + /** + * Resolve a builder. This needs to return a string which will be used in a dynamic `import()` + * clause. This should throw if no builder can be found. The dynamic import will throw if + * it is unsupported. + * @param builderName The name of the builder to be used. + * @returns All the info needed for the builder itself. + */ + resolveBuilder(builderName: string): Promise<BuilderInfoT | null>; + loadBuilder(info: BuilderInfoT): Promise<Builder | null>; + getCurrentDirectory(): Promise<string>; + getWorkspaceRoot(): Promise<string>; + getOptionsForTarget(target: Target): Promise<json.JsonObject | null>; + getProjectMetadata(projectName: string): Promise<json.JsonObject | null>; + getProjectMetadata(target: Target): Promise<json.JsonObject | null>; +} diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/architect/src/internal.js b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/architect/src/internal.js new file mode 100644 index 00000000..f74de953 --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/architect/src/internal.js @@ -0,0 +1,26 @@ +"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.BuilderVersionSymbol = exports.BuilderSymbol = void 0; +// Internal types that should not be exported directly. These are used by the host and architect +// itself. Host implementations should import the host.ts file. +/** + * BuilderSymbol used for knowing if a function was created using createBuilder(). This is a + * property set on the function that should be `true`. + * Using Symbol.for() as it's a global registry that's the same for all installations of + * Architect (if some libraries depends directly on architect instead of sharing the files). + */ +exports.BuilderSymbol = Symbol.for('@angular-devkit/architect:builder'); +/** + * BuilderVersionSymbol used for knowing which version of the library createBuilder() came from. + * This is to make sure we don't try to use an incompatible builder. + * Using Symbol.for() as it's a global registry that's the same for all installations of + * Architect (if some libraries depends directly on architect instead of sharing the files). + */ +exports.BuilderVersionSymbol = Symbol.for('@angular-devkit/architect:version'); diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/architect/src/output-schema.d.ts b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/architect/src/output-schema.d.ts new file mode 100644 index 00000000..f7431bf8 --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/architect/src/output-schema.d.ts @@ -0,0 +1,13 @@ +export interface Schema { + error?: string; + info?: { + [key: string]: any; + }; + success: boolean; + target?: Target; +} +export interface Target { + configuration?: string; + project?: string; + target?: string; +} diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/architect/src/output-schema.js b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/architect/src/output-schema.js new file mode 100644 index 00000000..4fb6d3d1 --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/architect/src/output-schema.js @@ -0,0 +1,4 @@ +"use strict"; +// THIS FILE IS AUTOMATICALLY GENERATED. TO UPDATE THIS FILE YOU NEED TO CHANGE THE +// CORRESPONDING JSON SCHEMA FILE, THEN RUN devkit-admin build (or bazel build ...). +Object.defineProperty(exports, "__esModule", { value: true }); diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/architect/src/output-schema.json b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/architect/src/output-schema.json new file mode 100644 index 00000000..5539068e --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/architect/src/output-schema.json @@ -0,0 +1,33 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema", + "$id": "BuilderOutputSchema", + "title": "Output schema for builders.", + "type": "object", + "properties": { + "success": { + "type": "boolean" + }, + "error": { + "type": "string" + }, + "target": { + "type": "object", + "properties": { + "project": { + "type": "string" + }, + "target": { + "type": "string" + }, + "configuration": { + "type": "string" + } + } + }, + "info": { + "type": "object" + } + }, + "additionalProperties": true, + "required": ["success"] +} diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/architect/src/progress-schema.d.ts b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/architect/src/progress-schema.d.ts new file mode 100644 index 00000000..331c42be --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/architect/src/progress-schema.d.ts @@ -0,0 +1,20 @@ +export interface Schema { + builder: { + [key: string]: any; + }; + current?: number; + error?: any; + id: number; + state: State; + status?: string; + target?: { + [key: string]: any; + }; + total?: number; +} +export declare enum State { + Error = "error", + Running = "running", + Stopped = "stopped", + Waiting = "waiting" +} diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/architect/src/progress-schema.js b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/architect/src/progress-schema.js new file mode 100644 index 00000000..e900879e --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/architect/src/progress-schema.js @@ -0,0 +1,12 @@ +"use strict"; +// THIS FILE IS AUTOMATICALLY GENERATED. TO UPDATE THIS FILE YOU NEED TO CHANGE THE +// CORRESPONDING JSON SCHEMA FILE, THEN RUN devkit-admin build (or bazel build ...). +Object.defineProperty(exports, "__esModule", { value: true }); +exports.State = void 0; +var State; +(function (State) { + State["Error"] = "error"; + State["Running"] = "running"; + State["Stopped"] = "stopped"; + State["Waiting"] = "waiting"; +})(State = exports.State || (exports.State = {})); diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/architect/src/progress-schema.json b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/architect/src/progress-schema.json new file mode 100644 index 00000000..e782f4ad --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/architect/src/progress-schema.json @@ -0,0 +1,83 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema", + "$id": "BuilderProgressSchema", + "title": "Progress schema for builders.", + "type": "object", + "allOf": [ + { + "type": "object", + "oneOf": [ + { + "type": "object", + "properties": { + "state": { + "type": "string", + "enum": ["stopped"] + } + }, + "required": ["state"] + }, + { + "type": "object", + "properties": { + "state": { + "type": "string", + "enum": ["waiting"] + }, + "status": { + "type": "string" + } + }, + "required": ["state"] + }, + { + "type": "object", + "properties": { + "state": { + "type": "string", + "enum": ["running"] + }, + "current": { + "type": "number", + "minimum": 0 + }, + "total": { + "type": "number", + "minimum": 0 + }, + "status": { + "type": "string" + } + }, + "required": ["state"] + }, + { + "type": "object", + "properties": { + "state": { + "type": "string", + "enum": ["error"] + }, + "error": true + }, + "required": ["state"] + } + ] + }, + { + "type": "object", + "properties": { + "builder": { + "type": "object" + }, + "target": { + "type": "object" + }, + "id": { + "type": "number" + } + }, + "required": ["builder", "id"] + } + ] +} diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/architect/src/schedule-by-name.d.ts b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/architect/src/schedule-by-name.d.ts new file mode 100644 index 00000000..d62ba678 --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/architect/src/schedule-by-name.d.ts @@ -0,0 +1,24 @@ +/** + * @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 + */ +import { analytics, experimental, json, logging } from '@angular-devkit/core'; +import { BuilderRun, Target } from './api'; +export declare function scheduleByName(name: string, buildOptions: json.JsonObject, options: { + target?: Target; + scheduler: experimental.jobs.Scheduler; + logger: logging.LoggerApi; + workspaceRoot: string | Promise<string>; + currentDirectory: string | Promise<string>; + analytics?: analytics.Analytics; +}): Promise<BuilderRun>; +export declare function scheduleByTarget(target: Target, overrides: json.JsonObject, options: { + scheduler: experimental.jobs.Scheduler; + logger: logging.LoggerApi; + workspaceRoot: string | Promise<string>; + currentDirectory: string | Promise<string>; + analytics?: analytics.Analytics; +}): Promise<BuilderRun>; 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; diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/architect/src/targets-schema.json b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/architect/src/targets-schema.json new file mode 100644 index 00000000..912c20ff --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/architect/src/targets-schema.json @@ -0,0 +1,39 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema", + "$id": "ArchitectTargets", + "title": "Targets schema for validating Architect targets configuration.", + "type": "object", + "description": "A map of available project targets.", + "additionalProperties": { + "$ref": "#/definitions/target" + }, + "required": [], + "definitions": { + "target": { + "type": "object", + "description": "Target options.", + "properties": { + "builder": { + "type": "string", + "description": "The builder used for this package." + }, + "options": { + "$ref": "#/definitions/options" + }, + "configurations": { + "type": "object", + "description": "A map of alternative target options.", + "additionalProperties": { + "$ref": "#/definitions/options" + } + } + }, + "additionalProperties": false, + "required": ["builder", "options"] + }, + "options": { + "type": "object", + "description": "Target options." + } + } +} diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/architect/testing/BUILD.bazel b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/architect/testing/BUILD.bazel new file mode 100644 index 00000000..1b8dfa63 --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/architect/testing/BUILD.bazel @@ -0,0 +1,27 @@ +# Copyright Google Inc. 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 + +load("//tools:defaults.bzl", "ts_library") + +licenses(["notice"]) # MIT + +package(default_visibility = ["//visibility:public"]) + +ts_library( + name = "testing", + srcs = glob( + include = ["**/*.ts"], + exclude = ["**/*_spec.ts"], + ), + module_name = "@angular-devkit/architect/testing", + module_root = "index.d.ts", + deps = [ + "//packages/angular_devkit/architect", + "//packages/angular_devkit/core", + "//packages/angular_devkit/core/node", + "@npm//@types/node", + "@npm//rxjs", + ], +) diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/architect/testing/index.d.ts b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/architect/testing/index.d.ts new file mode 100644 index 00000000..12e628b9 --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/architect/testing/index.d.ts @@ -0,0 +1,9 @@ +/** + * @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 + */ +export * from './testing-architect-host'; +export * from './test-project-host'; diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/architect/testing/index.js b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/architect/testing/index.js new file mode 100644 index 00000000..6f1f976a --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/architect/testing/index.js @@ -0,0 +1,21 @@ +"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 + */ +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __exportStar = (this && this.__exportStar) || function(m, exports) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +__exportStar(require("./testing-architect-host"), exports); +__exportStar(require("./test-project-host"), exports); diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/architect/testing/test-project-host.d.ts b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/architect/testing/test-project-host.d.ts new file mode 100644 index 00000000..240029a7 --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/architect/testing/test-project-host.d.ts @@ -0,0 +1,33 @@ +/** + * @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, PathFragment, virtualFs } from '@angular-devkit/core'; +import { NodeJsSyncHost } from '@angular-devkit/core/node'; +import { Stats } from 'fs'; +import { Observable } from 'rxjs'; +/** + * @deprecated + */ +export declare class TestProjectHost extends NodeJsSyncHost { + protected _templateRoot: Path; + private _currentRoot; + private _scopedSyncHost; + constructor(_templateRoot: Path); + root(): Path; + scopedSync(): virtualFs.SyncDelegateHost<Stats>; + initialize(): Observable<void>; + restore(): Observable<void>; + writeMultipleFiles(files: { + [path: string]: string | ArrayBufferLike | Buffer; + }): void; + replaceInFile(path: string, match: RegExp | string, replacement: string): void; + appendToFile(path: string, str: string): void; + fileMatchExists(dir: string, regex: RegExp): PathFragment | undefined; + copyFile(from: string, to: string): void; + private findUniqueFolderPath; +} diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/architect/testing/test-project-host.js b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/architect/testing/test-project-host.js new file mode 100644 index 00000000..f110997a --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/architect/testing/test-project-host.js @@ -0,0 +1,109 @@ +"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.TestProjectHost = void 0; +const core_1 = require("@angular-devkit/core"); +const node_1 = require("@angular-devkit/core/node"); +const rxjs_1 = require("rxjs"); +const operators_1 = require("rxjs/operators"); +/** + * @deprecated + */ +class TestProjectHost extends node_1.NodeJsSyncHost { + constructor(_templateRoot) { + super(); + this._templateRoot = _templateRoot; + this._currentRoot = null; + this._scopedSyncHost = null; + } + root() { + if (this._currentRoot === null) { + throw new Error('TestProjectHost must be initialized before being used.'); + } + return this._currentRoot; + } + scopedSync() { + if (this._currentRoot === null || this._scopedSyncHost === null) { + throw new Error('TestProjectHost must be initialized before being used.'); + } + return this._scopedSyncHost; + } + initialize() { + const recursiveList = (path) => this.list(path).pipe( + // Emit each fragment individually. + (0, operators_1.concatMap)((fragments) => (0, rxjs_1.from)(fragments)), + // Join the path with fragment. + (0, operators_1.map)((fragment) => (0, core_1.join)(path, fragment)), + // Emit directory content paths instead of the directory path. + (0, operators_1.mergeMap)((path) => this.isDirectory(path).pipe((0, operators_1.concatMap)((isDir) => (isDir ? recursiveList(path) : (0, rxjs_1.of)(path)))))); + // Find a unique folder that we can write to to use as current root. + return this.findUniqueFolderPath().pipe( + // Save the path and create a scoped host for it. + (0, operators_1.tap)((newFolderPath) => { + this._currentRoot = newFolderPath; + this._scopedSyncHost = new core_1.virtualFs.SyncDelegateHost(new core_1.virtualFs.ScopedHost(this, this.root())); + }), + // List all files in root. + (0, operators_1.concatMap)(() => recursiveList(this._templateRoot)), + // Copy them over to the current root. + (0, operators_1.concatMap)((from) => { + const to = (0, core_1.join)(this.root(), (0, core_1.relative)(this._templateRoot, from)); + return this.read(from).pipe((0, operators_1.concatMap)((buffer) => this.write(to, buffer))); + }), (0, operators_1.map)(() => { })); + } + restore() { + if (this._currentRoot === null) { + return rxjs_1.EMPTY; + } + // Delete the current root and clear the variables. + // Wait 50ms and retry up to 10 times, to give time for file locks to clear. + return this.exists(this.root()).pipe((0, operators_1.delay)(50), (0, operators_1.concatMap)((exists) => (exists ? this.delete(this.root()) : rxjs_1.EMPTY)), (0, operators_1.retry)(10), (0, operators_1.finalize)(() => { + this._currentRoot = null; + this._scopedSyncHost = null; + })); + } + writeMultipleFiles(files) { + Object.keys(files).forEach((fileName) => { + let content = files[fileName]; + if (typeof content == 'string') { + content = core_1.virtualFs.stringToFileBuffer(content); + } + else if (content instanceof Buffer) { + content = content.buffer.slice(content.byteOffset, content.byteOffset + content.byteLength); + } + this.scopedSync().write((0, core_1.normalize)(fileName), content); + }); + } + replaceInFile(path, match, replacement) { + const content = core_1.virtualFs.fileBufferToString(this.scopedSync().read((0, core_1.normalize)(path))); + this.scopedSync().write((0, core_1.normalize)(path), core_1.virtualFs.stringToFileBuffer(content.replace(match, replacement))); + } + appendToFile(path, str) { + const content = core_1.virtualFs.fileBufferToString(this.scopedSync().read((0, core_1.normalize)(path))); + this.scopedSync().write((0, core_1.normalize)(path), core_1.virtualFs.stringToFileBuffer(content.concat(str))); + } + fileMatchExists(dir, regex) { + const [fileName] = this.scopedSync() + .list((0, core_1.normalize)(dir)) + .filter((name) => name.match(regex)); + return fileName || undefined; + } + copyFile(from, to) { + const content = this.scopedSync().read((0, core_1.normalize)(from)); + this.scopedSync().write((0, core_1.normalize)(to), content); + } + findUniqueFolderPath() { + // 11 character alphanumeric string. + const randomString = Math.random().toString(36).slice(2); + const newFolderName = `test-project-host-${(0, core_1.basename)(this._templateRoot)}-${randomString}`; + const newFolderPath = (0, core_1.join)((0, core_1.dirname)(this._templateRoot), newFolderName); + return this.exists(newFolderPath).pipe((0, operators_1.concatMap)((exists) => (exists ? this.findUniqueFolderPath() : (0, rxjs_1.of)(newFolderPath)))); + } +} +exports.TestProjectHost = TestProjectHost; diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/architect/testing/testing-architect-host.d.ts b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/architect/testing/testing-architect-host.d.ts new file mode 100644 index 00000000..8c0154c5 --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/architect/testing/testing-architect-host.d.ts @@ -0,0 +1,42 @@ +/** + * @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 + */ +import { json } from '@angular-devkit/core'; +import { BuilderInfo, Target } from '../src'; +import { ArchitectHost, Builder } from '../src/internal'; +export declare class TestingArchitectHost implements ArchitectHost { + workspaceRoot: string; + currentDirectory: string; + private _backendHost; + private _builderImportMap; + private _builderMap; + private _targetMap; + /** + * Can provide a backend host, in case of integration tests. + * @param workspaceRoot The workspace root to use. + * @param currentDirectory The current directory to use. + * @param _backendHost A host to defer calls that aren't resolved here. + */ + constructor(workspaceRoot?: string, currentDirectory?: string, _backendHost?: ArchitectHost | null); + addBuilder(builderName: string, builder: Builder, description?: string, optionSchema?: json.schema.JsonSchema): void; + addBuilderFromPackage(packageName: string): Promise<void>; + addTarget(target: Target, builderName: string, options?: json.JsonObject): void; + getBuilderNameForTarget(target: Target): Promise<string | null>; + /** + * Resolve a builder. This needs to return a string which will be used in a dynamic `import()` + * clause. This should throw if no builder can be found. The dynamic import will throw if + * it is unsupported. + * @param builderName The name of the builder to be used. + * @returns All the info needed for the builder itself. + */ + resolveBuilder(builderName: string): Promise<BuilderInfo | null>; + getCurrentDirectory(): Promise<string>; + getWorkspaceRoot(): Promise<string>; + getOptionsForTarget(target: Target): Promise<json.JsonObject | null>; + getProjectMetadata(target: Target | string): Promise<json.JsonObject | null>; + loadBuilder(info: BuilderInfo): Promise<Builder | null>; +} diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/architect/testing/testing-architect-host.js b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/architect/testing/testing-architect-host.js new file mode 100644 index 00000000..025fa37a --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/architect/testing/testing-architect-host.js @@ -0,0 +1,119 @@ +"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 + */ +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.TestingArchitectHost = void 0; +const src_1 = require("../src"); +class TestingArchitectHost { + /** + * Can provide a backend host, in case of integration tests. + * @param workspaceRoot The workspace root to use. + * @param currentDirectory The current directory to use. + * @param _backendHost A host to defer calls that aren't resolved here. + */ + constructor(workspaceRoot = '', currentDirectory = workspaceRoot, _backendHost = null) { + this.workspaceRoot = workspaceRoot; + this.currentDirectory = currentDirectory; + this._backendHost = _backendHost; + this._builderImportMap = new Map(); + this._builderMap = new Map(); + this._targetMap = new Map(); + } + addBuilder(builderName, builder, description = 'Testing only builder.', optionSchema = { type: 'object' }) { + this._builderImportMap.set(builderName, builder); + this._builderMap.set(builderName, { builderName, description, optionSchema }); + } + async addBuilderFromPackage(packageName) { + const packageJson = await Promise.resolve().then(() => __importStar(require(packageName + '/package.json'))); + if (!('builders' in packageJson)) { + throw new Error('Invalid package.json, builders key not found.'); + } + if (!packageJson.name) { + throw new Error('Invalid package name'); + } + const builderJsonPath = packageName + '/' + packageJson['builders']; + const builderJson = await Promise.resolve().then(() => __importStar(require(builderJsonPath))); + const builders = builderJson['builders']; + if (!builders) { + throw new Error('Invalid builders.json, builders key not found.'); + } + for (const builderName of Object.keys(builders)) { + const b = builders[builderName]; + // TODO: remove this check as v1 is not supported anymore. + if (!b.implementation) { + continue; + } + const handler = (await Promise.resolve().then(() => __importStar(require(builderJsonPath + '/../' + b.implementation)))).default; + const optionsSchema = await Promise.resolve().then(() => __importStar(require(builderJsonPath + '/../' + b.schema))); + this.addBuilder(`${packageJson.name}:${builderName}`, handler, b.description, optionsSchema); + } + } + addTarget(target, builderName, options = {}) { + this._targetMap.set((0, src_1.targetStringFromTarget)(target), { builderName, options }); + } + async getBuilderNameForTarget(target) { + const name = (0, src_1.targetStringFromTarget)(target); + const maybeTarget = this._targetMap.get(name); + if (!maybeTarget) { + return this._backendHost && this._backendHost.getBuilderNameForTarget(target); + } + return maybeTarget.builderName; + } + /** + * Resolve a builder. This needs to return a string which will be used in a dynamic `import()` + * clause. This should throw if no builder can be found. The dynamic import will throw if + * it is unsupported. + * @param builderName The name of the builder to be used. + * @returns All the info needed for the builder itself. + */ + async resolveBuilder(builderName) { + return (this._builderMap.get(builderName) || + (this._backendHost && this._backendHost.resolveBuilder(builderName))); + } + async getCurrentDirectory() { + return this.currentDirectory; + } + async getWorkspaceRoot() { + return this.workspaceRoot; + } + async getOptionsForTarget(target) { + const name = (0, src_1.targetStringFromTarget)(target); + const maybeTarget = this._targetMap.get(name); + if (!maybeTarget) { + return this._backendHost && this._backendHost.getOptionsForTarget(target); + } + return maybeTarget.options; + } + async getProjectMetadata(target) { + return this._backendHost && this._backendHost.getProjectMetadata(target); + } + async loadBuilder(info) { + return (this._builderImportMap.get(info.builderName) || + (this._backendHost && this._backendHost.loadBuilder(info))); + } +} +exports.TestingArchitectHost = TestingArchitectHost; diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/LICENSE b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/LICENSE new file mode 100644 index 00000000..8876c32c --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/LICENSE @@ -0,0 +1,21 @@ +The MIT License + +Copyright (c) 2017 Google, Inc. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/README.md b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/README.md new file mode 100644 index 00000000..18ebc31c --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/README.md @@ -0,0 +1,167 @@ +# Core + +> Shared utilities for Angular DevKit. + +# Exception + +# Json + +## Schema + +### SchemaValidatorResult + +``` +export interface SchemaValidatorResult { + success: boolean; + errors?: string[]; +} +``` + +### SchemaValidator + +``` +export interface SchemaValidator { + (data: any): Observable<SchemaValidatorResult>; +} +``` + +### SchemaFormatter + +``` +export interface SchemaFormatter { + readonly async: boolean; + validate(data: any): boolean | Observable<boolean>; +} +``` + +### SchemaRegistry + +``` +export interface SchemaRegistry { + compile(schema: Object): Observable<SchemaValidator>; + addFormat(name: string, formatter: SchemaFormatter): void; +} +``` + +### CoreSchemaRegistry + +`SchemaRegistry` implementation using https://github.com/epoberezkin/ajv. +Constructor accepts object containing `SchemaFormatter` that will be added automatically. + +``` +export class CoreSchemaRegistry implements SchemaRegistry { + constructor(formats: { [name: string]: SchemaFormatter} = {}) {} +} +``` + +# Logger + +# Utils + +# Virtual FS + +# Workspaces + +The `workspaces` namespace provides an API for interacting with the workspace file formats. +It provides an abstraction of the underlying storage format of the workspace and provides +support for both reading and writing. Currently, the only supported format is the JSON-based +format used by the Angular CLI. For this format, the API provides internal change tracking of values which +enables fine-grained updates to the underlying storage of the workspace. This allows for the +retention of existing formatting and comments. + +A workspace is defined via the following object model. Definition collection objects are specialized +Javascript `Map` objects with an additional `add` method to simplify addition and provide more localized +error checking of the newly added values. + +```ts +export interface WorkspaceDefinition { + readonly extensions: Record<string, JsonValue | undefined>; + readonly projects: ProjectDefinitionCollection; +} + +export interface ProjectDefinition { + readonly extensions: Record<string, JsonValue | undefined>; + readonly targets: TargetDefinitionCollection; + root: string; + prefix?: string; + sourceRoot?: string; +} + +export interface TargetDefinition { + options?: Record<string, JsonValue | undefined>; + configurations?: Record<string, Record<string, JsonValue | undefined> | undefined>; + builder: string; +} +``` + +The API is asynchronous and has two main functions to facilitate reading, creation, and modifying +a workspace: `readWorkspace` and `writeWorkspace`. + +```ts +export enum WorkspaceFormat { + JSON, +} +``` + +```ts +export function readWorkspace( + path: string, + host: WorkspaceHost, + format?: WorkspaceFormat, +): Promise<{ workspace: WorkspaceDefinition }>; +``` + +```ts +export function writeWorkspace( + workspace: WorkspaceDefinition, + host: WorkspaceHost, + path?: string, + format?: WorkspaceFormat, +): Promise<void>; +``` + +A `WorkspaceHost` abstracts the underlying data access methods from the functions. It provides +methods to read, write, and analyze paths. A utility function is provided to create +an instance of a `WorkspaceHost` from the Angular DevKit's virtual filesystem host abstraction. + +```ts +export interface WorkspaceHost { + readFile(path: string): Promise<string>; + writeFile(path: string, data: string): Promise<void>; + isDirectory(path: string): Promise<boolean>; + isFile(path: string): Promise<boolean>; +} + +export function createWorkspaceHost(host: virtualFs.Host): WorkspaceHost; +``` + +## Usage Example + +To demonstrate the usage of the API, the following code will show how to add a option property +to a build target for an application. + +```ts +import { NodeJsSyncHost } from '@angular-devkit/core/node'; +import { workspaces } from '@angular-devkit/core'; + +async function demonstrate() { + const host = workspaces.createWorkspaceHost(new NodeJsSyncHost()); + const { workspace } = await workspaces.readWorkspace('path/to/workspace/directory/', host); + + const project = workspace.projects.get('my-app'); + if (!project) { + throw new Error('my-app does not exist'); + } + + const buildTarget = project.targets.get('build'); + if (!buildTarget) { + throw new Error('build target does not exist'); + } + + buildTarget.options.optimization = true; + + await workspaces.writeWorkspace(workspace, host); +} + +demonstrate(); +``` diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/node/BUILD.bazel b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/node/BUILD.bazel new file mode 100644 index 00000000..a97bc10b --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/node/BUILD.bazel @@ -0,0 +1,65 @@ +# Copyright Google Inc. 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 + +load("@npm//@bazel/jasmine:index.bzl", "jasmine_node_test") +load("//tools:defaults.bzl", "ts_library") + +licenses(["notice"]) # MIT License + +package(default_visibility = ["//visibility:public"]) + +ts_library( + name = "node", + srcs = glob( + include = ["**/*.ts"], + exclude = [ + "testing/**/*.ts", + "**/*_spec.ts", + "**/*_benchmark.ts", + ], + ), + data = ["package.json"], + module_name = "@angular-devkit/core/node", + module_root = "index.d.ts", + # The attribute below is needed in g3 to turn off strict typechecking + # strict_checks = False, + deps = [ + "//packages/angular_devkit/core", + "@npm//@types/node", + "@npm//chokidar", + "@npm//rxjs", + ], +) + +ts_library( + name = "node_test_lib", + testonly = True, + srcs = glob( + include = [ + "**/*_spec.ts", + ], + exclude = [ + "testing/**/*.ts", + ], + ), + deps = [ + ":node", + "//packages/angular_devkit/core", + "//tests/angular_devkit/core/node/jobs:jobs_test_lib", + "@npm//rxjs", + ], +) + +jasmine_node_test( + name = "node_test", + srcs = [":node_test_lib"], + deps = [ + "@npm//chokidar", + "@npm//temp", + # @node_module: ajv + # @node_module: fast_json_stable_stringify + # @node_module: magic_string + ], +) diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/node/cli-logger.d.ts b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/node/cli-logger.d.ts new file mode 100644 index 00000000..6217c6f4 --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/node/cli-logger.d.ts @@ -0,0 +1,16 @@ +/** + * @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 { logging } from '../src'; +export interface ProcessOutput { + write(buffer: string | Buffer): boolean; +} +/** + * A Logger that sends information to STDOUT and STDERR. + */ +export declare function createConsoleLogger(verbose?: boolean, stdout?: ProcessOutput, stderr?: ProcessOutput, colors?: Partial<Record<logging.LogLevel, (s: string) => string>>): logging.Logger; diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/node/cli-logger.js b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/node/cli-logger.js new file mode 100644 index 00000000..829b3ce7 --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/node/cli-logger.js @@ -0,0 +1,58 @@ +"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.createConsoleLogger = void 0; +const operators_1 = require("rxjs/operators"); +const src_1 = require("../src"); +/** + * A Logger that sends information to STDOUT and STDERR. + */ +function createConsoleLogger(verbose = false, stdout = process.stdout, stderr = process.stderr, colors) { + const logger = new src_1.logging.IndentLogger('cling'); + logger.pipe((0, operators_1.filter)((entry) => entry.level !== 'debug' || verbose)).subscribe((entry) => { + const color = colors && colors[entry.level]; + let output = stdout; + switch (entry.level) { + case 'warn': + case 'fatal': + case 'error': + output = stderr; + break; + } + // If we do console.log(message) or process.stdout.write(message + '\n'), the process might + // stop before the whole message is written and the stream is flushed. This happens when + // streams are asynchronous. + // + // NodeJS IO streams are different depending on platform and usage. In POSIX environment, + // for example, they're asynchronous when writing to a pipe, but synchronous when writing + // to a TTY. In windows, it's the other way around. You can verify which is which with + // stream.isTTY and platform, but this is not good enough. + // In the async case, one should wait for the callback before sending more data or + // continuing the process. In our case it would be rather hard to do (but not impossible). + // + // Instead we take the easy way out and simply chunk the message and call the write + // function while the buffer drain itself asynchronously. With a smaller chunk size than + // the buffer, we are mostly certain that it works. In this case, the chunk has been picked + // as half a page size (4096/2 = 2048), minus some bytes for the color formatting. + // On POSIX it seems the buffer is 2 pages (8192), but just to be sure (could be different + // by platform). + // + // For more details, see https://nodejs.org/api/process.html#process_a_note_on_process_i_o + const chunkSize = 2000; // Small chunk. + let message = entry.message; + while (message) { + const chunk = message.slice(0, chunkSize); + message = message.slice(chunkSize); + output.write(color ? color(chunk) : chunk); + } + output.write('\n'); + }); + return logger; +} +exports.createConsoleLogger = createConsoleLogger; diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/node/experimental/index.d.ts b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/node/experimental/index.d.ts new file mode 100644 index 00000000..30810c34 --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/node/experimental/index.d.ts @@ -0,0 +1,9 @@ +/** + * @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 + */ +import * as jobs from './jobs'; +export { jobs }; diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/node/experimental/index.js b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/node/experimental/index.js new file mode 100644 index 00000000..f6f58b8d --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/node/experimental/index.js @@ -0,0 +1,31 @@ +"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 + */ +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.jobs = void 0; +const jobs = __importStar(require("./jobs")); +exports.jobs = jobs; diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/node/experimental/jobs/index.d.ts b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/node/experimental/jobs/index.d.ts new file mode 100644 index 00000000..f01c2aeb --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/node/experimental/jobs/index.d.ts @@ -0,0 +1,8 @@ +/** + * @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 + */ +export * from './job-registry'; diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/node/experimental/jobs/index.js b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/node/experimental/jobs/index.js new file mode 100644 index 00000000..ad41fd7f --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/node/experimental/jobs/index.js @@ -0,0 +1,20 @@ +"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 + */ +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __exportStar = (this && this.__exportStar) || function(m, exports) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +__exportStar(require("./job-registry"), exports); diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/node/experimental/jobs/job-registry.d.ts b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/node/experimental/jobs/job-registry.d.ts new file mode 100644 index 00000000..57026245 --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/node/experimental/jobs/job-registry.d.ts @@ -0,0 +1,19 @@ +/** + * @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 + */ +import { Observable } from 'rxjs'; +import { JsonValue, experimental as core_experimental } from '../../../src'; +export declare class NodeModuleJobRegistry<MinimumArgumentValueT extends JsonValue = JsonValue, MinimumInputValueT extends JsonValue = JsonValue, MinimumOutputValueT extends JsonValue = JsonValue> implements core_experimental.jobs.Registry<MinimumArgumentValueT, MinimumInputValueT, MinimumOutputValueT> { + protected _resolve(name: string): string | null; + /** + * Get a job description for a named job. + * + * @param name The name of the job. + * @returns A description, or null if the job is not registered. + */ + get<A extends MinimumArgumentValueT, I extends MinimumInputValueT, O extends MinimumOutputValueT>(name: core_experimental.jobs.JobName): Observable<core_experimental.jobs.JobHandler<A, I, O> | null>; +} diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/node/experimental/jobs/job-registry.js b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/node/experimental/jobs/job-registry.js new file mode 100644 index 00000000..59a05ab4 --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/node/experimental/jobs/job-registry.js @@ -0,0 +1,59 @@ +"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.NodeModuleJobRegistry = void 0; +const rxjs_1 = require("rxjs"); +const src_1 = require("../../../src"); +class NodeModuleJobRegistry { + _resolve(name) { + try { + return require.resolve(name); + } + catch (e) { + if (e.code === 'MODULE_NOT_FOUND') { + return null; + } + throw e; + } + } + /** + * Get a job description for a named job. + * + * @param name The name of the job. + * @returns A description, or null if the job is not registered. + */ + get(name) { + const [moduleName, exportName] = name.split(/#/, 2); + const resolvedPath = this._resolve(moduleName); + if (!resolvedPath) { + return (0, rxjs_1.of)(null); + } + const pkg = require(resolvedPath); + const handler = pkg[exportName || 'default']; + if (!handler) { + return (0, rxjs_1.of)(null); + } + function _getValue(...fields) { + return fields.find((x) => src_1.schema.isJsonSchema(x)) || true; + } + const argument = _getValue(pkg.argument, handler.argument); + const input = _getValue(pkg.input, handler.input); + const output = _getValue(pkg.output, handler.output); + const channels = _getValue(pkg.channels, handler.channels); + return (0, rxjs_1.of)(Object.assign(handler.bind(undefined), { + jobDescription: { + argument, + input, + output, + channels, + }, + })); + } +} +exports.NodeModuleJobRegistry = NodeModuleJobRegistry; diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/node/fs.d.ts b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/node/fs.d.ts new file mode 100644 index 00000000..a6734a60 --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/node/fs.d.ts @@ -0,0 +1,11 @@ +/** + * @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 + */ +/** @deprecated Since v11.0, unused by the Angular tooling */ +export declare function isFile(filePath: string): boolean; +/** @deprecated Since v11.0, unused by the Angular tooling */ +export declare function isDirectory(filePath: string): boolean; diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/node/fs.js b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/node/fs.js new file mode 100644 index 00000000..b121082e --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/node/fs.js @@ -0,0 +1,41 @@ +"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.isDirectory = exports.isFile = void 0; +const fs_1 = require("fs"); +/** @deprecated Since v11.0, unused by the Angular tooling */ +function isFile(filePath) { + let stat; + try { + stat = (0, fs_1.statSync)(filePath); + } + catch (e) { + if (e && (e.code === 'ENOENT' || e.code === 'ENOTDIR')) { + return false; + } + throw e; + } + return stat.isFile() || stat.isFIFO(); +} +exports.isFile = isFile; +/** @deprecated Since v11.0, unused by the Angular tooling */ +function isDirectory(filePath) { + let stat; + try { + stat = (0, fs_1.statSync)(filePath); + } + catch (e) { + if (e && (e.code === 'ENOENT' || e.code === 'ENOTDIR')) { + return false; + } + throw e; + } + return stat.isDirectory(); +} +exports.isDirectory = isDirectory; diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/node/host.d.ts b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/node/host.d.ts new file mode 100644 index 00000000..bb333539 --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/node/host.d.ts @@ -0,0 +1,44 @@ +/** + * @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 { Stats } from 'fs'; +import { Observable } from 'rxjs'; +import { Path, PathFragment, virtualFs } from '../src'; +/** + * An implementation of the Virtual FS using Node as the background. There are two versions; one + * synchronous and one asynchronous. + */ +export declare class NodeJsAsyncHost implements virtualFs.Host<Stats> { + get capabilities(): virtualFs.HostCapabilities; + write(path: Path, content: virtualFs.FileBuffer): Observable<void>; + read(path: Path): Observable<virtualFs.FileBuffer>; + delete(path: Path): Observable<void>; + rename(from: Path, to: Path): Observable<void>; + list(path: Path): Observable<PathFragment[]>; + exists(path: Path): Observable<boolean>; + isDirectory(path: Path): Observable<boolean>; + isFile(path: Path): Observable<boolean>; + stat(path: Path): Observable<virtualFs.Stats<Stats>>; + watch(path: Path, _options?: virtualFs.HostWatchOptions): Observable<virtualFs.HostWatchEvent> | null; +} +/** + * An implementation of the Virtual FS using Node as the backend, synchronously. + */ +export declare class NodeJsSyncHost implements virtualFs.Host<Stats> { + get capabilities(): virtualFs.HostCapabilities; + write(path: Path, content: virtualFs.FileBuffer): Observable<void>; + read(path: Path): Observable<virtualFs.FileBuffer>; + delete(path: Path): Observable<void>; + rename(from: Path, to: Path): Observable<void>; + list(path: Path): Observable<PathFragment[]>; + exists(path: Path): Observable<boolean>; + isDirectory(path: Path): Observable<boolean>; + isFile(path: Path): Observable<boolean>; + stat(path: Path): Observable<virtualFs.Stats<Stats>>; + watch(path: Path, _options?: virtualFs.HostWatchOptions): Observable<virtualFs.HostWatchEvent> | null; +} diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/node/host.js b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/node/host.js new file mode 100644 index 00000000..a50139b8 --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/node/host.js @@ -0,0 +1,265 @@ +"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 + */ +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.NodeJsSyncHost = exports.NodeJsAsyncHost = void 0; +const fs_1 = __importStar(require("fs")); +const path_1 = require("path"); +const rxjs_1 = require("rxjs"); +const operators_1 = require("rxjs/operators"); +const src_1 = require("../src"); +async function exists(path) { + try { + await fs_1.promises.access(path, fs_1.constants.F_OK); + return true; + } + catch { + return false; + } +} +// This will only be initialized if the watch() method is called. +// Otherwise chokidar appears only in type positions, and shouldn't be referenced +// in the JavaScript output. +let FSWatcher; +function loadFSWatcher() { + if (!FSWatcher) { + try { + // eslint-disable-next-line import/no-extraneous-dependencies + FSWatcher = require('chokidar').FSWatcher; + } + catch (e) { + if (e.code !== 'MODULE_NOT_FOUND') { + throw new Error('As of angular-devkit version 8.0, the "chokidar" package ' + + 'must be installed in order to use watch() features.'); + } + throw e; + } + } +} +/** + * An implementation of the Virtual FS using Node as the background. There are two versions; one + * synchronous and one asynchronous. + */ +class NodeJsAsyncHost { + get capabilities() { + return { synchronous: false }; + } + write(path, content) { + return (0, rxjs_1.from)(fs_1.promises.mkdir((0, src_1.getSystemPath)((0, src_1.dirname)(path)), { recursive: true })).pipe((0, operators_1.mergeMap)(() => fs_1.promises.writeFile((0, src_1.getSystemPath)(path), new Uint8Array(content)))); + } + read(path) { + return (0, rxjs_1.from)(fs_1.promises.readFile((0, src_1.getSystemPath)(path))).pipe((0, operators_1.map)((buffer) => new Uint8Array(buffer).buffer)); + } + delete(path) { + return this.isDirectory(path).pipe((0, operators_1.mergeMap)(async (isDirectory) => { + if (isDirectory) { + // The below should be removed and replaced with just `rm` when support for Node.Js 12 is removed. + const { rm, rmdir } = fs_1.promises; + if (rm) { + await rm((0, src_1.getSystemPath)(path), { force: true, recursive: true, maxRetries: 3 }); + } + else { + await rmdir((0, src_1.getSystemPath)(path), { recursive: true, maxRetries: 3 }); + } + } + else { + await fs_1.promises.unlink((0, src_1.getSystemPath)(path)); + } + })); + } + rename(from, to) { + return (0, rxjs_1.from)(fs_1.promises.rename((0, src_1.getSystemPath)(from), (0, src_1.getSystemPath)(to))); + } + list(path) { + return (0, rxjs_1.from)(fs_1.promises.readdir((0, src_1.getSystemPath)(path))).pipe((0, operators_1.map)((names) => names.map((name) => (0, src_1.fragment)(name)))); + } + exists(path) { + return (0, rxjs_1.from)(exists((0, src_1.getSystemPath)(path))); + } + isDirectory(path) { + return this.stat(path).pipe((0, operators_1.map)((stat) => stat.isDirectory())); + } + isFile(path) { + return this.stat(path).pipe((0, operators_1.map)((stat) => stat.isFile())); + } + // Some hosts may not support stat. + stat(path) { + return (0, rxjs_1.from)(fs_1.promises.stat((0, src_1.getSystemPath)(path))); + } + // Some hosts may not support watching. + watch(path, _options) { + return new rxjs_1.Observable((obs) => { + loadFSWatcher(); + const watcher = new FSWatcher({ persistent: true }); + watcher.add((0, src_1.getSystemPath)(path)); + watcher + .on('change', (path) => { + obs.next({ + path: (0, src_1.normalize)(path), + time: new Date(), + type: 0 /* Changed */, + }); + }) + .on('add', (path) => { + obs.next({ + path: (0, src_1.normalize)(path), + time: new Date(), + type: 1 /* Created */, + }); + }) + .on('unlink', (path) => { + obs.next({ + path: (0, src_1.normalize)(path), + time: new Date(), + type: 2 /* Deleted */, + }); + }); + return () => watcher.close(); + }).pipe((0, operators_1.publish)(), (0, operators_1.refCount)()); + } +} +exports.NodeJsAsyncHost = NodeJsAsyncHost; +/** + * An implementation of the Virtual FS using Node as the backend, synchronously. + */ +class NodeJsSyncHost { + get capabilities() { + return { synchronous: true }; + } + write(path, content) { + return new rxjs_1.Observable((obs) => { + (0, fs_1.mkdirSync)((0, src_1.getSystemPath)((0, src_1.dirname)(path)), { recursive: true }); + (0, fs_1.writeFileSync)((0, src_1.getSystemPath)(path), new Uint8Array(content)); + obs.next(); + obs.complete(); + }); + } + read(path) { + return new rxjs_1.Observable((obs) => { + const buffer = (0, fs_1.readFileSync)((0, src_1.getSystemPath)(path)); + obs.next(new Uint8Array(buffer).buffer); + obs.complete(); + }); + } + delete(path) { + return this.isDirectory(path).pipe((0, operators_1.concatMap)((isDir) => { + if (isDir) { + const dirPaths = (0, fs_1.readdirSync)((0, src_1.getSystemPath)(path)); + const rmDirComplete = new rxjs_1.Observable((obs) => { + // The below should be removed and replaced with just `rmSync` when support for Node.Js 12 is removed. + const { rmSync, rmdirSync } = fs_1.default; + if (rmSync) { + rmSync((0, src_1.getSystemPath)(path), { force: true, recursive: true, maxRetries: 3 }); + } + else { + rmdirSync((0, src_1.getSystemPath)(path), { recursive: true, maxRetries: 3 }); + } + obs.complete(); + }); + return (0, rxjs_1.concat)(...dirPaths.map((name) => this.delete((0, src_1.join)(path, name))), rmDirComplete); + } + else { + try { + (0, fs_1.unlinkSync)((0, src_1.getSystemPath)(path)); + } + catch (err) { + return (0, rxjs_1.throwError)(err); + } + return (0, rxjs_1.of)(undefined); + } + })); + } + rename(from, to) { + return new rxjs_1.Observable((obs) => { + const toSystemPath = (0, src_1.getSystemPath)(to); + (0, fs_1.mkdirSync)((0, path_1.dirname)(toSystemPath), { recursive: true }); + (0, fs_1.renameSync)((0, src_1.getSystemPath)(from), toSystemPath); + obs.next(); + obs.complete(); + }); + } + list(path) { + return new rxjs_1.Observable((obs) => { + const names = (0, fs_1.readdirSync)((0, src_1.getSystemPath)(path)); + obs.next(names.map((name) => (0, src_1.fragment)(name))); + obs.complete(); + }); + } + exists(path) { + return new rxjs_1.Observable((obs) => { + obs.next((0, fs_1.existsSync)((0, src_1.getSystemPath)(path))); + obs.complete(); + }); + } + isDirectory(path) { + // eslint-disable-next-line @typescript-eslint/no-non-null-assertion + return this.stat(path).pipe((0, operators_1.map)((stat) => stat.isDirectory())); + } + isFile(path) { + // eslint-disable-next-line @typescript-eslint/no-non-null-assertion + return this.stat(path).pipe((0, operators_1.map)((stat) => stat.isFile())); + } + // Some hosts may not support stat. + stat(path) { + return new rxjs_1.Observable((obs) => { + obs.next((0, fs_1.statSync)((0, src_1.getSystemPath)(path))); + obs.complete(); + }); + } + // Some hosts may not support watching. + watch(path, _options) { + return new rxjs_1.Observable((obs) => { + loadFSWatcher(); + const watcher = new FSWatcher({ persistent: false }); + watcher.add((0, src_1.getSystemPath)(path)); + watcher + .on('change', (path) => { + obs.next({ + path: (0, src_1.normalize)(path), + time: new Date(), + type: 0 /* Changed */, + }); + }) + .on('add', (path) => { + obs.next({ + path: (0, src_1.normalize)(path), + time: new Date(), + type: 1 /* Created */, + }); + }) + .on('unlink', (path) => { + obs.next({ + path: (0, src_1.normalize)(path), + time: new Date(), + type: 2 /* Deleted */, + }); + }); + return () => watcher.close(); + }).pipe((0, operators_1.publish)(), (0, operators_1.refCount)()); + } +} +exports.NodeJsSyncHost = NodeJsSyncHost; diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/node/index.d.ts b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/node/index.d.ts new file mode 100644 index 00000000..ad973e84 --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/node/index.d.ts @@ -0,0 +1,12 @@ +/** + * @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 + */ +import * as experimental from './experimental/jobs/job-registry'; +import * as fs from './fs'; +export * from './cli-logger'; +export * from './host'; +export { experimental, fs }; diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/node/index.js b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/node/index.js new file mode 100644 index 00000000..35bea1dc --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/node/index.js @@ -0,0 +1,38 @@ +"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 + */ +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; +var __exportStar = (this && this.__exportStar) || function(m, exports) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.fs = exports.experimental = void 0; +const experimental = __importStar(require("./experimental/jobs/job-registry")); +exports.experimental = experimental; +const fs = __importStar(require("./fs")); +exports.fs = fs; +__exportStar(require("./cli-logger"), exports); +__exportStar(require("./host"), exports); diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/node/package.json b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/node/package.json new file mode 100644 index 00000000..87cb5f4a --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/node/package.json @@ -0,0 +1,5 @@ +{ + "name": "@angular-devkit/core/node", + "main": "index.js", + "typings": "index.d.ts" +} diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/node/testing/BUILD.bazel b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/node/testing/BUILD.bazel new file mode 100644 index 00000000..1b5afd40 --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/node/testing/BUILD.bazel @@ -0,0 +1,31 @@ +load("//tools:defaults.bzl", "ts_library") + +# Copyright Google Inc. 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 +licenses(["notice"]) # MIT License + +package(default_visibility = ["//visibility:public"]) + +ts_library( + name = "testing", + srcs = glob( + include = ["**/*.ts"], + exclude = [ + "**/*_spec.ts", + "**/*_benchmark.ts", + ], + ), + module_name = "@angular-devkit/core/node/testing", + module_root = "index.d.ts", + # The attribute below is needed in g3 to turn off strict typechecking + # strict_checks = False, + deps = [ + "//packages/angular_devkit/core", + "//packages/angular_devkit/core/node", + "@npm//@types/jasmine", + "@npm//@types/node", + "@npm//rxjs", + ], +) diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/node/testing/index.d.ts b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/node/testing/index.d.ts new file mode 100644 index 00000000..4dd8f30b --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/node/testing/index.d.ts @@ -0,0 +1,21 @@ +/** + * @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 * as fs from 'fs'; +import { Path, virtualFs } from '../../src'; +/** + * A Sync Scoped Host that creates a temporary directory and scope to it. + */ +export declare class TempScopedNodeJsSyncHost extends virtualFs.ScopedHost<fs.Stats> { + protected _sync?: virtualFs.SyncDelegateHost<fs.Stats>; + protected _root: Path; + constructor(); + get files(): Path[]; + get root(): Path; + get sync(): virtualFs.SyncDelegateHost<fs.Stats>; +} diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/node/testing/index.js b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/node/testing/index.js new file mode 100644 index 00000000..b8f34c9d --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/node/testing/index.js @@ -0,0 +1,72 @@ +"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 + */ +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.TempScopedNodeJsSyncHost = void 0; +const fs = __importStar(require("fs")); +const os = __importStar(require("os")); +const path = __importStar(require("path")); +const src_1 = require("../../src"); +const host_1 = require("../host"); +/** + * A Sync Scoped Host that creates a temporary directory and scope to it. + */ +class TempScopedNodeJsSyncHost extends src_1.virtualFs.ScopedHost { + constructor() { + const root = (0, src_1.normalize)(path.join(os.tmpdir(), `devkit-host-${+Date.now()}-${process.pid}`)); + fs.mkdirSync((0, src_1.getSystemPath)(root)); + super(new host_1.NodeJsSyncHost(), root); + this._root = root; + } + get files() { + const sync = this.sync; + function _visit(p) { + return sync + .list(p) + .map((fragment) => (0, src_1.join)(p, fragment)) + .reduce((files, path) => { + if (sync.isDirectory(path)) { + return files.concat(_visit(path)); + } + else { + return files.concat(path); + } + }, []); + } + return _visit((0, src_1.normalize)('/')); + } + get root() { + return this._root; + } + get sync() { + if (!this._sync) { + this._sync = new src_1.virtualFs.SyncDelegateHost(this); + } + return this._sync; + } +} +exports.TempScopedNodeJsSyncHost = TempScopedNodeJsSyncHost; diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/package.json b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/package.json new file mode 100644 index 00000000..cd10bc34 --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/package.json @@ -0,0 +1,46 @@ +{ + "name": "@angular-devkit/core", + "version": "13.2.5", + "description": "Angular DevKit - Core Utility Library", + "main": "src/index.js", + "typings": "src/index.d.ts", + "keywords": [ + "angular", + "Angular CLI", + "devkit", + "sdk", + "Angular DevKit", + "core" + ], + "dependencies": { + "ajv-formats": "2.1.1", + "ajv": "8.9.0", + "fast-json-stable-stringify": "2.1.0", + "magic-string": "0.25.7", + "rxjs": "6.6.7", + "source-map": "0.7.3" + }, + "peerDependencies": { + "chokidar": "^3.5.2" + }, + "peerDependenciesMeta": { + "chokidar": { + "optional": true + } + }, + "repository": { + "type": "git", + "url": "https://github.com/angular/angular-cli.git" + }, + "engines": { + "node": "^12.20.0 || ^14.15.0 || >=16.10.0", + "npm": "^6.11.0 || ^7.5.6 || >=8.0.0", + "yarn": ">= 1.13.0" + }, + "author": "Angular Authors", + "license": "MIT", + "bugs": { + "url": "https://github.com/angular/angular-cli/issues" + }, + "homepage": "https://github.com/angular/angular-cli" +} diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/analytics/api.d.ts b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/analytics/api.d.ts new file mode 100644 index 00000000..bb1f582d --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/analytics/api.d.ts @@ -0,0 +1,46 @@ +/** + * @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 + */ +export interface CustomDimensionsAndMetricsOptions { + dimensions?: (boolean | number | string)[]; + metrics?: (boolean | number | string)[]; +} +export interface EventOptions extends CustomDimensionsAndMetricsOptions { + label?: string; + value?: string; +} +export interface ScreenviewOptions extends CustomDimensionsAndMetricsOptions { + appVersion?: string; + appId?: string; + appInstallerId?: string; +} +export interface PageviewOptions extends CustomDimensionsAndMetricsOptions { + hostname?: string; + title?: string; +} +export interface TimingOptions extends CustomDimensionsAndMetricsOptions { + label?: string; +} +/** + * Interface for managing analytics. This is highly platform dependent, and mostly matches + * Google Analytics. The reason the interface is here is to remove the dependency to an + * implementation from most other places. + * + * The methods exported from this interface more or less match those needed by us in the + * universal analytics package, see https://unpkg.com/@types/universal-analytics@0.4.2/index.d.ts + * for typings. We mostly named arguments to make it easier to follow, but didn't change or + * add any semantics to those methods. They're mapping GA and u-a one for one. + * + * The Angular CLI (or any other kind of backend) should forward it to some compatible backend. + */ +export interface Analytics { + event(category: string, action: string, options?: EventOptions): void; + screenview(screenName: string, appName: string, options?: ScreenviewOptions): void; + pageview(path: string, options?: PageviewOptions): void; + timing(category: string, variable: string, time: string | number, options?: TimingOptions): void; + flush(): Promise<void>; +} diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/analytics/api.js b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/analytics/api.js new file mode 100644 index 00000000..b599b96d --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/analytics/api.js @@ -0,0 +1,9 @@ +"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 }); diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/analytics/forwarder.d.ts b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/analytics/forwarder.d.ts new file mode 100644 index 00000000..abe0b0e1 --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/analytics/forwarder.d.ts @@ -0,0 +1,67 @@ +/** + * @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 + */ +import { JsonObject } from '../json'; +import { Analytics, EventOptions, PageviewOptions, ScreenviewOptions, TimingOptions } from './api'; +export declare enum AnalyticsReportKind { + Event = "event", + Screenview = "screenview", + Pageview = "pageview", + Timing = "timing" +} +export interface AnalyticsReportBase extends JsonObject { + kind: AnalyticsReportKind; +} +export interface AnalyticsReportEvent extends AnalyticsReportBase { + kind: AnalyticsReportKind.Event; + options: JsonObject & EventOptions; + category: string; + action: string; +} +export interface AnalyticsReportScreenview extends AnalyticsReportBase { + kind: AnalyticsReportKind.Screenview; + options: JsonObject & ScreenviewOptions; + screenName: string; + appName: string; +} +export interface AnalyticsReportPageview extends AnalyticsReportBase { + kind: AnalyticsReportKind.Pageview; + options: JsonObject & PageviewOptions; + path: string; +} +export interface AnalyticsReportTiming extends AnalyticsReportBase { + kind: AnalyticsReportKind.Timing; + options: JsonObject & TimingOptions; + category: string; + variable: string; + time: string | number; +} +export declare type AnalyticsReport = AnalyticsReportEvent | AnalyticsReportScreenview | AnalyticsReportPageview | AnalyticsReportTiming; +/** + * A function that can forward analytics along some stream. AnalyticsReport is already a + * JsonObject descendant, but we force it here so the user knows it's safe to serialize. + */ +export declare type AnalyticsForwarderFn = (report: JsonObject & AnalyticsReport) => void; +/** + * A class that follows the Analytics interface and forwards analytic reports (JavaScript objects). + * AnalyticsReporter is the counterpart which takes analytic reports and report them to another + * Analytics interface. + */ +export declare class ForwardingAnalytics implements Analytics { + protected _fn: AnalyticsForwarderFn; + constructor(_fn: AnalyticsForwarderFn); + event(category: string, action: string, options?: EventOptions): void; + screenview(screenName: string, appName: string, options?: ScreenviewOptions): void; + pageview(path: string, options?: PageviewOptions): void; + timing(category: string, variable: string, time: string | number, options?: TimingOptions): void; + flush(): Promise<void>; +} +export declare class AnalyticsReporter { + protected _analytics: Analytics; + constructor(_analytics: Analytics); + report(report: AnalyticsReport): void; +} diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/analytics/forwarder.js b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/analytics/forwarder.js new file mode 100644 index 00000000..32ba65f5 --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/analytics/forwarder.js @@ -0,0 +1,88 @@ +"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.AnalyticsReporter = exports.ForwardingAnalytics = exports.AnalyticsReportKind = void 0; +var AnalyticsReportKind; +(function (AnalyticsReportKind) { + AnalyticsReportKind["Event"] = "event"; + AnalyticsReportKind["Screenview"] = "screenview"; + AnalyticsReportKind["Pageview"] = "pageview"; + AnalyticsReportKind["Timing"] = "timing"; +})(AnalyticsReportKind = exports.AnalyticsReportKind || (exports.AnalyticsReportKind = {})); +/** + * A class that follows the Analytics interface and forwards analytic reports (JavaScript objects). + * AnalyticsReporter is the counterpart which takes analytic reports and report them to another + * Analytics interface. + */ +class ForwardingAnalytics { + constructor(_fn) { + this._fn = _fn; + } + event(category, action, options) { + this._fn({ + kind: AnalyticsReportKind.Event, + category, + action, + options: { ...options }, + }); + } + screenview(screenName, appName, options) { + this._fn({ + kind: AnalyticsReportKind.Screenview, + screenName, + appName, + options: { ...options }, + }); + } + pageview(path, options) { + this._fn({ + kind: AnalyticsReportKind.Pageview, + path, + options: { ...options }, + }); + } + timing(category, variable, time, options) { + this._fn({ + kind: AnalyticsReportKind.Timing, + category, + variable, + time, + options: { ...options }, + }); + } + // We do not support flushing. + flush() { + return Promise.resolve(); + } +} +exports.ForwardingAnalytics = ForwardingAnalytics; +class AnalyticsReporter { + constructor(_analytics) { + this._analytics = _analytics; + } + report(report) { + switch (report.kind) { + case AnalyticsReportKind.Event: + this._analytics.event(report.category, report.action, report.options); + break; + case AnalyticsReportKind.Screenview: + this._analytics.screenview(report.screenName, report.appName, report.options); + break; + case AnalyticsReportKind.Pageview: + this._analytics.pageview(report.path, report.options); + break; + case AnalyticsReportKind.Timing: + this._analytics.timing(report.category, report.variable, report.time, report.options); + break; + default: + throw new Error('Unexpected analytics report: ' + JSON.stringify(report)); + } + } +} +exports.AnalyticsReporter = AnalyticsReporter; diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/analytics/index.d.ts b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/analytics/index.d.ts new file mode 100644 index 00000000..0a5adfb1 --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/analytics/index.d.ts @@ -0,0 +1,53 @@ +/** + * @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 + */ +export * from './api'; +export * from './forwarder'; +export * from './logging'; +export * from './multi'; +export * from './noop'; +/** + * MAKE SURE TO KEEP THIS IN SYNC WITH THE TABLE AND CONTENT IN `/docs/design/analytics.md`. + * WE LIST THOSE DIMENSIONS (AND MORE). + * + * These cannot be in their respective schema.json file because we either change the type + * (e.g. --buildEventLog is string, but we want to know the usage of it, not its value), or + * some validation needs to be done (we cannot record ng add --collection if it's not marked as + * allowed). + */ +export declare enum NgCliAnalyticsDimensions { + CpuCount = 1, + CpuSpeed = 2, + RamInGigabytes = 3, + NodeVersion = 4, + NgAddCollection = 6, + AotEnabled = 8, + BuildErrors = 20 +} +export declare enum NgCliAnalyticsMetrics { + NgComponentCount = 1, + UNUSED_2 = 2, + UNUSED_3 = 3, + UNUSED_4 = 4, + BuildTime = 5, + NgOnInitCount = 6, + InitialChunkSize = 7, + TotalChunkCount = 8, + TotalChunkSize = 9, + LazyChunkCount = 10, + LazyChunkSize = 11, + AssetCount = 12, + AssetSize = 13, + PolyfillSize = 14, + CssSize = 15 +} +export declare const NgCliAnalyticsDimensionsFlagInfo: { + [name: string]: [string, string]; +}; +export declare const NgCliAnalyticsMetricsFlagInfo: { + [name: string]: [string, string]; +}; diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/analytics/index.js b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/analytics/index.js new file mode 100644 index 00000000..ecf50ca5 --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/analytics/index.js @@ -0,0 +1,92 @@ +"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 + */ +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __exportStar = (this && this.__exportStar) || function(m, exports) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.NgCliAnalyticsMetricsFlagInfo = exports.NgCliAnalyticsDimensionsFlagInfo = exports.NgCliAnalyticsMetrics = exports.NgCliAnalyticsDimensions = void 0; +__exportStar(require("./api"), exports); +__exportStar(require("./forwarder"), exports); +__exportStar(require("./logging"), exports); +__exportStar(require("./multi"), exports); +__exportStar(require("./noop"), exports); +/** + * MAKE SURE TO KEEP THIS IN SYNC WITH THE TABLE AND CONTENT IN `/docs/design/analytics.md`. + * WE LIST THOSE DIMENSIONS (AND MORE). + * + * These cannot be in their respective schema.json file because we either change the type + * (e.g. --buildEventLog is string, but we want to know the usage of it, not its value), or + * some validation needs to be done (we cannot record ng add --collection if it's not marked as + * allowed). + */ +var NgCliAnalyticsDimensions; +(function (NgCliAnalyticsDimensions) { + NgCliAnalyticsDimensions[NgCliAnalyticsDimensions["CpuCount"] = 1] = "CpuCount"; + NgCliAnalyticsDimensions[NgCliAnalyticsDimensions["CpuSpeed"] = 2] = "CpuSpeed"; + NgCliAnalyticsDimensions[NgCliAnalyticsDimensions["RamInGigabytes"] = 3] = "RamInGigabytes"; + NgCliAnalyticsDimensions[NgCliAnalyticsDimensions["NodeVersion"] = 4] = "NodeVersion"; + NgCliAnalyticsDimensions[NgCliAnalyticsDimensions["NgAddCollection"] = 6] = "NgAddCollection"; + NgCliAnalyticsDimensions[NgCliAnalyticsDimensions["AotEnabled"] = 8] = "AotEnabled"; + NgCliAnalyticsDimensions[NgCliAnalyticsDimensions["BuildErrors"] = 20] = "BuildErrors"; +})(NgCliAnalyticsDimensions = exports.NgCliAnalyticsDimensions || (exports.NgCliAnalyticsDimensions = {})); +var NgCliAnalyticsMetrics; +(function (NgCliAnalyticsMetrics) { + NgCliAnalyticsMetrics[NgCliAnalyticsMetrics["NgComponentCount"] = 1] = "NgComponentCount"; + NgCliAnalyticsMetrics[NgCliAnalyticsMetrics["UNUSED_2"] = 2] = "UNUSED_2"; + NgCliAnalyticsMetrics[NgCliAnalyticsMetrics["UNUSED_3"] = 3] = "UNUSED_3"; + NgCliAnalyticsMetrics[NgCliAnalyticsMetrics["UNUSED_4"] = 4] = "UNUSED_4"; + NgCliAnalyticsMetrics[NgCliAnalyticsMetrics["BuildTime"] = 5] = "BuildTime"; + NgCliAnalyticsMetrics[NgCliAnalyticsMetrics["NgOnInitCount"] = 6] = "NgOnInitCount"; + NgCliAnalyticsMetrics[NgCliAnalyticsMetrics["InitialChunkSize"] = 7] = "InitialChunkSize"; + NgCliAnalyticsMetrics[NgCliAnalyticsMetrics["TotalChunkCount"] = 8] = "TotalChunkCount"; + NgCliAnalyticsMetrics[NgCliAnalyticsMetrics["TotalChunkSize"] = 9] = "TotalChunkSize"; + NgCliAnalyticsMetrics[NgCliAnalyticsMetrics["LazyChunkCount"] = 10] = "LazyChunkCount"; + NgCliAnalyticsMetrics[NgCliAnalyticsMetrics["LazyChunkSize"] = 11] = "LazyChunkSize"; + NgCliAnalyticsMetrics[NgCliAnalyticsMetrics["AssetCount"] = 12] = "AssetCount"; + NgCliAnalyticsMetrics[NgCliAnalyticsMetrics["AssetSize"] = 13] = "AssetSize"; + NgCliAnalyticsMetrics[NgCliAnalyticsMetrics["PolyfillSize"] = 14] = "PolyfillSize"; + NgCliAnalyticsMetrics[NgCliAnalyticsMetrics["CssSize"] = 15] = "CssSize"; +})(NgCliAnalyticsMetrics = exports.NgCliAnalyticsMetrics || (exports.NgCliAnalyticsMetrics = {})); +// This table is used when generating the analytics.md file. It should match the enum above +// or the validate-user-analytics script will fail. +exports.NgCliAnalyticsDimensionsFlagInfo = { + CpuCount: ['CPU Count', 'number'], + CpuSpeed: ['CPU Speed', 'number'], + RamInGigabytes: ['RAM (In GB)', 'number'], + NodeVersion: ['Node Version', 'number'], + NgAddCollection: ['--collection', 'string'], + AotEnabled: ['AOT Enabled', 'boolean'], + BuildErrors: ['Build Errors (comma separated)', 'string'], +}; +// This table is used when generating the analytics.md file. It should match the enum above +// or the validate-user-analytics script will fail. +exports.NgCliAnalyticsMetricsFlagInfo = { + NgComponentCount: ['NgComponentCount', 'number'], + UNUSED_2: ['UNUSED_2', 'none'], + UNUSED_3: ['UNUSED_3', 'none'], + UNUSED_4: ['UNUSED_4', 'none'], + BuildTime: ['Build Time', 'number'], + NgOnInitCount: ['NgOnInit Count', 'number'], + InitialChunkSize: ['Initial Chunk Size', 'number'], + TotalChunkCount: ['Total Chunk Count', 'number'], + TotalChunkSize: ['Total Chunk Size', 'number'], + LazyChunkCount: ['Lazy Chunk Count', 'number'], + LazyChunkSize: ['Lazy Chunk Size', 'number'], + AssetCount: ['Asset Count', 'number'], + AssetSize: ['Asset Size', 'number'], + PolyfillSize: [' Polyfill Size', 'number'], + CssSize: [' Css Size', 'number'], +}; diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/analytics/logging.d.ts b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/analytics/logging.d.ts new file mode 100644 index 00000000..675c962b --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/analytics/logging.d.ts @@ -0,0 +1,22 @@ +/** + * @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 + */ +import { Logger } from '../logger'; +import { Analytics, EventOptions, PageviewOptions, ScreenviewOptions, TimingOptions } from './api'; +/** + * Analytics implementation that logs analytics events to a logger. This should be used for + * debugging mainly. + */ +export declare class LoggingAnalytics implements Analytics { + protected _logger: Logger; + constructor(_logger: Logger); + event(category: string, action: string, options?: EventOptions): void; + screenview(screenName: string, appName: string, options?: ScreenviewOptions): void; + pageview(path: string, options?: PageviewOptions): void; + timing(category: string, variable: string, time: string | number, options?: TimingOptions): void; + flush(): Promise<void>; +} diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/analytics/logging.js b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/analytics/logging.js new file mode 100644 index 00000000..7bd70c77 --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/analytics/logging.js @@ -0,0 +1,35 @@ +"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.LoggingAnalytics = void 0; +/** + * Analytics implementation that logs analytics events to a logger. This should be used for + * debugging mainly. + */ +class LoggingAnalytics { + constructor(_logger) { + this._logger = _logger; + } + event(category, action, options) { + this._logger.info('event ' + JSON.stringify({ category, action, ...options })); + } + screenview(screenName, appName, options) { + this._logger.info('screenview ' + JSON.stringify({ screenName, appName, ...options })); + } + pageview(path, options) { + this._logger.info('pageview ' + JSON.stringify({ path, ...options })); + } + timing(category, variable, time, options) { + this._logger.info('timing ' + JSON.stringify({ category, variable, time, ...options })); + } + flush() { + return Promise.resolve(); + } +} +exports.LoggingAnalytics = LoggingAnalytics; diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/analytics/multi.d.ts b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/analytics/multi.d.ts new file mode 100644 index 00000000..6451b7e9 --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/analytics/multi.d.ts @@ -0,0 +1,21 @@ +/** + * @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 + */ +import { Analytics, EventOptions, PageviewOptions, ScreenviewOptions, TimingOptions } from './api'; +/** + * Analytics implementation that reports to multiple analytics backend. + */ +export declare class MultiAnalytics implements Analytics { + protected _backends: Analytics[]; + constructor(_backends?: Analytics[]); + push(...backend: Analytics[]): void; + event(category: string, action: string, options?: EventOptions): void; + screenview(screenName: string, appName: string, options?: ScreenviewOptions): void; + pageview(path: string, options?: PageviewOptions): void; + timing(category: string, variable: string, time: string | number, options?: TimingOptions): void; + flush(): Promise<void>; +} diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/analytics/multi.js b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/analytics/multi.js new file mode 100644 index 00000000..2cdf2a1b --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/analytics/multi.js @@ -0,0 +1,37 @@ +"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.MultiAnalytics = void 0; +/** + * Analytics implementation that reports to multiple analytics backend. + */ +class MultiAnalytics { + constructor(_backends = []) { + this._backends = _backends; + } + push(...backend) { + this._backends.push(...backend); + } + event(category, action, options) { + this._backends.forEach((be) => be.event(category, action, options)); + } + screenview(screenName, appName, options) { + this._backends.forEach((be) => be.screenview(screenName, appName, options)); + } + pageview(path, options) { + this._backends.forEach((be) => be.pageview(path, options)); + } + timing(category, variable, time, options) { + this._backends.forEach((be) => be.timing(category, variable, time, options)); + } + flush() { + return Promise.all(this._backends.map((x) => x.flush())).then(() => { }); + } +} +exports.MultiAnalytics = MultiAnalytics; diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/analytics/noop.d.ts b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/analytics/noop.d.ts new file mode 100644 index 00000000..6a83054e --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/analytics/noop.d.ts @@ -0,0 +1,18 @@ +/** + * @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 + */ +import { Analytics } from './api'; +/** + * Analytics implementation that does nothing. + */ +export declare class NoopAnalytics implements Analytics { + event(): void; + screenview(): void; + pageview(): void; + timing(): void; + flush(): Promise<void>; +} diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/analytics/noop.js b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/analytics/noop.js new file mode 100644 index 00000000..9581cfce --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/analytics/noop.js @@ -0,0 +1,23 @@ +"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.NoopAnalytics = void 0; +/** + * Analytics implementation that does nothing. + */ +class NoopAnalytics { + event() { } + screenview() { } + pageview() { } + timing() { } + flush() { + return Promise.resolve(); + } +} +exports.NoopAnalytics = NoopAnalytics; diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/exception/exception.d.ts b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/exception/exception.d.ts new file mode 100644 index 00000000..eebad547 --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/exception/exception.d.ts @@ -0,0 +1,40 @@ +/** + * @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 + */ +export declare class BaseException extends Error { + constructor(message?: string); +} +export declare class UnknownException extends BaseException { + constructor(message: string); +} +export declare class FileDoesNotExistException extends BaseException { + constructor(path: string); +} +export declare class FileAlreadyExistException extends BaseException { + constructor(path: string); +} +export declare class PathIsDirectoryException extends BaseException { + constructor(path: string); +} +export declare class PathIsFileException extends BaseException { + constructor(path: string); +} +export declare class ContentHasMutatedException extends BaseException { + constructor(path: string); +} +export declare class InvalidUpdateRecordException extends BaseException { + constructor(); +} +export declare class MergeConflictException extends BaseException { + constructor(path: string); +} +export declare class UnimplementedException extends BaseException { + constructor(); +} +export declare class UnsupportedPlatformException extends BaseException { + constructor(); +} diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/exception/exception.js b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/exception/exception.js new file mode 100644 index 00000000..f7427d28 --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/exception/exception.js @@ -0,0 +1,77 @@ +"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.UnsupportedPlatformException = exports.UnimplementedException = exports.MergeConflictException = exports.InvalidUpdateRecordException = exports.ContentHasMutatedException = exports.PathIsFileException = exports.PathIsDirectoryException = exports.FileAlreadyExistException = exports.FileDoesNotExistException = exports.UnknownException = exports.BaseException = void 0; +class BaseException extends Error { + constructor(message = '') { + super(message); + } +} +exports.BaseException = BaseException; +class UnknownException extends BaseException { + constructor(message) { + super(message); + } +} +exports.UnknownException = UnknownException; +// Exceptions +class FileDoesNotExistException extends BaseException { + constructor(path) { + super(`Path "${path}" does not exist.`); + } +} +exports.FileDoesNotExistException = FileDoesNotExistException; +class FileAlreadyExistException extends BaseException { + constructor(path) { + super(`Path "${path}" already exist.`); + } +} +exports.FileAlreadyExistException = FileAlreadyExistException; +class PathIsDirectoryException extends BaseException { + constructor(path) { + super(`Path "${path}" is a directory.`); + } +} +exports.PathIsDirectoryException = PathIsDirectoryException; +class PathIsFileException extends BaseException { + constructor(path) { + super(`Path "${path}" is a file.`); + } +} +exports.PathIsFileException = PathIsFileException; +class ContentHasMutatedException extends BaseException { + constructor(path) { + super(`Content at path "${path}" has changed between the start and the end of an update.`); + } +} +exports.ContentHasMutatedException = ContentHasMutatedException; +class InvalidUpdateRecordException extends BaseException { + constructor() { + super(`Invalid record instance.`); + } +} +exports.InvalidUpdateRecordException = InvalidUpdateRecordException; +class MergeConflictException extends BaseException { + constructor(path) { + super(`A merge conflicted on path "${path}".`); + } +} +exports.MergeConflictException = MergeConflictException; +class UnimplementedException extends BaseException { + constructor() { + super('This function is unimplemented.'); + } +} +exports.UnimplementedException = UnimplementedException; +class UnsupportedPlatformException extends BaseException { + constructor() { + super('This platform is not supported by this code path.'); + } +} +exports.UnsupportedPlatformException = UnsupportedPlatformException; diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/exception/index.d.ts b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/exception/index.d.ts new file mode 100644 index 00000000..38889c9c --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/exception/index.d.ts @@ -0,0 +1,8 @@ +/** + * @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 + */ +export * from './exception'; diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/exception/index.js b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/exception/index.js new file mode 100644 index 00000000..85d75d5a --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/exception/index.js @@ -0,0 +1,20 @@ +"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 + */ +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __exportStar = (this && this.__exportStar) || function(m, exports) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +__exportStar(require("./exception"), exports); diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/experimental.d.ts b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/experimental.d.ts new file mode 100644 index 00000000..458c6980 --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/experimental.d.ts @@ -0,0 +1,9 @@ +/** + * @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 + */ +import * as jobs from './experimental/jobs/index'; +export { jobs }; diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/experimental.js b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/experimental.js new file mode 100644 index 00000000..40c4b31a --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/experimental.js @@ -0,0 +1,31 @@ +"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 + */ +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.jobs = void 0; +const jobs = __importStar(require("./experimental/jobs/index")); +exports.jobs = jobs; diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/experimental/jobs/README.md b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/experimental/jobs/README.md new file mode 100644 index 00000000..ebb0f90a --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/experimental/jobs/README.md @@ -0,0 +1,510 @@ +# Description + +Jobs is the Angular DevKit subsystem for scheduling and running generic functions with clearly +typed inputs and outputs. A `Job` instance is a function associated with metadata. You can +schedule a job, synchronize it with other jobs, and use it to schedule other jobs. + +The whole API is serializable, allowing you to use a Node Stream or message channel to +communicate between the job and the job scheduler. + +Jobs are lazy, cold, and guaranteed to execute exactly once when scheduled. Subscribing to a job +returns messages from the point where the job is at. + +## Argument, Input, Output and Channels + +A job receives a single argument when scheduled and can also listen to an input channel. It can +emit multiple outputs, and can also provide multiple output channels that emit asynchronous JSON +messages, which can be typed. + +The I/O model is like that of an executable, where the argument corresponds to arguments on the +command line, the input channel to STDIN, the output channel to STDOUT, and the channels +would be additional output streams. + +## LifeCycle + +A `Job` goes through multiple LifeCycle messages before its completion; + +1. `JobState.Queued`. The job was queued and is waiting. This is the default state from the + scheduler. +1. `JobState.Ready`. The job's dependencies (see + ["Synchronizing and Dependencies"](#Dependencies)) are done running, the argument is + validated, and the job is ready to execute. +1. `JobState.Started`. The argument has been validated, the job has been called and is running. + This is handled by the job itself (or `createJobHandler()`). +1. `JobState.Ended`. The job has ended and is done running. This is handled by the job itself (or + `createJobHandler()`). +1. `JobState.Errored`. A unrecoverable error happened. + +Each state (except `Queued`) corresponds to a `JobOutboundMessage` on the `outboundBus` observable +that triggers the state change. The `Scheduler` emits the `Ready` and `Errored` messages; the job +implementation should not emit them, and if it does they are filtered out. You can listen for +these messages or use the corresponding state member. + +The job implementation should emit the `Start` and `End` messages when it is starting the job logic +itself. Only the first `Start` and `End` messages will be forwarded. Any more will be filtered out. + +The `Queued` state is set as the job is scheduled, so there is no need to listen for the message. + +## `Job<OutputType>` Object + +The `Job` object that is returned when you schedule a job provides access to the job's status and +utilities for tracking and modifying the job. + +1. `id`. A unique symbol that can be used as a Map key. +1. `description`. The description of the job from the scheduler. See `JobDescription` object. +1. `argument`. The argument value that was used to start the job. +1. `input`. An `Observer` that can be used to send validated inputs to the job itself. +1. `output`. An `Observable<OutputType>` that filters out messages to get only the returned output + of a job. +1. `promise`. A promise that waits for the last output of a job. Returns the last value outputted + (or no value if there's no last value). +1. `state`. The current state of the job (see `LifeCycle`). +1. `channels`. A map of side channels the user can listen to as `Observable`. +1. `ping()`. A function that can be used to ping the job, receiving a `Promise` for when the ping + is answered. +1. `stop()`. Sends a `stop` input to the job, which suggests to stop the job. The job itself can + choose to ignore this message. +1. `inboundBus`. The raw input `Observer<JobInboundMessage>`. This can be used to send messages to + the `context.inboundBus` observable in the job. These are `JobInboundMessage` messages. See + ["Communicating With Jobs"](#Communicating). +1. `outboundBus`. The raw output `Observable<JobOutput>`. This can be used to listen to messages + from the job. See ["Communicating With Jobs"](#Communicating). + +## `JobHandlerContext<I, O>` Object + +The `JobHandlerContext<>` is passed to the job handler code in addition to its argument. The +context contains the following members: + +1. `description`. The description of the job. Its name and schemas. +1. `scheduler`. A `Scheduler<>` instance that can be used to create additional jobs. +1. `dependencies`. A generic list of other job instances that were run as dependencies when + scheduling this job. Their `id` is not guaranteed to match the `id` of the `Job<>` instance + itself (those `Job<>`s might just be proxies). The state of those `Job<>` is guaranteed to be + `JobState.Ended`, as `JobState.Errored` would have prevented this handler from running. +1. `inboundBus`. The raw input observable, complement of the `inboundBus` observer from the `Job<>`. + +# Examples + +An example of a job that adds all input together and return the output value. We use a +simple synchronous job registry and a simple job scheduler. + +```typescript +import { jobs } from '@angular-devkit/core'; + +const add = jobs.createJobHandle<number[], number>((input) => + input.reduce((total, curr) => total + curr, 0), +); + +// Register the job in a SimpleJobRegistry. Different registries have different API. +const registry = new jobs.SimpleJobRegistry(); +const scheduler = new jobs.SimpleScheduler(registry); +registry.register(add, { + name: 'add', + input: { type: 'array', items: { type: 'number' } }, + output: { type: 'number' }, +}); + +scheduler + .schedule('add', [1, 2, 3, 4]) + .promise.then((output) => console.log('1 + 2 + 3 + 4 is ' + output)); +``` + +# Creating Jobs + +A job is at its core a function with a description object attached to it. The description object +stores the JSON schemas used to validate the types of the argument passed in, the input and +output values. By default, a job accepts and can output any JSON object. + +```typescript +import { Observable } from 'rxjs'; +import { jobs } from '@angular-devkit/core'; + +const argument = { + type: 'array', + items: { type: 'number' }, +}; +const output = { + type: 'number', +}; + +export function add(argument: number[]): Observable<jobs.JobOutboundMessage<number>> { + return new Observable((o) => { + o.next({ kind: jobs.JobOutboundMessageKind.Start }); + o.next({ + kind: jobs.JobOutboundMessageKind.Output, + output: argument.reduce((total, curr) => total + curr, 0), + }); + o.next({ kind: jobs.JobOutboundMessageKind.End }); + o.complete(); + }); +} + +// Add a property to `add` to make it officially a JobHandler. The Job system does not recognize +// any function as a JobHandler. +add.jobDescription = { + argument: argument, + output: output, +}; + +// Call the job with an array as argument, and log its output. +declare const scheduler: jobs.Scheduler; +scheduler.schedule('add', [1, 2, 3, 4]).output.subscribe((x) => console.log(x)); // Will output 10. +``` + +This is a lot of boilerplate, so we made some helpers to improve readability and manage argument, +input and output automatically: + +```typescript +// Add is a JobHandler function, like the above. +export const add = jobs.createJobHandler<number[], number>((argument) => + argument.reduce((total, curr) => total + curr, 0), +); + +// Schedule like above. +``` + +You can also return a Promise or an Observable, as jobs are asynchronous. This helper will set +start and end messages appropriately. It will also manage channels automatically (see below). + +A more complex job can be declared like this: + +```typescript +import { Observable } from 'rxjs'; +import { jobs } from '@angular-devkit/core'; + +// Show progress with each count in a separate output channel. Output "more" in a channel. +export const count = jobs.createJobHandler<number, number>( + // Receive a context that contains additional methods to create channels. + (argument: number, { createChannel }) => + new Observable<number>((o) => { + const side = createChannel('side', { type: 'string', const: 'more' }); + const progress = createChannel('progress', { type: 'number' }); + let i = 0; + function doCount() { + o.next(i++); + progress.next(i / argument); + side.next('more'); + + if (i < argument) { + setTimeout(doCount, 100); + } else { + o.complete(); + } + } + setTimeout(doCount, 100); + }), + { + argument: { type: 'number' }, + output: { type: 'number' }, + }, +); + +// Get a hold of a scheduler that refers to the job above. +declare const scheduler: jobs.Scheduler; + +const job = scheduler.schedule('count', 0); +job.getChannel('side').subscribe((x) => console.log(x)); +// You can type a channel too. Messages will be filtered out. +job + .getChannel<number>('progress', { type: 'number' }) + .subscribe((x) => console.log(x)); +``` + +## <a name="Communicating"></a>Communicating With Jobs + +Jobs can be started and updated in a separate process or thread, and as such communication with a +job should avoid using global objects (which might not be shared). The jobs API and schedulers +provide 2 communication streams (one for input and the other for output), named `inboundBus` and +`outboundBus`. + +### Raw Input Stream + +The `schedule()` function returns a `Job<>` interface that contains a `inboundBus` member of type +`Observer<JobInboundMessage>`. All messages sent _to_ the job goes through this stream. The `kind` +member of the `JobInboundMessage` interface dictates what kind of message it is sending: + +1. `JobInboundMessageKind.Ping`. A simple message that should be answered with + `JobOutboundMessageKind.Pong` when the job is responsive. The `id` field of the message should + be used when returning `Pong`. +1. `JobInboundMessageKind.Stop`. The job should be stopped. This is used when + cancelling/unsubscribing from the `output` (or by calling `stop()`). Any inputs or outputs + after this message will be ignored. +1. `JobInboundMessageKind.Input` is used when sending inputs to a job. These correspond to the + `next` methods of an `Observer` and are reported to the job through its `context.input` + Observable. There is no way to communicate an error to the job. + +Using the `createJobHandler()` helper, all those messages are automatically handled by the +boilerplate code. If you need direct access to raw inputs, you should subscribe to the +`context.inboundBus` Observable. + +### Raw Output Stream + +The `Job<>` interface also contains a `outboundBus` member (of type +`Observable<JobOutboundMessage<O>>` where `O` is the typed output of the job) which is the output +complement of `inboundBus`. All messages sent _from_ the job goes through this stream. The `kind` +member of the `JobOutboundMessage<O>` interface dictates what kind of message it is sending: + +1. `JobOutboundMessageKind.Create`. The `Job<>` was created, its dependencies are done, and the + library is validating Argument and calling the internal job code. +1. `JobOutboundMessageKind.Start`. The job code itself should send that message when started. + `createJobHandler()` will do it automatically. +1. `JobOutboundMessageKind.End`. The job has ended. This is done by the job itself and should always + be sent when completed. The scheduler will listen to this message to set the state and unblock + dependent jobs. `createJobHandler()` automatically send this message. +1. `JobOutboundMessageKind.Pong`. The job should answer a `JobInboundMessageKind.Ping` message with + this. Automatically done by `createJobHandler()`. +1. `JobOutboundMessageKind.Output`. An `Output` has been generated by the job. +1. `JobOutboundMessageKind.ChannelMessage`, `JobOutboundMessageKind.ChannelError` and + `JobOutboundMessageKind.ChannelComplete` are used for output channels. These correspond to the + `next`, `error` and `complete` methods of an `Observer` and are available to the callee through + the `job.channels` map of Observable. + +Those messages can be accessed directly through the `job.outboundBus` member. The job itself should +return an `Observable<JobOutboundMessage<O>>`. The `createJobHandler()` helper handles most of use +cases of this and makes it easier for jobs to handle this. + +## Job Dispatchers + +Dispatchers are a helper that redirect to different jobs given conditions. To create a job +dispatcher, use the `createDispatcher()` function: + +```typescript +import { jobs } from '@angular-devkit/core'; + +// A dispatcher that installs node modules given a user's preference. +const dispatcher = jobs.createDispatcher({ + name: 'node-install', + argument: { properties: { moduleName: { type: 'string' } } }, + output: { type: 'boolean' }, +}); + +const npmInstall = jobs.createJobHandler(/* ... */, { name: 'npm-install' }); +const yarnInstall = jobs.createJobHandler(/* ... */, { name: 'yarn-install' }); +const pnpmInstall = jobs.createJobHandler(/* ... */, { name: 'pnpm-install' }); + +declare const registry: jobs.SimpleJobRegistry; +registry.register(dispatcher); +registry.register(npmInstall); +registry.register(yarnInstall); +registry.register(pnpmInstall); + +// Default to npm. +dispatcher.setDefaultDelegate(npmInstall.name); +// If the user is asking for yarn over npm, uses it. +dispatcher.addConditionalDelegate(() => userWantsYarn, yarnInstall.name); +``` + +## Execution Strategy + +Jobs are always run in parallel and will always start, but many helper functions are provided +when creating a job to help you control the execution strategy; + +1. `serialize()`. Multiple runs of this job will be queued with each others. +1. `memoize(replayMessages = false)` will create a job, or reuse the same job when inputs are + matching. If the inputs don't match, a new job will be started and its outputs will be stored. + +These strategies can be used when creating the job: + +```typescript +// Same input and output as above. + +export const add = jobs.strategy.memoize()( + jobs.createJobHandler<number[], number>((argument) => + argument.reduce((total, curr) => total + curr, 0), + ), +); +``` + +Strategies can be reused to synchronize between jobs. For example, given jobs `jobA` and `jobB`, +you can reuse the strategy to serialize both jobs together; + +```typescript +const strategy = jobs.strategy.serialize(); +const jobA = strategy(jobs.createJobHandler(...)); +const jobB = strategy(jobs.createJobHandler(...)); +``` + +Even further, we can have package A and package B run in serialization, and B and C also be +serialized. Running A and C will run in parallel, while running B will wait for both A and C +to finish. + +```typescript +const strategy1 = jobs.strategy.serialize(); +const strategy2 = jobs.strategy.serialize(); +const jobA = strategy1(jobs.createJobHandler(...)); +const jobB = strategy1(strategy2(jobs.createJobHandler(...))); +const jobC = strategy2(jobs.createJobHandler(...)); +``` + +# Scheduling Jobs + +Jobs can be scheduled using a `Scheduler` interface, which contains a `schedule()` method: + +```typescript +interface Scheduler { + /** + * Schedule a job to be run, using its name. + * @param name The name of job to be run. + * @param argument The argument to send to the job when starting it. + * @param options Scheduling options. + * @returns The Job being run. + */ + schedule<I extends MinimumInputValueT, O extends MinimumOutputValueT>( + name: JobName, + argument: I, + options?: ScheduleJobOptions, + ): Job<JsonValue, O>; +} +``` + +The scheduler also has a `getDescription()` method to get a `JobDescription` object for a certain +name; that description contains schemas for the argument, input, output, and other channels: + +```typescript +interface Scheduler { + /** + * Get a job description for a named job. + * + * @param name The name of the job. + * @returns A description, or null if the job cannot be scheduled. + */ + getDescription(name: JobName): JobDescription | null; + + /** + * Returns true if the job name has been registered. + * @param name The name of the job. + * @returns True if the job exists, false otherwise. + */ + has(name: JobName): boolean; +} +``` + +Finally, the scheduler interface has a `pause()` method to stop scheduling. This will queue all +jobs and wait for the unpause function to be called before unblocking all the jobs scheduled. +This does not affect already running jobs. + +```typescript +interface Scheduler { + /** + * 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. + */ + pause(): () => void; +} +``` + +## <a name="Dependencies"></a>Synchronizing and Dependencies + +When scheduling jobs, it is often necessary to run jobs after certain other jobs are finished. +This is done through the `dependencies` options in the `schedule()` method. + +These jobs will also be passed to the job being scheduled, through its context. This can be +useful if, for example, the output of those jobs are of a known type, or have known side channels. + +An example of this would be a compiler that needs to know the output directory of other compilers +before it, in a tool chain. + +### Dependencies + +When scheduling jobs, the user can add a `dependencies` field to the scheduling options. The +scheduler will wait for those dependencies to finish before running the job, and pass those jobs +in the context of the job. + +### Accessing Dependencies + +Jobs are called with a `JobHandlerContext` as a second argument, which contains a +`dependencies: Job<JsonValue>[]` member which contains all dependencies that were used when +scheduling the job. Those aren't fully typed as they are determined by the user, and not the job +itself. They also can contain jobs that are not finished, and the job should use the `state` +member of the job itself before trying to access its content. + +### Scheduler Sub Jobs + +The `JobHandlerContext` also contains a `scheduler` member which can be used to schedule jobs +using the same scheduler that was used for the job. This allows jobs to call other jobs +and wait for them to end. + +## Available Schedulers + +The Core Angular DevKit library provides 2 implementations for the `Scheduler` interface: + +## SimpleJobRegistry + +Available in the jobs namespace. A registry that accept job registration, and can also schedule +jobs. + +```typescript +import { jobs } from '@angular-devkit/core'; + +const add = jobs.createJobHandler<number[], number>((argument) => + argument.reduce((total, curr) => total + curr, 0), +); + +// Register the job in a SimpleJobRegistry. Different registries have different API. +const registry = new jobs.SimpleJobRegistry(); +const scheduler = new SimpleJobScheduler(registry); + +registry.register(add, { + name: 'add', + argument: { type: 'array', items: { type: 'number' } }, + output: { type: 'number' }, +}); + +scheduler.schedule('add', [1, 2, 3, 4]); +``` + +## NodeModuleJobRegistry + +Available through `@angular-devkit/core/node`. + +A scheduler that loads jobs using their node package names. These jobs need to use the +`createJobHandler()` helper and report their argument/input/output schemas that way. + +```typescript +declare const registry: NodeModuleJobRegistry; +const scheduler = new SimpleJobScheduler(registry); + +scheduler.schedule('some-node-package#someExport', 'input'); +``` + +# Gotchas + +1. Deadlocking Dependencies + It is impossible to add dependencies to an already running job, but it is entirely possible to + get locked between jobs. Be aware of your own dependencies. + +1. Using `job.promise` + `job.promise` waits for the job to ends. Don't rely on it unless you know the job is not + watching and running for a long time. If you aren't sure, use + `job.output.pipe(first()).toPromise()` instead which will return the first next output, + regardless of whether the job watches and rerun or not. + +# FAQ + +1. Laziness + A job is lazy until executed, but its messages will be replayed when resubscribed. + +1. Serialize Strategy vs Dependencies + Strategies are functions that transform the execution of a job, and can be used when + declaring the job, or registering it. Dependencies, on the other hand, are listed when + scheduling a job to order jobs during scheduling. + + A job has no control over the way it's scheduled, and its dependencies. It can, however, + declare that it shouldn't run at the same time as itself. Alternatively, a user could + schedule a job twice and imply that the second run should wait for the first to finish. In + practice, this would be equivalent to having the job be serialized, but the important detail + is in _whom_ is defining the rules; using the `serialize()` strategy, the job implementation + is, while when using dependencies, the user is. + + The user does not need to know how to job needs to synchronize with itself, and the job does + not need to know how it synchronizes with other jobs that it doesn't know about. That's part + of the strength of this system as every job can be developed in a vacuum, only caring about + its contracts (argument, input and output) and its own synchronization. diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/experimental/jobs/api.d.ts b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/experimental/jobs/api.d.ts new file mode 100644 index 00000000..7c882e58 --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/experimental/jobs/api.d.ts @@ -0,0 +1,332 @@ +/** + * @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 + */ +import { Observable, Observer } from 'rxjs'; +import { JsonObject, JsonValue, schema } from '../../json/index'; +import { DeepReadonly } from '../../utils/index'; +/** + * A job name is just a string (needs to be serializable). + */ +export declare type JobName = string; +/** + * The job handler function, which is a method that's executed for the job. + */ +export interface JobHandler<ArgT extends JsonValue, InputT extends JsonValue, OutputT extends JsonValue> { + (argument: ArgT, context: JobHandlerContext<ArgT, InputT, OutputT>): Observable<JobOutboundMessage<OutputT>>; + jobDescription: Partial<JobDescription>; +} +/** + * The context in which the job is run. + */ +export interface JobHandlerContext<MinimumArgumentValueT extends JsonValue = JsonValue, MinimumInputValueT extends JsonValue = JsonValue, MinimumOutputValueT extends JsonValue = JsonValue> { + readonly description: JobDescription; + readonly scheduler: Scheduler<JsonValue, JsonValue, JsonValue>; + readonly dependencies: Job<JsonValue, JsonValue, JsonValue>[]; + readonly inboundBus: Observable<JobInboundMessage<MinimumInputValueT>>; +} +/** + * Metadata associated with a job. + */ +export interface JobDescription extends JsonObject { + readonly name: JobName; + readonly argument: DeepReadonly<schema.JsonSchema>; + readonly input: DeepReadonly<schema.JsonSchema>; + readonly output: DeepReadonly<schema.JsonSchema>; +} +/** + * Messages that can be sent TO a job. The job needs to listen to those. + */ +export declare enum JobInboundMessageKind { + Ping = "ip", + Stop = "is", + Input = "in" +} +/** Base interface for the all job inbound messages. */ +export interface JobInboundMessageBase extends JsonObject { + /** + * The kind of message this is. + */ + readonly kind: JobInboundMessageKind; +} +/** + * A ping to the job. The job should reply with a pong as soon as possible. + */ +export interface JobInboundMessagePing extends JobInboundMessageBase { + readonly kind: JobInboundMessageKind.Ping; + /** + * An ID that should be returned in the corresponding Pong. + */ + readonly id: number; +} +/** + * 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. + */ +export interface JobInboundMessageStop extends JobInboundMessageBase { + readonly kind: JobInboundMessageKind.Stop; +} +/** + * 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. + */ +export interface JobInboundMessageInput<InputT extends JsonValue> extends JobInboundMessageBase { + readonly kind: JobInboundMessageKind.Input; + /** + * The input being sent to the job. + */ + readonly value: InputT; +} +export declare type JobInboundMessage<InputT extends JsonValue> = JobInboundMessagePing | JobInboundMessageStop | JobInboundMessageInput<InputT>; +/** + * Kind of messages that can be outputted from a job. + */ +export declare enum JobOutboundMessageKind { + OnReady = "c", + Start = "s", + End = "e", + Pong = "p", + Output = "o", + ChannelCreate = "cn", + ChannelMessage = "cm", + ChannelError = "ce", + ChannelComplete = "cc" +} +/** Base interface for the all job messages. */ +export interface JobOutboundMessageBase { + /** + * The job description. + */ + readonly description: JobDescription; + /** + * The kind of message this is. + */ + readonly kind: JobOutboundMessageKind; +} +/** + * The job has been created and will validate its input. + */ +export interface JobOutboundMessageOnReady extends JobOutboundMessageBase { + readonly kind: JobOutboundMessageKind.OnReady; +} +/** + * The job started. This is done by the job itself. + */ +export interface JobOutboundMessageStart extends JobOutboundMessageBase { + readonly kind: JobOutboundMessageKind.Start; +} +/** + * An output value is available. + */ +export interface JobOutboundMessageOutput<OutputT extends JsonValue> extends JobOutboundMessageBase { + readonly kind: JobOutboundMessageKind.Output; + /** + * The message being outputted from the job. + */ + readonly value: OutputT; +} +/** + * Base interface for all job message related to channels. + */ +export interface JobOutboundMessageChannelBase extends JobOutboundMessageBase { + /** + * The name of the channel. + */ + readonly name: string; +} +/** + * 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. + */ +export interface JobOutboundMessageChannelMessage extends JobOutboundMessageChannelBase { + readonly kind: JobOutboundMessageKind.ChannelMessage; + /** + * The message being sent to the channel. + */ + readonly message: JsonValue; +} +/** + * 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. + */ +export interface JobOutboundMessageChannelError extends JobOutboundMessageChannelBase { + readonly kind: JobOutboundMessageKind.ChannelError; + /** + * The error message being sent to the channel. + */ + readonly error: JsonValue; +} +/** + * A job wants to create a new channel. + */ +export interface JobOutboundMessageChannelCreate extends JobOutboundMessageChannelBase { + readonly kind: JobOutboundMessageKind.ChannelCreate; +} +/** + * 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(). + */ +export interface JobOutboundMessageChannelComplete extends JobOutboundMessageChannelBase { + readonly kind: JobOutboundMessageKind.ChannelComplete; +} +/** + * OnEnd of the job run. + */ +export interface JobOutboundMessageEnd extends JobOutboundMessageBase { + readonly kind: JobOutboundMessageKind.End; +} +/** + * A pong response from a ping input. The id is the same as the one passed in. + */ +export interface JobOutboundMessagePong extends JobOutboundMessageBase { + readonly kind: JobOutboundMessageKind.Pong; + /** + * The ID that was passed in the `Ping` messages. + */ + readonly id: number; +} +/** + * Generic message type. + */ +export declare type JobOutboundMessage<OutputT extends JsonValue> = JobOutboundMessageOnReady | JobOutboundMessageStart | JobOutboundMessageOutput<OutputT> | JobOutboundMessageChannelCreate | JobOutboundMessageChannelMessage | JobOutboundMessageChannelError | JobOutboundMessageChannelComplete | JobOutboundMessageEnd | JobOutboundMessagePong; +/** + * The state of a job. These are changed as the job reports a new state through its messages. + */ +export declare enum JobState { + /** + * The job was queued and is waiting to start. + */ + Queued = "queued", + /** + * 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. + */ + Ready = "ready", + /** + * The job has been started. The job implementation is expected to send this as soon as its + * work is starting. + */ + Started = "started", + /** + * The job has ended and is done running. + */ + Ended = "ended", + /** + * An error occured and the job stopped because of internal state. + */ + Errored = "errored" +} +/** + * A Job instance, returned from scheduling a job. A Job instance is _not_ serializable. + */ +export interface Job<ArgumentT extends JsonValue = JsonValue, InputT extends JsonValue = JsonValue, OutputT extends JsonValue = JsonValue> { + /** + * 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. + */ + readonly description: Observable<JobDescription>; + /** + * Argument sent when scheduling the job. This is a copy of the argument. + */ + readonly argument: ArgumentT; + /** + * The input to the job. This goes through the input channel as messages. + */ + readonly input: Observer<InputT>; + /** + * Outputs of this job. + */ + readonly output: Observable<OutputT>; + /** + * The current state of the job. + */ + readonly state: JobState; + /** + * Get a channel that validates against the schema. Messages will be filtered by the schema. + * @param name The name of the channel. + * @param schema A schema to use to validate messages. + */ + getChannel<T extends JsonValue>(name: string, schema?: schema.JsonSchema): Observable<T>; + /** + * Pings the job and wait for the resulting Pong before completing. + */ + ping(): Observable<never>; + /** + * 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. + */ + stop(): void; + /** + * The JobInboundMessage messages TO the job. + */ + readonly inboundBus: Observer<JobInboundMessage<InputT>>; + /** + * The JobOutboundMessage FROM the job. + */ + readonly outboundBus: Observable<JobOutboundMessage<OutputT>>; +} +/** + * Options for scheduling jobs. + */ +export interface ScheduleJobOptions { + /** + * Jobs that need to finish before scheduling this job. These dependencies will be passed + * to the job itself in its context. + */ + dependencies?: Job | Job[]; +} +export interface Registry<MinimumArgumentValueT extends JsonValue = JsonValue, MinimumInputValueT extends JsonValue = JsonValue, MinimumOutputValueT extends JsonValue = JsonValue> { + /** + * Get a job handler. + * @param name The name of the job to get a handler from. + */ + get<A extends MinimumArgumentValueT, I extends MinimumInputValueT, O extends MinimumOutputValueT>(name: JobName): Observable<JobHandler<A, I, O> | null>; +} +/** + * An interface that can schedule jobs. + */ +export interface Scheduler<MinimumArgumentValueT extends JsonValue = JsonValue, MinimumInputValueT extends JsonValue = JsonValue, MinimumOutputValueT extends JsonValue = JsonValue> { + /** + * Get a job description for a named job. + * + * @param name The name of the job. + * @returns A description, or null if no description is available for this job. + */ + getDescription(name: JobName): Observable<JobDescription | null>; + /** + * Returns true if the job name has been registered. + * @param name The name of the job. + * @returns True if the job exists, false otherwise. + */ + has(name: JobName): Observable<boolean>; + /** + * 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. + */ + pause(): () => void; + /** + * Schedule a job to be run, using its name. + * @param name The name of job to be run. + * @param argument The argument to send to the job when starting it. + * @param options Scheduling options. + * @returns The job being run. + */ + schedule<A extends MinimumArgumentValueT, I extends MinimumInputValueT, O extends MinimumOutputValueT>(name: JobName, argument: A, options?: ScheduleJobOptions): Job<A, I, O>; +} +export declare function isJobHandler<A extends JsonValue, I extends JsonValue, O extends JsonValue>(value: unknown): value is JobHandler<A, I, O>; diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/experimental/jobs/api.js b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/experimental/jobs/api.js new file mode 100644 index 00000000..675c2e45 --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/experimental/jobs/api.js @@ -0,0 +1,73 @@ +"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.isJobHandler = exports.JobState = exports.JobOutboundMessageKind = exports.JobInboundMessageKind = void 0; +/** + * Messages that can be sent TO a job. The job needs to listen to those. + */ +var JobInboundMessageKind; +(function (JobInboundMessageKind) { + JobInboundMessageKind["Ping"] = "ip"; + JobInboundMessageKind["Stop"] = "is"; + // Channel specific messages. + JobInboundMessageKind["Input"] = "in"; + // Input channel does not allow completion / error. Erroring this will just close the Subject + // but not notify the job. +})(JobInboundMessageKind = exports.JobInboundMessageKind || (exports.JobInboundMessageKind = {})); +/** + * Kind of messages that can be outputted from a job. + */ +var JobOutboundMessageKind; +(function (JobOutboundMessageKind) { + // Lifecycle specific messages. + JobOutboundMessageKind["OnReady"] = "c"; + JobOutboundMessageKind["Start"] = "s"; + JobOutboundMessageKind["End"] = "e"; + JobOutboundMessageKind["Pong"] = "p"; + // Feedback messages. + JobOutboundMessageKind["Output"] = "o"; + // Channel specific messages. + JobOutboundMessageKind["ChannelCreate"] = "cn"; + JobOutboundMessageKind["ChannelMessage"] = "cm"; + JobOutboundMessageKind["ChannelError"] = "ce"; + JobOutboundMessageKind["ChannelComplete"] = "cc"; +})(JobOutboundMessageKind = exports.JobOutboundMessageKind || (exports.JobOutboundMessageKind = {})); +/** + * The state of a job. These are changed as the job reports a new state through its messages. + */ +var JobState; +(function (JobState) { + /** + * The job was queued and is waiting to start. + */ + JobState["Queued"] = "queued"; + /** + * 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. + */ + JobState["Ready"] = "ready"; + /** + * The job has been started. The job implementation is expected to send this as soon as its + * work is starting. + */ + JobState["Started"] = "started"; + /** + * The job has ended and is done running. + */ + JobState["Ended"] = "ended"; + /** + * An error occured and the job stopped because of internal state. + */ + JobState["Errored"] = "errored"; +})(JobState = exports.JobState || (exports.JobState = {})); +function isJobHandler(value) { + const job = value; + return (typeof job == 'function' && typeof job.jobDescription == 'object' && job.jobDescription !== null); +} +exports.isJobHandler = isJobHandler; diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/experimental/jobs/architecture.md b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/experimental/jobs/architecture.md new file mode 100644 index 00000000..da67dae5 --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/experimental/jobs/architecture.md @@ -0,0 +1,260 @@ +# Overview + +Jobs is a high-order API that adds inputs, runtime type checking, sequencing, and other +functionality on top of RxJS' `Observable`s. + +# Background + +An `Observable` (at a higher level) is a function that receives a `Subscriber`, and outputs +multiple values, and finishes once it calls the `Subscriber.prototype.complete()` method (in +JavaScript): + +```javascript +const output1To10EverySecond = function (subscriber) { + let t = 0; + const i = setInterval(() => { + t++; + subscriber.next(t); + if (t === 10) { + subscriber.complete(t); + } + }, 1000); + return () => clearInterval(i); +}; + +const stream$ = new Observable(output1To10EverySecond); +// Start the function, and output 1 to 100, once per line. +stream$.subscribe((x) => console.log(x)); +``` + +This, of course, can be typed in TypeScript, but those types are not enforced at runtime. + +# Glossary + +- `job handler`. The function that implements the job's logic. +- `raw input`. The input observable sending messages to the job. These messages are of type + `JobInboundMessage`. +- `raw output`. The output observer returned from the `job handler`. Messages on this observable + are of type `JobOutboundMessage`. + +# Description + +A `JobHandler`, similar to observables, is a function that receives an argument and a context, and +returns an `Observable` of messages, which can include outputs that are typed at runtime (using a +Json Schema): + +```javascript +const output1ToXEverySecond = function (x, context) { + return new Observable((subscriber) => { + let t = 0; + + // Notify our users that the actual work is started. + subscriber.next({ kind: JobOutboundMessageKind.Start }); + const i = setInterval(() => { + t++; + subscriber.next({ kind: JobOutboundMessageKind.Output, value: t }); + if (t === x) { + subscriber.next({ kind: JobOutboundMessageKind.End }); + subscriber.complete(); + } + }, 1000); + + return () => { + clearInterval(i); + }; + }); +}; + +// For now, jobs can not be called without a registry and scheduler. +const registry = new SimpleJobRegistry(); +registry.register('output-from-1-to-x', output1ToXEverySecond, { + argument: { type: 'number' }, + output: { type: 'number' }, +}); +const scheduler = new SimpleScheduler(registry); + +// Need to keep the same name that the registry would understand. +// Count from 1 to 10. +const job = scheduler.schedule('output-from-1-to-x', 10); + +// A Job<> instance has more members, but we only want the output values here. +job.output.subscribe((x) => console.log(x)); +``` + +This seems like a lot of boilerplate in comparison, but there are a few advantages; + +1. lifecycle. Jobs can tell when they start doing work and when work is done. +1. everything is typed, even at runtime. +1. the context also contains an input Observable that receives typed input messages, including + input values, and stop requests. +1. jobs can also schedule other jobs and wait for them, even if they don't know if a job is + implemented in the system. + +## Diagram + +A simpler way to think about jobs in contrast to observables is that job are closer to a Unix +process. It has an argument (command line flags), receive inputs (STDIN and interrupt signals), +and output values (STDOUT) as well as diagnostic (STDERR). They can be plugged one into another +(piping), and can be transformed, synchronized and scheduled (fork, exec, cron). + +```plain +- given A the type of the argument +- given I the type of the input +- given O the type of the output + + ,______________________ + JobInboundMessage<I> --> | handler(argument: A) | --> JobOutboundMessage<O> + - JobOutboundMessageKind.Output + - ... +``` + +`JobInboundMessage` includes: + +1. `JobInboundMessageKind.Ping`. A simple message that should be answered with + `JobOutboundMessageKind.Pong` when the job is responsive. The `id` field of the message should + be used when returning `Pong`. +1. `JobInboundMessageKind.Stop`. The job should be stopped. This is used when + cancelling/unsubscribing from the `output` (or by calling `stop()`). Any inputs or outputs + after this message will be ignored. +1. `JobInboundMessageKind.Input` is used when sending inputs to a job. These correspond to the + `next` methods of an `Observer` and are reported to the job through its `context.input` + Observable. There is no way to communicate an error to the job. + +`JobOutboundMessage` includes: + +1. `JobOutboundMessageKind.Ready`. The `Job<>` was created, its dependencies are done, and the + library is validating Argument and calling the internal job code. +1. `JobOutboundMessageKind.Start`. The job code itself should send that message when started. + `createJobHandler()` will do it automatically. +1. `JobOutboundMessageKind.End`. The job has ended. This is done by the job itself and should + always be sent when completed. The scheduler will listen to this message to set the state and + unblock dependent jobs. `createJobHandler()` automatically send this message. +1. `JobOutboundMessageKind.Pong`. The job should answer a `JobInboundMessageKind.Ping` message with + this. Automatically done by `createJobHandler()`. +1. `JobOutboundMessageKind.Output`. An `Output` has been generated by the job. +1. `JobOutboundMessageKind.ChannelMessage`, `JobOutboundMessageKind.ChannelError` and + `JobOutboundMessageKind.ChannelComplete` are used for output channels. These correspond to + the `next`, `error` and `complete` methods of an `Observer` and are available to the callee + through the `job.channels` map of Observable. + +Utilities should have some filtering and dispatching to separate observables, as a convenience for +the user. An example of this would be the `Job.prototype.output` observable which only contains +the value contained by messages of type `JobOutboundMessageKind.Output`. + +# Higher Order Jobs + +Because jobs are expected to be pure functions, they can be composed or transformed to create +more complex behaviour, similar to how RxJS operators can transform observables. + +```javascript +// Runs a job on the hour, every hour, regardless of how long the job takes. +// This creates a job function that can be registered by itself. +function scheduleJobOnTheHour(jobFunction) { + return function (argument, context) { + return new Observable((observer) => { + let timeout = 0; + + function _timeoutToNextHour() { + // Just wait until the next hour. + const t = new Date(); + const secondsToNextHour = 3600 - t.getSeconds() - t.getMinutes() * 60; + timeout = setTimeout(_scheduleJobAndWaitAnHour, secondsToNextHour); + } + + function _scheduleJobAndWaitAnHour() { + jobFunction(argument, context).subscribe( + (message) => observer.next(message), + (error) => observer.error(error), + // Do not forward completion, but use it to schedule the next job run. + () => { + _timeoutToNextHour(); + }, + ); + } + + // Kick off by waiting for next hour. + _timeoutToNextHour(); + + return () => clearTimeout(timeout); + }); + }; +} +``` + +Another way to compose jobs is to schedule jobs based on their name, from other jobs. + +```javascript +// Runs a job on the hour, every hour, regardless of how long the job takes. +// This creates a high order job by getting a job name and an argument, and scheduling the job +// every hour. +function scheduleJobOnTheHour(job, context) { + const { name, argument } = job; // Destructure our input. + + return new Observable((observer) => { + let timeout = 0; + + function _timeoutToNextHour() { + // Just wait until the next hour. + const t = new Date(); + const secondsToNextHour = 3600 - t.getSeconds() - t.getMinutes() * 60; + timeout = setTimeout(_scheduleJobAndWaitAnHour, secondsToNextHour); + } + + function _scheduleJobAndWaitAnHour() { + const subJob = context.scheduler.schedule(name, argument); + // We do not forward the input to the sub-job but that would be a valid example as well. + subJob.outboundBus.subscribe( + (message) => observer.next(message), + (error) => observer.error(error), + // Do not forward completion, but use it to schedule the next job run. + () => { + _timeoutToNextHour(); + }, + ); + } + + // Kick off by waiting for next hour. + _timeoutToNextHour(); + + return () => clearTimeout(timeout); + }); +} + +const registry = new SimpleJobRegistry(); +registry.register('schedule-job-on-the-hour', scheduleJobOnTheHour, { + argument: { + properties: { + name: { type: 'string' }, + argument: { type: true }, + }, + }, +}); + +// Implementation left to the reader. +registry.register('copy-files-from-a-to-b', require('some-package/copy-job')); + +const scheduler = new SimpleScheduler(registry); + +// A rudimentary backup system. +const job = scheduler.schedule('schedule-job-on-the-hour', { + name: 'copy-files-from-a-to-b', + argument: { + from: '/some-directory/to/backup', + to: '/volumes/usb-key', + }, +}); +job.output.subscribe((x) => console.log(x)); +``` + +# Limitations + +Jobs input, output and argument must be serializable to JSONs. This is a big limitation in usage, +but comes with the benefit that jobs can be serialized and called across memory boundaries. An +example would be an operator that takes a module path and run the job from that path in a separate +process. Or even a separate server, using HTTP calls. + +Another limitation is that the boilerplate is complex. Manually managing start/end life cycle, and +other messages such as ping/pong, etc. is tedious and requires a lot of code. A good way to keep +this limitation under control is to provide helpers to create `JobHandler`s which manage those +messages for the developer. A simple handler could be to get a `Promise` and return the output of +that promise automatically. diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/experimental/jobs/create-job-handler.d.ts b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/experimental/jobs/create-job-handler.d.ts new file mode 100644 index 00000000..e9e18ebc --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/experimental/jobs/create-job-handler.d.ts @@ -0,0 +1,48 @@ +/** + * @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 + */ +import { Observable, Observer } from 'rxjs'; +import { BaseException } from '../../exception/index'; +import { JsonValue } from '../../json/index'; +import { LoggerApi } from '../../logger'; +import { JobDescription, JobHandler, JobHandlerContext } from './api'; +export declare class ChannelAlreadyExistException extends BaseException { + constructor(name: string); +} +/** + * Interface for the JobHandler context that is used when using `createJobHandler()`. It extends + * the basic `JobHandlerContext` with additional functionality. + */ +export interface SimpleJobHandlerContext<A extends JsonValue, I extends JsonValue, O extends JsonValue> extends JobHandlerContext<A, I, O> { + createChannel: (name: string) => Observer<JsonValue>; + input: Observable<I>; +} +/** + * 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. + */ +export declare type SimpleJobHandlerFn<A extends JsonValue, I extends JsonValue, O extends JsonValue> = (input: A, context: SimpleJobHandlerContext<A, I, O>) => O | Promise<O> | Observable<O>; +/** + * Make a simple job handler that sets start and end from a function that's synchronous. + * + * @param fn The function to create a handler for. + * @param options An optional set of properties to set on the handler. Some fields might be + * required by registry or schedulers. + */ +export declare function createJobHandler<A extends JsonValue, I extends JsonValue, O extends JsonValue>(fn: SimpleJobHandlerFn<A, I, O>, options?: Partial<JobDescription>): JobHandler<A, I, O>; +/** + * Lazily create a job using a function. + * @param loader A factory function that returns a promise/observable of a JobHandler. + * @param options Same options as createJob. + */ +export declare function createJobFactory<A extends JsonValue, I extends JsonValue, O extends JsonValue>(loader: () => Promise<JobHandler<A, I, O>>, options?: Partial<JobDescription>): 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. + */ +export declare function createLoggerJob<A extends JsonValue, I extends JsonValue, O extends JsonValue>(job: JobHandler<A, I, O>, logger: LoggerApi): JobHandler<A, I, O>; diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/experimental/jobs/create-job-handler.js b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/experimental/jobs/create-job-handler.js new file mode 100644 index 00000000..92ee6668 --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/experimental/jobs/create-job-handler.js @@ -0,0 +1,135 @@ +"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.createLoggerJob = exports.createJobFactory = exports.createJobHandler = exports.ChannelAlreadyExistException = void 0; +const rxjs_1 = require("rxjs"); +const operators_1 = require("rxjs/operators"); +const index_1 = require("../../exception/index"); +const index_2 = require("../../utils/index"); +const api_1 = require("./api"); +class ChannelAlreadyExistException extends index_1.BaseException { + constructor(name) { + super(`Channel ${JSON.stringify(name)} already exist.`); + } +} +exports.ChannelAlreadyExistException = ChannelAlreadyExistException; +/** + * Make a simple job handler that sets start and end from a function that's synchronous. + * + * @param fn The function to create a handler for. + * @param options An optional set of properties to set on the handler. Some fields might be + * required by registry or schedulers. + */ +function createJobHandler(fn, options = {}) { + const handler = (argument, context) => { + const description = context.description; + const inboundBus = context.inboundBus; + const inputChannel = new rxjs_1.Subject(); + let subscription; + return new rxjs_1.Observable((subject) => { + function complete() { + if (subscription) { + subscription.unsubscribe(); + } + subject.next({ kind: api_1.JobOutboundMessageKind.End, description }); + subject.complete(); + inputChannel.complete(); + } + // Handle input. + const inboundSub = inboundBus.subscribe((message) => { + switch (message.kind) { + case api_1.JobInboundMessageKind.Ping: + subject.next({ kind: api_1.JobOutboundMessageKind.Pong, description, id: message.id }); + break; + case api_1.JobInboundMessageKind.Stop: + // There's no way to cancel a promise or a synchronous function, but we do cancel + // observables where possible. + complete(); + break; + case api_1.JobInboundMessageKind.Input: + inputChannel.next(message.value); + break; + } + }); + // Execute the function with the additional context. + const channels = new Map(); + const newContext = { + ...context, + input: inputChannel.asObservable(), + createChannel(name) { + if (channels.has(name)) { + throw new ChannelAlreadyExistException(name); + } + const channelSubject = new rxjs_1.Subject(); + const channelSub = channelSubject.subscribe((message) => { + subject.next({ + kind: api_1.JobOutboundMessageKind.ChannelMessage, + description, + name, + message, + }); + }, (error) => { + subject.next({ kind: api_1.JobOutboundMessageKind.ChannelError, description, name, error }); + // This can be reopened. + channels.delete(name); + }, () => { + subject.next({ kind: api_1.JobOutboundMessageKind.ChannelComplete, description, name }); + // This can be reopened. + channels.delete(name); + }); + channels.set(name, channelSubject); + if (subscription) { + subscription.add(channelSub); + } + return channelSubject; + }, + }; + subject.next({ kind: api_1.JobOutboundMessageKind.Start, description }); + let result = fn(argument, newContext); + // If the result is a promise, simply wait for it to complete before reporting the result. + if ((0, index_2.isPromise)(result)) { + result = (0, rxjs_1.from)(result); + } + else if (!(0, rxjs_1.isObservable)(result)) { + result = (0, rxjs_1.of)(result); + } + subscription = result.subscribe((value) => subject.next({ kind: api_1.JobOutboundMessageKind.Output, description, value }), (error) => subject.error(error), () => complete()); + subscription.add(inboundSub); + return subscription; + }); + }; + return Object.assign(handler, { jobDescription: options }); +} +exports.createJobHandler = createJobHandler; +/** + * Lazily create a job using a function. + * @param loader A factory function that returns a promise/observable of a JobHandler. + * @param options Same options as createJob. + */ +function createJobFactory(loader, options = {}) { + const handler = (argument, context) => { + return (0, rxjs_1.from)(loader()).pipe((0, operators_1.switchMap)((fn) => fn(argument, context))); + }; + return Object.assign(handler, { jobDescription: options }); +} +exports.createJobFactory = createJobFactory; +/** + * Creates a job that logs out input/output messages of another Job. The messages are still + * propagated to the other job. + */ +function createLoggerJob(job, logger) { + const handler = (argument, context) => { + context.inboundBus + .pipe((0, operators_1.tap)((message) => logger.info(`Input: ${JSON.stringify(message)}`))) + .subscribe(); + return job(argument, context).pipe((0, operators_1.tap)((message) => logger.info(`Message: ${JSON.stringify(message)}`), (error) => logger.warn(`Error: ${JSON.stringify(error)}`), () => logger.info(`Completed`))); + }; + return Object.assign(handler, job); +} +exports.createLoggerJob = createLoggerJob; diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/experimental/jobs/dispatcher.d.ts b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/experimental/jobs/dispatcher.d.ts new file mode 100644 index 00000000..eb053356 --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/experimental/jobs/dispatcher.d.ts @@ -0,0 +1,31 @@ +/** + * @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 + */ +import { JsonValue } from '../../json/index'; +import { Readwrite } from '../../utils/index'; +import { JobDescription, JobHandler, JobName } from './api'; +/** + * A JobDispatcher can be used to dispatch between multiple jobs. + */ +export interface JobDispatcher<A extends JsonValue, I extends JsonValue, O extends JsonValue> extends JobHandler<A, I, O> { + /** + * Set the default job if all conditionals failed. + * @param name The default name if all conditions are false. + */ + setDefaultJob(name: JobName | null | JobHandler<JsonValue, JsonValue, JsonValue>): void; + /** + * Add a conditional job that will be selected if the input fits a predicate. + * @param predicate + * @param name + */ + addConditionalJob(predicate: (args: A) => boolean, name: string): void; +} +/** + * OnReady a dispatcher that can dispatch to a sub job, depending on conditions. + * @param options + */ +export declare function createDispatcher<A extends JsonValue, I extends JsonValue, O extends JsonValue>(options?: Partial<Readwrite<JobDescription>>): JobDispatcher<A, I, O>; diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/experimental/jobs/dispatcher.js b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/experimental/jobs/dispatcher.js new file mode 100644 index 00000000..892b796c --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/experimental/jobs/dispatcher.js @@ -0,0 +1,50 @@ +"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.createDispatcher = void 0; +const api_1 = require("./api"); +const exception_1 = require("./exception"); +/** + * OnReady a dispatcher that can dispatch to a sub job, depending on conditions. + * @param options + */ +function createDispatcher(options = {}) { + let defaultDelegate = null; + const conditionalDelegateList = []; + const job = Object.assign((argument, context) => { + const maybeDelegate = conditionalDelegateList.find(([predicate]) => predicate(argument)); + let delegate = null; + if (maybeDelegate) { + delegate = context.scheduler.schedule(maybeDelegate[1], argument); + } + else if (defaultDelegate) { + delegate = context.scheduler.schedule(defaultDelegate, argument); + } + else { + throw new exception_1.JobDoesNotExistException('<null>'); + } + context.inboundBus.subscribe(delegate.inboundBus); + return delegate.outboundBus; + }, { + jobDescription: options, + }); + return Object.assign(job, { + setDefaultJob(name) { + if ((0, api_1.isJobHandler)(name)) { + name = name.jobDescription.name === undefined ? null : name.jobDescription.name; + } + defaultDelegate = name; + }, + addConditionalJob(predicate, name) { + conditionalDelegateList.push([predicate, name]); + }, + // TODO: Remove return-only generic from createDispatcher() API. + }); +} +exports.createDispatcher = createDispatcher; diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/experimental/jobs/exception.d.ts b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/experimental/jobs/exception.d.ts new file mode 100644 index 00000000..67528eb3 --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/experimental/jobs/exception.d.ts @@ -0,0 +1,15 @@ +/** + * @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 + */ +import { BaseException } from '../../exception/index'; +import { JobName } from './api'; +export declare class JobNameAlreadyRegisteredException extends BaseException { + constructor(name: JobName); +} +export declare class JobDoesNotExistException extends BaseException { + constructor(name: JobName); +} diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/experimental/jobs/exception.js b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/experimental/jobs/exception.js new file mode 100644 index 00000000..3e68d3c6 --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/experimental/jobs/exception.js @@ -0,0 +1,23 @@ +"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.JobDoesNotExistException = exports.JobNameAlreadyRegisteredException = void 0; +const index_1 = require("../../exception/index"); +class JobNameAlreadyRegisteredException extends index_1.BaseException { + constructor(name) { + super(`Job named ${JSON.stringify(name)} already exists.`); + } +} +exports.JobNameAlreadyRegisteredException = JobNameAlreadyRegisteredException; +class JobDoesNotExistException extends index_1.BaseException { + constructor(name) { + super(`Job name ${JSON.stringify(name)} does not exist.`); + } +} +exports.JobDoesNotExistException = JobDoesNotExistException; diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/experimental/jobs/fallback-registry.d.ts b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/experimental/jobs/fallback-registry.d.ts new file mode 100644 index 00000000..2af02295 --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/experimental/jobs/fallback-registry.d.ts @@ -0,0 +1,19 @@ +/** + * @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 + */ +import { Observable } from 'rxjs'; +import { JsonValue } from '../../json'; +import { JobHandler, JobName, Registry } from './api'; +/** + * A simple job registry that keep a map of JobName => JobHandler internally. + */ +export declare class FallbackRegistry<MinimumArgumentValueT extends JsonValue = JsonValue, MinimumInputValueT extends JsonValue = JsonValue, MinimumOutputValueT extends JsonValue = JsonValue> implements Registry<MinimumArgumentValueT, MinimumInputValueT, MinimumOutputValueT> { + protected _fallbacks: Registry<MinimumArgumentValueT, MinimumInputValueT, MinimumOutputValueT>[]; + constructor(_fallbacks?: Registry<MinimumArgumentValueT, MinimumInputValueT, MinimumOutputValueT>[]); + addFallback(registry: Registry): void; + get<A extends MinimumArgumentValueT = MinimumArgumentValueT, I extends MinimumInputValueT = MinimumInputValueT, O extends MinimumOutputValueT = MinimumOutputValueT>(name: JobName): Observable<JobHandler<A, I, O> | null>; +} diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/experimental/jobs/fallback-registry.js b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/experimental/jobs/fallback-registry.js new file mode 100644 index 00000000..e5cc4725 --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/experimental/jobs/fallback-registry.js @@ -0,0 +1,27 @@ +"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.FallbackRegistry = void 0; +const rxjs_1 = require("rxjs"); +const operators_1 = require("rxjs/operators"); +/** + * A simple job registry that keep a map of JobName => JobHandler internally. + */ +class FallbackRegistry { + constructor(_fallbacks = []) { + this._fallbacks = _fallbacks; + } + addFallback(registry) { + this._fallbacks.push(registry); + } + get(name) { + return (0, rxjs_1.from)(this._fallbacks).pipe((0, operators_1.concatMap)((fb) => fb.get(name)), (0, operators_1.first)((x) => x !== null, null)); + } +} +exports.FallbackRegistry = FallbackRegistry; diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/experimental/jobs/index.d.ts b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/experimental/jobs/index.d.ts new file mode 100644 index 00000000..094fc238 --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/experimental/jobs/index.d.ts @@ -0,0 +1,15 @@ +/** + * @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 + */ +export * from './api'; +export * from './create-job-handler'; +export * from './exception'; +export * from './dispatcher'; +export * from './fallback-registry'; +export * from './simple-registry'; +export * from './simple-scheduler'; +export * from './strategy'; diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/experimental/jobs/index.js b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/experimental/jobs/index.js new file mode 100644 index 00000000..d9739b1b --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/experimental/jobs/index.js @@ -0,0 +1,27 @@ +"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 + */ +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __exportStar = (this && this.__exportStar) || function(m, exports) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +__exportStar(require("./api"), exports); +__exportStar(require("./create-job-handler"), exports); +__exportStar(require("./exception"), exports); +__exportStar(require("./dispatcher"), exports); +__exportStar(require("./fallback-registry"), exports); +__exportStar(require("./simple-registry"), exports); +__exportStar(require("./simple-scheduler"), exports); +__exportStar(require("./strategy"), exports); diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/experimental/jobs/simple-registry.d.ts b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/experimental/jobs/simple-registry.d.ts new file mode 100644 index 00000000..454d6980 --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/experimental/jobs/simple-registry.d.ts @@ -0,0 +1,44 @@ +/** + * @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 + */ +import { Observable } from 'rxjs'; +import { JsonValue } from '../../json'; +import { JobDescription, JobHandler, JobName, Registry } from './api'; +/** + * SimpleJobRegistry job registration options. + */ +export interface RegisterJobOptions extends Partial<JobDescription> { +} +/** + * A simple job registry that keep a map of JobName => JobHandler internally. + */ +export declare class SimpleJobRegistry<MinimumArgumentValueT extends JsonValue = JsonValue, MinimumInputValueT extends JsonValue = JsonValue, MinimumOutputValueT extends JsonValue = JsonValue> implements Registry<MinimumArgumentValueT, MinimumInputValueT, MinimumOutputValueT> { + private _jobNames; + get<A extends MinimumArgumentValueT = MinimumArgumentValueT, I extends MinimumInputValueT = MinimumInputValueT, O extends MinimumOutputValueT = MinimumOutputValueT>(name: JobName): Observable<JobHandler<A, I, O> | null>; + /** + * Register a job handler. The name must be unique. + * + * @param name The name of the job. + * @param handler The function that will be called for the job. + * @param options An optional list of options to override the handler. {@see RegisterJobOptions} + */ + register<A extends MinimumArgumentValueT, I extends MinimumInputValueT, O extends MinimumOutputValueT>(name: JobName, handler: JobHandler<A, I, O>, options?: RegisterJobOptions): void; + /** + * Register a job handler. The name must be unique. + * + * @param handler The function that will be called for the job. + * @param options An optional list of options to override the handler. {@see RegisterJobOptions} + */ + register<ArgumentT extends JsonValue, InputT extends JsonValue, OutputT extends JsonValue>(handler: JobHandler<ArgumentT, InputT, OutputT>, options?: RegisterJobOptions & { + name: string; + }): void; + protected _register<ArgumentT extends JsonValue, InputT extends JsonValue, OutputT extends JsonValue>(name: JobName, handler: JobHandler<ArgumentT, InputT, OutputT>, options: RegisterJobOptions): void; + /** + * Returns the job names of all jobs. + */ + getJobNames(): JobName[]; +} diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/experimental/jobs/simple-registry.js b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/experimental/jobs/simple-registry.js new file mode 100644 index 00000000..33c09938 --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/experimental/jobs/simple-registry.js @@ -0,0 +1,77 @@ +"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.SimpleJobRegistry = void 0; +const rxjs_1 = require("rxjs"); +const json_1 = require("../../json"); +const api_1 = require("./api"); +const exception_1 = require("./exception"); +/** + * A simple job registry that keep a map of JobName => JobHandler internally. + */ +class SimpleJobRegistry { + constructor() { + this._jobNames = new Map(); + } + get(name) { + return (0, rxjs_1.of)(this._jobNames.get(name) || null); + } + register(nameOrHandler, handlerOrOptions = {}, options = {}) { + // Switch on the arguments. + if (typeof nameOrHandler == 'string') { + if (!(0, api_1.isJobHandler)(handlerOrOptions)) { + // This is an error. + throw new TypeError('Expected a JobHandler as second argument.'); + } + this._register(nameOrHandler, handlerOrOptions, options); + } + else if ((0, api_1.isJobHandler)(nameOrHandler)) { + if (typeof handlerOrOptions !== 'object') { + // This is an error. + throw new TypeError('Expected an object options as second argument.'); + } + const name = options.name || nameOrHandler.jobDescription.name || handlerOrOptions.name; + if (name === undefined) { + throw new TypeError('Expected name to be a string.'); + } + this._register(name, nameOrHandler, options); + } + else { + throw new TypeError('Unrecognized arguments.'); + } + } + _register(name, handler, options) { + if (this._jobNames.has(name)) { + // We shouldn't allow conflicts. + throw new exception_1.JobNameAlreadyRegisteredException(name); + } + // Merge all fields with the ones in the handler (to make sure we respect the handler). + const argument = json_1.schema.mergeSchemas(handler.jobDescription.argument, options.argument); + const input = json_1.schema.mergeSchemas(handler.jobDescription.input, options.input); + const output = json_1.schema.mergeSchemas(handler.jobDescription.output, options.output); + // Create the job description. + const jobDescription = { + name, + argument, + output, + input, + }; + const jobHandler = Object.assign(handler.bind(undefined), { + jobDescription, + }); + this._jobNames.set(name, jobHandler); + } + /** + * Returns the job names of all jobs. + */ + getJobNames() { + return [...this._jobNames.keys()]; + } +} +exports.SimpleJobRegistry = SimpleJobRegistry; diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/experimental/jobs/simple-scheduler.d.ts b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/experimental/jobs/simple-scheduler.d.ts new file mode 100644 index 00000000..e27e6772 --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/experimental/jobs/simple-scheduler.d.ts @@ -0,0 +1,77 @@ +/** + * @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 + */ +import { Observable } from 'rxjs'; +import { JsonValue, schema } from '../../json'; +import { Job, JobDescription, JobName, Registry, ScheduleJobOptions, Scheduler } from './api'; +export declare class JobArgumentSchemaValidationError extends schema.SchemaValidationException { + constructor(errors?: schema.SchemaValidatorError[]); +} +export declare class JobInboundMessageSchemaValidationError extends schema.SchemaValidationException { + constructor(errors?: schema.SchemaValidatorError[]); +} +export declare class JobOutputSchemaValidationError extends schema.SchemaValidationException { + constructor(errors?: schema.SchemaValidatorError[]); +} +/** + * Simple scheduler. Should be the base of all registries and schedulers. + */ +export declare class SimpleScheduler<MinimumArgumentT extends JsonValue = JsonValue, MinimumInputT extends JsonValue = JsonValue, MinimumOutputT extends JsonValue = JsonValue> implements Scheduler<MinimumArgumentT, MinimumInputT, MinimumOutputT> { + protected _jobRegistry: Registry<MinimumArgumentT, MinimumInputT, MinimumOutputT>; + protected _schemaRegistry: schema.SchemaRegistry; + private _internalJobDescriptionMap; + private _queue; + private _pauseCounter; + constructor(_jobRegistry: Registry<MinimumArgumentT, MinimumInputT, MinimumOutputT>, _schemaRegistry?: schema.SchemaRegistry); + private _getInternalDescription; + /** + * Get a job description for a named job. + * + * @param name The name of the job. + * @returns A description, or null if the job is not registered. + */ + getDescription(name: JobName): Observable<JobDescription | null>; + /** + * Returns true if the job name has been registered. + * @param name The name of the job. + * @returns True if the job exists, false otherwise. + */ + has(name: JobName): Observable<boolean>; + /** + * 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. + */ + pause(): () => void; + /** + * Schedule a job to be run, using its name. + * @param name The name of job to be run. + * @param argument The argument to send to the job when starting it. + * @param options Scheduling options. + * @returns The Job being run. + */ + schedule<A extends MinimumArgumentT, I extends MinimumInputT, O extends MinimumOutputT>(name: JobName, argument: A, options?: ScheduleJobOptions): Job<A, I, O>; + /** + * Filter messages. + * @private + */ + private _filterJobOutboundMessages; + /** + * Return a new state. This is just to simplify the reading of the _createJob method. + * @private + */ + private _updateState; + /** + * Create the job. + * @private + */ + private _createJob; + protected _scheduleJob<A extends MinimumArgumentT, I extends MinimumInputT, O extends MinimumOutputT>(name: JobName, argument: A, options: ScheduleJobOptions, waitable: Observable<never>): Job<A, I, O>; +} diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/experimental/jobs/simple-scheduler.js b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/experimental/jobs/simple-scheduler.js new file mode 100644 index 00000000..81fe1cdb --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/experimental/jobs/simple-scheduler.js @@ -0,0 +1,382 @@ +"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.SimpleScheduler = exports.JobOutputSchemaValidationError = exports.JobInboundMessageSchemaValidationError = exports.JobArgumentSchemaValidationError = void 0; +const rxjs_1 = require("rxjs"); +const operators_1 = require("rxjs/operators"); +const json_1 = require("../../json"); +const api_1 = require("./api"); +const exception_1 = require("./exception"); +class JobArgumentSchemaValidationError extends json_1.schema.SchemaValidationException { + constructor(errors) { + super(errors, 'Job Argument failed to validate. Errors: '); + } +} +exports.JobArgumentSchemaValidationError = JobArgumentSchemaValidationError; +class JobInboundMessageSchemaValidationError extends json_1.schema.SchemaValidationException { + constructor(errors) { + super(errors, 'Job Inbound Message failed to validate. Errors: '); + } +} +exports.JobInboundMessageSchemaValidationError = JobInboundMessageSchemaValidationError; +class JobOutputSchemaValidationError extends json_1.schema.SchemaValidationException { + constructor(errors) { + super(errors, 'Job Output failed to validate. Errors: '); + } +} +exports.JobOutputSchemaValidationError = JobOutputSchemaValidationError; +function _jobShare() { + // This is the same code as a `shareReplay()` operator, but uses a dumber Subject rather than a + // ReplaySubject. + return (source) => { + let refCount = 0; + let subject; + let hasError = false; + let isComplete = false; + let subscription; + return new rxjs_1.Observable((subscriber) => { + let innerSub; + refCount++; + if (!subject) { + subject = new rxjs_1.Subject(); + innerSub = subject.subscribe(subscriber); + subscription = source.subscribe({ + next(value) { + subject.next(value); + }, + error(err) { + hasError = true; + subject.error(err); + }, + complete() { + isComplete = true; + subject.complete(); + }, + }); + } + else { + innerSub = subject.subscribe(subscriber); + } + return () => { + refCount--; + innerSub.unsubscribe(); + if (subscription && refCount === 0 && (isComplete || hasError)) { + subscription.unsubscribe(); + } + }; + }); + }; +} +/** + * Simple scheduler. Should be the base of all registries and schedulers. + */ +class SimpleScheduler { + constructor(_jobRegistry, _schemaRegistry = new json_1.schema.CoreSchemaRegistry()) { + this._jobRegistry = _jobRegistry; + this._schemaRegistry = _schemaRegistry; + this._internalJobDescriptionMap = new Map(); + this._queue = []; + this._pauseCounter = 0; + } + _getInternalDescription(name) { + const maybeHandler = this._internalJobDescriptionMap.get(name); + if (maybeHandler !== undefined) { + return (0, rxjs_1.of)(maybeHandler); + } + const handler = this._jobRegistry.get(name); + return handler.pipe((0, operators_1.switchMap)((handler) => { + if (handler === null) { + return (0, rxjs_1.of)(null); + } + const description = { + // Make a copy of it to be sure it's proper JSON. + ...JSON.parse(JSON.stringify(handler.jobDescription)), + name: handler.jobDescription.name || name, + argument: handler.jobDescription.argument || true, + input: handler.jobDescription.input || true, + output: handler.jobDescription.output || true, + channels: handler.jobDescription.channels || {}, + }; + const handlerWithExtra = Object.assign(handler.bind(undefined), { + jobDescription: description, + argumentV: this._schemaRegistry.compile(description.argument).pipe((0, operators_1.shareReplay)(1)), + inputV: this._schemaRegistry.compile(description.input).pipe((0, operators_1.shareReplay)(1)), + outputV: this._schemaRegistry.compile(description.output).pipe((0, operators_1.shareReplay)(1)), + }); + this._internalJobDescriptionMap.set(name, handlerWithExtra); + return (0, rxjs_1.of)(handlerWithExtra); + })); + } + /** + * Get a job description for a named job. + * + * @param name The name of the job. + * @returns A description, or null if the job is not registered. + */ + getDescription(name) { + return (0, rxjs_1.concat)(this._getInternalDescription(name).pipe((0, operators_1.map)((x) => x && x.jobDescription)), (0, rxjs_1.of)(null)).pipe((0, operators_1.first)()); + } + /** + * Returns true if the job name has been registered. + * @param name The name of the job. + * @returns True if the job exists, false otherwise. + */ + has(name) { + return this.getDescription(name).pipe((0, operators_1.map)((x) => x !== null)); + } + /** + * 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. + */ + pause() { + let called = false; + this._pauseCounter++; + return () => { + if (!called) { + called = true; + if (--this._pauseCounter == 0) { + // Resume the queue. + const q = this._queue; + this._queue = []; + q.forEach((fn) => fn()); + } + } + }; + } + /** + * Schedule a job to be run, using its name. + * @param name The name of job to be run. + * @param argument The argument to send to the job when starting it. + * @param options Scheduling options. + * @returns The Job being run. + */ + schedule(name, argument, options) { + if (this._pauseCounter > 0) { + const waitable = new rxjs_1.Subject(); + this._queue.push(() => waitable.complete()); + return this._scheduleJob(name, argument, options || {}, waitable); + } + return this._scheduleJob(name, argument, options || {}, rxjs_1.EMPTY); + } + /** + * Filter messages. + * @private + */ + _filterJobOutboundMessages(message, state) { + switch (message.kind) { + case api_1.JobOutboundMessageKind.OnReady: + return state == api_1.JobState.Queued; + case api_1.JobOutboundMessageKind.Start: + return state == api_1.JobState.Ready; + case api_1.JobOutboundMessageKind.End: + return state == api_1.JobState.Started || state == api_1.JobState.Ready; + } + return true; + } + /** + * Return a new state. This is just to simplify the reading of the _createJob method. + * @private + */ + _updateState(message, state) { + switch (message.kind) { + case api_1.JobOutboundMessageKind.OnReady: + return api_1.JobState.Ready; + case api_1.JobOutboundMessageKind.Start: + return api_1.JobState.Started; + case api_1.JobOutboundMessageKind.End: + return api_1.JobState.Ended; + } + return state; + } + /** + * Create the job. + * @private + */ + _createJob(name, argument, handler, inboundBus, outboundBus) { + const schemaRegistry = this._schemaRegistry; + const channelsSubject = new Map(); + const channels = new Map(); + let state = api_1.JobState.Queued; + let pingId = 0; + // Create the input channel by having a filter. + const input = new rxjs_1.Subject(); + input + .pipe((0, operators_1.concatMap)((message) => handler.pipe((0, operators_1.switchMap)((handler) => { + if (handler === null) { + throw new exception_1.JobDoesNotExistException(name); + } + else { + return handler.inputV.pipe((0, operators_1.switchMap)((validate) => validate(message))); + } + }))), (0, operators_1.filter)((result) => result.success), (0, operators_1.map)((result) => result.data)) + .subscribe((value) => inboundBus.next({ kind: api_1.JobInboundMessageKind.Input, value })); + outboundBus = (0, rxjs_1.concat)(outboundBus, + // Add an End message at completion. This will be filtered out if the job actually send an + // End. + handler.pipe((0, operators_1.switchMap)((handler) => { + if (handler) { + return (0, rxjs_1.of)({ + kind: api_1.JobOutboundMessageKind.End, + description: handler.jobDescription, + }); + } + else { + return rxjs_1.EMPTY; + } + }))).pipe((0, operators_1.filter)((message) => this._filterJobOutboundMessages(message, state)), + // Update internal logic and Job<> members. + (0, operators_1.tap)((message) => { + // Update the state. + state = this._updateState(message, state); + switch (message.kind) { + case api_1.JobOutboundMessageKind.ChannelCreate: { + const maybeSubject = channelsSubject.get(message.name); + // If it doesn't exist or it's closed on the other end. + if (!maybeSubject) { + const s = new rxjs_1.Subject(); + channelsSubject.set(message.name, s); + channels.set(message.name, s.asObservable()); + } + break; + } + case api_1.JobOutboundMessageKind.ChannelMessage: { + const maybeSubject = channelsSubject.get(message.name); + if (maybeSubject) { + maybeSubject.next(message.message); + } + break; + } + case api_1.JobOutboundMessageKind.ChannelComplete: { + const maybeSubject = channelsSubject.get(message.name); + if (maybeSubject) { + maybeSubject.complete(); + channelsSubject.delete(message.name); + } + break; + } + case api_1.JobOutboundMessageKind.ChannelError: { + const maybeSubject = channelsSubject.get(message.name); + if (maybeSubject) { + maybeSubject.error(message.error); + channelsSubject.delete(message.name); + } + break; + } + } + }, () => { + state = api_1.JobState.Errored; + }), + // Do output validation (might include default values so this might have side + // effects). We keep all messages in order. + (0, operators_1.concatMap)((message) => { + if (message.kind !== api_1.JobOutboundMessageKind.Output) { + return (0, rxjs_1.of)(message); + } + return handler.pipe((0, operators_1.switchMap)((handler) => { + if (handler === null) { + throw new exception_1.JobDoesNotExistException(name); + } + else { + return handler.outputV.pipe((0, operators_1.switchMap)((validate) => validate(message.value)), (0, operators_1.switchMap)((output) => { + if (!output.success) { + throw new JobOutputSchemaValidationError(output.errors); + } + return (0, rxjs_1.of)({ + ...message, + output: output.data, + }); + })); + } + })); + }), _jobShare()); + const output = outboundBus.pipe((0, operators_1.filter)((x) => x.kind == api_1.JobOutboundMessageKind.Output), (0, operators_1.map)((x) => x.value), (0, operators_1.shareReplay)(1)); + // Return the Job. + return { + get state() { + return state; + }, + argument, + description: handler.pipe((0, operators_1.switchMap)((handler) => { + if (handler === null) { + throw new exception_1.JobDoesNotExistException(name); + } + else { + return (0, rxjs_1.of)(handler.jobDescription); + } + })), + output, + getChannel(name, schema = true) { + let maybeObservable = channels.get(name); + if (!maybeObservable) { + const s = new rxjs_1.Subject(); + channelsSubject.set(name, s); + channels.set(name, s.asObservable()); + maybeObservable = s.asObservable(); + } + return maybeObservable.pipe( + // Keep the order of messages. + (0, operators_1.concatMap)((message) => { + return schemaRegistry.compile(schema).pipe((0, operators_1.switchMap)((validate) => validate(message)), (0, operators_1.filter)((x) => x.success), (0, operators_1.map)((x) => x.data)); + })); + }, + ping() { + const id = pingId++; + inboundBus.next({ kind: api_1.JobInboundMessageKind.Ping, id }); + return outboundBus.pipe((0, operators_1.filter)((x) => x.kind === api_1.JobOutboundMessageKind.Pong && x.id == id), (0, operators_1.first)(), (0, operators_1.ignoreElements)()); + }, + stop() { + inboundBus.next({ kind: api_1.JobInboundMessageKind.Stop }); + }, + input, + inboundBus, + outboundBus, + }; + } + _scheduleJob(name, argument, options, waitable) { + // Get handler first, since this can error out if there's no handler for the job name. + const handler = this._getInternalDescription(name); + const optionsDeps = (options && options.dependencies) || []; + const dependencies = Array.isArray(optionsDeps) ? optionsDeps : [optionsDeps]; + const inboundBus = new rxjs_1.Subject(); + const outboundBus = (0, rxjs_1.concat)( + // Wait for dependencies, make sure to not report messages from dependencies. Subscribe to + // all dependencies at the same time so they run concurrently. + (0, rxjs_1.merge)(...dependencies.map((x) => x.outboundBus)).pipe((0, operators_1.ignoreElements)()), + // Wait for pause() to clear (if necessary). + waitable, (0, rxjs_1.from)(handler).pipe((0, operators_1.switchMap)((handler) => new rxjs_1.Observable((subscriber) => { + if (!handler) { + throw new exception_1.JobDoesNotExistException(name); + } + // Validate the argument. + return handler.argumentV + .pipe((0, operators_1.switchMap)((validate) => validate(argument)), (0, operators_1.switchMap)((output) => { + if (!output.success) { + throw new JobArgumentSchemaValidationError(output.errors); + } + const argument = output.data; + const description = handler.jobDescription; + subscriber.next({ kind: api_1.JobOutboundMessageKind.OnReady, description }); + const context = { + description, + dependencies: [...dependencies], + inboundBus: inboundBus.asObservable(), + scheduler: this, + }; + return handler(argument, context); + })) + .subscribe(subscriber); + })))); + return this._createJob(name, argument, handler, inboundBus, outboundBus); + } +} +exports.SimpleScheduler = SimpleScheduler; diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/experimental/jobs/strategy.d.ts b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/experimental/jobs/strategy.d.ts new file mode 100644 index 00000000..6aa45f21 --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/experimental/jobs/strategy.d.ts @@ -0,0 +1,28 @@ +/** + * @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 + */ +import { JsonValue } from '../../json'; +import { JobDescription, JobHandler } from './api'; +export declare namespace strategy { + 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>; + /** + * Creates a JobStrategy that serializes every call. This strategy can be mixed between jobs. + */ + function serialize<A extends JsonValue = JsonValue, I extends JsonValue = JsonValue, O extends JsonValue = JsonValue>(): JobStrategy<A, I, O>; + /** + * Creates a JobStrategy that will always reuse a running job, and restart it if the job ended. + * @param replayMessages Replay ALL messages if a job is reused, otherwise just hook up where it + * is. + */ + function reuse<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. + * @param replayMessages Replay ALL messages if a job is reused, otherwise just hook up where it + * is. + */ + function memoize<A extends JsonValue = JsonValue, I extends JsonValue = JsonValue, O extends JsonValue = JsonValue>(replayMessages?: boolean): JobStrategy<A, I, O>; +} diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/experimental/jobs/strategy.js b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/experimental/jobs/strategy.js new file mode 100644 index 00000000..0904164c --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/experimental/jobs/strategy.js @@ -0,0 +1,92 @@ +"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.strategy = void 0; +const rxjs_1 = require("rxjs"); +const operators_1 = require("rxjs/operators"); +const api_1 = require("./api"); +const stableStringify = require('fast-json-stable-stringify'); +// eslint-disable-next-line @typescript-eslint/no-namespace +var strategy; +(function (strategy) { + /** + * Creates a JobStrategy that serializes every call. This strategy can be mixed between jobs. + */ + function serialize() { + let latest = (0, rxjs_1.of)(); + return (handler, options) => { + const newHandler = (argument, context) => { + const previous = latest; + latest = (0, rxjs_1.concat)(previous.pipe((0, operators_1.ignoreElements)()), new rxjs_1.Observable((o) => handler(argument, context).subscribe(o))).pipe((0, operators_1.shareReplay)(0)); + return latest; + }; + return Object.assign(newHandler, { + jobDescription: Object.assign({}, handler.jobDescription, options), + }); + }; + } + strategy.serialize = serialize; + /** + * Creates a JobStrategy that will always reuse a running job, and restart it if the job ended. + * @param replayMessages Replay ALL messages if a job is reused, otherwise just hook up where it + * is. + */ + function reuse(replayMessages = false) { + let inboundBus = new rxjs_1.Subject(); + let run = null; + let state = null; + return (handler, options) => { + const newHandler = (argument, context) => { + // Forward inputs. + const subscription = context.inboundBus.subscribe(inboundBus); + if (run) { + return (0, rxjs_1.concat)( + // Update state. + (0, rxjs_1.of)(state), run).pipe((0, operators_1.finalize)(() => subscription.unsubscribe())); + } + run = handler(argument, { ...context, inboundBus: inboundBus.asObservable() }).pipe((0, operators_1.tap)((message) => { + if (message.kind == api_1.JobOutboundMessageKind.Start || + message.kind == api_1.JobOutboundMessageKind.OnReady || + message.kind == api_1.JobOutboundMessageKind.End) { + state = message; + } + }, undefined, () => { + subscription.unsubscribe(); + inboundBus = new rxjs_1.Subject(); + run = null; + }), replayMessages ? (0, operators_1.shareReplay)() : (0, operators_1.share)()); + return run; + }; + return Object.assign(newHandler, handler, options || {}); + }; + } + strategy.reuse = reuse; + /** + * Creates a JobStrategy that will reuse a running job if the argument matches. + * @param replayMessages Replay ALL messages if a job is reused, otherwise just hook up where it + * is. + */ + function memoize(replayMessages = false) { + const runs = new Map(); + return (handler, options) => { + const newHandler = (argument, context) => { + const argumentJson = stableStringify(argument); + const maybeJob = runs.get(argumentJson); + if (maybeJob) { + return maybeJob; + } + const run = handler(argument, context).pipe(replayMessages ? (0, operators_1.shareReplay)() : (0, operators_1.share)()); + runs.set(argumentJson, run); + return run; + }; + return Object.assign(newHandler, handler, options || {}); + }; + } + strategy.memoize = memoize; +})(strategy = exports.strategy || (exports.strategy = {})); diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/index.d.ts b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/index.d.ts new file mode 100644 index 00000000..dd2fa1d1 --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/index.d.ts @@ -0,0 +1,17 @@ +/** + * @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 + */ +import * as analytics from './analytics'; +import * as experimental from './experimental'; +import * as json from './json/index'; +import * as logging from './logger/index'; +import * as workspaces from './workspace'; +export * from './exception/exception'; +export * from './json/index'; +export * from './utils/index'; +export * from './virtual-fs/index'; +export { analytics, experimental, json, logging, workspaces }; diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/index.js b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/index.js new file mode 100644 index 00000000..85dcbfdb --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/index.js @@ -0,0 +1,46 @@ +"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 + */ +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; +var __exportStar = (this && this.__exportStar) || function(m, exports) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.workspaces = exports.logging = exports.json = exports.experimental = exports.analytics = void 0; +const analytics = __importStar(require("./analytics")); +exports.analytics = analytics; +const experimental = __importStar(require("./experimental")); +exports.experimental = experimental; +const json = __importStar(require("./json/index")); +exports.json = json; +const logging = __importStar(require("./logger/index")); +exports.logging = logging; +const workspaces = __importStar(require("./workspace")); +exports.workspaces = workspaces; +__exportStar(require("./exception/exception"), exports); +__exportStar(require("./json/index"), exports); +__exportStar(require("./utils/index"), exports); +__exportStar(require("./virtual-fs/index"), exports); diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/json/index.d.ts b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/json/index.d.ts new file mode 100644 index 00000000..b4634f6f --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/json/index.d.ts @@ -0,0 +1,10 @@ +/** + * @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 + */ +import * as schema from './schema/index'; +export * from './utils'; +export { schema }; diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/json/index.js b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/json/index.js new file mode 100644 index 00000000..b33de0a7 --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/json/index.js @@ -0,0 +1,35 @@ +"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 + */ +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; +var __exportStar = (this && this.__exportStar) || function(m, exports) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.schema = void 0; +const schema = __importStar(require("./schema/index")); +exports.schema = schema; +__exportStar(require("./utils"), exports); diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/json/parser.d.ts b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/json/parser.d.ts new file mode 100644 index 00000000..c25f21ca --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/json/parser.d.ts @@ -0,0 +1,104 @@ +/** + * @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 + */ +import { BaseException } from '../exception'; +import { JsonAstNode, Position } from './parser_ast'; +import { JsonValue } from './utils'; +export declare class JsonException extends BaseException { +} +/** + * A character was invalid in this context. + * @deprecated + * @private + */ +export declare class InvalidJsonCharacterException extends JsonException { + invalidChar: string; + line: number; + character: number; + offset: number; + constructor(context: JsonParserContext); +} +/** + * More input was expected, but we reached the end of the stream. + * @deprecated + * @private + */ +export declare class UnexpectedEndOfInputException extends JsonException { + constructor(_context: JsonParserContext); +} +/** + * An error happened within a file. + * @deprecated Deprecated since version 11. Use 3rd party JSON parsers such as `jsonc-parser` instead. + */ +export declare class PathSpecificJsonException extends JsonException { + path: string; + exception: JsonException; + constructor(path: string, exception: JsonException); +} +/** + * Context passed around the parser with information about where we currently are in the parse. + * @deprecated Deprecated since version 11. Use 3rd party JSON parsers such as `jsonc-parser` instead. + */ +export interface JsonParserContext { + position: Position; + previous: Position; + readonly original: string; + readonly mode: JsonParseMode; +} +/** + * The Parse mode used for parsing the JSON string. + */ +export declare enum JsonParseMode { + Strict = 0, + CommentsAllowed = 1, + SingleQuotesAllowed = 2, + IdentifierKeyNamesAllowed = 4, + TrailingCommasAllowed = 8, + HexadecimalNumberAllowed = 16, + MultiLineStringAllowed = 32, + LaxNumberParsingAllowed = 64, + NumberConstantsAllowed = 128, + Default = 0, + Loose = 255, + Json = 0, + Json5 = 255 +} +/** + * Parse the JSON string and return its AST. The AST may be losing data (end comments are + * discarded for example, and space characters are not represented in the AST), but all values + * will have a single node in the AST (a 1-to-1 mapping). + * + * @deprecated Deprecated since version 11. Use 3rd party JSON parsers such as `jsonc-parser` instead. + * @param input The string to use. + * @param mode The mode to parse the input with. {@see JsonParseMode}. + * @returns {JsonAstNode} The root node of the value of the AST. + */ +export declare function parseJsonAst(input: string, mode?: JsonParseMode): JsonAstNode; +/** + * Options for the parseJson() function. + * @deprecated Deprecated since version 11. Use 3rd party JSON parsers such as `jsonc-parser` instead. + */ +export interface ParseJsonOptions { + /** + * If omitted, will only emit errors related to the content of the JSON. If specified, any + * JSON errors will also include the path of the file that caused the error. + */ + path?: string; +} +/** + * Parse a JSON string into its value. This discards the AST and only returns the value itself. + * + * If a path option is pass, it also absorbs JSON parsing errors and return a new error with the + * path in it. Useful for showing errors when parsing from a file. + * + * @deprecated Deprecated since version 11. Use 3rd party JSON parsers such as `jsonc-parser` instead. + * @param input The string to parse. + * @param mode The mode to parse the input with. {@see JsonParseMode}. + * @param options Additional optinos for parsing. + * @returns {JsonValue} The value represented by the JSON string. + */ +export declare function parseJson(input: string, mode?: JsonParseMode, options?: ParseJsonOptions): JsonValue; diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/json/parser.js b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/json/parser.js new file mode 100644 index 00000000..4bdb6eda --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/json/parser.js @@ -0,0 +1,788 @@ +"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.parseJson = exports.parseJsonAst = exports.JsonParseMode = exports.PathSpecificJsonException = exports.UnexpectedEndOfInputException = exports.InvalidJsonCharacterException = exports.JsonException = void 0; +/* eslint-disable no-constant-condition */ +const exception_1 = require("../exception"); +class JsonException extends exception_1.BaseException { +} +exports.JsonException = JsonException; +/** + * A character was invalid in this context. + * @deprecated + * @private + */ +class InvalidJsonCharacterException extends JsonException { + constructor(context) { + const pos = context.previous; + const invalidChar = JSON.stringify(_peek(context)); + super(`Invalid JSON character: ${invalidChar} at ${pos.line}:${pos.character}.`); + this.invalidChar = invalidChar; + this.line = pos.line; + this.offset = pos.offset; + this.character = pos.character; + } +} +exports.InvalidJsonCharacterException = InvalidJsonCharacterException; +/** + * More input was expected, but we reached the end of the stream. + * @deprecated + * @private + */ +class UnexpectedEndOfInputException extends JsonException { + constructor(_context) { + super(`Unexpected end of file.`); + } +} +exports.UnexpectedEndOfInputException = UnexpectedEndOfInputException; +/** + * An error happened within a file. + * @deprecated Deprecated since version 11. Use 3rd party JSON parsers such as `jsonc-parser` instead. + */ +class PathSpecificJsonException extends JsonException { + constructor(path, exception) { + super(`An error happened at file path ${JSON.stringify(path)}: ${exception.message}`); + this.path = path; + this.exception = exception; + } +} +exports.PathSpecificJsonException = PathSpecificJsonException; +/** + * Peek and return the next character from the context. + * @private + */ +function _peek(context) { + return context.original[context.position.offset]; +} +/** + * Move the context to the next character, including incrementing the line if necessary. + * @private + */ +function _next(context) { + context.previous = context.position; + let { offset, line, character } = context.position; + const char = context.original[offset]; + offset++; + if (char == '\n') { + line++; + character = 0; + } + else { + character++; + } + context.position = { offset, line, character }; +} +function _token(context, valid) { + const char = _peek(context); + if (valid) { + if (!char) { + throw new UnexpectedEndOfInputException(context); + } + if (valid.indexOf(char) == -1) { + throw new InvalidJsonCharacterException(context); + } + } + // Move the position of the context to the next character. + _next(context); + return char; +} +/** + * Read the exponent part of a number. The exponent part is looser for JSON than the number + * part. `str` is the string of the number itself found so far, and start the position + * where the full number started. Returns the node found. + * @private + */ +function _readExpNumber(context, start, str, comments) { + let char; + let signed = false; + while (true) { + char = _token(context); + if (char == '+' || char == '-') { + if (signed) { + break; + } + signed = true; + str += char; + } + else if (char == '0' || + char == '1' || + char == '2' || + char == '3' || + char == '4' || + char == '5' || + char == '6' || + char == '7' || + char == '8' || + char == '9') { + signed = true; + str += char; + } + else { + break; + } + } + // We're done reading this number. + context.position = context.previous; + return { + kind: 'number', + start, + end: context.position, + text: context.original.substring(start.offset, context.position.offset), + value: Number.parseFloat(str), + comments: comments, + }; +} +/** + * Read the hexa part of a 0xBADCAFE hexadecimal number. + * @private + */ +function _readHexaNumber(context, isNegative, start, comments) { + // Read an hexadecimal number, until it's not hexadecimal. + let hexa = ''; + const valid = '0123456789abcdefABCDEF'; + for (let ch = _peek(context); ch && valid.includes(ch); ch = _peek(context)) { + // Add it to the hexa string. + hexa += ch; + // Move the position of the context to the next character. + _next(context); + } + const value = Number.parseInt(hexa, 16); + // We're done reading this number. + return { + kind: 'number', + start, + end: context.position, + text: context.original.substring(start.offset, context.position.offset), + value: isNegative ? -value : value, + comments, + }; +} +/** + * Read a number from the context. + * @private + */ +function _readNumber(context, comments = _readBlanks(context)) { + let str = ''; + let dotted = false; + const start = context.position; + // read until `e` or end of line. + while (true) { + const char = _token(context); + // Read tokens, one by one. + if (char == '-') { + if (str != '') { + throw new InvalidJsonCharacterException(context); + } + } + else if (char == 'I' && + (str == '-' || str == '' || str == '+') && + (context.mode & JsonParseMode.NumberConstantsAllowed) != 0) { + // Infinity? + // _token(context, 'I'); Already read. + _token(context, 'n'); + _token(context, 'f'); + _token(context, 'i'); + _token(context, 'n'); + _token(context, 'i'); + _token(context, 't'); + _token(context, 'y'); + str += 'Infinity'; + break; + } + else if (char == '0') { + if (str == '0' || str == '-0') { + throw new InvalidJsonCharacterException(context); + } + } + else if (char == '1' || + char == '2' || + char == '3' || + char == '4' || + char == '5' || + char == '6' || + char == '7' || + char == '8' || + char == '9') { + if (str == '0' || str == '-0') { + throw new InvalidJsonCharacterException(context); + } + } + else if (char == '+' && str == '') { + // Pass over. + } + else if (char == '.') { + if (dotted) { + throw new InvalidJsonCharacterException(context); + } + dotted = true; + } + else if (char == 'e' || char == 'E') { + return _readExpNumber(context, start, str + char, comments); + } + else if (char == 'x' && + (str == '0' || str == '-0') && + (context.mode & JsonParseMode.HexadecimalNumberAllowed) != 0) { + return _readHexaNumber(context, str == '-0', start, comments); + } + else { + // We read one too many characters, so rollback the last character. + context.position = context.previous; + break; + } + str += char; + } + // We're done reading this number. + if (str.endsWith('.') && (context.mode & JsonParseMode.HexadecimalNumberAllowed) == 0) { + throw new InvalidJsonCharacterException(context); + } + return { + kind: 'number', + start, + end: context.position, + text: context.original.substring(start.offset, context.position.offset), + value: Number.parseFloat(str), + comments, + }; +} +/** + * Read a string from the context. Takes the comments of the string or read the blanks before the + * string. + * @private + */ +function _readString(context, comments = _readBlanks(context)) { + const start = context.position; + // Consume the first string delimiter. + const delim = _token(context); + if ((context.mode & JsonParseMode.SingleQuotesAllowed) == 0) { + if (delim == "'") { + throw new InvalidJsonCharacterException(context); + } + } + let str = ''; + while (true) { + let char = _token(context); + if (char == delim) { + return { + kind: 'string', + start, + end: context.position, + text: context.original.substring(start.offset, context.position.offset), + value: str, + comments: comments, + }; + } + else if (char == '\\') { + char = _token(context); + switch (char) { + case '\\': + case '/': + case '"': + case delim: + str += char; + break; + case 'b': + str += '\b'; + break; + case 'f': + str += '\f'; + break; + case 'n': + str += '\n'; + break; + case 'r': + str += '\r'; + break; + case 't': + str += '\t'; + break; + case 'u': + const [c0] = _token(context, '0123456789abcdefABCDEF'); + const [c1] = _token(context, '0123456789abcdefABCDEF'); + const [c2] = _token(context, '0123456789abcdefABCDEF'); + const [c3] = _token(context, '0123456789abcdefABCDEF'); + str += String.fromCharCode(parseInt(c0 + c1 + c2 + c3, 16)); + break; + case undefined: + throw new UnexpectedEndOfInputException(context); + case '\n': + // Only valid when multiline strings are allowed. + if ((context.mode & JsonParseMode.MultiLineStringAllowed) == 0) { + throw new InvalidJsonCharacterException(context); + } + str += char; + break; + default: + throw new InvalidJsonCharacterException(context); + } + } + else if (char === undefined) { + throw new UnexpectedEndOfInputException(context); + } + else if (char == '\b' || char == '\f' || char == '\n' || char == '\r' || char == '\t') { + throw new InvalidJsonCharacterException(context); + } + else { + str += char; + } + } +} +/** + * Read the constant `true` from the context. + * @private + */ +function _readTrue(context, comments = _readBlanks(context)) { + const start = context.position; + _token(context, 't'); + _token(context, 'r'); + _token(context, 'u'); + _token(context, 'e'); + const end = context.position; + return { + kind: 'true', + start, + end, + text: context.original.substring(start.offset, end.offset), + value: true, + comments, + }; +} +/** + * Read the constant `false` from the context. + * @private + */ +function _readFalse(context, comments = _readBlanks(context)) { + const start = context.position; + _token(context, 'f'); + _token(context, 'a'); + _token(context, 'l'); + _token(context, 's'); + _token(context, 'e'); + const end = context.position; + return { + kind: 'false', + start, + end, + text: context.original.substring(start.offset, end.offset), + value: false, + comments, + }; +} +/** + * Read the constant `null` from the context. + * @private + */ +function _readNull(context, comments = _readBlanks(context)) { + const start = context.position; + _token(context, 'n'); + _token(context, 'u'); + _token(context, 'l'); + _token(context, 'l'); + const end = context.position; + return { + kind: 'null', + start, + end, + text: context.original.substring(start.offset, end.offset), + value: null, + comments: comments, + }; +} +/** + * Read the constant `NaN` from the context. + * @private + */ +function _readNaN(context, comments = _readBlanks(context)) { + const start = context.position; + _token(context, 'N'); + _token(context, 'a'); + _token(context, 'N'); + const end = context.position; + return { + kind: 'number', + start, + end, + text: context.original.substring(start.offset, end.offset), + value: NaN, + comments: comments, + }; +} +/** + * Read an array of JSON values from the context. + * @private + */ +function _readArray(context, comments = _readBlanks(context)) { + const start = context.position; + // Consume the first delimiter. + _token(context, '['); + const value = []; + const elements = []; + _readBlanks(context); + if (_peek(context) != ']') { + const node = _readValue(context); + elements.push(node); + value.push(node.value); + } + while (_peek(context) != ']') { + _token(context, ','); + const valueComments = _readBlanks(context); + if ((context.mode & JsonParseMode.TrailingCommasAllowed) !== 0 && _peek(context) === ']') { + break; + } + const node = _readValue(context, valueComments); + elements.push(node); + value.push(node.value); + } + _token(context, ']'); + return { + kind: 'array', + start, + end: context.position, + text: context.original.substring(start.offset, context.position.offset), + value, + elements, + comments, + }; +} +/** + * Read an identifier from the context. An identifier is a valid JavaScript identifier, and this + * function is only used in Loose mode. + * @private + */ +function _readIdentifier(context, comments = _readBlanks(context)) { + const start = context.position; + let char = _peek(context); + if (char && '0123456789'.indexOf(char) != -1) { + const identifierNode = _readNumber(context); + return { + kind: 'identifier', + start, + end: identifierNode.end, + text: identifierNode.text, + value: identifierNode.value.toString(), + }; + } + const identValidFirstChar = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMOPQRSTUVWXYZ'; + const identValidChar = '_$abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMOPQRSTUVWXYZ0123456789'; + let first = true; + let value = ''; + while (true) { + char = _token(context); + if (char == undefined || + (first ? identValidFirstChar.indexOf(char) : identValidChar.indexOf(char)) == -1) { + context.position = context.previous; + return { + kind: 'identifier', + start, + end: context.position, + text: context.original.substr(start.offset, context.position.offset), + value, + comments, + }; + } + value += char; + first = false; + } +} +/** + * Read a property from the context. A property is a string or (in Loose mode only) a number or + * an identifier, followed by a colon `:`. + * @private + */ +function _readProperty(context, comments = _readBlanks(context)) { + const start = context.position; + let key; + if ((context.mode & JsonParseMode.IdentifierKeyNamesAllowed) != 0) { + const top = _peek(context); + if (top == '"' || top == "'") { + key = _readString(context); + } + else { + key = _readIdentifier(context); + } + } + else { + key = _readString(context); + } + _readBlanks(context); + _token(context, ':'); + const value = _readValue(context); + const end = context.position; + return { + kind: 'keyvalue', + key, + value, + start, + end, + text: context.original.substring(start.offset, end.offset), + comments, + }; +} +/** + * Read an object of properties -> JSON values from the context. + * @private + */ +function _readObject(context, comments = _readBlanks(context)) { + const start = context.position; + // Consume the first delimiter. + _token(context, '{'); + const value = {}; + const properties = []; + _readBlanks(context); + if (_peek(context) != '}') { + const property = _readProperty(context); + value[property.key.value] = property.value.value; + properties.push(property); + while (_peek(context) != '}') { + _token(context, ','); + const propertyComments = _readBlanks(context); + if ((context.mode & JsonParseMode.TrailingCommasAllowed) !== 0 && _peek(context) === '}') { + break; + } + const property = _readProperty(context, propertyComments); + value[property.key.value] = property.value.value; + properties.push(property); + } + } + _token(context, '}'); + return { + kind: 'object', + properties, + start, + end: context.position, + value, + text: context.original.substring(start.offset, context.position.offset), + comments, + }; +} +/** + * Remove any blank character or comments (in Loose mode) from the context, returning an array + * of comments if any are found. + * @private + */ +function _readBlanks(context) { + if ((context.mode & JsonParseMode.CommentsAllowed) != 0) { + const comments = []; + while (true) { + const char = context.original[context.position.offset]; + if (char == '/' && context.original[context.position.offset + 1] == '*') { + const start = context.position; + // Multi line comment. + _next(context); + _next(context); + while (context.original[context.position.offset] != '*' || + context.original[context.position.offset + 1] != '/') { + _next(context); + if (context.position.offset >= context.original.length) { + throw new UnexpectedEndOfInputException(context); + } + } + // Remove "*/". + _next(context); + _next(context); + comments.push({ + kind: 'multicomment', + start, + end: context.position, + text: context.original.substring(start.offset, context.position.offset), + content: context.original.substring(start.offset + 2, context.position.offset - 2), + }); + } + else if (char == '/' && context.original[context.position.offset + 1] == '/') { + const start = context.position; + // Multi line comment. + _next(context); + _next(context); + while (context.original[context.position.offset] != '\n') { + _next(context); + if (context.position.offset >= context.original.length) { + break; + } + } + // Remove "\n". + if (context.position.offset < context.original.length) { + _next(context); + } + comments.push({ + kind: 'comment', + start, + end: context.position, + text: context.original.substring(start.offset, context.position.offset), + content: context.original.substring(start.offset + 2, context.position.offset - 1), + }); + } + else if (char == ' ' || char == '\t' || char == '\n' || char == '\r' || char == '\f') { + _next(context); + } + else { + break; + } + } + return comments; + } + else { + let char = context.original[context.position.offset]; + while (char == ' ' || char == '\t' || char == '\n' || char == '\r' || char == '\f') { + _next(context); + char = context.original[context.position.offset]; + } + return []; + } +} +/** + * Read a JSON value from the context, which can be any form of JSON value. + * @private + */ +function _readValue(context, comments = _readBlanks(context)) { + let result; + // Clean up before. + const char = _peek(context); + switch (char) { + case undefined: + throw new UnexpectedEndOfInputException(context); + case '-': + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': + result = _readNumber(context, comments); + break; + case '.': + case '+': + if ((context.mode & JsonParseMode.LaxNumberParsingAllowed) == 0) { + throw new InvalidJsonCharacterException(context); + } + result = _readNumber(context, comments); + break; + case "'": + case '"': + result = _readString(context, comments); + break; + case 'I': + if ((context.mode & JsonParseMode.NumberConstantsAllowed) == 0) { + throw new InvalidJsonCharacterException(context); + } + result = _readNumber(context, comments); + break; + case 'N': + if ((context.mode & JsonParseMode.NumberConstantsAllowed) == 0) { + throw new InvalidJsonCharacterException(context); + } + result = _readNaN(context, comments); + break; + case 't': + result = _readTrue(context, comments); + break; + case 'f': + result = _readFalse(context, comments); + break; + case 'n': + result = _readNull(context, comments); + break; + case '[': + result = _readArray(context, comments); + break; + case '{': + result = _readObject(context, comments); + break; + default: + throw new InvalidJsonCharacterException(context); + } + // Clean up after. + _readBlanks(context); + return result; +} +/** + * The Parse mode used for parsing the JSON string. + */ +var JsonParseMode; +(function (JsonParseMode) { + JsonParseMode[JsonParseMode["Strict"] = 0] = "Strict"; + JsonParseMode[JsonParseMode["CommentsAllowed"] = 1] = "CommentsAllowed"; + JsonParseMode[JsonParseMode["SingleQuotesAllowed"] = 2] = "SingleQuotesAllowed"; + JsonParseMode[JsonParseMode["IdentifierKeyNamesAllowed"] = 4] = "IdentifierKeyNamesAllowed"; + JsonParseMode[JsonParseMode["TrailingCommasAllowed"] = 8] = "TrailingCommasAllowed"; + JsonParseMode[JsonParseMode["HexadecimalNumberAllowed"] = 16] = "HexadecimalNumberAllowed"; + JsonParseMode[JsonParseMode["MultiLineStringAllowed"] = 32] = "MultiLineStringAllowed"; + JsonParseMode[JsonParseMode["LaxNumberParsingAllowed"] = 64] = "LaxNumberParsingAllowed"; + JsonParseMode[JsonParseMode["NumberConstantsAllowed"] = 128] = "NumberConstantsAllowed"; + JsonParseMode[JsonParseMode["Default"] = 0] = "Default"; + JsonParseMode[JsonParseMode["Loose"] = 255] = "Loose"; + JsonParseMode[JsonParseMode["Json"] = 0] = "Json"; + JsonParseMode[JsonParseMode["Json5"] = 255] = "Json5"; +})(JsonParseMode = exports.JsonParseMode || (exports.JsonParseMode = {})); +/** + * Parse the JSON string and return its AST. The AST may be losing data (end comments are + * discarded for example, and space characters are not represented in the AST), but all values + * will have a single node in the AST (a 1-to-1 mapping). + * + * @deprecated Deprecated since version 11. Use 3rd party JSON parsers such as `jsonc-parser` instead. + * @param input The string to use. + * @param mode The mode to parse the input with. {@see JsonParseMode}. + * @returns {JsonAstNode} The root node of the value of the AST. + */ +function parseJsonAst(input, mode = JsonParseMode.Default) { + if (mode == JsonParseMode.Default) { + mode = JsonParseMode.Strict; + } + const context = { + position: { offset: 0, line: 0, character: 0 }, + previous: { offset: 0, line: 0, character: 0 }, + original: input, + comments: undefined, + mode, + }; + const ast = _readValue(context); + if (context.position.offset < input.length) { + const rest = input.substr(context.position.offset); + const i = rest.length > 20 ? rest.substr(0, 20) + '...' : rest; + throw new Error(`Expected end of file, got "${i}" at ` + + `${context.position.line}:${context.position.character}.`); + } + return ast; +} +exports.parseJsonAst = parseJsonAst; +/** + * Parse a JSON string into its value. This discards the AST and only returns the value itself. + * + * If a path option is pass, it also absorbs JSON parsing errors and return a new error with the + * path in it. Useful for showing errors when parsing from a file. + * + * @deprecated Deprecated since version 11. Use 3rd party JSON parsers such as `jsonc-parser` instead. + * @param input The string to parse. + * @param mode The mode to parse the input with. {@see JsonParseMode}. + * @param options Additional optinos for parsing. + * @returns {JsonValue} The value represented by the JSON string. + */ +function parseJson(input, mode = JsonParseMode.Default, options) { + try { + // Try parsing for the fastest path available, if error, uses our own parser for better errors. + if (mode == JsonParseMode.Strict) { + try { + return JSON.parse(input); + } + catch (err) { + return parseJsonAst(input, mode).value; + } + } + return parseJsonAst(input, mode).value; + } + catch (e) { + if (options && options.path && e instanceof JsonException) { + throw new PathSpecificJsonException(options.path, e); + } + throw e; + } +} +exports.parseJson = parseJson; diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/json/parser_ast.d.ts b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/json/parser_ast.d.ts new file mode 100644 index 00000000..e9ee5818 --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/json/parser_ast.d.ts @@ -0,0 +1,67 @@ +/** + * @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 + */ +import { JsonArray, JsonObject } from './utils'; +export interface Position { + readonly offset: number; + readonly line: number; + readonly character: number; +} +export declare type JsonAstNode = JsonAstNumber | JsonAstString | JsonAstIdentifier | JsonAstArray | JsonAstObject | JsonAstConstantFalse | JsonAstConstantNull | JsonAstConstantTrue; +export interface JsonAstNodeBase { + readonly start: Position; + readonly end: Position; + readonly text: string; + readonly comments?: (JsonAstComment | JsonAstMultilineComment)[]; +} +export interface JsonAstNumber extends JsonAstNodeBase { + readonly kind: 'number'; + readonly value: number; +} +export interface JsonAstString extends JsonAstNodeBase { + readonly kind: 'string'; + readonly value: string; +} +export interface JsonAstIdentifier extends JsonAstNodeBase { + readonly kind: 'identifier'; + readonly value: string; +} +export interface JsonAstArray extends JsonAstNodeBase { + readonly kind: 'array'; + readonly elements: JsonAstNode[]; + readonly value: JsonArray; +} +export interface JsonAstKeyValue extends JsonAstNodeBase { + readonly kind: 'keyvalue'; + readonly key: JsonAstString | JsonAstIdentifier; + readonly value: JsonAstNode; +} +export interface JsonAstObject extends JsonAstNodeBase { + readonly kind: 'object'; + readonly properties: JsonAstKeyValue[]; + readonly value: JsonObject; +} +export interface JsonAstConstantFalse extends JsonAstNodeBase { + readonly kind: 'false'; + readonly value: false; +} +export interface JsonAstConstantNull extends JsonAstNodeBase { + readonly kind: 'null'; + readonly value: null; +} +export interface JsonAstConstantTrue extends JsonAstNodeBase { + readonly kind: 'true'; + readonly value: true; +} +export interface JsonAstMultilineComment extends JsonAstNodeBase { + readonly kind: 'multicomment'; + readonly content: string; +} +export interface JsonAstComment extends JsonAstNodeBase { + readonly kind: 'comment'; + readonly content: string; +} diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/json/parser_ast.js b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/json/parser_ast.js new file mode 100644 index 00000000..b599b96d --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/json/parser_ast.js @@ -0,0 +1,9 @@ +"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 }); diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/json/schema/index.d.ts b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/json/schema/index.d.ts new file mode 100644 index 00000000..144489d4 --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/json/schema/index.d.ts @@ -0,0 +1,15 @@ +/** + * @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 + */ +import * as transforms from './transforms'; +export * from './interface'; +export * from './pointer'; +export * from './registry'; +export * from './schema'; +export * from './visitor'; +export * from './utility'; +export { transforms }; diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/json/schema/index.js b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/json/schema/index.js new file mode 100644 index 00000000..d7662bd3 --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/json/schema/index.js @@ -0,0 +1,40 @@ +"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 + */ +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; +var __exportStar = (this && this.__exportStar) || function(m, exports) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.transforms = void 0; +const transforms = __importStar(require("./transforms")); +exports.transforms = transforms; +__exportStar(require("./interface"), exports); +__exportStar(require("./pointer"), exports); +__exportStar(require("./registry"), exports); +__exportStar(require("./schema"), exports); +__exportStar(require("./visitor"), exports); +__exportStar(require("./utility"), exports); diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/json/schema/interface.d.ts b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/json/schema/interface.d.ts new file mode 100644 index 00000000..9e1e080a --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/json/schema/interface.d.ts @@ -0,0 +1,88 @@ +/** + * @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 + */ +import { ErrorObject, Format } from 'ajv'; +import { Observable, SubscribableOrPromise } from 'rxjs'; +import { JsonArray, JsonObject, JsonValue } from '../utils'; +export declare type JsonPointer = string & { + __PRIVATE_DEVKIT_JSON_POINTER: void; +}; +export interface SchemaValidatorResult { + data: JsonValue; + success: boolean; + errors?: SchemaValidatorError[]; +} +export declare type SchemaValidatorError = Partial<ErrorObject>; +export interface SchemaValidatorOptions { + applyPreTransforms?: boolean; + applyPostTransforms?: boolean; + withPrompts?: boolean; +} +export interface SchemaValidator { + (data: JsonValue, options?: SchemaValidatorOptions): Observable<SchemaValidatorResult>; +} +export declare type SchemaFormatter = Format; +export interface SchemaFormat { + name: string; + formatter: SchemaFormatter; +} +export interface SmartDefaultProvider<T> { + (schema: JsonObject): T | Observable<T>; +} +export interface SchemaKeywordValidator { + (data: JsonValue, schema: JsonValue, parent: JsonObject | JsonArray | undefined, parentProperty: string | number | undefined, pointer: JsonPointer, rootData: JsonValue): boolean | Observable<boolean>; +} +export interface PromptDefinition { + id: string; + type: string; + message: string; + default?: string | string[] | number | boolean | null; + validator?: (value: JsonValue) => boolean | string | Promise<boolean | string>; + items?: Array<string | { + value: JsonValue; + label: string; + }>; + raw?: string | JsonObject; + multiselect?: boolean; + propertyTypes: Set<string>; +} +export declare type PromptProvider = (definitions: Array<PromptDefinition>) => SubscribableOrPromise<{ + [id: string]: JsonValue; +}>; +export interface SchemaRegistry { + compile(schema: Object): Observable<SchemaValidator>; + /** + * @deprecated since 11.2 without replacement. + * Producing a flatten schema document does not in all cases produce a schema with identical behavior to the original. + * See: https://json-schema.org/draft/2019-09/json-schema-core.html#rfc.appendix.B.2 + */ + flatten(schema: JsonObject | string): Observable<JsonObject>; + addFormat(format: SchemaFormat): void; + addSmartDefaultProvider<T>(source: string, provider: SmartDefaultProvider<T>): void; + usePromptProvider(provider: PromptProvider): void; + useXDeprecatedProvider(onUsage: (message: string) => void): void; + /** + * Add a transformation step before the validation of any Json. + * @param {JsonVisitor} visitor The visitor to transform every value. + * @param {JsonVisitor[]} deps A list of other visitors to run before. + */ + addPreTransform(visitor: JsonVisitor, deps?: JsonVisitor[]): void; + /** + * Add a transformation step after the validation of any Json. The JSON will not be validated + * after the POST, so if transformations are not compatible with the Schema it will not result + * in an error. + * @param {JsonVisitor} visitor The visitor to transform every value. + * @param {JsonVisitor[]} deps A list of other visitors to run before. + */ + addPostTransform(visitor: JsonVisitor, deps?: JsonVisitor[]): void; +} +export interface JsonSchemaVisitor { + (current: JsonObject | JsonArray, pointer: JsonPointer, parentSchema?: JsonObject | JsonArray, index?: string): void; +} +export interface JsonVisitor { + (value: JsonValue, pointer: JsonPointer, schema?: JsonObject, root?: JsonObject | JsonArray): Observable<JsonValue> | JsonValue; +} diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/json/schema/interface.js b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/json/schema/interface.js new file mode 100644 index 00000000..b599b96d --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/json/schema/interface.js @@ -0,0 +1,9 @@ +"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 }); diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/json/schema/pointer.d.ts b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/json/schema/pointer.d.ts new file mode 100644 index 00000000..3a1a6652 --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/json/schema/pointer.d.ts @@ -0,0 +1,11 @@ +/** + * @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 + */ +import { JsonPointer } from './interface'; +export declare function buildJsonPointer(fragments: string[]): JsonPointer; +export declare function joinJsonPointer(root: JsonPointer, ...others: string[]): JsonPointer; +export declare function parseJsonPointer(pointer: JsonPointer): string[]; diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/json/schema/pointer.js b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/json/schema/pointer.js new file mode 100644 index 00000000..22da5d16 --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/json/schema/pointer.js @@ -0,0 +1,39 @@ +"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.parseJsonPointer = exports.joinJsonPointer = exports.buildJsonPointer = void 0; +function buildJsonPointer(fragments) { + return ('/' + + fragments + .map((f) => { + return f.replace(/~/g, '~0').replace(/\//g, '~1'); + }) + .join('/')); +} +exports.buildJsonPointer = buildJsonPointer; +function joinJsonPointer(root, ...others) { + if (root == '/') { + return buildJsonPointer(others); + } + return (root + buildJsonPointer(others)); +} +exports.joinJsonPointer = joinJsonPointer; +function parseJsonPointer(pointer) { + if (pointer === '') { + return []; + } + if (pointer.charAt(0) !== '/') { + throw new Error('Relative pointer: ' + pointer); + } + return pointer + .substring(1) + .split(/\//) + .map((str) => str.replace(/~1/g, '/').replace(/~0/g, '~')); +} +exports.parseJsonPointer = parseJsonPointer; diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/json/schema/registry.d.ts b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/json/schema/registry.d.ts new file mode 100644 index 00000000..ad79df2b --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/json/schema/registry.d.ts @@ -0,0 +1,80 @@ +/** + * @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 + */ +import { ValidateFunction } from 'ajv'; +import { Observable } from 'rxjs'; +import { BaseException } from '../../exception/exception'; +import { JsonObject } from '../utils'; +import { JsonVisitor, PromptProvider, SchemaFormat, SchemaRegistry, SchemaValidator, SchemaValidatorError, SmartDefaultProvider } from './interface'; +import { JsonSchema } from './schema'; +export declare type UriHandler = (uri: string) => Observable<JsonObject> | Promise<JsonObject> | null | undefined; +export declare class SchemaValidationException extends BaseException { + readonly errors: SchemaValidatorError[]; + constructor(errors?: SchemaValidatorError[], baseMessage?: string); + static createMessages(errors?: SchemaValidatorError[]): string[]; +} +export declare class CoreSchemaRegistry implements SchemaRegistry { + private _ajv; + private _uriCache; + private _uriHandlers; + private _pre; + private _post; + private _currentCompilationSchemaInfo?; + private _smartDefaultKeyword; + private _promptProvider?; + private _sourceMap; + constructor(formats?: SchemaFormat[]); + private _fetch; + /** + * Add a transformation step before the validation of any Json. + * @param {JsonVisitor} visitor The visitor to transform every value. + * @param {JsonVisitor[]} deps A list of other visitors to run before. + */ + addPreTransform(visitor: JsonVisitor, deps?: JsonVisitor[]): void; + /** + * Add a transformation step after the validation of any Json. The JSON will not be validated + * after the POST, so if transformations are not compatible with the Schema it will not result + * in an error. + * @param {JsonVisitor} visitor The visitor to transform every value. + * @param {JsonVisitor[]} deps A list of other visitors to run before. + */ + addPostTransform(visitor: JsonVisitor, deps?: JsonVisitor[]): void; + protected _resolver(ref: string, validate?: ValidateFunction): { + context?: ValidateFunction; + schema?: JsonObject; + }; + /** + * Flatten the Schema, resolving and replacing all the refs. Makes it into a synchronous schema + * that is also easier to traverse. Does not cache the result. + * + * @param schema The schema or URI to flatten. + * @returns An Observable of the flattened schema object. + * @deprecated since 11.2 without replacement. + * Producing a flatten schema document does not in all cases produce a schema with identical behavior to the original. + * See: https://json-schema.org/draft/2019-09/json-schema-core.html#rfc.appendix.B.2 + */ + flatten(schema: JsonObject): Observable<JsonObject>; + private _flatten; + /** + * Compile and return a validation function for the Schema. + * + * @param schema The schema to validate. If a string, will fetch the schema before compiling it + * (using schema as a URI). + * @returns An Observable of the Validation function. + */ + compile(schema: JsonSchema): Observable<SchemaValidator>; + private _compile; + addFormat(format: SchemaFormat): void; + addSmartDefaultProvider<T>(source: string, provider: SmartDefaultProvider<T>): void; + registerUriHandler(handler: UriHandler): void; + usePromptProvider(provider: PromptProvider): void; + private _applyPrompts; + private static _set; + private _applySmartDefaults; + useXDeprecatedProvider(onUsage: (message: string) => void): void; + private normalizeDataPathArr; +} diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/json/schema/registry.js b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/json/schema/registry.js new file mode 100644 index 00000000..6c9707ae --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/json/schema/registry.js @@ -0,0 +1,548 @@ +"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 + */ +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.CoreSchemaRegistry = exports.SchemaValidationException = void 0; +const ajv_1 = __importDefault(require("ajv")); +const ajv_formats_1 = __importDefault(require("ajv-formats")); +const http = __importStar(require("http")); +const https = __importStar(require("https")); +const rxjs_1 = require("rxjs"); +const operators_1 = require("rxjs/operators"); +const Url = __importStar(require("url")); +const exception_1 = require("../../exception/exception"); +const utils_1 = require("../../utils"); +const utils_2 = require("../utils"); +const utility_1 = require("./utility"); +const visitor_1 = require("./visitor"); +class SchemaValidationException extends exception_1.BaseException { + constructor(errors, baseMessage = 'Schema validation failed with the following errors:') { + if (!errors || errors.length === 0) { + super('Schema validation failed.'); + this.errors = []; + return; + } + const messages = SchemaValidationException.createMessages(errors); + super(`${baseMessage}\n ${messages.join('\n ')}`); + this.errors = errors; + } + static createMessages(errors) { + if (!errors || errors.length === 0) { + return []; + } + const messages = errors.map((err) => { + var _a; + let message = `Data path ${JSON.stringify(err.instancePath)} ${err.message}`; + if (err.params) { + switch (err.keyword) { + case 'additionalProperties': + message += `(${err.params.additionalProperty})`; + break; + case 'enum': + message += `. Allowed values are: ${(_a = err.params.allowedValues) === null || _a === void 0 ? void 0 : _a.map((v) => `"${v}"`).join(', ')}`; + break; + } + } + return message + '.'; + }); + return messages; + } +} +exports.SchemaValidationException = SchemaValidationException; +class CoreSchemaRegistry { + constructor(formats = []) { + this._uriCache = new Map(); + this._uriHandlers = new Set(); + this._pre = new utils_1.PartiallyOrderedSet(); + this._post = new utils_1.PartiallyOrderedSet(); + this._smartDefaultKeyword = false; + this._sourceMap = new Map(); + this._ajv = new ajv_1.default({ + strict: false, + loadSchema: (uri) => this._fetch(uri), + passContext: true, + }); + (0, ajv_formats_1.default)(this._ajv); + for (const format of formats) { + this.addFormat(format); + } + } + async _fetch(uri) { + const maybeSchema = this._uriCache.get(uri); + if (maybeSchema) { + return maybeSchema; + } + // Try all handlers, one after the other. + for (const handler of this._uriHandlers) { + let handlerResult = handler(uri); + if (handlerResult === null || handlerResult === undefined) { + continue; + } + if ((0, rxjs_1.isObservable)(handlerResult)) { + handlerResult = handlerResult.toPromise(); + } + const value = await handlerResult; + this._uriCache.set(uri, value); + return value; + } + // If none are found, handle using http client. + return new Promise((resolve, reject) => { + const url = new Url.URL(uri); + const client = url.protocol === 'https:' ? https : http; + client.get(url, (res) => { + if (!res.statusCode || res.statusCode >= 300) { + // Consume the rest of the data to free memory. + res.resume(); + reject(new Error(`Request failed. Status Code: ${res.statusCode}`)); + } + else { + res.setEncoding('utf8'); + let data = ''; + res.on('data', (chunk) => { + data += chunk; + }); + res.on('end', () => { + try { + const json = JSON.parse(data); + this._uriCache.set(uri, json); + resolve(json); + } + catch (err) { + reject(err); + } + }); + } + }); + }); + } + /** + * Add a transformation step before the validation of any Json. + * @param {JsonVisitor} visitor The visitor to transform every value. + * @param {JsonVisitor[]} deps A list of other visitors to run before. + */ + addPreTransform(visitor, deps) { + this._pre.add(visitor, deps); + } + /** + * Add a transformation step after the validation of any Json. The JSON will not be validated + * after the POST, so if transformations are not compatible with the Schema it will not result + * in an error. + * @param {JsonVisitor} visitor The visitor to transform every value. + * @param {JsonVisitor[]} deps A list of other visitors to run before. + */ + addPostTransform(visitor, deps) { + this._post.add(visitor, deps); + } + _resolver(ref, validate) { + if (!validate || !ref) { + return {}; + } + const schema = validate.schemaEnv.root.schema; + const id = typeof schema === 'object' ? schema.$id : null; + let fullReference = ref; + if (typeof id === 'string') { + fullReference = Url.resolve(id, ref); + if (ref.startsWith('#')) { + fullReference = id + fullReference; + } + } + const resolvedSchema = this._ajv.getSchema(fullReference); + return { + context: resolvedSchema === null || resolvedSchema === void 0 ? void 0 : resolvedSchema.schemaEnv.validate, + schema: resolvedSchema === null || resolvedSchema === void 0 ? void 0 : resolvedSchema.schema, + }; + } + /** + * Flatten the Schema, resolving and replacing all the refs. Makes it into a synchronous schema + * that is also easier to traverse. Does not cache the result. + * + * @param schema The schema or URI to flatten. + * @returns An Observable of the flattened schema object. + * @deprecated since 11.2 without replacement. + * Producing a flatten schema document does not in all cases produce a schema with identical behavior to the original. + * See: https://json-schema.org/draft/2019-09/json-schema-core.html#rfc.appendix.B.2 + */ + flatten(schema) { + return (0, rxjs_1.from)(this._flatten(schema)); + } + async _flatten(schema) { + this._ajv.removeSchema(schema); + this._currentCompilationSchemaInfo = undefined; + const validate = await this._ajv.compileAsync(schema); + // eslint-disable-next-line @typescript-eslint/no-this-alias + const self = this; + function visitor(current, pointer, parentSchema, index) { + if (current && + parentSchema && + index && + (0, utils_2.isJsonObject)(current) && + Object.prototype.hasOwnProperty.call(current, '$ref') && + typeof current['$ref'] == 'string') { + const resolved = self._resolver(current['$ref'], validate); + if (resolved.schema) { + parentSchema[index] = resolved.schema; + } + } + } + const schemaCopy = (0, utils_1.deepCopy)(validate.schema); + (0, visitor_1.visitJsonSchema)(schemaCopy, visitor); + return schemaCopy; + } + /** + * Compile and return a validation function for the Schema. + * + * @param schema The schema to validate. If a string, will fetch the schema before compiling it + * (using schema as a URI). + * @returns An Observable of the Validation function. + */ + compile(schema) { + return (0, rxjs_1.from)(this._compile(schema)).pipe((0, operators_1.map)((validate) => (value, options) => (0, rxjs_1.from)(validate(value, options)))); + } + async _compile(schema) { + if (typeof schema === 'boolean') { + return async (data) => ({ success: schema, data }); + } + const schemaInfo = { + smartDefaultRecord: new Map(), + promptDefinitions: [], + }; + this._ajv.removeSchema(schema); + let validator; + try { + this._currentCompilationSchemaInfo = schemaInfo; + validator = this._ajv.compile(schema); + } + catch (e) { + // This should eventually be refactored so that we we handle race condition where the same schema is validated at the same time. + if (!(e instanceof ajv_1.default.MissingRefError)) { + throw e; + } + validator = await this._ajv.compileAsync(schema); + } + finally { + this._currentCompilationSchemaInfo = undefined; + } + return async (data, options) => { + var _a; + const validationOptions = { + withPrompts: true, + applyPostTransforms: true, + applyPreTransforms: true, + ...options, + }; + const validationContext = { + promptFieldsWithValue: new Set(), + }; + // Apply pre-validation transforms + if (validationOptions.applyPreTransforms) { + for (const visitor of this._pre.values()) { + data = await (0, visitor_1.visitJson)(data, visitor, schema, this._resolver.bind(this), validator).toPromise(); + } + } + // Apply smart defaults + await this._applySmartDefaults(data, schemaInfo.smartDefaultRecord); + // Apply prompts + if (validationOptions.withPrompts) { + const visitor = (value, pointer) => { + if (value !== undefined) { + validationContext.promptFieldsWithValue.add(pointer); + } + return value; + }; + if (typeof schema === 'object') { + await (0, visitor_1.visitJson)(data, visitor, schema, this._resolver.bind(this), validator).toPromise(); + } + const definitions = schemaInfo.promptDefinitions.filter((def) => !validationContext.promptFieldsWithValue.has(def.id)); + if (definitions.length > 0) { + await this._applyPrompts(data, definitions); + } + } + // Validate using ajv + try { + const success = await validator.call(validationContext, data); + if (!success) { + return { data, success, errors: (_a = validator.errors) !== null && _a !== void 0 ? _a : [] }; + } + } + catch (error) { + if (error instanceof ajv_1.default.ValidationError) { + return { data, success: false, errors: error.errors }; + } + throw error; + } + // Apply post-validation transforms + if (validationOptions.applyPostTransforms) { + for (const visitor of this._post.values()) { + data = await (0, visitor_1.visitJson)(data, visitor, schema, this._resolver.bind(this), validator).toPromise(); + } + } + return { data, success: true }; + }; + } + addFormat(format) { + this._ajv.addFormat(format.name, format.formatter); + } + addSmartDefaultProvider(source, provider) { + if (this._sourceMap.has(source)) { + throw new Error(source); + } + this._sourceMap.set(source, provider); + if (!this._smartDefaultKeyword) { + this._smartDefaultKeyword = true; + this._ajv.addKeyword({ + keyword: '$default', + errors: false, + valid: true, + compile: (schema, _parentSchema, it) => { + const compilationSchemInfo = this._currentCompilationSchemaInfo; + if (compilationSchemInfo === undefined) { + return () => true; + } + // We cheat, heavily. + const pathArray = this.normalizeDataPathArr(it); + compilationSchemInfo.smartDefaultRecord.set(JSON.stringify(pathArray), schema); + return () => true; + }, + metaSchema: { + type: 'object', + properties: { + '$source': { type: 'string' }, + }, + additionalProperties: true, + required: ['$source'], + }, + }); + } + } + registerUriHandler(handler) { + this._uriHandlers.add(handler); + } + usePromptProvider(provider) { + const isSetup = !!this._promptProvider; + this._promptProvider = provider; + if (isSetup) { + return; + } + this._ajv.addKeyword({ + keyword: 'x-prompt', + errors: false, + valid: true, + compile: (schema, parentSchema, it) => { + const compilationSchemInfo = this._currentCompilationSchemaInfo; + if (!compilationSchemInfo) { + return () => true; + } + const path = '/' + this.normalizeDataPathArr(it).join('/'); + let type; + let items; + let message; + if (typeof schema == 'string') { + message = schema; + } + else { + message = schema.message; + type = schema.type; + items = schema.items; + } + const propertyTypes = (0, utility_1.getTypesOfSchema)(parentSchema); + if (!type) { + if (propertyTypes.size === 1 && propertyTypes.has('boolean')) { + type = 'confirmation'; + } + else if (Array.isArray(parentSchema.enum)) { + type = 'list'; + } + else if (propertyTypes.size === 1 && + propertyTypes.has('array') && + parentSchema.items && + Array.isArray(parentSchema.items.enum)) { + type = 'list'; + } + else { + type = 'input'; + } + } + let multiselect; + if (type === 'list') { + multiselect = + schema.multiselect === undefined + ? propertyTypes.size === 1 && propertyTypes.has('array') + : schema.multiselect; + const enumValues = multiselect + ? parentSchema.items && + parentSchema.items.enum + : parentSchema.enum; + if (!items && Array.isArray(enumValues)) { + items = []; + for (const value of enumValues) { + if (typeof value == 'string') { + items.push(value); + } + else if (typeof value == 'object') { + // Invalid + } + else { + items.push({ label: value.toString(), value }); + } + } + } + } + const definition = { + id: path, + type, + message, + raw: schema, + items, + multiselect, + propertyTypes, + default: typeof parentSchema.default == 'object' && + parentSchema.default !== null && + !Array.isArray(parentSchema.default) + ? undefined + : parentSchema.default, + async validator(data) { + var _a; + try { + const result = await it.self.validate(parentSchema, data); + // If the schema is sync then false will be returned on validation failure + if (result) { + return result; + } + else if ((_a = it.self.errors) === null || _a === void 0 ? void 0 : _a.length) { + // Validation errors will be present on the Ajv instance when sync + return it.self.errors[0].message; + } + } + catch (e) { + // If the schema is async then an error will be thrown on validation failure + if (Array.isArray(e.errors) && e.errors.length) { + return e.errors[0].message; + } + } + return false; + }, + }; + compilationSchemInfo.promptDefinitions.push(definition); + return function () { + // If 'this' is undefined in the call, then it defaults to the global + // 'this'. + if (this && this.promptFieldsWithValue) { + this.promptFieldsWithValue.add(path); + } + return true; + }; + }, + metaSchema: { + oneOf: [ + { type: 'string' }, + { + type: 'object', + properties: { + 'type': { type: 'string' }, + 'message': { type: 'string' }, + }, + additionalProperties: true, + required: ['message'], + }, + ], + }, + }); + } + async _applyPrompts(data, prompts) { + const provider = this._promptProvider; + if (!provider) { + return; + } + const answers = await (0, rxjs_1.from)(provider(prompts)).toPromise(); + for (const path in answers) { + const pathFragments = path.split('/').slice(1); + CoreSchemaRegistry._set(data, pathFragments, answers[path], null, undefined, true); + } + } + static _set( + // eslint-disable-next-line @typescript-eslint/no-explicit-any + data, fragments, value, + // eslint-disable-next-line @typescript-eslint/no-explicit-any + parent = null, parentProperty, force) { + for (let index = 0; index < fragments.length; index++) { + const fragment = fragments[index]; + if (/^i\d+$/.test(fragment)) { + if (!Array.isArray(data)) { + return; + } + for (let dataIndex = 0; dataIndex < data.length; dataIndex++) { + CoreSchemaRegistry._set(data[dataIndex], fragments.slice(index + 1), value, data, `${dataIndex}`); + } + return; + } + if (!data && parent !== null && parentProperty) { + data = parent[parentProperty] = {}; + } + parent = data; + parentProperty = fragment; + data = data[fragment]; + } + if (parent && parentProperty && (force || parent[parentProperty] === undefined)) { + parent[parentProperty] = value; + } + } + async _applySmartDefaults(data, smartDefaults) { + for (const [pointer, schema] of smartDefaults.entries()) { + const fragments = JSON.parse(pointer); + const source = this._sourceMap.get(schema.$source); + if (!source) { + continue; + } + let value = source(schema); + if ((0, rxjs_1.isObservable)(value)) { + value = await value.toPromise(); + } + CoreSchemaRegistry._set(data, fragments, value); + } + } + useXDeprecatedProvider(onUsage) { + this._ajv.addKeyword({ + keyword: 'x-deprecated', + validate: (schema, _data, _parentSchema, dataCxt) => { + if (schema) { + onUsage(`Option "${dataCxt === null || dataCxt === void 0 ? void 0 : dataCxt.parentDataProperty}" is deprecated${typeof schema == 'string' ? ': ' + schema : '.'}`); + } + return true; + }, + errors: false, + }); + } + normalizeDataPathArr(it) { + return it.dataPathArr + .slice(1, it.dataLevel + 1) + .map((p) => (typeof p === 'number' ? p : p.str.replace(/"/g, ''))); + } +} +exports.CoreSchemaRegistry = CoreSchemaRegistry; diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/json/schema/schema.d.ts b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/json/schema/schema.d.ts new file mode 100644 index 00000000..d63d132e --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/json/schema/schema.d.ts @@ -0,0 +1,22 @@ +/** + * @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 + */ +import { JsonObject } from '../utils'; +/** + * A specialized interface for JsonSchema (to come). JsonSchemas are also JsonObject. + * + * @public + */ +export declare type JsonSchema = JsonObject | boolean; +export declare function isJsonSchema(value: unknown): value is JsonSchema; +/** + * Return a schema that is the merge of all subschemas, ie. it should validate all the schemas + * that were passed in. It is possible to make an invalid schema this way, e.g. by using + * `mergeSchemas({ type: 'number' }, { type: 'string' })`, which will never validate. + * @param schemas All schemas to be merged. + */ +export declare function mergeSchemas(...schemas: (JsonSchema | undefined)[]): JsonSchema; diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/json/schema/schema.js b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/json/schema/schema.js new file mode 100644 index 00000000..067a4068 --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/json/schema/schema.js @@ -0,0 +1,52 @@ +"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.mergeSchemas = exports.isJsonSchema = void 0; +const utils_1 = require("../utils"); +function isJsonSchema(value) { + return (0, utils_1.isJsonObject)(value) || value === false || value === true; +} +exports.isJsonSchema = isJsonSchema; +/** + * Return a schema that is the merge of all subschemas, ie. it should validate all the schemas + * that were passed in. It is possible to make an invalid schema this way, e.g. by using + * `mergeSchemas({ type: 'number' }, { type: 'string' })`, which will never validate. + * @param schemas All schemas to be merged. + */ +function mergeSchemas(...schemas) { + return schemas.reduce((prev, curr) => { + if (curr === undefined) { + return prev; + } + if (prev === false || curr === false) { + return false; + } + else if (prev === true) { + return curr; + } + else if (curr === true) { + return prev; + } + else if (Array.isArray(prev.allOf)) { + if (Array.isArray(curr.allOf)) { + return { ...prev, allOf: [...prev.allOf, ...curr.allOf] }; + } + else { + return { ...prev, allOf: [...prev.allOf, curr] }; + } + } + else if (Array.isArray(curr.allOf)) { + return { ...prev, allOf: [prev, ...curr.allOf] }; + } + else { + return { ...prev, allOf: [prev, curr] }; + } + }, true); +} +exports.mergeSchemas = mergeSchemas; diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/json/schema/transforms.d.ts b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/json/schema/transforms.d.ts new file mode 100644 index 00000000..6f7a0bbc --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/json/schema/transforms.d.ts @@ -0,0 +1,11 @@ +/** + * @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 + */ +import { JsonValue } from '../utils'; +import { JsonPointer } from './interface'; +import { JsonSchema } from './schema'; +export declare function addUndefinedDefaults(value: JsonValue, _pointer: JsonPointer, schema?: JsonSchema): JsonValue; diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/json/schema/transforms.js b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/json/schema/transforms.js new file mode 100644 index 00000000..c5360c98 --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/json/schema/transforms.js @@ -0,0 +1,94 @@ +"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.addUndefinedDefaults = void 0; +const utils_1 = require("../utils"); +const utility_1 = require("./utility"); +function addUndefinedDefaults(value, _pointer, schema) { + if (typeof schema === 'boolean' || schema === undefined) { + return value; + } + value !== null && value !== void 0 ? value : (value = schema.default); + const types = (0, utility_1.getTypesOfSchema)(schema); + if (types.size === 0) { + return value; + } + let type; + if (types.size === 1) { + // only one potential type + type = Array.from(types)[0]; + } + else if (types.size === 2 && types.has('array') && types.has('object')) { + // need to create one of them and array is simpler + type = 'array'; + } + else if (schema.properties && types.has('object')) { + // assume object + type = 'object'; + } + else if (schema.items && types.has('array')) { + // assume array + type = 'array'; + } + else { + // anything else needs to be checked by the consumer anyway + return value; + } + if (type === 'array') { + return value == undefined ? [] : value; + } + if (type === 'object') { + let newValue; + if (value == undefined) { + newValue = {}; + } + else if ((0, utils_1.isJsonObject)(value)) { + newValue = value; + } + else { + return value; + } + if (!(0, utils_1.isJsonObject)(schema.properties)) { + return newValue; + } + for (const [propName, schemaObject] of Object.entries(schema.properties)) { + if (propName === '$schema' || !(0, utils_1.isJsonObject)(schemaObject)) { + continue; + } + const value = newValue[propName]; + if (value === undefined) { + newValue[propName] = schemaObject.default; + } + else if ((0, utils_1.isJsonObject)(value)) { + // Basic support for oneOf and anyOf. + const propertySchemas = schemaObject.oneOf || schemaObject.anyOf; + const allProperties = Object.keys(value); + // Locate a schema which declares all the properties that the object contains. + const adjustedSchema = (0, utils_1.isJsonArray)(propertySchemas) && + propertySchemas.find((s) => { + if (!(0, utils_1.isJsonObject)(s)) { + return false; + } + const schemaType = (0, utility_1.getTypesOfSchema)(s); + if (schemaType.size === 1 && schemaType.has('object') && (0, utils_1.isJsonObject)(s.properties)) { + const properties = Object.keys(s.properties); + return allProperties.every((key) => properties.includes(key)); + } + return false; + }); + if (adjustedSchema && (0, utils_1.isJsonObject)(adjustedSchema)) { + newValue[propName] = addUndefinedDefaults(value, _pointer, adjustedSchema); + } + } + } + return newValue; + } + return value; +} +exports.addUndefinedDefaults = addUndefinedDefaults; diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/json/schema/utility.d.ts b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/json/schema/utility.d.ts new file mode 100644 index 00000000..6c4eead4 --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/json/schema/utility.d.ts @@ -0,0 +1,9 @@ +/** + * @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 + */ +import { JsonSchema } from './schema'; +export declare function getTypesOfSchema(schema: JsonSchema): Set<string>; diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/json/schema/utility.js b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/json/schema/utility.js new file mode 100644 index 00000000..2691d9a6 --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/json/schema/utility.js @@ -0,0 +1,88 @@ +"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.getTypesOfSchema = void 0; +const utils_1 = require("../utils"); +const allTypes = ['string', 'integer', 'number', 'object', 'array', 'boolean', 'null']; +function getTypesOfSchema(schema) { + if (!schema) { + return new Set(); + } + if (schema === true) { + return new Set(allTypes); + } + let potentials; + if (typeof schema.type === 'string') { + potentials = new Set([schema.type]); + } + else if (Array.isArray(schema.type)) { + potentials = new Set(schema.type); + } + else if ((0, utils_1.isJsonArray)(schema.enum)) { + potentials = new Set(); + // Gather the type of each enum values, and use that as a starter for potential types. + for (const v of schema.enum) { + switch (typeof v) { + case 'string': + case 'number': + case 'boolean': + potentials.add(typeof v); + break; + case 'object': + if (Array.isArray(v)) { + potentials.add('array'); + } + else if (v === null) { + potentials.add('null'); + } + else { + potentials.add('object'); + } + break; + } + } + } + else { + potentials = new Set(allTypes); + } + if ((0, utils_1.isJsonObject)(schema.not)) { + const notTypes = getTypesOfSchema(schema.not); + potentials = new Set([...potentials].filter((p) => !notTypes.has(p))); + } + if (Array.isArray(schema.allOf)) { + for (const sub of schema.allOf) { + const types = getTypesOfSchema(sub); + potentials = new Set([...types].filter((t) => potentials.has(t))); + } + } + if (Array.isArray(schema.oneOf)) { + let options = new Set(); + for (const sub of schema.oneOf) { + const types = getTypesOfSchema(sub); + options = new Set([...options, ...types]); + } + potentials = new Set([...options].filter((o) => potentials.has(o))); + } + if (Array.isArray(schema.anyOf)) { + let options = new Set(); + for (const sub of schema.anyOf) { + const types = getTypesOfSchema(sub); + options = new Set([...options, ...types]); + } + potentials = new Set([...options].filter((o) => potentials.has(o))); + } + if (schema.properties) { + potentials.add('object'); + } + else if (schema.items) { + potentials.add('array'); + } + return potentials; +} +exports.getTypesOfSchema = getTypesOfSchema; diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/json/schema/visitor.d.ts b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/json/schema/visitor.d.ts new file mode 100644 index 00000000..f161e151 --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/json/schema/visitor.d.ts @@ -0,0 +1,34 @@ +/** + * @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 + */ +import { Observable } from 'rxjs'; +import { JsonObject, JsonValue } from '../utils'; +import { JsonSchemaVisitor, JsonVisitor } from './interface'; +import { JsonSchema } from './schema'; +export interface ReferenceResolver<ContextT> { + (ref: string, context?: ContextT): { + context?: ContextT; + schema?: JsonObject; + }; +} +/** + * Visit all the properties in a JSON object, allowing to transform them. It supports calling + * properties synchronously or asynchronously (through Observables). + * The original object can be mutated or replaced entirely. In case where it's replaced, the new + * value is returned. When it's mutated though the original object will be changed. + * + * Please note it is possible to have an infinite loop here (which will result in a stack overflow) + * if you return 2 objects that references each others (or the same object all the time). + * + * @param {JsonValue} json The Json value to visit. + * @param {JsonVisitor} visitor A function that will be called on every items. + * @param {JsonObject} schema A JSON schema to pass through to the visitor (where possible). + * @param refResolver a function to resolve references in the schema. + * @returns {Observable< | undefined>} The observable of the new root, if the root changed. + */ +export declare function visitJson<ContextT>(json: JsonValue, visitor: JsonVisitor, schema?: JsonSchema, refResolver?: ReferenceResolver<ContextT>, context?: ContextT): Observable<JsonValue>; +export declare function visitJsonSchema(schema: JsonSchema, visitor: JsonSchemaVisitor): void; diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/json/schema/visitor.js b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/json/schema/visitor.js new file mode 100644 index 00000000..3d3ba47a --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/json/schema/visitor.js @@ -0,0 +1,148 @@ +"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.visitJsonSchema = exports.visitJson = void 0; +const rxjs_1 = require("rxjs"); +const operators_1 = require("rxjs/operators"); +const pointer_1 = require("./pointer"); +function _getObjectSubSchema(schema, key) { + if (typeof schema !== 'object' || schema === null) { + return undefined; + } + // Is it an object schema? + if (typeof schema.properties == 'object' || schema.type == 'object') { + if (typeof schema.properties == 'object' && + typeof schema.properties[key] == 'object') { + return schema.properties[key]; + } + if (typeof schema.additionalProperties == 'object') { + return schema.additionalProperties; + } + return undefined; + } + // Is it an array schema? + if (typeof schema.items == 'object' || schema.type == 'array') { + return typeof schema.items == 'object' ? schema.items : undefined; + } + return undefined; +} +function _visitJsonRecursive(json, visitor, ptr, schema, refResolver, context, root) { + if (schema === true || schema === false) { + // There's no schema definition, so just visit the JSON recursively. + schema = undefined; + } + // eslint-disable-next-line no-prototype-builtins + if (schema && schema.hasOwnProperty('$ref') && typeof schema['$ref'] == 'string') { + if (refResolver) { + const resolved = refResolver(schema['$ref'], context); + schema = resolved.schema; + context = resolved.context; + } + } + const value = visitor(json, ptr, schema, root); + return ((0, rxjs_1.isObservable)(value) ? value : (0, rxjs_1.of)(value)).pipe((0, operators_1.concatMap)((value) => { + if (Array.isArray(value)) { + return (0, rxjs_1.concat)((0, rxjs_1.from)(value).pipe((0, operators_1.mergeMap)((item, i) => { + return _visitJsonRecursive(item, visitor, (0, pointer_1.joinJsonPointer)(ptr, '' + i), _getObjectSubSchema(schema, '' + i), refResolver, context, root || value).pipe((0, operators_1.tap)((x) => (value[i] = x))); + }), (0, operators_1.ignoreElements)()), (0, rxjs_1.of)(value)); + } + else if (typeof value == 'object' && value !== null) { + return (0, rxjs_1.concat)((0, rxjs_1.from)(Object.getOwnPropertyNames(value)).pipe((0, operators_1.mergeMap)((key) => { + return _visitJsonRecursive(value[key], visitor, (0, pointer_1.joinJsonPointer)(ptr, key), _getObjectSubSchema(schema, key), refResolver, context, root || value).pipe((0, operators_1.tap)((x) => { + const descriptor = Object.getOwnPropertyDescriptor(value, key); + if (descriptor && descriptor.writable && value[key] !== x) { + value[key] = x; + } + })); + }), (0, operators_1.ignoreElements)()), (0, rxjs_1.of)(value)); + } + else { + return (0, rxjs_1.of)(value); + } + })); +} +/** + * Visit all the properties in a JSON object, allowing to transform them. It supports calling + * properties synchronously or asynchronously (through Observables). + * The original object can be mutated or replaced entirely. In case where it's replaced, the new + * value is returned. When it's mutated though the original object will be changed. + * + * Please note it is possible to have an infinite loop here (which will result in a stack overflow) + * if you return 2 objects that references each others (or the same object all the time). + * + * @param {JsonValue} json The Json value to visit. + * @param {JsonVisitor} visitor A function that will be called on every items. + * @param {JsonObject} schema A JSON schema to pass through to the visitor (where possible). + * @param refResolver a function to resolve references in the schema. + * @returns {Observable< | undefined>} The observable of the new root, if the root changed. + */ +function visitJson(json, visitor, schema, refResolver, context) { + return _visitJsonRecursive(json, visitor, (0, pointer_1.buildJsonPointer)([]), schema, refResolver, context); +} +exports.visitJson = visitJson; +function visitJsonSchema(schema, visitor) { + if (schema === false || schema === true) { + // Nothing to visit. + return; + } + const keywords = { + additionalItems: true, + items: true, + contains: true, + additionalProperties: true, + propertyNames: true, + not: true, + }; + const arrayKeywords = { + items: true, + allOf: true, + anyOf: true, + oneOf: true, + }; + const propsKeywords = { + definitions: true, + properties: true, + patternProperties: true, + additionalProperties: true, + dependencies: true, + items: true, + }; + function _traverse(schema, jsonPtr, rootSchema, parentSchema, keyIndex) { + if (schema && typeof schema == 'object' && !Array.isArray(schema)) { + visitor(schema, jsonPtr, parentSchema, keyIndex); + for (const key of Object.keys(schema)) { + const sch = schema[key]; + if (key in propsKeywords) { + if (sch && typeof sch == 'object') { + for (const prop of Object.keys(sch)) { + _traverse(sch[prop], (0, pointer_1.joinJsonPointer)(jsonPtr, key, prop), rootSchema, schema, prop); + } + } + } + else if (key in keywords) { + _traverse(sch, (0, pointer_1.joinJsonPointer)(jsonPtr, key), rootSchema, schema, key); + } + else if (key in arrayKeywords) { + if (Array.isArray(sch)) { + for (let i = 0; i < sch.length; i++) { + _traverse(sch[i], (0, pointer_1.joinJsonPointer)(jsonPtr, key, '' + i), rootSchema, sch, '' + i); + } + } + } + else if (Array.isArray(sch)) { + for (let i = 0; i < sch.length; i++) { + _traverse(sch[i], (0, pointer_1.joinJsonPointer)(jsonPtr, key, '' + i), rootSchema, sch, '' + i); + } + } + } + } + } + _traverse(schema, (0, pointer_1.buildJsonPointer)([]), schema); +} +exports.visitJsonSchema = visitJsonSchema; diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/json/utils.d.ts b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/json/utils.d.ts new file mode 100644 index 00000000..112ed642 --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/json/utils.d.ts @@ -0,0 +1,15 @@ +/** + * @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 + */ +export interface JsonArray extends Array<JsonValue> { +} +export interface JsonObject { + [prop: string]: JsonValue; +} +export declare type JsonValue = boolean | string | number | JsonArray | JsonObject | null; +export declare function isJsonObject(value: JsonValue): value is JsonObject; +export declare function isJsonArray(value: JsonValue): value is JsonArray; diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/json/utils.js b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/json/utils.js new file mode 100644 index 00000000..f867be5c --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/json/utils.js @@ -0,0 +1,18 @@ +"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.isJsonArray = exports.isJsonObject = void 0; +function isJsonObject(value) { + return value != null && typeof value === 'object' && !Array.isArray(value); +} +exports.isJsonObject = isJsonObject; +function isJsonArray(value) { + return Array.isArray(value); +} +exports.isJsonArray = isJsonArray; diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/logger/indent.d.ts b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/logger/indent.d.ts new file mode 100644 index 00000000..dab231ce --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/logger/indent.d.ts @@ -0,0 +1,11 @@ +/** + * @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 + */ +import { Logger } from './logger'; +export declare class IndentLogger extends Logger { + constructor(name: string, parent?: Logger | null, indentation?: string); +} diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/logger/indent.js b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/logger/indent.js new file mode 100644 index 00000000..8d96691d --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/logger/indent.js @@ -0,0 +1,40 @@ +"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.IndentLogger = void 0; +const operators_1 = require("rxjs/operators"); +const logger_1 = require("./logger"); +/** + * Keep an map of indentation => array of indentations based on the level. + * This is to optimize calculating the prefix based on the indentation itself. Since most logs + * come from similar levels, and with similar indentation strings, this will be shared by all + * loggers. Also, string concatenation is expensive so performing concats for every log entries + * is expensive; this alleviates it. + */ +const indentationMap = {}; +class IndentLogger extends logger_1.Logger { + constructor(name, parent = null, indentation = ' ') { + super(name, parent); + indentationMap[indentation] = indentationMap[indentation] || ['']; + const indentMap = indentationMap[indentation]; + this._observable = this._observable.pipe((0, operators_1.map)((entry) => { + const l = entry.path.filter((x) => !!x).length; + if (l >= indentMap.length) { + let current = indentMap[indentMap.length - 1]; + while (l >= indentMap.length) { + current += indentation; + indentMap.push(current); + } + } + entry.message = indentMap[l] + entry.message.split(/\n/).join('\n' + indentMap[l]); + return entry; + })); + } +} +exports.IndentLogger = IndentLogger; diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/logger/index.d.ts b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/logger/index.d.ts new file mode 100644 index 00000000..7f2254b5 --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/logger/index.d.ts @@ -0,0 +1,12 @@ +/** + * @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 + */ +export * from './indent'; +export * from './level'; +export * from './logger'; +export * from './null-logger'; +export * from './transform-logger'; diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/logger/index.js b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/logger/index.js new file mode 100644 index 00000000..ed55b969 --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/logger/index.js @@ -0,0 +1,24 @@ +"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 + */ +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __exportStar = (this && this.__exportStar) || function(m, exports) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +__exportStar(require("./indent"), exports); +__exportStar(require("./level"), exports); +__exportStar(require("./logger"), exports); +__exportStar(require("./null-logger"), exports); +__exportStar(require("./transform-logger"), exports); diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/logger/level.d.ts b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/logger/level.d.ts new file mode 100644 index 00000000..cdd41128 --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/logger/level.d.ts @@ -0,0 +1,28 @@ +/** + * @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 + */ +import { JsonObject } from '../json/utils'; +import { LogLevel, Logger } from './logger'; +export declare class LevelTransformLogger extends Logger { + readonly name: string; + readonly parent: Logger | null; + readonly levelTransform: (level: LogLevel) => LogLevel; + constructor(name: string, parent: Logger | null, levelTransform: (level: LogLevel) => LogLevel); + log(level: LogLevel, message: string, metadata?: JsonObject): void; + createChild(name: string): Logger; +} +export declare class LevelCapLogger extends LevelTransformLogger { + readonly name: string; + readonly parent: Logger | null; + readonly levelCap: LogLevel; + static levelMap: { + [cap: string]: { + [level: string]: string; + }; + }; + constructor(name: string, parent: Logger | null, levelCap: LogLevel); +} diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/logger/level.js b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/logger/level.js new file mode 100644 index 00000000..c691db48 --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/logger/level.js @@ -0,0 +1,44 @@ +"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.LevelCapLogger = exports.LevelTransformLogger = void 0; +const logger_1 = require("./logger"); +class LevelTransformLogger extends logger_1.Logger { + constructor(name, parent = null, levelTransform) { + super(name, parent); + this.name = name; + this.parent = parent; + this.levelTransform = levelTransform; + } + log(level, message, metadata = {}) { + return super.log(this.levelTransform(level), message, metadata); + } + createChild(name) { + return new LevelTransformLogger(name, this, this.levelTransform); + } +} +exports.LevelTransformLogger = LevelTransformLogger; +class LevelCapLogger extends LevelTransformLogger { + constructor(name, parent = null, levelCap) { + super(name, parent, (level) => { + return (LevelCapLogger.levelMap[levelCap][level] || level); + }); + this.name = name; + this.parent = parent; + this.levelCap = levelCap; + } +} +exports.LevelCapLogger = LevelCapLogger; +LevelCapLogger.levelMap = { + debug: { debug: 'debug', info: 'debug', warn: 'debug', error: 'debug', fatal: 'debug' }, + info: { debug: 'debug', info: 'info', warn: 'info', error: 'info', fatal: 'info' }, + warn: { debug: 'debug', info: 'info', warn: 'warn', error: 'warn', fatal: 'warn' }, + error: { debug: 'debug', info: 'info', warn: 'warn', error: 'error', fatal: 'error' }, + fatal: { debug: 'debug', info: 'info', warn: 'warn', error: 'error', fatal: 'fatal' }, +}; diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/logger/logger.d.ts b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/logger/logger.d.ts new file mode 100644 index 00000000..822efe6a --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/logger/logger.d.ts @@ -0,0 +1,55 @@ +/** + * @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 + */ +import { Observable, Operator, PartialObserver, Subject, Subscription } from 'rxjs'; +import { JsonObject } from '../json/utils'; +export interface LoggerMetadata extends JsonObject { + name: string; + path: string[]; +} +export interface LogEntry extends LoggerMetadata { + level: LogLevel; + message: string; + timestamp: number; +} +export interface LoggerApi { + createChild(name: string): Logger; + log(level: LogLevel, message: string, metadata?: JsonObject): void; + debug(message: string, metadata?: JsonObject): void; + info(message: string, metadata?: JsonObject): void; + warn(message: string, metadata?: JsonObject): void; + error(message: string, metadata?: JsonObject): void; + fatal(message: string, metadata?: JsonObject): void; +} +export declare type LogLevel = 'debug' | 'info' | 'warn' | 'error' | 'fatal'; +export declare class Logger extends Observable<LogEntry> implements LoggerApi { + readonly name: string; + readonly parent: Logger | null; + protected readonly _subject: Subject<LogEntry>; + protected _metadata: LoggerMetadata; + private _obs; + private _subscription; + protected get _observable(): Observable<LogEntry>; + protected set _observable(v: Observable<LogEntry>); + constructor(name: string, parent?: Logger | null); + asApi(): LoggerApi; + createChild(name: string): Logger; + complete(): void; + log(level: LogLevel, message: string, metadata?: JsonObject): void; + next(entry: LogEntry): void; + debug(message: string, metadata?: JsonObject): void; + info(message: string, metadata?: JsonObject): void; + warn(message: string, metadata?: JsonObject): void; + error(message: string, metadata?: JsonObject): void; + fatal(message: string, metadata?: JsonObject): void; + toString(): string; + lift<R>(operator: Operator<LogEntry, R>): Observable<R>; + subscribe(): Subscription; + subscribe(observer: PartialObserver<LogEntry>): Subscription; + subscribe(next?: (value: LogEntry) => void, error?: (error: Error) => void, complete?: () => void): Subscription; + forEach(next: (value: LogEntry) => void, PromiseCtor?: typeof Promise): Promise<void>; +} diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/logger/logger.js b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/logger/logger.js new file mode 100644 index 00000000..c63b8f33 --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/logger/logger.js @@ -0,0 +1,119 @@ +"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.Logger = void 0; +const rxjs_1 = require("rxjs"); +class Logger extends rxjs_1.Observable { + constructor(name, parent = null) { + super(); + this.name = name; + this.parent = parent; + this._subject = new rxjs_1.Subject(); + this._obs = (0, rxjs_1.empty)(); + this._subscription = null; + const path = []; + let p = parent; + while (p) { + path.push(p.name); + p = p.parent; + } + this._metadata = { name, path }; + this._observable = this._subject.asObservable(); + if (this.parent && this.parent._subject) { + // When the parent completes, complete us as well. + this.parent._subject.subscribe(undefined, undefined, () => this.complete()); + } + } + get _observable() { + return this._obs; + } + set _observable(v) { + if (this._subscription) { + this._subscription.unsubscribe(); + } + this._obs = v; + if (this.parent) { + this._subscription = this.subscribe((value) => { + if (this.parent) { + this.parent._subject.next(value); + } + }, (error) => { + if (this.parent) { + this.parent._subject.error(error); + } + }, () => { + if (this._subscription) { + this._subscription.unsubscribe(); + } + this._subscription = null; + }); + } + } + asApi() { + return { + createChild: (name) => this.createChild(name), + log: (level, message, metadata) => { + return this.log(level, message, metadata); + }, + debug: (message, metadata) => this.debug(message, metadata), + info: (message, metadata) => this.info(message, metadata), + warn: (message, metadata) => this.warn(message, metadata), + error: (message, metadata) => this.error(message, metadata), + fatal: (message, metadata) => this.fatal(message, metadata), + }; + } + createChild(name) { + return new this.constructor(name, this); + } + complete() { + this._subject.complete(); + } + log(level, message, metadata = {}) { + const entry = Object.assign({}, metadata, this._metadata, { + level, + message, + timestamp: +Date.now(), + }); + this._subject.next(entry); + } + next(entry) { + this._subject.next(entry); + } + debug(message, metadata = {}) { + return this.log('debug', message, metadata); + } + info(message, metadata = {}) { + return this.log('info', message, metadata); + } + warn(message, metadata = {}) { + return this.log('warn', message, metadata); + } + error(message, metadata = {}) { + return this.log('error', message, metadata); + } + fatal(message, metadata = {}) { + return this.log('fatal', message, metadata); + } + toString() { + return `<Logger(${this.name})>`; + } + lift(operator) { + return this._observable.lift(operator); + } + subscribe(_observerOrNext, _error, _complete) { + // eslint-disable-next-line prefer-spread + return this._observable.subscribe.apply(this._observable, + // eslint-disable-next-line prefer-rest-params + arguments); + } + forEach(next, PromiseCtor) { + return this._observable.forEach(next, PromiseCtor); + } +} +exports.Logger = Logger; diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/logger/null-logger.d.ts b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/logger/null-logger.d.ts new file mode 100644 index 00000000..10b1ec85 --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/logger/null-logger.d.ts @@ -0,0 +1,12 @@ +/** + * @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 + */ +import { Logger, LoggerApi } from './logger'; +export declare class NullLogger extends Logger { + constructor(parent?: Logger | null); + asApi(): LoggerApi; +} diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/logger/null-logger.js b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/logger/null-logger.js new file mode 100644 index 00000000..4e8316db --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/logger/null-logger.js @@ -0,0 +1,30 @@ +"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.NullLogger = void 0; +const rxjs_1 = require("rxjs"); +const logger_1 = require("./logger"); +class NullLogger extends logger_1.Logger { + constructor(parent = null) { + super('', parent); + this._observable = rxjs_1.EMPTY; + } + asApi() { + return { + createChild: () => new NullLogger(this), + log() { }, + debug() { }, + info() { }, + warn() { }, + error() { }, + fatal() { }, + }; + } +} +exports.NullLogger = NullLogger; diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/logger/transform-logger.d.ts b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/logger/transform-logger.d.ts new file mode 100644 index 00000000..983be42e --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/logger/transform-logger.d.ts @@ -0,0 +1,12 @@ +/** + * @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 + */ +import { Observable } from 'rxjs'; +import { LogEntry, Logger } from './logger'; +export declare class TransformLogger extends Logger { + constructor(name: string, transform: (stream: Observable<LogEntry>) => Observable<LogEntry>, parent?: Logger | null); +} diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/logger/transform-logger.js b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/logger/transform-logger.js new file mode 100644 index 00000000..5817bb26 --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/logger/transform-logger.js @@ -0,0 +1,18 @@ +"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.TransformLogger = void 0; +const logger_1 = require("./logger"); +class TransformLogger extends logger_1.Logger { + constructor(name, transform, parent = null) { + super(name, parent); + this._observable = transform(this._observable); + } +} +exports.TransformLogger = TransformLogger; diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/utils/array.d.ts b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/utils/array.d.ts new file mode 100644 index 00000000..a4e4bf16 --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/utils/array.d.ts @@ -0,0 +1,9 @@ +/** + * @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 + */ +/** @deprecated Since v12.0, unused by the Angular tooling */ +export declare function clean<T>(array: Array<T | undefined>): Array<T>; diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/utils/array.js b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/utils/array.js new file mode 100644 index 00000000..1bba02cf --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/utils/array.js @@ -0,0 +1,15 @@ +"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.clean = void 0; +/** @deprecated Since v12.0, unused by the Angular tooling */ +function clean(array) { + return array.filter((x) => x !== undefined); +} +exports.clean = clean; diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/utils/index.d.ts b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/utils/index.d.ts new file mode 100644 index 00000000..18a887e8 --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/utils/index.d.ts @@ -0,0 +1,25 @@ +/** + * @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 + */ +import * as tags from './literals'; +import * as strings from './strings'; +export * from './array'; +export * from './object'; +export * from './template'; +export * from './partially-ordered-set'; +export * from './priority-queue'; +export * from './lang'; +export { tags, strings }; +export declare type DeepReadonly<T> = T extends (infer R)[] ? DeepReadonlyArray<R> : T extends Function ? T : T extends object ? DeepReadonlyObject<T> : T; +export interface DeepReadonlyArray<T> extends Array<DeepReadonly<T>> { +} +export declare type DeepReadonlyObject<T> = { + readonly [P in keyof T]: DeepReadonly<T[P]>; +}; +export declare type Readwrite<T> = { + -readonly [P in keyof T]: T[P]; +}; diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/utils/index.js b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/utils/index.js new file mode 100644 index 00000000..5aa5266e --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/utils/index.js @@ -0,0 +1,42 @@ +"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 + */ +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; +var __exportStar = (this && this.__exportStar) || function(m, exports) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.strings = exports.tags = void 0; +const tags = __importStar(require("./literals")); +exports.tags = tags; +const strings = __importStar(require("./strings")); +exports.strings = strings; +__exportStar(require("./array"), exports); +__exportStar(require("./object"), exports); +__exportStar(require("./template"), exports); +__exportStar(require("./partially-ordered-set"), exports); +__exportStar(require("./priority-queue"), exports); +__exportStar(require("./lang"), exports); diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/utils/lang.d.ts b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/utils/lang.d.ts new file mode 100644 index 00000000..2c072d05 --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/utils/lang.d.ts @@ -0,0 +1,11 @@ +/** + * @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 + */ +/** + * Determine if the argument is shaped like a Promise + */ +export declare function isPromise(obj: any): obj is Promise<any>; diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/utils/lang.js b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/utils/lang.js new file mode 100644 index 00000000..35577300 --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/utils/lang.js @@ -0,0 +1,21 @@ +"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.isPromise = void 0; +// Borrowed from @angular/core +/** + * Determine if the argument is shaped like a Promise + */ +// eslint-disable-next-line @typescript-eslint/no-explicit-any +function isPromise(obj) { + // allow any Promise/A+ compliant thenable. + // It's up to the caller to ensure that obj.then conforms to the spec + return !!obj && typeof obj.then === 'function'; +} +exports.isPromise = isPromise; diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/utils/literals.d.ts b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/utils/literals.d.ts new file mode 100644 index 00000000..4a220ba9 --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/utils/literals.d.ts @@ -0,0 +1,15 @@ +/** + * @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 + */ +export interface TemplateTag<R = string> { + (template: TemplateStringsArray, ...substitutions: any[]): R; +} +export declare function oneLine(strings: TemplateStringsArray, ...values: any[]): string; +export declare function indentBy(indentations: number): TemplateTag; +export declare function stripIndent(strings: TemplateStringsArray, ...values: any[]): string; +export declare function stripIndents(strings: TemplateStringsArray, ...values: any[]): string; +export declare function trimNewlines(strings: TemplateStringsArray, ...values: any[]): string; diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/utils/literals.js b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/utils/literals.js new file mode 100644 index 00000000..ed58824c --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/utils/literals.js @@ -0,0 +1,59 @@ +"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.trimNewlines = exports.stripIndents = exports.stripIndent = exports.indentBy = exports.oneLine = void 0; +// eslint-disable-next-line @typescript-eslint/no-explicit-any +function oneLine(strings, ...values) { + const endResult = String.raw(strings, ...values); + return endResult.replace(/(?:\r?\n(?:\s*))+/gm, ' ').trim(); +} +exports.oneLine = oneLine; +function indentBy(indentations) { + let i = ''; + while (indentations--) { + i += ' '; + } + return (strings, ...values) => { + return i + stripIndent(strings, ...values).replace(/\n/g, '\n' + i); + }; +} +exports.indentBy = indentBy; +// eslint-disable-next-line @typescript-eslint/no-explicit-any +function stripIndent(strings, ...values) { + const endResult = String.raw(strings, ...values); + // remove the shortest leading indentation from each line + const match = endResult.match(/^[ \t]*(?=\S)/gm); + // return early if there's nothing to strip + if (match === null) { + return endResult; + } + const indent = Math.min(...match.map((el) => el.length)); + const regexp = new RegExp('^[ \\t]{' + indent + '}', 'gm'); + return (indent > 0 ? endResult.replace(regexp, '') : endResult).trim(); +} +exports.stripIndent = stripIndent; +// eslint-disable-next-line @typescript-eslint/no-explicit-any +function stripIndents(strings, ...values) { + return String.raw(strings, ...values) + .split('\n') + .map((line) => line.trim()) + .join('\n') + .trim(); +} +exports.stripIndents = stripIndents; +// eslint-disable-next-line @typescript-eslint/no-explicit-any +function trimNewlines(strings, ...values) { + const endResult = String.raw(strings, ...values); + return (endResult + // Remove the newline at the start. + .replace(/^(?:\r?\n)+/, '') + // Remove the newline at the end and following whitespace. + .replace(/(?:\r?\n(?:\s*))$/, '')); +} +exports.trimNewlines = trimNewlines; diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/utils/object.d.ts b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/utils/object.d.ts new file mode 100644 index 00000000..9c45ee6d --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/utils/object.d.ts @@ -0,0 +1,14 @@ +/** + * @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 + */ +/** @deprecated Since v12.0, unused by the Angular tooling */ +export declare function mapObject<T, V>(obj: { + [k: string]: T; +}, mapper: (k: string, v: T) => V): { + [k: string]: V; +}; +export declare function deepCopy<T>(value: T): T; diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/utils/object.js b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/utils/object.js new file mode 100644 index 00000000..d36ce1ee --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/utils/object.js @@ -0,0 +1,45 @@ +"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.deepCopy = exports.mapObject = void 0; +/** @deprecated Since v12.0, unused by the Angular tooling */ +function mapObject(obj, mapper) { + return Object.keys(obj).reduce((acc, k) => { + acc[k] = mapper(k, obj[k]); + return acc; + }, {}); +} +exports.mapObject = mapObject; +const copySymbol = Symbol(); +function deepCopy(value) { + if (Array.isArray(value)) { + return value.map((o) => deepCopy(o)); + } + else if (value && typeof value === 'object') { + const valueCasted = value; + if (valueCasted[copySymbol]) { + // This is a circular dependency. Just return the cloned value. + return valueCasted[copySymbol]; + } + if (valueCasted['toJSON']) { + return JSON.parse(valueCasted['toJSON']()); + } + const copy = Object.create(Object.getPrototypeOf(valueCasted)); + valueCasted[copySymbol] = copy; + for (const key of Object.getOwnPropertyNames(valueCasted)) { + copy[key] = deepCopy(valueCasted[key]); + } + valueCasted[copySymbol] = undefined; + return copy; + } + else { + return value; + } +} +exports.deepCopy = deepCopy; diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/utils/partially-ordered-set.d.ts b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/utils/partially-ordered-set.d.ts new file mode 100644 index 00000000..c7993e2b --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/utils/partially-ordered-set.d.ts @@ -0,0 +1,38 @@ +/** + * @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 + */ +import { BaseException } from '../exception'; +export declare class DependencyNotFoundException extends BaseException { + constructor(); +} +export declare class CircularDependencyFoundException extends BaseException { + constructor(); +} +export declare class PartiallyOrderedSet<T> implements Set<T> { + private _items; + protected _checkCircularDependencies(item: T, deps: Set<T>): void; + clear(): void; + has(item: T): boolean; + get size(): number; + forEach(callbackfn: (value: T, value2: T, set: PartiallyOrderedSet<T>) => void, thisArg?: any): void; + /** + * Returns an iterable of [v,v] pairs for every value `v` in the set. + */ + entries(): IterableIterator<[T, T]>; + /** + * Despite its name, returns an iterable of the values in the set, + */ + keys(): IterableIterator<T>; + /** + * Returns an iterable of values in the set. + */ + values(): IterableIterator<T>; + add(item: T, deps?: Set<T> | T[]): this; + delete(item: T): boolean; + [Symbol.iterator](): Generator<T, void, unknown>; + get [Symbol.toStringTag](): 'Set'; +} diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/utils/partially-ordered-set.js b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/utils/partially-ordered-set.js new file mode 100644 index 00000000..b617e870 --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/utils/partially-ordered-set.js @@ -0,0 +1,145 @@ +"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.PartiallyOrderedSet = exports.CircularDependencyFoundException = exports.DependencyNotFoundException = void 0; +const exception_1 = require("../exception"); +class DependencyNotFoundException extends exception_1.BaseException { + constructor() { + super('One of the dependencies is not part of the set.'); + } +} +exports.DependencyNotFoundException = DependencyNotFoundException; +class CircularDependencyFoundException extends exception_1.BaseException { + constructor() { + super('Circular dependencies found.'); + } +} +exports.CircularDependencyFoundException = CircularDependencyFoundException; +class PartiallyOrderedSet { + constructor() { + this._items = new Map(); + } + _checkCircularDependencies(item, deps) { + if (deps.has(item)) { + throw new CircularDependencyFoundException(); + } + deps.forEach((dep) => this._checkCircularDependencies(item, this._items.get(dep) || new Set())); + } + clear() { + this._items.clear(); + } + has(item) { + return this._items.has(item); + } + get size() { + return this._items.size; + } + forEach(callbackfn, thisArg) { + for (const x of this) { + callbackfn.call(thisArg, x, x, this); + } + } + /** + * Returns an iterable of [v,v] pairs for every value `v` in the set. + */ + *entries() { + for (const item of this) { + yield [item, item]; + } + } + /** + * Despite its name, returns an iterable of the values in the set, + */ + keys() { + return this.values(); + } + /** + * Returns an iterable of values in the set. + */ + values() { + return this[Symbol.iterator](); + } + add(item, deps = new Set()) { + if (Array.isArray(deps)) { + deps = new Set(deps); + } + // Verify item is not already in the set. + if (this._items.has(item)) { + const itemDeps = this._items.get(item) || new Set(); + // If the dependency list is equal, just return, otherwise remove and keep going. + let equal = true; + for (const dep of deps) { + if (!itemDeps.has(dep)) { + equal = false; + break; + } + } + if (equal) { + for (const dep of itemDeps) { + if (!deps.has(dep)) { + equal = false; + break; + } + } + } + if (equal) { + return this; + } + else { + this._items.delete(item); + } + } + // Verify all dependencies are part of the Set. + for (const dep of deps) { + if (!this._items.has(dep)) { + throw new DependencyNotFoundException(); + } + } + // Verify there's no dependency cycle. + this._checkCircularDependencies(item, deps); + this._items.set(item, new Set(deps)); + return this; + } + delete(item) { + if (!this._items.has(item)) { + return false; + } + // Remove it from all dependencies if force == true. + this._items.forEach((value) => value.delete(item)); + return this._items.delete(item); + } + *[Symbol.iterator]() { + const copy = new Map(this._items); + for (const [key, value] of copy.entries()) { + copy.set(key, new Set(value)); + } + while (copy.size > 0) { + const run = []; + // Take the first item without dependencies. + for (const [item, deps] of copy.entries()) { + if (deps.size == 0) { + run.push(item); + } + } + for (const item of run) { + copy.forEach((s) => s.delete(item)); + copy.delete(item); + yield item; + } + if (run.length == 0) { + // uh oh... + throw new CircularDependencyFoundException(); + } + } + } + get [Symbol.toStringTag]() { + return 'Set'; + } +} +exports.PartiallyOrderedSet = PartiallyOrderedSet; diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/utils/priority-queue.d.ts b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/utils/priority-queue.d.ts new file mode 100644 index 00000000..6086b73d --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/utils/priority-queue.d.ts @@ -0,0 +1,19 @@ +/** + * @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 + */ +/** Naive priority queue; not intended for large datasets */ +export declare class PriorityQueue<T> { + private _comparator; + private _items; + constructor(_comparator: (x: T, y: T) => number); + clear(): void; + push(item: T): void; + pop(): T | undefined; + peek(): T | undefined; + get size(): number; + toArray(): Array<T>; +} diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/utils/priority-queue.js b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/utils/priority-queue.js new file mode 100644 index 00000000..69c6ebab --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/utils/priority-queue.js @@ -0,0 +1,48 @@ +"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.PriorityQueue = void 0; +/** Naive priority queue; not intended for large datasets */ +class PriorityQueue { + constructor(_comparator) { + this._comparator = _comparator; + this._items = new Array(); + } + clear() { + this._items = new Array(); + } + push(item) { + const index = this._items.findIndex((existing) => this._comparator(item, existing) <= 0); + if (index === -1) { + this._items.push(item); + } + else { + this._items.splice(index, 0, item); + } + } + pop() { + if (this._items.length === 0) { + return undefined; + } + return this._items.splice(0, 1)[0]; + } + peek() { + if (this._items.length === 0) { + return undefined; + } + return this._items[0]; + } + get size() { + return this._items.length; + } + toArray() { + return this._items.slice(); + } +} +exports.PriorityQueue = PriorityQueue; diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/utils/strings.d.ts b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/utils/strings.d.ts new file mode 100644 index 00000000..f2779349 --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/utils/strings.d.ts @@ -0,0 +1,111 @@ +/** + * @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 + */ +/** + * Converts a camelized string into all lower case separated by underscores. + * + ```javascript + decamelize('innerHTML'); // 'inner_html' + decamelize('action_name'); // 'action_name' + decamelize('css-class-name'); // 'css-class-name' + decamelize('my favorite items'); // 'my favorite items' + ``` + + @method decamelize + @param {String} str The string to decamelize. + @return {String} the decamelized string. + */ +export declare function decamelize(str: string): string; +/** + Replaces underscores, spaces, or camelCase with dashes. + + ```javascript + dasherize('innerHTML'); // 'inner-html' + dasherize('action_name'); // 'action-name' + dasherize('css-class-name'); // 'css-class-name' + dasherize('my favorite items'); // 'my-favorite-items' + ``` + + @method dasherize + @param {String} str The string to dasherize. + @return {String} the dasherized string. + */ +export declare function dasherize(str: string): string; +/** + Returns the lowerCamelCase form of a string. + + ```javascript + camelize('innerHTML'); // 'innerHTML' + camelize('action_name'); // 'actionName' + camelize('css-class-name'); // 'cssClassName' + camelize('my favorite items'); // 'myFavoriteItems' + camelize('My Favorite Items'); // 'myFavoriteItems' + ``` + + @method camelize + @param {String} str The string to camelize. + @return {String} the camelized string. + */ +export declare function camelize(str: string): string; +/** + Returns the UpperCamelCase form of a string. + + ```javascript + 'innerHTML'.classify(); // 'InnerHTML' + 'action_name'.classify(); // 'ActionName' + 'css-class-name'.classify(); // 'CssClassName' + 'my favorite items'.classify(); // 'MyFavoriteItems' + ``` + + @method classify + @param {String} str the string to classify + @return {String} the classified string + */ +export declare function classify(str: string): string; +/** + More general than decamelize. Returns the lower\_case\_and\_underscored + form of a string. + + ```javascript + 'innerHTML'.underscore(); // 'inner_html' + 'action_name'.underscore(); // 'action_name' + 'css-class-name'.underscore(); // 'css_class_name' + 'my favorite items'.underscore(); // 'my_favorite_items' + ``` + + @method underscore + @param {String} str The string to underscore. + @return {String} the underscored string. + */ +export declare function underscore(str: string): string; +/** + Returns the Capitalized form of a string + + ```javascript + 'innerHTML'.capitalize() // 'InnerHTML' + 'action_name'.capitalize() // 'Action_name' + 'css-class-name'.capitalize() // 'Css-class-name' + 'my favorite items'.capitalize() // 'My favorite items' + ``` + + @method capitalize + @param {String} str The string to capitalize. + @return {String} The capitalized string. + */ +export declare function capitalize(str: string): string; +/** + * Calculate the levenshtein distance of two strings. + * See https://en.wikipedia.org/wiki/Levenshtein_distance. + * Based off https://gist.github.com/andrei-m/982927 (for using the faster dynamic programming + * version). + * + * @param a String a. + * @param b String b. + * @returns A number that represents the distance between the two strings. The greater the number + * the more distant the strings are from each others. + */ +export declare function levenshtein(a: string, b: string): number; diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/utils/strings.js b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/utils/strings.js new file mode 100644 index 00000000..4a777a70 --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/utils/strings.js @@ -0,0 +1,178 @@ +"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.levenshtein = exports.capitalize = exports.underscore = exports.classify = exports.camelize = exports.dasherize = exports.decamelize = void 0; +const STRING_DASHERIZE_REGEXP = /[ _]/g; +const STRING_DECAMELIZE_REGEXP = /([a-z\d])([A-Z])/g; +const STRING_CAMELIZE_REGEXP = /(-|_|\.|\s)+(.)?/g; +const STRING_UNDERSCORE_REGEXP_1 = /([a-z\d])([A-Z]+)/g; +const STRING_UNDERSCORE_REGEXP_2 = /-|\s+/g; +/** + * Converts a camelized string into all lower case separated by underscores. + * + ```javascript + decamelize('innerHTML'); // 'inner_html' + decamelize('action_name'); // 'action_name' + decamelize('css-class-name'); // 'css-class-name' + decamelize('my favorite items'); // 'my favorite items' + ``` + + @method decamelize + @param {String} str The string to decamelize. + @return {String} the decamelized string. + */ +function decamelize(str) { + return str.replace(STRING_DECAMELIZE_REGEXP, '$1_$2').toLowerCase(); +} +exports.decamelize = decamelize; +/** + Replaces underscores, spaces, or camelCase with dashes. + + ```javascript + dasherize('innerHTML'); // 'inner-html' + dasherize('action_name'); // 'action-name' + dasherize('css-class-name'); // 'css-class-name' + dasherize('my favorite items'); // 'my-favorite-items' + ``` + + @method dasherize + @param {String} str The string to dasherize. + @return {String} the dasherized string. + */ +function dasherize(str) { + return decamelize(str).replace(STRING_DASHERIZE_REGEXP, '-'); +} +exports.dasherize = dasherize; +/** + Returns the lowerCamelCase form of a string. + + ```javascript + camelize('innerHTML'); // 'innerHTML' + camelize('action_name'); // 'actionName' + camelize('css-class-name'); // 'cssClassName' + camelize('my favorite items'); // 'myFavoriteItems' + camelize('My Favorite Items'); // 'myFavoriteItems' + ``` + + @method camelize + @param {String} str The string to camelize. + @return {String} the camelized string. + */ +function camelize(str) { + return str + .replace(STRING_CAMELIZE_REGEXP, (_match, _separator, chr) => { + return chr ? chr.toUpperCase() : ''; + }) + .replace(/^([A-Z])/, (match) => match.toLowerCase()); +} +exports.camelize = camelize; +/** + Returns the UpperCamelCase form of a string. + + ```javascript + 'innerHTML'.classify(); // 'InnerHTML' + 'action_name'.classify(); // 'ActionName' + 'css-class-name'.classify(); // 'CssClassName' + 'my favorite items'.classify(); // 'MyFavoriteItems' + ``` + + @method classify + @param {String} str the string to classify + @return {String} the classified string + */ +function classify(str) { + return str + .split('.') + .map((part) => capitalize(camelize(part))) + .join('.'); +} +exports.classify = classify; +/** + More general than decamelize. Returns the lower\_case\_and\_underscored + form of a string. + + ```javascript + 'innerHTML'.underscore(); // 'inner_html' + 'action_name'.underscore(); // 'action_name' + 'css-class-name'.underscore(); // 'css_class_name' + 'my favorite items'.underscore(); // 'my_favorite_items' + ``` + + @method underscore + @param {String} str The string to underscore. + @return {String} the underscored string. + */ +function underscore(str) { + return str + .replace(STRING_UNDERSCORE_REGEXP_1, '$1_$2') + .replace(STRING_UNDERSCORE_REGEXP_2, '_') + .toLowerCase(); +} +exports.underscore = underscore; +/** + Returns the Capitalized form of a string + + ```javascript + 'innerHTML'.capitalize() // 'InnerHTML' + 'action_name'.capitalize() // 'Action_name' + 'css-class-name'.capitalize() // 'Css-class-name' + 'my favorite items'.capitalize() // 'My favorite items' + ``` + + @method capitalize + @param {String} str The string to capitalize. + @return {String} The capitalized string. + */ +function capitalize(str) { + return str.charAt(0).toUpperCase() + str.substr(1); +} +exports.capitalize = capitalize; +/** + * Calculate the levenshtein distance of two strings. + * See https://en.wikipedia.org/wiki/Levenshtein_distance. + * Based off https://gist.github.com/andrei-m/982927 (for using the faster dynamic programming + * version). + * + * @param a String a. + * @param b String b. + * @returns A number that represents the distance between the two strings. The greater the number + * the more distant the strings are from each others. + */ +function levenshtein(a, b) { + if (a.length == 0) { + return b.length; + } + if (b.length == 0) { + return a.length; + } + const matrix = []; + // increment along the first column of each row + for (let i = 0; i <= b.length; i++) { + matrix[i] = [i]; + } + // increment each column in the first row + for (let j = 0; j <= a.length; j++) { + matrix[0][j] = j; + } + // Fill in the rest of the matrix + for (let i = 1; i <= b.length; i++) { + for (let j = 1; j <= a.length; j++) { + if (b.charAt(i - 1) == a.charAt(j - 1)) { + matrix[i][j] = matrix[i - 1][j - 1]; + } + else { + matrix[i][j] = Math.min(matrix[i - 1][j - 1] + 1, // substitution + matrix[i][j - 1] + 1, // insertion + matrix[i - 1][j] + 1); + } + } + } + return matrix[b.length][a.length]; +} +exports.levenshtein = levenshtein; diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/utils/template.d.ts b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/utils/template.d.ts new file mode 100644 index 00000000..7425bb86 --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/utils/template.d.ts @@ -0,0 +1,89 @@ +/** + * @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 + */ +import { Position } from 'source-map'; +export interface TemplateOptions { + sourceURL?: string; + sourceMap?: boolean; + module?: boolean | { + exports: {}; + }; + sourceRoot?: string; + fileName?: string; +} +/** + * A simple AST for templates. There's only one level of AST nodes, but it's still useful + * to have the information you're looking for. + */ +export interface TemplateAst { + fileName: string; + content: string; + children: TemplateAstNode[]; +} +/** + * The base, which contains positions. + */ +export interface TemplateAstBase { + start: Position; + end: Position; +} +/** + * A static content node. + */ +export interface TemplateAstContent extends TemplateAstBase { + kind: 'content'; + content: string; +} +/** + * A comment node. + */ +export interface TemplateAstComment extends TemplateAstBase { + kind: 'comment'; + text: string; +} +/** + * An evaluate node, which is the code between `<% ... %>`. + */ +export interface TemplateAstEvaluate extends TemplateAstBase { + kind: 'evaluate'; + expression: string; +} +/** + * An escape node, which is the code between `<%- ... %>`. + */ +export interface TemplateAstEscape extends TemplateAstBase { + kind: 'escape'; + expression: string; +} +/** + * An interpolation node, which is the code between `<%= ... %>`. + */ +export interface TemplateAstInterpolate extends TemplateAstBase { + kind: 'interpolate'; + expression: string; +} +export declare type TemplateAstNode = TemplateAstContent | TemplateAstEvaluate | TemplateAstComment | TemplateAstEscape | TemplateAstInterpolate; +/** + * Given a source text (and a fileName), returns a TemplateAst. + */ +export declare function templateParser(sourceText: string, fileName: string): TemplateAst; +/** + * An equivalent of EJS templates, which is based on John Resig's `tmpl` implementation + * (http://ejohn.org/blog/javascript-micro-templating/) and Laura Doktorova's doT.js + * (https://github.com/olado/doT). + * + * This version differs from lodash by removing support from ES6 quasi-literals, and making the + * code slightly simpler to follow. It also does not depend on any third party, which is nice. + * + * Finally, it supports SourceMap, if you ever need to debug, which is super nice. + * + * @param content The template content. + * @param options Optional Options. See TemplateOptions for more description. + * @return {(input: T) => string} A function that accept an input object and returns the content + * of the template with the input applied. + */ +export declare function template<T>(content: string, options?: TemplateOptions): (input: T) => string; diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/utils/template.js b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/utils/template.js new file mode 100644 index 00000000..ec4de75c --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/utils/template.js @@ -0,0 +1,262 @@ +"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.template = exports.templateParser = void 0; +const source_map_1 = require("source-map"); +// Matches <%= expr %>. This does not support structural JavaScript (for/if/...). +const kInterpolateRe = /<%=([\s\S]+?)%>/g; +// Matches <%# text %>. It's a comment and will be entirely ignored. +const kCommentRe = /<%#([\s\S]+?)%>/g; +// Used to match template delimiters. +// <%- expr %>: HTML escape the value. +// <% ... %>: Structural template code. +const kEscapeRe = /<%-([\s\S]+?)%>/g; +const kEvaluateRe = /<%([\s\S]+?)%>/g; +/** Used to map characters to HTML entities. */ +const kHtmlEscapes = { + '&': '&', + '<': '<', + '>': '>', + '"': '"', + "'": ''', + '`': '`', +}; +// Used to match HTML entities and HTML characters. +const reUnescapedHtml = new RegExp(`[${Object.keys(kHtmlEscapes).join('')}]`, 'g'); +function _positionFor(content, offset) { + let line = 1; + let column = 0; + for (let i = 0; i < offset - 1; i++) { + if (content[i] == '\n') { + line++; + column = 0; + } + else { + column++; + } + } + return { + line, + column, + }; +} +/** + * Given a source text (and a fileName), returns a TemplateAst. + */ +function templateParser(sourceText, fileName) { + const children = []; + // Compile the regexp to match each delimiter. + const reExpressions = [kEscapeRe, kCommentRe, kInterpolateRe, kEvaluateRe]; + const reDelimiters = RegExp(reExpressions.map((x) => x.source).join('|') + '|$', 'g'); + const parsed = sourceText.split(reDelimiters); + let offset = 0; + // Optimization that uses the fact that the end of a node is always the beginning of the next + // node, so we keep the positioning of the nodes in memory. + let start = _positionFor(sourceText, offset); + let end; + const increment = reExpressions.length + 1; + for (let i = 0; i < parsed.length; i += increment) { + const [content, escape, comment, interpolate, evaluate] = parsed.slice(i, i + increment); + if (content) { + end = _positionFor(sourceText, offset + content.length); + offset += content.length; + children.push({ kind: 'content', content, start, end }); + start = end; + } + if (escape) { + end = _positionFor(sourceText, offset + escape.length + 5); + offset += escape.length + 5; + children.push({ kind: 'escape', expression: escape, start, end }); + start = end; + } + if (comment) { + end = _positionFor(sourceText, offset + comment.length + 5); + offset += comment.length + 5; + children.push({ kind: 'comment', text: comment, start, end }); + start = end; + } + if (interpolate) { + end = _positionFor(sourceText, offset + interpolate.length + 5); + offset += interpolate.length + 5; + children.push({ + kind: 'interpolate', + expression: interpolate, + start, + end, + }); + start = end; + } + if (evaluate) { + end = _positionFor(sourceText, offset + evaluate.length + 5); + offset += evaluate.length + 5; + children.push({ kind: 'evaluate', expression: evaluate, start, end }); + start = end; + } + } + return { + fileName, + content: sourceText, + children, + }; +} +exports.templateParser = templateParser; +/** + * Fastest implementation of the templating algorithm. It only add strings and does not bother + * with source maps. + */ +function templateFast(ast, options) { + const module = options && options.module ? 'module.exports.default =' : ''; + const reHtmlEscape = reUnescapedHtml.source.replace(/[']/g, "\\\\\\'"); + return ` + return ${module} function(obj) { + obj || (obj = {}); + let __t; + let __p = ''; + const __escapes = ${JSON.stringify(kHtmlEscapes)}; + const __escapesre = new RegExp('${reHtmlEscape}', 'g'); + + const __e = function(s) { + return s ? s.replace(__escapesre, function(key) { return __escapes[key]; }) : ''; + }; + with (obj) { + ${ast.children + .map((node) => { + switch (node.kind) { + case 'content': + return `__p += ${JSON.stringify(node.content)};`; + case 'interpolate': + return `__p += ((__t = (${node.expression})) == null) ? '' : __t;`; + case 'escape': + return `__p += __e(${node.expression});`; + case 'evaluate': + return node.expression; + } + }) + .join('\n')} + } + + return __p; + }; + `; +} +/** + * Templating algorithm with source map support. The map is outputted as //# sourceMapUrl=... + */ +function templateWithSourceMap(ast, options) { + const sourceUrl = ast.fileName; + const module = options && options.module ? 'module.exports.default =' : ''; + const reHtmlEscape = reUnescapedHtml.source.replace(/[']/g, "\\\\\\'"); + const preamble = new source_map_1.SourceNode(1, 0, sourceUrl, '').add(new source_map_1.SourceNode(1, 0, sourceUrl, [ + `return ${module} function(obj) {\n`, + ' obj || (obj = {});\n', + ' let __t;\n', + ' let __p = "";\n', + ` const __escapes = ${JSON.stringify(kHtmlEscapes)};\n`, + ` const __escapesre = new RegExp('${reHtmlEscape}', 'g');\n`, + `\n`, + ` const __e = function(s) { `, + ` return s ? s.replace(__escapesre, function(key) { return __escapes[key]; }) : '';`, + ` };\n`, + ` with (obj) {\n`, + ])); + const end = ast.children.length + ? ast.children[ast.children.length - 1].end + : { line: 0, column: 0 }; + const nodes = ast.children + .reduce((chunk, node) => { + let code = ''; + switch (node.kind) { + case 'content': + code = [ + new source_map_1.SourceNode(node.start.line, node.start.column, sourceUrl, '__p = __p'), + ...node.content.split('\n').map((line, i, arr) => { + return new source_map_1.SourceNode(node.start.line + i, i == 0 ? node.start.column : 0, sourceUrl, '\n + ' + JSON.stringify(line + (i == arr.length - 1 ? '' : '\n'))); + }), + new source_map_1.SourceNode(node.end.line, node.end.column, sourceUrl, ';\n'), + ]; + break; + case 'interpolate': + code = [ + new source_map_1.SourceNode(node.start.line, node.start.column, sourceUrl, '__p += ((__t = '), + ...node.expression.split('\n').map((line, i, arr) => { + return new source_map_1.SourceNode(node.start.line + i, i == 0 ? node.start.column : 0, sourceUrl, line + (i == arr.length - 1 ? '' : '\n')); + }), + new source_map_1.SourceNode(node.end.line, node.end.column, sourceUrl, ') == null ? "" : __t);\n'), + ]; + break; + case 'escape': + code = [ + new source_map_1.SourceNode(node.start.line, node.start.column, sourceUrl, '__p += __e('), + ...node.expression.split('\n').map((line, i, arr) => { + return new source_map_1.SourceNode(node.start.line + i, i == 0 ? node.start.column : 0, sourceUrl, line + (i == arr.length - 1 ? '' : '\n')); + }), + new source_map_1.SourceNode(node.end.line, node.end.column, sourceUrl, ');\n'), + ]; + break; + case 'evaluate': + code = [ + ...node.expression.split('\n').map((line, i, arr) => { + return new source_map_1.SourceNode(node.start.line + i, i == 0 ? node.start.column : 0, sourceUrl, line + (i == arr.length - 1 ? '' : '\n')); + }), + new source_map_1.SourceNode(node.end.line, node.end.column, sourceUrl, '\n'), + ]; + break; + } + return chunk.add(new source_map_1.SourceNode(node.start.line, node.start.column, sourceUrl, code)); + }, preamble) + .add(new source_map_1.SourceNode(end.line, end.column, sourceUrl, [' };\n', '\n', ' return __p;\n', '}\n'])); + const code = nodes.toStringWithSourceMap({ + file: sourceUrl, + sourceRoot: (options && options.sourceRoot) || '.', + }); + // Set the source content in the source map, otherwise the sourceUrl is not enough + // to find the content. + code.map.setSourceContent(sourceUrl, ast.content); + return (code.code + + '\n//# sourceMappingURL=data:application/json;base64,' + + Buffer.from(code.map.toString()).toString('base64')); +} +/** + * An equivalent of EJS templates, which is based on John Resig's `tmpl` implementation + * (http://ejohn.org/blog/javascript-micro-templating/) and Laura Doktorova's doT.js + * (https://github.com/olado/doT). + * + * This version differs from lodash by removing support from ES6 quasi-literals, and making the + * code slightly simpler to follow. It also does not depend on any third party, which is nice. + * + * Finally, it supports SourceMap, if you ever need to debug, which is super nice. + * + * @param content The template content. + * @param options Optional Options. See TemplateOptions for more description. + * @return {(input: T) => string} A function that accept an input object and returns the content + * of the template with the input applied. + */ +function template(content, options) { + const sourceUrl = (options && options.sourceURL) || 'ejs'; + const ast = templateParser(content, sourceUrl); + let source; + // If there's no need for source map support, we revert back to the fast implementation. + if (options && options.sourceMap) { + source = templateWithSourceMap(ast, options); + } + else { + source = templateFast(ast, options); + } + // We pass a dummy module in case the module option is passed. If `module: true` is passed, we + // need to only use the source, not the function itself. Otherwise expect a module object to be + // passed, and we use that one. + const fn = Function('module', source); + const module = options && options.module ? (options.module === true ? { exports: {} } : options.module) : null; + const result = fn(module); + // Provide the compiled function's source by its `toString` method or + // the `source` property as a convenience for inlining compiled templates. + result.source = source; + return result; +} +exports.template = template; diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/virtual-fs/host/alias.d.ts b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/virtual-fs/host/alias.d.ts new file mode 100644 index 00000000..38805baa --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/virtual-fs/host/alias.d.ts @@ -0,0 +1,60 @@ +/** + * @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 + */ +import { Path } from '../path'; +import { ResolverHost } from './resolver'; +/** + * A Virtual Host that allow to alias some paths to other paths. + * + * This does not verify, when setting an alias, that the target or source exist. Neither does it + * check whether it's a file or a directory. Please not that directories are also renamed/replaced. + * + * No recursion is done on the resolution, which means the following is perfectly valid then: + * + * ``` + * host.aliases.set(normalize('/file/a'), normalize('/file/b')); + * host.aliases.set(normalize('/file/b'), normalize('/file/a')); + * ``` + * + * This will result in a proper swap of two files for each others. + * + * @example + * const host = new SimpleMemoryHost(); + * host.write(normalize('/some/file'), content).subscribe(); + * + * const aHost = new AliasHost(host); + * aHost.read(normalize('/some/file')) + * .subscribe(x => expect(x).toBe(content)); + * aHost.aliases.set(normalize('/some/file'), normalize('/other/path'); + * + * // This file will not exist because /other/path does not exist. + * aHost.read(normalize('/some/file')) + * .subscribe(undefined, err => expect(err.message).toMatch(/does not exist/)); + * + * @example + * const host = new SimpleMemoryHost(); + * host.write(normalize('/some/folder/file'), content).subscribe(); + * + * const aHost = new AliasHost(host); + * aHost.read(normalize('/some/folder/file')) + * .subscribe(x => expect(x).toBe(content)); + * aHost.aliases.set(normalize('/some'), normalize('/other'); + * + * // This file will not exist because /other/path does not exist. + * aHost.read(normalize('/some/folder/file')) + * .subscribe(undefined, err => expect(err.message).toMatch(/does not exist/)); + * + * // Create the file with new content and verify that this has the new content. + * aHost.write(normalize('/other/folder/file'), content2).subscribe(); + * aHost.read(normalize('/some/folder/file')) + * .subscribe(x => expect(x).toBe(content2)); + */ +export declare class AliasHost<StatsT extends object = {}> extends ResolverHost<StatsT> { + protected _aliases: Map<Path, Path>; + protected _resolve(path: Path): Path; + get aliases(): Map<Path, Path>; +} diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/virtual-fs/host/alias.js b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/virtual-fs/host/alias.js new file mode 100644 index 00000000..314dda3c --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/virtual-fs/host/alias.js @@ -0,0 +1,86 @@ +"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.AliasHost = void 0; +const path_1 = require("../path"); +const resolver_1 = require("./resolver"); +/** + * A Virtual Host that allow to alias some paths to other paths. + * + * This does not verify, when setting an alias, that the target or source exist. Neither does it + * check whether it's a file or a directory. Please not that directories are also renamed/replaced. + * + * No recursion is done on the resolution, which means the following is perfectly valid then: + * + * ``` + * host.aliases.set(normalize('/file/a'), normalize('/file/b')); + * host.aliases.set(normalize('/file/b'), normalize('/file/a')); + * ``` + * + * This will result in a proper swap of two files for each others. + * + * @example + * const host = new SimpleMemoryHost(); + * host.write(normalize('/some/file'), content).subscribe(); + * + * const aHost = new AliasHost(host); + * aHost.read(normalize('/some/file')) + * .subscribe(x => expect(x).toBe(content)); + * aHost.aliases.set(normalize('/some/file'), normalize('/other/path'); + * + * // This file will not exist because /other/path does not exist. + * aHost.read(normalize('/some/file')) + * .subscribe(undefined, err => expect(err.message).toMatch(/does not exist/)); + * + * @example + * const host = new SimpleMemoryHost(); + * host.write(normalize('/some/folder/file'), content).subscribe(); + * + * const aHost = new AliasHost(host); + * aHost.read(normalize('/some/folder/file')) + * .subscribe(x => expect(x).toBe(content)); + * aHost.aliases.set(normalize('/some'), normalize('/other'); + * + * // This file will not exist because /other/path does not exist. + * aHost.read(normalize('/some/folder/file')) + * .subscribe(undefined, err => expect(err.message).toMatch(/does not exist/)); + * + * // Create the file with new content and verify that this has the new content. + * aHost.write(normalize('/other/folder/file'), content2).subscribe(); + * aHost.read(normalize('/some/folder/file')) + * .subscribe(x => expect(x).toBe(content2)); + */ +class AliasHost extends resolver_1.ResolverHost { + constructor() { + super(...arguments); + this._aliases = new Map(); + } + _resolve(path) { + let maybeAlias = this._aliases.get(path); + const sp = (0, path_1.split)(path); + const remaining = []; + // Also resolve all parents of the requested files, only picking the first one that matches. + // This can have surprising behaviour when aliases are inside another alias. It will always + // use the closest one to the file. + while (!maybeAlias && sp.length > 0) { + const p = (0, path_1.join)(path_1.NormalizedRoot, ...sp); + maybeAlias = this._aliases.get(p); + if (maybeAlias) { + maybeAlias = (0, path_1.join)(maybeAlias, ...remaining); + } + // Allow non-null-operator because we know sp.length > 0 (condition on while). + remaining.unshift(sp.pop()); // eslint-disable-line @typescript-eslint/no-non-null-assertion + } + return maybeAlias || path; + } + get aliases() { + return this._aliases; + } +} +exports.AliasHost = AliasHost; diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/virtual-fs/host/buffer.d.ts b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/virtual-fs/host/buffer.d.ts new file mode 100644 index 00000000..350e8570 --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/virtual-fs/host/buffer.d.ts @@ -0,0 +1,12 @@ +/** + * @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 + */ +import { TemplateTag } from '../../utils/literals'; +import { FileBuffer } from './interface'; +export declare function stringToFileBuffer(str: string): FileBuffer; +export declare const fileBuffer: TemplateTag<FileBuffer>; +export declare function fileBufferToString(fileBuffer: FileBuffer): string; diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/virtual-fs/host/buffer.js b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/virtual-fs/host/buffer.js new file mode 100644 index 00000000..6a6b2c02 --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/virtual-fs/host/buffer.js @@ -0,0 +1,69 @@ +"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.fileBufferToString = exports.fileBuffer = exports.stringToFileBuffer = void 0; +function stringToFileBuffer(str) { + // If we're in Node... + if (typeof Buffer !== 'undefined' && typeof Buffer.from === 'function') { + const buf = Buffer.from(str); + const ab = new ArrayBuffer(buf.length); + const view = new Uint8Array(ab); + for (let i = 0; i < buf.length; ++i) { + view[i] = buf[i]; + } + return ab; + } + else if (typeof TextEncoder !== 'undefined') { + // Modern browsers implement TextEncode. + return new TextEncoder('utf-8').encode(str).buffer; + } + else { + // Slowest method but sure to be compatible with every platform. + const buf = new ArrayBuffer(str.length * 2); // 2 bytes for each char + const bufView = new Uint16Array(buf); + for (let i = 0, strLen = str.length; i < strLen; i++) { + bufView[i] = str.charCodeAt(i); + } + return buf; + } +} +exports.stringToFileBuffer = stringToFileBuffer; +const fileBuffer = (strings, ...values) => { + return stringToFileBuffer(String.raw(strings, ...values)); +}; +exports.fileBuffer = fileBuffer; +function fileBufferToString(fileBuffer) { + if (fileBuffer.toString.length == 1) { + return fileBuffer.toString('utf-8'); + } + else if (typeof Buffer !== 'undefined') { + return Buffer.from(fileBuffer).toString('utf-8'); + } + else if (typeof TextDecoder !== 'undefined') { + // Modern browsers implement TextEncode. + return new TextDecoder('utf-8').decode(new Uint8Array(fileBuffer)); + } + else { + // Slowest method but sure to be compatible with every platform. + const bufView = new Uint8Array(fileBuffer); + const bufLength = bufView.length; + let result = ''; + let chunkLength = Math.pow(2, 16) - 1; + // We have to chunk it because String.fromCharCode.apply will throw + // `Maximum call stack size exceeded` on big inputs. + for (let i = 0; i < bufLength; i += chunkLength) { + if (i + chunkLength > bufLength) { + chunkLength = bufLength - i; + } + result += String.fromCharCode.apply(null, [...bufView.subarray(i, i + chunkLength)]); + } + return result; + } +} +exports.fileBufferToString = fileBufferToString; diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/virtual-fs/host/create.d.ts b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/virtual-fs/host/create.d.ts new file mode 100644 index 00000000..9091ff55 --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/virtual-fs/host/create.d.ts @@ -0,0 +1,21 @@ +/** + * @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 + */ +import { Path, PathFragment } from '../path'; +import { FileBuffer, FileBufferLike, Host, Stats } from './interface'; +export interface SyncHostHandler<StatsT extends object = {}> { + read(path: Path): FileBuffer; + list(path: Path): PathFragment[]; + exists(path: Path): boolean; + isDirectory(path: Path): boolean; + isFile(path: Path): boolean; + stat(path: Path): Stats<StatsT> | null; + write(path: Path, content: FileBufferLike): void; + delete(path: Path): void; + rename(from: Path, to: Path): void; +} +export declare function createSyncHost<StatsT extends object = {}>(handler: SyncHostHandler<StatsT>): Host<StatsT>; diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/virtual-fs/host/create.js b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/virtual-fs/host/create.js new file mode 100644 index 00000000..39b4313a --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/virtual-fs/host/create.js @@ -0,0 +1,55 @@ +"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.createSyncHost = void 0; +const rxjs_1 = require("rxjs"); +function wrapAction(action) { + return new rxjs_1.Observable((subscriber) => { + subscriber.next(action()); + subscriber.complete(); + }); +} +function createSyncHost(handler) { + return new (class { + get capabilities() { + return { synchronous: true }; + } + read(path) { + return wrapAction(() => handler.read(path)); + } + list(path) { + return wrapAction(() => handler.list(path)); + } + exists(path) { + return wrapAction(() => handler.exists(path)); + } + isDirectory(path) { + return wrapAction(() => handler.isDirectory(path)); + } + isFile(path) { + return wrapAction(() => handler.isFile(path)); + } + stat(path) { + return wrapAction(() => handler.stat(path)); + } + write(path, content) { + return wrapAction(() => handler.write(path, content)); + } + delete(path) { + return wrapAction(() => handler.delete(path)); + } + rename(from, to) { + return wrapAction(() => handler.rename(from, to)); + } + watch() { + return null; + } + })(); +} +exports.createSyncHost = createSyncHost; diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/virtual-fs/host/empty.d.ts b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/virtual-fs/host/empty.d.ts new file mode 100644 index 00000000..11892fe1 --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/virtual-fs/host/empty.d.ts @@ -0,0 +1,19 @@ +/** + * @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 + */ +import { Observable } from 'rxjs'; +import { Path, PathFragment } from '../path'; +import { FileBuffer, HostCapabilities, ReadonlyHost, Stats } from './interface'; +export declare class Empty implements ReadonlyHost { + readonly capabilities: HostCapabilities; + read(path: Path): Observable<FileBuffer>; + list(path: Path): Observable<PathFragment[]>; + exists(path: Path): Observable<boolean>; + isDirectory(path: Path): Observable<boolean>; + isFile(path: Path): Observable<boolean>; + stat(path: Path): Observable<Stats<{}> | null>; +} diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/virtual-fs/host/empty.js b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/virtual-fs/host/empty.js new file mode 100644 index 00000000..60f10537 --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/virtual-fs/host/empty.js @@ -0,0 +1,39 @@ +"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.Empty = void 0; +const rxjs_1 = require("rxjs"); +const exception_1 = require("../../exception"); +class Empty { + constructor() { + this.capabilities = { + synchronous: true, + }; + } + read(path) { + return (0, rxjs_1.throwError)(new exception_1.FileDoesNotExistException(path)); + } + list(path) { + return (0, rxjs_1.of)([]); + } + exists(path) { + return (0, rxjs_1.of)(false); + } + isDirectory(path) { + return (0, rxjs_1.of)(false); + } + isFile(path) { + return (0, rxjs_1.of)(false); + } + stat(path) { + // We support stat() but have no file. + return (0, rxjs_1.of)(null); + } +} +exports.Empty = Empty; diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/virtual-fs/host/index.d.ts b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/virtual-fs/host/index.d.ts new file mode 100644 index 00000000..bc44ca9e --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/virtual-fs/host/index.d.ts @@ -0,0 +1,20 @@ +/** + * @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 + */ +export * from './alias'; +export * from './buffer'; +export * from './create'; +export * from './empty'; +export * from './interface'; +export * from './memory'; +export * from './pattern'; +export * from './record'; +export * from './safe'; +export * from './scoped'; +export * from './sync'; +export * from './resolver'; +export * from './test'; diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/virtual-fs/host/index.js b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/virtual-fs/host/index.js new file mode 100644 index 00000000..9c7abad1 --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/virtual-fs/host/index.js @@ -0,0 +1,32 @@ +"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 + */ +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __exportStar = (this && this.__exportStar) || function(m, exports) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +__exportStar(require("./alias"), exports); +__exportStar(require("./buffer"), exports); +__exportStar(require("./create"), exports); +__exportStar(require("./empty"), exports); +__exportStar(require("./interface"), exports); +__exportStar(require("./memory"), exports); +__exportStar(require("./pattern"), exports); +__exportStar(require("./record"), exports); +__exportStar(require("./safe"), exports); +__exportStar(require("./scoped"), exports); +__exportStar(require("./sync"), exports); +__exportStar(require("./resolver"), exports); +__exportStar(require("./test"), exports); diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/virtual-fs/host/interface.d.ts b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/virtual-fs/host/interface.d.ts new file mode 100644 index 00000000..23dcd233 --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/virtual-fs/host/interface.d.ts @@ -0,0 +1,53 @@ +/** + * @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 + */ +import { Observable } from 'rxjs'; +import { Path, PathFragment } from '../path'; +export declare type FileBuffer = ArrayBuffer; +export declare type FileBufferLike = ArrayBufferLike; +export interface HostWatchOptions { + readonly persistent?: boolean; + readonly recursive?: boolean; +} +export declare const enum HostWatchEventType { + Changed = 0, + Created = 1, + Deleted = 2, + Renamed = 3 +} +export declare type Stats<T extends object = {}> = T & { + isFile(): boolean; + isDirectory(): boolean; + readonly size: number; + readonly atime: Date; + readonly mtime: Date; + readonly ctime: Date; + readonly birthtime: Date; +}; +export interface HostWatchEvent { + readonly time: Date; + readonly type: HostWatchEventType; + readonly path: Path; +} +export interface HostCapabilities { + synchronous: boolean; +} +export interface ReadonlyHost<StatsT extends object = {}> { + readonly capabilities: HostCapabilities; + read(path: Path): Observable<FileBuffer>; + list(path: Path): Observable<PathFragment[]>; + exists(path: Path): Observable<boolean>; + isDirectory(path: Path): Observable<boolean>; + isFile(path: Path): Observable<boolean>; + stat(path: Path): Observable<Stats<StatsT> | null> | null; +} +export interface Host<StatsT extends object = {}> extends ReadonlyHost<StatsT> { + write(path: Path, content: FileBufferLike): Observable<void>; + delete(path: Path): Observable<void>; + rename(from: Path, to: Path): Observable<void>; + watch(path: Path, options?: HostWatchOptions): Observable<HostWatchEvent> | null; +} diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/virtual-fs/host/interface.js b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/virtual-fs/host/interface.js new file mode 100644 index 00000000..b599b96d --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/virtual-fs/host/interface.js @@ -0,0 +1,9 @@ +"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 }); diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/virtual-fs/host/memory.d.ts b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/virtual-fs/host/memory.d.ts new file mode 100644 index 00000000..aebfb802 --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/virtual-fs/host/memory.d.ts @@ -0,0 +1,68 @@ +/** + * @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 + */ +import { Observable } from 'rxjs'; +import { Path, PathFragment } from '../path'; +import { FileBuffer, Host, HostCapabilities, HostWatchEvent, HostWatchEventType, HostWatchOptions, Stats } from './interface'; +export interface SimpleMemoryHostStats { + readonly content: FileBuffer | null; +} +export declare class SimpleMemoryHost implements Host<{}> { + protected _cache: Map<Path, Stats<SimpleMemoryHostStats>>; + private _watchers; + protected _newDirStats(): { + inspect(): string; + isFile(): boolean; + isDirectory(): boolean; + size: number; + atime: Date; + ctime: Date; + mtime: Date; + birthtime: Date; + content: null; + }; + protected _newFileStats(content: FileBuffer, oldStats?: Stats<SimpleMemoryHostStats>): { + inspect(): string; + isFile(): boolean; + isDirectory(): boolean; + size: number; + atime: Date; + ctime: Date; + mtime: Date; + birthtime: Date; + content: ArrayBuffer; + }; + constructor(); + protected _toAbsolute(path: Path): Path; + protected _updateWatchers(path: Path, type: HostWatchEventType): void; + get capabilities(): HostCapabilities; + /** + * List of protected methods that give direct access outside the observables to the cache + * and internal states. + */ + protected _write(path: Path, content: FileBuffer): void; + protected _read(path: Path): FileBuffer; + protected _delete(path: Path): void; + protected _rename(from: Path, to: Path): void; + protected _list(path: Path): PathFragment[]; + protected _exists(path: Path): boolean; + protected _isDirectory(path: Path): boolean; + protected _isFile(path: Path): boolean; + protected _stat(path: Path): Stats<SimpleMemoryHostStats> | null; + protected _watch(path: Path, options?: HostWatchOptions): Observable<HostWatchEvent>; + write(path: Path, content: FileBuffer): Observable<void>; + read(path: Path): Observable<FileBuffer>; + delete(path: Path): Observable<void>; + rename(from: Path, to: Path): Observable<void>; + list(path: Path): Observable<PathFragment[]>; + exists(path: Path): Observable<boolean>; + isDirectory(path: Path): Observable<boolean>; + isFile(path: Path): Observable<boolean>; + stat(path: Path): Observable<Stats<{}> | null> | null; + watch(path: Path, options?: HostWatchOptions): Observable<HostWatchEvent> | null; + reset(): void; +} diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/virtual-fs/host/memory.js b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/virtual-fs/host/memory.js new file mode 100644 index 00000000..5edd9523 --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/virtual-fs/host/memory.js @@ -0,0 +1,330 @@ +"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.SimpleMemoryHost = void 0; +const rxjs_1 = require("rxjs"); +const exception_1 = require("../../exception"); +const path_1 = require("../path"); +class SimpleMemoryHost { + constructor() { + this._cache = new Map(); + this._watchers = new Map(); + this._cache.set((0, path_1.normalize)('/'), this._newDirStats()); + } + _newDirStats() { + return { + inspect() { + return '<Directory>'; + }, + isFile() { + return false; + }, + isDirectory() { + return true; + }, + size: 0, + atime: new Date(), + ctime: new Date(), + mtime: new Date(), + birthtime: new Date(), + content: null, + }; + } + _newFileStats(content, oldStats) { + return { + inspect() { + return `<File size(${content.byteLength})>`; + }, + isFile() { + return true; + }, + isDirectory() { + return false; + }, + size: content.byteLength, + atime: oldStats ? oldStats.atime : new Date(), + ctime: new Date(), + mtime: new Date(), + birthtime: oldStats ? oldStats.birthtime : new Date(), + content, + }; + } + _toAbsolute(path) { + return (0, path_1.isAbsolute)(path) ? path : (0, path_1.normalize)('/' + path); + } + _updateWatchers(path, type) { + const time = new Date(); + let currentPath = path; + let parent = null; + if (this._watchers.size == 0) { + // Nothing to do if there's no watchers. + return; + } + const maybeWatcher = this._watchers.get(currentPath); + if (maybeWatcher) { + maybeWatcher.forEach((watcher) => { + const [options, subject] = watcher; + subject.next({ path, time, type }); + if (!options.persistent && type == 2 /* Deleted */) { + subject.complete(); + this._watchers.delete(currentPath); + } + }); + } + do { + currentPath = parent !== null ? parent : currentPath; + parent = (0, path_1.dirname)(currentPath); + const maybeWatcher = this._watchers.get(currentPath); + if (maybeWatcher) { + maybeWatcher.forEach((watcher) => { + const [options, subject] = watcher; + if (!options.recursive) { + return; + } + subject.next({ path, time, type }); + if (!options.persistent && type == 2 /* Deleted */) { + subject.complete(); + this._watchers.delete(currentPath); + } + }); + } + } while (parent != currentPath); + } + get capabilities() { + return { synchronous: true }; + } + /** + * List of protected methods that give direct access outside the observables to the cache + * and internal states. + */ + _write(path, content) { + path = this._toAbsolute(path); + const old = this._cache.get(path); + if (old && old.isDirectory()) { + throw new exception_1.PathIsDirectoryException(path); + } + // Update all directories. If we find a file we know it's an invalid write. + const fragments = (0, path_1.split)(path); + let curr = (0, path_1.normalize)('/'); + for (const fr of fragments) { + curr = (0, path_1.join)(curr, fr); + const maybeStats = this._cache.get(fr); + if (maybeStats) { + if (maybeStats.isFile()) { + throw new exception_1.PathIsFileException(curr); + } + } + else { + this._cache.set(curr, this._newDirStats()); + } + } + // Create the stats. + const stats = this._newFileStats(content, old); + this._cache.set(path, stats); + this._updateWatchers(path, old ? 0 /* Changed */ : 1 /* Created */); + } + _read(path) { + path = this._toAbsolute(path); + const maybeStats = this._cache.get(path); + if (!maybeStats) { + throw new exception_1.FileDoesNotExistException(path); + } + else if (maybeStats.isDirectory()) { + throw new exception_1.PathIsDirectoryException(path); + } + else if (!maybeStats.content) { + throw new exception_1.PathIsDirectoryException(path); + } + else { + return maybeStats.content; + } + } + _delete(path) { + path = this._toAbsolute(path); + if (this._isDirectory(path)) { + for (const [cachePath] of this._cache.entries()) { + if (cachePath.startsWith(path + path_1.NormalizedSep) || cachePath === path) { + this._cache.delete(cachePath); + } + } + } + else { + this._cache.delete(path); + } + this._updateWatchers(path, 2 /* Deleted */); + } + _rename(from, to) { + from = this._toAbsolute(from); + to = this._toAbsolute(to); + if (!this._cache.has(from)) { + throw new exception_1.FileDoesNotExistException(from); + } + else if (this._cache.has(to)) { + throw new exception_1.FileAlreadyExistException(to); + } + if (this._isDirectory(from)) { + for (const path of this._cache.keys()) { + if (path.startsWith(from + path_1.NormalizedSep)) { + const content = this._cache.get(path); + if (content) { + // We don't need to clone or extract the content, since we're moving files. + this._cache.set((0, path_1.join)(to, path_1.NormalizedSep, path.slice(from.length)), content); + } + } + } + } + else { + const content = this._cache.get(from); + if (content) { + const fragments = (0, path_1.split)(to); + const newDirectories = []; + let curr = (0, path_1.normalize)('/'); + for (const fr of fragments) { + curr = (0, path_1.join)(curr, fr); + const maybeStats = this._cache.get(fr); + if (maybeStats) { + if (maybeStats.isFile()) { + throw new exception_1.PathIsFileException(curr); + } + } + else { + newDirectories.push(curr); + } + } + for (const newDirectory of newDirectories) { + this._cache.set(newDirectory, this._newDirStats()); + } + this._cache.delete(from); + this._cache.set(to, content); + } + } + this._updateWatchers(from, 3 /* Renamed */); + } + _list(path) { + path = this._toAbsolute(path); + if (this._isFile(path)) { + throw new exception_1.PathIsFileException(path); + } + const fragments = (0, path_1.split)(path); + const result = new Set(); + if (path !== path_1.NormalizedRoot) { + for (const p of this._cache.keys()) { + if (p.startsWith(path + path_1.NormalizedSep)) { + result.add((0, path_1.split)(p)[fragments.length]); + } + } + } + else { + for (const p of this._cache.keys()) { + if (p.startsWith(path_1.NormalizedSep) && p !== path_1.NormalizedRoot) { + result.add((0, path_1.split)(p)[1]); + } + } + } + return [...result]; + } + _exists(path) { + return !!this._cache.get(this._toAbsolute(path)); + } + _isDirectory(path) { + const maybeStats = this._cache.get(this._toAbsolute(path)); + return maybeStats ? maybeStats.isDirectory() : false; + } + _isFile(path) { + const maybeStats = this._cache.get(this._toAbsolute(path)); + return maybeStats ? maybeStats.isFile() : false; + } + _stat(path) { + const maybeStats = this._cache.get(this._toAbsolute(path)); + if (!maybeStats) { + return null; + } + else { + return maybeStats; + } + } + _watch(path, options) { + path = this._toAbsolute(path); + const subject = new rxjs_1.Subject(); + let maybeWatcherArray = this._watchers.get(path); + if (!maybeWatcherArray) { + maybeWatcherArray = []; + this._watchers.set(path, maybeWatcherArray); + } + maybeWatcherArray.push([options || {}, subject]); + return subject.asObservable(); + } + write(path, content) { + return new rxjs_1.Observable((obs) => { + this._write(path, content); + obs.next(); + obs.complete(); + }); + } + read(path) { + return new rxjs_1.Observable((obs) => { + const content = this._read(path); + obs.next(content); + obs.complete(); + }); + } + delete(path) { + return new rxjs_1.Observable((obs) => { + this._delete(path); + obs.next(); + obs.complete(); + }); + } + rename(from, to) { + return new rxjs_1.Observable((obs) => { + this._rename(from, to); + obs.next(); + obs.complete(); + }); + } + list(path) { + return new rxjs_1.Observable((obs) => { + obs.next(this._list(path)); + obs.complete(); + }); + } + exists(path) { + return new rxjs_1.Observable((obs) => { + obs.next(this._exists(path)); + obs.complete(); + }); + } + isDirectory(path) { + return new rxjs_1.Observable((obs) => { + obs.next(this._isDirectory(path)); + obs.complete(); + }); + } + isFile(path) { + return new rxjs_1.Observable((obs) => { + obs.next(this._isFile(path)); + obs.complete(); + }); + } + // Some hosts may not support stat. + stat(path) { + return new rxjs_1.Observable((obs) => { + obs.next(this._stat(path)); + obs.complete(); + }); + } + watch(path, options) { + return this._watch(path, options); + } + reset() { + this._cache.clear(); + this._watchers.clear(); + } +} +exports.SimpleMemoryHost = SimpleMemoryHost; diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/virtual-fs/host/pattern.d.ts b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/virtual-fs/host/pattern.d.ts new file mode 100644 index 00000000..fd1db63a --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/virtual-fs/host/pattern.d.ts @@ -0,0 +1,17 @@ +/** + * @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 + */ +import { Path } from '../path'; +import { ResolverHost } from './resolver'; +export declare type ReplacementFunction = (path: Path) => Path; +/** + */ +export declare class PatternMatchingHost<StatsT extends object = {}> extends ResolverHost<StatsT> { + protected _patterns: Map<RegExp, ReplacementFunction>; + addPattern(pattern: string | string[], replacementFn: ReplacementFunction): void; + protected _resolve(path: Path): Path; +} diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/virtual-fs/host/pattern.js b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/virtual-fs/host/pattern.js new file mode 100644 index 00000000..56688765 --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/virtual-fs/host/pattern.js @@ -0,0 +1,46 @@ +"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.PatternMatchingHost = void 0; +const resolver_1 = require("./resolver"); +/** + */ +class PatternMatchingHost extends resolver_1.ResolverHost { + constructor() { + super(...arguments); + this._patterns = new Map(); + } + addPattern(pattern, replacementFn) { + // Simple GLOB pattern replacement. + const reString = '^(' + + (Array.isArray(pattern) ? pattern : [pattern]) + .map((ex) => '(' + + ex + .split(/[/\\]/g) + .map((f) => f + .replace(/[-[\]{}()+?.^$|]/g, '\\$&') + .replace(/^\*\*/g, '(.+?)?') + .replace(/\*/g, '[^/\\\\]*')) + .join('[/\\\\]') + + ')') + .join('|') + + ')($|/|\\\\)'; + this._patterns.set(new RegExp(reString), replacementFn); + } + _resolve(path) { + let newPath = path; + this._patterns.forEach((fn, re) => { + if (re.test(path)) { + newPath = fn(newPath); + } + }); + return newPath; + } +} +exports.PatternMatchingHost = PatternMatchingHost; diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/virtual-fs/host/record.d.ts b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/virtual-fs/host/record.d.ts new file mode 100644 index 00000000..e0cfc22f --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/virtual-fs/host/record.d.ts @@ -0,0 +1,92 @@ +/** + * @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 + */ +import { Observable } from 'rxjs'; +import { Path, PathFragment } from '../path'; +import { FileBuffer, Host, HostCapabilities, HostWatchOptions, ReadonlyHost, Stats } from './interface'; +import { SimpleMemoryHost } from './memory'; +export interface CordHostCreate { + kind: 'create'; + path: Path; + content: FileBuffer; +} +export interface CordHostOverwrite { + kind: 'overwrite'; + path: Path; + content: FileBuffer; +} +export interface CordHostRename { + kind: 'rename'; + from: Path; + to: Path; +} +export interface CordHostDelete { + kind: 'delete'; + path: Path; +} +export declare type CordHostRecord = CordHostCreate | CordHostOverwrite | CordHostRename | CordHostDelete; +/** + * A Host that records changes to the underlying Host, while keeping a record of Create, Overwrite, + * Rename and Delete of files. + * + * This is fully compatible with Host, but will keep a staging of every changes asked. That staging + * follows the principle of the Tree (e.g. can create a file that already exists). + * + * Using `create()` and `overwrite()` will force those operations, but using `write` will add + * the create/overwrite records IIF the files does/doesn't already exist. + */ +export declare class CordHost extends SimpleMemoryHost { + protected _back: ReadonlyHost; + protected _filesToCreate: Set<Path>; + protected _filesToRename: Map<Path, Path>; + protected _filesToRenameRevert: Map<Path, Path>; + protected _filesToDelete: Set<Path>; + protected _filesToOverwrite: Set<Path>; + constructor(_back: ReadonlyHost); + get backend(): ReadonlyHost; + get capabilities(): HostCapabilities; + /** + * Create a copy of this host, including all actions made. + * @returns {CordHost} The carbon copy. + */ + clone(): CordHost; + /** + * Commit the changes recorded to a Host. It is assumed that the host does have the same structure + * as the host that was used for backend (could be the same host). + * @param host The host to create/delete/rename/overwrite files to. + * @param force Whether to skip existence checks when creating/overwriting. This is + * faster but might lead to incorrect states. Because Hosts natively don't support creation + * versus overwriting (it's only writing), we check for existence before completing a request. + * @returns An observable that completes when done, or error if an error occured. + */ + commit(host: Host, force?: boolean): Observable<void>; + records(): CordHostRecord[]; + /** + * Specialized version of {@link CordHost#write} which forces the creation of a file whether it + * exists or not. + * @param {} path + * @param {FileBuffer} content + * @returns {Observable<void>} + */ + create(path: Path, content: FileBuffer): Observable<void>; + overwrite(path: Path, content: FileBuffer): Observable<void>; + write(path: Path, content: FileBuffer): Observable<void>; + read(path: Path): Observable<FileBuffer>; + delete(path: Path): Observable<void>; + rename(from: Path, to: Path): Observable<void>; + list(path: Path): Observable<PathFragment[]>; + exists(path: Path): Observable<boolean>; + isDirectory(path: Path): Observable<boolean>; + isFile(path: Path): Observable<boolean>; + stat(path: Path): Observable<Stats | null> | null; + watch(path: Path, options?: HostWatchOptions): null; + willCreate(path: Path): boolean; + willOverwrite(path: Path): boolean; + willDelete(path: Path): boolean; + willRename(path: Path): boolean; + willRenameTo(path: Path, to: Path): boolean; +} diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/virtual-fs/host/record.js b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/virtual-fs/host/record.js new file mode 100644 index 00000000..ae55d28a --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/virtual-fs/host/record.js @@ -0,0 +1,314 @@ +"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.CordHost = void 0; +const rxjs_1 = require("rxjs"); +const operators_1 = require("rxjs/operators"); +const exception_1 = require("../../exception"); +const memory_1 = require("./memory"); +/** + * A Host that records changes to the underlying Host, while keeping a record of Create, Overwrite, + * Rename and Delete of files. + * + * This is fully compatible with Host, but will keep a staging of every changes asked. That staging + * follows the principle of the Tree (e.g. can create a file that already exists). + * + * Using `create()` and `overwrite()` will force those operations, but using `write` will add + * the create/overwrite records IIF the files does/doesn't already exist. + */ +class CordHost extends memory_1.SimpleMemoryHost { + constructor(_back) { + super(); + this._back = _back; + this._filesToCreate = new Set(); + this._filesToRename = new Map(); + this._filesToRenameRevert = new Map(); + this._filesToDelete = new Set(); + this._filesToOverwrite = new Set(); + } + get backend() { + return this._back; + } + get capabilities() { + // Our own host is always Synchronous, but the backend might not be. + return { + synchronous: this._back.capabilities.synchronous, + }; + } + /** + * Create a copy of this host, including all actions made. + * @returns {CordHost} The carbon copy. + */ + clone() { + const dolly = new CordHost(this._back); + dolly._cache = new Map(this._cache); + dolly._filesToCreate = new Set(this._filesToCreate); + dolly._filesToRename = new Map(this._filesToRename); + dolly._filesToRenameRevert = new Map(this._filesToRenameRevert); + dolly._filesToDelete = new Set(this._filesToDelete); + dolly._filesToOverwrite = new Set(this._filesToOverwrite); + return dolly; + } + /** + * Commit the changes recorded to a Host. It is assumed that the host does have the same structure + * as the host that was used for backend (could be the same host). + * @param host The host to create/delete/rename/overwrite files to. + * @param force Whether to skip existence checks when creating/overwriting. This is + * faster but might lead to incorrect states. Because Hosts natively don't support creation + * versus overwriting (it's only writing), we check for existence before completing a request. + * @returns An observable that completes when done, or error if an error occured. + */ + commit(host, force = false) { + // Really commit everything to the actual host. + return (0, rxjs_1.from)(this.records()).pipe((0, operators_1.concatMap)((record) => { + switch (record.kind) { + case 'delete': + return host.delete(record.path); + case 'rename': + return host.rename(record.from, record.to); + case 'create': + return host.exists(record.path).pipe((0, operators_1.switchMap)((exists) => { + if (exists && !force) { + return (0, rxjs_1.throwError)(new exception_1.FileAlreadyExistException(record.path)); + } + else { + return host.write(record.path, record.content); + } + })); + case 'overwrite': + return host.exists(record.path).pipe((0, operators_1.switchMap)((exists) => { + if (!exists && !force) { + return (0, rxjs_1.throwError)(new exception_1.FileDoesNotExistException(record.path)); + } + else { + return host.write(record.path, record.content); + } + })); + } + }), (0, operators_1.reduce)(() => { })); + } + records() { + return [ + ...[...this._filesToDelete.values()].map((path) => ({ + kind: 'delete', + path, + })), + ...[...this._filesToRename.entries()].map(([from, to]) => ({ + kind: 'rename', + from, + to, + })), + ...[...this._filesToCreate.values()].map((path) => ({ + kind: 'create', + path, + content: this._read(path), + })), + ...[...this._filesToOverwrite.values()].map((path) => ({ + kind: 'overwrite', + path, + content: this._read(path), + })), + ]; + } + /** + * Specialized version of {@link CordHost#write} which forces the creation of a file whether it + * exists or not. + * @param {} path + * @param {FileBuffer} content + * @returns {Observable<void>} + */ + create(path, content) { + if (super._exists(path)) { + throw new exception_1.FileAlreadyExistException(path); + } + if (this._filesToDelete.has(path)) { + this._filesToDelete.delete(path); + this._filesToOverwrite.add(path); + } + else { + this._filesToCreate.add(path); + } + return super.write(path, content); + } + overwrite(path, content) { + return this.isDirectory(path).pipe((0, operators_1.switchMap)((isDir) => { + if (isDir) { + return (0, rxjs_1.throwError)(new exception_1.PathIsDirectoryException(path)); + } + return this.exists(path); + }), (0, operators_1.switchMap)((exists) => { + if (!exists) { + return (0, rxjs_1.throwError)(new exception_1.FileDoesNotExistException(path)); + } + if (!this._filesToCreate.has(path)) { + this._filesToOverwrite.add(path); + } + return super.write(path, content); + })); + } + write(path, content) { + return this.exists(path).pipe((0, operators_1.switchMap)((exists) => { + if (exists) { + // It exists, but might be being renamed or deleted. In that case we want to create it. + if (this.willRename(path) || this.willDelete(path)) { + return this.create(path, content); + } + else { + return this.overwrite(path, content); + } + } + else { + return this.create(path, content); + } + })); + } + read(path) { + if (this._exists(path)) { + return super.read(path); + } + return this._back.read(path); + } + delete(path) { + if (this._exists(path)) { + if (this._filesToCreate.has(path)) { + this._filesToCreate.delete(path); + } + else if (this._filesToOverwrite.has(path)) { + this._filesToOverwrite.delete(path); + this._filesToDelete.add(path); + } + else { + const maybeOrigin = this._filesToRenameRevert.get(path); + if (maybeOrigin) { + this._filesToRenameRevert.delete(path); + this._filesToRename.delete(maybeOrigin); + this._filesToDelete.add(maybeOrigin); + } + else { + return (0, rxjs_1.throwError)(new exception_1.UnknownException(`This should never happen. Path: ${JSON.stringify(path)}.`)); + } + } + return super.delete(path); + } + else { + return this._back.exists(path).pipe((0, operators_1.switchMap)((exists) => { + if (exists) { + this._filesToDelete.add(path); + return (0, rxjs_1.of)(); + } + else { + return (0, rxjs_1.throwError)(new exception_1.FileDoesNotExistException(path)); + } + })); + } + } + rename(from, to) { + return (0, rxjs_1.concat)(this.exists(to), this.exists(from)).pipe((0, operators_1.toArray)(), (0, operators_1.switchMap)(([existTo, existFrom]) => { + if (!existFrom) { + return (0, rxjs_1.throwError)(new exception_1.FileDoesNotExistException(from)); + } + if (from === to) { + return rxjs_1.EMPTY; + } + if (existTo) { + return (0, rxjs_1.throwError)(new exception_1.FileAlreadyExistException(to)); + } + // If we're renaming a file that's been created, shortcircuit to creating the `to` path. + if (this._filesToCreate.has(from)) { + this._filesToCreate.delete(from); + this._filesToCreate.add(to); + return super.rename(from, to); + } + if (this._filesToOverwrite.has(from)) { + this._filesToOverwrite.delete(from); + // Recursively call this function. This is so we don't repeat the bottom logic. This + // if will be by-passed because we just deleted the `from` path from files to overwrite. + return (0, rxjs_1.concat)(this.rename(from, to), new rxjs_1.Observable((x) => { + this._filesToOverwrite.add(to); + x.complete(); + })); + } + if (this._filesToDelete.has(to)) { + this._filesToDelete.delete(to); + this._filesToDelete.add(from); + this._filesToOverwrite.add(to); + // We need to delete the original and write the new one. + return this.read(from).pipe((0, operators_1.map)((content) => this._write(to, content))); + } + const maybeTo1 = this._filesToRenameRevert.get(from); + if (maybeTo1) { + // We already renamed to this file (A => from), let's rename the former to the new + // path (A => to). + this._filesToRename.delete(maybeTo1); + this._filesToRenameRevert.delete(from); + from = maybeTo1; + } + this._filesToRename.set(from, to); + this._filesToRenameRevert.set(to, from); + // If the file is part of our data, just rename it internally. + if (this._exists(from)) { + return super.rename(from, to); + } + else { + // Create a file with the same content. + return this._back.read(from).pipe((0, operators_1.switchMap)((content) => super.write(to, content))); + } + })); + } + list(path) { + return (0, rxjs_1.concat)(super.list(path), this._back.list(path)).pipe((0, operators_1.reduce)((list, curr) => { + curr.forEach((elem) => list.add(elem)); + return list; + }, new Set()), (0, operators_1.map)((set) => [...set])); + } + exists(path) { + return this._exists(path) + ? (0, rxjs_1.of)(true) + : this.willDelete(path) || this.willRename(path) + ? (0, rxjs_1.of)(false) + : this._back.exists(path); + } + isDirectory(path) { + return this._exists(path) ? super.isDirectory(path) : this._back.isDirectory(path); + } + isFile(path) { + return this._exists(path) + ? super.isFile(path) + : this.willDelete(path) || this.willRename(path) + ? (0, rxjs_1.of)(false) + : this._back.isFile(path); + } + stat(path) { + return this._exists(path) + ? super.stat(path) + : this.willDelete(path) || this.willRename(path) + ? (0, rxjs_1.of)(null) + : this._back.stat(path); + } + watch(path, options) { + // Watching not supported. + return null; + } + willCreate(path) { + return this._filesToCreate.has(path); + } + willOverwrite(path) { + return this._filesToOverwrite.has(path); + } + willDelete(path) { + return this._filesToDelete.has(path); + } + willRename(path) { + return this._filesToRename.has(path); + } + willRenameTo(path, to) { + return this._filesToRename.get(path) === to; + } +} +exports.CordHost = CordHost; diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/virtual-fs/host/resolver.d.ts b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/virtual-fs/host/resolver.d.ts new file mode 100644 index 00000000..c27f123c --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/virtual-fs/host/resolver.d.ts @@ -0,0 +1,30 @@ +/** + * @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 + */ +import { Observable } from 'rxjs'; +import { Path, PathFragment } from '../path'; +import { FileBuffer, Host, HostCapabilities, HostWatchEvent, HostWatchOptions, Stats } from './interface'; +/** + * A Host that runs a method before calling its delegate. This is an abstract class and its actual + * behaviour is entirely dependant of the subclass. + */ +export declare abstract class ResolverHost<T extends object> implements Host<T> { + protected _delegate: Host<T>; + protected abstract _resolve(path: Path): Path; + constructor(_delegate: Host<T>); + get capabilities(): HostCapabilities; + write(path: Path, content: FileBuffer): Observable<void>; + read(path: Path): Observable<FileBuffer>; + delete(path: Path): Observable<void>; + rename(from: Path, to: Path): Observable<void>; + list(path: Path): Observable<PathFragment[]>; + exists(path: Path): Observable<boolean>; + isDirectory(path: Path): Observable<boolean>; + isFile(path: Path): Observable<boolean>; + stat(path: Path): Observable<Stats<T> | null> | null; + watch(path: Path, options?: HostWatchOptions): Observable<HostWatchEvent> | null; +} diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/virtual-fs/host/resolver.js b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/virtual-fs/host/resolver.js new file mode 100644 index 00000000..08c793c5 --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/virtual-fs/host/resolver.js @@ -0,0 +1,55 @@ +"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.ResolverHost = void 0; +/** + * A Host that runs a method before calling its delegate. This is an abstract class and its actual + * behaviour is entirely dependant of the subclass. + */ +class ResolverHost { + constructor(_delegate) { + this._delegate = _delegate; + } + get capabilities() { + return this._delegate.capabilities; + } + write(path, content) { + return this._delegate.write(this._resolve(path), content); + } + read(path) { + return this._delegate.read(this._resolve(path)); + } + delete(path) { + return this._delegate.delete(this._resolve(path)); + } + rename(from, to) { + return this._delegate.rename(this._resolve(from), this._resolve(to)); + } + list(path) { + return this._delegate.list(this._resolve(path)); + } + exists(path) { + return this._delegate.exists(this._resolve(path)); + } + isDirectory(path) { + return this._delegate.isDirectory(this._resolve(path)); + } + isFile(path) { + return this._delegate.isFile(this._resolve(path)); + } + // Some hosts may not support stat. + stat(path) { + return this._delegate.stat(this._resolve(path)); + } + // Some hosts may not support watching. + watch(path, options) { + return this._delegate.watch(this._resolve(path), options); + } +} +exports.ResolverHost = ResolverHost; diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/virtual-fs/host/safe.d.ts b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/virtual-fs/host/safe.d.ts new file mode 100644 index 00000000..882c54da --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/virtual-fs/host/safe.d.ts @@ -0,0 +1,25 @@ +/** + * @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 + */ +import { Observable } from 'rxjs'; +import { Path, PathFragment } from '../path'; +import { FileBuffer, HostCapabilities, ReadonlyHost, Stats } from './interface'; +/** + * A Host that filters out errors. The only exception is `read()` which will still error out if + * the delegate returned an error (e.g. NodeJS will error out if the file doesn't exist). + */ +export declare class SafeReadonlyHost<StatsT extends object = {}> implements ReadonlyHost<StatsT> { + private _delegate; + constructor(_delegate: ReadonlyHost<StatsT>); + get capabilities(): HostCapabilities; + read(path: Path): Observable<FileBuffer>; + list(path: Path): Observable<PathFragment[]>; + exists(path: Path): Observable<boolean>; + isDirectory(path: Path): Observable<boolean>; + isFile(path: Path): Observable<boolean>; + stat(path: Path): Observable<Stats<StatsT> | null> | null; +} diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/virtual-fs/host/safe.js b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/virtual-fs/host/safe.js new file mode 100644 index 00000000..526988c2 --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/virtual-fs/host/safe.js @@ -0,0 +1,45 @@ +"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.SafeReadonlyHost = void 0; +const rxjs_1 = require("rxjs"); +const operators_1 = require("rxjs/operators"); +/** + * A Host that filters out errors. The only exception is `read()` which will still error out if + * the delegate returned an error (e.g. NodeJS will error out if the file doesn't exist). + */ +class SafeReadonlyHost { + constructor(_delegate) { + this._delegate = _delegate; + } + get capabilities() { + return this._delegate.capabilities; + } + read(path) { + return this._delegate.read(path); + } + list(path) { + return this._delegate.list(path).pipe((0, operators_1.catchError)(() => (0, rxjs_1.of)([]))); + } + exists(path) { + return this._delegate.exists(path); + } + isDirectory(path) { + return this._delegate.isDirectory(path).pipe((0, operators_1.catchError)(() => (0, rxjs_1.of)(false))); + } + isFile(path) { + return this._delegate.isFile(path).pipe((0, operators_1.catchError)(() => (0, rxjs_1.of)(false))); + } + // Some hosts may not support stats. + stat(path) { + const maybeStat = this._delegate.stat(path); + return maybeStat && maybeStat.pipe((0, operators_1.catchError)(() => (0, rxjs_1.of)(null))); + } +} +exports.SafeReadonlyHost = SafeReadonlyHost; diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/virtual-fs/host/scoped.d.ts b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/virtual-fs/host/scoped.d.ts new file mode 100644 index 00000000..42c4f0c3 --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/virtual-fs/host/scoped.d.ts @@ -0,0 +1,15 @@ +/** + * @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 + */ +import { Path } from '../path'; +import { Host } from './interface'; +import { ResolverHost } from './resolver'; +export declare class ScopedHost<T extends object> extends ResolverHost<T> { + protected _root: Path; + constructor(delegate: Host<T>, _root?: Path); + protected _resolve(path: Path): Path; +} diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/virtual-fs/host/scoped.js b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/virtual-fs/host/scoped.js new file mode 100644 index 00000000..cc7b3767 --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/virtual-fs/host/scoped.js @@ -0,0 +1,22 @@ +"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.ScopedHost = void 0; +const path_1 = require("../path"); +const resolver_1 = require("./resolver"); +class ScopedHost extends resolver_1.ResolverHost { + constructor(delegate, _root = path_1.NormalizedRoot) { + super(delegate); + this._root = _root; + } + _resolve(path) { + return (0, path_1.join)(this._root, path); + } +} +exports.ScopedHost = ScopedHost; diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/virtual-fs/host/sync.d.ts b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/virtual-fs/host/sync.d.ts new file mode 100644 index 00000000..2a9f0c80 --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/virtual-fs/host/sync.d.ts @@ -0,0 +1,34 @@ +/** + * @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 + */ +import { Observable } from 'rxjs'; +import { BaseException } from '../../exception'; +import { Path, PathFragment } from '../path'; +import { FileBuffer, FileBufferLike, Host, HostCapabilities, HostWatchEvent, HostWatchOptions, Stats } from './interface'; +export declare class SynchronousDelegateExpectedException extends BaseException { + constructor(); +} +/** + * Implement a synchronous-only host interface (remove the Observable parts). + */ +export declare class SyncDelegateHost<T extends object = {}> { + protected _delegate: Host<T>; + constructor(_delegate: Host<T>); + protected _doSyncCall<ResultT>(observable: Observable<ResultT>): ResultT; + get capabilities(): HostCapabilities; + get delegate(): Host<T>; + write(path: Path, content: FileBufferLike): void; + read(path: Path): FileBuffer; + delete(path: Path): void; + rename(from: Path, to: Path): void; + list(path: Path): PathFragment[]; + exists(path: Path): boolean; + isDirectory(path: Path): boolean; + isFile(path: Path): boolean; + stat(path: Path): Stats<T> | null; + watch(path: Path, options?: HostWatchOptions): Observable<HostWatchEvent> | null; +} diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/virtual-fs/host/sync.js b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/virtual-fs/host/sync.js new file mode 100644 index 00000000..9fbdbc82 --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/virtual-fs/host/sync.js @@ -0,0 +1,91 @@ +"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.SyncDelegateHost = exports.SynchronousDelegateExpectedException = void 0; +const exception_1 = require("../../exception"); +class SynchronousDelegateExpectedException extends exception_1.BaseException { + constructor() { + super(`Expected a synchronous delegate but got an asynchronous one.`); + } +} +exports.SynchronousDelegateExpectedException = SynchronousDelegateExpectedException; +/** + * Implement a synchronous-only host interface (remove the Observable parts). + */ +class SyncDelegateHost { + constructor(_delegate) { + this._delegate = _delegate; + if (!_delegate.capabilities.synchronous) { + throw new SynchronousDelegateExpectedException(); + } + } + _doSyncCall(observable) { + let completed = false; + let result = undefined; + let errorResult = undefined; + // Perf note: this is not using an observer object to avoid a performance penalty in RxJS. + // See https://github.com/ReactiveX/rxjs/pull/5646 for details. + observable.subscribe((x) => (result = x), (err) => (errorResult = err), () => (completed = true)); + if (errorResult !== undefined) { + throw errorResult; + } + if (!completed) { + throw new SynchronousDelegateExpectedException(); + } + // The non-null operation is to work around `void` type. We don't allow to return undefined + // but ResultT could be void, which is undefined in JavaScript, so this doesn't change the + // behaviour. + // eslint-disable-next-line @typescript-eslint/no-non-null-assertion + return result; + } + get capabilities() { + return this._delegate.capabilities; + } + get delegate() { + return this._delegate; + } + write(path, content) { + return this._doSyncCall(this._delegate.write(path, content)); + } + read(path) { + return this._doSyncCall(this._delegate.read(path)); + } + delete(path) { + return this._doSyncCall(this._delegate.delete(path)); + } + rename(from, to) { + return this._doSyncCall(this._delegate.rename(from, to)); + } + list(path) { + return this._doSyncCall(this._delegate.list(path)); + } + exists(path) { + return this._doSyncCall(this._delegate.exists(path)); + } + isDirectory(path) { + return this._doSyncCall(this._delegate.isDirectory(path)); + } + isFile(path) { + return this._doSyncCall(this._delegate.isFile(path)); + } + // Some hosts may not support stat. + stat(path) { + const result = this._delegate.stat(path); + if (result) { + return this._doSyncCall(result); + } + else { + return null; + } + } + watch(path, options) { + return this._delegate.watch(path, options); + } +} +exports.SyncDelegateHost = SyncDelegateHost; diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/virtual-fs/host/test.d.ts b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/virtual-fs/host/test.d.ts new file mode 100644 index 00000000..0fc5ee68 --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/virtual-fs/host/test.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 + */ +import { Observable } from 'rxjs'; +import { Path, PathFragment } from '../path'; +import { FileBuffer, HostWatchEvent, HostWatchOptions, Stats } from './interface'; +import { SimpleMemoryHost, SimpleMemoryHostStats } from './memory'; +import { SyncDelegateHost } from './sync'; +export declare namespace test { + type TestLogRecord = { + kind: 'write' | 'read' | 'delete' | 'list' | 'exists' | 'isDirectory' | 'isFile' | 'stat' | 'watch'; + path: Path; + } | { + kind: 'rename'; + from: Path; + to: Path; + }; + class TestHost extends SimpleMemoryHost { + protected _records: TestLogRecord[]; + protected _sync: SyncDelegateHost<{}> | null; + constructor(map?: { + [path: string]: string; + }); + get records(): TestLogRecord[]; + clearRecords(): void; + get files(): Path[]; + get sync(): SyncDelegateHost<{}>; + clone(): TestHost; + protected _write(path: Path, content: FileBuffer): void; + protected _read(path: Path): ArrayBuffer; + protected _delete(path: Path): void; + protected _rename(from: Path, to: Path): void; + protected _list(path: Path): PathFragment[]; + protected _exists(path: Path): boolean; + protected _isDirectory(path: Path): boolean; + protected _isFile(path: Path): boolean; + protected _stat(path: Path): Stats<SimpleMemoryHostStats> | null; + protected _watch(path: Path, options?: HostWatchOptions): Observable<HostWatchEvent>; + $write(path: string, content: string): void; + $read(path: string): string; + $list(path: string): PathFragment[]; + $exists(path: string): boolean; + $isDirectory(path: string): boolean; + $isFile(path: string): boolean; + } +} diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/virtual-fs/host/test.js b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/virtual-fs/host/test.js new file mode 100644 index 00000000..26381daf --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/virtual-fs/host/test.js @@ -0,0 +1,122 @@ +"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.test = void 0; +const path_1 = require("../path"); +const buffer_1 = require("./buffer"); +const memory_1 = require("./memory"); +const sync_1 = require("./sync"); +// eslint-disable-next-line @typescript-eslint/no-namespace +var test; +(function (test) { + class TestHost extends memory_1.SimpleMemoryHost { + constructor(map = {}) { + super(); + this._records = []; + this._sync = null; + for (const filePath of Object.getOwnPropertyNames(map)) { + this._write((0, path_1.normalize)(filePath), (0, buffer_1.stringToFileBuffer)(map[filePath])); + } + } + get records() { + return [...this._records]; + } + clearRecords() { + this._records = []; + } + get files() { + const sync = this.sync; + function _visit(p) { + return sync + .list(p) + .map((fragment) => (0, path_1.join)(p, fragment)) + .reduce((files, path) => { + if (sync.isDirectory(path)) { + return files.concat(_visit(path)); + } + else { + return files.concat(path); + } + }, []); + } + return _visit((0, path_1.normalize)('/')); + } + get sync() { + if (!this._sync) { + this._sync = new sync_1.SyncDelegateHost(this); + } + return this._sync; + } + clone() { + const newHost = new TestHost(); + newHost._cache = new Map(this._cache); + return newHost; + } + // Override parents functions to keep a record of all operators that were done. + _write(path, content) { + this._records.push({ kind: 'write', path }); + return super._write(path, content); + } + _read(path) { + this._records.push({ kind: 'read', path }); + return super._read(path); + } + _delete(path) { + this._records.push({ kind: 'delete', path }); + return super._delete(path); + } + _rename(from, to) { + this._records.push({ kind: 'rename', from, to }); + return super._rename(from, to); + } + _list(path) { + this._records.push({ kind: 'list', path }); + return super._list(path); + } + _exists(path) { + this._records.push({ kind: 'exists', path }); + return super._exists(path); + } + _isDirectory(path) { + this._records.push({ kind: 'isDirectory', path }); + return super._isDirectory(path); + } + _isFile(path) { + this._records.push({ kind: 'isFile', path }); + return super._isFile(path); + } + _stat(path) { + this._records.push({ kind: 'stat', path }); + return super._stat(path); + } + _watch(path, options) { + this._records.push({ kind: 'watch', path }); + return super._watch(path, options); + } + $write(path, content) { + return super._write((0, path_1.normalize)(path), (0, buffer_1.stringToFileBuffer)(content)); + } + $read(path) { + return (0, buffer_1.fileBufferToString)(super._read((0, path_1.normalize)(path))); + } + $list(path) { + return super._list((0, path_1.normalize)(path)); + } + $exists(path) { + return super._exists((0, path_1.normalize)(path)); + } + $isDirectory(path) { + return super._isDirectory((0, path_1.normalize)(path)); + } + $isFile(path) { + return super._isFile((0, path_1.normalize)(path)); + } + } + test.TestHost = TestHost; +})(test = exports.test || (exports.test = {})); diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/virtual-fs/index.d.ts b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/virtual-fs/index.d.ts new file mode 100644 index 00000000..0f018749 --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/virtual-fs/index.d.ts @@ -0,0 +1,10 @@ +/** + * @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 + */ +import * as virtualFs from './host/index'; +export * from './path'; +export { virtualFs }; diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/virtual-fs/index.js b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/virtual-fs/index.js new file mode 100644 index 00000000..fb84e113 --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/virtual-fs/index.js @@ -0,0 +1,35 @@ +"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 + */ +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; +var __exportStar = (this && this.__exportStar) || function(m, exports) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.virtualFs = void 0; +const virtualFs = __importStar(require("./host/index")); +exports.virtualFs = virtualFs; +__exportStar(require("./path"), exports); diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/virtual-fs/path.d.ts b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/virtual-fs/path.d.ts new file mode 100644 index 00000000..44dfdd13 --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/virtual-fs/path.d.ts @@ -0,0 +1,113 @@ +/** + * @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 + */ +import { BaseException } from '../exception'; +import { TemplateTag } from '../utils/literals'; +export declare class InvalidPathException extends BaseException { + constructor(path: string); +} +export declare class PathMustBeAbsoluteException extends BaseException { + constructor(path: string); +} +export declare class PathCannotBeFragmentException extends BaseException { + constructor(path: string); +} +/** + * A Path recognized by most methods in the DevKit. + */ +export declare type Path = string & { + __PRIVATE_DEVKIT_PATH: void; +}; +/** + * A Path fragment (file or directory name) recognized by most methods in the DevKit. + */ +export declare type PathFragment = Path & { + __PRIVATE_DEVKIT_PATH_FRAGMENT: void; +}; +/** + * The Separator for normalized path. + * @type {Path} + */ +export declare const NormalizedSep: Path; +/** + * The root of a normalized path. + * @type {Path} + */ +export declare const NormalizedRoot: Path; +/** + * Split a path into multiple path fragments. Each fragments except the last one will end with + * a path separator. + * @param {Path} path The path to split. + * @returns {Path[]} An array of path fragments. + */ +export declare function split(path: Path): PathFragment[]; +/** + * + */ +export declare function extname(path: Path): string; +/** + * Return the basename of the path, as a Path. See path.basename + */ +export declare function basename(path: Path): PathFragment; +/** + * Return the dirname of the path, as a Path. See path.dirname + */ +export declare function dirname(path: Path): Path; +/** + * Join multiple paths together, and normalize the result. Accepts strings that will be + * normalized as well (but the original must be a path). + */ +export declare function join(p1: Path, ...others: string[]): Path; +/** + * Returns true if a path is absolute. + */ +export declare function isAbsolute(p: Path): boolean; +/** + * Returns a path such that `join(from, relative(from, to)) == to`. + * Both paths must be absolute, otherwise it does not make much sense. + */ +export declare function relative(from: Path, to: Path): Path; +/** + * Returns a Path that is the resolution of p2, from p1. If p2 is absolute, it will return p2, + * otherwise will join both p1 and p2. + */ +export declare function resolve(p1: Path, p2: Path): Path; +export declare function fragment(path: string): PathFragment; +/** + * Reset the cache. This is only useful for testing. + * @private + */ +export declare function resetNormalizeCache(): void; +/** + * Normalize a string into a Path. This is the only mean to get a Path type from a string that + * represents a system path. This method cache the results as real world paths tend to be + * duplicated often. + * Normalization includes: + * - Windows backslashes `\\` are replaced with `/`. + * - Windows drivers are replaced with `/X/`, where X is the drive letter. + * - Absolute paths starts with `/`. + * - Multiple `/` are replaced by a single one. + * - Path segments `.` are removed. + * - Path segments `..` are resolved. + * - If a path is absolute, having a `..` at the start is invalid (and will throw). + * @param path The path to be normalized. + */ +export declare function normalize(path: string): Path; +/** + * The no cache version of the normalize() function. Used for benchmarking and testing. + */ +export declare function noCacheNormalize(path: string): Path; +export declare const path: TemplateTag<Path>; +export declare type WindowsPath = string & { + __PRIVATE_DEVKIT_WINDOWS_PATH: void; +}; +export declare type PosixPath = string & { + __PRIVATE_DEVKIT_POSIX_PATH: void; +}; +export declare function asWindowsPath(path: Path): WindowsPath; +export declare function asPosixPath(path: Path): PosixPath; +export declare function getSystemPath(path: Path): string; diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/virtual-fs/path.js b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/virtual-fs/path.js new file mode 100644 index 00000000..6c550429 --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/virtual-fs/path.js @@ -0,0 +1,287 @@ +"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.getSystemPath = exports.asPosixPath = exports.asWindowsPath = exports.path = exports.noCacheNormalize = exports.normalize = exports.resetNormalizeCache = exports.fragment = exports.resolve = exports.relative = exports.isAbsolute = exports.join = exports.dirname = exports.basename = exports.extname = exports.split = exports.NormalizedRoot = exports.NormalizedSep = exports.PathCannotBeFragmentException = exports.PathMustBeAbsoluteException = exports.InvalidPathException = void 0; +const exception_1 = require("../exception"); +class InvalidPathException extends exception_1.BaseException { + constructor(path) { + super(`Path ${JSON.stringify(path)} is invalid.`); + } +} +exports.InvalidPathException = InvalidPathException; +class PathMustBeAbsoluteException extends exception_1.BaseException { + constructor(path) { + super(`Path ${JSON.stringify(path)} must be absolute.`); + } +} +exports.PathMustBeAbsoluteException = PathMustBeAbsoluteException; +class PathCannotBeFragmentException extends exception_1.BaseException { + constructor(path) { + super(`Path ${JSON.stringify(path)} cannot be made a fragment.`); + } +} +exports.PathCannotBeFragmentException = PathCannotBeFragmentException; +/** + * The Separator for normalized path. + * @type {Path} + */ +exports.NormalizedSep = '/'; +/** + * The root of a normalized path. + * @type {Path} + */ +exports.NormalizedRoot = exports.NormalizedSep; +/** + * Split a path into multiple path fragments. Each fragments except the last one will end with + * a path separator. + * @param {Path} path The path to split. + * @returns {Path[]} An array of path fragments. + */ +function split(path) { + const fragments = path.split(exports.NormalizedSep).map((x) => fragment(x)); + if (fragments[fragments.length - 1].length === 0) { + fragments.pop(); + } + return fragments; +} +exports.split = split; +/** + * + */ +function extname(path) { + const base = basename(path); + const i = base.lastIndexOf('.'); + if (i < 1) { + return ''; + } + else { + return base.substr(i); + } +} +exports.extname = extname; +/** + * Return the basename of the path, as a Path. See path.basename + */ +function basename(path) { + const i = path.lastIndexOf(exports.NormalizedSep); + if (i == -1) { + return fragment(path); + } + else { + return fragment(path.substr(path.lastIndexOf(exports.NormalizedSep) + 1)); + } +} +exports.basename = basename; +/** + * Return the dirname of the path, as a Path. See path.dirname + */ +function dirname(path) { + const index = path.lastIndexOf(exports.NormalizedSep); + if (index === -1) { + return ''; + } + const endIndex = index === 0 ? 1 : index; // case of file under root: '/file' + return normalize(path.substr(0, endIndex)); +} +exports.dirname = dirname; +/** + * Join multiple paths together, and normalize the result. Accepts strings that will be + * normalized as well (but the original must be a path). + */ +function join(p1, ...others) { + if (others.length > 0) { + return normalize((p1 ? p1 + exports.NormalizedSep : '') + others.join(exports.NormalizedSep)); + } + else { + return p1; + } +} +exports.join = join; +/** + * Returns true if a path is absolute. + */ +function isAbsolute(p) { + return p.startsWith(exports.NormalizedSep); +} +exports.isAbsolute = isAbsolute; +/** + * Returns a path such that `join(from, relative(from, to)) == to`. + * Both paths must be absolute, otherwise it does not make much sense. + */ +function relative(from, to) { + if (!isAbsolute(from)) { + throw new PathMustBeAbsoluteException(from); + } + if (!isAbsolute(to)) { + throw new PathMustBeAbsoluteException(to); + } + let p; + if (from == to) { + p = ''; + } + else { + const splitFrom = split(from); + const splitTo = split(to); + while (splitFrom.length > 0 && splitTo.length > 0 && splitFrom[0] == splitTo[0]) { + splitFrom.shift(); + splitTo.shift(); + } + if (splitFrom.length == 0) { + p = splitTo.join(exports.NormalizedSep); + } + else { + p = splitFrom + .map(() => '..') + .concat(splitTo) + .join(exports.NormalizedSep); + } + } + return normalize(p); +} +exports.relative = relative; +/** + * Returns a Path that is the resolution of p2, from p1. If p2 is absolute, it will return p2, + * otherwise will join both p1 and p2. + */ +function resolve(p1, p2) { + if (isAbsolute(p2)) { + return p2; + } + else { + return join(p1, p2); + } +} +exports.resolve = resolve; +function fragment(path) { + if (path.indexOf(exports.NormalizedSep) != -1) { + throw new PathCannotBeFragmentException(path); + } + return path; +} +exports.fragment = fragment; +/** + * normalize() cache to reduce computation. For now this grows and we never flush it, but in the + * future we might want to add a few cache flush to prevent this from growing too large. + */ +let normalizedCache = new Map(); +/** + * Reset the cache. This is only useful for testing. + * @private + */ +function resetNormalizeCache() { + normalizedCache = new Map(); +} +exports.resetNormalizeCache = resetNormalizeCache; +/** + * Normalize a string into a Path. This is the only mean to get a Path type from a string that + * represents a system path. This method cache the results as real world paths tend to be + * duplicated often. + * Normalization includes: + * - Windows backslashes `\\` are replaced with `/`. + * - Windows drivers are replaced with `/X/`, where X is the drive letter. + * - Absolute paths starts with `/`. + * - Multiple `/` are replaced by a single one. + * - Path segments `.` are removed. + * - Path segments `..` are resolved. + * - If a path is absolute, having a `..` at the start is invalid (and will throw). + * @param path The path to be normalized. + */ +function normalize(path) { + let maybePath = normalizedCache.get(path); + if (!maybePath) { + maybePath = noCacheNormalize(path); + normalizedCache.set(path, maybePath); + } + return maybePath; +} +exports.normalize = normalize; +/** + * The no cache version of the normalize() function. Used for benchmarking and testing. + */ +function noCacheNormalize(path) { + if (path == '' || path == '.') { + return ''; + } + else if (path == exports.NormalizedRoot) { + return exports.NormalizedRoot; + } + // Match absolute windows path. + const original = path; + if (path.match(/^[A-Z]:[/\\]/i)) { + path = '\\' + path[0] + '\\' + path.substr(3); + } + // We convert Windows paths as well here. + const p = path.split(/[/\\]/g); + let relative = false; + let i = 1; + // Special case the first one. + if (p[0] != '') { + p.unshift('.'); + relative = true; + } + while (i < p.length) { + if (p[i] == '.') { + p.splice(i, 1); + } + else if (p[i] == '..') { + if (i < 2 && !relative) { + throw new InvalidPathException(original); + } + else if (i >= 2 && p[i - 1] != '..') { + p.splice(i - 1, 2); + i--; + } + else { + i++; + } + } + else if (p[i] == '') { + p.splice(i, 1); + } + else { + i++; + } + } + if (p.length == 1) { + return p[0] == '' ? exports.NormalizedSep : ''; + } + else { + if (p[0] == '.') { + p.shift(); + } + return p.join(exports.NormalizedSep); + } +} +exports.noCacheNormalize = noCacheNormalize; +const path = (strings, ...values) => { + return normalize(String.raw(strings, ...values)); +}; +exports.path = path; +function asWindowsPath(path) { + const drive = path.match(/^\/(\w)(?:\/(.*))?$/); + if (drive) { + const subPath = drive[2] ? drive[2].replace(/\//g, '\\') : ''; + return `${drive[1]}:\\${subPath}`; + } + return path.replace(/\//g, '\\'); +} +exports.asWindowsPath = asWindowsPath; +function asPosixPath(path) { + return path; +} +exports.asPosixPath = asPosixPath; +function getSystemPath(path) { + if (process.platform.startsWith('win32')) { + return asWindowsPath(path); + } + else { + return asPosixPath(path); + } +} +exports.getSystemPath = getSystemPath; diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/workspace/core.d.ts b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/workspace/core.d.ts new file mode 100644 index 00000000..2849bd6d --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/workspace/core.d.ts @@ -0,0 +1,61 @@ +/** + * @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 + */ +import { WorkspaceDefinition } from './definitions'; +import { WorkspaceHost } from './host'; +/** + * Supported workspace formats + */ +export declare enum WorkspaceFormat { + JSON = 0 +} +/** + * @private + */ +export declare function _test_addWorkspaceFile(name: string, format: WorkspaceFormat): void; +/** + * @private + */ +export declare function _test_removeWorkspaceFile(name: string): void; +/** + * Reads and constructs a `WorkspaceDefinition`. If the function is provided with a path to a + * directory instead of a file, a search of the directory's files will commence to attempt to + * locate a known workspace file. Currently the following are considered known workspace files: + * - `angular.json` + * - `.angular.json` + * + * @param path The path to either a workspace file or a directory containing a workspace file. + * @param host The `WorkspaceHost` to use to access the file and directory data. + * @param format An optional `WorkspaceFormat` value. Used if the path specifies a non-standard + * file name that would prevent automatically discovering the format. + * + * + * @return An `Promise` of the read result object with the `WorkspaceDefinition` contained within + * the `workspace` property. + */ +export declare function readWorkspace(path: string, host: WorkspaceHost, format?: WorkspaceFormat): Promise<{ + workspace: WorkspaceDefinition; +}>; +/** + * Writes a `WorkspaceDefinition` to the underlying storage via the provided `WorkspaceHost`. + * If the `WorkspaceDefinition` was created via the `readWorkspace` function, metadata will be + * used to determine the path and format of the Workspace. In all other cases, the `path` and + * `format` options must be specified as they would be otherwise unknown. + * + * @param workspace The `WorkspaceDefinition` that will be written. + * @param host The `WorkspaceHost` to use to access/write the file and directory data. + * @param path The path to a file location for the output. Required if `readWorkspace` was not + * used to create the `WorkspaceDefinition`. Optional otherwise; will override the + * `WorkspaceDefinition` metadata if provided. + * @param format The `WorkspaceFormat` to use for output. Required if `readWorkspace` was not + * used to create the `WorkspaceDefinition`. Optional otherwise; will override the + * `WorkspaceDefinition` metadata if provided. + * + * + * @return An `Promise` of type `void`. + */ +export declare function writeWorkspace(workspace: WorkspaceDefinition, host: WorkspaceHost, path?: string, format?: WorkspaceFormat): Promise<void>; diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/workspace/core.js b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/workspace/core.js new file mode 100644 index 00000000..3ef20c88 --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/workspace/core.js @@ -0,0 +1,132 @@ +"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.writeWorkspace = exports.readWorkspace = exports._test_removeWorkspaceFile = exports._test_addWorkspaceFile = exports.WorkspaceFormat = void 0; +const virtual_fs_1 = require("../virtual-fs"); +const reader_1 = require("./json/reader"); +const writer_1 = require("./json/writer"); +const formatLookup = new WeakMap(); +/** + * Supported workspace formats + */ +var WorkspaceFormat; +(function (WorkspaceFormat) { + WorkspaceFormat[WorkspaceFormat["JSON"] = 0] = "JSON"; +})(WorkspaceFormat = exports.WorkspaceFormat || (exports.WorkspaceFormat = {})); +/** + * @private + */ +function _test_addWorkspaceFile(name, format) { + workspaceFiles[name] = format; +} +exports._test_addWorkspaceFile = _test_addWorkspaceFile; +/** + * @private + */ +function _test_removeWorkspaceFile(name) { + delete workspaceFiles[name]; +} +exports._test_removeWorkspaceFile = _test_removeWorkspaceFile; +// NOTE: future additions could also perform content analysis to determine format/version +const workspaceFiles = { + 'angular.json': WorkspaceFormat.JSON, + '.angular.json': WorkspaceFormat.JSON, +}; +/** + * Reads and constructs a `WorkspaceDefinition`. If the function is provided with a path to a + * directory instead of a file, a search of the directory's files will commence to attempt to + * locate a known workspace file. Currently the following are considered known workspace files: + * - `angular.json` + * - `.angular.json` + * + * @param path The path to either a workspace file or a directory containing a workspace file. + * @param host The `WorkspaceHost` to use to access the file and directory data. + * @param format An optional `WorkspaceFormat` value. Used if the path specifies a non-standard + * file name that would prevent automatically discovering the format. + * + * + * @return An `Promise` of the read result object with the `WorkspaceDefinition` contained within + * the `workspace` property. + */ +async function readWorkspace(path, host, format) { + if (await host.isDirectory(path)) { + // TODO: Warn if multiple found (requires diagnostics support) + const directory = (0, virtual_fs_1.normalize)(path); + let found = false; + for (const [name, nameFormat] of Object.entries(workspaceFiles)) { + if (format !== undefined && format !== nameFormat) { + continue; + } + const potential = (0, virtual_fs_1.getSystemPath)((0, virtual_fs_1.join)(directory, name)); + if (await host.isFile(potential)) { + path = potential; + format = nameFormat; + found = true; + break; + } + } + if (!found) { + throw new Error('Unable to locate a workspace file for workspace path. Are you missing an `angular.json`' + + ' or `.angular.json` file?'); + } + } + else if (format === undefined) { + const filename = (0, virtual_fs_1.basename)((0, virtual_fs_1.normalize)(path)); + if (filename in workspaceFiles) { + format = workspaceFiles[filename]; + } + } + if (format === undefined) { + throw new Error('Unable to determine format for workspace path.'); + } + let workspace; + switch (format) { + case WorkspaceFormat.JSON: + workspace = await (0, reader_1.readJsonWorkspace)(path, host); + break; + default: + throw new Error('Unsupported workspace format.'); + } + formatLookup.set(workspace, WorkspaceFormat.JSON); + return { workspace }; +} +exports.readWorkspace = readWorkspace; +/** + * Writes a `WorkspaceDefinition` to the underlying storage via the provided `WorkspaceHost`. + * If the `WorkspaceDefinition` was created via the `readWorkspace` function, metadata will be + * used to determine the path and format of the Workspace. In all other cases, the `path` and + * `format` options must be specified as they would be otherwise unknown. + * + * @param workspace The `WorkspaceDefinition` that will be written. + * @param host The `WorkspaceHost` to use to access/write the file and directory data. + * @param path The path to a file location for the output. Required if `readWorkspace` was not + * used to create the `WorkspaceDefinition`. Optional otherwise; will override the + * `WorkspaceDefinition` metadata if provided. + * @param format The `WorkspaceFormat` to use for output. Required if `readWorkspace` was not + * used to create the `WorkspaceDefinition`. Optional otherwise; will override the + * `WorkspaceDefinition` metadata if provided. + * + * + * @return An `Promise` of type `void`. + */ +async function writeWorkspace(workspace, host, path, format) { + if (format === undefined) { + format = formatLookup.get(workspace); + if (format === undefined) { + throw new Error('A format is required for custom workspace objects.'); + } + } + switch (format) { + case WorkspaceFormat.JSON: + return (0, writer_1.writeJsonWorkspace)(workspace, host, path); + default: + throw new Error('Unsupported workspace format.'); + } +} +exports.writeWorkspace = writeWorkspace; diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/workspace/definitions.d.ts b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/workspace/definitions.d.ts new file mode 100644 index 00000000..b2bdd0f8 --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/workspace/definitions.d.ts @@ -0,0 +1,63 @@ +/** + * @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 + */ +import { JsonValue } from '../json'; +export interface WorkspaceDefinition { + readonly extensions: Record<string, JsonValue | undefined>; + readonly projects: ProjectDefinitionCollection; +} +export interface ProjectDefinition { + readonly extensions: Record<string, JsonValue | undefined>; + readonly targets: TargetDefinitionCollection; + root: string; + prefix?: string; + sourceRoot?: string; +} +export interface TargetDefinition { + options?: Record<string, JsonValue | undefined>; + configurations?: Record<string, Record<string, JsonValue | undefined> | undefined>; + defaultConfiguration?: string; + builder: string; +} +export declare type DefinitionCollectionListener<V extends object> = (name: string, action: 'add' | 'remove' | 'replace', newValue: V | undefined, oldValue: V | undefined, collection: DefinitionCollection<V>) => void; +declare class DefinitionCollection<V extends object> implements ReadonlyMap<string, V> { + private _listener?; + private _map; + constructor(initial?: Record<string, V>, _listener?: DefinitionCollectionListener<V> | undefined); + delete(key: string): boolean; + set(key: string, value: V): this; + forEach<T>(callbackfn: (value: V, key: string, map: DefinitionCollection<V>) => void, thisArg?: T): void; + get(key: string): V | undefined; + has(key: string): boolean; + get size(): number; + [Symbol.iterator](): IterableIterator<[string, V]>; + entries(): IterableIterator<[string, V]>; + keys(): IterableIterator<string>; + values(): IterableIterator<V>; +} +export declare class ProjectDefinitionCollection extends DefinitionCollection<ProjectDefinition> { + constructor(initial?: Record<string, ProjectDefinition>, listener?: DefinitionCollectionListener<ProjectDefinition>); + add(definition: { + name: string; + root: string; + sourceRoot?: string; + prefix?: string; + targets?: Record<string, TargetDefinition | undefined>; + [key: string]: unknown; + }): ProjectDefinition; + set(name: string, value: ProjectDefinition): this; + private _validateName; +} +export declare class TargetDefinitionCollection extends DefinitionCollection<TargetDefinition> { + constructor(initial?: Record<string, TargetDefinition>, listener?: DefinitionCollectionListener<TargetDefinition>); + add(definition: { + name: string; + } & TargetDefinition): TargetDefinition; + set(name: string, value: TargetDefinition): this; + private _validateName; +} +export {}; diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/workspace/definitions.js b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/workspace/definitions.js new file mode 100644 index 00000000..1a41f044 --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/workspace/definitions.js @@ -0,0 +1,167 @@ +"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.TargetDefinitionCollection = exports.ProjectDefinitionCollection = void 0; +class DefinitionCollection { + constructor(initial, _listener) { + this._listener = _listener; + this._map = new Map(initial && Object.entries(initial)); + } + delete(key) { + const value = this._map.get(key); + const result = this._map.delete(key); + if (result && value !== undefined && this._listener) { + this._listener(key, 'remove', undefined, value, this); + } + return result; + } + set(key, value) { + const existing = this.get(key); + this._map.set(key, value); + if (this._listener) { + this._listener(key, existing !== undefined ? 'replace' : 'add', value, existing, this); + } + return this; + } + forEach(callbackfn, thisArg) { + this._map.forEach((value, key) => callbackfn(value, key, this), thisArg); + } + get(key) { + return this._map.get(key); + } + has(key) { + return this._map.has(key); + } + get size() { + return this._map.size; + } + [Symbol.iterator]() { + return this._map[Symbol.iterator](); + } + entries() { + return this._map.entries(); + } + keys() { + return this._map.keys(); + } + values() { + return this._map.values(); + } +} +function isJsonValue(value) { + const visited = new Set(); + switch (typeof value) { + case 'boolean': + case 'number': + case 'string': + return true; + case 'object': + if (value === null) { + return true; + } + visited.add(value); + for (const property of Object.values(value)) { + if (typeof value === 'object' && visited.has(property)) { + continue; + } + if (!isJsonValue(property)) { + return false; + } + } + return true; + default: + return false; + } +} +class ProjectDefinitionCollection extends DefinitionCollection { + constructor(initial, listener) { + super(initial, listener); + } + add(definition) { + if (this.has(definition.name)) { + throw new Error('Project name already exists.'); + } + this._validateName(definition.name); + const project = { + root: definition.root, + prefix: definition.prefix, + sourceRoot: definition.sourceRoot, + targets: new TargetDefinitionCollection(), + extensions: {}, + }; + if (definition.targets) { + for (const [name, target] of Object.entries(definition.targets)) { + if (target) { + project.targets.set(name, target); + } + } + } + for (const [name, value] of Object.entries(definition)) { + switch (name) { + case 'name': + case 'root': + case 'sourceRoot': + case 'prefix': + case 'targets': + break; + default: + if (isJsonValue(value)) { + project.extensions[name] = value; + } + else { + throw new TypeError(`"${name}" must be a JSON value.`); + } + break; + } + } + super.set(definition.name, project); + return project; + } + set(name, value) { + this._validateName(name); + super.set(name, value); + return this; + } + _validateName(name) { + if (typeof name !== 'string' || !/^(?:@\w[\w.-]*\/)?\w[\w.-]*$/.test(name)) { + throw new Error('Project name must be a valid npm package name.'); + } + } +} +exports.ProjectDefinitionCollection = ProjectDefinitionCollection; +class TargetDefinitionCollection extends DefinitionCollection { + constructor(initial, listener) { + super(initial, listener); + } + add(definition) { + if (this.has(definition.name)) { + throw new Error('Target name already exists.'); + } + this._validateName(definition.name); + const target = { + builder: definition.builder, + options: definition.options, + configurations: definition.configurations, + defaultConfiguration: definition.defaultConfiguration, + }; + super.set(definition.name, target); + return target; + } + set(name, value) { + this._validateName(name); + super.set(name, value); + return this; + } + _validateName(name) { + if (typeof name !== 'string') { + throw new TypeError('Target name must be a string.'); + } + } +} +exports.TargetDefinitionCollection = TargetDefinitionCollection; diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/workspace/host.d.ts b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/workspace/host.d.ts new file mode 100644 index 00000000..b6c06f2d --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/workspace/host.d.ts @@ -0,0 +1,15 @@ +/** + * @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 + */ +import { virtualFs } from '../virtual-fs'; +export interface WorkspaceHost { + readFile(path: string): Promise<string>; + writeFile(path: string, data: string): Promise<void>; + isDirectory(path: string): Promise<boolean>; + isFile(path: string): Promise<boolean>; +} +export declare function createWorkspaceHost(host: virtualFs.Host): WorkspaceHost; diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/workspace/host.js b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/workspace/host.js new file mode 100644 index 00000000..c259a499 --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/workspace/host.js @@ -0,0 +1,42 @@ +"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.createWorkspaceHost = void 0; +const virtual_fs_1 = require("../virtual-fs"); +function createWorkspaceHost(host) { + const workspaceHost = { + async readFile(path) { + const data = await host.read((0, virtual_fs_1.normalize)(path)).toPromise(); + return virtual_fs_1.virtualFs.fileBufferToString(data); + }, + async writeFile(path, data) { + return host.write((0, virtual_fs_1.normalize)(path), virtual_fs_1.virtualFs.stringToFileBuffer(data)).toPromise(); + }, + async isDirectory(path) { + try { + return await host.isDirectory((0, virtual_fs_1.normalize)(path)).toPromise(); + } + catch { + // some hosts throw if path does not exist + return false; + } + }, + async isFile(path) { + try { + return await host.isFile((0, virtual_fs_1.normalize)(path)).toPromise(); + } + catch { + // some hosts throw if path does not exist + return false; + } + }, + }; + return workspaceHost; +} +exports.createWorkspaceHost = createWorkspaceHost; diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/workspace/index.d.ts b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/workspace/index.d.ts new file mode 100644 index 00000000..721f198e --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/workspace/index.d.ts @@ -0,0 +1,10 @@ +/** + * @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 + */ +export * from './definitions'; +export { WorkspaceHost, createWorkspaceHost } from './host'; +export { WorkspaceFormat, readWorkspace, writeWorkspace } from './core'; diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/workspace/index.js b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/workspace/index.js new file mode 100644 index 00000000..c502fe04 --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/workspace/index.js @@ -0,0 +1,27 @@ +"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 + */ +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __exportStar = (this && this.__exportStar) || function(m, exports) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.writeWorkspace = exports.readWorkspace = exports.WorkspaceFormat = exports.createWorkspaceHost = void 0; +__exportStar(require("./definitions"), exports); +var host_1 = require("./host"); +Object.defineProperty(exports, "createWorkspaceHost", { enumerable: true, get: function () { return host_1.createWorkspaceHost; } }); +var core_1 = require("./core"); +Object.defineProperty(exports, "WorkspaceFormat", { enumerable: true, get: function () { return core_1.WorkspaceFormat; } }); +Object.defineProperty(exports, "readWorkspace", { enumerable: true, get: function () { return core_1.readWorkspace; } }); +Object.defineProperty(exports, "writeWorkspace", { enumerable: true, get: function () { return core_1.writeWorkspace; } }); diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/workspace/json/metadata.d.ts b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/workspace/json/metadata.d.ts new file mode 100644 index 00000000..2b317bb5 --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/workspace/json/metadata.d.ts @@ -0,0 +1,41 @@ +/** + * @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 + */ +import { JsonValue } from '../../json'; +import { JsonAstArray, JsonAstKeyValue, JsonAstNode, JsonAstObject } from '../../json/parser_ast'; +import { ProjectDefinition, TargetDefinition, WorkspaceDefinition } from '../definitions'; +export declare const JsonWorkspaceSymbol: unique symbol; +export interface JsonWorkspaceDefinition extends WorkspaceDefinition { + [JsonWorkspaceSymbol]: JsonWorkspaceMetadata; +} +interface ChangeValues { + json: JsonValue; + project: ProjectDefinition; + target: TargetDefinition; + projectcollection: Iterable<[string, ProjectDefinition]>; + targetcollection: Iterable<[string, TargetDefinition]>; +} +export interface JsonChange<T extends keyof ChangeValues = keyof ChangeValues> { + op: T extends 'json' | 'project' | 'target' ? 'add' | 'remove' | 'replace' : 'add'; + path: string; + node: JsonAstNode | JsonAstKeyValue; + value?: ChangeValues[T]; + type: T; +} +export declare class JsonWorkspaceMetadata { + readonly filePath: string; + readonly ast: JsonAstObject; + readonly raw: string; + readonly changes: JsonChange[]; + constructor(filePath: string, ast: JsonAstObject, raw: string); + get hasChanges(): boolean; + get changeCount(): number; + findChangesForPath(path: string): JsonChange[]; + addChange<T extends keyof ChangeValues = keyof ChangeValues>(op: 'add' | 'remove' | 'replace', path: string, node: JsonAstArray | JsonAstObject | JsonAstKeyValue, value?: ChangeValues[T], type?: T): void; + reset(): void; +} +export {}; diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/workspace/json/metadata.js b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/workspace/json/metadata.js new file mode 100644 index 00000000..1a5f1e5f --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/workspace/json/metadata.js @@ -0,0 +1,47 @@ +"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.JsonWorkspaceMetadata = exports.JsonWorkspaceSymbol = void 0; +exports.JsonWorkspaceSymbol = Symbol.for('@angular/core:workspace-json'); +class JsonWorkspaceMetadata { + constructor(filePath, ast, raw) { + this.filePath = filePath; + this.ast = ast; + this.raw = raw; + this.changes = []; + } + get hasChanges() { + return this.changes.length > 0; + } + get changeCount() { + return this.changes.length; + } + findChangesForPath(path) { + return this.changes.filter((c) => c.path === path); + } + addChange(op, path, node, value, type) { + // Remove redundant operations + if (op === 'remove' || op === 'replace') { + for (let i = this.changes.length - 1; i >= 0; --i) { + const currentPath = this.changes[i].path; + if (currentPath === path || currentPath.startsWith(path + '/')) { + if (op === 'replace' && currentPath === path && this.changes[i].op === 'add') { + op = 'add'; + } + this.changes.splice(i, 1); + } + } + } + this.changes.push({ op, path, node, value, type: op === 'remove' || !type ? 'json' : type }); + } + reset() { + this.changes.length = 0; + } +} +exports.JsonWorkspaceMetadata = JsonWorkspaceMetadata; diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/workspace/json/reader.d.ts b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/workspace/json/reader.d.ts new file mode 100644 index 00000000..b9fb50b8 --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/workspace/json/reader.d.ts @@ -0,0 +1,10 @@ +/** + * @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 + */ +import { WorkspaceDefinition } from '../definitions'; +import { WorkspaceHost } from '../host'; +export declare function readJsonWorkspace(path: string, host: WorkspaceHost): Promise<WorkspaceDefinition>; diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/workspace/json/reader.js b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/workspace/json/reader.js new file mode 100644 index 00000000..b6e7af0c --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/workspace/json/reader.js @@ -0,0 +1,229 @@ +"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.readJsonWorkspace = void 0; +const parser_1 = require("../../json/parser"); +const definitions_1 = require("../definitions"); +const metadata_1 = require("./metadata"); +const utilities_1 = require("./utilities"); +async function readJsonWorkspace(path, host) { + const raw = await host.readFile(path); + if (raw === undefined) { + throw new Error('Unable to read workspace file.'); + } + const ast = (0, parser_1.parseJsonAst)(raw, parser_1.JsonParseMode.Loose); + if (ast.kind !== 'object') { + throw new Error('Invalid workspace file - expected JSON object.'); + } + // Version check + const versionNode = ast.properties.find((pair) => pair.key.value === 'version'); + if (!versionNode) { + throw new Error('Unknown format - version specifier not found.'); + } + const formatVersion = versionNode.value.value; + if (formatVersion !== 1) { + throw new Error(`Invalid format version detected - Expected:[ 1 ] Found: [ ${formatVersion} ]`); + } + const context = { + host, + metadata: new metadata_1.JsonWorkspaceMetadata(path, ast, raw), + trackChanges: true, + error(message, _node) { + // TODO: Diagnostic reporting support + throw new Error(message); + }, + warn(_message, _node) { + // TODO: Diagnostic reporting support + }, + }; + const workspace = parseWorkspace(ast, context); + return workspace; +} +exports.readJsonWorkspace = readJsonWorkspace; +const specialWorkspaceExtensions = ['cli', 'defaultProject', 'newProjectRoot', 'schematics']; +const specialProjectExtensions = ['cli', 'schematics', 'projectType']; +function parseWorkspace(workspaceNode, context) { + const jsonMetadata = context.metadata; + let projects; + let projectsNode; + let extensions; + if (!context.trackChanges) { + extensions = Object.create(null); + } + for (const { key, value } of workspaceNode.properties) { + const name = key.value; + if (name === '$schema' || name === 'version') { + // skip + } + else if (name === 'projects') { + if (value.kind !== 'object') { + context.error('Invalid "projects" field found; expected an object.', value); + continue; + } + projectsNode = value; + projects = parseProjectsObject(value, context); + } + else { + if (!specialWorkspaceExtensions.includes(name) && !/^[a-z]{1,3}-.*/.test(name)) { + context.warn(`Project extension with invalid name found.`, key); + } + if (extensions) { + extensions[name] = value.value; + } + } + } + let collectionListener; + if (context.trackChanges && projectsNode) { + const parentNode = projectsNode; + collectionListener = (name, action, newValue) => { + jsonMetadata.addChange(action, `/projects/${(0, utilities_1.escapeKey)(name)}`, parentNode, newValue, 'project'); + }; + } + const projectCollection = new definitions_1.ProjectDefinitionCollection(projects, collectionListener); + return { + [metadata_1.JsonWorkspaceSymbol]: jsonMetadata, + projects: projectCollection, + // If not tracking changes the `extensions` variable will contain the parsed + // values. Otherwise the extensions are tracked via a virtual AST object. + extensions: extensions || + (0, utilities_1.createVirtualAstObject)(workspaceNode, { + exclude: ['$schema', 'version', 'projects'], + listener(op, path, node, value) { + jsonMetadata.addChange(op, path, node, value); + }, + }), + }; +} +function parseProjectsObject(projectsNode, context) { + const projects = Object.create(null); + for (const { key, value } of projectsNode.properties) { + if (value.kind !== 'object') { + context.warn('Skipping invalid project value; expected an object.', value); + continue; + } + const name = key.value; + projects[name] = parseProject(name, value, context); + } + return projects; +} +function parseProject(projectName, projectNode, context) { + const jsonMetadata = context.metadata; + let targets; + let targetsNode; + let extensions; + let properties; + if (!context.trackChanges) { + // If not tracking changes, the parser will store the values directly in standard objects + extensions = Object.create(null); + properties = Object.create(null); + } + for (const { key, value } of projectNode.properties) { + const name = key.value; + switch (name) { + case 'targets': + case 'architect': + if (value.kind !== 'object') { + context.error(`Invalid "${name}" field found; expected an object.`, value); + break; + } + targetsNode = value; + targets = parseTargetsObject(projectName, value, context); + break; + case 'prefix': + case 'root': + case 'sourceRoot': + if (value.kind !== 'string') { + context.warn(`Project property "${name}" should be a string.`, value); + } + if (properties) { + properties[name] = value.value; + } + break; + default: + if (!specialProjectExtensions.includes(name) && !/^[a-z]{1,3}-.*/.test(name)) { + context.warn(`Project extension with invalid name found.`, key); + } + if (extensions) { + extensions[name] = value.value; + } + break; + } + } + let collectionListener; + if (context.trackChanges) { + if (targetsNode) { + const parentNode = targetsNode; + collectionListener = (name, action, newValue) => { + jsonMetadata.addChange(action, `/projects/${projectName}/targets/${(0, utilities_1.escapeKey)(name)}`, parentNode, newValue, 'target'); + }; + } + else { + let added = false; + collectionListener = (_name, action, _new, _old, collection) => { + if (added || action !== 'add') { + return; + } + jsonMetadata.addChange('add', `/projects/${projectName}/targets`, projectNode, collection, 'targetcollection'); + added = true; + }; + } + } + const base = { + targets: new definitions_1.TargetDefinitionCollection(targets, collectionListener), + // If not tracking changes the `extensions` variable will contain the parsed + // values. Otherwise the extensions are tracked via a virtual AST object. + extensions: extensions || + (0, utilities_1.createVirtualAstObject)(projectNode, { + exclude: ['architect', 'prefix', 'root', 'sourceRoot', 'targets'], + listener(op, path, node, value) { + jsonMetadata.addChange(op, `/projects/${projectName}${path}`, node, value); + }, + }), + }; + let project; + if (context.trackChanges) { + project = (0, utilities_1.createVirtualAstObject)(projectNode, { + base, + include: ['prefix', 'root', 'sourceRoot'], + listener(op, path, node, value) { + jsonMetadata.addChange(op, `/projects/${projectName}${path}`, node, value); + }, + }); + } + else { + project = { + ...base, + ...properties, + }; + } + return project; +} +function parseTargetsObject(projectName, targetsNode, context) { + const jsonMetadata = context.metadata; + const targets = Object.create(null); + for (const { key, value } of targetsNode.properties) { + if (value.kind !== 'object') { + context.warn('Skipping invalid target value; expected an object.', value); + continue; + } + const name = key.value; + if (context.trackChanges) { + targets[name] = (0, utilities_1.createVirtualAstObject)(value, { + include: ['builder', 'options', 'configurations', 'defaultConfiguration'], + listener(op, path, node, value) { + jsonMetadata.addChange(op, `/projects/${projectName}/targets/${name}${path}`, node, value); + }, + }); + } + else { + targets[name] = value.value; + } + } + return targets; +} diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/workspace/json/utilities.d.ts b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/workspace/json/utilities.d.ts new file mode 100644 index 00000000..e31928d6 --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/workspace/json/utilities.d.ts @@ -0,0 +1,18 @@ +/** + * @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 + */ +import { JsonObject, JsonValue } from '../../json'; +import { JsonAstArray, JsonAstKeyValue, JsonAstObject } from '../../json/parser_ast'; +export declare type ChangeListener = (op: 'add' | 'remove' | 'replace', path: string, node: JsonAstArray | JsonAstObject | JsonAstKeyValue, value?: JsonValue) => void; +export declare function escapeKey(key: string | number): string | number; +export declare function unescapeKey(key: string | number): string | number; +export declare function createVirtualAstObject<T extends object = JsonObject>(root: JsonAstObject, options?: { + exclude?: string[]; + include?: string[]; + listener?: ChangeListener; + base?: object; +}): T; diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/workspace/json/utilities.js b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/workspace/json/utilities.js new file mode 100644 index 00000000..b619eaba --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/workspace/json/utilities.js @@ -0,0 +1,233 @@ +"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.createVirtualAstObject = exports.unescapeKey = exports.escapeKey = void 0; +const stableStringify = require('fast-json-stable-stringify'); +function findNode(parent, p) { + if (parent.kind === 'object') { + const entry = parent.properties.find((entry) => entry.key.value === p); + if (entry) { + return { node: entry.value, parent: entry }; + } + } + else { + const index = Number(p); + if (!isNaN(index)) { + return { node: parent.elements[index], parent }; + } + } + return { parent }; +} +function createPropertyDescriptor(value) { + return { + configurable: true, + enumerable: true, + writable: true, + value, + }; +} +function escapeKey(key) { + if (typeof key === 'number') { + return key; + } + return key.replace('~', '~0').replace('/', '~1'); +} +exports.escapeKey = escapeKey; +function unescapeKey(key) { + if (typeof key === 'number') { + return key; + } + return key.replace('~1', '/').replace('~0', '~'); +} +exports.unescapeKey = unescapeKey; +function createVirtualAstObject(root, options = {}) { + const reporter = (path, parent, node, old, current) => { + if (options.listener) { + if (old === current || stableStringify(old) === stableStringify(current)) { + return; + } + const op = old === undefined ? 'add' : current === undefined ? 'remove' : 'replace'; + options.listener(op, path, parent, current); + } + }; + return create(root, '', reporter, new Set(options.exclude), options.include && options.include.length > 0 ? new Set(options.include) : undefined, options.base); +} +exports.createVirtualAstObject = createVirtualAstObject; +function create(ast, path, reporter, excluded = new Set(), included, base) { + const cache = new Map(); + const alteredNodes = new Set(); + if (!base) { + if (ast.kind === 'object') { + base = Object.create(null); + } + else { + base = []; + base.length = ast.elements.length; + } + } + return new Proxy(base, { + getOwnPropertyDescriptor(target, p) { + const descriptor = Reflect.getOwnPropertyDescriptor(target, p); + if (descriptor || typeof p === 'symbol') { + return descriptor; + } + else if (excluded.has(p) || (included && !included.has(p))) { + return undefined; + } + const propertyPath = path + '/' + escapeKey(p); + const cacheEntry = cache.get(propertyPath); + if (cacheEntry) { + if (cacheEntry.value !== undefined) { + return createPropertyDescriptor(cacheEntry.value); + } + return undefined; + } + const { node } = findNode(ast, p); + if (node) { + return createPropertyDescriptor(node.value); + } + return undefined; + }, + has(target, p) { + if (Reflect.has(target, p)) { + return true; + } + else if (typeof p === 'symbol' || excluded.has(p)) { + return false; + } + return cache.has(path + '/' + escapeKey(p)) || findNode(ast, p) !== undefined; + }, + get(target, p) { + if (typeof p === 'symbol' || Reflect.has(target, p)) { + return Reflect.get(target, p); + } + else if (excluded.has(p) || (included && !included.has(p))) { + return undefined; + } + const propertyPath = path + '/' + escapeKey(p); + const cacheEntry = cache.get(propertyPath); + if (cacheEntry) { + return cacheEntry.value; + } + const { node, parent } = findNode(ast, p); + let value; + if (node) { + if (node.kind === 'object' || node.kind === 'array') { + value = create(node, propertyPath, (path, parent, vnode, old, current) => { + if (!alteredNodes.has(node)) { + reporter(path, parent, vnode, old, current); + } + }); + } + else { + value = node.value; + } + cache.set(propertyPath, { node, parent, value }); + } + return value; + }, + set(target, p, value) { + if (value === undefined) { + // setting to undefined is equivalent to a delete + // eslint-disable-next-line @typescript-eslint/no-non-null-assertion + return this.deleteProperty(target, p); + } + if (typeof p === 'symbol' || Reflect.has(target, p)) { + return Reflect.set(target, p, value); + } + else if (excluded.has(p) || (included && !included.has(p))) { + return false; + } + // TODO: Check if is JSON value + const jsonValue = value; + const propertyPath = path + '/' + escapeKey(p); + const cacheEntry = cache.get(propertyPath); + if (cacheEntry) { + const oldValue = cacheEntry.value; + cacheEntry.value = value; + if (cacheEntry.node && oldValue !== value) { + alteredNodes.add(cacheEntry.node); + } + reporter(propertyPath, cacheEntry.parent, cacheEntry.node, oldValue, jsonValue); + } + else { + const { node, parent } = findNode(ast, p); + cache.set(propertyPath, { node, parent, value: value }); + if (node && node.value !== value) { + alteredNodes.add(node); + } + reporter(propertyPath, parent, node, node && node.value, value); + } + return true; + }, + deleteProperty(target, p) { + if (typeof p === 'symbol' || Reflect.has(target, p)) { + return Reflect.deleteProperty(target, p); + } + else if (excluded.has(p) || (included && !included.has(p))) { + return false; + } + const propertyPath = path + '/' + escapeKey(p); + const cacheEntry = cache.get(propertyPath); + if (cacheEntry) { + const oldValue = cacheEntry.value; + cacheEntry.value = undefined; + if (cacheEntry.node) { + alteredNodes.add(cacheEntry.node); + } + if (cacheEntry.parent.kind === 'keyvalue') { + // Remove the entire key/value pair from this JSON object + reporter(propertyPath, ast, cacheEntry.node, oldValue, undefined); + } + else { + reporter(propertyPath, cacheEntry.parent, cacheEntry.node, oldValue, undefined); + } + } + else { + const { node, parent } = findNode(ast, p); + if (node) { + cache.set(propertyPath, { node, parent, value: undefined }); + alteredNodes.add(node); + if (parent.kind === 'keyvalue') { + // Remove the entire key/value pair from this JSON object + reporter(propertyPath, ast, node, node && node.value, undefined); + } + else { + reporter(propertyPath, parent, node, node && node.value, undefined); + } + } + } + return true; + }, + defineProperty(target, p, attributes) { + if (typeof p === 'symbol') { + return Reflect.defineProperty(target, p, attributes); + } + return false; + }, + ownKeys(target) { + let keys; + if (ast.kind === 'object') { + keys = ast.properties + .map((entry) => entry.key.value) + .filter((p) => !excluded.has(p) && (!included || included.has(p))); + } + else { + keys = []; + } + for (const key of cache.keys()) { + const relativeKey = key.substr(path.length + 1); + if (relativeKey.length > 0 && !relativeKey.includes('/')) { + keys.push(`${unescapeKey(relativeKey)}`); + } + } + return [...new Set([...keys, ...Reflect.ownKeys(target)])]; + }, + }); +} diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/workspace/json/writer.d.ts b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/workspace/json/writer.d.ts new file mode 100644 index 00000000..5666b31b --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/workspace/json/writer.d.ts @@ -0,0 +1,12 @@ +/** + * @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 + */ +import { WorkspaceDefinition } from '../definitions'; +import { WorkspaceHost } from '../host'; +export declare function writeJsonWorkspace(workspace: WorkspaceDefinition, host: WorkspaceHost, path?: string, options?: { + schema?: string; +}): Promise<void>; diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/workspace/json/writer.js b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/workspace/json/writer.js new file mode 100644 index 00000000..308ef427 --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/workspace/json/writer.js @@ -0,0 +1,296 @@ +"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 + */ +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.writeJsonWorkspace = void 0; +const magic_string_1 = __importDefault(require("magic-string")); +const metadata_1 = require("./metadata"); +const utilities_1 = require("./utilities"); +async function writeJsonWorkspace(workspace, host, path, options = {}) { + const metadata = workspace[metadata_1.JsonWorkspaceSymbol]; + if (metadata) { + if (!metadata.hasChanges) { + // nothing to do + return; + } + // update existing JSON workspace + const data = updateJsonWorkspace(metadata); + return host.writeFile(path || metadata.filePath, data); + } + else { + // serialize directly + if (!path) { + throw new Error('path option is required'); + } + const obj = convertJsonWorkspace(workspace, options.schema); + const data = JSON.stringify(obj, null, 2); + return host.writeFile(path, data); + } +} +exports.writeJsonWorkspace = writeJsonWorkspace; +function convertJsonWorkspace(workspace, schema) { + const obj = { + $schema: schema || './node_modules/@angular/cli/lib/config/schema.json', + version: 1, + ...workspace.extensions, + projects: workspace.projects ? convertJsonProjectCollection(workspace.projects) : {}, + }; + return obj; +} +function convertJsonProjectCollection(collection) { + const projects = Object.create(null); + for (const [projectName, project] of collection) { + projects[projectName] = convertJsonProject(project); + } + return projects; +} +function convertJsonProject(project) { + let targets; + if (project.targets.size > 0) { + targets = Object.create(null); + for (const [targetName, target] of project.targets) { + targets[targetName] = convertJsonTarget(target); + } + } + const obj = { + ...project.extensions, + root: project.root, + ...(project.sourceRoot === undefined ? {} : { sourceRoot: project.sourceRoot }), + ...(project.prefix === undefined ? {} : { prefix: project.prefix }), + ...(targets === undefined ? {} : { architect: targets }), + }; + return obj; +} +function isEmpty(obj) { + return obj === undefined || Object.keys(obj).length === 0; +} +function convertJsonTarget(target) { + return { + builder: target.builder, + ...(isEmpty(target.options) ? {} : { options: target.options }), + ...(isEmpty(target.configurations) + ? {} + : { configurations: target.configurations }), + ...(target.defaultConfiguration === undefined + ? {} + : { defaultConfiguration: target.defaultConfiguration }), + }; +} +function convertJsonTargetCollection(collection) { + const targets = Object.create(null); + for (const [projectName, target] of collection) { + targets[projectName] = convertJsonTarget(target); + } + return targets; +} +function findFullStart(node, raw) { + let i = node.start.offset; + while (i > 0 && /\s/.test(raw[i - 1])) { + --i; + } + return i; +} +function findFullEnd(node, raw) { + let i = node.end.offset; + if (i >= raw.length) { + return raw.length; + } + else if (raw[i] === ',') { + return i + 1; + } + while (i > node.start.offset && /\s/.test(raw[i - 1])) { + --i; + } + return i; +} +function findPrecedingComma(node, raw) { + let i = node.start.offset; + if (node.comments && node.comments.length > 0) { + i = node.comments[0].start.offset; + } + while (i > 0 && /\s/.test(raw[i - 1])) { + --i; + } + if (raw[i - 1] === ',') { + return i - 1; + } + return -1; +} +function stringify(value, multiline, depth, indent) { + if (value === undefined) { + return ''; + } + if (multiline) { + const content = JSON.stringify(value, null, indent); + const spacing = '\n' + indent.repeat(depth); + return content.replace(/\n/g, spacing); + } + else { + return JSON.stringify(value); + } +} +function normalizeValue(value, type) { + switch (type) { + case 'project': + return convertJsonProject(value); + case 'projectcollection': + const projects = convertJsonProjectCollection(value); + return Object.keys(projects).length === 0 ? undefined : projects; + case 'target': + return convertJsonTarget(value); + case 'targetcollection': + const targets = convertJsonTargetCollection(value); + return Object.keys(targets).length === 0 ? undefined : targets; + default: + return value; + } +} +function updateJsonWorkspace(metadata) { + const data = new magic_string_1.default(metadata.raw); + const indent = data.getIndentString(); + const removedCommas = new Set(); + const nodeChanges = new Map(); + for (const { op, path, node, value, type } of metadata.changes) { + // targets/projects are typically large objects so always use multiline + const multiline = node.start.line !== node.end.line || type !== 'json'; + const pathSegments = path.split('/'); + const depth = pathSegments.length - 1; // TODO: more complete analysis + const propertyOrIndex = (0, utilities_1.unescapeKey)(pathSegments[depth]); + const jsonValue = normalizeValue(value, type); + if (op === 'add' && jsonValue === undefined) { + continue; + } + // Track changes to the order/size of any modified objects/arrays + let elements = nodeChanges.get(node); + if (!elements) { + if (node.kind === 'array') { + elements = node.elements.slice(); + nodeChanges.set(node, elements); + } + else if (node.kind === 'object') { + elements = node.properties.slice(); + nodeChanges.set(node, elements); + } + else { + // keyvalue + elements = []; + } + } + switch (op) { + case 'add': + let contentPrefix = ''; + if (node.kind === 'object') { + contentPrefix = `"${propertyOrIndex}": `; + } + const spacing = multiline ? '\n' + indent.repeat(depth) : ' '; + const content = spacing + contentPrefix + stringify(jsonValue, multiline, depth, indent); + // Additions are handled after analyzing all operations + // This is mainly to support array operations which can occur at arbitrary indices + if (node.kind === 'object') { + // Object property additions are always added at the end for simplicity + elements.push(content); + } + else { + // Add place holders if adding an index past the length + // An empty string is an impossible real value + for (let i = elements.length; i < +propertyOrIndex; ++i) { + elements[i] = ''; + } + if (elements[+propertyOrIndex] === '') { + elements[+propertyOrIndex] = content; + } + else { + elements.splice(+propertyOrIndex, 0, content); + } + } + break; + case 'remove': + let removalIndex = -1; + if (node.kind === 'object') { + removalIndex = elements.findIndex((e) => { + return typeof e != 'string' && e.kind === 'keyvalue' && e.key.value === propertyOrIndex; + }); + } + else if (node.kind === 'array') { + removalIndex = +propertyOrIndex; + } + if (removalIndex === -1) { + continue; + } + const nodeToRemove = elements[removalIndex]; + if (typeof nodeToRemove === 'string') { + // synthetic + elements.splice(removalIndex, 1); + continue; + } + if (elements.length - 1 === removalIndex) { + // If the element is a terminal element remove the otherwise trailing comma + const commaIndex = findPrecedingComma(nodeToRemove, data.original); + if (commaIndex !== -1) { + data.remove(commaIndex, commaIndex + 1); + removedCommas.add(commaIndex); + } + } + data.remove(findFullStart(nodeToRemove, data.original), findFullEnd(nodeToRemove, data.original)); + elements.splice(removalIndex, 1); + break; + case 'replace': + let nodeToReplace; + if (node.kind === 'keyvalue') { + nodeToReplace = node.value; + } + else if (node.kind === 'array') { + nodeToReplace = elements[+propertyOrIndex]; + if (typeof nodeToReplace === 'string') { + // Was already modified. This is already handled. + continue; + } + } + else { + continue; + } + nodeChanges.delete(nodeToReplace); + data.overwrite(nodeToReplace.start.offset, nodeToReplace.end.offset, stringify(jsonValue, multiline, depth, indent)); + break; + } + } + for (const [node, elements] of nodeChanges.entries()) { + let parentPoint = 1 + data.original.indexOf(node.kind === 'array' ? '[' : '{', node.start.offset); + // Short-circuit for simple case + if (elements.length === 1 && typeof elements[0] === 'string') { + data.appendRight(parentPoint, elements[0]); + continue; + } + // Combine adjecent element additions to minimize/simplify insertions + const optimizedElements = []; + for (let i = 0; i < elements.length; ++i) { + const element = elements[i]; + if (typeof element === 'string' && i > 0 && typeof elements[i - 1] === 'string') { + optimizedElements[optimizedElements.length - 1] += ',' + element; + } + else { + optimizedElements.push(element); + } + } + let prefixComma = false; + for (const element of optimizedElements) { + if (typeof element === 'string') { + data.appendRight(parentPoint, (prefixComma ? ',' : '') + element); + } + else { + parentPoint = findFullEnd(element, data.original); + prefixComma = data.original[parentPoint - 1] !== ',' || removedCommas.has(parentPoint - 1); + } + } + } + const result = data.toString(); + return result; +} diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/LICENSE b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/LICENSE new file mode 100644 index 00000000..8876c32c --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/LICENSE @@ -0,0 +1,21 @@ +The MIT License + +Copyright (c) 2017 Google, Inc. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/README.md b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/README.md new file mode 100644 index 00000000..7fce70c8 --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/README.md @@ -0,0 +1,204 @@ +# Schematics + +> A scaffolding library for the modern web. + +## Description + +Schematics are generators that transform an existing filesystem. They can create files, refactor existing files, or move files around. + +What distinguishes Schematics from other generators, such as Yeoman or Yarn Create, is that schematics are purely descriptive; no changes are applied to the actual filesystem until everything is ready to be committed. There is no side effect, by design, in Schematics. + +# Glossary + +| Term | Description | +| -------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| **Schematics** | A generator that executes descriptive code without side effects on an existing file system. | +| **Collection** | A list of schematics metadata. Schematics can be referred by name inside a collection. | +| **Tool** | The code using the Schematics library. | +| **Tree** | A staging area for changes, containing the original file system, and a list of changes to apply to it. | +| **Rule** | A function that applies actions to a `Tree`. It returns a new `Tree` that will contain all transformations to be applied. | +| **Source** | A function that creates an entirely new `Tree` from an empty filesystem. For example, a file source could read files from disk and create a Create Action for each of those. | +| **Action** | An atomic operation to be validated and committed to a filesystem or a `Tree`. Actions are created by schematics. | +| **Sink** | The final destination of all `Action`s. | + +# Tooling + +Schematics is a library, and does not work by itself. A [reference CLI](https://github.com/angular/angular-cli/blob/master/packages/angular_devkit/schematics_cli/bin/schematics.ts) is available on this repository, and is published on NPM at [@angular-devkit/schematics-cli](https://www.npmjs.com/package/@angular-devkit/schematics-cli). This document explains the library usage and the tooling API, but does not go into the tool implementation itself. + +The tooling is responsible for the following tasks: + +1. Create the Schematic Engine, and pass in a Collection and Schematic loader. +1. Understand and respect the Schematics metadata and dependencies between collections. Schematics can refer to dependencies, and it's the responsibility of the tool to honor those dependencies. The reference CLI uses NPM packages for its collections. +1. Create the Options object. Options can be anything, but the schematics can specify a JSON Schema that should be respected. The reference CLI, for example, parses the arguments as a JSON object and validates it with the Schema specified by the collection. +1. Schematics provides some JSON Schema formats for validation that tooling should add. These validate paths, html selectors and app names. Please check the reference CLI for how these can be added. +1. Call the schematics with the original Tree. The tree should represent the initial state of the filesystem. The reference CLI uses the current directory for this. +1. Create a Sink and commit the result of the schematics to the Sink. Many sinks are provided by the library; FileSystemSink and DryRunSink are examples. +1. Output any logs propagated by the library, including debugging information. + +The tooling API is composed of the following pieces: + +## Engine + +The `SchematicEngine` is responsible for loading and constructing `Collection`s and `Schematics`. When creating an engine, the tooling provides an `EngineHost` interface that understands how to create a `CollectionDescription` from a name, and how to create a `SchematicDescription`. + +# Schematics (Generators) + +Schematics are generators and part of a `Collection`. + +## Collection + +A Collection is defined by a `collection.json` file (in the reference CLI). This JSON defines the following properties: + +| Prop Name | Type | Description | +| ----------- | -------- | --------------------------- | +| **name** | `string` | The name of the collection. | +| **version** | `string` | Unused field. | + +## Schematic + +# Operators, Sources and Rules + +A `Source` is a generator of a `Tree`; it creates an entirely new root tree from nothing. A `Rule` is a transformation from one `Tree` to another. A `Schematic` (at the root) is a `Rule` that is normally applied on the filesystem. + +## Operators + +`FileOperator`s apply changes to a single `FileEntry` and return a new `FileEntry`. The result follows these rules: + +1. If the `FileEntry` returned is null, a `DeleteAction` will be added to the action list. +1. If the path changed, a `RenameAction` will be added to the action list. +1. If the content changed, an `OverwriteAction` will be added to the action list. + +It is impossible to create files using a `FileOperator`. + +## Provided Operators + +The Schematics library provides multiple `Operator` factories by default that cover basic use cases: + +| FileOperator | Description | +| -------------------------------- | -------------------------------------------------------------------- | +| `contentTemplate<T>(options: T)` | Apply a content template (see the [Templating](#templating) section) | +| `pathTemplate<T>(options: T)` | Apply a path template (see the [Templating](#templating) section) | + +## Provided Sources + +The Schematics library additionally provides multiple `Source` factories by default: + +| Source | Description | +| -------------------------------------- | -------------------------------------------------------------------------------------------------------------------------- | +| `empty()` | Creates a source that returns an empty `Tree`. | +| `source(tree: Tree)` | Creates a `Source` that returns the `Tree` passed in as argument. | +| `url(url: string)` | Loads a list of files from the given URL and returns a `Tree` with the files as `CreateAction` applied to an empty `Tree`. | +| `apply(source: Source, rules: Rule[])` | Apply a list of `Rule`s to a source, and return the resulting `Source`. | + +## Provided Rules + +The schematics library also provides `Rule` factories by default: + +| Rule | Description | +| ------------------------------------------- | -------------------------------------------------------------------------------------- | +| `noop()` | Returns the input `Tree` as is. | +| `chain(rules: Rule[])` | Returns a `Rule` that's the concatenation of other `Rule`s. | +| `forEach(op: FileOperator)` | Returns a `Rule` that applies an operator to every file of the input `Tree`. | +| `move(root: string)` | Moves all the files from the input to a subdirectory. | +| `merge(other: Tree)` | Merge the input `Tree` with the other `Tree`. | +| `contentTemplate<T>(options: T)` | Apply a content template (see the Template section) to the entire `Tree`. | +| `pathTemplate<T>(options: T)` | Apply a path template (see the Template section) to the entire `Tree`. | +| `template<T>(options: T)` | Apply both path and content templates (see the Template section) to the entire `Tree`. | +| `filter(predicate: FilePredicate<boolean>)` | Returns the input `Tree` with files that do not pass the `FilePredicate`. | + +# Templating + +As referenced above, some functions are based upon a file templating system, which consists of path and content templating. + +The system operates on placeholders defined inside files or their paths as loaded in the `Tree` and fills these in as defined in the following, using values passed into the `Rule` which applies the templating (i.e. `template<T>(options: T)`). + +## Path Templating + +| Placeholder | Description | +| ----------------------- | -------------------------------------------------------------------------------------------------------------------------------- | +| `__variable__` | Replaced with the value of `variable`. | +| `__variable@function__` | Replaced with the result of the call `function(variable)`. Can be chained to the left (`__variable@function1@function2__ ` etc). | + +## Content Templating + +| Placeholder | Description | +| ------------------- | ------------------------------------------------------------------------------------------------------------------------------------------- | +| `<%= expression %>` | Replaced with the result of the call of the given expression. This only supports direct expressions, no structural (for/if/...) JavaScript. | +| `<%- expression %>` | Same as above, but the value of the result will be escaped for HTML when inserted (i.e. replacing '<' with '\<') | +| `<% inline code %>` | Inserts the given code into the template structure, allowing to insert structural JavaScript. | +| `<%# text %>` | A comment, which gets entirely dropped. | + +# Examples + +## Simple + +An example of a simple Schematics which creates a "hello world" file, using an option to determine its path: + +```typescript +import { Tree } from '@angular-devkit/schematics'; + +export default function MySchematic(options: any) { + return (tree: Tree) => { + tree.create(options.path + '/hi', 'Hello world!'); + return tree; + }; +} +``` + +A few things from this example: + +1. The function receives the list of options from the tooling. +1. It returns a [`Rule`](src/engine/interface.ts#L73), which is a transformation from a `Tree` to another `Tree`. + +## Templating + +A simplified example of a Schematics which creates a file containing a new Class, using an option to determine its name: + +```typescript +// files/__name@dasherize__.ts + +export class <%= classify(name) %> { +} +``` + +```typescript +// index.ts + +import { strings } from '@angular-devkit/core'; +import { + Rule, + SchematicContext, + SchematicsException, + Tree, + apply, + branchAndMerge, + mergeWith, + template, + url, +} from '@angular-devkit/schematics'; +import { Schema as ClassOptions } from './schema'; + +export default function (options: ClassOptions): Rule { + return (tree: Tree, context: SchematicContext) => { + if (!options.name) { + throw new SchematicsException('Option (name) is required.'); + } + + const templateSource = apply(url('./files'), [ + template({ + ...strings, + ...options, + }), + ]); + + return branchAndMerge(mergeWith(templateSource)); + }; +} +``` + +Additional things from this example: + +1. `strings` provides the used `dasherize` and `classify` functions, among others. +1. The files are on-disk in the same root directory as the `index.ts` and loaded into a `Tree`. +1. Then the `template` `Rule` fills in the specified templating placeholders. For this, it only knows about the variables and functions passed to it via the options-object. +1. Finally, the resulting `Tree`, containing the new file, is merged with the existing files of the project which the Schematic is run on. diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/collection-schema.json b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/collection-schema.json new file mode 100644 index 00000000..64892804 --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/collection-schema.json @@ -0,0 +1,70 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema", + "$id": "SchematicsCollectionSchema", + "title": "Collection Schema for validating a 'collection.json'.", + "type": "object", + "properties": { + "extends": { + "oneOf": [ + { + "type": "string", + "minLength": 1 + }, + { + "type": "array", + "items": { + "type": "string", + "minLength": 1 + }, + "minItems": 1 + } + ] + }, + "schematics": { + "type": "object", + "description": "A map of schematic names to schematic details", + "additionalProperties": { + "type": "object", + "properties": { + "aliases": { + "type": "array", + "items": { + "type": "string" + } + }, + "factory": { + "type": "string", + "description": "A folder or file path to the schematic factory" + }, + "description": { + "type": "string", + "description": "A description for the schematic" + }, + "extends": { + "type": "string", + "description": "An schematic override. It can be a local schematic or from another collection (in the format 'collection:schematic')" + }, + "schema": { + "type": "string", + "description": "Location of the schema.json file of the schematic" + }, + "hidden": { + "type": "boolean", + "default": false, + "description": "Whether or not this schematic should be listed by the tooling. This does not prevent the tooling to run this schematic, just removes its name from listSchematicNames()." + }, + "private": { + "type": "boolean", + "default": false, + "description": "Whether or not this schematic can be called from an external schematic, or a tool. This implies hidden: true." + } + }, + "required": ["factory", "description"] + } + }, + "version": { + "type": "string" + } + }, + "required": ["schematics"] +} diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/package.json b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/package.json new file mode 100644 index 00000000..b62a765d --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/package.json @@ -0,0 +1,42 @@ +{ + "name": "@angular-devkit/schematics", + "version": "13.2.5", + "description": "Angular Schematics - Library", + "main": "src/index.js", + "typings": "src/index.d.ts", + "keywords": [ + "angular", + "Angular CLI", + "devkit", + "sdk", + "Angular DevKit", + "blueprints", + "scaffolding", + "template", + "tooling", + "code generation", + "schematics" + ], + "dependencies": { + "@angular-devkit/core": "13.2.5", + "jsonc-parser": "3.0.0", + "magic-string": "0.25.7", + "ora": "5.4.1", + "rxjs": "6.6.7" + }, + "repository": { + "type": "git", + "url": "https://github.com/angular/angular-cli.git" + }, + "engines": { + "node": "^12.20.0 || ^14.15.0 || >=16.10.0", + "npm": "^6.11.0 || ^7.5.6 || >=8.0.0", + "yarn": ">= 1.13.0" + }, + "author": "Angular Authors", + "license": "MIT", + "bugs": { + "url": "https://github.com/angular/angular-cli/issues" + }, + "homepage": "https://github.com/angular/angular-cli" +} diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/engine/engine.d.ts b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/engine/engine.d.ts new file mode 100644 index 00000000..02063733 --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/engine/engine.d.ts @@ -0,0 +1,77 @@ +/** + * @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 { BaseException } from '@angular-devkit/core'; +import { Observable } from 'rxjs'; +import { Url } from 'url'; +import { MergeStrategy } from '../tree/interface'; +import { Workflow } from '../workflow/interface'; +import { Collection, CollectionDescription, Engine, EngineHost, ExecutionOptions, Schematic, SchematicContext, SchematicDescription, Source, TaskConfiguration, TaskId, TaskInfo, TypedSchematicContext } from './interface'; +export declare class UnknownUrlSourceProtocol extends BaseException { + constructor(url: string); +} +export declare class UnknownCollectionException extends BaseException { + constructor(name: string); +} +export declare class CircularCollectionException extends BaseException { + constructor(name: string); +} +export declare class UnknownSchematicException extends BaseException { + constructor(name: string, collection: CollectionDescription<{}>); +} +export declare class PrivateSchematicException extends BaseException { + constructor(name: string, collection: CollectionDescription<{}>); +} +export declare class SchematicEngineConflictingException extends BaseException { + constructor(); +} +export declare class UnregisteredTaskException extends BaseException { + constructor(name: string, schematic?: SchematicDescription<{}, {}>); +} +export declare class UnknownTaskDependencyException extends BaseException { + constructor(id: TaskId); +} +export declare class CollectionImpl<CollectionT extends object, SchematicT extends object> implements Collection<CollectionT, SchematicT> { + private _description; + private _engine; + readonly baseDescriptions?: CollectionDescription<CollectionT>[] | undefined; + constructor(_description: CollectionDescription<CollectionT>, _engine: SchematicEngine<CollectionT, SchematicT>, baseDescriptions?: CollectionDescription<CollectionT>[] | undefined); + get description(): CollectionDescription<CollectionT>; + get name(): string; + createSchematic(name: string, allowPrivate?: boolean): Schematic<CollectionT, SchematicT>; + listSchematicNames(): string[]; +} +export declare class TaskScheduler { + private _context; + private _queue; + private _taskIds; + private static _taskIdCounter; + constructor(_context: SchematicContext); + private _calculatePriority; + private _mapDependencies; + schedule<T>(taskConfiguration: TaskConfiguration<T>): TaskId; + finalize(): ReadonlyArray<TaskInfo>; +} +export declare class SchematicEngine<CollectionT extends object, SchematicT extends object> implements Engine<CollectionT, SchematicT> { + private _host; + protected _workflow?: Workflow | undefined; + private _collectionCache; + private _schematicCache; + private _taskSchedulers; + constructor(_host: EngineHost<CollectionT, SchematicT>, _workflow?: Workflow | undefined); + get workflow(): Workflow | null; + get defaultMergeStrategy(): MergeStrategy; + createCollection(name: string, requester?: Collection<CollectionT, SchematicT>): Collection<CollectionT, SchematicT>; + private _createCollectionDescription; + createContext(schematic: Schematic<CollectionT, SchematicT>, parent?: Partial<TypedSchematicContext<CollectionT, SchematicT>>, executionOptions?: Partial<ExecutionOptions>): TypedSchematicContext<CollectionT, SchematicT>; + createSchematic(name: string, collection: Collection<CollectionT, SchematicT>, allowPrivate?: boolean): Schematic<CollectionT, SchematicT>; + listSchematicNames(collection: Collection<CollectionT, SchematicT>): string[]; + transformOptions<OptionT extends object, ResultT extends object>(schematic: Schematic<CollectionT, SchematicT>, options: OptionT, context?: TypedSchematicContext<CollectionT, SchematicT>): Observable<ResultT>; + createSourceFromUrl(url: Url, context: TypedSchematicContext<CollectionT, SchematicT>): Source; + executePostTasks(): Observable<void>; +} diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/engine/engine.js b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/engine/engine.js new file mode 100644 index 00000000..64941062 --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/engine/engine.js @@ -0,0 +1,295 @@ +"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.SchematicEngine = exports.TaskScheduler = exports.CollectionImpl = exports.UnknownTaskDependencyException = exports.UnregisteredTaskException = exports.SchematicEngineConflictingException = exports.PrivateSchematicException = exports.UnknownSchematicException = exports.CircularCollectionException = exports.UnknownCollectionException = exports.UnknownUrlSourceProtocol = void 0; +const core_1 = require("@angular-devkit/core"); +const rxjs_1 = require("rxjs"); +const operators_1 = require("rxjs/operators"); +const interface_1 = require("../tree/interface"); +const null_1 = require("../tree/null"); +const static_1 = require("../tree/static"); +const schematic_1 = require("./schematic"); +class UnknownUrlSourceProtocol extends core_1.BaseException { + constructor(url) { + super(`Unknown Protocol on url "${url}".`); + } +} +exports.UnknownUrlSourceProtocol = UnknownUrlSourceProtocol; +class UnknownCollectionException extends core_1.BaseException { + constructor(name) { + super(`Unknown collection "${name}".`); + } +} +exports.UnknownCollectionException = UnknownCollectionException; +class CircularCollectionException extends core_1.BaseException { + constructor(name) { + super(`Circular collection reference "${name}".`); + } +} +exports.CircularCollectionException = CircularCollectionException; +class UnknownSchematicException extends core_1.BaseException { + constructor(name, collection) { + super(`Schematic "${name}" not found in collection "${collection.name}".`); + } +} +exports.UnknownSchematicException = UnknownSchematicException; +class PrivateSchematicException extends core_1.BaseException { + constructor(name, collection) { + super(`Schematic "${name}" not found in collection "${collection.name}".`); + } +} +exports.PrivateSchematicException = PrivateSchematicException; +class SchematicEngineConflictingException extends core_1.BaseException { + constructor() { + super(`A schematic was called from a different engine as its parent.`); + } +} +exports.SchematicEngineConflictingException = SchematicEngineConflictingException; +class UnregisteredTaskException extends core_1.BaseException { + constructor(name, schematic) { + const addendum = schematic ? ` in schematic "${schematic.name}"` : ''; + super(`Unregistered task "${name}"${addendum}.`); + } +} +exports.UnregisteredTaskException = UnregisteredTaskException; +class UnknownTaskDependencyException extends core_1.BaseException { + constructor(id) { + super(`Unknown task dependency [ID: ${id.id}].`); + } +} +exports.UnknownTaskDependencyException = UnknownTaskDependencyException; +class CollectionImpl { + constructor(_description, _engine, baseDescriptions) { + this._description = _description; + this._engine = _engine; + this.baseDescriptions = baseDescriptions; + } + get description() { + return this._description; + } + get name() { + return this.description.name || '<unknown>'; + } + createSchematic(name, allowPrivate = false) { + return this._engine.createSchematic(name, this, allowPrivate); + } + listSchematicNames() { + return this._engine.listSchematicNames(this); + } +} +exports.CollectionImpl = CollectionImpl; +class TaskScheduler { + constructor(_context) { + this._context = _context; + this._queue = new core_1.PriorityQueue((x, y) => x.priority - y.priority); + this._taskIds = new Map(); + } + _calculatePriority(dependencies) { + if (dependencies.size === 0) { + return 0; + } + const prio = [...dependencies].reduce((prio, task) => prio + task.priority, 1); + return prio; + } + _mapDependencies(dependencies) { + if (!dependencies) { + return new Set(); + } + const tasks = dependencies.map((dep) => { + const task = this._taskIds.get(dep); + if (!task) { + throw new UnknownTaskDependencyException(dep); + } + return task; + }); + return new Set(tasks); + } + schedule(taskConfiguration) { + const dependencies = this._mapDependencies(taskConfiguration.dependencies); + const priority = this._calculatePriority(dependencies); + const task = { + id: TaskScheduler._taskIdCounter++, + priority, + configuration: taskConfiguration, + context: this._context, + }; + this._queue.push(task); + const id = { id: task.id }; + this._taskIds.set(id, task); + return id; + } + finalize() { + const tasks = this._queue.toArray(); + this._queue.clear(); + this._taskIds.clear(); + return tasks; + } +} +exports.TaskScheduler = TaskScheduler; +TaskScheduler._taskIdCounter = 1; +class SchematicEngine { + constructor(_host, _workflow) { + this._host = _host; + this._workflow = _workflow; + this._collectionCache = new Map(); + this._schematicCache = new WeakMap(); + this._taskSchedulers = new Array(); + } + get workflow() { + return this._workflow || null; + } + get defaultMergeStrategy() { + return this._host.defaultMergeStrategy || interface_1.MergeStrategy.Default; + } + createCollection(name, requester) { + let collection = this._collectionCache.get(name); + if (collection) { + return collection; + } + const [description, bases] = this._createCollectionDescription(name, requester === null || requester === void 0 ? void 0 : requester.description); + collection = new CollectionImpl(description, this, bases); + this._collectionCache.set(name, collection); + this._schematicCache.set(collection, new Map()); + return collection; + } + _createCollectionDescription(name, requester, parentNames) { + const description = this._host.createCollectionDescription(name, requester); + if (!description) { + throw new UnknownCollectionException(name); + } + if (parentNames && parentNames.has(description.name)) { + throw new CircularCollectionException(name); + } + const bases = new Array(); + if (description.extends) { + parentNames = (parentNames || new Set()).add(description.name); + for (const baseName of description.extends) { + const [base, baseBases] = this._createCollectionDescription(baseName, description, new Set(parentNames)); + bases.unshift(base, ...baseBases); + } + } + return [description, bases]; + } + createContext(schematic, parent, executionOptions) { + // Check for inconsistencies. + if (parent && parent.engine && parent.engine !== this) { + throw new SchematicEngineConflictingException(); + } + let interactive = true; + if (executionOptions && executionOptions.interactive != undefined) { + interactive = executionOptions.interactive; + } + else if (parent && parent.interactive != undefined) { + interactive = parent.interactive; + } + let context = { + debug: (parent && parent.debug) || false, + engine: this, + logger: (parent && parent.logger && parent.logger.createChild(schematic.description.name)) || + new core_1.logging.NullLogger(), + schematic, + strategy: parent && parent.strategy !== undefined ? parent.strategy : this.defaultMergeStrategy, + interactive, + addTask, + }; + const maybeNewContext = this._host.transformContext(context); + if (maybeNewContext) { + context = maybeNewContext; + } + const taskScheduler = new TaskScheduler(context); + const host = this._host; + this._taskSchedulers.push(taskScheduler); + function addTask(task, dependencies) { + const config = task.toConfiguration(); + if (!host.hasTaskExecutor(config.name)) { + throw new UnregisteredTaskException(config.name, schematic.description); + } + config.dependencies = config.dependencies || []; + if (dependencies) { + config.dependencies.unshift(...dependencies); + } + return taskScheduler.schedule(config); + } + return context; + } + createSchematic(name, collection, allowPrivate = false) { + const schematicMap = this._schematicCache.get(collection); + let schematic = schematicMap === null || schematicMap === void 0 ? void 0 : schematicMap.get(name); + if (schematic) { + return schematic; + } + let collectionDescription = collection.description; + let description = this._host.createSchematicDescription(name, collection.description); + if (!description) { + if (collection.baseDescriptions) { + for (const base of collection.baseDescriptions) { + description = this._host.createSchematicDescription(name, base); + if (description) { + collectionDescription = base; + break; + } + } + } + if (!description) { + // Report the error for the top level schematic collection + throw new UnknownSchematicException(name, collection.description); + } + } + if (description.private && !allowPrivate) { + throw new PrivateSchematicException(name, collection.description); + } + const factory = this._host.getSchematicRuleFactory(description, collectionDescription); + schematic = new schematic_1.SchematicImpl(description, factory, collection, this); + schematicMap === null || schematicMap === void 0 ? void 0 : schematicMap.set(name, schematic); + return schematic; + } + listSchematicNames(collection) { + const names = this._host.listSchematicNames(collection.description); + if (collection.baseDescriptions) { + for (const base of collection.baseDescriptions) { + names.push(...this._host.listSchematicNames(base)); + } + } + // remove duplicates + return [...new Set(names)].sort(); + } + transformOptions(schematic, options, context) { + return this._host.transformOptions(schematic.description, options, context); + } + createSourceFromUrl(url, context) { + switch (url.protocol) { + case 'null:': + return () => new null_1.NullTree(); + case 'empty:': + return () => (0, static_1.empty)(); + default: + const hostSource = this._host.createSourceFromUrl(url, context); + if (!hostSource) { + throw new UnknownUrlSourceProtocol(url.toString()); + } + return hostSource; + } + } + executePostTasks() { + const executors = new Map(); + const taskObservable = (0, rxjs_1.from)(this._taskSchedulers).pipe((0, operators_1.concatMap)((scheduler) => scheduler.finalize()), (0, operators_1.concatMap)((task) => { + const { name, options } = task.configuration; + const executor = executors.get(name); + if (executor) { + return executor(options, task.context); + } + return this._host.createTaskExecutor(name).pipe((0, operators_1.concatMap)((executor) => { + executors.set(name, executor); + return executor(options, task.context); + })); + })); + return taskObservable; + } +} +exports.SchematicEngine = SchematicEngine; diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/engine/index.d.ts b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/engine/index.d.ts new file mode 100644 index 00000000..666c8c40 --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/engine/index.d.ts @@ -0,0 +1,10 @@ +/** + * @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 + */ +export * from './engine'; +export * from './interface'; +export * from './schematic'; diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/engine/index.js b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/engine/index.js new file mode 100644 index 00000000..c2ca0f07 --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/engine/index.js @@ -0,0 +1,22 @@ +"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 + */ +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __exportStar = (this && this.__exportStar) || function(m, exports) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +__exportStar(require("./engine"), exports); +__exportStar(require("./interface"), exports); +__exportStar(require("./schematic"), exports); diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/engine/interface.d.ts b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/engine/interface.d.ts new file mode 100644 index 00000000..790cfbfb --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/engine/interface.d.ts @@ -0,0 +1,157 @@ +/** + * @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 { analytics, logging } from '@angular-devkit/core'; +import { Observable } from 'rxjs'; +import { Url } from 'url'; +import { FileEntry, MergeStrategy, Tree } from '../tree/interface'; +import { Workflow } from '../workflow/interface'; +export interface TaskConfiguration<T = {}> { + name: string; + dependencies?: Array<TaskId>; + options?: T; +} +export interface TaskConfigurationGenerator<T = {}> { + toConfiguration(): TaskConfiguration<T>; +} +export declare type TaskExecutor<T = {}> = (options: T | undefined, context: SchematicContext) => Promise<void> | Observable<void>; +export interface TaskExecutorFactory<T> { + readonly name: string; + create(options?: T): Promise<TaskExecutor> | Observable<TaskExecutor>; +} +export interface TaskId { + readonly id: number; +} +export interface TaskInfo { + readonly id: number; + readonly priority: number; + readonly configuration: TaskConfiguration; + readonly context: SchematicContext; +} +export interface ExecutionOptions { + scope: string; + interactive: boolean; +} +/** + * The description (metadata) of a collection. This type contains every information the engine + * needs to run. The CollectionMetadataT type parameter contains additional metadata that you + * want to store while remaining type-safe. + */ +export declare type CollectionDescription<CollectionMetadataT extends object> = CollectionMetadataT & { + readonly name: string; + readonly extends?: string[]; +}; +/** + * The description (metadata) of a schematic. This type contains every information the engine + * needs to run. The SchematicMetadataT and CollectionMetadataT type parameters contain additional + * metadata that you want to store while remaining type-safe. + */ +export declare type SchematicDescription<CollectionMetadataT extends object, SchematicMetadataT extends object> = SchematicMetadataT & { + readonly collection: CollectionDescription<CollectionMetadataT>; + readonly name: string; + readonly private?: boolean; + readonly hidden?: boolean; +}; +/** + * The Host for the Engine. Specifically, the piece of the tooling responsible for resolving + * collections and schematics descriptions. The SchematicMetadataT and CollectionMetadataT type + * parameters contain additional metadata that you want to store while remaining type-safe. + */ +export interface EngineHost<CollectionMetadataT extends object, SchematicMetadataT extends object> { + createCollectionDescription(name: string, requester?: CollectionDescription<CollectionMetadataT>): CollectionDescription<CollectionMetadataT>; + listSchematicNames(collection: CollectionDescription<CollectionMetadataT>): string[]; + createSchematicDescription(name: string, collection: CollectionDescription<CollectionMetadataT>): SchematicDescription<CollectionMetadataT, SchematicMetadataT> | null; + getSchematicRuleFactory<OptionT extends object>(schematic: SchematicDescription<CollectionMetadataT, SchematicMetadataT>, collection: CollectionDescription<CollectionMetadataT>): RuleFactory<OptionT>; + createSourceFromUrl(url: Url, context: TypedSchematicContext<CollectionMetadataT, SchematicMetadataT>): Source | null; + transformOptions<OptionT extends object, ResultT extends object>(schematic: SchematicDescription<CollectionMetadataT, SchematicMetadataT>, options: OptionT, context?: TypedSchematicContext<CollectionMetadataT, SchematicMetadataT>): Observable<ResultT>; + transformContext(context: TypedSchematicContext<CollectionMetadataT, SchematicMetadataT>): TypedSchematicContext<CollectionMetadataT, SchematicMetadataT> | void; + createTaskExecutor(name: string): Observable<TaskExecutor>; + hasTaskExecutor(name: string): boolean; + readonly defaultMergeStrategy?: MergeStrategy; +} +/** + * The root Engine for creating and running schematics and collections. Everything related to + * a schematic execution starts from this interface. + * + * CollectionMetadataT is, by default, a generic Collection metadata type. This is used throughout + * the engine typings so that you can use a type that's merged into descriptions, while being + * type-safe. + * + * SchematicMetadataT is a type that contains additional typing for the Schematic Description. + */ +export interface Engine<CollectionMetadataT extends object, SchematicMetadataT extends object> { + createCollection(name: string, requester?: Collection<CollectionMetadataT, SchematicMetadataT>): Collection<CollectionMetadataT, SchematicMetadataT>; + createContext(schematic: Schematic<CollectionMetadataT, SchematicMetadataT>, parent?: Partial<TypedSchematicContext<CollectionMetadataT, SchematicMetadataT>>, executionOptions?: Partial<ExecutionOptions>): TypedSchematicContext<CollectionMetadataT, SchematicMetadataT>; + createSchematic(name: string, collection: Collection<CollectionMetadataT, SchematicMetadataT>): Schematic<CollectionMetadataT, SchematicMetadataT>; + createSourceFromUrl(url: Url, context: TypedSchematicContext<CollectionMetadataT, SchematicMetadataT>): Source; + transformOptions<OptionT extends object, ResultT extends object>(schematic: Schematic<CollectionMetadataT, SchematicMetadataT>, options: OptionT, context?: TypedSchematicContext<CollectionMetadataT, SchematicMetadataT>): Observable<ResultT>; + executePostTasks(): Observable<void>; + readonly defaultMergeStrategy: MergeStrategy; + readonly workflow: Workflow | null; +} +/** + * A Collection as created by the Engine. This should be used by the tool to create schematics, + * or by rules to create other schematics as well. + */ +export interface Collection<CollectionMetadataT extends object, SchematicMetadataT extends object> { + readonly description: CollectionDescription<CollectionMetadataT>; + readonly baseDescriptions?: Array<CollectionDescription<CollectionMetadataT>>; + createSchematic(name: string, allowPrivate?: boolean): Schematic<CollectionMetadataT, SchematicMetadataT>; + listSchematicNames(): string[]; +} +/** + * A Schematic as created by the Engine. This should be used by the tool to execute the main + * schematics, or by rules to execute other schematics as well. + */ +export interface Schematic<CollectionMetadataT extends object, SchematicMetadataT extends object> { + readonly description: SchematicDescription<CollectionMetadataT, SchematicMetadataT>; + readonly collection: Collection<CollectionMetadataT, SchematicMetadataT>; + call<OptionT extends object>(options: OptionT, host: Observable<Tree>, parentContext?: Partial<TypedSchematicContext<CollectionMetadataT, SchematicMetadataT>>, executionOptions?: Partial<ExecutionOptions>): Observable<Tree>; +} +/** + * A SchematicContext. Contains information necessary for Schematics to execute some rules, for + * example when using another schematics, as we need the engine and collection. + */ +export interface TypedSchematicContext<CollectionMetadataT extends object, SchematicMetadataT extends object> { + readonly debug: boolean; + readonly engine: Engine<CollectionMetadataT, SchematicMetadataT>; + readonly logger: logging.LoggerApi; + readonly schematic: Schematic<CollectionMetadataT, SchematicMetadataT>; + readonly strategy: MergeStrategy; + readonly interactive: boolean; + addTask<T>(task: TaskConfigurationGenerator<T>, dependencies?: Array<TaskId>): TaskId; + /** @deprecated since version 11 - as it's unused. */ + readonly analytics?: analytics.Analytics; +} +/** + * This is used by the Schematics implementations in order to avoid needing to have typing from + * the tooling. Schematics are not specific to a tool. + */ +export declare type SchematicContext = TypedSchematicContext<{}, {}>; +/** + * A rule factory, which is normally the way schematics are implemented. Returned by the tooling + * after loading a schematic description. + */ +export declare type RuleFactory<T extends object> = (options: T) => Rule; +/** + * A FileOperator applies changes synchronously to a FileEntry. An async operator returns + * asynchronously. We separate them so that the type system can catch early errors. + */ +export declare type FileOperator = (entry: FileEntry) => FileEntry | null; +export declare type AsyncFileOperator = (tree: FileEntry) => Observable<FileEntry | null>; +/** + * A source is a function that generates a Tree from a specific context. A rule transforms a tree + * into another tree from a specific context. In both cases, an Observable can be returned if + * the source or the rule are asynchronous. Only the last Tree generated in the observable will + * be used though. + * + * We obfuscate the context of Source and Rule because the schematic implementation should not + * know which types is the schematic or collection metadata, as they are both tooling specific. + */ +export declare type Source = (context: SchematicContext) => Tree | Observable<Tree>; +export declare type Rule = (tree: Tree, context: SchematicContext) => Tree | Observable<Tree> | Rule | Promise<void | Rule> | void; diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/engine/interface.js b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/engine/interface.js new file mode 100644 index 00000000..b599b96d --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/engine/interface.js @@ -0,0 +1,9 @@ +"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 }); diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/engine/schematic.d.ts b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/engine/schematic.d.ts new file mode 100644 index 00000000..718b6849 --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/engine/schematic.d.ts @@ -0,0 +1,24 @@ +/** + * @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 + */ +import { BaseException } from '@angular-devkit/core'; +import { Observable } from 'rxjs'; +import { Tree } from '../tree/interface'; +import { Collection, Engine, ExecutionOptions, RuleFactory, Schematic, SchematicDescription, TypedSchematicContext } from './interface'; +export declare class InvalidSchematicsNameException extends BaseException { + constructor(name: string); +} +export declare class SchematicImpl<CollectionT extends object, SchematicT extends object> implements Schematic<CollectionT, SchematicT> { + private _description; + private _factory; + private _collection; + private _engine; + constructor(_description: SchematicDescription<CollectionT, SchematicT>, _factory: RuleFactory<{}>, _collection: Collection<CollectionT, SchematicT>, _engine: Engine<CollectionT, SchematicT>); + get description(): SchematicDescription<CollectionT, SchematicT>; + get collection(): Collection<CollectionT, SchematicT>; + call<OptionT extends object>(options: OptionT, host: Observable<Tree>, parentContext?: Partial<TypedSchematicContext<CollectionT, SchematicT>>, executionOptions?: Partial<ExecutionOptions>): Observable<Tree>; +} diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/engine/schematic.js b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/engine/schematic.js new file mode 100644 index 00000000..2b33c2f5 --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/engine/schematic.js @@ -0,0 +1,67 @@ +"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.SchematicImpl = exports.InvalidSchematicsNameException = void 0; +const core_1 = require("@angular-devkit/core"); +const rxjs_1 = require("rxjs"); +const operators_1 = require("rxjs/operators"); +const call_1 = require("../rules/call"); +const scoped_1 = require("../tree/scoped"); +class InvalidSchematicsNameException extends core_1.BaseException { + constructor(name) { + super(`Schematics has invalid name: "${name}".`); + } +} +exports.InvalidSchematicsNameException = InvalidSchematicsNameException; +class SchematicImpl { + constructor(_description, _factory, _collection, _engine) { + this._description = _description; + this._factory = _factory; + this._collection = _collection; + this._engine = _engine; + if (!_description.name.match(/^[-@/_.a-zA-Z0-9]+$/)) { + throw new InvalidSchematicsNameException(_description.name); + } + } + get description() { + return this._description; + } + get collection() { + return this._collection; + } + call(options, host, parentContext, executionOptions) { + const context = this._engine.createContext(this, parentContext, executionOptions); + return host.pipe((0, operators_1.first)(), (0, operators_1.concatMap)((tree) => this._engine + .transformOptions(this, options, context) + .pipe((0, operators_1.map)((o) => [tree, o]))), (0, operators_1.concatMap)(([tree, transformedOptions]) => { + let input; + let scoped = false; + if (executionOptions && executionOptions.scope) { + scoped = true; + input = new scoped_1.ScopedTree(tree, executionOptions.scope); + } + else { + input = tree; + } + return (0, call_1.callRule)(this._factory(transformedOptions), (0, rxjs_1.of)(input), context).pipe((0, operators_1.map)((output) => { + if (output === input) { + return tree; + } + else if (scoped) { + tree.merge(output); + return tree; + } + else { + return output; + } + })); + })); + } +} +exports.SchematicImpl = SchematicImpl; diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/exception/exception.d.ts b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/exception/exception.d.ts new file mode 100644 index 00000000..269b0e0d --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/exception/exception.d.ts @@ -0,0 +1,31 @@ +/** + * @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 + */ +import { BaseException } from '@angular-devkit/core'; +export declare class SchematicsException extends BaseException { +} +export declare class FileDoesNotExistException extends BaseException { + constructor(path: string); +} +export declare class FileAlreadyExistException extends BaseException { + constructor(path: string); +} +export declare class ContentHasMutatedException extends BaseException { + constructor(path: string); +} +export declare class InvalidUpdateRecordException extends BaseException { + constructor(); +} +export declare class MergeConflictException extends BaseException { + constructor(path: string); +} +export declare class UnsuccessfulWorkflowExecution extends BaseException { + constructor(); +} +export declare class UnimplementedException extends BaseException { + constructor(); +} diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/exception/exception.js b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/exception/exception.js new file mode 100644 index 00000000..b04bc343 --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/exception/exception.js @@ -0,0 +1,58 @@ +"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.UnimplementedException = exports.UnsuccessfulWorkflowExecution = exports.MergeConflictException = exports.InvalidUpdateRecordException = exports.ContentHasMutatedException = exports.FileAlreadyExistException = exports.FileDoesNotExistException = exports.SchematicsException = void 0; +const core_1 = require("@angular-devkit/core"); +// Used by schematics to throw exceptions. +class SchematicsException extends core_1.BaseException { +} +exports.SchematicsException = SchematicsException; +// Exceptions +class FileDoesNotExistException extends core_1.BaseException { + constructor(path) { + super(`Path "${path}" does not exist.`); + } +} +exports.FileDoesNotExistException = FileDoesNotExistException; +class FileAlreadyExistException extends core_1.BaseException { + constructor(path) { + super(`Path "${path}" already exist.`); + } +} +exports.FileAlreadyExistException = FileAlreadyExistException; +class ContentHasMutatedException extends core_1.BaseException { + constructor(path) { + super(`Content at path "${path}" has changed between the start and the end of an update.`); + } +} +exports.ContentHasMutatedException = ContentHasMutatedException; +class InvalidUpdateRecordException extends core_1.BaseException { + constructor() { + super(`Invalid record instance.`); + } +} +exports.InvalidUpdateRecordException = InvalidUpdateRecordException; +class MergeConflictException extends core_1.BaseException { + constructor(path) { + super(`A merge conflicted on path "${path}".`); + } +} +exports.MergeConflictException = MergeConflictException; +class UnsuccessfulWorkflowExecution extends core_1.BaseException { + constructor() { + super('Workflow did not execute successfully.'); + } +} +exports.UnsuccessfulWorkflowExecution = UnsuccessfulWorkflowExecution; +class UnimplementedException extends core_1.BaseException { + constructor() { + super('This function is unimplemented.'); + } +} +exports.UnimplementedException = UnimplementedException; diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/formats/format-validator.d.ts b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/formats/format-validator.d.ts new file mode 100644 index 00000000..88952600 --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/formats/format-validator.d.ts @@ -0,0 +1,10 @@ +/** + * @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 + */ +import { JsonObject, JsonValue, schema } from '@angular-devkit/core'; +import { Observable } from 'rxjs'; +export declare function formatValidator(data: JsonValue, dataSchema: JsonObject, formats: schema.SchemaFormat[]): Observable<schema.SchemaValidatorResult>; diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/formats/format-validator.js b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/formats/format-validator.js new file mode 100644 index 00000000..208e1d14 --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/formats/format-validator.js @@ -0,0 +1,20 @@ +"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.formatValidator = void 0; +const core_1 = require("@angular-devkit/core"); +const operators_1 = require("rxjs/operators"); +function formatValidator(data, dataSchema, formats) { + const registry = new core_1.schema.CoreSchemaRegistry(); + for (const format of formats) { + registry.addFormat(format); + } + return registry.compile(dataSchema).pipe((0, operators_1.mergeMap)((validator) => validator(data))); +} +exports.formatValidator = formatValidator; diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/formats/html-selector.d.ts b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/formats/html-selector.d.ts new file mode 100644 index 00000000..95616881 --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/formats/html-selector.d.ts @@ -0,0 +1,9 @@ +/** + * @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 + */ +import { schema } from '@angular-devkit/core'; +export declare const htmlSelectorFormat: schema.SchemaFormat; diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/formats/html-selector.js b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/formats/html-selector.js new file mode 100644 index 00000000..8005c035 --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/formats/html-selector.js @@ -0,0 +1,44 @@ +"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.htmlSelectorFormat = void 0; +// As per https://html.spec.whatwg.org/multipage/custom-elements.html#valid-custom-element-name +// * Without mandatory `-` as the application prefix will generally cover its inclusion +// * And an allowance for upper alpha characters +// NOTE: This should eventually be broken out into two formats: full and partial (allows for prefix) +const unicodeRanges = [ + [0xc0, 0xd6], + [0xd8, 0xf6], + [0xf8, 0x37d], + [0x37f, 0x1fff], + [0x200c, 0x200d], + [0x203f, 0x2040], + [0x2070, 0x218f], + [0x2c00, 0x2fef], + [0x3001, 0xd7ff], + [0xf900, 0xfdcf], + [0xfdf0, 0xfffd], + [0x10000, 0xeffff], +]; +function isValidElementName(name) { + let regex = '^[a-zA-Z]['; + regex += '-.0-9_a-zA-Z\\u{B7}'; + for (const range of unicodeRanges) { + regex += `\\u{${range[0].toString(16)}}-\\u{${range[1].toString(16)}}`; + } + regex += ']*$'; + return new RegExp(regex, 'u').test(name); +} +exports.htmlSelectorFormat = { + name: 'html-selector', + formatter: { + async: false, + validate: (name) => typeof name === 'string' && isValidElementName(name), + }, +}; diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/formats/index.d.ts b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/formats/index.d.ts new file mode 100644 index 00000000..a3b4bd37 --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/formats/index.d.ts @@ -0,0 +1,11 @@ +/** + * @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 + */ +import { schema } from '@angular-devkit/core'; +export { htmlSelectorFormat } from './html-selector'; +export { pathFormat } from './path'; +export declare const standardFormats: schema.SchemaFormat[]; diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/formats/index.js b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/formats/index.js new file mode 100644 index 00000000..1fce3ace --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/formats/index.js @@ -0,0 +1,17 @@ +"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.standardFormats = exports.pathFormat = exports.htmlSelectorFormat = void 0; +const html_selector_1 = require("./html-selector"); +const path_1 = require("./path"); +var html_selector_2 = require("./html-selector"); +Object.defineProperty(exports, "htmlSelectorFormat", { enumerable: true, get: function () { return html_selector_2.htmlSelectorFormat; } }); +var path_2 = require("./path"); +Object.defineProperty(exports, "pathFormat", { enumerable: true, get: function () { return path_2.pathFormat; } }); +exports.standardFormats = [html_selector_1.htmlSelectorFormat, path_1.pathFormat]; diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/formats/path.d.ts b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/formats/path.d.ts new file mode 100644 index 00000000..9957e37c --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/formats/path.d.ts @@ -0,0 +1,9 @@ +/** + * @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 + */ +import { schema } from '@angular-devkit/core'; +export declare const pathFormat: schema.SchemaFormat; diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/formats/path.js b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/formats/path.js new file mode 100644 index 00000000..3a9d1240 --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/formats/path.js @@ -0,0 +1,24 @@ +"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.pathFormat = void 0; +const core_1 = require("@angular-devkit/core"); +exports.pathFormat = { + name: 'path', + formatter: { + async: false, + validate: (path) => { + // Check path is normalized already. + return path === (0, core_1.normalize)(path); + // TODO: check if path is valid (is that just checking if it's normalized?) + // TODO: check path is from root of schematics even if passed absolute + // TODO: error out if path is outside of host + }, + }, +}; diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/index.d.ts b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/index.d.ts new file mode 100644 index 00000000..5d8c7b5a --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/index.d.ts @@ -0,0 +1,41 @@ +/** + * @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 + */ +import * as formats from './formats/index'; +import { FilePredicate, MergeStrategy, Tree as TreeInterface } from './tree/interface'; +import * as workflow from './workflow/index'; +export { SchematicsException } from './exception/exception'; +export * from './tree/action'; +export * from './engine/index'; +export * from './exception/exception'; +export * from './tree/interface'; +export * from './rules/base'; +export * from './rules/call'; +export * from './rules/move'; +export * from './rules/random'; +export * from './rules/schematic'; +export * from './rules/template'; +export * from './rules/url'; +export * from './tree/delegate'; +export * from './tree/empty'; +export * from './tree/host-tree'; +export { UpdateRecorder } from './tree/interface'; +export * from './engine/schematic'; +export * from './sink/dryrun'; +export * from './sink/host'; +export * from './sink/sink'; +export { formats }; +export { workflow }; +export interface TreeConstructor { + empty(): TreeInterface; + branch(tree: TreeInterface): TreeInterface; + merge(tree: TreeInterface, other: TreeInterface, strategy?: MergeStrategy): TreeInterface; + partition(tree: TreeInterface, predicate: FilePredicate<boolean>): [TreeInterface, TreeInterface]; + optimize(tree: TreeInterface): TreeInterface; +} +export declare type Tree = TreeInterface; +export declare const Tree: TreeConstructor; diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/index.js b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/index.js new file mode 100644 index 00000000..738fbad7 --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/index.js @@ -0,0 +1,75 @@ +"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 + */ +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; +var __exportStar = (this && this.__exportStar) || function(m, exports) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.Tree = exports.workflow = exports.formats = exports.SchematicsException = void 0; +const formats = __importStar(require("./formats/index")); +exports.formats = formats; +const interface_1 = require("./tree/interface"); +const static_1 = require("./tree/static"); +const workflow = __importStar(require("./workflow/index")); +exports.workflow = workflow; +var exception_1 = require("./exception/exception"); +Object.defineProperty(exports, "SchematicsException", { enumerable: true, get: function () { return exception_1.SchematicsException; } }); +__exportStar(require("./tree/action"), exports); +__exportStar(require("./engine/index"), exports); +__exportStar(require("./exception/exception"), exports); +__exportStar(require("./tree/interface"), exports); +__exportStar(require("./rules/base"), exports); +__exportStar(require("./rules/call"), exports); +__exportStar(require("./rules/move"), exports); +__exportStar(require("./rules/random"), exports); +__exportStar(require("./rules/schematic"), exports); +__exportStar(require("./rules/template"), exports); +__exportStar(require("./rules/url"), exports); +__exportStar(require("./tree/delegate"), exports); +__exportStar(require("./tree/empty"), exports); +__exportStar(require("./tree/host-tree"), exports); +__exportStar(require("./engine/schematic"), exports); +__exportStar(require("./sink/dryrun"), exports); +__exportStar(require("./sink/host"), exports); +__exportStar(require("./sink/sink"), exports); +exports.Tree = { + empty() { + return (0, static_1.empty)(); + }, + branch(tree) { + return (0, static_1.branch)(tree); + }, + merge(tree, other, strategy = interface_1.MergeStrategy.Default) { + return (0, static_1.merge)(tree, other, strategy); + }, + partition(tree, predicate) { + return (0, static_1.partition)(tree, predicate); + }, + optimize(tree) { + return tree; + }, +}; diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/rules/base.d.ts b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/rules/base.d.ts new file mode 100644 index 00000000..f78b3895 --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/rules/base.d.ts @@ -0,0 +1,38 @@ +/** + * @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 + */ +import { FileOperator, Rule, Source } from '../engine/interface'; +import { FilePredicate, MergeStrategy, Tree } from '../tree/interface'; +/** + * A Source that returns an tree as its single value. + */ +export declare function source(tree: Tree): Source; +/** + * A source that returns an empty tree. + */ +export declare function empty(): Source; +/** + * Chain multiple rules into a single rule. + */ +export declare function chain(rules: Rule[]): Rule; +/** + * Apply multiple rules to a source, and returns the source transformed. + */ +export declare function apply(source: Source, rules: Rule[]): Source; +/** + * Merge an input tree with the source passed in. + */ +export declare function mergeWith(source: Source, strategy?: MergeStrategy): Rule; +export declare function noop(): Rule; +export declare function filter(predicate: FilePredicate<boolean>): Rule; +export declare function asSource(rule: Rule): Source; +export declare function branchAndMerge(rule: Rule, strategy?: MergeStrategy): Rule; +export declare function when(predicate: FilePredicate<boolean>, operator: FileOperator): FileOperator; +export declare function partitionApplyMerge(predicate: FilePredicate<boolean>, ruleYes: Rule, ruleNo?: Rule): Rule; +export declare function forEach(operator: FileOperator): Rule; +export declare function composeFileOperators(operators: FileOperator[]): FileOperator; +export declare function applyToSubtree(path: string, rules: Rule[]): Rule; diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/rules/base.js b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/rules/base.js new file mode 100644 index 00000000..fdcae77a --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/rules/base.js @@ -0,0 +1,155 @@ +"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.applyToSubtree = exports.composeFileOperators = exports.forEach = exports.partitionApplyMerge = exports.when = exports.branchAndMerge = exports.asSource = exports.filter = exports.noop = exports.mergeWith = exports.apply = exports.chain = exports.empty = exports.source = void 0; +const rxjs_1 = require("rxjs"); +const operators_1 = require("rxjs/operators"); +const exception_1 = require("../exception/exception"); +const host_tree_1 = require("../tree/host-tree"); +const interface_1 = require("../tree/interface"); +const scoped_1 = require("../tree/scoped"); +const static_1 = require("../tree/static"); +const call_1 = require("./call"); +/** + * A Source that returns an tree as its single value. + */ +function source(tree) { + return () => tree; +} +exports.source = source; +/** + * A source that returns an empty tree. + */ +function empty() { + return () => (0, static_1.empty)(); +} +exports.empty = empty; +/** + * Chain multiple rules into a single rule. + */ +function chain(rules) { + return (tree, context) => { + return rules.reduce((acc, curr) => (0, call_1.callRule)(curr, acc, context), tree); + }; +} +exports.chain = chain; +/** + * Apply multiple rules to a source, and returns the source transformed. + */ +function apply(source, rules) { + return (context) => (0, call_1.callRule)(chain(rules), (0, call_1.callSource)(source, context), context); +} +exports.apply = apply; +/** + * Merge an input tree with the source passed in. + */ +function mergeWith(source, strategy = interface_1.MergeStrategy.Default) { + return (tree, context) => { + return (0, call_1.callSource)(source, context).pipe((0, operators_1.map)((sourceTree) => tree.merge(sourceTree, strategy || context.strategy)), (0, operators_1.mapTo)(tree)); + }; +} +exports.mergeWith = mergeWith; +function noop() { + return () => { }; +} +exports.noop = noop; +function filter(predicate) { + return (tree) => { + if (host_tree_1.HostTree.isHostTree(tree)) { + return new host_tree_1.FilterHostTree(tree, predicate); + } + else { + throw new exception_1.SchematicsException('Tree type is not supported.'); + } + }; +} +exports.filter = filter; +function asSource(rule) { + return (context) => (0, call_1.callRule)(rule, (0, static_1.empty)(), context); +} +exports.asSource = asSource; +function branchAndMerge(rule, strategy = interface_1.MergeStrategy.Default) { + return (tree, context) => { + return (0, call_1.callRule)(rule, tree.branch(), context).pipe((0, operators_1.map)((branch) => tree.merge(branch, strategy || context.strategy)), (0, operators_1.mapTo)(tree)); + }; +} +exports.branchAndMerge = branchAndMerge; +function when(predicate, operator) { + return (entry) => { + if (predicate(entry.path, entry)) { + return operator(entry); + } + else { + return entry; + } + }; +} +exports.when = when; +function partitionApplyMerge(predicate, ruleYes, ruleNo) { + return (tree, context) => { + const [yes, no] = (0, static_1.partition)(tree, predicate); + return (0, rxjs_1.concat)((0, call_1.callRule)(ruleYes, yes, context), (0, call_1.callRule)(ruleNo || noop(), no, context)).pipe((0, operators_1.toArray)(), (0, operators_1.map)(([yesTree, noTree]) => { + yesTree.merge(noTree, context.strategy); + return yesTree; + })); + }; +} +exports.partitionApplyMerge = partitionApplyMerge; +function forEach(operator) { + return (tree) => { + tree.visit((path, entry) => { + if (!entry) { + return; + } + const newEntry = operator(entry); + if (newEntry === entry) { + return; + } + if (newEntry === null) { + tree.delete(path); + return; + } + if (newEntry.path != path) { + tree.rename(path, newEntry.path); + } + if (!newEntry.content.equals(entry.content)) { + tree.overwrite(newEntry.path, newEntry.content); + } + }); + }; +} +exports.forEach = forEach; +function composeFileOperators(operators) { + return (entry) => { + let current = entry; + for (const op of operators) { + current = op(current); + if (current === null) { + // Deleted, just return. + return null; + } + } + return current; + }; +} +exports.composeFileOperators = composeFileOperators; +function applyToSubtree(path, rules) { + return (tree, context) => { + const scoped = new scoped_1.ScopedTree(tree, path); + return (0, call_1.callRule)(chain(rules), scoped, context).pipe((0, operators_1.map)((result) => { + if (result === scoped) { + return tree; + } + else { + throw new exception_1.SchematicsException('Original tree must be returned from all rules when using "applyToSubtree".'); + } + })); + }; +} +exports.applyToSubtree = applyToSubtree; diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/rules/call.d.ts b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/rules/call.d.ts new file mode 100644 index 00000000..b978109a --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/rules/call.d.ts @@ -0,0 +1,22 @@ +/** + * @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 + */ +import { BaseException } from '@angular-devkit/core'; +import { Observable } from 'rxjs'; +import { Rule, SchematicContext, Source } from '../engine/interface'; +import { Tree } from '../tree/interface'; +/** + * When a rule or source returns an invalid value. + */ +export declare class InvalidRuleResultException extends BaseException { + constructor(value?: {}); +} +export declare class InvalidSourceResultException extends BaseException { + constructor(value?: {}); +} +export declare function callSource(source: Source, context: SchematicContext): Observable<Tree>; +export declare function callRule(rule: Rule, input: Tree | Observable<Tree>, context: SchematicContext): Observable<Tree>; diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/rules/call.js b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/rules/call.js new file mode 100644 index 00000000..caeb25ad --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/rules/call.js @@ -0,0 +1,110 @@ +"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.callRule = exports.callSource = exports.InvalidSourceResultException = exports.InvalidRuleResultException = void 0; +const core_1 = require("@angular-devkit/core"); +const rxjs_1 = require("rxjs"); +const operators_1 = require("rxjs/operators"); +const interface_1 = require("../tree/interface"); +function _getTypeOfResult(value) { + if (value === undefined) { + return 'undefined'; + } + else if (value === null) { + return 'null'; + } + else if (typeof value == 'function') { + return `Function()`; + } + else if (typeof value != 'object') { + return `${typeof value}(${JSON.stringify(value)})`; + } + else { + if (Object.getPrototypeOf(value) == Object) { + return `Object(${JSON.stringify(value)})`; + } + else if (value.constructor) { + return `Instance of class ${value.constructor.name}`; + } + else { + return 'Unknown Object'; + } + } +} +/** + * When a rule or source returns an invalid value. + */ +class InvalidRuleResultException extends core_1.BaseException { + constructor(value) { + super(`Invalid rule result: ${_getTypeOfResult(value)}.`); + } +} +exports.InvalidRuleResultException = InvalidRuleResultException; +class InvalidSourceResultException extends core_1.BaseException { + constructor(value) { + super(`Invalid source result: ${_getTypeOfResult(value)}.`); + } +} +exports.InvalidSourceResultException = InvalidSourceResultException; +function callSource(source, context) { + const result = source(context); + if ((0, rxjs_1.isObservable)(result)) { + // Only return the last Tree, and make sure it's a Tree. + return result.pipe((0, operators_1.defaultIfEmpty)(), (0, operators_1.last)(), (0, operators_1.tap)((inner) => { + if (!inner || !(interface_1.TreeSymbol in inner)) { + throw new InvalidSourceResultException(inner); + } + })); + } + else if (result && interface_1.TreeSymbol in result) { + return (0, rxjs_1.of)(result); + } + else { + return (0, rxjs_1.throwError)(new InvalidSourceResultException(result)); + } +} +exports.callSource = callSource; +function callRule(rule, input, context) { + return ((0, rxjs_1.isObservable)(input) ? input : (0, rxjs_1.of)(input)).pipe((0, operators_1.mergeMap)((inputTree) => { + const result = rule(inputTree, context); + if (!result) { + return (0, rxjs_1.of)(inputTree); + } + else if (typeof result == 'function') { + // This is considered a Rule, chain the rule and return its output. + return callRule(result, inputTree, context); + } + else if ((0, rxjs_1.isObservable)(result)) { + // Only return the last Tree, and make sure it's a Tree. + return result.pipe((0, operators_1.defaultIfEmpty)(), (0, operators_1.last)(), (0, operators_1.tap)((inner) => { + if (!inner || !(interface_1.TreeSymbol in inner)) { + throw new InvalidRuleResultException(inner); + } + })); + } + else if ((0, core_1.isPromise)(result)) { + return (0, rxjs_1.from)(result).pipe((0, operators_1.mergeMap)((inner) => { + if (typeof inner === 'function') { + // This is considered a Rule, chain the rule and return its output. + return callRule(inner, inputTree, context); + } + else { + return (0, rxjs_1.of)(inputTree); + } + })); + } + else if (interface_1.TreeSymbol in result) { + return (0, rxjs_1.of)(result); + } + else { + return (0, rxjs_1.throwError)(new InvalidRuleResultException(result)); + } + })); +} +exports.callRule = callRule; diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/rules/move.d.ts b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/rules/move.d.ts new file mode 100644 index 00000000..16687aa6 --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/rules/move.d.ts @@ -0,0 +1,9 @@ +/** + * @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 + */ +import { Rule } from '../engine/interface'; +export declare function move(from: string, to?: string): Rule; diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/rules/move.js b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/rules/move.js new file mode 100644 index 00000000..6a2f7f08 --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/rules/move.js @@ -0,0 +1,37 @@ +"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.move = void 0; +const core_1 = require("@angular-devkit/core"); +const base_1 = require("./base"); +function move(from, to) { + if (to === undefined) { + to = from; + from = '/'; + } + const fromPath = (0, core_1.normalize)('/' + from); + const toPath = (0, core_1.normalize)('/' + to); + if (fromPath === toPath) { + return base_1.noop; + } + return (tree) => { + if (tree.exists(fromPath)) { + // fromPath is a file + tree.rename(fromPath, toPath); + } + else { + // fromPath is a directory + tree.getDir(fromPath).visit((path) => { + tree.rename(path, (0, core_1.join)(toPath, path.substr(fromPath.length))); + }); + } + return tree; + }; +} +exports.move = move; diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/rules/random.d.ts b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/rules/random.d.ts new file mode 100644 index 00000000..0abc730f --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/rules/random.d.ts @@ -0,0 +1,14 @@ +/** + * @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 + */ +import { Source } from '../engine/interface'; +export interface RandomOptions { + root?: string; + multi?: boolean | number; + multiFiles?: boolean | number; +} +export default function (options: RandomOptions): Source; diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/rules/random.js b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/rules/random.js new file mode 100644 index 00000000..b0ec3fb7 --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/rules/random.js @@ -0,0 +1,40 @@ +"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 }); +const host_tree_1 = require("../tree/host-tree"); +function generateStringOfLength(l) { + return new Array(l) + .fill(0) + .map((_x) => { + return 'abcdefghijklmnopqrstuvwxyz'[Math.floor(Math.random() * 26)]; + }) + .join(''); +} +function random(from, to) { + return Math.floor(Math.random() * (to - from)) + from; +} +function default_1(options) { + return () => { + const root = 'root' in options ? options.root : '/'; + const map = new host_tree_1.HostTree(); + const nbFiles = 'multiFiles' in options + ? typeof options.multiFiles == 'number' + ? options.multiFiles + : random(2, 12) + : 1; + for (let i = 0; i < nbFiles; i++) { + const path = 'a/b/c/d/e/f'.slice(Math.random() * 10); + const fileName = generateStringOfLength(20); + const content = generateStringOfLength(100); + map.create(root + '/' + path + '/' + fileName, content); + } + return map; + }; +} +exports.default = default_1; diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/rules/rename.d.ts b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/rules/rename.d.ts new file mode 100644 index 00000000..75e8e42e --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/rules/rename.d.ts @@ -0,0 +1,10 @@ +/** + * @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 + */ +import { Rule } from '../engine/interface'; +import { FilePredicate } from '../tree/interface'; +export declare function rename(match: FilePredicate<boolean>, to: FilePredicate<string>): Rule; diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/rules/rename.js b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/rules/rename.js new file mode 100644 index 00000000..a02a96d1 --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/rules/rename.js @@ -0,0 +1,26 @@ +"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.rename = void 0; +const core_1 = require("@angular-devkit/core"); +const base_1 = require("./base"); +function rename(match, to) { + return (0, base_1.forEach)((entry) => { + if (match(entry.path, entry)) { + return { + content: entry.content, + path: (0, core_1.normalize)(to(entry.path, entry)), + }; + } + else { + return entry; + } + }); +} +exports.rename = rename; diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/rules/schematic.d.ts b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/rules/schematic.d.ts new file mode 100644 index 00000000..c840fb9c --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/rules/schematic.d.ts @@ -0,0 +1,23 @@ +/** + * @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 + */ +import { ExecutionOptions, Rule } from '../engine/interface'; +/** + * Run a schematic from a separate collection. + * + * @param collectionName The name of the collection that contains the schematic to run. + * @param schematicName The name of the schematic to run. + * @param options The options to pass as input to the RuleFactory. + */ +export declare function externalSchematic<OptionT extends object>(collectionName: string, schematicName: string, options: OptionT, executionOptions?: Partial<ExecutionOptions>): Rule; +/** + * Run a schematic from the same collection. + * + * @param schematicName The name of the schematic to run. + * @param options The options to pass as input to the RuleFactory. + */ +export declare function schematic<OptionT extends object>(schematicName: string, options: OptionT, executionOptions?: Partial<ExecutionOptions>): Rule; diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/rules/schematic.js b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/rules/schematic.js new file mode 100644 index 00000000..01f69a4e --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/rules/schematic.js @@ -0,0 +1,51 @@ +"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.schematic = exports.externalSchematic = void 0; +const rxjs_1 = require("rxjs"); +const operators_1 = require("rxjs/operators"); +const interface_1 = require("../tree/interface"); +const static_1 = require("../tree/static"); +/** + * Run a schematic from a separate collection. + * + * @param collectionName The name of the collection that contains the schematic to run. + * @param schematicName The name of the schematic to run. + * @param options The options to pass as input to the RuleFactory. + */ +function externalSchematic(collectionName, schematicName, options, executionOptions) { + return (input, context) => { + const collection = context.engine.createCollection(collectionName, context.schematic.collection); + const schematic = collection.createSchematic(schematicName); + return schematic.call(options, (0, rxjs_1.of)((0, static_1.branch)(input)), context, executionOptions).pipe((0, operators_1.last)(), (0, operators_1.map)((x) => { + input.merge(x, interface_1.MergeStrategy.AllowOverwriteConflict); + return input; + })); + }; +} +exports.externalSchematic = externalSchematic; +/** + * Run a schematic from the same collection. + * + * @param schematicName The name of the schematic to run. + * @param options The options to pass as input to the RuleFactory. + */ +function schematic(schematicName, options, executionOptions) { + return (input, context) => { + const collection = context.schematic.collection; + const schematic = collection.createSchematic(schematicName, true); + return schematic.call(options, (0, rxjs_1.of)((0, static_1.branch)(input)), context, executionOptions).pipe((0, operators_1.last)(), (0, operators_1.map)((x) => { + // We allow overwrite conflict here because they're the only merge conflict we particularly + // don't want to deal with; the input tree might have an OVERWRITE which the sub + input.merge(x, interface_1.MergeStrategy.AllowOverwriteConflict); + return input; + })); + }; +} +exports.schematic = schematic; diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/rules/template.d.ts b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/rules/template.d.ts new file mode 100644 index 00000000..45335160 --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/rules/template.d.ts @@ -0,0 +1,39 @@ +/** + * @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 + */ +import { BaseException } from '@angular-devkit/core'; +import { FileOperator, Rule } from '../engine/interface'; +export declare const TEMPLATE_FILENAME_RE: RegExp; +export declare class OptionIsNotDefinedException extends BaseException { + constructor(name: string); +} +export declare class UnknownPipeException extends BaseException { + constructor(name: string); +} +export declare class InvalidPipeException extends BaseException { + constructor(name: string); +} +export declare type PathTemplateValue = boolean | string | number | undefined; +export declare type PathTemplatePipeFunction = (x: string) => PathTemplateValue; +export declare type PathTemplateData = { + [key: string]: PathTemplateValue | PathTemplateData | PathTemplatePipeFunction; +}; +export interface PathTemplateOptions { + interpolationStart: string; + interpolationEnd: string; + pipeSeparator?: string; +} +export declare function applyContentTemplate<T>(options: T): FileOperator; +export declare function contentTemplate<T>(options: T): Rule; +export declare function applyPathTemplate<T extends PathTemplateData>(data: T, options?: PathTemplateOptions): FileOperator; +export declare function pathTemplate<T extends PathTemplateData>(options: T): Rule; +/** + * Remove every `.template` suffix from file names. + */ +export declare function renameTemplateFiles(): Rule; +export declare function template<T>(options: T): Rule; +export declare function applyTemplates<T>(options: T): Rule; diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/rules/template.js b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/rules/template.js new file mode 100644 index 00000000..8fc87bc2 --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/rules/template.js @@ -0,0 +1,151 @@ +"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.applyTemplates = exports.template = exports.renameTemplateFiles = exports.pathTemplate = exports.applyPathTemplate = exports.contentTemplate = exports.applyContentTemplate = exports.InvalidPipeException = exports.UnknownPipeException = exports.OptionIsNotDefinedException = exports.TEMPLATE_FILENAME_RE = void 0; +const core_1 = require("@angular-devkit/core"); +const util_1 = require("util"); +const base_1 = require("./base"); +const rename_1 = require("./rename"); +exports.TEMPLATE_FILENAME_RE = /\.template$/; +class OptionIsNotDefinedException extends core_1.BaseException { + constructor(name) { + super(`Option "${name}" is not defined.`); + } +} +exports.OptionIsNotDefinedException = OptionIsNotDefinedException; +class UnknownPipeException extends core_1.BaseException { + constructor(name) { + super(`Pipe "${name}" is not defined.`); + } +} +exports.UnknownPipeException = UnknownPipeException; +class InvalidPipeException extends core_1.BaseException { + constructor(name) { + super(`Pipe "${name}" is invalid.`); + } +} +exports.InvalidPipeException = InvalidPipeException; +const decoder = new util_1.TextDecoder('utf-8', { fatal: true }); +function applyContentTemplate(options) { + return (entry) => { + const { path, content } = entry; + try { + const decodedContent = decoder.decode(content); + return { + path, + content: Buffer.from((0, core_1.template)(decodedContent, {})(options)), + }; + } + catch (e) { + if (e.code === 'ERR_ENCODING_INVALID_ENCODED_DATA') { + return entry; + } + throw e; + } + }; +} +exports.applyContentTemplate = applyContentTemplate; +function contentTemplate(options) { + return (0, base_1.forEach)(applyContentTemplate(options)); +} +exports.contentTemplate = contentTemplate; +function applyPathTemplate(data, options = { + interpolationStart: '__', + interpolationEnd: '__', + pipeSeparator: '@', +}) { + const is = options.interpolationStart; + const ie = options.interpolationEnd; + const isL = is.length; + const ieL = ie.length; + return (entry) => { + let path = entry.path; + const content = entry.content; + const original = path; + let start = path.indexOf(is); + // + 1 to have at least a length 1 name. `____` is not valid. + let end = path.indexOf(ie, start + isL + 1); + while (start != -1 && end != -1) { + const match = path.substring(start + isL, end); + let replacement = data[match]; + if (!options.pipeSeparator) { + if (typeof replacement == 'function') { + replacement = replacement.call(data, original); + } + if (replacement === undefined) { + throw new OptionIsNotDefinedException(match); + } + } + else { + const [name, ...pipes] = match.split(options.pipeSeparator); + replacement = data[name]; + if (typeof replacement == 'function') { + replacement = replacement.call(data, original); + } + if (replacement === undefined) { + throw new OptionIsNotDefinedException(name); + } + replacement = pipes.reduce((acc, pipe) => { + if (!pipe) { + return acc; + } + if (!(pipe in data)) { + throw new UnknownPipeException(pipe); + } + if (typeof data[pipe] != 'function') { + throw new InvalidPipeException(pipe); + } + // Coerce to string. + return '' + data[pipe](acc); + }, '' + replacement); + } + path = path.substring(0, start) + replacement + path.substring(end + ieL); + start = path.indexOf(options.interpolationStart); + // See above. + end = path.indexOf(options.interpolationEnd, start + isL + 1); + } + return { path: (0, core_1.normalize)(path), content }; + }; +} +exports.applyPathTemplate = applyPathTemplate; +function pathTemplate(options) { + return (0, base_1.forEach)(applyPathTemplate(options)); +} +exports.pathTemplate = pathTemplate; +/** + * Remove every `.template` suffix from file names. + */ +function renameTemplateFiles() { + return (0, rename_1.rename)((path) => !!path.match(exports.TEMPLATE_FILENAME_RE), (path) => path.replace(exports.TEMPLATE_FILENAME_RE, '')); +} +exports.renameTemplateFiles = renameTemplateFiles; +function template(options) { + return (0, base_1.chain)([ + contentTemplate(options), + // Force cast to PathTemplateData. We need the type for the actual pathTemplate() call, + // but in this case we cannot do anything as contentTemplate are more permissive. + // Since values are coerced to strings in PathTemplates it will be fine in the end. + pathTemplate(options), + ]); +} +exports.template = template; +function applyTemplates(options) { + return (0, base_1.forEach)((0, base_1.when)((path) => path.endsWith('.template'), (0, base_1.composeFileOperators)([ + applyContentTemplate(options), + // See above for this weird cast. + applyPathTemplate(options), + (entry) => { + return { + content: entry.content, + path: entry.path.replace(exports.TEMPLATE_FILENAME_RE, ''), + }; + }, + ]))); +} +exports.applyTemplates = applyTemplates; diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/rules/url.d.ts b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/rules/url.d.ts new file mode 100644 index 00000000..d56462f3 --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/rules/url.d.ts @@ -0,0 +1,9 @@ +/** + * @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 + */ +import { Source } from '../engine/interface'; +export declare function url(urlString: string): Source; diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/rules/url.js b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/rules/url.js new file mode 100644 index 00000000..4328f74e --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/rules/url.js @@ -0,0 +1,16 @@ +"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.url = void 0; +const url_1 = require("url"); +function url(urlString) { + const url = (0, url_1.parse)(urlString); + return (context) => context.engine.createSourceFromUrl(url, context)(context); +} +exports.url = url; 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'; +} diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/tree/action.d.ts b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/tree/action.d.ts new file mode 100644 index 00000000..12bc3b8b --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/tree/action.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 { BaseException, Path } from '@angular-devkit/core'; +export declare class UnknownActionException extends BaseException { + constructor(action: Action); +} +export declare type Action = CreateFileAction | OverwriteFileAction | RenameFileAction | DeleteFileAction; +export interface ActionBase { + readonly id: number; + readonly parent: number; + readonly path: Path; +} +export declare class ActionList implements Iterable<Action> { + private _actions; + protected _action(action: Partial<Action>): void; + create(path: Path, content: Buffer): void; + overwrite(path: Path, content: Buffer): void; + rename(path: Path, to: Path): void; + delete(path: Path): void; + optimize(): void; + push(action: Action): void; + get(i: number): Action; + has(action: Action): boolean; + find(predicate: (value: Action) => boolean): Action | null; + forEach(fn: (value: Action, index: number, array: Action[]) => void, thisArg?: {}): void; + get length(): number; + [Symbol.iterator](): IterableIterator<Action>; +} +export declare function isContentAction(action: Action): action is CreateFileAction | OverwriteFileAction; +export interface CreateFileAction extends ActionBase { + readonly kind: 'c'; + readonly content: Buffer; +} +export interface OverwriteFileAction extends ActionBase { + readonly kind: 'o'; + readonly content: Buffer; +} +export interface RenameFileAction extends ActionBase { + readonly kind: 'r'; + readonly to: Path; +} +export interface DeleteFileAction extends ActionBase { + readonly kind: 'd'; +} diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/tree/action.js b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/tree/action.js new file mode 100644 index 00000000..b5815892 --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/tree/action.js @@ -0,0 +1,140 @@ +"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.isContentAction = exports.ActionList = exports.UnknownActionException = void 0; +const core_1 = require("@angular-devkit/core"); +class UnknownActionException extends core_1.BaseException { + constructor(action) { + super(`Unknown action: "${action.kind}".`); + } +} +exports.UnknownActionException = UnknownActionException; +let _id = 1; +class ActionList { + constructor() { + this._actions = []; + } + _action(action) { + var _a, _b; + this._actions.push({ + ...action, + id: _id++, + parent: (_b = (_a = this._actions[this._actions.length - 1]) === null || _a === void 0 ? void 0 : _a.id) !== null && _b !== void 0 ? _b : 0, + }); + } + create(path, content) { + this._action({ kind: 'c', path, content }); + } + overwrite(path, content) { + this._action({ kind: 'o', path, content }); + } + rename(path, to) { + this._action({ kind: 'r', path, to }); + } + delete(path) { + this._action({ kind: 'd', path }); + } + optimize() { + const toCreate = new Map(); + const toRename = new Map(); + const toOverwrite = new Map(); + const toDelete = new Set(); + for (const action of this._actions) { + switch (action.kind) { + case 'c': + toCreate.set(action.path, action.content); + break; + case 'o': + if (toCreate.has(action.path)) { + toCreate.set(action.path, action.content); + } + else { + toOverwrite.set(action.path, action.content); + } + break; + case 'd': + toDelete.add(action.path); + break; + case 'r': + const maybeCreate = toCreate.get(action.path); + const maybeOverwrite = toOverwrite.get(action.path); + if (maybeCreate) { + toCreate.delete(action.path); + toCreate.set(action.to, maybeCreate); + } + if (maybeOverwrite) { + toOverwrite.delete(action.path); + toOverwrite.set(action.to, maybeOverwrite); + } + let maybeRename = undefined; + for (const [from, to] of toRename.entries()) { + if (to == action.path) { + maybeRename = from; + break; + } + } + if (maybeRename) { + toRename.set(maybeRename, action.to); + } + if (!maybeCreate && !maybeOverwrite && !maybeRename) { + toRename.set(action.path, action.to); + } + break; + } + } + this._actions = []; + toDelete.forEach((x) => { + this.delete(x); + }); + toRename.forEach((to, from) => { + this.rename(from, to); + }); + toCreate.forEach((content, path) => { + this.create(path, content); + }); + toOverwrite.forEach((content, path) => { + this.overwrite(path, content); + }); + } + push(action) { + this._actions.push(action); + } + get(i) { + return this._actions[i]; + } + has(action) { + for (let i = 0; i < this._actions.length; i++) { + const a = this._actions[i]; + if (a.id == action.id) { + return true; + } + if (a.id > action.id) { + return false; + } + } + return false; + } + find(predicate) { + return this._actions.find(predicate) || null; + } + forEach(fn, thisArg) { + this._actions.forEach(fn, thisArg); + } + get length() { + return this._actions.length; + } + [Symbol.iterator]() { + return this._actions[Symbol.iterator](); + } +} +exports.ActionList = ActionList; +function isContentAction(action) { + return action.kind == 'c' || action.kind == 'o'; +} +exports.isContentAction = isContentAction; diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/tree/delegate.d.ts b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/tree/delegate.d.ts new file mode 100644 index 00000000..2ffc446e --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/tree/delegate.d.ts @@ -0,0 +1,30 @@ +/** + * @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 { Action } from './action'; +import { DirEntry, FileEntry, FileVisitor, MergeStrategy, Tree, UpdateRecorder } from './interface'; +export declare class DelegateTree implements Tree { + protected _other: Tree; + constructor(_other: Tree); + branch(): Tree; + merge(other: Tree, strategy?: MergeStrategy): void; + get root(): DirEntry; + read(path: string): Buffer | null; + exists(path: string): boolean; + get(path: string): FileEntry | null; + getDir(path: string): DirEntry; + visit(visitor: FileVisitor): void; + overwrite(path: string, content: Buffer | string): void; + beginUpdate(path: string): UpdateRecorder; + commitUpdate(record: UpdateRecorder): void; + create(path: string, content: Buffer | string): void; + delete(path: string): void; + rename(from: string, to: string): void; + apply(action: Action, strategy?: MergeStrategy): void; + get actions(): Action[]; +} diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/tree/delegate.js b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/tree/delegate.js new file mode 100644 index 00000000..f63990b1 --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/tree/delegate.js @@ -0,0 +1,71 @@ +"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.DelegateTree = void 0; +const interface_1 = require("./interface"); +class DelegateTree { + constructor(_other) { + this._other = _other; + } + branch() { + return this._other.branch(); + } + merge(other, strategy) { + this._other.merge(other, strategy); + } + get root() { + return this._other.root; + } + // Readonly. + read(path) { + return this._other.read(path); + } + exists(path) { + return this._other.exists(path); + } + get(path) { + return this._other.get(path); + } + getDir(path) { + return this._other.getDir(path); + } + visit(visitor) { + return this._other.visit(visitor); + } + // Change content of host files. + overwrite(path, content) { + return this._other.overwrite(path, content); + } + beginUpdate(path) { + return this._other.beginUpdate(path); + } + commitUpdate(record) { + return this._other.commitUpdate(record); + } + // Structural methods. + create(path, content) { + return this._other.create(path, content); + } + delete(path) { + return this._other.delete(path); + } + rename(from, to) { + return this._other.rename(from, to); + } + apply(action, strategy) { + return this._other.apply(action, strategy); + } + get actions() { + return this._other.actions; + } + [interface_1.TreeSymbol]() { + return this; + } +} +exports.DelegateTree = DelegateTree; diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/tree/empty.d.ts b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/tree/empty.d.ts new file mode 100644 index 00000000..bd29a84e --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/tree/empty.d.ts @@ -0,0 +1,11 @@ +/** + * @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 + */ +import { HostTree } from './host-tree'; +export declare class EmptyTree extends HostTree { + constructor(); +} diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/tree/empty.js b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/tree/empty.js new file mode 100644 index 00000000..73ed6391 --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/tree/empty.js @@ -0,0 +1,17 @@ +"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.EmptyTree = void 0; +const host_tree_1 = require("./host-tree"); +class EmptyTree extends host_tree_1.HostTree { + constructor() { + super(); + } +} +exports.EmptyTree = EmptyTree; diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/tree/entry.d.ts b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/tree/entry.d.ts new file mode 100644 index 00000000..4fb16d1c --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/tree/entry.d.ts @@ -0,0 +1,25 @@ +/** + * @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 } from '@angular-devkit/core'; +import { FileEntry } from './interface'; +export declare class SimpleFileEntry implements FileEntry { + private _path; + private _content; + constructor(_path: Path, _content: Buffer); + get path(): Path; + get content(): Buffer; +} +export declare class LazyFileEntry implements FileEntry { + private _path; + private _load; + private _content; + constructor(_path: Path, _load: (path?: Path) => Buffer); + get path(): Path; + get content(): Buffer; +} diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/tree/entry.js b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/tree/entry.js new file mode 100644 index 00000000..cfe7ada6 --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/tree/entry.js @@ -0,0 +1,37 @@ +"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.LazyFileEntry = exports.SimpleFileEntry = void 0; +class SimpleFileEntry { + constructor(_path, _content) { + this._path = _path; + this._content = _content; + } + get path() { + return this._path; + } + get content() { + return this._content; + } +} +exports.SimpleFileEntry = SimpleFileEntry; +class LazyFileEntry { + constructor(_path, _load) { + this._path = _path; + this._load = _load; + this._content = null; + } + get path() { + return this._path; + } + get content() { + return this._content || (this._content = this._load(this._path)); + } +} +exports.LazyFileEntry = LazyFileEntry; diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/tree/host-tree.d.ts b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/tree/host-tree.d.ts new file mode 100644 index 00000000..dd370e91 --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/tree/host-tree.d.ts @@ -0,0 +1,63 @@ +/** + * @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, PathFragment, virtualFs } from '@angular-devkit/core'; +import { Action } from './action'; +import { DirEntry, FileEntry, FilePredicate, FileVisitor, MergeStrategy, Tree, UpdateRecorder } from './interface'; +export declare class HostDirEntry implements DirEntry { + readonly parent: DirEntry | null; + readonly path: Path; + protected _host: virtualFs.SyncDelegateHost; + protected _tree: Tree; + constructor(parent: DirEntry | null, path: Path, _host: virtualFs.SyncDelegateHost, _tree: Tree); + get subdirs(): PathFragment[]; + get subfiles(): PathFragment[]; + dir(name: PathFragment): DirEntry; + file(name: PathFragment): FileEntry | null; + visit(visitor: FileVisitor): void; + private getSubfilesRecursively; +} +export declare class HostTree implements Tree { + protected _backend: virtualFs.ReadonlyHost<{}>; + private readonly _id; + private _record; + private _recordSync; + private _ancestry; + private _dirCache; + static isHostTree(tree: Tree): tree is HostTree; + constructor(_backend?: virtualFs.ReadonlyHost<{}>); + protected _normalizePath(path: string): Path; + protected _willCreate(path: Path): boolean; + protected _willOverwrite(path: Path): boolean; + protected _willDelete(path: Path): boolean; + protected _willRename(path: Path): boolean; + branch(): Tree; + private isAncestorOf; + merge(other: Tree, strategy?: MergeStrategy): void; + get root(): DirEntry; + read(path: string): Buffer | null; + exists(path: string): boolean; + get(path: string): FileEntry | null; + getDir(path: string): DirEntry; + visit(visitor: FileVisitor): void; + overwrite(path: string, content: Buffer | string): void; + beginUpdate(path: string): UpdateRecorder; + commitUpdate(record: UpdateRecorder): void; + create(path: string, content: Buffer | string): void; + delete(path: string): void; + rename(from: string, to: string): void; + apply(action: Action, strategy?: MergeStrategy): void; + private generateActions; + get actions(): Action[]; +} +export declare class HostCreateTree extends HostTree { + constructor(host: virtualFs.ReadonlyHost); +} +export declare class FilterHostTree extends HostTree { + constructor(tree: HostTree, filter?: FilePredicate<boolean>); +} diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/tree/host-tree.js b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/tree/host-tree.js new file mode 100644 index 00000000..8cde1dfa --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/tree/host-tree.js @@ -0,0 +1,406 @@ +"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.FilterHostTree = exports.HostCreateTree = exports.HostTree = exports.HostDirEntry = void 0; +const core_1 = require("@angular-devkit/core"); +const rxjs_1 = require("rxjs"); +const operators_1 = require("rxjs/operators"); +const exception_1 = require("../exception/exception"); +const delegate_1 = require("./delegate"); +const entry_1 = require("./entry"); +const interface_1 = require("./interface"); +const recorder_1 = require("./recorder"); +const scoped_1 = require("./scoped"); +let _uniqueId = 0; +class HostDirEntry { + constructor(parent, path, _host, _tree) { + this.parent = parent; + this.path = path; + this._host = _host; + this._tree = _tree; + } + get subdirs() { + return this._host + .list(this.path) + .filter((fragment) => this._host.isDirectory((0, core_1.join)(this.path, fragment))); + } + get subfiles() { + return this._host + .list(this.path) + .filter((fragment) => this._host.isFile((0, core_1.join)(this.path, fragment))); + } + dir(name) { + return this._tree.getDir((0, core_1.join)(this.path, name)); + } + file(name) { + return this._tree.get((0, core_1.join)(this.path, name)); + } + visit(visitor) { + try { + this.getSubfilesRecursively().forEach((file) => visitor(file.path, file)); + } + catch (e) { + if (e !== interface_1.FileVisitorCancelToken) { + throw e; + } + } + } + getSubfilesRecursively() { + function _recurse(entry) { + return entry.subdirs.reduce((files, subdir) => [...files, ..._recurse(entry.dir(subdir))], entry.subfiles.map((subfile) => entry.file(subfile))); + } + return _recurse(this); + } +} +exports.HostDirEntry = HostDirEntry; +class HostTree { + constructor(_backend = new core_1.virtualFs.Empty()) { + this._backend = _backend; + this._id = --_uniqueId; + this._ancestry = new Set(); + this._dirCache = new Map(); + this._record = new core_1.virtualFs.CordHost(new core_1.virtualFs.SafeReadonlyHost(_backend)); + this._recordSync = new core_1.virtualFs.SyncDelegateHost(this._record); + } + [interface_1.TreeSymbol]() { + return this; + } + static isHostTree(tree) { + if (tree instanceof HostTree) { + return true; + } + if (typeof tree === 'object' && typeof tree._ancestry === 'object') { + return true; + } + return false; + } + _normalizePath(path) { + return (0, core_1.normalize)('/' + path); + } + _willCreate(path) { + return this._record.willCreate(path); + } + _willOverwrite(path) { + return this._record.willOverwrite(path); + } + _willDelete(path) { + return this._record.willDelete(path); + } + _willRename(path) { + return this._record.willRename(path); + } + branch() { + const branchedTree = new HostTree(this._backend); + branchedTree._record = this._record.clone(); + branchedTree._recordSync = new core_1.virtualFs.SyncDelegateHost(branchedTree._record); + branchedTree._ancestry = new Set(this._ancestry).add(this._id); + return branchedTree; + } + isAncestorOf(tree) { + if (tree instanceof HostTree) { + return tree._ancestry.has(this._id); + } + if (tree instanceof delegate_1.DelegateTree) { + return this.isAncestorOf(tree._other); + } + if (tree instanceof scoped_1.ScopedTree) { + return this.isAncestorOf(tree._base); + } + return false; + } + merge(other, strategy = interface_1.MergeStrategy.Default) { + if (other === this) { + // Merging with yourself? Tsk tsk. Nothing to do at least. + return; + } + if (this.isAncestorOf(other)) { + // Workaround for merging a branch back into one of its ancestors + // More complete branch point tracking is required to avoid + strategy |= interface_1.MergeStrategy.Overwrite; + } + const creationConflictAllowed = (strategy & interface_1.MergeStrategy.AllowCreationConflict) == interface_1.MergeStrategy.AllowCreationConflict; + const overwriteConflictAllowed = (strategy & interface_1.MergeStrategy.AllowOverwriteConflict) == interface_1.MergeStrategy.AllowOverwriteConflict; + const deleteConflictAllowed = (strategy & interface_1.MergeStrategy.AllowDeleteConflict) == interface_1.MergeStrategy.AllowDeleteConflict; + other.actions.forEach((action) => { + switch (action.kind) { + case 'c': { + const { path, content } = action; + if (this._willCreate(path) || this._willOverwrite(path) || this.exists(path)) { + const existingContent = this.read(path); + if (existingContent && content.equals(existingContent)) { + // Identical outcome; no action required + return; + } + if (!creationConflictAllowed) { + throw new exception_1.MergeConflictException(path); + } + this._record.overwrite(path, content).subscribe(); + } + else { + this._record.create(path, content).subscribe(); + } + return; + } + case 'o': { + const { path, content } = action; + if (this._willDelete(path) && !overwriteConflictAllowed) { + throw new exception_1.MergeConflictException(path); + } + // Ignore if content is the same (considered the same change). + if (this._willOverwrite(path)) { + const existingContent = this.read(path); + if (existingContent && content.equals(existingContent)) { + // Identical outcome; no action required + return; + } + if (!overwriteConflictAllowed) { + throw new exception_1.MergeConflictException(path); + } + } + // We use write here as merge validation has already been done, and we want to let + // the CordHost do its job. + this._record.write(path, content).subscribe(); + return; + } + case 'r': { + const { path, to } = action; + if (this._willDelete(path)) { + throw new exception_1.MergeConflictException(path); + } + if (this._willRename(path)) { + if (this._record.willRenameTo(path, to)) { + // Identical outcome; no action required + return; + } + // No override possible for renaming. + throw new exception_1.MergeConflictException(path); + } + this.rename(path, to); + return; + } + case 'd': { + const { path } = action; + if (this._willDelete(path)) { + // TODO: This should technically check the content (e.g., hash on delete) + // Identical outcome; no action required + return; + } + if (!this.exists(path) && !deleteConflictAllowed) { + throw new exception_1.MergeConflictException(path); + } + this._recordSync.delete(path); + return; + } + } + }); + } + get root() { + return this.getDir('/'); + } + // Readonly. + read(path) { + const entry = this.get(path); + return entry ? entry.content : null; + } + exists(path) { + return this._recordSync.isFile(this._normalizePath(path)); + } + get(path) { + const p = this._normalizePath(path); + if (this._recordSync.isDirectory(p)) { + throw new core_1.PathIsDirectoryException(p); + } + if (!this._recordSync.exists(p)) { + return null; + } + return new entry_1.LazyFileEntry(p, () => Buffer.from(this._recordSync.read(p))); + } + getDir(path) { + const p = this._normalizePath(path); + if (this._recordSync.isFile(p)) { + throw new core_1.PathIsFileException(p); + } + let maybeCache = this._dirCache.get(p); + if (!maybeCache) { + let parent = (0, core_1.dirname)(p); + if (p === parent) { + parent = null; + } + maybeCache = new HostDirEntry(parent && this.getDir(parent), p, this._recordSync, this); + this._dirCache.set(p, maybeCache); + } + return maybeCache; + } + visit(visitor) { + this.root.visit((path, entry) => { + visitor(path, entry); + }); + } + // Change content of host files. + overwrite(path, content) { + const p = this._normalizePath(path); + if (!this._recordSync.exists(p)) { + throw new exception_1.FileDoesNotExistException(p); + } + const c = typeof content == 'string' ? Buffer.from(content) : content; + this._record.overwrite(p, c).subscribe(); + } + beginUpdate(path) { + const entry = this.get(path); + if (!entry) { + throw new exception_1.FileDoesNotExistException(path); + } + return recorder_1.UpdateRecorderBase.createFromFileEntry(entry); + } + commitUpdate(record) { + if (record instanceof recorder_1.UpdateRecorderBase) { + const path = record.path; + const entry = this.get(path); + if (!entry) { + throw new exception_1.ContentHasMutatedException(path); + } + else { + const newContent = record.apply(entry.content); + if (!newContent.equals(entry.content)) { + this.overwrite(path, newContent); + } + } + } + else { + throw new exception_1.InvalidUpdateRecordException(); + } + } + // Structural methods. + create(path, content) { + const p = this._normalizePath(path); + if (this._recordSync.exists(p)) { + throw new exception_1.FileAlreadyExistException(p); + } + const c = typeof content == 'string' ? Buffer.from(content) : content; + this._record.create(p, c).subscribe(); + } + delete(path) { + this._recordSync.delete(this._normalizePath(path)); + } + rename(from, to) { + this._recordSync.rename(this._normalizePath(from), this._normalizePath(to)); + } + apply(action, strategy) { + throw new exception_1.SchematicsException('Apply not implemented on host trees.'); + } + *generateActions() { + for (const record of this._record.records()) { + switch (record.kind) { + case 'create': + yield { + id: this._id, + parent: 0, + kind: 'c', + path: record.path, + content: Buffer.from(record.content), + }; + break; + case 'overwrite': + yield { + id: this._id, + parent: 0, + kind: 'o', + path: record.path, + content: Buffer.from(record.content), + }; + break; + case 'rename': + yield { + id: this._id, + parent: 0, + kind: 'r', + path: record.from, + to: record.to, + }; + break; + case 'delete': + yield { + id: this._id, + parent: 0, + kind: 'd', + path: record.path, + }; + break; + } + } + } + get actions() { + // Create a list of all records until we hit our original backend. This is to support branches + // that diverge from each others. + return Array.from(this.generateActions()); + } +} +exports.HostTree = HostTree; +class HostCreateTree extends HostTree { + constructor(host) { + super(); + const tempHost = new HostTree(host); + tempHost.visit((path) => { + const content = tempHost.read(path); + if (content) { + this.create(path, content); + } + }); + } +} +exports.HostCreateTree = HostCreateTree; +class FilterHostTree extends HostTree { + constructor(tree, filter = () => true) { + const newBackend = new core_1.virtualFs.SimpleMemoryHost(); + // cast to allow access + const originalBackend = tree._backend; + const recurse = (base) => { + return originalBackend.list(base).pipe((0, operators_1.mergeMap)((x) => x), (0, operators_1.map)((path) => (0, core_1.join)(base, path)), (0, operators_1.concatMap)((path) => { + let isDirectory = false; + originalBackend.isDirectory(path).subscribe((val) => (isDirectory = val)); + if (isDirectory) { + return recurse(path); + } + let isFile = false; + originalBackend.isFile(path).subscribe((val) => (isFile = val)); + if (!isFile || !filter(path)) { + return rxjs_1.EMPTY; + } + let content = null; + originalBackend.read(path).subscribe((val) => (content = val)); + if (!content) { + return rxjs_1.EMPTY; + } + return newBackend.write(path, content); + })); + }; + recurse((0, core_1.normalize)('/')).subscribe(); + super(newBackend); + for (const action of tree.actions) { + if (!filter(action.path)) { + continue; + } + switch (action.kind) { + case 'c': + this.create(action.path, action.content); + break; + case 'd': + this.delete(action.path); + break; + case 'o': + this.overwrite(action.path, action.content); + break; + case 'r': + this.rename(action.path, action.to); + break; + } + } + } +} +exports.FilterHostTree = FilterHostTree; diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/tree/interface.d.ts b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/tree/interface.d.ts new file mode 100644 index 00000000..168e0591 --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/tree/interface.d.ts @@ -0,0 +1,61 @@ +/** + * @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, PathFragment } from '@angular-devkit/core'; +import { Action } from './action'; +export declare enum MergeStrategy { + AllowOverwriteConflict = 2, + AllowCreationConflict = 4, + AllowDeleteConflict = 8, + Default = 0, + Error = 1, + ContentOnly = 2, + Overwrite = 14 +} +export declare const FileVisitorCancelToken: symbol; +export declare type FileVisitor = FilePredicate<void>; +export interface FileEntry { + readonly path: Path; + readonly content: Buffer; +} +export interface DirEntry { + readonly parent: DirEntry | null; + readonly path: Path; + readonly subdirs: PathFragment[]; + readonly subfiles: PathFragment[]; + dir(name: PathFragment): DirEntry; + file(name: PathFragment): FileEntry | null; + visit(visitor: FileVisitor): void; +} +export interface FilePredicate<T> { + (path: Path, entry?: Readonly<FileEntry> | null): T; +} +export declare const TreeSymbol: symbol; +export interface Tree { + branch(): Tree; + merge(other: Tree, strategy?: MergeStrategy): void; + readonly root: DirEntry; + read(path: string): Buffer | null; + exists(path: string): boolean; + get(path: string): FileEntry | null; + getDir(path: string): DirEntry; + visit(visitor: FileVisitor): void; + overwrite(path: string, content: Buffer | string): void; + beginUpdate(path: string): UpdateRecorder; + commitUpdate(record: UpdateRecorder): void; + create(path: string, content: Buffer | string): void; + delete(path: string): void; + rename(from: string, to: string): void; + apply(action: Action, strategy?: MergeStrategy): void; + readonly actions: Action[]; +} +export interface UpdateRecorder { + insertLeft(index: number, content: Buffer | string): UpdateRecorder; + insertRight(index: number, content: Buffer | string): UpdateRecorder; + remove(index: number, length: number): UpdateRecorder; +} diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/tree/interface.js b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/tree/interface.js new file mode 100644 index 00000000..b8ac1141 --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/tree/interface.js @@ -0,0 +1,47 @@ +"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.TreeSymbol = exports.FileVisitorCancelToken = exports.MergeStrategy = void 0; +var MergeStrategy; +(function (MergeStrategy) { + MergeStrategy[MergeStrategy["AllowOverwriteConflict"] = 2] = "AllowOverwriteConflict"; + MergeStrategy[MergeStrategy["AllowCreationConflict"] = 4] = "AllowCreationConflict"; + MergeStrategy[MergeStrategy["AllowDeleteConflict"] = 8] = "AllowDeleteConflict"; + // Uses the default strategy. + MergeStrategy[MergeStrategy["Default"] = 0] = "Default"; + // Error out if 2 files have the same path. It is useful to have a different value than + // Default in this case as the tooling Default might differ. + MergeStrategy[MergeStrategy["Error"] = 1] = "Error"; + // Only content conflicts are overwritten. + MergeStrategy[MergeStrategy["ContentOnly"] = 2] = "ContentOnly"; + // Overwrite everything with the latest change. + MergeStrategy[MergeStrategy["Overwrite"] = 14] = "Overwrite"; +})(MergeStrategy = exports.MergeStrategy || (exports.MergeStrategy = {})); +// eslint-disable-next-line @typescript-eslint/no-inferrable-types +exports.FileVisitorCancelToken = Symbol(); +exports.TreeSymbol = (function () { + const globalSymbol = (typeof window == 'object' && window.window === window && window.Symbol) || + (typeof self == 'object' && self.self === self && self.Symbol) || + (typeof global == 'object' && global.global === global && global.Symbol); + if (!globalSymbol) { + return Symbol('schematic-tree'); + } + if (!globalSymbol.schematicTree) { + globalSymbol.schematicTree = Symbol('schematic-tree'); + } + return globalSymbol.schematicTree; +})(); +// eslint-disable-next-line @typescript-eslint/no-namespace +var Tree; +(function (Tree) { + function isTree(maybeTree) { + return exports.TreeSymbol in maybeTree; + } + Tree.isTree = isTree; +})(Tree || (Tree = {})); diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/tree/null.d.ts b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/tree/null.d.ts new file mode 100644 index 00000000..0a7ac06a --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/tree/null.d.ts @@ -0,0 +1,43 @@ +/** + * @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 { BaseException, Path, PathFragment } from '@angular-devkit/core'; +import { Action } from './action'; +import { DirEntry, MergeStrategy, Tree, UpdateRecorder } from './interface'; +export declare class CannotCreateFileException extends BaseException { + constructor(path: string); +} +export declare class NullTreeDirEntry implements DirEntry { + readonly path: Path; + get parent(): DirEntry | null; + constructor(path: Path); + readonly subdirs: PathFragment[]; + readonly subfiles: PathFragment[]; + dir(name: PathFragment): DirEntry; + file(_name: PathFragment): null; + visit(): void; +} +export declare class NullTree implements Tree { + branch(): Tree; + merge(_other: Tree, _strategy?: MergeStrategy): void; + readonly root: DirEntry; + exists(_path: string): boolean; + read(_path: string): null; + get(_path: string): null; + getDir(path: string): NullTreeDirEntry; + visit(): void; + beginUpdate(path: string): never; + commitUpdate(record: UpdateRecorder): never; + copy(path: string, _to: string): never; + delete(path: string): never; + create(path: string, _content: Buffer | string): never; + rename(path: string, _to: string): never; + overwrite(path: string, _content: Buffer | string): never; + apply(_action: Action, _strategy?: MergeStrategy): void; + get actions(): Action[]; +} diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/tree/null.js b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/tree/null.js new file mode 100644 index 00000000..007e5bbe --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/tree/null.js @@ -0,0 +1,92 @@ +"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.NullTree = exports.NullTreeDirEntry = exports.CannotCreateFileException = void 0; +const core_1 = require("@angular-devkit/core"); +const exception_1 = require("../exception/exception"); +const interface_1 = require("./interface"); +const recorder_1 = require("./recorder"); +class CannotCreateFileException extends core_1.BaseException { + constructor(path) { + super(`Cannot create file "${path}".`); + } +} +exports.CannotCreateFileException = CannotCreateFileException; +class NullTreeDirEntry { + constructor(path) { + this.path = path; + this.subdirs = []; + this.subfiles = []; + } + get parent() { + return this.path == '/' ? null : new NullTreeDirEntry((0, core_1.dirname)(this.path)); + } + dir(name) { + return new NullTreeDirEntry((0, core_1.join)(this.path, name)); + } + file(_name) { + return null; + } + visit() { } +} +exports.NullTreeDirEntry = NullTreeDirEntry; +class NullTree { + constructor() { + this.root = new NullTreeDirEntry((0, core_1.normalize)('/')); + } + [interface_1.TreeSymbol]() { + return this; + } + branch() { + return new NullTree(); + } + merge(_other, _strategy) { } + // Simple readonly file system operations. + exists(_path) { + return false; + } + read(_path) { + return null; + } + get(_path) { + return null; + } + getDir(path) { + return new NullTreeDirEntry((0, core_1.normalize)('/' + path)); + } + visit() { } + // Change content of host files. + beginUpdate(path) { + throw new exception_1.FileDoesNotExistException(path); + } + commitUpdate(record) { + throw new exception_1.FileDoesNotExistException(record instanceof recorder_1.UpdateRecorderBase ? record.path : '<unknown>'); + } + // Change structure of the host. + copy(path, _to) { + throw new exception_1.FileDoesNotExistException(path); + } + delete(path) { + throw new exception_1.FileDoesNotExistException(path); + } + create(path, _content) { + throw new CannotCreateFileException(path); + } + rename(path, _to) { + throw new exception_1.FileDoesNotExistException(path); + } + overwrite(path, _content) { + throw new exception_1.FileDoesNotExistException(path); + } + apply(_action, _strategy) { } + get actions() { + return []; + } +} +exports.NullTree = NullTree; diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/tree/recorder.d.ts b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/tree/recorder.d.ts new file mode 100644 index 00000000..21dc6b6e --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/tree/recorder.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 { UpdateBufferBase } from '../utility/update-buffer'; +import { FileEntry, UpdateRecorder } from './interface'; +export declare class UpdateRecorderBase implements UpdateRecorder { + protected _path: string; + protected _original: Buffer; + protected _content: UpdateBufferBase; + constructor(entry: FileEntry); + static createFromFileEntry(entry: FileEntry): UpdateRecorderBase; + get path(): string; + insertLeft(index: number, content: Buffer | string): UpdateRecorder; + insertRight(index: number, content: Buffer | string): UpdateRecorder; + remove(index: number, length: number): UpdateRecorder; + apply(content: Buffer): Buffer; +} +export declare class UpdateRecorderBom extends UpdateRecorderBase { + private _delta; + constructor(entry: FileEntry, _delta?: number); + insertLeft(index: number, content: Buffer | string): UpdateRecorder; + insertRight(index: number, content: Buffer | string): UpdateRecorder; + remove(index: number, length: number): UpdateRecorder; +} diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/tree/recorder.js b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/tree/recorder.js new file mode 100644 index 00000000..b05ef116 --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/tree/recorder.js @@ -0,0 +1,74 @@ +"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.UpdateRecorderBom = exports.UpdateRecorderBase = void 0; +const exception_1 = require("../exception/exception"); +const update_buffer_1 = require("../utility/update-buffer"); +class UpdateRecorderBase { + constructor(entry) { + this._original = Buffer.from(entry.content); + this._content = update_buffer_1.UpdateBufferBase.create(entry.content); + this._path = entry.path; + } + static createFromFileEntry(entry) { + const c0 = entry.content.byteLength > 0 && entry.content.readUInt8(0); + const c1 = entry.content.byteLength > 1 && entry.content.readUInt8(1); + const c2 = entry.content.byteLength > 2 && entry.content.readUInt8(2); + // Check if we're BOM. + if (c0 == 0xef && c1 == 0xbb && c2 == 0xbf) { + return new UpdateRecorderBom(entry); + } + else if (c0 === 0xff && c1 == 0xfe) { + return new UpdateRecorderBom(entry); + } + else if (c0 === 0xfe && c1 == 0xff) { + return new UpdateRecorderBom(entry); + } + return new UpdateRecorderBase(entry); + } + get path() { + return this._path; + } + // These just record changes. + insertLeft(index, content) { + this._content.insertLeft(index, typeof content == 'string' ? Buffer.from(content) : content); + return this; + } + insertRight(index, content) { + this._content.insertRight(index, typeof content == 'string' ? Buffer.from(content) : content); + return this; + } + remove(index, length) { + this._content.remove(index, length); + return this; + } + apply(content) { + if (!content.equals(this._content.original)) { + throw new exception_1.ContentHasMutatedException(this.path); + } + return this._content.generate(); + } +} +exports.UpdateRecorderBase = UpdateRecorderBase; +class UpdateRecorderBom extends UpdateRecorderBase { + constructor(entry, _delta = 1) { + super(entry); + this._delta = _delta; + } + insertLeft(index, content) { + return super.insertLeft(index + this._delta, content); + } + insertRight(index, content) { + return super.insertRight(index + this._delta, content); + } + remove(index, length) { + return super.remove(index + this._delta, length); + } +} +exports.UpdateRecorderBom = UpdateRecorderBom; diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/tree/scoped.d.ts b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/tree/scoped.d.ts new file mode 100644 index 00000000..4884d693 --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/tree/scoped.d.ts @@ -0,0 +1,47 @@ +/** + * @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, PathFragment } from '@angular-devkit/core'; +import { Action } from './action'; +import { DirEntry, FileEntry, FileVisitor, MergeStrategy, Tree, UpdateRecorder } from './interface'; +declare class ScopedDirEntry implements DirEntry { + private _base; + readonly scope: Path; + constructor(_base: DirEntry, scope: Path); + get parent(): DirEntry | null; + get path(): Path; + get subdirs(): PathFragment[]; + get subfiles(): PathFragment[]; + dir(name: PathFragment): DirEntry; + file(name: PathFragment): FileEntry | null; + visit(visitor: FileVisitor): void; +} +export declare class ScopedTree implements Tree { + private _base; + readonly _root: ScopedDirEntry; + constructor(_base: Tree, scope: string); + get root(): DirEntry; + branch(): Tree; + merge(other: Tree, strategy?: MergeStrategy): void; + read(path: string): Buffer | null; + exists(path: string): boolean; + get(path: string): FileEntry | null; + getDir(path: string): DirEntry; + visit(visitor: FileVisitor): void; + overwrite(path: string, content: Buffer | string): void; + beginUpdate(path: string): UpdateRecorder; + commitUpdate(record: UpdateRecorder): void; + create(path: string, content: Buffer | string): void; + delete(path: string): void; + rename(from: string, to: string): void; + apply(action: Action, strategy?: MergeStrategy): void; + get actions(): Action[]; + private _fullPath; + private _fullPathAction; +} +export {}; diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/tree/scoped.js b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/tree/scoped.js new file mode 100644 index 00000000..61cc0049 --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/tree/scoped.js @@ -0,0 +1,169 @@ +"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.ScopedTree = void 0; +const core_1 = require("@angular-devkit/core"); +const delegate_1 = require("./delegate"); +const interface_1 = require("./interface"); +class ScopedFileEntry { + constructor(_base, scope) { + this._base = _base; + this.scope = scope; + } + get path() { + return (0, core_1.join)(core_1.NormalizedRoot, (0, core_1.relative)(this.scope, this._base.path)); + } + get content() { + return this._base.content; + } +} +class ScopedDirEntry { + constructor(_base, scope) { + this._base = _base; + this.scope = scope; + } + get parent() { + if (!this._base.parent || this._base.path == this.scope) { + return null; + } + return new ScopedDirEntry(this._base.parent, this.scope); + } + get path() { + return (0, core_1.join)(core_1.NormalizedRoot, (0, core_1.relative)(this.scope, this._base.path)); + } + get subdirs() { + return this._base.subdirs; + } + get subfiles() { + return this._base.subfiles; + } + dir(name) { + const entry = this._base.dir(name); + return entry && new ScopedDirEntry(entry, this.scope); + } + file(name) { + const entry = this._base.file(name); + return entry && new ScopedFileEntry(entry, this.scope); + } + visit(visitor) { + return this._base.visit((path, entry) => { + visitor((0, core_1.join)(core_1.NormalizedRoot, (0, core_1.relative)(this.scope, path)), entry && new ScopedFileEntry(entry, this.scope)); + }); + } +} +class ScopedTree { + constructor(_base, scope) { + this._base = _base; + const normalizedScope = (0, core_1.normalize)('/' + scope); + this._root = new ScopedDirEntry(this._base.getDir(normalizedScope), normalizedScope); + } + get root() { + return this._root; + } + branch() { + return new ScopedTree(this._base.branch(), this._root.scope); + } + merge(other, strategy) { + // eslint-disable-next-line @typescript-eslint/no-this-alias + const self = this; + const delegate = new (class extends delegate_1.DelegateTree { + get actions() { + return other.actions.map((action) => self._fullPathAction(action)); + } + })(other); + this._base.merge(delegate, strategy); + } + // Readonly. + read(path) { + return this._base.read(this._fullPath(path)); + } + exists(path) { + return this._base.exists(this._fullPath(path)); + } + get(path) { + const entry = this._base.get(this._fullPath(path)); + return entry && new ScopedFileEntry(entry, this._root.scope); + } + getDir(path) { + const entry = this._base.getDir(this._fullPath(path)); + return entry && new ScopedDirEntry(entry, this._root.scope); + } + visit(visitor) { + return this._root.visit(visitor); + } + // Change content of host files. + overwrite(path, content) { + return this._base.overwrite(this._fullPath(path), content); + } + beginUpdate(path) { + return this._base.beginUpdate(this._fullPath(path)); + } + commitUpdate(record) { + return this._base.commitUpdate(record); + } + // Structural methods. + create(path, content) { + return this._base.create(this._fullPath(path), content); + } + delete(path) { + return this._base.delete(this._fullPath(path)); + } + rename(from, to) { + return this._base.rename(this._fullPath(from), this._fullPath(to)); + } + apply(action, strategy) { + return this._base.apply(this._fullPathAction(action), strategy); + } + get actions() { + const scopedActions = []; + for (const action of this._base.actions) { + if (!action.path.startsWith(this._root.scope + '/')) { + continue; + } + if (action.kind !== 'r') { + scopedActions.push({ + ...action, + path: (0, core_1.join)(core_1.NormalizedRoot, (0, core_1.relative)(this._root.scope, action.path)), + }); + } + else if (action.to.startsWith(this._root.scope + '/')) { + scopedActions.push({ + ...action, + path: (0, core_1.join)(core_1.NormalizedRoot, (0, core_1.relative)(this._root.scope, action.path)), + to: (0, core_1.join)(core_1.NormalizedRoot, (0, core_1.relative)(this._root.scope, action.to)), + }); + } + } + return scopedActions; + } + [interface_1.TreeSymbol]() { + return this; + } + _fullPath(path) { + return (0, core_1.join)(this._root.scope, (0, core_1.normalize)('/' + path)); + } + _fullPathAction(action) { + let fullPathAction; + if (action.kind === 'r') { + fullPathAction = { + ...action, + path: this._fullPath(action.path), + to: this._fullPath(action.to), + }; + } + else { + fullPathAction = { + ...action, + path: this._fullPath(action.path), + }; + } + return fullPathAction; + } +} +exports.ScopedTree = ScopedTree; diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/tree/static.d.ts b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/tree/static.d.ts new file mode 100644 index 00000000..9b7062ab --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/tree/static.d.ts @@ -0,0 +1,13 @@ +/** + * @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 + */ +import { HostTree } from './host-tree'; +import { FilePredicate, MergeStrategy, Tree } from './interface'; +export declare function empty(): HostTree; +export declare function branch(tree: Tree): Tree; +export declare function merge(tree: Tree, other: Tree, strategy?: MergeStrategy): Tree; +export declare function partition(tree: Tree, predicate: FilePredicate<boolean>): [Tree, Tree]; diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/tree/static.js b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/tree/static.js new file mode 100644 index 00000000..70b5293c --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/tree/static.js @@ -0,0 +1,38 @@ +"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.partition = exports.merge = exports.branch = exports.empty = void 0; +const exception_1 = require("../exception/exception"); +const host_tree_1 = require("./host-tree"); +const interface_1 = require("./interface"); +function empty() { + return new host_tree_1.HostTree(); +} +exports.empty = empty; +function branch(tree) { + return tree.branch(); +} +exports.branch = branch; +function merge(tree, other, strategy = interface_1.MergeStrategy.Default) { + tree.merge(other, strategy); + return tree; +} +exports.merge = merge; +function partition(tree, predicate) { + if (tree instanceof host_tree_1.HostTree) { + return [ + new host_tree_1.FilterHostTree(tree, predicate), + new host_tree_1.FilterHostTree(tree, (path, entry) => !predicate(path, entry)), + ]; + } + else { + throw new exception_1.SchematicsException('Tree type is not supported.'); + } +} +exports.partition = partition; diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/utility/environment-options.d.ts b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/utility/environment-options.d.ts new file mode 100644 index 00000000..01f356cb --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/utility/environment-options.d.ts @@ -0,0 +1,8 @@ +/** + * @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 + */ +export declare const updateBufferV2Enabled: boolean; diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/utility/environment-options.js b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/utility/environment-options.js new file mode 100644 index 00000000..a33531c4 --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/utility/environment-options.js @@ -0,0 +1,20 @@ +"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.updateBufferV2Enabled = void 0; +function isEnabled(variable) { + return variable === '1' || variable.toLowerCase() === 'true'; +} +function isPresent(variable) { + return typeof variable === 'string' && variable !== ''; +} +// Use UpdateBuffer2, which uses magic-string internally. +// TODO: Switch this for the next major release to use UpdateBuffer2 by default. +const updateBufferV2 = process.env['NG_UPDATE_BUFFER_V2']; +exports.updateBufferV2Enabled = isPresent(updateBufferV2) && isEnabled(updateBufferV2); diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/utility/linked-list.d.ts b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/utility/linked-list.d.ts new file mode 100644 index 00000000..721aa6b7 --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/utility/linked-list.d.ts @@ -0,0 +1,19 @@ +/** + * @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 + */ +export declare class LinkedList<T extends { + next: T | null; +}> { + private _head; + constructor(_head: T); + get(l: number): T | null; + get head(): T; + get length(): number; + reduce<R>(accumulator: (acc: R, value: T, index?: number) => R, seed: R): R; + find(predicate: (value: T, index?: number) => boolean): T | null; + forEach(visitor: (value: T, index?: number) => void): void; +} diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/utility/linked-list.js b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/utility/linked-list.js new file mode 100644 index 00000000..847cdcd8 --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/utility/linked-list.js @@ -0,0 +1,68 @@ +"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.LinkedList = void 0; +class LinkedList { + constructor(_head) { + this._head = _head; + } + get(l) { + let c = this._head; + while (c && l > 0) { + l--; + c = c.next; + } + return c; + } + get head() { + return this._head; + } + get length() { + let c = this._head; + let i = 0; + while (c) { + i++; + c = c.next; + } + return i; + } + reduce(accumulator, seed) { + let c = this._head; + let acc = seed; + let i = 0; + while (c) { + acc = accumulator(acc, c, i); + i++; + c = c.next; + } + return acc; + } + find(predicate) { + let c = this._head; + let i = 0; + while (c) { + if (predicate(c, i)) { + break; + } + i++; + c = c.next; + } + return c; + } + forEach(visitor) { + let c = this._head; + let i = 0; + while (c) { + visitor(c, i); + i++; + c = c.next; + } + } +} +exports.LinkedList = LinkedList; diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/utility/update-buffer.d.ts b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/utility/update-buffer.d.ts new file mode 100644 index 00000000..7a7ec1bf --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/utility/update-buffer.d.ts @@ -0,0 +1,118 @@ +/** + * @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 { BaseException } from '@angular-devkit/core'; +import MagicString from 'magic-string'; +import { LinkedList } from './linked-list'; +export declare class IndexOutOfBoundException extends BaseException { + constructor(index: number, min: number, max?: number); +} +/** @deprecated Since v13.0 */ +export declare class ContentCannotBeRemovedException extends BaseException { + constructor(); +} +/** + * A Chunk description, including left/right content that has been inserted. + * If _left/_right is null, this means that content was deleted. If the _content is null, + * it means the content itself was deleted. + * + * @see UpdateBuffer + * @deprecated Since v13.0 + */ +export declare class Chunk { + start: number; + end: number; + originalContent: Buffer; + private _content; + private _left; + private _right; + private _assertLeft; + private _assertRight; + next: Chunk | null; + constructor(start: number, end: number, originalContent: Buffer); + get length(): number; + toString(encoding?: BufferEncoding): string; + slice(start: number): Chunk; + append(buffer: Buffer, essential: boolean): void; + prepend(buffer: Buffer, essential: boolean): void; + assert(left: boolean, _content: boolean, right: boolean): void; + remove(left: boolean, content: boolean, right: boolean): void; + copy(target: Buffer, start: number): number; +} +/** + * Base class for an update buffer implementation that allows buffers to be inserted to the _right + * or _left, or deleted, while keeping indices to the original buffer. + */ +export declare abstract class UpdateBufferBase { + protected _originalContent: Buffer; + constructor(_originalContent: Buffer); + abstract get length(): number; + abstract get original(): Buffer; + abstract toString(encoding?: string): string; + abstract generate(): Buffer; + abstract insertLeft(index: number, content: Buffer, assert?: boolean): void; + abstract insertRight(index: number, content: Buffer, assert?: boolean): void; + abstract remove(index: number, length: number): void; + /** + * Creates an UpdateBufferBase instance. Depending on the NG_UPDATE_BUFFER_V2 + * environment variable, will either create an UpdateBuffer or an UpdateBuffer2 + * instance. + * + * See: https://github.com/angular/angular-cli/issues/21110 + * + * @param originalContent The original content of the update buffer instance. + * @returns An UpdateBufferBase instance. + */ + static create(originalContent: Buffer): UpdateBufferBase; +} +/** + * An utility class that allows buffers to be inserted to the _right or _left, or deleted, while + * keeping indices to the original buffer. + * + * The constructor takes an original buffer, and keeps it into a linked list of chunks, smaller + * buffers that keep track of _content inserted to the _right or _left of it. + * + * Since the Node Buffer structure is non-destructive when slicing, we try to use slicing to create + * new chunks, and always keep chunks pointing to the original content. + * + * @deprecated Since v13.0 + */ +export declare class UpdateBuffer extends UpdateBufferBase { + protected _linkedList: LinkedList<Chunk>; + constructor(originalContent: Buffer); + protected _assertIndex(index: number): void; + protected _slice(start: number): [Chunk, Chunk]; + /** + * Gets the position in the content based on the position in the string. + * Some characters might be wider than one byte, thus we have to determine the position using + * string functions. + */ + protected _getTextPosition(index: number): number; + get length(): number; + get original(): Buffer; + toString(encoding?: BufferEncoding): string; + generate(): Buffer; + insertLeft(index: number, content: Buffer, assert?: boolean): void; + insertRight(index: number, content: Buffer, assert?: boolean): void; + remove(index: number, length: number): void; +} +/** + * An utility class that allows buffers to be inserted to the _right or _left, or deleted, while + * keeping indices to the original buffer. + */ +export declare class UpdateBuffer2 extends UpdateBufferBase { + protected _mutatableContent: MagicString; + protected _assertIndex(index: number): void; + get length(): number; + get original(): Buffer; + toString(): string; + generate(): Buffer; + insertLeft(index: number, content: Buffer): void; + insertRight(index: number, content: Buffer): void; + remove(index: number, length: number): void; +} diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/utility/update-buffer.js b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/utility/update-buffer.js new file mode 100644 index 00000000..03f20846 --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/utility/update-buffer.js @@ -0,0 +1,324 @@ +"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 + */ +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.UpdateBuffer2 = exports.UpdateBuffer = exports.UpdateBufferBase = exports.Chunk = exports.ContentCannotBeRemovedException = exports.IndexOutOfBoundException = void 0; +const core_1 = require("@angular-devkit/core"); +const magic_string_1 = __importDefault(require("magic-string")); +const environment_options_1 = require("./environment-options"); +const linked_list_1 = require("./linked-list"); +class IndexOutOfBoundException extends core_1.BaseException { + constructor(index, min, max = Infinity) { + super(`Index ${index} outside of range [${min}, ${max}].`); + } +} +exports.IndexOutOfBoundException = IndexOutOfBoundException; +/** @deprecated Since v13.0 */ +class ContentCannotBeRemovedException extends core_1.BaseException { + constructor() { + super(`User tried to remove content that was marked essential.`); + } +} +exports.ContentCannotBeRemovedException = ContentCannotBeRemovedException; +/** + * A Chunk description, including left/right content that has been inserted. + * If _left/_right is null, this means that content was deleted. If the _content is null, + * it means the content itself was deleted. + * + * @see UpdateBuffer + * @deprecated Since v13.0 + */ +class Chunk { + constructor(start, end, originalContent) { + this.start = start; + this.end = end; + this.originalContent = originalContent; + this._left = Buffer.alloc(0); + this._right = Buffer.alloc(0); + this._assertLeft = false; + this._assertRight = false; + this.next = null; + this._content = originalContent.slice(start, end); + } + get length() { + return ((this._left ? this._left.length : 0) + + (this._content ? this._content.length : 0) + + (this._right ? this._right.length : 0)); + } + toString(encoding = 'utf-8') { + return ((this._left ? this._left.toString(encoding) : '') + + (this._content ? this._content.toString(encoding) : '') + + (this._right ? this._right.toString(encoding) : '')); + } + slice(start) { + if (start < this.start || start > this.end) { + throw new IndexOutOfBoundException(start, this.start, this.end); + } + // Update _content to the new indices. + const newChunk = new Chunk(start, this.end, this.originalContent); + // If this chunk has _content, reslice the original _content. We move the _right so we are not + // losing any data here. If this chunk has been deleted, the next chunk should also be deleted. + if (this._content) { + this._content = this.originalContent.slice(this.start, start); + } + else { + newChunk._content = this._content; + if (this._right === null) { + newChunk._left = null; + } + } + this.end = start; + // Move _right to the new chunk. + newChunk._right = this._right; + this._right = this._right && Buffer.alloc(0); + // Update essentials. + if (this._assertRight) { + newChunk._assertRight = true; + this._assertRight = false; + } + // Update the linked list. + newChunk.next = this.next; + this.next = newChunk; + return newChunk; + } + append(buffer, essential) { + if (!this._right) { + if (essential) { + throw new ContentCannotBeRemovedException(); + } + return; + } + const outro = this._right; + this._right = Buffer.alloc(outro.length + buffer.length); + outro.copy(this._right, 0); + buffer.copy(this._right, outro.length); + if (essential) { + this._assertRight = true; + } + } + prepend(buffer, essential) { + if (!this._left) { + if (essential) { + throw new ContentCannotBeRemovedException(); + } + return; + } + const intro = this._left; + this._left = Buffer.alloc(intro.length + buffer.length); + intro.copy(this._left, 0); + buffer.copy(this._left, intro.length); + if (essential) { + this._assertLeft = true; + } + } + assert(left, _content, right) { + if (left && this._assertLeft) { + throw new ContentCannotBeRemovedException(); + } + if (right && this._assertRight) { + throw new ContentCannotBeRemovedException(); + } + } + remove(left, content, right) { + if (left) { + if (this._assertLeft) { + throw new ContentCannotBeRemovedException(); + } + this._left = null; + } + if (content) { + this._content = null; + } + if (right) { + if (this._assertRight) { + throw new ContentCannotBeRemovedException(); + } + this._right = null; + } + } + copy(target, start) { + if (this._left) { + this._left.copy(target, start); + start += this._left.length; + } + if (this._content) { + this._content.copy(target, start); + start += this._content.length; + } + if (this._right) { + this._right.copy(target, start); + start += this._right.length; + } + return start; + } +} +exports.Chunk = Chunk; +/** + * Base class for an update buffer implementation that allows buffers to be inserted to the _right + * or _left, or deleted, while keeping indices to the original buffer. + */ +class UpdateBufferBase { + constructor(_originalContent) { + this._originalContent = _originalContent; + } + /** + * Creates an UpdateBufferBase instance. Depending on the NG_UPDATE_BUFFER_V2 + * environment variable, will either create an UpdateBuffer or an UpdateBuffer2 + * instance. + * + * See: https://github.com/angular/angular-cli/issues/21110 + * + * @param originalContent The original content of the update buffer instance. + * @returns An UpdateBufferBase instance. + */ + static create(originalContent) { + return environment_options_1.updateBufferV2Enabled + ? new UpdateBuffer2(originalContent) + : new UpdateBuffer(originalContent); + } +} +exports.UpdateBufferBase = UpdateBufferBase; +/** + * An utility class that allows buffers to be inserted to the _right or _left, or deleted, while + * keeping indices to the original buffer. + * + * The constructor takes an original buffer, and keeps it into a linked list of chunks, smaller + * buffers that keep track of _content inserted to the _right or _left of it. + * + * Since the Node Buffer structure is non-destructive when slicing, we try to use slicing to create + * new chunks, and always keep chunks pointing to the original content. + * + * @deprecated Since v13.0 + */ +class UpdateBuffer extends UpdateBufferBase { + constructor(originalContent) { + super(originalContent); + this._linkedList = new linked_list_1.LinkedList(new Chunk(0, originalContent.length, originalContent)); + } + _assertIndex(index) { + if (index < 0 || index > this._originalContent.length) { + throw new IndexOutOfBoundException(index, 0, this._originalContent.length); + } + } + _slice(start) { + let index; + if (start >= this._originalContent.length) { + index = start; + } + else if (start < 0) { + index = this._originalContent.length + start; + } + else { + index = this._getTextPosition(start); + } + this._assertIndex(index); + // Find the chunk by going through the list. + const h = this._linkedList.find((chunk) => index <= chunk.end); + if (!h) { + throw Error('Chunk cannot be found.'); + } + if (index == h.end && h.next !== null) { + return [h, h.next]; + } + return [h, h.slice(index)]; + } + /** + * Gets the position in the content based on the position in the string. + * Some characters might be wider than one byte, thus we have to determine the position using + * string functions. + */ + _getTextPosition(index) { + return Buffer.from(this._originalContent.toString().substring(0, index)).length; + } + get length() { + return this._linkedList.reduce((acc, chunk) => acc + chunk.length, 0); + } + get original() { + return this._originalContent; + } + toString(encoding = 'utf-8') { + return this._linkedList.reduce((acc, chunk) => acc + chunk.toString(encoding), ''); + } + generate() { + const result = Buffer.allocUnsafe(this.length); + let i = 0; + this._linkedList.forEach((chunk) => { + chunk.copy(result, i); + i += chunk.length; + }); + return result; + } + insertLeft(index, content, assert = false) { + this._slice(index)[0].append(content, assert); + } + insertRight(index, content, assert = false) { + this._slice(index)[1].prepend(content, assert); + } + remove(index, length) { + if (length === 0) { + return; + } + const end = index + length; + const first = this._slice(index)[1]; + const last = this._slice(end)[1]; + let curr; + for (curr = first; curr && curr !== last; curr = curr.next) { + curr.assert(curr !== first, curr !== last, curr === first); + } + for (curr = first; curr && curr !== last; curr = curr.next) { + curr.remove(curr !== first, curr !== last, curr === first); + } + if (curr) { + curr.remove(true, false, false); + } + } +} +exports.UpdateBuffer = UpdateBuffer; +/** + * An utility class that allows buffers to be inserted to the _right or _left, or deleted, while + * keeping indices to the original buffer. + */ +class UpdateBuffer2 extends UpdateBufferBase { + constructor() { + super(...arguments); + this._mutatableContent = new magic_string_1.default(this._originalContent.toString()); + } + _assertIndex(index) { + if (index < 0 || index > this._originalContent.length) { + throw new IndexOutOfBoundException(index, 0, this._originalContent.length); + } + } + get length() { + return this._mutatableContent.length(); + } + get original() { + return this._originalContent; + } + toString() { + return this._mutatableContent.toString(); + } + generate() { + return Buffer.from(this.toString()); + } + insertLeft(index, content) { + this._assertIndex(index); + this._mutatableContent.appendLeft(index, content.toString()); + } + insertRight(index, content) { + this._assertIndex(index); + this._mutatableContent.appendRight(index, content.toString()); + } + remove(index, length) { + this._assertIndex(index); + this._mutatableContent.remove(index, index + length); + } +} +exports.UpdateBuffer2 = UpdateBuffer2; diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/workflow/base.d.ts b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/workflow/base.d.ts new file mode 100644 index 00000000..532f88e6 --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/workflow/base.d.ts @@ -0,0 +1,51 @@ +/** + * @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 + */ +import { schema, virtualFs } from '@angular-devkit/core'; +import { Observable, Subject } from 'rxjs'; +import { Engine, EngineHost } from '../engine'; +import { DryRunEvent } from '../sink/dryrun'; +import { Sink } from '../sink/sink'; +import { LifeCycleEvent, RequiredWorkflowExecutionContext, Workflow, WorkflowExecutionContext } from './interface'; +export interface BaseWorkflowOptions { + host: virtualFs.Host; + engineHost: EngineHost<{}, {}>; + registry?: schema.CoreSchemaRegistry; + force?: boolean; + dryRun?: boolean; +} +/** + * Base class for workflows. Even without abstract methods, this class should not be used without + * surrounding some initialization for the registry and host. This class only adds life cycle and + * dryrun/force support. You need to provide any registry and task executors that you need to + * support. + * See {@see NodeWorkflow} implementation for how to make a specialized subclass of this. + * TODO: add default set of CoreSchemaRegistry transforms. Once the job refactor is done, use that + * as the support for tasks. + * + * @public + */ +export declare abstract class BaseWorkflow implements Workflow { + protected _engine: Engine<{}, {}>; + protected _engineHost: EngineHost<{}, {}>; + protected _registry: schema.CoreSchemaRegistry; + protected _host: virtualFs.Host; + protected _reporter: Subject<DryRunEvent>; + protected _lifeCycle: Subject<LifeCycleEvent>; + protected _context: WorkflowExecutionContext[]; + protected _force: boolean; + protected _dryRun: boolean; + constructor(options: BaseWorkflowOptions); + get context(): Readonly<WorkflowExecutionContext>; + get engine(): Engine<{}, {}>; + get engineHost(): EngineHost<{}, {}>; + get registry(): schema.SchemaRegistry; + get reporter(): Observable<DryRunEvent>; + get lifeCycle(): Observable<LifeCycleEvent>; + protected _createSinks(): Sink[]; + execute(options: Partial<WorkflowExecutionContext> & RequiredWorkflowExecutionContext): Observable<void>; +} diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/workflow/base.js b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/workflow/base.js new file mode 100644 index 00000000..5847c0dc --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/workflow/base.js @@ -0,0 +1,138 @@ +"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.BaseWorkflow = void 0; +const core_1 = require("@angular-devkit/core"); +const rxjs_1 = require("rxjs"); +const operators_1 = require("rxjs/operators"); +const engine_1 = require("../engine"); +const exception_1 = require("../exception/exception"); +const formats_1 = require("../formats"); +const dryrun_1 = require("../sink/dryrun"); +const host_1 = require("../sink/host"); +const host_tree_1 = require("../tree/host-tree"); +/** + * Base class for workflows. Even without abstract methods, this class should not be used without + * surrounding some initialization for the registry and host. This class only adds life cycle and + * dryrun/force support. You need to provide any registry and task executors that you need to + * support. + * See {@see NodeWorkflow} implementation for how to make a specialized subclass of this. + * TODO: add default set of CoreSchemaRegistry transforms. Once the job refactor is done, use that + * as the support for tasks. + * + * @public + */ +class BaseWorkflow { + constructor(options) { + this._reporter = new rxjs_1.Subject(); + this._lifeCycle = new rxjs_1.Subject(); + this._host = options.host; + this._engineHost = options.engineHost; + if (options.registry) { + this._registry = options.registry; + } + else { + this._registry = new core_1.schema.CoreSchemaRegistry(formats_1.standardFormats); + this._registry.addPostTransform(core_1.schema.transforms.addUndefinedDefaults); + } + this._engine = new engine_1.SchematicEngine(this._engineHost, this); + this._context = []; + this._force = options.force || false; + this._dryRun = options.dryRun || false; + } + get context() { + const maybeContext = this._context[this._context.length - 1]; + if (!maybeContext) { + throw new Error('Cannot get context when workflow is not executing...'); + } + return maybeContext; + } + get engine() { + return this._engine; + } + get engineHost() { + return this._engineHost; + } + get registry() { + return this._registry; + } + get reporter() { + return this._reporter.asObservable(); + } + get lifeCycle() { + return this._lifeCycle.asObservable(); + } + _createSinks() { + let error = false; + const dryRunSink = new dryrun_1.DryRunSink(this._host, this._force); + const dryRunSubscriber = dryRunSink.reporter.subscribe((event) => { + this._reporter.next(event); + error = error || event.kind == 'error'; + }); + // We need two sinks if we want to output what will happen, and actually do the work. + return [ + dryRunSink, + // Add a custom sink that clean ourselves and throws an error if an error happened. + { + commit() { + dryRunSubscriber.unsubscribe(); + if (error) { + return (0, rxjs_1.throwError)(new exception_1.UnsuccessfulWorkflowExecution()); + } + return (0, rxjs_1.of)(); + }, + }, + // Only add a HostSink if this is not a dryRun. + ...(!this._dryRun ? [new host_1.HostSink(this._host, this._force)] : []), + ]; + } + execute(options) { + const parentContext = this._context[this._context.length - 1]; + if (!parentContext) { + this._lifeCycle.next({ kind: 'start' }); + } + /** Create the collection and the schematic. */ + const collection = this._engine.createCollection(options.collection); + // Only allow private schematics if called from the same collection. + const allowPrivate = options.allowPrivate || (parentContext && parentContext.collection === options.collection); + const schematic = collection.createSchematic(options.schematic, allowPrivate); + const sinks = this._createSinks(); + this._lifeCycle.next({ kind: 'workflow-start' }); + const context = { + ...options, + debug: options.debug || false, + logger: options.logger || (parentContext && parentContext.logger) || new core_1.logging.NullLogger(), + parentContext, + }; + this._context.push(context); + return schematic + .call(options.options, (0, rxjs_1.of)(new host_tree_1.HostTree(this._host)), { logger: context.logger }) + .pipe((0, operators_1.concatMap)((tree) => { + // Process all sinks. + return (0, rxjs_1.concat)((0, rxjs_1.from)(sinks).pipe((0, operators_1.concatMap)((sink) => sink.commit(tree)), (0, operators_1.ignoreElements)()), (0, rxjs_1.of)(tree)); + }), (0, operators_1.concatMap)(() => { + if (this._dryRun) { + return rxjs_1.EMPTY; + } + this._lifeCycle.next({ kind: 'post-tasks-start' }); + return this._engine + .executePostTasks() + .pipe((0, operators_1.tap)({ complete: () => this._lifeCycle.next({ kind: 'post-tasks-end' }) }), (0, operators_1.defaultIfEmpty)(), (0, operators_1.last)()); + }), (0, operators_1.tap)({ + complete: () => { + this._lifeCycle.next({ kind: 'workflow-end' }); + this._context.pop(); + if (this._context.length == 0) { + this._lifeCycle.next({ kind: 'end' }); + } + }, + })); + } +} +exports.BaseWorkflow = BaseWorkflow; diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/workflow/index.d.ts b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/workflow/index.d.ts new file mode 100644 index 00000000..3abed265 --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/workflow/index.d.ts @@ -0,0 +1,9 @@ +/** + * @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 + */ +export * from './base'; +export * from './interface'; diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/workflow/index.js b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/workflow/index.js new file mode 100644 index 00000000..5bb1e71d --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/workflow/index.js @@ -0,0 +1,21 @@ +"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 + */ +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __exportStar = (this && this.__exportStar) || function(m, exports) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +__exportStar(require("./base"), exports); +__exportStar(require("./interface"), exports); diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/workflow/interface.d.ts b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/workflow/interface.d.ts new file mode 100644 index 00000000..a1b71c37 --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/workflow/interface.d.ts @@ -0,0 +1,27 @@ +/** + * @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 + */ +import { logging } from '@angular-devkit/core'; +import { Observable } from 'rxjs'; +export interface RequiredWorkflowExecutionContext { + collection: string; + schematic: string; + options: object; +} +export interface WorkflowExecutionContext extends RequiredWorkflowExecutionContext { + debug: boolean; + logger: logging.Logger; + parentContext?: Readonly<WorkflowExecutionContext>; + allowPrivate?: boolean; +} +export interface LifeCycleEvent { + kind: 'start' | 'end' | 'workflow-start' | 'workflow-end' | 'post-tasks-start' | 'post-tasks-end'; +} +export interface Workflow { + readonly context: Readonly<WorkflowExecutionContext>; + execute(options: Partial<WorkflowExecutionContext> & RequiredWorkflowExecutionContext): Observable<void>; +} diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/workflow/interface.js b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/workflow/interface.js new file mode 100644 index 00000000..b599b96d --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/workflow/interface.js @@ -0,0 +1,9 @@ +"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 }); diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/tasks/BUILD.bazel b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/tasks/BUILD.bazel new file mode 100644 index 00000000..09f1ba24 --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/tasks/BUILD.bazel @@ -0,0 +1,35 @@ +load("//tools:defaults.bzl", "ts_library") + +# Copyright Google Inc. 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 +licenses(["notice"]) + +package(default_visibility = ["//visibility:public"]) + +ts_library( + name = "tasks", + srcs = glob( + include = ["**/*.ts"], + exclude = [ + "node/**/*.ts", + "**/*_spec.ts", + "**/*_benchmark.ts", + ], + ), + data = ["package.json"], + module_name = "@angular-devkit/schematics/tasks", + module_root = "index.d.ts", + # The attribute below is needed in g3 to turn off strict typechecking + # strict_checks = False, + deps = [ + "//packages/angular_devkit/core", + "//packages/angular_devkit/core/node", + "//packages/angular_devkit/schematics", + "@npm//@types/node", + "@npm//ora", + "@npm//rxjs", + "@npm//typescript", + ], +) diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/tasks/index.d.ts b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/tasks/index.d.ts new file mode 100644 index 00000000..36c11571 --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/tasks/index.d.ts @@ -0,0 +1,11 @@ +/** + * @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 + */ +export { NodePackageInstallTask } from './package-manager/install-task'; +export { NodePackageLinkTask } from './package-manager/link-task'; +export { RepositoryInitializerTask } from './repo-init/init-task'; +export { RunSchematicTask } from './run-schematic/task'; diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/tasks/index.js b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/tasks/index.js new file mode 100644 index 00000000..d43e7a11 --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/tasks/index.js @@ -0,0 +1,18 @@ +"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.RunSchematicTask = exports.RepositoryInitializerTask = exports.NodePackageLinkTask = exports.NodePackageInstallTask = void 0; +var install_task_1 = require("./package-manager/install-task"); +Object.defineProperty(exports, "NodePackageInstallTask", { enumerable: true, get: function () { return install_task_1.NodePackageInstallTask; } }); +var link_task_1 = require("./package-manager/link-task"); +Object.defineProperty(exports, "NodePackageLinkTask", { enumerable: true, get: function () { return link_task_1.NodePackageLinkTask; } }); +var init_task_1 = require("./repo-init/init-task"); +Object.defineProperty(exports, "RepositoryInitializerTask", { enumerable: true, get: function () { return init_task_1.RepositoryInitializerTask; } }); +var task_1 = require("./run-schematic/task"); +Object.defineProperty(exports, "RunSchematicTask", { enumerable: true, get: function () { return task_1.RunSchematicTask; } }); diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/tasks/node/BUILD.bazel b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/tasks/node/BUILD.bazel new file mode 100644 index 00000000..230f2f37 --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/tasks/node/BUILD.bazel @@ -0,0 +1,32 @@ +load("//tools:defaults.bzl", "ts_library") + +# Copyright Google Inc. 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 +licenses(["notice"]) + +package(default_visibility = ["//visibility:public"]) + +ts_library( + name = "node", + srcs = glob( + include = ["**/*.ts"], + exclude = [ + "**/*_spec.ts", + "**/*_benchmark.ts", + ], + ), + module_name = "@angular-devkit/schematics/tasks/node", + module_root = "index.d.ts", + # The attribute below is needed in g3 to turn off strict typechecking + # strict_checks = False, + deps = [ + "//packages/angular_devkit/core", + "//packages/angular_devkit/core/node", + "//packages/angular_devkit/schematics", + "//packages/angular_devkit/schematics/tasks", + "@npm//@types/node", + "@npm//rxjs", + ], +) diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/tasks/node/index.d.ts b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/tasks/node/index.d.ts new file mode 100644 index 00000000..0bebe160 --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/tasks/node/index.d.ts @@ -0,0 +1,15 @@ +/** + * @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 + */ +import { TaskExecutorFactory } from '../../src'; +import { NodePackageTaskFactoryOptions } from '../package-manager/options'; +import { RepositoryInitializerTaskFactoryOptions } from '../repo-init/options'; +export declare class BuiltinTaskExecutor { + static readonly NodePackage: TaskExecutorFactory<NodePackageTaskFactoryOptions>; + static readonly RepositoryInitializer: TaskExecutorFactory<RepositoryInitializerTaskFactoryOptions>; + static readonly RunSchematic: TaskExecutorFactory<{}>; +} diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/tasks/node/index.js b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/tasks/node/index.js new file mode 100644 index 00000000..54120661 --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/tasks/node/index.js @@ -0,0 +1,47 @@ +"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 + */ +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.BuiltinTaskExecutor = void 0; +const options_1 = require("../package-manager/options"); +const options_2 = require("../repo-init/options"); +const options_3 = require("../run-schematic/options"); +class BuiltinTaskExecutor { +} +exports.BuiltinTaskExecutor = BuiltinTaskExecutor; +BuiltinTaskExecutor.NodePackage = { + name: options_1.NodePackageName, + create: (options) => Promise.resolve().then(() => __importStar(require('../package-manager/executor'))).then((mod) => mod.default(options)), +}; +BuiltinTaskExecutor.RepositoryInitializer = { + name: options_2.RepositoryInitializerName, + create: (options) => Promise.resolve().then(() => __importStar(require('../repo-init/executor'))).then((mod) => mod.default(options)), +}; +BuiltinTaskExecutor.RunSchematic = { + name: options_3.RunSchematicName, + create: () => Promise.resolve().then(() => __importStar(require('../run-schematic/executor'))).then((mod) => mod.default()), +}; diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/tasks/package-manager/executor.d.ts b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/tasks/package-manager/executor.d.ts new file mode 100644 index 00000000..4fa6cca4 --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/tasks/package-manager/executor.d.ts @@ -0,0 +1,14 @@ +/** + * @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 + */ +import { BaseException } from '@angular-devkit/core'; +import { TaskExecutor } from '../../src'; +import { NodePackageTaskFactoryOptions, NodePackageTaskOptions } from './options'; +export declare class UnknownPackageManagerException extends BaseException { + constructor(name: string); +} +export default function (factoryOptions?: NodePackageTaskFactoryOptions): TaskExecutor<NodePackageTaskOptions>; diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/tasks/package-manager/executor.js b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/tasks/package-manager/executor.js new file mode 100644 index 00000000..bc656111 --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/tasks/package-manager/executor.js @@ -0,0 +1,144 @@ +"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 + */ +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.UnknownPackageManagerException = void 0; +const core_1 = require("@angular-devkit/core"); +const child_process_1 = require("child_process"); +const ora_1 = __importDefault(require("ora")); +const path = __importStar(require("path")); +const rxjs_1 = require("rxjs"); +const src_1 = require("../../src"); +const packageManagers = { + 'npm': { + quietArgument: '--quiet', + commands: { + installAll: 'install', + installPackage: 'install', + }, + }, + 'cnpm': { + commands: { + installAll: 'install', + installPackage: 'install', + }, + }, + 'yarn': { + quietArgument: '--silent', + commands: { + installPackage: 'add', + }, + }, + 'pnpm': { + quietArgument: '--silent', + commands: { + installAll: 'install', + installPackage: 'install', + }, + }, +}; +class UnknownPackageManagerException extends core_1.BaseException { + constructor(name) { + super(`Unknown package manager "${name}".`); + } +} +exports.UnknownPackageManagerException = UnknownPackageManagerException; +function default_1(factoryOptions = {}) { + const packageManagerName = factoryOptions.packageManager || 'npm'; + const packageManagerProfile = packageManagers[packageManagerName]; + if (!packageManagerProfile) { + throw new UnknownPackageManagerException(packageManagerName); + } + const rootDirectory = factoryOptions.rootDirectory || process.cwd(); + return (options = { command: 'install' }) => { + let taskPackageManagerProfile = packageManagerProfile; + let taskPackageManagerName = packageManagerName; + if (factoryOptions.allowPackageManagerOverride && options.packageManager) { + taskPackageManagerProfile = packageManagers[options.packageManager]; + if (!taskPackageManagerProfile) { + throw new UnknownPackageManagerException(options.packageManager); + } + taskPackageManagerName = options.packageManager; + } + const bufferedOutput = []; + const spawnOptions = { + stdio: options.hideOutput ? 'pipe' : 'inherit', + shell: true, + cwd: path.join(rootDirectory, options.workingDirectory || ''), + }; + const args = []; + if (options.packageName) { + if (options.command === 'install') { + args.push(taskPackageManagerProfile.commands.installPackage); + } + args.push(options.packageName); + } + else if (options.command === 'install' && taskPackageManagerProfile.commands.installAll) { + args.push(taskPackageManagerProfile.commands.installAll); + } + if (options.quiet && taskPackageManagerProfile.quietArgument) { + args.push(taskPackageManagerProfile.quietArgument); + } + if (factoryOptions.registry) { + args.push(`--registry="${factoryOptions.registry}"`); + } + if (factoryOptions.force) { + args.push('--force'); + } + return new rxjs_1.Observable((obs) => { + var _a, _b; + const spinner = (0, ora_1.default)({ + text: `Installing packages (${taskPackageManagerName})...`, + // Workaround for https://github.com/sindresorhus/ora/issues/136. + discardStdin: process.platform != 'win32', + }).start(); + const childProcess = (0, child_process_1.spawn)(taskPackageManagerName, args, spawnOptions).on('close', (code) => { + if (code === 0) { + spinner.succeed('Packages installed successfully.'); + spinner.stop(); + obs.next(); + obs.complete(); + } + else { + if (options.hideOutput) { + bufferedOutput.forEach(({ stream, data }) => stream.write(data)); + } + spinner.fail('Package install failed, see above.'); + obs.error(new src_1.UnsuccessfulWorkflowExecution()); + } + }); + if (options.hideOutput) { + (_a = childProcess.stdout) === null || _a === void 0 ? void 0 : _a.on('data', (data) => bufferedOutput.push({ stream: process.stdout, data: data })); + (_b = childProcess.stderr) === null || _b === void 0 ? void 0 : _b.on('data', (data) => bufferedOutput.push({ stream: process.stderr, data: data })); + } + }); + }; +} +exports.default = default_1; diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/tasks/package-manager/install-task.d.ts b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/tasks/package-manager/install-task.d.ts new file mode 100644 index 00000000..69924a69 --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/tasks/package-manager/install-task.d.ts @@ -0,0 +1,27 @@ +/** + * @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 + */ +import { TaskConfiguration, TaskConfigurationGenerator } from '../../src'; +import { NodePackageTaskOptions } from './options'; +interface NodePackageInstallTaskOptions { + packageManager?: string; + packageName?: string; + workingDirectory?: string; + quiet?: boolean; + hideOutput?: boolean; +} +export declare class NodePackageInstallTask implements TaskConfigurationGenerator<NodePackageTaskOptions> { + quiet: boolean; + hideOutput: boolean; + workingDirectory?: string; + packageManager?: string; + packageName?: string; + constructor(workingDirectory?: string); + constructor(options: NodePackageInstallTaskOptions); + toConfiguration(): TaskConfiguration<NodePackageTaskOptions>; +} +export {}; diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/tasks/package-manager/install-task.js b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/tasks/package-manager/install-task.js new file mode 100644 index 00000000..ae02887b --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/tasks/package-manager/install-task.js @@ -0,0 +1,51 @@ +"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.NodePackageInstallTask = void 0; +const options_1 = require("./options"); +class NodePackageInstallTask { + constructor(options) { + this.quiet = true; + this.hideOutput = true; + if (typeof options === 'string') { + this.workingDirectory = options; + } + else if (typeof options === 'object') { + if (options.quiet != undefined) { + this.quiet = options.quiet; + } + if (options.hideOutput != undefined) { + this.hideOutput = options.hideOutput; + } + if (options.workingDirectory != undefined) { + this.workingDirectory = options.workingDirectory; + } + if (options.packageManager != undefined) { + this.packageManager = options.packageManager; + } + if (options.packageName != undefined) { + this.packageName = options.packageName; + } + } + } + toConfiguration() { + return { + name: options_1.NodePackageName, + options: { + command: 'install', + quiet: this.quiet, + hideOutput: this.hideOutput, + workingDirectory: this.workingDirectory, + packageManager: this.packageManager, + packageName: this.packageName, + }, + }; + } +} +exports.NodePackageInstallTask = NodePackageInstallTask; diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/tasks/package-manager/link-task.d.ts b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/tasks/package-manager/link-task.d.ts new file mode 100644 index 00000000..c7d2b63c --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/tasks/package-manager/link-task.d.ts @@ -0,0 +1,16 @@ +/** + * @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 + */ +import { TaskConfiguration, TaskConfigurationGenerator } from '../../src'; +import { NodePackageTaskOptions } from './options'; +export declare class NodePackageLinkTask implements TaskConfigurationGenerator<NodePackageTaskOptions> { + packageName?: string | undefined; + workingDirectory?: string | undefined; + quiet: boolean; + constructor(packageName?: string | undefined, workingDirectory?: string | undefined); + toConfiguration(): TaskConfiguration<NodePackageTaskOptions>; +} diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/tasks/package-manager/link-task.js b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/tasks/package-manager/link-task.js new file mode 100644 index 00000000..2518b4cb --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/tasks/package-manager/link-task.js @@ -0,0 +1,30 @@ +"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.NodePackageLinkTask = void 0; +const options_1 = require("./options"); +class NodePackageLinkTask { + constructor(packageName, workingDirectory) { + this.packageName = packageName; + this.workingDirectory = workingDirectory; + this.quiet = true; + } + toConfiguration() { + return { + name: options_1.NodePackageName, + options: { + command: 'link', + quiet: this.quiet, + workingDirectory: this.workingDirectory, + packageName: this.packageName, + }, + }; + } +} +exports.NodePackageLinkTask = NodePackageLinkTask; diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/tasks/package-manager/options.d.ts b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/tasks/package-manager/options.d.ts new file mode 100644 index 00000000..60c1253f --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/tasks/package-manager/options.d.ts @@ -0,0 +1,23 @@ +/** + * @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 + */ +export declare const NodePackageName = "node-package"; +export interface NodePackageTaskFactoryOptions { + rootDirectory?: string; + packageManager?: string; + allowPackageManagerOverride?: boolean; + registry?: string; + force?: boolean; +} +export interface NodePackageTaskOptions { + command: string; + quiet?: boolean; + hideOutput?: boolean; + workingDirectory?: string; + packageName?: string; + packageManager?: string; +} diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/tasks/package-manager/options.js b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/tasks/package-manager/options.js new file mode 100644 index 00000000..3b33121f --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/tasks/package-manager/options.js @@ -0,0 +1,11 @@ +"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.NodePackageName = void 0; +exports.NodePackageName = 'node-package'; diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/tasks/package.json b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/tasks/package.json new file mode 100644 index 00000000..075ac40a --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/tasks/package.json @@ -0,0 +1,5 @@ +{ + "name": "@angular-devkit/schematics/tasks", + "main": "index.js", + "typings": "index.d.ts" +} diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/tasks/repo-init/executor.d.ts b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/tasks/repo-init/executor.d.ts new file mode 100644 index 00000000..e412a64b --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/tasks/repo-init/executor.d.ts @@ -0,0 +1,10 @@ +/** + * @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 + */ +import { TaskExecutor } from '../../src'; +import { RepositoryInitializerTaskFactoryOptions, RepositoryInitializerTaskOptions } from './options'; +export default function (factoryOptions?: RepositoryInitializerTaskFactoryOptions): TaskExecutor<RepositoryInitializerTaskOptions>; diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/tasks/repo-init/executor.js b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/tasks/repo-init/executor.js new file mode 100644 index 00000000..4acf4f56 --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/tasks/repo-init/executor.js @@ -0,0 +1,90 @@ +"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 + */ +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +const core_1 = require("@angular-devkit/core"); +const child_process_1 = require("child_process"); +const path = __importStar(require("path")); +function default_1(factoryOptions = {}) { + const rootDirectory = factoryOptions.rootDirectory || process.cwd(); + return async (options = {}, context) => { + const authorName = options.authorName; + const authorEmail = options.authorEmail; + const execute = (args, ignoreErrorStream) => { + const outputStream = 'ignore'; + const errorStream = ignoreErrorStream ? 'ignore' : process.stderr; + const spawnOptions = { + stdio: [process.stdin, outputStream, errorStream], + shell: true, + cwd: path.join(rootDirectory, options.workingDirectory || ''), + env: { + ...process.env, + ...(authorName ? { GIT_AUTHOR_NAME: authorName, GIT_COMMITTER_NAME: authorName } : {}), + ...(authorEmail + ? { GIT_AUTHOR_EMAIL: authorEmail, GIT_COMMITTER_EMAIL: authorEmail } + : {}), + }, + }; + return new Promise((resolve, reject) => { + (0, child_process_1.spawn)('git', args, spawnOptions).on('close', (code) => { + if (code === 0) { + resolve(); + } + else { + reject(code); + } + }); + }); + }; + const hasCommand = await execute(['--version']).then(() => true, () => false); + if (!hasCommand) { + return; + } + const insideRepo = await execute(['rev-parse', '--is-inside-work-tree'], true).then(() => true, () => false); + if (insideRepo) { + context.logger.info(core_1.tags.oneLine ` + Directory is already under version control. + Skipping initialization of git. + `); + return; + } + // if git is not found or an error was thrown during the `git` + // init process just swallow any errors here + // NOTE: This will be removed once task error handling is implemented + try { + await execute(['init']); + await execute(['add', '.']); + if (options.commit) { + const message = options.message || 'initial commit'; + await execute(['commit', `-m "${message}"`]); + } + context.logger.info('Successfully initialized git.'); + } + catch { } + }; +} +exports.default = default_1; diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/tasks/repo-init/init-task.d.ts b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/tasks/repo-init/init-task.d.ts new file mode 100644 index 00000000..08fd4040 --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/tasks/repo-init/init-task.d.ts @@ -0,0 +1,20 @@ +/** + * @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 + */ +import { TaskConfiguration, TaskConfigurationGenerator } from '../../src'; +import { RepositoryInitializerTaskOptions } from './options'; +export interface CommitOptions { + message?: string; + name?: string; + email?: string; +} +export declare class RepositoryInitializerTask implements TaskConfigurationGenerator<RepositoryInitializerTaskOptions> { + workingDirectory?: string | undefined; + commitOptions?: CommitOptions | undefined; + constructor(workingDirectory?: string | undefined, commitOptions?: CommitOptions | undefined); + toConfiguration(): TaskConfiguration<RepositoryInitializerTaskOptions>; +} diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/tasks/repo-init/init-task.js b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/tasks/repo-init/init-task.js new file mode 100644 index 00000000..8809b29f --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/tasks/repo-init/init-task.js @@ -0,0 +1,30 @@ +"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.RepositoryInitializerTask = void 0; +const options_1 = require("./options"); +class RepositoryInitializerTask { + constructor(workingDirectory, commitOptions) { + this.workingDirectory = workingDirectory; + this.commitOptions = commitOptions; + } + toConfiguration() { + return { + name: options_1.RepositoryInitializerName, + options: { + commit: !!this.commitOptions, + workingDirectory: this.workingDirectory, + authorName: this.commitOptions && this.commitOptions.name, + authorEmail: this.commitOptions && this.commitOptions.email, + message: this.commitOptions && this.commitOptions.message, + }, + }; + } +} +exports.RepositoryInitializerTask = RepositoryInitializerTask; diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/tasks/repo-init/options.d.ts b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/tasks/repo-init/options.d.ts new file mode 100644 index 00000000..93816617 --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/tasks/repo-init/options.d.ts @@ -0,0 +1,18 @@ +/** + * @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 + */ +export declare const RepositoryInitializerName = "repo-init"; +export interface RepositoryInitializerTaskFactoryOptions { + rootDirectory?: string; +} +export interface RepositoryInitializerTaskOptions { + workingDirectory?: string; + commit?: boolean; + message?: string; + authorName?: string; + authorEmail?: string; +} diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/tasks/repo-init/options.js b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/tasks/repo-init/options.js new file mode 100644 index 00000000..2185b470 --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/tasks/repo-init/options.js @@ -0,0 +1,11 @@ +"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.RepositoryInitializerName = void 0; +exports.RepositoryInitializerName = 'repo-init'; diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/tasks/run-schematic/executor.d.ts b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/tasks/run-schematic/executor.d.ts new file mode 100644 index 00000000..f445760e --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/tasks/run-schematic/executor.d.ts @@ -0,0 +1,10 @@ +/** + * @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 + */ +import { TaskExecutor } from '../../src'; +import { RunSchematicTaskOptions } from './options'; +export default function (): TaskExecutor<RunSchematicTaskOptions<{}>>; diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/tasks/run-schematic/executor.js b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/tasks/run-schematic/executor.js new file mode 100644 index 00000000..9b93e152 --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/tasks/run-schematic/executor.js @@ -0,0 +1,29 @@ +"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 }); +function default_1() { + return (options, context) => { + if (!(options === null || options === void 0 ? void 0 : options.name)) { + throw new Error('RunSchematicTask requires an options object with a non-empty name property.'); + } + const maybeWorkflow = context.engine.workflow; + const collection = options.collection || context.schematic.collection.description.name; + if (!maybeWorkflow) { + throw new Error('Need Workflow to support executing schematics as post tasks.'); + } + return maybeWorkflow.execute({ + collection: collection, + schematic: options.name, + options: options.options, + // Allow private when calling from the same collection. + allowPrivate: collection == context.schematic.collection.description.name, + }); + }; +} +exports.default = default_1; diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/tasks/run-schematic/options.d.ts b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/tasks/run-schematic/options.d.ts new file mode 100644 index 00000000..1dca95da --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/tasks/run-schematic/options.d.ts @@ -0,0 +1,13 @@ +/** + * @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 + */ +export declare const RunSchematicName = "run-schematic"; +export interface RunSchematicTaskOptions<T> { + collection: string | null; + name: string; + options: T; +} diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/tasks/run-schematic/options.js b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/tasks/run-schematic/options.js new file mode 100644 index 00000000..d77ec6a6 --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/tasks/run-schematic/options.js @@ -0,0 +1,11 @@ +"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.RunSchematicName = void 0; +exports.RunSchematicName = 'run-schematic'; diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/tasks/run-schematic/task.d.ts b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/tasks/run-schematic/task.d.ts new file mode 100644 index 00000000..2ff0e5bf --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/tasks/run-schematic/task.d.ts @@ -0,0 +1,17 @@ +/** + * @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 + */ +import { TaskConfiguration, TaskConfigurationGenerator } from '../../src'; +import { RunSchematicTaskOptions } from './options'; +export declare class RunSchematicTask<T> implements TaskConfigurationGenerator<RunSchematicTaskOptions<T>> { + protected _collection: string | null; + protected _schematic: string; + protected _options: T; + constructor(s: string, o: T); + constructor(c: string, s: string, o: T); + toConfiguration(): TaskConfiguration<RunSchematicTaskOptions<T>>; +} diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/tasks/run-schematic/task.js b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/tasks/run-schematic/task.js new file mode 100644 index 00000000..595848b5 --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/tasks/run-schematic/task.js @@ -0,0 +1,34 @@ +"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.RunSchematicTask = void 0; +const options_1 = require("./options"); +class RunSchematicTask { + constructor(c, s, o) { + if (arguments.length == 2 || typeof s !== 'string') { + o = s; + s = c; + c = null; + } + this._collection = c; + this._schematic = s; + this._options = o; + } + toConfiguration() { + return { + name: options_1.RunSchematicName, + options: { + collection: this._collection, + name: this._schematic, + options: this._options, + }, + }; + } +} +exports.RunSchematicTask = RunSchematicTask; diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/testing/BUILD.bazel b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/testing/BUILD.bazel new file mode 100644 index 00000000..5442ff4b --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/testing/BUILD.bazel @@ -0,0 +1,28 @@ +load("//tools:defaults.bzl", "ts_library") + +# Copyright Google Inc. 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 +licenses(["notice"]) + +package(default_visibility = ["//visibility:public"]) + +ts_library( + name = "testing", + srcs = glob( + include = ["**/*.ts"], + ), + data = ["package.json"], + module_name = "@angular-devkit/schematics/testing", + module_root = "index.d.ts", + deps = [ + "//packages/angular_devkit/core", + "//packages/angular_devkit/schematics", + "//packages/angular_devkit/schematics/tasks", + "//packages/angular_devkit/schematics/tasks/node", + "//packages/angular_devkit/schematics/tools", + "@npm//@types/node", + "@npm//rxjs", + ], +) diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/testing/index.d.ts b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/testing/index.d.ts new file mode 100644 index 00000000..3c315c83 --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/testing/index.d.ts @@ -0,0 +1,8 @@ +/** + * @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 + */ +export * from './schematic-test-runner'; diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/testing/index.js b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/testing/index.js new file mode 100644 index 00000000..a01e5efa --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/testing/index.js @@ -0,0 +1,20 @@ +"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 + */ +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __exportStar = (this && this.__exportStar) || function(m, exports) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +__exportStar(require("./schematic-test-runner"), exports); diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/testing/package.json b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/testing/package.json new file mode 100644 index 00000000..05a24826 --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/testing/package.json @@ -0,0 +1,5 @@ +{ + "name": "@angular-devkit/schematics/testing", + "main": "index.js", + "typings": "index.d.ts" +} diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/testing/schematic-test-runner.d.ts b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/testing/schematic-test-runner.d.ts new file mode 100644 index 00000000..055448af --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/testing/schematic-test-runner.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 + */ +import { logging } from '@angular-devkit/core'; +import { Observable } from 'rxjs'; +import { DelegateTree, Rule, SchematicContext, SchematicEngine, TaskConfiguration, Tree } from '../src'; +export declare class UnitTestTree extends DelegateTree { + get files(): string[]; + readContent(path: string): string; +} +export declare class SchematicTestRunner { + private _collectionName; + private _engineHost; + private _engine; + private _collection; + private _logger; + constructor(_collectionName: string, collectionPath: string); + get engine(): SchematicEngine<{}, {}>; + get logger(): logging.Logger; + get tasks(): TaskConfiguration[]; + registerCollection(collectionName: string, collectionPath: string): void; + runSchematicAsync<SchematicSchemaT>(schematicName: string, opts?: SchematicSchemaT, tree?: Tree): Observable<UnitTestTree>; + runExternalSchematicAsync<SchematicSchemaT>(collectionName: string, schematicName: string, opts?: SchematicSchemaT, tree?: Tree): Observable<UnitTestTree>; + callRule(rule: Rule, tree: Tree, parentContext?: Partial<SchematicContext>): Observable<Tree>; +} diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/testing/schematic-test-runner.js b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/testing/schematic-test-runner.js new file mode 100644 index 00000000..e5146ac9 --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/testing/schematic-test-runner.js @@ -0,0 +1,82 @@ +"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.SchematicTestRunner = exports.UnitTestTree = void 0; +const core_1 = require("@angular-devkit/core"); +const rxjs_1 = require("rxjs"); +const operators_1 = require("rxjs/operators"); +const src_1 = require("../src"); +const call_1 = require("../src/rules/call"); +const node_1 = require("../tasks/node"); +const tools_1 = require("../tools"); +class UnitTestTree extends src_1.DelegateTree { + get files() { + const result = []; + this.visit((path) => result.push(path)); + return result; + } + readContent(path) { + const buffer = this.read(path); + if (buffer === null) { + return ''; + } + return buffer.toString(); + } +} +exports.UnitTestTree = UnitTestTree; +class SchematicTestRunner { + constructor(_collectionName, collectionPath) { + this._collectionName = _collectionName; + this._engineHost = new tools_1.NodeModulesTestEngineHost(); + this._engine = new src_1.SchematicEngine(this._engineHost); + this._engineHost.registerCollection(_collectionName, collectionPath); + this._logger = new core_1.logging.Logger('test'); + const registry = new core_1.schema.CoreSchemaRegistry(src_1.formats.standardFormats); + registry.addPostTransform(core_1.schema.transforms.addUndefinedDefaults); + this._engineHost.registerOptionsTransform((0, tools_1.validateOptionsWithSchema)(registry)); + this._engineHost.registerTaskExecutor(node_1.BuiltinTaskExecutor.NodePackage); + this._engineHost.registerTaskExecutor(node_1.BuiltinTaskExecutor.RepositoryInitializer); + this._engineHost.registerTaskExecutor(node_1.BuiltinTaskExecutor.RunSchematic); + this._collection = this._engine.createCollection(this._collectionName); + } + get engine() { + return this._engine; + } + get logger() { + return this._logger; + } + get tasks() { + return [...this._engineHost.tasks]; + } + registerCollection(collectionName, collectionPath) { + this._engineHost.registerCollection(collectionName, collectionPath); + } + runSchematicAsync(schematicName, opts, tree) { + const schematic = this._collection.createSchematic(schematicName, true); + const host = (0, rxjs_1.of)(tree || new src_1.HostTree()); + this._engineHost.clearTasks(); + return schematic + .call(opts || {}, host, { logger: this._logger }) + .pipe((0, operators_1.map)((tree) => new UnitTestTree(tree))); + } + runExternalSchematicAsync(collectionName, schematicName, opts, tree) { + const externalCollection = this._engine.createCollection(collectionName); + const schematic = externalCollection.createSchematic(schematicName, true); + const host = (0, rxjs_1.of)(tree || new src_1.HostTree()); + this._engineHost.clearTasks(); + return schematic + .call(opts || {}, host, { logger: this._logger }) + .pipe((0, operators_1.map)((tree) => new UnitTestTree(tree))); + } + callRule(rule, tree, parentContext) { + const context = this._engine.createContext({}, parentContext); + return (0, call_1.callRule)(rule, (0, rxjs_1.of)(tree), context); + } +} +exports.SchematicTestRunner = SchematicTestRunner; diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/tools/BUILD.bazel b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/tools/BUILD.bazel new file mode 100644 index 00000000..c7514fb5 --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/tools/BUILD.bazel @@ -0,0 +1,67 @@ +load("@npm//@bazel/jasmine:index.bzl", "jasmine_node_test") +load("//tools:defaults.bzl", "ts_library") + +# Copyright Google Inc. 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 +licenses(["notice"]) + +package(default_visibility = ["//visibility:public"]) + +ts_library( + name = "tools", + srcs = glob( + include = ["**/*.ts"], + exclude = [ + "**/*_spec.ts", + "**/*_benchmark.ts", + "test/**/*.ts", + ], + ), + data = ["package.json"], + module_name = "@angular-devkit/schematics/tools", + module_root = "index.d.ts", + # The attribute below is needed in g3 to turn off strict typechecking + # strict_checks = False, + deps = [ + "//packages/angular_devkit/core", + "//packages/angular_devkit/core/node", + "//packages/angular_devkit/schematics", + "//packages/angular_devkit/schematics/tasks", + "//packages/angular_devkit/schematics/tasks/node", + "@npm//@types/node", + "@npm//jsonc-parser", + "@npm//rxjs", + ], +) + +ts_library( + name = "tools_test_lib", + testonly = True, + srcs = glob( + include = [ + "**/*_spec.ts", + "test/**/*.ts", + ], + ), + deps = [ + ":tools", + "//packages/angular_devkit/core", + "//packages/angular_devkit/core/node", + "//packages/angular_devkit/schematics", + "//packages/angular_devkit/schematics/tasks", + "//packages/angular_devkit/schematics/testing", + "//tests/angular_devkit/schematics/tools/file-system-engine-host:file_system_engine_host_test_lib", + "@npm//rxjs", + ], +) + +jasmine_node_test( + name = "tools_test", + srcs = [":tools_test_lib"], + deps = [ + "@npm//jasmine", + "@npm//source-map", + ], +) diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/tools/description.d.ts b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/tools/description.d.ts new file mode 100644 index 00000000..5390481d --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/tools/description.d.ts @@ -0,0 +1,41 @@ +/** + * @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 + */ +import { JsonObject } from '@angular-devkit/core'; +import { Collection, CollectionDescription, Engine, EngineHost, RuleFactory, Schematic, SchematicDescription, TypedSchematicContext } from '../src'; +export interface FileSystemCollectionDescription { + readonly name: string; + readonly path: string; + readonly version?: string; + readonly schematics: { + [name: string]: FileSystemSchematicDesc; + }; +} +export interface FileSystemSchematicJsonDescription { + readonly aliases?: string[]; + readonly factory: string; + readonly name: string; + readonly collection: FileSystemCollectionDescription; + readonly description: string; + readonly schema?: string; + readonly extends?: string; +} +export interface FileSystemSchematicDescription extends FileSystemSchematicJsonDescription { + readonly path: string; + readonly schemaJson?: JsonObject; + readonly factoryFn: RuleFactory<{}>; +} +/** + * Used to simplify typings. + */ +export declare type FileSystemEngine = Engine<FileSystemCollectionDescription, FileSystemSchematicDescription>; +export declare type FileSystemEngineHost = EngineHost<FileSystemCollectionDescription, FileSystemSchematicDescription>; +export declare type FileSystemCollection = Collection<FileSystemCollectionDescription, FileSystemSchematicDescription>; +export declare type FileSystemSchematic = Schematic<FileSystemCollectionDescription, FileSystemSchematicDescription>; +export declare type FileSystemCollectionDesc = CollectionDescription<FileSystemCollectionDescription>; +export declare type FileSystemSchematicDesc = SchematicDescription<FileSystemCollectionDescription, FileSystemSchematicDescription>; +export declare type FileSystemSchematicContext = TypedSchematicContext<FileSystemCollectionDescription, FileSystemSchematicDescription>; diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/tools/description.js b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/tools/description.js new file mode 100644 index 00000000..b599b96d --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/tools/description.js @@ -0,0 +1,9 @@ +"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 }); diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/tools/export-ref.d.ts b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/tools/export-ref.d.ts new file mode 100644 index 00000000..06428cea --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/tools/export-ref.d.ts @@ -0,0 +1,16 @@ +/** + * @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 + */ +export declare class ExportStringRef<T> { + private _ref?; + private _module; + private _path; + constructor(ref: string, parentPath?: string, inner?: boolean); + get ref(): T | undefined; + get module(): string; + get path(): string; +} diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/tools/export-ref.js b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/tools/export-ref.js new file mode 100644 index 00000000..1c88d8ee --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/tools/export-ref.js @@ -0,0 +1,35 @@ +"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.ExportStringRef = void 0; +const path_1 = require("path"); +class ExportStringRef { + constructor(ref, parentPath = process.cwd(), inner = true) { + const [path, name] = ref.split('#', 2); + this._module = path[0] == '.' ? (0, path_1.resolve)(parentPath, path) : path; + this._module = require.resolve(this._module); + this._path = (0, path_1.dirname)(this._module); + if (inner) { + this._ref = require(this._module)[name || 'default']; + } + else { + this._ref = require(this._module); + } + } + get ref() { + return this._ref; + } + get module() { + return this._module; + } + get path() { + return this._path; + } +} +exports.ExportStringRef = ExportStringRef; diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/tools/fallback-engine-host.d.ts b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/tools/fallback-engine-host.d.ts new file mode 100644 index 00000000..8a915a5e --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/tools/fallback-engine-host.d.ts @@ -0,0 +1,36 @@ +/** + * @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 { Url } from 'url'; +import { CollectionDescription, EngineHost, RuleFactory, SchematicDescription, Source, TaskExecutor, TypedSchematicContext } from '../src'; +export declare type FallbackCollectionDescription = { + host: EngineHost<{}, {}>; + description: CollectionDescription<{}>; +}; +export declare type FallbackSchematicDescription = { + description: SchematicDescription<{}, {}>; +}; +export declare type FallbackContext = TypedSchematicContext<FallbackCollectionDescription, FallbackSchematicDescription>; +/** + * An EngineHost that support multiple hosts in a fallback configuration. If a host does not + * have a collection/schematics, use the following host before giving up. + */ +export declare class FallbackEngineHost implements EngineHost<{}, {}> { + private _hosts; + addHost<CollectionT extends object, SchematicT extends object>(host: EngineHost<CollectionT, SchematicT>): void; + createCollectionDescription(name: string, requester?: CollectionDescription<{}>): CollectionDescription<FallbackCollectionDescription>; + createSchematicDescription(name: string, collection: CollectionDescription<FallbackCollectionDescription>): SchematicDescription<FallbackCollectionDescription, FallbackSchematicDescription> | null; + getSchematicRuleFactory<OptionT extends object>(schematic: SchematicDescription<FallbackCollectionDescription, FallbackSchematicDescription>, collection: CollectionDescription<FallbackCollectionDescription>): RuleFactory<OptionT>; + createSourceFromUrl(url: Url, context: FallbackContext): Source | null; + transformOptions<OptionT extends object, ResultT extends object>(schematic: SchematicDescription<FallbackCollectionDescription, FallbackSchematicDescription>, options: OptionT, context?: FallbackContext): Observable<ResultT>; + transformContext(context: FallbackContext): FallbackContext; + listSchematicNames(collection: CollectionDescription<FallbackCollectionDescription>): string[]; + createTaskExecutor(name: string): Observable<TaskExecutor>; + hasTaskExecutor(name: string): boolean; +} diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/tools/fallback-engine-host.js b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/tools/fallback-engine-host.js new file mode 100644 index 00000000..bf2f5a98 --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/tools/fallback-engine-host.js @@ -0,0 +1,86 @@ +"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.FallbackEngineHost = void 0; +const rxjs_1 = require("rxjs"); +const operators_1 = require("rxjs/operators"); +const src_1 = require("../src"); +/** + * An EngineHost that support multiple hosts in a fallback configuration. If a host does not + * have a collection/schematics, use the following host before giving up. + */ +class FallbackEngineHost { + constructor() { + this._hosts = []; + } + addHost(host) { + this._hosts.push(host); + } + createCollectionDescription(name, requester) { + for (const host of this._hosts) { + try { + const description = host.createCollectionDescription(name, requester); + return { name, host, description }; + } + catch (_) { } + } + throw new src_1.UnknownCollectionException(name); + } + createSchematicDescription(name, collection) { + const description = collection.host.createSchematicDescription(name, collection.description); + if (!description) { + return null; + } + return { name, collection, description }; + } + getSchematicRuleFactory(schematic, collection) { + return collection.host.getSchematicRuleFactory(schematic.description, collection.description); + } + createSourceFromUrl(url, context) { + return context.schematic.collection.description.host.createSourceFromUrl(url, context); + } + transformOptions(schematic, options, context) { + // eslint-disable-next-line @typescript-eslint/no-explicit-any + return (0, rxjs_1.of)(options).pipe(...this._hosts.map((host) => (0, operators_1.mergeMap)((opt) => host.transformOptions(schematic, opt, context)))); + } + transformContext(context) { + let result = context; + this._hosts.forEach((host) => { + result = (host.transformContext(result) || result); + }); + return result; + } + listSchematicNames(collection) { + const allNames = new Set(); + this._hosts.forEach((host) => { + try { + host.listSchematicNames(collection.description).forEach((name) => allNames.add(name)); + } + catch (_) { } + }); + return [...allNames]; + } + createTaskExecutor(name) { + for (const host of this._hosts) { + if (host.hasTaskExecutor(name)) { + return host.createTaskExecutor(name); + } + } + return (0, rxjs_1.throwError)(new src_1.UnregisteredTaskException(name)); + } + hasTaskExecutor(name) { + for (const host of this._hosts) { + if (host.hasTaskExecutor(name)) { + return true; + } + } + return false; + } +} +exports.FallbackEngineHost = FallbackEngineHost; diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/tools/file-system-engine-host-base.d.ts b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/tools/file-system-engine-host-base.d.ts new file mode 100644 index 00000000..7c76aef6 --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/tools/file-system-engine-host-base.d.ts @@ -0,0 +1,75 @@ +/** + * @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 { BaseException } from '@angular-devkit/core'; +import { Observable } from 'rxjs'; +import { Url } from 'url'; +import { RuleFactory, Source, TaskExecutor, TaskExecutorFactory } from '../src'; +import { FileSystemCollectionDesc, FileSystemEngineHost, FileSystemSchematicContext, FileSystemSchematicDesc, FileSystemSchematicDescription } from './description'; +export declare type OptionTransform<T extends object, R extends object> = (schematic: FileSystemSchematicDescription, options: T, context?: FileSystemSchematicContext) => Observable<R> | PromiseLike<R> | R; +export declare type ContextTransform = (context: FileSystemSchematicContext) => FileSystemSchematicContext; +export declare class CollectionCannotBeResolvedException extends BaseException { + constructor(name: string); +} +export declare class InvalidCollectionJsonException extends BaseException { + constructor(_name: string, path: string, jsonException?: Error); +} +export declare class SchematicMissingFactoryException extends BaseException { + constructor(name: string); +} +export declare class FactoryCannotBeResolvedException extends BaseException { + constructor(name: string); +} +export declare class CollectionMissingSchematicsMapException extends BaseException { + constructor(name: string); +} +export declare class CollectionMissingFieldsException extends BaseException { + constructor(name: string); +} +export declare class SchematicMissingFieldsException extends BaseException { + constructor(name: string); +} +export declare class SchematicMissingDescriptionException extends BaseException { + constructor(name: string); +} +export declare class SchematicNameCollisionException extends BaseException { + constructor(name: string); +} +/** + * A EngineHost base class that uses the file system to resolve collections. This is the base of + * all other EngineHost provided by the tooling part of the Schematics library. + */ +export declare abstract class FileSystemEngineHostBase implements FileSystemEngineHost { + protected abstract _resolveCollectionPath(name: string, requester?: string): string; + protected abstract _resolveReferenceString(name: string, parentPath: string): { + ref: RuleFactory<{}>; + path: string; + } | null; + protected abstract _transformCollectionDescription(name: string, desc: Partial<FileSystemCollectionDesc>): FileSystemCollectionDesc; + protected abstract _transformSchematicDescription(name: string, collection: FileSystemCollectionDesc, desc: Partial<FileSystemSchematicDesc>): FileSystemSchematicDesc; + private _transforms; + private _contextTransforms; + private _taskFactories; + listSchematicNames(collection: FileSystemCollectionDesc): string[]; + registerOptionsTransform<T extends object, R extends object>(t: OptionTransform<T, R>): void; + registerContextTransform(t: ContextTransform): void; + /** + * + * @param name + * @return {{path: string}} + */ + createCollectionDescription(name: string, requester?: FileSystemCollectionDesc): FileSystemCollectionDesc; + createSchematicDescription(name: string, collection: FileSystemCollectionDesc): FileSystemSchematicDesc | null; + createSourceFromUrl(url: Url): Source | null; + transformOptions<OptionT extends object, ResultT extends object>(schematic: FileSystemSchematicDesc, options: OptionT, context?: FileSystemSchematicContext): Observable<ResultT>; + transformContext(context: FileSystemSchematicContext): FileSystemSchematicContext; + getSchematicRuleFactory<OptionT extends object>(schematic: FileSystemSchematicDesc, _collection: FileSystemCollectionDesc): RuleFactory<OptionT>; + registerTaskExecutor<T>(factory: TaskExecutorFactory<T>, options?: T): void; + createTaskExecutor(name: string): Observable<TaskExecutor>; + hasTaskExecutor(name: string): boolean; +} diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/tools/file-system-engine-host-base.js b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/tools/file-system-engine-host-base.js new file mode 100644 index 00000000..84ab178a --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/tools/file-system-engine-host-base.js @@ -0,0 +1,261 @@ +"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.FileSystemEngineHostBase = exports.SchematicNameCollisionException = exports.SchematicMissingDescriptionException = exports.SchematicMissingFieldsException = exports.CollectionMissingFieldsException = exports.CollectionMissingSchematicsMapException = exports.FactoryCannotBeResolvedException = exports.SchematicMissingFactoryException = exports.InvalidCollectionJsonException = exports.CollectionCannotBeResolvedException = void 0; +const core_1 = require("@angular-devkit/core"); +const node_1 = require("@angular-devkit/core/node"); +const fs_1 = require("fs"); +const path_1 = require("path"); +const rxjs_1 = require("rxjs"); +const src_1 = require("../src"); +const file_system_utility_1 = require("./file-system-utility"); +class CollectionCannotBeResolvedException extends core_1.BaseException { + constructor(name) { + super(`Collection ${JSON.stringify(name)} cannot be resolved.`); + } +} +exports.CollectionCannotBeResolvedException = CollectionCannotBeResolvedException; +class InvalidCollectionJsonException extends core_1.BaseException { + constructor(_name, path, jsonException) { + let msg = `Collection JSON at path ${JSON.stringify(path)} is invalid.`; + if (jsonException) { + msg = `${msg} ${jsonException.message}`; + } + super(msg); + } +} +exports.InvalidCollectionJsonException = InvalidCollectionJsonException; +class SchematicMissingFactoryException extends core_1.BaseException { + constructor(name) { + super(`Schematic ${JSON.stringify(name)} is missing a factory.`); + } +} +exports.SchematicMissingFactoryException = SchematicMissingFactoryException; +class FactoryCannotBeResolvedException extends core_1.BaseException { + constructor(name) { + super(`Schematic ${JSON.stringify(name)} cannot resolve the factory.`); + } +} +exports.FactoryCannotBeResolvedException = FactoryCannotBeResolvedException; +class CollectionMissingSchematicsMapException extends core_1.BaseException { + constructor(name) { + super(`Collection "${name}" does not have a schematics map.`); + } +} +exports.CollectionMissingSchematicsMapException = CollectionMissingSchematicsMapException; +class CollectionMissingFieldsException extends core_1.BaseException { + constructor(name) { + super(`Collection "${name}" is missing fields.`); + } +} +exports.CollectionMissingFieldsException = CollectionMissingFieldsException; +class SchematicMissingFieldsException extends core_1.BaseException { + constructor(name) { + super(`Schematic "${name}" is missing fields.`); + } +} +exports.SchematicMissingFieldsException = SchematicMissingFieldsException; +class SchematicMissingDescriptionException extends core_1.BaseException { + constructor(name) { + super(`Schematics "${name}" does not have a description.`); + } +} +exports.SchematicMissingDescriptionException = SchematicMissingDescriptionException; +class SchematicNameCollisionException extends core_1.BaseException { + constructor(name) { + super(`Schematics/alias ${JSON.stringify(name)} collides with another alias or schematic` + + ' name.'); + } +} +exports.SchematicNameCollisionException = SchematicNameCollisionException; +/** + * A EngineHost base class that uses the file system to resolve collections. This is the base of + * all other EngineHost provided by the tooling part of the Schematics library. + */ +class FileSystemEngineHostBase { + constructor() { + // eslint-disable-next-line @typescript-eslint/no-explicit-any + this._transforms = []; + this._contextTransforms = []; + this._taskFactories = new Map(); + } + listSchematicNames(collection) { + const schematics = []; + for (const key of Object.keys(collection.schematics)) { + const schematic = collection.schematics[key]; + if (schematic.hidden || schematic.private) { + continue; + } + // If extends is present without a factory it is an alias, do not return it + // unless it is from another collection. + if (!schematic.extends || schematic.factory) { + schematics.push(key); + } + else if (schematic.extends && schematic.extends.indexOf(':') !== -1) { + schematics.push(key); + } + } + return schematics; + } + registerOptionsTransform(t) { + this._transforms.push(t); + } + registerContextTransform(t) { + this._contextTransforms.push(t); + } + /** + * + * @param name + * @return {{path: string}} + */ + createCollectionDescription(name, requester) { + const path = this._resolveCollectionPath(name, requester === null || requester === void 0 ? void 0 : requester.path); + const jsonValue = (0, file_system_utility_1.readJsonFile)(path); + if (!jsonValue || typeof jsonValue != 'object' || Array.isArray(jsonValue)) { + throw new InvalidCollectionJsonException(name, path); + } + // normalize extends property to an array + if (typeof jsonValue['extends'] === 'string') { + jsonValue['extends'] = [jsonValue['extends']]; + } + const description = this._transformCollectionDescription(name, { + ...jsonValue, + path, + }); + if (!description || !description.name) { + throw new InvalidCollectionJsonException(name, path); + } + // Validate aliases. + const allNames = Object.keys(description.schematics); + for (const schematicName of Object.keys(description.schematics)) { + const aliases = description.schematics[schematicName].aliases || []; + for (const alias of aliases) { + if (allNames.indexOf(alias) != -1) { + throw new SchematicNameCollisionException(alias); + } + } + allNames.push(...aliases); + } + return description; + } + createSchematicDescription(name, collection) { + // Resolve aliases first. + for (const schematicName of Object.keys(collection.schematics)) { + const schematicDescription = collection.schematics[schematicName]; + if (schematicDescription.aliases && schematicDescription.aliases.indexOf(name) != -1) { + name = schematicName; + break; + } + } + if (!(name in collection.schematics)) { + return null; + } + const collectionPath = (0, path_1.dirname)(collection.path); + const partialDesc = collection.schematics[name]; + if (!partialDesc) { + return null; + } + if (partialDesc.extends) { + const index = partialDesc.extends.indexOf(':'); + const collectionName = index !== -1 ? partialDesc.extends.substr(0, index) : null; + const schematicName = index === -1 ? partialDesc.extends : partialDesc.extends.substr(index + 1); + if (collectionName !== null) { + const extendCollection = this.createCollectionDescription(collectionName); + return this.createSchematicDescription(schematicName, extendCollection); + } + else { + return this.createSchematicDescription(schematicName, collection); + } + } + // Use any on this ref as we don't have the OptionT here, but we don't need it (we only need + // the path). + if (!partialDesc.factory) { + throw new SchematicMissingFactoryException(name); + } + const resolvedRef = this._resolveReferenceString(partialDesc.factory, collectionPath); + if (!resolvedRef) { + throw new FactoryCannotBeResolvedException(name); + } + let schema = partialDesc.schema; + let schemaJson = undefined; + if (schema) { + if (!(0, path_1.isAbsolute)(schema)) { + schema = (0, path_1.join)(collectionPath, schema); + } + schemaJson = (0, file_system_utility_1.readJsonFile)(schema); + } + // The schematic path is used to resolve URLs. + // We should be able to just do `dirname(resolvedRef.path)` but for compatibility with + // Bazel under Windows this directory needs to be resolved from the collection instead. + // This is needed because on Bazel under Windows the data files (such as the collection or + // url files) are not in the same place as the compiled JS. + const maybePath = (0, path_1.join)(collectionPath, partialDesc.factory); + const path = (0, fs_1.existsSync)(maybePath) && (0, fs_1.statSync)(maybePath).isDirectory() ? maybePath : (0, path_1.dirname)(maybePath); + return this._transformSchematicDescription(name, collection, { + ...partialDesc, + schema, + schemaJson, + name, + path, + factoryFn: resolvedRef.ref, + collection, + }); + } + createSourceFromUrl(url) { + switch (url.protocol) { + case null: + case 'file:': + return (context) => { + // Check if context has necessary FileSystemSchematicContext path property + const fileDescription = context.schematic.description; + if (fileDescription.path === undefined) { + throw new Error('Unsupported schematic context. Expected a FileSystemSchematicContext.'); + } + // Resolve all file:///a/b/c/d from the schematic's own path, and not the current + // path. + const root = (0, core_1.normalize)((0, path_1.resolve)(fileDescription.path, url.path || '')); + return new src_1.HostCreateTree(new core_1.virtualFs.ScopedHost(new node_1.NodeJsSyncHost(), root)); + }; + } + return null; + } + transformOptions(schematic, options, context) { + const transform = async () => { + let transformedOptions = options; + for (const transformer of this._transforms) { + const transformerResult = transformer(schematic, transformedOptions, context); + transformedOptions = await ((0, rxjs_1.isObservable)(transformerResult) + ? transformerResult.toPromise() + : transformerResult); + } + return transformedOptions; + }; + return (0, rxjs_1.from)(transform()); + } + transformContext(context) { + return this._contextTransforms.reduce((acc, curr) => curr(acc), context); + } + getSchematicRuleFactory(schematic, _collection) { + return schematic.factoryFn; + } + registerTaskExecutor(factory, options) { + this._taskFactories.set(factory.name, () => (0, rxjs_1.from)(factory.create(options))); + } + createTaskExecutor(name) { + const factory = this._taskFactories.get(name); + if (factory) { + return factory(); + } + return (0, rxjs_1.throwError)(new src_1.UnregisteredTaskException(name)); + } + hasTaskExecutor(name) { + return this._taskFactories.has(name); + } +} +exports.FileSystemEngineHostBase = FileSystemEngineHostBase; diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/tools/file-system-engine-host.d.ts b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/tools/file-system-engine-host.d.ts new file mode 100644 index 00000000..a99cde93 --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/tools/file-system-engine-host.d.ts @@ -0,0 +1,28 @@ +/** + * @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 + */ +import { Observable } from 'rxjs'; +import { RuleFactory, TaskExecutor } from '../src'; +import { FileSystemCollectionDesc, FileSystemSchematicDesc } from './description'; +import { FileSystemEngineHostBase } from './file-system-engine-host-base'; +/** + * A simple EngineHost that uses a root with one directory per collection inside of it. The + * collection declaration follows the same rules as the regular FileSystemEngineHostBase. + */ +export declare class FileSystemEngineHost extends FileSystemEngineHostBase { + protected _root: string; + constructor(_root: string); + protected _resolveCollectionPath(name: string): string; + protected _resolveReferenceString(refString: string, parentPath: string): { + ref: RuleFactory<{}>; + path: string; + } | null; + protected _transformCollectionDescription(name: string, desc: Partial<FileSystemCollectionDesc>): FileSystemCollectionDesc; + protected _transformSchematicDescription(name: string, _collection: FileSystemCollectionDesc, desc: Partial<FileSystemSchematicDesc>): FileSystemSchematicDesc; + hasTaskExecutor(name: string): boolean; + createTaskExecutor(name: string): Observable<TaskExecutor>; +} diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/tools/file-system-engine-host.js b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/tools/file-system-engine-host.js new file mode 100644 index 00000000..2b3a4cc9 --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/tools/file-system-engine-host.js @@ -0,0 +1,113 @@ +"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 + */ +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.FileSystemEngineHost = void 0; +const fs_1 = require("fs"); +const path_1 = require("path"); +const rxjs_1 = require("rxjs"); +const operators_1 = require("rxjs/operators"); +const src_1 = require("../src"); +const export_ref_1 = require("./export-ref"); +const file_system_engine_host_base_1 = require("./file-system-engine-host-base"); +/** + * A simple EngineHost that uses a root with one directory per collection inside of it. The + * collection declaration follows the same rules as the regular FileSystemEngineHostBase. + */ +class FileSystemEngineHost extends file_system_engine_host_base_1.FileSystemEngineHostBase { + constructor(_root) { + super(); + this._root = _root; + } + _resolveCollectionPath(name) { + try { + // Allow `${_root}/${name}.json` as a collection. + const maybePath = require.resolve((0, path_1.join)(this._root, name + '.json')); + if ((0, fs_1.existsSync)(maybePath)) { + return maybePath; + } + } + catch (error) { } + try { + // Allow `${_root}/${name}/collection.json. + const maybePath = require.resolve((0, path_1.join)(this._root, name, 'collection.json')); + if ((0, fs_1.existsSync)(maybePath)) { + return maybePath; + } + } + catch (error) { } + throw new file_system_engine_host_base_1.CollectionCannotBeResolvedException(name); + } + _resolveReferenceString(refString, parentPath) { + // Use the same kind of export strings as NodeModule. + const ref = new export_ref_1.ExportStringRef(refString, parentPath); + if (!ref.ref) { + return null; + } + return { ref: ref.ref, path: ref.module }; + } + _transformCollectionDescription(name, desc) { + if (!desc.schematics || typeof desc.schematics != 'object') { + throw new file_system_engine_host_base_1.CollectionMissingSchematicsMapException(name); + } + return { + ...desc, + name, + }; + } + _transformSchematicDescription(name, _collection, desc) { + if (!desc.factoryFn || !desc.path || !desc.description) { + throw new file_system_engine_host_base_1.SchematicMissingFieldsException(name); + } + return desc; + } + hasTaskExecutor(name) { + if (super.hasTaskExecutor(name)) { + return true; + } + try { + const maybePath = require.resolve((0, path_1.join)(this._root, name)); + if ((0, fs_1.existsSync)(maybePath)) { + return true; + } + } + catch { } + return false; + } + createTaskExecutor(name) { + if (!super.hasTaskExecutor(name)) { + try { + const path = require.resolve((0, path_1.join)(this._root, name)); + // Default handling code is for old tasks that incorrectly export `default` with non-ESM module + return (0, rxjs_1.from)(Promise.resolve().then(() => __importStar(require(path))).then((mod) => { var _a; return (((_a = mod.default) === null || _a === void 0 ? void 0 : _a.default) || mod.default)(); })).pipe((0, operators_1.catchError)(() => (0, rxjs_1.throwError)(new src_1.UnregisteredTaskException(name)))); + } + catch { } + } + return super.createTaskExecutor(name); + } +} +exports.FileSystemEngineHost = FileSystemEngineHost; diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/tools/file-system-utility.d.ts b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/tools/file-system-utility.d.ts new file mode 100644 index 00000000..2586150f --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/tools/file-system-utility.d.ts @@ -0,0 +1,9 @@ +/** + * @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 + */ +import { JsonValue } from '@angular-devkit/core'; +export declare function readJsonFile(path: string): JsonValue; diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/tools/file-system-utility.js b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/tools/file-system-utility.js new file mode 100644 index 00000000..e8499727 --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/tools/file-system-utility.js @@ -0,0 +1,26 @@ +"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.readJsonFile = void 0; +const schematics_1 = require("@angular-devkit/schematics"); +const fs_1 = require("fs"); +const jsonc_parser_1 = require("jsonc-parser"); +function readJsonFile(path) { + if (!(0, fs_1.existsSync)(path)) { + throw new schematics_1.FileDoesNotExistException(path); + } + const errors = []; + const content = (0, jsonc_parser_1.parse)((0, fs_1.readFileSync)(path, 'utf-8'), errors, { allowTrailingComma: true }); + if (errors.length) { + const { error, offset } = errors[0]; + throw new Error(`Failed to parse "${path}" as JSON AST Object. ${(0, jsonc_parser_1.printParseErrorCode)(error)} at location: ${offset}.`); + } + return content; +} +exports.readJsonFile = readJsonFile; diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/tools/index.d.ts b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/tools/index.d.ts new file mode 100644 index 00000000..5f2672b0 --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/tools/index.d.ts @@ -0,0 +1,15 @@ +/** + * @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 + */ +export * from './description'; +export * from './export-ref'; +export * from './file-system-engine-host-base'; +export * from './workflow/node-workflow'; +export { FileSystemEngineHost } from './file-system-engine-host'; +export { NodeModulesEngineHost, NodePackageDoesNotSupportSchematics, } from './node-module-engine-host'; +export { NodeModulesTestEngineHost } from './node-modules-test-engine-host'; +export { validateOptionsWithSchema } from './schema-option-transform'; diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/tools/index.js b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/tools/index.js new file mode 100644 index 00000000..8efe0672 --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/tools/index.js @@ -0,0 +1,33 @@ +"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 + */ +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __exportStar = (this && this.__exportStar) || function(m, exports) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.validateOptionsWithSchema = exports.NodeModulesTestEngineHost = exports.NodePackageDoesNotSupportSchematics = exports.NodeModulesEngineHost = exports.FileSystemEngineHost = void 0; +__exportStar(require("./description"), exports); +__exportStar(require("./export-ref"), exports); +__exportStar(require("./file-system-engine-host-base"), exports); +__exportStar(require("./workflow/node-workflow"), exports); +var file_system_engine_host_1 = require("./file-system-engine-host"); +Object.defineProperty(exports, "FileSystemEngineHost", { enumerable: true, get: function () { return file_system_engine_host_1.FileSystemEngineHost; } }); +var node_module_engine_host_1 = require("./node-module-engine-host"); +Object.defineProperty(exports, "NodeModulesEngineHost", { enumerable: true, get: function () { return node_module_engine_host_1.NodeModulesEngineHost; } }); +Object.defineProperty(exports, "NodePackageDoesNotSupportSchematics", { enumerable: true, get: function () { return node_module_engine_host_1.NodePackageDoesNotSupportSchematics; } }); +var node_modules_test_engine_host_1 = require("./node-modules-test-engine-host"); +Object.defineProperty(exports, "NodeModulesTestEngineHost", { enumerable: true, get: function () { return node_modules_test_engine_host_1.NodeModulesTestEngineHost; } }); +var schema_option_transform_1 = require("./schema-option-transform"); +Object.defineProperty(exports, "validateOptionsWithSchema", { enumerable: true, get: function () { return schema_option_transform_1.validateOptionsWithSchema; } }); diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/tools/node-module-engine-host.d.ts b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/tools/node-module-engine-host.d.ts new file mode 100644 index 00000000..e1122fd7 --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/tools/node-module-engine-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 + */ +import { BaseException } from '@angular-devkit/core'; +import { RuleFactory } from '../src'; +import { FileSystemCollectionDesc, FileSystemSchematicDesc } from './description'; +import { FileSystemEngineHostBase } from './file-system-engine-host-base'; +export declare class NodePackageDoesNotSupportSchematics extends BaseException { + constructor(name: string); +} +/** + * A simple EngineHost that uses NodeModules to resolve collections. + */ +export declare class NodeModulesEngineHost extends FileSystemEngineHostBase { + private readonly paths?; + constructor(paths?: string[] | undefined); + private resolve; + protected _resolveCollectionPath(name: string, requester?: string): string; + protected _resolveReferenceString(refString: string, parentPath: string): { + ref: RuleFactory<{}>; + path: string; + } | null; + protected _transformCollectionDescription(name: string, desc: Partial<FileSystemCollectionDesc>): FileSystemCollectionDesc; + protected _transformSchematicDescription(name: string, _collection: FileSystemCollectionDesc, desc: Partial<FileSystemSchematicDesc>): FileSystemSchematicDesc; +} diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/tools/node-module-engine-host.js b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/tools/node-module-engine-host.js new file mode 100644 index 00000000..23b4a332 --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/tools/node-module-engine-host.js @@ -0,0 +1,107 @@ +"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.NodeModulesEngineHost = exports.NodePackageDoesNotSupportSchematics = void 0; +const core_1 = require("@angular-devkit/core"); +const path_1 = require("path"); +const export_ref_1 = require("./export-ref"); +const file_system_engine_host_base_1 = require("./file-system-engine-host-base"); +const file_system_utility_1 = require("./file-system-utility"); +class NodePackageDoesNotSupportSchematics extends core_1.BaseException { + constructor(name) { + super(`Package ${JSON.stringify(name)} was found but does not support schematics.`); + } +} +exports.NodePackageDoesNotSupportSchematics = NodePackageDoesNotSupportSchematics; +/** + * A simple EngineHost that uses NodeModules to resolve collections. + */ +class NodeModulesEngineHost extends file_system_engine_host_base_1.FileSystemEngineHostBase { + constructor(paths) { + super(); + this.paths = paths; + } + resolve(name, requester, references = new Set()) { + if (requester) { + if (references.has(requester)) { + references.add(requester); + throw new Error('Circular schematic reference detected: ' + JSON.stringify(Array.from(references))); + } + else { + references.add(requester); + } + } + const relativeBase = requester ? (0, path_1.dirname)(requester) : process.cwd(); + let collectionPath = undefined; + if (name.startsWith('.')) { + name = (0, path_1.resolve)(relativeBase, name); + } + const resolveOptions = { + paths: requester ? [(0, path_1.dirname)(requester), ...(this.paths || [])] : this.paths, + }; + // Try to resolve as a package + try { + const packageJsonPath = require.resolve((0, path_1.join)(name, 'package.json'), resolveOptions); + const { schematics } = require(packageJsonPath); + if (!schematics || typeof schematics !== 'string') { + throw new NodePackageDoesNotSupportSchematics(name); + } + collectionPath = this.resolve(schematics, packageJsonPath, references); + } + catch (e) { + if (e.code !== 'MODULE_NOT_FOUND') { + throw e; + } + } + // If not a package, try to resolve as a file + if (!collectionPath) { + try { + collectionPath = require.resolve(name, resolveOptions); + } + catch (e) { + if (e.code !== 'MODULE_NOT_FOUND') { + throw e; + } + } + } + // If not a package or a file, error + if (!collectionPath) { + throw new file_system_engine_host_base_1.CollectionCannotBeResolvedException(name); + } + return collectionPath; + } + _resolveCollectionPath(name, requester) { + const collectionPath = this.resolve(name, requester); + (0, file_system_utility_1.readJsonFile)(collectionPath); + return collectionPath; + } + _resolveReferenceString(refString, parentPath) { + const ref = new export_ref_1.ExportStringRef(refString, parentPath); + if (!ref.ref) { + return null; + } + return { ref: ref.ref, path: ref.module }; + } + _transformCollectionDescription(name, desc) { + if (!desc.schematics || typeof desc.schematics != 'object') { + throw new file_system_engine_host_base_1.CollectionMissingSchematicsMapException(name); + } + return { + ...desc, + name, + }; + } + _transformSchematicDescription(name, _collection, desc) { + if (!desc.factoryFn || !desc.path || !desc.description) { + throw new file_system_engine_host_base_1.SchematicMissingFieldsException(name); + } + return desc; + } +} +exports.NodeModulesEngineHost = NodeModulesEngineHost; diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/tools/node-modules-test-engine-host.d.ts b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/tools/node-modules-test-engine-host.d.ts new file mode 100644 index 00000000..60ac61ac --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/tools/node-modules-test-engine-host.d.ts @@ -0,0 +1,23 @@ +/** + * @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 + */ +import { TaskConfiguration } from '../src/engine'; +import { FileSystemSchematicContext } from './description'; +import { NodeModulesEngineHost } from './node-module-engine-host'; +/** + * An EngineHost that uses a registry to super seed locations of collection.json files, but + * revert back to using node modules resolution. This is done for testing. + */ +export declare class NodeModulesTestEngineHost extends NodeModulesEngineHost { + private _collections; + private _tasks; + get tasks(): TaskConfiguration<{}>[]; + clearTasks(): void; + registerCollection(name: string, path: string): void; + transformContext(context: FileSystemSchematicContext): FileSystemSchematicContext; + protected _resolveCollectionPath(name: string, requester?: string): string; +} diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/tools/node-modules-test-engine-host.js b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/tools/node-modules-test-engine-host.js new file mode 100644 index 00000000..abaab377 --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/tools/node-modules-test-engine-host.js @@ -0,0 +1,47 @@ +"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.NodeModulesTestEngineHost = void 0; +const node_module_engine_host_1 = require("./node-module-engine-host"); +/** + * An EngineHost that uses a registry to super seed locations of collection.json files, but + * revert back to using node modules resolution. This is done for testing. + */ +class NodeModulesTestEngineHost extends node_module_engine_host_1.NodeModulesEngineHost { + constructor() { + super(...arguments); + this._collections = new Map(); + this._tasks = []; + } + get tasks() { + return this._tasks; + } + clearTasks() { + this._tasks = []; + } + registerCollection(name, path) { + this._collections.set(name, path); + } + transformContext(context) { + const oldAddTask = context.addTask; + context.addTask = (task, dependencies) => { + this._tasks.push(task.toConfiguration()); + return oldAddTask.call(context, task, dependencies); + }; + return context; + } + _resolveCollectionPath(name, requester) { + const maybePath = this._collections.get(name); + if (maybePath) { + return maybePath; + } + return super._resolveCollectionPath(name, requester); + } +} +exports.NodeModulesTestEngineHost = NodeModulesTestEngineHost; diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/tools/package.json b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/tools/package.json new file mode 100644 index 00000000..e82f12c2 --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/tools/package.json @@ -0,0 +1,5 @@ +{ + "name": "@angular-devkit/schematics/tools", + "main": "index.js", + "typings": "index.d.ts" +} diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/tools/schema-option-transform.d.ts b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/tools/schema-option-transform.d.ts new file mode 100644 index 00000000..a7de1dcc --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/tools/schema-option-transform.d.ts @@ -0,0 +1,14 @@ +/** + * @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 + */ +import { schema } from '@angular-devkit/core'; +import { Observable } from 'rxjs'; +import { FileSystemSchematicContext, FileSystemSchematicDescription } from './description'; +export declare class InvalidInputOptions<T = {}> extends schema.SchemaValidationException { + constructor(options: T, errors: schema.SchemaValidatorError[]); +} +export declare function validateOptionsWithSchema(registry: schema.SchemaRegistry): <T extends {}>(schematic: FileSystemSchematicDescription, options: T, context?: FileSystemSchematicContext | undefined) => Observable<T>; diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/tools/schema-option-transform.js b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/tools/schema-option-transform.js new file mode 100644 index 00000000..9d665a85 --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/tools/schema-option-transform.js @@ -0,0 +1,38 @@ +"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.validateOptionsWithSchema = exports.InvalidInputOptions = void 0; +const core_1 = require("@angular-devkit/core"); +const rxjs_1 = require("rxjs"); +const operators_1 = require("rxjs/operators"); +class InvalidInputOptions extends core_1.schema.SchemaValidationException { + constructor(options, errors) { + super(errors, `Schematic input does not validate against the Schema: ${JSON.stringify(options)}\nErrors:\n`); + } +} +exports.InvalidInputOptions = InvalidInputOptions; +// This can only be used in NodeJS. +function validateOptionsWithSchema(registry) { + return (schematic, options, context) => { + // Prevent a schematic from changing the options object by making a copy of it. + options = (0, core_1.deepCopy)(options); + const withPrompts = context ? context.interactive : true; + if (schematic.schema && schematic.schemaJson) { + // Make a deep copy of options. + return registry.compile(schematic.schemaJson).pipe((0, operators_1.mergeMap)((validator) => validator(options, { withPrompts })), (0, operators_1.first)(), (0, operators_1.map)((result) => { + if (!result.success) { + throw new InvalidInputOptions(options, result.errors || []); + } + return options; + })); + } + return (0, rxjs_1.of)(options); + }; +} +exports.validateOptionsWithSchema = validateOptionsWithSchema; diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/tools/workflow/node-workflow.d.ts b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/tools/workflow/node-workflow.d.ts new file mode 100644 index 00000000..cbbcaba3 --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/tools/workflow/node-workflow.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 + */ +import { Path, schema, virtualFs } from '@angular-devkit/core'; +import { workflow } from '@angular-devkit/schematics'; +import { FileSystemEngine } from '../description'; +import { OptionTransform } from '../file-system-engine-host-base'; +import { NodeModulesEngineHost } from '../node-module-engine-host'; +export interface NodeWorkflowOptions { + force?: boolean; + dryRun?: boolean; + packageManager?: string; + packageManagerForce?: boolean; + packageRegistry?: string; + registry?: schema.CoreSchemaRegistry; + resolvePaths?: string[]; + schemaValidation?: boolean; + optionTransforms?: OptionTransform<object, object>[]; + engineHostCreator?: (options: NodeWorkflowOptions) => NodeModulesEngineHost; +} +/** + * A workflow specifically for Node tools. + */ +export declare class NodeWorkflow extends workflow.BaseWorkflow { + constructor(root: string, options: NodeWorkflowOptions); + constructor(host: virtualFs.Host, options: NodeWorkflowOptions & { + root?: Path; + }); + get engine(): FileSystemEngine; + get engineHost(): NodeModulesEngineHost; +} diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/tools/workflow/node-workflow.js b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/tools/workflow/node-workflow.js new file mode 100644 index 00000000..41a69c28 --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/tools/workflow/node-workflow.js @@ -0,0 +1,69 @@ +"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.NodeWorkflow = void 0; +const core_1 = require("@angular-devkit/core"); +const node_1 = require("@angular-devkit/core/node"); +const schematics_1 = require("@angular-devkit/schematics"); +const node_2 = require("../../tasks/node"); +const node_module_engine_host_1 = require("../node-module-engine-host"); +const schema_option_transform_1 = require("../schema-option-transform"); +/** + * A workflow specifically for Node tools. + */ +class NodeWorkflow extends schematics_1.workflow.BaseWorkflow { + constructor(hostOrRoot, options) { + var _a; + let host; + let root; + if (typeof hostOrRoot === 'string') { + root = (0, core_1.normalize)(hostOrRoot); + host = new core_1.virtualFs.ScopedHost(new node_1.NodeJsSyncHost(), root); + } + else { + host = hostOrRoot; + root = options.root; + } + const engineHost = ((_a = options.engineHostCreator) === null || _a === void 0 ? void 0 : _a.call(options, options)) || new node_module_engine_host_1.NodeModulesEngineHost(options.resolvePaths); + super({ + host, + engineHost, + force: options.force, + dryRun: options.dryRun, + registry: options.registry, + }); + engineHost.registerTaskExecutor(node_2.BuiltinTaskExecutor.NodePackage, { + allowPackageManagerOverride: true, + packageManager: options.packageManager, + force: options.packageManagerForce, + rootDirectory: root && (0, core_1.getSystemPath)(root), + registry: options.packageRegistry, + }); + engineHost.registerTaskExecutor(node_2.BuiltinTaskExecutor.RepositoryInitializer, { + rootDirectory: root && (0, core_1.getSystemPath)(root), + }); + engineHost.registerTaskExecutor(node_2.BuiltinTaskExecutor.RunSchematic); + if (options.optionTransforms) { + for (const transform of options.optionTransforms) { + engineHost.registerOptionsTransform(transform); + } + } + if (options.schemaValidation) { + engineHost.registerOptionsTransform((0, schema_option_transform_1.validateOptionsWithSchema)(this.registry)); + } + this._context = []; + } + get engine() { + return this._engine; + } + get engineHost() { + return this._engineHost; + } +} +exports.NodeWorkflow = NodeWorkflow; |