@ti-engine/core 1.3.12 → 1.4.1
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/CHANGELOG.md +36 -1
- package/bin/localization/labels.json +12 -0
- package/bin/start-instance.js +1 -1
- package/components/auditing.js +47 -22
- package/components/connection-observer.js +2 -2
- package/components/definitions.types.js +248 -0
- package/components/exchange/message-dispatcher.js +1 -1
- package/components/exchange/message-exchange.js +6 -30
- package/components/exchange/message-handler.js +2 -2
- package/components/exchange/message-memory-cache.js +1 -1
- package/components/exchange/message-observer.js +2 -2
- package/components/exchange/message-receiver.js +2 -2
- package/components/exchange/message-sender.js +2 -2
- package/components/exchange/message-tracer.js +4 -27
- package/components/service-caller.js +1 -40
- package/components/service-consumer.js +1 -1
- package/components/service-executor.js +1 -16
- package/components/service-instance.js +4 -9
- package/components/service-provider.js +9 -8
- package/integrations/redis-integration.js +8 -13
- package/package.json +8 -10
- package/utils/cache.js +57 -12
- package/utils/config.js +103 -200
- package/utils/exceptions.js +37 -20
- package/utils/localization.js +2 -17
- package/utils/logger.js +5 -8
- package/utils/tools.js +5 -20
- package/integrations/gcloud-integration.js +0 -65
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* The ti-engine is an open source, free to use—both for personal and commercial projects—framework for the creation of microservice-based solutions using node.js.
|
|
3
|
-
* Copyright © 2021-2025 Boris Kostadinov <kostadinov.boris@gmail.com>
|
|
4
|
-
* This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
|
|
5
|
-
* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
|
6
|
-
* You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
7
|
-
*/
|
|
8
|
-
|
|
9
|
-
const config = require( "#config" );
|
|
10
|
-
const tools = require( "#tools" );
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* Used to verify if the GCloud integration is enabled.
|
|
14
|
-
*
|
|
15
|
-
* @method
|
|
16
|
-
* @returns {boolean}
|
|
17
|
-
* @public
|
|
18
|
-
*/
|
|
19
|
-
module.exports.isEnabled = () => {
|
|
20
|
-
return tools.toBool( process.env.TI_GCLOUD_ENABLED );
|
|
21
|
-
};
|
|
22
|
-
|
|
23
|
-
/**
|
|
24
|
-
* Will be used to gracefully shut down the instance.
|
|
25
|
-
* <br/>
|
|
26
|
-
* NOTE: Will be overridden below after the instance creation.
|
|
27
|
-
*
|
|
28
|
-
* @method
|
|
29
|
-
* @param {Error} error
|
|
30
|
-
* @abstract
|
|
31
|
-
* @public
|
|
32
|
-
*/
|
|
33
|
-
module.exports.reportError = ( error ) => {
|
|
34
|
-
console.error( "Attempting to report error to GCloud while integration to it is disabled!" );
|
|
35
|
-
};
|
|
36
|
-
|
|
37
|
-
if ( process.env.TI_GCLOUD_ENABLED === true ) {
|
|
38
|
-
const { ErrorReporting } = require( "@google-cloud/error-reporting" );
|
|
39
|
-
|
|
40
|
-
const errorReporting = new ErrorReporting( {
|
|
41
|
-
projectId: config.getSetting( config.setting.GCLOUD_PROJECT_ID ),
|
|
42
|
-
key: config.getSetting( config.setting.GCLOUD_API_KEY ),
|
|
43
|
-
reportMode: "production",
|
|
44
|
-
logLevel: 2,
|
|
45
|
-
reportUnhandledRejections: true
|
|
46
|
-
} );
|
|
47
|
-
|
|
48
|
-
/**
|
|
49
|
-
* Reports an error to the GCloud error reporting system.
|
|
50
|
-
*
|
|
51
|
-
* @method
|
|
52
|
-
* @param {Error} error
|
|
53
|
-
* @override
|
|
54
|
-
* @public
|
|
55
|
-
*/
|
|
56
|
-
module.exports.reportError = ( error ) => {
|
|
57
|
-
errorReporting.report( {
|
|
58
|
-
eventTime: ( new Date() ).toISOString(),
|
|
59
|
-
message: error.stack,
|
|
60
|
-
serviceContext: {
|
|
61
|
-
service: process.env.TI_INSTANCE_ID
|
|
62
|
-
}
|
|
63
|
-
} );
|
|
64
|
-
};
|
|
65
|
-
}
|