From 291803c31f829fe0d32bb3207bc11def95a7408c Mon Sep 17 00:00:00 2001 From: Nevena Bojovic Date: Tue, 1 Mar 2022 20:05:50 +0100 Subject: Urađena test aplikacija. Povezan front i back. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../node_modules/@angular-devkit/core/LICENSE | 21 + .../node_modules/@angular-devkit/core/README.md | 167 +++++ .../@angular-devkit/core/node/BUILD.bazel | 65 ++ .../@angular-devkit/core/node/cli-logger.d.ts | 16 + .../@angular-devkit/core/node/cli-logger.js | 58 ++ .../core/node/experimental/index.d.ts | 9 + .../core/node/experimental/index.js | 31 + .../core/node/experimental/jobs/index.d.ts | 8 + .../core/node/experimental/jobs/index.js | 20 + .../core/node/experimental/jobs/job-registry.d.ts | 19 + .../core/node/experimental/jobs/job-registry.js | 59 ++ .../node_modules/@angular-devkit/core/node/fs.d.ts | 11 + .../node_modules/@angular-devkit/core/node/fs.js | 41 ++ .../@angular-devkit/core/node/host.d.ts | 44 ++ .../node_modules/@angular-devkit/core/node/host.js | 265 +++++++ .../@angular-devkit/core/node/index.d.ts | 12 + .../@angular-devkit/core/node/index.js | 38 + .../@angular-devkit/core/node/package.json | 5 + .../@angular-devkit/core/node/testing/BUILD.bazel | 31 + .../@angular-devkit/core/node/testing/index.d.ts | 21 + .../@angular-devkit/core/node/testing/index.js | 72 ++ .../node_modules/@angular-devkit/core/package.json | 46 ++ .../@angular-devkit/core/src/analytics/api.d.ts | 46 ++ .../@angular-devkit/core/src/analytics/api.js | 9 + .../core/src/analytics/forwarder.d.ts | 67 ++ .../core/src/analytics/forwarder.js | 88 +++ .../@angular-devkit/core/src/analytics/index.d.ts | 53 ++ .../@angular-devkit/core/src/analytics/index.js | 92 +++ .../core/src/analytics/logging.d.ts | 22 + .../@angular-devkit/core/src/analytics/logging.js | 35 + .../@angular-devkit/core/src/analytics/multi.d.ts | 21 + .../@angular-devkit/core/src/analytics/multi.js | 37 + .../@angular-devkit/core/src/analytics/noop.d.ts | 18 + .../@angular-devkit/core/src/analytics/noop.js | 23 + .../core/src/exception/exception.d.ts | 40 ++ .../core/src/exception/exception.js | 77 ++ .../@angular-devkit/core/src/exception/index.d.ts | 8 + .../@angular-devkit/core/src/exception/index.js | 20 + .../@angular-devkit/core/src/experimental.d.ts | 9 + .../@angular-devkit/core/src/experimental.js | 31 + .../core/src/experimental/jobs/README.md | 510 +++++++++++++ .../core/src/experimental/jobs/api.d.ts | 332 +++++++++ .../core/src/experimental/jobs/api.js | 73 ++ .../core/src/experimental/jobs/architecture.md | 260 +++++++ .../src/experimental/jobs/create-job-handler.d.ts | 48 ++ .../src/experimental/jobs/create-job-handler.js | 135 ++++ .../core/src/experimental/jobs/dispatcher.d.ts | 31 + .../core/src/experimental/jobs/dispatcher.js | 50 ++ .../core/src/experimental/jobs/exception.d.ts | 15 + .../core/src/experimental/jobs/exception.js | 23 + .../src/experimental/jobs/fallback-registry.d.ts | 19 + .../src/experimental/jobs/fallback-registry.js | 27 + .../core/src/experimental/jobs/index.d.ts | 15 + .../core/src/experimental/jobs/index.js | 27 + .../src/experimental/jobs/simple-registry.d.ts | 44 ++ .../core/src/experimental/jobs/simple-registry.js | 77 ++ .../src/experimental/jobs/simple-scheduler.d.ts | 77 ++ .../core/src/experimental/jobs/simple-scheduler.js | 382 ++++++++++ .../core/src/experimental/jobs/strategy.d.ts | 28 + .../core/src/experimental/jobs/strategy.js | 92 +++ .../@angular-devkit/core/src/index.d.ts | 17 + .../node_modules/@angular-devkit/core/src/index.js | 46 ++ .../@angular-devkit/core/src/json/index.d.ts | 10 + .../@angular-devkit/core/src/json/index.js | 35 + .../@angular-devkit/core/src/json/parser.d.ts | 104 +++ .../@angular-devkit/core/src/json/parser.js | 788 +++++++++++++++++++++ .../@angular-devkit/core/src/json/parser_ast.d.ts | 67 ++ .../@angular-devkit/core/src/json/parser_ast.js | 9 + .../core/src/json/schema/index.d.ts | 15 + .../@angular-devkit/core/src/json/schema/index.js | 40 ++ .../core/src/json/schema/interface.d.ts | 88 +++ .../core/src/json/schema/interface.js | 9 + .../core/src/json/schema/pointer.d.ts | 11 + .../core/src/json/schema/pointer.js | 39 + .../core/src/json/schema/registry.d.ts | 80 +++ .../core/src/json/schema/registry.js | 548 ++++++++++++++ .../core/src/json/schema/schema.d.ts | 22 + .../@angular-devkit/core/src/json/schema/schema.js | 52 ++ .../core/src/json/schema/transforms.d.ts | 11 + .../core/src/json/schema/transforms.js | 94 +++ .../core/src/json/schema/utility.d.ts | 9 + .../core/src/json/schema/utility.js | 88 +++ .../core/src/json/schema/visitor.d.ts | 34 + .../core/src/json/schema/visitor.js | 148 ++++ .../@angular-devkit/core/src/json/utils.d.ts | 15 + .../@angular-devkit/core/src/json/utils.js | 18 + .../@angular-devkit/core/src/logger/indent.d.ts | 11 + .../@angular-devkit/core/src/logger/indent.js | 40 ++ .../@angular-devkit/core/src/logger/index.d.ts | 12 + .../@angular-devkit/core/src/logger/index.js | 24 + .../@angular-devkit/core/src/logger/level.d.ts | 28 + .../@angular-devkit/core/src/logger/level.js | 44 ++ .../@angular-devkit/core/src/logger/logger.d.ts | 55 ++ .../@angular-devkit/core/src/logger/logger.js | 119 ++++ .../core/src/logger/null-logger.d.ts | 12 + .../@angular-devkit/core/src/logger/null-logger.js | 30 + .../core/src/logger/transform-logger.d.ts | 12 + .../core/src/logger/transform-logger.js | 18 + .../@angular-devkit/core/src/utils/array.d.ts | 9 + .../@angular-devkit/core/src/utils/array.js | 15 + .../@angular-devkit/core/src/utils/index.d.ts | 25 + .../@angular-devkit/core/src/utils/index.js | 42 ++ .../@angular-devkit/core/src/utils/lang.d.ts | 11 + .../@angular-devkit/core/src/utils/lang.js | 21 + .../@angular-devkit/core/src/utils/literals.d.ts | 15 + .../@angular-devkit/core/src/utils/literals.js | 59 ++ .../@angular-devkit/core/src/utils/object.d.ts | 14 + .../@angular-devkit/core/src/utils/object.js | 45 ++ .../core/src/utils/partially-ordered-set.d.ts | 38 + .../core/src/utils/partially-ordered-set.js | 145 ++++ .../core/src/utils/priority-queue.d.ts | 19 + .../core/src/utils/priority-queue.js | 48 ++ .../@angular-devkit/core/src/utils/strings.d.ts | 111 +++ .../@angular-devkit/core/src/utils/strings.js | 178 +++++ .../@angular-devkit/core/src/utils/template.d.ts | 89 +++ .../@angular-devkit/core/src/utils/template.js | 262 +++++++ .../core/src/virtual-fs/host/alias.d.ts | 60 ++ .../core/src/virtual-fs/host/alias.js | 86 +++ .../core/src/virtual-fs/host/buffer.d.ts | 12 + .../core/src/virtual-fs/host/buffer.js | 69 ++ .../core/src/virtual-fs/host/create.d.ts | 21 + .../core/src/virtual-fs/host/create.js | 55 ++ .../core/src/virtual-fs/host/empty.d.ts | 19 + .../core/src/virtual-fs/host/empty.js | 39 + .../core/src/virtual-fs/host/index.d.ts | 20 + .../core/src/virtual-fs/host/index.js | 32 + .../core/src/virtual-fs/host/interface.d.ts | 53 ++ .../core/src/virtual-fs/host/interface.js | 9 + .../core/src/virtual-fs/host/memory.d.ts | 68 ++ .../core/src/virtual-fs/host/memory.js | 330 +++++++++ .../core/src/virtual-fs/host/pattern.d.ts | 17 + .../core/src/virtual-fs/host/pattern.js | 46 ++ .../core/src/virtual-fs/host/record.d.ts | 92 +++ .../core/src/virtual-fs/host/record.js | 314 ++++++++ .../core/src/virtual-fs/host/resolver.d.ts | 30 + .../core/src/virtual-fs/host/resolver.js | 55 ++ .../core/src/virtual-fs/host/safe.d.ts | 25 + .../core/src/virtual-fs/host/safe.js | 45 ++ .../core/src/virtual-fs/host/scoped.d.ts | 15 + .../core/src/virtual-fs/host/scoped.js | 22 + .../core/src/virtual-fs/host/sync.d.ts | 34 + .../core/src/virtual-fs/host/sync.js | 91 +++ .../core/src/virtual-fs/host/test.d.ts | 50 ++ .../core/src/virtual-fs/host/test.js | 122 ++++ .../@angular-devkit/core/src/virtual-fs/index.d.ts | 10 + .../@angular-devkit/core/src/virtual-fs/index.js | 35 + .../@angular-devkit/core/src/virtual-fs/path.d.ts | 113 +++ .../@angular-devkit/core/src/virtual-fs/path.js | 287 ++++++++ .../@angular-devkit/core/src/workspace/core.d.ts | 61 ++ .../@angular-devkit/core/src/workspace/core.js | 132 ++++ .../core/src/workspace/definitions.d.ts | 63 ++ .../core/src/workspace/definitions.js | 167 +++++ .../@angular-devkit/core/src/workspace/host.d.ts | 15 + .../@angular-devkit/core/src/workspace/host.js | 42 ++ .../@angular-devkit/core/src/workspace/index.d.ts | 10 + .../@angular-devkit/core/src/workspace/index.js | 27 + .../core/src/workspace/json/metadata.d.ts | 41 ++ .../core/src/workspace/json/metadata.js | 47 ++ .../core/src/workspace/json/reader.d.ts | 10 + .../core/src/workspace/json/reader.js | 229 ++++++ .../core/src/workspace/json/utilities.d.ts | 18 + .../core/src/workspace/json/utilities.js | 233 ++++++ .../core/src/workspace/json/writer.d.ts | 12 + .../core/src/workspace/json/writer.js | 296 ++++++++ 164 files changed, 11647 insertions(+) create mode 100644 sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/LICENSE create mode 100644 sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/README.md create mode 100644 sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/node/BUILD.bazel create mode 100644 sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/node/cli-logger.d.ts create mode 100644 sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/node/cli-logger.js create mode 100644 sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/node/experimental/index.d.ts create mode 100644 sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/node/experimental/index.js create mode 100644 sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/node/experimental/jobs/index.d.ts create mode 100644 sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/node/experimental/jobs/index.js create mode 100644 sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/node/experimental/jobs/job-registry.d.ts create mode 100644 sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/node/experimental/jobs/job-registry.js create mode 100644 sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/node/fs.d.ts create mode 100644 sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/node/fs.js create mode 100644 sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/node/host.d.ts create mode 100644 sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/node/host.js create mode 100644 sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/node/index.d.ts create mode 100644 sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/node/index.js create mode 100644 sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/node/package.json create mode 100644 sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/node/testing/BUILD.bazel create mode 100644 sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/node/testing/index.d.ts create mode 100644 sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/node/testing/index.js create mode 100644 sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/package.json create mode 100644 sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/analytics/api.d.ts create mode 100644 sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/analytics/api.js create mode 100644 sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/analytics/forwarder.d.ts create mode 100644 sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/analytics/forwarder.js create mode 100644 sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/analytics/index.d.ts create mode 100644 sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/analytics/index.js create mode 100644 sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/analytics/logging.d.ts create mode 100644 sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/analytics/logging.js create mode 100644 sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/analytics/multi.d.ts create mode 100644 sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/analytics/multi.js create mode 100644 sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/analytics/noop.d.ts create mode 100644 sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/analytics/noop.js create mode 100644 sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/exception/exception.d.ts create mode 100644 sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/exception/exception.js create mode 100644 sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/exception/index.d.ts create mode 100644 sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/exception/index.js create mode 100644 sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/experimental.d.ts create mode 100644 sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/experimental.js create mode 100644 sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/experimental/jobs/README.md create mode 100644 sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/experimental/jobs/api.d.ts create mode 100644 sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/experimental/jobs/api.js create mode 100644 sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/experimental/jobs/architecture.md create mode 100644 sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/experimental/jobs/create-job-handler.d.ts create mode 100644 sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/experimental/jobs/create-job-handler.js create mode 100644 sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/experimental/jobs/dispatcher.d.ts create mode 100644 sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/experimental/jobs/dispatcher.js create mode 100644 sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/experimental/jobs/exception.d.ts create mode 100644 sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/experimental/jobs/exception.js create mode 100644 sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/experimental/jobs/fallback-registry.d.ts create mode 100644 sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/experimental/jobs/fallback-registry.js create mode 100644 sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/experimental/jobs/index.d.ts create mode 100644 sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/experimental/jobs/index.js create mode 100644 sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/experimental/jobs/simple-registry.d.ts create mode 100644 sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/experimental/jobs/simple-registry.js create mode 100644 sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/experimental/jobs/simple-scheduler.d.ts create mode 100644 sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/experimental/jobs/simple-scheduler.js create mode 100644 sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/experimental/jobs/strategy.d.ts create mode 100644 sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/experimental/jobs/strategy.js create mode 100644 sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/index.d.ts create mode 100644 sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/index.js create mode 100644 sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/json/index.d.ts create mode 100644 sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/json/index.js create mode 100644 sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/json/parser.d.ts create mode 100644 sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/json/parser.js create mode 100644 sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/json/parser_ast.d.ts create mode 100644 sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/json/parser_ast.js create mode 100644 sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/json/schema/index.d.ts create mode 100644 sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/json/schema/index.js create mode 100644 sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/json/schema/interface.d.ts create mode 100644 sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/json/schema/interface.js create mode 100644 sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/json/schema/pointer.d.ts create mode 100644 sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/json/schema/pointer.js create mode 100644 sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/json/schema/registry.d.ts create mode 100644 sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/json/schema/registry.js create mode 100644 sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/json/schema/schema.d.ts create mode 100644 sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/json/schema/schema.js create mode 100644 sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/json/schema/transforms.d.ts create mode 100644 sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/json/schema/transforms.js create mode 100644 sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/json/schema/utility.d.ts create mode 100644 sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/json/schema/utility.js create mode 100644 sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/json/schema/visitor.d.ts create mode 100644 sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/json/schema/visitor.js create mode 100644 sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/json/utils.d.ts create mode 100644 sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/json/utils.js create mode 100644 sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/logger/indent.d.ts create mode 100644 sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/logger/indent.js create mode 100644 sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/logger/index.d.ts create mode 100644 sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/logger/index.js create mode 100644 sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/logger/level.d.ts create mode 100644 sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/logger/level.js create mode 100644 sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/logger/logger.d.ts create mode 100644 sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/logger/logger.js create mode 100644 sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/logger/null-logger.d.ts create mode 100644 sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/logger/null-logger.js create mode 100644 sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/logger/transform-logger.d.ts create mode 100644 sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/logger/transform-logger.js create mode 100644 sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/utils/array.d.ts create mode 100644 sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/utils/array.js create mode 100644 sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/utils/index.d.ts create mode 100644 sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/utils/index.js create mode 100644 sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/utils/lang.d.ts create mode 100644 sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/utils/lang.js create mode 100644 sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/utils/literals.d.ts create mode 100644 sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/utils/literals.js create mode 100644 sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/utils/object.d.ts create mode 100644 sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/utils/object.js create mode 100644 sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/utils/partially-ordered-set.d.ts create mode 100644 sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/utils/partially-ordered-set.js create mode 100644 sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/utils/priority-queue.d.ts create mode 100644 sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/utils/priority-queue.js create mode 100644 sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/utils/strings.d.ts create mode 100644 sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/utils/strings.js create mode 100644 sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/utils/template.d.ts create mode 100644 sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/utils/template.js create mode 100644 sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/virtual-fs/host/alias.d.ts create mode 100644 sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/virtual-fs/host/alias.js create mode 100644 sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/virtual-fs/host/buffer.d.ts create mode 100644 sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/virtual-fs/host/buffer.js create mode 100644 sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/virtual-fs/host/create.d.ts create mode 100644 sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/virtual-fs/host/create.js create mode 100644 sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/virtual-fs/host/empty.d.ts create mode 100644 sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/virtual-fs/host/empty.js create mode 100644 sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/virtual-fs/host/index.d.ts create mode 100644 sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/virtual-fs/host/index.js create mode 100644 sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/virtual-fs/host/interface.d.ts create mode 100644 sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/virtual-fs/host/interface.js create mode 100644 sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/virtual-fs/host/memory.d.ts create mode 100644 sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/virtual-fs/host/memory.js create mode 100644 sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/virtual-fs/host/pattern.d.ts create mode 100644 sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/virtual-fs/host/pattern.js create mode 100644 sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/virtual-fs/host/record.d.ts create mode 100644 sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/virtual-fs/host/record.js create mode 100644 sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/virtual-fs/host/resolver.d.ts create mode 100644 sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/virtual-fs/host/resolver.js create mode 100644 sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/virtual-fs/host/safe.d.ts create mode 100644 sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/virtual-fs/host/safe.js create mode 100644 sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/virtual-fs/host/scoped.d.ts create mode 100644 sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/virtual-fs/host/scoped.js create mode 100644 sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/virtual-fs/host/sync.d.ts create mode 100644 sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/virtual-fs/host/sync.js create mode 100644 sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/virtual-fs/host/test.d.ts create mode 100644 sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/virtual-fs/host/test.js create mode 100644 sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/virtual-fs/index.d.ts create mode 100644 sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/virtual-fs/index.js create mode 100644 sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/virtual-fs/path.d.ts create mode 100644 sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/virtual-fs/path.js create mode 100644 sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/workspace/core.d.ts create mode 100644 sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/workspace/core.js create mode 100644 sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/workspace/definitions.d.ts create mode 100644 sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/workspace/definitions.js create mode 100644 sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/workspace/host.d.ts create mode 100644 sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/workspace/host.js create mode 100644 sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/workspace/index.d.ts create mode 100644 sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/workspace/index.js create mode 100644 sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/workspace/json/metadata.d.ts create mode 100644 sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/workspace/json/metadata.js create mode 100644 sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/workspace/json/reader.d.ts create mode 100644 sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/workspace/json/reader.js create mode 100644 sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/workspace/json/utilities.d.ts create mode 100644 sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/workspace/json/utilities.js create mode 100644 sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/workspace/json/writer.d.ts create mode 100644 sandbox/testAppNevena/Front/node_modules/@angular-devkit/core/src/workspace/json/writer.js (limited to 'sandbox/testAppNevena/Front/node_modules/@angular-devkit/core') 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; +} +``` + +### SchemaFormatter + +``` +export interface SchemaFormatter { + readonly async: boolean; + validate(data: any): boolean | Observable; +} +``` + +### SchemaRegistry + +``` +export interface SchemaRegistry { + compile(schema: Object): Observable; + 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; + readonly projects: ProjectDefinitionCollection; +} + +export interface ProjectDefinition { + readonly extensions: Record; + readonly targets: TargetDefinitionCollection; + root: string; + prefix?: string; + sourceRoot?: string; +} + +export interface TargetDefinition { + options?: Record; + configurations?: Record | 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; +``` + +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; + writeFile(path: string, data: string): Promise; + isDirectory(path: string): Promise; + isFile(path: string): Promise; +} + +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 + */ +/// +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 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 implements core_experimental.jobs.Registry { + 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(name: core_experimental.jobs.JobName): Observable | 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 + */ +/// +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 { + get capabilities(): virtualFs.HostCapabilities; + write(path: Path, content: virtualFs.FileBuffer): Observable; + read(path: Path): Observable; + delete(path: Path): Observable; + rename(from: Path, to: Path): Observable; + list(path: Path): Observable; + exists(path: Path): Observable; + isDirectory(path: Path): Observable; + isFile(path: Path): Observable; + stat(path: Path): Observable>; + watch(path: Path, _options?: virtualFs.HostWatchOptions): Observable | null; +} +/** + * An implementation of the Virtual FS using Node as the backend, synchronously. + */ +export declare class NodeJsSyncHost implements virtualFs.Host { + get capabilities(): virtualFs.HostCapabilities; + write(path: Path, content: virtualFs.FileBuffer): Observable; + read(path: Path): Observable; + delete(path: Path): Observable; + rename(from: Path, to: Path): Observable; + list(path: Path): Observable; + exists(path: Path): Observable; + isDirectory(path: Path): Observable; + isFile(path: Path): Observable; + stat(path: Path): Observable>; + watch(path: Path, _options?: virtualFs.HostWatchOptions): Observable | 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 + */ +/// +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 { + protected _sync?: virtualFs.SyncDelegateHost; + protected _root: Path; + constructor(); + get files(): Path[]; + get root(): Path; + get sync(): virtualFs.SyncDelegateHost; +} 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; +} 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; +} +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; +} 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; +} 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; +} 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` 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` 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`. 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`. This can be used to listen to messages + from the job. See ["Communicating With Jobs"](#Communicating). + +## `JobHandlerContext` 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((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> { + 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((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( + // Receive a context that contains additional methods to create channels. + (argument: number, { createChannel }) => + new Observable((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('progress', { type: 'number' }) + .subscribe((x) => console.log(x)); +``` + +## 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`. 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>` 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` 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>`. 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((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( + name: JobName, + argument: I, + options?: ScheduleJobOptions, + ): Job; +} +``` + +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; +} +``` + +## 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[]` 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((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 { + (argument: ArgT, context: JobHandlerContext): Observable>; + jobDescription: Partial; +} +/** + * The context in which the job is run. + */ +export interface JobHandlerContext { + readonly description: JobDescription; + readonly scheduler: Scheduler; + readonly dependencies: Job[]; + readonly inboundBus: Observable>; +} +/** + * Metadata associated with a job. + */ +export interface JobDescription extends JsonObject { + readonly name: JobName; + readonly argument: DeepReadonly; + readonly input: DeepReadonly; + readonly output: DeepReadonly; +} +/** + * 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 extends JobInboundMessageBase { + readonly kind: JobInboundMessageKind.Input; + /** + * The input being sent to the job. + */ + readonly value: InputT; +} +export declare type JobInboundMessage = JobInboundMessagePing | JobInboundMessageStop | JobInboundMessageInput; +/** + * 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 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 = JobOutboundMessageOnReady | JobOutboundMessageStart | JobOutboundMessageOutput | 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 { + /** + * 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; + /** + * 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; + /** + * Outputs of this job. + */ + readonly output: Observable; + /** + * 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(name: string, schema?: schema.JsonSchema): Observable; + /** + * Pings the job and wait for the resulting Pong before completing. + */ + ping(): Observable; + /** + * 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>; + /** + * The JobOutboundMessage FROM the job. + */ + readonly outboundBus: Observable>; +} +/** + * 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 { + /** + * Get a job handler. + * @param name The name of the job to get a handler from. + */ + get(name: JobName): Observable | null>; +} +/** + * An interface that can schedule jobs. + */ +export interface Scheduler { + /** + * 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; + /** + * 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; + /** + * 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(name: JobName, argument: A, options?: ScheduleJobOptions): Job; +} +export declare function isJobHandler(value: unknown): value is JobHandler; 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 --> | handler(argument: A) | --> JobOutboundMessage + - 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 extends JobHandlerContext { + createChannel: (name: string) => Observer; + input: Observable; +} +/** + * 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 = (input: A, context: SimpleJobHandlerContext) => O | Promise | Observable; +/** + * 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(fn: SimpleJobHandlerFn, options?: Partial): JobHandler; +/** + * 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(loader: () => Promise>, options?: Partial): JobHandler; +/** + * 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(job: JobHandler, logger: LoggerApi): JobHandler; 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 extends JobHandler { + /** + * Set the default job if all conditionals failed. + * @param name The default name if all conditions are false. + */ + setDefaultJob(name: JobName | null | JobHandler): 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(options?: Partial>): JobDispatcher; 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(''); + } + 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 implements Registry { + protected _fallbacks: Registry[]; + constructor(_fallbacks?: Registry[]); + addFallback(registry: Registry): void; + get(name: JobName): Observable | 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 { +} +/** + * A simple job registry that keep a map of JobName => JobHandler internally. + */ +export declare class SimpleJobRegistry implements Registry { + private _jobNames; + get(name: JobName): Observable | 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(name: JobName, handler: JobHandler, 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(handler: JobHandler, options?: RegisterJobOptions & { + name: string; + }): void; + protected _register(name: JobName, handler: JobHandler, 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 implements Scheduler { + protected _jobRegistry: Registry; + protected _schemaRegistry: schema.SchemaRegistry; + private _internalJobDescriptionMap; + private _queue; + private _pauseCounter; + constructor(_jobRegistry: Registry, _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; + /** + * 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; + /** + * 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(name: JobName, argument: A, options?: ScheduleJobOptions): Job; + /** + * 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(name: JobName, argument: A, options: ScheduleJobOptions, waitable: Observable): Job; +} 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 = (handler: JobHandler, options?: Partial>) => JobHandler; + /** + * Creates a JobStrategy that serializes every call. This strategy can be mixed between jobs. + */ + function serialize(): JobStrategy; + /** + * 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?: boolean): JobStrategy; + /** + * 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?: boolean): JobStrategy; +} 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; +export interface SchemaValidatorOptions { + applyPreTransforms?: boolean; + applyPostTransforms?: boolean; + withPrompts?: boolean; +} +export interface SchemaValidator { + (data: JsonValue, options?: SchemaValidatorOptions): Observable; +} +export declare type SchemaFormatter = Format; +export interface SchemaFormat { + name: string; + formatter: SchemaFormatter; +} +export interface SmartDefaultProvider { + (schema: JsonObject): T | Observable; +} +export interface SchemaKeywordValidator { + (data: JsonValue, schema: JsonValue, parent: JsonObject | JsonArray | undefined, parentProperty: string | number | undefined, pointer: JsonPointer, rootData: JsonValue): boolean | Observable; +} +export interface PromptDefinition { + id: string; + type: string; + message: string; + default?: string | string[] | number | boolean | null; + validator?: (value: JsonValue) => boolean | string | Promise; + items?: Array; + raw?: string | JsonObject; + multiselect?: boolean; + propertyTypes: Set; +} +export declare type PromptProvider = (definitions: Array) => SubscribableOrPromise<{ + [id: string]: JsonValue; +}>; +export interface SchemaRegistry { + compile(schema: Object): Observable; + /** + * @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; + addFormat(format: SchemaFormat): void; + addSmartDefaultProvider(source: string, provider: SmartDefaultProvider): 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; +} 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 | Promise | 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; + 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; + private _compile; + addFormat(format: SchemaFormat): void; + addSmartDefaultProvider(source: string, provider: SmartDefaultProvider): 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; 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 { + (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(json: JsonValue, visitor: JsonVisitor, schema?: JsonSchema, refResolver?: ReferenceResolver, context?: ContextT): Observable; +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 { +} +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 implements LoggerApi { + readonly name: string; + readonly parent: Logger | null; + protected readonly _subject: Subject; + protected _metadata: LoggerMetadata; + private _obs; + private _subscription; + protected get _observable(): Observable; + protected set _observable(v: Observable); + 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(operator: Operator): Observable; + subscribe(): Subscription; + subscribe(observer: PartialObserver): Subscription; + subscribe(next?: (value: LogEntry) => void, error?: (error: Error) => void, complete?: () => void): Subscription; + forEach(next: (value: LogEntry) => void, PromiseCtor?: typeof Promise): Promise; +} 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 ``; + } + 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) => Observable, 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(array: Array): Array; 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 extends (infer R)[] ? DeepReadonlyArray : T extends Function ? T : T extends object ? DeepReadonlyObject : T; +export interface DeepReadonlyArray extends Array> { +} +export declare type DeepReadonlyObject = { + readonly [P in keyof T]: DeepReadonly; +}; +export declare type Readwrite = { + -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; 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 { + (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(obj: { + [k: string]: T; +}, mapper: (k: string, v: T) => V): { + [k: string]: V; +}; +export declare function deepCopy(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 implements Set { + private _items; + protected _checkCircularDependencies(item: T, deps: Set): void; + clear(): void; + has(item: T): boolean; + get size(): number; + forEach(callbackfn: (value: T, value2: T, set: PartiallyOrderedSet) => 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; + /** + * Returns an iterable of values in the set. + */ + values(): IterableIterator; + add(item: T, deps?: Set | T[]): this; + delete(item: T): boolean; + [Symbol.iterator](): Generator; + 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 { + 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; +} 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(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 extends ResolverHost { + protected _aliases: Map; + protected _resolve(path: Path): Path; + get aliases(): Map; +} 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; +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 { + read(path: Path): FileBuffer; + list(path: Path): PathFragment[]; + exists(path: Path): boolean; + isDirectory(path: Path): boolean; + isFile(path: Path): boolean; + stat(path: Path): Stats | null; + write(path: Path, content: FileBufferLike): void; + delete(path: Path): void; + rename(from: Path, to: Path): void; +} +export declare function createSyncHost(handler: SyncHostHandler): Host; 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; + list(path: Path): Observable; + exists(path: Path): Observable; + isDirectory(path: Path): Observable; + isFile(path: Path): Observable; + stat(path: Path): Observable | 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 & { + 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 { + readonly capabilities: HostCapabilities; + read(path: Path): Observable; + list(path: Path): Observable; + exists(path: Path): Observable; + isDirectory(path: Path): Observable; + isFile(path: Path): Observable; + stat(path: Path): Observable | null> | null; +} +export interface Host extends ReadonlyHost { + write(path: Path, content: FileBufferLike): Observable; + delete(path: Path): Observable; + rename(from: Path, to: Path): Observable; + watch(path: Path, options?: HostWatchOptions): Observable | 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>; + 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): { + 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 | null; + protected _watch(path: Path, options?: HostWatchOptions): Observable; + write(path: Path, content: FileBuffer): Observable; + read(path: Path): Observable; + delete(path: Path): Observable; + rename(from: Path, to: Path): Observable; + list(path: Path): Observable; + exists(path: Path): Observable; + isDirectory(path: Path): Observable; + isFile(path: Path): Observable; + stat(path: Path): Observable | null> | null; + watch(path: Path, options?: HostWatchOptions): Observable | 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 ''; + }, + 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 ``; + }, + 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 extends ResolverHost { + protected _patterns: Map; + 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; + protected _filesToRename: Map; + protected _filesToRenameRevert: Map; + protected _filesToDelete: Set; + protected _filesToOverwrite: Set; + 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; + 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} + */ + create(path: Path, content: FileBuffer): Observable; + overwrite(path: Path, content: FileBuffer): Observable; + write(path: Path, content: FileBuffer): Observable; + read(path: Path): Observable; + delete(path: Path): Observable; + rename(from: Path, to: Path): Observable; + list(path: Path): Observable; + exists(path: Path): Observable; + isDirectory(path: Path): Observable; + isFile(path: Path): Observable; + stat(path: Path): Observable | 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} + */ + 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 implements Host { + protected _delegate: Host; + protected abstract _resolve(path: Path): Path; + constructor(_delegate: Host); + get capabilities(): HostCapabilities; + write(path: Path, content: FileBuffer): Observable; + read(path: Path): Observable; + delete(path: Path): Observable; + rename(from: Path, to: Path): Observable; + list(path: Path): Observable; + exists(path: Path): Observable; + isDirectory(path: Path): Observable; + isFile(path: Path): Observable; + stat(path: Path): Observable | null> | null; + watch(path: Path, options?: HostWatchOptions): Observable | 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 implements ReadonlyHost { + private _delegate; + constructor(_delegate: ReadonlyHost); + get capabilities(): HostCapabilities; + read(path: Path): Observable; + list(path: Path): Observable; + exists(path: Path): Observable; + isDirectory(path: Path): Observable; + isFile(path: Path): Observable; + stat(path: Path): Observable | 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 extends ResolverHost { + protected _root: Path; + constructor(delegate: Host, _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 { + protected _delegate: Host; + constructor(_delegate: Host); + protected _doSyncCall(observable: Observable): ResultT; + get capabilities(): HostCapabilities; + get delegate(): Host; + 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 | null; + watch(path: Path, options?: HostWatchOptions): Observable | 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 | null; + protected _watch(path: Path, options?: HostWatchOptions): Observable; + $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; +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; 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; + readonly projects: ProjectDefinitionCollection; +} +export interface ProjectDefinition { + readonly extensions: Record; + readonly targets: TargetDefinitionCollection; + root: string; + prefix?: string; + sourceRoot?: string; +} +export interface TargetDefinition { + options?: Record; + configurations?: Record | undefined>; + defaultConfiguration?: string; + builder: string; +} +export declare type DefinitionCollectionListener = (name: string, action: 'add' | 'remove' | 'replace', newValue: V | undefined, oldValue: V | undefined, collection: DefinitionCollection) => void; +declare class DefinitionCollection implements ReadonlyMap { + private _listener?; + private _map; + constructor(initial?: Record, _listener?: DefinitionCollectionListener | undefined); + delete(key: string): boolean; + set(key: string, value: V): this; + forEach(callbackfn: (value: V, key: string, map: DefinitionCollection) => 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; + values(): IterableIterator; +} +export declare class ProjectDefinitionCollection extends DefinitionCollection { + constructor(initial?: Record, listener?: DefinitionCollectionListener); + add(definition: { + name: string; + root: string; + sourceRoot?: string; + prefix?: string; + targets?: Record; + [key: string]: unknown; + }): ProjectDefinition; + set(name: string, value: ProjectDefinition): this; + private _validateName; +} +export declare class TargetDefinitionCollection extends DefinitionCollection { + constructor(initial?: Record, listener?: DefinitionCollectionListener); + 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; + writeFile(path: string, data: string): Promise; + isDirectory(path: string): Promise; + isFile(path: string): Promise; +} +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 { + 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(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; 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(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; 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; +} -- cgit v1.2.3