@decohere/core 0.0.1-dev.116
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/commonjs/src/caching/cache-manager.js +98 -0
- package/commonjs/src/caching/cache.decorator.js +69 -0
- package/commonjs/src/caching/cache.js +6 -0
- package/commonjs/src/caching/index.js +23 -0
- package/commonjs/src/caching/invalidate-cache.decorator.js +92 -0
- package/commonjs/src/caching/memoize.decorator.js +36 -0
- package/commonjs/src/caching/node-cache-memoize.adapter.js +49 -0
- package/commonjs/src/cli/action.js +65 -0
- package/commonjs/src/cli/command.js +127 -0
- package/commonjs/src/cli/index.js +61 -0
- package/commonjs/src/cli/module.type.js +18 -0
- package/commonjs/src/cli/options.js +115 -0
- package/commonjs/src/collections/collections.js +21 -0
- package/commonjs/src/collections/find-duplicates.js +35 -0
- package/commonjs/src/collections/index.js +52 -0
- package/commonjs/src/collections/merge-arrays.js +34 -0
- package/commonjs/src/collections/sum.js +63 -0
- package/commonjs/src/collections/unique-objects.js +39 -0
- package/commonjs/src/composition/index.js +4 -0
- package/commonjs/src/configuration/configuration.types.js +11 -0
- package/commonjs/src/configuration/index.js +18 -0
- package/commonjs/src/diagnostics/index.js +22 -0
- package/commonjs/src/diagnostics/trace.js +86 -0
- package/commonjs/src/extensibility/decorator-factory-base.js +22 -0
- package/commonjs/src/extensibility/decorator-factory.js +31 -0
- package/commonjs/src/extensibility/extension.js +37 -0
- package/commonjs/src/extensibility/index.js +23 -0
- package/commonjs/src/extensibility/mixwith.js +36 -0
- package/commonjs/src/extensibility/pipeline.js +56 -0
- package/commonjs/src/extensibility/step.js +18 -0
- package/commonjs/src/interop/docker/docker.js +54 -0
- package/commonjs/src/interop/errors/interop.error.js +12 -0
- package/commonjs/src/interop/git/git.js +134 -0
- package/commonjs/src/interop/git/git.types.js +4 -0
- package/commonjs/src/interop/index.js +97 -0
- package/commonjs/src/interop/node/index.js +18 -0
- package/commonjs/src/interop/node/node.js +45 -0
- package/commonjs/src/interop/npm/npm.js +231 -0
- package/commonjs/src/interop/npm/npm.types.js +16 -0
- package/commonjs/src/interop/pnpm/pnpm.js +34 -0
- package/commonjs/src/interop/pnpm/pnpm.types.js +4 -0
- package/commonjs/src/interop/shell/shell.argv.js +45 -0
- package/commonjs/src/interop/shell/shell.js +105 -0
- package/commonjs/src/interop/shell/shell.types.js +4 -0
- package/commonjs/src/interop/types/detect-package-manager.js +71 -0
- package/commonjs/src/interop/types/package-manager.js +4 -0
- package/commonjs/src/interop/yarn/yarn.js +34 -0
- package/commonjs/src/interop/yarn/yarn.types.js +4 -0
- package/commonjs/src/io/copy-file.js +25 -0
- package/commonjs/src/io/delete-file.js +21 -0
- package/commonjs/src/io/directory-exists.js +24 -0
- package/commonjs/src/io/file-exists.js +19 -0
- package/commonjs/src/io/find-directories.js +21 -0
- package/commonjs/src/io/find-file.js +45 -0
- package/commonjs/src/io/index.js +66 -0
- package/commonjs/src/io/io.js +28 -0
- package/commonjs/src/io/read-file.js +39 -0
- package/commonjs/src/io/remove-dir.js +22 -0
- package/commonjs/src/io/types/directory.type.js +4 -0
- package/commonjs/src/io/types/file.js +28 -0
- package/commonjs/src/io/types/index.js +19 -0
- package/commonjs/src/io/url-to-path.js +33 -0
- package/commonjs/src/io/watch.js +261 -0
- package/commonjs/src/io/write-file.js +30 -0
- package/commonjs/src/objects/deep-merge.js +67 -0
- package/commonjs/src/objects/index.js +11 -0
- package/commonjs/src/reflection/index.js +20 -0
- package/commonjs/src/reflection/types/index.js +18 -0
- package/commonjs/src/reflection/types/reflection.types.js +26 -0
- package/commonjs/src/reflection/utilities.js +118 -0
- package/commonjs/src/semver/index.js +18 -0
- package/commonjs/src/semver/semver.js +92 -0
- package/commonjs/src/system/camel-case.js +13 -0
- package/commonjs/src/system/debounce.js +19 -0
- package/commonjs/src/system/decorator.js +46 -0
- package/commonjs/src/system/environment.js +23 -0
- package/commonjs/src/system/function.types.js +18 -0
- package/commonjs/src/system/index.js +24 -0
- package/commonjs/src/system/retry.decorator.js +40 -0
- package/commonjs/src/system/sleep.js +13 -0
- package/commonjs/src/system/type.utils.js +4 -0
- package/commonjs/src/testing/flush-promises.js +16 -0
- package/commonjs/src/testing/glob-with-memfs.js +22 -0
- package/commonjs/src/testing/index.js +22 -0
- package/commonjs/src/testing/memfs.js +52 -0
- package/commonjs/src/testing/mock-logger.js +36 -0
- package/commonjs/src/testing/spy-on-constructor.js +27 -0
- package/es6/src/caching/cache-manager.js +82 -0
- package/es6/src/caching/cache.decorator.js +51 -0
- package/es6/src/caching/cache.js +3 -0
- package/es6/src/caching/index.js +6 -0
- package/es6/src/caching/invalidate-cache.decorator.js +71 -0
- package/es6/src/caching/memoize.decorator.js +27 -0
- package/es6/src/caching/node-cache-memoize.adapter.js +37 -0
- package/es6/src/cli/action.js +47 -0
- package/es6/src/cli/command.js +106 -0
- package/es6/src/cli/index.js +4 -0
- package/es6/src/cli/module.type.js +11 -0
- package/es6/src/cli/options.js +76 -0
- package/es6/src/collections/collections.js +4 -0
- package/es6/src/collections/find-duplicates.js +17 -0
- package/es6/src/collections/index.js +1 -0
- package/es6/src/collections/merge-arrays.js +16 -0
- package/es6/src/collections/sum.js +45 -0
- package/es6/src/collections/unique-objects.js +21 -0
- package/es6/src/composition/index.js +1 -0
- package/es6/src/configuration/configuration.types.js +1 -0
- package/es6/src/configuration/index.js +1 -0
- package/es6/src/diagnostics/index.js +1 -0
- package/es6/src/diagnostics/trace.js +68 -0
- package/es6/src/extensibility/decorator-factory-base.js +39 -0
- package/es6/src/extensibility/decorator-factory.js +21 -0
- package/es6/src/extensibility/extension.js +27 -0
- package/es6/src/extensibility/index.js +6 -0
- package/es6/src/extensibility/mixwith.js +26 -0
- package/es6/src/extensibility/pipeline.js +46 -0
- package/es6/src/extensibility/step.js +16 -0
- package/es6/src/interop/docker/docker.js +44 -0
- package/es6/src/interop/errors/interop.error.js +2 -0
- package/es6/src/interop/git/git.js +124 -0
- package/es6/src/interop/git/git.types.js +1 -0
- package/es6/src/interop/index.js +21 -0
- package/es6/src/interop/node/index.js +1 -0
- package/es6/src/interop/node/node.js +35 -0
- package/es6/src/interop/npm/npm.js +180 -0
- package/es6/src/interop/npm/npm.types.js +6 -0
- package/es6/src/interop/pnpm/pnpm.js +24 -0
- package/es6/src/interop/pnpm/pnpm.types.js +1 -0
- package/es6/src/interop/shell/shell.argv.js +35 -0
- package/es6/src/interop/shell/shell.js +95 -0
- package/es6/src/interop/shell/shell.types.js +1 -0
- package/es6/src/interop/types/detect-package-manager.js +50 -0
- package/es6/src/interop/types/package-manager.js +1 -0
- package/es6/src/interop/yarn/yarn.js +24 -0
- package/es6/src/interop/yarn/yarn.types.js +1 -0
- package/es6/src/io/copy-file.js +10 -0
- package/es6/src/io/delete-file.js +6 -0
- package/es6/src/io/directory-exists.js +9 -0
- package/es6/src/io/file-exists.js +9 -0
- package/es6/src/io/find-directories.js +11 -0
- package/es6/src/io/find-file.js +27 -0
- package/es6/src/io/index.js +2 -0
- package/es6/src/io/io.js +11 -0
- package/es6/src/io/read-file.js +13 -0
- package/es6/src/io/remove-dir.js +7 -0
- package/es6/src/io/types/directory.type.js +1 -0
- package/es6/src/io/types/file.js +18 -0
- package/es6/src/io/types/index.js +2 -0
- package/es6/src/io/url-to-path.js +15 -0
- package/es6/src/io/watch.js +238 -0
- package/es6/src/io/write-file.js +15 -0
- package/es6/src/objects/deep-merge.js +57 -0
- package/es6/src/objects/index.js +1 -0
- package/es6/src/reflection/index.js +3 -0
- package/es6/src/reflection/types/index.js +1 -0
- package/es6/src/reflection/types/reflection.types.js +8 -0
- package/es6/src/reflection/utilities.js +74 -0
- package/es6/src/semver/index.js +1 -0
- package/es6/src/semver/semver.js +71 -0
- package/es6/src/system/camel-case.js +3 -0
- package/es6/src/system/debounce.js +9 -0
- package/es6/src/system/decorator.js +30 -0
- package/es6/src/system/environment.js +5 -0
- package/es6/src/system/function.types.js +26 -0
- package/es6/src/system/index.js +7 -0
- package/es6/src/system/retry.decorator.js +30 -0
- package/es6/src/system/sleep.js +3 -0
- package/es6/src/system/type.utils.js +1 -0
- package/es6/src/testing/flush-promises.js +6 -0
- package/es6/src/testing/glob-with-memfs.js +20 -0
- package/es6/src/testing/index.js +5 -0
- package/es6/src/testing/memfs.js +25 -0
- package/es6/src/testing/mock-logger.js +26 -0
- package/es6/src/testing/spy-on-constructor.js +31 -0
- package/package.json +106 -0
- package/types/src/caching/cache-manager.d.ts +59 -0
- package/types/src/caching/cache.d.ts +11 -0
- package/types/src/caching/cache.decorator.d.ts +18 -0
- package/types/src/caching/index.d.ts +6 -0
- package/types/src/caching/invalidate-cache.decorator.d.ts +17 -0
- package/types/src/caching/memoize.decorator.d.ts +16 -0
- package/types/src/caching/node-cache-memoize.adapter.d.ts +22 -0
- package/types/src/cli/action.d.ts +36 -0
- package/types/src/cli/command.d.ts +34 -0
- package/types/src/cli/index.d.ts +7 -0
- package/types/src/cli/module.type.d.ts +36 -0
- package/types/src/cli/options.d.ts +28 -0
- package/types/src/collections/collections.d.ts +4 -0
- package/types/src/collections/find-duplicates.d.ts +2 -0
- package/types/src/collections/index.d.ts +1 -0
- package/types/src/collections/merge-arrays.d.ts +2 -0
- package/types/src/collections/sum.d.ts +4 -0
- package/types/src/collections/unique-objects.d.ts +2 -0
- package/types/src/composition/index.d.ts +37 -0
- package/types/src/configuration/configuration.types.d.ts +10 -0
- package/types/src/configuration/index.d.ts +1 -0
- package/types/src/diagnostics/index.d.ts +1 -0
- package/types/src/diagnostics/trace.d.ts +10 -0
- package/types/src/extensibility/decorator-factory-base.d.ts +39 -0
- package/types/src/extensibility/decorator-factory.d.ts +19 -0
- package/types/src/extensibility/extension.d.ts +9 -0
- package/types/src/extensibility/index.d.ts +6 -0
- package/types/src/extensibility/mixwith.d.ts +6 -0
- package/types/src/extensibility/pipeline.d.ts +12 -0
- package/types/src/extensibility/step.d.ts +16 -0
- package/types/src/interop/docker/docker.d.ts +19 -0
- package/types/src/interop/errors/interop.error.d.ts +2 -0
- package/types/src/interop/git/git.d.ts +16 -0
- package/types/src/interop/git/git.types.d.ts +14 -0
- package/types/src/interop/index.d.ts +14 -0
- package/types/src/interop/node/index.d.ts +1 -0
- package/types/src/interop/node/node.d.ts +5 -0
- package/types/src/interop/npm/npm.d.ts +29 -0
- package/types/src/interop/npm/npm.types.d.ts +24 -0
- package/types/src/interop/pnpm/pnpm.d.ts +9 -0
- package/types/src/interop/pnpm/pnpm.types.d.ts +3 -0
- package/types/src/interop/shell/shell.argv.d.ts +5 -0
- package/types/src/interop/shell/shell.d.ts +6 -0
- package/types/src/interop/shell/shell.types.d.ts +9 -0
- package/types/src/interop/types/detect-package-manager.d.ts +4 -0
- package/types/src/interop/types/package-manager.d.ts +10 -0
- package/types/src/interop/yarn/yarn.d.ts +9 -0
- package/types/src/interop/yarn/yarn.types.d.ts +3 -0
- package/types/src/io/copy-file.d.ts +4 -0
- package/types/src/io/delete-file.d.ts +1 -0
- package/types/src/io/directory-exists.d.ts +1 -0
- package/types/src/io/file-exists.d.ts +1 -0
- package/types/src/io/find-directories.d.ts +2 -0
- package/types/src/io/find-file.d.ts +9 -0
- package/types/src/io/index.d.ts +2 -0
- package/types/src/io/io.d.ts +11 -0
- package/types/src/io/read-file.d.ts +4 -0
- package/types/src/io/remove-dir.d.ts +5 -0
- package/types/src/io/types/directory.type.d.ts +4 -0
- package/types/src/io/types/file.d.ts +20 -0
- package/types/src/io/types/index.d.ts +2 -0
- package/types/src/io/url-to-path.d.ts +2 -0
- package/types/src/io/watch.d.ts +16 -0
- package/types/src/io/write-file.d.ts +5 -0
- package/types/src/objects/deep-merge.d.ts +41 -0
- package/types/src/objects/index.d.ts +1 -0
- package/types/src/reflection/index.d.ts +3 -0
- package/types/src/reflection/types/index.d.ts +1 -0
- package/types/src/reflection/types/reflection.types.d.ts +21 -0
- package/types/src/reflection/utilities.d.ts +27 -0
- package/types/src/semver/index.d.ts +1 -0
- package/types/src/semver/semver.d.ts +18 -0
- package/types/src/system/camel-case.d.ts +1 -0
- package/types/src/system/debounce.d.ts +1 -0
- package/types/src/system/decorator.d.ts +15 -0
- package/types/src/system/environment.d.ts +6 -0
- package/types/src/system/function.types.d.ts +55 -0
- package/types/src/system/index.d.ts +7 -0
- package/types/src/system/retry.decorator.d.ts +6 -0
- package/types/src/system/sleep.d.ts +1 -0
- package/types/src/system/type.utils.d.ts +1 -0
- package/types/src/testing/flush-promises.d.ts +1 -0
- package/types/src/testing/glob-with-memfs.d.ts +3 -0
- package/types/src/testing/index.d.ts +5 -0
- package/types/src/testing/memfs.d.ts +5 -0
- package/types/src/testing/mock-logger.d.ts +13 -0
- package/types/src/testing/spy-on-constructor.d.ts +21 -0
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
function _export(target, all) {
|
|
6
|
+
for(var name in all)Object.defineProperty(target, name, {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: Object.getOwnPropertyDescriptor(all, name).get
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
_export(exports, {
|
|
12
|
+
get ConfigFileOption () {
|
|
13
|
+
return ConfigFileOption;
|
|
14
|
+
},
|
|
15
|
+
get ConfigurationOption () {
|
|
16
|
+
return ConfigurationOption;
|
|
17
|
+
},
|
|
18
|
+
get DryRunOption () {
|
|
19
|
+
return DryRunOption;
|
|
20
|
+
},
|
|
21
|
+
get EnvFileIfExistsOption () {
|
|
22
|
+
return EnvFileIfExistsOption;
|
|
23
|
+
},
|
|
24
|
+
get EnvFileOption () {
|
|
25
|
+
return EnvFileOption;
|
|
26
|
+
},
|
|
27
|
+
get LogLevelOption () {
|
|
28
|
+
return LogLevelOption;
|
|
29
|
+
},
|
|
30
|
+
get NoBuildOptions () {
|
|
31
|
+
return NoBuildOptions;
|
|
32
|
+
},
|
|
33
|
+
get NoCleanOptions () {
|
|
34
|
+
return NoCleanOptions;
|
|
35
|
+
},
|
|
36
|
+
get ProjectOption () {
|
|
37
|
+
return ProjectOption;
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
const _commander = require("commander");
|
|
41
|
+
function parseOptionalBoolean(input) {
|
|
42
|
+
if (typeof input === "boolean") {
|
|
43
|
+
return input;
|
|
44
|
+
}
|
|
45
|
+
const value = input.trim().toLowerCase();
|
|
46
|
+
if ([
|
|
47
|
+
"true",
|
|
48
|
+
"1",
|
|
49
|
+
"yes",
|
|
50
|
+
"on"
|
|
51
|
+
].includes(value)) {
|
|
52
|
+
return true;
|
|
53
|
+
}
|
|
54
|
+
if ([
|
|
55
|
+
"false",
|
|
56
|
+
"0",
|
|
57
|
+
"no",
|
|
58
|
+
"off"
|
|
59
|
+
].includes(value)) {
|
|
60
|
+
return false;
|
|
61
|
+
}
|
|
62
|
+
throw new Error(`Invalid boolean value: "${input}". Use true/false.`);
|
|
63
|
+
}
|
|
64
|
+
class ConfigurationOption extends _commander.Option {
|
|
65
|
+
constructor(defaultValue){
|
|
66
|
+
super("--configuration <configuration>", "Configuration name");
|
|
67
|
+
this.default(defaultValue);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
class ConfigFileOption extends _commander.Option {
|
|
71
|
+
constructor(defaultValue = ".decohere.js"){
|
|
72
|
+
super("--config-file <file>", "Path to Decohere config file");
|
|
73
|
+
this.default(defaultValue);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
class LogLevelOption extends _commander.Option {
|
|
77
|
+
constructor(){
|
|
78
|
+
super("--log-level <level>", "Log level (trace, debug, info, warn, error)");
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
class EnvFileOption extends _commander.Option {
|
|
82
|
+
constructor(){
|
|
83
|
+
super("--env-file <file>", "Load environment variables from this file before running");
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
class EnvFileIfExistsOption extends _commander.Option {
|
|
87
|
+
constructor(){
|
|
88
|
+
super("--env-file-if-exists <file>", "Like --env-file, but skip it when the file is missing");
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
class NoCleanOptions extends _commander.Option {
|
|
92
|
+
constructor(defaultValue){
|
|
93
|
+
super("--no-clean", "Will not clean the project directories");
|
|
94
|
+
this.default(defaultValue);
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
class NoBuildOptions extends _commander.Option {
|
|
98
|
+
constructor(defaultValue){
|
|
99
|
+
super("--no-build", "Will not run the build step");
|
|
100
|
+
this.default(defaultValue);
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
class DryRunOption extends _commander.Option {
|
|
104
|
+
constructor(description, defaultValue = false){
|
|
105
|
+
super("--dry-run [dryRun]", description);
|
|
106
|
+
this.default(defaultValue);
|
|
107
|
+
this.preset(true);
|
|
108
|
+
this.argParser(parseOptionalBoolean);
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
class ProjectOption extends _commander.Option {
|
|
112
|
+
constructor(){
|
|
113
|
+
super("--project <project>", "Project name to target");
|
|
114
|
+
}
|
|
115
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
_export_star(require("./find-duplicates.js"), exports);
|
|
6
|
+
_export_star(require("./merge-arrays.js"), exports);
|
|
7
|
+
_export_star(require("./sum.js"), exports);
|
|
8
|
+
_export_star(require("./unique-objects.js"), exports);
|
|
9
|
+
function _export_star(from, to) {
|
|
10
|
+
Object.keys(from).forEach(function(k) {
|
|
11
|
+
if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
|
|
12
|
+
Object.defineProperty(to, k, {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: function() {
|
|
15
|
+
return from[k];
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
return from;
|
|
21
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
function _export(target, all) {
|
|
6
|
+
for(var name in all)Object.defineProperty(target, name, {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: Object.getOwnPropertyDescriptor(all, name).get
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
_export(exports, {
|
|
12
|
+
get findDuplicatesBy () {
|
|
13
|
+
return findDuplicatesBy;
|
|
14
|
+
},
|
|
15
|
+
get findDuplicatesByKey () {
|
|
16
|
+
return findDuplicatesByKey;
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
function findDuplicatesByKey(items, key) {
|
|
20
|
+
return findDuplicatesBy(items, (item)=>String(item[key]));
|
|
21
|
+
}
|
|
22
|
+
function findDuplicatesBy(items, selector) {
|
|
23
|
+
const groups = new Map();
|
|
24
|
+
for (const item of items){
|
|
25
|
+
const k = selector(item);
|
|
26
|
+
const existing = groups.get(k) ?? [];
|
|
27
|
+
groups.set(k, [
|
|
28
|
+
...existing,
|
|
29
|
+
item
|
|
30
|
+
]);
|
|
31
|
+
}
|
|
32
|
+
return [
|
|
33
|
+
...groups.entries()
|
|
34
|
+
].filter(([, group])=>group.length > 1);
|
|
35
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
Object.defineProperty(exports, "collections", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: function() {
|
|
8
|
+
return _collections;
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
const _collections = /*#__PURE__*/ _interop_require_wildcard(require("./collections.js"));
|
|
12
|
+
function _getRequireWildcardCache(nodeInterop) {
|
|
13
|
+
if (typeof WeakMap !== "function") return null;
|
|
14
|
+
var cacheBabelInterop = new WeakMap();
|
|
15
|
+
var cacheNodeInterop = new WeakMap();
|
|
16
|
+
return (_getRequireWildcardCache = function(nodeInterop) {
|
|
17
|
+
return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
|
|
18
|
+
})(nodeInterop);
|
|
19
|
+
}
|
|
20
|
+
function _interop_require_wildcard(obj, nodeInterop) {
|
|
21
|
+
if (!nodeInterop && obj && obj.__esModule) {
|
|
22
|
+
return obj;
|
|
23
|
+
}
|
|
24
|
+
if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
|
|
25
|
+
return {
|
|
26
|
+
default: obj
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
var cache = _getRequireWildcardCache(nodeInterop);
|
|
30
|
+
if (cache && cache.has(obj)) {
|
|
31
|
+
return cache.get(obj);
|
|
32
|
+
}
|
|
33
|
+
var newObj = {
|
|
34
|
+
__proto__: null
|
|
35
|
+
};
|
|
36
|
+
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
|
|
37
|
+
for(var key in obj){
|
|
38
|
+
if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
39
|
+
var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
|
|
40
|
+
if (desc && (desc.get || desc.set)) {
|
|
41
|
+
Object.defineProperty(newObj, key, desc);
|
|
42
|
+
} else {
|
|
43
|
+
newObj[key] = obj[key];
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
newObj.default = obj;
|
|
48
|
+
if (cache) {
|
|
49
|
+
cache.set(obj, newObj);
|
|
50
|
+
}
|
|
51
|
+
return newObj;
|
|
52
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
function _export(target, all) {
|
|
6
|
+
for(var name in all)Object.defineProperty(target, name, {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: Object.getOwnPropertyDescriptor(all, name).get
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
_export(exports, {
|
|
12
|
+
get mergeBy () {
|
|
13
|
+
return mergeBy;
|
|
14
|
+
},
|
|
15
|
+
get mergeByKey () {
|
|
16
|
+
return mergeByKey;
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
function mergeByKey(first, second, key) {
|
|
20
|
+
return mergeBy(first, second, (item)=>String(item[key]));
|
|
21
|
+
}
|
|
22
|
+
function mergeBy(first, second, selector) {
|
|
23
|
+
// Second collection values win when keys collide.
|
|
24
|
+
const merged = [
|
|
25
|
+
...first,
|
|
26
|
+
...second
|
|
27
|
+
];
|
|
28
|
+
return [
|
|
29
|
+
...new Map(merged.map((item)=>[
|
|
30
|
+
selector(item),
|
|
31
|
+
item
|
|
32
|
+
])).values()
|
|
33
|
+
];
|
|
34
|
+
}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
function _export(target, all) {
|
|
6
|
+
for(var name in all)Object.defineProperty(target, name, {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: Object.getOwnPropertyDescriptor(all, name).get
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
_export(exports, {
|
|
12
|
+
get sumBy () {
|
|
13
|
+
return sumBy;
|
|
14
|
+
},
|
|
15
|
+
get sumByKey () {
|
|
16
|
+
return sumByKey;
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
function sumByKey(objects, key) {
|
|
20
|
+
return sum(objects, key);
|
|
21
|
+
}
|
|
22
|
+
function sumBy(objects, key) {
|
|
23
|
+
return sum(objects, key);
|
|
24
|
+
}
|
|
25
|
+
function extractValueFromItem(item, key) {
|
|
26
|
+
if (typeof key === "function") {
|
|
27
|
+
const result = key(item);
|
|
28
|
+
return isNumericValue(result) ? result : 0;
|
|
29
|
+
}
|
|
30
|
+
const value = item?.[key];
|
|
31
|
+
return isNumericValue(value) ? value : 0;
|
|
32
|
+
}
|
|
33
|
+
function isNumericValue(value) {
|
|
34
|
+
return typeof value === "number" || typeof value === "bigint";
|
|
35
|
+
}
|
|
36
|
+
function determineSumType(firstValue) {
|
|
37
|
+
return typeof firstValue === "bigint" ? "bigint" : "number";
|
|
38
|
+
}
|
|
39
|
+
function getInitialSumValue(sumType) {
|
|
40
|
+
return sumType === "bigint" ? 0n : 0;
|
|
41
|
+
}
|
|
42
|
+
function addValues(total, value, sumType) {
|
|
43
|
+
if (sumType === "bigint") {
|
|
44
|
+
const totalBigInt = total;
|
|
45
|
+
const valueBigInt = typeof value === "bigint" ? value : BigInt(value);
|
|
46
|
+
return totalBigInt + valueBigInt;
|
|
47
|
+
}
|
|
48
|
+
const totalNumber = total;
|
|
49
|
+
const valueNumber = typeof value === "number" ? value : Number(value);
|
|
50
|
+
return totalNumber + valueNumber;
|
|
51
|
+
}
|
|
52
|
+
function sum(objects, key) {
|
|
53
|
+
if (objects.length === 0) {
|
|
54
|
+
return 0;
|
|
55
|
+
}
|
|
56
|
+
const firstValue = extractValueFromItem(objects[0], key);
|
|
57
|
+
const sumType = determineSumType(firstValue);
|
|
58
|
+
const initialValue = getInitialSumValue(sumType);
|
|
59
|
+
return objects.reduce((total, item)=>{
|
|
60
|
+
const value = extractValueFromItem(item, key);
|
|
61
|
+
return addValues(total, value, sumType);
|
|
62
|
+
}, initialValue);
|
|
63
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
function _export(target, all) {
|
|
6
|
+
for(var name in all)Object.defineProperty(target, name, {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: Object.getOwnPropertyDescriptor(all, name).get
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
_export(exports, {
|
|
12
|
+
get uniqueObjectsBy () {
|
|
13
|
+
return uniqueObjectsBy;
|
|
14
|
+
},
|
|
15
|
+
get uniqueObjectsByKey () {
|
|
16
|
+
return uniqueObjectsByKey;
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
function uniqueObjectsByKey(objects, key) {
|
|
20
|
+
return uniqueObjects(objects, key);
|
|
21
|
+
}
|
|
22
|
+
function uniqueObjectsBy(objects, key) {
|
|
23
|
+
return uniqueObjects(objects, key);
|
|
24
|
+
}
|
|
25
|
+
function uniqueObjects(objects, key) {
|
|
26
|
+
const getKey = (key, item)=>{
|
|
27
|
+
if (typeof key === "function") {
|
|
28
|
+
return key(item);
|
|
29
|
+
}
|
|
30
|
+
return item != null ? item[key] : null;
|
|
31
|
+
};
|
|
32
|
+
const arrayUniqueByKey = [
|
|
33
|
+
...new Map(objects.map((item)=>[
|
|
34
|
+
getKey(key, item),
|
|
35
|
+
item
|
|
36
|
+
])).values()
|
|
37
|
+
];
|
|
38
|
+
return arrayUniqueByKey;
|
|
39
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
Object.defineProperty(exports, "ConfigurationServiceToken", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: function() {
|
|
8
|
+
return ConfigurationServiceToken;
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
const ConfigurationServiceToken = Symbol("IConfigurationService");
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
_export_star(require("./configuration.types.js"), exports);
|
|
6
|
+
function _export_star(from, to) {
|
|
7
|
+
Object.keys(from).forEach(function(k) {
|
|
8
|
+
if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
|
|
9
|
+
Object.defineProperty(to, k, {
|
|
10
|
+
enumerable: true,
|
|
11
|
+
get: function() {
|
|
12
|
+
return from[k];
|
|
13
|
+
}
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
});
|
|
17
|
+
return from;
|
|
18
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
function _export(target, all) {
|
|
6
|
+
for(var name in all)Object.defineProperty(target, name, {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: Object.getOwnPropertyDescriptor(all, name).get
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
_export(exports, {
|
|
12
|
+
get Trace () {
|
|
13
|
+
return _trace.Trace;
|
|
14
|
+
},
|
|
15
|
+
get timed () {
|
|
16
|
+
return _trace.timed;
|
|
17
|
+
},
|
|
18
|
+
get trace () {
|
|
19
|
+
return _trace.trace;
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
const _trace = require("./trace.js");
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
function _export(target, all) {
|
|
6
|
+
for(var name in all)Object.defineProperty(target, name, {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: Object.getOwnPropertyDescriptor(all, name).get
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
_export(exports, {
|
|
12
|
+
get Trace () {
|
|
13
|
+
return Trace;
|
|
14
|
+
},
|
|
15
|
+
get timed () {
|
|
16
|
+
return timed;
|
|
17
|
+
},
|
|
18
|
+
get trace () {
|
|
19
|
+
return trace;
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
const _types = require("node:util/types");
|
|
23
|
+
const _scribe = require("@decohere/scribe");
|
|
24
|
+
// Keep existing behavior for now: trace mode is toggled via FORGE_TRACE.
|
|
25
|
+
const isTraceEnabled = process.env.FORGE_TRACE != null;
|
|
26
|
+
if (isTraceEnabled) {
|
|
27
|
+
const hasExplicitLevel = process.env.LOG_LEVEL != null || process.env.SCRIBE_LOG_LEVEL != null || process.env.LOGGING_LEVEL != null;
|
|
28
|
+
if (!hasExplicitLevel) {
|
|
29
|
+
_scribe.scribe.configure({
|
|
30
|
+
adapter: new _scribe.ConsoleAdapter(),
|
|
31
|
+
options: {
|
|
32
|
+
logLevel: "trace"
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
function serializeArgs(args) {
|
|
38
|
+
if (args.length === 0) return "";
|
|
39
|
+
return args.map((arg)=>{
|
|
40
|
+
if (Array.isArray(arg)) return `[${arg.map(String).join(", ")}]`;
|
|
41
|
+
const s = String(arg);
|
|
42
|
+
return s.length > 60 ? `${s.slice(0, 57)}...` : s;
|
|
43
|
+
}).join(", ");
|
|
44
|
+
}
|
|
45
|
+
function wrapWithTiming(fn, className, methodName, logLevel) {
|
|
46
|
+
let logger;
|
|
47
|
+
return function(...args) {
|
|
48
|
+
if (logger == null) {
|
|
49
|
+
logger = _scribe.scribe.logger(className);
|
|
50
|
+
}
|
|
51
|
+
const log = logger;
|
|
52
|
+
const label = `${methodName}(${serializeArgs(args)})`;
|
|
53
|
+
const start = performance.now();
|
|
54
|
+
const logDuration = ()=>{
|
|
55
|
+
log[logLevel](`${label}: ${(performance.now() - start).toFixed(2)}ms`);
|
|
56
|
+
};
|
|
57
|
+
const result = fn.apply(this, args);
|
|
58
|
+
if ((0, _types.isPromise)(result)) {
|
|
59
|
+
return result.finally(logDuration);
|
|
60
|
+
}
|
|
61
|
+
logDuration();
|
|
62
|
+
return result;
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
function trace(target, propertyKey, descriptor) {
|
|
66
|
+
if (!isTraceEnabled) return descriptor;
|
|
67
|
+
const className = target.constructor.name;
|
|
68
|
+
descriptor.value = wrapWithTiming(descriptor.value, className, propertyKey, "trace");
|
|
69
|
+
return descriptor;
|
|
70
|
+
}
|
|
71
|
+
function timed(target, propertyKey, descriptor) {
|
|
72
|
+
const className = target.constructor.name;
|
|
73
|
+
descriptor.value = wrapWithTiming(descriptor.value, className, propertyKey, "info");
|
|
74
|
+
return descriptor;
|
|
75
|
+
}
|
|
76
|
+
function Trace(constructor) {
|
|
77
|
+
if (!isTraceEnabled) return;
|
|
78
|
+
const className = constructor.name;
|
|
79
|
+
for (const key of Object.getOwnPropertyNames(constructor.prototype)){
|
|
80
|
+
if (key === "constructor") continue;
|
|
81
|
+
const descriptor = Object.getOwnPropertyDescriptor(constructor.prototype, key);
|
|
82
|
+
if (descriptor == null || typeof descriptor.value !== "function") continue;
|
|
83
|
+
descriptor.value = wrapWithTiming(descriptor.value, className, key, "trace");
|
|
84
|
+
Object.defineProperty(constructor.prototype, key, descriptor);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
Object.defineProperty(exports, "DecoratorFactoryBase", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: function() {
|
|
8
|
+
return DecoratorFactoryBase;
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
class DecoratorFactoryBase {
|
|
12
|
+
/**
|
|
13
|
+
* Utility method to check if we're currently in a test environment
|
|
14
|
+
*/ isTestEnvironment() {
|
|
15
|
+
return process.env.TEST === "true";
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Creates a no-op decorator that returns the original function unchanged
|
|
19
|
+
*/ createNoOpDecorator() {
|
|
20
|
+
return (_target, _propertyKey, descriptor)=>descriptor;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Decorator factory class that provides decorator methods which can be conditionally
|
|
3
|
+
* disabled during unit testing using the @ignoreInUnitTest decorator.
|
|
4
|
+
*
|
|
5
|
+
* Inspired by: https://jasonharper.blog/2018/03/13/decorate-the-decorator-to-exclude-in-unit-testing/
|
|
6
|
+
*/ /**
|
|
7
|
+
* Decorator that disables the decorated decorator method when TEST environment variable is true.
|
|
8
|
+
* If TEST=true, it returns a no-op decorator that simply returns the original function unchanged.
|
|
9
|
+
*/ "use strict";
|
|
10
|
+
Object.defineProperty(exports, "__esModule", {
|
|
11
|
+
value: true
|
|
12
|
+
});
|
|
13
|
+
Object.defineProperty(exports, "ignoreInUnitTest", {
|
|
14
|
+
enumerable: true,
|
|
15
|
+
get: function() {
|
|
16
|
+
return ignoreInUnitTest;
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
function ignoreInUnitTest(_target, _propertyKey, descriptor) {
|
|
20
|
+
const originalMethod = descriptor.value;
|
|
21
|
+
descriptor.value = function(...args) {
|
|
22
|
+
// Check if we're in a test environment
|
|
23
|
+
if (process.env.TEST === "true") {
|
|
24
|
+
// Return a no-op decorator that just returns the original function
|
|
25
|
+
return (originalFunction)=>originalFunction;
|
|
26
|
+
}
|
|
27
|
+
// Otherwise, apply the original decorator method
|
|
28
|
+
return originalMethod.apply(this, args);
|
|
29
|
+
};
|
|
30
|
+
return descriptor;
|
|
31
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
Object.defineProperty(exports, "extension", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: function() {
|
|
8
|
+
return extension;
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
function extension(ctor, options) {
|
|
12
|
+
return (_target, propertyKey, descriptor)=>{
|
|
13
|
+
const originalFunction = descriptor.value;
|
|
14
|
+
ctor.prototype[propertyKey] = function(...args) {
|
|
15
|
+
return originalFunction.apply(this, [
|
|
16
|
+
this,
|
|
17
|
+
...args
|
|
18
|
+
]);
|
|
19
|
+
};
|
|
20
|
+
if (options?.static) {
|
|
21
|
+
Object.defineProperty(ctor, propertyKey, {
|
|
22
|
+
configurable: true,
|
|
23
|
+
writable: true,
|
|
24
|
+
value (...args) {
|
|
25
|
+
const receiver = singletonOf(ctor) ?? this;
|
|
26
|
+
return originalFunction.apply(receiver, [
|
|
27
|
+
receiver,
|
|
28
|
+
...args
|
|
29
|
+
]);
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
function singletonOf(ctor) {
|
|
36
|
+
return ctor.instance;
|
|
37
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
_export_star(require("./decorator-factory.js"), exports);
|
|
6
|
+
_export_star(require("./decorator-factory-base.js"), exports);
|
|
7
|
+
_export_star(require("./extension.js"), exports);
|
|
8
|
+
_export_star(require("./mixwith.js"), exports);
|
|
9
|
+
_export_star(require("./pipeline.js"), exports);
|
|
10
|
+
_export_star(require("./step.js"), exports);
|
|
11
|
+
function _export_star(from, to) {
|
|
12
|
+
Object.keys(from).forEach(function(k) {
|
|
13
|
+
if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
|
|
14
|
+
Object.defineProperty(to, k, {
|
|
15
|
+
enumerable: true,
|
|
16
|
+
get: function() {
|
|
17
|
+
return from[k];
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
return from;
|
|
23
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
Object.defineProperty(exports, "mixwith", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: function() {
|
|
8
|
+
return mixwith;
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
const BLOCKED_PROTOTYPE_KEYS = new Set([
|
|
12
|
+
"constructor",
|
|
13
|
+
"prototype",
|
|
14
|
+
"name",
|
|
15
|
+
"length"
|
|
16
|
+
]);
|
|
17
|
+
function copyPrototypeProperties(target, source) {
|
|
18
|
+
for (const key of Reflect.ownKeys(source)){
|
|
19
|
+
if (typeof key === "string" && BLOCKED_PROTOTYPE_KEYS.has(key)) {
|
|
20
|
+
continue;
|
|
21
|
+
}
|
|
22
|
+
const descriptor = Object.getOwnPropertyDescriptor(source, key);
|
|
23
|
+
if (descriptor == null) {
|
|
24
|
+
continue;
|
|
25
|
+
}
|
|
26
|
+
Object.defineProperty(target, key, descriptor);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
function mixwith(...mixins) {
|
|
30
|
+
class Mixed {
|
|
31
|
+
}
|
|
32
|
+
for (const mixin of mixins){
|
|
33
|
+
copyPrototypeProperties(Mixed.prototype, mixin.prototype);
|
|
34
|
+
}
|
|
35
|
+
return Mixed;
|
|
36
|
+
}
|