@xapp/arachne-parsers
Advanced tools
Comparing version 0.6.4 to 0.7.0
@@ -7,3 +7,3 @@ /// <reference types="cheerio" /> | ||
export interface Detector { | ||
detect(): DetectorResult[]; | ||
detect(): Promise<DetectorResult[]>; | ||
} | ||
@@ -30,3 +30,3 @@ /** | ||
constructor(html: string | cheerio.Root); | ||
abstract detect(): DetectorResult[]; | ||
abstract detect(): Promise<DetectorResult[]>; | ||
} |
/*! Copyright (c) 2023, XAPP AI */ | ||
export * from "./ChiirpDetector"; | ||
export * from "./Detector"; | ||
export * from "./MultiDetector"; | ||
export * from "./ScheduleEngineDetector"; | ||
export * from "./ScriptDetector"; | ||
@@ -5,0 +7,0 @@ export * from "./SurefireDetector"; |
@@ -18,4 +18,6 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
__exportStar(require("./ChiirpDetector"), exports); | ||
__exportStar(require("./Detector"), exports); | ||
__exportStar(require("./MultiDetector"), exports); | ||
__exportStar(require("./ScheduleEngineDetector"), exports); | ||
__exportStar(require("./ScriptDetector"), exports); | ||
@@ -22,0 +24,0 @@ __exportStar(require("./SurefireDetector"), exports); |
@@ -7,3 +7,3 @@ /// <reference types="cheerio" /> | ||
constructor(html: string | cheerio.Root, detectors: AbstractDetector[]); | ||
detect(): DetectorResult[]; | ||
detect(): Promise<DetectorResult[]>; | ||
} |
"use strict"; | ||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } | ||
return new (P || (P = Promise))(function (resolve, reject) { | ||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } | ||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } | ||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } | ||
step((generator = generator.apply(thisArg, _arguments || [])).next()); | ||
}); | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
@@ -12,8 +21,10 @@ exports.MultiDetector = void 0; | ||
detect() { | ||
const results = []; | ||
for (const detector of this.detectors) { | ||
const result = detector.detect(); | ||
results.push(...result); | ||
} | ||
return results; | ||
return __awaiter(this, void 0, void 0, function* () { | ||
const results = []; | ||
for (const detector of this.detectors) { | ||
const result = yield detector.detect(); | ||
results.push(...result); | ||
} | ||
return results; | ||
}); | ||
} | ||
@@ -20,0 +31,0 @@ } |
@@ -26,3 +26,3 @@ /// <reference types="cheerio" /> | ||
constructor(html: string | cheerio.Root, technology: string, host: string); | ||
detect(): DetectorResult[]; | ||
detect(): Promise<DetectorResult[]>; | ||
} |
"use strict"; | ||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } | ||
return new (P || (P = Promise))(function (resolve, reject) { | ||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } | ||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } | ||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } | ||
step((generator = generator.apply(thisArg, _arguments || [])).next()); | ||
}); | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
@@ -25,23 +34,25 @@ exports.ScriptDetector = void 0; | ||
detect() { | ||
const scriptTags = this.cheerio("script"); | ||
let installed = false; | ||
for (const i in scriptTags) { | ||
const element = scriptTags[i]; | ||
if (isScriptElement(element)) { | ||
const src = element.attribs['src']; | ||
if (src) { | ||
try { | ||
const url = new URL(src); | ||
if (this.host.toLowerCase() === url.host.toLowerCase()) { | ||
installed = true; | ||
return __awaiter(this, void 0, void 0, function* () { | ||
const scriptTags = this.cheerio("script"); | ||
let installed = false; | ||
for (const i in scriptTags) { | ||
const element = scriptTags[i]; | ||
if (isScriptElement(element)) { | ||
const src = element.attribs['src']; | ||
if (src) { | ||
try { | ||
const url = new URL(src); | ||
if (this.host.toLowerCase() === url.host.toLowerCase()) { | ||
installed = true; | ||
} | ||
} | ||
catch (e) { /* Don't Care */ } | ||
} | ||
catch (e) { /* Don't Care */ } | ||
} | ||
} | ||
} | ||
return [{ | ||
technology: this.technology, | ||
installed | ||
}]; | ||
return [{ | ||
technology: this.technology, | ||
installed | ||
}]; | ||
}); | ||
} | ||
@@ -48,0 +59,0 @@ } |
@@ -6,3 +6,3 @@ /*! Copyright (c) 2023, XAPP AI */ | ||
export declare class SurefireDetector extends AbstractDetector { | ||
detect(): DetectorResult[]; | ||
detect(): Promise<DetectorResult[]>; | ||
} |
"use strict"; | ||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } | ||
return new (P || (P = Promise))(function (resolve, reject) { | ||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } | ||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } | ||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } | ||
step((generator = generator.apply(thisArg, _arguments || [])).next()); | ||
}); | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
@@ -11,4 +20,6 @@ exports.SurefireDetector = exports.SFL_FORM_HOST = exports.SFL_FORM = void 0; | ||
detect() { | ||
const form = new ScriptDetector_1.ScriptDetector(this.cheerio, exports.SFL_FORM, exports.SFL_FORM_HOST).detect(); | ||
return [...form]; | ||
return __awaiter(this, void 0, void 0, function* () { | ||
const form = yield new ScriptDetector_1.ScriptDetector(this.cheerio, exports.SFL_FORM, exports.SFL_FORM_HOST).detect(); | ||
return [...form]; | ||
}); | ||
} | ||
@@ -15,0 +26,0 @@ } |
@@ -9,3 +9,3 @@ /*! Copyright (c) 2023, XAPP AI */ | ||
export declare class UserWayDetector extends AbstractDetector { | ||
detect(): DetectorResult[]; | ||
detect(): Promise<DetectorResult[]>; | ||
} |
"use strict"; | ||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } | ||
return new (P || (P = Promise))(function (resolve, reject) { | ||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } | ||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } | ||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } | ||
step((generator = generator.apply(thisArg, _arguments || [])).next()); | ||
}); | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
@@ -14,4 +23,6 @@ exports.UserWayDetector = exports.USER_WAY_CDN = exports.USER_WAY = void 0; | ||
detect() { | ||
const userWay = new ScriptDetector_1.ScriptDetector(this.cheerio, exports.USER_WAY, exports.USER_WAY_CDN).detect(); | ||
return [...userWay]; | ||
return __awaiter(this, void 0, void 0, function* () { | ||
const userWay = yield new ScriptDetector_1.ScriptDetector(this.cheerio, exports.USER_WAY, exports.USER_WAY_CDN).detect(); | ||
return [...userWay]; | ||
}); | ||
} | ||
@@ -18,0 +29,0 @@ } |
@@ -8,6 +8,6 @@ /*! Copyright (c) 2023, XAPP AI */ | ||
/** | ||
* Detects both XAPP Search & XAPP Chat | ||
* Detects both XAPP Search & XAPP Chat from https://xapp.ai | ||
*/ | ||
export declare class XAPPDetector extends AbstractDetector { | ||
detect(): DetectorResult[]; | ||
detect(): Promise<DetectorResult[]>; | ||
} |
"use strict"; | ||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } | ||
return new (P || (P = Promise))(function (resolve, reject) { | ||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } | ||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } | ||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } | ||
step((generator = generator.apply(thisArg, _arguments || [])).next()); | ||
}); | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
@@ -12,9 +21,11 @@ exports.XAPPDetector = exports.XAPP_CHAT_HOST = exports.XAPP_CHAT = exports.XAPP_SEARCH_HOST = exports.XAPP_SEARCH = void 0; | ||
/** | ||
* Detects both XAPP Search & XAPP Chat | ||
* Detects both XAPP Search & XAPP Chat from https://xapp.ai | ||
*/ | ||
class XAPPDetector extends Detector_1.AbstractDetector { | ||
detect() { | ||
const search = new ScriptDetector_1.ScriptDetector(this.cheerio, exports.XAPP_SEARCH, exports.XAPP_SEARCH_HOST).detect(); | ||
const chat = new ScriptDetector_1.ScriptDetector(this.cheerio, exports.XAPP_CHAT, exports.XAPP_CHAT_HOST).detect(); | ||
return [...search, ...chat]; | ||
return __awaiter(this, void 0, void 0, function* () { | ||
const search = yield new ScriptDetector_1.ScriptDetector(this.cheerio, exports.XAPP_SEARCH, exports.XAPP_SEARCH_HOST).detect(); | ||
const chat = yield new ScriptDetector_1.ScriptDetector(this.cheerio, exports.XAPP_CHAT, exports.XAPP_CHAT_HOST).detect(); | ||
return [...search, ...chat]; | ||
}); | ||
} | ||
@@ -21,0 +32,0 @@ } |
{ | ||
"name": "@xapp/arachne-parsers", | ||
"version": "0.6.4", | ||
"version": "0.7.0", | ||
"types": "lib/index", | ||
@@ -18,6 +18,6 @@ "main": "lib/index", | ||
"devDependencies": { | ||
"@microsoft/api-extractor": "7.35.2", | ||
"@microsoft/api-extractor": "7.36.0", | ||
"@types/chai": "4.3.5", | ||
"@types/mocha": "10.0.1", | ||
"@types/node": "18.16.17", | ||
"@types/node": "18.16.18", | ||
"@types/sinon": "10.0.15", | ||
@@ -29,3 +29,3 @@ "@types/sinon-chai": "3.2.9", | ||
"mocha": "10.2.0", | ||
"sinon": "15.1.1", | ||
"sinon": "15.1.2", | ||
"sinon-chai": "3.7.0", | ||
@@ -48,3 +48,3 @@ "ts-node": "10.9.1", | ||
}, | ||
"gitHead": "4f8e2650c09102a09b3883831678a4856f05715a" | ||
"gitHead": "2a7c6bca4c744214565c985438750fea165d33ee" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
72574
63
1072