@nocobase/plugin-workflow-javascript 2.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +201 -0
- package/README.md +99 -0
- package/client.d.ts +2 -0
- package/client.js +1 -0
- package/dist/client/907399554f340b0a.js +10 -0
- package/dist/client/CodeEditor.d.ts +8 -0
- package/dist/client/ScriptInstruction.d.ts +129 -0
- package/dist/client/d608e8e5c2f2b5cf.js +10 -0
- package/dist/client/index.d.ts +5 -0
- package/dist/client/index.js +10 -0
- package/dist/externalVersion.js +23 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +48 -0
- package/dist/locale/de-DE.json +33 -0
- package/dist/locale/en-US.json +33 -0
- package/dist/locale/es-ES.json +33 -0
- package/dist/locale/fr-FR.json +33 -0
- package/dist/locale/hu-HU.json +33 -0
- package/dist/locale/id-ID.json +33 -0
- package/dist/locale/index.d.ts +12 -0
- package/dist/locale/index.js +54 -0
- package/dist/locale/it-IT.json +33 -0
- package/dist/locale/ja-JP.json +33 -0
- package/dist/locale/ko-KR.json +33 -0
- package/dist/locale/ko_KR.json +25 -0
- package/dist/locale/nl-NL.json +33 -0
- package/dist/locale/pt-BR.json +33 -0
- package/dist/locale/ru-RU.json +33 -0
- package/dist/locale/tr-TR.json +33 -0
- package/dist/locale/uk-UA.json +33 -0
- package/dist/locale/vi-VN.json +33 -0
- package/dist/locale/zh-CN.json +33 -0
- package/dist/locale/zh-TW.json +33 -0
- package/dist/node_modules/winston-transport/.babelrc +3 -0
- package/dist/node_modules/winston-transport/.eslintrc +7 -0
- package/dist/node_modules/winston-transport/.gitattributes +1 -0
- package/dist/node_modules/winston-transport/.nyc_output/c1bd7935-644d-4c7a-89c1-24531a04e4cc.json +1 -0
- package/dist/node_modules/winston-transport/.nyc_output/processinfo/c1bd7935-644d-4c7a-89c1-24531a04e4cc.json +1 -0
- package/dist/node_modules/winston-transport/.nyc_output/processinfo/index.json +1 -0
- package/dist/node_modules/winston-transport/LICENSE +22 -0
- package/dist/node_modules/winston-transport/dist/index.js +8 -0
- package/dist/node_modules/winston-transport/dist/legacy.js +116 -0
- package/dist/node_modules/winston-transport/dist/modern.js +212 -0
- package/dist/node_modules/winston-transport/index.d.ts +39 -0
- package/dist/node_modules/winston-transport/index.js +3 -0
- package/dist/node_modules/winston-transport/legacy.js +119 -0
- package/dist/node_modules/winston-transport/modern.js +211 -0
- package/dist/node_modules/winston-transport/node_modules/readable-stream/errors-browser.js +127 -0
- package/dist/node_modules/winston-transport/node_modules/readable-stream/errors.js +116 -0
- package/dist/node_modules/winston-transport/node_modules/readable-stream/experimentalWarning.js +17 -0
- package/dist/node_modules/winston-transport/node_modules/readable-stream/lib/_stream_duplex.js +126 -0
- package/dist/node_modules/winston-transport/node_modules/readable-stream/lib/_stream_passthrough.js +37 -0
- package/dist/node_modules/winston-transport/node_modules/readable-stream/lib/_stream_readable.js +1027 -0
- package/dist/node_modules/winston-transport/node_modules/readable-stream/lib/_stream_transform.js +190 -0
- package/dist/node_modules/winston-transport/node_modules/readable-stream/lib/_stream_writable.js +641 -0
- package/dist/node_modules/winston-transport/node_modules/readable-stream/lib/internal/streams/async_iterator.js +180 -0
- package/dist/node_modules/winston-transport/node_modules/readable-stream/lib/internal/streams/buffer_list.js +183 -0
- package/dist/node_modules/winston-transport/node_modules/readable-stream/lib/internal/streams/destroy.js +96 -0
- package/dist/node_modules/winston-transport/node_modules/readable-stream/lib/internal/streams/end-of-stream.js +86 -0
- package/dist/node_modules/winston-transport/node_modules/readable-stream/lib/internal/streams/from-browser.js +3 -0
- package/dist/node_modules/winston-transport/node_modules/readable-stream/lib/internal/streams/from.js +52 -0
- package/dist/node_modules/winston-transport/node_modules/readable-stream/lib/internal/streams/pipeline.js +86 -0
- package/dist/node_modules/winston-transport/node_modules/readable-stream/lib/internal/streams/state.js +22 -0
- package/dist/node_modules/winston-transport/node_modules/readable-stream/lib/internal/streams/stream-browser.js +1 -0
- package/dist/node_modules/winston-transport/node_modules/readable-stream/lib/internal/streams/stream.js +1 -0
- package/dist/node_modules/winston-transport/node_modules/readable-stream/package.json +68 -0
- package/dist/node_modules/winston-transport/node_modules/readable-stream/readable-browser.js +9 -0
- package/dist/node_modules/winston-transport/node_modules/readable-stream/readable.js +16 -0
- package/dist/node_modules/winston-transport/package.json +1 -0
- package/dist/server/ScriptInstruction.d.ts +45 -0
- package/dist/server/ScriptInstruction.js +175 -0
- package/dist/server/Vm.js +100 -0
- package/dist/server/cache-logger.d.ts +6 -0
- package/dist/server/cache-logger.js +56 -0
- package/dist/server/index.d.ts +1 -0
- package/dist/server/index.js +42 -0
- package/dist/server/plugin.d.ts +11 -0
- package/dist/server/plugin.js +68 -0
- package/package.json +40 -0
- package/server.d.ts +2 -0
- package/server.js +1 -0
|
@@ -0,0 +1,211 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const util = require('util');
|
|
4
|
+
const Writable = require('readable-stream/lib/_stream_writable.js');
|
|
5
|
+
const { LEVEL } = require('triple-beam');
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Constructor function for the TransportStream. This is the base prototype
|
|
9
|
+
* that all `winston >= 3` transports should inherit from.
|
|
10
|
+
* @param {Object} options - Options for this TransportStream instance
|
|
11
|
+
* @param {String} options.level - Highest level according to RFC5424.
|
|
12
|
+
* @param {Boolean} options.handleExceptions - If true, info with
|
|
13
|
+
* { exception: true } will be written.
|
|
14
|
+
* @param {Function} options.log - Custom log function for simple Transport
|
|
15
|
+
* creation
|
|
16
|
+
* @param {Function} options.close - Called on "unpipe" from parent.
|
|
17
|
+
*/
|
|
18
|
+
const TransportStream = module.exports = function TransportStream(options = {}) {
|
|
19
|
+
Writable.call(this, { objectMode: true, highWaterMark: options.highWaterMark });
|
|
20
|
+
|
|
21
|
+
this.format = options.format;
|
|
22
|
+
this.level = options.level;
|
|
23
|
+
this.handleExceptions = options.handleExceptions;
|
|
24
|
+
this.handleRejections = options.handleRejections;
|
|
25
|
+
this.silent = options.silent;
|
|
26
|
+
|
|
27
|
+
if (options.log) this.log = options.log;
|
|
28
|
+
if (options.logv) this.logv = options.logv;
|
|
29
|
+
if (options.close) this.close = options.close;
|
|
30
|
+
|
|
31
|
+
// Get the levels from the source we are piped from.
|
|
32
|
+
this.once('pipe', logger => {
|
|
33
|
+
// Remark (indexzero): this bookkeeping can only support multiple
|
|
34
|
+
// Logger parents with the same `levels`. This comes into play in
|
|
35
|
+
// the `winston.Container` code in which `container.add` takes
|
|
36
|
+
// a fully realized set of options with pre-constructed TransportStreams.
|
|
37
|
+
this.levels = logger.levels;
|
|
38
|
+
this.parent = logger;
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
// If and/or when the transport is removed from this instance
|
|
42
|
+
this.once('unpipe', src => {
|
|
43
|
+
// Remark (indexzero): this bookkeeping can only support multiple
|
|
44
|
+
// Logger parents with the same `levels`. This comes into play in
|
|
45
|
+
// the `winston.Container` code in which `container.add` takes
|
|
46
|
+
// a fully realized set of options with pre-constructed TransportStreams.
|
|
47
|
+
if (src === this.parent) {
|
|
48
|
+
this.parent = null;
|
|
49
|
+
if (this.close) {
|
|
50
|
+
this.close();
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
/*
|
|
57
|
+
* Inherit from Writeable using Node.js built-ins
|
|
58
|
+
*/
|
|
59
|
+
util.inherits(TransportStream, Writable);
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Writes the info object to our transport instance.
|
|
63
|
+
* @param {mixed} info - TODO: add param description.
|
|
64
|
+
* @param {mixed} enc - TODO: add param description.
|
|
65
|
+
* @param {function} callback - TODO: add param description.
|
|
66
|
+
* @returns {undefined}
|
|
67
|
+
* @private
|
|
68
|
+
*/
|
|
69
|
+
TransportStream.prototype._write = function _write(info, enc, callback) {
|
|
70
|
+
if (this.silent || (info.exception === true && !this.handleExceptions)) {
|
|
71
|
+
return callback(null);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
// Remark: This has to be handled in the base transport now because we
|
|
75
|
+
// cannot conditionally write to our pipe targets as stream. We always
|
|
76
|
+
// prefer any explicit level set on the Transport itself falling back to
|
|
77
|
+
// any level set on the parent.
|
|
78
|
+
const level = this.level || (this.parent && this.parent.level);
|
|
79
|
+
|
|
80
|
+
if (!level || this.levels[level] >= this.levels[info[LEVEL]]) {
|
|
81
|
+
if (info && !this.format) {
|
|
82
|
+
return this.log(info, callback);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
let errState;
|
|
86
|
+
let transformed;
|
|
87
|
+
|
|
88
|
+
// We trap(and re-throw) any errors generated by the user-provided format, but also
|
|
89
|
+
// guarantee that the streams callback is invoked so that we can continue flowing.
|
|
90
|
+
try {
|
|
91
|
+
transformed = this.format.transform(Object.assign({}, info), this.format.options);
|
|
92
|
+
} catch (err) {
|
|
93
|
+
errState = err;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
if (errState || !transformed) {
|
|
97
|
+
// eslint-disable-next-line callback-return
|
|
98
|
+
callback();
|
|
99
|
+
if (errState) throw errState;
|
|
100
|
+
return;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
return this.log(transformed, callback);
|
|
104
|
+
}
|
|
105
|
+
this._writableState.sync = false;
|
|
106
|
+
return callback(null);
|
|
107
|
+
};
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* Writes the batch of info objects (i.e. "object chunks") to our transport
|
|
111
|
+
* instance after performing any necessary filtering.
|
|
112
|
+
* @param {mixed} chunks - TODO: add params description.
|
|
113
|
+
* @param {function} callback - TODO: add params description.
|
|
114
|
+
* @returns {mixed} - TODO: add returns description.
|
|
115
|
+
* @private
|
|
116
|
+
*/
|
|
117
|
+
TransportStream.prototype._writev = function _writev(chunks, callback) {
|
|
118
|
+
if (this.logv) {
|
|
119
|
+
const infos = chunks.filter(this._accept, this);
|
|
120
|
+
if (!infos.length) {
|
|
121
|
+
return callback(null);
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
// Remark (indexzero): from a performance perspective if Transport
|
|
125
|
+
// implementers do choose to implement logv should we make it their
|
|
126
|
+
// responsibility to invoke their format?
|
|
127
|
+
return this.logv(infos, callback);
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
for (let i = 0; i < chunks.length; i++) {
|
|
131
|
+
if (!this._accept(chunks[i])) continue;
|
|
132
|
+
|
|
133
|
+
if (chunks[i].chunk && !this.format) {
|
|
134
|
+
this.log(chunks[i].chunk, chunks[i].callback);
|
|
135
|
+
continue;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
let errState;
|
|
139
|
+
let transformed;
|
|
140
|
+
|
|
141
|
+
// We trap(and re-throw) any errors generated by the user-provided format, but also
|
|
142
|
+
// guarantee that the streams callback is invoked so that we can continue flowing.
|
|
143
|
+
try {
|
|
144
|
+
transformed = this.format.transform(
|
|
145
|
+
Object.assign({}, chunks[i].chunk),
|
|
146
|
+
this.format.options
|
|
147
|
+
);
|
|
148
|
+
} catch (err) {
|
|
149
|
+
errState = err;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
if (errState || !transformed) {
|
|
153
|
+
// eslint-disable-next-line callback-return
|
|
154
|
+
chunks[i].callback();
|
|
155
|
+
if (errState) {
|
|
156
|
+
// eslint-disable-next-line callback-return
|
|
157
|
+
callback(null);
|
|
158
|
+
throw errState;
|
|
159
|
+
}
|
|
160
|
+
} else {
|
|
161
|
+
this.log(transformed, chunks[i].callback);
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
return callback(null);
|
|
166
|
+
};
|
|
167
|
+
|
|
168
|
+
/**
|
|
169
|
+
* Predicate function that returns true if the specfied `info` on the
|
|
170
|
+
* WriteReq, `write`, should be passed down into the derived
|
|
171
|
+
* TransportStream's I/O via `.log(info, callback)`.
|
|
172
|
+
* @param {WriteReq} write - winston@3 Node.js WriteReq for the `info` object
|
|
173
|
+
* representing the log message.
|
|
174
|
+
* @returns {Boolean} - Value indicating if the `write` should be accepted &
|
|
175
|
+
* logged.
|
|
176
|
+
*/
|
|
177
|
+
TransportStream.prototype._accept = function _accept(write) {
|
|
178
|
+
const info = write.chunk;
|
|
179
|
+
if (this.silent) {
|
|
180
|
+
return false;
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
// We always prefer any explicit level set on the Transport itself
|
|
184
|
+
// falling back to any level set on the parent.
|
|
185
|
+
const level = this.level || (this.parent && this.parent.level);
|
|
186
|
+
|
|
187
|
+
// Immediately check the average case: log level filtering.
|
|
188
|
+
if (
|
|
189
|
+
info.exception === true ||
|
|
190
|
+
!level ||
|
|
191
|
+
this.levels[level] >= this.levels[info[LEVEL]]
|
|
192
|
+
) {
|
|
193
|
+
// Ensure the info object is valid based on `{ exception }`:
|
|
194
|
+
// 1. { handleExceptions: true }: all `info` objects are valid
|
|
195
|
+
// 2. { exception: false }: accepted by all transports.
|
|
196
|
+
if (this.handleExceptions || info.exception !== true) {
|
|
197
|
+
return true;
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
return false;
|
|
202
|
+
};
|
|
203
|
+
|
|
204
|
+
/**
|
|
205
|
+
* _nop is short for "No operation"
|
|
206
|
+
* @returns {Boolean} Intentionally false.
|
|
207
|
+
*/
|
|
208
|
+
TransportStream.prototype._nop = function _nop() {
|
|
209
|
+
// eslint-disable-next-line no-undefined
|
|
210
|
+
return void undefined;
|
|
211
|
+
};
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; }
|
|
4
|
+
|
|
5
|
+
var codes = {};
|
|
6
|
+
|
|
7
|
+
function createErrorType(code, message, Base) {
|
|
8
|
+
if (!Base) {
|
|
9
|
+
Base = Error;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
function getMessage(arg1, arg2, arg3) {
|
|
13
|
+
if (typeof message === 'string') {
|
|
14
|
+
return message;
|
|
15
|
+
} else {
|
|
16
|
+
return message(arg1, arg2, arg3);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
var NodeError =
|
|
21
|
+
/*#__PURE__*/
|
|
22
|
+
function (_Base) {
|
|
23
|
+
_inheritsLoose(NodeError, _Base);
|
|
24
|
+
|
|
25
|
+
function NodeError(arg1, arg2, arg3) {
|
|
26
|
+
return _Base.call(this, getMessage(arg1, arg2, arg3)) || this;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
return NodeError;
|
|
30
|
+
}(Base);
|
|
31
|
+
|
|
32
|
+
NodeError.prototype.name = Base.name;
|
|
33
|
+
NodeError.prototype.code = code;
|
|
34
|
+
codes[code] = NodeError;
|
|
35
|
+
} // https://github.com/nodejs/node/blob/v10.8.0/lib/internal/errors.js
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
function oneOf(expected, thing) {
|
|
39
|
+
if (Array.isArray(expected)) {
|
|
40
|
+
var len = expected.length;
|
|
41
|
+
expected = expected.map(function (i) {
|
|
42
|
+
return String(i);
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
if (len > 2) {
|
|
46
|
+
return "one of ".concat(thing, " ").concat(expected.slice(0, len - 1).join(', '), ", or ") + expected[len - 1];
|
|
47
|
+
} else if (len === 2) {
|
|
48
|
+
return "one of ".concat(thing, " ").concat(expected[0], " or ").concat(expected[1]);
|
|
49
|
+
} else {
|
|
50
|
+
return "of ".concat(thing, " ").concat(expected[0]);
|
|
51
|
+
}
|
|
52
|
+
} else {
|
|
53
|
+
return "of ".concat(thing, " ").concat(String(expected));
|
|
54
|
+
}
|
|
55
|
+
} // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/startsWith
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
function startsWith(str, search, pos) {
|
|
59
|
+
return str.substr(!pos || pos < 0 ? 0 : +pos, search.length) === search;
|
|
60
|
+
} // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/endsWith
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
function endsWith(str, search, this_len) {
|
|
64
|
+
if (this_len === undefined || this_len > str.length) {
|
|
65
|
+
this_len = str.length;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
return str.substring(this_len - search.length, this_len) === search;
|
|
69
|
+
} // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/includes
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
function includes(str, search, start) {
|
|
73
|
+
if (typeof start !== 'number') {
|
|
74
|
+
start = 0;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
if (start + search.length > str.length) {
|
|
78
|
+
return false;
|
|
79
|
+
} else {
|
|
80
|
+
return str.indexOf(search, start) !== -1;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
createErrorType('ERR_INVALID_OPT_VALUE', function (name, value) {
|
|
85
|
+
return 'The value "' + value + '" is invalid for option "' + name + '"';
|
|
86
|
+
}, TypeError);
|
|
87
|
+
createErrorType('ERR_INVALID_ARG_TYPE', function (name, expected, actual) {
|
|
88
|
+
// determiner: 'must be' or 'must not be'
|
|
89
|
+
var determiner;
|
|
90
|
+
|
|
91
|
+
if (typeof expected === 'string' && startsWith(expected, 'not ')) {
|
|
92
|
+
determiner = 'must not be';
|
|
93
|
+
expected = expected.replace(/^not /, '');
|
|
94
|
+
} else {
|
|
95
|
+
determiner = 'must be';
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
var msg;
|
|
99
|
+
|
|
100
|
+
if (endsWith(name, ' argument')) {
|
|
101
|
+
// For cases like 'first argument'
|
|
102
|
+
msg = "The ".concat(name, " ").concat(determiner, " ").concat(oneOf(expected, 'type'));
|
|
103
|
+
} else {
|
|
104
|
+
var type = includes(name, '.') ? 'property' : 'argument';
|
|
105
|
+
msg = "The \"".concat(name, "\" ").concat(type, " ").concat(determiner, " ").concat(oneOf(expected, 'type'));
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
msg += ". Received type ".concat(typeof actual);
|
|
109
|
+
return msg;
|
|
110
|
+
}, TypeError);
|
|
111
|
+
createErrorType('ERR_STREAM_PUSH_AFTER_EOF', 'stream.push() after EOF');
|
|
112
|
+
createErrorType('ERR_METHOD_NOT_IMPLEMENTED', function (name) {
|
|
113
|
+
return 'The ' + name + ' method is not implemented';
|
|
114
|
+
});
|
|
115
|
+
createErrorType('ERR_STREAM_PREMATURE_CLOSE', 'Premature close');
|
|
116
|
+
createErrorType('ERR_STREAM_DESTROYED', function (name) {
|
|
117
|
+
return 'Cannot call ' + name + ' after a stream was destroyed';
|
|
118
|
+
});
|
|
119
|
+
createErrorType('ERR_MULTIPLE_CALLBACK', 'Callback called multiple times');
|
|
120
|
+
createErrorType('ERR_STREAM_CANNOT_PIPE', 'Cannot pipe, not readable');
|
|
121
|
+
createErrorType('ERR_STREAM_WRITE_AFTER_END', 'write after end');
|
|
122
|
+
createErrorType('ERR_STREAM_NULL_VALUES', 'May not write null values to stream', TypeError);
|
|
123
|
+
createErrorType('ERR_UNKNOWN_ENCODING', function (arg) {
|
|
124
|
+
return 'Unknown encoding: ' + arg;
|
|
125
|
+
}, TypeError);
|
|
126
|
+
createErrorType('ERR_STREAM_UNSHIFT_AFTER_END_EVENT', 'stream.unshift() after end event');
|
|
127
|
+
module.exports.codes = codes;
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const codes = {};
|
|
4
|
+
|
|
5
|
+
function createErrorType(code, message, Base) {
|
|
6
|
+
if (!Base) {
|
|
7
|
+
Base = Error
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
function getMessage (arg1, arg2, arg3) {
|
|
11
|
+
if (typeof message === 'string') {
|
|
12
|
+
return message
|
|
13
|
+
} else {
|
|
14
|
+
return message(arg1, arg2, arg3)
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
class NodeError extends Base {
|
|
19
|
+
constructor (arg1, arg2, arg3) {
|
|
20
|
+
super(getMessage(arg1, arg2, arg3));
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
NodeError.prototype.name = Base.name;
|
|
25
|
+
NodeError.prototype.code = code;
|
|
26
|
+
|
|
27
|
+
codes[code] = NodeError;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
// https://github.com/nodejs/node/blob/v10.8.0/lib/internal/errors.js
|
|
31
|
+
function oneOf(expected, thing) {
|
|
32
|
+
if (Array.isArray(expected)) {
|
|
33
|
+
const len = expected.length;
|
|
34
|
+
expected = expected.map((i) => String(i));
|
|
35
|
+
if (len > 2) {
|
|
36
|
+
return `one of ${thing} ${expected.slice(0, len - 1).join(', ')}, or ` +
|
|
37
|
+
expected[len - 1];
|
|
38
|
+
} else if (len === 2) {
|
|
39
|
+
return `one of ${thing} ${expected[0]} or ${expected[1]}`;
|
|
40
|
+
} else {
|
|
41
|
+
return `of ${thing} ${expected[0]}`;
|
|
42
|
+
}
|
|
43
|
+
} else {
|
|
44
|
+
return `of ${thing} ${String(expected)}`;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/startsWith
|
|
49
|
+
function startsWith(str, search, pos) {
|
|
50
|
+
return str.substr(!pos || pos < 0 ? 0 : +pos, search.length) === search;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/endsWith
|
|
54
|
+
function endsWith(str, search, this_len) {
|
|
55
|
+
if (this_len === undefined || this_len > str.length) {
|
|
56
|
+
this_len = str.length;
|
|
57
|
+
}
|
|
58
|
+
return str.substring(this_len - search.length, this_len) === search;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/includes
|
|
62
|
+
function includes(str, search, start) {
|
|
63
|
+
if (typeof start !== 'number') {
|
|
64
|
+
start = 0;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
if (start + search.length > str.length) {
|
|
68
|
+
return false;
|
|
69
|
+
} else {
|
|
70
|
+
return str.indexOf(search, start) !== -1;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
createErrorType('ERR_INVALID_OPT_VALUE', function (name, value) {
|
|
75
|
+
return 'The value "' + value + '" is invalid for option "' + name + '"'
|
|
76
|
+
}, TypeError);
|
|
77
|
+
createErrorType('ERR_INVALID_ARG_TYPE', function (name, expected, actual) {
|
|
78
|
+
// determiner: 'must be' or 'must not be'
|
|
79
|
+
let determiner;
|
|
80
|
+
if (typeof expected === 'string' && startsWith(expected, 'not ')) {
|
|
81
|
+
determiner = 'must not be';
|
|
82
|
+
expected = expected.replace(/^not /, '');
|
|
83
|
+
} else {
|
|
84
|
+
determiner = 'must be';
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
let msg;
|
|
88
|
+
if (endsWith(name, ' argument')) {
|
|
89
|
+
// For cases like 'first argument'
|
|
90
|
+
msg = `The ${name} ${determiner} ${oneOf(expected, 'type')}`;
|
|
91
|
+
} else {
|
|
92
|
+
const type = includes(name, '.') ? 'property' : 'argument';
|
|
93
|
+
msg = `The "${name}" ${type} ${determiner} ${oneOf(expected, 'type')}`;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
msg += `. Received type ${typeof actual}`;
|
|
97
|
+
return msg;
|
|
98
|
+
}, TypeError);
|
|
99
|
+
createErrorType('ERR_STREAM_PUSH_AFTER_EOF', 'stream.push() after EOF');
|
|
100
|
+
createErrorType('ERR_METHOD_NOT_IMPLEMENTED', function (name) {
|
|
101
|
+
return 'The ' + name + ' method is not implemented'
|
|
102
|
+
});
|
|
103
|
+
createErrorType('ERR_STREAM_PREMATURE_CLOSE', 'Premature close');
|
|
104
|
+
createErrorType('ERR_STREAM_DESTROYED', function (name) {
|
|
105
|
+
return 'Cannot call ' + name + ' after a stream was destroyed';
|
|
106
|
+
});
|
|
107
|
+
createErrorType('ERR_MULTIPLE_CALLBACK', 'Callback called multiple times');
|
|
108
|
+
createErrorType('ERR_STREAM_CANNOT_PIPE', 'Cannot pipe, not readable');
|
|
109
|
+
createErrorType('ERR_STREAM_WRITE_AFTER_END', 'write after end');
|
|
110
|
+
createErrorType('ERR_STREAM_NULL_VALUES', 'May not write null values to stream', TypeError);
|
|
111
|
+
createErrorType('ERR_UNKNOWN_ENCODING', function (arg) {
|
|
112
|
+
return 'Unknown encoding: ' + arg
|
|
113
|
+
}, TypeError);
|
|
114
|
+
createErrorType('ERR_STREAM_UNSHIFT_AFTER_END_EVENT', 'stream.unshift() after end event');
|
|
115
|
+
|
|
116
|
+
module.exports.codes = codes;
|
package/dist/node_modules/winston-transport/node_modules/readable-stream/experimentalWarning.js
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
var experimentalWarnings = new Set();
|
|
4
|
+
|
|
5
|
+
function emitExperimentalWarning(feature) {
|
|
6
|
+
if (experimentalWarnings.has(feature)) return;
|
|
7
|
+
var msg = feature + ' is an experimental feature. This feature could ' +
|
|
8
|
+
'change at any time';
|
|
9
|
+
experimentalWarnings.add(feature);
|
|
10
|
+
process.emitWarning(msg, 'ExperimentalWarning');
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
function noop() {}
|
|
14
|
+
|
|
15
|
+
module.exports.emitExperimentalWarning = process.emitWarning
|
|
16
|
+
? emitExperimentalWarning
|
|
17
|
+
: noop;
|
package/dist/node_modules/winston-transport/node_modules/readable-stream/lib/_stream_duplex.js
ADDED
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
// Copyright Joyent, Inc. and other Node contributors.
|
|
2
|
+
//
|
|
3
|
+
// Permission is hereby granted, free of charge, to any person obtaining a
|
|
4
|
+
// copy of this software and associated documentation files (the
|
|
5
|
+
// "Software"), to deal in the Software without restriction, including
|
|
6
|
+
// without limitation the rights to use, copy, modify, merge, publish,
|
|
7
|
+
// distribute, sublicense, and/or sell copies of the Software, and to permit
|
|
8
|
+
// persons to whom the Software is furnished to do so, subject to the
|
|
9
|
+
// following conditions:
|
|
10
|
+
//
|
|
11
|
+
// The above copyright notice and this permission notice shall be included
|
|
12
|
+
// in all copies or substantial portions of the Software.
|
|
13
|
+
//
|
|
14
|
+
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
|
15
|
+
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
16
|
+
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
|
|
17
|
+
// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
|
18
|
+
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
|
19
|
+
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
|
|
20
|
+
// USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
21
|
+
|
|
22
|
+
// a duplex stream is just a stream that is both readable and writable.
|
|
23
|
+
// Since JS doesn't have multiple prototypal inheritance, this class
|
|
24
|
+
// prototypally inherits from Readable, and then parasitically from
|
|
25
|
+
// Writable.
|
|
26
|
+
|
|
27
|
+
'use strict';
|
|
28
|
+
|
|
29
|
+
/*<replacement>*/
|
|
30
|
+
var objectKeys = Object.keys || function (obj) {
|
|
31
|
+
var keys = [];
|
|
32
|
+
for (var key in obj) keys.push(key);
|
|
33
|
+
return keys;
|
|
34
|
+
};
|
|
35
|
+
/*</replacement>*/
|
|
36
|
+
|
|
37
|
+
module.exports = Duplex;
|
|
38
|
+
var Readable = require('./_stream_readable');
|
|
39
|
+
var Writable = require('./_stream_writable');
|
|
40
|
+
require('inherits')(Duplex, Readable);
|
|
41
|
+
{
|
|
42
|
+
// Allow the keys array to be GC'ed.
|
|
43
|
+
var keys = objectKeys(Writable.prototype);
|
|
44
|
+
for (var v = 0; v < keys.length; v++) {
|
|
45
|
+
var method = keys[v];
|
|
46
|
+
if (!Duplex.prototype[method]) Duplex.prototype[method] = Writable.prototype[method];
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
function Duplex(options) {
|
|
50
|
+
if (!(this instanceof Duplex)) return new Duplex(options);
|
|
51
|
+
Readable.call(this, options);
|
|
52
|
+
Writable.call(this, options);
|
|
53
|
+
this.allowHalfOpen = true;
|
|
54
|
+
if (options) {
|
|
55
|
+
if (options.readable === false) this.readable = false;
|
|
56
|
+
if (options.writable === false) this.writable = false;
|
|
57
|
+
if (options.allowHalfOpen === false) {
|
|
58
|
+
this.allowHalfOpen = false;
|
|
59
|
+
this.once('end', onend);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
Object.defineProperty(Duplex.prototype, 'writableHighWaterMark', {
|
|
64
|
+
// making it explicit this property is not enumerable
|
|
65
|
+
// because otherwise some prototype manipulation in
|
|
66
|
+
// userland will fail
|
|
67
|
+
enumerable: false,
|
|
68
|
+
get: function get() {
|
|
69
|
+
return this._writableState.highWaterMark;
|
|
70
|
+
}
|
|
71
|
+
});
|
|
72
|
+
Object.defineProperty(Duplex.prototype, 'writableBuffer', {
|
|
73
|
+
// making it explicit this property is not enumerable
|
|
74
|
+
// because otherwise some prototype manipulation in
|
|
75
|
+
// userland will fail
|
|
76
|
+
enumerable: false,
|
|
77
|
+
get: function get() {
|
|
78
|
+
return this._writableState && this._writableState.getBuffer();
|
|
79
|
+
}
|
|
80
|
+
});
|
|
81
|
+
Object.defineProperty(Duplex.prototype, 'writableLength', {
|
|
82
|
+
// making it explicit this property is not enumerable
|
|
83
|
+
// because otherwise some prototype manipulation in
|
|
84
|
+
// userland will fail
|
|
85
|
+
enumerable: false,
|
|
86
|
+
get: function get() {
|
|
87
|
+
return this._writableState.length;
|
|
88
|
+
}
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
// the no-half-open enforcer
|
|
92
|
+
function onend() {
|
|
93
|
+
// If the writable side ended, then we're ok.
|
|
94
|
+
if (this._writableState.ended) return;
|
|
95
|
+
|
|
96
|
+
// no more data can be written.
|
|
97
|
+
// But allow more writes to happen in this tick.
|
|
98
|
+
process.nextTick(onEndNT, this);
|
|
99
|
+
}
|
|
100
|
+
function onEndNT(self) {
|
|
101
|
+
self.end();
|
|
102
|
+
}
|
|
103
|
+
Object.defineProperty(Duplex.prototype, 'destroyed', {
|
|
104
|
+
// making it explicit this property is not enumerable
|
|
105
|
+
// because otherwise some prototype manipulation in
|
|
106
|
+
// userland will fail
|
|
107
|
+
enumerable: false,
|
|
108
|
+
get: function get() {
|
|
109
|
+
if (this._readableState === undefined || this._writableState === undefined) {
|
|
110
|
+
return false;
|
|
111
|
+
}
|
|
112
|
+
return this._readableState.destroyed && this._writableState.destroyed;
|
|
113
|
+
},
|
|
114
|
+
set: function set(value) {
|
|
115
|
+
// we ignore the value if the stream
|
|
116
|
+
// has not been initialized yet
|
|
117
|
+
if (this._readableState === undefined || this._writableState === undefined) {
|
|
118
|
+
return;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
// backward compatibility, the user is explicitly
|
|
122
|
+
// managing destroyed
|
|
123
|
+
this._readableState.destroyed = value;
|
|
124
|
+
this._writableState.destroyed = value;
|
|
125
|
+
}
|
|
126
|
+
});
|
package/dist/node_modules/winston-transport/node_modules/readable-stream/lib/_stream_passthrough.js
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
// Copyright Joyent, Inc. and other Node contributors.
|
|
2
|
+
//
|
|
3
|
+
// Permission is hereby granted, free of charge, to any person obtaining a
|
|
4
|
+
// copy of this software and associated documentation files (the
|
|
5
|
+
// "Software"), to deal in the Software without restriction, including
|
|
6
|
+
// without limitation the rights to use, copy, modify, merge, publish,
|
|
7
|
+
// distribute, sublicense, and/or sell copies of the Software, and to permit
|
|
8
|
+
// persons to whom the Software is furnished to do so, subject to the
|
|
9
|
+
// following conditions:
|
|
10
|
+
//
|
|
11
|
+
// The above copyright notice and this permission notice shall be included
|
|
12
|
+
// in all copies or substantial portions of the Software.
|
|
13
|
+
//
|
|
14
|
+
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
|
15
|
+
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
16
|
+
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
|
|
17
|
+
// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
|
18
|
+
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
|
19
|
+
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
|
|
20
|
+
// USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
21
|
+
|
|
22
|
+
// a passthrough stream.
|
|
23
|
+
// basically just the most minimal sort of Transform stream.
|
|
24
|
+
// Every written chunk gets output as-is.
|
|
25
|
+
|
|
26
|
+
'use strict';
|
|
27
|
+
|
|
28
|
+
module.exports = PassThrough;
|
|
29
|
+
var Transform = require('./_stream_transform');
|
|
30
|
+
require('inherits')(PassThrough, Transform);
|
|
31
|
+
function PassThrough(options) {
|
|
32
|
+
if (!(this instanceof PassThrough)) return new PassThrough(options);
|
|
33
|
+
Transform.call(this, options);
|
|
34
|
+
}
|
|
35
|
+
PassThrough.prototype._transform = function (chunk, encoding, cb) {
|
|
36
|
+
cb(null, chunk);
|
|
37
|
+
};
|