@denevads/dnv-smo 1.0.37 → 1.0.38

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.
@@ -73,3 +73,10 @@ export interface Recurso {
73
73
  dias: string;
74
74
  nombre: string;
75
75
  }
76
+ export interface Datasource {
77
+ data: string;
78
+ tipo: string;
79
+ }
80
+ export interface DatasourceMap {
81
+ [codigo: string]: Datasource;
82
+ }
package/dist/smo.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { setDatasource, variable, location, DataSalida, ExecFunction, Notify, start, GetRecursosByCodigo, GetRecursos, GetRecursosRelleno, GetRecursosMetadatos, RecursosMetadato } from "./interfaces/callbacks";
1
+ import { setDatasource, variable, location, DataSalida, ExecFunction, Notify, start, GetRecursosByCodigo, GetRecursos, GetRecursosRelleno, GetRecursosMetadatos, RecursosMetadato, DatasourceMap } from "./interfaces/callbacks";
2
2
  import { Subject } from 'rxjs';
3
3
  export declare class SMO {
4
4
  vars: any;
@@ -28,6 +28,7 @@ export declare class SMO {
28
28
  checkHealth(json: string): void;
29
29
  checkHealthPrinter(json: string): void;
30
30
  getValorCalendario(estado: boolean): void;
31
+ getLocalDatasource(data: DatasourceMap): void;
31
32
  }
32
33
  declare class SmoEvents {
33
34
  start: Subject<start>;
@@ -48,6 +49,7 @@ declare class SmoEvents {
48
49
  checkHealth: Subject<string>;
49
50
  checkHealthPrinter: Subject<string>;
50
51
  getValorCalendario: Subject<boolean>;
52
+ getLocalDatasource: Subject<DatasourceMap>;
51
53
  constructor(smo: SMO);
52
54
  }
53
55
  declare class smoCallBacks {
@@ -98,6 +100,12 @@ declare class smoCallBacks {
98
100
  checkHealthPrinter(): void;
99
101
  printImage(image: string): void;
100
102
  getValorCalendario(codigo: number, tipoObjeto?: number): void;
103
+ /**
104
+ * Funcion que permite obtener uno o varios datasources pasando su/sus codigos
105
+ * Permite un solo codigo o un array de codigos
106
+ * @param codDS Puede ser un número o un array de números
107
+ */
108
+ getLocalDatasource(codDS: number | number[]): void;
101
109
  }
102
110
  declare class Utils {
103
111
  smo: SMO;
@@ -127,7 +135,8 @@ export declare enum SMO_EVENT_TYPE {
127
135
  getVariableStorage = "getVariableStorage",
128
136
  checkHealth = "checkHealth",
129
137
  checkHealthPrinter = "checkHealthPrinter",
130
- getValorCalendario = "getValorCalendario"
138
+ getValorCalendario = "getValorCalendario",
139
+ getLocalDatasource = "getLocalDatasource"
131
140
  }
132
141
  export declare enum LogLevel {
133
142
  Debug = 0,
@@ -177,5 +186,6 @@ export interface ObjJSType {
177
186
  checkHealthPrinter: () => void;
178
187
  checkHealth: () => void;
179
188
  getValorCalendario: () => void;
189
+ getLocalDatasource: () => void;
180
190
  }
181
191
  export {};
package/dist/smo.js CHANGED
@@ -108,7 +108,9 @@ var SMO = /** @class */ (function () {
108
108
  // @ts-ignore
109
109
  CheckHealth: window.objJS.checkHealth,
110
110
  // @ts-ignore
111
- getValorCalendario: window.objJS.getValorCalendario
111
+ getValorCalendario: window.objJS.getValorCalendario,
112
+ // @ts-ignore
113
+ getLocalDatasource: window.objJS.getLocalDatasource,
112
114
  };
113
115
  }
114
116
  else {
@@ -216,6 +218,10 @@ var SMO = /** @class */ (function () {
216
218
  selft.getValorCalendario(e.data.objData);
217
219
  return;
218
220
  }
221
+ if (func == SMO_EVENT_TYPE.getLocalDatasource) {
222
+ selft.getLocalDatasource(e.data.objData);
223
+ return;
224
+ }
219
225
  console.warn("message not implemented!!" + func);
220
226
  }
221
227
  };
@@ -272,6 +278,9 @@ var SMO = /** @class */ (function () {
272
278
  SMO.prototype.getValorCalendario = function (estado) {
273
279
  this.events.getValorCalendario.next(estado);
274
280
  };
281
+ SMO.prototype.getLocalDatasource = function (data) {
282
+ this.events.getLocalDatasource.next(data);
283
+ };
275
284
  return SMO;
276
285
  }());
277
286
  exports.SMO = SMO;
@@ -295,6 +304,7 @@ var SmoEvents = /** @class */ (function () {
295
304
  this.checkHealth = new rxjs_1.Subject();
296
305
  this.checkHealthPrinter = new rxjs_1.Subject();
297
306
  this.getValorCalendario = new rxjs_1.Subject();
307
+ this.getLocalDatasource = new rxjs_1.Subject();
298
308
  }
299
309
  return SmoEvents;
300
310
  }());
@@ -668,6 +678,20 @@ var smoCallBacks = /** @class */ (function () {
668
678
  idSmo: this.smo.id
669
679
  }, this.smo.vars.idSmo);
670
680
  };
681
+ /**
682
+ * Funcion que permite obtener uno o varios datasources pasando su/sus codigos
683
+ * Permite un solo codigo o un array de codigos
684
+ * @param codDS Puede ser un número o un array de números
685
+ */
686
+ smoCallBacks.prototype.getLocalDatasource = function (codDS) {
687
+ // Si es un solo código, lo convertimos a un array para tratar ambos casos de la misma manera
688
+ var codDSArray = Array.isArray(codDS) ? codDS : [codDS];
689
+ this.smo.utils.sendToParent({
690
+ target: "Dnv.smoCallbacks.getLocalDatasource",
691
+ objData: codDSArray, // Enviamos el array, sea de un solo código o varios
692
+ idSmo: this.smo.id
693
+ }, this.smo.vars.idSmo);
694
+ };
671
695
  return smoCallBacks;
672
696
  }());
673
697
  var Utils = /** @class */ (function () {
@@ -845,6 +869,7 @@ var SMO_EVENT_TYPE;
845
869
  SMO_EVENT_TYPE["checkHealth"] = "checkHealth";
846
870
  SMO_EVENT_TYPE["checkHealthPrinter"] = "checkHealthPrinter";
847
871
  SMO_EVENT_TYPE["getValorCalendario"] = "getValorCalendario";
872
+ SMO_EVENT_TYPE["getLocalDatasource"] = "getLocalDatasource";
848
873
  })(SMO_EVENT_TYPE || (exports.SMO_EVENT_TYPE = SMO_EVENT_TYPE = {}));
849
874
  var LogLevel;
850
875
  (function (LogLevel) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@denevads/dnv-smo",
3
- "version": "1.0.37",
3
+ "version": "1.0.38",
4
4
  "description": "SMO module",
5
5
  "main": "./src/index.js",
6
6
  "types": "./src/index.d.ts",
@@ -77,4 +77,11 @@ export interface Recurso {
77
77
  dias:string;
78
78
  nombre:string;
79
79
  }
80
+ export interface Datasource{
81
+ data : string;
82
+ tipo: string;
83
+ }
84
+ export interface DatasourceMap {
85
+ [codigo: string]: Datasource; // Cada clave tiene un solo Datasource
86
+ }
80
87
 
package/src/smo.ts CHANGED
@@ -8,7 +8,7 @@ import {
8
8
  start,
9
9
  GetRecursosByCodigo,
10
10
  GetRecursos,
11
- GetRecursosRelleno, GetRecursosMetadatos, RecursosMetadato
11
+ GetRecursosRelleno, GetRecursosMetadatos, RecursosMetadato, Datasource, DatasourceMap
12
12
  } from "./interfaces/callbacks";
13
13
  import {interval, Subject, Subscription} from 'rxjs';
14
14
 
@@ -128,7 +128,9 @@ export class SMO {
128
128
  // @ts-ignore
129
129
  CheckHealth: window.objJS.checkHealth,
130
130
  // @ts-ignore
131
- getValorCalendario: window.objJS.getValorCalendario
131
+ getValorCalendario: window.objJS.getValorCalendario,
132
+ // @ts-ignore
133
+ getLocalDatasource: window.objJS.getLocalDatasource,
132
134
  };
133
135
  }else{
134
136
  console.log("No existe objJS en window");
@@ -168,76 +170,80 @@ export class SMO {
168
170
  initOnMessage():void{
169
171
  let selft = this;
170
172
  window.onmessage = function(e) {
171
- if (e.data.target) {
172
- var targets = e.data.target.split('.');
173
- var func = targets[targets.length-1];
174
- if(func == SMO_EVENT_TYPE.start){
175
- selft.start();
176
- return;
177
- }
178
- if(func == SMO_EVENT_TYPE.setDatasource){
179
- selft.setDatasource(e.data.objData);
180
- return;
181
- }
182
- if(func == SMO_EVENT_TYPE.getVariable){
183
- selft.getVariable(e.data.objData);
184
- return;
185
- }
186
- if(func ==SMO_EVENT_TYPE.setCurrentStream){
187
- selft.setCurrentStream(e.data.objData);
188
- return;
189
- }
190
- if(func==SMO_EVENT_TYPE.infoCurrentLocation){
191
- selft.infoCurrentLocation(e.data.objData);
192
- return;
193
- }
194
- if(func==SMO_EVENT_TYPE.setSalidaData){
195
- selft.setSalidaData(e.data.objData);
196
- return;
197
- }
198
- if(func ==SMO_EVENT_TYPE.updatefromsalida){
199
- selft.updatefromsalida(e.data.objData);
200
- return;
201
- }
202
- if(func == SMO_EVENT_TYPE.getRecursosByCodigo){
203
- selft.getRecursosByCodigo(e.data.objData);
204
- return;
205
- }
206
- if(func == SMO_EVENT_TYPE.getRecursosByMetadato){
207
- selft.getRecursosByMetadato(e.data.objData);
208
- return;
209
- }
210
- if(func == SMO_EVENT_TYPE.getRecursosByMetadatos){
211
- selft.getRecursosByMetadatos(e.data.objData);
212
- return;
213
- }
214
- if(func == SMO_EVENT_TYPE.getRecursos){
215
- selft.getRecursos(e.data.objData);
216
- }
217
- if(func == SMO_EVENT_TYPE.getRecursosDefault){
218
- selft.getRecursosDefault(e.data.objData);
219
- }
220
- if(func == SMO_EVENT_TYPE.getRecursosRelleno){
221
- selft.getRecursosRelleno(e.data.objData);
222
- return;
223
- }
224
- if(func == SMO_EVENT_TYPE.getVariableStorage){
225
- selft.getVariableStorage(e.data.objData);
226
- return;
227
- }
228
- if(func == SMO_EVENT_TYPE.checkHealth){
229
- selft.checkHealth(e.data.objData);
230
- return;
231
- }
232
- if(func == SMO_EVENT_TYPE.checkHealthPrinter){
233
- selft.checkHealthPrinter(e.data.objData);
234
- return;
235
- }
236
- if(func == SMO_EVENT_TYPE.getValorCalendario){
237
- selft.getValorCalendario(e.data.objData);
238
- return;
239
- }
240
- console.warn("message not implemented!!" +func);
173
+ if (e.data.target) {
174
+ var targets = e.data.target.split('.');
175
+ var func = targets[targets.length-1];
176
+ if(func == SMO_EVENT_TYPE.start){
177
+ selft.start();
178
+ return;
179
+ }
180
+ if(func == SMO_EVENT_TYPE.setDatasource){
181
+ selft.setDatasource(e.data.objData);
182
+ return;
183
+ }
184
+ if(func == SMO_EVENT_TYPE.getVariable){
185
+ selft.getVariable(e.data.objData);
186
+ return;
187
+ }
188
+ if(func ==SMO_EVENT_TYPE.setCurrentStream){
189
+ selft.setCurrentStream(e.data.objData);
190
+ return;
191
+ }
192
+ if(func==SMO_EVENT_TYPE.infoCurrentLocation){
193
+ selft.infoCurrentLocation(e.data.objData);
194
+ return;
195
+ }
196
+ if(func==SMO_EVENT_TYPE.setSalidaData){
197
+ selft.setSalidaData(e.data.objData);
198
+ return;
199
+ }
200
+ if(func ==SMO_EVENT_TYPE.updatefromsalida){
201
+ selft.updatefromsalida(e.data.objData);
202
+ return;
203
+ }
204
+ if(func == SMO_EVENT_TYPE.getRecursosByCodigo){
205
+ selft.getRecursosByCodigo(e.data.objData);
206
+ return;
207
+ }
208
+ if(func == SMO_EVENT_TYPE.getRecursosByMetadato){
209
+ selft.getRecursosByMetadato(e.data.objData);
210
+ return;
211
+ }
212
+ if(func == SMO_EVENT_TYPE.getRecursosByMetadatos){
213
+ selft.getRecursosByMetadatos(e.data.objData);
214
+ return;
215
+ }
216
+ if(func == SMO_EVENT_TYPE.getRecursos){
217
+ selft.getRecursos(e.data.objData);
218
+ }
219
+ if(func == SMO_EVENT_TYPE.getRecursosDefault){
220
+ selft.getRecursosDefault(e.data.objData);
221
+ }
222
+ if(func == SMO_EVENT_TYPE.getRecursosRelleno){
223
+ selft.getRecursosRelleno(e.data.objData);
224
+ return;
225
+ }
226
+ if(func == SMO_EVENT_TYPE.getVariableStorage){
227
+ selft.getVariableStorage(e.data.objData);
228
+ return;
229
+ }
230
+ if(func == SMO_EVENT_TYPE.checkHealth){
231
+ selft.checkHealth(e.data.objData);
232
+ return;
233
+ }
234
+ if(func == SMO_EVENT_TYPE.checkHealthPrinter){
235
+ selft.checkHealthPrinter(e.data.objData);
236
+ return;
237
+ }
238
+ if(func == SMO_EVENT_TYPE.getValorCalendario){
239
+ selft.getValorCalendario(e.data.objData);
240
+ return;
241
+ }
242
+ if(func == SMO_EVENT_TYPE.getLocalDatasource){
243
+ selft.getLocalDatasource(e.data.objData);
244
+ return;
245
+ }
246
+ console.warn("message not implemented!!" +func);
241
247
  }
242
248
  }
243
249
  }
@@ -294,6 +300,9 @@ export class SMO {
294
300
  getValorCalendario(estado:boolean):void{
295
301
  this.events.getValorCalendario.next(estado);
296
302
  }
303
+ getLocalDatasource(data: DatasourceMap):void{
304
+ this.events.getLocalDatasource.next(data);
305
+ }
297
306
  }
298
307
 
299
308
  class SmoEvents{
@@ -315,6 +324,7 @@ class SmoEvents{
315
324
  public checkHealth: Subject<string> = new Subject<string>();
316
325
  public checkHealthPrinter: Subject<string> = new Subject<string>();
317
326
  public getValorCalendario: Subject<boolean> = new Subject<boolean>();
327
+ public getLocalDatasource: Subject<DatasourceMap> = new Subject<DatasourceMap>();
318
328
  constructor(smo:SMO){}
319
329
  }
320
330
  class smoCallBacks{
@@ -691,6 +701,21 @@ class smoCallBacks{
691
701
  idSmo: this.smo.id
692
702
  }, this.smo.vars.idSmo);
693
703
  }
704
+ /**
705
+ * Funcion que permite obtener uno o varios datasources pasando su/sus codigos
706
+ * Permite un solo codigo o un array de codigos
707
+ * @param codDS Puede ser un número o un array de números
708
+ */
709
+ getLocalDatasource(codDS: number | number[]): void {
710
+ // Si es un solo código, lo convertimos a un array para tratar ambos casos de la misma manera
711
+ const codDSArray = Array.isArray(codDS) ? codDS : [codDS];
712
+
713
+ this.smo.utils.sendToParent({
714
+ target: "Dnv.smoCallbacks.getLocalDatasource",
715
+ objData: codDSArray, // Enviamos el array, sea de un solo código o varios
716
+ idSmo: this.smo.id
717
+ }, this.smo.vars.idSmo);
718
+ }
694
719
 
695
720
  }
696
721
  class Utils{
@@ -882,7 +907,8 @@ export enum SMO_EVENT_TYPE{
882
907
  getVariableStorage = "getVariableStorage",
883
908
  checkHealth = "checkHealth",
884
909
  checkHealthPrinter = "checkHealthPrinter",
885
- getValorCalendario = "getValorCalendario"
910
+ getValorCalendario = "getValorCalendario",
911
+ getLocalDatasource = "getLocalDatasource"
886
912
  }
887
913
  export enum LogLevel {
888
914
  Debug= 0,
@@ -932,5 +958,6 @@ export interface ObjJSType {
932
958
  checkHealthPrinter: () => void;
933
959
  checkHealth: () => void;
934
960
  getValorCalendario: () => void;
961
+ getLocalDatasource: () => void;
935
962
  }
936
963