This commit is contained in:
lalBi94
2023-03-05 13:23:23 +01:00
commit 7bc56c09b5
14034 changed files with 1834369 additions and 0 deletions

14
node_modules/bonjour-service/dist/index.d.ts generated vendored Normal file
View File

@@ -0,0 +1,14 @@
import Browser, { BrowserConfig } from './lib/browser';
import Service, { ServiceConfig, ServiceReferer } from './lib/service';
export declare class Bonjour {
private server;
private registry;
constructor(opts?: ServiceConfig | undefined, errorCallback?: Function | undefined);
publish(opts: ServiceConfig): Service;
unpublishAll(callback?: CallableFunction | undefined): void;
find(opts?: BrowserConfig | undefined, onup?: (service: Service) => void): Browser;
findOne(opts?: BrowserConfig | undefined, timeout?: number, callback?: CallableFunction): Browser;
destroy(): void;
}
export { Service, ServiceReferer, ServiceConfig, Browser, BrowserConfig };
export default Bonjour;

51
node_modules/bonjour-service/dist/index.js generated vendored Normal file
View File

@@ -0,0 +1,51 @@
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.Browser = exports.Service = exports.Bonjour = void 0;
const registry_1 = __importDefault(require("./lib/registry"));
const mdns_server_1 = __importDefault(require("./lib/mdns-server"));
const browser_1 = __importDefault(require("./lib/browser"));
exports.Browser = browser_1.default;
const service_1 = __importDefault(require("./lib/service"));
exports.Service = service_1.default;
class Bonjour {
constructor(opts, errorCallback) {
this.server = new mdns_server_1.default(opts, errorCallback);
this.registry = new registry_1.default(this.server);
}
publish(opts) {
return this.registry.publish(opts);
}
unpublishAll(callback) {
return this.registry.unpublishAll(callback);
}
find(opts = undefined, onup) {
return new browser_1.default(this.server.mdns, opts, onup);
}
findOne(opts = undefined, timeout = 10000, callback) {
const browser = new browser_1.default(this.server.mdns, opts);
var timer;
browser.once('up', (service) => {
if (timer !== undefined)
clearTimeout(timer);
browser.stop();
if (callback)
callback(service);
});
timer = setTimeout(() => {
browser.stop();
if (callback)
callback(null);
}, timeout);
return browser;
}
destroy() {
this.registry.destroy();
this.server.mdns.destroy();
}
}
exports.Bonjour = Bonjour;
exports.default = Bonjour;
//# sourceMappingURL=index.js.map

1
node_modules/bonjour-service/dist/index.js.map generated vendored Normal file

File diff suppressed because one or more lines are too long

4
node_modules/bonjour-service/dist/lib/KeyValue.d.ts generated vendored Normal file
View File

@@ -0,0 +1,4 @@
declare type KeyValue = {
[key: string]: any;
};
export default KeyValue;

3
node_modules/bonjour-service/dist/lib/KeyValue.js generated vendored Normal file
View File

@@ -0,0 +1,3 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
//# sourceMappingURL=KeyValue.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"KeyValue.js","sourceRoot":"","sources":["../../src/lib/KeyValue.ts"],"names":[],"mappings":""}

29
node_modules/bonjour-service/dist/lib/browser.d.ts generated vendored Normal file
View File

@@ -0,0 +1,29 @@
/// <reference types="node" />
import { EventEmitter } from 'events';
import Service from './service';
export interface BrowserConfig {
type: string;
protocol?: 'tcp' | 'udp';
subtypes?: Array<string>;
txt?: any;
}
export declare class Browser extends EventEmitter {
private mdns;
private onresponse;
private serviceMap;
private txt;
private name?;
private txtQuery;
private wildcard;
private _services;
constructor(mdns: any, opts: any, onup?: (service: Service) => void);
start(): void;
stop(): void;
update(): void;
get services(): any[];
private addService;
private removeService;
private goodbyes;
private buildServicesFor;
}
export default Browser;

