@carno.js/core 0.2.11 → 1.0.2
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/LICENSE +673 -673
- package/README.md +188 -0
- package/dist/Carno.js +272 -333
- package/dist/Carno.mjs +268 -0
- package/dist/DefaultRoutes.js +51 -0
- package/dist/DefaultRoutes.mjs +34 -0
- package/dist/bun/index.js +183 -0
- package/dist/bun/index.js.map +86 -0
- package/dist/cache/CacheDriver.js +13 -0
- package/dist/cache/CacheDriver.mjs +0 -0
- package/dist/cache/CacheService.js +113 -0
- package/dist/cache/CacheService.mjs +93 -0
- package/dist/cache/MemoryDriver.js +66 -0
- package/dist/cache/MemoryDriver.mjs +46 -0
- package/dist/cache/RedisDriver.js +81 -0
- package/dist/cache/RedisDriver.mjs +61 -0
- package/dist/compiler/JITCompiler.js +111 -0
- package/dist/compiler/JITCompiler.mjs +89 -0
- package/dist/container/Container.js +99 -0
- package/dist/container/Container.mjs +78 -0
- package/dist/context/Context.js +97 -0
- package/dist/context/Context.mjs +77 -0
- package/dist/cors/CorsHandler.js +90 -0
- package/dist/cors/CorsHandler.mjs +68 -0
- package/dist/decorators/Controller.js +42 -0
- package/dist/decorators/Controller.mjs +22 -0
- package/dist/decorators/Inject.js +30 -0
- package/dist/decorators/Inject.mjs +10 -0
- package/dist/decorators/Middleware.js +35 -0
- package/dist/decorators/Middleware.mjs +15 -0
- package/dist/decorators/Service.js +31 -0
- package/dist/decorators/Service.mjs +12 -0
- package/dist/decorators/methods.js +60 -0
- package/dist/decorators/methods.mjs +34 -0
- package/dist/decorators/params.js +63 -0
- package/dist/decorators/params.mjs +37 -0
- package/dist/events/Lifecycle.js +69 -0
- package/dist/events/Lifecycle.mjs +41 -0
- package/dist/exceptions/HttpException.js +112 -26
- package/dist/exceptions/HttpException.mjs +82 -0
- package/dist/index.js +129 -31
- package/dist/index.mjs +94 -0
- package/dist/metadata.js +34 -0
- package/dist/metadata.mjs +9 -0
- package/dist/middleware/CarnoMiddleware.js +13 -0
- package/dist/middleware/CarnoMiddleware.mjs +0 -0
- package/dist/router/RadixRouter.js +121 -0
- package/dist/router/RadixRouter.mjs +101 -0
- package/dist/testing/TestHarness.js +81 -0
- package/dist/testing/TestHarness.mjs +60 -0
- package/dist/utils/Metadata.js +53 -0
- package/dist/utils/Metadata.mjs +31 -0
- package/dist/validation/ValibotAdapter.js +67 -0
- package/dist/validation/ValibotAdapter.mjs +48 -0
- package/dist/validation/ValidatorAdapter.js +35 -19
- package/dist/validation/ValidatorAdapter.mjs +14 -0
- package/dist/validation/ZodAdapter.js +80 -0
- package/dist/validation/ZodAdapter.mjs +59 -0
- package/package.json +21 -63
- package/src/Carno.ts +605 -0
- package/src/DefaultRoutes.ts +34 -0
- package/src/cache/CacheDriver.ts +50 -0
- package/src/cache/CacheService.ts +139 -0
- package/src/cache/MemoryDriver.ts +104 -0
- package/src/cache/RedisDriver.ts +116 -0
- package/src/compiler/JITCompiler.ts +167 -0
- package/src/container/Container.ts +168 -0
- package/src/context/Context.ts +128 -0
- package/src/cors/CorsHandler.ts +145 -0
- package/src/decorators/Controller.ts +63 -0
- package/src/decorators/Inject.ts +16 -0
- package/src/decorators/Middleware.ts +22 -0
- package/src/decorators/Service.ts +18 -0
- package/src/decorators/methods.ts +58 -0
- package/src/decorators/params.ts +47 -0
- package/src/events/Lifecycle.ts +97 -0
- package/src/exceptions/HttpException.ts +99 -0
- package/src/index.ts +92 -0
- package/src/metadata.ts +46 -0
- package/src/middleware/CarnoMiddleware.ts +14 -0
- package/src/router/RadixRouter.ts +225 -0
- package/src/testing/TestHarness.ts +177 -0
- package/src/utils/Metadata.ts +43 -0
- package/src/validation/ValibotAdapter.ts +95 -0
- package/src/validation/ValidatorAdapter.ts +69 -0
- package/src/validation/ZodAdapter.ts +102 -0
- package/dist/Carno.d.ts +0 -75
- package/dist/cache/bento-cache.driver.d.ts +0 -13
- package/dist/cache/bento-cache.driver.js +0 -55
- package/dist/cache/cache.service.d.ts +0 -8
- package/dist/cache/cache.service.js +0 -6
- package/dist/commons/decorators/Injectable.decorator.d.ts +0 -20
- package/dist/commons/decorators/Injectable.decorator.js +0 -33
- package/dist/commons/decorators/controller.decorator.d.ts +0 -8
- package/dist/commons/decorators/controller.decorator.js +0 -22
- package/dist/commons/decorators/http.decorators.d.ts +0 -13
- package/dist/commons/decorators/http.decorators.js +0 -63
- package/dist/commons/decorators/index.d.ts +0 -6
- package/dist/commons/decorators/index.js +0 -22
- package/dist/commons/decorators/inject.decorator.d.ts +0 -1
- package/dist/commons/decorators/inject.decorator.js +0 -5
- package/dist/commons/decorators/middleware.decorator.d.ts +0 -2
- package/dist/commons/decorators/middleware.decorator.js +0 -30
- package/dist/commons/decorators/service.decorator.d.ts +0 -2
- package/dist/commons/decorators/service.decorator.js +0 -7
- package/dist/commons/decorators/validation.decorator.d.ts +0 -32
- package/dist/commons/decorators/validation.decorator.js +0 -40
- package/dist/commons/http-code.enum.d.ts +0 -50
- package/dist/commons/http-code.enum.js +0 -54
- package/dist/commons/index.d.ts +0 -3
- package/dist/commons/index.js +0 -19
- package/dist/commons/registries/ProviderControl.d.ts +0 -77
- package/dist/commons/registries/ProviderControl.js +0 -112
- package/dist/commons/registries/ProviderRegistry.d.ts +0 -7
- package/dist/commons/registries/ProviderRegistry.js +0 -20
- package/dist/constants.d.ts +0 -8
- package/dist/constants.js +0 -11
- package/dist/container/ContainerConfiguration.d.ts +0 -45
- package/dist/container/ContainerConfiguration.js +0 -121
- package/dist/container/DependencyResolver.d.ts +0 -20
- package/dist/container/DependencyResolver.js +0 -85
- package/dist/container/InjectorService.d.ts +0 -58
- package/dist/container/InjectorService.js +0 -286
- package/dist/container/MethodInvoker.d.ts +0 -21
- package/dist/container/MethodInvoker.js +0 -83
- package/dist/container/RouteResolver.d.ts +0 -27
- package/dist/container/RouteResolver.js +0 -173
- package/dist/container/container.d.ts +0 -41
- package/dist/container/container.js +0 -71
- package/dist/container/createContainer.d.ts +0 -3
- package/dist/container/createContainer.js +0 -12
- package/dist/container/createInjector.d.ts +0 -2
- package/dist/container/createInjector.js +0 -7
- package/dist/container/index.d.ts +0 -6
- package/dist/container/index.js +0 -22
- package/dist/container/middleware.resolver.d.ts +0 -9
- package/dist/container/middleware.resolver.js +0 -35
- package/dist/default-routes-carno.d.ts +0 -3
- package/dist/default-routes-carno.js +0 -29
- package/dist/domain/BaseContext.d.ts +0 -15
- package/dist/domain/BaseContext.js +0 -2
- package/dist/domain/CarnoClosure.d.ts +0 -1
- package/dist/domain/CarnoClosure.js +0 -2
- package/dist/domain/CarnoMiddleware.d.ts +0 -5
- package/dist/domain/CarnoMiddleware.js +0 -2
- package/dist/domain/Context.d.ts +0 -58
- package/dist/domain/Context.js +0 -188
- package/dist/domain/FastContext.d.ts +0 -34
- package/dist/domain/FastContext.js +0 -59
- package/dist/domain/LocalsContainer.d.ts +0 -4
- package/dist/domain/LocalsContainer.js +0 -10
- package/dist/domain/Metadata.d.ts +0 -449
- package/dist/domain/Metadata.js +0 -511
- package/dist/domain/cors-config.d.ts +0 -12
- package/dist/domain/cors-config.js +0 -18
- package/dist/domain/cors-headers-cache.d.ts +0 -17
- package/dist/domain/cors-headers-cache.js +0 -101
- package/dist/domain/http-method.d.ts +0 -7
- package/dist/domain/http-method.js +0 -11
- package/dist/domain/index.d.ts +0 -10
- package/dist/domain/index.js +0 -26
- package/dist/domain/provider-scope.d.ts +0 -5
- package/dist/domain/provider-scope.js +0 -9
- package/dist/domain/provider-type.d.ts +0 -6
- package/dist/domain/provider-type.js +0 -10
- package/dist/domain/provider.d.ts +0 -37
- package/dist/domain/provider.js +0 -70
- package/dist/events/hooks.decorator.d.ts +0 -3
- package/dist/events/hooks.decorator.js +0 -29
- package/dist/events/index.d.ts +0 -2
- package/dist/events/index.js +0 -18
- package/dist/events/on-event.d.ts +0 -13
- package/dist/events/on-event.js +0 -11
- package/dist/exceptions/HttpException.d.ts +0 -9
- package/dist/exceptions/index.d.ts +0 -1
- package/dist/exceptions/index.js +0 -17
- package/dist/index.d.ts +0 -16
- package/dist/route/CompiledRoute.d.ts +0 -23
- package/dist/route/CompiledRoute.js +0 -9
- package/dist/route/FastPathExecutor.d.ts +0 -12
- package/dist/route/FastPathExecutor.js +0 -50
- package/dist/route/JITCompiler.d.ts +0 -28
- package/dist/route/JITCompiler.js +0 -245
- package/dist/route/Matcher.d.ts +0 -11
- package/dist/route/Matcher.js +0 -48
- package/dist/route/ParamResolverFactory.d.ts +0 -14
- package/dist/route/ParamResolverFactory.js +0 -49
- package/dist/route/RouteCompiler.d.ts +0 -28
- package/dist/route/RouteCompiler.js +0 -157
- package/dist/route/RouteExecutor.d.ts +0 -12
- package/dist/route/RouteExecutor.js +0 -84
- package/dist/route/memoirist.d.ts +0 -31
- package/dist/route/memoirist.js +0 -373
- package/dist/services/logger.service.d.ts +0 -23
- package/dist/services/logger.service.js +0 -47
- package/dist/testing/core-testing.d.ts +0 -24
- package/dist/testing/core-testing.js +0 -102
- package/dist/testing/index.d.ts +0 -1
- package/dist/testing/index.js +0 -17
- package/dist/utils/ValidationCache.d.ts +0 -5
- package/dist/utils/ValidationCache.js +0 -35
- package/dist/utils/ancestorOf.d.ts +0 -2
- package/dist/utils/ancestorOf.js +0 -10
- package/dist/utils/ancestorsOf.d.ts +0 -6
- package/dist/utils/ancestorsOf.js +0 -20
- package/dist/utils/classOf.d.ts +0 -13
- package/dist/utils/classOf.js +0 -21
- package/dist/utils/cleanObject.d.ts +0 -6
- package/dist/utils/cleanObject.js +0 -22
- package/dist/utils/constructorOf.d.ts +0 -11
- package/dist/utils/constructorOf.js +0 -18
- package/dist/utils/createInstance.d.ts +0 -1
- package/dist/utils/createInstance.js +0 -7
- package/dist/utils/decoratorTypeOf.d.ts +0 -11
- package/dist/utils/decoratorTypeOf.js +0 -32
- package/dist/utils/deepClone.d.ts +0 -6
- package/dist/utils/deepClone.js +0 -63
- package/dist/utils/deepMerge.d.ts +0 -9
- package/dist/utils/deepMerge.js +0 -62
- package/dist/utils/descriptorOf.d.ts +0 -8
- package/dist/utils/descriptorOf.js +0 -16
- package/dist/utils/formatValidationErrors.d.ts +0 -5
- package/dist/utils/formatValidationErrors.js +0 -80
- package/dist/utils/getClassOrSymbol.d.ts +0 -1
- package/dist/utils/getClassOrSymbol.js +0 -8
- package/dist/utils/getConstructorArgNames.d.ts +0 -1
- package/dist/utils/getConstructorArgNames.js +0 -12
- package/dist/utils/getMethodArgTypes.d.ts +0 -1
- package/dist/utils/getMethodArgTypes.js +0 -9
- package/dist/utils/getValue.d.ts +0 -32
- package/dist/utils/getValue.js +0 -47
- package/dist/utils/hasJsonMethod.d.ts +0 -1
- package/dist/utils/hasJsonMethod.js +0 -6
- package/dist/utils/index.d.ts +0 -15
- package/dist/utils/index.js +0 -31
- package/dist/utils/isArray.d.ts +0 -13
- package/dist/utils/isArray.js +0 -21
- package/dist/utils/isArrowFn.d.ts +0 -1
- package/dist/utils/isArrowFn.js +0 -7
- package/dist/utils/isBoolean.d.ts +0 -7
- package/dist/utils/isBoolean.js +0 -15
- package/dist/utils/isBuffer.d.ts +0 -7
- package/dist/utils/isBuffer.js +0 -19
- package/dist/utils/isClass.d.ts +0 -1
- package/dist/utils/isClass.js +0 -26
- package/dist/utils/isCollection.d.ts +0 -6
- package/dist/utils/isCollection.js +0 -20
- package/dist/utils/isDate.d.ts +0 -6
- package/dist/utils/isDate.js +0 -11
- package/dist/utils/isEmpty.d.ts +0 -6
- package/dist/utils/isEmpty.js +0 -12
- package/dist/utils/isFunction.d.ts +0 -1
- package/dist/utils/isFunction.js +0 -6
- package/dist/utils/isInheritedFrom.d.ts +0 -1
- package/dist/utils/isInheritedFrom.js +0 -24
- package/dist/utils/isMomentObject.d.ts +0 -1
- package/dist/utils/isMomentObject.js +0 -6
- package/dist/utils/isMongooseObject.d.ts +0 -2
- package/dist/utils/isMongooseObject.js +0 -11
- package/dist/utils/isNil.d.ts +0 -1
- package/dist/utils/isNil.js +0 -6
- package/dist/utils/isNumber.d.ts +0 -7
- package/dist/utils/isNumber.js +0 -15
- package/dist/utils/isObject.d.ts +0 -1
- package/dist/utils/isObject.js +0 -6
- package/dist/utils/isObservable.d.ts +0 -1
- package/dist/utils/isObservable.js +0 -6
- package/dist/utils/isPlainObject.d.ts +0 -7
- package/dist/utils/isPlainObject.js +0 -16
- package/dist/utils/isPrimitive.d.ts +0 -14
- package/dist/utils/isPrimitive.js +0 -28
- package/dist/utils/isPrimitiveType.d.ts +0 -1
- package/dist/utils/isPrimitiveType.js +0 -11
- package/dist/utils/isPromise.d.ts +0 -7
- package/dist/utils/isPromise.js +0 -14
- package/dist/utils/isProtectedKey.d.ts +0 -5
- package/dist/utils/isProtectedKey.js +0 -10
- package/dist/utils/isRegExp.d.ts +0 -1
- package/dist/utils/isRegExp.js +0 -6
- package/dist/utils/isRequestScope.d.ts +0 -11
- package/dist/utils/isRequestScope.js +0 -23
- package/dist/utils/isSerializable.d.ts +0 -1
- package/dist/utils/isSerializable.js +0 -11
- package/dist/utils/isStream.d.ts +0 -1
- package/dist/utils/isStream.js +0 -6
- package/dist/utils/isString.d.ts +0 -6
- package/dist/utils/isString.js +0 -14
- package/dist/utils/isSymbol.d.ts +0 -6
- package/dist/utils/isSymbol.js +0 -14
- package/dist/utils/methodsOf.d.ts +0 -9
- package/dist/utils/methodsOf.js +0 -24
- package/dist/utils/nameOf.d.ts +0 -14
- package/dist/utils/nameOf.js +0 -31
- package/dist/utils/objectKeys.d.ts +0 -1
- package/dist/utils/objectKeys.js +0 -7
- package/dist/utils/primitiveOf.d.ts +0 -1
- package/dist/utils/primitiveOf.js +0 -18
- package/dist/utils/prototypeOf.d.ts +0 -6
- package/dist/utils/prototypeOf.js +0 -12
- package/dist/utils/setValue.d.ts +0 -1
- package/dist/utils/setValue.js +0 -32
- package/dist/utils/toMap.d.ts +0 -3
- package/dist/utils/toMap.js +0 -34
- package/dist/utils/toStringConstructor.d.ts +0 -1
- package/dist/utils/toStringConstructor.js +0 -10
- package/dist/validation/ValidatorAdapter.d.ts +0 -66
- package/dist/validation/adapters/ClassValidatorAdapter.d.ts +0 -23
- package/dist/validation/adapters/ClassValidatorAdapter.js +0 -47
- package/dist/validation/adapters/ZodAdapter.d.ts +0 -14
- package/dist/validation/adapters/ZodAdapter.js +0 -56
- package/dist/validation/adapters/index.d.ts +0 -4
- package/dist/validation/adapters/index.js +0 -7
- package/dist/validation/index.d.ts +0 -3
- package/dist/validation/index.js +0 -20
package/dist/utils/isBuffer.d.ts
DELETED
package/dist/utils/isBuffer.js
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.isBuffer = isBuffer;
|
|
4
|
-
exports.isUint8Array = isUint8Array;
|
|
5
|
-
/**
|
|
6
|
-
* Tests to see if the object is Buffer
|
|
7
|
-
* @param target
|
|
8
|
-
* @returns {boolean}
|
|
9
|
-
*/
|
|
10
|
-
function isBuffer(target) {
|
|
11
|
-
// is Class
|
|
12
|
-
if (target && "isBuffer" in target && typeof target.isBuffer === "function") {
|
|
13
|
-
return true;
|
|
14
|
-
}
|
|
15
|
-
return isUint8Array(target);
|
|
16
|
-
}
|
|
17
|
-
function isUint8Array(target) {
|
|
18
|
-
return !!(target && (target === Uint8Array || target instanceof Uint8Array));
|
|
19
|
-
}
|
package/dist/utils/isClass.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function isClass(target: any): boolean;
|
package/dist/utils/isClass.js
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.isClass = isClass;
|
|
4
|
-
const isArray_1 = require("./isArray");
|
|
5
|
-
const isArrowFn_1 = require("./isArrowFn");
|
|
6
|
-
const isBuffer_1 = require("./isBuffer");
|
|
7
|
-
const isDate_1 = require("./isDate");
|
|
8
|
-
const isPlainObject_1 = require("./isPlainObject");
|
|
9
|
-
const isPrimitive_1 = require("./isPrimitive");
|
|
10
|
-
const isPromise_1 = require("./isPromise");
|
|
11
|
-
const isSymbol_1 = require("./isSymbol");
|
|
12
|
-
function isClass(target) {
|
|
13
|
-
if (!target) {
|
|
14
|
-
return false;
|
|
15
|
-
}
|
|
16
|
-
if ((0, isArrowFn_1.isArrowFn)(target)) {
|
|
17
|
-
return false;
|
|
18
|
-
}
|
|
19
|
-
return !((0, isSymbol_1.isSymbol)(target) ||
|
|
20
|
-
(0, isPrimitive_1.isPrimitiveOrPrimitiveClass)(target) ||
|
|
21
|
-
(0, isPlainObject_1.isClassObject)(target) ||
|
|
22
|
-
(0, isDate_1.isDate)(target) ||
|
|
23
|
-
(0, isPromise_1.isPromise)(target) ||
|
|
24
|
-
(0, isArray_1.isArrayOrArrayClass)(target) ||
|
|
25
|
-
(0, isBuffer_1.isBuffer)(target));
|
|
26
|
-
}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.isCollection = isCollection;
|
|
4
|
-
const isArray_1 = require("./isArray");
|
|
5
|
-
/**
|
|
6
|
-
* Return true if the target.
|
|
7
|
-
* @param target
|
|
8
|
-
* @returns {boolean}
|
|
9
|
-
*/
|
|
10
|
-
function isCollection(target) {
|
|
11
|
-
return ((0, isArray_1.isArrayOrArrayClass)(target) ||
|
|
12
|
-
target === Map ||
|
|
13
|
-
target instanceof Map ||
|
|
14
|
-
target === Set ||
|
|
15
|
-
target instanceof Set ||
|
|
16
|
-
target === WeakMap ||
|
|
17
|
-
target instanceof WeakMap ||
|
|
18
|
-
target === WeakSet ||
|
|
19
|
-
target instanceof WeakSet);
|
|
20
|
-
}
|
package/dist/utils/isDate.d.ts
DELETED
package/dist/utils/isDate.js
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.isDate = isDate;
|
|
4
|
-
/**
|
|
5
|
-
*
|
|
6
|
-
* @param target
|
|
7
|
-
* @returns {boolean}
|
|
8
|
-
*/
|
|
9
|
-
function isDate(target) {
|
|
10
|
-
return target === Date || (target instanceof Date && !isNaN(+target));
|
|
11
|
-
}
|
package/dist/utils/isEmpty.d.ts
DELETED
package/dist/utils/isEmpty.js
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.isEmpty = isEmpty;
|
|
4
|
-
const isNil_1 = require("./isNil");
|
|
5
|
-
/**
|
|
6
|
-
* Return true if the value is an empty string, null or undefined.
|
|
7
|
-
* @param value
|
|
8
|
-
* @returns {boolean}
|
|
9
|
-
*/
|
|
10
|
-
function isEmpty(value) {
|
|
11
|
-
return value === "" || (0, isNil_1.isNil)(value);
|
|
12
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function isFunction(target: any): target is Function;
|
package/dist/utils/isFunction.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function isInheritedFrom(target: any, from: any, deep?: number): boolean;
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.isInheritedFrom = isInheritedFrom;
|
|
4
|
-
const classOf_1 = require("./classOf");
|
|
5
|
-
const ancestorOf_1 = require("./ancestorOf");
|
|
6
|
-
const nameOf_1 = require("./nameOf");
|
|
7
|
-
function isInheritedFrom(target, from, deep = 5) {
|
|
8
|
-
if (!target || !from) {
|
|
9
|
-
return false;
|
|
10
|
-
}
|
|
11
|
-
target = (0, classOf_1.classOf)(target);
|
|
12
|
-
from = (0, classOf_1.classOf)(from);
|
|
13
|
-
while ((0, nameOf_1.nameOf)(target) !== "") {
|
|
14
|
-
if (!deep) {
|
|
15
|
-
return false;
|
|
16
|
-
}
|
|
17
|
-
if (target === from) {
|
|
18
|
-
return true;
|
|
19
|
-
}
|
|
20
|
-
target = (0, ancestorOf_1.ancestorOf)(target);
|
|
21
|
-
deep--;
|
|
22
|
-
}
|
|
23
|
-
return false;
|
|
24
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function isMomentObject(obj: any): boolean;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.isObjectID = isObjectID;
|
|
4
|
-
exports.isMongooseObject = isMongooseObject;
|
|
5
|
-
const hasJsonMethod_1 = require("./hasJsonMethod");
|
|
6
|
-
function isObjectID(obj) {
|
|
7
|
-
return obj && obj._bsontype;
|
|
8
|
-
}
|
|
9
|
-
function isMongooseObject(obj) {
|
|
10
|
-
return !!(((0, hasJsonMethod_1.hasJsonMethod)(obj) && obj.$isMongooseModelPrototype) || isObjectID(obj));
|
|
11
|
-
}
|
package/dist/utils/isNil.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function isNil(value: any): boolean;
|
package/dist/utils/isNil.js
DELETED
package/dist/utils/isNumber.d.ts
DELETED
package/dist/utils/isNumber.js
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.isNumber = isNumber;
|
|
4
|
-
exports.isNumberOrNumberClass = isNumberOrNumberClass;
|
|
5
|
-
/**
|
|
6
|
-
*
|
|
7
|
-
* @param target
|
|
8
|
-
* @returns {boolean}
|
|
9
|
-
*/
|
|
10
|
-
function isNumber(target) {
|
|
11
|
-
return typeof target === "number";
|
|
12
|
-
}
|
|
13
|
-
function isNumberOrNumberClass(target) {
|
|
14
|
-
return typeof target === "number" || target instanceof Number || target === Number;
|
|
15
|
-
}
|
package/dist/utils/isObject.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function isObject(target: any): target is object;
|
package/dist/utils/isObject.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function isObservable<T>(obj: any): boolean;
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.isClassObject = isClassObject;
|
|
4
|
-
exports.isPlainObject = isPlainObject;
|
|
5
|
-
const classOf_1 = require("./classOf");
|
|
6
|
-
/**
|
|
7
|
-
*
|
|
8
|
-
* @param target
|
|
9
|
-
* @returns {boolean}
|
|
10
|
-
*/
|
|
11
|
-
function isClassObject(target) {
|
|
12
|
-
return target === Object;
|
|
13
|
-
}
|
|
14
|
-
function isPlainObject(target) {
|
|
15
|
-
return isClassObject((0, classOf_1.classOf)(target)) && target !== Object;
|
|
16
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Return true if the given obj is a primitive.
|
|
3
|
-
* @param target
|
|
4
|
-
* @returns {boolean}
|
|
5
|
-
* @ignore
|
|
6
|
-
*/
|
|
7
|
-
export declare function isPrimitiveOrPrimitiveClass(target: any): boolean;
|
|
8
|
-
/**
|
|
9
|
-
* Return true if the given obj is a primitive.
|
|
10
|
-
* @param target
|
|
11
|
-
* @returns {boolean}
|
|
12
|
-
*/
|
|
13
|
-
export declare function isPrimitive(target: any): boolean;
|
|
14
|
-
export declare function isPrimitiveClass(target: any): boolean;
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.isPrimitiveOrPrimitiveClass = isPrimitiveOrPrimitiveClass;
|
|
4
|
-
exports.isPrimitive = isPrimitive;
|
|
5
|
-
exports.isPrimitiveClass = isPrimitiveClass;
|
|
6
|
-
const isBoolean_1 = require("./isBoolean");
|
|
7
|
-
const isNumber_1 = require("./isNumber");
|
|
8
|
-
const isString_1 = require("./isString");
|
|
9
|
-
/**
|
|
10
|
-
* Return true if the given obj is a primitive.
|
|
11
|
-
* @param target
|
|
12
|
-
* @returns {boolean}
|
|
13
|
-
* @ignore
|
|
14
|
-
*/
|
|
15
|
-
function isPrimitiveOrPrimitiveClass(target) {
|
|
16
|
-
return (0, isString_1.isStringOrStringClass)(target) || (0, isNumber_1.isNumberOrNumberClass)(target) || (0, isBoolean_1.isBooleanOrBooleanClass)(target);
|
|
17
|
-
}
|
|
18
|
-
/**
|
|
19
|
-
* Return true if the given obj is a primitive.
|
|
20
|
-
* @param target
|
|
21
|
-
* @returns {boolean}
|
|
22
|
-
*/
|
|
23
|
-
function isPrimitive(target) {
|
|
24
|
-
return (0, isString_1.isString)(target) || (0, isNumber_1.isNumber)(target) || (0, isBoolean_1.isBoolean)(target);
|
|
25
|
-
}
|
|
26
|
-
function isPrimitiveClass(target) {
|
|
27
|
-
return [String, Number, Boolean].includes(target);
|
|
28
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function isPrimitiveType(type: any): boolean;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.isPrimitiveType = isPrimitiveType;
|
|
4
|
-
function isPrimitiveType(type) {
|
|
5
|
-
return (type === String ||
|
|
6
|
-
type === Number ||
|
|
7
|
-
type === Boolean ||
|
|
8
|
-
type === Symbol ||
|
|
9
|
-
type === undefined ||
|
|
10
|
-
type === null);
|
|
11
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Tests to see if the object is an ES2015 (ES6) Promise
|
|
3
|
-
* @see {@link https://www.ecma-international.org/ecma-262/6.0/#sec-promise-objects}
|
|
4
|
-
* @param target
|
|
5
|
-
* @returns {boolean}
|
|
6
|
-
*/
|
|
7
|
-
export declare function isPromise<T = any>(target: any): target is Promise<T>;
|
package/dist/utils/isPromise.js
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.isPromise = isPromise;
|
|
4
|
-
/**
|
|
5
|
-
* Tests to see if the object is an ES2015 (ES6) Promise
|
|
6
|
-
* @see {@link https://www.ecma-international.org/ecma-262/6.0/#sec-promise-objects}
|
|
7
|
-
* @param target
|
|
8
|
-
* @returns {boolean}
|
|
9
|
-
*/
|
|
10
|
-
function isPromise(target) {
|
|
11
|
-
return (target === Promise ||
|
|
12
|
-
target instanceof Promise ||
|
|
13
|
-
(!!target && typeof target.subscribe !== "function" && typeof target.then === "function"));
|
|
14
|
-
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.isProtectedKey = isProtectedKey;
|
|
4
|
-
/**
|
|
5
|
-
* Prevent prototype pollution vulnerability
|
|
6
|
-
* @param key
|
|
7
|
-
*/
|
|
8
|
-
function isProtectedKey(key) {
|
|
9
|
-
return ["__proto__", "constructor", "prototype"].includes(key);
|
|
10
|
-
}
|
package/dist/utils/isRegExp.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function isRegExp(target: any): target is RegExp;
|
package/dist/utils/isRegExp.js
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { TokenProvider } from "../commons";
|
|
2
|
-
import { InjectorService } from "../container";
|
|
3
|
-
import { Provider } from "../domain";
|
|
4
|
-
/**
|
|
5
|
-
* Check if the provider is a request scope or have some dependency that is a request scope
|
|
6
|
-
|
|
7
|
-
* @param provider
|
|
8
|
-
* @param deps
|
|
9
|
-
* @param injector
|
|
10
|
-
*/
|
|
11
|
-
export declare function isRequestScope(provider: Provider, deps: TokenProvider[], injector: InjectorService): boolean;
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.isRequestScope = isRequestScope;
|
|
4
|
-
const domain_1 = require("../domain");
|
|
5
|
-
/**
|
|
6
|
-
* Check if the provider is a request scope or have some dependency that is a request scope
|
|
7
|
-
|
|
8
|
-
* @param provider
|
|
9
|
-
* @param deps
|
|
10
|
-
* @param injector
|
|
11
|
-
*/
|
|
12
|
-
function isRequestScope(provider, deps, injector) {
|
|
13
|
-
if (provider.scope === 'request')
|
|
14
|
-
return true;
|
|
15
|
-
if (deps.length === 0)
|
|
16
|
-
return false;
|
|
17
|
-
return deps.some(dep => {
|
|
18
|
-
const depProvider = injector.get(dep);
|
|
19
|
-
if (!depProvider)
|
|
20
|
-
return false;
|
|
21
|
-
return depProvider.scope === domain_1.ProviderScope.REQUEST;
|
|
22
|
-
});
|
|
23
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function isSerializable(data: any): boolean;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.isSerializable = isSerializable;
|
|
4
|
-
const isStream_1 = require("./isStream");
|
|
5
|
-
const isBoolean_1 = require("./isBoolean");
|
|
6
|
-
const isNumber_1 = require("./isNumber");
|
|
7
|
-
const isString_1 = require("./isString");
|
|
8
|
-
const isNil_1 = require("./isNil");
|
|
9
|
-
function isSerializable(data) {
|
|
10
|
-
return !(Buffer.isBuffer(data) || (0, isStream_1.isStream)(data) || (0, isBoolean_1.isBoolean)(data) || (0, isNumber_1.isNumber)(data) || (0, isString_1.isString)(data) || (0, isNil_1.isNil)(data));
|
|
11
|
-
}
|
package/dist/utils/isStream.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function isStream(obj: any): boolean;
|
package/dist/utils/isStream.js
DELETED
package/dist/utils/isString.d.ts
DELETED
package/dist/utils/isString.js
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.isString = isString;
|
|
4
|
-
exports.isStringOrStringClass = isStringOrStringClass;
|
|
5
|
-
/**
|
|
6
|
-
* @param target
|
|
7
|
-
* @returns {boolean}
|
|
8
|
-
*/
|
|
9
|
-
function isString(target) {
|
|
10
|
-
return typeof target === "string";
|
|
11
|
-
}
|
|
12
|
-
function isStringOrStringClass(target) {
|
|
13
|
-
return typeof target === "string" || target instanceof String || target === String;
|
|
14
|
-
}
|
package/dist/utils/isSymbol.d.ts
DELETED
package/dist/utils/isSymbol.js
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.isSymbol = isSymbol;
|
|
4
|
-
exports.isSymbolOrSymbolClass = isSymbolOrSymbolClass;
|
|
5
|
-
/**
|
|
6
|
-
*
|
|
7
|
-
* @param target
|
|
8
|
-
*/
|
|
9
|
-
function isSymbol(target) {
|
|
10
|
-
return typeof target === "symbol";
|
|
11
|
-
}
|
|
12
|
-
function isSymbolOrSymbolClass(target) {
|
|
13
|
-
return typeof target === "symbol" || target instanceof Symbol || target === Symbol;
|
|
14
|
-
}
|
package/dist/utils/methodsOf.js
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.methodsOf = methodsOf;
|
|
4
|
-
const classOf_1 = require("./classOf");
|
|
5
|
-
const ancestorsOf_1 = require("./ancestorsOf");
|
|
6
|
-
const prototypeOf_1 = require("./prototypeOf");
|
|
7
|
-
/**
|
|
8
|
-
* Return all methods for a given class.
|
|
9
|
-
* @param target
|
|
10
|
-
*/
|
|
11
|
-
function methodsOf(target) {
|
|
12
|
-
const methods = new Map();
|
|
13
|
-
target = (0, classOf_1.classOf)(target);
|
|
14
|
-
(0, ancestorsOf_1.ancestorsOf)(target).forEach((target) => {
|
|
15
|
-
const keys = Reflect.ownKeys((0, prototypeOf_1.prototypeOf)(target));
|
|
16
|
-
// @ts-ignore
|
|
17
|
-
keys.forEach((propertyKey) => {
|
|
18
|
-
if (propertyKey !== "constructor") {
|
|
19
|
-
methods.set(propertyKey, { target, propertyKey });
|
|
20
|
-
}
|
|
21
|
-
});
|
|
22
|
-
});
|
|
23
|
-
return Array.from(methods.values());
|
|
24
|
-
}
|
package/dist/utils/nameOf.d.ts
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Get the provide name.
|
|
3
|
-
* @param targetClass
|
|
4
|
-
*/
|
|
5
|
-
export declare function nameOfClass(targetClass: any): string;
|
|
6
|
-
/**
|
|
7
|
-
* Get symbol name.
|
|
8
|
-
* @param sym
|
|
9
|
-
*/
|
|
10
|
-
export declare const nameOfSymbol: (sym: symbol) => string;
|
|
11
|
-
/**
|
|
12
|
-
* Get object name
|
|
13
|
-
*/
|
|
14
|
-
export declare function nameOf(obj: any): string;
|
package/dist/utils/nameOf.js
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.nameOfSymbol = void 0;
|
|
4
|
-
exports.nameOfClass = nameOfClass;
|
|
5
|
-
exports.nameOf = nameOf;
|
|
6
|
-
/**
|
|
7
|
-
* Get the provide name.
|
|
8
|
-
* @param targetClass
|
|
9
|
-
*/
|
|
10
|
-
function nameOfClass(targetClass) {
|
|
11
|
-
return typeof targetClass === "function" ? targetClass.name : targetClass.constructor.name;
|
|
12
|
-
}
|
|
13
|
-
/**
|
|
14
|
-
* Get symbol name.
|
|
15
|
-
* @param sym
|
|
16
|
-
*/
|
|
17
|
-
const nameOfSymbol = (sym) => sym.toString().replace("Symbol(", "").replace(")", "");
|
|
18
|
-
exports.nameOfSymbol = nameOfSymbol;
|
|
19
|
-
/**
|
|
20
|
-
* Get object name
|
|
21
|
-
*/
|
|
22
|
-
function nameOf(obj) {
|
|
23
|
-
switch (typeof obj) {
|
|
24
|
-
default:
|
|
25
|
-
return "" + obj;
|
|
26
|
-
case "symbol":
|
|
27
|
-
return (0, exports.nameOfSymbol)(obj);
|
|
28
|
-
case "function":
|
|
29
|
-
return nameOfClass(obj);
|
|
30
|
-
}
|
|
31
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function objectKeys(obj: any): string[];
|
package/dist/utils/objectKeys.js
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.objectKeys = objectKeys;
|
|
4
|
-
const isProtectedKey_1 = require("./isProtectedKey");
|
|
5
|
-
function objectKeys(obj) {
|
|
6
|
-
return Object.keys(obj).filter((key) => !(0, isProtectedKey_1.isProtectedKey)(key));
|
|
7
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function primitiveOf(target: any): "string" | "number" | "boolean" | "any";
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.primitiveOf = primitiveOf;
|
|
4
|
-
const isBoolean_1 = require("./isBoolean");
|
|
5
|
-
const isNumber_1 = require("./isNumber");
|
|
6
|
-
const isString_1 = require("./isString");
|
|
7
|
-
function primitiveOf(target) {
|
|
8
|
-
if ((0, isString_1.isStringOrStringClass)(target)) {
|
|
9
|
-
return "string";
|
|
10
|
-
}
|
|
11
|
-
if ((0, isNumber_1.isNumberOrNumberClass)(target)) {
|
|
12
|
-
return "number";
|
|
13
|
-
}
|
|
14
|
-
if ((0, isBoolean_1.isBooleanOrBooleanClass)(target)) {
|
|
15
|
-
return "boolean";
|
|
16
|
-
}
|
|
17
|
-
return "any";
|
|
18
|
-
}
|