@tsed/core 7.0.0-beta.1 → 7.0.0-beta.12
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/jest.config.js +14 -0
- package/lib/cjs/decorators/configurable.js +2 -6
- package/lib/cjs/decorators/configurable.js.map +1 -1
- package/lib/cjs/decorators/deprecated.js +2 -1
- package/lib/cjs/decorators/deprecated.js.map +1 -1
- package/lib/cjs/decorators/enumerable.js +2 -6
- package/lib/cjs/decorators/enumerable.js.map +1 -1
- package/lib/cjs/decorators/notConfigurable.js +0 -4
- package/lib/cjs/decorators/notConfigurable.js.map +1 -1
- package/lib/cjs/decorators/notEnumerable.js +0 -4
- package/lib/cjs/decorators/notEnumerable.js.map +1 -1
- package/lib/cjs/decorators/readOnly.js +0 -4
- package/lib/cjs/decorators/readOnly.js.map +1 -1
- package/lib/cjs/decorators/writable.js +2 -6
- package/lib/cjs/decorators/writable.js.map +1 -1
- package/lib/cjs/domain/AnyToPromise.js +10 -10
- package/lib/cjs/domain/AnyToPromise.js.map +1 -1
- package/lib/cjs/errors/UnsupportedDecoratorType.js +5 -3
- package/lib/cjs/errors/UnsupportedDecoratorType.js.map +1 -1
- package/lib/cjs/index.js +81 -5
- package/lib/cjs/index.js.map +1 -1
- package/lib/cjs/package.json +3 -0
- package/lib/cjs/utils/decorators/decorateMethodsOf.js +1 -0
- package/lib/cjs/utils/decorators/decorateMethodsOf.js.map +1 -1
- package/lib/cjs/utils/imports/importPackage.js +5 -1
- package/lib/cjs/utils/imports/importPackage.js.map +1 -1
- package/lib/cjs/utils/objects/deepClone.js +6 -0
- package/lib/cjs/utils/objects/deepClone.js.map +1 -1
- package/lib/cjs/utils/objects/deepMerge.js.map +1 -1
- package/lib/cjs/utils/objects/getConstructorArgNames.js +6 -1
- package/lib/cjs/utils/objects/getConstructorArgNames.js.map +1 -1
- package/lib/cjs/utils/objects/getValue.js +1 -1
- package/lib/cjs/utils/objects/getValue.js.map +1 -1
- package/lib/cjs/utils/objects/isBuffer.js +13 -0
- package/lib/cjs/utils/objects/isBuffer.js.map +1 -0
- package/lib/cjs/utils/objects/isClass.js +3 -1
- package/lib/cjs/utils/objects/isClass.js.map +1 -1
- package/lib/cjs/utils/objects/methodsOf.js.map +1 -1
- package/lib/esm/decorators/configurable.js +1 -5
- package/lib/esm/decorators/configurable.js.map +1 -1
- package/lib/esm/decorators/deprecated.js +2 -1
- package/lib/esm/decorators/deprecated.js.map +1 -1
- package/lib/esm/decorators/enumerable.js +1 -5
- package/lib/esm/decorators/enumerable.js.map +1 -1
- package/lib/esm/decorators/notConfigurable.js +1 -5
- package/lib/esm/decorators/notConfigurable.js.map +1 -1
- package/lib/esm/decorators/notEnumerable.js +1 -5
- package/lib/esm/decorators/notEnumerable.js.map +1 -1
- package/lib/esm/decorators/readOnly.js +1 -5
- package/lib/esm/decorators/readOnly.js.map +1 -1
- package/lib/esm/decorators/storeFn.js +1 -1
- package/lib/esm/decorators/storeMerge.js +1 -1
- package/lib/esm/decorators/storeSet.js +1 -1
- package/lib/esm/decorators/writable.js +1 -5
- package/lib/esm/decorators/writable.js.map +1 -1
- package/lib/esm/domain/AnyToPromise.js +3 -3
- package/lib/esm/domain/Metadata.js +1 -1
- package/lib/esm/domain/Store.js +8 -8
- package/lib/esm/errors/UnsupportedDecoratorType.js +3 -1
- package/lib/esm/errors/UnsupportedDecoratorType.js.map +1 -1
- package/lib/esm/index.js +81 -5
- package/lib/esm/index.js.map +1 -1
- package/lib/esm/package.json +3 -0
- package/lib/esm/utils/decorators/decorateMethodsOf.js +6 -5
- package/lib/esm/utils/decorators/decorateMethodsOf.js.map +1 -1
- package/lib/esm/utils/decorators/decoratorArgs.js +1 -1
- package/lib/esm/utils/decorators/decoratorTypeOf.js +2 -2
- package/lib/esm/utils/decorators/inheritedDescriptorOf.js +1 -1
- package/lib/esm/utils/decorators/useMethodDecorators.js +1 -1
- package/lib/esm/utils/objects/ancestorsOf.js +3 -3
- package/lib/esm/utils/objects/cleanObject.js +1 -1
- package/lib/esm/utils/objects/createInstance.js +1 -1
- package/lib/esm/utils/objects/deepClone.js +12 -6
- package/lib/esm/utils/objects/deepClone.js.map +1 -1
- package/lib/esm/utils/objects/deepMerge.js +5 -5
- package/lib/esm/utils/objects/deepMerge.js.map +1 -1
- package/lib/esm/utils/objects/getClassOrSymbol.js +2 -2
- package/lib/esm/utils/objects/getConstructorArgNames.js +7 -2
- package/lib/esm/utils/objects/getConstructorArgNames.js.map +1 -1
- package/lib/esm/utils/objects/getEnumerableKeys.js +2 -2
- package/lib/esm/utils/objects/getValue.js +4 -4
- package/lib/esm/utils/objects/getValue.js.map +1 -1
- package/lib/esm/utils/objects/isArrowFn.js +1 -1
- package/lib/esm/utils/objects/isBuffer.js +9 -0
- package/lib/esm/utils/objects/isBuffer.js.map +1 -0
- package/lib/esm/utils/objects/isClass.js +10 -8
- package/lib/esm/utils/objects/isClass.js.map +1 -1
- package/lib/esm/utils/objects/isCollection.js +1 -1
- package/lib/esm/utils/objects/isEmpty.js +1 -1
- package/lib/esm/utils/objects/isEnumerable.js +2 -2
- package/lib/esm/utils/objects/isInheritedFrom.js +3 -3
- package/lib/esm/utils/objects/isPlainObject.js +1 -1
- package/lib/esm/utils/objects/isPrimitive.js +3 -3
- package/lib/esm/utils/objects/isSerializable.js +5 -5
- package/lib/esm/utils/objects/methodsOf.js +3 -3
- package/lib/esm/utils/objects/methodsOf.js.map +1 -1
- package/lib/esm/utils/objects/objectKeys.js +1 -1
- package/lib/esm/utils/objects/primitiveOf.js +3 -3
- package/lib/esm/utils/objects/prototypeOf.js +1 -1
- package/lib/esm/utils/objects/setValue.js +1 -1
- package/lib/esm/utils/objects/toMap.js +2 -2
- package/lib/esm/utils/objects/toStringConstructor.js +1 -1
- package/lib/esm/utils/proxyDelegation.js +1 -1
- package/lib/types/decorators/configurable.d.ts +0 -1
- package/lib/types/decorators/enumerable.d.ts +0 -1
- package/lib/types/decorators/notConfigurable.d.ts +0 -1
- package/lib/types/decorators/notEnumerable.d.ts +0 -1
- package/lib/types/decorators/readOnly.d.ts +0 -1
- package/lib/types/decorators/writable.d.ts +0 -1
- package/lib/types/index.d.ts +80 -5
- package/lib/types/utils/objects/deepMerge.d.ts +1 -1
- package/lib/types/utils/objects/isBuffer.d.ts +7 -0
- package/lib/types/utils/objects/methodsOf.d.ts +5 -1
- package/package.json +12 -6
- package/readme.md +3 -3
- package/tsconfig.compile.esm.json +1 -12
- package/lib/cjs/decorators/index.js +0 -18
- package/lib/cjs/decorators/index.js.map +0 -1
- package/lib/cjs/domain/index.js +0 -11
- package/lib/cjs/domain/index.js.map +0 -1
- package/lib/cjs/interfaces/index.js +0 -3
- package/lib/cjs/interfaces/index.js.map +0 -1
- package/lib/cjs/utils/index.js +0 -19
- package/lib/cjs/utils/index.js.map +0 -1
- package/lib/cjs/utils/objects/index.js +0 -46
- package/lib/cjs/utils/objects/index.js.map +0 -1
- package/lib/esm/decorators/index.js +0 -15
- package/lib/esm/decorators/index.js.map +0 -1
- package/lib/esm/domain/index.js +0 -8
- package/lib/esm/domain/index.js.map +0 -1
- package/lib/esm/interfaces/index.js +0 -2
- package/lib/esm/interfaces/index.js.map +0 -1
- package/lib/esm/utils/index.js +0 -16
- package/lib/esm/utils/index.js.map +0 -1
- package/lib/esm/utils/objects/index.js +0 -43
- package/lib/esm/utils/objects/index.js.map +0 -1
- package/lib/types/decorators/index.d.ts +0 -14
- package/lib/types/domain/index.d.ts +0 -7
- package/lib/types/interfaces/index.d.ts +0 -4
- package/lib/types/utils/index.d.ts +0 -13
- package/lib/types/utils/objects/index.d.ts +0 -42
package/jest.config.js
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
// For a detailed explanation regarding each configuration property, visit:
|
|
2
|
+
// https://jestjs.io/docs/en/configuration.html
|
|
3
|
+
|
|
4
|
+
module.exports = {
|
|
5
|
+
...require("@tsed/jest-config")(__dirname, "core"),
|
|
6
|
+
coverageThreshold: {
|
|
7
|
+
global: {
|
|
8
|
+
statements: 97.95,
|
|
9
|
+
branches: 89.59,
|
|
10
|
+
functions: 96.04,
|
|
11
|
+
lines: 98.17
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
};
|
|
@@ -1,14 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.Configurable = void 0;
|
|
4
|
-
|
|
5
|
-
* @module common/core
|
|
6
|
-
*/
|
|
7
|
-
const utils_1 = require("../utils");
|
|
8
|
-
/** */
|
|
4
|
+
const descriptorOf_1 = require("../utils/objects/descriptorOf");
|
|
9
5
|
function Configurable(value = true) {
|
|
10
6
|
return (target, propertyKey) => {
|
|
11
|
-
const descriptor = (0,
|
|
7
|
+
const descriptor = (0, descriptorOf_1.descriptorOf)(target, propertyKey) || { writable: true, enumerable: true };
|
|
12
8
|
descriptor.configurable = value;
|
|
13
9
|
Object.defineProperty((target && target.prototype) || target, propertyKey, descriptor);
|
|
14
10
|
return descriptor;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"configurable.js","sourceRoot":"","sources":["../../../src/decorators/configurable.ts"],"names":[],"mappings":";;;AAAA
|
|
1
|
+
{"version":3,"file":"configurable.js","sourceRoot":"","sources":["../../../src/decorators/configurable.ts"],"names":[],"mappings":";;;AAAA,gEAA2D;AAE3D,SAAgB,YAAY,CAAC,QAAiB,IAAI;IAChD,OAAO,CAAC,MAAW,EAAE,WAAmB,EAAE,EAAE;QAC1C,MAAM,UAAU,GAAG,IAAA,2BAAY,EAAC,MAAM,EAAE,WAAW,CAAC,IAAI,EAAC,QAAQ,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI,EAAC,CAAC;QAC3F,UAAU,CAAC,YAAY,GAAG,KAAK,CAAC;QAChC,MAAM,CAAC,cAAc,CAAC,CAAC,MAAM,IAAI,MAAM,CAAC,SAAS,CAAC,IAAI,MAAM,EAAE,WAAW,EAAE,UAAU,CAAC,CAAC;QAEvF,OAAO,UAAU,CAAC;IACpB,CAAC,CAAC;AACJ,CAAC;AARD,oCAQC","sourcesContent":["import {descriptorOf} from \"../utils/objects/descriptorOf\";\n\nexport function Configurable(value: boolean = true): Function {\n return (target: any, propertyKey: string) => {\n const descriptor = descriptorOf(target, propertyKey) || {writable: true, enumerable: true};\n descriptor.configurable = value;\n Object.defineProperty((target && target.prototype) || target, propertyKey, descriptor);\n\n return descriptor;\n };\n}\n"]}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.Deprecated = void 0;
|
|
4
|
+
const util_1 = require("util");
|
|
4
5
|
/**
|
|
5
6
|
* The `@Deprecated()` decorators wraps the given method in such a way that it is marked as deprecated.
|
|
6
7
|
*
|
|
@@ -35,7 +36,7 @@ exports.Deprecated = void 0;
|
|
|
35
36
|
function Deprecated(message) {
|
|
36
37
|
return (target, targetKey, descriptor) => {
|
|
37
38
|
const originalMethod = descriptor.value;
|
|
38
|
-
descriptor.value =
|
|
39
|
+
descriptor.value = (0, util_1.deprecate)(originalMethod, message);
|
|
39
40
|
return descriptor;
|
|
40
41
|
};
|
|
41
42
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deprecated.js","sourceRoot":"","sources":["../../../src/decorators/deprecated.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"deprecated.js","sourceRoot":"","sources":["../../../src/decorators/deprecated.ts"],"names":[],"mappings":";;;AAAA,+BAA+B;AAE/B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,SAAgB,UAAU,CAAC,OAAe;IACxC,OAAO,CAAC,MAAiB,EAAE,SAAiB,EAAE,UAAwC,EAAE,EAAE;QACxF,MAAM,cAAc,GAAG,UAAU,CAAC,KAAK,CAAC;QAExC,UAAU,CAAC,KAAK,GAAG,IAAA,gBAAS,EAAC,cAAc,EAAE,OAAO,CAAC,CAAC;QAEtD,OAAO,UAAU,CAAC;IACpB,CAAC,CAAC;AACJ,CAAC;AARD,gCAQC","sourcesContent":["import {deprecate} from \"util\";\nimport {Type} from \"../domain/Type\";\n/**\n * The `@Deprecated()` decorators wraps the given method in such a way that it is marked as deprecated.\n *\n * ```typescript\n * provide Foo {\n *\n * @Deprecated(\"Foo.method: Use Foo.method2 instead\")\n * public method() {\n *\n * }\n * ```\n *\n * When called, @Deprecated() will return a function that will emit a `DeprecationWarning` using the `process.on('warning')` event.\n * By default, this warning will be emitted and printed to `stderr` exactly once, the first time it is called. After the warning is emitted, the wrapped method is called.\n *\n * If either the `--no-deprecation` or `--no-warnings` command line flags are used, or if the `process.noDeprecation`\n * property is set to `true` prior to the first deprecation warning, the `@Deprecated()` decorators does nothing.\n *\n * If the `--trace-deprecation` or `--trace-warnings` command line flags are set, or the `process.traceDeprecation`\n * property is set to `true`, a warning and a stack trace are printed to stderr the first time the deprecated function is called.\n *\n * If the `--throw-deprecation` command line flag is set, or the `process.throwDeprecation` property is set to `true`,\n * then an exception will be thrown when the deprecated function is called.\n *\n * The `--throw-deprecation` command line flag and `process.throwDeprecation` property take precedence over `--trace-deprecation`\n * and `process.traceDeprecation`.\n *\n * @param message\n * @returns {Function}\n * @decorator\n */\nexport function Deprecated(message: string): Function {\n return (target: Type<any>, targetKey: string, descriptor: TypedPropertyDescriptor<any>) => {\n const originalMethod = descriptor.value;\n\n descriptor.value = deprecate(originalMethod, message);\n\n return descriptor;\n };\n}\n"]}
|
|
@@ -1,14 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.Enumerable = void 0;
|
|
4
|
-
|
|
5
|
-
* @module common/core
|
|
6
|
-
*/
|
|
7
|
-
const utils_1 = require("../utils");
|
|
8
|
-
/** */
|
|
4
|
+
const descriptorOf_1 = require("../utils/objects/descriptorOf");
|
|
9
5
|
function Enumerable(value = true) {
|
|
10
6
|
return (target, propertyKey) => {
|
|
11
|
-
const descriptor = (0,
|
|
7
|
+
const descriptor = (0, descriptorOf_1.descriptorOf)(target, propertyKey) || { writable: true, configurable: true };
|
|
12
8
|
descriptor.enumerable = value;
|
|
13
9
|
Object.defineProperty((target && target.prototype) || target, propertyKey, descriptor);
|
|
14
10
|
return descriptor;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"enumerable.js","sourceRoot":"","sources":["../../../src/decorators/enumerable.ts"],"names":[],"mappings":";;;AAAA
|
|
1
|
+
{"version":3,"file":"enumerable.js","sourceRoot":"","sources":["../../../src/decorators/enumerable.ts"],"names":[],"mappings":";;;AAAA,gEAA2D;AAE3D,SAAgB,UAAU,CAAC,QAAiB,IAAI;IAC9C,OAAO,CAAC,MAAW,EAAE,WAAmB,EAAE,EAAE;QAC1C,MAAM,UAAU,GAAG,IAAA,2BAAY,EAAC,MAAM,EAAE,WAAW,CAAC,IAAI,EAAC,QAAQ,EAAE,IAAI,EAAE,YAAY,EAAE,IAAI,EAAC,CAAC;QAC7F,UAAU,CAAC,UAAU,GAAG,KAAK,CAAC;QAC9B,MAAM,CAAC,cAAc,CAAC,CAAC,MAAM,IAAI,MAAM,CAAC,SAAS,CAAC,IAAI,MAAM,EAAE,WAAW,EAAE,UAAU,CAAC,CAAC;QAEvF,OAAO,UAAU,CAAC;IACpB,CAAC,CAAC;AACJ,CAAC;AARD,gCAQC","sourcesContent":["import {descriptorOf} from \"../utils/objects/descriptorOf\";\n\nexport function Enumerable(value: boolean = true): Function {\n return (target: any, propertyKey: string) => {\n const descriptor = descriptorOf(target, propertyKey) || {writable: true, configurable: true};\n descriptor.enumerable = value;\n Object.defineProperty((target && target.prototype) || target, propertyKey, descriptor);\n\n return descriptor;\n };\n}\n"]}
|
|
@@ -1,11 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.NotConfigurable = void 0;
|
|
4
|
-
/**
|
|
5
|
-
* @module common/core
|
|
6
|
-
*/
|
|
7
4
|
const configurable_1 = require("./configurable");
|
|
8
|
-
/** */
|
|
9
5
|
function NotConfigurable() {
|
|
10
6
|
return (0, configurable_1.Configurable)(false);
|
|
11
7
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"notConfigurable.js","sourceRoot":"","sources":["../../../src/decorators/notConfigurable.ts"],"names":[],"mappings":";;;AAAA
|
|
1
|
+
{"version":3,"file":"notConfigurable.js","sourceRoot":"","sources":["../../../src/decorators/notConfigurable.ts"],"names":[],"mappings":";;;AAAA,iDAA4C;AAE5C,SAAgB,eAAe;IAC7B,OAAO,IAAA,2BAAY,EAAC,KAAK,CAAC,CAAC;AAC7B,CAAC;AAFD,0CAEC","sourcesContent":["import {Configurable} from \"./configurable\";\n\nexport function NotConfigurable(): Function {\n return Configurable(false);\n}\n"]}
|
|
@@ -1,11 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.NotEnumerable = void 0;
|
|
4
|
-
/**
|
|
5
|
-
* @module common/core
|
|
6
|
-
*/
|
|
7
4
|
const enumerable_1 = require("./enumerable");
|
|
8
|
-
/** */
|
|
9
5
|
function NotEnumerable() {
|
|
10
6
|
return (0, enumerable_1.Enumerable)(false);
|
|
11
7
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"notEnumerable.js","sourceRoot":"","sources":["../../../src/decorators/notEnumerable.ts"],"names":[],"mappings":";;;AAAA
|
|
1
|
+
{"version":3,"file":"notEnumerable.js","sourceRoot":"","sources":["../../../src/decorators/notEnumerable.ts"],"names":[],"mappings":";;;AAAA,6CAAwC;AAExC,SAAgB,aAAa;IAC3B,OAAO,IAAA,uBAAU,EAAC,KAAK,CAAC,CAAC;AAC3B,CAAC;AAFD,sCAEC","sourcesContent":["import {Enumerable} from \"./enumerable\";\n\nexport function NotEnumerable(): Function {\n return Enumerable(false);\n}\n"]}
|
|
@@ -1,11 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.Readonly = void 0;
|
|
4
|
-
/**
|
|
5
|
-
* @module common/core
|
|
6
|
-
*/
|
|
7
4
|
const writable_1 = require("./writable");
|
|
8
|
-
/** */
|
|
9
5
|
function Readonly() {
|
|
10
6
|
return (0, writable_1.Writable)(false);
|
|
11
7
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"readOnly.js","sourceRoot":"","sources":["../../../src/decorators/readOnly.ts"],"names":[],"mappings":";;;AAAA
|
|
1
|
+
{"version":3,"file":"readOnly.js","sourceRoot":"","sources":["../../../src/decorators/readOnly.ts"],"names":[],"mappings":";;;AAAA,yCAAoC;AAEpC,SAAgB,QAAQ;IACtB,OAAO,IAAA,mBAAQ,EAAC,KAAK,CAAC,CAAC;AACzB,CAAC;AAFD,4BAEC","sourcesContent":["import {Writable} from \"./writable\";\n\nexport function Readonly(): Function {\n return Writable(false);\n}\n"]}
|
|
@@ -1,14 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.Writable = void 0;
|
|
4
|
-
|
|
5
|
-
* @module common/core
|
|
6
|
-
*/
|
|
7
|
-
const utils_1 = require("../utils");
|
|
8
|
-
/** */
|
|
4
|
+
const descriptorOf_1 = require("../utils/objects/descriptorOf");
|
|
9
5
|
function Writable(value = true) {
|
|
10
6
|
return (target, propertyKey) => {
|
|
11
|
-
const descriptor = (0,
|
|
7
|
+
const descriptor = (0, descriptorOf_1.descriptorOf)(target, propertyKey) || { configurable: true, enumerable: true };
|
|
12
8
|
descriptor.writable = value;
|
|
13
9
|
Object.defineProperty((target && target.prototype) || target, propertyKey, descriptor);
|
|
14
10
|
return descriptor;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"writable.js","sourceRoot":"","sources":["../../../src/decorators/writable.ts"],"names":[],"mappings":";;;AAAA
|
|
1
|
+
{"version":3,"file":"writable.js","sourceRoot":"","sources":["../../../src/decorators/writable.ts"],"names":[],"mappings":";;;AAAA,gEAA2D;AAE3D,SAAgB,QAAQ,CAAC,QAAiB,IAAI;IAC5C,OAAO,CAAC,MAAW,EAAE,WAAmB,EAAE,EAAE;QAC1C,MAAM,UAAU,GAAG,IAAA,2BAAY,EAAC,MAAM,EAAE,WAAW,CAAC,IAAI,EAAC,YAAY,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI,EAAC,CAAC;QAC/F,UAAU,CAAC,QAAQ,GAAG,KAAK,CAAC;QAC5B,MAAM,CAAC,cAAc,CAAC,CAAC,MAAM,IAAI,MAAM,CAAC,SAAS,CAAC,IAAI,MAAM,EAAE,WAAW,EAAE,UAAU,CAAC,CAAC;QAEvF,OAAO,UAAU,CAAC;IACpB,CAAC,CAAC;AACJ,CAAC;AARD,4BAQC","sourcesContent":["import {descriptorOf} from \"../utils/objects/descriptorOf\";\n\nexport function Writable(value: boolean = true): Function {\n return (target: any, propertyKey: string) => {\n const descriptor = descriptorOf(target, propertyKey) || {configurable: true, enumerable: true};\n descriptor.writable = value;\n Object.defineProperty((target && target.prototype) || target, propertyKey, descriptor);\n\n return descriptor;\n };\n}\n"]}
|
|
@@ -35,17 +35,17 @@ class AnyToPromise {
|
|
|
35
35
|
_AnyToPromise_rejects.set(this, void 0);
|
|
36
36
|
_AnyToPromise_hasNextFunction.set(this, false);
|
|
37
37
|
_AnyToPromise_promise.set(this, void 0);
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
38
|
+
tslib_1.__classPrivateFieldSet(this, _AnyToPromise_hasNextFunction, hasNextFunction, "f");
|
|
39
|
+
tslib_1.__classPrivateFieldSet(this, _AnyToPromise_promise, new Promise((resolve, reject) => {
|
|
40
|
+
tslib_1.__classPrivateFieldSet(this, _AnyToPromise_resolves, resolve, "f");
|
|
41
|
+
tslib_1.__classPrivateFieldSet(this, _AnyToPromise_rejects, reject, "f");
|
|
42
42
|
}), "f");
|
|
43
43
|
}
|
|
44
44
|
isDone() {
|
|
45
45
|
return this.status !== AnyToPromiseStatus.PENDING;
|
|
46
46
|
}
|
|
47
47
|
get next() {
|
|
48
|
-
|
|
48
|
+
tslib_1.__classPrivateFieldSet(this, _AnyToPromise_hasNextFunction, true, "f");
|
|
49
49
|
return (error) => {
|
|
50
50
|
if (this.isDone()) {
|
|
51
51
|
return;
|
|
@@ -66,21 +66,21 @@ class AnyToPromise {
|
|
|
66
66
|
catch (er) {
|
|
67
67
|
this.reject(er);
|
|
68
68
|
}
|
|
69
|
-
return
|
|
69
|
+
return tslib_1.__classPrivateFieldGet(this, _AnyToPromise_promise, "f");
|
|
70
70
|
}
|
|
71
71
|
reject(er) {
|
|
72
72
|
if (this.isDone()) {
|
|
73
73
|
return;
|
|
74
74
|
}
|
|
75
75
|
this.done(AnyToPromiseStatus.REJECTED);
|
|
76
|
-
|
|
76
|
+
tslib_1.__classPrivateFieldGet(this, _AnyToPromise_rejects, "f").call(this, er);
|
|
77
77
|
}
|
|
78
78
|
resolve(response = {}) {
|
|
79
79
|
if (this.isDone()) {
|
|
80
80
|
return;
|
|
81
81
|
}
|
|
82
82
|
this.done(AnyToPromiseStatus.RESOLVED);
|
|
83
|
-
|
|
83
|
+
tslib_1.__classPrivateFieldGet(this, _AnyToPromise_resolves, "f").call(this, { ...response, state: AnyToPromiseStatus.RESOLVED });
|
|
84
84
|
}
|
|
85
85
|
destroy() { }
|
|
86
86
|
cancel() {
|
|
@@ -88,7 +88,7 @@ class AnyToPromise {
|
|
|
88
88
|
return;
|
|
89
89
|
}
|
|
90
90
|
this.done(AnyToPromiseStatus.CANCELED);
|
|
91
|
-
return
|
|
91
|
+
return tslib_1.__classPrivateFieldGet(this, _AnyToPromise_resolves, "f").call(this, { state: AnyToPromiseStatus.CANCELED });
|
|
92
92
|
}
|
|
93
93
|
done(status) {
|
|
94
94
|
this.destroy();
|
|
@@ -130,7 +130,7 @@ class AnyToPromise {
|
|
|
130
130
|
});
|
|
131
131
|
}
|
|
132
132
|
}
|
|
133
|
-
if (!
|
|
133
|
+
if (!tslib_1.__classPrivateFieldGet(this, _AnyToPromise_hasNextFunction, "f")) {
|
|
134
134
|
// no next function and empty response
|
|
135
135
|
return this.resolve({
|
|
136
136
|
...additionalProps,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AnyToPromise.js","sourceRoot":"","sources":["../../../src/domain/AnyToPromise.ts"],"names":[],"mappings":";;;;;AAAA,gEAA2D;AAC3D,0DAAqD;AACrD,wDAAmD;AAEnD;;GAEG;AACH,SAAS,UAAU,CAAC,GAAQ;IAC1B,OAAO,GAAG,CAAC,IAAI,IAAI,GAAG,CAAC,OAAO,IAAI,GAAG,CAAC,MAAM,IAAI,GAAG,CAAC,UAAU,CAAC;AACjE,CAAC;AAED;;GAEG;AACH,IAAY,kBAKX;AALD,WAAY,kBAAkB;IAC5B,yCAAmB,CAAA;IACnB,2CAAqB,CAAA;IACrB,2CAAqB,CAAA;IACrB,2CAAqB,CAAA;AACvB,CAAC,EALW,kBAAkB,GAAlB,0BAAkB,KAAlB,0BAAkB,QAK7B;AAED,IAAY,yBAIX;AAJD,WAAY,yBAAyB;IACnC,8CAAiB,CAAA;IACjB,8CAAiB,CAAA;IACjB,0CAAa,CAAA;AACf,CAAC,EAJW,yBAAyB,GAAzB,iCAAyB,KAAzB,iCAAyB,QAIpC;AAUD,MAAa,YAAY;IAUvB,YAAY,EAAC,eAAe,GAAG,KAAK,KAAiC,EAAE;QAThE,WAAM,GAAG,kBAAkB,CAAC,OAAO,CAAC;QAG3C,yCAAe;QACf,wCAAc;QACd,wCAAmB,KAAK,EAAC;QAEzB,wCAAgD;QAG9C,
|
|
1
|
+
{"version":3,"file":"AnyToPromise.js","sourceRoot":"","sources":["../../../src/domain/AnyToPromise.ts"],"names":[],"mappings":";;;;;AAAA,gEAA2D;AAC3D,0DAAqD;AAC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OAAO;qBACX,IAAI,CAAC,CAAC,MAAW,EAAE,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC,CAAC;qBAC3D,KAAK,CAAC,CAAC,KAAU,EAAE,EAAE;oBACpB,IAAI,KAAK,CAAC,QAAQ,IAAI,UAAU,CAAC,KAAK,CAAC,QAAQ,CAAC,EAAE;wBAChD,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;qBACpC;oBACD,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;gBAC5B,CAAC,CAAC,CAAC;aACN;SACF;QAED,IAAI,CAAC,+BAAA,IAAI,qCAAiB,EAAE;YAC1B,sCAAsC;YACtC,OAAO,IAAI,CAAC,OAAO,CAAC;gBAClB,GAAG,eAAe;gBAClB,IAAI,EAAE,OAAO;gBACb,IAAI,EAAE,yBAAyB,CAAC,IAAI;aACrC,CAAC,CAAC;SACJ;IACH,CAAC;IAES,kBAAkB,CAAC,OAAY;QACvC,OAAO,OAAO,KAAK,kBAAkB,CAAC,QAAQ,CAAC;IACjD,CAAC;CACF;AAhJD,oCAgJC","sourcesContent":["import {isObservable} from \"../utils/objects/isObservable\";\nimport {isPromise} from \"../utils/objects/isPromise\";\nimport {isStream} from \"../utils/objects/isStream\";\n\n/**\n * @ignore\n */\nfunction isResponse(obj: any) {\n return obj.data && obj.headers && obj.status && obj.statusText;\n}\n\n/**\n * @ignore\n */\nexport enum AnyToPromiseStatus {\n PENDING = \"PENDING\",\n CANCELED = \"CANCELED\",\n RESOLVED = \"RESOLVED\",\n REJECTED = \"REJECTED\"\n}\n\nexport enum AnyToPromiseResponseTypes {\n STREAM = \"STREAM\",\n BUFFER = \"BUFFER\",\n DATA = \"DATA\"\n}\n\nexport interface AnyPromiseResult<T = any> {\n state: AnyToPromiseStatus;\n type: AnyToPromiseResponseTypes;\n status?: number;\n headers?: Record<string, any>;\n data: T;\n}\n\nexport class AnyToPromise<T = any> {\n public status = AnyToPromiseStatus.PENDING;\n public args: any[];\n\n #resolves: any;\n #rejects: any;\n #hasNextFunction = false;\n\n readonly #promise: Promise<AnyPromiseResult<T>>;\n\n constructor({hasNextFunction = false}: {hasNextFunction?: boolean} = {}) {\n this.#hasNextFunction = hasNextFunction;\n\n this.#promise = new Promise((resolve: any, reject: any) => {\n this.#resolves = resolve;\n this.#rejects = reject;\n });\n }\n\n isDone(): boolean {\n return this.status !== AnyToPromiseStatus.PENDING;\n }\n\n get next() {\n this.#hasNextFunction = true;\n\n return (error?: any) => {\n if (this.isDone()) {\n return;\n }\n\n return error ? this.reject(error) : this.resolve({type: AnyToPromiseResponseTypes.DATA});\n };\n }\n\n /**\n *\n */\n async call(cb: Function): Promise<AnyPromiseResult<T>> {\n if (this.isDone()) {\n return this as any;\n }\n\n try {\n this.handle(cb());\n } catch (er) {\n this.reject(er);\n }\n\n return this.#promise;\n }\n\n reject(er: any) {\n if (this.isDone()) {\n return;\n }\n\n this.done(AnyToPromiseStatus.REJECTED);\n\n this.#rejects(er);\n }\n\n resolve(response: any = {}) {\n if (this.isDone()) {\n return;\n }\n\n this.done(AnyToPromiseStatus.RESOLVED);\n\n this.#resolves({...response, state: AnyToPromiseStatus.RESOLVED});\n }\n\n destroy() {}\n\n cancel() {\n if (this.isDone()) {\n return;\n }\n\n this.done(AnyToPromiseStatus.CANCELED);\n\n return this.#resolves({state: AnyToPromiseStatus.CANCELED});\n }\n\n done(status: AnyToPromiseStatus) {\n this.destroy();\n this.status = status;\n }\n\n handle(process: any, additionalProps = {}): any {\n if (this.isDone()) {\n return;\n }\n\n if (process) {\n if (this.isCanceledResponse(process)) {\n // ABANDON\n return this.cancel();\n }\n\n if (isObservable(process)) {\n process = process.toPromise();\n }\n\n if (isResponse(process)) {\n return this.handle(process.data, {\n ...additionalProps,\n status: process.status,\n headers: process.headers\n });\n }\n\n if (isStream(process)) {\n return this.resolve({...additionalProps, type: AnyToPromiseResponseTypes.STREAM, data: process});\n }\n if (isStream(process) || Buffer.isBuffer(process)) {\n return this.resolve({...additionalProps, type: AnyToPromiseResponseTypes.BUFFER, data: process});\n }\n\n if (isPromise(process)) {\n return process\n .then((result: any) => this.handle(result, additionalProps))\n .catch((error: any) => {\n if (error.response && isResponse(error.response)) {\n return this.handle(error.response);\n }\n return this.reject(error);\n });\n }\n }\n\n if (!this.#hasNextFunction) {\n // no next function and empty response\n return this.resolve({\n ...additionalProps,\n data: process,\n type: AnyToPromiseResponseTypes.DATA\n });\n }\n }\n\n protected isCanceledResponse(process: any) {\n return process === AnyToPromiseStatus.CANCELED;\n }\n}\n"]}
|
|
@@ -1,19 +1,21 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.UnsupportedDecoratorType = void 0;
|
|
4
|
-
const
|
|
4
|
+
const decoratorTypeOf_1 = require("../utils/decorators/decoratorTypeOf");
|
|
5
|
+
const classOf_1 = require("../utils/objects/classOf");
|
|
6
|
+
const nameOf_1 = require("../utils/objects/nameOf");
|
|
5
7
|
class UnsupportedDecoratorType extends Error {
|
|
6
8
|
constructor(decorator, args) {
|
|
7
9
|
super(UnsupportedDecoratorType.buildMessage(decorator, args));
|
|
8
10
|
}
|
|
9
11
|
static buildMessage(decorator, args) {
|
|
10
12
|
const [target, propertyKey, index] = args;
|
|
11
|
-
const bindingType = (0,
|
|
13
|
+
const bindingType = (0, decoratorTypeOf_1.decoratorTypeOf)(args);
|
|
12
14
|
const shortBinding = bindingType.split("/")[0];
|
|
13
15
|
const param = shortBinding === "parameter" ? ".[" + index + "]" : "";
|
|
14
16
|
const cstr = shortBinding === "parameter" ? ".constructor" : "";
|
|
15
17
|
const method = propertyKey ? "." + propertyKey : cstr;
|
|
16
|
-
const path = (0,
|
|
18
|
+
const path = (0, nameOf_1.nameOf)((0, classOf_1.classOf)(target)) + method + param;
|
|
17
19
|
return `${decorator.name} cannot be used as ${bindingType} decorator on ${path}`;
|
|
18
20
|
}
|
|
19
21
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UnsupportedDecoratorType.js","sourceRoot":"","sources":["../../../src/errors/UnsupportedDecoratorType.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"UnsupportedDecoratorType.js","sourceRoot":"","sources":["../../../src/errors/UnsupportedDecoratorType.ts"],"names":[],"mappings":";;;AAAA,yEAAoE;AACpE,sDAAiD;AACjD,oDAA+C;AAE/C,MAAa,wBAAyB,SAAQ,KAAK;IAGjD,YAAY,SAAc,EAAE,IAAW;QACrC,KAAK,CAAC,wBAAwB,CAAC,YAAY,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC,CAAC;IAChE,CAAC;IAEO,MAAM,CAAC,YAAY,CAAC,SAAc,EAAE,IAAW;QACrD,MAAM,CAAC,MAAM,EAAE,WAAW,EAAE,KAAK,CAAC,GAAG,IAAI,CAAC;QAE1C,MAAM,WAAW,GAAG,IAAA,iCAAe,EAAC,IAAI,CAAC,CAAC;QAC1C,MAAM,YAAY,GAAG,WAAW,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;QAC/C,MAAM,KAAK,GAAG,YAAY,KAAK,WAAW,CAAC,CAAC,CAAC,IAAI,GAAG,KAAK,GAAG,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC;QACrE,MAAM,IAAI,GAAG,YAAY,KAAK,WAAW,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,EAAE,CAAC;QAChE,MAAM,MAAM,GAAG,WAAW,CAAC,CAAC,CAAC,GAAG,GAAG,WAAW,CAAC,CAAC,CAAC,IAAI,CAAC;QAEtD,MAAM,IAAI,GAAG,IAAA,eAAM,EAAC,IAAA,iBAAO,EAAC,MAAM,CAAC,CAAC,GAAG,MAAM,GAAG,KAAK,CAAC;QAEtD,OAAO,GAAG,SAAS,CAAC,IAAI,sBAAsB,WAAW,iBAAiB,IAAI,EAAE,CAAC;IACnF,CAAC;CACF;AApBD,4DAoBC","sourcesContent":["import {decoratorTypeOf} from \"../utils/decorators/decoratorTypeOf\";\nimport {classOf} from \"../utils/objects/classOf\";\nimport {nameOf} from \"../utils/objects/nameOf\";\n\nexport class UnsupportedDecoratorType extends Error {\n name: \"UNSUPPORTED_DECORATOR_TYPE\";\n\n constructor(decorator: any, args: any[]) {\n super(UnsupportedDecoratorType.buildMessage(decorator, args));\n }\n\n private static buildMessage(decorator: any, args: any[]): string {\n const [target, propertyKey, index] = args;\n\n const bindingType = decoratorTypeOf(args);\n const shortBinding = bindingType.split(\"/\")[0];\n const param = shortBinding === \"parameter\" ? \".[\" + index + \"]\" : \"\";\n const cstr = shortBinding === \"parameter\" ? \".constructor\" : \"\";\n const method = propertyKey ? \".\" + propertyKey : cstr;\n\n const path = nameOf(classOf(target)) + method + param;\n\n return `${decorator.name} cannot be used as ${bindingType} decorator on ${path}`;\n }\n}\n"]}
|
package/lib/cjs/index.js
CHANGED
|
@@ -1,9 +1,85 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* @file Automatically generated by barrelsby.
|
|
4
|
+
*/
|
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
6
|
const tslib_1 = require("tslib");
|
|
4
|
-
require("
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
tslib_1.__exportStar(require("./decorators/configurable"), exports);
|
|
8
|
+
tslib_1.__exportStar(require("./decorators/deprecated"), exports);
|
|
9
|
+
tslib_1.__exportStar(require("./decorators/enumerable"), exports);
|
|
10
|
+
tslib_1.__exportStar(require("./decorators/notConfigurable"), exports);
|
|
11
|
+
tslib_1.__exportStar(require("./decorators/notEnumerable"), exports);
|
|
12
|
+
tslib_1.__exportStar(require("./decorators/readOnly"), exports);
|
|
13
|
+
tslib_1.__exportStar(require("./decorators/storeFn"), exports);
|
|
14
|
+
tslib_1.__exportStar(require("./decorators/storeMerge"), exports);
|
|
15
|
+
tslib_1.__exportStar(require("./decorators/storeSet"), exports);
|
|
16
|
+
tslib_1.__exportStar(require("./decorators/writable"), exports);
|
|
17
|
+
tslib_1.__exportStar(require("./domain/AnyToPromise"), exports);
|
|
18
|
+
tslib_1.__exportStar(require("./domain/DecoratorTypes"), exports);
|
|
19
|
+
tslib_1.__exportStar(require("./domain/Env"), exports);
|
|
20
|
+
tslib_1.__exportStar(require("./domain/Hooks"), exports);
|
|
21
|
+
tslib_1.__exportStar(require("./domain/Metadata"), exports);
|
|
22
|
+
tslib_1.__exportStar(require("./domain/Store"), exports);
|
|
23
|
+
tslib_1.__exportStar(require("./domain/Type"), exports);
|
|
24
|
+
tslib_1.__exportStar(require("./errors/UnsupportedDecoratorType"), exports);
|
|
25
|
+
tslib_1.__exportStar(require("./interfaces/AnyDecorator"), exports);
|
|
26
|
+
tslib_1.__exportStar(require("./interfaces/DecoratorParameters"), exports);
|
|
27
|
+
tslib_1.__exportStar(require("./interfaces/HashOf"), exports);
|
|
28
|
+
tslib_1.__exportStar(require("./interfaces/MetadataTypes"), exports);
|
|
29
|
+
tslib_1.__exportStar(require("./interfaces/ValueOf"), exports);
|
|
30
|
+
tslib_1.__exportStar(require("./utils/catchError"), exports);
|
|
31
|
+
tslib_1.__exportStar(require("./utils/proxyDelegation"), exports);
|
|
32
|
+
tslib_1.__exportStar(require("./utils/uniq"), exports);
|
|
33
|
+
tslib_1.__exportStar(require("./utils/decorators/decorateMethodsOf"), exports);
|
|
34
|
+
tslib_1.__exportStar(require("./utils/decorators/decoratorArgs"), exports);
|
|
35
|
+
tslib_1.__exportStar(require("./utils/decorators/decoratorTypeOf"), exports);
|
|
36
|
+
tslib_1.__exportStar(require("./utils/decorators/inheritedDescriptorOf"), exports);
|
|
37
|
+
tslib_1.__exportStar(require("./utils/decorators/useDecorators"), exports);
|
|
38
|
+
tslib_1.__exportStar(require("./utils/decorators/useMethodDecorators"), exports);
|
|
39
|
+
tslib_1.__exportStar(require("./utils/http/getHostInfoFromPort"), exports);
|
|
40
|
+
tslib_1.__exportStar(require("./utils/imports/importPackage"), exports);
|
|
41
|
+
tslib_1.__exportStar(require("./utils/objects/ancestorOf"), exports);
|
|
42
|
+
tslib_1.__exportStar(require("./utils/objects/ancestorsOf"), exports);
|
|
43
|
+
tslib_1.__exportStar(require("./utils/objects/classOf"), exports);
|
|
44
|
+
tslib_1.__exportStar(require("./utils/objects/cleanObject"), exports);
|
|
45
|
+
tslib_1.__exportStar(require("./utils/objects/constructorOf"), exports);
|
|
46
|
+
tslib_1.__exportStar(require("./utils/objects/createInstance"), exports);
|
|
47
|
+
tslib_1.__exportStar(require("./utils/objects/deepClone"), exports);
|
|
48
|
+
tslib_1.__exportStar(require("./utils/objects/deepMerge"), exports);
|
|
49
|
+
tslib_1.__exportStar(require("./utils/objects/descriptorOf"), exports);
|
|
50
|
+
tslib_1.__exportStar(require("./utils/objects/getClassOrSymbol"), exports);
|
|
51
|
+
tslib_1.__exportStar(require("./utils/objects/getConstructorArgNames"), exports);
|
|
52
|
+
tslib_1.__exportStar(require("./utils/objects/getEnumerableKeys"), exports);
|
|
53
|
+
tslib_1.__exportStar(require("./utils/objects/getValue"), exports);
|
|
54
|
+
tslib_1.__exportStar(require("./utils/objects/isArray"), exports);
|
|
55
|
+
tslib_1.__exportStar(require("./utils/objects/isArrowFn"), exports);
|
|
56
|
+
tslib_1.__exportStar(require("./utils/objects/isBoolean"), exports);
|
|
57
|
+
tslib_1.__exportStar(require("./utils/objects/isBuffer"), exports);
|
|
58
|
+
tslib_1.__exportStar(require("./utils/objects/isClass"), exports);
|
|
59
|
+
tslib_1.__exportStar(require("./utils/objects/isCollection"), exports);
|
|
60
|
+
tslib_1.__exportStar(require("./utils/objects/isDate"), exports);
|
|
61
|
+
tslib_1.__exportStar(require("./utils/objects/isEmpty"), exports);
|
|
62
|
+
tslib_1.__exportStar(require("./utils/objects/isEnumerable"), exports);
|
|
63
|
+
tslib_1.__exportStar(require("./utils/objects/isFunction"), exports);
|
|
64
|
+
tslib_1.__exportStar(require("./utils/objects/isInheritedFrom"), exports);
|
|
65
|
+
tslib_1.__exportStar(require("./utils/objects/isNil"), exports);
|
|
66
|
+
tslib_1.__exportStar(require("./utils/objects/isNumber"), exports);
|
|
67
|
+
tslib_1.__exportStar(require("./utils/objects/isObject"), exports);
|
|
68
|
+
tslib_1.__exportStar(require("./utils/objects/isObservable"), exports);
|
|
69
|
+
tslib_1.__exportStar(require("./utils/objects/isPlainObject"), exports);
|
|
70
|
+
tslib_1.__exportStar(require("./utils/objects/isPrimitive"), exports);
|
|
71
|
+
tslib_1.__exportStar(require("./utils/objects/isPromise"), exports);
|
|
72
|
+
tslib_1.__exportStar(require("./utils/objects/isProtectedKey"), exports);
|
|
73
|
+
tslib_1.__exportStar(require("./utils/objects/isSerializable"), exports);
|
|
74
|
+
tslib_1.__exportStar(require("./utils/objects/isStream"), exports);
|
|
75
|
+
tslib_1.__exportStar(require("./utils/objects/isString"), exports);
|
|
76
|
+
tslib_1.__exportStar(require("./utils/objects/isSymbol"), exports);
|
|
77
|
+
tslib_1.__exportStar(require("./utils/objects/methodsOf"), exports);
|
|
78
|
+
tslib_1.__exportStar(require("./utils/objects/nameOf"), exports);
|
|
79
|
+
tslib_1.__exportStar(require("./utils/objects/objectKeys"), exports);
|
|
80
|
+
tslib_1.__exportStar(require("./utils/objects/primitiveOf"), exports);
|
|
81
|
+
tslib_1.__exportStar(require("./utils/objects/prototypeOf"), exports);
|
|
82
|
+
tslib_1.__exportStar(require("./utils/objects/setValue"), exports);
|
|
83
|
+
tslib_1.__exportStar(require("./utils/objects/toMap"), exports);
|
|
84
|
+
tslib_1.__exportStar(require("./utils/objects/toStringConstructor"), exports);
|
|
9
85
|
//# sourceMappingURL=index.js.map
|
package/lib/cjs/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"index.js","source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\n * @file Automatically generated by barrelsby.\n */\n\nexport * from \"./decorators/configurable\";\nexport * from \"./decorators/deprecated\";\nexport * from \"./decorators/enumerable\";\nexport * from \"./decorators/notConfigurable\";\nexport * from \"./decorators/notEnumerable\";\nexport * from \"./decorators/readOnly\";\nexport * from \"./decorators/storeFn\";\nexport * from \"./decorators/storeMerge\";\nexport * from \"./decorators/storeSet\";\nexport * from \"./decorators/writable\";\nexport * from \"./domain/AnyToPromise\";\nexport * from \"./domain/DecoratorTypes\";\nexport * from \"./domain/Env\";\nexport * from \"./domain/Hooks\";\nexport * from \"./domain/Metadata\";\nexport * from \"./domain/Store\";\nexport * from \"./domain/Type\";\nexport * from \"./errors/UnsupportedDecoratorType\";\nexport * from \"./interfaces/AnyDecorator\";\nexport * from \"./interfaces/DecoratorParameters\";\nexport * from \"./interfaces/HashOf\";\nexport * from \"./interfaces/MetadataTypes\";\nexport * from \"./interfaces/ValueOf\";\nexport * from \"./utils/catchError\";\nexport * from \"./utils/proxyDelegation\";\nexport * from \"./utils/uniq\";\nexport * from \"./utils/decorators/decorateMethodsOf\";\nexport * from \"./utils/decorators/decoratorArgs\";\nexport * from \"./utils/decorators/decoratorTypeOf\";\nexport * from \"./utils/decorators/inheritedDescriptorOf\";\nexport * from \"./utils/decorators/useDecorators\";\nexport * from \"./utils/decorators/useMethodDecorators\";\nexport * from \"./utils/http/getHostInfoFromPort\";\nexport * from \"./utils/imports/importPackage\";\nexport * from \"./utils/objects/ancestorOf\";\nexport * from \"./utils/objects/ancestorsOf\";\nexport * from \"./utils/objects/classOf\";\nexport * from \"./utils/objects/cleanObject\";\nexport * from \"./utils/objects/constructorOf\";\nexport * from \"./utils/objects/createInstance\";\nexport * from \"./utils/objects/deepClone\";\nexport * from \"./utils/objects/deepMerge\";\nexport * from \"./utils/objects/descriptorOf\";\nexport * from \"./utils/objects/getClassOrSymbol\";\nexport * from \"./utils/objects/getConstructorArgNames\";\nexport * from \"./utils/objects/getEnumerableKeys\";\nexport * from \"./utils/objects/getValue\";\nexport * from \"./utils/objects/isArray\";\nexport * from \"./utils/objects/isArrowFn\";\nexport * from \"./utils/objects/isBoolean\";\nexport * from \"./utils/objects/isBuffer\";\nexport * from \"./utils/objects/isClass\";\nexport * from \"./utils/objects/isCollection\";\nexport * from \"./utils/objects/isDate\";\nexport * from \"./utils/objects/isEmpty\";\nexport * from \"./utils/objects/isEnumerable\";\nexport * from \"./utils/objects/isFunction\";\nexport * from \"./utils/objects/isInheritedFrom\";\nexport * from \"./utils/objects/isNil\";\nexport * from \"./utils/objects/isNumber\";\nexport * from \"./utils/objects/isObject\";\nexport * from \"./utils/objects/isObservable\";\nexport * from \"./utils/objects/isPlainObject\";\nexport * from \"./utils/objects/isPrimitive\";\nexport * from \"./utils/objects/isPromise\";\nexport * from \"./utils/objects/isProtectedKey\";\nexport * from \"./utils/objects/isSerializable\";\nexport * from \"./utils/objects/isStream\";\nexport * from \"./utils/objects/isString\";\nexport * from \"./utils/objects/isSymbol\";\nexport * from \"./utils/objects/methodsOf\";\nexport * from \"./utils/objects/nameOf\";\nexport * from \"./utils/objects/objectKeys\";\nexport * from \"./utils/objects/primitiveOf\";\nexport * from \"./utils/objects/prototypeOf\";\nexport * from \"./utils/objects/setValue\";\nexport * from \"./utils/objects/toMap\";\nexport * from \"./utils/objects/toStringConstructor\";\n"]}
|
|
@@ -10,6 +10,7 @@ function decorateMethodsOf(klass, decorator) {
|
|
|
10
10
|
(0, methodsOf_1.methodsOf)(klass).forEach(({ target, propertyKey }) => {
|
|
11
11
|
if (target !== (0, classOf_1.classOf)(klass)) {
|
|
12
12
|
Object.defineProperty((0, prototypeOf_1.prototypeOf)(klass), propertyKey, {
|
|
13
|
+
writable: true,
|
|
13
14
|
value(...args) {
|
|
14
15
|
return (0, prototypeOf_1.prototypeOf)(target)[propertyKey].apply(this, args);
|
|
15
16
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"decorateMethodsOf.js","sourceRoot":"","sources":["../../../../src/utils/decorators/decorateMethodsOf.ts"],"names":[],"mappings":";;;AAAA,gDAA2C;AAC3C,oDAA+C;AAC/C,wDAAmD;AACnD,0DAAqD;AACrD,8CAAyC;AAEzC,SAAgB,iBAAiB,CAAC,KAAU,EAAE,SAAc;IAC1D,IAAA,qBAAS,EAAC,KAAK,CAAC,CAAC,OAAO,CAAC,CAAC,EAAC,MAAM,EAAE,WAAW,EAAC,EAAE,EAAE;QACjD,IAAI,MAAM,KAAK,IAAA,iBAAO,EAAC,KAAK,CAAC,EAAE;YAC7B,MAAM,CAAC,cAAc,CAAC,IAAA,yBAAW,EAAC,KAAK,CAAC,EAAE,WAAW,EAAE;gBACrD,KAAK,CAAC,GAAG,IAAW;oBAClB,OAAO,IAAA,yBAAW,EAAC,MAAM,CAAC,CAAC,WAAW,CAAC,CAAC,KAAK,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;gBAC5D,CAAC;aACF,CAAC,CAAC;YAEH,aAAK,CAAC,oBAAoB,CAAC,KAAK,EAAE,MAAM,EAAE,WAAW,CAAC,CAAC;SACxD;QAED,SAAS,CAAC,IAAA,yBAAW,EAAC,KAAK,CAAC,EAAE,WAAW,EAAE,IAAA,2BAAY,EAAC,KAAK,EAAE,WAAW,CAAC,CAAC,CAAC;IAC/E,CAAC,CAAC,CAAC;AACL,CAAC;
|
|
1
|
+
{"version":3,"file":"decorateMethodsOf.js","sourceRoot":"","sources":["../../../../src/utils/decorators/decorateMethodsOf.ts"],"names":[],"mappings":";;;AAAA,gDAA2C;AAC3C,oDAA+C;AAC/C,wDAAmD;AACnD,0DAAqD;AACrD,8CAAyC;AAEzC,SAAgB,iBAAiB,CAAC,KAAU,EAAE,SAAc;IAC1D,IAAA,qBAAS,EAAC,KAAK,CAAC,CAAC,OAAO,CAAC,CAAC,EAAC,MAAM,EAAE,WAAW,EAAC,EAAE,EAAE;QACjD,IAAI,MAAM,KAAK,IAAA,iBAAO,EAAC,KAAK,CAAC,EAAE;YAC7B,MAAM,CAAC,cAAc,CAAC,IAAA,yBAAW,EAAC,KAAK,CAAC,EAAE,WAAW,EAAE;gBACrD,QAAQ,EAAE,IAAI;gBACd,KAAK,CAAC,GAAG,IAAW;oBAClB,OAAO,IAAA,yBAAW,EAAC,MAAM,CAAC,CAAC,WAAW,CAAC,CAAC,KAAK,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;gBAC5D,CAAC;aACF,CAAC,CAAC;YAEH,aAAK,CAAC,oBAAoB,CAAC,KAAK,EAAE,MAAM,EAAE,WAAW,CAAC,CAAC;SACxD;QAED,SAAS,CAAC,IAAA,yBAAW,EAAC,KAAK,CAAC,EAAE,WAAW,EAAE,IAAA,2BAAY,EAAC,KAAK,EAAE,WAAW,CAAC,CAAC,CAAC;IAC/E,CAAC,CAAC,CAAC;AACL,CAAC;AAfD,8CAeC","sourcesContent":["import {classOf} from \"../objects/classOf\";\nimport {methodsOf} from \"../objects/methodsOf\";\nimport {prototypeOf} from \"../objects/prototypeOf\";\nimport {descriptorOf} from \"../objects/descriptorOf\";\nimport {Store} from \"../../domain/Store\";\n\nexport function decorateMethodsOf(klass: any, decorator: any) {\n methodsOf(klass).forEach(({target, propertyKey}) => {\n if (target !== classOf(klass)) {\n Object.defineProperty(prototypeOf(klass), propertyKey, {\n writable: true,\n value(...args: any[]) {\n return prototypeOf(target)[propertyKey].apply(this, args);\n }\n });\n\n Store.mergeStoreMethodFrom(klass, target, propertyKey);\n }\n\n decorator(prototypeOf(klass), propertyKey, descriptorOf(klass, propertyKey));\n });\n}\n"]}
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
3
|
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
5
9
|
}) : (function(o, m, k, k2) {
|
|
6
10
|
if (k2 === undefined) k2 = k;
|
|
7
11
|
o[k2] = m[k];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"importPackage.js","sourceRoot":"","sources":["../../../../src/utils/imports/importPackage.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"importPackage.js","sourceRoot":"","sources":["../../../../src/utils/imports/importPackage.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAO,KAAK,UAAU,aAAa,CAAC,WAAmB,EAAE,WAAqB,GAAG,EAAE,mDAAQ,WAAW,GAAC,EAAE,QAAQ,GAAG,KAAK;IACvH,IAAI;QACF,OAAO,MAAM,QAAQ,EAAE,CAAC;KACzB;IAAC,OAAO,CAAC,EAAE;QACV,IAAI,CAAC,QAAQ,EAAE;YACb,MAAM,CAAC,CAAC;SACT;QAED,OAAO,EAAE,CAAC;KACX;AACH,CAAC;AAVD,sCAUC","sourcesContent":["export async function importPackage(packageName: string, loaderFn: Function = () => import(packageName), optional = false) {\n try {\n return await loaderFn();\n } catch (e) {\n if (!optional) {\n throw e;\n }\n\n return {};\n }\n}\n"]}
|
|
@@ -7,6 +7,7 @@ const isFunction_1 = require("./isFunction");
|
|
|
7
7
|
const isNil_1 = require("./isNil");
|
|
8
8
|
const isPrimitive_1 = require("./isPrimitive");
|
|
9
9
|
const isSymbol_1 = require("./isSymbol");
|
|
10
|
+
const isBuffer_1 = require("./isBuffer");
|
|
10
11
|
const isBasicType = (source) => (0, isNil_1.isNil)(source) || (0, isPrimitive_1.isPrimitive)(source) || (0, isSymbol_1.isSymbol)(source) || (0, isFunction_1.isFunction)(source);
|
|
11
12
|
/**
|
|
12
13
|
* Return a cloned value
|
|
@@ -18,6 +19,11 @@ function deepClone(source, stack = new WeakMap()) {
|
|
|
18
19
|
if (isBasicType(source)) {
|
|
19
20
|
return source;
|
|
20
21
|
}
|
|
22
|
+
if ((0, isBuffer_1.isBuffer)(source)) {
|
|
23
|
+
const copy = Buffer.alloc(source.length);
|
|
24
|
+
source.copy(copy);
|
|
25
|
+
return copy;
|
|
26
|
+
}
|
|
21
27
|
if ((0, isDate_1.isDate)(source)) {
|
|
22
28
|
return new Date(source);
|
|
23
29
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deepClone.js","sourceRoot":"","sources":["../../../../src/utils/objects/deepClone.ts"],"names":[],"mappings":";;;AAAA,uCAAkC;AAClC,qCAAgC;AAChC,6CAAwC;AACxC,mCAA8B;AAC9B,+CAA0C;AAC1C,yCAAoC;AAEpC,MAAM,WAAW,GAAG,CAAC,MAAW,EAAE,EAAE,CAAC,IAAA,aAAK,EAAC,MAAM,CAAC,IAAI,IAAA,yBAAW,EAAC,MAAM,CAAC,IAAI,IAAA,mBAAQ,EAAC,MAAM,CAAC,IAAI,IAAA,uBAAU,EAAC,MAAM,CAAC,CAAC;AAEpH;;;;GAIG;AACH,SAAgB,SAAS,CAAC,MAAW,EAAE,KAAK,GAAG,IAAI,OAAO,EAAE;IAC1D,IAAI,IAAS,CAAC;IAEd,IAAI,WAAW,CAAC,MAAM,CAAC,EAAE;QACvB,OAAO,MAAM,CAAC;KACf;IAED,IAAI,IAAA,eAAM,EAAC,MAAM,CAAC,EAAE;QAClB,OAAO,IAAI,IAAI,CAAC,MAAM,CAAC,CAAC;KACzB;IAED,MAAM,OAAO,GAAG,KAAK,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;IAElC,IAAI,OAAO,EAAE;QACX,kBAAkB;QAClB,uBAAuB;QACvB,OAAO,CAAC,GAAG,CAAC,uBAAuB,IAAI,OAAO,CAAC,KAAK,CAAC,oCAAoC,EAAE,OAAO,CAAC,CAAC;QACpG,OAAO,OAAO,CAAC;KAChB;IAED,IAAI,IAAA,iBAAO,EAAC,MAAM,CAAC,EAAE;QACnB,IAAI,GAAG,E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AAC,CAAC;aAC9C;SACF;KACF;IAED,IAAI,CAAC,IAAA,iBAAO,EAAC,MAAM,CAAC,EAAE;QACpB,MAAM,SAAS,GAAG,OAAO,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC;QACjD,OAAO,CAAC,cAAc,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC;KACzC;IAED,OAAO,IAAI,CAAC;AACd,CAAC;AApDD,8BAoDC","sourcesContent":["import {isArray} from \"./isArray\";\nimport {isDate} from \"./isDate\";\nimport {isFunction} from \"./isFunction\";\nimport {isNil} from \"./isNil\";\nimport {isPrimitive} from \"./isPrimitive\";\nimport {isSymbol} from \"./isSymbol\";\nimport {isBuffer} from \"./isBuffer\";\n\nconst isBasicType = (source: any) => isNil(source) || isPrimitive(source) || isSymbol(source) || isFunction(source);\n\n/**\n * Return a cloned value\n * @param source\n * @param stack\n */\nexport function deepClone(source: any, stack = new WeakMap()): any {\n let dest: any;\n\n if (isBasicType(source)) {\n return source;\n }\n\n if (isBuffer(source)) {\n const copy = Buffer.alloc(source.length);\n source.copy(copy);\n return copy;\n }\n\n if (isDate(source)) {\n return new Date(source);\n }\n\n const stacked = stack.get(source);\n\n if (stacked) {\n // See issue #1619\n // istanbul ignore next\n process.env.TSED_TRACK_CIRCULAR_REF && console.trace(\"Circular ref detected on deepClone\", stacked);\n return stacked;\n }\n\n if (isArray(source)) {\n dest = [];\n } else {\n dest = {};\n stack.set(source, dest);\n }\n\n for (const key in source) {\n // Use getOwnPropertyDescriptor instead of source[key] to prevent from triggering setter/getter.\n const descriptor = Object.getOwnPropertyDescriptor(source, key)!;\n\n if (descriptor) {\n if (!isFunction(descriptor.value)) {\n dest[key] = deepClone(descriptor.value, stack);\n } else {\n Object.defineProperty(dest, key, descriptor);\n }\n }\n }\n\n if (!isArray(source)) {\n const prototype = Reflect.getPrototypeOf(source);\n Reflect.setPrototypeOf(dest, prototype);\n }\n\n return dest;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{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,KAAK,GAAG,SAAS,CAAC,GAAG,EAAE,GAAG,IAAI,GAAG,CAAC,GAAG,CAAC,EAAE;YAC5C,GAAG,OAAO;YACV,SAAS,EAAE,GAAG;SACf,CAAC,CAAC;QAEH,IAAI,OAAO,CAAC,mBAAmB,IAAI,KAAK,KAAK,SAAS,EAAE;YACtD,OAAO,GAAG,CAAC;SACZ;QAED,OAAO;YACL,GAAG,GAAG;YACN,CAAC,GAAG,CAAC,EAAE,KAAK;SACb,CAAC;IACJ,CAAC,EAAE,IAAA,+BAAc,EAAC,MAAM,CAAC,CAAC,CAAC;AAC7B,CAAC;AA/BD,8BA+BC","sourcesContent":["import {createInstance} from \"./createInstance\";\nimport {isFunction} from \"./isFunction\";\nimport {isPrimitive} from \"./isPrimitive\";\nimport {isSymbol} from \"./isSymbol\";\nimport {objectKeys} from \"./objectKeys\";\n\nexport type DeepMergeReducerCB = (collection: any[], value: any, options?: DeepMergeOptions) => any;\nexport type DeepMergeComparatorCB = (item: any, ref: any) => boolean;\n\nexport interface DeepMergeOptions {\n reducers?: Record<string, DeepMergeReducerCB>;\n parentKey?: string;\n cleanUndefinedProps?: boolean;\n}\n\nexport function mergeReducerBuilder(cb: DeepMergeComparatorCB) {\n return (collection: any[], value: any, options: DeepMergeOptions) => {\n const index = collection.findIndex((item) => cb(item, value));\n\n if (index === -1) {\n return [...collection, value];\n }\n\n collection[index] = deepMerge(collection[index], value, options);\n\n return collection;\n };\n}\n\nconst defaultReducer = mergeReducerBuilder((a, b) => a === b);\n\nfunction getReducer({reducers, parentKey}: DeepMergeOptions) {\n if (!reducers) {\n return defaultReducer;\n }\n\n if (parentKey && reducers[parentKey]) {\n return reducers[parentKey];\n }\n\n return reducers[\"default\"] || defaultReducer;\n}\n\nfunction shouldReturnObj(obj: any, source: any) {\n return isPrimitive(obj) || isSymbol(obj) || isFunction(obj) || source === undefined;\n}\n\nfunction shouldReturnSource(obj: any, source: any) {\n return obj === undefined || obj === null || (obj === \"\" && source !== \"\");\n}\n\nexport function deepMerge<T = any, C = any>(source: T & any, obj: C & any, options: DeepMergeOptions = {}): (T & C) | undefined | null {\n if (shouldReturnSource(obj, source)) {\n return source as any;\n }\n\n if (shouldReturnObj(obj, source)) {\n return obj;\n }\n\n if (Array.isArray(source)) {\n const reducer = getReducer(options);\n\n return [].concat(obj).reduce((out: any[], value: any) => reducer(out, value, options), [...source]);\n }\n\n return [...objectKeys(source), ...objectKeys(obj)].reduce((out: any, key: string) => {\n const src = source && source[key];\n const value = deepMerge(src, obj && obj[key], {\n ...options,\n parentKey: key\n });\n\n if (options.cleanUndefinedProps && value === undefined) {\n return out;\n }\n\n return {\n ...out,\n [key]: value\n };\n }, createInstance(source));\n}\n"]}
|
|
@@ -3,7 +3,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.getConstructorArgNames = void 0;
|
|
4
4
|
const toStringConstructor_1 = require("./toStringConstructor");
|
|
5
5
|
function getConstructorArgNames(target) {
|
|
6
|
-
return (0, toStringConstructor_1.toStringConstructor)(target)
|
|
6
|
+
return (0, toStringConstructor_1.toStringConstructor)(target)
|
|
7
|
+
.split("constructor(")[1]
|
|
8
|
+
.split(")")[0]
|
|
9
|
+
.split(", ")
|
|
10
|
+
.filter(Boolean)
|
|
11
|
+
.map((s) => s.trim());
|
|
7
12
|
}
|
|
8
13
|
exports.getConstructorArgNames = getConstructorArgNames;
|
|
9
14
|
//# sourceMappingURL=getConstructorArgNames.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getConstructorArgNames.js","sourceRoot":"","sources":["../../../../src/utils/objects/getConstructorArgNames.ts"],"names":[],"mappings":";;;AAAA,+DAA0D;AAE1D,SAAgB,sBAAsB,CAAC,MAAW;IAChD,OAAO,IAAA,yCAAmB,EAAC,MAAM,CAAC,
|
|
1
|
+
{"version":3,"file":"getConstructorArgNames.js","sourceRoot":"","sources":["../../../../src/utils/objects/getConstructorArgNames.ts"],"names":[],"mappings":";;;AAAA,+DAA0D;AAE1D,SAAgB,sBAAsB,CAAC,MAAW;IAChD,OAAO,IAAA,yCAAmB,EAAC,MAAM,CAAC;SAC/B,KAAK,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC;SACxB,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;SACb,KAAK,CAAC,IAAI,CAAC;SACX,MAAM,CAAC,OAAO,CAAC;SACf,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC;AAC1B,CAAC;AAPD,wDAOC","sourcesContent":["import {toStringConstructor} from \"./toStringConstructor\";\n\nexport function getConstructorArgNames(target: any) {\n return toStringConstructor(target)\n .split(\"constructor(\")[1]\n .split(\")\")[0]\n .split(\", \")\n .filter(Boolean)\n .map((s) => s.trim());\n}\n"]}
|
|
@@ -34,7 +34,7 @@ function getValue(...args) {
|
|
|
34
34
|
const keys = expression.split(separator);
|
|
35
35
|
const getValue = (key) => {
|
|
36
36
|
if (scope) {
|
|
37
|
-
if (scope[key] !== undefined || key in scope) {
|
|
37
|
+
if (scope[key] !== undefined || ((0, isObject_1.isObject)(scope) && key in scope)) {
|
|
38
38
|
return scope[key];
|
|
39
39
|
}
|
|
40
40
|
if ((0, isFunction_1.isFunction)(scope.get)) {
|