160
node_modules/bonjour-service/dist/lib/browser.js generated vendored Normal file
View File

@@ -0,0 +1,160 @@
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.Browser = void 0;
const dns_txt_1 = __importDefault(require("./dns-txt"));
const dns_equal_1 = __importDefault(require("dns-equal"));
const events_1 = require("events");
const service_types_1 = require("./service-types");
const filter_service_1 = __importDefault(require("./utils/filter-service"));
const filter_txt_1 = __importDefault(require("./utils/filter-txt"));
const TLD = '.local';
const WILDCARD = '_services._dns-sd._udp' + TLD;
class Browser extends events_1.EventEmitter {
constructor(mdns, opts, onup) {
super();
this.onresponse = null;
this.serviceMap = {};
this.wildcard = false;
this._services = [];
if (typeof opts === 'function')
return new Browser(mdns, null, opts);
this.mdns = mdns;
if (opts != null && opts.txt != null) {
this.txt = new dns_txt_1.default(opts.txt);
}
else {
this.txt = new dns_txt_1.default();
}
if (!opts || !opts.type) {
this.name = WILDCARD;
this.wildcard = true;
}
else {
this.name = (0, service_types_1.toString)({ name: opts.type, protocol: opts.protocol || 'tcp' }) + TLD;
if (opts.name)
this.name = opts.name + '.' + this.name;
this.wildcard = false;
}
if (opts != null && opts.txt !== undefined)
this.txtQuery = (0, filter_txt_1.default)(opts.txt);
if (onup)
this.on('up', onup);
this.start();
}
start() {
if (this.onresponse || this.name === undefined)
return;
var self = this;
var nameMap = {};
if (!this.wildcard)
nameMap[this.name] = true;
this.onresponse = (packet, rinfo) => {
if (self.wildcard) {
packet.answers.forEach((answer) => {
if (answer.type !== 'PTR' || answer.name !== self.name || answer.name in nameMap)
return;
nameMap[answer.data] = true;
self.mdns.query(answer.data, 'PTR');
});
}
Object.keys(nameMap).forEach(function (name) {
self.goodbyes(name, packet).forEach(self.removeService.bind(self));
var matches = self.buildServicesFor(name, packet, self.txt, rinfo);
if (matches.length === 0)
return;
matches.forEach((service) => {
if (self.serviceMap[service.fqdn])
return;
self.addService(service);
});
});
};
this.mdns.on('response', this.onresponse);
this.update();
}
stop() {
if (!this.onresponse)
return;
this.mdns.removeListener('response', this.onresponse);
this.onresponse = null;
}
update() {
this.mdns.query(this.name, 'PTR');
}
get services() {
return this._services;
}
addService(service) {
if ((0, filter_service_1.default)(service, this.txtQuery) === false)
return;
this._services.push(service);
this.serviceMap[service.fqdn] = true;
this.emit('up', service);
}
removeService(fqdn) {
var service, index;
this._services.some(function (s, i) {
if ((0, dns_equal_1.default)(s.fqdn, fqdn)) {
service = s;
index = i;
return true;
}
});
if (!service || index === undefined)
return;
this._services.splice(index, 1);
delete this.serviceMap[fqdn];
this.emit('down', service);
}
goodbyes(name, packet) {
return packet.answers.concat(packet.additionals)
.filter((rr) => rr.type === 'PTR' && rr.ttl === 0 && (0, dns_equal_1.default)(rr.name, name))
.map((rr) => rr.data);
}
buildServicesFor(name, packet, txt, referer) {
var records = packet.answers.concat(packet.additionals).filter((rr) => rr.ttl > 0);
return records
.filter((rr) => rr.type === 'PTR' && (0, dns_equal_1.default)(rr.name, name))
.map((ptr) => {
const service = {
addresses: []
};
records
.filter((rr) => {
return (rr.type === 'SRV' || rr.type === 'TXT') && (0, dns_equal_1.default)(rr.name, ptr.data);
})
.forEach((rr) => {
if (rr.type === 'SRV') {
var parts = rr.name.split('.');
var name = parts[0];
var types = (0, service_types_1.toType)(parts.slice(1, -1).join('.'));
service.name = name;
service.fqdn = rr.name;
service.host = rr.data.target;
service.referer = referer;
service.port = rr.data.port;
service.type = types.name;
service.protocol = types.protocol;
service.subtypes = types.subtypes;
}
else if (rr.type === 'TXT') {
service.rawTxt = rr.data;
service.txt = this.txt.decodeAll(rr.data);
}
});
if (!service.name)
return;
records
.filter((rr) => (rr.type === 'A' || rr.type === 'AAAA') && (0, dns_equal_1.default)(rr.name, service.host))
.forEach((rr) => service.addresses.push(rr.data));
return service;
})
.filter((rr) => !!rr);
}
}
exports.Browser = Browser;
exports.default = Browser;
//# sourceMappingURL=browser.js.map

