@denevads/dnv-smo 1.0.18 → 1.0.20

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.
@@ -31,6 +31,9 @@ export interface Notify {
31
31
  destion: string;
32
32
  value: any;
33
33
  }
34
+ export interface GetRecursosByCodigo {
35
+ recursos?: Recurso[];
36
+ }
34
37
  export interface GetRecursos {
35
38
  codigo: number;
36
39
  fechaInicio: string;
package/dist/smo.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { setDatasource, variable, location, DataSalida, ExecFunction, Notify, start, GetRecursos, GetRecursosRelleno } from "./interfaces/callbacks";
1
+ import { setDatasource, variable, location, DataSalida, ExecFunction, Notify, start, GetRecursosByCodigo, GetRecursos, GetRecursosRelleno } from "./interfaces/callbacks";
2
2
  import { Subject } from 'rxjs';
3
3
  export declare class SMO {
4
4
  vars: any;
@@ -18,6 +18,7 @@ export declare class SMO {
18
18
  infoCurrentLocation(location: location): void;
19
19
  setSalidaData(data: DataSalida): void;
20
20
  updatefromsalida(data: any): void;
21
+ getRecursosByCodigo(data: GetRecursosByCodigo): void;
21
22
  getRecursos(data: GetRecursos): void;
22
23
  getRecursosDefault(data: GetRecursos): void;
23
24
  getRecursosRelleno(data: GetRecursosRelleno): void;
@@ -34,6 +35,7 @@ declare class SmoEvents {
34
35
  infoCurrentLocation: Subject<location>;
35
36
  setSalidaData: Subject<DataSalida>;
36
37
  updatefromsalida: Subject<any>;
38
+ getRecursosByCodigo: Subject<GetRecursosByCodigo>;
37
39
  getRecursos: Subject<GetRecursos>;
38
40
  getRecursosDefault: Subject<GetRecursos>;
39
41
  getRecursosRelleno: Subject<GetRecursosRelleno>;
@@ -75,6 +77,7 @@ declare class smoCallBacks {
75
77
  playOnceChannel(codigoCanal: string): void;
76
78
  stopPlayChannel(): void;
77
79
  editWrapperStyle(obj: any): void;
80
+ getRecursosByCodigo(codigos: any): void;
78
81
  getRecursos(): void;
79
82
  getRecursosDefault(): void;
80
83
  getRecursosRelleno(): void;
@@ -105,6 +108,7 @@ export declare enum SMO_EVENT_TYPE {
105
108
  setSalidaData = "setSalidaData",
106
109
  updatefromsalida = "updatefromsalida",
107
110
  setDatasourceJson = "setDatasourceJson",
111
+ getRecursosByCodigo = "getRecursosBycodigo",
108
112
  getRecursos = "getRecursos",
109
113
  getRecursosDefault = "getRecursosDefault",
110
114
  getRecursosRelleno = "getRecursosRelleno",
package/dist/smo.js CHANGED
@@ -195,6 +195,10 @@ var SMO = /** @class */ (function () {
195
195
  selft.updatefromsalida(e.data.objdata);
196
196
  return;
197
197
  }
198
+ if (func == SMO_EVENT_TYPE.getRecursosByCodigo) {
199
+ selft.getRecursosByCodigo(e.data.objData);
200
+ return;
201
+ }
198
202
  if (func == SMO_EVENT_TYPE.getRecursos) {
199
203
  selft.getRecursos(e.data.objData);
200
204
  }
@@ -243,6 +247,9 @@ var SMO = /** @class */ (function () {
243
247
  SMO.prototype.updatefromsalida = function (data) {
244
248
  this.events.updatefromsalida.next(data);
245
249
  };
250
+ SMO.prototype.getRecursosByCodigo = function (data) {
251
+ this.events.getRecursosByCodigo.next(data);
252
+ };
246
253
  SMO.prototype.getRecursos = function (data) {
247
254
  this.events.getRecursos.next(data);
248
255
  };
@@ -274,6 +281,7 @@ var SmoEvents = /** @class */ (function () {
274
281
  this.infoCurrentLocation = new rxjs_1.Subject();
275
282
  this.setSalidaData = new rxjs_1.Subject();
276
283
  this.updatefromsalida = new rxjs_1.Subject();
284
+ this.getRecursosByCodigo = new rxjs_1.Subject();
277
285
  this.getRecursos = new rxjs_1.Subject();
278
286
  this.getRecursosDefault = new rxjs_1.Subject();
279
287
  this.getRecursosRelleno = new rxjs_1.Subject();
@@ -528,6 +536,16 @@ var smoCallBacks = /** @class */ (function () {
528
536
  idSmo: this.smo.id
529
537
  }, "*");
530
538
  };
539
+ smoCallBacks.prototype.getRecursosByCodigo = function (codigos) {
540
+ /** ["123456","654321"] */
541
+ parent.postMessage({
542
+ target: "Dnv.smoCallbacks.getRecursosByCodigo",
543
+ objData: {
544
+ recursos: codigos
545
+ },
546
+ idSmo: this.smo.id
547
+ }, "*");
548
+ };
531
549
  smoCallBacks.prototype.getRecursos = function () {
532
550
  parent.postMessage({
533
551
  target: "Dnv.smoCallbacks.getRecursos",
@@ -626,7 +644,9 @@ var Utils = /** @class */ (function () {
626
644
  // Funciones para XML to JSON
627
645
  Utils.prototype.xmlToJSON = function (xml) {
628
646
  var getxml = new DOMParser();
629
- var xmlDoc = getxml.parseFromString(xml.replace(/\n/g, ''), "text/xml");
647
+ var sinSaltosYTabulaciones = xml.replace(/[\n\r\t]/g, '');
648
+ var sinEspaciosEntreTags = sinSaltosYTabulaciones.replace(/>\s*</g, '><');
649
+ var xmlDoc = getxml.parseFromString(sinEspaciosEntreTags, "text/xml");
630
650
  // gets the JSON string
631
651
  var json_str = this.jsonToStr(this.setJsonObj(xmlDoc));
632
652
  // sets and returns the JSON object, if "rstr" undefined (not passed), else, returns JSON string
@@ -696,6 +716,7 @@ var SMO_EVENT_TYPE;
696
716
  SMO_EVENT_TYPE["setSalidaData"] = "setSalidaData";
697
717
  SMO_EVENT_TYPE["updatefromsalida"] = "updatefromsalida";
698
718
  SMO_EVENT_TYPE["setDatasourceJson"] = "setDatasourceJson";
719
+ SMO_EVENT_TYPE["getRecursosByCodigo"] = "getRecursosBycodigo";
699
720
  SMO_EVENT_TYPE["getRecursos"] = "getRecursos";
700
721
  SMO_EVENT_TYPE["getRecursosDefault"] = "getRecursosDefault";
701
722
  SMO_EVENT_TYPE["getRecursosRelleno"] = "getRecursosRelleno";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@denevads/dnv-smo",
3
- "version": "1.0.18",
3
+ "version": "1.0.20",
4
4
  "description": "SMO module",
5
5
  "main": "./src/index.js",
6
6
  "types": "./src/index.d.ts",
@@ -34,6 +34,9 @@ export interface Notify{
34
34
  destion:string,
35
35
  value:any
36
36
  }
37
+ export interface GetRecursosByCodigo {
38
+ recursos?: Recurso[];
39
+ }
37
40
 
38
41
  export interface GetRecursos {
39
42
  codigo: number;
package/src/smo.ts CHANGED
@@ -6,7 +6,9 @@ import {
6
6
  ExecFunction,
7
7
  Notify,
8
8
  start,
9
- GetRecursos, GetRecursosRelleno
9
+ GetRecursosByCodigo,
10
+ GetRecursos,
11
+ GetRecursosRelleno
10
12
  } from "./interfaces/callbacks";
11
13
  import {interval, Subject, Subscription} from 'rxjs';
12
14
  interface Window {
@@ -222,6 +224,10 @@ export class SMO {
222
224
  selft.updatefromsalida(e.data.objdata);
223
225
  return;
224
226
  }
227
+ if(func == SMO_EVENT_TYPE.getRecursosByCodigo){
228
+ selft.getRecursosByCodigo(e.data.objData);
229
+ return;
230
+ }
225
231
  if(func == SMO_EVENT_TYPE.getRecursos){
226
232
  selft.getRecursos(e.data.objData);
227
233
  }
@@ -271,6 +277,9 @@ export class SMO {
271
277
  updatefromsalida(data:any):void{
272
278
  this.events.updatefromsalida.next(data);
273
279
  }
280
+ getRecursosByCodigo(data:GetRecursosByCodigo):void{
281
+ this.events.getRecursosByCodigo.next(data);
282
+ }
274
283
  getRecursos(data:GetRecursos):void{
275
284
  this.events.getRecursos.next(data);
276
285
  }
@@ -300,6 +309,7 @@ class SmoEvents{
300
309
  public infoCurrentLocation: Subject<location> = new Subject<location>();
301
310
  public setSalidaData: Subject<DataSalida> = new Subject<DataSalida>();
302
311
  public updatefromsalida: Subject<any> = new Subject<any>();
312
+ public getRecursosByCodigo: Subject<GetRecursosByCodigo> = new Subject<GetRecursosByCodigo>();
303
313
  public getRecursos: Subject<GetRecursos> = new Subject<GetRecursos>();
304
314
  public getRecursosDefault: Subject<GetRecursos> = new Subject<GetRecursos>();
305
315
  public getRecursosRelleno: Subject<GetRecursosRelleno> = new Subject<GetRecursosRelleno>();
@@ -557,6 +567,16 @@ class smoCallBacks{
557
567
  idSmo: this.smo.id
558
568
  }, "*");
559
569
  }
570
+ getRecursosByCodigo(codigos: any):void{
571
+ /** ["123456","654321"] */
572
+ parent.postMessage({
573
+ target: "Dnv.smoCallbacks.getRecursosByCodigo",
574
+ objData: {
575
+ recursos : codigos
576
+ },
577
+ idSmo: this.smo.id
578
+ }, "*");
579
+ }
560
580
  getRecursos():void{
561
581
  parent.postMessage({
562
582
  target: "Dnv.smoCallbacks.getRecursos",
@@ -657,7 +677,9 @@ class Utils{
657
677
  // Funciones para XML to JSON
658
678
  xmlToJSON(xml:string) {
659
679
  let getxml = new DOMParser();
660
- let xmlDoc = getxml.parseFromString(xml.replace(/\n/g, ''),"text/xml");
680
+ let sinSaltosYTabulaciones = xml.replace(/[\n\r\t]/g, '');
681
+ let sinEspaciosEntreTags = sinSaltosYTabulaciones.replace(/>\s*</g, '><');
682
+ let xmlDoc = getxml.parseFromString(sinEspaciosEntreTags,"text/xml");
661
683
  // gets the JSON string
662
684
  let json_str = this.jsonToStr(this.setJsonObj(xmlDoc));
663
685
  // sets and returns the JSON object, if "rstr" undefined (not passed), else, returns JSON string
@@ -736,6 +758,7 @@ export enum SMO_EVENT_TYPE{
736
758
  setSalidaData ="setSalidaData",
737
759
  updatefromsalida = "updatefromsalida",
738
760
  setDatasourceJson = "setDatasourceJson",
761
+ getRecursosByCodigo = "getRecursosBycodigo",
739
762
  getRecursos = "getRecursos",
740
763
  getRecursosDefault = "getRecursosDefault",
741
764
  getRecursosRelleno = "getRecursosRelleno",