@baklavabg/common-ts 1.0.22 → 1.0.23
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/dist/index.d.ts +0 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +0 -1
- package/dist/index.js.map +1 -1
- package/dist/utils/index.d.ts +3 -2
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/index.js +3 -2
- package/dist/utils/index.js.map +1 -1
- package/dist/utils/tryCatchSafeDecorator.d.ts +1 -0
- package/dist/utils/tryCatchSafeDecorator.d.ts.map +1 -1
- package/dist/utils/tryCatchSafeDecorator.js +19 -0
- package/dist/utils/tryCatchSafeDecorator.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -2,7 +2,6 @@ export * from "./safeExit/index.js";
|
|
|
2
2
|
export * from "./utils/index.js";
|
|
3
3
|
export type { User1, User2 } from "./types/index.js";
|
|
4
4
|
export { formatUserName } from "./utils/user.utils.js";
|
|
5
|
-
export { TryCatch } from "./utils/tryCatchSafeDecorator.js";
|
|
6
5
|
export { equals, greaterThan, isEmpty, isEven, isNegative, isNotEmpty, isNull, isNullOrUndefined, isOdd, isPositive, isUndefined, isZero, lessThan, notEquals, } from "./safeExit/conditionHelpers.js";
|
|
7
6
|
export { createFolder } from "./utils/file.utils.js";
|
|
8
7
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAC;AACpC,cAAc,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAC;AACpC,cAAc,kBAAkB,CAAC;AAEjC,YAAY,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAErD,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAEvD,OAAO,EACH,MAAM,EACN,WAAW,EACX,OAAO,EACP,MAAM,EACN,UAAU,EACV,UAAU,EACV,MAAM,EACN,iBAAiB,EACjB,KAAK,EACL,UAAU,EACV,WAAW,EACX,MAAM,EACN,QAAQ,EACR,SAAS,GACZ,MAAM,gCAAgC,CAAC;AAExC,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
export * from "./safeExit/index.js";
|
|
2
2
|
export * from "./utils/index.js";
|
|
3
3
|
export { formatUserName } from "./utils/user.utils.js";
|
|
4
|
-
export { TryCatch } from "./utils/tryCatchSafeDecorator.js";
|
|
5
4
|
export { equals, greaterThan, isEmpty, isEven, isNegative, isNotEmpty, isNull, isNullOrUndefined, isOdd, isPositive, isUndefined, isZero, lessThan, notEquals, } from "./safeExit/conditionHelpers.js";
|
|
6
5
|
export { createFolder } from "./utils/file.utils.js";
|
|
7
6
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAC;AACpC,cAAc,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAC;AACpC,cAAc,kBAAkB,CAAC;AAIjC,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAEvD,OAAO,EACH,MAAM,EACN,WAAW,EACX,OAAO,EACP,MAAM,EACN,UAAU,EACV,UAAU,EACV,MAAM,EACN,iBAAiB,EACjB,KAAK,EACL,UAAU,EACV,WAAW,EACX,MAAM,EACN,QAAQ,EACR,SAAS,GACZ,MAAM,gCAAgC,CAAC;AAExC,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC"}
|
package/dist/utils/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
export { saveFile, loadFile, loadJson, saveJson, createFolder } from "./file.utils.js";
|
|
2
|
-
export { print } from "./log.utils.js";
|
|
3
1
|
export { blue, cyan, green, magenta, red, white, yellow } from "console-log-colors";
|
|
2
|
+
export { createFolder, loadFile, loadJson, saveFile, saveJson } from "./file.utils.js";
|
|
3
|
+
export { print } from "./log.utils.js";
|
|
4
|
+
export { TryCatch, TryCatchRethrow } from "./tryCatchSafeDecorator.js";
|
|
4
5
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AACpF,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AACvF,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AACvC,OAAO,EAAE,QAAQ,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC"}
|
package/dist/utils/index.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
export { saveFile, loadFile, loadJson, saveJson, createFolder } from "./file.utils.js";
|
|
2
|
-
export { print } from "./log.utils.js";
|
|
3
1
|
export { blue, cyan, green, magenta, red, white, yellow } from "console-log-colors";
|
|
2
|
+
export { createFolder, loadFile, loadJson, saveFile, saveJson } from "./file.utils.js";
|
|
3
|
+
export { print } from "./log.utils.js";
|
|
4
|
+
export { TryCatch, TryCatchRethrow } from "./tryCatchSafeDecorator.js";
|
|
4
5
|
//# sourceMappingURL=index.js.map
|
package/dist/utils/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AACpF,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AACvF,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AACvC,OAAO,EAAE,QAAQ,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC"}
|
|
@@ -1,2 +1,3 @@
|
|
|
1
1
|
export declare function TryCatch<C = undefined>(printError?: boolean, printStack?: boolean, customReturn?: C): (originalMethod: (...args: any[]) => any, _context: ClassMethodDecoratorContext) => any;
|
|
2
|
+
export declare function TryCatchRethrow(printError?: boolean, printStack?: boolean): (originalMethod: (...args: any[]) => any, _context: ClassMethodDecoratorContext) => (this: any, ...args: any[]) => any;
|
|
2
3
|
//# sourceMappingURL=tryCatchSafeDecorator.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tryCatchSafeDecorator.d.ts","sourceRoot":"","sources":["../../src/utils/tryCatchSafeDecorator.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"tryCatchSafeDecorator.d.ts","sourceRoot":"","sources":["../../src/utils/tryCatchSafeDecorator.ts"],"names":[],"mappings":"AAiCA,wBAAgB,QAAQ,CAAC,CAAC,GAAG,SAAS,EAAE,UAAU,GAAE,OAAc,EAAE,UAAU,GAAE,OAAc,EAAE,YAAY,CAAC,EAAE,CAAC,IAC3F,gBAAgB,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,GAAG,EAAE,UAAU,2BAA2B,KACf,GAAG,CAEtF;AAED,wBAAgB,eAAe,CAAC,UAAU,GAAE,OAAc,EAAE,UAAU,GAAE,OAAe,IAClE,gBAAgB,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,GAAG,EAAE,UAAU,2BAA2B,MAC1E,MAAM,GAAG,EAAE,GAAG,MAAM,GAAG,EAAE,SAcjD"}
|
|
@@ -28,10 +28,29 @@
|
|
|
28
28
|
// See tryCatchSafe.ts for more details on parameter behavior.
|
|
29
29
|
// import { safe } from "./tryCatchSafe.js";
|
|
30
30
|
import { safe } from "../safeExit/safe.js";
|
|
31
|
+
import { print } from "../utils/log.utils.js";
|
|
31
32
|
//@mii to move to safeExit folder
|
|
32
33
|
export function TryCatch(printError = true, printStack = true, customReturn) {
|
|
33
34
|
return function (originalMethod, _context) {
|
|
34
35
|
return safe(originalMethod, printError, printStack, customReturn);
|
|
35
36
|
};
|
|
36
37
|
}
|
|
38
|
+
export function TryCatchRethrow(printError = true, printStack = false) {
|
|
39
|
+
return function (originalMethod, _context) {
|
|
40
|
+
return function (...args) {
|
|
41
|
+
try {
|
|
42
|
+
return originalMethod.apply(this, args);
|
|
43
|
+
}
|
|
44
|
+
catch (error) {
|
|
45
|
+
if (printError) {
|
|
46
|
+
print.red(error instanceof Error ? `${error.message}` : `${error}`);
|
|
47
|
+
}
|
|
48
|
+
if (printStack && error instanceof Error) {
|
|
49
|
+
print.red(`${error.stack}`);
|
|
50
|
+
}
|
|
51
|
+
throw error;
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
};
|
|
55
|
+
}
|
|
37
56
|
//# sourceMappingURL=tryCatchSafeDecorator.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tryCatchSafeDecorator.js","sourceRoot":"","sources":["../../src/utils/tryCatchSafeDecorator.ts"],"names":[],"mappings":"AAAA,mFAAmF;AACnF,sFAAsF;AACtF,6FAA6F;AAC7F,kGAAkG;AAClG,EAAE;AACF,iBAAiB;AACjB,sDAAsD;AACtD,EAAE;AACF,kBAAkB;AAClB,wGAAwG;AACxG,4CAA4C;AAC5C,oBAAoB;AACpB,wCAAwC;AACxC,MAAM;AACN,EAAE;AACF,6FAA6F;AAC7F,2BAA2B;AAC3B,2BAA2B;AAC3B,wCAAwC;AACxC,MAAM;AACN,IAAI;AACJ,EAAE;AACF,sBAAsB;AACtB,iEAAiE;AACjE,kEAAkE;AAClE,2EAA2E;AAC3E,EAAE;AACF,8DAA8D;AAC9D,4CAA4C;AAC5C,OAAO,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"tryCatchSafeDecorator.js","sourceRoot":"","sources":["../../src/utils/tryCatchSafeDecorator.ts"],"names":[],"mappings":"AAAA,mFAAmF;AACnF,sFAAsF;AACtF,6FAA6F;AAC7F,kGAAkG;AAClG,EAAE;AACF,iBAAiB;AACjB,sDAAsD;AACtD,EAAE;AACF,kBAAkB;AAClB,wGAAwG;AACxG,4CAA4C;AAC5C,oBAAoB;AACpB,wCAAwC;AACxC,MAAM;AACN,EAAE;AACF,6FAA6F;AAC7F,2BAA2B;AAC3B,2BAA2B;AAC3B,wCAAwC;AACxC,MAAM;AACN,IAAI;AACJ,EAAE;AACF,sBAAsB;AACtB,iEAAiE;AACjE,kEAAkE;AAClE,2EAA2E;AAC3E,EAAE;AACF,8DAA8D;AAC9D,4CAA4C;AAC5C,OAAO,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAC3C,OAAO,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAE9C,iCAAiC;AACjC,MAAM,UAAU,QAAQ,CAAgB,aAAsB,IAAI,EAAE,aAAsB,IAAI,EAAE,YAAgB;IAC5G,OAAO,UAAU,cAAuC,EAAE,QAAqC;QAC3F,OAAO,IAAI,CAAC,cAAc,EAAE,UAAU,EAAE,UAAU,EAAE,YAAmB,CAAQ,CAAC;IACpF,CAAC,CAAC;AACN,CAAC;AAED,MAAM,UAAU,eAAe,CAAC,aAAsB,IAAI,EAAE,aAAsB,KAAK;IACnF,OAAO,UAAU,cAAuC,EAAE,QAAqC;QAC3F,OAAO,UAAqB,GAAG,IAAW;YACtC,IAAI,CAAC;gBACD,OAAO,cAAc,CAAC,KAAK,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;YAC5C,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACb,IAAI,UAAU,EAAE,CAAC;oBACb,KAAK,CAAC,GAAG,CAAC,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,GAAG,KAAK,EAAE,CAAC,CAAC;gBACxE,CAAC;gBACD,IAAI,UAAU,IAAI,KAAK,YAAY,KAAK,EAAE,CAAC;oBACvC,KAAK,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC,KAAK,EAAE,CAAC,CAAC;gBAChC,CAAC;gBACD,MAAM,KAAK,CAAC;YAChB,CAAC;QACL,CAAC,CAAC;IACN,CAAC,CAAC;AACN,CAAC"}
|