1
node_modules/bonjour-service/dist/lib/browser.js.map generated vendored Normal file

File diff suppressed because one or more lines are too long

10
node_modules/bonjour-service/dist/lib/dns-txt.d.ts generated vendored Normal file
View File

@@ -0,0 +1,10 @@
/// <reference types="node" />
import KeyValue from './KeyValue';
export declare class DnsTxt {
private binary;
constructor(opts?: KeyValue);
encode(data?: KeyValue): Buffer[];
decode(buffer: Buffer): KeyValue;
decodeAll(buffer: Array<Buffer>): KeyValue;
}
export default DnsTxt;

42
node_modules/bonjour-service/dist/lib/dns-txt.js generated vendored Normal file
View File

@@ -0,0 +1,42 @@
'use strict';
Object.defineProperty(exports, "__esModule", { value: true });
exports.DnsTxt = void 0;
class DnsTxt {
constructor(opts = {}) {
this.binary = opts ? opts.binary : false;
}
encode(data = {}) {
return Object.entries(data)
.map(([key, value]) => {
let item = `${key}=${value}`;
return Buffer.from(item);
});
}
decode(buffer) {
var data = {};
try {
let format = buffer.toString();
let parts = format.split(/=(.+)/);
let key = parts[0];
let value = parts[1];
data[key] = value;
}
catch (_) { }
return data;
}
decodeAll(buffer) {
return buffer
.filter(i => i.length > 1)
.map(i => this.decode(i))
.reduce((prev, curr) => {
var obj = prev;
let [key] = Object.keys(curr);
let [value] = Object.values(curr);
obj[key] = value;
return obj;
}, {});
}
}
exports.DnsTxt = DnsTxt;
exports.default = DnsTxt;
//# sourceMappingURL=dns-txt.js.map

1
node_modules/bonjour-service/dist/lib/dns-txt.js.map generated vendored Normal file

File diff suppressed because one or more lines are too long

14
node_modules/bonjour-service/dist/lib/mdns-server.d.ts generated vendored Normal file
View File

@@ -0,0 +1,14 @@
import { ServiceRecord } from './service';
export declare class Server {
mdns: any;
private registry;
private errorCallback;
constructor(opts: any, errorCallback?: Function | undefined);
register(records: Array<ServiceRecord> | ServiceRecord): void;
unregister(records: Array<ServiceRecord> | ServiceRecord): void;
private respondToQuery;
private recordsFor;
private isDuplicateRecord;
private unique;
}
export default Server;

120
node_modules/bonjour-service/dist/lib/mdns-server.js generated vendored Normal file
View File

