@ygracs/xepg-lib-js 0.0.23 → 0.0.24
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/CHANGELOG.md +24 -0
- package/README.md +9 -3
- package/doc/xepgdoc-lib.md +111 -18
- package/index.js +6 -5
- package/lib/dts-helper.js +7 -7
- package/lib/xepgdoc-lib.js +341 -183
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,27 @@
|
|
|
1
|
+
#### *v0.0.24*
|
|
2
|
+
|
|
3
|
+
Pre-release version.
|
|
4
|
+
|
|
5
|
+
> - update `xepgdoc-lib.md`;
|
|
6
|
+
> - update dependency on `@ygracs/dtf-lib-js` module to v0.0.29;
|
|
7
|
+
> - update dependency on `@ygracs/xobj-lib-js` module to v0.2.3;
|
|
8
|
+
> - (`TXEpgContentProvider`) add new properties: `schedules`;
|
|
9
|
+
> - (`TXEpgContentProvider`) deprecate properties: `SchedulesList`;
|
|
10
|
+
> - (`TXEpgContentProvider`) remove deprecated methods: `loadFromString`;
|
|
11
|
+
> - (`TXEpgHeaderContainer`) add new methods: `loadFromXMLString`;
|
|
12
|
+
> - (`TXEpgHeaderContainer`) deprecate methods: `setProviderInfo`;
|
|
13
|
+
> - (`TXEpgProviderContainer`) add new methods: `loadFromXMLString`;
|
|
14
|
+
> - (`TXEpgSchedulesList`) change constructor behavior on handling params (*see docs for details*);
|
|
15
|
+
> - (`TXEpgSchedulesList`) add new properties: `count`;
|
|
16
|
+
> - (`TXEpgSchedulesList`) deprecate properties: `schedQty`;
|
|
17
|
+
> - (`TXEpgSchedulesList`) add new methods: `isEmpty`, `isNotEmpty`;
|
|
18
|
+
> - (`TXEpgSchedulesList`) deprecate methods: `hasNoSchedules`, `hasSchedules`;
|
|
19
|
+
> - (`TXEpgSchedulesList`) remove deprecated methods: `chkScheduleIndex`;
|
|
20
|
+
> - (`TXEpgSchedulesList`) add iterator method;
|
|
21
|
+
> - (`TXEpgScheduleItem`) change constructor behavior on handling params (*see docs for details*);
|
|
22
|
+
> - (`TXEpgScheduleItem`) add new methods: `loadFromXMLString`;
|
|
23
|
+
> - other fixes.
|
|
24
|
+
|
|
1
25
|
#### *v0.0.23*
|
|
2
26
|
|
|
3
27
|
Pre-release version.
|
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
|***rev.*:**|0.0.
|
|
1
|
+
|***rev.*:**|0.0.10|
|
|
2
2
|
|:---|---:|
|
|
3
|
-
|***date***:|2025-
|
|
3
|
+
|***date***:|2025-07-30|
|
|
4
4
|
|
|
5
5
|
## Introduction
|
|
6
6
|
|
|
@@ -12,10 +12,16 @@ This module provide a base functionality for handling an EPG-sources based on XE
|
|
|
12
12
|
|
|
13
13
|
This module contains the following components:
|
|
14
14
|
|
|
15
|
-
### 1. a set of XEPG-document constants and components
|
|
15
|
+
### 1. a set of XEPG-document constants, functions and components
|
|
16
16
|
|
|
17
17
|
- constants:
|
|
18
18
|
|
|
19
|
+
- functions:
|
|
20
|
+
|
|
21
|
+
+ `readAsTagName`;
|
|
22
|
+
+ `readAsAttrName`;
|
|
23
|
+
+ `valueToElementID`;
|
|
24
|
+
|
|
19
25
|
- classes:
|
|
20
26
|
|
|
21
27
|
+ `TXEpgScheduleItem`;
|
package/doc/xepgdoc-lib.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
|***rev.*:**|0.1.
|
|
1
|
+
|***rev.*:**|0.1.40|
|
|
2
2
|
|:---|---:|
|
|
3
|
-
|***date***:|2025-
|
|
3
|
+
|***date***:|2025-07-30|
|
|
4
4
|
|
|
5
5
|
## Introduction
|
|
6
6
|
|
|
@@ -115,14 +115,19 @@ This class provides a functionality for handle an EPG-schedule element.
|
|
|
115
115
|
|
|
116
116
|
The class constructor creates a new instance of the class.
|
|
117
117
|
|
|
118
|
+
##### syntax
|
|
119
|
+
|
|
120
|
+
`new TXEpgScheduleItem(object[, options[, extra]])`
|
|
121
|
+
|
|
118
122
|
##### constructor parameters
|
|
119
123
|
|
|
120
124
|
The class constructor receives arguments listed below:
|
|
121
125
|
|
|
122
126
|
| parameter name | value type | default value | description |
|
|
123
127
|
|:---|---|---:|:---|
|
|
124
|
-
|
|
125
|
-
|
|
128
|
+
| `object` | `object` | --- | a host object|
|
|
129
|
+
| `options` | `object` | --- | an options settings|
|
|
130
|
+
| `extra` | `object` | --- | \[*since: `v0.0.24`*] an extra options settings |
|
|
126
131
|
|
|
127
132
|
#### class properties
|
|
128
133
|
|
|
@@ -232,6 +237,25 @@ This method tries to set a schedule description. If succeed `true` returned.
|
|
|
232
237
|
|
|
233
238
|
This method saves an element content to a string in an XML-format.
|
|
234
239
|
|
|
240
|
+
#### class methods (*experimental*)
|
|
241
|
+
|
|
242
|
+
> Note: Purpose of those methods will be discussed and some may be deprecate and make obsolete or functionality may be altered. So use it with cautions in mind.
|
|
243
|
+
|
|
244
|
+
<a name="TXEpgScheduleItem+loadFromXMLString"></a>
|
|
245
|
+
##### **loadFromXMLString(str)** => `boolean`
|
|
246
|
+
|
|
247
|
+
> since: `v0.0.24`
|
|
248
|
+
|
|
249
|
+
This method loads an element content from a string given by a `str` parameter.
|
|
250
|
+
|
|
251
|
+
| parameter name | value type | default value | description |
|
|
252
|
+
|:---|---|---:|:---|
|
|
253
|
+
| `str` | `string` | --- | some content |
|
|
254
|
+
|
|
255
|
+
###### *exceptions*
|
|
256
|
+
|
|
257
|
+
This methods throws `Error` if something goes wrong through a parsing process of a string.
|
|
258
|
+
|
|
235
259
|
<a name="TXEpgSchedulesList"></a>
|
|
236
260
|
### **TXEpgSchedulesList**
|
|
237
261
|
|
|
@@ -241,20 +265,32 @@ This class provides a functionality for handle an EPG-schedules list.
|
|
|
241
265
|
|
|
242
266
|
The class constructor creates a new instance of the class.
|
|
243
267
|
|
|
268
|
+
##### syntax
|
|
269
|
+
|
|
270
|
+
`new TXEpgSchedulesList(object[, options[, extra]])`
|
|
271
|
+
|
|
244
272
|
##### constructor parameters
|
|
245
273
|
|
|
246
274
|
The class constructor receives arguments listed below:
|
|
247
275
|
|
|
248
276
|
| parameter name | value type | default value | description |
|
|
249
277
|
|:---|---|---:|:---|
|
|
250
|
-
|
|
251
|
-
|
|
278
|
+
| `object` | `array` | --- | a host object |
|
|
279
|
+
| `options` | `object` | --- | an options settings |
|
|
280
|
+
| `extra` | `object` | --- | \[*since: `v0.0.24`*] an extra options settings |
|
|
252
281
|
|
|
253
282
|
#### class properties
|
|
254
283
|
|
|
255
284
|
<a name="TXEpgSchedulesList+schedQty"></a>
|
|
256
285
|
##### **schedQty**
|
|
257
286
|
|
|
287
|
+
> \[!] NOTE: `[since v0.0.24]` deprecated. Use [`count` property](#TXEpgSchedulesList+count) instead.
|
|
288
|
+
|
|
289
|
+
<a name="TXEpgSchedulesList+count"></a>
|
|
290
|
+
##### **count**
|
|
291
|
+
|
|
292
|
+
> since: \[`v0.0.24`]
|
|
293
|
+
|
|
258
294
|
| property type | read only | description |
|
|
259
295
|
|---|---|:---|
|
|
260
296
|
| `number` | yes | contains a quantity of the elements the container holds |
|
|
@@ -278,16 +314,26 @@ The class constructor receives arguments listed below:
|
|
|
278
314
|
<a name="TXEpgSchedulesList+hasNoSchedules"></a>
|
|
279
315
|
##### **hasNoSchedules()** => `boolean`
|
|
280
316
|
|
|
317
|
+
> \[!] NOTE: `[since v0.0.24]` deprecated. Use [`isEmpty` method](#TXEpgSchedulesList+isEmpty) instead.
|
|
318
|
+
|
|
319
|
+
<a name="TXEpgSchedulesList+isEmpty"></a>
|
|
320
|
+
##### **isEmpty()** => `boolean`
|
|
321
|
+
|
|
322
|
+
> since: `v0.0.24`
|
|
323
|
+
|
|
281
324
|
This method returns `true` if a document contains no schedules.
|
|
282
325
|
|
|
283
326
|
<a name="TXEpgSchedulesList+hasSchedules"></a>
|
|
284
327
|
##### **hasSchedules()** => `boolean`
|
|
285
328
|
|
|
286
|
-
|
|
329
|
+
> \[!] NOTE: `[since v0.0.24]` deprecated. Use [`isNotEmpty` method](#TXEpgSchedulesList+isNotEmpty) instead.
|
|
287
330
|
|
|
288
|
-
|
|
331
|
+
<a name="TXEpgSchedulesList+isNotEmpty"></a>
|
|
332
|
+
##### **isNotEmpty()** => `boolean`
|
|
289
333
|
|
|
290
|
-
>
|
|
334
|
+
> since: `v0.0.24`
|
|
335
|
+
|
|
336
|
+
This method returns `true` if a document contains at least one schedule.
|
|
291
337
|
|
|
292
338
|
<a name="TXEpgSchedulesList+chkIndex"></a>
|
|
293
339
|
##### **chkIndex(value)** => `boolean`
|
|
@@ -338,14 +384,18 @@ This class implements a structure that holds an information about a program prov
|
|
|
338
384
|
|
|
339
385
|
The class constructor creates a new instance of the class.
|
|
340
386
|
|
|
387
|
+
##### syntax
|
|
388
|
+
|
|
389
|
+
`new TXEpgProviderContainer(object[, options])`
|
|
390
|
+
|
|
341
391
|
##### constructor parameters
|
|
342
392
|
|
|
343
|
-
The class constructor receives arguments listed below:
|
|
393
|
+
The class constructor receives an arguments listed below:
|
|
344
394
|
|
|
345
|
-
|name|type|default value|description|
|
|
395
|
+
| parameter name | value type | default value | description |
|
|
346
396
|
|:---|---|---:|:---|
|
|
347
|
-
|
|
348
|
-
|
|
397
|
+
| `object` | `object` | --- | a host object |
|
|
398
|
+
| `options` | `object` | --- | an option settings |
|
|
349
399
|
|
|
350
400
|
The `options` structure is listed below:
|
|
351
401
|
|
|
@@ -422,6 +472,25 @@ This method loads information about content provider.
|
|
|
422
472
|
|
|
423
473
|
This method saves an element content to a string.
|
|
424
474
|
|
|
475
|
+
#### class methods (*experimental*)
|
|
476
|
+
|
|
477
|
+
> Note: Purpose of those methods will be discussed and some may be deprecate and make obsolete or functionality may be altered. So use it with cautions in mind.
|
|
478
|
+
|
|
479
|
+
<a name="TXEpgProviderContainer+loadFromXMLString"></a>
|
|
480
|
+
##### **loadFromXMLString(str)** => `boolean`
|
|
481
|
+
|
|
482
|
+
> since: `v0.0.24`
|
|
483
|
+
|
|
484
|
+
This method loads an element content from a string given by a `str` parameter.
|
|
485
|
+
|
|
486
|
+
| parameter name | value type | default value | description |
|
|
487
|
+
|:---|---|---:|:---|
|
|
488
|
+
| `str` | `string` | --- | some content |
|
|
489
|
+
|
|
490
|
+
###### *exceptions*
|
|
491
|
+
|
|
492
|
+
This methods throws `Error` if something goes wrong through a parsing process of a string.
|
|
493
|
+
|
|
425
494
|
#### class methods (*special*)
|
|
426
495
|
|
|
427
496
|
##### **init()**
|
|
@@ -667,7 +736,7 @@ An object contains the following fields:
|
|
|
667
736
|
<a name="TXEpgHeaderContainer+setChannelInfo"></a>
|
|
668
737
|
##### **setChannelInfo(obj)** => `void`
|
|
669
738
|
|
|
670
|
-
> \[!] WARNING: `[since v0.0.22]` deprecated.
|
|
739
|
+
> \[!] WARNING: `[since v0.0.22]` deprecated. Use [`TXEpgChannelContainer.setInfo()`](#TXEpgChannelContainer+setInfo) instead.
|
|
671
740
|
|
|
672
741
|
This method fills a channel information with a given data.
|
|
673
742
|
|
|
@@ -701,6 +770,8 @@ This method returns an object which contains an information about document provi
|
|
|
701
770
|
|
|
702
771
|
##### **setProviderInfo(obj)**
|
|
703
772
|
|
|
773
|
+
> \[!] WARNING: `[since v0.0.24]` deprecated. Use [`TXEpgProviderContainer.setInfo()`](#TXEpgProviderContainer+setInfo) instead.
|
|
774
|
+
|
|
704
775
|
<a name="TXEpgHeaderContainer+saveToXMLString"></a>
|
|
705
776
|
##### **saveToXMLString()** => `string`
|
|
706
777
|
|
|
@@ -708,6 +779,25 @@ This method returns an object which contains an information about document provi
|
|
|
708
779
|
|
|
709
780
|
This method saves an element content to a string.
|
|
710
781
|
|
|
782
|
+
#### class methods (*experimental*)
|
|
783
|
+
|
|
784
|
+
> Note: Purpose of those methods will be discussed and some may be deprecate and make obsolete or functionality may be altered. So use it with cautions in mind.
|
|
785
|
+
|
|
786
|
+
<a name="TXEpgHeaderContainer+loadFromXMLString"></a>
|
|
787
|
+
##### **loadFromXMLString(str)** => `boolean`
|
|
788
|
+
|
|
789
|
+
> since: `v0.0.24`
|
|
790
|
+
|
|
791
|
+
This method loads an element content from a string given by a `str` parameter.
|
|
792
|
+
|
|
793
|
+
| parameter name | value type | default value | description |
|
|
794
|
+
|:---|---|---:|:---|
|
|
795
|
+
| `str` | `string` | --- | some content |
|
|
796
|
+
|
|
797
|
+
###### *exceptions*
|
|
798
|
+
|
|
799
|
+
This methods throws `Error` if something goes wrong through a parsing process of a string.
|
|
800
|
+
|
|
711
801
|
<a name="TXEpgContentProvider"></a>
|
|
712
802
|
### **TXEpgContentProvider**
|
|
713
803
|
|
|
@@ -770,6 +860,13 @@ The `options` structure is listed below:
|
|
|
770
860
|
<a name="TXEpgContentProvider+SchedulesList"></a>
|
|
771
861
|
##### **SchedulesList**
|
|
772
862
|
|
|
863
|
+
> \[!] NOTE: `[since v0.0.24]` deprecated. Use [`schedules` property](#TXEpgContentProvider+schedules) instead.
|
|
864
|
+
|
|
865
|
+
<a name="TXEpgContentProvider+schedules"></a>
|
|
866
|
+
##### **schedules**
|
|
867
|
+
|
|
868
|
+
> since: `v0.0.24`
|
|
869
|
+
|
|
773
870
|
| property type | read only | description |
|
|
774
871
|
|---|---|:---|
|
|
775
872
|
| `TXEpgSchedulesList` | yes | returns a `TXEpgSchedulesList` instance |
|
|
@@ -790,10 +887,6 @@ This method saves a document content into a file addressed by `src`.
|
|
|
790
887
|
|:---|---|---:|:---|
|
|
791
888
|
| `src` | `string` | --- | path to a file |
|
|
792
889
|
|
|
793
|
-
##### **loadFromString(xmlString, options)** => `boolean`
|
|
794
|
-
|
|
795
|
-
> WARNING: This method deprecated (*since `v0.0.18`*). Use `loadFromXMLString` instead.
|
|
796
|
-
|
|
797
890
|
<a name="TXEpgContentProvider+loadFromXMLString"></a>
|
|
798
891
|
##### **loadFromXMLString(str)** => `boolean`
|
|
799
892
|
|
package/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// [v0.
|
|
1
|
+
// [v0.1.011-20250727]
|
|
2
2
|
|
|
3
3
|
// === module init block ===
|
|
4
4
|
|
|
@@ -6,7 +6,7 @@ const xepgdoc = require('./lib/xepgdoc-lib.js');
|
|
|
6
6
|
|
|
7
7
|
const xObj = require('@ygracs/xobj-lib-js');
|
|
8
8
|
|
|
9
|
-
// === module
|
|
9
|
+
// === module inner block ===
|
|
10
10
|
|
|
11
11
|
// === module main block ===
|
|
12
12
|
|
|
@@ -20,8 +20,9 @@ module.exports.TXEpgDTSProvider = xepgdoc.TXEpgDTSProvider;
|
|
|
20
20
|
module.exports.TXEpgProviderContainer = xepgdoc.TXEpgProviderContainer;
|
|
21
21
|
module.exports.TXEpgHeaderContainer = xepgdoc.TXEpgHeaderContainer;
|
|
22
22
|
|
|
23
|
+
module.exports.readAsTagName = xepgdoc.readAsTagName;
|
|
24
|
+
module.exports.readAsAttrName = xepgdoc.readAsAttrName;
|
|
25
|
+
module.exports.valueToElementID = xepgdoc.valueToElementID;
|
|
26
|
+
|
|
23
27
|
// re-export stuff from `@ygracs/xobj-lib-js` module
|
|
24
28
|
module.exports.TXmlContentParseOptions = xObj.TXmlContentParseOptions;
|
|
25
|
-
|
|
26
|
-
/**/// will deprecate
|
|
27
|
-
module.exports.TXepgDTSProvider = xepgdoc.TXepgDTSProvider;
|
package/lib/dts-helper.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// [v0.1.
|
|
1
|
+
// [v0.1.048-20250727]
|
|
2
2
|
|
|
3
3
|
// === module init block ===
|
|
4
4
|
|
|
@@ -30,10 +30,10 @@ const def_dts_param = [
|
|
|
30
30
|
*/
|
|
31
31
|
|
|
32
32
|
/**
|
|
33
|
+
* Checks if a given value is a valid dtstype ID
|
|
33
34
|
* @function chkDTSysID
|
|
34
35
|
* @param {(number|string)} value - value to verify
|
|
35
36
|
* @returns {boolean}
|
|
36
|
-
* @description Checs if a given value is a valid dtstype ID
|
|
37
37
|
*/
|
|
38
38
|
function chkDTSysID(value) {
|
|
39
39
|
const _value = valueToIndex(value);
|
|
@@ -41,10 +41,10 @@ function chkDTSysID(value) {
|
|
|
41
41
|
};
|
|
42
42
|
|
|
43
43
|
/**
|
|
44
|
+
* Returns a dtstype name by a given dtstype ID
|
|
44
45
|
* @function getDTSysName
|
|
45
46
|
* @param {(number|string)} value - DTS-type identifier
|
|
46
47
|
* @returns {string}
|
|
47
|
-
* @description Returns a dtstype name by a given dtstype ID
|
|
48
48
|
*/
|
|
49
49
|
function getDTSysName(value) {
|
|
50
50
|
let result = 'undefined';
|
|
@@ -55,17 +55,17 @@ function getDTSysName(value) {
|
|
|
55
55
|
};
|
|
56
56
|
|
|
57
57
|
/**
|
|
58
|
+
* A 'DTS'-type descriptor
|
|
58
59
|
* @typedef {Object} DTSysDescr
|
|
59
60
|
* @property {number} index - dtstype ID
|
|
60
61
|
* @property {string} name - dtstype name
|
|
61
|
-
* @description A DTS-type descriptor
|
|
62
62
|
*/
|
|
63
63
|
|
|
64
64
|
/**
|
|
65
|
+
* Returns a dtstype description for a given dtstype ID
|
|
65
66
|
* @function getDTSysDescr
|
|
66
67
|
* @param {(number|string)} value - DTS-type identifier
|
|
67
68
|
* @returns {DTSysDescr}
|
|
68
|
-
* @description Returns a dtstype description for a given dtstype ID
|
|
69
69
|
*/
|
|
70
70
|
function getDTSysDescr(value) {
|
|
71
71
|
let index = valueToIndex(value);
|
|
@@ -84,12 +84,12 @@ function getDTSysDescr(value) {
|
|
|
84
84
|
};
|
|
85
85
|
|
|
86
86
|
/**
|
|
87
|
+
* Tries to convert a given string to timestamp
|
|
87
88
|
* @function convStringToDTValue
|
|
88
89
|
* @param {string} value - some value
|
|
89
90
|
* @param {(number|string)} [dts_id=0] - DTS-type identifier
|
|
90
91
|
* @param {(number|string)} [tz] - <*reserved*>
|
|
91
92
|
* @returns {number}
|
|
92
|
-
* @description Tries to convert a given string to timestamp
|
|
93
93
|
* @todo check TZ
|
|
94
94
|
*/
|
|
95
95
|
function convStringToDTValue(value, dts_id = 0, tz) {
|
|
@@ -150,12 +150,12 @@ function convStringToDTValue(value, dts_id = 0, tz) {
|
|
|
150
150
|
};
|
|
151
151
|
|
|
152
152
|
/**
|
|
153
|
+
* Tries to convert a given value to its string representation
|
|
153
154
|
* @function convDTValueToString
|
|
154
155
|
* @param {(number|string|Date)} value - some value
|
|
155
156
|
* @param {(number|string)} [dts_id=0] - DTS-type identifier
|
|
156
157
|
* @param {(number|string)} [tz] - <*reserved*>
|
|
157
158
|
* @returns {string}
|
|
158
|
-
* @description Tries to convert a given value to its string representation
|
|
159
159
|
* @todo check TZ
|
|
160
160
|
*/
|
|
161
161
|
function convDTValueToString(value, dts_id, tz) {
|