@sergdudko/objectstream 2.0.4 → 3.1.0
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/CHANGELOG.md +2 -27
- package/README.md +4 -1
- package/ignoreUpdatesModules.json +4 -0
- package/lib/classes/Parser.d.ts +102 -0
- package/lib/classes/Parser.js +231 -0
- package/lib/classes/Parser.js.map +1 -0
- package/lib/classes/Stringifer.d.ts +70 -0
- package/lib/classes/Stringifer.js +144 -0
- package/lib/classes/Stringifer.js.map +1 -0
- package/lib/index.d.ts +2 -169
- package/lib/index.js +4 -394
- package/lib/index.js.map +1 -1
- package/lib/utils/global.d.ts +8 -0
- package/lib/utils/global.js +40 -0
- package/lib/utils/global.js.map +1 -0
- package/package.json +22 -14
- package/lib/index.d.ts.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,29 +1,4 @@
|
|
|
1
|
-
#
|
|
1
|
+
# 3.0.0 / 2021-05-10
|
|
2
2
|
|
|
3
3
|
## :tada: Enhancements
|
|
4
|
-
-
|
|
5
|
-
|
|
6
|
-
# 2.0.3 / 2020-06-08
|
|
7
|
-
|
|
8
|
-
## :tada: Enhancements
|
|
9
|
-
- Size optimization
|
|
10
|
-
|
|
11
|
-
# 2.0.2 / 2020-06-07
|
|
12
|
-
|
|
13
|
-
## :tada: Enhancements
|
|
14
|
-
- Added TypeScript declaration
|
|
15
|
-
|
|
16
|
-
# 2.0.1 / 2020-06-07
|
|
17
|
-
|
|
18
|
-
## :tada: Enhancements
|
|
19
|
-
- Update AutoDeploy scripts
|
|
20
|
-
|
|
21
|
-
# 2.0.0 / 2020-06-07
|
|
22
|
-
|
|
23
|
-
## :tada: Enhancements
|
|
24
|
-
- New version in TypeScript implementation
|
|
25
|
-
|
|
26
|
-
# 1.7.7 / 2020-01-16
|
|
27
|
-
|
|
28
|
-
## :tada: Stable version
|
|
29
|
-
- Old version in JavaScript implementation
|
|
4
|
+
- Removed support Node v8.x
|
package/README.md
CHANGED
|
@@ -89,10 +89,13 @@ Creates a stream to convert json from string or convert json to drain. The strea
|
|
|
89
89
|
```
|
|
90
90
|
|
|
91
91
|
## WARNING
|
|
92
|
-
Streams behave unexpectedly when processing errors in versions node
|
|
92
|
+
Streams behave unexpectedly when processing errors in versions node 14 and later. In these versions, you need to make sure that in case of an error the stream will be destroyed or the processing of the stream will continue.
|
|
93
93
|
|
|
94
94
|
## EXAMPLE
|
|
95
95
|
[see test directory](https://github.com/siarheidudko/objectstream/tree/master/test)
|
|
96
|
+
|
|
97
|
+
## OLDER VERSIONS
|
|
98
|
+
- [v2.0.5](https://www.npmjs.com/package/@sergdudko/objectstream/v/2.0.5) - supported Node 8
|
|
96
99
|
|
|
97
100
|
## LICENSE
|
|
98
101
|
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
/// <reference types="node" />
|
|
3
|
+
import { Transform } from "stream";
|
|
4
|
+
/**
|
|
5
|
+
* @class Parser
|
|
6
|
+
*
|
|
7
|
+
* Сreates an instance of Parser (String to Json conversion stream)
|
|
8
|
+
*/
|
|
9
|
+
export declare class Parser extends Transform {
|
|
10
|
+
/**
|
|
11
|
+
*
|
|
12
|
+
* @param start - first separator
|
|
13
|
+
* @param middle - middle separator
|
|
14
|
+
* @param end - end separator
|
|
15
|
+
*/
|
|
16
|
+
constructor(start?: string, middle?: string, end?: string);
|
|
17
|
+
/**
|
|
18
|
+
* separators
|
|
19
|
+
*
|
|
20
|
+
* @private
|
|
21
|
+
*/
|
|
22
|
+
private __separators;
|
|
23
|
+
/**
|
|
24
|
+
* empty buffer
|
|
25
|
+
*
|
|
26
|
+
* @private
|
|
27
|
+
*/
|
|
28
|
+
private static __empty;
|
|
29
|
+
/**
|
|
30
|
+
* stream byte counter
|
|
31
|
+
*
|
|
32
|
+
* @private
|
|
33
|
+
*/
|
|
34
|
+
private __bytesRead;
|
|
35
|
+
/**
|
|
36
|
+
* stream encoding
|
|
37
|
+
*
|
|
38
|
+
* @private
|
|
39
|
+
*/
|
|
40
|
+
private __encoding;
|
|
41
|
+
/**
|
|
42
|
+
* stream buffer
|
|
43
|
+
*
|
|
44
|
+
* @private
|
|
45
|
+
*/
|
|
46
|
+
private __buffers;
|
|
47
|
+
/**
|
|
48
|
+
* left brace counter
|
|
49
|
+
*
|
|
50
|
+
* @private
|
|
51
|
+
*/
|
|
52
|
+
private __leftBrace;
|
|
53
|
+
/**
|
|
54
|
+
* right brace counter
|
|
55
|
+
*
|
|
56
|
+
* @private
|
|
57
|
+
*/
|
|
58
|
+
private __rightBrace;
|
|
59
|
+
/**
|
|
60
|
+
* open quote flag
|
|
61
|
+
*
|
|
62
|
+
* @private
|
|
63
|
+
*/
|
|
64
|
+
private __openQuotes;
|
|
65
|
+
/**
|
|
66
|
+
* clear buffer and reset counters
|
|
67
|
+
*
|
|
68
|
+
* @private
|
|
69
|
+
*/
|
|
70
|
+
private __clear;
|
|
71
|
+
/**
|
|
72
|
+
* basic stream handler
|
|
73
|
+
*/
|
|
74
|
+
private __handler;
|
|
75
|
+
/**
|
|
76
|
+
* Data event handler
|
|
77
|
+
*
|
|
78
|
+
* @private
|
|
79
|
+
* @param string - string or buffer data
|
|
80
|
+
* @param encoding - stream encoding
|
|
81
|
+
* @param callback - callback function
|
|
82
|
+
*/
|
|
83
|
+
_transform(string: string | Buffer | null | undefined, encoding?: BufferEncoding, callback?: Function): void;
|
|
84
|
+
/**
|
|
85
|
+
* Flush event handler
|
|
86
|
+
*
|
|
87
|
+
* @private
|
|
88
|
+
* @param callback - callback function
|
|
89
|
+
*/
|
|
90
|
+
_flush(callback?: Function): void;
|
|
91
|
+
/**
|
|
92
|
+
* End event handler
|
|
93
|
+
*
|
|
94
|
+
* @private
|
|
95
|
+
* @param callback - callback function
|
|
96
|
+
*/
|
|
97
|
+
_final(callback?: Function): void;
|
|
98
|
+
/**
|
|
99
|
+
* set stream encoding
|
|
100
|
+
*/
|
|
101
|
+
setEncoding(encoding: "utf8" | "utf-8" | "base64" | "latin1" | "binary" | "hex"): this;
|
|
102
|
+
}
|
|
@@ -0,0 +1,231 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Parser = void 0;
|
|
4
|
+
const stream_1 = require("stream");
|
|
5
|
+
const global_1 = require("../utils/global");
|
|
6
|
+
/**
|
|
7
|
+
* @class Parser
|
|
8
|
+
*
|
|
9
|
+
* Сreates an instance of Parser (String to Json conversion stream)
|
|
10
|
+
*/
|
|
11
|
+
class Parser extends stream_1.Transform {
|
|
12
|
+
/**
|
|
13
|
+
*
|
|
14
|
+
* @param start - first separator
|
|
15
|
+
* @param middle - middle separator
|
|
16
|
+
* @param end - end separator
|
|
17
|
+
*/
|
|
18
|
+
constructor(start, middle, end) {
|
|
19
|
+
super({ highWaterMark: 64 * 1024, objectMode: true });
|
|
20
|
+
if ((typeof (start) !== "undefined") &&
|
|
21
|
+
((typeof (start) !== "string") ||
|
|
22
|
+
(Buffer.byteLength(start) > 1) ||
|
|
23
|
+
(start.match(/["{}]/))))
|
|
24
|
+
throw new Error("Argument start require one byte String!");
|
|
25
|
+
if ((typeof (middle) !== "undefined") &&
|
|
26
|
+
((typeof (middle) !== "string") ||
|
|
27
|
+
(Buffer.byteLength(middle) > 1) ||
|
|
28
|
+
(middle.match(/["{}]/))))
|
|
29
|
+
throw new Error("Argument separator require one byte String!");
|
|
30
|
+
if ((typeof (end) !== "undefined") &&
|
|
31
|
+
((typeof (end) !== "string") ||
|
|
32
|
+
(Buffer.byteLength(end) > 1) ||
|
|
33
|
+
(end.match(/["{}]/))))
|
|
34
|
+
throw new Error("Argument end require one byte String!");
|
|
35
|
+
this.__separators = {
|
|
36
|
+
start: Buffer.from(start ? start : "", "utf8")[0],
|
|
37
|
+
middle: Buffer.from(middle ? middle : "", "utf8")[0],
|
|
38
|
+
end: Buffer.from(end ? end : "", "utf8")[0]
|
|
39
|
+
};
|
|
40
|
+
this.__clear();
|
|
41
|
+
this.__bytesRead = 0;
|
|
42
|
+
this.__encoding = "utf8";
|
|
43
|
+
this.setDefaultEncoding(this.__encoding);
|
|
44
|
+
this.__buffers = [];
|
|
45
|
+
this.__leftBrace = 0;
|
|
46
|
+
this.__rightBrace = 0;
|
|
47
|
+
this.__openQuotes = false;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* clear buffer and reset counters
|
|
51
|
+
*
|
|
52
|
+
* @private
|
|
53
|
+
*/
|
|
54
|
+
__clear() {
|
|
55
|
+
this.__buffers = [];
|
|
56
|
+
this.__leftBrace = 0;
|
|
57
|
+
this.__rightBrace = 0;
|
|
58
|
+
this.__openQuotes = false;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* basic stream handler
|
|
62
|
+
*/
|
|
63
|
+
__handler(buffer, s, errors) {
|
|
64
|
+
if (this.__buffers.length > 65536) {
|
|
65
|
+
const _nbuffer = Buffer.concat(this.__buffers);
|
|
66
|
+
this.__buffers = [];
|
|
67
|
+
this.__buffers.push(_nbuffer);
|
|
68
|
+
}
|
|
69
|
+
if (this.__leftBrace !== 0) {
|
|
70
|
+
this.__buffers.push(buffer.slice(s, s + 1));
|
|
71
|
+
}
|
|
72
|
+
else if ((this.__separators.start !== buffer[s]) &&
|
|
73
|
+
(this.__separators.end !== buffer[s]) &&
|
|
74
|
+
(this.__separators.middle !== buffer[s]) &&
|
|
75
|
+
(0x20 !== buffer[s]) &&
|
|
76
|
+
(0x0d !== buffer[s]) &&
|
|
77
|
+
(0x0a !== buffer[s]) &&
|
|
78
|
+
(0x09 !== buffer[s])) {
|
|
79
|
+
errors.push(new Error("Unexpected token " +
|
|
80
|
+
buffer.slice(s, s + 1).toString(this.__encoding) +
|
|
81
|
+
" in JSON at position " + (this.__bytesRead + s)));
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Data event handler
|
|
86
|
+
*
|
|
87
|
+
* @private
|
|
88
|
+
* @param string - string or buffer data
|
|
89
|
+
* @param encoding - stream encoding
|
|
90
|
+
* @param callback - callback function
|
|
91
|
+
*/
|
|
92
|
+
_transform(string,
|
|
93
|
+
// eslint-disable-next-line
|
|
94
|
+
encoding = this.__encoding, callback = () => { return; }) {
|
|
95
|
+
if (typeof (string) === "undefined") {
|
|
96
|
+
callback();
|
|
97
|
+
return;
|
|
98
|
+
}
|
|
99
|
+
if (string === null) {
|
|
100
|
+
this._final(() => {
|
|
101
|
+
callback();
|
|
102
|
+
});
|
|
103
|
+
return;
|
|
104
|
+
}
|
|
105
|
+
const _buffer = (typeof (string) === "string") ?
|
|
106
|
+
Buffer.from(string, encoding) : string;
|
|
107
|
+
if (!(_buffer instanceof Buffer)) {
|
|
108
|
+
callback([
|
|
109
|
+
new Error("Incoming data type is " +
|
|
110
|
+
typeof (_buffer) +
|
|
111
|
+
", require data type is String!")
|
|
112
|
+
]);
|
|
113
|
+
return;
|
|
114
|
+
}
|
|
115
|
+
if (Parser.__empty.equals(_buffer)) {
|
|
116
|
+
callback();
|
|
117
|
+
return;
|
|
118
|
+
}
|
|
119
|
+
const errors = [];
|
|
120
|
+
for (let s = 0; s < _buffer.length; s++) {
|
|
121
|
+
switch (_buffer[s]) {
|
|
122
|
+
case 0x7b:
|
|
123
|
+
this.__leftBrace++;
|
|
124
|
+
this.__handler(_buffer, s, errors);
|
|
125
|
+
break;
|
|
126
|
+
case 0x7d:
|
|
127
|
+
this.__rightBrace++;
|
|
128
|
+
this.__handler(_buffer, s, errors);
|
|
129
|
+
break;
|
|
130
|
+
case 0x08:
|
|
131
|
+
case 0x09:
|
|
132
|
+
case 0x0a:
|
|
133
|
+
case 0x0c:
|
|
134
|
+
case 0x0d:
|
|
135
|
+
case 0x00:
|
|
136
|
+
case 0x0b:
|
|
137
|
+
if (this.__openQuotes && (this.__leftBrace !== 0))
|
|
138
|
+
this.__buffers.push(Buffer.from("\\u" + ("0000" + _buffer[s].toString(16)).slice(-4), "utf8"));
|
|
139
|
+
break;
|
|
140
|
+
case 0x22:
|
|
141
|
+
if (_buffer[s - 1] !== 0x5c)
|
|
142
|
+
if (this.__openQuotes)
|
|
143
|
+
this.__openQuotes = false;
|
|
144
|
+
else if (this.__leftBrace !== 0)
|
|
145
|
+
this.__openQuotes = true;
|
|
146
|
+
this.__handler(_buffer, s, errors);
|
|
147
|
+
break;
|
|
148
|
+
default:
|
|
149
|
+
this.__handler(_buffer, s, errors);
|
|
150
|
+
break;
|
|
151
|
+
}
|
|
152
|
+
if ((this.__leftBrace !== 0) && (this.__leftBrace === this.__rightBrace)) {
|
|
153
|
+
try {
|
|
154
|
+
const _buf = Buffer.concat(this.__buffers);
|
|
155
|
+
const _str = _buf.toString("utf8");
|
|
156
|
+
const _object = JSON.parse(_str);
|
|
157
|
+
if ((0, global_1.validator)(_object, false)) {
|
|
158
|
+
this.__clear();
|
|
159
|
+
this.push(_object);
|
|
160
|
+
}
|
|
161
|
+
else {
|
|
162
|
+
this.__clear();
|
|
163
|
+
errors.push(new Error("Validation failed, incoming data type is not pure Object!"));
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
catch (err) {
|
|
167
|
+
this.__clear();
|
|
168
|
+
errors.push(err);
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
else if (this.__leftBrace < this.__rightBrace) {
|
|
172
|
+
this.__clear();
|
|
173
|
+
errors.push(new Error("Parsing error, clear buffer!"));
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
if (errors.length > 0)
|
|
177
|
+
callback(errors);
|
|
178
|
+
else
|
|
179
|
+
callback();
|
|
180
|
+
this.__bytesRead += _buffer.byteLength;
|
|
181
|
+
}
|
|
182
|
+
/**
|
|
183
|
+
* Flush event handler
|
|
184
|
+
*
|
|
185
|
+
* @private
|
|
186
|
+
* @param callback - callback function
|
|
187
|
+
*/
|
|
188
|
+
_flush(callback = () => { return; }) {
|
|
189
|
+
this.__clear();
|
|
190
|
+
callback();
|
|
191
|
+
}
|
|
192
|
+
/**
|
|
193
|
+
* End event handler
|
|
194
|
+
*
|
|
195
|
+
* @private
|
|
196
|
+
* @param callback - callback function
|
|
197
|
+
*/
|
|
198
|
+
_final(callback = () => { return; }) {
|
|
199
|
+
if (this.__buffers.length === 0) {
|
|
200
|
+
callback();
|
|
201
|
+
return;
|
|
202
|
+
}
|
|
203
|
+
try {
|
|
204
|
+
const _buf = Buffer.concat(this.__buffers);
|
|
205
|
+
const _str = _buf.toString("utf8");
|
|
206
|
+
JSON.parse(_str);
|
|
207
|
+
callback([
|
|
208
|
+
new Error("Raw object detected!")
|
|
209
|
+
]);
|
|
210
|
+
}
|
|
211
|
+
catch (err) {
|
|
212
|
+
callback([err]);
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
/**
|
|
216
|
+
* set stream encoding
|
|
217
|
+
*/
|
|
218
|
+
setEncoding(encoding) {
|
|
219
|
+
this.__encoding = encoding;
|
|
220
|
+
this.setDefaultEncoding(this.__encoding);
|
|
221
|
+
return this;
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
exports.Parser = Parser;
|
|
225
|
+
/**
|
|
226
|
+
* empty buffer
|
|
227
|
+
*
|
|
228
|
+
* @private
|
|
229
|
+
*/
|
|
230
|
+
Parser.__empty = Buffer.from("");
|
|
231
|
+
//# sourceMappingURL=Parser.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Parser.js","sourceRoot":"","sources":["../../src/classes/Parser.ts"],"names":[],"mappings":";;;AAAA,mCAAkC;AAClC,4CAA2C;AAE3C;;;;GAIG;AACH,MAAa,MAAO,SAAQ,kBAAS;IACpC;;;;;OAKG;IACH,YAAY,KAAc,EAAE,MAAe,EAAE,GAAY;QACxD,KAAK,CAAC,EAAE,aAAa,EAAE,EAAE,GAAC,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,CAAC,CAAA;QACnD,IACC,CAAC,OAAM,CAAC,KAAK,CAAC,KAAK,WAAW,CAAC;YAC/B,CAAC,CAAC,OAAM,CA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|
+
/// <reference types="node" />
|
|
3
|
+
import { Transform } from "stream";
|
|
4
|
+
/**
|
|
5
|
+
* @class Stringifer
|
|
6
|
+
*
|
|
7
|
+
* Сreates an instance of Stringifer (Json to String conversion stream)
|
|
8
|
+
*/
|
|
9
|
+
export declare class Stringifer extends Transform {
|
|
10
|
+
/**
|
|
11
|
+
*
|
|
12
|
+
* @param start - first separator
|
|
13
|
+
* @param middle - middle separator
|
|
14
|
+
* @param end - end separator
|
|
15
|
+
*/
|
|
16
|
+
constructor(start?: string, middle?: string, end?: string);
|
|
17
|
+
/**
|
|
18
|
+
* separators
|
|
19
|
+
*
|
|
20
|
+
* @private
|
|
21
|
+
*/
|
|
22
|
+
private __separators;
|
|
23
|
+
/**
|
|
24
|
+
* pass string data to the stream
|
|
25
|
+
*
|
|
26
|
+
* @private
|
|
27
|
+
*/
|
|
28
|
+
private __isString;
|
|
29
|
+
/**
|
|
30
|
+
* stream byte counter
|
|
31
|
+
*
|
|
32
|
+
* @private
|
|
33
|
+
*/
|
|
34
|
+
private __bytesWrite;
|
|
35
|
+
/**
|
|
36
|
+
* stream encoding
|
|
37
|
+
*
|
|
38
|
+
* @private
|
|
39
|
+
*/
|
|
40
|
+
private __encoding;
|
|
41
|
+
/**
|
|
42
|
+
* Data event handler
|
|
43
|
+
*
|
|
44
|
+
* @private
|
|
45
|
+
* @param object - object data
|
|
46
|
+
* @param encoding - stream encoding
|
|
47
|
+
* @param callback - callback function
|
|
48
|
+
*/
|
|
49
|
+
_transform(object: {
|
|
50
|
+
[key: string]: any;
|
|
51
|
+
} | null | undefined, encoding?: BufferEncoding, callback?: Function): void;
|
|
52
|
+
/**
|
|
53
|
+
* Flush event handler
|
|
54
|
+
*
|
|
55
|
+
* @private
|
|
56
|
+
* @param callback - callback function
|
|
57
|
+
*/
|
|
58
|
+
_flush(callback?: () => void): void;
|
|
59
|
+
/**
|
|
60
|
+
* End event handler
|
|
61
|
+
*
|
|
62
|
+
* @private
|
|
63
|
+
* @param callback - callback function
|
|
64
|
+
*/
|
|
65
|
+
_final(callback?: () => void): void;
|
|
66
|
+
/**
|
|
67
|
+
* set stream encoding
|
|
68
|
+
*/
|
|
69
|
+
setEncoding(encoding: "utf8" | "utf-8" | "base64" | "latin1" | "binary" | "hex"): this;
|
|
70
|
+
}
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Stringifer = void 0;
|
|
4
|
+
const stream_1 = require("stream");
|
|
5
|
+
const global_1 = require("../utils/global");
|
|
6
|
+
/**
|
|
7
|
+
* @class Stringifer
|
|
8
|
+
*
|
|
9
|
+
* Сreates an instance of Stringifer (Json to String conversion stream)
|
|
10
|
+
*/
|
|
11
|
+
class Stringifer extends stream_1.Transform {
|
|
12
|
+
/**
|
|
13
|
+
*
|
|
14
|
+
* @param start - first separator
|
|
15
|
+
* @param middle - middle separator
|
|
16
|
+
* @param end - end separator
|
|
17
|
+
*/
|
|
18
|
+
constructor(start, middle, end) {
|
|
19
|
+
super({ highWaterMark: 64 * 1024, objectMode: true });
|
|
20
|
+
if ((typeof (start) !== "undefined") &&
|
|
21
|
+
((typeof (start) !== "string") ||
|
|
22
|
+
(Buffer.byteLength(start) > 1) ||
|
|
23
|
+
(start.match(/["{}]/))))
|
|
24
|
+
throw new Error("Argument start require one byte String!");
|
|
25
|
+
if ((typeof (middle) !== "undefined") &&
|
|
26
|
+
((typeof (middle) !== "string") ||
|
|
27
|
+
(Buffer.byteLength(middle) > 1) ||
|
|
28
|
+
(middle.match(/["{}]/))))
|
|
29
|
+
throw new Error("Argument separator require one byte String!");
|
|
30
|
+
if ((typeof (end) !== "undefined") &&
|
|
31
|
+
((typeof (end) !== "string") ||
|
|
32
|
+
(Buffer.byteLength(end) > 1) ||
|
|
33
|
+
(end.match(/["{}]/))))
|
|
34
|
+
throw new Error("Argument end require one byte String!");
|
|
35
|
+
this.__separators = {
|
|
36
|
+
start: Buffer.from(start ? start : "", "utf8"),
|
|
37
|
+
middle: Buffer.from(middle ? middle : "", "utf8"),
|
|
38
|
+
end: Buffer.from(end ? end : "", "utf8")
|
|
39
|
+
};
|
|
40
|
+
this.__isString = false;
|
|
41
|
+
this.__bytesWrite = 0;
|
|
42
|
+
this.__encoding = "utf8";
|
|
43
|
+
this.setDefaultEncoding(this.__encoding);
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Data event handler
|
|
47
|
+
*
|
|
48
|
+
* @private
|
|
49
|
+
* @param object - object data
|
|
50
|
+
* @param encoding - stream encoding
|
|
51
|
+
* @param callback - callback function
|
|
52
|
+
*/
|
|
53
|
+
// eslint-disable-next-line
|
|
54
|
+
_transform(object,
|
|
55
|
+
// eslint-disable-next-line
|
|
56
|
+
encoding = this.__encoding, callback = () => { return; }) {
|
|
57
|
+
if (typeof (object) === "undefined") {
|
|
58
|
+
callback();
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
if (object === null) {
|
|
62
|
+
this._final(() => {
|
|
63
|
+
callback();
|
|
64
|
+
});
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
switch (typeof (object)) {
|
|
68
|
+
case "object":
|
|
69
|
+
try {
|
|
70
|
+
if ((0, global_1.validator)(object, false) !== true) {
|
|
71
|
+
callback([new Error("Validation failed, incoming data type is not pure Object!")]);
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
74
|
+
let _buffer = Buffer.from(JSON.stringify(object), "utf8");
|
|
75
|
+
if (this.__bytesWrite === 0) {
|
|
76
|
+
_buffer = Buffer.concat([this.__separators.start, _buffer]);
|
|
77
|
+
}
|
|
78
|
+
else {
|
|
79
|
+
_buffer = Buffer.concat([this.__separators.middle, _buffer]);
|
|
80
|
+
}
|
|
81
|
+
if (this.__isString)
|
|
82
|
+
this.push(_buffer.toString(this.__encoding));
|
|
83
|
+
else
|
|
84
|
+
this.push(_buffer, this.__encoding);
|
|
85
|
+
this.__bytesWrite += Buffer.byteLength(_buffer);
|
|
86
|
+
callback();
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
89
|
+
catch (err) {
|
|
90
|
+
callback([err]);
|
|
91
|
+
return;
|
|
92
|
+
}
|
|
93
|
+
case "undefined":
|
|
94
|
+
callback();
|
|
95
|
+
return;
|
|
96
|
+
default:
|
|
97
|
+
callback([new Error("Incoming data type is " + typeof (object) + ", require data type is pure Object!")]);
|
|
98
|
+
return;
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Flush event handler
|
|
103
|
+
*
|
|
104
|
+
* @private
|
|
105
|
+
* @param callback - callback function
|
|
106
|
+
*/
|
|
107
|
+
_flush(callback = () => { return; }) {
|
|
108
|
+
callback();
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* End event handler
|
|
112
|
+
*
|
|
113
|
+
* @private
|
|
114
|
+
* @param callback - callback function
|
|
115
|
+
*/
|
|
116
|
+
_final(callback = () => { return; }) {
|
|
117
|
+
if (this.__bytesWrite === 0) {
|
|
118
|
+
const _buffer = Buffer.concat([this.__separators.start, this.__separators.end]);
|
|
119
|
+
if (this.__isString)
|
|
120
|
+
this.push(_buffer.toString(this.__encoding));
|
|
121
|
+
else
|
|
122
|
+
this.push(_buffer, this.__encoding);
|
|
123
|
+
}
|
|
124
|
+
else {
|
|
125
|
+
if (this.__isString)
|
|
126
|
+
this.push(this.__separators.end.toString(this.__encoding));
|
|
127
|
+
else
|
|
128
|
+
this.push(this.__separators.end, this.__encoding);
|
|
129
|
+
}
|
|
130
|
+
this.__bytesWrite += Buffer.byteLength(this.__separators.end);
|
|
131
|
+
callback();
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* set stream encoding
|
|
135
|
+
*/
|
|
136
|
+
setEncoding(encoding) {
|
|
137
|
+
this.__encoding = encoding;
|
|
138
|
+
this.setDefaultEncoding(this.__encoding);
|
|
139
|
+
this.__isString = true;
|
|
140
|
+
return this;
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
exports.Stringifer = Stringifer;
|
|
144
|
+
//# sourceMappingURL=Stringifer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Stringifer.js","sourceRoot":"","sources":["../../src/classes/Stringifer.ts"],"names":[],"mappings":";;;AAAA,mCAAkC;AAClC,4CAA2C;AAE3C;;;;GAIG;AACH,MAAa,UAAW,SAAQ,kBAAS;IACxC;;;;;OAKG;IACH,YAAY,KAAc,EAAE,MAAe,EAAE,GAAY;QACxD,KAAK,CAAC,EAAE,aAAa,EAAE,EAAE,GAAC,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,CAAC,CAAA;QACnD,IACC,CAAC,OAAM,CAAC,KAAK,CAAC,KAAK,WAAW,CAAC;YAC/B,CAAC,CAAC,OAAM,CAAC,KAAK,CAAC,KAAK,QAAQ,CAAC;gBAC7B,CAAC,MAAM,CAAC,UAAU,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;gBAC9B,CAAC,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC;YAEvB,MAAM,IAAI,KAAK,CAAC,yCAAyC,CAAC,CAAA;QAC3D,IACC,CAAC,OAAM,CAAC,MAAM,CAAC,KAAK,WAAW,CAAC;YAChC,CAAC,CAAC,OAAM,CAAC,MAAM,CAAC,KAAK,QAAQ,CAAC;gBAC9B,CAAC,MAAM,CAAC,UAAU,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;gBAC/B,CAAC,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC;YAExB,MAAM,IAAI,KAAK,CAAC,6CAA6C,CAAC,CAAA;QAC/D,IACC,CAAC,OAAM,CAAC,GAAG,CAAC,KAAK,WAAW,CAAC;YAC7B,CAAC,CAAC,OAAM,CAAC,GAAG,CAAC,KAAK,QAAQ,CAAC;gBAC3B,CAAC,MAAM,CAAC,UAAU,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;gBAC5B,CAAC,GAA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