@@ -0,0 +1,120 @@
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.Server = void 0;
const array_flatten_1 = __importDefault(require("array-flatten"));
const es6_1 = __importDefault(require("fast-deep-equal/es6"));
const multicast_dns_1 = __importDefault(require("multicast-dns"));
const dns_equal_1 = __importDefault(require("dns-equal"));
class Server {
constructor(opts, errorCallback) {
this.registry = {};
this.mdns = (0, multicast_dns_1.default)(opts);
this.mdns.setMaxListeners(0);
this.mdns.on('query', this.respondToQuery.bind(this));
this.errorCallback = errorCallback !== null && errorCallback !== void 0 ? errorCallback : function (err) { throw err; };
}
register(records) {
const shouldRegister = (record) => {
var subRegistry = this.registry[record.type];
if (!subRegistry) {
subRegistry = this.registry[record.type] = [];
}
else if (subRegistry.some(this.isDuplicateRecord(record))) {
return;
}
subRegistry.push(record);
};
if (Array.isArray(records)) {
records.forEach(shouldRegister);
}
else {
shouldRegister(records);
}
}
unregister(records) {
const shouldUnregister = (record) => {
let type = record.type;
if (!(type in this.registry)) {
return;
}
this.registry[type] = this.registry[type].filter((i) => i.name !== record.name);
};
if (Array.isArray(records)) {
records.forEach(shouldUnregister);
}
else {
shouldUnregister(records);
}
}
respondToQuery(query) {
let self = this;
query.questions.forEach((question) => {
var type = question.type;
var name = question.name;
var answers = type === 'ANY'
? array_flatten_1.default.depth(Object.keys(self.registry).map(self.recordsFor.bind(self, name)), 1)
: self.recordsFor(name, type);
if (answers.length === 0)
return;
var additionals = [];
if (type !== 'ANY') {
answers.forEach((answer) => {
if (answer.type !== 'PTR')
return;
additionals = additionals
.concat(self.recordsFor(answer.data, 'SRV'))
.concat(self.recordsFor(answer.data, 'TXT'));
});
additionals
.filter(function (record) {
return record.type === 'SRV';
})
.map(function (record) {
return record.data.target;
})
.filter(this.unique())
.forEach(function (target) {
additionals = additionals
.concat(self.recordsFor(target, 'A'))
.concat(self.recordsFor(target, 'AAAA'));
});
}
self.mdns.respond({ answers: answers, additionals: additionals }, (err) => {
if (err) {
this.errorCallback(err);
}
});
});
}
recordsFor(name, type) {
if (!(type in this.registry)) {
return [];
}
return this.registry[type].filter((record) => {
var _name = ~name.indexOf('.') ? record.name : record.name.split('.')[0];
return (0, dns_equal_1.default)(_name, name);
});
}
isDuplicateRecord(a) {
return (b) => {
return a.type === b.type &&
a.name === b.name &&
(0, es6_1.default)(a.data, b.data);
};
}
unique() {
var set = [];
return (obj) => {
if (~set.indexOf(obj))
return false;
set.push(obj);
return true;
};
}
}
exports.Server = Server;
exports.default = Server;
//# sourceMappingURL=mdns-server.js.map

File diff suppressed because one or more lines are too long

14
node_modules/bonjour-service/dist/lib/registry.d.ts generated vendored Normal file
View File

@@ -0,0 +1,14 @@
import Server from './mdns-server';
import Service, { ServiceConfig } from './service';
export declare class Registry {
private server;
private services;
constructor(server: Server);
publish(config: ServiceConfig): Service;
unpublishAll(callback: CallableFunction | undefined): void;
destroy(): void;
private probe;
private announce;
private teardown;
}
export default Registry;

140
node_modules/bonjour-service/dist/lib/registry.js generated vendored Normal file
View File

