sim-node-lib 0.3.16 → 0.3.18

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 CHANGED
@@ -4,9 +4,9 @@ Node commons library to use on SIMlabs projets
4
4
 
5
5
  ## ENVs
6
6
 
7
- | Description/use | Name | Block |
8
- | --------------------------------- | -------------- | ----- |
9
- | Chave para encriptação | AES_SECRET_KEY | Crypt |
7
+ | Description/use | Name | Block |
8
+ | ---------------------- | -------------- | ----- |
9
+ | Chave para encriptação | AES_SECRET_KEY | Crypt |
10
10
 
11
11
  ## Documentation
12
12
 
@@ -17,5 +17,5 @@ All documentation about this library is on Confluence.
17
17
  To publish the library, execute the command below:
18
18
 
19
19
  ```
20
- yarn pub
20
+ yarn pub
21
21
  ```
@@ -1,3 +1,10 @@
1
1
  export declare class UpdateUtil {
2
2
  static updateObjectsWithSameType(mainObj: any, obj: any, type?: any): typeof type;
3
3
  }
4
+ export declare function updateObjectsWithSameType(mainObj: any, obj: any, type?: any): typeof type;
5
+ export declare function flattenObjectIntoNewModel<T>(obj: any, model: {
6
+ new (): any;
7
+ $columnsDefinitions: {
8
+ keys(): IterableIterator<string>;
9
+ };
10
+ }): T;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.UpdateUtil = void 0;
3
+ exports.flattenObjectIntoNewModel = exports.updateObjectsWithSameType = exports.UpdateUtil = void 0;
4
4
  class UpdateUtil {
5
5
  static updateObjectsWithSameType(mainObj, obj, type) {
6
6
  for (let k of Object.keys(obj)) {
@@ -10,3 +10,18 @@ class UpdateUtil {
10
10
  }
11
11
  }
12
12
  exports.UpdateUtil = UpdateUtil;
13
+ function updateObjectsWithSameType(mainObj, obj, type) {
14
+ for (let k of Object.keys(obj)) {
15
+ mainObj[k] = obj[k];
16
+ }
17
+ return mainObj;
18
+ }
19
+ exports.updateObjectsWithSameType = updateObjectsWithSameType;
20
+ function flattenObjectIntoNewModel(obj, model) {
21
+ const flattenedObject = new model();
22
+ for (let key of model.$columnsDefinitions.keys()) {
23
+ flattenedObject[key] = obj[key];
24
+ }
25
+ return flattenedObject;
26
+ }
27
+ exports.flattenObjectIntoNewModel = flattenObjectIntoNewModel;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sim-node-lib",
3
- "version": "0.3.16",
3
+ "version": "0.3.18",
4
4
  "description": "Library from SIMLabs",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",