new license file version [CI SKIP]
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"createObject.js","sourceRoot":"","sources":["../../../../src/internal/util/createObject.ts"],"names":[],"mappings":";;;AAAA,SAAgB,YAAY,CAAC,IAAc,EAAE,MAAa;IACxD,OAAO,IAAI,CAAC,MAAM,CAAC,UAAC,MAAM,EAAE,GAAG,EAAE,CAAC,IAAK,OAAA,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC,EAAE,MAAM,CAAC,EAAnC,CAAmC,EAAE,EAAS,CAAC,CAAC;AACzF,CAAC;AAFD,oCAEC"}
|
||||
@@ -0,0 +1,14 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.expand = void 0;
|
||||
var lift_1 = require("../util/lift");
|
||||
var mergeInternals_1 = require("./mergeInternals");
|
||||
function expand(project, concurrent, scheduler) {
|
||||
if (concurrent === void 0) { concurrent = Infinity; }
|
||||
concurrent = (concurrent || 0) < 1 ? Infinity : concurrent;
|
||||
return lift_1.operate(function (source, subscriber) {
|
||||
return mergeInternals_1.mergeInternals(source, subscriber, project, concurrent, undefined, true, scheduler);
|
||||
});
|
||||
}
|
||||
exports.expand = expand;
|
||||
//# sourceMappingURL=expand.js.map
|
||||
@@ -0,0 +1,44 @@
|
||||
{
|
||||
"name": "npm-run-path",
|
||||
"version": "4.0.1",
|
||||
"description": "Get your PATH prepended with locally installed binaries",
|
||||
"license": "MIT",
|
||||
"repository": "sindresorhus/npm-run-path",
|
||||
"author": {
|
||||
"name": "Sindre Sorhus",
|
||||
"email": "sindresorhus@gmail.com",
|
||||
"url": "sindresorhus.com"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=8"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "xo && ava && tsd"
|
||||
},
|
||||
"files": [
|
||||
"index.js",
|
||||
"index.d.ts"
|
||||
],
|
||||
"keywords": [
|
||||
"npm",
|
||||
"run",
|
||||
"path",
|
||||
"package",
|
||||
"bin",
|
||||
"binary",
|
||||
"binaries",
|
||||
"script",
|
||||
"cli",
|
||||
"command-line",
|
||||
"execute",
|
||||
"executable"
|
||||
],
|
||||
"dependencies": {
|
||||
"path-key": "^3.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"ava": "^1.4.1",
|
||||
"tsd": "^0.7.2",
|
||||
"xo": "^0.24.0"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
'use strict';
|
||||
|
||||
var GetIntrinsic = require('get-intrinsic');
|
||||
|
||||
var $TypeError = GetIntrinsic('%TypeError%');
|
||||
|
||||
var Type = require('../Type');
|
||||
var BigIntLeftShift = require('./leftShift');
|
||||
|
||||
// https://262.ecma-international.org/11.0/#sec-numeric-types-bigint-signedRightShift
|
||||
|
||||
module.exports = function BigIntSignedRightShift(x, y) {
|
||||
if (Type(x) !== 'BigInt' || Type(y) !== 'BigInt') {
|
||||
throw new $TypeError('Assertion failed: `x` and `y` arguments must be BigInts');
|
||||
}
|
||||
|
||||
return BigIntLeftShift(x, -y);
|
||||
};
|
||||
@@ -0,0 +1,3 @@
|
||||
'use strict';
|
||||
|
||||
module.exports = require('./async').anyLimit;
|
||||
@@ -0,0 +1,10 @@
|
||||
"use strict";
|
||||
|
||||
if (!require("./is-implemented")()) {
|
||||
Object.defineProperty(Math, "cosh", {
|
||||
value: require("./shim"),
|
||||
configurable: true,
|
||||
enumerable: false,
|
||||
writable: true
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"takeWhile.js","sourceRoot":"","sources":["../../../../src/internal/operators/takeWhile.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,wBAAwB,EAAE,MAAM,sBAAsB,CAAC;AAoDhE,MAAM,UAAU,SAAS,CAAI,SAA+C,EAAE,SAAS,GAAG,KAAK;IAC7F,OAAO,OAAO,CAAC,CAAC,MAAM,EAAE,UAAU,EAAE,EAAE;QACpC,IAAI,KAAK,GAAG,CAAC,CAAC;QACd,MAAM,CAAC,SAAS,CACd,wBAAwB,CAAC,UAAU,EAAE,CAAC,KAAK,EAAE,EAAE;YAC7C,MAAM,MAAM,GAAG,SAAS,CAAC,KAAK,EAAE,KAAK,EAAE,CAAC,CAAC;YACzC,CAAC,MAAM,IAAI,SAAS,CAAC,IAAI,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;YAChD,CAAC,MAAM,IAAI,UAAU,CAAC,QAAQ,EAAE,CAAC;QACnC,CAAC,CAAC,CACH,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC"}
|
||||
@@ -0,0 +1,42 @@
|
||||
{
|
||||
"name": "wcwidth",
|
||||
"version": "1.0.1",
|
||||
"description": "Port of C's wcwidth() and wcswidth()",
|
||||
"author": "Tim Oxley",
|
||||
"contributors": [
|
||||
"Woong Jun <woong.jun@gmail.com> (http://code.woong.org/)"
|
||||
],
|
||||
"main": "index.js",
|
||||
"dependencies": {
|
||||
"defaults": "^1.0.3"
|
||||
},
|
||||
"devDependencies": {
|
||||
"tape": "^4.5.1"
|
||||
},
|
||||
"license": "MIT",
|
||||
"keywords": [
|
||||
"wide character",
|
||||
"wc",
|
||||
"wide character string",
|
||||
"wcs",
|
||||
"terminal",
|
||||
"width",
|
||||
"wcwidth",
|
||||
"wcswidth"
|
||||
],
|
||||
"directories": {
|
||||
"doc": "docs",
|
||||
"test": "test"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "tape test/*.js"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/timoxley/wcwidth.git"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/timoxley/wcwidth/issues"
|
||||
},
|
||||
"homepage": "https://github.com/timoxley/wcwidth#readme"
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
module.exports={A:{A:{"2":"J D E F A B CC"},B:{"1":"N O P Q R S T U V W X Y Z a b c d e i j k l m n o p q r s t u f H","2":"C K L","322":"G M"},C:{"1":"KB MB NB OB PB QB RB TB UB VB WB XB YB uB vB aB bB cB dB eB fB hB iB jB kB h lB mB nB oB pB P Q R wB S T U V W X Y Z a b c d e i j k l m n o p q r s t u f H xB yB","2":"0 1 2 3 4 5 6 7 8 DC tB I v J D E F A B C K L G M N O w g x y z EC FC","194":"9 AB BB CB DB EB FB GB HB IB JB","513":"LB SB ZB gB"},D:{"1":"LB MB NB OB PB QB RB SB TB UB VB WB XB YB uB ZB vB aB bB cB dB eB fB gB hB iB jB kB h lB mB nB oB pB P Q R S T U V W X Y Z a b c d e i j k l m n o p q r s t u f H xB yB GC","2":"0 1 2 3 4 5 6 7 8 9 I v J D E F A B C K L G M N O w g x y z AB BB CB DB EB FB","4":"GB HB IB JB KB"},E:{"1":"C K L G qB rB 1B MC NC 2B 3B 4B 5B sB 6B 7B 8B 9B OC","2":"I v J D E F A B HC zB IC JC KC LC 0B"},F:{"1":"8 9 AB BB CB DB EB FB GB HB IB JB KB LB MB NB OB PB QB RB SB TB UB VB WB XB YB ZB aB bB cB dB eB fB gB hB iB jB kB h lB mB nB oB pB P Q R wB S T U V W X Y Z a b c d e","2":"0 1 2 F B C G M N O w g x y z PC QC RC SC qB AC TC rB","4":"3 4 5 6 7"},G:{"1":"eC fC gC hC iC jC kC lC mC nC 2B 3B 4B 5B sB 6B 7B 8B 9B","2":"E zB UC BC VC WC XC YC ZC aC bC cC dC"},H:{"2":"oC"},I:{"2":"tB I pC qC rC sC BC tC uC","4":"f"},J:{"2":"D A"},K:{"1":"h","2":"A B C qB AC rB"},L:{"1":"H"},M:{"1":"H"},N:{"2":"A B"},O:{"1":"vC"},P:{"1":"I g wC xC yC zC 0C 0B 1C 2C 3C 4C 5C sB 6C 7C 8C"},Q:{"1":"1B"},R:{"1":"9C"},S:{"1":"BD","2":"AD"}},B:4,C:"Service Workers"};
|
||||
@@ -0,0 +1,13 @@
|
||||
"use strict";
|
||||
|
||||
var isObject = require("../object/is");
|
||||
|
||||
module.exports = function (value) {
|
||||
if (!isObject(value)) return false;
|
||||
try {
|
||||
if (!value.constructor) return false;
|
||||
return value.constructor.prototype === value;
|
||||
} catch (error) {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,30 @@
|
||||
var baseToPairs = require('./_baseToPairs'),
|
||||
getTag = require('./_getTag'),
|
||||
mapToArray = require('./_mapToArray'),
|
||||
setToPairs = require('./_setToPairs');
|
||||
|
||||
/** `Object#toString` result references. */
|
||||
var mapTag = '[object Map]',
|
||||
setTag = '[object Set]';
|
||||
|
||||
/**
|
||||
* Creates a `_.toPairs` or `_.toPairsIn` function.
|
||||
*
|
||||
* @private
|
||||
* @param {Function} keysFunc The function to get the keys of a given object.
|
||||
* @returns {Function} Returns the new pairs function.
|
||||
*/
|
||||
function createToPairs(keysFunc) {
|
||||
return function(object) {
|
||||
var tag = getTag(object);
|
||||
if (tag == mapTag) {
|
||||
return mapToArray(object);
|
||||
}
|
||||
if (tag == setTag) {
|
||||
return setToPairs(object);
|
||||
}
|
||||
return baseToPairs(object, keysFunc(object));
|
||||
};
|
||||
}
|
||||
|
||||
module.exports = createToPairs;
|
||||
@@ -0,0 +1,21 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) Luke Edwards <luke.edwards05@gmail.com> (https://lukeed.com)
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
@@ -0,0 +1 @@
|
||||
{"name":"cli-width","version":"4.0.0","files":{"LICENSE":{"checkedAt":1678883671206,"integrity":"sha512-WvAltlLidCF6ggMlM4K75Oy5E3YTMVEPHvK/wbRi2gLXfAZkNtIoi7N094kQCE9IUvBWn6gu/56VpePu9flz7w==","mode":420,"size":757},"index.js":{"checkedAt":1678883671206,"integrity":"sha512-rqDLIgJnsR7lWuOaFYbui7nMyd26vIDW+klPDzr7bD3LMQ073r2jEN8zDKwi1Z8Ijr6ooRnt01qw2gVcp2VvMg==","mode":420,"size":903},"README.md":{"checkedAt":1678883671206,"integrity":"sha512-fcEQtMRULn/hc6odGRMiRB/Fqc8sTxLA3BxxaVhD61mBoUzbZbuMfDJVNBbCxT6gobpzUzd5HynuACKLa2zN+Q==","mode":420,"size":1831},"package.json":{"checkedAt":1678883671206,"integrity":"sha512-tHGIPNojGNyqY9cyUTRy0owfDvNcHl3kjFoamYZyTN8eV05Y1hRHsNsz4ab4FDFZ0qEbl0pWiE8xvkmnDRjfSQ==","mode":420,"size":926},".github/FUNDING.yml":{"checkedAt":1678883671206,"integrity":"sha512-1rwPyOpXXTBOl+i9M8dB01UbP8Czbu43eJNLfDxELRJ/Qg6S9nrFvgUnI2layJv7/35hWmBk1C3klkhCKGCU5g==","mode":420,"size":67},".github/workflows/node.js.yml":{"checkedAt":1678883671206,"integrity":"sha512-8lwxV9Ia/PaJskwh3l3JnrPjUgHbjYoQfPPz6naIneVWYbT1khA2AbrJAXmB/x9leUaJ0EkWbnKoW9X/LP8I5w==","mode":420,"size":868},".prettierrc":{"checkedAt":1678883671206,"integrity":"sha512-mJK7RGFsbCdhAnViNx5ccqNVzhtRkHLOVzPqHUlx/7jJs+g/k1oYEg4HAqrmRNBydK1LCSFEWfwTZ5qO1gUefA==","mode":420,"size":26}}}
|
||||
@@ -0,0 +1,3 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
//# sourceMappingURL=Operator.js.map
|
||||
@@ -0,0 +1,12 @@
|
||||
import Node from './shared/Node';
|
||||
import Component from '../Component';
|
||||
import { Identifier } from 'estree';
|
||||
import TemplateScope from './shared/TemplateScope';
|
||||
import { TemplateNode } from '../../interfaces';
|
||||
export default class Let extends Node {
|
||||
type: 'Let';
|
||||
name: Identifier;
|
||||
value: Identifier;
|
||||
names: string[];
|
||||
constructor(component: Component, parent: Node, scope: TemplateScope, info: TemplateNode);
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
require('./index.js')
|
||||
|
||||
console.log(DOMException.INDEX_SIZE_ERR)
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"flatMap.js","sourceRoot":"","sources":["../../../../src/internal/operators/flatMap.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAKtC,MAAM,CAAC,IAAM,OAAO,GAAG,QAAQ,CAAC"}
|
||||
@@ -0,0 +1,78 @@
|
||||
/**
|
||||
* Cannot do Math.log(x) / Math.log(10) bc if IEEE floating point issue
|
||||
* @param x number
|
||||
*/
|
||||
export function getMagnitude(x) {
|
||||
// Cannot count string length via Number.toString because it may use scientific notation
|
||||
// for very small or very large numbers.
|
||||
return Math.floor(Math.log(x) * Math.LOG10E);
|
||||
}
|
||||
export function repeat(s, times) {
|
||||
if (typeof s.repeat === 'function') {
|
||||
return s.repeat(times);
|
||||
}
|
||||
var arr = new Array(times);
|
||||
for (var i = 0; i < arr.length; i++) {
|
||||
arr[i] = s;
|
||||
}
|
||||
return arr.join('');
|
||||
}
|
||||
export function setInternalSlot(map, pl, field, value) {
|
||||
if (!map.get(pl)) {
|
||||
map.set(pl, Object.create(null));
|
||||
}
|
||||
var slots = map.get(pl);
|
||||
slots[field] = value;
|
||||
}
|
||||
export function setMultiInternalSlots(map, pl, props) {
|
||||
for (var _i = 0, _a = Object.keys(props); _i < _a.length; _i++) {
|
||||
var k = _a[_i];
|
||||
setInternalSlot(map, pl, k, props[k]);
|
||||
}
|
||||
}
|
||||
export function getInternalSlot(map, pl, field) {
|
||||
return getMultiInternalSlots(map, pl, field)[field];
|
||||
}
|
||||
export function getMultiInternalSlots(map, pl) {
|
||||
var fields = [];
|
||||
for (var _i = 2; _i < arguments.length; _i++) {
|
||||
fields[_i - 2] = arguments[_i];
|
||||
}
|
||||
var slots = map.get(pl);
|
||||
if (!slots) {
|
||||
throw new TypeError("".concat(pl, " InternalSlot has not been initialized"));
|
||||
}
|
||||
return fields.reduce(function (all, f) {
|
||||
all[f] = slots[f];
|
||||
return all;
|
||||
}, Object.create(null));
|
||||
}
|
||||
export function isLiteralPart(patternPart) {
|
||||
return patternPart.type === 'literal';
|
||||
}
|
||||
/*
|
||||
17 ECMAScript Standard Built-in Objects:
|
||||
Every built-in Function object, including constructors, that is not
|
||||
identified as an anonymous function has a name property whose value
|
||||
is a String.
|
||||
|
||||
Unless otherwise specified, the name property of a built-in Function
|
||||
object, if it exists, has the attributes { [[Writable]]: false,
|
||||
[[Enumerable]]: false, [[Configurable]]: true }.
|
||||
*/
|
||||
export function defineProperty(target, name, _a) {
|
||||
var value = _a.value;
|
||||
Object.defineProperty(target, name, {
|
||||
configurable: true,
|
||||
enumerable: false,
|
||||
writable: true,
|
||||
value: value,
|
||||
});
|
||||
}
|
||||
export var UNICODE_EXTENSION_SEQUENCE_REGEX = /-u(?:-[0-9a-z]{2,8})+/gi;
|
||||
export function invariant(condition, message, Err) {
|
||||
if (Err === void 0) { Err = Error; }
|
||||
if (!condition) {
|
||||
throw new Err(message);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.scheduleAsyncIterable = void 0;
|
||||
var Observable_1 = require("../Observable");
|
||||
var executeSchedule_1 = require("../util/executeSchedule");
|
||||
function scheduleAsyncIterable(input, scheduler) {
|
||||
if (!input) {
|
||||
throw new Error('Iterable cannot be null');
|
||||
}
|
||||
return new Observable_1.Observable(function (subscriber) {
|
||||
executeSchedule_1.executeSchedule(subscriber, scheduler, function () {
|
||||
var iterator = input[Symbol.asyncIterator]();
|
||||
executeSchedule_1.executeSchedule(subscriber, scheduler, function () {
|
||||
iterator.next().then(function (result) {
|
||||
if (result.done) {
|
||||
subscriber.complete();
|
||||
}
|
||||
else {
|
||||
subscriber.next(result.value);
|
||||
}
|
||||
});
|
||||
}, 0, true);
|
||||
});
|
||||
});
|
||||
}
|
||||
exports.scheduleAsyncIterable = scheduleAsyncIterable;
|
||||
//# sourceMappingURL=scheduleAsyncIterable.js.map
|
||||
@@ -0,0 +1,10 @@
|
||||
"use strict";
|
||||
|
||||
if (!require("./is-implemented")()) {
|
||||
Object.defineProperty(Object, "keys", {
|
||||
value: require("./shim"),
|
||||
configurable: true,
|
||||
enumerable: false,
|
||||
writable: true
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
/*! blob-to-buffer. MIT License. Jimmy Wärting <https://jimmy.warting.se/opensource> */
|
||||
|
||||
if (!globalThis.DOMException) {
|
||||
const { MessageChannel } = require('worker_threads'),
|
||||
port = new MessageChannel().port1,
|
||||
ab = new ArrayBuffer()
|
||||
try { port.postMessage(ab, [ab, ab]) }
|
||||
catch (err) {
|
||||
err.constructor.name === 'DOMException' && (
|
||||
globalThis.DOMException = err.constructor
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = globalThis.DOMException
|
||||
@@ -0,0 +1,312 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.argon2id = exports.argon2i = exports.argon2d = void 0;
|
||||
const _assert_js_1 = require("./_assert.js");
|
||||
const utils_js_1 = require("./utils.js");
|
||||
const blake2b_js_1 = require("./blake2b.js");
|
||||
const _u64_js_1 = require("./_u64.js");
|
||||
// Experimental implementation of argon2.
|
||||
// Could be broken & slow. May be removed at a later time.
|
||||
// RFC 9106
|
||||
var Types;
|
||||
(function (Types) {
|
||||
Types[Types["Argond2d"] = 0] = "Argond2d";
|
||||
Types[Types["Argon2i"] = 1] = "Argon2i";
|
||||
Types[Types["Argon2id"] = 2] = "Argon2id";
|
||||
})(Types || (Types = {}));
|
||||
const ARGON2_SYNC_POINTS = 4;
|
||||
const toBytesOptional = (buf) => (buf !== undefined ? (0, utils_js_1.toBytes)(buf) : new Uint8Array([]));
|
||||
function mul(a, b) {
|
||||
const aL = a & 0xffff;
|
||||
const aH = a >>> 16;
|
||||
const bL = b & 0xffff;
|
||||
const bH = b >>> 16;
|
||||
const ll = Math.imul(aL, bL);
|
||||
const hl = Math.imul(aH, bL);
|
||||
const lh = Math.imul(aL, bH);
|
||||
const hh = Math.imul(aH, bH);
|
||||
const BUF = ((ll >>> 16) + (hl & 0xffff) + lh) | 0;
|
||||
const h = ((hl >>> 16) + (BUF >>> 16) + hh) | 0;
|
||||
return { h, l: (BUF << 16) | (ll & 0xffff) };
|
||||
}
|
||||
function relPos(areaSize, relativePos) {
|
||||
// areaSize - 1 - ((areaSize * ((relativePos ** 2) >>> 32)) >>> 32)
|
||||
return areaSize - 1 - mul(areaSize, mul(relativePos, relativePos).h).h;
|
||||
}
|
||||
function mul2(a, b) {
|
||||
// 2 * a * b (via shifts)
|
||||
const { h, l } = mul(a, b);
|
||||
return { h: ((h << 1) | (l >>> 31)) & 4294967295, l: (l << 1) & 4294967295 };
|
||||
}
|
||||
function blamka(Ah, Al, Bh, Bl) {
|
||||
const { h: Ch, l: Cl } = mul2(Al, Bl);
|
||||
// A + B + (2 * A * B)
|
||||
const Rll = _u64_js_1.default.add3L(Al, Bl, Cl);
|
||||
return { h: _u64_js_1.default.add3H(Rll, Ah, Bh, Ch), l: Rll | 0 };
|
||||
}
|
||||
// Temporary block buffer
|
||||
const BUF = new Uint32Array(256);
|
||||
function G(a, b, c, d) {
|
||||
let Al = BUF[2 * a], Ah = BUF[2 * a + 1]; // prettier-ignore
|
||||
let Bl = BUF[2 * b], Bh = BUF[2 * b + 1]; // prettier-ignore
|
||||
let Cl = BUF[2 * c], Ch = BUF[2 * c + 1]; // prettier-ignore
|
||||
let Dl = BUF[2 * d], Dh = BUF[2 * d + 1]; // prettier-ignore
|
||||
({ h: Ah, l: Al } = blamka(Ah, Al, Bh, Bl));
|
||||
({ Dh, Dl } = { Dh: Dh ^ Ah, Dl: Dl ^ Al });
|
||||
({ Dh, Dl } = { Dh: _u64_js_1.default.rotr32H(Dh, Dl), Dl: _u64_js_1.default.rotr32L(Dh, Dl) });
|
||||
({ h: Ch, l: Cl } = blamka(Ch, Cl, Dh, Dl));
|
||||
({ Bh, Bl } = { Bh: Bh ^ Ch, Bl: Bl ^ Cl });
|
||||
({ Bh, Bl } = { Bh: _u64_js_1.default.rotrSH(Bh, Bl, 24), Bl: _u64_js_1.default.rotrSL(Bh, Bl, 24) });
|
||||
({ h: Ah, l: Al } = blamka(Ah, Al, Bh, Bl));
|
||||
({ Dh, Dl } = { Dh: Dh ^ Ah, Dl: Dl ^ Al });
|
||||
({ Dh, Dl } = { Dh: _u64_js_1.default.rotrSH(Dh, Dl, 16), Dl: _u64_js_1.default.rotrSL(Dh, Dl, 16) });
|
||||
({ h: Ch, l: Cl } = blamka(Ch, Cl, Dh, Dl));
|
||||
({ Bh, Bl } = { Bh: Bh ^ Ch, Bl: Bl ^ Cl });
|
||||
({ Bh, Bl } = { Bh: _u64_js_1.default.rotrBH(Bh, Bl, 63), Bl: _u64_js_1.default.rotrBL(Bh, Bl, 63) });
|
||||
(BUF[2 * a] = Al), (BUF[2 * a + 1] = Ah);
|
||||
(BUF[2 * b] = Bl), (BUF[2 * b + 1] = Bh);
|
||||
(BUF[2 * c] = Cl), (BUF[2 * c + 1] = Ch);
|
||||
(BUF[2 * d] = Dl), (BUF[2 * d + 1] = Dh);
|
||||
}
|
||||
// prettier-ignore
|
||||
function P(v00, v01, v02, v03, v04, v05, v06, v07, v08, v09, v10, v11, v12, v13, v14, v15) {
|
||||
G(v00, v04, v08, v12);
|
||||
G(v01, v05, v09, v13);
|
||||
G(v02, v06, v10, v14);
|
||||
G(v03, v07, v11, v15);
|
||||
G(v00, v05, v10, v15);
|
||||
G(v01, v06, v11, v12);
|
||||
G(v02, v07, v08, v13);
|
||||
G(v03, v04, v09, v14);
|
||||
}
|
||||
function block(x, xPos, yPos, outPos, needXor) {
|
||||
for (let i = 0; i < 256; i++)
|
||||
BUF[i] = x[xPos + i] ^ x[yPos + i];
|
||||
// columns
|
||||
for (let i = 0; i < 128; i += 16) {
|
||||
// prettier-ignore
|
||||
P(i, i + 1, i + 2, i + 3, i + 4, i + 5, i + 6, i + 7, i + 8, i + 9, i + 10, i + 11, i + 12, i + 13, i + 14, i + 15);
|
||||
}
|
||||
// rows
|
||||
for (let i = 0; i < 16; i += 2) {
|
||||
// prettier-ignore
|
||||
P(i, i + 1, i + 16, i + 17, i + 32, i + 33, i + 48, i + 49, i + 64, i + 65, i + 80, i + 81, i + 96, i + 97, i + 112, i + 113);
|
||||
}
|
||||
if (needXor)
|
||||
for (let i = 0; i < 256; i++)
|
||||
x[outPos + i] ^= BUF[i] ^ x[xPos + i] ^ x[yPos + i];
|
||||
else
|
||||
for (let i = 0; i < 256; i++)
|
||||
x[outPos + i] = BUF[i] ^ x[xPos + i] ^ x[yPos + i];
|
||||
}
|
||||
// Variable-Length Hash Function H'
|
||||
function Hp(A, dkLen) {
|
||||
const A8 = (0, utils_js_1.u8)(A);
|
||||
const T = new Uint32Array(1);
|
||||
const T8 = (0, utils_js_1.u8)(T);
|
||||
T[0] = dkLen;
|
||||
// Fast path
|
||||
if (dkLen <= 64)
|
||||
return blake2b_js_1.blake2b.create({ dkLen }).update(T8).update(A8).digest();
|
||||
const out = new Uint8Array(dkLen);
|
||||
let V = blake2b_js_1.blake2b.create({}).update(T8).update(A8).digest();
|
||||
let pos = 0;
|
||||
// First block
|
||||
out.set(V.subarray(0, 32));
|
||||
pos += 32;
|
||||
// Rest blocks
|
||||
for (; dkLen - pos > 64; pos += 32)
|
||||
out.set((V = (0, blake2b_js_1.blake2b)(V)).subarray(0, 32), pos);
|
||||
// Last block
|
||||
out.set((0, blake2b_js_1.blake2b)(V, { dkLen: dkLen - pos }), pos);
|
||||
return (0, utils_js_1.u32)(out);
|
||||
}
|
||||
function indexAlpha(r, s, laneLen, segmentLen, index, randL, sameLane = false) {
|
||||
let area;
|
||||
if (0 == r) {
|
||||
if (0 == s)
|
||||
area = index - 1;
|
||||
else if (sameLane)
|
||||
area = s * segmentLen + index - 1;
|
||||
else
|
||||
area = s * segmentLen + (index == 0 ? -1 : 0);
|
||||
}
|
||||
else if (sameLane)
|
||||
area = laneLen - segmentLen + index - 1;
|
||||
else
|
||||
area = laneLen - segmentLen + (index == 0 ? -1 : 0);
|
||||
const startPos = r !== 0 && s !== ARGON2_SYNC_POINTS - 1 ? (s + 1) * segmentLen : 0;
|
||||
const rel = relPos(area, randL);
|
||||
// NOTE: check about overflows here
|
||||
// absPos = (startPos + relPos) % laneLength;
|
||||
return (startPos + rel) % laneLen;
|
||||
}
|
||||
function argon2Init(type, password, salt, opts) {
|
||||
password = (0, utils_js_1.toBytes)(password);
|
||||
salt = (0, utils_js_1.toBytes)(salt);
|
||||
let { p, dkLen, m, t, version, key, personalization, maxmem, onProgress } = {
|
||||
...opts,
|
||||
version: opts.version || 0x13,
|
||||
dkLen: opts.dkLen || 32,
|
||||
maxmem: 2 ** 32,
|
||||
};
|
||||
// Validation
|
||||
_assert_js_1.default.number(p);
|
||||
_assert_js_1.default.number(dkLen);
|
||||
_assert_js_1.default.number(m);
|
||||
_assert_js_1.default.number(t);
|
||||
_assert_js_1.default.number(version);
|
||||
if (dkLen < 4 || dkLen >= 2 ** 32)
|
||||
throw new Error('Argon2: dkLen should be at least 4 bytes');
|
||||
if (dkLen < 1 || p >= 2 ** 32)
|
||||
throw new Error('Argon2: p (paralllelism) should be at least 1');
|
||||
if (dkLen < 1 || p >= 2 ** 32)
|
||||
throw new Error('Argon2: t (iterations) should be at least 1');
|
||||
if (m < 8 * p)
|
||||
throw new Error(`Argon2: memory should be at least 8*p bytes`);
|
||||
if (version !== 16 && version !== 19)
|
||||
throw new Error(`Argon2: unknown version=${version}`);
|
||||
password = (0, utils_js_1.toBytes)(password);
|
||||
if (password.length < 0 || password.length >= 2 ** 32)
|
||||
throw new Error('Argon2: password should be less than 4 GB');
|
||||
salt = (0, utils_js_1.toBytes)(salt);
|
||||
if (salt.length < 8)
|
||||
throw new Error('Argon2: salt should be at least 8 bytes');
|
||||
key = toBytesOptional(key);
|
||||
personalization = toBytesOptional(personalization);
|
||||
if (onProgress !== undefined && typeof onProgress !== 'function')
|
||||
throw new Error('progressCb should be function');
|
||||
// Params
|
||||
const lanes = p;
|
||||
// m' = 4 * p * floor (m / 4p)
|
||||
const mP = 4 * p * Math.floor(m / (ARGON2_SYNC_POINTS * p));
|
||||
//q = m' / p columns
|
||||
const laneLen = Math.floor(mP / p);
|
||||
const segmentLen = Math.floor(laneLen / ARGON2_SYNC_POINTS);
|
||||
// H0
|
||||
const h = blake2b_js_1.blake2b.create({});
|
||||
const BUF = new Uint32Array(1);
|
||||
const BUF8 = (0, utils_js_1.u8)(BUF);
|
||||
for (const i of [p, dkLen, m, t, version, type]) {
|
||||
if (i < 0 || i >= 2 ** 32)
|
||||
throw new Error(`Argon2: wrong parameter=${i}, expected uint32`);
|
||||
BUF[0] = i;
|
||||
h.update(BUF8);
|
||||
}
|
||||
for (let i of [password, salt, key, personalization]) {
|
||||
BUF[0] = i.length;
|
||||
h.update(BUF8).update(i);
|
||||
}
|
||||
const H0 = new Uint32Array(18);
|
||||
const H0_8 = (0, utils_js_1.u8)(H0);
|
||||
h.digestInto(H0_8);
|
||||
// 256 u32 = 1024 (BLOCK_SIZE)
|
||||
const memUsed = mP * 256;
|
||||
if (memUsed < 0 || memUsed >= 2 ** 32 || memUsed > maxmem) {
|
||||
throw new Error(`Argon2: wrong params (memUsed=${memUsed} maxmem=${maxmem}), should be less than 2**32`);
|
||||
}
|
||||
const B = new Uint32Array(memUsed);
|
||||
// Fill first blocks
|
||||
for (let l = 0; l < p; l++) {
|
||||
const i = 256 * laneLen * l;
|
||||
// B[i][0] = H'^(1024)(H_0 || LE32(0) || LE32(i))
|
||||
H0[17] = l;
|
||||
H0[16] = 0;
|
||||
B.set(Hp(H0, 1024), i);
|
||||
// B[i][1] = H'^(1024)(H_0 || LE32(1) || LE32(i))
|
||||
H0[16] = 1;
|
||||
B.set(Hp(H0, 1024), i + 256);
|
||||
}
|
||||
let perBlock = () => { };
|
||||
if (onProgress) {
|
||||
const totalBlock = t * ARGON2_SYNC_POINTS * p * segmentLen;
|
||||
// Invoke callback if progress changes from 10.01 to 10.02
|
||||
// Allows to draw smooth progress bar on up to 8K screen
|
||||
const callbackPer = Math.max(Math.floor(totalBlock / 10000), 1);
|
||||
let blockCnt = 0;
|
||||
perBlock = () => {
|
||||
blockCnt++;
|
||||
if (onProgress && (!(blockCnt % callbackPer) || blockCnt === totalBlock))
|
||||
onProgress(blockCnt / totalBlock);
|
||||
};
|
||||
}
|
||||
return { type, mP, p, t, version, B, laneLen, lanes, segmentLen, dkLen, perBlock };
|
||||
}
|
||||
function argon2Output(B, p, laneLen, dkLen) {
|
||||
const B_final = new Uint32Array(256);
|
||||
for (let l = 0; l < p; l++)
|
||||
for (let j = 0; j < 256; j++)
|
||||
B_final[j] ^= B[256 * (laneLen * l + laneLen - 1) + j];
|
||||
return (0, utils_js_1.u8)(Hp(B_final, dkLen));
|
||||
}
|
||||
function processBlock(B, address, l, r, s, index, laneLen, segmentLen, lanes, offset, prev, dataIndependent, needXor) {
|
||||
if (offset % laneLen)
|
||||
prev = offset - 1;
|
||||
let randL, randH;
|
||||
if (dataIndependent) {
|
||||
if (index % 128 === 0) {
|
||||
address[256 + 12]++;
|
||||
block(address, 256, 2 * 256, 0, false);
|
||||
block(address, 0, 2 * 256, 0, false);
|
||||
}
|
||||
randL = address[2 * (index % 128)];
|
||||
randH = address[2 * (index % 128) + 1];
|
||||
}
|
||||
else {
|
||||
const T = 256 * prev;
|
||||
randL = B[T];
|
||||
randH = B[T + 1];
|
||||
}
|
||||
// address block
|
||||
const refLane = r === 0 && s === 0 ? l : randH % lanes;
|
||||
const refPos = indexAlpha(r, s, laneLen, segmentLen, index, randL, refLane == l);
|
||||
const refBlock = laneLen * refLane + refPos;
|
||||
// B[i][j] = G(B[i][j-1], B[l][z])
|
||||
block(B, 256 * prev, 256 * refBlock, offset * 256, needXor);
|
||||
}
|
||||
function argon2(type, password, salt, opts) {
|
||||
const { mP, p, t, version, B, laneLen, lanes, segmentLen, dkLen, perBlock } = argon2Init(type, password, salt, opts);
|
||||
// Pre-loop setup
|
||||
// [address, input, zero_block] format so we can pass single U32 to block function
|
||||
const address = new Uint32Array(3 * 256);
|
||||
address[256 + 6] = mP;
|
||||
address[256 + 8] = t;
|
||||
address[256 + 10] = type;
|
||||
for (let r = 0; r < t; r++) {
|
||||
const needXor = r !== 0 && version === 0x13;
|
||||
address[256 + 0] = r;
|
||||
for (let s = 0; s < ARGON2_SYNC_POINTS; s++) {
|
||||
address[256 + 4] = s;
|
||||
const dataIndependent = type == Types.Argon2i || (type == Types.Argon2id && r === 0 && s < 2);
|
||||
for (let l = 0; l < p; l++) {
|
||||
address[256 + 2] = l;
|
||||
address[256 + 12] = 0;
|
||||
let startPos = 0;
|
||||
if (r === 0 && s === 0) {
|
||||
startPos = 2;
|
||||
if (dataIndependent) {
|
||||
address[256 + 12]++;
|
||||
block(address, 256, 2 * 256, 0, false);
|
||||
block(address, 0, 2 * 256, 0, false);
|
||||
}
|
||||
}
|
||||
// current block postion
|
||||
let offset = l * laneLen + s * segmentLen + startPos;
|
||||
// previous block position
|
||||
let prev = offset % laneLen ? offset - 1 : offset + laneLen - 1;
|
||||
for (let index = startPos; index < segmentLen; index++, offset++, prev++) {
|
||||
perBlock();
|
||||
processBlock(B, address, l, r, s, index, laneLen, segmentLen, lanes, offset, prev, dataIndependent, needXor);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return argon2Output(B, p, laneLen, dkLen);
|
||||
}
|
||||
const argon2d = (password, salt, opts) => argon2(Types.Argond2d, password, salt, opts);
|
||||
exports.argon2d = argon2d;
|
||||
const argon2i = (password, salt, opts) => argon2(Types.Argon2i, password, salt, opts);
|
||||
exports.argon2i = argon2i;
|
||||
const argon2id = (password, salt, opts) => argon2(Types.Argon2id, password, salt, opts);
|
||||
exports.argon2id = argon2id;
|
||||
//# sourceMappingURL=argon2.js.map
|
||||
@@ -0,0 +1,45 @@
|
||||
import { RequestRequestOptions } from "./RequestRequestOptions";
|
||||
import { RequestHeaders } from "./RequestHeaders";
|
||||
import { Url } from "./Url";
|
||||
/**
|
||||
* Parameters that can be passed into `request(route, parameters)` or `endpoint(route, parameters)` methods
|
||||
*/
|
||||
export type RequestParameters = {
|
||||
/**
|
||||
* Base URL to be used when a relative URL is passed, such as `/orgs/{org}`.
|
||||
* If `baseUrl` is `https://enterprise.acme-inc.com/api/v3`, then the request
|
||||
* will be sent to `https://enterprise.acme-inc.com/api/v3/orgs/{org}`.
|
||||
*/
|
||||
baseUrl?: Url;
|
||||
/**
|
||||
* HTTP headers. Use lowercase keys.
|
||||
*/
|
||||
headers?: RequestHeaders;
|
||||
/**
|
||||
* Media type options, see {@link https://developer.github.com/v3/media/|GitHub Developer Guide}
|
||||
*/
|
||||
mediaType?: {
|
||||
/**
|
||||
* `json` by default. Can be `raw`, `text`, `html`, `full`, `diff`, `patch`, `sha`, `base64`. Depending on endpoint
|
||||
*/
|
||||
format?: string;
|
||||
/**
|
||||
* Custom media type names of {@link https://developer.github.com/v3/media/|API Previews} without the `-preview` suffix.
|
||||
* Example for single preview: `['squirrel-girl']`.
|
||||
* Example for multiple previews: `['squirrel-girl', 'mister-fantastic']`.
|
||||
*/
|
||||
previews?: string[];
|
||||
};
|
||||
/**
|
||||
* Pass custom meta information for the request. The `request` object will be returned as is.
|
||||
*/
|
||||
request?: RequestRequestOptions;
|
||||
/**
|
||||
* Any additional parameter will be passed as follows
|
||||
* 1. URL parameter if `':parameter'` or `{parameter}` is part of `url`
|
||||
* 2. Query parameter if `method` is `'GET'` or `'HEAD'`
|
||||
* 3. Request body if `parameter` is `'data'`
|
||||
* 4. JSON in the request body in the form of `body[parameter]` unless `parameter` key is `'data'`
|
||||
*/
|
||||
[parameter: string]: unknown;
|
||||
};
|
||||
@@ -0,0 +1,34 @@
|
||||
let Declaration = require('../declaration')
|
||||
|
||||
class InlineLogical extends Declaration {
|
||||
/**
|
||||
* Use old syntax for -moz- and -webkit-
|
||||
*/
|
||||
prefixed(prop, prefix) {
|
||||
return prefix + prop.replace('-inline', '')
|
||||
}
|
||||
|
||||
/**
|
||||
* Return property name by spec
|
||||
*/
|
||||
normalize(prop) {
|
||||
return prop.replace(/(margin|padding|border)-(start|end)/, '$1-inline-$2')
|
||||
}
|
||||
}
|
||||
|
||||
InlineLogical.names = [
|
||||
'border-inline-start',
|
||||
'border-inline-end',
|
||||
'margin-inline-start',
|
||||
'margin-inline-end',
|
||||
'padding-inline-start',
|
||||
'padding-inline-end',
|
||||
'border-start',
|
||||
'border-end',
|
||||
'margin-start',
|
||||
'margin-end',
|
||||
'padding-start',
|
||||
'padding-end'
|
||||
]
|
||||
|
||||
module.exports = InlineLogical
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"subscribeOn.js","sourceRoot":"","sources":["../../../../src/internal/operators/subscribeOn.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AA6DvC,MAAM,UAAU,WAAW,CAAI,SAAwB,EAAE,QAAgB,CAAC;IACxE,OAAO,OAAO,CAAC,CAAC,MAAM,EAAE,UAAU,EAAE,EAAE;QACpC,UAAU,CAAC,GAAG,CAAC,SAAS,CAAC,QAAQ,CAAC,GAAG,EAAE,CAAC,MAAM,CAAC,SAAS,CAAC,UAAU,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC;IAChF,CAAC,CAAC,CAAC;AACL,CAAC"}
|
||||
@@ -0,0 +1,223 @@
|
||||
# raw-body
|
||||
|
||||
[![NPM Version][npm-image]][npm-url]
|
||||
[![NPM Downloads][downloads-image]][downloads-url]
|
||||
[![Node.js Version][node-version-image]][node-version-url]
|
||||
[![Build status][github-actions-ci-image]][github-actions-ci-url]
|
||||
[![Test coverage][coveralls-image]][coveralls-url]
|
||||
|
||||
Gets the entire buffer of a stream either as a `Buffer` or a string.
|
||||
Validates the stream's length against an expected length and maximum limit.
|
||||
Ideal for parsing request bodies.
|
||||
|
||||
## Install
|
||||
|
||||
This is a [Node.js](https://nodejs.org/en/) module available through the
|
||||
[npm registry](https://www.npmjs.com/). Installation is done using the
|
||||
[`npm install` command](https://docs.npmjs.com/getting-started/installing-npm-packages-locally):
|
||||
|
||||
```sh
|
||||
$ npm install raw-body
|
||||
```
|
||||
|
||||
### TypeScript
|
||||
|
||||
This module includes a [TypeScript](https://www.typescriptlang.org/)
|
||||
declaration file to enable auto complete in compatible editors and type
|
||||
information for TypeScript projects. This module depends on the Node.js
|
||||
types, so install `@types/node`:
|
||||
|
||||
```sh
|
||||
$ npm install @types/node
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
```js
|
||||
var getRawBody = require('raw-body')
|
||||
```
|
||||
|
||||
### getRawBody(stream, [options], [callback])
|
||||
|
||||
**Returns a promise if no callback specified and global `Promise` exists.**
|
||||
|
||||
Options:
|
||||
|
||||
- `length` - The length of the stream.
|
||||
If the contents of the stream do not add up to this length,
|
||||
an `400` error code is returned.
|
||||
- `limit` - The byte limit of the body.
|
||||
This is the number of bytes or any string format supported by
|
||||
[bytes](https://www.npmjs.com/package/bytes),
|
||||
for example `1000`, `'500kb'` or `'3mb'`.
|
||||
If the body ends up being larger than this limit,
|
||||
a `413` error code is returned.
|
||||
- `encoding` - The encoding to use to decode the body into a string.
|
||||
By default, a `Buffer` instance will be returned when no encoding is specified.
|
||||
Most likely, you want `utf-8`, so setting `encoding` to `true` will decode as `utf-8`.
|
||||
You can use any type of encoding supported by [iconv-lite](https://www.npmjs.org/package/iconv-lite#readme).
|
||||
|
||||
You can also pass a string in place of options to just specify the encoding.
|
||||
|
||||
If an error occurs, the stream will be paused, everything unpiped,
|
||||
and you are responsible for correctly disposing the stream.
|
||||
For HTTP requests, you may need to finish consuming the stream if
|
||||
you want to keep the socket open for future requests. For streams
|
||||
that use file descriptors, you should `stream.destroy()` or
|
||||
`stream.close()` to prevent leaks.
|
||||
|
||||
## Errors
|
||||
|
||||
This module creates errors depending on the error condition during reading.
|
||||
The error may be an error from the underlying Node.js implementation, but is
|
||||
otherwise an error created by this module, which has the following attributes:
|
||||
|
||||
* `limit` - the limit in bytes
|
||||
* `length` and `expected` - the expected length of the stream
|
||||
* `received` - the received bytes
|
||||
* `encoding` - the invalid encoding
|
||||
* `status` and `statusCode` - the corresponding status code for the error
|
||||
* `type` - the error type
|
||||
|
||||
### Types
|
||||
|
||||
The errors from this module have a `type` property which allows for the programmatic
|
||||
determination of the type of error returned.
|
||||
|
||||
#### encoding.unsupported
|
||||
|
||||
This error will occur when the `encoding` option is specified, but the value does
|
||||
not map to an encoding supported by the [iconv-lite](https://www.npmjs.org/package/iconv-lite#readme)
|
||||
module.
|
||||
|
||||
#### entity.too.large
|
||||
|
||||
This error will occur when the `limit` option is specified, but the stream has
|
||||
an entity that is larger.
|
||||
|
||||
#### request.aborted
|
||||
|
||||
This error will occur when the request stream is aborted by the client before
|
||||
reading the body has finished.
|
||||
|
||||
#### request.size.invalid
|
||||
|
||||
This error will occur when the `length` option is specified, but the stream has
|
||||
emitted more bytes.
|
||||
|
||||
#### stream.encoding.set
|
||||
|
||||
This error will occur when the given stream has an encoding set on it, making it
|
||||
a decoded stream. The stream should not have an encoding set and is expected to
|
||||
emit `Buffer` objects.
|
||||
|
||||
#### stream.not.readable
|
||||
|
||||
This error will occur when the given stream is not readable.
|
||||
|
||||
## Examples
|
||||
|
||||
### Simple Express example
|
||||
|
||||
```js
|
||||
var contentType = require('content-type')
|
||||
var express = require('express')
|
||||
var getRawBody = require('raw-body')
|
||||
|
||||
var app = express()
|
||||
|
||||
app.use(function (req, res, next) {
|
||||
getRawBody(req, {
|
||||
length: req.headers['content-length'],
|
||||
limit: '1mb',
|
||||
encoding: contentType.parse(req).parameters.charset
|
||||
}, function (err, string) {
|
||||
if (err) return next(err)
|
||||
req.text = string
|
||||
next()
|
||||
})
|
||||
})
|
||||
|
||||
// now access req.text
|
||||
```
|
||||
|
||||
### Simple Koa example
|
||||
|
||||
```js
|
||||
var contentType = require('content-type')
|
||||
var getRawBody = require('raw-body')
|
||||
var koa = require('koa')
|
||||
|
||||
var app = koa()
|
||||
|
||||
app.use(function * (next) {
|
||||
this.text = yield getRawBody(this.req, {
|
||||
length: this.req.headers['content-length'],
|
||||
limit: '1mb',
|
||||
encoding: contentType.parse(this.req).parameters.charset
|
||||
})
|
||||
yield next
|
||||
})
|
||||
|
||||
// now access this.text
|
||||
```
|
||||
|
||||
### Using as a promise
|
||||
|
||||
To use this library as a promise, simply omit the `callback` and a promise is
|
||||
returned, provided that a global `Promise` is defined.
|
||||
|
||||
```js
|
||||
var getRawBody = require('raw-body')
|
||||
var http = require('http')
|
||||
|
||||
var server = http.createServer(function (req, res) {
|
||||
getRawBody(req)
|
||||
.then(function (buf) {
|
||||
res.statusCode = 200
|
||||
res.end(buf.length + ' bytes submitted')
|
||||
})
|
||||
.catch(function (err) {
|
||||
res.statusCode = 500
|
||||
res.end(err.message)
|
||||
})
|
||||
})
|
||||
|
||||
server.listen(3000)
|
||||
```
|
||||
|
||||
### Using with TypeScript
|
||||
|
||||
```ts
|
||||
import * as getRawBody from 'raw-body';
|
||||
import * as http from 'http';
|
||||
|
||||
const server = http.createServer((req, res) => {
|
||||
getRawBody(req)
|
||||
.then((buf) => {
|
||||
res.statusCode = 200;
|
||||
res.end(buf.length + ' bytes submitted');
|
||||
})
|
||||
.catch((err) => {
|
||||
res.statusCode = err.statusCode;
|
||||
res.end(err.message);
|
||||
});
|
||||
});
|
||||
|
||||
server.listen(3000);
|
||||
```
|
||||
|
||||
## License
|
||||
|
||||
[MIT](LICENSE)
|
||||
|
||||
[npm-image]: https://img.shields.io/npm/v/raw-body.svg
|
||||
[npm-url]: https://npmjs.org/package/raw-body
|
||||
[node-version-image]: https://img.shields.io/node/v/raw-body.svg
|
||||
[node-version-url]: https://nodejs.org/en/download/
|
||||
[coveralls-image]: https://img.shields.io/coveralls/stream-utils/raw-body/master.svg
|
||||
[coveralls-url]: https://coveralls.io/r/stream-utils/raw-body?branch=master
|
||||
[downloads-image]: https://img.shields.io/npm/dm/raw-body.svg
|
||||
[downloads-url]: https://npmjs.org/package/raw-body
|
||||
[github-actions-ci-image]: https://img.shields.io/github/actions/workflow/status/stream-utils/raw-body/ci.yml?branch=master&label=ci
|
||||
[github-actions-ci-url]: https://github.com/jshttp/stream-utils/raw-body?query=workflow%3Aci
|
||||
@@ -0,0 +1,5 @@
|
||||
var convert = require('./convert'),
|
||||
func = convert('kebabCase', require('../kebabCase'), require('./_falseOptions'));
|
||||
|
||||
func.placeholder = require('./placeholder');
|
||||
module.exports = func;
|
||||
@@ -0,0 +1,49 @@
|
||||
{
|
||||
"name": "@octokit/graphql",
|
||||
"description": "GitHub GraphQL API client for browsers and Node",
|
||||
"version": "5.0.5",
|
||||
"license": "MIT",
|
||||
"files": [
|
||||
"dist-*/",
|
||||
"bin/"
|
||||
],
|
||||
"source": "dist-src/index.js",
|
||||
"types": "dist-types/index.d.ts",
|
||||
"main": "dist-node/index.js",
|
||||
"module": "dist-web/index.js",
|
||||
"pika": true,
|
||||
"sideEffects": false,
|
||||
"keywords": [
|
||||
"octokit",
|
||||
"github",
|
||||
"api",
|
||||
"graphql"
|
||||
],
|
||||
"repository": "github:octokit/graphql.js",
|
||||
"dependencies": {
|
||||
"@octokit/request": "^6.0.0",
|
||||
"@octokit/types": "^9.0.0",
|
||||
"universal-user-agent": "^6.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@pika/pack": "^0.3.7",
|
||||
"@pika/plugin-build-node": "^0.9.0",
|
||||
"@pika/plugin-build-web": "^0.9.0",
|
||||
"@pika/plugin-ts-standard-pkg": "^0.9.0",
|
||||
"@types/fetch-mock": "^7.2.5",
|
||||
"@types/jest": "^29.0.0",
|
||||
"@types/node": "^18.0.0",
|
||||
"fetch-mock": "^9.0.0",
|
||||
"jest": "^29.0.0",
|
||||
"prettier": "2.8.3",
|
||||
"semantic-release-plugin-update-version-in-files": "^1.0.0",
|
||||
"ts-jest": "^29.0.0",
|
||||
"typescript": "^4.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 14"
|
||||
},
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"scheduleArray.js","sourceRoot":"","sources":["../../../../src/internal/scheduled/scheduleArray.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAG3C,MAAM,UAAU,aAAa,CAAI,KAAmB,EAAE,SAAwB;IAC5E,OAAO,IAAI,UAAU,CAAI,UAAC,UAAU;QAElC,IAAI,CAAC,GAAG,CAAC,CAAC;QAEV,OAAO,SAAS,CAAC,QAAQ,CAAC;YACxB,IAAI,CAAC,KAAK,KAAK,CAAC,MAAM,EAAE;gBAGtB,UAAU,CAAC,QAAQ,EAAE,CAAC;aACvB;iBAAM;gBAGL,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;gBAI5B,IAAI,CAAC,UAAU,CAAC,MAAM,EAAE;oBACtB,IAAI,CAAC,QAAQ,EAAE,CAAC;iBACjB;aACF;QACH,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC"}
|
||||
@@ -0,0 +1,10 @@
|
||||
"use strict";
|
||||
|
||||
if (!require("./is-implemented")()) {
|
||||
Object.defineProperty(Math, "log10", {
|
||||
value: require("./shim"),
|
||||
configurable: true,
|
||||
enumerable: false,
|
||||
writable: true
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
var baseExtremum = require('./_baseExtremum'),
|
||||
baseGt = require('./_baseGt'),
|
||||
identity = require('./identity');
|
||||
|
||||
/**
|
||||
* Computes the maximum value of `array`. If `array` is empty or falsey,
|
||||
* `undefined` is returned.
|
||||
*
|
||||
* @static
|
||||
* @since 0.1.0
|
||||
* @memberOf _
|
||||
* @category Math
|
||||
* @param {Array} array The array to iterate over.
|
||||
* @returns {*} Returns the maximum value.
|
||||
* @example
|
||||
*
|
||||
* _.max([4, 2, 8, 6]);
|
||||
* // => 8
|
||||
*
|
||||
* _.max([]);
|
||||
* // => undefined
|
||||
*/
|
||||
function max(array) {
|
||||
return (array && array.length)
|
||||
? baseExtremum(array, identity, baseGt)
|
||||
: undefined;
|
||||
}
|
||||
|
||||
module.exports = max;
|
||||
@@ -0,0 +1,7 @@
|
||||
/**
|
||||
* Removes an item from an array, mutating it.
|
||||
* @param arr The array to remove the item from
|
||||
* @param item The item to remove
|
||||
*/
|
||||
export declare function arrRemove<T>(arr: T[] | undefined | null, item: T): void;
|
||||
//# sourceMappingURL=arrRemove.d.ts.map
|
||||
@@ -0,0 +1,8 @@
|
||||
// Strip ANSI formatting from string
|
||||
|
||||
"use strict";
|
||||
|
||||
var stringifiable = require("es5-ext/object/validate-stringifiable")
|
||||
, r = require("./regex-ansi")();
|
||||
|
||||
module.exports = function (str) { return stringifiable(str).replace(r, ""); };
|
||||
@@ -0,0 +1,11 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.config = void 0;
|
||||
exports.config = {
|
||||
onUnhandledError: null,
|
||||
onStoppedNotification: null,
|
||||
Promise: undefined,
|
||||
useDeprecatedSynchronousErrorHandling: false,
|
||||
useDeprecatedNextContext: false,
|
||||
};
|
||||
//# sourceMappingURL=config.js.map
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"distinctUntilKeyChanged.js","sourceRoot":"","sources":["../../../../src/internal/operators/distinctUntilKeyChanged.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAoE9D,MAAM,UAAU,uBAAuB,CAAuB,GAAM,EAAE,OAAuC;IAC3G,OAAO,oBAAoB,CAAC,UAAC,CAAI,EAAE,CAAI,IAAK,OAAA,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,EAArD,CAAqD,CAAC,CAAC;AACrG,CAAC"}
|
||||
@@ -0,0 +1,44 @@
|
||||
/**
|
||||
* This function takes one parameter and just returns it. Simply put,
|
||||
* this is like `<T>(x: T): T => x`.
|
||||
*
|
||||
* ## Examples
|
||||
*
|
||||
* This is useful in some cases when using things like `mergeMap`
|
||||
*
|
||||
* ```ts
|
||||
* import { interval, take, map, range, mergeMap, identity } from 'rxjs';
|
||||
*
|
||||
* const source$ = interval(1000).pipe(take(5));
|
||||
*
|
||||
* const result$ = source$.pipe(
|
||||
* map(i => range(i)),
|
||||
* mergeMap(identity) // same as mergeMap(x => x)
|
||||
* );
|
||||
*
|
||||
* result$.subscribe({
|
||||
* next: console.log
|
||||
* });
|
||||
* ```
|
||||
*
|
||||
* Or when you want to selectively apply an operator
|
||||
*
|
||||
* ```ts
|
||||
* import { interval, take, identity } from 'rxjs';
|
||||
*
|
||||
* const shouldLimit = () => Math.random() < 0.5;
|
||||
*
|
||||
* const source$ = interval(1000);
|
||||
*
|
||||
* const result$ = source$.pipe(shouldLimit() ? take(5) : identity);
|
||||
*
|
||||
* result$.subscribe({
|
||||
* next: console.log
|
||||
* });
|
||||
* ```
|
||||
*
|
||||
* @param x Any value that is returned by this function
|
||||
* @returns The value passed as the first parameter to this function
|
||||
*/
|
||||
export declare function identity<T>(x: T): T;
|
||||
//# sourceMappingURL=identity.d.ts.map
|
||||
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"root": true,
|
||||
|
||||
"extends": "@ljharb",
|
||||
|
||||
"rules": {
|
||||
"id-length": [2, { "min": 1, "max": 25 }],
|
||||
"operator-linebreak": [2, "after"]
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,160 @@
|
||||
/**
|
||||
* Response.js
|
||||
*
|
||||
* Response class provides content decoding
|
||||
*/
|
||||
|
||||
import Headers from './headers.js';
|
||||
import Body, {clone, extractContentType} from './body.js';
|
||||
import {isRedirect} from './utils/is-redirect.js';
|
||||
|
||||
const INTERNALS = Symbol('Response internals');
|
||||
|
||||
/**
|
||||
* Response class
|
||||
*
|
||||
* Ref: https://fetch.spec.whatwg.org/#response-class
|
||||
*
|
||||
* @param Stream body Readable stream
|
||||
* @param Object opts Response options
|
||||
* @return Void
|
||||
*/
|
||||
export default class Response extends Body {
|
||||
constructor(body = null, options = {}) {
|
||||
super(body, options);
|
||||
|
||||
// eslint-disable-next-line no-eq-null, eqeqeq, no-negated-condition
|
||||
const status = options.status != null ? options.status : 200;
|
||||
|
||||
const headers = new Headers(options.headers);
|
||||
|
||||
if (body !== null && !headers.has('Content-Type')) {
|
||||
const contentType = extractContentType(body, this);
|
||||
if (contentType) {
|
||||
headers.append('Content-Type', contentType);
|
||||
}
|
||||
}
|
||||
|
||||
this[INTERNALS] = {
|
||||
type: 'default',
|
||||
url: options.url,
|
||||
status,
|
||||
statusText: options.statusText || '',
|
||||
headers,
|
||||
counter: options.counter,
|
||||
highWaterMark: options.highWaterMark
|
||||
};
|
||||
}
|
||||
|
||||
get type() {
|
||||
return this[INTERNALS].type;
|
||||
}
|
||||
|
||||
get url() {
|
||||
return this[INTERNALS].url || '';
|
||||
}
|
||||
|
||||
get status() {
|
||||
return this[INTERNALS].status;
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience property representing if the request ended normally
|
||||
*/
|
||||
get ok() {
|
||||
return this[INTERNALS].status >= 200 && this[INTERNALS].status < 300;
|
||||
}
|
||||
|
||||
get redirected() {
|
||||
return this[INTERNALS].counter > 0;
|
||||
}
|
||||
|
||||
get statusText() {
|
||||
return this[INTERNALS].statusText;
|
||||
}
|
||||
|
||||
get headers() {
|
||||
return this[INTERNALS].headers;
|
||||
}
|
||||
|
||||
get highWaterMark() {
|
||||
return this[INTERNALS].highWaterMark;
|
||||
}
|
||||
|
||||
/**
|
||||
* Clone this response
|
||||
*
|
||||
* @return Response
|
||||
*/
|
||||
clone() {
|
||||
return new Response(clone(this, this.highWaterMark), {
|
||||
type: this.type,
|
||||
url: this.url,
|
||||
status: this.status,
|
||||
statusText: this.statusText,
|
||||
headers: this.headers,
|
||||
ok: this.ok,
|
||||
redirected: this.redirected,
|
||||
size: this.size,
|
||||
highWaterMark: this.highWaterMark
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string} url The URL that the new response is to originate from.
|
||||
* @param {number} status An optional status code for the response (e.g., 302.)
|
||||
* @returns {Response} A Response object.
|
||||
*/
|
||||
static redirect(url, status = 302) {
|
||||
if (!isRedirect(status)) {
|
||||
throw new RangeError('Failed to execute "redirect" on "response": Invalid status code');
|
||||
}
|
||||
|
||||
return new Response(null, {
|
||||
headers: {
|
||||
location: new URL(url).toString()
|
||||
},
|
||||
status
|
||||
});
|
||||
}
|
||||
|
||||
static error() {
|
||||
const response = new Response(null, {status: 0, statusText: ''});
|
||||
response[INTERNALS].type = 'error';
|
||||
return response;
|
||||
}
|
||||
|
||||
static json(data = undefined, init = {}) {
|
||||
const body = JSON.stringify(data);
|
||||
|
||||
if (body === undefined) {
|
||||
throw new TypeError('data is not JSON serializable');
|
||||
}
|
||||
|
||||
const headers = new Headers(init && init.headers);
|
||||
|
||||
if (!headers.has('content-type')) {
|
||||
headers.set('content-type', 'application/json');
|
||||
}
|
||||
|
||||
return new Response(body, {
|
||||
...init,
|
||||
headers
|
||||
});
|
||||
}
|
||||
|
||||
get [Symbol.toStringTag]() {
|
||||
return 'Response';
|
||||
}
|
||||
}
|
||||
|
||||
Object.defineProperties(Response.prototype, {
|
||||
type: {enumerable: true},
|
||||
url: {enumerable: true},
|
||||
status: {enumerable: true},
|
||||
ok: {enumerable: true},
|
||||
redirected: {enumerable: true},
|
||||
statusText: {enumerable: true},
|
||||
headers: {enumerable: true},
|
||||
clone: {enumerable: true}
|
||||
});
|
||||
@@ -0,0 +1,3 @@
|
||||
"use strict";
|
||||
|
||||
module.exports = require("./lib/methods")(require("./plain"));
|
||||
@@ -0,0 +1,209 @@
|
||||
v3.9.14 (2023-02-05)
|
||||
--------------------
|
||||
[new] Support conditional export resolution with custom resolver. (nick-klaviyo)
|
||||
|
||||
v3.9.13 (2022-12-08)
|
||||
--------------------
|
||||
[fix] Fix typescript errors in index.d.ts
|
||||
|
||||
v3.9.12 (2022-11-29)
|
||||
--------------------
|
||||
[new] Add file system API.
|
||||
[fix] Fix parsing error with object pattern in catch clause.
|
||||
|
||||
v3.9.11 (2022-08-28)
|
||||
--------------------
|
||||
[new] Add option `require.strict` to allow to load required modules in non strict mode.
|
||||
[fix] Security fix.
|
||||
|
||||
v3.9.10 (2022-07-05)
|
||||
-------------------
|
||||
[new] Add uptime to process.
|
||||
[fix] Security fix.
|
||||
[fix] Fix inspection with showProxy.
|
||||
|
||||
v3.9.9 (2022-02-24)
|
||||
-------------------
|
||||
[fix] Bump parser ECMA version to 2022.
|
||||
|
||||
v3.9.8 (2022-02-16)
|
||||
-------------------
|
||||
[fix] Add function type check for arguments, caller, and callee property check (GeoffRen)
|
||||
[fix] Fix find best extension handler
|
||||
|
||||
v3.9.7 (2022-02-10)
|
||||
-------------------
|
||||
[fix] Allow relative require from base script
|
||||
[fix] Fix issue with modules with exports clause in package JSON
|
||||
[fix] Added missing whitelist check before custom require
|
||||
[fix] Revert plain object toString behavior
|
||||
[fix] Root path check improved
|
||||
|
||||
v3.9.6 (2022-02-08)
|
||||
-------------------
|
||||
[fix] Security fixes (XmiliaH)
|
||||
|
||||
v3.9.5 (2021-10-17)
|
||||
-------------------
|
||||
[new] Editor config (aubelsb2)
|
||||
[fix] Fix for Promise.then breaking
|
||||
[fix] Fix for missing properties on CallSite
|
||||
|
||||
v3.9.4 (2021-10-12)
|
||||
-------------------
|
||||
[new] Added strict option
|
||||
[fix] Security fixes (XmiliaH)
|
||||
[fix] Fixed bound function causes TypeError (XmiliaH)
|
||||
[fix] Allow extending of frozen objects
|
||||
|
||||
v3.9.3 (2020-04-07)
|
||||
-------------------
|
||||
[fix] Security fixes
|
||||
[fix] Fixed problems when Promise object is deleted (XmiliaH)
|
||||
[fix] Fixed oversight that write ability can change on non configurable properties (XmiliaH)
|
||||
[fix] Support shebang as node does (XmiliaH)
|
||||
[fix] Property typos (Shigma)
|
||||
|
||||
|
||||
v3.9.2 (2020-04-29)
|
||||
-------------------
|
||||
[new] Added NodeVM options to pass argv & env to process object (XmiliaH)
|
||||
[fix] Fixed breakouts in NodeVM (XmiliaH)
|
||||
[fix] Made async check more robust (XmiliaH)
|
||||
|
||||
v3.9.1 (2020-03-29)
|
||||
-------------------
|
||||
[fix] Require helpers statically in main (XmiliaH)
|
||||
[fix] Fix for non-configurable property access (XmiliaH)
|
||||
|
||||
v3.9.0 (2020-03-21)
|
||||
-------------------
|
||||
[new] Added vm.Script `lineOffset` and `columnOffset` options (azu)
|
||||
[new] Allow to specify a compiler per VMScript (XmiliaH)
|
||||
[new] Add option to disable async (XmiliaH)
|
||||
[new] Added allot of jsdoc (XmiliaH)
|
||||
[fix] Fix access to frozen or unconfigurable properties (XmiliaH)
|
||||
[fix] Double wrap Objects to prevent breakout via inspect (XmiliaH)
|
||||
[fix] Compile now compiles VM code (XmiliaH)
|
||||
|
||||
v3.8.4 (2019-09-13)
|
||||
-------------------
|
||||
[fix] Do not allow precompiling VMScript (XmiliaH)
|
||||
[fix] Security fixes (XmiliaH)
|
||||
|
||||
v3.8.3 (2019-07-31)
|
||||
-------------------
|
||||
[fix] Security fixes
|
||||
|
||||
v3.8.2 (2019-06-13)
|
||||
-------------------
|
||||
[fix] toString() on builtin objects
|
||||
|
||||
v3.8.1 (2019-05-02)
|
||||
-------------------
|
||||
[fix] Module resolver fixes
|
||||
[fix] require('events') works correctly in Node 12
|
||||
[fix] SyntaxError not being instanceOf Error
|
||||
|
||||
v3.8.0 (2019-04-21)
|
||||
-------------------
|
||||
[new] Allow prohibiting access to eval/wasm in sandbox context
|
||||
[new] Allow transitive external dependencies in sandbox context (Idan Attias)
|
||||
[new] Allow using wildcards in module-names passed using the external attribute (Harel Moshe)
|
||||
[fix] Default to index.js when specified "main" does not exist (Harel Moshe)
|
||||
[fix] Security fixes
|
||||
|
||||
v3.7.0 (2019-04-15)
|
||||
-------------------
|
||||
[new] Add require.resolve (Idan Attias)
|
||||
[new] Support multiple root paths (Idan Attias)
|
||||
|
||||
v3.6.11 (2019-04-08)
|
||||
-------------------
|
||||
[fix] Contextification of EvalError and URIError
|
||||
[fix] Security fixes
|
||||
|
||||
v3.6.10 (2019-01-28)
|
||||
-------------------
|
||||
[fix] Add missing console.debug function in NodeVM
|
||||
[fix] Security fixes
|
||||
|
||||
v3.6.9 (2019-01-26)
|
||||
-------------------
|
||||
[fix] Security fixes
|
||||
|
||||
v3.6.8 (2019-01-26)
|
||||
-------------------
|
||||
[fix] Security fixes
|
||||
|
||||
v3.6.7 (2019-01-26)
|
||||
-------------------
|
||||
[fix] Security fixes
|
||||
|
||||
v3.6.6 (2019-01-01)
|
||||
-------------------
|
||||
[fix] Security fixes
|
||||
|
||||
v3.6.5 (2018-12-31)
|
||||
-------------------
|
||||
[fix] Security fixes
|
||||
|
||||
v3.6.4 (2018-10-17)
|
||||
-------------------
|
||||
[fix] Added new to vmwerror when trying to load coffeescipt but can't (dotconnor)
|
||||
[fix] Add arguments to process.nextTick proxy (Patrick Engström)
|
||||
|
||||
v3.6.3 (2018-08-06)
|
||||
-------------------
|
||||
[fix] Security fixes
|
||||
|
||||
v3.6.2 (2018-07-05)
|
||||
-------------------
|
||||
[fix] Security fixes
|
||||
|
||||
v3.6.1 (2018-06-27)
|
||||
-------------------
|
||||
[fix] Security fixes
|
||||
|
||||
v3.6.0 (2018-05-11)
|
||||
-------------------
|
||||
[new] Support for custom source extensions
|
||||
[new] WIP support for disallowing Promise
|
||||
[fix] Prevent slow unsafe alloc for Buffers
|
||||
[fix] Refactors around defaults
|
||||
[fix] Types definition update
|
||||
|
||||
v3.5.2 (2017-10-04)
|
||||
-------------------
|
||||
[fix] Prevent slow unsafe alloc for Buffers
|
||||
|
||||
v3.5.1 (2017-10-04)
|
||||
-------------------
|
||||
[fix] Prevent unsafe alloc for Buffers
|
||||
|
||||
v3.5.0 (2017-08-31)
|
||||
-------------------
|
||||
[new] Allow a custom compiler to receive the filetype (Orta Therox)
|
||||
[new] Allow in-sandbox requires to also get called through the compiler (Orta Therox)
|
||||
[new] Support whitelisting modules inside a VM (Orta Therox)
|
||||
[new] Add TypeScript definition (Orta Therox)
|
||||
|
||||
v3.4.0 (2017-03-28)
|
||||
-------------------
|
||||
[new] Added experimental VM.protect method
|
||||
|
||||
v3.3.1 (2017-03-27)
|
||||
-------------------
|
||||
[new] Added VM.freeze method
|
||||
|
||||
v3.2.0 (2017-02-10)
|
||||
-------------------
|
||||
[new] Added support for pre-compiled scripts via VMScript
|
||||
|
||||
v3.1.0 (2016-09-03)
|
||||
-------------------
|
||||
[new] Added option wrapper (Alizain Feerasta)
|
||||
|
||||
v3.0.1 (2016-07-20)
|
||||
-------------------
|
||||
Initial release
|
||||
@@ -0,0 +1,2 @@
|
||||
if(typeof cptable === 'undefined') cptable = {};
|
||||
cptable[1144] = (function(){ var d = "\u0000\u0001\u0002\u0003\t\u000b\f\r\u000e\u000f\u0010\u0011\u0012\u0013
\b\u0018\u0019\u001c\u001d\u001e\u001f\n\u0017\u001b\u0005\u0006\u0007\u0016\u0004\u0014\u0015\u001a âä{áãå\\ñ°.<(+!&]êë}íîï~ßé$*);^-/ÂÄÀÁÃÅÇÑò,%_>?øÉÊËÈÍÎÏÌù:£§'=\"Øabcdefghi«»ðýþ±[jklmnopqrªºæ¸Æ€µìstuvwxyz¡¿ÐÝÞ®¢#¥·©@¶¼½¾¬|¯¨´×àABCDEFGHIôö¦óõèJKLMNOPQR¹ûü`úÿç÷STUVWXYZ²ÔÖÒÓÕ0123456789³ÛÜÙÚ", D = [], e = {}; for(var i=0;i!=d.length;++i) { if(d.charCodeAt(i) !== 0xFFFD) e[d.charAt(i)] = i; D[i] = d.charAt(i); } return {"enc": e, "dec": D }; })();
|
||||
@@ -0,0 +1,68 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.StatsClientService = void 0;
|
||||
const request_1 = require("../core/request");
|
||||
class StatsClientService {
|
||||
/**
|
||||
* Get all
|
||||
* Lists all stats clients. Please remember that the key can only be viewed on creation.
|
||||
* @result ResponseStatsClient
|
||||
* @throws ApiError
|
||||
*/
|
||||
static async statsClientControllerGetAll() {
|
||||
const result = await (0, request_1.request)({
|
||||
method: 'GET',
|
||||
path: `/api/statsclients`,
|
||||
});
|
||||
return result.body;
|
||||
}
|
||||
/**
|
||||
* Post
|
||||
* Create a new stats client. <br> Please remember that the client's key will be generated automaticly and that it can only be viewed on creation.
|
||||
* @param requestBody CreateStatsClient
|
||||
* @result ResponseStatsClient
|
||||
* @throws ApiError
|
||||
*/
|
||||
static async statsClientControllerPost(requestBody) {
|
||||
const result = await (0, request_1.request)({
|
||||
method: 'POST',
|
||||
path: `/api/statsclients`,
|
||||
body: requestBody,
|
||||
});
|
||||
return result.body;
|
||||
}
|
||||
/**
|
||||
* Get one
|
||||
* Lists all information about the stats client whose id got provided. Please remember that the key can only be viewed on creation.
|
||||
* @param id
|
||||
* @result ResponseStatsClient
|
||||
* @throws ApiError
|
||||
*/
|
||||
static async statsClientControllerGetOne(id) {
|
||||
const result = await (0, request_1.request)({
|
||||
method: 'GET',
|
||||
path: `/api/statsclients/${id}`,
|
||||
});
|
||||
return result.body;
|
||||
}
|
||||
/**
|
||||
* Remove
|
||||
* Delete the stats client whose id you provided. <br> If no client with this id exists it will just return 204(no content).
|
||||
* @param id
|
||||
* @param force
|
||||
* @result ResponseStatsClient
|
||||
* @result ResponseEmpty
|
||||
* @throws ApiError
|
||||
*/
|
||||
static async statsClientControllerRemove(id, force) {
|
||||
const result = await (0, request_1.request)({
|
||||
method: 'DELETE',
|
||||
path: `/api/statsclients/${id}`,
|
||||
query: {
|
||||
'force': force,
|
||||
},
|
||||
});
|
||||
return result.body;
|
||||
}
|
||||
}
|
||||
exports.StatsClientService = StatsClientService;
|
||||
@@ -0,0 +1,2 @@
|
||||
export default function(t,e,l,n,r){for(e=e.split?e.split("."):e,n=0;n<e.length;n++)t=t?t[e[n]]:r;return t===r?l:t}
|
||||
//# sourceMappingURL=dlv.es.js.map
|
||||
@@ -0,0 +1,35 @@
|
||||
var root = require('./_root');
|
||||
|
||||
/** Detect free variable `exports`. */
|
||||
var freeExports = typeof exports == 'object' && exports && !exports.nodeType && exports;
|
||||
|
||||
/** Detect free variable `module`. */
|
||||
var freeModule = freeExports && typeof module == 'object' && module && !module.nodeType && module;
|
||||
|
||||
/** Detect the popular CommonJS extension `module.exports`. */
|
||||
var moduleExports = freeModule && freeModule.exports === freeExports;
|
||||
|
||||
/** Built-in value references. */
|
||||
var Buffer = moduleExports ? root.Buffer : undefined,
|
||||
allocUnsafe = Buffer ? Buffer.allocUnsafe : undefined;
|
||||
|
||||
/**
|
||||
* Creates a clone of `buffer`.
|
||||
*
|
||||
* @private
|
||||
* @param {Buffer} buffer The buffer to clone.
|
||||
* @param {boolean} [isDeep] Specify a deep clone.
|
||||
* @returns {Buffer} Returns the cloned buffer.
|
||||
*/
|
||||
function cloneBuffer(buffer, isDeep) {
|
||||
if (isDeep) {
|
||||
return buffer.slice();
|
||||
}
|
||||
var length = buffer.length,
|
||||
result = allocUnsafe ? allocUnsafe(length) : new buffer.constructor(length);
|
||||
|
||||
buffer.copy(result);
|
||||
return result;
|
||||
}
|
||||
|
||||
module.exports = cloneBuffer;
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"index.js","sources":["../dist-src/index.js"],"sourcesContent":["import { Deprecation } from \"deprecation\";\nimport once from \"once\";\nconst logOnceCode = once((deprecation) => console.warn(deprecation));\nconst logOnceHeaders = once((deprecation) => console.warn(deprecation));\n/**\n * Error with extra properties to help with debugging\n */\nexport class RequestError extends Error {\n constructor(message, statusCode, options) {\n super(message);\n // Maintains proper stack trace (only available on V8)\n /* istanbul ignore next */\n if (Error.captureStackTrace) {\n Error.captureStackTrace(this, this.constructor);\n }\n this.name = \"HttpError\";\n this.status = statusCode;\n let headers;\n if (\"headers\" in options && typeof options.headers !== \"undefined\") {\n headers = options.headers;\n }\n if (\"response\" in options) {\n this.response = options.response;\n headers = options.response.headers;\n }\n // redact request credentials without mutating original request options\n const requestCopy = Object.assign({}, options.request);\n if (options.request.headers.authorization) {\n requestCopy.headers = Object.assign({}, options.request.headers, {\n authorization: options.request.headers.authorization.replace(/ .*$/, \" [REDACTED]\"),\n });\n }\n requestCopy.url = requestCopy.url\n // client_id & client_secret can be passed as URL query parameters to increase rate limit\n // see https://developer.github.com/v3/#increasing-the-unauthenticated-rate-limit-for-oauth-applications\n .replace(/\\bclient_secret=\\w+/g, \"client_secret=[REDACTED]\")\n // OAuth tokens can be passed as URL query parameters, although it is not recommended\n // see https://developer.github.com/v3/#oauth2-token-sent-in-a-header\n .replace(/\\baccess_token=\\w+/g, \"access_token=[REDACTED]\");\n this.request = requestCopy;\n // deprecations\n Object.defineProperty(this, \"code\", {\n get() {\n logOnceCode(new Deprecation(\"[@octokit/request-error] `error.code` is deprecated, use `error.status`.\"));\n return statusCode;\n },\n });\n Object.defineProperty(this, \"headers\", {\n get() {\n logOnceHeaders(new Deprecation(\"[@octokit/request-error] `error.headers` is deprecated, use `error.response.headers`.\"));\n return headers || {};\n },\n });\n }\n}\n"],"names":["logOnceCode","once","deprecation","console","warn","logOnceHeaders","RequestError","Error","constructor","message","statusCode","options","captureStackTrace","name","status","headers","response","requestCopy","Object","assign","request","authorization","replace","url","defineProperty","get","Deprecation"],"mappings":";;;;;;;;;AAEA,MAAMA,WAAW,GAAGC,IAAI,CAAEC,WAAW,IAAKC,OAAO,CAACC,IAAI,CAACF,WAAW,CAAC,CAAC;AACpE,MAAMG,cAAc,GAAGJ,IAAI,CAAEC,WAAW,IAAKC,OAAO,CAACC,IAAI,CAACF,WAAW,CAAC,CAAC;AACvE;AACA;AACA;AACO,MAAMI,YAAY,SAASC,KAAK,CAAC;EACpCC,WAAW,CAACC,OAAO,EAAEC,UAAU,EAAEC,OAAO,EAAE;IACtC,KAAK,CAACF,OAAO,CAAC;;;IAGd,IAAIF,KAAK,CAACK,iBAAiB,EAAE;MACzBL,KAAK,CAACK,iBAAiB,CAAC,IAAI,EAAE,IAAI,CAACJ,WAAW,CAAC;;IAEnD,IAAI,CAACK,IAAI,GAAG,WAAW;IACvB,IAAI,CAACC,MAAM,GAAGJ,UAAU;IACxB,IAAIK,OAAO;IACX,IAAI,SAAS,IAAIJ,OAAO,IAAI,OAAOA,OAAO,CAACI,OAAO,KAAK,WAAW,EAAE;MAChEA,OAAO,GAAGJ,OAAO,CAACI,OAAO;;IAE7B,IAAI,UAAU,IAAIJ,OAAO,EAAE;MACvB,IAAI,CAACK,QAAQ,GAAGL,OAAO,CAACK,QAAQ;MAChCD,OAAO,GAAGJ,OAAO,CAACK,QAAQ,CAACD,OAAO;;;IAGtC,MAAME,WAAW,GAAGC,MAAM,CAACC,MAAM,CAAC,EAAE,EAAER,OAAO,CAACS,OAAO,CAAC;IACtD,IAAIT,OAAO,CAACS,OAAO,CAACL,OAAO,CAACM,aAAa,EAAE;MACvCJ,WAAW,CAACF,OAAO,GAAGG,MAAM,CAACC,MAAM,CAAC,EAAE,EAAER,OAAO,CAACS,OAAO,CAACL,OAAO,EAAE;QAC7DM,aAAa,EAAEV,OAAO,CAACS,OAAO,CAACL,OAAO,CAACM,aAAa,CAACC,OAAO,CAAC,MAAM,EAAE,aAAa;OACrF,CAAC;;IAENL,WAAW,CAACM,GAAG,GAAGN,WAAW,CAACM;;;KAGzBD,OAAO,CAAC,sBAAsB,EAAE,0BAA0B;;;KAG1DA,OAAO,CAAC,qBAAqB,EAAE,yBAAyB,CAAC;IAC9D,IAAI,CAACF,OAAO,GAAGH,WAAW;;IAE1BC,MAAM,CAACM,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE;MAChCC,GAAG,GAAG;QACFzB,WAAW,CAAC,IAAI0B,uBAAW,CAAC,0EAA0E,CAAC,CAAC;QACxG,OAAOhB,UAAU;;KAExB,CAAC;IACFQ,MAAM,CAACM,cAAc,CAAC,IAAI,EAAE,SAAS,EAAE;MACnCC,GAAG,GAAG;QACFpB,cAAc,CAAC,IAAIqB,uBAAW,CAAC,uFAAuF,CAAC,CAAC;QACxH,OAAOX,OAAO,IAAI,EAAE;;KAE3B,CAAC;;AAEV;;;;"}
|
||||
@@ -0,0 +1,269 @@
|
||||
declare const figureSet: {
|
||||
readonly tick: string;
|
||||
readonly info: string;
|
||||
readonly warning: string;
|
||||
readonly cross: string;
|
||||
readonly square: string;
|
||||
readonly squareSmall: string;
|
||||
readonly squareSmallFilled: string;
|
||||
readonly squareDarkShade: string;
|
||||
readonly squareMediumShade: string;
|
||||
readonly squareLightShade: string;
|
||||
readonly squareTop: string;
|
||||
readonly squareBottom: string;
|
||||
readonly squareLeft: string;
|
||||
readonly squareRight: string;
|
||||
readonly squareCenter: string;
|
||||
readonly circle: string;
|
||||
readonly circleFilled: string;
|
||||
readonly circleDotted: string;
|
||||
readonly circleDouble: string;
|
||||
readonly circleCircle: string;
|
||||
readonly circleCross: string;
|
||||
readonly circlePipe: string;
|
||||
readonly circleQuestionMark: string;
|
||||
readonly radioOn: string;
|
||||
readonly radioOff: string;
|
||||
readonly checkboxOn: string;
|
||||
readonly checkboxOff: string;
|
||||
readonly checkboxCircleOn: string;
|
||||
readonly checkboxCircleOff: string;
|
||||
readonly questionMarkPrefix: string;
|
||||
readonly bullet: string;
|
||||
readonly dot: string;
|
||||
readonly ellipsis: string;
|
||||
readonly pointer: string;
|
||||
readonly pointerSmall: string;
|
||||
readonly triangleUp: string;
|
||||
readonly triangleUpSmall: string;
|
||||
readonly triangleUpOutline: string;
|
||||
readonly triangleDown: string;
|
||||
readonly triangleDownSmall: string;
|
||||
readonly triangleLeft: string;
|
||||
readonly triangleLeftSmall: string;
|
||||
readonly triangleRight: string;
|
||||
readonly triangleRightSmall: string;
|
||||
readonly lozenge: string;
|
||||
readonly lozengeOutline: string;
|
||||
readonly home: string;
|
||||
readonly hamburger: string;
|
||||
readonly smiley: string;
|
||||
readonly mustache: string;
|
||||
readonly heart: string;
|
||||
readonly star: string;
|
||||
readonly play: string;
|
||||
readonly musicNote: string;
|
||||
readonly musicNoteBeamed: string;
|
||||
readonly nodejs: string;
|
||||
readonly arrowUp: string;
|
||||
readonly arrowDown: string;
|
||||
readonly arrowLeft: string;
|
||||
readonly arrowRight: string;
|
||||
readonly arrowLeftRight: string;
|
||||
readonly arrowUpDown: string;
|
||||
readonly almostEqual: string;
|
||||
readonly notEqual: string;
|
||||
readonly lessOrEqual: string;
|
||||
readonly greaterOrEqual: string;
|
||||
readonly identical: string;
|
||||
readonly infinity: string;
|
||||
readonly subscriptZero: string;
|
||||
readonly subscriptOne: string;
|
||||
readonly subscriptTwo: string;
|
||||
readonly subscriptThree: string;
|
||||
readonly subscriptFour: string;
|
||||
readonly subscriptFive: string;
|
||||
readonly subscriptSix: string;
|
||||
readonly subscriptSeven: string;
|
||||
readonly subscriptEight: string;
|
||||
readonly subscriptNine: string;
|
||||
readonly oneHalf: string;
|
||||
readonly oneThird: string;
|
||||
readonly oneQuarter: string;
|
||||
readonly oneFifth: string;
|
||||
readonly oneSixth: string;
|
||||
readonly oneSeventh: string;
|
||||
readonly oneEighth: string;
|
||||
readonly oneNinth: string;
|
||||
readonly oneTenth: string;
|
||||
readonly twoThirds: string;
|
||||
readonly twoFifths: string;
|
||||
readonly threeQuarters: string;
|
||||
readonly threeFifths: string;
|
||||
readonly threeEighths: string;
|
||||
readonly fourFifths: string;
|
||||
readonly fiveSixths: string;
|
||||
readonly fiveEighths: string;
|
||||
readonly sevenEighth: string;
|
||||
readonly line: string;
|
||||
readonly lineBold: string;
|
||||
readonly lineDouble: string;
|
||||
readonly lineDashed0: string;
|
||||
readonly lineDashed1: string;
|
||||
readonly lineDashed2: string;
|
||||
readonly lineDashed3: string;
|
||||
readonly lineDashed4: string;
|
||||
readonly lineDashed5: string;
|
||||
readonly lineDashed6: string;
|
||||
readonly lineDashed7: string;
|
||||
readonly lineDashed8: string;
|
||||
readonly lineDashed9: string;
|
||||
readonly lineDashed10: string;
|
||||
readonly lineDashed11: string;
|
||||
readonly lineDashed12: string;
|
||||
readonly lineDashed13: string;
|
||||
readonly lineDashed14: string;
|
||||
readonly lineDashed15: string;
|
||||
readonly lineVertical: string;
|
||||
readonly lineVerticalBold: string;
|
||||
readonly lineVerticalDouble: string;
|
||||
readonly lineVerticalDashed0: string;
|
||||
readonly lineVerticalDashed1: string;
|
||||
readonly lineVerticalDashed2: string;
|
||||
readonly lineVerticalDashed3: string;
|
||||
readonly lineVerticalDashed4: string;
|
||||
readonly lineVerticalDashed5: string;
|
||||
readonly lineVerticalDashed6: string;
|
||||
readonly lineVerticalDashed7: string;
|
||||
readonly lineVerticalDashed8: string;
|
||||
readonly lineVerticalDashed9: string;
|
||||
readonly lineVerticalDashed10: string;
|
||||
readonly lineVerticalDashed11: string;
|
||||
readonly lineDownLeft: string;
|
||||
readonly lineDownLeftArc: string;
|
||||
readonly lineDownBoldLeftBold: string;
|
||||
readonly lineDownBoldLeft: string;
|
||||
readonly lineDownLeftBold: string;
|
||||
readonly lineDownDoubleLeftDouble: string;
|
||||
readonly lineDownDoubleLeft: string;
|
||||
readonly lineDownLeftDouble: string;
|
||||
readonly lineDownRight: string;
|
||||
readonly lineDownRightArc: string;
|
||||
readonly lineDownBoldRightBold: string;
|
||||
readonly lineDownBoldRight: string;
|
||||
readonly lineDownRightBold: string;
|
||||
readonly lineDownDoubleRightDouble: string;
|
||||
readonly lineDownDoubleRight: string;
|
||||
readonly lineDownRightDouble: string;
|
||||
readonly lineUpLeft: string;
|
||||
readonly lineUpLeftArc: string;
|
||||
readonly lineUpBoldLeftBold: string;
|
||||
readonly lineUpBoldLeft: string;
|
||||
readonly lineUpLeftBold: string;
|
||||
readonly lineUpDoubleLeftDouble: string;
|
||||
readonly lineUpDoubleLeft: string;
|
||||
readonly lineUpLeftDouble: string;
|
||||
readonly lineUpRight: string;
|
||||
readonly lineUpRightArc: string;
|
||||
readonly lineUpBoldRightBold: string;
|
||||
readonly lineUpBoldRight: string;
|
||||
readonly lineUpRightBold: string;
|
||||
readonly lineUpDoubleRightDouble: string;
|
||||
readonly lineUpDoubleRight: string;
|
||||
readonly lineUpRightDouble: string;
|
||||
readonly lineUpDownLeft: string;
|
||||
readonly lineUpBoldDownBoldLeftBold: string;
|
||||
readonly lineUpBoldDownBoldLeft: string;
|
||||
readonly lineUpDownLeftBold: string;
|
||||
readonly lineUpBoldDownLeftBold: string;
|
||||
readonly lineUpDownBoldLeftBold: string;
|
||||
readonly lineUpDownBoldLeft: string;
|
||||
readonly lineUpBoldDownLeft: string;
|
||||
readonly lineUpDoubleDownDoubleLeftDouble: string;
|
||||
readonly lineUpDoubleDownDoubleLeft: string;
|
||||
readonly lineUpDownLeftDouble: string;
|
||||
readonly lineUpDownRight: string;
|
||||
readonly lineUpBoldDownBoldRightBold: string;
|
||||
readonly lineUpBoldDownBoldRight: string;
|
||||
readonly lineUpDownRightBold: string;
|
||||
readonly lineUpBoldDownRightBold: string;
|
||||
readonly lineUpDownBoldRightBold: string;
|
||||
readonly lineUpDownBoldRight: string;
|
||||
readonly lineUpBoldDownRight: string;
|
||||
readonly lineUpDoubleDownDoubleRightDouble: string;
|
||||
readonly lineUpDoubleDownDoubleRight: string;
|
||||
readonly lineUpDownRightDouble: string;
|
||||
readonly lineDownLeftRight: string;
|
||||
readonly lineDownBoldLeftBoldRightBold: string;
|
||||
readonly lineDownLeftBoldRightBold: string;
|
||||
readonly lineDownBoldLeftRight: string;
|
||||
readonly lineDownBoldLeftBoldRight: string;
|
||||
readonly lineDownBoldLeftRightBold: string;
|
||||
readonly lineDownLeftRightBold: string;
|
||||
readonly lineDownLeftBoldRight: string;
|
||||
readonly lineDownDoubleLeftDoubleRightDouble: string;
|
||||
readonly lineDownDoubleLeftRight: string;
|
||||
readonly lineDownLeftDoubleRightDouble: string;
|
||||
readonly lineUpLeftRight: string;
|
||||
readonly lineUpBoldLeftBoldRightBold: string;
|
||||
readonly lineUpLeftBoldRightBold: string;
|
||||
readonly lineUpBoldLeftRight: string;
|
||||
readonly lineUpBoldLeftBoldRight: string;
|
||||
readonly lineUpBoldLeftRightBold: string;
|
||||
readonly lineUpLeftRightBold: string;
|
||||
readonly lineUpLeftBoldRight: string;
|
||||
readonly lineUpDoubleLeftDoubleRightDouble: string;
|
||||
readonly lineUpDoubleLeftRight: string;
|
||||
readonly lineUpLeftDoubleRightDouble: string;
|
||||
readonly lineUpDownLeftRight: string;
|
||||
readonly lineUpBoldDownBoldLeftBoldRightBold: string;
|
||||
readonly lineUpDownBoldLeftBoldRightBold: string;
|
||||
readonly lineUpBoldDownLeftBoldRightBold: string;
|
||||
readonly lineUpBoldDownBoldLeftRightBold: string;
|
||||
readonly lineUpBoldDownBoldLeftBoldRight: string;
|
||||
readonly lineUpBoldDownLeftRight: string;
|
||||
readonly lineUpDownBoldLeftRight: string;
|
||||
readonly lineUpDownLeftBoldRight: string;
|
||||
readonly lineUpDownLeftRightBold: string;
|
||||
readonly lineUpBoldDownBoldLeftRight: string;
|
||||
readonly lineUpDownLeftBoldRightBold: string;
|
||||
readonly lineUpBoldDownLeftBoldRight: string;
|
||||
readonly lineUpBoldDownLeftRightBold: string;
|
||||
readonly lineUpDownBoldLeftBoldRight: string;
|
||||
readonly lineUpDownBoldLeftRightBold: string;
|
||||
readonly lineUpDoubleDownDoubleLeftDoubleRightDouble: string;
|
||||
readonly lineUpDoubleDownDoubleLeftRight: string;
|
||||
readonly lineUpDownLeftDoubleRightDouble: string;
|
||||
readonly lineCross: string;
|
||||
readonly lineBackslash: string;
|
||||
readonly lineSlash: string;
|
||||
};
|
||||
|
||||
type FigureSet = typeof figureSet;
|
||||
|
||||
/**
|
||||
Symbols to use when the terminal supports Unicode symbols.
|
||||
*/
|
||||
export const mainSymbols: FigureSet;
|
||||
|
||||
/**
|
||||
Symbols to use when the terminal does not support Unicode symbols.
|
||||
*/
|
||||
export const fallbackSymbols: FigureSet;
|
||||
|
||||
/**
|
||||
Symbols to use on any terminal.
|
||||
*/
|
||||
export default figureSet;
|
||||
|
||||
/**
|
||||
Replace Unicode symbols depending on the terminal.
|
||||
|
||||
@param string - String where the Unicode symbols will be replaced with fallback symbols depending on the terminal.
|
||||
@returns The input with replaced fallback Unicode symbols.
|
||||
|
||||
@example
|
||||
```
|
||||
import figures, {replaceSymbols} from 'figures';
|
||||
|
||||
console.log(replaceSymbols('✔︎ check'));
|
||||
// On terminals with Unicode symbols: ✔︎ check
|
||||
// On other terminals: √ check
|
||||
|
||||
console.log(figures.tick);
|
||||
// On terminals with Unicode symbols: ✔︎
|
||||
// On other terminals: √
|
||||
```
|
||||
*/
|
||||
export function replaceSymbols(string: string): string;
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
/**
|
||||
* The base implementation of `_.reduce` and `_.reduceRight`, without support
|
||||
* for iteratee shorthands, which iterates over `collection` using `eachFunc`.
|
||||
*
|
||||
* @private
|
||||
* @param {Array|Object} collection The collection to iterate over.
|
||||
* @param {Function} iteratee The function invoked per iteration.
|
||||
* @param {*} accumulator The initial value.
|
||||
* @param {boolean} initAccum Specify using the first or last element of
|
||||
* `collection` as the initial value.
|
||||
* @param {Function} eachFunc The function to iterate over `collection`.
|
||||
* @returns {*} Returns the accumulated value.
|
||||
*/
|
||||
function baseReduce(collection, iteratee, accumulator, initAccum, eachFunc) {
|
||||
eachFunc(collection, function(value, index, collection) {
|
||||
accumulator = initAccum
|
||||
? (initAccum = false, value)
|
||||
: iteratee(accumulator, value, index, collection);
|
||||
});
|
||||
return accumulator;
|
||||
}
|
||||
|
||||
module.exports = baseReduce;
|
||||
@@ -0,0 +1,14 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.throttleTime = void 0;
|
||||
var async_1 = require("../scheduler/async");
|
||||
var throttle_1 = require("./throttle");
|
||||
var timer_1 = require("../observable/timer");
|
||||
function throttleTime(duration, scheduler, config) {
|
||||
if (scheduler === void 0) { scheduler = async_1.asyncScheduler; }
|
||||
if (config === void 0) { config = throttle_1.defaultThrottleConfig; }
|
||||
var duration$ = timer_1.timer(duration, scheduler);
|
||||
return throttle_1.throttle(function () { return duration$; }, config);
|
||||
}
|
||||
exports.throttleTime = throttleTime;
|
||||
//# sourceMappingURL=throttleTime.js.map
|
||||
@@ -0,0 +1,5 @@
|
||||
var convert = require('./convert'),
|
||||
func = convert('padStart', require('../padStart'));
|
||||
|
||||
func.placeholder = require('./placeholder');
|
||||
module.exports = func;
|
||||
@@ -0,0 +1,3 @@
|
||||
'use strict';
|
||||
|
||||
module.exports = require('./async').selectLimit;
|
||||
@@ -0,0 +1,6 @@
|
||||
import { zip } from '../observable/zip';
|
||||
import { joinAllInternals } from './joinAllInternals';
|
||||
export function zipAll(project) {
|
||||
return joinAllInternals(zip, project);
|
||||
}
|
||||
//# sourceMappingURL=zipAll.js.map
|
||||
@@ -0,0 +1,16 @@
|
||||
import svelte from 'rollup-plugin-svelte';
|
||||
import resolve from 'rollup-plugin-node-resolve';
|
||||
|
||||
const pkg = require('./package.json');
|
||||
|
||||
export default {
|
||||
input: 'src/SvelteTrapFocus.svelte',
|
||||
output: [
|
||||
{ file: pkg.module, 'format': 'en' },
|
||||
{ file: pkg.main, 'format': 'umd', name: 'SvelteTrapFocus' }
|
||||
],
|
||||
plugins: [
|
||||
svelte(),
|
||||
resolve()
|
||||
],
|
||||
};
|
||||
@@ -0,0 +1,410 @@
|
||||
# vm2 [![NPM Version][npm-image]][npm-url] [![NPM Downloads][downloads-image]][downloads-url] [![Package Quality][quality-image]][quality-url] [](https://github.com/patriksimek/vm2/actions/workflows/node-test.yml) [![Known Vulnerabilities][snyk-image]][snyk-url]
|
||||
|
||||
vm2 is a sandbox that can run untrusted code with whitelisted Node's built-in modules. Securely!
|
||||
|
||||
## Features
|
||||
|
||||
* Runs untrusted code securely in a single process with your code side by side
|
||||
* Full control over the sandbox's console output
|
||||
* The sandbox has limited access to the process's methods
|
||||
* It is possible to require modules (built-in and external) from the sandbox
|
||||
* You can limit access to certain (or all) built-in modules
|
||||
* You can securely call methods and exchange data and callbacks between sandboxes
|
||||
* Is immune to all known methods of attacks
|
||||
* Transpiler support
|
||||
|
||||
## How does it work
|
||||
|
||||
* It uses the internal VM module to create a secure context.
|
||||
* It uses [Proxies](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Proxy) to prevent escaping from the sandbox.
|
||||
* It overrides the built-in require to control access to modules.
|
||||
|
||||
## What is the difference between Node's vm and vm2?
|
||||
|
||||
Try it yourself:
|
||||
|
||||
```js
|
||||
const vm = require('vm');
|
||||
vm.runInNewContext('this.constructor.constructor("return process")().exit()');
|
||||
console.log('Never gets executed.');
|
||||
```
|
||||
|
||||
```js
|
||||
const {VM} = require('vm2');
|
||||
new VM().run('this.constructor.constructor("return process")().exit()');
|
||||
// Throws ReferenceError: process is not defined
|
||||
```
|
||||
|
||||
## Installation
|
||||
|
||||
**IMPORTANT**: VM2 requires Node.js 6 or newer.
|
||||
|
||||
```sh
|
||||
npm install vm2
|
||||
```
|
||||
|
||||
## Quick Example
|
||||
|
||||
```js
|
||||
const {VM} = require('vm2');
|
||||
const vm = new VM();
|
||||
|
||||
vm.run(`process.exit()`); // TypeError: process.exit is not a function
|
||||
```
|
||||
|
||||
```js
|
||||
const {NodeVM} = require('vm2');
|
||||
const vm = new NodeVM({
|
||||
require: {
|
||||
external: true,
|
||||
root: './'
|
||||
}
|
||||
});
|
||||
|
||||
vm.run(`
|
||||
var request = require('request');
|
||||
request('http://www.google.com', function (error, response, body) {
|
||||
console.error(error);
|
||||
if (!error && response.statusCode == 200) {
|
||||
console.log(body); // Show the HTML for the Google homepage.
|
||||
}
|
||||
});
|
||||
`, 'vm.js');
|
||||
```
|
||||
|
||||
## Documentation
|
||||
|
||||
* [VM](#vm)
|
||||
* [NodeVM](#nodevm)
|
||||
* [VMScript](#vmscript)
|
||||
* [Error handling](#error-handling)
|
||||
* [Debugging a sandboxed code](#debugging-a-sandboxed-code)
|
||||
* [Read-only objects](#read-only-objects-experimental)
|
||||
* [Protected objects](#protected-objects-experimental)
|
||||
* [Cross-sandbox relationships](#cross-sandbox-relationships)
|
||||
* [CLI](#cli)
|
||||
* [2.x to 3.x changes](https://github.com/patriksimek/vm2/wiki/2.x-to-3.x-changes)
|
||||
* [1.x and 2.x docs](https://github.com/patriksimek/vm2/wiki/1.x-and-2.x-docs)
|
||||
* [Contributing](https://github.com/patriksimek/vm2/wiki/Contributing)
|
||||
|
||||
## VM
|
||||
|
||||
VM is a simple sandbox to synchronously run untrusted code without the `require` feature. Only JavaScript built-in objects and Node's `Buffer` are available. Scheduling functions (`setInterval`, `setTimeout` and `setImmediate`) are not available by default.
|
||||
|
||||
**Options:**
|
||||
|
||||
* `timeout` - Script timeout in milliseconds. **WARNING**: You might want to use this option together with `allowAsync=false`. Further, operating on returned objects from the sandbox can run arbitrary code and circumvent the timeout. One should test if the returned object is a primitive with `typeof` and fully discard it (doing logging or creating error messages with such an object might also run arbitrary code again) in the other case.
|
||||
* `sandbox` - VM's global object.
|
||||
* `compiler` - `javascript` (default) or `coffeescript` or custom compiler function. The library expects you to have coffee-script pre-installed if the compiler is set to `coffeescript`.
|
||||
* `eval` - If set to `false` any calls to `eval` or function constructors (`Function`, `GeneratorFunction`, etc.) will throw an `EvalError` (default: `true`).
|
||||
* `wasm` - If set to `false` any attempt to compile a WebAssembly module will throw a `WebAssembly.CompileError` (default: `true`).
|
||||
* `allowAsync` - If set to `false` any attempt to run code using `async` will throw a `VMError` (default: `true`).
|
||||
|
||||
**IMPORTANT**: Timeout is only effective on synchronous code that you run through `run`. Timeout does **NOT** work on any method returned by VM. There are some situations when timeout doesn't work - see [#244](https://github.com/patriksimek/vm2/pull/244).
|
||||
|
||||
```js
|
||||
const {VM} = require('vm2');
|
||||
|
||||
const vm = new VM({
|
||||
timeout: 1000,
|
||||
allowAsync: false,
|
||||
sandbox: {}
|
||||
});
|
||||
|
||||
vm.run('process.exit()'); // throws ReferenceError: process is not defined
|
||||
```
|
||||
|
||||
You can also retrieve values from VM.
|
||||
|
||||
```js
|
||||
let number = vm.run('1337'); // returns 1337
|
||||
```
|
||||
|
||||
**TIP**: See tests for more usage examples.
|
||||
|
||||
## NodeVM
|
||||
|
||||
Unlike `VM`, `NodeVM` allows you to require modules in the same way that you would in the regular Node's context.
|
||||
|
||||
**Options:**
|
||||
|
||||
* `console` - `inherit` to enable console, `redirect` to redirect to events, `off` to disable console (default: `inherit`).
|
||||
* `sandbox` - VM's global object.
|
||||
* `compiler` - `javascript` (default) or `coffeescript` or custom compiler function (which receives the code, and it's file path). The library expects you to have coffee-script pre-installed if the compiler is set to `coffeescript`.
|
||||
* `eval` - If set to `false` any calls to `eval` or function constructors (`Function`, `GeneratorFunction`, etc.) will throw an `EvalError` (default: `true`).
|
||||
* `wasm` - If set to `false` any attempt to compile a WebAssembly module will throw a `WebAssembly.CompileError` (default: `true`).
|
||||
* `sourceExtensions` - Array of file extensions to treat as source code (default: `['js']`).
|
||||
* `require` - `true` or object to enable `require` method (default: `false`).
|
||||
* `require.external` - Values can be `true`, an array of allowed external modules, or an object (default: `false`). All paths matching `/node_modules/${any_allowed_external_module}/(?!/node_modules/)` are allowed to be required.
|
||||
* `require.external.modules` - Array of allowed external modules. Also supports wildcards, so specifying `['@scope/*-ver-??]`, for instance, will allow using all modules having a name of the form `@scope/something-ver-aa`, `@scope/other-ver-11`, etc. The `*` wildcard does not match path separators.
|
||||
* `require.external.transitive` - Boolean which indicates if transitive dependencies of external modules are allowed (default: `false`). **WARNING**: When a module is required transitively, any module is then able to require it normally, even if this was not possible before it was loaded.
|
||||
* `require.builtin` - Array of allowed built-in modules, accepts ["\*"] for all (default: none). **WARNING**: "\*" can be dangerous as new built-ins can be added.
|
||||
* `require.root` - Restricted path(s) where local modules can be required (default: every path).
|
||||
* `require.mock` - Collection of mock modules (both external or built-in).
|
||||
* `require.context` - `host` (default) to require modules in the host and proxy them into the sandbox. `sandbox` to load, compile, and require modules in the sandbox. Except for `events`, built-in modules are always required in the host and proxied into the sandbox.
|
||||
* `require.import` - An array of modules to be loaded into NodeVM on start.
|
||||
* `require.resolve` - An additional lookup function in case a module wasn't found in one of the traditional node lookup paths.
|
||||
* `require.customRequire` - Use instead of the `require` function to load modules from the host.
|
||||
* `require.strict` - `false` to not force strict mode on modules loaded by require (default: `true`).
|
||||
* `require.fs` - Custom file system implementation.
|
||||
* `nesting` - **WARNING**: Allowing this is a security risk as scripts can create a NodeVM which can require any host module. `true` to enable VMs nesting (default: `false`).
|
||||
* `wrapper` - `commonjs` (default) to wrap script into CommonJS wrapper, `none` to retrieve value returned by the script.
|
||||
* `argv` - Array to be passed to `process.argv`.
|
||||
* `env` - Object to be passed to `process.env`.
|
||||
* `strict` - `true` to loaded modules in strict mode (default: `false`).
|
||||
|
||||
**IMPORTANT**: Timeout is not effective for NodeVM so it is not immune to `while (true) {}` or similar evil.
|
||||
|
||||
**REMEMBER**: The more modules you allow, the more fragile your sandbox becomes.
|
||||
|
||||
```js
|
||||
const {NodeVM} = require('vm2');
|
||||
|
||||
const vm = new NodeVM({
|
||||
console: 'inherit',
|
||||
sandbox: {},
|
||||
require: {
|
||||
external: true,
|
||||
builtin: ['fs', 'path'],
|
||||
root: './',
|
||||
mock: {
|
||||
fs: {
|
||||
readFileSync: () => 'Nice try!'
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// Sync
|
||||
|
||||
let functionInSandbox = vm.run('module.exports = function(who) { console.log("hello "+ who); }');
|
||||
functionInSandbox('world');
|
||||
|
||||
// Async
|
||||
|
||||
let functionWithCallbackInSandbox = vm.run('module.exports = function(who, callback) { callback("hello "+ who); }');
|
||||
functionWithCallbackInSandbox('world', (greeting) => {
|
||||
console.log(greeting);
|
||||
});
|
||||
```
|
||||
|
||||
When `wrapper` is set to `none`, `NodeVM` behaves more like `VM` for synchronous code.
|
||||
|
||||
```js
|
||||
assert.ok(vm.run('return true') === true);
|
||||
```
|
||||
|
||||
**TIP**: See tests for more usage examples.
|
||||
|
||||
### Loading modules by relative path
|
||||
|
||||
To load modules by relative path, you must pass the full path of the script you're running as a second argument to vm's `run` method if the script is a string. The filename is then displayed in any stack traces generated by the script.
|
||||
|
||||
```js
|
||||
vm.run('require("foobar")', '/data/myvmscript.js');
|
||||
```
|
||||
|
||||
If the script you are running is a VMScript, the path is given in the VMScript constructor.
|
||||
|
||||
```js
|
||||
const script = new VMScript('require("foobar")', {filename: '/data/myvmscript.js'});
|
||||
vm.run(script);
|
||||
```
|
||||
|
||||
## VMScript
|
||||
|
||||
You can increase performance by using precompiled scripts. The precompiled VMScript can be run multiple times. It is important to note that the code is not bound to any VM (context); rather, it is bound before each run, just for that run.
|
||||
|
||||
```js
|
||||
const {VM, VMScript} = require('vm2');
|
||||
|
||||
const vm = new VM();
|
||||
const script = new VMScript('Math.random()');
|
||||
console.log(vm.run(script));
|
||||
console.log(vm.run(script));
|
||||
```
|
||||
|
||||
It works for both `VM` and `NodeVM`.
|
||||
|
||||
```js
|
||||
const {NodeVM, VMScript} = require('vm2');
|
||||
|
||||
const vm = new NodeVM();
|
||||
const script = new VMScript('module.exports = Math.random()');
|
||||
console.log(vm.run(script));
|
||||
console.log(vm.run(script));
|
||||
```
|
||||
|
||||
Code is compiled automatically the first time it runs. One can compile the code anytime with `script.compile()`. Once the code is compiled, the method has no effect.
|
||||
|
||||
## Error handling
|
||||
|
||||
Errors in code compilation and synchronous code execution can be handled by `try-catch`. Errors in asynchronous code execution can be handled by attaching `uncaughtException` event handler to Node's `process`.
|
||||
|
||||
```js
|
||||
try {
|
||||
var script = new VMScript('Math.random()').compile();
|
||||
} catch (err) {
|
||||
console.error('Failed to compile script.', err);
|
||||
}
|
||||
|
||||
try {
|
||||
vm.run(script);
|
||||
} catch (err) {
|
||||
console.error('Failed to execute script.', err);
|
||||
}
|
||||
|
||||
process.on('uncaughtException', (err) => {
|
||||
console.error('Asynchronous error caught.', err);
|
||||
});
|
||||
```
|
||||
|
||||
## Debugging a sandboxed code
|
||||
|
||||
You can debug or inspect code running in the sandbox as if it was running in a normal process.
|
||||
|
||||
* You can use breakpoints (which requires you to specify a script file name)
|
||||
* You can use `debugger` keyword.
|
||||
* You can use step-in to step inside the code running in the sandbox.
|
||||
|
||||
### Example
|
||||
|
||||
/tmp/main.js:
|
||||
|
||||
```js
|
||||
const {VM, VMScript} = require('.');
|
||||
const fs = require('fs');
|
||||
const file = `${__dirname}/sandbox.js`;
|
||||
|
||||
// By providing a file name as second argument you enable breakpoints
|
||||
const script = new VMScript(fs.readFileSync(file), file);
|
||||
|
||||
new VM().run(script);
|
||||
```
|
||||
|
||||
/tmp/sandbox.js
|
||||
|
||||
```js
|
||||
const foo = 'ahoj';
|
||||
|
||||
// The debugger keyword works just fine everywhere.
|
||||
// Even without specifying a file name to the VMScript object.
|
||||
debugger;
|
||||
```
|
||||
|
||||
## Read-only objects (experimental)
|
||||
|
||||
To prevent sandboxed scripts from adding, changing, or deleting properties from the proxied objects, you can use `freeze` methods to make the object read-only. This is only effective inside VM. Frozen objects are affected deeply. Primitive types cannot be frozen.
|
||||
|
||||
**Example without using `freeze`:**
|
||||
|
||||
```js
|
||||
const util = {
|
||||
add: (a, b) => a + b
|
||||
}
|
||||
|
||||
const vm = new VM({
|
||||
sandbox: {util}
|
||||
});
|
||||
|
||||
vm.run('util.add = (a, b) => a - b');
|
||||
console.log(util.add(1, 1)); // returns 0
|
||||
```
|
||||
|
||||
**Example with using `freeze`:**
|
||||
|
||||
```js
|
||||
const vm = new VM(); // Objects specified in the sandbox cannot be frozen.
|
||||
vm.freeze(util, 'util'); // Second argument adds object to global.
|
||||
|
||||
vm.run('util.add = (a, b) => a - b'); // Fails silently when not in strict mode.
|
||||
console.log(util.add(1, 1)); // returns 2
|
||||
```
|
||||
|
||||
**IMPORTANT:** It is not possible to freeze objects that have already been proxied to the VM.
|
||||
|
||||
## Protected objects (experimental)
|
||||
|
||||
Unlike `freeze`, this method allows sandboxed scripts to add, change, or delete properties on objects, with one exception - it is not possible to attach functions. Sandboxed scripts are therefore not able to modify methods like `toJSON`, `toString` or `inspect`.
|
||||
|
||||
**IMPORTANT:** It is not possible to protect objects that have already been proxied to the VM.
|
||||
|
||||
## Cross-sandbox relationships
|
||||
|
||||
```js
|
||||
const assert = require('assert');
|
||||
const {VM} = require('vm2');
|
||||
|
||||
const sandbox = {
|
||||
object: new Object(),
|
||||
func: new Function(),
|
||||
buffer: new Buffer([0x01, 0x05])
|
||||
}
|
||||
|
||||
const vm = new VM({sandbox});
|
||||
|
||||
assert.ok(vm.run(`object`) === sandbox.object);
|
||||
assert.ok(vm.run(`object instanceof Object`));
|
||||
assert.ok(vm.run(`object`) instanceof Object);
|
||||
assert.ok(vm.run(`object.__proto__ === Object.prototype`));
|
||||
assert.ok(vm.run(`object`).__proto__ === Object.prototype);
|
||||
|
||||
assert.ok(vm.run(`func`) === sandbox.func);
|
||||
assert.ok(vm.run(`func instanceof Function`));
|
||||
assert.ok(vm.run(`func`) instanceof Function);
|
||||
assert.ok(vm.run(`func.__proto__ === Function.prototype`));
|
||||
assert.ok(vm.run(`func`).__proto__ === Function.prototype);
|
||||
|
||||
assert.ok(vm.run(`new func() instanceof func`));
|
||||
assert.ok(vm.run(`new func()`) instanceof sandbox.func);
|
||||
assert.ok(vm.run(`new func().__proto__ === func.prototype`));
|
||||
assert.ok(vm.run(`new func()`).__proto__ === sandbox.func.prototype);
|
||||
|
||||
assert.ok(vm.run(`buffer`) === sandbox.buffer);
|
||||
assert.ok(vm.run(`buffer instanceof Buffer`));
|
||||
assert.ok(vm.run(`buffer`) instanceof Buffer);
|
||||
assert.ok(vm.run(`buffer.__proto__ === Buffer.prototype`));
|
||||
assert.ok(vm.run(`buffer`).__proto__ === Buffer.prototype);
|
||||
assert.ok(vm.run(`buffer.slice(0, 1) instanceof Buffer`));
|
||||
assert.ok(vm.run(`buffer.slice(0, 1)`) instanceof Buffer);
|
||||
```
|
||||
|
||||
## CLI
|
||||
|
||||
Before you can use vm2 in the command line, install it globally with `npm install vm2 -g`.
|
||||
|
||||
```sh
|
||||
vm2 ./script.js
|
||||
```
|
||||
|
||||
## Known Issues
|
||||
|
||||
* It is not possible to define a class that extends a proxied class. This includes using a proxied class in `Object.create`.
|
||||
* Direct eval does not work.
|
||||
* Logging sandbox arrays will repeat the array part in the properties.
|
||||
* Source code transformations can result a different source string for a function.
|
||||
* There are ways to crash the node process from inside the sandbox.
|
||||
|
||||
## Deployment
|
||||
|
||||
1. Update the `CHANGELOG.md`
|
||||
2. Update the `package.json` version number
|
||||
3. Commit the changes
|
||||
4. Run `npm publish`
|
||||
|
||||
## Sponsors
|
||||
|
||||
[![Integromat][integromat-image]][integromat-url]
|
||||
|
||||
[npm-image]: https://img.shields.io/npm/v/vm2.svg?style=flat-square
|
||||
[npm-url]: https://www.npmjs.com/package/vm2
|
||||
[downloads-image]: https://img.shields.io/npm/dm/vm2.svg?style=flat-square
|
||||
[downloads-url]: https://www.npmjs.com/package/vm2
|
||||
[quality-image]: http://npm.packagequality.com/shield/vm2.svg?style=flat-square
|
||||
[quality-url]: http://packagequality.com/#?package=vm2
|
||||
[travis-image]: https://img.shields.io/travis/patriksimek/vm2/master.svg?style=flat-square&label=unit
|
||||
[travis-url]: https://travis-ci.org/patriksimek/vm2
|
||||
[snyk-image]: https://snyk.io/test/github/patriksimek/vm2/badge.svg
|
||||
[snyk-url]: https://snyk.io/test/github/patriksimek/vm2
|
||||
[integromat-image]: https://static.integromat.com/logo/45_text.png
|
||||
[integromat-url]: https://www.integromat.com
|
||||
@@ -0,0 +1,62 @@
|
||||
import { MonoTypeOperatorFunction, SchedulerLike } from '../types';
|
||||
/**
|
||||
* Asynchronously subscribes Observers to this Observable on the specified {@link SchedulerLike}.
|
||||
*
|
||||
* With `subscribeOn` you can decide what type of scheduler a specific Observable will be using when it is subscribed to.
|
||||
*
|
||||
* Schedulers control the speed and order of emissions to observers from an Observable stream.
|
||||
*
|
||||
* 
|
||||
*
|
||||
* ## Example
|
||||
*
|
||||
* Given the following code:
|
||||
*
|
||||
* ```ts
|
||||
* import { of, merge } from 'rxjs';
|
||||
*
|
||||
* const a = of(1, 2, 3);
|
||||
* const b = of(4, 5, 6);
|
||||
*
|
||||
* merge(a, b).subscribe(console.log);
|
||||
*
|
||||
* // Outputs
|
||||
* // 1
|
||||
* // 2
|
||||
* // 3
|
||||
* // 4
|
||||
* // 5
|
||||
* // 6
|
||||
* ```
|
||||
*
|
||||
* Both Observable `a` and `b` will emit their values directly and synchronously once they are subscribed to.
|
||||
*
|
||||
* If we instead use the `subscribeOn` operator declaring that we want to use the {@link asyncScheduler} for values emitted by Observable `a`:
|
||||
*
|
||||
* ```ts
|
||||
* import { of, subscribeOn, asyncScheduler, merge } from 'rxjs';
|
||||
*
|
||||
* const a = of(1, 2, 3).pipe(subscribeOn(asyncScheduler));
|
||||
* const b = of(4, 5, 6);
|
||||
*
|
||||
* merge(a, b).subscribe(console.log);
|
||||
*
|
||||
* // Outputs
|
||||
* // 4
|
||||
* // 5
|
||||
* // 6
|
||||
* // 1
|
||||
* // 2
|
||||
* // 3
|
||||
* ```
|
||||
*
|
||||
* The reason for this is that Observable `b` emits its values directly and synchronously like before
|
||||
* but the emissions from `a` are scheduled on the event loop because we are now using the {@link asyncScheduler} for that specific Observable.
|
||||
*
|
||||
* @param scheduler The {@link SchedulerLike} to perform subscription actions on.
|
||||
* @param delay A delay to pass to the scheduler to delay subscriptions
|
||||
* @return A function that returns an Observable modified so that its
|
||||
* subscriptions happen on the specified {@link SchedulerLike}.
|
||||
*/
|
||||
export declare function subscribeOn<T>(scheduler: SchedulerLike, delay?: number): MonoTypeOperatorFunction<T>;
|
||||
//# sourceMappingURL=subscribeOn.d.ts.map
|
||||
@@ -0,0 +1,9 @@
|
||||
"use strict";
|
||||
|
||||
var toShortString = require("../to-short-string-representation")
|
||||
, isInteger = require("./is-integer");
|
||||
|
||||
module.exports = function (num) {
|
||||
if (!isInteger(num)) throw new TypeError(toShortString(num) + " is not a integer");
|
||||
return Number(num);
|
||||
};
|
||||
@@ -0,0 +1,46 @@
|
||||
{
|
||||
"name": "latest-version",
|
||||
"version": "7.0.0",
|
||||
"description": "Get the latest version of an npm package",
|
||||
"license": "MIT",
|
||||
"repository": "sindresorhus/latest-version",
|
||||
"funding": "https://github.com/sponsors/sindresorhus",
|
||||
"author": {
|
||||
"name": "Sindre Sorhus",
|
||||
"email": "sindresorhus@gmail.com",
|
||||
"url": "https://sindresorhus.com"
|
||||
},
|
||||
"type": "module",
|
||||
"exports": "./index.js",
|
||||
"engines": {
|
||||
"node": ">=14.16"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "xo && ava && tsd"
|
||||
},
|
||||
"files": [
|
||||
"index.js",
|
||||
"index.d.ts"
|
||||
],
|
||||
"keywords": [
|
||||
"latest",
|
||||
"version",
|
||||
"npm",
|
||||
"pkg",
|
||||
"package",
|
||||
"package.json",
|
||||
"current",
|
||||
"module"
|
||||
],
|
||||
"dependencies": {
|
||||
"package-json": "^8.1.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"ava": "^4.3.0",
|
||||
"semver": "^7.3.7",
|
||||
"semver-regex": "^4.0.5",
|
||||
"tsd": "^0.21.0",
|
||||
"typescript": "^4.7.4",
|
||||
"xo": "^0.50.0"
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user