@@ -0,0 +1,140 @@
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.Registry = void 0;
const array_flatten_1 = __importDefault(require("array-flatten"));
const dns_equal_1 = __importDefault(require("dns-equal"));
const service_1 = __importDefault(require("./service"));
const REANNOUNCE_MAX_MS = 60 * 60 * 1000;
const REANNOUNCE_FACTOR = 3;
class Registry {
constructor(server) {
this.services = [];
this.server = server;
}
publish(config) {
function start(service, registry, opts) {
if (service.activated)
return;
service.activated = true;
registry.services.push(service);
if (!(service instanceof service_1.default))
return;
if (opts.probe) {
registry.probe(registry.server.mdns, service, (exists) => {
if (exists) {
service.stop();
console.log(new Error('Service name is already in use on the network'));
return;
}
registry.announce(registry.server, service);
});
}
else {
registry.announce(registry.server, service);
}
}
function stop(service, registry, callback) {
if (!service.activated)
return;
if (!(service instanceof service_1.default))
return;
registry.teardown(registry.server, service, callback);
const index = registry.services.indexOf(service);
if (index !== -1)
registry.services.splice(index, 1);
}
const service = new service_1.default(config);
service.start = start.bind(null, service, this);
service.stop = stop.bind(null, service, this);
service.start({ probe: config.probe !== false });
return service;
}
unpublishAll(callback) {
this.teardown(this.server, this.services, callback);
this.services = [];
}
destroy() {
this.services.map(service => service.destroyed = true);
}
probe(mdns, service, callback) {
var sent = false;
var retries = 0;
var timer;
const send = () => {
if (!service.activated || service.destroyed)
return;
mdns.query(service.fqdn, 'ANY', function () {
sent = true;
timer = setTimeout(++retries < 3 ? send : done, 250);
timer.unref();
});
};
const onresponse = (packet) => {
if (!sent)
return;
if (packet.answers.some(matchRR) || packet.additionals.some(matchRR))
done(true);
};
const matchRR = (rr) => {
return (0, dns_equal_1.default)(rr.name, service.fqdn);
};
const done = (exists) => {
mdns.removeListener('response', onresponse);
clearTimeout(timer);
callback(!!exists);
};
mdns.on('response', onresponse);
setTimeout(send, Math.random() * 250);
}
announce(server, service) {
var delay = 1000;
var packet = service.records();
server.register(packet);
const broadcast = () => {
if (!service.activated || service.destroyed)
return;
server.mdns.respond(packet, function () {
if (!service.published) {
service.activated = true;
service.published = true;
service.emit('up');
}
delay = delay * REANNOUNCE_FACTOR;
if (delay < REANNOUNCE_MAX_MS && !service.destroyed) {
setTimeout(broadcast, delay).unref();
}
});
};
broadcast();
}
teardown(server, services, callback) {
if (!Array.isArray(services))
services = [services];
services = services.filter((service) => service.activated);
var records = array_flatten_1.default.depth(services.map(function (service) {
service.activated = false;
var records = service.records();
records.forEach((record) => {
record.ttl = 0;
});
return records;
}), 1);
if (records.length === 0)
return callback && callback();
server.unregister(records);
server.mdns.respond(records, function () {
services.forEach(function (service) {
service.published = false;
});
if (typeof callback === "function") {
callback.apply(null, arguments);
}
});
}
}
exports.Registry = Registry;
exports.default = Registry;
//# sourceMappingURL=registry.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,7 @@
export interface ServiceType {
name?: string;
protocol?: 'tcp' | 'udp' | string | null | undefined;
subtypes?: Array<string>;
}
export declare const toString: (data: ServiceType) => any;
export declare const toType: (string: string) => ServiceType;

48
node_modules/bonjour-service/dist/lib/service-types.js generated vendored Normal file
View File

