@samet-it/be-base-common 1.3.2 → 1.3.4
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/error/error.handler.js +3 -1
- package/dist/error/index.d.ts +5 -1
- package/dist/error/index.js +5 -1
- package/dist/exit/exit-handler.impl.js +3 -0
- package/dist/generator/generator.js +3 -0
- package/dist/index.d.ts +2 -1
- package/dist/index.foretell.d.ts +1 -0
- package/dist/index.foretell.js +26 -0
- package/dist/index.js +2 -1
- package/dist/index.loader.d.ts +1 -0
- package/dist/index.loader.js +15 -0
- package/dist/internal.d.ts +1 -0
- package/dist/internal.js +2 -0
- package/package.json +9 -9
- package/dist/error/items/index.d.ts +0 -5
- package/dist/error/items/index.js +0 -5
- package/dist/logger/index.d.ts +0 -2
- package/dist/logger/index.js +0 -2
- package/dist/logger/index.types.d.ts +0 -39
- package/dist/logger/index.types.js +0 -1
- package/dist/logger/logger.impl.d.ts +0 -7
- package/dist/logger/logger.impl.js +0 -44
- /package/dist/error/{items/page-not-found.error.d.ts → page-not-found.error.d.ts} +0 -0
- /package/dist/error/{items/page-not-found.error.js → page-not-found.error.js} +0 -0
- /package/dist/error/{items/record-duplicated.error.d.ts → record-duplicated.error.d.ts} +0 -0
- /package/dist/error/{items/record-duplicated.error.js → record-duplicated.error.js} +0 -0
- /package/dist/error/{items/record-not-found.error.d.ts → record-not-found.error.d.ts} +0 -0
- /package/dist/error/{items/record-not-found.error.js → record-not-found.error.js} +0 -0
- /package/dist/error/{items/samet.error.d.ts → samet.error.d.ts} +0 -0
- /package/dist/error/{items/samet.error.js → samet.error.js} +0 -0
- /package/dist/error/{items/validation.error.d.ts → validation.error.d.ts} +0 -0
- /package/dist/error/{items/validation.error.js → validation.error.js} +0 -0
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { errorCommon } from "@leyyo/common";
|
|
1
|
+
import { errorCommon, setFqn } from "@leyyo/common";
|
|
2
|
+
import { FQN } from "../internal.js";
|
|
2
3
|
class ErrorHandler {
|
|
3
4
|
_CLEAR_STAT = 1_000 * 60 * 60 * 24; // daily
|
|
4
5
|
_stats = new Map();
|
|
@@ -57,5 +58,6 @@ class ErrorHandler {
|
|
|
57
58
|
return map;
|
|
58
59
|
}
|
|
59
60
|
}
|
|
61
|
+
setFqn(ErrorHandler, FQN);
|
|
60
62
|
// noinspection JSUnusedGlobalSymbols
|
|
61
63
|
export const errorHandler = new ErrorHandler();
|
package/dist/error/index.d.ts
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
1
|
export * from './index.types.js';
|
|
2
2
|
export * from './error.handler.js';
|
|
3
|
-
export * from './
|
|
3
|
+
export * from './page-not-found.error.js';
|
|
4
|
+
export * from './record-duplicated.error.js';
|
|
5
|
+
export * from './record-not-found.error.js';
|
|
6
|
+
export * from './samet.error.js';
|
|
7
|
+
export * from './validation.error.js';
|
package/dist/error/index.js
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
1
|
export * from './index.types.js';
|
|
2
2
|
export * from './error.handler.js';
|
|
3
|
-
export * from './
|
|
3
|
+
export * from './page-not-found.error.js';
|
|
4
|
+
export * from './record-duplicated.error.js';
|
|
5
|
+
export * from './record-not-found.error.js';
|
|
6
|
+
export * from './samet.error.js';
|
|
7
|
+
export * from './validation.error.js';
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { setFqn } from "@leyyo/common";
|
|
2
|
+
import { FQN } from "../internal.js";
|
|
1
3
|
class ExitHandlerImpl {
|
|
2
4
|
register(fn) {
|
|
3
5
|
['SIGINT', 'SIGTERM', 'SIGQUIT', 'SIGKILL'].forEach(event => {
|
|
@@ -11,5 +13,6 @@ class ExitHandlerImpl {
|
|
|
11
13
|
});
|
|
12
14
|
}
|
|
13
15
|
}
|
|
16
|
+
setFqn(ExitHandlerImpl, FQN);
|
|
14
17
|
// noinspection JSUnusedGlobalSymbols
|
|
15
18
|
export const exitHandler = new ExitHandlerImpl();
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { randomUUID } from "node:crypto";
|
|
2
|
+
import { setFqn } from "@leyyo/common";
|
|
3
|
+
import { FQN } from "../internal.js";
|
|
2
4
|
const NUMERIC = '0123456789';
|
|
3
5
|
const UPPER = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
|
|
4
6
|
const LOWER = 'abcdefghijklmnopqrstuvwxyz';
|
|
@@ -408,5 +410,6 @@ class Generator {
|
|
|
408
410
|
return domains.join(':');
|
|
409
411
|
}
|
|
410
412
|
}
|
|
413
|
+
setFqn(Generator, FQN);
|
|
411
414
|
// noinspection JSUnusedGlobalSymbols
|
|
412
415
|
export const generator = new Generator();
|
package/dist/index.d.ts
CHANGED
|
@@ -2,8 +2,9 @@ export * from './config/index.js';
|
|
|
2
2
|
export * from './error/index.js';
|
|
3
3
|
export * from './exit/index.js';
|
|
4
4
|
export * from './generator/index.js';
|
|
5
|
-
export * from './logger/index.js';
|
|
6
5
|
export * from './model/index.js';
|
|
6
|
+
export * from './index.foretell.js';
|
|
7
|
+
export * from './index.loader.js';
|
|
7
8
|
export * from '@leyyo/asl';
|
|
8
9
|
export * from '@leyyo/assert';
|
|
9
10
|
export * from '@leyyo/builder';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const foretell_sametBaseCommon: any[];
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { foretell_leyyoCommon, leyyo } from "@leyyo/common";
|
|
2
|
+
import { FQN } from "./internal.js";
|
|
3
|
+
import { foretell_leyyoAsl } from "@leyyo/asl";
|
|
4
|
+
import { foretell_leyyoAssert } from "@leyyo/assert";
|
|
5
|
+
import { foretell_leyyoBuilder } from "@leyyo/builder";
|
|
6
|
+
import { foretell_leyyoEither } from "@leyyo/either";
|
|
7
|
+
import { foretell_leyyoEnv } from "@leyyo/env";
|
|
8
|
+
import { foretell_leyyoEnveloper } from "@leyyo/enveloper";
|
|
9
|
+
import { foretell_leyyoType } from "@leyyo/type";
|
|
10
|
+
// noinspection JSUnusedGlobalSymbols
|
|
11
|
+
export const foretell_sametBaseCommon = [
|
|
12
|
+
...foretell_leyyoAsl,
|
|
13
|
+
...foretell_leyyoAssert,
|
|
14
|
+
...foretell_leyyoBuilder,
|
|
15
|
+
...foretell_leyyoCommon,
|
|
16
|
+
...foretell_leyyoEither,
|
|
17
|
+
...foretell_leyyoEnv,
|
|
18
|
+
...foretell_leyyoEnveloper,
|
|
19
|
+
...foretell_leyyoType,
|
|
20
|
+
// errors
|
|
21
|
+
() => leyyo.errorPool.lazy(FQN, 'PageNotFoundError', import('./error/page-not-found.error.js').then(m => m.PageNotFoundError), { i18n: true, emit: true }),
|
|
22
|
+
() => leyyo.errorPool.lazy(FQN, 'RecordDuplicatedError', import('./error/record-duplicated.error.js').then(m => m.RecordDuplicatedError), { i18n: true, emit: true }),
|
|
23
|
+
() => leyyo.errorPool.lazy(FQN, 'RecordNotFoundError', import('./error/record-not-found.error.js').then(m => m.RecordNotFoundError), { i18n: true, emit: true }),
|
|
24
|
+
() => leyyo.errorPool.lazy(FQN, 'SametError', import('./error/samet.error.js').then(m => m.SametError), { i18n: true, emit: true }),
|
|
25
|
+
() => leyyo.errorPool.lazy(FQN, 'ValidationError', import('./error/validation.error.js').then(m => m.ValidationError), { i18n: true, emit: true }),
|
|
26
|
+
];
|
package/dist/index.js
CHANGED
|
@@ -2,8 +2,9 @@ export * from './config/index.js';
|
|
|
2
2
|
export * from './error/index.js';
|
|
3
3
|
export * from './exit/index.js';
|
|
4
4
|
export * from './generator/index.js';
|
|
5
|
-
export * from './logger/index.js';
|
|
6
5
|
export * from './model/index.js';
|
|
6
|
+
export * from './index.foretell.js';
|
|
7
|
+
export * from './index.loader.js';
|
|
7
8
|
export * from '@leyyo/asl';
|
|
8
9
|
export * from '@leyyo/assert';
|
|
9
10
|
export * from '@leyyo/builder';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const loader_sametBaseCommon: import("@leyyo/common").LoaderLike;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { defineLoader, loader_leyyoCommon } from "@leyyo/common";
|
|
2
|
+
import { FQN } from "./internal.js";
|
|
3
|
+
import { loader_leyyoAsl } from "@leyyo/asl";
|
|
4
|
+
import { loader_leyyoAssert } from "@leyyo/assert";
|
|
5
|
+
import { loader_leyyoBuilder } from "@leyyo/builder";
|
|
6
|
+
import { loader_leyyoEither } from "@leyyo/either";
|
|
7
|
+
import { loader_leyyoEnv } from "@leyyo/env";
|
|
8
|
+
import { loader_leyyoEnveloper } from "@leyyo/enveloper";
|
|
9
|
+
import { loader_leyyoType } from "@leyyo/type";
|
|
10
|
+
// noinspection JSUnusedGlobalSymbols
|
|
11
|
+
export const loader_sametBaseCommon = defineLoader(FQN, ...loader_leyyoAsl, ...loader_leyyoAssert, ...loader_leyyoBuilder, ...loader_leyyoCommon, ...loader_leyyoEither, ...loader_leyyoEnv, ...loader_leyyoEnveloper, ...loader_leyyoType,
|
|
12
|
+
// errors
|
|
13
|
+
() => import('./error/page-not-found.error.js').then(m => m.PageNotFoundError), () => import('./error/record-duplicated.error.js').then(m => m.RecordDuplicatedError), () => import('./error/record-not-found.error.js').then(m => m.RecordNotFoundError), () => import('./error/samet.error.js').then(m => m.SametError), () => import('./error/validation.error.js').then(m => m.ValidationError),
|
|
14
|
+
// instances
|
|
15
|
+
() => import('./config/base-common.config.js').then(m => m.baseCommonConfig), () => import('./error/error.handler.js').then(m => m.errorHandler), () => import('./exit/exit-handler.impl.js').then(m => m.exitHandler), () => import('./generator/generator.js').then(m => m.generator));
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const NME: string, FQN: string, VER: string, CNF: import("@leyyo/common").LeyyoConfig;
|
package/dist/internal.js
ADDED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@samet-it/be-base-common",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.4",
|
|
4
4
|
"description": "Backend Base Common",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -64,13 +64,13 @@
|
|
|
64
64
|
}
|
|
65
65
|
},
|
|
66
66
|
"dependencies": {
|
|
67
|
-
"@leyyo/asl": "^1.3.
|
|
68
|
-
"@leyyo/assert": "^1.3.
|
|
69
|
-
"@leyyo/builder": "^3.1.
|
|
70
|
-
"@leyyo/common": "^1.3.
|
|
71
|
-
"@leyyo/either": "^1.3.
|
|
72
|
-
"@leyyo/env": "^1.3.
|
|
73
|
-
"@leyyo/enveloper": "^1.3.
|
|
74
|
-
"@leyyo/type": "^1.3.
|
|
67
|
+
"@leyyo/asl": "^1.3.5",
|
|
68
|
+
"@leyyo/assert": "^1.3.2",
|
|
69
|
+
"@leyyo/builder": "^3.1.11",
|
|
70
|
+
"@leyyo/common": "^1.3.12",
|
|
71
|
+
"@leyyo/either": "^1.3.4",
|
|
72
|
+
"@leyyo/env": "^1.3.11",
|
|
73
|
+
"@leyyo/enveloper": "^1.3.5",
|
|
74
|
+
"@leyyo/type": "^1.3.5"
|
|
75
75
|
}
|
|
76
76
|
}
|
package/dist/logger/index.d.ts
DELETED
package/dist/logger/index.js
DELETED
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import { ClassLike, Obj, Logger } from "@leyyo/common";
|
|
2
|
-
/**
|
|
3
|
-
* Logger pool interface
|
|
4
|
-
* */
|
|
5
|
-
export interface LoggerLike {
|
|
6
|
-
/**
|
|
7
|
-
* Create logger by class name
|
|
8
|
-
*
|
|
9
|
-
* @param {string} className - class name
|
|
10
|
-
* @return {Logger} - logger instance
|
|
11
|
-
* */
|
|
12
|
-
of(className: string): Logger;
|
|
13
|
-
/**
|
|
14
|
-
* Create logger by class
|
|
15
|
-
*
|
|
16
|
-
* @param {function} clazz - class
|
|
17
|
-
* @return {Logger} - logger instance
|
|
18
|
-
* */
|
|
19
|
-
of(clazz: ClassLike): Logger;
|
|
20
|
-
/**
|
|
21
|
-
* Create logger by instance
|
|
22
|
-
*
|
|
23
|
-
* @param {Obj} instance - instance, ie: `this`
|
|
24
|
-
* @return {Logger} - logger instance
|
|
25
|
-
* */
|
|
26
|
-
of(instance: Obj): Logger;
|
|
27
|
-
/**
|
|
28
|
-
* Get samet default logger
|
|
29
|
-
*
|
|
30
|
-
* @return {Logger} - logger instance
|
|
31
|
-
* */
|
|
32
|
-
get samet(): Logger;
|
|
33
|
-
/**
|
|
34
|
-
* Get developer default logger
|
|
35
|
-
*
|
|
36
|
-
* @return {Logger} - logger instance
|
|
37
|
-
* */
|
|
38
|
-
get developer(): Logger;
|
|
39
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import { logCommon } from "@leyyo/common";
|
|
2
|
-
/**
|
|
3
|
-
* Logger pool class
|
|
4
|
-
* */
|
|
5
|
-
class LoggerImpl {
|
|
6
|
-
/**
|
|
7
|
-
* Samet default logger
|
|
8
|
-
* */
|
|
9
|
-
_sametLogger;
|
|
10
|
-
/**
|
|
11
|
-
* Developer default logger
|
|
12
|
-
* */
|
|
13
|
-
_developerLogger;
|
|
14
|
-
/**
|
|
15
|
-
* Create logger
|
|
16
|
-
*
|
|
17
|
-
* @param {(string|ClassLike|Obj)} ref - class name, class or instance
|
|
18
|
-
* @return {Logger} - logger instance
|
|
19
|
-
* */
|
|
20
|
-
of(ref) {
|
|
21
|
-
return logCommon.of(ref);
|
|
22
|
-
}
|
|
23
|
-
/** @inheritDoc */
|
|
24
|
-
get samet() {
|
|
25
|
-
if (!this._sametLogger) {
|
|
26
|
-
this._sametLogger = logCommon.of('Samet');
|
|
27
|
-
}
|
|
28
|
-
return this._sametLogger;
|
|
29
|
-
}
|
|
30
|
-
/** @inheritDoc */
|
|
31
|
-
get developer() {
|
|
32
|
-
if (!this._developerLogger) {
|
|
33
|
-
this._developerLogger = logCommon.of('Developer');
|
|
34
|
-
}
|
|
35
|
-
return this._developerLogger;
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
// noinspection JSUnusedGlobalSymbols
|
|
39
|
-
/**
|
|
40
|
-
* Logger pool
|
|
41
|
-
*
|
|
42
|
-
* @type {LoggerLike}
|
|
43
|
-
* */
|
|
44
|
-
export const logger = new LoggerImpl();
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|