@imolko/ultra-ddd 1.0.21-beta → 1.0.22-beta

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.
@@ -1 +1 @@
1
- {"version":3,"file":"track.template.d.ts","sourceRoot":"","sources":["../../../../src/scripts/get-event/templates/track.template.ts"],"names":[],"mappings":"AAAA,QAAA,MAAM,aAAa,EAAE,MAoDpB,CAAC;AAEF,eAAe,aAAa,CAAC"}
1
+ {"version":3,"file":"track.template.d.ts","sourceRoot":"","sources":["../../../../src/scripts/get-event/templates/track.template.ts"],"names":[],"mappings":"AAAA,QAAA,MAAM,aAAa,EAAE,MAwEpB,CAAC;AAEF,eAAe,aAAa,CAAC"}
@@ -7,6 +7,10 @@ const eventPaths: { [key: string]: string } = {
7
7
  // event-path-flag
8
8
  };
9
9
 
10
+ interface SchemifyModel {
11
+ version: string; schema: JsonSchemaForCloudEvent;
12
+ }
13
+
10
14
  export function main() {
11
15
  // flag
12
16
 
@@ -17,15 +21,31 @@ export function main() {
17
21
  console.log('\\\\nEVENTS', events); // Escapar la barra invertida
18
22
 
19
23
  // Esquematizar eventos
20
- const schemify: { [key: string]: { version: string; schema: JsonSchemaForCloudEvent; }[] } = {};
21
- for (const event of events) {
22
- const schemaExe = event.getJsonSchemasForEvolution();
23
- if (schemaExe.isValid()) {
24
- const schemes = schemaExe.getValue();
25
- schemify[event.NAME] = schemes;
24
+ const groupByType = (list: schemifyModel[]): { [key: string]: schemifyModel[] } => {
25
+ const groupedMap: { [key: string]: schemifyModel[] } = {};
26
+ for (const item of list) {
27
+ const typeObject = item.schema.properties.type as {type: string, const: string};
28
+ const type = typeObject.const;
29
+ if (type && typeof type === 'string') {
30
+ groupedMap[type] = groupedMap[type] ? [...groupedMap[type], item] : [item];
31
+ }
32
+ }
33
+ return groupedMap;
34
+ }
35
+ const getGroups = () => {
36
+ let schemify: { [key: string]: SchemifyModel[] } = {};
37
+ for (const event of events) {
38
+ const schemaExe = event.getJsonSchemasForEvolution();
39
+ if (schemaExe.isValid()) {
40
+ const list = schemaExe.getValue();
41
+ const groups = groupByType(list);
42
+ schemify = {...schemify, ...groups}
43
+ }
26
44
  }
45
+ return schemify;
27
46
  }
28
- console.log("\\\\nSCHEMES", schemify); // Escapar la barra invertida
47
+ const schemify = getGroups();
48
+ console.log("\\\\nSCHEMES", schemify);
29
49
 
30
50
  // Obtener la ruta del directorio src
31
51
  const srcFolderPath = path.resolve(__dirname, '..'); // Subir un nivel desde event-schemes
@@ -1 +1 @@
1
- {"version":3,"file":"track.template.js","sourceRoot":"","sources":["../../../../src/scripts/get-event/templates/track.template.ts"],"names":[],"mappings":"AAAA,MAAM,aAAa,GAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAoD7B,CAAC;AAEF,eAAe,aAAa,CAAC"}
1
+ {"version":3,"file":"track.template.js","sourceRoot":"","sources":["../../../../src/scripts/get-event/templates/track.template.ts"],"names":[],"mappings":"AAAA,MAAM,aAAa,GAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAwE7B,CAAC;AAEF,eAAe,aAAa,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"track.template.d.ts","sourceRoot":"","sources":["../../../../src/scripts/get-event/templates/track.template.ts"],"names":[],"mappings":"AAAA,QAAA,MAAM,aAAa,EAAE,MAoDpB,CAAC;AAEF,eAAe,aAAa,CAAC"}
1
+ {"version":3,"file":"track.template.d.ts","sourceRoot":"","sources":["../../../../src/scripts/get-event/templates/track.template.ts"],"names":[],"mappings":"AAAA,QAAA,MAAM,aAAa,EAAE,MAwEpB,CAAC;AAEF,eAAe,aAAa,CAAC"}
@@ -9,6 +9,10 @@ const eventPaths: { [key: string]: string } = {
9
9
  // event-path-flag
10
10
  };
11
11
 
12
+ interface SchemifyModel {
13
+ version: string; schema: JsonSchemaForCloudEvent;
14
+ }
15
+
12
16
  export function main() {
13
17
  // flag
14
18
 
@@ -19,15 +23,31 @@ export function main() {
19
23
  console.log('\\\\nEVENTS', events); // Escapar la barra invertida
20
24
 
21
25
  // Esquematizar eventos
22
- const schemify: { [key: string]: { version: string; schema: JsonSchemaForCloudEvent; }[] } = {};
23
- for (const event of events) {
24
- const schemaExe = event.getJsonSchemasForEvolution();
25
- if (schemaExe.isValid()) {
26
- const schemes = schemaExe.getValue();
27
- schemify[event.NAME] = schemes;
26
+ const groupByType = (list: schemifyModel[]): { [key: string]: schemifyModel[] } => {
27
+ const groupedMap: { [key: string]: schemifyModel[] } = {};
28
+ for (const item of list) {
29
+ const typeObject = item.schema.properties.type as {type: string, const: string};
30
+ const type = typeObject.const;
31
+ if (type && typeof type === 'string') {
32
+ groupedMap[type] = groupedMap[type] ? [...groupedMap[type], item] : [item];
33
+ }
34
+ }
35
+ return groupedMap;
36
+ }
37
+ const getGroups = () => {
38
+ let schemify: { [key: string]: SchemifyModel[] } = {};
39
+ for (const event of events) {
40
+ const schemaExe = event.getJsonSchemasForEvolution();
41
+ if (schemaExe.isValid()) {
42
+ const list = schemaExe.getValue();
43
+ const groups = groupByType(list);
44
+ schemify = {...schemify, ...groups}
45
+ }
28
46
  }
47
+ return schemify;
29
48
  }
30
- console.log("\\\\nSCHEMES", schemify); // Escapar la barra invertida
49
+ const schemify = getGroups();
50
+ console.log("\\\\nSCHEMES", schemify);
31
51
 
32
52
  // Obtener la ruta del directorio src
33
53
  const srcFolderPath = path.resolve(__dirname, '..'); // Subir un nivel desde event-schemes
@@ -1 +1 @@
1
- {"version":3,"file":"track.template.js","sourceRoot":"","sources":["../../../../src/scripts/get-event/templates/track.template.ts"],"names":[],"mappings":";;AAAA,MAAM,aAAa,GAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAoD7B,CAAC;AAEF,kBAAe,aAAa,CAAC"}
1
+ {"version":3,"file":"track.template.js","sourceRoot":"","sources":["../../../../src/scripts/get-event/templates/track.template.ts"],"names":[],"mappings":";;AAAA,MAAM,aAAa,GAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAwE7B,CAAC;AAEF,kBAAe,aAAa,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@imolko/ultra-ddd",
3
- "version": "1.0.21-beta",
3
+ "version": "1.0.22-beta",
4
4
  "description": "",
5
5
  "keywords": [
6
6
  "results",