@@ -0,0 +1,48 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.toType = exports.toString = void 0;
const Prefix = (name) => {
return '_' + name;
};
const AllowedProp = (key) => {
let keys = ['name', 'protocol', 'subtypes'];
return keys.includes(key);
};
const toString = (data) => {
let formatted = {
name: data.name,
protocol: data.protocol,
subtypes: data.subtypes
};
let entries = Object.entries(formatted);
return entries
.filter(([key, val]) => AllowedProp(key) && val !== undefined)
.reduce((prev, [key, val]) => {
switch (typeof val) {
case 'object':
val.map((i) => prev.push(Prefix(i)));
break;
default:
prev.push(Prefix(val));
break;
}
return prev;
}, [])
.join('.');
};
exports.toString = toString;
const toType = (string) => {
var parts = string.split('.');
for (let i in parts) {
if (parts[i][0] !== '_')
continue;
parts[i] = parts[i].slice(1);
}
return {
name: parts.shift(),
protocol: parts.shift() || null,
subtypes: parts
};
};
exports.toType = toType;
//# sourceMappingURL=service-types.js.map

File diff suppressed because one or more lines are too long

53
node_modules/bonjour-service/dist/lib/service.d.ts generated vendored Normal file
View File

@@ -0,0 +1,53 @@
/// <reference types="node" />
import KeyValue from './KeyValue';
import { EventEmitter } from 'events';
export interface ServiceConfig {
name: string;
type: string;
port: number;
protocol?: 'tcp' | 'udp';
host?: string;
fqdn?: string;
subtypes?: Array<string>;
txt?: KeyValue;
probe?: boolean;
}
export interface ServiceRecord {
name: string;
type: 'PTR' | 'SRV' | 'TXT' | 'A' | 'AAAA';
ttl: number;
data: KeyValue | string | any;
}
export interface ServiceReferer {
address: string;
family: 'IPv4' | 'IPv6';
port: number;
size: number;
}
export declare class Service extends EventEmitter {
name: string;
type: string;
protocol: 'tcp' | 'udp';
port: number;
host: string;
fqdn: string;
txt?: any;
subtypes?: Array<string>;
addresses?: Array<string>;
referer?: ServiceReferer;
probe: boolean;
published: boolean;
activated: boolean;
destroyed: boolean;
start?: any;
stop?: any;
private txtService;
constructor(config: ServiceConfig);
records(): Array<ServiceRecord>;
private RecordPTR;
private RecordSRV;
private RecordTXT;
private RecordA;
private RecordAAAA;
}
export default Service;

101
node_modules/bonjour-service/dist/lib/service.js generated vendored Normal file
View File

@@ -0,0 +1,101 @@
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.Service = void 0;
const os_1 = __importDefault(require("os"));
const dns_txt_1 = __importDefault(require("./dns-txt"));
const events_1 = require("events");
const service_types_1 = require("./service-types");
const TLD = '.local';
class Service extends events_1.EventEmitter {
constructor(config) {
super();
this.probe = true;
this.published = false;
this.activated = false;
this.destroyed = false;
this.txtService = new dns_txt_1.default();
if (!config.name)
throw new Error('ServiceConfig requires `name` property to be set');
if (!config.type)
throw new Error('ServiceConfig requires `type` property to be set');
if (!config.port)
throw new Error('ServiceConfig requires `port` property to be set');
this.name = config.name;
this.protocol = config.protocol || 'tcp';
this.type = (0, service_types_1.toString)({ name: config.type, protocol: this.protocol });
this.port = config.port;
this.host = config.host || os_1.default.hostname();
this.fqdn = `${this.name}.${this.type}${TLD}`;
this.txt = config.txt;
this.subtypes = config.subtypes;
}
records() {
var records = [this.RecordPTR(this), this.RecordSRV(this), this.RecordTXT(this)];
let ifaces = Object.values(os_1.default.networkInterfaces());
for (let iface of ifaces) {
let addrs = iface;
for (let addr of addrs) {
if (addr.internal || addr.mac === '00:00:00:00:00:00')
continue;
switch (addr.family) {
case 'IPv4':
records.push(this.RecordA(this, addr.address));
break;
case 'IPv6':
records.push(this.RecordAAAA(this, addr.address));
break;
}
}
}
return records;
}
RecordPTR(service) {
return {
name: `${service.type}${TLD}`,
type: 'PTR',
ttl: 28800,
data: service.fqdn
};
}
RecordSRV(service) {
return {
name: service.fqdn,
type: 'SRV',
ttl: 120,
data: {
port: service.port,
target: service.host
}
};
}
RecordTXT(service) {
return {
name: service.fqdn,
type: 'TXT',
ttl: 4500,
data: this.txtService.encode(service.txt)
};
}
RecordA(service, ip) {
return {
name: service.host,
type: 'A',
ttl: 120,
data: ip
};
}
RecordAAAA(service, ip) {
return {
name: service.host,
type: 'AAAA',
ttl: 120,
data: ip
};
}
}
exports.Service = Service;
exports.default = Service;
//# sourceMappingURL=service.js.map

