@denevads/dnv-smo 1.0.19 → 1.0.21

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
@@ -1,18 +1,80 @@
1
- # DnvSMO
2
- Libreria de conexión con la API de la salida.
1
+ #Introducción
2
+ Librería de interfaz de comunicaciones entre un objeto HTML5 y las funciones de un player de DenevaDS.
3
3
 
4
- ## Conexión con NPM
4
+ Aquí definiremos el uso de la librería y las funciones que la misma provee
5
5
 
6
- Para conexión con NPM se deben de ejecutar los siguientes comandos. La cuenta de login es denevads
7
6
 
7
+ # Instalación
8
+ La librería esta pensada para ser usada junto con Angular, de manera que si no contamos con el cli de angular en el sistema conviene instalarlo para inicializar el proyecto.
9
+ ```sh
10
+ npm install -g @angular/cli
11
+ ```
12
+ Inicializamos un proyecto de prueba llamado html-deneva en la ruta en la que estemos.
13
+ ```sh
14
+ ng new html-deneva
15
+ ```
16
+ Una vez que ya tenemos la estructura básica del proyecto podemos instalar la librería en el proyecto ejecutando la siguiente liena dentro de la carpeta del mismo:
17
+ ```sh
18
+ npm install @denevads/dnv-smo
19
+ ```
8
20
 
9
- npm run build
21
+ # Inicialización
10
22
 
11
- npm login
23
+ Una vez que tengamos el proyecto de angular inicializado, procedemos importar el módulo.
12
24
 
13
- npm publish
25
+ Dentro de la definición del app.module en la carpeta app, importamos la librería.
26
+ ```ts
27
+ import { SMO } from '@denevads/dnv-smo/dist/smo';
28
+ ```
29
+ y lo añadimos como provider en @NgModule
30
+ ```ts
31
+ providers: [SMO]
32
+ ```
14
33
 
15
- ## Instalación.
34
+ Ahora ya solo bastaría con añadirlo al componente del angular y empezar a usarlo.
16
35
 
17
- Para instalar la librería hay que ejecutar: npm install @denevads/dnv-smo
36
+ De nuevo en app.component importamos la librería
37
+ ```js
38
+ import { LogLevel, SMO } from '@denevads/dnv-smo/dist/smo'
39
+ ```
40
+ Y en la exportación de la clase AppComponent añadimos el constructor
41
+ ```js
42
+ constructor(private smo:SMO){ }
43
+ ```
44
+ De esta manera ya tendríamos disponible para su uso todas las llamadas que aporta la librería usando
45
+ ```js
46
+ this.smo.
47
+ ```
48
+ También en la importacion hemos traído la enumeración de los niveles de log, que sirven para loggear en el disco del equipo.
49
+ El uso sería de la siguiente forma.
50
+ ```js
51
+ this.smo.smoCallBacks.smoLog('Mensaje de prueba',LogLevel.Info);
52
+ ```
18
53
 
54
+ # Compilación y empaquetado.
55
+
56
+ Para que el proyecto pueda funcionar en un equipo sin problemas hay que hacer un par de cambios en el código del proyecto por defecto.
57
+
58
+ El primero de ellos es modificar el tsconfig.json para que el "target" sea "ES5" en lugar de "ES2022"
59
+
60
+
61
+ Y el segundo cambio es en archivo de index. Aquí haremos dos cosas.
62
+ -Borraremos la importación del favicon (además de borrarlo de la carpeta de archivos).
63
+ -Y cambiamos la línea
64
+ ```html
65
+ <base href="/">
66
+ ```
67
+ por
68
+ ```html
69
+ <script>document.write('<base href="' + document.location + '" />');</script>
70
+ ```
71
+ Con estos cambios hechos, podemos compilar el proyecto ejecutando la línea
72
+ ```sh
73
+ ng b
74
+ ```
75
+ Esto nos generara una carpeta dist, con el contenido de nuestro HTML5 compilado.
76
+
77
+ Para poder subirlo al player de deneva, simplemente tenemos que crear un zip con el contenido en la raíz, y le cambiaremos la extensión por
78
+ ```sh
79
+ .wgt
80
+ ```
@@ -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",
@@ -698,6 +716,7 @@ var SMO_EVENT_TYPE;
698
716
  SMO_EVENT_TYPE["setSalidaData"] = "setSalidaData";
699
717
  SMO_EVENT_TYPE["updatefromsalida"] = "updatefromsalida";
700
718
  SMO_EVENT_TYPE["setDatasourceJson"] = "setDatasourceJson";
719
+ SMO_EVENT_TYPE["getRecursosByCodigo"] = "getRecursosByCodigo";
701
720
  SMO_EVENT_TYPE["getRecursos"] = "getRecursos";
702
721
  SMO_EVENT_TYPE["getRecursosDefault"] = "getRecursosDefault";
703
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.19",
3
+ "version": "1.0.21",
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",
@@ -738,6 +758,7 @@ export enum SMO_EVENT_TYPE{
738
758
  setSalidaData ="setSalidaData",
739
759
  updatefromsalida = "updatefromsalida",
740
760
  setDatasourceJson = "setDatasourceJson",
761
+ getRecursosByCodigo = "getRecursosByCodigo",
741
762
  getRecursos = "getRecursos",
742
763
  getRecursosDefault = "getRecursosDefault",
743
764
  getRecursosRelleno = "getRecursosRelleno",