mqtt and socket added

This commit is contained in:
Miisa Ekholm
2022-10-21 11:17:48 +03:00
parent 52370df9ce
commit 9e3d953b9e
751 changed files with 185105 additions and 153 deletions

27
WebUI/node_modules/help-me/.github/workflows/ci.yml generated vendored Normal file
View File

@@ -0,0 +1,27 @@
name: ci
on: [push, pull_request]
jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [10.x, 12.x, 14.x, 16.x]
steps:
- uses: actions/checkout@v2
- name: Use Node.js
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- name: Install
run: |
npm install
- name: Run tests
run: |
npm run test

22
WebUI/node_modules/help-me/LICENSE generated vendored Normal file
View File

@@ -0,0 +1,22 @@
The MIT License (MIT)
Copyright (c) 2014 Matteo Collina
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.

53
WebUI/node_modules/help-me/README.md generated vendored Normal file
View File

@@ -0,0 +1,53 @@
help-me
=======
Help command for node, to use with [minimist](http://npm.im/minimist) and [commist](http://npm.im/commist).
Example
-------
```js
'use strict'
var helpMe = require('help-me')
var path = require('path')
var help = helpMe({
dir: path.join(__dirname, 'doc'),
// the default
ext: '.txt'
})
help
.createStream(['hello']) // can support also strings
.pipe(process.stdout)
// little helper to do the same
help.toStdout(['hello']
```
Usage with commist
------------------
[Commist](http://npm.im/commist) provide a command system for node.
```js
var commist = require('commist')()
var path = require('path')
var help = require('help-me')({
dir: path.join(__dirname, 'doc')
})
commist.register('help', help.toStdout)
commist.parse(process.argv.splice(2))
```
Acknowledgements
----------------
This project was kindly sponsored by [nearForm](http://nearform.com).
License
-------
MIT

1
WebUI/node_modules/help-me/doc/hello.txt generated vendored Normal file
View File

@@ -0,0 +1 @@
this is hello world

1
WebUI/node_modules/help-me/doc/help.txt generated vendored Normal file
View File

@@ -0,0 +1 @@
aaaaa

8
WebUI/node_modules/help-me/example.js generated vendored Normal file
View File

@@ -0,0 +1,8 @@
'use strict'
const commist = require('commist')()
const help = require('./')()
commist.register('help', help.toStdout)
commist.parse(process.argv.splice(2))

1
WebUI/node_modules/help-me/fixture/basic/hello.txt generated vendored Normal file
View File

@@ -0,0 +1 @@
ahdsadhdash

1
WebUI/node_modules/help-me/fixture/basic/help.txt generated vendored Normal file
View File

@@ -0,0 +1 @@
hello world

0
WebUI/node_modules/help-me/fixture/dir/a/b.txt generated vendored Normal file
View File

1
WebUI/node_modules/help-me/fixture/no-ext/hello generated vendored Normal file
View File

@@ -0,0 +1 @@
ghghghhg

View File

@@ -0,0 +1 @@
hello world

View File

@@ -0,0 +1 @@
hello

View File

@@ -0,0 +1 @@
ewweqjewqjewqj

View File

@@ -0,0 +1 @@
45678

View File

@@ -0,0 +1 @@
12345

93
WebUI/node_modules/help-me/help-me.js generated vendored Normal file
View File

@@ -0,0 +1,93 @@
'use strict'
const fs = require('fs')
const { PassThrough, pipeline } = require('readable-stream')
const glob = require('glob')
const defaults = {
ext: '.txt',
help: 'help'
}
function isDirectory (path) {
try {
const stat = fs.lstatSync(path)
return stat.isDirectory()
} catch (err) {
return false
}
}
function helpMe (opts) {
opts = Object.assign({}, defaults, opts)
if (!opts.dir) {
throw new Error('missing dir')
}
if (!isDirectory(opts.dir)) {
throw new Error(`${opts.dir} is not a directory`)
}
return {
createStream: createStream,
toStdout: toStdout
}
function createStream (args) {
if (typeof args === 'string') {
args = args.split(' ')
} else if (!args || args.length === 0) {
args = [opts.help]
}
const out = new PassThrough()
const re = new RegExp(args.map(function (arg) {
return arg + '[a-zA-Z0-9]*'
}).join('[ /]+'))
glob(opts.dir + '/**/*' + opts.ext, function (err, files) {
if (err) return out.emit('error', err)
files = files.map(function (path) {
const relative = path.replace(opts.dir, '').replace(/^\//, '')
return { path, relative }
}).filter(function (file) {
return file.relative.match(re)
})
if (files.length === 0) {
return out.emit('error', new Error('no such help file'))
} else if (files.length > 1) {
const exactMatch = files.find((file) => file.relative === `${args[0]}${opts.ext}`)
if (!exactMatch) {
out.write('There are ' + files.length + ' help pages ')
out.write('that matches the given request, please disambiguate:\n')
files.forEach(function (file) {
out.write(' * ')
out.write(file.relative.replace(opts.ext, ''))
out.write('\n')
})
out.end()
return
}
files = [exactMatch]
}
pipeline(fs.createReadStream(files[0].path), out, () => {})
})
return out
}
function toStdout (args) {
createStream(args)
.on('error', function () {
console.log('no such help file\n')
toStdout()
})
.pipe(process.stdout)
}
}
module.exports = helpMe

37
WebUI/node_modules/help-me/package.json generated vendored Normal file
View File

@@ -0,0 +1,37 @@
{
"name": "help-me",
"version": "3.0.0",
"description": "Help command for node, partner of minimist and commist",
"main": "help-me.js",
"scripts": {
"test": "standard && node test.js | tap-spec"
},
"repository": {
"type": "git",
"url": "https://github.com/mcollina/help-me.git"
},
"keywords": [
"help",
"command",
"minimist",
"commist"
],
"author": "Matteo Collina <hello@matteocollina.com>",
"license": "MIT",
"bugs": {
"url": "https://github.com/mcollina/help-me/issues"
},
"homepage": "https://github.com/mcollina/help-me",
"devDependencies": {
"commist": "^1.0.0",
"concat-stream": "^2.0.0",
"pre-commit": "^1.1.3",
"standard": "^16.0.0",
"tap-spec": "^5.0.0",
"tape": "^5.0.0"
},
"dependencies": {
"glob": "^7.1.6",
"readable-stream": "^3.6.0"
}
}

225
WebUI/node_modules/help-me/test.js generated vendored Normal file
View File

@@ -0,0 +1,225 @@
'use strict'
const test = require('tape')
const concat = require('concat-stream')
const fs = require('fs')
const helpMe = require('./')
test('throws if no directory is passed', function (t) {
try {
helpMe()
t.fail()
} catch (err) {
t.equal(err.message, 'missing dir')
}
t.end()
})
test('throws if a normal file is passed', function (t) {
try {
helpMe({
dir: __filename
})
t.fail()
} catch (err) {
t.equal(err.message, `${__filename} is not a directory`)
}
t.end()
})
test('throws if the directory cannot be accessed', function (t) {
try {
helpMe({
dir: './foo'
})
t.fail()
} catch (err) {
t.equal(err.message, './foo is not a directory')
}
t.end()
})
test('show a generic help.txt from a folder to a stream', function (t) {
t.plan(2)
helpMe({
dir: 'fixture/basic'
}).createStream()
.pipe(concat(function (data) {
fs.readFile('fixture/basic/help.txt', function (err, expected) {
t.error(err)
t.equal(data.toString(), expected.toString())
})
}))
})
test('custom help command with an array', function (t) {
t.plan(2)
helpMe({
dir: 'fixture/basic'
}).createStream(['hello'])
.pipe(concat(function (data) {
fs.readFile('fixture/basic/hello.txt', function (err, expected) {
t.error(err)
t.equal(data.toString(), expected.toString())
})
}))
})
test('custom help command without an ext', function (t) {
t.plan(2)
helpMe({
dir: 'fixture/no-ext',
ext: ''
}).createStream(['hello'])
.pipe(concat(function (data) {
fs.readFile('fixture/no-ext/hello', function (err, expected) {
t.error(err)
t.equal(data.toString(), expected.toString())
})
}))
})
test('custom help command with a string', function (t) {
t.plan(2)
helpMe({
dir: 'fixture/basic'
}).createStream('hello')
.pipe(concat(function (data) {
fs.readFile('fixture/basic/hello.txt', function (err, expected) {
t.error(err)
t.equal(data.toString(), expected.toString())
})
}))
})
test('missing help file', function (t) {
t.plan(1)
helpMe({
dir: 'fixture/basic'
}).createStream('abcde')
.on('error', function (err) {
t.equal(err.message, 'no such help file')
})
.resume()
})
test('custom help command with an array', function (t) {
const helper = helpMe({
dir: 'fixture/shortnames'
})
t.test('abbreviates two words in one', function (t) {
t.plan(2)
helper
.createStream(['world'])
.pipe(concat(function (data) {
fs.readFile('fixture/shortnames/hello world.txt', function (err, expected) {
t.error(err)
t.equal(data.toString(), expected.toString())
})
}))
})
t.test('abbreviates three words in two', function (t) {
t.plan(2)
helper
.createStream(['abcde', 'fghi'])
.pipe(concat(function (data) {
fs.readFile('fixture/shortnames/abcde fghi lmno.txt', function (err, expected) {
t.error(err)
t.equal(data.toString(), expected.toString())
})
}))
})
t.test('abbreviates a word', function (t) {
t.plan(2)
helper
.createStream(['abc', 'fg'])
.pipe(concat(function (data) {
fs.readFile('fixture/shortnames/abcde fghi lmno.txt', function (err, expected) {
t.error(err)
t.equal(data.toString(), expected.toString())
})
}))
})
t.test('abbreviates a word using strings', function (t) {
t.plan(2)
helper
.createStream('abc fg')
.pipe(concat(function (data) {
fs.readFile('fixture/shortnames/abcde fghi lmno.txt', function (err, expected) {
t.error(err)
t.equal(data.toString(), expected.toString())
})
}))
})
t.test('print a disambiguation', function (t) {
t.plan(1)
const expected = '' +
'There are 2 help pages that matches the given request, please disambiguate:\n' +
' * abcde fghi lmno\n' +
' * abcde hello\n'
helper
.createStream(['abc'])
.pipe(concat({ encoding: 'string' }, function (data) {
t.equal(data, expected)
}))
})
t.test('choose exact match over partial', function (t) {
t.plan(1)
helpMe({
dir: 'fixture/sameprefix'
}).createStream(['hello'])
.pipe(concat({ encoding: 'string' }, function (data) {
t.equal(data, 'hello')
}))
})
})
test('support for help files organized in folders', function (t) {
const helper = helpMe({
dir: 'fixture/dir'
})
t.test('passing an array', function (t) {
t.plan(2)
helper
.createStream(['a', 'b'])
.pipe(concat(function (data) {
fs.readFile('fixture/dir/a/b.txt', function (err, expected) {
t.error(err)
t.equal(data.toString(), expected.toString())
})
}))
})
t.test('passing a string', function (t) {
t.plan(2)
helper
.createStream('a b')
.pipe(concat(function (data) {
fs.readFile('fixture/dir/a/b.txt', function (err, expected) {
t.error(err)
t.equal(data.toString(), expected.toString())
})
}))
})
})