1
node_modules/bonjour-service/dist/lib/service.js.map generated vendored Normal file

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,4 @@
import KeyValue from '../KeyValue';
import Service from '../service';
declare const _default: (service: Service, txtQuery: KeyValue | undefined) => boolean;
export default _default;

View File

@@ -0,0 +1,22 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.default = (service, txtQuery) => {
if (txtQuery === undefined)
return true;
let serviceTxt = service.txt;
let query = Object.entries(txtQuery)
.map(([key, value]) => {
let queryValue = serviceTxt[key];
if (queryValue === undefined)
return false;
if (value != queryValue)
return false;
return true;
});
if (query.length == 0)
return true;
if (query.includes(false))
return false;
return true;
};
//# sourceMappingURL=filter-service.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"filter-service.js","sourceRoot":"","sources":["../../../src/lib/utils/filter-service.ts"],"names":[],"mappings":";;AAOA,kBAAe,CAAC,OAAgB,EAAE,QAA8B,EAAW,EAAE;IACzE,IAAG,QAAQ,KAAK,SAAS;QAAE,OAAO,IAAI,CAAA;IACtC,IAAI,UAAU,GAAG,OAAO,CAAC,GAAG,CAAA;IAC5B,IAAI,KAAK,GAAG,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC;SAC/B,GAAG,CAAC,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE,EAAE;QAClB,IAAI,UAAU,GAAG,UAAU,CAAC,GAAG,CAAC,CAAA;QAChC,IAAG,UAAU,KAAK,SAAS;YAAE,OAAO,KAAK,CAAA;QACzC,IAAG,KAAK,IAAI,UAAU;YAAE,OAAO,KAAK,CAAA;QACpC,OAAO,IAAI,CAAA;IACf,CAAC,CAAC,CAAA;IACN,IAAG,KAAK,CAAC,MAAM,IAAI,CAAC;QAAE,OAAO,IAAI,CAAA;IACjC,IAAG,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC;QAAE,OAAO,KAAK,CAAA;IACtC,OAAO,IAAI,CAAA;AACf,CAAC,CAAA"}

View File

@@ -0,0 +1,3 @@
import KeyValue from '../KeyValue';
declare const _default: (data: KeyValue) => {};
export default _default;

View File

@@ -0,0 +1,6 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.default = (data) => Object.keys(data)
.filter((key) => !key.includes('binary'))
.reduce((cur, key) => { return Object.assign(cur, { [key]: data[key] }); }, {});
//# sourceMappingURL=filter-txt.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"filter-txt.js","sourceRoot":"","sources":["../../../src/lib/utils/filter-txt.ts"],"names":[],"mappings":";;AAMA,kBAAe,CAAC,IAAc,EAAE,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC;KACnD,MAAM,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC,GAAG,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;KACxC,MAAM,CAAC,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE,GAAG,OAAO,MAAM,CAAC,MAAM,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,CAAA,CAAA,CAAC,EAAE,EAAE,CAAC,CAAA"}