new license file version [CI SKIP]
This commit is contained in:
@@ -0,0 +1,7 @@
|
||||
"use strict";
|
||||
function __export(m) {
|
||||
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
|
||||
}
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
__export(require("rxjs-compat/Subscription"));
|
||||
//# sourceMappingURL=Subscription.js.map
|
||||
@@ -0,0 +1,53 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
/* istanbul ignore file: deprecated */
|
||||
const url_1 = require("url");
|
||||
const keys = [
|
||||
'protocol',
|
||||
'host',
|
||||
'hostname',
|
||||
'port',
|
||||
'pathname',
|
||||
'search'
|
||||
];
|
||||
exports.default = (origin, options) => {
|
||||
var _a, _b;
|
||||
if (options.path) {
|
||||
if (options.pathname) {
|
||||
throw new TypeError('Parameters `path` and `pathname` are mutually exclusive.');
|
||||
}
|
||||
if (options.search) {
|
||||
throw new TypeError('Parameters `path` and `search` are mutually exclusive.');
|
||||
}
|
||||
if (options.searchParams) {
|
||||
throw new TypeError('Parameters `path` and `searchParams` are mutually exclusive.');
|
||||
}
|
||||
}
|
||||
if (options.search && options.searchParams) {
|
||||
throw new TypeError('Parameters `search` and `searchParams` are mutually exclusive.');
|
||||
}
|
||||
if (!origin) {
|
||||
if (!options.protocol) {
|
||||
throw new TypeError('No URL protocol specified');
|
||||
}
|
||||
origin = `${options.protocol}//${(_b = (_a = options.hostname) !== null && _a !== void 0 ? _a : options.host) !== null && _b !== void 0 ? _b : ''}`;
|
||||
}
|
||||
const url = new url_1.URL(origin);
|
||||
if (options.path) {
|
||||
const searchIndex = options.path.indexOf('?');
|
||||
if (searchIndex === -1) {
|
||||
options.pathname = options.path;
|
||||
}
|
||||
else {
|
||||
options.pathname = options.path.slice(0, searchIndex);
|
||||
options.search = options.path.slice(searchIndex + 1);
|
||||
}
|
||||
delete options.path;
|
||||
}
|
||||
for (const key of keys) {
|
||||
if (options[key]) {
|
||||
url[key] = options[key].toString();
|
||||
}
|
||||
}
|
||||
return url;
|
||||
};
|
||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1,2 @@
|
||||
declare const _root: any;
|
||||
export { _root as root };
|
||||
@@ -0,0 +1 @@
|
||||
import 'rxjs-compat/add/operator/filter';
|
||||
@@ -0,0 +1,13 @@
|
||||
|
||||
|
||||
// Detects whether input type="file" is available on the platform
|
||||
// E.g. iOS < 6 and some android version don't support this
|
||||
|
||||
// It's useful if you want to hide the upload feature of your app on devices that
|
||||
// don't support it (iphone, ipad, etc).
|
||||
|
||||
Modernizr.addTest('fileinput', function() {
|
||||
var elem = document.createElement('input');
|
||||
elem.type = 'file';
|
||||
return !elem.disabled;
|
||||
});
|
||||
@@ -0,0 +1 @@
|
||||
export * from 'rxjs-compat/observable/defer';
|
||||
@@ -0,0 +1 @@
|
||||
{"name":"@octokit/request","version":"5.6.3","files":{"LICENSE":{"checkedAt":1678887829389,"integrity":"sha512-8FFmjOGzS4YsHoIqH94puCnrt52IbgXvyeCeydF8pso7rWBBQUq/ucDlumRLaH81XnrOqtE31m4OeKzAtd9ESA==","mode":420,"size":1081},"dist-src/get-buffer-response.js":{"checkedAt":1678887829457,"integrity":"sha512-R4cVeuusp6BIrPoY4empzUHfAOs1s9ye1Fltq0gVR572ZDVr+mSZnfELqE473vH9PuvBXpCL53H2xvwckNsPSQ==","mode":420,"size":91},"dist-src/index.js":{"checkedAt":1678887829457,"integrity":"sha512-/zkz+lBQIpUJqtaIlVHvYQASdCWAlDxBQS4UawhcNsb2sm5N+2S0kdwK3pbwFFQeh5ZT5rJ7efvubrgykTtdsA==","mode":420,"size":327},"dist-node/index.js":{"checkedAt":1678887829448,"integrity":"sha512-VFxXG3MYikR7DE/a5voVRqVZZXIzBOOpuDxwb1XjQYMfFZ0TA+Vbpd90gS68pAe7HUCnnLES3y/o52snyeW4mQ==","mode":420,"size":4974},"dist-web/index.js":{"checkedAt":1678887829457,"integrity":"sha512-6nVOiL0Nu5CCYE7b1zkhWnnWZ3l4qfTOwohKS6AUSogv0zLiZ5NYbICWA9QYYphMyuwbrXG66JORDvPLP2NU0A==","mode":420,"size":5309},"dist-src/with-defaults.js":{"checkedAt":1678887829465,"integrity":"sha512-ViYIHbAUe0ihuLAqIrScKj7yNx2DODwqA7UVID7gewEKQX0rXSwp0mGkpXKjVjPMvTnwaSUs+MIH4dxb3LipKQ==","mode":420,"size":893},"dist-src/version.js":{"checkedAt":1678887829457,"integrity":"sha512-0CwL1lzopnOUzjn7cB33K3ZG9E7KPOfKLBkIV/nGetVXUB2Rlnaiu0/0V1U4UJBR3DStXHeXFZ680t3uGcOf3w==","mode":420,"size":32},"package.json":{"checkedAt":1678887829457,"integrity":"sha512-D2ENM+xISkect8WOlrvbo0yEGWqQPYHZUN6fEsaVbcbqKzWaJz3lljWiL83JfOM3HvPVp/FA5R0i+8pLOhvJzg==","mode":420,"size":1500},"dist-node/index.js.map":{"checkedAt":1678887829465,"integrity":"sha512-vKwHRSHV2+OhDyTYu5ga1voA930yl65Abgpb62okJySN68MCIdq+QEEkCha/nJHAWfpSMvBRm+LyLNIKmtavaA==","mode":420,"size":11292},"dist-src/fetch-wrapper.js":{"checkedAt":1678887829465,"integrity":"sha512-E22WPFYG3Sb4AZ25Kft1/jMWjQ0xBasPVjcycmhFd5AQIv5dFlI+dzbITKDQHF0Cr0JreTLeV8+s/arwRyhtpg==","mode":420,"size":4129},"dist-web/index.js.map":{"checkedAt":1678887829474,"integrity":"sha512-vA8objJ3h/QeBeseUGj0icfeQBhv5aXdrsf82SUpPP+exp/Gu4lQgJKoKbZHp9Uvg/namLb6KaekygRIjbrW+w==","mode":420,"size":10964},"dist-types/fetch-wrapper.d.ts":{"checkedAt":1678887829486,"integrity":"sha512-OnOvovhjy71/ZPeCiHxF6Clss9jB+bDM+oDIbm19sm6UhPVEtVnao8aUxbd3dF01bB7+kX4d+OImPtAEs0Ap9w==","mode":420,"size":311},"dist-types/get-buffer-response.d.ts":{"checkedAt":1678887829486,"integrity":"sha512-VAO2FMq8rHWdEeF3H2g02b3XnX6ZpR84g3szggxwYFfQq5pUyjADN9ZMGSvphs8b+kXykSVSjBHei16iNIzT9Q==","mode":420,"size":124},"dist-types/index.d.ts":{"checkedAt":1678887829486,"integrity":"sha512-eaGoIgcQ2F9KBBE0XPzlDpeCFLhrxY1IHs9kIUd6LdAQrWOgDO15gVlm6g9aLp7A5A1mUycEEa4/J8ScBmFl6A==","mode":420,"size":81},"README.md":{"checkedAt":1678887829481,"integrity":"sha512-XsLNy7uav4sNeN/c/ODuXAuNi6ulrka12H4/hD3alWaVL8IH9a4DdIxuiUSGzVB7O5pEKdH2WaXTOF0XzfWEDA==","mode":420,"size":16132},"dist-types/with-defaults.d.ts":{"checkedAt":1678887829486,"integrity":"sha512-EneLytkUhxrMq60FuCCkBd1XYF50b547U7jYFjleFFTSXazmhYehRv15+w4lAdQVQxrG3zqbmfbOjdEtN84aDg==","mode":420,"size":209},"dist-types/version.d.ts":{"checkedAt":1678887829481,"integrity":"sha512-AQTu0vQmfBQvCBd9hxgpcu4pHo9eXO8bJL5nihjXFVc1VREnb/RLPIEyokvDoeXgxCZpoDWEpfZzuillHwQacw==","mode":420,"size":40}}}
|
||||
@@ -0,0 +1 @@
|
||||
export * from 'rxjs-compat/operators/elementAt';
|
||||
@@ -0,0 +1,29 @@
|
||||
const fs = require('fs').promises;
|
||||
const path = require('path');
|
||||
const sh = require('shelljs');
|
||||
const tmp = require('tmp');
|
||||
|
||||
const mkTmpDir = () => {
|
||||
const dir = tmp.dirSync({ prefix: 'release-it-' });
|
||||
return dir.name;
|
||||
};
|
||||
|
||||
const readFile = file => fs.readFile(path.resolve(file), 'utf8');
|
||||
|
||||
const gitAdd = (content, file, message) => {
|
||||
sh.ShellString(content).toEnd(file);
|
||||
sh.exec(`git add ${file}`);
|
||||
const { stdout } = sh.exec(`git commit -m "${message}"`);
|
||||
const match = stdout.match(/\[.+([a-z0-9]{7})\]/);
|
||||
return match ? match[1] : null;
|
||||
};
|
||||
|
||||
const getArgs = (args, prefix) =>
|
||||
args.filter(args => typeof args[0] === 'string' && args[0].startsWith(prefix)).map(args => args[0].trim());
|
||||
|
||||
module.exports = {
|
||||
mkTmpDir,
|
||||
readFile,
|
||||
gitAdd,
|
||||
getArgs
|
||||
};
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"isNumeric.js","sources":["../../../src/internal/util/isNumeric.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,MAAM,UAAU,SAAS,CAAC,GAAQ;IAKhC,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,GAAG,UAAU,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC;AAC3D,CAAC"}
|
||||
@@ -0,0 +1,79 @@
|
||||
let Declaration = require('../declaration')
|
||||
|
||||
class TransformDecl extends Declaration {
|
||||
/**
|
||||
* Recursively check all parents for @keyframes
|
||||
*/
|
||||
keyframeParents (decl) {
|
||||
let { parent } = decl
|
||||
while (parent) {
|
||||
if (parent.type === 'atrule' && parent.name === 'keyframes') {
|
||||
return true
|
||||
}
|
||||
;({ parent } = parent)
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
/**
|
||||
* Is transform contain 3D commands
|
||||
*/
|
||||
contain3d (decl) {
|
||||
if (decl.prop === 'transform-origin') {
|
||||
return false
|
||||
}
|
||||
|
||||
for (let func of TransformDecl.functions3d) {
|
||||
if (decl.value.includes(`${func}(`)) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
return false
|
||||
}
|
||||
|
||||
/**
|
||||
* Replace rotateZ to rotate for IE 9
|
||||
*/
|
||||
set (decl, prefix) {
|
||||
decl = super.set(decl, prefix)
|
||||
if (prefix === '-ms-') {
|
||||
decl.value = decl.value.replace(/rotatez/gi, 'rotate')
|
||||
}
|
||||
return decl
|
||||
}
|
||||
|
||||
/**
|
||||
* Don't add prefix for IE in keyframes
|
||||
*/
|
||||
insert (decl, prefix, prefixes) {
|
||||
if (prefix === '-ms-') {
|
||||
if (!this.contain3d(decl) && !this.keyframeParents(decl)) {
|
||||
return super.insert(decl, prefix, prefixes)
|
||||
}
|
||||
} else if (prefix === '-o-') {
|
||||
if (!this.contain3d(decl)) {
|
||||
return super.insert(decl, prefix, prefixes)
|
||||
}
|
||||
} else {
|
||||
return super.insert(decl, prefix, prefixes)
|
||||
}
|
||||
return undefined
|
||||
}
|
||||
}
|
||||
|
||||
TransformDecl.names = ['transform', 'transform-origin']
|
||||
|
||||
TransformDecl.functions3d = [
|
||||
'matrix3d',
|
||||
'translate3d',
|
||||
'translateZ',
|
||||
'scale3d',
|
||||
'scaleZ',
|
||||
'rotate3d',
|
||||
'rotateX',
|
||||
'rotateY',
|
||||
'perspective'
|
||||
]
|
||||
|
||||
module.exports = TransformDecl
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"index.js","sources":["../dist-src/auth.js","../dist-src/with-authorization-prefix.js","../dist-src/hook.js","../dist-src/index.js"],"sourcesContent":["const REGEX_IS_INSTALLATION_LEGACY = /^v1\\./;\nconst REGEX_IS_INSTALLATION = /^ghs_/;\nconst REGEX_IS_USER_TO_SERVER = /^ghu_/;\nexport async function auth(token) {\n const isApp = token.split(/\\./).length === 3;\n const isInstallation = REGEX_IS_INSTALLATION_LEGACY.test(token) ||\n REGEX_IS_INSTALLATION.test(token);\n const isUserToServer = REGEX_IS_USER_TO_SERVER.test(token);\n const tokenType = isApp\n ? \"app\"\n : isInstallation\n ? \"installation\"\n : isUserToServer\n ? \"user-to-server\"\n : \"oauth\";\n return {\n type: \"token\",\n token: token,\n tokenType,\n };\n}\n","/**\n * Prefix token for usage in the Authorization header\n *\n * @param token OAuth token or JSON Web Token\n */\nexport function withAuthorizationPrefix(token) {\n if (token.split(/\\./).length === 3) {\n return `bearer ${token}`;\n }\n return `token ${token}`;\n}\n","import { withAuthorizationPrefix } from \"./with-authorization-prefix\";\nexport async function hook(token, request, route, parameters) {\n const endpoint = request.endpoint.merge(route, parameters);\n endpoint.headers.authorization = withAuthorizationPrefix(token);\n return request(endpoint);\n}\n","import { auth } from \"./auth\";\nimport { hook } from \"./hook\";\nexport const createTokenAuth = function createTokenAuth(token) {\n if (!token) {\n throw new Error(\"[@octokit/auth-token] No token passed to createTokenAuth\");\n }\n if (typeof token !== \"string\") {\n throw new Error(\"[@octokit/auth-token] Token passed to createTokenAuth is not a string\");\n }\n token = token.replace(/^(token|bearer) +/i, \"\");\n return Object.assign(auth.bind(null, token), {\n hook: hook.bind(null, token),\n });\n};\n"],"names":["REGEX_IS_INSTALLATION_LEGACY","REGEX_IS_INSTALLATION","REGEX_IS_USER_TO_SERVER","auth","token","isApp","split","length","isInstallation","test","isUserToServer","tokenType","type","withAuthorizationPrefix","hook","request","route","parameters","endpoint","merge","headers","authorization","createTokenAuth","Error","replace","Object","assign","bind"],"mappings":";;;;AAAA,MAAMA,4BAA4B,GAAG,OAArC;AACA,MAAMC,qBAAqB,GAAG,OAA9B;AACA,MAAMC,uBAAuB,GAAG,OAAhC;AACO,eAAeC,IAAf,CAAoBC,KAApB,EAA2B;AAC9B,QAAMC,KAAK,GAAGD,KAAK,CAACE,KAAN,CAAY,IAAZ,EAAkBC,MAAlB,KAA6B,CAA3C;AACA,QAAMC,cAAc,GAAGR,4BAA4B,CAACS,IAA7B,CAAkCL,KAAlC,KACnBH,qBAAqB,CAACQ,IAAtB,CAA2BL,KAA3B,CADJ;AAEA,QAAMM,cAAc,GAAGR,uBAAuB,CAACO,IAAxB,CAA6BL,KAA7B,CAAvB;AACA,QAAMO,SAAS,GAAGN,KAAK,GACjB,KADiB,GAEjBG,cAAc,GACV,cADU,GAEVE,cAAc,GACV,gBADU,GAEV,OANd;AAOA,SAAO;AACHE,IAAAA,IAAI,EAAE,OADH;AAEHR,IAAAA,KAAK,EAAEA,KAFJ;AAGHO,IAAAA;AAHG,GAAP;AAKH;;ACpBD;AACA;AACA;AACA;AACA;AACA,AAAO,SAASE,uBAAT,CAAiCT,KAAjC,EAAwC;AAC3C,MAAIA,KAAK,CAACE,KAAN,CAAY,IAAZ,EAAkBC,MAAlB,KAA6B,CAAjC,EAAoC;AAChC,WAAQ,UAASH,KAAM,EAAvB;AACH;;AACD,SAAQ,SAAQA,KAAM,EAAtB;AACH;;ACTM,eAAeU,IAAf,CAAoBV,KAApB,EAA2BW,OAA3B,EAAoCC,KAApC,EAA2CC,UAA3C,EAAuD;AAC1D,QAAMC,QAAQ,GAAGH,OAAO,CAACG,QAAR,CAAiBC,KAAjB,CAAuBH,KAAvB,EAA8BC,UAA9B,CAAjB;AACAC,EAAAA,QAAQ,CAACE,OAAT,CAAiBC,aAAjB,GAAiCR,uBAAuB,CAACT,KAAD,CAAxD;AACA,SAAOW,OAAO,CAACG,QAAD,CAAd;AACH;;MCHYI,eAAe,GAAG,SAASA,eAAT,CAAyBlB,KAAzB,EAAgC;AAC3D,MAAI,CAACA,KAAL,EAAY;AACR,UAAM,IAAImB,KAAJ,CAAU,0DAAV,CAAN;AACH;;AACD,MAAI,OAAOnB,KAAP,KAAiB,QAArB,EAA+B;AAC3B,UAAM,IAAImB,KAAJ,CAAU,uEAAV,CAAN;AACH;;AACDnB,EAAAA,KAAK,GAAGA,KAAK,CAACoB,OAAN,CAAc,oBAAd,EAAoC,EAApC,CAAR;AACA,SAAOC,MAAM,CAACC,MAAP,CAAcvB,IAAI,CAACwB,IAAL,CAAU,IAAV,EAAgBvB,KAAhB,CAAd,EAAsC;AACzCU,IAAAA,IAAI,EAAEA,IAAI,CAACa,IAAL,CAAU,IAAV,EAAgBvB,KAAhB;AADmC,GAAtC,CAAP;AAGH,CAXM;;;;"}
|
||||
@@ -0,0 +1,48 @@
|
||||
{
|
||||
"name": "registry-auth-token",
|
||||
"version": "4.2.2",
|
||||
"description": "Get the auth token set for an npm registry (if any)",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"test": "mocha",
|
||||
"posttest": "standard",
|
||||
"coverage": "istanbul cover _mocha"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+ssh://git@github.com/rexxars/registry-auth-token.git"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=6.0.0"
|
||||
},
|
||||
"keywords": [
|
||||
"npm",
|
||||
"conf",
|
||||
"config",
|
||||
"npmconf",
|
||||
"registry",
|
||||
"auth",
|
||||
"token",
|
||||
"authtoken"
|
||||
],
|
||||
"author": "Espen Hovlandsdal <espen@hovlandsdal.com>",
|
||||
"license": "MIT",
|
||||
"bugs": {
|
||||
"url": "https://github.com/rexxars/registry-auth-token/issues"
|
||||
},
|
||||
"homepage": "https://github.com/rexxars/registry-auth-token#readme",
|
||||
"dependencies": {
|
||||
"rc": "1.2.8"
|
||||
},
|
||||
"devDependencies": {
|
||||
"istanbul": "^0.4.2",
|
||||
"mocha": "^6.1.4",
|
||||
"require-uncached": "^1.0.2",
|
||||
"standard": "^12.0.1"
|
||||
},
|
||||
"standard": {
|
||||
"ignore": [
|
||||
"coverage/**"
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,78 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const is_1 = require("@sindresorhus/is");
|
||||
const normalizeArguments = (options, defaults) => {
|
||||
if (is_1.default.null_(options.encoding)) {
|
||||
throw new TypeError('To get a Buffer, set `options.responseType` to `buffer` instead');
|
||||
}
|
||||
is_1.assert.any([is_1.default.string, is_1.default.undefined], options.encoding);
|
||||
is_1.assert.any([is_1.default.boolean, is_1.default.undefined], options.resolveBodyOnly);
|
||||
is_1.assert.any([is_1.default.boolean, is_1.default.undefined], options.methodRewriting);
|
||||
is_1.assert.any([is_1.default.boolean, is_1.default.undefined], options.isStream);
|
||||
is_1.assert.any([is_1.default.string, is_1.default.undefined], options.responseType);
|
||||
// `options.responseType`
|
||||
if (options.responseType === undefined) {
|
||||
options.responseType = 'text';
|
||||
}
|
||||
// `options.retry`
|
||||
const { retry } = options;
|
||||
if (defaults) {
|
||||
options.retry = { ...defaults.retry };
|
||||
}
|
||||
else {
|
||||
options.retry = {
|
||||
calculateDelay: retryObject => retryObject.computedValue,
|
||||
limit: 0,
|
||||
methods: [],
|
||||
statusCodes: [],
|
||||
errorCodes: [],
|
||||
maxRetryAfter: undefined
|
||||
};
|
||||
}
|
||||
if (is_1.default.object(retry)) {
|
||||
options.retry = {
|
||||
...options.retry,
|
||||
...retry
|
||||
};
|
||||
options.retry.methods = [...new Set(options.retry.methods.map(method => method.toUpperCase()))];
|
||||
options.retry.statusCodes = [...new Set(options.retry.statusCodes)];
|
||||
options.retry.errorCodes = [...new Set(options.retry.errorCodes)];
|
||||
}
|
||||
else if (is_1.default.number(retry)) {
|
||||
options.retry.limit = retry;
|
||||
}
|
||||
if (is_1.default.undefined(options.retry.maxRetryAfter)) {
|
||||
options.retry.maxRetryAfter = Math.min(
|
||||
// TypeScript is not smart enough to handle `.filter(x => is.number(x))`.
|
||||
// eslint-disable-next-line unicorn/no-fn-reference-in-iterator
|
||||
...[options.timeout.request, options.timeout.connect].filter(is_1.default.number));
|
||||
}
|
||||
// `options.pagination`
|
||||
if (is_1.default.object(options.pagination)) {
|
||||
if (defaults) {
|
||||
options.pagination = {
|
||||
...defaults.pagination,
|
||||
...options.pagination
|
||||
};
|
||||
}
|
||||
const { pagination } = options;
|
||||
if (!is_1.default.function_(pagination.transform)) {
|
||||
throw new Error('`options.pagination.transform` must be implemented');
|
||||
}
|
||||
if (!is_1.default.function_(pagination.shouldContinue)) {
|
||||
throw new Error('`options.pagination.shouldContinue` must be implemented');
|
||||
}
|
||||
if (!is_1.default.function_(pagination.filter)) {
|
||||
throw new TypeError('`options.pagination.filter` must be implemented');
|
||||
}
|
||||
if (!is_1.default.function_(pagination.paginate)) {
|
||||
throw new Error('`options.pagination.paginate` must be implemented');
|
||||
}
|
||||
}
|
||||
// JSON mode
|
||||
if (options.responseType === 'json' && options.headers.accept === undefined) {
|
||||
options.headers.accept = 'application/json';
|
||||
}
|
||||
return options;
|
||||
};
|
||||
exports.default = normalizeArguments;
|
||||
@@ -0,0 +1,211 @@
|
||||
import { Operator } from '../Operator';
|
||||
import { Subscriber } from '../Subscriber';
|
||||
import { Observable } from '../Observable';
|
||||
import { Subject } from '../Subject';
|
||||
import { Subscription } from '../Subscription';
|
||||
import { OuterSubscriber } from '../OuterSubscriber';
|
||||
import { InnerSubscriber } from '../InnerSubscriber';
|
||||
import { subscribeToResult } from '../util/subscribeToResult';
|
||||
import { OperatorFunction } from '../types';
|
||||
|
||||
/**
|
||||
* Branch out the source Observable values as a nested Observable starting from
|
||||
* an emission from `openings` and ending when the output of `closingSelector`
|
||||
* emits.
|
||||
*
|
||||
* <span class="informal">It's like {@link bufferToggle}, but emits a nested
|
||||
* Observable instead of an array.</span>
|
||||
*
|
||||
* 
|
||||
*
|
||||
* Returns an Observable that emits windows of items it collects from the source
|
||||
* Observable. The output Observable emits windows that contain those items
|
||||
* emitted by the source Observable between the time when the `openings`
|
||||
* Observable emits an item and when the Observable returned by
|
||||
* `closingSelector` emits an item.
|
||||
*
|
||||
* ## Example
|
||||
* Every other second, emit the click events from the next 500ms
|
||||
* ```ts
|
||||
* import { fromEvent, interval, EMPTY } from 'rxjs';
|
||||
* import { windowToggle, mergeAll } from 'rxjs/operators';
|
||||
*
|
||||
* const clicks = fromEvent(document, 'click');
|
||||
* const openings = interval(1000);
|
||||
* const result = clicks.pipe(
|
||||
* windowToggle(openings, i => i % 2 ? interval(500) : EMPTY),
|
||||
* mergeAll()
|
||||
* );
|
||||
* result.subscribe(x => console.log(x));
|
||||
* ```
|
||||
*
|
||||
* @see {@link window}
|
||||
* @see {@link windowCount}
|
||||
* @see {@link windowTime}
|
||||
* @see {@link windowWhen}
|
||||
* @see {@link bufferToggle}
|
||||
*
|
||||
* @param {Observable<O>} openings An observable of notifications to start new
|
||||
* windows.
|
||||
* @param {function(value: O): Observable} closingSelector A function that takes
|
||||
* the value emitted by the `openings` observable and returns an Observable,
|
||||
* which, when it emits (either `next` or `complete`), signals that the
|
||||
* associated window should complete.
|
||||
* @return {Observable<Observable<T>>} An observable of windows, which in turn
|
||||
* are Observables.
|
||||
* @method windowToggle
|
||||
* @owner Observable
|
||||
*/
|
||||
export function windowToggle<T, O>(openings: Observable<O>,
|
||||
closingSelector: (openValue: O) => Observable<any>): OperatorFunction<T, Observable<T>> {
|
||||
return (source: Observable<T>) => source.lift(new WindowToggleOperator<T, O>(openings, closingSelector));
|
||||
}
|
||||
|
||||
class WindowToggleOperator<T, O> implements Operator<T, Observable<T>> {
|
||||
|
||||
constructor(private openings: Observable<O>,
|
||||
private closingSelector: (openValue: O) => Observable<any>) {
|
||||
}
|
||||
|
||||
call(subscriber: Subscriber<Observable<T>>, source: any): any {
|
||||
return source.subscribe(new WindowToggleSubscriber(
|
||||
subscriber, this.openings, this.closingSelector
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
interface WindowContext<T> {
|
||||
window: Subject<T>;
|
||||
subscription: Subscription;
|
||||
}
|
||||
|
||||
/**
|
||||
* We need this JSDoc comment for affecting ESDoc.
|
||||
* @ignore
|
||||
* @extends {Ignored}
|
||||
*/
|
||||
class WindowToggleSubscriber<T, O> extends OuterSubscriber<T, any> {
|
||||
private contexts: WindowContext<T>[] = [];
|
||||
private openSubscription: Subscription;
|
||||
|
||||
constructor(destination: Subscriber<Observable<T>>,
|
||||
private openings: Observable<O>,
|
||||
private closingSelector: (openValue: O) => Observable<any>) {
|
||||
super(destination);
|
||||
this.add(this.openSubscription = subscribeToResult(this, openings, openings as any));
|
||||
}
|
||||
|
||||
protected _next(value: T) {
|
||||
const { contexts } = this;
|
||||
if (contexts) {
|
||||
const len = contexts.length;
|
||||
for (let i = 0; i < len; i++) {
|
||||
contexts[i].window.next(value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected _error(err: any) {
|
||||
|
||||
const { contexts } = this;
|
||||
this.contexts = null;
|
||||
|
||||
if (contexts) {
|
||||
const len = contexts.length;
|
||||
let index = -1;
|
||||
|
||||
while (++index < len) {
|
||||
const context = contexts[index];
|
||||
context.window.error(err);
|
||||
context.subscription.unsubscribe();
|
||||
}
|
||||
}
|
||||
|
||||
super._error(err);
|
||||
}
|
||||
|
||||
protected _complete() {
|
||||
const { contexts } = this;
|
||||
this.contexts = null;
|
||||
if (contexts) {
|
||||
const len = contexts.length;
|
||||
let index = -1;
|
||||
while (++index < len) {
|
||||
const context = contexts[index];
|
||||
context.window.complete();
|
||||
context.subscription.unsubscribe();
|
||||
}
|
||||
}
|
||||
super._complete();
|
||||
}
|
||||
|
||||
/** @deprecated This is an internal implementation detail, do not use. */
|
||||
_unsubscribe() {
|
||||
const { contexts } = this;
|
||||
this.contexts = null;
|
||||
if (contexts) {
|
||||
const len = contexts.length;
|
||||
let index = -1;
|
||||
while (++index < len) {
|
||||
const context = contexts[index];
|
||||
context.window.unsubscribe();
|
||||
context.subscription.unsubscribe();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
notifyNext(outerValue: any, innerValue: any,
|
||||
outerIndex: number, innerIndex: number,
|
||||
innerSub: InnerSubscriber<T, any>): void {
|
||||
|
||||
if (outerValue === this.openings) {
|
||||
let closingNotifier;
|
||||
try {
|
||||
const { closingSelector } = this;
|
||||
closingNotifier = closingSelector(innerValue);
|
||||
} catch (e) {
|
||||
return this.error(e);
|
||||
}
|
||||
|
||||
const window = new Subject<T>();
|
||||
const subscription = new Subscription();
|
||||
const context = { window, subscription };
|
||||
this.contexts.push(context);
|
||||
const innerSubscription = subscribeToResult(this, closingNotifier, context as any);
|
||||
|
||||
if (innerSubscription.closed) {
|
||||
this.closeWindow(this.contexts.length - 1);
|
||||
} else {
|
||||
(<any>innerSubscription).context = context;
|
||||
subscription.add(innerSubscription);
|
||||
}
|
||||
|
||||
this.destination.next(window);
|
||||
} else {
|
||||
this.closeWindow(this.contexts.indexOf(outerValue));
|
||||
}
|
||||
}
|
||||
|
||||
notifyError(err: any): void {
|
||||
this.error(err);
|
||||
}
|
||||
|
||||
notifyComplete(inner: Subscription): void {
|
||||
if (inner !== this.openSubscription) {
|
||||
this.closeWindow(this.contexts.indexOf((<any> inner).context));
|
||||
}
|
||||
}
|
||||
|
||||
private closeWindow(index: number): void {
|
||||
if (index === -1) {
|
||||
return;
|
||||
}
|
||||
|
||||
const { contexts } = this;
|
||||
const context = contexts[index];
|
||||
const { window, subscription } = context;
|
||||
contexts.splice(index, 1);
|
||||
window.complete();
|
||||
subscription.unsubscribe();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,85 @@
|
||||
import { Operator } from '../Operator';
|
||||
import { Subscriber } from '../Subscriber';
|
||||
import { Observable } from '../Observable';
|
||||
import { OperatorFunction } from '../types';
|
||||
import { SimpleOuterSubscriber, innerSubscribe, SimpleInnerSubscriber } from '../innerSubscribe';
|
||||
|
||||
/**
|
||||
* Buffers the source Observable values until `closingNotifier` emits.
|
||||
*
|
||||
* <span class="informal">Collects values from the past as an array, and emits
|
||||
* that array only when another Observable emits.</span>
|
||||
*
|
||||
* 
|
||||
*
|
||||
* Buffers the incoming Observable values until the given `closingNotifier`
|
||||
* Observable emits a value, at which point it emits the buffer on the output
|
||||
* Observable and starts a new buffer internally, awaiting the next time
|
||||
* `closingNotifier` emits.
|
||||
*
|
||||
* ## Example
|
||||
*
|
||||
* On every click, emit array of most recent interval events
|
||||
*
|
||||
* ```ts
|
||||
* import { fromEvent, interval } from 'rxjs';
|
||||
* import { buffer } from 'rxjs/operators';
|
||||
*
|
||||
* const clicks = fromEvent(document, 'click');
|
||||
* const intervalEvents = interval(1000);
|
||||
* const buffered = intervalEvents.pipe(buffer(clicks));
|
||||
* buffered.subscribe(x => console.log(x));
|
||||
* ```
|
||||
*
|
||||
* @see {@link bufferCount}
|
||||
* @see {@link bufferTime}
|
||||
* @see {@link bufferToggle}
|
||||
* @see {@link bufferWhen}
|
||||
* @see {@link window}
|
||||
*
|
||||
* @param {Observable<any>} closingNotifier An Observable that signals the
|
||||
* buffer to be emitted on the output Observable.
|
||||
* @return {Observable<T[]>} An Observable of buffers, which are arrays of
|
||||
* values.
|
||||
* @method buffer
|
||||
* @owner Observable
|
||||
*/
|
||||
export function buffer<T>(closingNotifier: Observable<any>): OperatorFunction<T, T[]> {
|
||||
return function bufferOperatorFunction(source: Observable<T>) {
|
||||
return source.lift(new BufferOperator<T>(closingNotifier));
|
||||
};
|
||||
}
|
||||
|
||||
class BufferOperator<T> implements Operator<T, T[]> {
|
||||
|
||||
constructor(private closingNotifier: Observable<any>) {
|
||||
}
|
||||
|
||||
call(subscriber: Subscriber<T[]>, source: any): any {
|
||||
return source.subscribe(new BufferSubscriber(subscriber, this.closingNotifier));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* We need this JSDoc comment for affecting ESDoc.
|
||||
* @ignore
|
||||
* @extends {Ignored}
|
||||
*/
|
||||
class BufferSubscriber<T> extends SimpleOuterSubscriber<T, any> {
|
||||
private buffer: T[] = [];
|
||||
|
||||
constructor(destination: Subscriber<T[]>, closingNotifier: Observable<any>) {
|
||||
super(destination);
|
||||
this.add(innerSubscribe(closingNotifier, new SimpleInnerSubscriber(this)));
|
||||
}
|
||||
|
||||
protected _next(value: T) {
|
||||
this.buffer.push(value);
|
||||
}
|
||||
|
||||
notifyNext(): void {
|
||||
const buffer = this.buffer;
|
||||
this.buffer = [];
|
||||
this.destination.next!(buffer);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
/** PURE_IMPORTS_START tslib,_Subscriber PURE_IMPORTS_END */
|
||||
import * as tslib_1 from "tslib";
|
||||
import { Subscriber } from '../Subscriber';
|
||||
export function skipWhile(predicate) {
|
||||
return function (source) { return source.lift(new SkipWhileOperator(predicate)); };
|
||||
}
|
||||
var SkipWhileOperator = /*@__PURE__*/ (function () {
|
||||
function SkipWhileOperator(predicate) {
|
||||
this.predicate = predicate;
|
||||
}
|
||||
SkipWhileOperator.prototype.call = function (subscriber, source) {
|
||||
return source.subscribe(new SkipWhileSubscriber(subscriber, this.predicate));
|
||||
};
|
||||
return SkipWhileOperator;
|
||||
}());
|
||||
var SkipWhileSubscriber = /*@__PURE__*/ (function (_super) {
|
||||
tslib_1.__extends(SkipWhileSubscriber, _super);
|
||||
function SkipWhileSubscriber(destination, predicate) {
|
||||
var _this = _super.call(this, destination) || this;
|
||||
_this.predicate = predicate;
|
||||
_this.skipping = true;
|
||||
_this.index = 0;
|
||||
return _this;
|
||||
}
|
||||
SkipWhileSubscriber.prototype._next = function (value) {
|
||||
var destination = this.destination;
|
||||
if (this.skipping) {
|
||||
this.tryCallPredicate(value);
|
||||
}
|
||||
if (!this.skipping) {
|
||||
destination.next(value);
|
||||
}
|
||||
};
|
||||
SkipWhileSubscriber.prototype.tryCallPredicate = function (value) {
|
||||
try {
|
||||
var result = this.predicate(value, this.index++);
|
||||
this.skipping = Boolean(result);
|
||||
}
|
||||
catch (err) {
|
||||
this.destination.error(err);
|
||||
}
|
||||
};
|
||||
return SkipWhileSubscriber;
|
||||
}(Subscriber));
|
||||
//# sourceMappingURL=skipWhile.js.map
|
||||
@@ -0,0 +1 @@
|
||||
module.exports={A:{A:{"1":"B","2":"J E F G A BC"},B:{"1":"P Q R S T U V W X Y Z a b c d f g h i j k l m n o p q r s D t","2":"C K L H M N O"},C:{"2":"0 1 2 3 4 5 6 7 8 9 CC tB I u J E F G A B C K L H M N O v w x y z 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 uB ZB vB aB bB cB dB eB fB gB hB iB jB kB e lB mB nB oB pB P Q R wB S T U V W X Y Z a b c d f g h i j k l m n o p q r s D t xB yB DC EC"},D:{"1":"0 1 2 3 4 5 6 7 8 9 K L H M N O v w x y z 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 uB ZB vB aB bB cB dB eB fB gB hB iB jB kB e lB mB nB oB pB P Q R S T U V W X Y Z a b c d f g h i j k l m n o p q r s D t xB yB FC","2":"I u J E F G A B C"},E:{"2":"I u J E F G A B C K L H GC zB HC IC JC KC 0B qB rB 1B LC MC 2B 3B 4B 5B sB 6B 7B 8B NC"},F:{"1":"0 1 2 3 4 5 6 7 8 9 H M N O v w x y z 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 e lB mB nB oB pB P Q R wB S T U V W X Y Z a b c d","2":"G B C OC PC QC RC qB 9B SC rB"},G:{"2":"F zB TC AC UC VC WC XC YC ZC aC bC cC dC eC fC gC hC iC jC kC lC mC 2B 3B 4B 5B sB 6B 7B 8B"},H:{"2":"nC"},I:{"2":"tB I D oC pC qC rC AC sC tC"},J:{"2":"E A"},K:{"1":"e","2":"A B C qB 9B rB"},L:{"1":"D"},M:{"2":"D"},N:{"1":"B","2":"A"},O:{"1":"uC"},P:{"1":"I vC wC xC yC zC 0B 0C 1C 2C 3C 4C sB 5C 6C 7C"},Q:{"1":"1B"},R:{"1":"8C"},S:{"2":"9C"}},B:5,C:"Resource Hints: prerender"};
|
||||
@@ -0,0 +1,29 @@
|
||||
type IsAny<T> = 0 extends (1 & T) ? true : false; // https://stackoverflow.com/a/49928360/3406963
|
||||
type IsNever<T> = [T] extends [never] ? true : false;
|
||||
type IsUnknown<T> = IsNever<T> extends false ? T extends unknown ? unknown extends T ? IsAny<T> extends false ? true : false : false : false : false;
|
||||
|
||||
/**
|
||||
Create a function type with a return type of your choice and the same parameters as the given function type.
|
||||
|
||||
Use-case: You want to define a wrapped function that returns something different while receiving the same parameters. For example, you might want to wrap a function that can throw an error into one that will return `undefined` instead.
|
||||
|
||||
@example
|
||||
```
|
||||
import {SetReturnType} from 'type-fest';
|
||||
|
||||
type MyFunctionThatCanThrow = (foo: SomeType, bar: unknown) => SomeOtherType;
|
||||
|
||||
type MyWrappedFunction = SetReturnType<MyFunctionThatCanThrow, SomeOtherType | undefined>;
|
||||
//=> type MyWrappedFunction = (foo: SomeType, bar: unknown) => SomeOtherType | undefined;
|
||||
```
|
||||
*/
|
||||
export type SetReturnType<Fn extends (...args: any[]) => any, TypeToReturn> =
|
||||
// Just using `Parameters<Fn>` isn't ideal because it doesn't handle the `this` fake parameter.
|
||||
Fn extends (this: infer ThisArg, ...args: infer Arguments) => any ? (
|
||||
// If a function did not specify the `this` fake parameter, it will be inferred to `unknown`.
|
||||
// We want to detect this situation just to display a friendlier type upon hovering on an IntelliSense-powered IDE.
|
||||
IsUnknown<ThisArg> extends true ? (...args: Arguments) => TypeToReturn : (this: ThisArg, ...args: Arguments) => TypeToReturn
|
||||
) : (
|
||||
// This part should be unreachable, but we make it meaningful just in case…
|
||||
(...args: Parameters<Fn>) => TypeToReturn
|
||||
);
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"timer.js","sources":["../../src/internal/observable/timer.ts"],"names":[],"mappings":";;AAAA,4CAA2C;AAE3C,4CAA2C;AAC3C,+CAA8C;AAC9C,mDAAkD;AAqDlD,SAAgB,KAAK,CAAC,OAA0B,EAC1B,iBAA0C,EAC1C,SAAyB;IAFzB,wBAAA,EAAA,WAA0B;IAG9C,IAAI,MAAM,GAAG,CAAC,CAAC,CAAC;IAChB,IAAI,qBAAS,CAAC,iBAAiB,CAAC,EAAE;QAChC,MAAM,GAAG,MAAM,CAAC,iBAAiB,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,MAAM,CAAC,iBAAiB,CAAC,CAAC;KAC1E;SAAM,IAAI,yBAAW,CAAC,iBAAiB,CAAC,EAAE;QACzC,SAAS,GAAG,iBAAwB,CAAC;KACtC;IAED,IAAI,CAAC,yBAAW,CAAC,SAAS,CAAC,EAAE;QAC3B,SAAS,GAAG,aAAK,CAAC;KACnB;IAED,OAAO,IAAI,uBAAU,CAAC,UAAA,UAAU;QAC9B,IAAM,GAAG,GAAG,qBAAS,CAAC,OAAO,CAAC;YAC5B,CAAC,CAAE,OAAkB;YACrB,CAAC,CAAC,CAAC,CAAC,OAAO,GAAG,SAAS,CAAC,GAAG,EAAE,CAAC,CAAC;QAEjC,OAAO,SAAS,CAAC,QAAQ,CAAC,QAAQ,EAAE,GAAG,EAAE;YACvC,KAAK,EAAE,CAAC,EAAE,MAAM,QAAA,EAAE,UAAU,YAAA;SAC7B,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC;AAvBD,sBAuBC;AAQD,SAAS,QAAQ,CAAoC,KAAiB;IAC5D,IAAA,mBAAK,EAAE,qBAAM,EAAE,6BAAU,CAAW;IAC5C,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAEvB,IAAI,UAAU,CAAC,MAAM,EAAE;QACrB,OAAO;KACR;SAAM,IAAI,MAAM,KAAK,CAAC,CAAC,EAAE;QACxB,OAAO,UAAU,CAAC,QAAQ,EAAE,CAAC;KAC9B;IAED,KAAK,CAAC,KAAK,GAAG,KAAK,GAAG,CAAC,CAAC;IACxB,IAAI,CAAC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;AAC/B,CAAC"}
|
||||
Reference in New Issue
Block a user