@ti-engine/core 1.3.10 → 1.3.11

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 CHANGED
@@ -2,6 +2,10 @@
2
2
 
3
3
  This document will contain the list of changes made to the framework. The format is based on the [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/) specification.
4
4
 
5
+ ## Version 1.3.11
6
+ * feat(tools): add `arrayUniques` method to the tools module that helps extract only the unique array values
7
+ * fix(start instance): fix `undefined` instance ID in the log message about starting the instance
8
+
5
9
  ## Version 1.3.10
6
10
  * chore: fix various minor issues reported by the linter
7
11
  * build(npm): add more information and options to the `package.json` file
@@ -121,8 +121,6 @@ process.on( "uncaughtException", ( error ) => {
121
121
 
122
122
  // Start the instance:
123
123
  try {
124
- logger.log( `Starting new instance of type '${ process.env.TI_INSTANCE_NAME }' with instance ID '${ process.env.TI_INSTANCE_ID }'.`, logger.logSeverity.NOTICE );
125
-
126
124
  const serviceConstructor = require( path.join( process.cwd(), process.env.TI_INSTANCE_CLASS ) );
127
125
  const serviceConfigPath = process.env.TI_INSTANCE_CONFIG;
128
126
  /** @type ServiceConfiguration */
@@ -144,6 +142,7 @@ try {
144
142
  };
145
143
 
146
144
  if ( mainInstance.isServiceInstance ) {
145
+ logger.log( `Starting new instance of type '${ process.env.TI_INSTANCE_NAME }' with instance ID '${ process.env.TI_INSTANCE_ID }'.`, logger.logSeverity.NOTICE );
147
146
  mainInstance.start().catch( ( error ) => {
148
147
  logger.log( `Error detected during instance '${ process.env.TI_INSTANCE_ID }' startup!`, logger.logSeverity.ALERT, error );
149
148
  setImmediate( () => process.exit( 1 ) );
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ti-engine/core",
3
- "version": "1.3.10",
3
+ "version": "1.3.11",
4
4
  "description": "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.",
5
5
  "keywords": [
6
6
  "microservices",
package/utils/tools.js CHANGED
@@ -199,6 +199,24 @@ module.exports.toBool = ( value ) => {
199
199
  return result;
200
200
  };
201
201
 
202
+ /**
203
+ * Used to fetch only the unique values from the provided array.
204
+ * <br/>
205
+ * Note: For objects and arrays, uniqueness is determined by reference equality. Primitives are compared by their value.
206
+ *
207
+ * @method
208
+ * @param {Array} array
209
+ * @returns {Array}
210
+ * @throws {TypeError} If the provided parameter is not an array
211
+ * @public
212
+ */
213
+ module.exports.arrayUniques = ( array ) => {
214
+ if ( !Array.isArray( array ) ) {
215
+ throw new TypeError( "Expected an array" );
216
+ }
217
+ return [ ...new Set( array ) ];
218
+ };
219
+
202
220
  /**
203
221
  * Will return a UTC date string in format YYYY-MM-DD from the provided date.
204
222
  *