Include dummy json source code in order to fix handlebles vulnerability (#452)

* Include dummy json source code in order to fix handlebles vulnerability

* Bump version to 2.16.0-rc
This commit is contained in:
Chaoyi Yuan 2020-02-12 09:55:07 +08:00 коммит произвёл GitHub
Родитель 62b3787bce
Коммит f5367c97da
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
11 изменённых файлов: 899 добавлений и 74 удалений

Просмотреть файл

@ -1,3 +1,7 @@
## 2.16.0
### Changed
* Fix Handlebars vulnerability CVE-2019-19919 (npm [advisory](https://www.npmjs.com/advisories/1164))
## 2.15.0 (2019-12-30)
### Added
* Display Azure IoT Hub name in Azure IoT Hub tree view

Просмотреть файл

@ -0,0 +1,19 @@
Copyright (c) 2017 Matt Sweetman
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

Просмотреть файл

@ -0,0 +1,62 @@
// Copyright (c) 2017 Matt Sweetman
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
var Handlebars = require('handlebars');
var fecha = require('fecha');
var numbro = require('numbro');
var mockdata = require('./lib/mockdata');
var helpers = require('./lib/helpers');
var utils = require('./lib/utils');
var dummyjson = {
// Global seed for the random number generator
seed: null,
parse: function (string, options) {
options = options || {};
// Merge custom mockdata/helpers into the defaults, items with the same name will override
options.mockdata = Handlebars.Utils.extend({}, mockdata, options.mockdata);
options.helpers = Handlebars.Utils.extend({}, helpers, options.helpers);
// If a seed is passed in the options it will override the default one
utils.setRandomSeed(options.seed || dummyjson.seed);
// Certain helpers, such as name and email, attempt to synchronise and use the same values when
// called after one-another. This object acts as a cache so the helpers can share their values.
options.mockdata.__cache = {};
return Handlebars.compile(string)(options.mockdata, {
helpers: options.helpers,
partials: options.partials
});
},
// Expose the built-in modules so people can use them in their own helpers
mockdata: mockdata,
helpers: helpers,
utils: utils,
// Also expose the number and date formatters so people can modify their settings
fecha: fecha,
numbro: numbro
};
module.exports = dummyjson;

Просмотреть файл

@ -0,0 +1,472 @@
// Copyright (c) 2017 Matt Sweetman
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
var os = require('os');
var Handlebars = require('handlebars');
var numbro = require('numbro');
var fecha = require('fecha');
var utils = require('./utils');
// Generating int and floats is very similar so we route both to this single function
function getNumber (type, min, max, format, options) {
var ret;
// Juggle the arguments if the user didn't supply a format string
if (!options) {
options = format;
format = null;
}
if (type === 'int') {
ret = utils.randomInt(min, max);
} else if (type === 'float') {
ret = utils.randomFloat(min, max);
}
if (typeof options.hash.round === 'number') {
ret = Math.round(ret / options.hash.round) * options.hash.round;
}
if (format) {
ret = numbro(ret).format(format);
}
return ret;
}
// Generating time and dates is very similar so we route both to this single function
function getDate (type, min, max, format, options) {
var ret;
// Juggle the arguments if the user didn't supply a format string
if (!options) {
options = format;
format = null;
}
if (type === 'date') {
min = Date.parse(min);
max = Date.parse(max);
} else if (type === 'time') {
min = Date.parse('1970-01-01T' + min);
max = Date.parse('1970-01-01T' + max);
}
ret = utils.randomDate(min, max);
if (format === 'unix') {
// We need to undo the timezone offset fix from utils.randomDate()
ret = Math.floor((ret.getTime() - ret.getTimezoneOffset() * 60000) / 1000);
} else if (format) {
ret = fecha.format(ret, format);
} else if (type === 'time') {
// Time has a default format if one is not specified
ret = fecha.format(ret, 'HH:mm');
}
return ret;
}
function getFirstName (options) {
// The value is cached so that other helpers can use it.
// Each helper is allowed to use the cached value just once.
var cache = options.data.root.__cache;
var ret = utils.randomArrayItem(options.data.root.firstNames);
cache.firstName = ret;
cache.username_firstName = ret;
cache.email_firstName = ret;
return ret;
}
function getLastName (options) {
// The value is cached so that other helpers can use it.
// Each helper is allowed to use the cached value just once.
var cache = options.data.root.__cache;
var ret = utils.randomArrayItem(options.data.root.lastNames);
cache.lastName = ret;
cache.username_lastName = ret;
cache.email_lastName = ret;
return ret;
}
function getCompany (options) {
// The value is cached so that other helpers can use it.
// Each helper is allowed to use the cached value just once.
var cache = options.data.root.__cache;
var ret = utils.randomArrayItem(options.data.root.companies);
cache.company = ret;
cache.domain_company = ret;
cache.email_company = ret;
return ret;
}
function getTld (options) {
// The value is cached so that other helpers can use it.
// Each helper is allowed to use the cached value just once.
var cache = options.data.root.__cache;
var tld = utils.randomArrayItem(options.data.root.tlds);
cache.tld = tld;
cache.domain_tld = tld;
cache.email_tld = tld;
return tld;
}
var helpers = {
repeat: function (min, max, options) {
var ret = '';
var total = 0;
var data;
var i;
if (arguments.length === 3) {
// If given two numbers then pick a random one between the two
total = utils.randomInt(min, max);
} else if (arguments.length === 2) {
// If given one number then just use it as a fixed repeat total
options = max;
total = min;
} else {
throw new Error('The repeat helper requires a numeric param');
}
// Create a shallow copy of data so we can add variables without modifying the original
data = Handlebars.Utils.extend({}, options.data);
for (i = 0; i < total; i++) {
// Clear the linked values on each iteration so a new set of names/companies is generated
options.data.root.__cache = {};
// You can access these in your template using @index, @total, @first, @last
data.index = i;
data.total = total;
data.first = i === 0;
data.last = i === total - 1;
// By using 'this' as the context the repeat block will inherit the current scope
ret = ret + options.fn(this, {data: data});
if (options.hash.comma !== false) {
// Trim any whitespace left by handlebars and add a comma if it doesn't already exist,
// also trim any trailing commas that might be at the end of the loop
ret = ret.trimRight();
if (i < total - 1 && ret.charAt(ret.length - 1) !== ',') {
ret += ',';
} else if (i === total - 1 && ret.charAt(ret.length - 1) === ',') {
ret = ret.slice(0, -1);
}
ret += os.EOL;
}
}
return ret;
},
int: function (min, max, format, options) {
if (arguments.length !== 3 && arguments.length !== 4) {
throw new Error('The int helper requires two numeric params');
}
return getNumber('int', min, max, format, options);
},
float: function (min, max, format, options) {
if (arguments.length !== 3 && arguments.length !== 4) {
throw new Error('The float helper requires two numeric params');
}
return getNumber('float', min, max, format, options);
},
boolean: function () {
return utils.randomBoolean().toString();
},
date: function (min, max, format, options) {
if (arguments.length !== 3 && arguments.length !== 4) {
throw new Error('The date helper requires two string params');
}
return getDate('date', min, max, format, options);
},
time: function (min, max, format, options) {
if (arguments.length !== 3 && arguments.length !== 4) {
throw new Error('The time helper requires two string params');
}
return getDate('time', min, max, format, options);
},
title: function (options) {
return utils.randomArrayItem(options.data.root.titles);
},
firstName: function (options) {
// Try to use the cached values first, otherwise generate a new value
var cache = options.data.root.__cache;
var ret = cache.firstName || getFirstName(options);
// The cached values are cleared so they can't be used again
cache.firstName = null;
return ret;
},
lastName: function (options) {
// Try to use the cached values first, otherwise generate a new value
var cache = options.data.root.__cache;
var ret = cache.lastName || getLastName(options);
// The cached values are cleared so they can't be used again
cache.lastName = null;
return ret;
},
username: function (options) {
// Try to use the cached values first, otherwise generate a new value
var cache = options.data.root.__cache;
var first = cache.username_firstName || getFirstName(options);
var last = cache.username_lastName || getLastName(options);
// The cached values are cleared so they can't be used again
cache.username_firstName = null;
cache.username_lastName = null;
return first.substr(0, 1).toLowerCase() + last.toLowerCase();
},
company: function (options) {
// Try to use the cached values first, otherwise generate a new value
var cache = options.data.root.__cache;
var company = cache.company || getCompany(options);
// The cached values are cleared so they can't be used again
cache.company = null;
return company;
},
tld: function (options) {
// Try to use the cached values first, otherwise generate a new value
var cache = options.data.root.__cache;
var tld = cache.tld || getTld(options);
// The cached values are cleared so they can't be used again
cache.tld = null;
return tld;
},
domain: function (options) {
// Try to use the cached values first, otherwise generate a new value
var cache = options.data.root.__cache;
var company = cache.domain_company || getCompany(options);
var tld = cache.domain_tld || getTld(options);
// The cached values are cleared so they can't be used again
cache.domain_company = null;
cache.domain_tld = null;
return company.toLowerCase() + '.' + tld;
},
email: function (options) {
// Try to use the cached values first, otherwise generate a new value
var cache = options.data.root.__cache;
var first = cache.email_firstName || getFirstName(options);
var last = cache.email_lastName || getLastName(options);
var company = cache.email_company || getCompany(options);
var tld = cache.email_tld || getTld(options);
// The cached values are cleared so they can't be used again
cache.email_firstName = null;
cache.email_lastName = null;
cache.email_company = null;
cache.email_tld = null;
return first.toLowerCase() + '.' + last.toLowerCase() +
'@' + company.toLowerCase() + '.' + tld;
},
street: function (options) {
return utils.randomArrayItem(options.data.root.streets);
},
city: function (options) {
return utils.randomArrayItem(options.data.root.cities);
},
country: function (options) {
var ret;
var rootData = options.data.root;
var cache = rootData.__cache;
// Try to use the cached values first, otherwise generate a new value
if (cache.country) {
ret = cache.country;
} else {
var pos = utils.randomInt(0, rootData.countries.length - 1);
ret = rootData.countries[pos];
cache.countryCode = rootData.countryCodes[pos];
}
// The cached values are cleared so they can't be used again
cache.country = null;
return ret;
},
countryCode: function (options) {
var ret;
var rootData = options.data.root;
var cache = rootData.__cache;
// Try to use the cached values first, otherwise generate a new value
if (cache.countryCode) {
ret = cache.countryCode;
} else {
var pos = utils.randomInt(0, rootData.countries.length - 1);
ret = rootData.countryCodes[pos];
cache.country = rootData.countries[pos];
}
// The cached values are cleared so they can't be used again
cache.countryCode = null;
return ret;
},
zipcode: function () {
return ('0' + utils.randomInt(1000, 99999).toString()).slice(-5);
},
postcode: function () {
return utils.randomChar() + utils.randomChar() + utils.randomInt(0, 9) + ' ' +
utils.randomInt(0, 9) + utils.randomChar() + utils.randomChar();
},
lat: function (options) {
return getNumber('float', -90, 90, '0.000000', options);
},
long: function (options) {
return getNumber('float', -180, 180, '0.000000', options);
},
phone: function (format) {
// Provide a default format if one is not given
format = (typeof format === 'string') ? format : 'xxx-xxx-xxxx';
return format.replace(/x/g, function () {
return utils.randomInt(0, 9);
});
},
guid: function () {
var ret = '';
var i = 0;
var mask = 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx';
var c, r, v;
while (i++ < 36) {
c = mask[i - 1];
r = utils.random() * 16 | 0;
v = (c === 'x') ? r : (r & 0x3 | 0x8);
ret += (c === '-' || c === '4') ? c : v.toString(16);
}
return ret;
},
ipv4: function () {
return utils.randomInt(1, 255) + '.' + utils.randomInt(0, 255) + '.' +
utils.randomInt(0, 255) + '.' + utils.randomInt(0, 255);
},
ipv6: function () {
return utils.randomInt(1, 0xffff).toString(16) + ':' +
utils.randomInt(0, 0xffff).toString(16) + ':' +
utils.randomInt(0, 0xffff).toString(16) + ':' +
utils.randomInt(0, 0xffff).toString(16) + ':' +
utils.randomInt(0, 0xffff).toString(16) + ':' +
utils.randomInt(0, 0xffff).toString(16) + ':' +
utils.randomInt(0, 0xffff).toString(16) + ':' +
utils.randomInt(0, 0xffff).toString(16);
},
color: function (options) {
return utils.randomArrayItem(options.data.root.colors);
},
hexColor: function (options) {
var r = utils.randomInt(0, 0xff);
var g = utils.randomInt(0, 0xff);
var b = utils.randomInt(0, 0xff);
if (options.hash.websafe === true) {
r = Math.round(r / 0x33) * 0x33;
g = Math.round(g / 0x33) * 0x33;
b = Math.round(b / 0x33) * 0x33;
}
// Ensure that single digit values are padded with leading zeros
return '#' +
('0' + r.toString(16)).slice(-2) +
('0' + g.toString(16)).slice(-2) +
('0' + b.toString(16)).slice(-2);
},
lorem: function (totalWords, options) {
var ret = '';
var i, word;
var isNewSentence = true;
var lastPunctuationIndex = 0;
// Juggle the arguments if totalWords wasn't provided
if (!options) {
options = totalWords;
totalWords = 25;
}
for (i = 0; i < totalWords; i++) {
word = utils.randomArrayItem(options.data.root.lorem);
// If the last iteration triggered a new sentence then capitalize the first letter
if (isNewSentence) {
word = word.charAt(0).toUpperCase() + word.slice(1);
isNewSentence = false;
}
// Only introduce new punctuation if we're more then 3 words away from the end,
// and more than 3 words since the last punctuation, and a 1 in 3 chance.
if (i < totalWords - 3 && i - lastPunctuationIndex > 3 && utils.random() < 0.3) {
isNewSentence = utils.random() < 0.6;
word = word + (isNewSentence ? '.' : ',');
lastPunctuationIndex = i;
}
ret = ret + word + ' ';
}
// Add a period/full-stop at the very end
ret = ret.trimRight() + '.';
return ret;
},
lowercase: function (value) {
return value.toLowerCase();
},
uppercase: function (value) {
return value.toUpperCase();
}
};
module.exports = helpers;

Просмотреть файл

@ -0,0 +1,229 @@
// Copyright (c) 2017 Matt Sweetman
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
var titles = [
'Mr', 'Mrs', 'Dr', 'Prof', 'Lord', 'Lady', 'Sir', 'Madam'
];
var firstNames = [
'Leanne', 'Edward', 'Haydee', 'Lyle', 'Shea', 'Curtis', 'Roselyn', 'Marcus', 'Lyn', 'Lloyd',
'Isabelle', 'Francis', 'Olivia', 'Roman', 'Myong', 'Jamie', 'Alexis', 'Vernon', 'Chloe', 'Max',
'Kirstie', 'Tyler', 'Katelin', 'Alejandro', 'Hannah', 'Gavin', 'Lynetta', 'Russell', 'Neida',
'Kurt', 'Dannielle', 'Aiden', 'Janett', 'Vaughn', 'Michelle', 'Brian', 'Maisha', 'Theo', 'Emma',
'Cedric', 'Jocelyn', 'Darrell', 'Grace', 'Ivan', 'Rikki', 'Erik', 'Madeleine', 'Rufus',
'Florance', 'Raymond', 'Jenette', 'Danny', 'Kathy', 'Michael', 'Layla', 'Rolf', 'Selma', 'Anton',
'Rosie', 'Craig', 'Victoria', 'Andy', 'Lorelei', 'Drew', 'Yuri', 'Miles', 'Raisa', 'Rico',
'Rosanne', 'Cory', 'Dori', 'Travis', 'Joslyn', 'Austin', 'Haley', 'Ian', 'Liza', 'Rickey',
'Susana', 'Stephen', 'Richelle', 'Lance', 'Jetta', 'Heath', 'Juliana', 'Rene', 'Madelyn', 'Stan',
'Eleanore', 'Jason', 'Alexa', 'Adam', 'Jenna', 'Warren', 'Cecilia', 'Benito', 'Elaine', 'Mitch',
'Raylene', 'Cyrus'
];
var lastNames = [
'Flinn', 'Bryd', 'Milligan', 'Keesee', 'Mercer', 'Chapman', 'Zobel', 'Carter', 'Pettey',
'Starck', 'Raymond', 'Pullman', 'Drolet', 'Higgins', 'Matzen', 'Tindel', 'Winter', 'Charley',
'Schaefer', 'Hancock', 'Dampier', 'Garling', 'Verde', 'Lenihan', 'Rhymer', 'Pleiman', 'Dunham',
'Seabury', 'Goudy', 'Latshaw', 'Whitson', 'Cumbie', 'Webster', 'Bourquin', 'Young', 'Rikard',
'Brier', 'Luck', 'Porras', 'Gilmore', 'Turner', 'Sprowl', 'Rohloff', 'Magby', 'Wallis', 'Mullens',
'Correa', 'Murphy', 'Connor', 'Gamble', 'Castleman', 'Pace', 'Durrett', 'Bourne', 'Hottle',
'Oldman', 'Paquette', 'Stine', 'Muldoon', 'Smit', 'Finn', 'Kilmer', 'Sager', 'White', 'Friedrich',
'Fennell', 'Miers', 'Carroll', 'Freeman', 'Hollis', 'Neal', 'Remus', 'Pickering', 'Woodrum',
'Bradbury', 'Caffey', 'Tuck', 'Jensen', 'Shelly', 'Hyder', 'Krumm', 'Hundt', 'Seal', 'Pendergast',
'Kelsey', 'Milling', 'Karst', 'Helland', 'Risley', 'Grieve', 'Paschall', 'Coolidge', 'Furlough',
'Brandt', 'Cadena', 'Rebelo', 'Leath', 'Backer', 'Bickers', 'Cappel'
];
var companies = [
'Unilogic', 'Solexis', 'Dalserve', 'Terrasys', 'Pancast', 'Tomiatech', 'Kancom', 'Iridimax',
'Proline', 'Qualcore', 'Thermatek', 'VTGrafix', 'Sunopia', 'WestGate', 'Chromaton', 'Tecomix',
'Galcom', 'Zatheon', 'OmniTouch', 'Hivemind', 'MultiServ', 'Citisys', 'Polygan', 'Dynaroc',
'Storex', 'Britech', 'Thermolock', 'Cryptonica', 'LoopSys', 'ForeTrust', 'TrueXT', 'LexiconLabs',
'Bellgate', 'Dynalab', 'Logico', 'Terralabs', 'CoreMax', 'Polycore', 'Infracom', 'Coolinga',
'MultiLingua', 'Conixco', 'QuadNet', 'FortyFour', 'TurboSystems', 'Optiplex', 'Nitrocam',
'CoreXTS', 'PeerSys', 'FastMart', 'Westercom', 'Templatek', 'Cirpria', 'FastFreight', 'Baramax',
'Superwire', 'Celmax', 'Connic', 'Forecore', 'SmartSystems', 'Ulogica', 'Seelogic', 'DynaAir',
'OpenServ', 'Maxcast', 'SixtySix', 'Protheon', 'SkyCenta', 'Eluxa', 'GrafixMedia', 'VenStrategy',
'Keycast', 'Opticast', 'Cameratek', 'CorpTek', 'Sealine', 'Playtech', 'Anaplex', 'Hypervision',
'Xenosys', 'Hassifix', 'Infratouch', 'Airconix', 'StrategyLine', 'Helixicon', 'MediaDime',
'NitroSystems', 'Viewtopia', 'Cryosoft', 'DuoServe', 'Acousticom', 'Freecast', 'CoreRobotics',
'Quadtek', 'Haltheon', 'TrioSys', 'Amsquare', 'Sophis', 'Keysoft', 'Creatonix'
];
var tlds = [
'com', 'org', 'net', 'info', 'edu', 'gov', 'co', 'biz', 'name', 'me', 'mobi', 'club', 'xyz', 'eu'
];
var streets = [
'Warner Street', 'Ceder Avenue', 'Glendale Road', 'Chester Square', 'Beechmont Parkway',
'Carter Street', 'Hinton Road', 'Pitman Street', 'Winston Road', 'Cottontail Road',
'Buckley Street', 'Concord Avenue', 'Clemont Street', 'Sleepy Lane', 'Bushey Crescent',
'Randolph Street', 'Radcliffe Road', 'Canal Street', 'Ridgewood Drive', 'Highland Drive',
'Orchard Road', 'Foster Walk', 'Walford Way', 'Harrington Crescent', 'Emmet Road',
'Berkeley Street', 'Clarendon Street', 'Sherman Road', 'Mount Street', 'Hunter Street',
'Pearl Street', 'Barret Street', 'Taylor Street', 'Shaftsbury Avenue', 'Paxton Street',
'Park Avenue', 'Seaside Drive', 'Tavistock Place', 'Prospect Place', 'Harvard Avenue',
'Elton Way', 'Green Street', 'Appleton Street', 'Banner Street', 'Piermont Drive', 'Brook Street',
'Main Street', 'Fairmont Avenue', 'Arlington Road', 'Rutherford Street', 'Windsor Avenue',
'Maple Street', 'Wandle Street', 'Grosvenor Square', 'Hunt Street', 'Haredale Road',
'Glenn Drive', 'Mulholland Drive', 'Baker Street', 'Fuller Road', 'Coleman Avenue', 'Wall Street',
'Robinson Street', 'Blakeley Street', 'Alexander Avenue', 'Gartland Street', 'Wooster Road',
'Brentwood Drive', 'Colwood Place', 'Rivington Street', 'Bramble Lane', 'Hartswood Road',
'Albion Place', 'Waverton Street', 'Sawmill Lane', 'Templeton Parkway', 'Hill Street',
'Marsham Street', 'Stockton Lane', 'Lake Drive', 'Elm Street', 'Winchester Drive',
'Crockett Street', 'High Street', 'Longford Crescent', 'Moreland Street', 'Sterling Street',
'Golden Lane', 'Mercer Street', 'Dunstable Street', 'Chestnut Walk', 'Rutland Drive',
'Buckfield Lane', 'Pembrooke Street', 'Tower Lane', 'Willow Avenue', 'Faraday Street',
'Springfield Street', 'Crawford Street', 'Hudson Street'
];
var cities = [
'Beaverton', 'Stanford', 'Baltimore', 'Newcastle', 'Halifax', 'Rockhampton', 'Coventry',
'Medford', 'Boulder', 'Dover', 'Waterbury', 'Christchurch', 'Manchester', 'Perth', 'Norwich',
'Redmond', 'Plymouth', 'Tacoma', 'Newport', 'Bradford', 'Aspen', 'Wellington', 'Oakland',
'Norfolk', 'Durham', 'Portsmouth', 'Detroit', 'Portland', 'Northampton', 'Dayton', 'Charleston',
'Irvine', 'Dallas', 'Albany', 'Petersburg', 'Melbourne', 'Southampton', 'Stafford', 'Bridgeport',
'Fairfield', 'Dundee', 'Spokane', 'Oakleigh', 'Bristol', 'Sacramento', 'Sheffield', 'Lewisburg',
'Miami', 'Brisbane', 'Denver', 'Kingston', 'Burwood', 'Rochester', 'Fresno', 'Cardiff',
'Auckland', 'Sudbury', 'Hastings', 'Reno', 'Hillboro', 'Palmerston', 'Oxford', 'Hobart',
'Atlanta', 'Wilmington', 'Vancouver', 'Youngstown', 'Hartford', 'London', 'Danbury', 'Birmingham',
'Columbia', 'Dublin', 'Chicago', 'Toronto', 'Orlando', 'Toledo', 'Pheonix', 'Bakersfield',
'Nottingham', 'Newark', 'Fargo', 'Walkerville', 'Exeter', 'Woodville', 'Greenville', 'Frankston',
'Bangor', 'Seattle', 'Canterbury', 'Colchester', 'Boston', 'York', 'Cambridge', 'Brighton',
'Lancaster', 'Adelaide', 'Cleveland', 'Telford', 'Richmond'
];
var countries = [
'Andorra', 'United Arab Emirates', 'Afghanistan', 'Antigua and Barbuda', 'Anguilla', 'Albania',
'Armenia', 'Angola', 'Antarctica', 'Argentina', 'American Samoa', 'Austria', 'Australia', 'Aruba',
'Åland Islands', 'Azerbaijan', 'Bosnia and Herzegovina', 'Barbados', 'Bangladesh', 'Belgium',
'Burkina Faso', 'Bulgaria', 'Bahrain', 'Burundi', 'Benin', 'Saint Barthélemy', 'Bermuda',
'Brunei Darussalam', 'Bolivia, Plurinational State of', 'Bonaire, Sint Eustatius and Saba',
'Brazil', 'Bahamas', 'Bhutan', 'Bouvet Island', 'Botswana', 'Belarus', 'Belize', 'Canada',
'Cocos (Keeling) Islands', 'Congo, the Democratic Republic of the', 'Central African Republic',
'Congo', 'Switzerland', 'Côte d\'Ivoire', 'Cook Islands', 'Chile', 'Cameroon', 'China',
'Colombia', 'Costa Rica', 'Cuba', 'Cabo Verde', 'Curaçao', 'Christmas Island', 'Cyprus',
'Czech Republic', 'Germany', 'Djibouti', 'Denmark', 'Dominica', 'Dominican Republic', 'Algeria',
'Ecuador', 'Estonia', 'Egypt', 'Western Sahara', 'Eritrea', 'Spain', 'Ethiopia', 'Finland',
'Fiji', 'Falkland Islands (Malvinas)', 'Micronesia, Federated States of', 'Faroe Islands',
'France', 'Gabon', 'United Kingdom of Great Britain and Northern Ireland', 'Grenada', 'Georgia',
'French Guiana', 'Guernsey', 'Ghana', 'Gibraltar', 'Greenland', 'Gambia', 'Guinea', 'Guadeloupe',
'Equatorial Guinea', 'Greece', 'South Georgia and the South Sandwich Islands', 'Guatemala',
'Guam', 'Guinea-Bissau', 'Guyana', 'Hong Kong', 'Heard Island and McDonald Islands', 'Honduras',
'Croatia', 'Haiti', 'Hungary', 'Indonesia', 'Ireland', 'Israel', 'Isle of Man', 'India',
'British Indian Ocean Territory', 'Iraq', 'Iran, Islamic Republic of', 'Iceland', 'Italy',
'Jersey', 'Jamaica', 'Jordan', 'Japan', 'Kenya', 'Kyrgyzstan', 'Cambodia', 'Kiribati', 'Comoros',
'Saint Kitts and Nevis', 'Korea, Democratic People\'s Republic of', 'Korea, Republic of',
'Kuwait', 'Cayman Islands', 'Kazakhstan', 'Lao People\'s Democratic Republic', 'Lebanon',
'Saint Lucia', 'Liechtenstein', 'Sri Lanka', 'Liberia', 'Lesotho', 'Lithuania', 'Luxembourg',
'Latvia', 'Libya', 'Morocco', 'Monaco', 'Moldova, Republic of', 'Montenegro',
'Saint Martin (French part)', 'Madagascar', 'Marshall Islands',
'Macedonia, the former Yugoslav Republic of', 'Mali', 'Myanmar', 'Mongolia', 'Macao',
'Northern Mariana Islands', 'Martinique', 'Mauritania', 'Montserrat', 'Malta', 'Mauritius',
'Maldives', 'Malawi', 'Mexico', 'Malaysia', 'Mozambique', 'Namibia', 'New Caledonia', 'Niger',
'Norfolk Island', 'Nigeria', 'Nicaragua', 'Netherlands', 'Norway', 'Nepal', 'Nauru', 'Niue',
'New Zealand', 'Oman', 'Panama', 'Peru', 'French Polynesia', 'Papua New Guinea', 'Philippines',
'Pakistan', 'Poland', 'Saint Pierre and Miquelon', 'Pitcairn', 'Puerto Rico',
'Palestine, State of', 'Portugal', 'Palau', 'Paraguay', 'Qatar', 'Réunion', 'Romania', 'Serbia',
'Russian Federation', 'Rwanda', 'Saudi Arabia', 'Solomon Islands', 'Seychelles', 'Sudan',
'Sweden', 'Singapore', 'Saint Helena, Ascension and Tristan da Cunha', 'Slovenia',
'Svalbard and Jan Mayen', 'Slovakia', 'Sierra Leone', 'San Marino', 'Senegal', 'Somalia',
'Suriname', 'South Sudan', 'Sao Tome and Principe', 'El Salvador', 'Sint Maarten (Dutch part)',
'Syrian Arab Republic', 'Swaziland', 'Turks and Caicos Islands', 'Chad',
'French Southern Territories', 'Togo', 'Thailand', 'Tajikistan', 'Tokelau', 'Timor-Leste',
'Turkmenistan', 'Tunisia', 'Tonga', 'Turkey', 'Trinidad and Tobago', 'Tuvalu',
'Taiwan, Province of China', 'Tanzania, United Republic of', 'Ukraine', 'Uganda',
'United States Minor Outlying Islands', 'United States of America', 'Uruguay', 'Uzbekistan',
'Holy See', 'Saint Vincent and the Grenadines', 'Venezuela, Bolivarian Republic of',
'Virgin Islands, British', 'Virgin Islands, U.S.', 'Viet Nam', 'Vanuatu', 'Wallis and Futuna',
'Samoa', 'Yemen', 'Mayotte', 'South Africa', 'Zambia', 'Zimbabwe'
];
var countryCodes = [
'AD', 'AE', 'AF', 'AG', 'AI', 'AL', 'AM', 'AO', 'AQ', 'AR', 'AS', 'AT', 'AU', 'AW', 'AX', 'AZ',
'BA', 'BB', 'BD', 'BE', 'BF', 'BG', 'BH', 'BI', 'BJ', 'BL', 'BM', 'BN', 'BO', 'BQ', 'BR', 'BS',
'BT', 'BV', 'BW', 'BY', 'BZ', 'CA', 'CC', 'CD', 'CF', 'CG', 'CH', 'CI', 'CK', 'CL', 'CM', 'CN',
'CO', 'CR', 'CU', 'CV', 'CW', 'CX', 'CY', 'CZ', 'DE', 'DJ', 'DK', 'DM', 'DO', 'DZ', 'EC', 'EE',
'EG', 'EH', 'ER', 'ES', 'ET', 'FI', 'FJ', 'FK', 'FM', 'FO', 'FR', 'GA', 'GB', 'GD', 'GE', 'GF',
'GG', 'GH', 'GI', 'GL', 'GM', 'GN', 'GP', 'GQ', 'GR', 'GS', 'GT', 'GU', 'GW', 'GY', 'HK', 'HM',
'HN', 'HR', 'HT', 'HU', 'ID', 'IE', 'IL', 'IM', 'IN', 'IO', 'IQ', 'IR', 'IS', 'IT', 'JE', 'JM',
'JO', 'JP', 'KE', 'KG', 'KH', 'KI', 'KM', 'KN', 'KP', 'KR', 'KW', 'KY', 'KZ', 'LA', 'LB', 'LC',
'LI', 'LK', 'LR', 'LS', 'LT', 'LU', 'LV', 'LY', 'MA', 'MC', 'MD', 'ME', 'MF', 'MG', 'MH', 'MK',
'ML', 'MM', 'MN', 'MO', 'MP', 'MQ', 'MR', 'MS', 'MT', 'MU', 'MV', 'MW', 'MX', 'MY', 'MZ', 'NA',
'NC', 'NE', 'NF', 'NG', 'NI', 'NL', 'NO', 'NP', 'NR', 'NU', 'NZ', 'OM', 'PA', 'PE', 'PF', 'PG',
'PH', 'PK', 'PL', 'PM', 'PN', 'PR', 'PS', 'PT', 'PW', 'PY', 'QA', 'RE', 'RO', 'RS', 'RU', 'RW',
'SA', 'SB', 'SC', 'SD', 'SE', 'SG', 'SH', 'SI', 'SJ', 'SK', 'SL', 'SM', 'SN', 'SO', 'SR', 'SS',
'ST', 'SV', 'SX', 'SY', 'SZ', 'TC', 'TD', 'TF', 'TG', 'TH', 'TJ', 'TK', 'TL', 'TM', 'TN', 'TO',
'TR', 'TT', 'TV', 'TW', 'TZ', 'UA', 'UG', 'UM', 'US', 'UY', 'UZ', 'VA', 'VC', 'VE', 'VG', 'VI',
'VN', 'VU', 'WF', 'WS', 'YE', 'YT', 'ZA', 'ZM', 'ZW'
];
var colors = [
'aliceblue', 'antiquewhite', 'aqua', 'aquamarine', 'azure', 'beige', 'bisque', 'black',
'blanchedalmond', 'blue', 'blueviolet', 'brown', 'burlywood', 'cadetblue', 'chartreuse',
'chocolate', 'coral', 'cornflowerblue', 'cornsilk', 'crimson', 'cyan', 'darkblue', 'darkcyan',
'darkgoldenrod', 'darkgray', 'darkgreen', 'darkkhaki', 'darkmagenta', 'darkolivegreen',
'darkorange', 'darkorchid', 'darkred', 'darksalmon', 'darkseagreen', 'darkslateblue',
'darkslategray', 'darkturquoise', 'darkviolet', 'deeppink', 'deepskyblue', 'dimgray',
'dodgerblue', 'firebrick', 'floralwhite', 'forestgreen', 'fuchsia', 'gainsboro', 'ghostwhite',
'gold', 'goldenrod', 'gray', 'green', 'greenyellow', 'honeydew', 'hotpink', 'indianred', 'indigo',
'ivory', 'khaki', 'lavender', 'lavenderblush', 'lawngreen', 'lemonchiffon', 'lightblue',
'lightcoral', 'lightcyan', 'lightgoldenrodyellow', 'lightgray', 'lightgreen', 'lightpink',
'lightsalmon', 'lightseagreen', 'lightskyblue', 'lightslategray', 'lightsteelblue', 'lightyellow',
'lime', 'limegreen', 'linen', 'magenta', 'maroon', 'mediumaquamarine', 'mediumblue',
'mediumorchid', 'mediumpurple', 'mediumseagreen', 'mediumslateblue', 'mediumspringgreen',
'mediumturquoise', 'mediumvioletred', 'midnightblue', 'mintcream', 'mistyrose', 'moccasin',
'navajowhite', 'navy', 'oldlace', 'olive', 'olivedrab', 'orange', 'orangered', 'orchid',
'palegoldenrod', 'palegreen', 'paleturquoise', 'palevioletred', 'papayawhip', 'peachpuff', 'peru',
'pink', 'plum', 'powderblue', 'purple', 'rebeccapurple', 'red', 'rosybrown', 'royalblue',
'saddlebrown', 'salmon', 'sandybrown', 'seagreen', 'seashell', 'sienna', 'silver', 'skyblue',
'slateblue', 'slategray', 'snow', 'springgreen', 'steelblue', 'tan', 'teal', 'thistle', 'tomato',
'turquoise', 'violet', 'wheat', 'white', 'whitesmoke', 'yellow', 'yellowgreen'
];
var lorem = [
'lorem', 'ipsum', 'dolor', 'sit', 'amet', 'consectetur', 'adipiscing', 'elit', 'morbi',
'vulputate', 'eros', 'ut', 'mi', 'laoreet', 'viverra', 'nunc', 'lacinia', 'non', 'condimentum',
'aenean', 'lacus', 'nisl', 'auctor', 'at', 'tortor', 'ac', 'fringilla', 'sodales', 'pretium',
'quis', 'iaculis', 'in', 'aliquam', 'ultrices', 'felis', 'accumsan', 'ornare', 'etiam',
'elementum', 'aliquet', 'finibus', 'maecenas', 'dignissim', 'vel', 'blandit', 'placerat', 'sed',
'tempor', 'ex', 'faucibus', 'velit', 'nam', 'erat', 'augue', 'quisque', 'nulla', 'maximus',
'vitae', 'e', 'lobortis', 'euismod', 'tristique', 'metus', 'vehicula', 'purus', 'diam', 'mollis',
'neque', 'eu', 'porttitor', 'mauris', 'a', 'risus', 'orci', 'tincidunt', 'scelerisque',
'vestibulum', 'dui', 'ante', 'posuere', 'turpis', 'enim', 'cras', 'massa', 'cursus', 'suscipit',
'tempus', 'facilisis', 'ultricies', 'i', 'eget', 'imperdiet', 'donec', 'arcu', 'ligula',
'sagittis', 'hendrerit', 'justo', 'pellentesque', 'mattis', 'lacinia', 'leo', 'est', 'magna',
'nibh', 'sem', 'natoque', 'consequat', 'proin', 'eti', 'commodo', 'rhoncus', 'dictum', 'id',
'pharetra', 'sapien', 'gravida', 'sollicitudin', 'curabitur', 'au', 'nisi', 'bibendum', 'lectus',
'et', 'pulvinar'
];
module.exports = {
titles: titles,
firstNames: firstNames,
lastNames: lastNames,
companies: companies,
tlds: tlds,
streets: streets,
cities: cities,
countries: countries,
countryCodes: countryCodes,
colors: colors,
lorem: lorem
};

Просмотреть файл

@ -0,0 +1,64 @@
// Copyright (c) 2017 Matt Sweetman
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
var seedrandom = require('seedrandom');
// Create an instance of the prng without a seed (so it'll be a random sequence every time)
var prng = seedrandom();
var utils = {
setRandomSeed: function (seed) {
prng = seedrandom(seed);
},
random: function () {
return prng();
},
randomInt: function (min, max) {
return Math.floor(utils.random() * (max - min + 1)) + min;
},
randomFloat: function (min, max) {
return utils.random() * (max - min) + min;
},
randomBoolean: function () {
return utils.random() < 0.5;
},
randomDate: function (min, max) {
// We add the timezone offset to avoid the date falling outside the supplied range
var d = new Date(Math.floor(utils.random() * (max - min)) + min);
d.setTime(d.getTime() + d.getTimezoneOffset() * 60000);
return d;
},
randomArrayItem: function (array) {
return array[utils.randomInt(0, array.length - 1)];
},
randomChar: function (charset) {
charset = charset || 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
return charset.charAt(utils.randomInt(0, charset.length - 1));
}
};
module.exports = utils;

98
package-lock.json сгенерированный
Просмотреть файл

@ -1,6 +1,6 @@
{
"name": "azure-iot-toolkit",
"version": "2.15.0",
"version": "2.16.0-rc",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
@ -796,7 +796,7 @@
},
"util": {
"version": "0.10.3",
"resolved": "http://registry.npmjs.org/util/-/util-0.10.3.tgz",
"resolved": "https://registry.npmjs.org/util/-/util-0.10.3.tgz",
"integrity": "sha1-evsa/lCAUkZInj23/g7TeTNqwPk=",
"dev": true,
"requires": {
@ -1502,7 +1502,7 @@
},
"browserify-aes": {
"version": "1.2.0",
"resolved": "http://registry.npmjs.org/browserify-aes/-/browserify-aes-1.2.0.tgz",
"resolved": "https://registry.npmjs.org/browserify-aes/-/browserify-aes-1.2.0.tgz",
"integrity": "sha512-+7CHXqGuspUn/Sl5aO7Ea0xWGAtETPXNSAjHo48JfLdPWcMng33Xe4znFvQweqc/uzk5zSOI3H52CYnjCfb5hA==",
"dev": true,
"requires": {
@ -1544,7 +1544,7 @@
},
"browserify-rsa": {
"version": "4.0.1",
"resolved": "http://registry.npmjs.org/browserify-rsa/-/browserify-rsa-4.0.1.tgz",
"resolved": "https://registry.npmjs.org/browserify-rsa/-/browserify-rsa-4.0.1.tgz",
"integrity": "sha1-IeCr+vbyApzy+vsTNWenAdQTVSQ=",
"dev": true,
"requires": {
@ -2075,7 +2075,7 @@
},
"create-hash": {
"version": "1.2.0",
"resolved": "http://registry.npmjs.org/create-hash/-/create-hash-1.2.0.tgz",
"resolved": "https://registry.npmjs.org/create-hash/-/create-hash-1.2.0.tgz",
"integrity": "sha512-z00bCGNHDG8mHAkP7CtT1qVu+bFQUPjYq/4Iv3C3kWjTFV10zIjfSoeqXo9Asws8gwSHDGj/hl2u4OGIjapeCg==",
"dev": true,
"requires": {
@ -2088,7 +2088,7 @@
},
"create-hmac": {
"version": "1.1.7",
"resolved": "http://registry.npmjs.org/create-hmac/-/create-hmac-1.1.7.tgz",
"resolved": "https://registry.npmjs.org/create-hmac/-/create-hmac-1.1.7.tgz",
"integrity": "sha512-MJG9liiZ+ogc4TzUwuvbER1JRdgvUFSB5+VR/g5h82fGaIRWMWddtKBHi7/sVhfjQZ6SehlyhvQYrcYkaUIpLg==",
"dev": true,
"requires": {
@ -2313,7 +2313,7 @@
},
"diffie-hellman": {
"version": "5.0.3",
"resolved": "http://registry.npmjs.org/diffie-hellman/-/diffie-hellman-5.0.3.tgz",
"resolved": "https://registry.npmjs.org/diffie-hellman/-/diffie-hellman-5.0.3.tgz",
"integrity": "sha512-kqag/Nl+f3GwyK25fhUMYj81BUOrZ9IuJsjIcDE5icNM9FJHAVm3VcUDxdLPoQtTuUylWm6ZIknYJwwaPxsUzg==",
"dev": true,
"requires": {
@ -2389,17 +2389,6 @@
"is-obj": "^1.0.0"
}
},
"dummy-json": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/dummy-json/-/dummy-json-2.0.0.tgz",
"integrity": "sha1-eZ8OCkt3doXJe6+dVueKQkquoAo=",
"requires": {
"fecha": "^1.1.0",
"handlebars": "~4.0.5",
"numbro": "^1.6.2",
"seedrandom": "^2.4.2"
}
},
"duplexer": {
"version": "0.1.1",
"resolved": "https://registry.npmjs.org/duplexer/-/duplexer-0.1.1.tgz",
@ -2894,9 +2883,9 @@
"integrity": "sha1-1RQsDK7msRifh9OnYREGT4bIu/I="
},
"fecha": {
"version": "1.2.2",
"resolved": "https://registry.npmjs.org/fecha/-/fecha-1.2.2.tgz",
"integrity": "sha1-FNldjIgxNmhG5syQ8shwIp560fk="
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/fecha/-/fecha-1.1.0.tgz",
"integrity": "sha1-Hgp2PVhTG32FARdlwRSOjShkdw4="
},
"figgy-pudding": {
"version": "3.5.1",
@ -3835,29 +3824,14 @@
"dev": true
},
"handlebars": {
"version": "4.0.14",
"resolved": "https://registry.npmjs.org/handlebars/-/handlebars-4.0.14.tgz",
"integrity": "sha512-E7tDoyAA8ilZIV3xDJgl18sX3M8xB9/fMw8+mfW4msLW8jlX97bAnWgT3pmaNXuvzIEgSBMnAHfuXsB2hdzfow==",
"version": "4.3.0",
"resolved": "https://registry.npmjs.org/handlebars/-/handlebars-4.3.0.tgz",
"integrity": "sha512-7XlnO8yBXOdi7AzowjZssQr47Ctidqm7GbgARapOaqSN9HQhlClnOkR9HieGauIT3A8MBC6u9wPCXs97PCYpWg==",
"requires": {
"async": "^2.5.0",
"neo-async": "^2.6.0",
"optimist": "^0.6.1",
"source-map": "^0.6.1",
"uglify-js": "^3.1.4"
},
"dependencies": {
"async": {
"version": "2.6.3",
"resolved": "https://registry.npmjs.org/async/-/async-2.6.3.tgz",
"integrity": "sha512-zflvls11DCy+dQWzTW2dzuilv8Z5X/pjfmZOWba6TNIVDm+2UDaJmXSOXlasHKfNBs8oo3M0aT50fDEWfKZjXg==",
"requires": {
"lodash": "^4.17.14"
}
},
"source-map": {
"version": "0.6.1",
"resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz",
"integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g=="
}
}
},
"har-schema": {
@ -5136,12 +5110,11 @@
"neo-async": {
"version": "2.6.1",
"resolved": "https://registry.npmjs.org/neo-async/-/neo-async-2.6.1.tgz",
"integrity": "sha512-iyam8fBuCUpWeKPGpaNMetEocMt364qkCsfL9JuhjXX6dRnguRVOfk2GZaDpPjcOKiiXCPINZC1GczQ7iTq3Zw==",
"dev": true
"integrity": "sha512-iyam8fBuCUpWeKPGpaNMetEocMt364qkCsfL9JuhjXX6dRnguRVOfk2GZaDpPjcOKiiXCPINZC1GczQ7iTq3Zw=="
},
"next-tick": {
"version": "1.0.0",
"resolved": "http://registry.npmjs.org/next-tick/-/next-tick-1.0.0.tgz",
"resolved": "https://registry.npmjs.org/next-tick/-/next-tick-1.0.0.tgz",
"integrity": "sha1-yobR/ogoFpsBICCOPchCS524NCw="
},
"nice-try": {
@ -5216,9 +5189,9 @@
}
},
"numbro": {
"version": "1.11.1",
"resolved": "https://registry.npmjs.org/numbro/-/numbro-1.11.1.tgz",
"integrity": "sha512-qL0Etqbunz4RtPx4bNjMONe9HyUpgbrM4Sa3VpWY5oRdp9ry5DufAj6lCvnIcluRBA9QUacrllYc73QK0G6VAw=="
"version": "1.6.2",
"resolved": "https://registry.npmjs.org/numbro/-/numbro-1.6.2.tgz",
"integrity": "sha1-xFyaThwltnOgbBg/Lc23WrZY8mk="
},
"oauth-sign": {
"version": "0.9.0",
@ -6038,7 +6011,7 @@
},
"safe-regex": {
"version": "1.1.0",
"resolved": "http://registry.npmjs.org/safe-regex/-/safe-regex-1.1.0.tgz",
"resolved": "https://registry.npmjs.org/safe-regex/-/safe-regex-1.1.0.tgz",
"integrity": "sha1-QKNmnzsHfR6UPURinhV91IAjvy4=",
"dev": true,
"requires": {
@ -6067,9 +6040,9 @@
}
},
"seedrandom": {
"version": "2.4.4",
"resolved": "https://registry.npmjs.org/seedrandom/-/seedrandom-2.4.4.tgz",
"integrity": "sha512-9A+PDmgm+2du77B5i0Ip2cxOqqHjgNxnBgglxLcX78A2D6c2rTo61z4jnVABpF4cKeDMDG+cmXXvdnqse2VqMA=="
"version": "2.4.2",
"resolved": "https://registry.npmjs.org/seedrandom/-/seedrandom-2.4.2.tgz",
"integrity": "sha1-GNeMQSh9E6/46tsp4jWTiySKqf8="
},
"semver": {
"version": "5.7.1",
@ -6185,7 +6158,7 @@
},
"sha.js": {
"version": "2.4.11",
"resolved": "http://registry.npmjs.org/sha.js/-/sha.js-2.4.11.tgz",
"resolved": "https://registry.npmjs.org/sha.js/-/sha.js-2.4.11.tgz",
"integrity": "sha512-QMEp5B7cftE7APOjk5Y6xgrbWu+WkLVQwk8JNjZ8nKRciZaByEW6MubieAiToS7+dwvrjGhH8jRXz3MVd0AYqQ==",
"dev": true,
"requires": {
@ -6368,8 +6341,7 @@
"source-map": {
"version": "0.6.1",
"resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz",
"integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==",
"dev": true
"integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g=="
},
"source-map-resolve": {
"version": "0.5.2",
@ -6929,25 +6901,19 @@
"dev": true
},
"uglify-js": {
"version": "3.6.0",
"resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.6.0.tgz",
"integrity": "sha512-W+jrUHJr3DXKhrsS7NUVxn3zqMOFn0hL/Ei6v0anCIMoKC93TjcflTagwIHLW7SfMFfiQuktQyFVCFHGUE0+yg==",
"version": "3.7.5",
"resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.7.5.tgz",
"integrity": "sha512-GFZ3EXRptKGvb/C1Sq6nO1iI7AGcjyqmIyOw0DrD0675e+NNbGO72xmMM2iEBdFbxaTLo70NbjM/Wy54uZIlsg==",
"optional": true,
"requires": {
"commander": "~2.20.0",
"commander": "~2.20.3",
"source-map": "~0.6.1"
},
"dependencies": {
"commander": {
"version": "2.20.0",
"resolved": "https://registry.npmjs.org/commander/-/commander-2.20.0.tgz",
"integrity": "sha512-7j2y+40w61zy6YC2iRNpUe/NwhNyoXrYpHMrSunaMG64nRnaf96zO/KMQR4OyN/UnE5KLyEBnKHd4aG3rskjpQ==",
"optional": true
},
"source-map": {
"version": "0.6.1",
"resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz",
"integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==",
"version": "2.20.3",
"resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz",
"integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==",
"optional": true
}
}

Просмотреть файл

@ -2,7 +2,7 @@
"name": "azure-iot-toolkit",
"displayName": "Azure IoT Hub",
"description": "This extension is now a part of Azure IoT Tools extension pack. We highly recommend installing Azure IoT Tools to get full capabilities for Azure IoT development. Interact with Azure IoT Hub, IoT Device Management, IoT Edge Management, IoT Hub Device Simulation, IoT Hub Code Generation and IoT Hub Device Provisioning Service (DPS).",
"version": "2.15.0",
"version": "2.16.0-rc",
"publisher": "vsciot-vscode",
"aiKey": "0caaff90-cc1c-4def-b64c-3ef33615bc9b",
"icon": "logo.png",
@ -710,9 +710,9 @@
"command": "azure-iot-toolkit.startMonitorIoTHubMessageWithAbbreviation",
"when": "never"
},
{
"command": "azure-iot-dps.loadMore",
"when": "never"
{
"command": "azure-iot-dps.loadMore",
"when": "never"
}
]
},
@ -824,12 +824,15 @@
"azure-iot-device-mqtt": "^1.8.1",
"azure-iothub": "^1.8.1",
"body-parser": "^1.18.2",
"dummy-json": "^2.0.0",
"express": "^4.16.3",
"fecha": "^1.1.0",
"fs-extra": "^7.0.0",
"handlebars": "^4.3.0",
"ms-rest": "^2.3.2",
"ms-rest-azure": "^2.5.5",
"numbro": "^1.6.2",
"replace-in-file": "^3.4.0",
"seedrandom": "^2.4.2",
"strip-json-comments": "^2.0.1",
"uuid": "^3.3.2",
"vscode-azureextensionui": "^0.28.2",

Просмотреть файл

@ -6,8 +6,8 @@ import { ConnectionString } from "azure-iot-common";
import { Message } from "azure-iot-device";
import { Client } from "azure-iot-device";
import { clientFromConnectionString } from "azure-iot-device-mqtt";
import * as dummyjson from "dummy-json";
import * as vscode from "vscode";
import * as dummyjson from "../external_lib/dummy-json";
import { Constants } from "./constants";
import { IoTHubResourceExplorer } from "./iotHubResourceExplorer";
import { DeviceItem } from "./Model/DeviceItem";
@ -157,7 +157,7 @@ export class Simulator {
} else {
// Exit when no connection string found or the connection string is invalid.
if (!this.iotHubConnectionString) {
var errorMessage = "Failed to launch Send D2C Messages webview: No IoT Hub Connection String Found.";
let errorMessage = "Failed to launch Send D2C Messages webview: No IoT Hub Connection String Found.";
vscode.window.showErrorMessage(errorMessage);
this.telemetry(Constants.SimulatorLaunchEvent, false, {
error: errorMessage,

Просмотреть файл

@ -1,9 +1,9 @@
import * as bodyParser from "body-parser";
import * as dummyjson from "dummy-json";
import * as express from "express";
import * as http from "http";
import { AddressInfo } from "net";
import * as vscode from "vscode";
import * as dummyjson from "../../external_lib/dummy-json";
import { Constants } from "../constants";
import { DeviceItem } from "../Model/DeviceItem";
import { SendStatus } from "../sendStatus";

Просмотреть файл

@ -95,6 +95,12 @@ const config = {
false,
/$^/
),
// Numbro
new webpack.ContextReplacementPlugin(
/numbro/,
false,
/$^/
),
// Copy required resources for Azure treeview
new copyPlugin([
path.join('node_modules', 'vscode-azureextensionui', 'resources', '**', '*.svg')