UNPKG

flysh

Version:

DOM Document Object Artifact Collector

90 lines 2.48 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.PageRecords = void 0; /** * 'PageRecords' Model Class Definition * * The class is instanciated and filled by the 'Flysh' class during page(s) parsing. The data collection is structured * as an array of 'Map'. In case of exception during process, the 'error' flag is set to true (i.e: timeout, crash,...). * * Example of the output data format sent back after page(s) parsing, * [ * ['item_name' : 'some name', 'item_description' : 'some description',...], * ['item_name' : 'some name', 'item_description' : 'some description',...], * ... * ] */ class PageRecords { /** * Class properties */ _error = false; _recordList; _uri; /** * Constructor * * @param uri Contains the full 'URI' address * @param error Value being set in case of error (timeout, exception,...) */ constructor(uri, error) { this._error = error; this._recordList = new Array(); this._uri = uri; } /** * Getter 'Error' * * @returns Returns a 'boolean' value setted to true in case of error */ get getError() { return this._error; } /** * Setter 'Error' * * @param error Contains the 'boolean' value to set in case of successful/unsuccessful process */ setError(error) { this._error = error; } /** * Getter 'URI' * * @returns Returns a 'string' that contains the URI value */ get URI() { return this._uri; } /** * Getter 'RecordList' * * @returns Returns an array of 'Map' that contains the list of records */ get recordList() { return this._recordList; } /** * Returns the number of records from the current page * * @returns Returns the count of records from the record list */ get numberRecords() { let tot = 0; for (let ref of this._recordList) tot += ref.size; return tot; } /** * 'Stringify' the class instance * * @returns Returns a 'string' that contains all the class properties */ get toString() { return 'URI : ' + this._uri + '\n' + 'Error : ' + this._error + '\n' + 'List of records : ' + this._recordList + '\n'; } } exports.PageRecords = PageRecords; //# sourceMappingURL=PageRecords.js.map