diff --git a/README.md b/README.md index 4a70eb5..04c7e45 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ # **README** -- Document last update : 12/03/2023 +- Document last update : 20/04/2023 - Author : **John Van Derton** — **john@cserv.be** ## **What is it ?** @@ -59,10 +59,9 @@ This is showing a simple **HTML** structure that includes an element called `tab // Invoke useful libraries import { Flysh, InputMessage, OutputMessage, PageRecords, FlyshException } from 'Flysh'; -// Instantiate the 'InputMessage' class (the local file/filesystem parameter is set to 'true') -// Note : The third 'InputMessage' boolean parameter is setting the source mode, either from the filesystem or the lan/wan -// Note+ : A fourth optional parameter can preset a timeout value (default 1500ms) -let inputMessage = new InputMessage('.','/somepath/somefilename.htm',true); +// Instantiate the 'InputMessage' class +// Note : A third optional parameter can preset 6a timeout value (default 1500ms) +let inputMessage = new InputMessage('.','/somepath/somefilename.htm'); // Add the 'SPC' (Scope/Parent/Child) class instance with a fully defined filter selector i.e : 'table tr td' // Note : the 'addSPC()' method is now deprecated -> 'addFilterSelector()' inputMessage.addFilterSelector('table tr td'); @@ -142,7 +141,7 @@ Source code of a pagination table, The parsing of this **HTML** code additionally produces result by scanning all the linked pages. In order to do this properly, it must inform the instantiated `InputMessage` class that there is a pagination table (**paginator**). See the example from below, ```typescript -let IM = new InputMessage('.','/somepath/somefilename.htm',true); +let IM = new InputMessage('.','/somepath/somefilename.htm'); IM.addPaginator('span.nav_pagination_control_class a','href'); ... let f = new Flysh(IM); @@ -169,7 +168,7 @@ This section will attempt to demonstrate the ability to manage different structu We can observe from below that the three fields have their own definition. By successively recreating the three objects related to each field, it becomes possible to properly achieve the data processing. Note that the new `addField()` method is now replacing `addSibling()`. ```typescript - let IM = new InputMessage('.','/somepath/somefilename.htm',true); + let IM = new InputMessage('.','/somepath/somefilename.htm'); IM.addFilterSelector('#list_items_id span.item_field_span_class') .addField('column_1','p','item_name.item_class',''); @@ -199,14 +198,6 @@ The `timeout` default value is defined from the `InputMessage` class. This value new InputMessage('domain','path',DOCUMENT_ACCESS,TIMEOUT_VALUE); ``` -#### **Access mode setting** - -The access mode can be defined following two different approaches. It is therefore possible to access documents either from the local file system or the LAN/WAN network. The `DOCUMENT_ACCESS` field contains a `boolean` value who is specifying either an access via the filesystem (true) or the network (false). For example, accessing a document on a remote site will only be possible by specifying that it is not on the filesystem (false). - -```Typescript - new InputMessage('domain','path',FILESYSTEM_ACCESS); -``` - ### **How to define the filter selector ?** #### **What is a filter selector ?** diff --git a/package-lock.json b/package-lock.json index 1e394ba..e6dc9ad 100644 --- a/package-lock.json +++ b/package-lock.json @@ -69,6 +69,16 @@ "@jridgewell/sourcemap-codec": "^1.4.10" } }, + "node_modules/@pkgjs/parseargs": { + "version": "0.11.0", + "resolved": "https://registry.npmjs.org/@pkgjs/parseargs/-/parseargs-0.11.0.tgz", + "integrity": "sha512-+1VkjdD0QBLPodGrJUeqarH8VAIvQODIbwh9XpP5Syisf7YoQgsJKPNFoqqLQlu+VQ/tVSshMR6loPMn8U+dPg==", + "dev": true, + "optional": true, + "engines": { + "node": ">=14" + } + }, "node_modules/@tootallnate/once": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/@tootallnate/once/-/once-2.0.0.tgz", @@ -114,9 +124,9 @@ "dev": true }, "node_modules/@types/node": { - "version": "18.15.11", - "resolved": "https://registry.npmjs.org/@types/node/-/node-18.15.11.tgz", - "integrity": "sha512-E5Kwq2n4SbMzQOn6wnmBjuK9ouqlURrcZDVfbo9ftDDTFt3nk7ZKK4GMOzoYgnpQJKcxwQw+lGaBvvlMo0qN/Q==" + "version": "18.15.12", + "resolved": "https://registry.npmjs.org/@types/node/-/node-18.15.12.tgz", + "integrity": "sha512-Wha1UwsB3CYdqUm2PPzh/1gujGCNtWVUYF0mB00fJFoR4gTyWTDPjSm+zBF787Ahw8vSGgBja90MkgFwvB86Dg==" }, "node_modules/abab": { "version": "2.0.6", @@ -431,6 +441,20 @@ "integrity": "sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ==", "dev": true }, + "node_modules/cross-spawn": { + "version": "7.0.3", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", + "integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==", + "dev": true, + "dependencies": { + "path-key": "^3.1.0", + "shebang-command": "^2.0.0", + "which": "^2.0.1" + }, + "engines": { + "node": ">= 8" + } + }, "node_modules/cssstyle": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/cssstyle/-/cssstyle-3.0.0.tgz", @@ -667,6 +691,22 @@ "flat": "cli.js" } }, + "node_modules/foreground-child": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/foreground-child/-/foreground-child-3.1.1.tgz", + "integrity": "sha512-TMKDUnIte6bfb5nWv7V/caI169OHgvwjb7V4WkeUvbQQdjr5rWKqHFiKWb/fcOwB+CzBT+qbWjvj+DVwRskpIg==", + "dev": true, + "dependencies": { + "cross-spawn": "^7.0.0", + "signal-exit": "^4.0.1" + }, + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, "node_modules/form-data": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz", @@ -923,6 +963,29 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/isexe": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", + "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==" + }, + "node_modules/jackspeak": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/jackspeak/-/jackspeak-2.0.3.tgz", + "integrity": "sha512-0Jud3OMUdMbrlr3PyUMKESq51LXVAB+a239Ywdvd+Kgxj3MaBRml/nVRxf8tQFyfthMjuRkxkv7Vg58pmIMfuQ==", + "dev": true, + "dependencies": { + "cliui": "^7.0.4" + }, + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + }, + "optionalDependencies": { + "@pkgjs/parseargs": "^0.11.0" + } + }, "node_modules/jquery": { "version": "3.6.4", "resolved": "https://registry.npmjs.org/jquery/-/jquery-3.6.4.tgz", @@ -1037,9 +1100,9 @@ } }, "node_modules/lru-cache": { - "version": "9.0.3", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-9.0.3.tgz", - "integrity": "sha512-cyjNRew29d4kbgnz1sjDqxg7qg8NW4s+HQzCGjeon7DV5T2yDije16W9HaUFV1dhVEMh+SjrOcK0TomBmf3Egg==", + "version": "9.1.0", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-9.1.0.tgz", + "integrity": "sha512-qFXQEwchrZcMVen2uIDceR8Tii6kCJak5rzDStfEM0qA3YLMswaxIEZO0DhIbJ3aqaJiDjt+3crlplOb0tDtKQ==", "dev": true, "engines": { "node": "14 || >=16.14" @@ -1193,9 +1256,9 @@ } }, "node_modules/npm": { - "version": "9.6.4", - "resolved": "https://registry.npmjs.org/npm/-/npm-9.6.4.tgz", - "integrity": "sha512-8/Mct0X/w77PmgIpSlXfNIOlrZBfT+8966zLCxOhwi1qZ2Ueyy99uWPSDW6bt2OKw1NzrvHJBSgkzAvn1iWuhw==", + "version": "9.6.5", + "resolved": "https://registry.npmjs.org/npm/-/npm-9.6.5.tgz", + "integrity": "sha512-0SYs9lz1ND7V3+Lz6EbsnUdZ4OxjQOHbaIKdWd8OgsbZ2hCC2ZeiXMEaBEPEVBaILW+huFA0pJ1YME+52iZI5g==", "bundleDependencies": [ "@isaacs/string-locale-compare", "@npmcli/arborist", @@ -1266,8 +1329,8 @@ ], "dependencies": { "@isaacs/string-locale-compare": "^1.1.0", - "@npmcli/arborist": "^6.2.7", - "@npmcli/config": "^6.1.5", + "@npmcli/arborist": "^6.2.8", + "@npmcli/config": "^6.1.6", "@npmcli/map-workspaces": "^3.0.3", "@npmcli/package-json": "^3.0.0", "@npmcli/run-script": "^6.0.0", @@ -1284,34 +1347,34 @@ "glob": "^9.3.2", "graceful-fs": "^4.2.11", "hosted-git-info": "^6.1.1", - "ini": "^3.0.1", + "ini": "^4.1.0", "init-package-json": "^5.0.0", "is-cidr": "^4.0.2", "json-parse-even-better-errors": "^3.0.0", "libnpmaccess": "^7.0.2", - "libnpmdiff": "^5.0.15", - "libnpmexec": "^5.0.15", - "libnpmfund": "^4.0.15", + "libnpmdiff": "^5.0.16", + "libnpmexec": "^5.0.16", + "libnpmfund": "^4.0.16", "libnpmhook": "^9.0.3", "libnpmorg": "^5.0.3", - "libnpmpack": "^5.0.15", + "libnpmpack": "^5.0.16", "libnpmpublish": "^7.1.3", "libnpmsearch": "^6.0.2", "libnpmteam": "^5.0.3", "libnpmversion": "^4.0.2", - "make-fetch-happen": "^11.0.3", - "minimatch": "^7.4.3", - "minipass": "^4.2.5", + "make-fetch-happen": "^11.1.0", + "minimatch": "^7.4.6", + "minipass": "^4.2.8", "minipass-pipeline": "^1.2.4", "ms": "^2.1.2", "node-gyp": "^9.3.1", "nopt": "^7.1.0", "npm-audit-report": "^4.0.0", - "npm-install-checks": "^6.1.0", + "npm-install-checks": "^6.1.1", "npm-package-arg": "^10.1.0", "npm-pick-manifest": "^8.0.1", "npm-profile": "^7.0.1", - "npm-registry-fetch": "^14.0.3", + "npm-registry-fetch": "^14.0.4", "npm-user-validate": "^2.0.0", "npmlog": "^7.0.1", "p-map": "^4.0.0", @@ -1319,11 +1382,11 @@ "parse-conflict-json": "^3.0.1", "proc-log": "^3.0.0", "qrcode-terminal": "^0.12.0", - "read": "^2.0.0", + "read": "^2.1.0", "read-package-json": "^6.0.1", "read-package-json-fast": "^3.0.2", - "semver": "^7.3.8", - "ssri": "^10.0.2", + "semver": "^7.5.0", + "ssri": "^10.0.3", "tar": "^6.1.13", "text-table": "~0.2.0", "tiny-relative-date": "^1.3.0", @@ -1360,7 +1423,7 @@ "license": "ISC" }, "node_modules/npm/node_modules/@npmcli/arborist": { - "version": "6.2.7", + "version": "6.2.8", "inBundle": true, "license": "ISC", "dependencies": { @@ -1396,7 +1459,7 @@ "semver": "^7.3.7", "ssri": "^10.0.1", "treeverse": "^3.0.0", - "walk-up-path": "^1.0.0" + "walk-up-path": "^3.0.1" }, "bin": { "arborist": "bin/index.js" @@ -1406,17 +1469,17 @@ } }, "node_modules/npm/node_modules/@npmcli/config": { - "version": "6.1.5", + "version": "6.1.6", "inBundle": true, "license": "ISC", "dependencies": { "@npmcli/map-workspaces": "^3.0.2", - "ini": "^3.0.0", + "ini": "^4.1.0", "nopt": "^7.0.0", "proc-log": "^3.0.0", "read-package-json-fast": "^3.0.2", "semver": "^7.3.5", - "walk-up-path": "^1.0.0" + "walk-up-path": "^3.0.1" }, "engines": { "node": "^14.17.0 || ^16.13.0 || >=18.0.0" @@ -1492,7 +1555,7 @@ } }, "node_modules/npm/node_modules/@npmcli/metavuln-calculator": { - "version": "5.0.0", + "version": "5.0.1", "inBundle": true, "license": "ISC", "dependencies": { @@ -1597,12 +1660,21 @@ "node": ">= 10" } }, + "node_modules/npm/node_modules/@tufjs/canonical-json": { + "version": "1.0.0", + "inBundle": true, + "license": "MIT", + "engines": { + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + } + }, "node_modules/npm/node_modules/@tufjs/models": { - "version": "1.0.1", + "version": "1.0.3", "inBundle": true, "license": "MIT", "dependencies": { - "minimatch": "^7.4.2" + "@tufjs/canonical-json": "1.0.0", + "minimatch": "^7.4.6" }, "engines": { "node": "^14.17.0 || ^16.13.0 || >=18.0.0" @@ -2291,11 +2363,11 @@ "license": "ISC" }, "node_modules/npm/node_modules/ini": { - "version": "3.0.1", + "version": "4.1.0", "inBundle": true, "license": "ISC", "engines": { - "node": "^12.13.0 || ^14.15.0 || >=16.0.0" + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" } }, "node_modules/npm/node_modules/init-package-json": { @@ -2415,11 +2487,11 @@ } }, "node_modules/npm/node_modules/libnpmdiff": { - "version": "5.0.15", + "version": "5.0.16", "inBundle": true, "license": "ISC", "dependencies": { - "@npmcli/arborist": "^6.2.7", + "@npmcli/arborist": "^6.2.8", "@npmcli/disparity-colors": "^3.0.0", "@npmcli/installed-package-contents": "^2.0.2", "binary-extensions": "^2.2.0", @@ -2434,11 +2506,11 @@ } }, "node_modules/npm/node_modules/libnpmexec": { - "version": "5.0.15", + "version": "5.0.16", "inBundle": true, "license": "ISC", "dependencies": { - "@npmcli/arborist": "^6.2.7", + "@npmcli/arborist": "^6.2.8", "@npmcli/run-script": "^6.0.0", "chalk": "^4.1.0", "ci-info": "^3.7.1", @@ -2449,18 +2521,18 @@ "read": "^2.0.0", "read-package-json-fast": "^3.0.2", "semver": "^7.3.7", - "walk-up-path": "^1.0.0" + "walk-up-path": "^3.0.1" }, "engines": { "node": "^14.17.0 || ^16.13.0 || >=18.0.0" } }, "node_modules/npm/node_modules/libnpmfund": { - "version": "4.0.15", + "version": "4.0.16", "inBundle": true, "license": "ISC", "dependencies": { - "@npmcli/arborist": "^6.2.7" + "@npmcli/arborist": "^6.2.8" }, "engines": { "node": "^14.17.0 || ^16.13.0 || >=18.0.0" @@ -2491,11 +2563,11 @@ } }, "node_modules/npm/node_modules/libnpmpack": { - "version": "5.0.15", + "version": "5.0.16", "inBundle": true, "license": "ISC", "dependencies": { - "@npmcli/arborist": "^6.2.7", + "@npmcli/arborist": "^6.2.8", "@npmcli/run-script": "^6.0.0", "npm-package-arg": "^10.1.0", "pacote": "^15.0.8" @@ -2569,7 +2641,7 @@ } }, "node_modules/npm/node_modules/make-fetch-happen": { - "version": "11.0.3", + "version": "11.1.0", "inBundle": true, "license": "ISC", "dependencies": { @@ -2594,7 +2666,7 @@ } }, "node_modules/npm/node_modules/minimatch": { - "version": "7.4.3", + "version": "7.4.6", "inBundle": true, "license": "ISC", "dependencies": { @@ -2608,7 +2680,7 @@ } }, "node_modules/npm/node_modules/minipass": { - "version": "4.2.5", + "version": "4.2.8", "inBundle": true, "license": "ISC", "engines": { @@ -2638,7 +2710,7 @@ } }, "node_modules/npm/node_modules/minipass-fetch": { - "version": "3.0.1", + "version": "3.0.2", "inBundle": true, "license": "MIT", "dependencies": { @@ -3171,7 +3243,7 @@ } }, "node_modules/npm/node_modules/npm-install-checks": { - "version": "6.1.0", + "version": "6.1.1", "inBundle": true, "license": "BSD-2-Clause", "dependencies": { @@ -3241,7 +3313,7 @@ } }, "node_modules/npm/node_modules/npm-registry-fetch": { - "version": "14.0.3", + "version": "14.0.4", "inBundle": true, "license": "ISC", "dependencies": { @@ -3448,7 +3520,7 @@ } }, "node_modules/npm/node_modules/read": { - "version": "2.0.0", + "version": "2.1.0", "inBundle": true, "license": "ISC", "dependencies": { @@ -3579,7 +3651,7 @@ "optional": true }, "node_modules/npm/node_modules/semver": { - "version": "7.3.8", + "version": "7.5.0", "inBundle": true, "license": "ISC", "dependencies": { @@ -3614,13 +3686,13 @@ "license": "ISC" }, "node_modules/npm/node_modules/sigstore": { - "version": "1.2.0", + "version": "1.3.0", "inBundle": true, "license": "Apache-2.0", "dependencies": { "@sigstore/protobuf-specs": "^0.1.0", "make-fetch-happen": "^11.0.1", - "tuf-js": "^1.0.0" + "tuf-js": "^1.1.3" }, "bin": { "sigstore": "bin/sigstore.js" @@ -3693,7 +3765,7 @@ "license": "CC0-1.0" }, "node_modules/npm/node_modules/ssri": { - "version": "10.0.2", + "version": "10.0.3", "inBundle": true, "license": "ISC", "dependencies": { @@ -3803,11 +3875,11 @@ } }, "node_modules/npm/node_modules/tuf-js": { - "version": "1.1.2", + "version": "1.1.4", "inBundle": true, "license": "MIT", "dependencies": { - "@tufjs/models": "1.0.1", + "@tufjs/models": "1.0.3", "make-fetch-happen": "^11.0.1" }, "engines": { @@ -3862,7 +3934,7 @@ } }, "node_modules/npm/node_modules/walk-up-path": { - "version": "1.0.0", + "version": "3.0.1", "inBundle": true, "license": "ISC" }, @@ -4005,6 +4077,15 @@ "node": ">=0.10.0" } }, + "node_modules/path-key": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", + "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", + "dev": true, + "engines": { + "node": ">=8" + } + }, "node_modules/path-scurry": { "version": "1.7.0", "resolved": "https://registry.npmjs.org/path-scurry/-/path-scurry-1.7.0.tgz", @@ -4138,16 +4219,21 @@ } }, "node_modules/rimraf/node_modules/glob": { - "version": "10.1.0", - "resolved": "https://registry.npmjs.org/glob/-/glob-10.1.0.tgz", - "integrity": "sha512-daGobsYuT0G4hng24B5LbeLNvwKZYRhWyDl3RvqqAGZjJnCopWWK6PWnAGBY1M/vdA63QE+jddhZcYp+74Bq6Q==", + "version": "10.2.1", + "resolved": "https://registry.npmjs.org/glob/-/glob-10.2.1.tgz", + "integrity": "sha512-ngom3wq2UhjdbmRE/krgkD8BQyi1KZ5l+D2dVm4+Yj+jJIBp74/ZGunL6gNGc/CYuQmvUBiavWEXIotRiv5R6A==", "dev": true, "dependencies": { + "foreground-child": "^3.1.0", "fs.realpath": "^1.0.0", + "jackspeak": "^2.0.3", "minimatch": "^9.0.0", "minipass": "^5.0.0", "path-scurry": "^1.7.0" }, + "bin": { + "glob": "dist/cjs/src/bin.js" + }, "engines": { "node": ">=16 || 14 >=14.17" }, @@ -4220,6 +4306,39 @@ "randombytes": "^2.1.0" } }, + "node_modules/shebang-command": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", + "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", + "dev": true, + "dependencies": { + "shebang-regex": "^3.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/shebang-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", + "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/signal-exit": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-4.0.1.tgz", + "integrity": "sha512-uUWsN4aOxJAS8KOuf3QMyFtgm1pkb6I+KRZbRF/ghdf5T7sM+B1lLLzPDxswUjkmHyxQAVzEgG35E3NzDM9GVw==", + "dev": true, + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, "node_modules/source-map": { "version": "0.6.1", "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", @@ -4506,6 +4625,20 @@ "node": ">=14" } }, + "node_modules/which": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", + "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", + "dependencies": { + "isexe": "^2.0.0" + }, + "bin": { + "node-which": "bin/node-which" + }, + "engines": { + "node": ">= 8" + } + }, "node_modules/word-wrap": { "version": "1.2.3", "resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.3.tgz", diff --git a/src/class/Flysh.ts b/src/class/Flysh.ts index 0877efa..41ce9ef 100644 --- a/src/class/Flysh.ts +++ b/src/class/Flysh.ts @@ -1,5 +1,5 @@ import { DomElement, InputMessage, NavPane, SPC } from "./model/InputMessage"; -import { FlyshException } from "./model/FlyshException"; +import { FlyshException } from "./exception/FlyshException"; import { OutputMessage, PageRecords } from "./model/OutputMessage"; const jquery = require("jquery"); diff --git a/src/class/model/FlyshException.ts b/src/class/exception/FlyshException.ts similarity index 100% rename from src/class/model/FlyshException.ts rename to src/class/exception/FlyshException.ts diff --git a/src/class/model/InputMessage.ts b/src/class/model/InputMessage.ts index 6b3561f..349930a 100644 --- a/src/class/model/InputMessage.ts +++ b/src/class/model/InputMessage.ts @@ -1,5 +1,5 @@ import { Expose, Type } from 'class-transformer'; -import { FlyshException } from './FlyshException'; +import { FlyshException } from '../exception/FlyshException'; import "reflect-metadata"; @@ -440,7 +440,7 @@ export class InputMessage { }, }) private _doms : DomElement[] | NavPane[] | SPC[] = new Array(); - private _fs : boolean; + private _fs : boolean = true; private _id : number; private _navpane : boolean = false; private _pagepath : string; @@ -458,35 +458,29 @@ export class InputMessage { pagepath : string, timeout ?: number ) { - this._domain = this._documentDomainLocationValidator(domain); - this._fs = this._documentFSLocationValidator(); + this._domain = this._domainValidator(domain); this._id = Math.floor(Math.random() * Math.floor(this.ID_GENERATED_FLOOR_FUNC_COMPLEXITY_VALUE)); this._pagepath = pagepath; this._timeout = timeout || this.DEFAULT_INSTANCE_TIMEOUT_VALUE; } - + /** - * This internal function is evaluating if the domain validity + * Check only if the domain is locally based (filesytem) or from the network. If the domain is an URL + * then the private filesystem propeerty is set to false + * + * @param domain Input string parameter that contains the domain value + * @returns A string formatted value that contains the passed parameter */ - private _documentDomainLocationValidator(domain : string) : string { + private _domainValidator(domain : string) : string { let _retVal = domain; + // Evaluates if the domain/path is empty if ((domain.length === 0)) throw new FlyshException(6500005100, new TypeError(), InputMessage.EXCEPTION_ID_6500005100_MESSAGE_VALUE); - - return _retVal; - } - - /** - * This internal function is evaluating if the specified document is located on a filesystem. - * If the document is not located on a filesystem then a 'false' value will be returned - * TODO : test & implement a .forceFS() method - */ - private _documentFSLocationValidator() : boolean { - let _retVal : boolean = true; - + + // Evaluates if the domain is a wall formed URL let regEx = new RegExp(this.REGEX_FS_URI_VALIDATION_VALUE); - if (this._domain.match(regEx) !== null) _retVal = false; + if (domain.match(regEx) !== null) this._fs = false; return _retVal; } diff --git a/src/index.ts b/src/index.ts index 13620b4..f5bb569 100644 --- a/src/index.ts +++ b/src/index.ts @@ -12,6 +12,6 @@ export { Flysh } from "./class/Flysh"; /** * Model classes with exception */ -export { FlyshException } from "./class/model/FlyshException"; +export { FlyshException } from "./class/exception/FlyshException"; export { InputMessage } from "./class/model/InputMessage"; export { OutputMessage, PageRecords } from "./class/model/OutputMessage"; \ No newline at end of file diff --git a/test/src/model/FlyshException.test.ts b/test/src/exception/FlyshException.test.ts similarity index 90% rename from test/src/model/FlyshException.test.ts rename to test/src/exception/FlyshException.test.ts index 752965c..e2cba31 100644 --- a/test/src/model/FlyshException.test.ts +++ b/test/src/exception/FlyshException.test.ts @@ -1,4 +1,4 @@ -import { } from '../../../src/class/model/FlyshException'; +import { FlyshException } from '../../../src/class/exception/FlyshException'; /** * 'FlyshException' Main Class Test diff --git a/test/src/flysh.test.ts b/test/src/flysh.test.ts index d4c3e4b..cae03c1 100644 --- a/test/src/flysh.test.ts +++ b/test/src/flysh.test.ts @@ -1,5 +1,4 @@ import { Flysh } from '../../src/class/Flysh'; -import { FlyshException } from '../../src/class/model/FlyshException'; import { InputMessage } from '../../src/class/model/InputMessage'; import { OutputMessage, PageRecords } from '../../src/class/model/OutputMessage'; @@ -44,49 +43,7 @@ describe('_________(Flysh Class "Dynamic Tests")_________', () => { describe('>>> Before parsing the current page document, do : ', () => { - /** - * This test is not relevant anymore as the previous 'InputMessage' class validation is now handling it - */ - // it('[001] Throws an exception because of invalid (URL), "fetchDOM()"', async () => { - // const f = new Flysh(new InputMessage('.','',false)); - // let pageRecNotFaulted : PageRecords = new PageRecords('', false); - // let pageRecFaulted : PageRecords = new PageRecords('', true); - // let pglist = new Array(); - // pglist.push(pageRecFaulted); - // pglist.push(pageRecNotFaulted); - // pglist.push(pageRecNotFaulted); - // await expect(f['fetchDOM']("")).to.be.rejectedWith(TypeError,"Invalid URL"); - // }); - - /** - * This test is not relevant anymore as the previous 'InputMessage' class validation is now handling it - */ - // it('[002] Throws an exception because of file not found (empty), invalid directory (ENOENT), "harvesting()"', async () => { - // const f = new Flysh(new InputMessage('.','',true)); - // let pageRecNotFaulted : PageRecords = new PageRecords('', false); - // let pageRecFaulted : PageRecords = new PageRecords('', true); - // let pglist = new Array(); - // pglist.push(pageRecFaulted); - // pglist.push(pageRecNotFaulted); - // pglist.push(pageRecNotFaulted); - // await expect(f['harvesting']("")).to.be.rejectedWith(FlyshException,"Exception occurred during process\nCause : ENOENT: no such file or directory, open \'\'"); - // }); - - /** - * This test is not relevant anymore as the previous 'InputMessage' class validation is now handling it - */ - // it('[003] Throws an exception because of invalid URL (empty), harvesting()', async () => { - // const f = new Flysh(new InputMessage('.','',false)); - // let pageRecNotFaulted : PageRecords = new PageRecords('', false); - // let pageRecFaulted : PageRecords = new PageRecords('', true); - // let pglist = new Array(); - // pglist.push(pageRecFaulted); - // pglist.push(pageRecNotFaulted); - // pglist.push(pageRecNotFaulted); - // await expect(f['harvesting']("")).to.be.rejectedWith(FlyshException,"Exception occurred during process\nCause : Invalid URL: "); - // }); - - it('[004] Expects harvesting() method to be fulfilled', async () => { + it('[001] Expects harvesting() method to be fulfilled', async () => { const f = new Flysh(new InputMessage('.','')); await expect(f['harvesting']("./test/dataset/100.htm")).to.be.fulfilled; }); diff --git a/test/src/model/InputMessage.test.ts b/test/src/model/InputMessage.test.ts index 6237fae..e50d1f6 100644 --- a/test/src/model/InputMessage.test.ts +++ b/test/src/model/InputMessage.test.ts @@ -1,5 +1,5 @@ import { Flysh } from '../../../src/class/Flysh'; -import { FlyshException } from '../../../src/class/model/FlyshException'; +import { FlyshException } from '../../../src/class/exception/FlyshException'; import { InputMessage, NavPane, Sibling, SPC } from '../../../src/class/model/InputMessage'; import { PageRecords } from '../../../src/class/model/OutputMessage'; @@ -50,12 +50,42 @@ describe('_________("InputMessage" Class Model Tests)_________', () => { expect(err.message).to.equal(InputMessage.EXCEPTION_ID_6500005100_MESSAGE_VALUE+"\nCause : "); }); - it('[004] Expecting identical domain value', () => { - let err = new FlyshException(0, new Error(), ""); + it('[004] Expecting filesystem property setted to true (local)', () => { + const im = new InputMessage('.',''); + expect(im.filesystem).equal(true); + expect(im.URI).equal('.'); + }); + + it('[005] Expecting filesystem property setted to true (local)', () => { + const im = new InputMessage('file.html',''); + expect(im.filesystem).equal(true); + expect(im.URI).equal('file.html'); + }); + + it('[006] Expecting filesystem property setted to false (URL)', () => { const im = new InputMessage('https://domain.abc',''); + expect(im.filesystem).equal(false); expect(im.URI).equal('https://domain.abc'); }); + it('[007] Expecting filesystem property setted to false (URL)', () => { + const im = new InputMessage('http://domain.abc',''); + expect(im.filesystem).equal(false); + expect(im.URI).equal('http://domain.abc'); + }); + + it('[008] Expecting filesystem property setted to false (URL)', () => { + const im = new InputMessage('http://www.domain.abc',''); + expect(im.filesystem).equal(false); + expect(im.URI).equal('http://www.domain.abc'); + }); + + it('[009] Expecting filesystem property setted to false (URL)', () => { + const im = new InputMessage('https://www.domain.abc',''); + expect(im.filesystem).equal(false); + expect(im.URI).equal('https://www.domain.abc'); + }); + }); /**