@ygracs/xepg-lib-js 0.0.25 → 0.0.27-b

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.
@@ -0,0 +1,590 @@
1
+ /**
2
+ * An XEPG-element options set (base)
3
+ */
4
+ export type OPT_epgelsett_bs = {
5
+ /**
6
+ * - parser options
7
+ */
8
+ parseOptions?: InstanceType<typeof TXmlContentParseOptions>;
9
+ };
10
+ /**
11
+ * An XEPG-element options set (base)
12
+ */
13
+ export type XEpgElementConfigBase = {
14
+ /**
15
+ * - parser options
16
+ */
17
+ parseOptions: InstanceType<typeof TXmlContentParseOptions>;
18
+ };
19
+ /**
20
+ * A schedule info descriptor
21
+ */
22
+ export type xepgShedInfoDesc = {
23
+ /**
24
+ * - a schedule start time
25
+ */
26
+ time: number;
27
+ /**
28
+ * - schedule title
29
+ */
30
+ title: string;
31
+ /**
32
+ * - schedule category
33
+ */
34
+ cat?: string;
35
+ /**
36
+ * - schedule rating
37
+ */
38
+ pcmark?: number;
39
+ /**
40
+ * - schedule description
41
+ */
42
+ descr?: string;
43
+ };
44
+ /**
45
+ * An extra options set
46
+ */
47
+ export type OPT_extra = {
48
+ /**
49
+ * - 'DTS'-settings
50
+ */
51
+ dts_src?: object;
52
+ /**
53
+ * - 'TZ'-settings
54
+ */
55
+ tz_src?: object;
56
+ };
57
+ /**
58
+ * An XEPG-element options set (extend)
59
+ */
60
+ export type OPT_epgelsett_ex = {
61
+ /**
62
+ * - parser options
63
+ */
64
+ parseOptions?: InstanceType<typeof TXmlContentParseOptions>;
65
+ dts_src?: object;
66
+ tz_src?: object;
67
+ };
68
+ /**
69
+ * A provider info descriptor
70
+ */
71
+ export type xepgProvInfoDesc = {
72
+ /**
73
+ * - provider name
74
+ */
75
+ name?: string;
76
+ /**
77
+ * - provider version
78
+ */
79
+ version?: string;
80
+ /**
81
+ * - document schema
82
+ */
83
+ schema: string;
84
+ /**
85
+ * - document type
86
+ */
87
+ doctype: string;
88
+ };
89
+ /**
90
+ * A channel info descriptor
91
+ */
92
+ export type xepgChnInfoDesc = {
93
+ /**
94
+ * - channel ID
95
+ */
96
+ chnid: string;
97
+ /**
98
+ * - channel name
99
+ */
100
+ chname: string;
101
+ /**
102
+ * - channel 'Group ID'
103
+ */
104
+ chngid?: string;
105
+ /**
106
+ * - EPG-source URL
107
+ */
108
+ srcurl?: string;
109
+ };
110
+
111
+ /**
112
+ * An options set for `TXEpgContentProvider`-class
113
+ */
114
+ export type OPT_epgcpsett = {
115
+ /**
116
+ * - parser options
117
+ */
118
+ parseOptions?: InstanceType<typeof TXmlContentParseOptions>;
119
+ /**
120
+ * - <*deprecated*>
121
+ */
122
+ autoBindRoot?: boolean;
123
+ };
124
+ /**
125
+ * An options set for `TXEpgContentProvider`-class
126
+ */
127
+ export type XEpgContainerConfig = {
128
+ /**
129
+ * - parser options
130
+ */
131
+ parseOptions: InstanceType<typeof TXmlContentParseOptions>;
132
+ /**
133
+ * - <*deprecated*>
134
+ */
135
+ autoBindRoot?: boolean | undefined;
136
+ };
137
+
138
+ /**
139
+ * This class implements an instance of an element
140
+ * that manages content of a document declaration
141
+ * @since v0.0.2x
142
+ */
143
+ export class TXmlContentDeclaration {
144
+ /**
145
+ * Creates an instance of the element
146
+ * @throws {TypeError}
147
+ */
148
+ constructor(obj: object, opt?: OPT_epgelsett_bs);
149
+ /**
150
+ * Contains a version of an XML
151
+ */
152
+ get version(): string;
153
+ set version(value: string);
154
+ /**
155
+ * Contains a document character set
156
+ */
157
+ get encoding(): string;
158
+ set encoding(value: string);
159
+ /**
160
+ * Initializes an instance content.
161
+ */
162
+ init(): void;
163
+ #private;
164
+ }
165
+ export const XEPG_DEF_PROVIDER_NAME: "xepg-lib-js";
166
+ export const XEPG_DEF_PROVIDER_VER: "0.0.21";
167
+ export const XEPG_DEF_DOCUMENT_TYPE: "xepg";
168
+ export const XEPG_DEF_DOCUMENT_SCHEMA: string;
169
+ /**
170
+ * This class implements an interface of a DTS-provider element
171
+ */
172
+ export class TXEpgDTSProvider {
173
+ /**
174
+ * Creates an instance of the DTS-provider element
175
+ */
176
+ constructor(obj: object, opt?: OPT_epgelsett_bs);
177
+ /**
178
+ * Contains a dtstype ID
179
+ */
180
+ get dtstype(): number;
181
+ set dtstype(value: number);
182
+ /**
183
+ * Contains a TZ-offset
184
+ */
185
+ get curDocTZ(): number;
186
+ set curDocTZ(value: number);
187
+ /**
188
+ * Tries to set a `DTS`-type
189
+ * @since 0.0.22
190
+ */
191
+ setType(value: any): boolean;
192
+ #private;
193
+ }
194
+
195
+ /**
196
+ * This class implements an interface of a EPG-schedule element
197
+ * @since 0.0.22
198
+ */
199
+ export class TXEpgScheduleItem {
200
+ /**
201
+ * Creates an instance of the EPG-schedule element
202
+ */
203
+ constructor(obj: object, opt?: OPT_epgelsett_ex, extra?: OPT_extra);
204
+ /**
205
+ * Contains a dtstype ID
206
+ */
207
+ get dtstype(): number;
208
+ /**
209
+ * Contains a TZ-offset
210
+ */
211
+ get curDocTZ(): number;
212
+ /**
213
+ * Contains a schedule start time as a timestamp
214
+ */
215
+ get time(): number;
216
+ /**
217
+ * Contains a schedule title
218
+ */
219
+ get title(): string;
220
+ /**
221
+ * Contains a schedule category
222
+ */
223
+ get category(): string;
224
+ /**
225
+ * Contains a schedule rating value (aka pcmark)
226
+ */
227
+ get rating(): number;
228
+ /**
229
+ * Contains a schedule description
230
+ */
231
+ get descr(): string;
232
+ /**
233
+ * Returns a schedule info item descriptor
234
+ */
235
+ getInfo(): xepgShedInfoDesc;
236
+ /**
237
+ * Sets a schedule start time.
238
+ */
239
+ setTime(value: number | string | Date): boolean;
240
+ /**
241
+ * Sets a schedule title.
242
+ */
243
+ setTitle(value: string): boolean;
244
+ /**
245
+ * Sets a schedule title.
246
+ */
247
+ setCategory(value: string): boolean;
248
+ /**
249
+ * Sets a schedule rating value.
250
+ */
251
+ setRating(value: number | string): boolean;
252
+ /**
253
+ * Sets a schedule description.
254
+ */
255
+ setDescr(value: string): boolean;
256
+ /**
257
+ * Returns an instance content as a string in an XML-format.
258
+ */
259
+ saveToXMLString(): string;
260
+ /**
261
+ * Loads an element content from a string.
262
+ * @since v0.0.24
263
+ * @throws {Error}
264
+ * @experimental
265
+ */
266
+ loadFromXMLString(xmlString: string): boolean;
267
+ #private;
268
+ }
269
+
270
+ /**
271
+ * This class implements an interface of a EPG-schedules list
272
+ */
273
+ export class TXEpgSchedulesList {
274
+ /**
275
+ * Creates an instance of the schedules list
276
+ */
277
+ constructor(obj: any[], opt?: OPT_epgelsett_ex, extra?: OPT_extra);
278
+ /**
279
+ * Contains a quantity of a schedules
280
+ * @deprecated
281
+ * @todo \[since `v0.0.24`] deprecated. Use `TXEpgSchedulesList.count`
282
+ */
283
+ get schedQty(): number;
284
+ /**
285
+ * Contains a quantity of a schedules
286
+ * @since v0.0.24
287
+ */
288
+ get count(): number;
289
+ /**
290
+ * Contains a dtstype ID
291
+ */
292
+ get dtstype(): number;
293
+ /**
294
+ * Contains a TZ-offset
295
+ */
296
+ get curDocTZ(): number;
297
+ /**
298
+ * Indicates whether an instance has none member
299
+ * @since v0.0.24
300
+ */
301
+ isEmpty(): boolean;
302
+ /**
303
+ * Indicates whether an instance has any member
304
+ * @since v0.0.24
305
+ */
306
+ isNotEmpty(): boolean;
307
+ /**
308
+ * Checks whether a given value is a valid index and it fits the index range
309
+ * of an instance
310
+ * @since 0.0.20
311
+ */
312
+ chkIndex(value: number | string): boolean;
313
+ /**
314
+ * Returns a schedule element addressed by a given index
315
+ * @since 0.0.22
316
+ */
317
+ schedule(index: number | string): TXEpgScheduleItem | null;
318
+ /**
319
+ * Returns a schedule info item for instance element addressed
320
+ * by a given index
321
+ */
322
+ getScheduleInfo(index: number | string): xepgShedInfoDesc | null;
323
+ /**
324
+ * Returns a schedule info for instance members
325
+ */
326
+ getAllSchedulesInfo(): xepgShedInfoDesc[];
327
+ /**
328
+ * @protected
329
+ */
330
+ protected asJSON(): string;
331
+ [Symbol.iterator](): {
332
+ next: () => {
333
+ done: boolean;
334
+ value: TXEpgScheduleItem | null;
335
+ } | {
336
+ done: boolean;
337
+ value: undefined;
338
+ };
339
+ return(): {
340
+ done: boolean;
341
+ value: undefined;
342
+ };
343
+ };
344
+ #private;
345
+ }
346
+
347
+ /**
348
+ * This class implements an interface of a EPG-provider element
349
+ */
350
+ export class TXEpgProviderContainer {
351
+ /**
352
+ * Creates an instance of the EPG-provider element
353
+ */
354
+ constructor(obj: object, opt?: OPT_epgelsett_bs);
355
+ /**
356
+ * Contains a provider name
357
+ */
358
+ get name(): string;
359
+ set name(value: string);
360
+ /**
361
+ * Contains a version of a provider
362
+ */
363
+ get version(): string;
364
+ set version(value: string);
365
+ /**
366
+ * Contains a version of a document schema
367
+ */
368
+ get schema(): string;
369
+ set schema(value: string);
370
+ /**
371
+ * Contains a document type
372
+ */
373
+ get doctype(): string;
374
+ set doctype(value: string);
375
+ /**
376
+ * Sets a provider name
377
+ */
378
+ setName(value: string): boolean;
379
+ /**
380
+ * Returns a provider info item
381
+ */
382
+ getInfo(): xepgProvInfoDesc;
383
+ /**
384
+ * Sets a provider info
385
+ * @todo [since v0.0.21] deprecate use of `obj`-param as array
386
+ */
387
+ setInfo(obj: string[] | xepgProvInfoDesc): void;
388
+ /**
389
+ * Sets an initial instance state
390
+ */
391
+ init(opt?: xepgProvInfoDesc | string[]): void;
392
+ /**
393
+ * Returns an instance content as a string in an XML-format.
394
+ * @since v0.0.20
395
+ */
396
+ saveToXMLString(): string;
397
+ /**
398
+ * Loads a element content from a string.
399
+ * @since v0.0.24
400
+ * @throws {Error}
401
+ * @experimental
402
+ */
403
+ loadFromXMLString(xmlString: string): boolean;
404
+ #private;
405
+ }
406
+
407
+ /**
408
+ * This class implements an interface of a channel element
409
+ * @since 0.0.22
410
+ */
411
+ export class TXEpgChannelContainer {
412
+ /**
413
+ * Creates an instance of the channel element
414
+ */
415
+ constructor(obj: object, opt?: OPT_epgelsett_bs);
416
+ /**
417
+ * Contains a channel ID
418
+ */
419
+ get id(): string;
420
+ /**
421
+ * Contains a channel name
422
+ */
423
+ get name(): string;
424
+ set name(value: string);
425
+ /**
426
+ * Contains a channel Group ID
427
+ */
428
+ get gid(): string;
429
+ set gid(value: string);
430
+ /**
431
+ * Contains a channel source URL
432
+ */
433
+ get url(): string;
434
+ set url(value: string);
435
+ /**
436
+ * Tries to set a channel ID
437
+ */
438
+ setID(value: string): boolean;
439
+ /**
440
+ * Returns a channel info
441
+ */
442
+ getInfo(): xepgChnInfoDesc;
443
+ /**
444
+ * Sets a channel info
445
+ */
446
+ setInfo(obj: string | xepgChnInfoDesc): void;
447
+ #private;
448
+ }
449
+
450
+ /**
451
+ * This class implements an interface of a EPG-header element
452
+ */
453
+ export class TXEpgHeaderContainer {
454
+ /**
455
+ * Creates an instance of the EPG-header element
456
+ */
457
+ constructor(obj: object, opt?: OPT_epgelsett_bs);
458
+ /**
459
+ * Returns a `TXEpgDTSProvider` instance
460
+ */
461
+ get dts(): TXEpgDTSProvider;
462
+ /**
463
+ * Contains a dtstype ID
464
+ * @todo [since v0.0.22] becomes readonly
465
+ */
466
+ get dtstype(): number;
467
+ set dtstype(value: number);
468
+ /**
469
+ * Contains a TZ-offset
470
+ * @todo [since v0.0.22] becomes readonly
471
+ */
472
+ get curDocTZ(): number;
473
+ set curDocTZ(value: number);
474
+ /**
475
+ * Returns a `TXEpgProviderContainer` instance
476
+ * @since 0.0.22
477
+ */
478
+ get provider(): TXEpgProviderContainer | null;
479
+ /**
480
+ * Returns a `TXEpgChannelContainer` instance
481
+ * @since 0.0.22
482
+ */
483
+ get channel(): TXEpgChannelContainer;
484
+ /**
485
+ * Returns a document creation date as a timestamp
486
+ */
487
+ getDocumentDT(): number;
488
+ /**
489
+ * Sets a document creation date to a current system time
490
+ */
491
+ setDocumentDT(): void;
492
+ /**
493
+ * Returns a document expire date as a timestamp
494
+ */
495
+ getDocumentEDT(): number;
496
+ /**
497
+ * Sets a document expire date to a given time
498
+ */
499
+ setDocumentEDT(value: any): void;
500
+ /**
501
+ * Returns a channel info
502
+ */
503
+ getChannelInfo(): xepgChnInfoDesc;
504
+ /**
505
+ * Returns a provider info
506
+ */
507
+ getProviderInfo(): xepgProvInfoDesc | null;
508
+ /**
509
+ * Returns an instance content as a string in an XML-format.
510
+ * @since v0.0.20
511
+ */
512
+ saveToXMLString(): string;
513
+ /**
514
+ * Loads an element content from a string.
515
+ * @since v0.0.24
516
+ * @throws {Error}
517
+ * @experimental
518
+ */
519
+ loadFromXMLString(xmlString: string): boolean;
520
+ #private;
521
+ }
522
+
523
+ /**
524
+ * This class implements an interface of the container
525
+ * that manages a content of a XEPG-document
526
+ */
527
+ export class TXEpgContentProvider {
528
+ /**
529
+ * Creates an instance of the XEPG-content provider
530
+ */
531
+ constructor(opt?: OPT_epgcpsett);
532
+ /**
533
+ * Returns a `TXEpgHeaderContainer` instance
534
+ * @since 0.0.22
535
+ */
536
+ get header(): TXEpgHeaderContainer;
537
+ /**
538
+ * Returns a `TXEpgProviderContainer` instance
539
+ * @since 0.0.22
540
+ */
541
+ get provider(): TXEpgProviderContainer | null;
542
+ /**
543
+ * Returns a `TXEpgDTSProvider` instance
544
+ */
545
+ get dts(): TXEpgDTSProvider | null;
546
+ /**
547
+ * Returns a `TXEpgSchedulesList` instance
548
+ * @since 0.0.24
549
+ */
550
+ get schedules(): TXEpgSchedulesList;
551
+
552
+ init(): void;
553
+ /**
554
+ * Returns a document content as a string in an XML-format.
555
+ */
556
+ saveToXMLString(): string;
557
+ /**
558
+ * Saves a document content to a file.
559
+ * @throws {Error}
560
+ * @async
561
+ */
562
+ saveToFile(source: string): Promise<fsoDescr>;
563
+ /**
564
+ * Saves a document content to a file.
565
+ */
566
+ saveToFileSync(source: string): fsoDescr;
567
+ /**
568
+ * Loads a document content from a string.
569
+ * @since 0.0.18
570
+ * @throws {Error}
571
+ */
572
+ loadFromXMLString(xmlString: string): boolean;
573
+ /**
574
+ * Loads a document content from a file.
575
+ * @throws {Error}
576
+ * @async
577
+ */
578
+ loadFromFile(source: string): Promise<fsoDescr>;
579
+ /**
580
+ * Loads a document content from a file.
581
+ */
582
+ loadFromFileSync(source: string): fsoDescr;
583
+ /**
584
+ * @protected
585
+ */
586
+ protected asJSON(): string;
587
+ #private;
588
+ }
589
+ import { TXmlContentParseOptions } from "@ygracs/xobj-lib-js";
590
+ import { fsoDescr } from "@cntwg/file-helper";