@atxp/server 0.2.21 → 0.3.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/dist/_virtual/_commonjsHelpers.js +8 -0
- package/dist/_virtual/_commonjsHelpers.js.map +1 -0
- package/dist/_virtual/bom-handling.js +4 -0
- package/dist/_virtual/bom-handling.js.map +1 -0
- package/dist/_virtual/dbcs-codec.js +4 -0
- package/dist/_virtual/dbcs-codec.js.map +1 -0
- package/dist/_virtual/index.js +8 -0
- package/dist/_virtual/index.js.map +1 -0
- package/dist/_virtual/index2.js +4 -0
- package/dist/_virtual/index2.js.map +1 -0
- package/dist/_virtual/index3.js +4 -0
- package/dist/_virtual/index3.js.map +1 -0
- package/dist/_virtual/index4.js +4 -0
- package/dist/_virtual/index4.js.map +1 -0
- package/dist/_virtual/index5.js +4 -0
- package/dist/_virtual/index5.js.map +1 -0
- package/dist/_virtual/inherits.js +4 -0
- package/dist/_virtual/inherits.js.map +1 -0
- package/dist/_virtual/inherits_browser.js +4 -0
- package/dist/_virtual/inherits_browser.js.map +1 -0
- package/dist/_virtual/sbcs-codec.js +4 -0
- package/dist/_virtual/sbcs-codec.js.map +1 -0
- package/dist/_virtual/utf16.js +4 -0
- package/dist/_virtual/utf16.js.map +1 -0
- package/dist/_virtual/utf32.js +4 -0
- package/dist/_virtual/utf32.js.map +1 -0
- package/dist/_virtual/utf7.js +4 -0
- package/dist/_virtual/utf7.js.map +1 -0
- package/dist/atxpContext.js +9 -6
- package/dist/atxpContext.js.map +1 -1
- package/dist/atxpServer.js +19 -27
- package/dist/atxpServer.js.map +1 -1
- package/dist/core/mcp.js +39 -0
- package/dist/core/mcp.js.map +1 -0
- package/dist/{oAuthChallenge.js → core/oauth.js} +21 -12
- package/dist/core/oauth.js.map +1 -0
- package/dist/{token.js → core/token.js} +13 -7
- package/dist/core/token.js.map +1 -0
- package/dist/getResource.js +5 -3
- package/dist/getResource.js.map +1 -1
- package/dist/index.cjs +13727 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.ts +141 -5
- package/dist/index.js +13708 -5
- package/dist/index.js.map +1 -1
- package/dist/{http.js → node/http.js} +21 -20
- package/dist/node/http.js.map +1 -0
- package/dist/node/oauth.js +23 -0
- package/dist/node/oauth.js.map +1 -0
- package/dist/node/token.js +15 -0
- package/dist/node/token.js.map +1 -0
- package/dist/node_modules/bytes/index.js +181 -0
- package/dist/node_modules/bytes/index.js.map +1 -0
- package/dist/node_modules/depd/index.js +551 -0
- package/dist/node_modules/depd/index.js.map +1 -0
- package/dist/node_modules/http-errors/index.js +307 -0
- package/dist/node_modules/http-errors/index.js.map +1 -0
- package/dist/node_modules/iconv-lite/encodings/dbcs-codec.js +599 -0
- package/dist/node_modules/iconv-lite/encodings/dbcs-codec.js.map +1 -0
- package/dist/node_modules/iconv-lite/encodings/dbcs-data.js +207 -0
- package/dist/node_modules/iconv-lite/encodings/dbcs-data.js.map +1 -0
- package/dist/node_modules/iconv-lite/encodings/index.js +45 -0
- package/dist/node_modules/iconv-lite/encodings/index.js.map +1 -0
- package/dist/node_modules/iconv-lite/encodings/internal.js +211 -0
- package/dist/node_modules/iconv-lite/encodings/internal.js.map +1 -0
- package/dist/node_modules/iconv-lite/encodings/sbcs-codec.js +84 -0
- package/dist/node_modules/iconv-lite/encodings/sbcs-codec.js.map +1 -0
- package/dist/node_modules/iconv-lite/encodings/sbcs-data-generated.js +461 -0
- package/dist/node_modules/iconv-lite/encodings/sbcs-data-generated.js.map +1 -0
- package/dist/node_modules/iconv-lite/encodings/sbcs-data.js +188 -0
- package/dist/node_modules/iconv-lite/encodings/sbcs-data.js.map +1 -0
- package/dist/node_modules/iconv-lite/encodings/tables/big5-added.json.js +507 -0
- package/dist/node_modules/iconv-lite/encodings/tables/big5-added.json.js.map +1 -0
- package/dist/node_modules/iconv-lite/encodings/tables/cp936.json.js +2622 -0
- package/dist/node_modules/iconv-lite/encodings/tables/cp936.json.js.map +1 -0
- package/dist/node_modules/iconv-lite/encodings/tables/cp949.json.js +2381 -0
- package/dist/node_modules/iconv-lite/encodings/tables/cp949.json.js.map +1 -0
- package/dist/node_modules/iconv-lite/encodings/tables/cp950.json.js +730 -0
- package/dist/node_modules/iconv-lite/encodings/tables/cp950.json.js.map +1 -0
- package/dist/node_modules/iconv-lite/encodings/tables/eucjp.json.js +823 -0
- package/dist/node_modules/iconv-lite/encodings/tables/eucjp.json.js.map +1 -0
- package/dist/node_modules/iconv-lite/encodings/tables/gb18030-ranges.json.js +425 -0
- package/dist/node_modules/iconv-lite/encodings/tables/gb18030-ranges.json.js.map +1 -0
- package/dist/node_modules/iconv-lite/encodings/tables/gbk-added.json.js +265 -0
- package/dist/node_modules/iconv-lite/encodings/tables/gbk-added.json.js.map +1 -0
- package/dist/node_modules/iconv-lite/encodings/tables/shiftjis.json.js +549 -0
- package/dist/node_modules/iconv-lite/encodings/tables/shiftjis.json.js.map +1 -0
- package/dist/node_modules/iconv-lite/encodings/utf16.js +207 -0
- package/dist/node_modules/iconv-lite/encodings/utf16.js.map +1 -0
- package/dist/node_modules/iconv-lite/encodings/utf32.js +330 -0
- package/dist/node_modules/iconv-lite/encodings/utf32.js.map +1 -0
- package/dist/node_modules/iconv-lite/encodings/utf7.js +298 -0
- package/dist/node_modules/iconv-lite/encodings/utf7.js.map +1 -0
- package/dist/node_modules/iconv-lite/lib/bom-handling.js +62 -0
- package/dist/node_modules/iconv-lite/lib/bom-handling.js.map +1 -0
- package/dist/node_modules/iconv-lite/lib/index.js +193 -0
- package/dist/node_modules/iconv-lite/lib/index.js.map +1 -0
- package/dist/node_modules/iconv-lite/lib/streams.js +121 -0
- package/dist/node_modules/iconv-lite/lib/streams.js.map +1 -0
- package/dist/node_modules/inherits/inherits.js +22 -0
- package/dist/node_modules/inherits/inherits.js.map +1 -0
- package/dist/node_modules/inherits/inherits_browser.js +39 -0
- package/dist/node_modules/inherits/inherits_browser.js.map +1 -0
- package/dist/node_modules/raw-body/index.js +352 -0
- package/dist/node_modules/raw-body/index.js.map +1 -0
- package/dist/node_modules/safer-buffer/safer.js +89 -0
- package/dist/node_modules/safer-buffer/safer.js.map +1 -0
- package/dist/node_modules/setprototypeof/index.js +27 -0
- package/dist/node_modules/setprototypeof/index.js.map +1 -0
- package/dist/node_modules/statuses/codes.json.js +68 -0
- package/dist/node_modules/statuses/codes.json.js.map +1 -0
- package/dist/node_modules/statuses/index.js +158 -0
- package/dist/node_modules/statuses/index.js.map +1 -0
- package/dist/node_modules/toidentifier/index.js +42 -0
- package/dist/node_modules/toidentifier/index.js.map +1 -0
- package/dist/node_modules/unpipe/index.js +79 -0
- package/dist/node_modules/unpipe/index.js.map +1 -0
- package/dist/oAuthMetadata.js +7 -4
- package/dist/oAuthMetadata.js.map +1 -1
- package/dist/paymentServer.js +5 -20
- package/dist/paymentServer.js.map +1 -1
- package/dist/protectedResourceMetadata.js +7 -4
- package/dist/protectedResourceMetadata.js.map +1 -1
- package/dist/requirePayment.js +7 -4
- package/dist/requirePayment.js.map +1 -1
- package/dist/types.js +4 -2
- package/dist/types.js.map +1 -1
- package/dist/webapi/mcp.js +25 -0
- package/dist/webapi/mcp.js.map +1 -0
- package/dist/webapi/oauth.js +21 -0
- package/dist/webapi/oauth.js.map +1 -0
- package/dist/webapi/token.js +15 -0
- package/dist/webapi/token.js.map +1 -0
- package/package.json +21 -7
- package/dist/atxpContext.d.ts +0 -6
- package/dist/atxpContext.d.ts.map +0 -1
- package/dist/atxpServer.d.ts +0 -12
- package/dist/atxpServer.d.ts.map +0 -1
- package/dist/getResource.d.ts +0 -4
- package/dist/getResource.d.ts.map +0 -1
- package/dist/http.d.ts +0 -7
- package/dist/http.d.ts.map +0 -1
- package/dist/http.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/oAuthChallenge.d.ts +0 -4
- package/dist/oAuthChallenge.d.ts.map +0 -1
- package/dist/oAuthChallenge.js.map +0 -1
- package/dist/oAuthMetadata.d.ts +0 -6
- package/dist/oAuthMetadata.d.ts.map +0 -1
- package/dist/paymentServer.d.ts +0 -62
- package/dist/paymentServer.d.ts.map +0 -1
- package/dist/protectedResourceMetadata.d.ts +0 -5
- package/dist/protectedResourceMetadata.d.ts.map +0 -1
- package/dist/requirePayment.d.ts +0 -3
- package/dist/requirePayment.d.ts.map +0 -1
- package/dist/serverTestHelpers.d.ts +0 -55
- package/dist/serverTestHelpers.d.ts.map +0 -1
- package/dist/serverTestHelpers.js +0 -88
- package/dist/serverTestHelpers.js.map +0 -1
- package/dist/token.d.ts +0 -4
- package/dist/token.d.ts.map +0 -1
- package/dist/token.js.map +0 -1
- package/dist/types.d.ts +0 -60
- package/dist/types.d.ts.map +0 -1
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import { __require as requireSafer } from '../../safer-buffer/safer.js';
|
|
2
|
+
|
|
3
|
+
var streams;
|
|
4
|
+
var hasRequiredStreams;
|
|
5
|
+
|
|
6
|
+
function requireStreams () {
|
|
7
|
+
if (hasRequiredStreams) return streams;
|
|
8
|
+
hasRequiredStreams = 1;
|
|
9
|
+
|
|
10
|
+
var Buffer = requireSafer().Buffer;
|
|
11
|
+
|
|
12
|
+
// NOTE: Due to 'stream' module being pretty large (~100Kb, significant in browser environments),
|
|
13
|
+
// we opt to dependency-inject it instead of creating a hard dependency.
|
|
14
|
+
streams = function(stream_module) {
|
|
15
|
+
var Transform = stream_module.Transform;
|
|
16
|
+
|
|
17
|
+
// == Encoder stream =======================================================
|
|
18
|
+
|
|
19
|
+
function IconvLiteEncoderStream(conv, options) {
|
|
20
|
+
this.conv = conv;
|
|
21
|
+
options = options || {};
|
|
22
|
+
options.decodeStrings = false; // We accept only strings, so we don't need to decode them.
|
|
23
|
+
Transform.call(this, options);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
IconvLiteEncoderStream.prototype = Object.create(Transform.prototype, {
|
|
27
|
+
constructor: { value: IconvLiteEncoderStream }
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
IconvLiteEncoderStream.prototype._transform = function(chunk, encoding, done) {
|
|
31
|
+
if (typeof chunk != 'string')
|
|
32
|
+
return done(new Error("Iconv encoding stream needs strings as its input."));
|
|
33
|
+
try {
|
|
34
|
+
var res = this.conv.write(chunk);
|
|
35
|
+
if (res && res.length) this.push(res);
|
|
36
|
+
done();
|
|
37
|
+
}
|
|
38
|
+
catch (e) {
|
|
39
|
+
done(e);
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
IconvLiteEncoderStream.prototype._flush = function(done) {
|
|
44
|
+
try {
|
|
45
|
+
var res = this.conv.end();
|
|
46
|
+
if (res && res.length) this.push(res);
|
|
47
|
+
done();
|
|
48
|
+
}
|
|
49
|
+
catch (e) {
|
|
50
|
+
done(e);
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
IconvLiteEncoderStream.prototype.collect = function(cb) {
|
|
55
|
+
var chunks = [];
|
|
56
|
+
this.on('error', cb);
|
|
57
|
+
this.on('data', function(chunk) { chunks.push(chunk); });
|
|
58
|
+
this.on('end', function() {
|
|
59
|
+
cb(null, Buffer.concat(chunks));
|
|
60
|
+
});
|
|
61
|
+
return this;
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
// == Decoder stream =======================================================
|
|
66
|
+
|
|
67
|
+
function IconvLiteDecoderStream(conv, options) {
|
|
68
|
+
this.conv = conv;
|
|
69
|
+
options = options || {};
|
|
70
|
+
options.encoding = this.encoding = 'utf8'; // We output strings.
|
|
71
|
+
Transform.call(this, options);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
IconvLiteDecoderStream.prototype = Object.create(Transform.prototype, {
|
|
75
|
+
constructor: { value: IconvLiteDecoderStream }
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
IconvLiteDecoderStream.prototype._transform = function(chunk, encoding, done) {
|
|
79
|
+
if (!Buffer.isBuffer(chunk) && !(chunk instanceof Uint8Array))
|
|
80
|
+
return done(new Error("Iconv decoding stream needs buffers as its input."));
|
|
81
|
+
try {
|
|
82
|
+
var res = this.conv.write(chunk);
|
|
83
|
+
if (res && res.length) this.push(res, this.encoding);
|
|
84
|
+
done();
|
|
85
|
+
}
|
|
86
|
+
catch (e) {
|
|
87
|
+
done(e);
|
|
88
|
+
}
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
IconvLiteDecoderStream.prototype._flush = function(done) {
|
|
92
|
+
try {
|
|
93
|
+
var res = this.conv.end();
|
|
94
|
+
if (res && res.length) this.push(res, this.encoding);
|
|
95
|
+
done();
|
|
96
|
+
}
|
|
97
|
+
catch (e) {
|
|
98
|
+
done(e);
|
|
99
|
+
}
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
IconvLiteDecoderStream.prototype.collect = function(cb) {
|
|
103
|
+
var res = '';
|
|
104
|
+
this.on('error', cb);
|
|
105
|
+
this.on('data', function(chunk) { res += chunk; });
|
|
106
|
+
this.on('end', function() {
|
|
107
|
+
cb(null, res);
|
|
108
|
+
});
|
|
109
|
+
return this;
|
|
110
|
+
};
|
|
111
|
+
|
|
112
|
+
return {
|
|
113
|
+
IconvLiteEncoderStream: IconvLiteEncoderStream,
|
|
114
|
+
IconvLiteDecoderStream: IconvLiteDecoderStream,
|
|
115
|
+
};
|
|
116
|
+
};
|
|
117
|
+
return streams;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
export { requireStreams as __require };
|
|
121
|
+
//# sourceMappingURL=streams.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"streams.js","sources":["../../../../../../node_modules/iconv-lite/lib/streams.js"],"sourcesContent":["\"use strict\";\n\nvar Buffer = require(\"safer-buffer\").Buffer;\n\n// NOTE: Due to 'stream' module being pretty large (~100Kb, significant in browser environments), \n// we opt to dependency-inject it instead of creating a hard dependency.\nmodule.exports = function(stream_module) {\n var Transform = stream_module.Transform;\n\n // == Encoder stream =======================================================\n\n function IconvLiteEncoderStream(conv, options) {\n this.conv = conv;\n options = options || {};\n options.decodeStrings = false; // We accept only strings, so we don't need to decode them.\n Transform.call(this, options);\n }\n\n IconvLiteEncoderStream.prototype = Object.create(Transform.prototype, {\n constructor: { value: IconvLiteEncoderStream }\n });\n\n IconvLiteEncoderStream.prototype._transform = function(chunk, encoding, done) {\n if (typeof chunk != 'string')\n return done(new Error(\"Iconv encoding stream needs strings as its input.\"));\n try {\n var res = this.conv.write(chunk);\n if (res && res.length) this.push(res);\n done();\n }\n catch (e) {\n done(e);\n }\n }\n\n IconvLiteEncoderStream.prototype._flush = function(done) {\n try {\n var res = this.conv.end();\n if (res && res.length) this.push(res);\n done();\n }\n catch (e) {\n done(e);\n }\n }\n\n IconvLiteEncoderStream.prototype.collect = function(cb) {\n var chunks = [];\n this.on('error', cb);\n this.on('data', function(chunk) { chunks.push(chunk); });\n this.on('end', function() {\n cb(null, Buffer.concat(chunks));\n });\n return this;\n }\n\n\n // == Decoder stream =======================================================\n\n function IconvLiteDecoderStream(conv, options) {\n this.conv = conv;\n options = options || {};\n options.encoding = this.encoding = 'utf8'; // We output strings.\n Transform.call(this, options);\n }\n\n IconvLiteDecoderStream.prototype = Object.create(Transform.prototype, {\n constructor: { value: IconvLiteDecoderStream }\n });\n\n IconvLiteDecoderStream.prototype._transform = function(chunk, encoding, done) {\n if (!Buffer.isBuffer(chunk) && !(chunk instanceof Uint8Array))\n return done(new Error(\"Iconv decoding stream needs buffers as its input.\"));\n try {\n var res = this.conv.write(chunk);\n if (res && res.length) this.push(res, this.encoding);\n done();\n }\n catch (e) {\n done(e);\n }\n }\n\n IconvLiteDecoderStream.prototype._flush = function(done) {\n try {\n var res = this.conv.end();\n if (res && res.length) this.push(res, this.encoding); \n done();\n }\n catch (e) {\n done(e);\n }\n }\n\n IconvLiteDecoderStream.prototype.collect = function(cb) {\n var res = '';\n this.on('error', cb);\n this.on('data', function(chunk) { res += chunk; });\n this.on('end', function() {\n cb(null, res);\n });\n return this;\n }\n\n return {\n IconvLiteEncoderStream: IconvLiteEncoderSt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AAW;AAClC,aAAY,EAAE,CAAC,IAAI,EAAE,GAAG,CAAC;AACzB,SAAA,CAAS,CAAC;AACV,SAAQ,OAAO,IAAI;AACnB,KAAA;;AAEA,KAAI,OAAO;SACH,sBAAsB,EAAE,sBAAsB;SAC9C,sBAAsB,EAAE,sBAAsB;MACjD;CACL,CAAC;;;;;;","x_google_ignoreList":[0]}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { __module as inherits } from '../../_virtual/inherits.js';
|
|
2
|
+
import { __require as requireInherits_browser } from './inherits_browser.js';
|
|
3
|
+
|
|
4
|
+
var hasRequiredInherits;
|
|
5
|
+
|
|
6
|
+
function requireInherits () {
|
|
7
|
+
if (hasRequiredInherits) return inherits.exports;
|
|
8
|
+
hasRequiredInherits = 1;
|
|
9
|
+
try {
|
|
10
|
+
var util = require('util');
|
|
11
|
+
/* istanbul ignore next */
|
|
12
|
+
if (typeof util.inherits !== 'function') throw '';
|
|
13
|
+
inherits.exports = util.inherits;
|
|
14
|
+
} catch (e) {
|
|
15
|
+
/* istanbul ignore next */
|
|
16
|
+
inherits.exports = requireInherits_browser();
|
|
17
|
+
}
|
|
18
|
+
return inherits.exports;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export { requireInherits as __require };
|
|
22
|
+
//# sourceMappingURL=inherits.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"inherits.js","sources":["../../../../../node_modules/inherits/inherits.js"],"sourcesContent":["try {\n var util = require('util');\n /* istanbul ignore next */\n if (typeof util.inherits !== 'function') throw '';\n module.exports = util.inherits;\n} catch (e) {\n /* istanbul ignore next */\n module.exports = require('./inherits_browser.js');\n}\n"],"names":["inheritsModule","require$$1"],"mappings":";;;;;;;;CAAA,IAAI;AACJ,GAAE,IAAI,IAAI,GAAG,OAAA,CAAQ,MAAM,CAAC;AAC5B;GACE,IAAI,OAAO,IAAI,CAAC,QAAQ,KAAK,UAAU,EAAE,MAAM,EAAE;AACnD,GAAEA,QAAA,CAAA,OAAc,GAAG,IAAI,CAAC,QAAQ;CAChC,CAAC,CAAC,OAAO,CAAC,EAAE;AACZ;GACEA,QAAA,CAAA,OAAc,GAAGC,uBAAA,EAAgC;AACnD,CAAA;;;;;;","x_google_ignoreList":[0]}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { __module as inherits_browser } from '../../_virtual/inherits_browser.js';
|
|
2
|
+
|
|
3
|
+
var hasRequiredInherits_browser;
|
|
4
|
+
|
|
5
|
+
function requireInherits_browser () {
|
|
6
|
+
if (hasRequiredInherits_browser) return inherits_browser.exports;
|
|
7
|
+
hasRequiredInherits_browser = 1;
|
|
8
|
+
if (typeof Object.create === 'function') {
|
|
9
|
+
// implementation from standard node.js 'util' module
|
|
10
|
+
inherits_browser.exports = function inherits(ctor, superCtor) {
|
|
11
|
+
if (superCtor) {
|
|
12
|
+
ctor.super_ = superCtor;
|
|
13
|
+
ctor.prototype = Object.create(superCtor.prototype, {
|
|
14
|
+
constructor: {
|
|
15
|
+
value: ctor,
|
|
16
|
+
enumerable: false,
|
|
17
|
+
writable: true,
|
|
18
|
+
configurable: true
|
|
19
|
+
}
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
} else {
|
|
24
|
+
// old school shim for old browsers
|
|
25
|
+
inherits_browser.exports = function inherits(ctor, superCtor) {
|
|
26
|
+
if (superCtor) {
|
|
27
|
+
ctor.super_ = superCtor;
|
|
28
|
+
var TempCtor = function () {};
|
|
29
|
+
TempCtor.prototype = superCtor.prototype;
|
|
30
|
+
ctor.prototype = new TempCtor();
|
|
31
|
+
ctor.prototype.constructor = ctor;
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
return inherits_browser.exports;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export { requireInherits_browser as __require };
|
|
39
|
+
//# sourceMappingURL=inherits_browser.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"inherits_browser.js","sources":["../../../../../node_modules/inherits/inherits_browser.js"],"sourcesContent":["if (typeof Object.create === 'function') {\n // implementation from standard node.js 'util' module\n module.exports = function inherits(ctor, superCtor) {\n if (superCtor) {\n ctor.super_ = superCtor\n ctor.prototype = Object.create(superCtor.prototype, {\n constructor: {\n value: ctor,\n enumerable: false,\n writable: true,\n configurable: true\n }\n })\n }\n };\n} else {\n // old school shim for old browsers\n module.exports = function inherits(ctor, superCtor) {\n if (superCtor) {\n ctor.super_ = superCtor\n var TempCtor = function () {}\n TempCtor.prototype = superCtor.prototype\n ctor.prototype = new TempCtor()\n ctor.prototype.constructor = ctor\n }\n }\n}\n"],"names":["inherits_browserModule"],"mappings":";;;;;;;AAAA,CAAA,IAAI,OAAO,MAAM,CAAC,MAAM,KAAK,UAAU,EAAE;AACzC;GACEA,gBAAA,CAAA,OAAc,GAAG,SAAS,QAAQ,CAAC,IAAI,EAAE,SAAS,EAAE;KAClD,IAAI,SAAS,EAAE;OACb,IAAI,CAAC,MAAM,GAAG;OACd,IAAI,CAAC,SAAS,GAAG,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC,SAAS,EAAE;AAC1D,SAAQ,WAAW,EAAE;WACX,KAAK,EAAE,IAAI;WACX,UAAU,EAAE,KAAK;WACjB,QAAQ,EAAE,IAAI;AACxB,WAAU,YAAY,EAAE;AACxB;QACO;AACP,KAAA;GACA,CAAG;AACH,CAAA,CAAC,MAAM;AACP;GACEA,gBAAA,CAAA,OAAc,GAAG,SAAS,QAAQ,CAAC,IAAI,EAAE,SAAS,EAAE;KAClD,IAAI,SAAS,EAAE;OACb,IAAI,CAAC,MAAM,GAAG;OACd,IAAI,QAAQ,GAAG,YAAY,CAAA;AACjC,OAAM,QAAQ,CAAC,SAAS,GAAG,SAAS,CAAC;AACrC,OAAM,IAAI,CAAC,SAAS,GAAG,IAAI,QAAQ;AACnC,OAAM,IAAI,CAAC,SAAS,CAAC,WAAW,GAAG;AACnC,KAAA;AACA,GAAA;AACA,CAAA;;;;;;","x_google_ignoreList":[0]}
|
|
@@ -0,0 +1,352 @@
|
|
|
1
|
+
import { commonjsGlobal } from '../../_virtual/_commonjsHelpers.js';
|
|
2
|
+
import { __require as requireBytes } from '../bytes/index.js';
|
|
3
|
+
import { __require as requireHttpErrors } from '../http-errors/index.js';
|
|
4
|
+
import { __require as requireLib } from '../iconv-lite/lib/index.js';
|
|
5
|
+
import { __require as requireUnpipe } from '../unpipe/index.js';
|
|
6
|
+
|
|
7
|
+
/*!
|
|
8
|
+
* raw-body
|
|
9
|
+
* Copyright(c) 2013-2014 Jonathan Ong
|
|
10
|
+
* Copyright(c) 2014-2022 Douglas Christopher Wilson
|
|
11
|
+
* MIT Licensed
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
var rawBody;
|
|
15
|
+
var hasRequiredRawBody;
|
|
16
|
+
|
|
17
|
+
function requireRawBody () {
|
|
18
|
+
if (hasRequiredRawBody) return rawBody;
|
|
19
|
+
hasRequiredRawBody = 1;
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Module dependencies.
|
|
23
|
+
* @private
|
|
24
|
+
*/
|
|
25
|
+
|
|
26
|
+
var asyncHooks = tryRequireAsyncHooks();
|
|
27
|
+
var bytes = requireBytes();
|
|
28
|
+
var createError = requireHttpErrors();
|
|
29
|
+
var iconv = requireLib();
|
|
30
|
+
var unpipe = requireUnpipe();
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Module exports.
|
|
34
|
+
* @public
|
|
35
|
+
*/
|
|
36
|
+
|
|
37
|
+
rawBody = getRawBody;
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Module variables.
|
|
41
|
+
* @private
|
|
42
|
+
*/
|
|
43
|
+
|
|
44
|
+
var ICONV_ENCODING_MESSAGE_REGEXP = /^Encoding not recognized: /;
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Get the decoder for a given encoding.
|
|
48
|
+
*
|
|
49
|
+
* @param {string} encoding
|
|
50
|
+
* @private
|
|
51
|
+
*/
|
|
52
|
+
|
|
53
|
+
function getDecoder (encoding) {
|
|
54
|
+
if (!encoding) return null
|
|
55
|
+
|
|
56
|
+
try {
|
|
57
|
+
return iconv.getDecoder(encoding)
|
|
58
|
+
} catch (e) {
|
|
59
|
+
// error getting decoder
|
|
60
|
+
if (!ICONV_ENCODING_MESSAGE_REGEXP.test(e.message)) throw e
|
|
61
|
+
|
|
62
|
+
// the encoding was not found
|
|
63
|
+
throw createError(415, 'specified encoding unsupported', {
|
|
64
|
+
encoding: encoding,
|
|
65
|
+
type: 'encoding.unsupported'
|
|
66
|
+
})
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Get the raw body of a stream (typically HTTP).
|
|
72
|
+
*
|
|
73
|
+
* @param {object} stream
|
|
74
|
+
* @param {object|string|function} [options]
|
|
75
|
+
* @param {function} [callback]
|
|
76
|
+
* @public
|
|
77
|
+
*/
|
|
78
|
+
|
|
79
|
+
function getRawBody (stream, options, callback) {
|
|
80
|
+
var done = callback;
|
|
81
|
+
var opts = options || {};
|
|
82
|
+
|
|
83
|
+
// light validation
|
|
84
|
+
if (stream === undefined) {
|
|
85
|
+
throw new TypeError('argument stream is required')
|
|
86
|
+
} else if (typeof stream !== 'object' || stream === null || typeof stream.on !== 'function') {
|
|
87
|
+
throw new TypeError('argument stream must be a stream')
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
if (options === true || typeof options === 'string') {
|
|
91
|
+
// short cut for encoding
|
|
92
|
+
opts = {
|
|
93
|
+
encoding: options
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
if (typeof options === 'function') {
|
|
98
|
+
done = options;
|
|
99
|
+
opts = {};
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
// validate callback is a function, if provided
|
|
103
|
+
if (done !== undefined && typeof done !== 'function') {
|
|
104
|
+
throw new TypeError('argument callback must be a function')
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
// require the callback without promises
|
|
108
|
+
if (!done && !commonjsGlobal.Promise) {
|
|
109
|
+
throw new TypeError('argument callback is required')
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
// get encoding
|
|
113
|
+
var encoding = opts.encoding !== true
|
|
114
|
+
? opts.encoding
|
|
115
|
+
: 'utf-8';
|
|
116
|
+
|
|
117
|
+
// convert the limit to an integer
|
|
118
|
+
var limit = bytes.parse(opts.limit);
|
|
119
|
+
|
|
120
|
+
// convert the expected length to an integer
|
|
121
|
+
var length = opts.length != null && !isNaN(opts.length)
|
|
122
|
+
? parseInt(opts.length, 10)
|
|
123
|
+
: null;
|
|
124
|
+
|
|
125
|
+
if (done) {
|
|
126
|
+
// classic callback style
|
|
127
|
+
return readStream(stream, encoding, length, limit, wrap(done))
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
return new Promise(function executor (resolve, reject) {
|
|
131
|
+
readStream(stream, encoding, length, limit, function onRead (err, buf) {
|
|
132
|
+
if (err) return reject(err)
|
|
133
|
+
resolve(buf);
|
|
134
|
+
});
|
|
135
|
+
})
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
/**
|
|
139
|
+
* Halt a stream.
|
|
140
|
+
*
|
|
141
|
+
* @param {Object} stream
|
|
142
|
+
* @private
|
|
143
|
+
*/
|
|
144
|
+
|
|
145
|
+
function halt (stream) {
|
|
146
|
+
// unpipe everything from the stream
|
|
147
|
+
unpipe(stream);
|
|
148
|
+
|
|
149
|
+
// pause stream
|
|
150
|
+
if (typeof stream.pause === 'function') {
|
|
151
|
+
stream.pause();
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
/**
|
|
156
|
+
* Read the data from the stream.
|
|
157
|
+
*
|
|
158
|
+
* @param {object} stream
|
|
159
|
+
* @param {string} encoding
|
|
160
|
+
* @param {number} length
|
|
161
|
+
* @param {number} limit
|
|
162
|
+
* @param {function} callback
|
|
163
|
+
* @public
|
|
164
|
+
*/
|
|
165
|
+
|
|
166
|
+
function readStream (stream, encoding, length, limit, callback) {
|
|
167
|
+
var complete = false;
|
|
168
|
+
var sync = true;
|
|
169
|
+
|
|
170
|
+
// check the length and limit options.
|
|
171
|
+
// note: we intentionally leave the stream paused,
|
|
172
|
+
// so users should handle the stream themselves.
|
|
173
|
+
if (limit !== null && length !== null && length > limit) {
|
|
174
|
+
return done(createError(413, 'request entity too large', {
|
|
175
|
+
expected: length,
|
|
176
|
+
length: length,
|
|
177
|
+
limit: limit,
|
|
178
|
+
type: 'entity.too.large'
|
|
179
|
+
}))
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
// streams1: assert request encoding is buffer.
|
|
183
|
+
// streams2+: assert the stream encoding is buffer.
|
|
184
|
+
// stream._decoder: streams1
|
|
185
|
+
// state.encoding: streams2
|
|
186
|
+
// state.decoder: streams2, specifically < 0.10.6
|
|
187
|
+
var state = stream._readableState;
|
|
188
|
+
if (stream._decoder || (state && (state.encoding || state.decoder))) {
|
|
189
|
+
// developer error
|
|
190
|
+
return done(createError(500, 'stream encoding should not be set', {
|
|
191
|
+
type: 'stream.encoding.set'
|
|
192
|
+
}))
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
if (typeof stream.readable !== 'undefined' && !stream.readable) {
|
|
196
|
+
return done(createError(500, 'stream is not readable', {
|
|
197
|
+
type: 'stream.not.readable'
|
|
198
|
+
}))
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
var received = 0;
|
|
202
|
+
var decoder;
|
|
203
|
+
|
|
204
|
+
try {
|
|
205
|
+
decoder = getDecoder(encoding);
|
|
206
|
+
} catch (err) {
|
|
207
|
+
return done(err)
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
var buffer = decoder
|
|
211
|
+
? ''
|
|
212
|
+
: [];
|
|
213
|
+
|
|
214
|
+
// attach listeners
|
|
215
|
+
stream.on('aborted', onAborted);
|
|
216
|
+
stream.on('close', cleanup);
|
|
217
|
+
stream.on('data', onData);
|
|
218
|
+
stream.on('end', onEnd);
|
|
219
|
+
stream.on('error', onEnd);
|
|
220
|
+
|
|
221
|
+
// mark sync section complete
|
|
222
|
+
sync = false;
|
|
223
|
+
|
|
224
|
+
function done () {
|
|
225
|
+
var args = new Array(arguments.length);
|
|
226
|
+
|
|
227
|
+
// copy arguments
|
|
228
|
+
for (var i = 0; i < args.length; i++) {
|
|
229
|
+
args[i] = arguments[i];
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
// mark complete
|
|
233
|
+
complete = true;
|
|
234
|
+
|
|
235
|
+
if (sync) {
|
|
236
|
+
process.nextTick(invokeCallback);
|
|
237
|
+
} else {
|
|
238
|
+
invokeCallback();
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
function invokeCallback () {
|
|
242
|
+
cleanup();
|
|
243
|
+
|
|
244
|
+
if (args[0]) {
|
|
245
|
+
// halt the stream on error
|
|
246
|
+
halt(stream);
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
callback.apply(null, args);
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
function onAborted () {
|
|
254
|
+
if (complete) return
|
|
255
|
+
|
|
256
|
+
done(createError(400, 'request aborted', {
|
|
257
|
+
code: 'ECONNABORTED',
|
|
258
|
+
expected: length,
|
|
259
|
+
length: length,
|
|
260
|
+
received: received,
|
|
261
|
+
type: 'request.aborted'
|
|
262
|
+
}));
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
function onData (chunk) {
|
|
266
|
+
if (complete) return
|
|
267
|
+
|
|
268
|
+
received += chunk.length;
|
|
269
|
+
|
|
270
|
+
if (limit !== null && received > limit) {
|
|
271
|
+
done(createError(413, 'request entity too large', {
|
|
272
|
+
limit: limit,
|
|
273
|
+
received: received,
|
|
274
|
+
type: 'entity.too.large'
|
|
275
|
+
}));
|
|
276
|
+
} else if (decoder) {
|
|
277
|
+
buffer += decoder.write(chunk);
|
|
278
|
+
} else {
|
|
279
|
+
buffer.push(chunk);
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
function onEnd (err) {
|
|
284
|
+
if (complete) return
|
|
285
|
+
if (err) return done(err)
|
|
286
|
+
|
|
287
|
+
if (length !== null && received !== length) {
|
|
288
|
+
done(createError(400, 'request size did not match content length', {
|
|
289
|
+
expected: length,
|
|
290
|
+
length: length,
|
|
291
|
+
received: received,
|
|
292
|
+
type: 'request.size.invalid'
|
|
293
|
+
}));
|
|
294
|
+
} else {
|
|
295
|
+
var string = decoder
|
|
296
|
+
? buffer + (decoder.end() || '')
|
|
297
|
+
: Buffer.concat(buffer);
|
|
298
|
+
done(null, string);
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
function cleanup () {
|
|
303
|
+
buffer = null;
|
|
304
|
+
|
|
305
|
+
stream.removeListener('aborted', onAborted);
|
|
306
|
+
stream.removeListener('data', onData);
|
|
307
|
+
stream.removeListener('end', onEnd);
|
|
308
|
+
stream.removeListener('error', onEnd);
|
|
309
|
+
stream.removeListener('close', cleanup);
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
/**
|
|
314
|
+
* Try to require async_hooks
|
|
315
|
+
* @private
|
|
316
|
+
*/
|
|
317
|
+
|
|
318
|
+
function tryRequireAsyncHooks () {
|
|
319
|
+
try {
|
|
320
|
+
return require('async_hooks')
|
|
321
|
+
} catch (e) {
|
|
322
|
+
return {}
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
/**
|
|
327
|
+
* Wrap function with async resource, if possible.
|
|
328
|
+
* AsyncResource.bind static method backported.
|
|
329
|
+
* @private
|
|
330
|
+
*/
|
|
331
|
+
|
|
332
|
+
function wrap (fn) {
|
|
333
|
+
var res;
|
|
334
|
+
|
|
335
|
+
// create anonymous resource
|
|
336
|
+
if (asyncHooks.AsyncResource) {
|
|
337
|
+
res = new asyncHooks.AsyncResource(fn.name || 'bound-anonymous-fn');
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
// incompatible node.js
|
|
341
|
+
if (!res || !res.runInAsyncScope) {
|
|
342
|
+
return fn
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
// return bound function
|
|
346
|
+
return res.runInAsyncScope.bind(res, fn, null)
|
|
347
|
+
}
|
|
348
|
+
return rawBody;
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
export { requireRawBody as __require };
|
|
352
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../../node_modules/raw-body/index.js"],"sourcesContent":["/*!\n * raw-body\n * Copyright(c) 2013-2014 Jonathan Ong\n * Copyright(c) 2014-2022 Douglas Christopher Wilson\n * MIT Licensed\n */\n\n'use strict'\n\n/**\n * Module dependencies.\n * @private\n */\n\nvar asyncHooks = tryRequireAsyncHooks()\nvar bytes = require('bytes')\nvar createError = require('http-errors')\nvar iconv = require('iconv-lite')\nvar unpipe = require('unpipe')\n\n/**\n * Module exports.\n * @public\n */\n\nmodule.exports = getRawBody\n\n/**\n * Module variables.\n * @private\n */\n\nvar ICONV_ENCODING_MESSAGE_REGEXP = /^Encoding not recognized: /\n\n/**\n * Get the decoder for a given encoding.\n *\n * @param {string} encoding\n * @private\n */\n\nfunction getDecoder (encoding) {\n if (!encoding) return null\n\n try {\n return iconv.getDecoder(encoding)\n } catch (e) {\n // error getting decoder\n if (!ICONV_ENCODING_MESSAGE_REGEXP.test(e.message)) throw e\n\n // the encoding was not found\n throw createError(415, 'specified encoding unsupported', {\n encoding: encoding,\n type: 'encoding.unsupported'\n })\n }\n}\n\n/**\n * Get the raw body of a stream (typically HTTP).\n *\n * @param {object} stream\n * @param {object|string|function} [options]\n * @param {function} [callback]\n * @public\n */\n\nfunction getRawBody (stream, options, callback) {\n var done = callback\n var opts = options || {}\n\n // light validation\n if (stream === undefined) {\n throw new TypeError('argument stream is required')\n } else if (typeof stream !== 'object' || stream === null || typeof stream.on !== 'function') {\n throw new TypeError('argument stream must be a stream')\n }\n\n if (options === true || typeof options === 'string') {\n // short cut for encoding\n opts = {\n encoding: options\n }\n }\n\n if (typeof options === 'function') {\n done = options\n opts = {}\n }\n\n // validate callback is a function, if provided\n if (done !== undefined && typeof done !== 'function') {\n throw new TypeError('argument callback must be a function')\n }\n\n // require the callback without promises\n if (!done && !global.Promise) {\n throw new TypeError('argument callback is required')\n }\n\n // get encoding\n var encoding = opts.encoding !== true\n ? opts.encoding\n : 'utf-8'\n\n // convert the limit to an integer\n var limit = bytes.parse(opts.limit)\n\n // convert the expected length to an integer\n var length = opts.length != null && !isNaN(opts.length)\n ? parseInt(opts.length, 10)\n : null\n\n if (done) {\n // classic callback style\n return readStream(stream, encoding, length, limit, wrap(done))\n }\n\n return new Promise(function executor (resolve, reject) {\n readStream(stream, encoding, length, limit, function onRead (err, buf) {\n if (err) return reject(err)\n resolve(buf)\n })\n })\n}\n\n/**\n * Halt a stream.\n *\n * @param {Object} stream\n * @private\n */\n\nfunction halt (stream) {\n // unpipe everything from the stream\n unpipe(stream)\n\n // pause stream\n if (typeof stream.pause === 'function') {\n stream.pause()\n }\n}\n\n/**\n * Read the data from the stream.\n *\n * @param {object} stream\n * @param {string} encoding\n * @param {number} length\n * @param {number} limit\n * @param {function} callback\n * @public\n */\n\nfunction readStream (stream, encoding, length, limit, callback) {\n var complete = false\n var sync = true\n\n // check the length and limit options.\n // note: we intentionally leave the stream paused,\n // so users should handle the stream themselves.\n if (limit !== null && length !== null && length > limit) {\n return done(createError(413, 'request entity too large', {\n expected: length,\n length: length,\n limit: limit,\n type: 'entity.too.large'\n }))\n }\n\n // streams1: assert request encoding is buffer.\n // streams2+: assert the stream encoding is buffer.\n // stream._decoder: streams1\n // state.encoding: streams2\n // state.decoder: streams2, specifically < 0.10.6\n var state = stream._readableState\n if (stream._decoder || (state && (state.encoding || state.decoder))) {\n // developer error\n return done(createError(500, 'stream encoding should not be set', {\n type: 'stream.encoding.set'\n }))\n }\n\n if (typeof stream.readable !== 'undefined' && !stream.readable) {\n return done(createError(500, 'stream is not readable', {\n type: 'stream.not.readable'\n }))\n }\n\n var received = 0\n var decoder\n\n try {\n decoder = getDecoder(encoding)\n } catch (err) {\n return done(err)\n }\n\n var buffer = decoder\n ? ''\n : []\n\n // attach listeners\n stream.on('aborted', onAborted)\n stream.on('close', cleanup)\n stream.on('data', onData)\n stream.on('end', onEnd)\n stream.on('error', onEnd)\n\n // mark sync section complete\n sync = false\n\n function done () {\n var args = new Array(arguments.length)\n\n // copy arguments\n for (var i = 0; i < args.length; i++) {\n args[i] = arguments[i]\n }\n\n // mark complete\n complete = true\n\n if (sync) {\n process.nextTick(invokeCallback)\n } else {\n invokeCallback()\n }\n\n function invokeCallback () {\n cleanup()\n\n if (args[0]) {\n // halt the stream on error\n halt(stream)\n }\n\n callback.apply(null, args)\n }\n }\n\n function onAborted () {\n if (complete) return\n\n done(createError(400, 'request aborted', {\n code: 'ECONNABORTED',\n expected: length,\n length: length,\n received: received,\n type: 'request.aborted'\n }))\n }\n\n function onData (chunk) {\n if (complete) return\n\n received += chunk.length\n\n if (limit !== null && received > limit) {\n done(createError(413, 'request entity too large', {\n limit: limit,\n received: received,\n type: 'entity.too.large'\n }))\n } else if (decoder) {\n buffer += decoder.write(chunk)\n } else {\n buffer.push(chunk)\n }\n }\n\n function onEnd (err) {\n if (complete) return\n if (err) return done(err)\n\n if (length !== null && received !== length) {\n done(createError(400, 'request size did not match content length', {\n expected: length,\n length: length,\n received: received,\n type: 'request.size.invalid'\n }))\n } else {\n var string = decoder\n ? buffer + (decoder.end() || '')\n : Buffer.concat(buffer)\n done(null, string)\n }\n }\n\n function cleanup () {\n buffer = null\n\n stream.removeListener('aborted', onAborted)\n stream.removeListener('data', onData)\n stream.removeListener('end', onEnd)\n stream.removeListener('error', onEnd)\n stream.removeListener('close', cleanup)\n }\n}\n\n/**\n * Try to require async_hooks\n * @private\n */\n\nfunction tryRequireAsyncHooks () {\n try {\n return require('async_hooks')\n } catch (e) {\n return {}\n }\n}\n\n/**\n * Wrap function with async resource, if possible.\n * AsyncResource.bind static method backported.\n * @private\n */\n\nfunction wrap (fn) {\n var res\n\n // create anonymous resource\n if (asyncHooks.AsyncResource) {\n res = new asyncHooks.AsyncResource(fn.name || 'bound-anonymous-fn')\n }\n\n // incompatible node.js\n if (!res || !res.runInAsyncScope) {\n return fn\n }\n\n // return bound function\n return res.runInAsyncScope.bind(res, fn, null)\n}\n"],"names":["require$$0","require$$1","require$$2","require$$3","global"],"mappings":";;;;;;;;;;;;;;;;;;;;AASA;AACA;AACA;AACA;;CAEA,IAAI,UAAU,GAAG,oBAAoB;AACrC,CAAA,IAAI,KAAK,GAAGA,YAAA;AACZ,CAAA,IAAI,WAAW,GAAGC,iBAAA;AAClB,CAAA,IAAI,KAAK,GAAGC,UAAA;AACZ,CAAA,IAAI,MAAM,GAAGC,aAAA;;AAEb;AACA;AACA;AACA;;AAEA,CAAA,OAAc,GAAG;;AAEjB;AACA;AACA;AACA;;AAEA,CAAA,IAAI,6BAA6B,GAAG;;AAEpC;AACA;AACA;AACA;AACA;AACA;;CAEA,SAAS,UAAU,EAAE,QAAQ,EAAE;AAC/B,GAAE,IAAI,CAAC,QAAQ,EAAE,OAAO;;AAExB,GAAE,IAAI;AACN,KAAI,OAAO,KAAK,CAAC,UAAU,CAAC,QAAQ;GACpC,CAAG,CAAC,OAAO,CAAC,EAAE;AACd;KACI,IAAI,CAAC,6BAA6B,CAAC,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC,EAAE,MAAM;;AAE9D;AACA,KAAI,MAAM,WAAW,CAAC,GAAG,EAAE,gCAAgC,EAAE;OACvD,QAAQ,EAAE,QAAQ;AACxB,OAAM,IAAI,EAAE;MACP;AACL,GAAA;AACA,CAAA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,CAAA,SAAS,UAAU,EAAE,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE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pC,KAAI,OAAO;AACX,GAAA;;AAEA;GACE,OAAO,GAAG,CAAC,eAAe,CAAC,IAAI,CAAC,GAAG,EAAE,EAAE,EAAE,IAAI;AAC/C,CAAA;;;;;;","x_google_ignoreList":[0]}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import require$$0 from 'buffer';
|
|
2
|
+
|
|
3
|
+
/* eslint-disable node/no-deprecated-api */
|
|
4
|
+
|
|
5
|
+
var safer_1;
|
|
6
|
+
var hasRequiredSafer;
|
|
7
|
+
|
|
8
|
+
function requireSafer () {
|
|
9
|
+
if (hasRequiredSafer) return safer_1;
|
|
10
|
+
hasRequiredSafer = 1;
|
|
11
|
+
|
|
12
|
+
var buffer = require$$0;
|
|
13
|
+
var Buffer = buffer.Buffer;
|
|
14
|
+
|
|
15
|
+
var safer = {};
|
|
16
|
+
|
|
17
|
+
var key;
|
|
18
|
+
|
|
19
|
+
for (key in buffer) {
|
|
20
|
+
if (!buffer.hasOwnProperty(key)) continue
|
|
21
|
+
if (key === 'SlowBuffer' || key === 'Buffer') continue
|
|
22
|
+
safer[key] = buffer[key];
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
var Safer = safer.Buffer = {};
|
|
26
|
+
for (key in Buffer) {
|
|
27
|
+
if (!Buffer.hasOwnProperty(key)) continue
|
|
28
|
+
if (key === 'allocUnsafe' || key === 'allocUnsafeSlow') continue
|
|
29
|
+
Safer[key] = Buffer[key];
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
safer.Buffer.prototype = Buffer.prototype;
|
|
33
|
+
|
|
34
|
+
if (!Safer.from || Safer.from === Uint8Array.from) {
|
|
35
|
+
Safer.from = function (value, encodingOrOffset, length) {
|
|
36
|
+
if (typeof value === 'number') {
|
|
37
|
+
throw new TypeError('The "value" argument must not be of type number. Received type ' + typeof value)
|
|
38
|
+
}
|
|
39
|
+
if (value && typeof value.length === 'undefined') {
|
|
40
|
+
throw new TypeError('The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type ' + typeof value)
|
|
41
|
+
}
|
|
42
|
+
return Buffer(value, encodingOrOffset, length)
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
if (!Safer.alloc) {
|
|
47
|
+
Safer.alloc = function (size, fill, encoding) {
|
|
48
|
+
if (typeof size !== 'number') {
|
|
49
|
+
throw new TypeError('The "size" argument must be of type number. Received type ' + typeof size)
|
|
50
|
+
}
|
|
51
|
+
if (size < 0 || size >= 2 * (1 << 30)) {
|
|
52
|
+
throw new RangeError('The value "' + size + '" is invalid for option "size"')
|
|
53
|
+
}
|
|
54
|
+
var buf = Buffer(size);
|
|
55
|
+
if (!fill || fill.length === 0) {
|
|
56
|
+
buf.fill(0);
|
|
57
|
+
} else if (typeof encoding === 'string') {
|
|
58
|
+
buf.fill(fill, encoding);
|
|
59
|
+
} else {
|
|
60
|
+
buf.fill(fill);
|
|
61
|
+
}
|
|
62
|
+
return buf
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
if (!safer.kStringMaxLength) {
|
|
67
|
+
try {
|
|
68
|
+
safer.kStringMaxLength = process.binding('buffer').kStringMaxLength;
|
|
69
|
+
} catch (e) {
|
|
70
|
+
// we can't determine kStringMaxLength in environments where process.binding
|
|
71
|
+
// is unsupported, so let's not set it
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
if (!safer.constants) {
|
|
76
|
+
safer.constants = {
|
|
77
|
+
MAX_LENGTH: safer.kMaxLength
|
|
78
|
+
};
|
|
79
|
+
if (safer.kStringMaxLength) {
|
|
80
|
+
safer.constants.MAX_STRING_LENGTH = safer.kStringMaxLength;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
safer_1 = safer;
|
|
85
|
+
return safer_1;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
export { requireSafer as __require };
|
|
89
|
+
//# sourceMappingURL=safer.js.map
|