Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
// Copyright 2018-2019 The Board of Trustees of the Leland Stanford Junior University
//
// Author: Giovanni Campagna
//
// See COPYING for details
"use strict";
const assert = require('assert');
const ThingTalk = require('thingtalk');
const Tp = require('thingpedia');
const fs = require('fs');
const path = require('path');
const util = require('util');
const ThingpediaDeviceFactories = require('./thingpedia-device-factories.json');
class MockThingpediaClient extends Tp.BaseClient {
constructor() {
super(null);
this._devices = null;
this._entities = null;
this._thingpediafilename = path.resolve(path.dirname(module.filename), 'thingpedia.tt');
this._loaded = null;
}
get developerKey() {
return null;
}
get locale() {
return this._locale;
}
//
// This file is part of Genie
//
// Copyright 2018-2019 The Board of Trustees of the Leland Stanford Junior University
//
// Author: Giovanni Campagna
//
// See COPYING for details
"use strict";
const ThingTalk = require('thingtalk');
const Tp = require('thingpedia');
const fs = require('fs');
const util = require('util');
module.exports = class FileThingpediaClient extends Tp.BaseClient {
constructor(args) {
super({ locale: args.locale, getDeveloperKey() { return null; } });
this._locale = args.locale;
this._devices = null;
this._entities = null;
this._thingpediafilename = args.thingpedia;
this._entityfilename = args.entities;
this._datasetfilename = args.dataset;
this._loaded = null;
}
get developerKey() {
return null;
}
get locale() {
getAllKinds(deviceId) {
return this.getAllDiscoveryServices(deviceId).then((services) => services.map((s) => {
return { kind: s.discovery_type + s.service };
}));
}
getByPrimaryKind(kind) {
return db.withClient((dbClient) => device.getByPrimaryKind(dbClient, kind));
}
}
var _discoveryServer = new TpDiscovery.Server(new ThingpediaDiscoveryDatabase());
const CATEGORIES = new Set(['media', 'social-network', 'home', 'communication', 'health', 'service', 'data-management']);
module.exports = class ThingpediaClientCloud extends Tp.BaseClient {
constructor(developerKey, locale, dbClient = null) {
super();
this._developerKey = developerKey;
this._locale = locale;
this.language = I18n.localeToLanguage(locale);
this._dbClient = null;
}
get developerKey() {
return this._developerKey;
}
get locale() {
return this._locale;