@tc-libs/core 4.0.0
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/README.md +13 -0
- package/package.json +31 -0
- package/src/core.module.d.ts +5 -0
- package/src/core.module.js +168 -0
- package/src/core.module.js.map +1 -0
- package/src/core.module.options.d.ts +103 -0
- package/src/core.module.options.js +5 -0
- package/src/core.module.options.js.map +1 -0
- package/src/index.d.ts +2 -0
- package/src/index.js +6 -0
- package/src/index.js.map +1 -0
package/README.md
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# @tc-libs/core
|
|
2
|
+
|
|
3
|
+
Libreria umbrella che aggrega il kernel condiviso delle `tc-libs-nestjs`
|
|
4
|
+
(REST + Mongo + auth/access + observability + file/storage) in un unico modulo
|
|
5
|
+
`CoreModule.forRootAsync`.
|
|
6
|
+
|
|
7
|
+
Assorbe: `constant`, `error-interface`, `errors`, `helper`, `pagination`,
|
|
8
|
+
`app-cache`, `database`, `service`, `request`, `response`, `message`, `doc`,
|
|
9
|
+
`authentication`, `user`, `permission`, `role`, `api-key`, `login-access`,
|
|
10
|
+
`logger`, `debugger`, `http-log`, `error-handler`, `file`, `storage`.
|
|
11
|
+
|
|
12
|
+
I simboli dei singoli pacchetti restano importabili da `@tc-libs/<nome>`
|
|
13
|
+
(installati transitivamente da questa libreria).
|
package/package.json
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@tc-libs/core",
|
|
3
|
+
"version": "4.0.0",
|
|
4
|
+
"dependencies": {
|
|
5
|
+
"@tc-libs/api-key": "4.0.0",
|
|
6
|
+
"@tc-libs/app-cache": "4.0.0",
|
|
7
|
+
"@tc-libs/authentication": "4.0.0",
|
|
8
|
+
"@tc-libs/database": "4.0.0",
|
|
9
|
+
"@tc-libs/debugger": "4.0.0",
|
|
10
|
+
"@tc-libs/error-handler": "4.0.0",
|
|
11
|
+
"@tc-libs/file": "4.0.0",
|
|
12
|
+
"@tc-libs/helper": "4.0.0",
|
|
13
|
+
"@tc-libs/http-log": "4.0.0",
|
|
14
|
+
"@tc-libs/logger": "4.0.0",
|
|
15
|
+
"@tc-libs/login-access": "4.0.0",
|
|
16
|
+
"@tc-libs/message": "4.0.0",
|
|
17
|
+
"@tc-libs/pagination": "4.0.0",
|
|
18
|
+
"@tc-libs/permission": "4.0.0",
|
|
19
|
+
"@tc-libs/request": "4.0.0",
|
|
20
|
+
"@tc-libs/response": "4.0.0",
|
|
21
|
+
"@tc-libs/role": "4.0.0",
|
|
22
|
+
"@tc-libs/storage": "4.0.0",
|
|
23
|
+
"@nestjs/common": "^11.0.12",
|
|
24
|
+
"@nestjs/mongoose": "^11.0.3",
|
|
25
|
+
"tslib": "^2.8.1"
|
|
26
|
+
},
|
|
27
|
+
"type": "commonjs",
|
|
28
|
+
"main": "./src/index.js",
|
|
29
|
+
"typings": "./src/index.d.ts",
|
|
30
|
+
"types": "./src/index.d.ts"
|
|
31
|
+
}
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var CoreModule_1;
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.CoreModule = void 0;
|
|
5
|
+
const tslib_1 = require("tslib");
|
|
6
|
+
const common_1 = require("@nestjs/common");
|
|
7
|
+
const mongoose_1 = require("@nestjs/mongoose");
|
|
8
|
+
const authentication_1 = require("@tc-libs/authentication");
|
|
9
|
+
const app_cache_1 = require("@tc-libs/app-cache");
|
|
10
|
+
const database_1 = require("@tc-libs/database");
|
|
11
|
+
const helper_1 = require("@tc-libs/helper");
|
|
12
|
+
const request_1 = require("@tc-libs/request");
|
|
13
|
+
const response_1 = require("@tc-libs/response");
|
|
14
|
+
const pagination_1 = require("@tc-libs/pagination");
|
|
15
|
+
const message_1 = require("@tc-libs/message");
|
|
16
|
+
const storage_1 = require("@tc-libs/storage");
|
|
17
|
+
const file_1 = require("@tc-libs/file");
|
|
18
|
+
const logger_1 = require("@tc-libs/logger");
|
|
19
|
+
const debugger_1 = require("@tc-libs/debugger");
|
|
20
|
+
const http_log_1 = require("@tc-libs/http-log");
|
|
21
|
+
const error_handler_1 = require("@tc-libs/error-handler");
|
|
22
|
+
const permission_1 = require("@tc-libs/permission");
|
|
23
|
+
const role_1 = require("@tc-libs/role");
|
|
24
|
+
const login_access_1 = require("@tc-libs/login-access");
|
|
25
|
+
const api_key_1 = require("@tc-libs/api-key");
|
|
26
|
+
// ---- fan-out: dal config unico alle opzioni dei singoli sotto-moduli ----
|
|
27
|
+
function toHelperOptions(o) {
|
|
28
|
+
const a = o.auth;
|
|
29
|
+
return {
|
|
30
|
+
jwt: a.jwt,
|
|
31
|
+
auth: {
|
|
32
|
+
subject: a.auth.subject,
|
|
33
|
+
audience: a.auth.audience,
|
|
34
|
+
issuer: a.auth.issuer,
|
|
35
|
+
accessToken: a.auth.accessToken,
|
|
36
|
+
refreshToken: a.auth.refreshToken,
|
|
37
|
+
permissionToken: {
|
|
38
|
+
secretKey: a.auth.permissionToken.secretKey,
|
|
39
|
+
expirationTime: a.auth.permissionToken.expirationTime,
|
|
40
|
+
notBeforeExpirationTime: a.auth.permissionToken.notBeforeExpirationTime,
|
|
41
|
+
encryptKey: a.auth.permissionToken.encryptKey,
|
|
42
|
+
encryptIv: a.auth.permissionToken.encryptIv,
|
|
43
|
+
},
|
|
44
|
+
},
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
function toRequestOptions(o) {
|
|
48
|
+
return {
|
|
49
|
+
request: o.request,
|
|
50
|
+
app: o.app,
|
|
51
|
+
file: {
|
|
52
|
+
audio: { maxFileSize: o.files.audio.maxFileSize },
|
|
53
|
+
excel: { maxFileSize: o.files.excel.maxFileSize },
|
|
54
|
+
image: { maxFileSize: o.files.image.maxFileSize },
|
|
55
|
+
video: { maxFileSize: o.files.video.maxFileSize },
|
|
56
|
+
},
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
function toMessageOptions(o) {
|
|
60
|
+
return {
|
|
61
|
+
appDefaultLanguage: o.languages.default,
|
|
62
|
+
availableLanguages: o.languages.available,
|
|
63
|
+
i18nEnabled: o.languages.i18nEnabled,
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
function toErrorHandlerOptions(o) {
|
|
67
|
+
return {
|
|
68
|
+
availableLanguages: o.languages.available,
|
|
69
|
+
versioning: { version: o.app.versioning.version },
|
|
70
|
+
repoVersion: o.app.repoVersion,
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
function toDebuggerOptions(o) {
|
|
74
|
+
const channel = o.log.debugger.cloudwatch;
|
|
75
|
+
const shared = o.log.cloudwatch;
|
|
76
|
+
return {
|
|
77
|
+
system: o.log.debugger.system,
|
|
78
|
+
telegram: o.log.telegram ?? { chatId: '', apiToken: '' },
|
|
79
|
+
cloudwatch: channel && shared
|
|
80
|
+
? {
|
|
81
|
+
credential: shared.credential,
|
|
82
|
+
region: shared.region,
|
|
83
|
+
logGroup: channel.logGroup,
|
|
84
|
+
logStream: channel.logStream,
|
|
85
|
+
minLevel: channel.minLevel,
|
|
86
|
+
}
|
|
87
|
+
: undefined,
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
function toLoggerOptions(o) {
|
|
91
|
+
const channel = o.log.logger.cloudwatch;
|
|
92
|
+
const shared = o.log.cloudwatch;
|
|
93
|
+
return {
|
|
94
|
+
telegram: {
|
|
95
|
+
enabled: o.log.logger.telegramEnabled,
|
|
96
|
+
chatId: o.log.telegram?.chatId ?? '',
|
|
97
|
+
apiToken: o.log.telegram?.apiToken ?? '',
|
|
98
|
+
},
|
|
99
|
+
cloudwatch: channel && shared
|
|
100
|
+
? {
|
|
101
|
+
enabled: channel.enabled,
|
|
102
|
+
credential: shared.credential,
|
|
103
|
+
region: shared.region,
|
|
104
|
+
logGroup: channel.logGroup,
|
|
105
|
+
logStream: channel.logStream,
|
|
106
|
+
minLevel: channel.minLevel,
|
|
107
|
+
}
|
|
108
|
+
: undefined,
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
function toHttpLogOptions(o) {
|
|
112
|
+
const channel = o.log.http.cloudwatch;
|
|
113
|
+
const shared = o.log.cloudwatch;
|
|
114
|
+
return {
|
|
115
|
+
http: o.log.http.config,
|
|
116
|
+
cloudwatch: channel && shared
|
|
117
|
+
? {
|
|
118
|
+
credential: shared.credential,
|
|
119
|
+
region: shared.region,
|
|
120
|
+
logGroup: channel.logGroup,
|
|
121
|
+
logStream: channel.logStream,
|
|
122
|
+
}
|
|
123
|
+
: undefined,
|
|
124
|
+
};
|
|
125
|
+
}
|
|
126
|
+
let CoreModule = CoreModule_1 = class CoreModule {
|
|
127
|
+
static forRootAsync(options) {
|
|
128
|
+
// fetta asincrona: attende la factory condivisa e ne estrae la porzione
|
|
129
|
+
// richiesta dal singolo sotto-modulo.
|
|
130
|
+
const slice = (map) => ({
|
|
131
|
+
imports: options.imports,
|
|
132
|
+
inject: options.inject,
|
|
133
|
+
useFactory: async (...args) => map(await options.useFactory(...args)),
|
|
134
|
+
});
|
|
135
|
+
return {
|
|
136
|
+
module: CoreModule_1,
|
|
137
|
+
imports: [
|
|
138
|
+
mongoose_1.MongooseModule.forRootAsync({
|
|
139
|
+
imports: [database_1.DatabaseOptionsModule.registerAsync(slice((o) => o.db))],
|
|
140
|
+
inject: [database_1.DatabaseOptionsService],
|
|
141
|
+
useFactory: (dbOptionsService) => dbOptionsService.createOptions(),
|
|
142
|
+
}),
|
|
143
|
+
helper_1.HelperModule.registerAsync(slice(toHelperOptions), true),
|
|
144
|
+
authentication_1.AuthModule.registerAsync(slice((o) => o.auth), true),
|
|
145
|
+
app_cache_1.AppCacheModule.registerAsync(options.cacheEnabled, slice((o) => o.cache), true),
|
|
146
|
+
request_1.RequestModule.registerAsync(slice(toRequestOptions), true),
|
|
147
|
+
response_1.ResponseModule,
|
|
148
|
+
pagination_1.PaginationModule,
|
|
149
|
+
message_1.MessageModule.registerAsync(slice(toMessageOptions), true),
|
|
150
|
+
storage_1.StorageModule.registerAsync(slice((o) => o.storage), true),
|
|
151
|
+
file_1.FileModule.registerAsync(slice((o) => o.files), true),
|
|
152
|
+
logger_1.LoggerModule.registerAsync(slice(toLoggerOptions), true),
|
|
153
|
+
debugger_1.DebuggerModule.registerAsync(slice(toDebuggerOptions), true),
|
|
154
|
+
http_log_1.HttpLogModule.registerAsync(slice(toHttpLogOptions), true),
|
|
155
|
+
error_handler_1.ErrorHandlerModule.registerAsync(slice(toErrorHandlerOptions), true),
|
|
156
|
+
permission_1.PermissionModule,
|
|
157
|
+
role_1.RoleModule,
|
|
158
|
+
login_access_1.LoginAccessModule,
|
|
159
|
+
api_key_1.ApiKeyModule.registerAsync(options.userServiceProvider, slice((o) => o.apiKey), true),
|
|
160
|
+
],
|
|
161
|
+
};
|
|
162
|
+
}
|
|
163
|
+
};
|
|
164
|
+
exports.CoreModule = CoreModule;
|
|
165
|
+
exports.CoreModule = CoreModule = CoreModule_1 = tslib_1.__decorate([
|
|
166
|
+
(0, common_1.Module)({})
|
|
167
|
+
], CoreModule);
|
|
168
|
+
//# sourceMappingURL=core.module.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"core.module.js","sourceRoot":"","sources":["../../../../packages/core/src/core.module.ts"],"names":[],"mappings":";;;;;AAAA,2CAAuD;AACvD,+CAAkD;AAElD,4DAAqD;AACrD,kDAAoD;AACpD,gDAAkF;AAClF,4CAA8D;AAC9D,8CAAuE;AACvE,gDAAmD;AACnD,oDAAuD;AACvD,8CAAuE;AACvE,8CAAiD;AACjD,wCAA2C;AAC3C,4CAAoE;AACpE,gDAA0E;AAC1E,gDAAwE;AACxE,0DAAuF;AACvF,oDAAuD;AACvD,wCAA2C;AAC3C,wDAA0D;AAC1D,8CAAgD;AAOhD,4EAA4E;AAE5E,SAAS,eAAe,CAAC,CAAoB;IAC3C,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC;IACjB,OAAO;QACL,GAAG,EAAE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AAE,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,EAAE,IAAI,CAAC;gBACrD,qBAAY,CAAC,aAAa,CAAC,KAAK,CAAC,eAAe,CAAC,EAAE,IAAI,CAAC;gBACxD,yBAAc,CAAC,aAAa,CAAC,KAAK,CAAC,iBAAiB,CAAC,EAAE,IAAI,CAAC;gBAC5D,wBAAa,CAAC,aAAa,CAAC,KAAK,CAAC,gBAAgB,CAAC,EAAE,IAAI,CAAC;gBAC1D,kCAAkB,CAAC,aAAa,CAAC,KAAK,CAAC,qBAAqB,CAAC,EAAE,IAAI,CAAC;gBACpE,6BAAgB;gBAChB,iBAAU;gBACV,gCAAiB;gBACjB,sBAAY,CAAC,aAAa,CACxB,OAAO,CAAC,mBAAmB,EAC3B,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,EACtB,IAAI,CACL;aACF;SACF,CAAC;IACJ,CAAC;CACF,CAAA;AA/CY,gCAAU;qBAAV,UAAU;IADtB,IAAA,eAAM,EAAC,EAAE,CAAC;GACE,UAAU,CA+CtB"}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import { Provider } from '@nestjs/common';
|
|
2
|
+
import { ModuleMetadata } from '@nestjs/common/interfaces';
|
|
3
|
+
import { AuthenticationModuleOptions } from '@tc-libs/authentication';
|
|
4
|
+
import { AppCacheModuleOptions } from '@tc-libs/app-cache';
|
|
5
|
+
import { DatabaseOptionsConfig } from '@tc-libs/database';
|
|
6
|
+
import { IRequestModuleRequestOptions } from '@tc-libs/request';
|
|
7
|
+
import { FileModuleOptions } from '@tc-libs/file';
|
|
8
|
+
import { StorageModuleOptions } from '@tc-libs/storage';
|
|
9
|
+
import { ApiKeyModuleOptions } from '@tc-libs/api-key';
|
|
10
|
+
import { DebuggerModuleOptions } from '@tc-libs/debugger';
|
|
11
|
+
import { HttpLogModuleOptions } from '@tc-libs/http-log';
|
|
12
|
+
export declare const CORE_MODULE_OPTIONS = "CORE_MODULE_OPTIONS";
|
|
13
|
+
type CloudwatchLevel = 'error' | 'warn' | 'info' | 'debug';
|
|
14
|
+
/**
|
|
15
|
+
* Config unico di CoreModule.
|
|
16
|
+
*
|
|
17
|
+
* Filosofia: pass-through (ogni sotto-modulo mantiene la sua interfaccia
|
|
18
|
+
* esistente) + hoist delle sole duplicazioni reali, raccolte una volta e
|
|
19
|
+
* distribuite ai sotto-moduli dal CoreModule:
|
|
20
|
+
* - `auth` -> authentication + helper
|
|
21
|
+
* - `app` -> request + error-handler (repoVersion, versioning.version)
|
|
22
|
+
* - `languages` -> message + error-handler
|
|
23
|
+
* - `files` -> file + request.file
|
|
24
|
+
* - `log.telegram` -> debugger + logger
|
|
25
|
+
* - `log.cloudwatch` -> debugger + logger + http-log (credenziali + region)
|
|
26
|
+
*/
|
|
27
|
+
export interface CoreModuleOptions {
|
|
28
|
+
app: {
|
|
29
|
+
production: boolean;
|
|
30
|
+
globalPrefix: string;
|
|
31
|
+
repoVersion: string;
|
|
32
|
+
versioning: {
|
|
33
|
+
enable: boolean;
|
|
34
|
+
prefix: string;
|
|
35
|
+
version: string;
|
|
36
|
+
};
|
|
37
|
+
};
|
|
38
|
+
db: DatabaseOptionsConfig;
|
|
39
|
+
cache: AppCacheModuleOptions;
|
|
40
|
+
auth: AuthenticationModuleOptions;
|
|
41
|
+
request: IRequestModuleRequestOptions;
|
|
42
|
+
files: FileModuleOptions;
|
|
43
|
+
storage: StorageModuleOptions;
|
|
44
|
+
languages: {
|
|
45
|
+
default: string;
|
|
46
|
+
available: string[];
|
|
47
|
+
i18nEnabled: boolean;
|
|
48
|
+
};
|
|
49
|
+
log: {
|
|
50
|
+
telegram?: {
|
|
51
|
+
chatId: string;
|
|
52
|
+
apiToken: string;
|
|
53
|
+
};
|
|
54
|
+
cloudwatch?: {
|
|
55
|
+
credential: {
|
|
56
|
+
key: string;
|
|
57
|
+
secret: string;
|
|
58
|
+
};
|
|
59
|
+
region: string;
|
|
60
|
+
};
|
|
61
|
+
debugger: {
|
|
62
|
+
system: DebuggerModuleOptions['system'];
|
|
63
|
+
cloudwatch?: {
|
|
64
|
+
logGroup: string;
|
|
65
|
+
logStream: string;
|
|
66
|
+
minLevel?: CloudwatchLevel;
|
|
67
|
+
};
|
|
68
|
+
};
|
|
69
|
+
logger: {
|
|
70
|
+
telegramEnabled: boolean;
|
|
71
|
+
cloudwatch?: {
|
|
72
|
+
enabled: boolean;
|
|
73
|
+
logGroup: string;
|
|
74
|
+
logStream: string;
|
|
75
|
+
minLevel?: CloudwatchLevel;
|
|
76
|
+
};
|
|
77
|
+
};
|
|
78
|
+
http: {
|
|
79
|
+
config: HttpLogModuleOptions['http'];
|
|
80
|
+
cloudwatch?: {
|
|
81
|
+
logGroup: string;
|
|
82
|
+
logStream: string;
|
|
83
|
+
};
|
|
84
|
+
};
|
|
85
|
+
};
|
|
86
|
+
apiKey: ApiKeyModuleOptions;
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Opzioni di `CoreModule.forRootAsync`.
|
|
90
|
+
*
|
|
91
|
+
* `cacheEnabled` e `userServiceProvider` sono sincroni per necessità:
|
|
92
|
+
* - AppCacheModule decide a bootstrap se montare Redis o cache in-memory;
|
|
93
|
+
* - ApiKeyModule ha bisogno del provider concreto del servizio User dell'app
|
|
94
|
+
* (il pacchetto `user` espone solo interfacce).
|
|
95
|
+
*/
|
|
96
|
+
export interface CoreModuleAsyncOptions {
|
|
97
|
+
imports?: ModuleMetadata['imports'];
|
|
98
|
+
inject?: any[];
|
|
99
|
+
useFactory: (...args: any[]) => Promise<CoreModuleOptions> | CoreModuleOptions;
|
|
100
|
+
cacheEnabled: boolean;
|
|
101
|
+
userServiceProvider: Provider;
|
|
102
|
+
}
|
|
103
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"core.module.options.js","sourceRoot":"","sources":["../../../../packages/core/src/core.module.options.ts"],"names":[],"mappings":";;;AAYa,QAAA,mBAAmB,GAAG,qBAAqB,CAAC"}
|
package/src/index.d.ts
ADDED
package/src/index.js
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
tslib_1.__exportStar(require("./core.module"), exports);
|
|
5
|
+
tslib_1.__exportStar(require("./core.module.options"), exports);
|
|
6
|
+
//# sourceMappingURL=index.js.map
|
package/src/index.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../packages/core/src/index.ts"],"names":[],"mappings":";;;AAAA,wDAA8B;AAC9B,gEAAsC"}
|