Current Dev State

This commit is contained in:
Tim Lorsbach
2025-06-23 20:13:54 +02:00
parent b4f9bb277d
commit ded50edaa2
22617 changed files with 4345095 additions and 174 deletions

11
static/js/ketcher2/node_modules/bole/LICENSE.md generated vendored Normal file
View File

@ -0,0 +1,11 @@
The MIT License (MIT)
=====================
Copyright (c) 2014 Rod Vagg
---------------------------
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.

126
static/js/ketcher2/node_modules/bole/README.md generated vendored Normal file
View File

@ -0,0 +1,126 @@
# bole
**A tiny JSON logger**
[![NPM](https://nodei.co/npm/bole.png?downloads=true&downloadRank=true&stars=true)](https://nodei.co/npm/bole/)
Log JSON from within Node.js applications. The log format is obviously inspired by the excellent [Bunyan](https://github.com/trentm/node-bunyan) and is likely to be output-compatible in most cases. The difference is that **bole** aims for even more simplicity, supporting only the common-case basics.
**bole** is designed for global singleton use. Your application has many log sources, but they all aggregate to the same sources. You configure output in *one place* for an application, regardless of how many modules and dependencies are also using **bole** for logging.
## Example
**mymodule.js**
```js
var log = require('bole')('mymodule')
module.exports.derp = function derp() {
log.debug('W00t!')
log.info('Starting mymodule#derp()')
}
```
**main.js**
```js
var bole = require('bole')
var mod = require('./mymodule')
bole.output({
level: 'info',
stream: process.stdout
})
mod.derp()
```
```text
$ node main
{"time":"2014-05-18T23:47:06.545Z","hostname":"tweedy","pid":27374,"level":"info","name":"mymodule","message":"Starting mymodule#derp()"}
```
## Features
* Arbitrary log **names**, create a logger by calling `var log = bole('logname')` and `'logname'` will be attached to the output
* Loggers have 4 levels / methods: `log.debug()`, `log.info()`, `log.warn()`, `log.error()`
* Log methods accept `console.log()` style strfmt output ( using`util.format()`): `log.warn('foo %s', 'bar')`
* Log methods accept arbitrary objects that extend the log output data, each property on the object is attached to the debug output object
* Log methods accept `Error` objects and print appropriate `Error` properties, including a full stack trace (including any *cause* where supported)
* Log methods accept `http.IncomingMessage` for simple logging of an HTTP server's `req` object. URL, method, headers, remote host details will be included in the log output.
* Newline separated JSON output to arbitrary streams
* Any number of output streams, each with configurable minimum log-levels
* Fast short-circuit where no loggers are configured for the log-level, effectively making log statements a noop where they don't output
* Sub-logger to split a logger for grouping types of events, such as individual HTTP request
* Object-logging (i.e. not automatically stringified) if you pass an `objectMode:true` stream for output.
## API
### bole(name)
Create a new **logger** with the supplied `name` to be attached to each output. If you keep a logger-per module you don't need to pass loggers around, *keep your concerns separated*.
### logger#debug(), logger#info(), logger#warn(), logger#error()
Loggers have 4 roughly identical log methods, one for each of the supports log-levels. Log levels are recorded on the output and can be used to determine the level of detail passed to the output.
Log methods support the following types of input:
* **`Error` objects**: log output will include the error `name`, `message`, complete `stack` and also a `code` where there is one. Additionally you can supply further arguments which are passed to `util.format()` and attached as a `"message"` property to the output: `log.warn(err, 'error occurred while fetching session for user %s', user.name)`
* **`http.IncomingMessage`** for simple access-log style logging. URL, method, headers, remote address and remote port are logged: `log.info(req)`, further data can be provided for a `"message"` property if required.
* **Arbitrary objects** whose properties will be placed directly on the logged output object. Be careful passing objects with large numbers of properties, in most cases you are best to construct your own objects: `log.debug({ dbHost: 'foo', dbPort: 8080 }, 'connecting to database')`, further data can be provided for a `"message"` property if required.
* **console.log style output** so you can treat loggers just like `console.log()`: `log.info('logging a string')`, `log.info('it has been said that %d is the meaning of %s', 42, 'life')`, `log.debug('foo', 'bar', 'baz')`.
If you require more sophisticated serialisation of your objects, then write a utility function to convert those objects to loggable objects.
### logger()
The `logger` object returned by `bole(name)` is also a function that accepts a `name` argument. It returns a new logger whose name is the parent logger with the new name appended after a `':'` character. This is useful for splitting a logger up for grouping events. Consider the HTTP server case where you may want to group all events from a particular request together:
```js
var log = bole('server')
http.createServer(function (req, res) {
req.log = log(uuid.v4()) // make a new sub-logger
req.log.info(req)
//...
// log an error against this sub-logger
req.log.error(err)
})
```
In this case, your events would be listed as something like `"name":"server:93f57a1a-ae59-46da-a625-8d084a77028a"` and each event for a particular request would have the same `"name"` property, distinct from the rest.
Sub-loggers can even be split in to sub-sub loggers, the rabbit hole is ~bottomless.
### bole.output()
Add outputs for application-wide logging, accepts either an object for defining a single output or an array of objects defining multiple outputs. Each output requires only a `'level'` and a `'stream'`, where the *level* defines the *minimum* debug level to print to this stream and the *stream* is any `WritableStream` that accepts a `.write()` method.
If you pass in a stream with `objectMode` set to `true` then you will receive the raw log objects rather than their stringified versions.
```js
bole.output([
{ level: 'debug', fs.createWriteStream('app.log') },
{ level: 'info', process.stdout }
])
```
### bole.reset()
Clears all output streams from the application
## Additional features
If you need to serialise specific types of objects then **write a utility function** to convert to a loggable object.
If you need a special kind of output then **write a stream to accept output data**.
If you need to filter a present output data in a special way, **write a package to do it and publish it in npm**.
## License
**bole** is Copyright (c) 2014 Rod Vagg [@rvagg](https://twitter.com/rvagg) and licensed under the MIT License. All rights not explicitly granted in the MIT License are reserved. See the included [LICENSE.md](./LICENSE.md) file for more details.

126
static/js/ketcher2/node_modules/bole/bole.js generated vendored Normal file
View File

@ -0,0 +1,126 @@
var stringify = require('json-stringify-safe')
, format = require('util').format
, is = require('core-util-is')
, individual = require('individual')('$$bole', { })
, levels = 'debug info warn error'.split(' ')
, hostname = require('os').hostname()
, pid = process.pid
function stackToString (e) {
var s = e.stack
, ce
if (is.isFunction(e.cause) && (ce = e.cause()))
s += '\nCaused by: ' + stackToString(ce)
return s
}
function levelLogger (level, name) {
return function (inp) {
var outputs = individual[level]
if (!outputs)
return // no outputs for this level
var out = {
time : new Date().toISOString()
, hostname : hostname
, pid : pid
, level : level
, name : name
}
, k
, i = 0
, stringified
if (is.isError(inp)) {
if (arguments.length > 1)
out.message = format.apply(null, Array.prototype.slice.call(arguments, 1))
out.err = {
name : inp.name
, message : inp.message
, code : inp.code // perhaps
, stack : stackToString(inp)
}
} else if (is.isObject(inp) && inp.method && inp.url && inp.headers && inp.socket) {
if (arguments.length > 1)
out.message = format.apply(null, Array.prototype.slice.call(arguments, 1))
out.req = {
method : inp.method
, url : inp.url
, headers : inp.headers
, remoteAddress : inp.connection.remoteAddress
, remotePort : inp.connection.remotePort
}
} else if (is.isObject(inp)) {
if (arguments.length > 1)
out.message = format.apply(null, Array.prototype.slice.call(arguments, 1))
for (k in inp) {
if (Object.prototype.hasOwnProperty.call(inp, k))
out[k] = inp[k]
}
} else if (!is.isUndefined(inp)) {
out.message = format.apply(null, arguments)
}
for (; i < outputs.length; i++) {
if (outputs[i]._writableState && outputs[i]._writableState.objectMode === true) {
outputs[i].write(out)
} else {
if (!stringified) // lazy stringify
stringified = stringify(out) + '\n'
outputs[i].write(stringified)
}
}
}
}
function bole (name) {
function boleLogger (subname) {
return bole(name + ':' + subname)
}
function makeLogger (p, level) {
p[level] = levelLogger(level, name)
return p
}
return levels.reduce(makeLogger, boleLogger)
}
bole.output = function (opt) {
if (Array.isArray(opt))
return opt.forEach(bole.output)
var i = 0
, b = false
for (; i < levels.length; i++) {
if (levels[i] === opt.level)
b = true
if (b) {
if (!individual[levels[i]])
individual[levels[i]] = []
individual[levels[i]].push(opt.stream)
}
}
}
bole.reset = function () {
for (var k in individual)
delete individual[k]
}
module.exports = bole

63
static/js/ketcher2/node_modules/bole/package.json generated vendored Normal file
View File

@ -0,0 +1,63 @@
{
"_from": "bole@^2.0.0",
"_id": "bole@2.0.0",
"_inBundle": false,
"_integrity": "sha1-2KocaQRnv7T+Ebh0rLLoOH44JhU=",
"_location": "/bole",
"_phantomChildren": {},
"_requested": {
"type": "range",
"registry": true,
"raw": "bole@^2.0.0",
"name": "bole",
"escapedName": "bole",
"rawSpec": "^2.0.0",
"saveSpec": null,
"fetchSpec": "^2.0.0"
},
"_requiredBy": [
"/budo"
],
"_resolved": "https://registry.npmjs.org/bole/-/bole-2.0.0.tgz",
"_shasum": "d8aa1c690467bfb4fe11b874acb2e8387e382615",
"_spec": "bole@^2.0.0",
"_where": "/home/manfred/enviPath/ketcher2/ketcher/node_modules/budo",
"author": {
"name": "Rod Vagg",
"email": "r@va.gg",
"url": "@rvagg"
},
"bugs": {
"url": "https://github.com/rvagg/bole/issues"
},
"bundleDependencies": false,
"dependencies": {
"core-util-is": ">=1.0.1 <1.1.0-0",
"individual": ">=3.0.0 <3.1.0-0",
"json-stringify-safe": ">=5.0.0 <5.1.0-0"
},
"deprecated": false,
"description": "A tiny JSON logger",
"devDependencies": {
"bl": ">=0.9.3 <0.10.0-0",
"hyperquest": ">=1.0.1 <1.1.0-0",
"list-stream": ">=1.0.0 <1.1.0-0",
"tape": ">=3.0.3 <3.1.0-0"
},
"homepage": "https://github.com/rvagg/bole#readme",
"keywords": [
"logging",
"json"
],
"license": "MIT",
"main": "bole.js",
"name": "bole",
"repository": {
"type": "git",
"url": "git+https://github.com/rvagg/bole.git"
},
"scripts": {
"test": "node test.js"
},
"version": "2.0.0"
}

451
static/js/ketcher2/node_modules/bole/test.js generated vendored Normal file
View File

@ -0,0 +1,451 @@
var http = require('http')
, hreq = require('hyperquest')
, test = require('tape')
, bl = require('bl')
, listStream = require('list-stream')
, bole = require('./')
, pid = process.pid
, host = require('os').hostname()
function mklogobj (name, level, inp) {
var out = {
time : new Date().toISOString()
, hostname : host
, pid : pid
, level : level
, name : name
}
, k
for (k in inp) {
if (Object.prototype.hasOwnProperty.call(inp, k))
out[k] = inp[k]
}
return out
}
// take a log string and zero out the millisecond field
// to make comparison a little safer (not *entirely* safe)
function safe (str) {
return str.replace(/("time":"\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.)\d{3}Z"/g, '$1xxxZ')
.replace(/("remoteAddress":")(?:::ffff:)?(127.0.0.1")/g, '$1$2')
.replace(/("host":")(?:(?:localhost)|(?:::))(:\d+")/g, '$1$2')
}
test('test simple logging', function (t) {
t.plan(1)
t.on('end', bole.reset)
var sink = bl()
, log = bole('simple')
, expected = []
bole.output({
level : 'debug'
, stream : sink
})
expected.push(mklogobj('simple', 'debug', { aDebug : 'object' }))
log.debug({ aDebug: 'object' })
expected.push(mklogobj('simple', 'info', { anInfo : 'object' }))
log.info({ anInfo: 'object' })
expected.push(mklogobj('simple', 'warn', { aWarn : 'object' }))
log.warn({ aWarn: 'object' })
expected.push(mklogobj('simple', 'error', { anError : 'object' }))
log.error({ anError: 'object' })
sink.end(function () {
var exp = expected.reduce(function (p, c) {
return p + JSON.stringify(c) + '\n'
}, '')
t.equal(safe(sink.slice().toString()), safe(exp))
})
})
test('test multiple logs', function (t) {
t.plan(1)
t.on('end', bole.reset)
var sink = bl()
, log1 = bole('simple1')
, log2 = bole('simple2')
, expected = []
bole.output({
level : 'debug'
, stream : sink
})
expected.push(mklogobj('simple1', 'debug', { aDebug : 'object' }))
log1.debug({ aDebug: 'object' })
expected.push(mklogobj('simple1', 'info', { anInfo : 'object' }))
log1.info({ anInfo: 'object' })
expected.push(mklogobj('simple2', 'warn', { aWarn : 'object' }))
log2.warn({ aWarn: 'object' })
expected.push(mklogobj('simple2', 'error', { anError : 'object' }))
log2.error({ anError: 'object' })
sink.end(function () {
var exp = expected.reduce(function (p, c) {
return p + JSON.stringify(c) + '\n'
}, '')
t.equal(safe(sink.slice().toString()), safe(exp))
})
})
test('test multiple outputs', function (t) {
t.plan(4)
t.on('end', bole.reset)
var debugSink = bl()
, infoSink = bl()
, warnSink = bl()
, errorSink = bl()
, log = bole('simple')
, expected = []
// add individual
bole.output({
level : 'debug'
, stream : debugSink
})
// add array
bole.output([
{
level : 'info'
, stream : infoSink
}
, {
level : 'warn'
, stream : warnSink
}
])
bole.output({
level : 'error'
, stream : errorSink
})
expected.push(mklogobj('simple', 'debug', { aDebug : 'object' }))
log.debug({ aDebug: 'object' })
expected.push(mklogobj('simple', 'info', { anInfo : 'object' }))
log.info({ anInfo: 'object' })
expected.push(mklogobj('simple', 'warn', { aWarn : 'object' }))
log.warn({ aWarn: 'object' })
expected.push(mklogobj('simple', 'error', { anError : 'object' }))
log.error({ anError: 'object' })
debugSink.end()
infoSink.end()
warnSink.end()
errorSink.end(function () {
// debug
var exp = expected.reduce(function (p, c) {
return p + JSON.stringify(c) + '\n'
}, '')
t.equal(safe(debugSink.slice().toString()), safe(exp))
// info
exp = expected.slice(1).reduce(function (p, c) {
return p + JSON.stringify(c) + '\n'
}, '')
t.equal(safe(infoSink.slice().toString()), safe(exp))
// warn
exp = expected.slice(2).reduce(function (p, c) {
return p + JSON.stringify(c) + '\n'
}, '')
t.equal(safe(warnSink.slice().toString()), safe(exp))
// error
exp = expected.slice(3).reduce(function (p, c) {
return p + JSON.stringify(c) + '\n'
}, '')
t.equal(safe(errorSink.slice().toString()), safe(exp))
})
})
test('test string formatting', function (t) {
t.plan(7)
t.on('end', bole.reset)
function testSingle (level, msg, args) {
var sink = bl()
, log = bole('strfmt')
, expected
bole.output({
level : level
, stream : sink
})
expected = mklogobj('strfmt', level, msg)
log[level].apply(log, args)
sink.end(function () {
var exp = JSON.stringify(expected) + '\n'
t.equal(safe(sink.slice().toString()), safe(exp))
})
bole.reset()
}
testSingle('debug', {}, [])
testSingle('debug', { message: 'test' }, [ 'test' ])
testSingle('info', { message: 'true' }, [ true ])
testSingle('info', { message: 'false' }, [ false ])
testSingle('warn', { message: 'a number [42]' }, [ 'a number [%d]', 42 ])
testSingle('error', { message: 'a string [str]' }, [ 'a string [%s]', 'str' ])
testSingle('error', { message: 'foo bar baz' }, [ 'foo', 'bar', 'baz' ])
})
test('test error formatting', function (t) {
t.plan(1)
t.on('end', bole.reset)
var sink = bl()
, log = bole('errfmt')
, err = new Error('error msg in here')
, expected
bole.output({
level : 'debug'
, stream : sink
})
expected = mklogobj('errfmt', 'debug', { err: {
name : 'Error'
, message : 'error msg in here'
, stack : 'STACK'
}})
log.debug(err)
sink.end(function () {
var exp = JSON.stringify(expected) + '\n'
, act = safe(sink.slice().toString())
act = act.replace(/("stack":")Error:[^"]+/, '$1STACK')
t.equal(act, safe(exp))
})
})
test('test error formatting with message', function (t) {
t.plan(1)
t.on('end', bole.reset)
var sink = bl()
, log = bole('errfmt')
, err = new Error('error msg in here')
, expected
bole.output({
level : 'debug'
, stream : sink
})
expected = mklogobj('errfmt', 'debug', {
message : 'this is a message'
, err : {
name : 'Error'
, message : 'error msg in here'
, stack : 'STACK'
}
})
log.debug(err, 'this is a %s', 'message')
sink.end(function () {
var exp = JSON.stringify(expected) + '\n'
, act = safe(sink.slice().toString())
act = act.replace(/("stack":")Error:[^"]+/, '$1STACK')
t.equal(act, safe(exp))
})
})
test('test request object', function (t) {
t.on('end', bole.reset)
var sink = bl()
, log = bole('reqfmt')
, expected
, server
, host
bole.output({
level : 'info'
, stream : sink
})
server = http.createServer(function (req, res) {
expected = mklogobj('reqfmt', 'info', {
req: {
method : 'GET'
, url : '/foo?bar=baz'
, headers : {
host : host
, connection : 'close'
}
, remoteAddress : '127.0.0.1'
, remotePort : 'RPORT'
}
})
log.info(req)
res.end()
sink.end(function () {
var exp = JSON.stringify(expected) + '\n'
, act = safe(sink.slice().toString())
act = act.replace(/("remotePort":)\d+/, '$1"RPORT"')
t.equal(act, safe(exp))
server.close(t.end.bind(t))
})
})
server.listen(function () {
hreq.get('http://' + (host = this.address().address + ':' + this.address().port) + '/foo?bar=baz')
})
})
test('test request object with message', function (t) {
t.on('end', bole.reset)
var sink = bl()
, log = bole('reqfmt')
, expected
, server
, host
bole.output({
level : 'info'
, stream : sink
})
server = http.createServer(function (req, res) {
expected = mklogobj('reqfmt', 'info', {
message : 'this is a message'
, req: {
method : 'GET'
, url : '/foo?bar=baz'
, headers : {
host : host
, connection : 'close'
}
, remoteAddress : '127.0.0.1'
, remotePort : 'RPORT'
}
})
log.info(req, 'this is a %s', 'message')
res.end()
sink.end(function () {
var exp = JSON.stringify(expected) + '\n'
, act = safe(sink.slice().toString())
act = act.replace(/("remotePort":)\d+/, '$1"RPORT"')
t.equal(act, safe(exp))
server.close(t.end.bind(t))
})
})
server.listen(function () {
hreq.get('http://' + (host = this.address().address + ':' + this.address().port) + '/foo?bar=baz')
})
})
test('test sub logger', function (t) {
t.plan(1)
t.on('end', bole.reset)
var sink = bl()
, log = bole('parent')
, expected = []
, sub1
, sub2
bole.output({
level : 'debug'
, stream : sink
})
expected.push(mklogobj('parent', 'debug', { aDebug : 'object' }))
log.debug({ aDebug: 'object' })
expected.push(mklogobj('parent', 'info', { anInfo : 'object' }))
log.info({ anInfo: 'object' })
expected.push(mklogobj('parent', 'warn', { aWarn : 'object' }))
log.warn({ aWarn: 'object' })
expected.push(mklogobj('parent', 'error', { anError : 'object' }))
log.error({ anError: 'object' })
expected.push(mklogobj('parent:sub1', 'debug', { aDebug : 'object' }))
;(sub1 = log('sub1')).debug({ aDebug: 'object' })
expected.push(mklogobj('parent:sub1', 'info', { anInfo : 'object' }))
sub1.info({ anInfo: 'object' })
expected.push(mklogobj('parent:sub2', 'warn', { aWarn : 'object' }))
;(sub2 = log('sub2')).warn({ aWarn: 'object' })
expected.push(mklogobj('parent:sub2:subsub', 'error', { anError : 'object' }))
sub2('subsub').error({ anError: 'object' })
sink.end(function () {
var exp = expected.reduce(function (p, c) {
return p + JSON.stringify(c) + '\n'
}, '')
t.equal(safe(sink.slice().toString()), safe(exp))
})
})
test('test object logging', function (t) {
t.on('end', bole.reset)
var sink = listStream.obj()
, log = bole('simple')
, expected = []
bole.output({
level : 'debug'
, stream : sink
})
expected.push(mklogobj('simple', 'debug', { aDebug : 'object' }))
log.debug({ aDebug: 'object' })
expected.push(mklogobj('simple', 'info', { anInfo : 'object' }))
log.info({ anInfo: 'object' })
expected.push(mklogobj('simple', 'warn', { aWarn : 'object' }))
log.warn({ aWarn: 'object' })
expected.push(mklogobj('simple', 'error', { anError : 'object' }))
log.error({ anError: 'object' })
sink.end(function () {
t.equal(sink.length, expected.length, 'correct number of log entries')
for (var i = 0; i < expected.length; i++)
t.deepEqual(sink.get(i), expected[i], 'correct log entry #' + i)
t.end()
})
})