new license file version [CI SKIP]

This commit is contained in:
2023-03-15 13:43:57 +00:00
parent d8a3063735
commit 00359d25c1
5600 changed files with 523898 additions and 2 deletions

View File

@@ -0,0 +1,470 @@
# http2-wrapper
> HTTP/2 client, just with the familiar `https` API
[![Node CI](https://github.com/szmarczak/http2-wrapper/workflows/Node%20CI/badge.svg)](https://github.com/szmarczak/http2-wrapper/actions)
[![codecov](https://codecov.io/gh/szmarczak/http2-wrapper/branch/master/graph/badge.svg)](https://codecov.io/gh/szmarczak/http2-wrapper)
[![npm](https://img.shields.io/npm/dm/http2-wrapper.svg)](https://www.npmjs.com/package/http2-wrapper)
[![install size](https://packagephobia.now.sh/badge?p=http2-wrapper)](https://packagephobia.now.sh/result?p=http2-wrapper)
This package was created to support HTTP/2 without the need to rewrite your code.<br>
I recommend adapting to the [`http2`](https://nodejs.org/api/http2.html) module if possible - it's much simpler to use and has many cool features!
**Tip**: `http2-wrapper` is very useful when you rely on other modules that use the HTTP/1 API and you want to support HTTP/2.
**Pro Tip**: While the native `http2` doesn't have agents yet, you can use `http2-wrapper` Agents and still operate on the native HTTP/2 streams.
## Installation
> `$ npm install http2-wrapper`<br>
> `$ yarn add http2-wrapper`
## Usage
```js
const http2 = require('http2-wrapper');
const options = {
hostname: 'nghttp2.org',
protocol: 'https:',
path: '/httpbin/post',
method: 'POST',
headers: {
'content-length': 6
}
};
const request = http2.request(options, response => {
console.log('statusCode:', response.statusCode);
console.log('headers:', response.headers);
const body = [];
response.on('data', chunk => {
body.push(chunk);
});
response.on('end', () => {
console.log('body:', Buffer.concat(body).toString());
});
});
request.on('error', console.error);
request.write('123');
request.end('456');
// statusCode: 200
// headers: [Object: null prototype] {
// ':status': 200,
// date: 'Fri, 27 Sep 2019 19:45:46 GMT',
// 'content-type': 'application/json',
// 'access-control-allow-origin': '*',
// 'access-control-allow-credentials': 'true',
// 'content-length': '239',
// 'x-backend-header-rtt': '0.002516',
// 'strict-transport-security': 'max-age=31536000',
// server: 'nghttpx',
// via: '1.1 nghttpx',
// 'alt-svc': 'h3-23=":4433"; ma=3600',
// 'x-frame-options': 'SAMEORIGIN',
// 'x-xss-protection': '1; mode=block',
// 'x-content-type-options': 'nosniff'
// }
// body: {
// "args": {},
// "data": "123456",
// "files": {},
// "form": {},
// "headers": {
// "Content-Length": "6",
// "Host": "nghttp2.org"
// },
// "json": 123456,
// "origin": "xxx.xxx.xxx.xxx",
// "url": "https://nghttp2.org/httpbin/post"
// }
```
## API
**Note:** The `session` option was renamed to `tlsSession` for better readability.
### http2.auto(url, options, callback)
Performs [ALPN](https://nodejs.org/api/tls.html#tls_alpn_and_sni) negotiation.
Returns a Promise giving proper `ClientRequest` instance (depending on the ALPN).
**Note**: The `agent` option represents an object with `http`, `https` and `http2` properties.
```js
const http2 = require('http2-wrapper');
const options = {
hostname: 'httpbin.org',
protocol: 'http:', // Note the `http:` protocol here
path: '/post',
method: 'POST',
headers: {
'content-length': 6
}
};
(async () => {
try {
const request = await http2.auto(options, response => {
console.log('statusCode:', response.statusCode);
console.log('headers:', response.headers);
const body = [];
response.on('data', chunk => body.push(chunk));
response.on('end', () => {
console.log('body:', Buffer.concat(body).toString());
});
});
request.on('error', console.error);
request.write('123');
request.end('456');
} catch (error) {
console.error(error);
}
})();
// statusCode: 200
// headers: { connection: 'close',
// server: 'gunicorn/19.9.0',
// date: 'Sat, 15 Dec 2018 18:19:32 GMT',
// 'content-type': 'application/json',
// 'content-length': '259',
// 'access-control-allow-origin': '*',
// 'access-control-allow-credentials': 'true',
// via: '1.1 vegur' }
// body: {
// "args": {},
// "data": "123456",
// "files": {},
// "form": {},
// "headers": {
// "Connection": "close",
// "Content-Length": "6",
// "Host": "httpbin.org"
// },
// "json": 123456,
// "origin": "xxx.xxx.xxx.xxx",
// "url": "http://httpbin.org/post"
// }
```
### http2.auto.protocolCache
An instance of [`quick-lru`](https://github.com/sindresorhus/quick-lru) used for ALPN cache.
There is a maximum of 100 entries. You can modify the limit through `protocolCache.maxSize` - note that the change will be visible globally.
### http2.request(url, options, callback)
Same as [`https.request`](https://nodejs.org/api/https.html#https_https_request_options_callback).
##### options.h2session
Type: `Http2Session`<br>
The session used to make the actual request. If none provided, it will use `options.agent`.
### http2.get(url, options, callback)
Same as [`https.get`](https://nodejs.org/api/https.html#https_https_get_options_callback).
### new http2.ClientRequest(url, options, callback)
Same as [`https.ClientRequest`](https://nodejs.org/api/https.html#https_class_https_clientrequest).
### new http2.IncomingMessage(socket)
Same as [`https.IncomingMessage`](https://nodejs.org/api/https.html#https_class_https_incomingmessage).
### new http2.Agent(options)
**Note:** this is **not** compatible with the classic `http.Agent`.
Usage example:
```js
const http2 = require('http2-wrapper');
class MyAgent extends http2.Agent {
createConnection(origin, options) {
console.log(`Connecting to ${http2.Agent.normalizeOrigin(origin)}`);
return http2.Agent.connect(origin, options);
}
}
http2.get({
hostname: 'google.com',
agent: new MyAgent()
}, res => {
res.on('data', chunk => console.log(`Received chunk of ${chunk.length} bytes`));
});
```
#### options
Each option is assigned to each `Agent` instance and can be changed later.
##### timeout
Type: `number`<br>
Default: `60000`
If there's no activity after `timeout` milliseconds, the session will be closed.
##### maxSessions
Type: `number`<br>
Default: `Infinity`
The maximum amount of sessions in total.
##### maxFreeSessions
Type: `number`<br>
Default: `10`
The maximum amount of free sessions in total. This only applies to sessions with no pending requests.
**Note:** It is possible that the amount will be exceeded when sessions have at least 1 pending request.
##### maxCachedTlsSessions
Type: `number`<br>
Default: `100`
The maximum amount of cached TLS sessions.
#### Agent.normalizeOrigin(url)
Returns a string representing the origin of the URL.
#### agent.settings
Type: `object`<br>
Default: `{enablePush: false}`
[Settings](https://nodejs.org/api/http2.html#http2_settings_object) used by the current agent instance.
#### agent.normalizeOptions([options](https://github.com/szmarczak/http2-wrapper/blob/master/source/agent.js))
Returns a string representing normalized options.
```js
Agent.normalizeOptions({servername: 'example.com'});
// => ':example.com'
```
#### agent.getSession(origin, options)
##### [origin](https://nodejs.org/api/http2.html#http2_http2_connect_authority_options_listener)
Type: `string` `URL` `object`
An origin used to create new session.
##### [options](https://nodejs.org/api/http2.html#http2_http2_connect_authority_options_listener)
Type: `object`
The options used to create new session.
Returns a Promise giving free `Http2Session`. If no free sessions are found, a new one is created.
#### agent.getSession([origin](#origin), [options](options-1), listener)
##### listener
Type: `object`
```
{
reject: error => void,
resolve: session => void
}
```
If the `listener` argument is present, the Promise will resolve immediately. It will use the `resolve` function to pass the session.
#### agent.request([origin](#origin), [options](#options-1), [headers](https://nodejs.org/api/http2.html#http2_headers_object), [streamOptions](https://nodejs.org/api/http2.html#http2_clienthttp2session_request_headers_options))
Returns a Promise giving `Http2Stream`.
#### agent.createConnection([origin](#origin), [options](#options-1))
Returns a new `TLSSocket`. It defaults to `Agent.connect(origin, options)`.
#### agent.closeFreeSessions()
Makes an attempt to close free sessions. Only sessions with 0 concurrent streams will be closed.
#### agent.destroy(reason)
Destroys **all** sessions.
#### Event: 'session'
```js
agent.on('session', session => {
// A new session has been created by the Agent.
});
```
## Proxy support
An example of a full-featured proxy server can be found [here](examples/proxy/server.js). It supports **mirroring, custom authorities and the CONNECT protocol**.
### Mirroring
To mirror another server we need to use only [`http2-proxy`](https://github.com/nxtedition/node-http2-proxy). We don't need the CONNECT protocol or custom authorities.
To see the result, just navigate to the server's address.
### HTTP/1 over HTTP/2
Since we don't care about mirroring, the server needs to support the CONNECT protocol in this case.
The client looks like this:
```js
const https = require('https');
const http2 = require('http2');
const session = http2.connect('https://localhost:8000', {
// For demo purposes only!
rejectUnauthorized: false
});
session.ref();
https.request('https://httpbin.org/anything', {
createConnection: options => {
return session.request({
':method': 'CONNECT',
':authority': `${options.host}:${options.port}`
});
}
}, response => {
console.log('statusCode:', response.statusCode);
console.log('headers:', response.headers);
const body = [];
response.on('data', chunk => {
body.push(chunk);
});
response.on('end', () => {
console.log('body:', Buffer.concat(body).toString());
session.unref();
});
}).end();
```
### HTTP/2 over HTTP/2
It's a tricky one! We cannot create an HTTP/2 session on top of an HTTP/2 stream. But... we can still specify the `:authority` header, no need to use the CONNECT protocol here.
The client looks like this:
```js
const http2 = require('../../source');
const {Agent} = http2;
class ProxyAgent extends Agent {
constructor(url, options) {
super(options);
this.origin = url;
}
request(origin, sessionOptions, headers, streamOptions) {
return super.request(this.origin, sessionOptions, {
...headers,
':authority': (new URL(origin)).host
}, streamOptions);
}
}
const request = http2.request({
hostname: 'httpbin.org',
protocol: 'https:',
path: '/anything',
agent: new ProxyAgent('https://localhost:8000'),
// For demo purposes only!
rejectUnauthorized: false
}, response => {
console.log('statusCode:', response.statusCode);
console.log('headers:', response.headers);
const body = [];
response.on('data', chunk => {
body.push(chunk);
});
response.on('end', () => {
console.log('body:', Buffer.concat(body).toString());
});
});
request.on('error', console.error);
request.end();
```
## Notes
- If you're interested in [WebSockets over HTTP/2](https://tools.ietf.org/html/rfc8441), then [check out this discussion](https://github.com/websockets/ws/issues/1458).
- [HTTP/2 sockets cannot be malformed](https://github.com/nodejs/node/blob/cc8250fab86486632fdeb63892be735d7628cd13/lib/internal/http2/core.js#L725), therefore modifying the socket will have no effect.
- You can make [a custom Agent](examples/push-stream/index.js) to support push streams.
## Benchmarks
CPU: Intel i7-7700k (governor: performance)<br>
Server: H2O v2.2.5 [`h2o.conf`](h2o.conf)<br>
Node: v14.5.0
Linux: 5.6.18-156.current
`auto` means `http2wrapper.auto`.
```
http2-wrapper x 12,181 ops/sec ±3.39% (75 runs sampled)
http2-wrapper - preconfigured session x 13,140 ops/sec ±2.51% (79 runs sampled)
http2-wrapper - auto x 11,412 ops/sec ±2.55% (78 runs sampled)
http2 x 16,050 ops/sec ±1.39% (86 runs sampled)
https - auto - keepalive x 12,288 ops/sec ±2.69% (79 runs sampled)
https - keepalive x 12,155 ops/sec ±3.32% (78 runs sampled)
https x 1,604 ops/sec ±2.03% (77 runs sampled)
http x 6,041 ops/sec ±3.82% (76 runs sampled)
Fastest is http2
```
`http2-wrapper`:
- 32% **less** performant than `http2`
- as performant as `https - keepalive`
- 100% **more** performant than `http`
`http2-wrapper - preconfigured session`:
- 22% **less** performant than `http2`
- 8% **more** performant than `https - keepalive`
- 118% **more** performant than `http`
`http2-wrapper - auto`:
- 41% **less** performant than `http2`
- 8% **less** performant than `https - keepalive`
- 89% **more** performant than `http`
`https - auto - keepalive`:
- 31% **less** performant than `http2`
- as performant as `https - keepalive`
- 103% **more** performant than `http`
## Related
- [`got`](https://github.com/sindresorhus/got) - Simplified HTTP requests
## License
MIT

View File

@@ -0,0 +1 @@
module.exports={C:{"2":0,"3":0,"4":0,"5":0,"6":0,"7":0,"8":0,"9":0,"10":0,"11":0,"12":0,"13":0,"14":0,"15":0,"16":0,"17":0,"18":0,"19":0,"20":0,"21":0,"22":0,"23":0,"24":0,"25":0,"26":0,"27":0,"28":0,"29":0,"30":0,"31":0,"32":0,"33":0,"34":0,"35":0,"36":0,"37":0,"38":0,"39":0,"40":0,"41":0,"42":0,"43":0,"44":0,"45":0,"46":0,"47":0,"48":0,"49":0,"50":0,"51":0,"52":0.00421,"53":0,"54":0,"55":0,"56":0,"57":0,"58":0,"59":0,"60":0,"61":0,"62":0,"63":0,"64":0,"65":0,"66":0,"67":0,"68":0,"69":0,"70":0,"71":0,"72":0,"73":0,"74":0,"75":0,"76":0,"77":0,"78":0.02944,"79":0,"80":0,"81":0,"82":0,"83":0,"84":0,"85":0,"86":0,"87":0,"88":0,"89":0,"90":0.00421,"91":0,"92":0,"93":0,"94":0,"95":0,"96":0,"97":0,"98":0,"99":0,"100":0,"101":0,"102":0.02944,"103":0,"104":0.00841,"105":0,"106":0,"107":0.01682,"108":0.54245,"109":0.3364,"110":0.01682,"111":0,"3.5":0,"3.6":0},D:{"4":0,"5":0,"6":0,"7":0,"8":0,"9":0,"10":0,"11":0,"12":0,"13":0,"14":0,"15":0,"16":0,"17":0,"18":0,"19":0,"20":0,"21":0,"22":0.00841,"23":0,"24":0,"25":0,"26":0,"27":0,"28":0,"29":0,"30":0,"31":0,"32":0,"33":0,"34":0,"35":0,"36":0,"37":0,"38":0,"39":0,"40":0,"41":0,"42":0,"43":0,"44":0,"45":0,"46":0,"47":0,"48":0,"49":0.00421,"50":0,"51":0,"52":0,"53":0,"54":0,"55":0,"56":0,"57":0,"58":0,"59":0,"60":0,"61":0,"62":0,"63":0,"64":0,"65":0,"66":0,"67":0.00421,"68":0,"69":0,"70":0,"71":0,"72":0,"73":0,"74":0,"75":0,"76":0,"77":0.00421,"78":0,"79":0.01262,"80":0,"81":0.00841,"83":0,"84":0,"85":0,"86":0,"87":0.00421,"88":0.00421,"89":0.00421,"90":0,"91":0.00421,"92":0,"93":0.00421,"94":0,"95":0,"96":0,"97":0.00421,"98":0.01262,"99":0.01262,"100":0.00841,"101":0,"102":0.00841,"103":0.04205,"104":0.01262,"105":0.34481,"106":0.00841,"107":0.29856,"108":3.74666,"109":3.82235,"110":0,"111":0,"112":0},F:{"9":0,"11":0,"12":0,"15":0,"16":0,"17":0,"18":0,"19":0,"20":0,"21":0,"22":0,"23":0,"24":0,"25":0,"26":0,"27":0,"28":0,"29":0,"30":0,"31":0,"32":0,"33":0,"34":0,"35":0,"36":0,"37":0,"38":0,"39":0,"40":0,"41":0,"42":0,"43":0,"44":0,"45":0,"46":0,"47":0,"48":0,"49":0,"50":0,"51":0,"52":0,"53":0,"54":0,"55":0,"56":0,"57":0,"58":0,"60":0,"62":0,"63":0,"64":0,"65":0,"66":0,"67":0,"68":0,"69":0,"70":0,"71":0,"72":0,"73":0,"74":0,"75":0,"76":0,"77":0,"78":0,"79":0,"80":0,"81":0,"82":0,"83":0,"84":0,"85":0.00421,"86":0.00421,"87":0,"88":0,"89":0,"90":0,"91":0,"92":0.00421,"93":0.50881,"94":0.29015,"9.5-9.6":0,"10.0-10.1":0,"10.5":0,"10.6":0,"11.1":0,"11.5":0,"11.6":0,"12.1":0},B:{"12":0,"13":0,"14":0,"15":0,"16":0,"17":0,"18":0,"79":0,"80":0,"81":0,"83":0,"84":0,"85":0,"86":0,"87":0,"88":0,"89":0,"90":0,"91":0,"92":0,"93":0,"94":0,"95":0,"96":0,"97":0,"98":0,"99":0,"100":0,"101":0,"102":0,"103":0,"104":0,"105":0,"106":0,"107":0.00841,"108":0.64337,"109":0.56347},E:{"4":0,"5":0,"6":0,"7":0,"8":0,"9":0,"10":0,"11":0,"12":0,"13":0.00421,"14":0.03785,"15":0.00841,_:"0","3.1":0,"3.2":0,"5.1":0,"6.1":0,"7.1":0,"9.1":0,"10.1":0,"11.1":0.00421,"12.1":0.00841,"13.1":0.06728,"14.1":0.10513,"15.1":0.07569,"15.2-15.3":0.0799,"15.4":0.18082,"15.5":0.32379,"15.6":2.02681,"16.0":0.2523,"16.1":0.76111,"16.2":1.56006,"16.3":0.18082},G:{"8":0,"3.2":0,"4.0-4.1":0,"4.2-4.3":0,"5.0-5.1":0,"6.0-6.1":0,"7.0-7.1":0,"8.1-8.4":0.02864,"9.0-9.2":0,"9.3":0.1031,"10.0-10.2":0,"10.3":0.09737,"11.0-11.2":0.00573,"11.3-11.4":0,"12.0-12.1":0,"12.2-12.5":0.46968,"13.0-13.1":0,"13.2":0.01146,"13.3":0.00573,"13.4-13.7":0.13174,"14.0-14.4":0.4525,"14.5-14.8":0.59569,"15.0-15.1":0.30357,"15.2-15.3":0.61288,"15.4":0.6186,"15.5":1.50642,"15.6":7.66382,"16.0":9.02131,"16.1":19.10227,"16.2":12.33199,"16.3":1.09974},P:{"4":0.09329,"5.0-5.4":0,"6.2-6.4":0,"7.2-7.4":0,"8.2":0,"9.2":0,"10.1":0,"11.1-11.2":0,"12.0":0,"13.0":0,"14.0":0,"15.0":0,"16.0":0,"17.0":0.0311,"18.0":0.02073,"19.0":1.12979},I:{"0":0,"3":0,"4":0,"2.1":0,"2.2":0,"2.3":0,"4.1":0,"4.2-4.3":0.01493,"4.4":0,"4.4.3-4.4.4":0.05973},K:{_:"0 10 11 12 11.1 11.5 12.1"},A:{"6":0,"7":0,"8":0,"9":0,"10":0,"11":0.02944,"5.5":0},J:{"7":0,"10":0},N:{"10":0,"11":0},R:{_:"0"},M:{"0":0.29555},Q:{"13.1":0},O:{"0":0.0058},H:{"0":0.05486},L:{"0":26.1029},S:{"2.5":0}};

View File

@@ -0,0 +1,44 @@
import { AsyncAction } from './AsyncAction';
import { Subscription } from '../Subscription';
import { QueueScheduler } from './QueueScheduler';
import { SchedulerAction } from '../types';
/**
* We need this JSDoc comment for affecting ESDoc.
* @ignore
* @extends {Ignored}
*/
export class QueueAction<T> extends AsyncAction<T> {
constructor(protected scheduler: QueueScheduler,
protected work: (this: SchedulerAction<T>, state?: T) => void) {
super(scheduler, work);
}
public schedule(state?: T, delay: number = 0): Subscription {
if (delay > 0) {
return super.schedule(state, delay);
}
this.delay = delay;
this.state = state;
this.scheduler.flush(this);
return this;
}
public execute(state: T, delay: number): any {
return (delay > 0 || this.closed) ?
super.execute(state, delay) :
this._execute(state, delay) ;
}
protected requestAsyncId(scheduler: QueueScheduler, id?: any, delay: number = 0): any {
// If delay exists and is greater than 0, or if the delay is null (the
// action wasn't rescheduled) but was originally scheduled as an async
// action, then recycle as an async action.
if ((delay !== null && delay > 0) || (delay === null && this.delay > 0)) {
return super.requestAsyncId(scheduler, id, delay);
}
// Otherwise flush the scheduler starting with this action.
return scheduler.flush(this);
}
}

View File

@@ -0,0 +1,37 @@
'use strict';
const os = require('os');
const nameMap = new Map([
[21, ['Monterey', '12']],
[20, ['Big Sur', '11']],
[19, ['Catalina', '10.15']],
[18, ['Mojave', '10.14']],
[17, ['High Sierra', '10.13']],
[16, ['Sierra', '10.12']],
[15, ['El Capitan', '10.11']],
[14, ['Yosemite', '10.10']],
[13, ['Mavericks', '10.9']],
[12, ['Mountain Lion', '10.8']],
[11, ['Lion', '10.7']],
[10, ['Snow Leopard', '10.6']],
[9, ['Leopard', '10.5']],
[8, ['Tiger', '10.4']],
[7, ['Panther', '10.3']],
[6, ['Jaguar', '10.2']],
[5, ['Puma', '10.1']]
]);
const macosRelease = release => {
release = Number((release || os.release()).split('.')[0]);
const [name, version] = nameMap.get(release);
return {
name,
version
};
};
module.exports = macosRelease;
// TODO: remove this in the next major version
module.exports.default = macosRelease;

View File

@@ -0,0 +1,40 @@
{
"name": "to-readable-stream",
"version": "1.0.0",
"description": "Convert a string/Buffer/Uint8Array to a readable stream",
"license": "MIT",
"repository": "sindresorhus/to-readable-stream",
"author": {
"name": "Sindre Sorhus",
"email": "sindresorhus@gmail.com",
"url": "sindresorhus.com"
},
"engines": {
"node": ">=6"
},
"scripts": {
"test": "xo && ava"
},
"files": [
"index.js"
],
"keywords": [
"stream",
"readablestream",
"string",
"buffer",
"uint8array",
"from",
"into",
"to",
"transform",
"convert",
"readable",
"pull"
],
"devDependencies": {
"ava": "*",
"get-stream": "^3.0.0",
"xo": "*"
}
}

View File

@@ -0,0 +1,82 @@
const _ = require('lodash');
const sinon = require('sinon');
const semver = require('semver');
const { parseVersion } = require('../../lib/util');
const Log = require('../../lib/log');
const Config = require('../../lib/config');
const ShellStub = require('../stub/shell');
const Spinner = require('../../lib/spinner');
const Prompt = require('../../lib/prompt');
module.exports.factory = (Definition, { namespace, options = {}, container = {} } = {}) => {
_.defaults(options, { ci: true, verbose: false, 'dry-run': false, debug: false });
const ns = namespace || Definition.name.toLowerCase();
container.config = container.config || new Config(Object.assign({ config: false }, options));
container.log = container.log || sinon.createStubInstance(Log);
const spinner = container.spinner || sinon.createStubInstance(Spinner);
spinner.show.callsFake(({ enabled = true, task }) => (enabled ? task() : () => {}));
container.spinner = spinner;
container.shell = container.shell || new ShellStub({ container });
container.prompt = container.prompt || new Prompt({ container });
container.shell.cache = { set: () => {}, has: () => false };
return new Definition({
namespace: ns,
options,
container
});
};
const getIncrement = (plugin, { latestVersion }) => {
return (
plugin.getIncrement({
latestVersion,
increment: plugin.options.increment,
isPreRelease: false,
preReleaseId: null
}) ||
plugin.getContext('increment') ||
plugin.config.getContext('increment')
);
};
const getVersion = async (plugin, { latestVersion, increment }) => {
return (
(await plugin.getIncrementedVersionCI({ latestVersion, increment })) ||
(await plugin.getIncrementedVersion({ latestVersion, increment })) ||
(increment !== false ? semver.inc(latestVersion, increment || 'patch') : latestVersion)
);
};
module.exports.runTasks = async plugin => {
await plugin.init();
const name = (await plugin.getName()) || '__test__';
const latestVersion = (await plugin.getLatestVersion()) || '1.0.0';
const changelog = (await plugin.getChangelog(latestVersion)) || null;
const increment = getIncrement(plugin, { latestVersion });
plugin.config.setContext({ name, latestVersion, latestTag: latestVersion, changelog });
const version = await getVersion(plugin, { latestVersion, increment });
plugin.config.setContext(parseVersion(version));
await plugin.beforeBump();
await plugin.bump(version);
plugin.config.setContext({ tagName: version });
await plugin.beforeRelease();
await plugin.release();
await plugin.afterRelease();
return {
name,
latestVersion,
version
};
};

View File

@@ -0,0 +1,156 @@
'use strict';
const fs = require('fs');
const path = require('path');
const {promisify} = require('util');
const semver = require('semver');
const useNativeRecursiveOption = semver.satisfies(process.version, '>=10.12.0');
// https://github.com/nodejs/node/issues/8987
// https://github.com/libuv/libuv/pull/1088
const checkPath = pth => {
if (process.platform === 'win32') {
const pathHasInvalidWinCharacters = /[<>:"|?*]/.test(pth.replace(path.parse(pth).root, ''));
if (pathHasInvalidWinCharacters) {
const error = new Error(`Path contains invalid characters: ${pth}`);
error.code = 'EINVAL';
throw error;
}
}
};
const processOptions = options => {
// https://github.com/sindresorhus/make-dir/issues/18
const defaults = {
mode: 0o777,
fs
};
return {
...defaults,
...options
};
};
const permissionError = pth => {
// This replicates the exception of `fs.mkdir` with native the
// `recusive` option when run on an invalid drive under Windows.
const error = new Error(`operation not permitted, mkdir '${pth}'`);
error.code = 'EPERM';
error.errno = -4048;
error.path = pth;
error.syscall = 'mkdir';
return error;
};
const makeDir = async (input, options) => {
checkPath(input);
options = processOptions(options);
const mkdir = promisify(options.fs.mkdir);
const stat = promisify(options.fs.stat);
if (useNativeRecursiveOption && options.fs.mkdir === fs.mkdir) {
const pth = path.resolve(input);
await mkdir(pth, {
mode: options.mode,
recursive: true
});
return pth;
}
const make = async pth => {
try {
await mkdir(pth, options.mode);
return pth;
} catch (error) {
if (error.code === 'EPERM') {
throw error;
}
if (error.code === 'ENOENT') {
if (path.dirname(pth) === pth) {
throw permissionError(pth);
}
if (error.message.includes('null bytes')) {
throw error;
}
await make(path.dirname(pth));
return make(pth);
}
try {
const stats = await stat(pth);
if (!stats.isDirectory()) {
throw new Error('The path is not a directory');
}
} catch (_) {
throw error;
}
return pth;
}
};
return make(path.resolve(input));
};
module.exports = makeDir;
module.exports.sync = (input, options) => {
checkPath(input);
options = processOptions(options);
if (useNativeRecursiveOption && options.fs.mkdirSync === fs.mkdirSync) {
const pth = path.resolve(input);
fs.mkdirSync(pth, {
mode: options.mode,
recursive: true
});
return pth;
}
const make = pth => {
try {
options.fs.mkdirSync(pth, options.mode);
} catch (error) {
if (error.code === 'EPERM') {
throw error;
}
if (error.code === 'ENOENT') {
if (path.dirname(pth) === pth) {
throw permissionError(pth);
}
if (error.message.includes('null bytes')) {
throw error;
}
make(path.dirname(pth));
return make(pth);
}
try {
if (!options.fs.statSync(pth).isDirectory()) {
throw new Error('The path is not a directory');
}
} catch (_) {
throw error;
}
}
return pth;
};
return make(path.resolve(input));
};

View File

@@ -0,0 +1 @@
module.exports={A:{A:{"2":"J E F G A B BC"},B:{"1":"N O 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"},C:{"1":"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","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 DC EC"},D:{"1":"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":"0 1 2 3 4 5 6 7 8 9 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"},E:{"1":"B C K L H 0B qB rB 1B LC MC 2B 3B 4B 5B sB 6B 7B 8B NC","2":"I u J E F G A GC zB HC IC JC KC"},F:{"1":"3 4 5 6 7 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 e lB mB nB oB pB P Q R wB S T U V W X Y Z a b c d","2":"0 1 2 G B C H M N O v w x y z OC PC QC RC qB 9B SC rB"},G:{"1":"bC cC dC eC fC gC hC iC jC kC lC mC 2B 3B 4B 5B sB 6B 7B 8B","2":"F zB TC AC UC VC WC XC YC ZC aC"},H:{"2":"nC"},I:{"1":"D","2":"tB I 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:{"1":"D"},N:{"2":"A B"},O:{"1":"uC"},P:{"1":"vC wC xC yC zC 0B 0C 1C 2C 3C 4C sB 5C 6C 7C","2":"I"},Q:{"1":"1B"},R:{"1":"8C"},S:{"2":"9C"}},B:1,C:"Minimum length attribute for input fields"};

View File

@@ -0,0 +1 @@
module.exports={A:{A:{"2":"J E F G A B BC"},B:{"1":"C K L H M N O","322":"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"},C:{"2":"0 1 2 3 4 5 6 7 8 CC tB I u J E F G A B C K L H M N O v w x y z DC EC","194":"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 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"},D:{"2":"0 1 2 3 4 5 6 7 8 9 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","322":"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"},E:{"1":"E F G A B C K L H IC JC KC 0B qB rB 1B LC MC 2B 3B 4B 5B sB 6B 7B 8B NC","2":"I u J GC zB HC"},F:{"2":"0 1 2 3 4 5 6 7 G B C H M N O v w x y z OC PC QC RC qB 9B SC rB","322":"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 e lB mB nB oB pB P Q R wB S T U V W X Y Z a b c d"},G:{"1":"F 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","2":"zB TC AC UC VC"},H:{"2":"nC"},I:{"2":"tB I D oC pC qC rC AC sC tC"},J:{"2":"E A"},K:{"2":"A B C qB 9B rB","322":"e"},L:{"322":"D"},M:{"2":"D"},N:{"2":"A B"},O:{"322":"uC"},P:{"2":"I vC wC xC yC zC 0B 0C 1C 2C 3C 4C sB 5C 6C 7C"},Q:{"322":"1B"},R:{"322":"8C"},S:{"194":"9C"}},B:1,C:"Video Tracks"};

View File

@@ -0,0 +1 @@
{"version":3,"file":"ajax.js","sources":["../../../../src/internal/observable/dom/ajax.ts"],"names":[],"mappings":"AAAA,OAAO,EAAG,cAAc,EAAuB,MAAM,kBAAkB,CAAC;AAiFxE,MAAM,CAAC,MAAM,IAAI,GAAuB,CAAC,GAAG,EAAE,CAAC,cAAc,CAAC,MAAM,CAAC,EAAE,CAAC"}

View File

@@ -0,0 +1,140 @@
import { Observable } from '../Observable';
import { ObservableInput, SchedulerLike} from '../types';
import { isScheduler } from '../util/isScheduler';
import { mergeAll } from '../operators/mergeAll';
import { fromArray } from './fromArray';
/* tslint:disable:max-line-length */
/** @deprecated use {@link scheduled} and {@link mergeAll} (e.g. `scheduled([ob1, ob2, ob3], scheduled).pipe(mergeAll())*/
export function merge<T>(v1: ObservableInput<T>, scheduler: SchedulerLike): Observable<T>;
/** @deprecated use {@link scheduled} and {@link mergeAll} (e.g. `scheduled([ob1, ob2, ob3], scheduled).pipe(mergeAll())*/
export function merge<T>(v1: ObservableInput<T>, concurrent: number, scheduler: SchedulerLike): Observable<T>;
/** @deprecated use {@link scheduled} and {@link mergeAll} (e.g. `scheduled([ob1, ob2, ob3], scheduled).pipe(mergeAll())*/
export function merge<T, T2>(v1: ObservableInput<T>, v2: ObservableInput<T2>, scheduler: SchedulerLike): Observable<T | T2>;
/** @deprecated use {@link scheduled} and {@link mergeAll} (e.g. `scheduled([ob1, ob2, ob3], scheduled).pipe(mergeAll())*/
export function merge<T, T2>(v1: ObservableInput<T>, v2: ObservableInput<T2>, concurrent: number, scheduler: SchedulerLike): Observable<T | T2>;
/** @deprecated use {@link scheduled} and {@link mergeAll} (e.g. `scheduled([ob1, ob2, ob3], scheduled).pipe(mergeAll())*/
export function merge<T, T2, T3>(v1: ObservableInput<T>, v2: ObservableInput<T2>, v3: ObservableInput<T3>, scheduler: SchedulerLike): Observable<T | T2 | T3>;
/** @deprecated use {@link scheduled} and {@link mergeAll} (e.g. `scheduled([ob1, ob2, ob3], scheduled).pipe(mergeAll())*/
export function merge<T, T2, T3>(v1: ObservableInput<T>, v2: ObservableInput<T2>, v3: ObservableInput<T3>, concurrent: number, scheduler: SchedulerLike): Observable<T | T2 | T3>;
/** @deprecated use {@link scheduled} and {@link mergeAll} (e.g. `scheduled([ob1, ob2, ob3], scheduled).pipe(mergeAll())*/
export function merge<T, T2, T3, T4>(v1: ObservableInput<T>, v2: ObservableInput<T2>, v3: ObservableInput<T3>, v4: ObservableInput<T4>, scheduler: SchedulerLike): Observable<T | T2 | T3 | T4>;
/** @deprecated use {@link scheduled} and {@link mergeAll} (e.g. `scheduled([ob1, ob2, ob3], scheduled).pipe(mergeAll())*/
export function merge<T, T2, T3, T4>(v1: ObservableInput<T>, v2: ObservableInput<T2>, v3: ObservableInput<T3>, v4: ObservableInput<T4>, concurrent: number, scheduler: SchedulerLike): Observable<T | T2 | T3 | T4>;
/** @deprecated use {@link scheduled} and {@link mergeAll} (e.g. `scheduled([ob1, ob2, ob3], scheduled).pipe(mergeAll())*/
export function merge<T, T2, T3, T4, T5>(v1: ObservableInput<T>, v2: ObservableInput<T2>, v3: ObservableInput<T3>, v4: ObservableInput<T4>, v5: ObservableInput<T5>, scheduler: SchedulerLike): Observable<T | T2 | T3 | T4 | T5>;
/** @deprecated use {@link scheduled} and {@link mergeAll} (e.g. `scheduled([ob1, ob2, ob3], scheduled).pipe(mergeAll())*/
export function merge<T, T2, T3, T4, T5>(v1: ObservableInput<T>, v2: ObservableInput<T2>, v3: ObservableInput<T3>, v4: ObservableInput<T4>, v5: ObservableInput<T5>, concurrent: number, scheduler: SchedulerLike): Observable<T | T2 | T3 | T4 | T5>;
/** @deprecated use {@link scheduled} and {@link mergeAll} (e.g. `scheduled([ob1, ob2, ob3], scheduled).pipe(mergeAll())*/
export function merge<T, T2, T3, T4, T5, T6>(v1: ObservableInput<T>, v2: ObservableInput<T2>, v3: ObservableInput<T3>, v4: ObservableInput<T4>, v5: ObservableInput<T5>, v6: ObservableInput<T6>, scheduler: SchedulerLike): Observable<T | T2 | T3 | T4 | T5 | T6>;
/** @deprecated use {@link scheduled} and {@link mergeAll} (e.g. `scheduled([ob1, ob2, ob3], scheduled).pipe(mergeAll())*/
export function merge<T, T2, T3, T4, T5, T6>(v1: ObservableInput<T>, v2: ObservableInput<T2>, v3: ObservableInput<T3>, v4: ObservableInput<T4>, v5: ObservableInput<T5>, v6: ObservableInput<T6>, concurrent: number, scheduler: SchedulerLike): Observable<T | T2 | T3 | T4 | T5 | T6>;
export function merge<T>(v1: ObservableInput<T>): Observable<T>;
export function merge<T>(v1: ObservableInput<T>, concurrent?: number): Observable<T>;
export function merge<T, T2>(v1: ObservableInput<T>, v2: ObservableInput<T2>): Observable<T | T2>;
export function merge<T, T2>(v1: ObservableInput<T>, v2: ObservableInput<T2>, concurrent?: number): Observable<T | T2>;
export function merge<T, T2, T3>(v1: ObservableInput<T>, v2: ObservableInput<T2>, v3: ObservableInput<T3>): Observable<T | T2 | T3>;
export function merge<T, T2, T3>(v1: ObservableInput<T>, v2: ObservableInput<T2>, v3: ObservableInput<T3>, concurrent?: number): Observable<T | T2 | T3>;
export function merge<T, T2, T3, T4>(v1: ObservableInput<T>, v2: ObservableInput<T2>, v3: ObservableInput<T3>, v4: ObservableInput<T4>): Observable<T | T2 | T3 | T4>;
export function merge<T, T2, T3, T4>(v1: ObservableInput<T>, v2: ObservableInput<T2>, v3: ObservableInput<T3>, v4: ObservableInput<T4>, concurrent?: number): Observable<T | T2 | T3 | T4>;
export function merge<T, T2, T3, T4, T5>(v1: ObservableInput<T>, v2: ObservableInput<T2>, v3: ObservableInput<T3>, v4: ObservableInput<T4>, v5: ObservableInput<T5>): Observable<T | T2 | T3 | T4 | T5>;
export function merge<T, T2, T3, T4, T5>(v1: ObservableInput<T>, v2: ObservableInput<T2>, v3: ObservableInput<T3>, v4: ObservableInput<T4>, v5: ObservableInput<T5>, concurrent?: number): Observable<T | T2 | T3 | T4 | T5>;
export function merge<T, T2, T3, T4, T5, T6>(v1: ObservableInput<T>, v2: ObservableInput<T2>, v3: ObservableInput<T3>, v4: ObservableInput<T4>, v5: ObservableInput<T5>, v6: ObservableInput<T6>): Observable<T | T2 | T3 | T4 | T5 | T6>;
export function merge<T, T2, T3, T4, T5, T6>(v1: ObservableInput<T>, v2: ObservableInput<T2>, v3: ObservableInput<T3>, v4: ObservableInput<T4>, v5: ObservableInput<T5>, v6: ObservableInput<T6>, concurrent?: number): Observable<T | T2 | T3 | T4 | T5 | T6>;
export function merge<T>(...observables: (ObservableInput<T> | number)[]): Observable<T>;
/** @deprecated use {@link scheduled} and {@link mergeAll} (e.g. `scheduled([ob1, ob2, ob3], scheduled).pipe(mergeAll())*/
export function merge<T>(...observables: (ObservableInput<T> | SchedulerLike | number)[]): Observable<T>;
export function merge<T, R>(...observables: (ObservableInput<any> | number)[]): Observable<R>;
/** @deprecated use {@link scheduled} and {@link mergeAll} (e.g. `scheduled([ob1, ob2, ob3], scheduled).pipe(mergeAll())*/
export function merge<T, R>(...observables: (ObservableInput<any> | SchedulerLike | number)[]): Observable<R>;
/* tslint:enable:max-line-length */
/**
* Creates an output Observable which concurrently emits all values from every
* given input Observable.
*
* <span class="informal">Flattens multiple Observables together by blending
* their values into one Observable.</span>
*
* ![](merge.png)
*
* `merge` subscribes to each given input Observable (as arguments), and simply
* forwards (without doing any transformation) all the values from all the input
* Observables to the output Observable. The output Observable only completes
* once all input Observables have completed. Any error delivered by an input
* Observable will be immediately emitted on the output Observable.
*
* ## Examples
* ### Merge together two Observables: 1s interval and clicks
* ```ts
* import { merge, fromEvent, interval } from 'rxjs';
*
* const clicks = fromEvent(document, 'click');
* const timer = interval(1000);
* const clicksOrTimer = merge(clicks, timer);
* clicksOrTimer.subscribe(x => console.log(x));
*
* // Results in the following:
* // timer will emit ascending values, one every second(1000ms) to console
* // clicks logs MouseEvents to console everytime the "document" is clicked
* // Since the two streams are merged you see these happening
* // as they occur.
* ```
*
* ### Merge together 3 Observables, but only 2 run concurrently
* ```ts
* import { merge, interval } from 'rxjs';
* import { take } from 'rxjs/operators';
*
* const timer1 = interval(1000).pipe(take(10));
* const timer2 = interval(2000).pipe(take(6));
* const timer3 = interval(500).pipe(take(10));
* const concurrent = 2; // the argument
* const merged = merge(timer1, timer2, timer3, concurrent);
* merged.subscribe(x => console.log(x));
*
* // Results in the following:
* // - First timer1 and timer2 will run concurrently
* // - timer1 will emit a value every 1000ms for 10 iterations
* // - timer2 will emit a value every 2000ms for 6 iterations
* // - after timer1 hits its max iteration, timer2 will
* // continue, and timer3 will start to run concurrently with timer2
* // - when timer2 hits its max iteration it terminates, and
* // timer3 will continue to emit a value every 500ms until it is complete
* ```
*
* @see {@link mergeAll}
* @see {@link mergeMap}
* @see {@link mergeMapTo}
* @see {@link mergeScan}
*
* @param {...ObservableInput} observables Input Observables to merge together.
* @param {number} [concurrent=Number.POSITIVE_INFINITY] Maximum number of input
* Observables being subscribed to concurrently.
* @param {SchedulerLike} [scheduler=null] The {@link SchedulerLike} to use for managing
* concurrency of input Observables.
* @return {Observable} an Observable that emits items that are the result of
* every input Observable.
* @static true
* @name merge
* @owner Observable
*/
export function merge<T, R>(...observables: Array<ObservableInput<any> | SchedulerLike | number>): Observable<R> {
let concurrent = Number.POSITIVE_INFINITY;
let scheduler: SchedulerLike = null;
let last: any = observables[observables.length - 1];
if (isScheduler(last)) {
scheduler = <SchedulerLike>observables.pop();
if (observables.length > 1 && typeof observables[observables.length - 1] === 'number') {
concurrent = <number>observables.pop();
}
} else if (typeof last === 'number') {
concurrent = <number>observables.pop();
}
if (scheduler === null && observables.length === 1 && observables[0] instanceof Observable) {
return <Observable<R>>observables[0];
}
return mergeAll<R>(concurrent)(fromArray<any>(observables, scheduler));
}

View File

@@ -0,0 +1 @@
module.exports={C:{"2":0,"3":0,"4":0,"5":0,"6":0,"7":0,"8":0,"9":0,"10":0,"11":0,"12":0,"13":0,"14":0,"15":0,"16":0,"17":0,"18":0,"19":0,"20":0,"21":0,"22":0,"23":0,"24":0,"25":0,"26":0,"27":0,"28":0,"29":0,"30":0,"31":0,"32":0,"33":0,"34":0,"35":0,"36":0,"37":0,"38":0,"39":0,"40":0,"41":0,"42":0,"43":0,"44":0,"45":0,"46":0,"47":0,"48":0,"49":0,"50":0,"51":0,"52":0.00474,"53":0,"54":0,"55":0,"56":0,"57":0,"58":0,"59":0,"60":0,"61":0,"62":0,"63":0,"64":0,"65":0,"66":0,"67":0,"68":0,"69":0,"70":0,"71":0,"72":0,"73":0,"74":0,"75":0,"76":0,"77":0,"78":0.01423,"79":0,"80":0,"81":0,"82":0,"83":0,"84":0,"85":0,"86":0,"87":0,"88":0,"89":0,"90":0,"91":0.00474,"92":0.00474,"93":0,"94":0,"95":0,"96":0,"97":0,"98":0,"99":0,"100":0,"101":0.01423,"102":0.01423,"103":0,"104":0.00949,"105":0.00949,"106":0.01423,"107":0.50276,"108":0.87271,"109":0.5407,"110":0,"111":0,"3.5":0,"3.6":0},D:{"4":0,"5":0,"6":0,"7":0,"8":0,"9":0,"10":0,"11":0,"12":0,"13":0,"14":0,"15":0,"16":0,"17":0,"18":0,"19":0,"20":0,"21":0,"22":0,"23":0,"24":0,"25":0,"26":0,"27":0,"28":0,"29":0,"30":0,"31":0,"32":0,"33":0,"34":0,"35":0,"36":0,"37":0,"38":0,"39":0,"40":0.00474,"41":0,"42":0,"43":0,"44":0,"45":0,"46":0,"47":0,"48":0,"49":0,"50":0,"51":0,"52":0,"53":0,"54":0,"55":0,"56":0,"57":0.00474,"58":0,"59":0,"60":0,"61":0,"62":0,"63":0,"64":0,"65":0.00474,"66":0,"67":0.00474,"68":0,"69":0,"70":0,"71":0,"72":0,"73":0,"74":0.00474,"75":0,"76":0,"77":0,"78":0,"79":0,"80":0.00474,"81":0.01897,"83":0,"84":0,"85":0,"86":0,"87":0.01897,"88":0,"89":0,"90":0.00949,"91":0.00474,"92":0.01897,"93":0,"94":0.00949,"95":0,"96":0.00474,"97":0.01897,"98":0.01897,"99":0.00474,"100":0.0332,"101":0.00949,"102":0.00474,"103":0.0332,"104":0.00949,"105":0.00949,"106":0.02846,"107":0.03794,"108":6.27499,"109":6.64969,"110":0.00474,"111":0.00474,"112":0},F:{"9":0,"11":0,"12":0,"15":0,"16":0,"17":0,"18":0,"19":0,"20":0,"21":0,"22":0,"23":0,"24":0,"25":0,"26":0,"27":0,"28":0,"29":0,"30":0,"31":0,"32":0,"33":0,"34":0,"35":0,"36":0,"37":0,"38":0,"39":0,"40":0,"41":0,"42":0,"43":0,"44":0,"45":0,"46":0,"47":0,"48":0,"49":0,"50":0,"51":0,"52":0,"53":0,"54":0,"55":0,"56":0,"57":0,"58":0,"60":0,"62":0,"63":0,"64":0,"65":0,"66":0.00474,"67":0.02372,"68":0,"69":0,"70":0,"71":0,"72":0,"73":0,"74":0,"75":0,"76":0,"77":0,"78":0,"79":0,"80":0,"81":0,"82":0,"83":0,"84":0,"85":0,"86":0,"87":0,"88":0,"89":0,"90":0.21344,"91":0,"92":0,"93":0.02846,"94":0.13755,"9.5-9.6":0,"10.0-10.1":0,"10.5":0,"10.6":0,"11.1":0,"11.5":0,"11.6":0,"12.1":0},B:{"12":0,"13":0.00474,"14":0.00949,"15":0.01423,"16":0.00474,"17":0,"18":0.0332,"79":0,"80":0,"81":0.00949,"83":0,"84":0.01423,"85":0,"86":0,"87":0,"88":0,"89":0.00949,"90":0.01423,"91":0,"92":0.00949,"93":0,"94":0,"95":0,"96":0,"97":0,"98":0,"99":0.00949,"100":0.00949,"101":0.00474,"102":0.00949,"103":0.00949,"104":0,"105":0.0332,"106":0.00474,"107":0.01423,"108":0.56916,"109":0.69722},E:{"4":0,"5":0,"6":0,"7":0,"8":0,"9":0,"10":0,"11":0,"12":0,"13":0,"14":0.01897,"15":0,_:"0","3.1":0,"3.2":0,"5.1":0,"6.1":0,"7.1":0,"9.1":0,"10.1":0,"11.1":0,"12.1":0.00949,"13.1":0.01423,"14.1":0.01897,"15.1":0,"15.2-15.3":0,"15.4":0.00474,"15.5":0.00474,"15.6":0.04743,"16.0":0.00949,"16.1":0.04743,"16.2":0.05217,"16.3":0.00474},G:{"8":0,"3.2":0,"4.0-4.1":0,"4.2-4.3":0,"5.0-5.1":0,"6.0-6.1":0,"7.0-7.1":0,"8.1-8.4":0.00133,"9.0-9.2":0,"9.3":0.01591,"10.0-10.2":0,"10.3":2.75744,"11.0-11.2":0.00133,"11.3-11.4":0.00133,"12.0-12.1":0.0053,"12.2-12.5":0.18957,"13.0-13.1":0.0053,"13.2":0,"13.3":0.14583,"13.4-13.7":0.51967,"14.0-14.4":0.20283,"14.5-14.8":0.8617,"15.0-15.1":0.11931,"15.2-15.3":0.17764,"15.4":0.12594,"15.5":0.67478,"15.6":1.21036,"16.0":0.85772,"16.1":1.89309,"16.2":2.38757,"16.3":0.4388},P:{"4":0.05142,"5.0-5.4":0.02057,"6.2-6.4":0.03085,"7.2-7.4":0.42162,"8.2":0.01028,"9.2":0.01028,"10.1":0.01028,"11.1-11.2":0.44219,"12.0":0.04113,"13.0":0.28794,"14.0":1.35743,"15.0":0.01028,"16.0":0.10284,"17.0":0.07198,"18.0":0.17482,"19.0":1.86132},I:{"0":0,"3":0,"4":0,"2.1":0,"2.2":0,"2.3":0,"4.1":0,"4.2-4.3":0,"4.4":0,"4.4.3-4.4.4":0.1764},K:{_:"0 10 11 12 11.1 11.5 12.1"},A:{"6":0,"7":0,"8":0,"9":0,"10":0,"11":0.0332,"5.5":0},J:{"7":0,"10":0},N:{"10":0,"11":0},R:{_:"0"},M:{"0":0.13143},Q:{"13.1":0},O:{"0":1.32476},H:{"0":0.53751},L:{"0":59.58224},S:{"2.5":0}};

View File

@@ -0,0 +1,47 @@
export const completionShTemplate = `###-begin-{{app_name}}-completions-###
#
# yargs command completion script
#
# Installation: {{app_path}} {{completion_command}} >> ~/.bashrc
# or {{app_path}} {{completion_command}} >> ~/.bash_profile on OSX.
#
_yargs_completions()
{
local cur_word args type_list
cur_word="\${COMP_WORDS[COMP_CWORD]}"
args=("\${COMP_WORDS[@]}")
# ask yargs to generate completions.
type_list=$({{app_path}} --get-yargs-completions "\${args[@]}")
COMPREPLY=( $(compgen -W "\${type_list}" -- \${cur_word}) )
# if no match was found, fall back to filename completion
if [ \${#COMPREPLY[@]} -eq 0 ]; then
COMPREPLY=()
fi
return 0
}
complete -o default -F _yargs_completions {{app_name}}
###-end-{{app_name}}-completions-###
`;
export const completionZshTemplate = `###-begin-{{app_name}}-completions-###
#
# yargs command completion script
#
# Installation: {{app_path}} {{completion_command}} >> ~/.zshrc
# or {{app_path}} {{completion_command}} >> ~/.zsh_profile on OSX.
#
_{{app_name}}_yargs_completions()
{
local reply
local si=$IFS
IFS=$'\n' reply=($(COMP_CWORD="$((CURRENT-1))" COMP_LINE="$BUFFER" COMP_POINT="$CURSOR" {{app_path}} --get-yargs-completions "\${words[@]}"))
IFS=$si
_describe 'values' reply
}
compdef _{{app_name}}_yargs_completions {{app_name}}
###-end-{{app_name}}-completions-###
`;

View File

@@ -0,0 +1,164 @@
import { Subscriber } from '../Subscriber';
import { Subscription } from '../Subscription';
import { Observable } from '../Observable';
import { Subject } from '../Subject';
export function groupBy(keySelector, elementSelector, durationSelector, subjectSelector) {
return (source) => source.lift(new GroupByOperator(keySelector, elementSelector, durationSelector, subjectSelector));
}
class GroupByOperator {
constructor(keySelector, elementSelector, durationSelector, subjectSelector) {
this.keySelector = keySelector;
this.elementSelector = elementSelector;
this.durationSelector = durationSelector;
this.subjectSelector = subjectSelector;
}
call(subscriber, source) {
return source.subscribe(new GroupBySubscriber(subscriber, this.keySelector, this.elementSelector, this.durationSelector, this.subjectSelector));
}
}
class GroupBySubscriber extends Subscriber {
constructor(destination, keySelector, elementSelector, durationSelector, subjectSelector) {
super(destination);
this.keySelector = keySelector;
this.elementSelector = elementSelector;
this.durationSelector = durationSelector;
this.subjectSelector = subjectSelector;
this.groups = null;
this.attemptedToUnsubscribe = false;
this.count = 0;
}
_next(value) {
let key;
try {
key = this.keySelector(value);
}
catch (err) {
this.error(err);
return;
}
this._group(value, key);
}
_group(value, key) {
let groups = this.groups;
if (!groups) {
groups = this.groups = new Map();
}
let group = groups.get(key);
let element;
if (this.elementSelector) {
try {
element = this.elementSelector(value);
}
catch (err) {
this.error(err);
}
}
else {
element = value;
}
if (!group) {
group = (this.subjectSelector ? this.subjectSelector() : new Subject());
groups.set(key, group);
const groupedObservable = new GroupedObservable(key, group, this);
this.destination.next(groupedObservable);
if (this.durationSelector) {
let duration;
try {
duration = this.durationSelector(new GroupedObservable(key, group));
}
catch (err) {
this.error(err);
return;
}
this.add(duration.subscribe(new GroupDurationSubscriber(key, group, this)));
}
}
if (!group.closed) {
group.next(element);
}
}
_error(err) {
const groups = this.groups;
if (groups) {
groups.forEach((group, key) => {
group.error(err);
});
groups.clear();
}
this.destination.error(err);
}
_complete() {
const groups = this.groups;
if (groups) {
groups.forEach((group, key) => {
group.complete();
});
groups.clear();
}
this.destination.complete();
}
removeGroup(key) {
this.groups.delete(key);
}
unsubscribe() {
if (!this.closed) {
this.attemptedToUnsubscribe = true;
if (this.count === 0) {
super.unsubscribe();
}
}
}
}
class GroupDurationSubscriber extends Subscriber {
constructor(key, group, parent) {
super(group);
this.key = key;
this.group = group;
this.parent = parent;
}
_next(value) {
this.complete();
}
_unsubscribe() {
const { parent, key } = this;
this.key = this.parent = null;
if (parent) {
parent.removeGroup(key);
}
}
}
export class GroupedObservable extends Observable {
constructor(key, groupSubject, refCountSubscription) {
super();
this.key = key;
this.groupSubject = groupSubject;
this.refCountSubscription = refCountSubscription;
}
_subscribe(subscriber) {
const subscription = new Subscription();
const { refCountSubscription, groupSubject } = this;
if (refCountSubscription && !refCountSubscription.closed) {
subscription.add(new InnerRefCountSubscription(refCountSubscription));
}
subscription.add(groupSubject.subscribe(subscriber));
return subscription;
}
}
class InnerRefCountSubscription extends Subscription {
constructor(parent) {
super();
this.parent = parent;
parent.count++;
}
unsubscribe() {
const parent = this.parent;
if (!parent.closed && !this.closed) {
super.unsubscribe();
parent.count -= 1;
if (parent.count === 0 && parent.attemptedToUnsubscribe) {
parent.unsubscribe();
}
}
}
}
//# sourceMappingURL=groupBy.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"combineAll.js","sources":["../src/operators/combineAll.ts"],"names":[],"mappings":";;;;;AAAA,sDAAiD"}

View File

@@ -0,0 +1,4 @@
# requirejs-bower
Bower packaging for [RequireJS](http://requirejs.org).

View File

@@ -0,0 +1,15 @@
'use strict';
module.exports = (url, opts) => {
if (typeof url !== 'string') {
throw new TypeError(`Expected \`url\` to be of type \`string\`, got \`${typeof url}\``);
}
url = url.trim();
opts = Object.assign({https: false}, opts);
if (/^\.*\/|^(?!localhost)\w+:/.test(url)) {
return url;
}
return url.replace(/^(?!(?:\w+:)?\/\/)/, opts.https ? 'https://' : 'http://');
};

View File

@@ -0,0 +1 @@
module.exports={C:{"2":0,"3":0,"4":0,"5":0,"6":0,"7":0,"8":0,"9":0,"10":0,"11":0,"12":0,"13":0,"14":0,"15":0,"16":0,"17":0,"18":0,"19":0,"20":0,"21":0.01504,"22":0,"23":0,"24":0,"25":0,"26":0,"27":0,"28":0,"29":0,"30":0,"31":0,"32":0,"33":0,"34":0.02005,"35":0,"36":0,"37":0.00501,"38":0,"39":0,"40":0.01002,"41":0.01002,"42":0,"43":0,"44":0.00501,"45":0,"46":0.00501,"47":0.00501,"48":0.0401,"49":0.00501,"50":0.00501,"51":0,"52":0.00501,"53":0,"54":0,"55":0,"56":0.01504,"57":0.00501,"58":0,"59":0,"60":0,"61":0.01002,"62":0,"63":0,"64":0,"65":0,"66":0,"67":0.01002,"68":0.00501,"69":0,"70":0,"71":0,"72":0.01504,"73":0,"74":0,"75":0.00501,"76":0,"77":0,"78":0.05513,"79":0.25561,"80":0,"81":0,"82":0,"83":0.00501,"84":0.00501,"85":0,"86":0,"87":0,"88":0.03007,"89":0.00501,"90":0,"91":0,"92":0,"93":0,"94":0.00501,"95":0.08019,"96":0,"97":0,"98":0.01002,"99":0.07518,"100":0.00501,"101":0.00501,"102":0.03007,"103":0.00501,"104":0.01002,"105":0.03007,"106":0.05012,"107":0.23556,"108":2.4208,"109":1.35825,"110":0.05012,"111":0,"3.5":0,"3.6":0},D:{"4":0,"5":0,"6":0,"7":0,"8":0,"9":0,"10":0,"11":0,"12":0,"13":0,"14":0,"15":0,"16":0,"17":0,"18":0,"19":0,"20":0,"21":0,"22":0,"23":0,"24":0,"25":0,"26":0,"27":0,"28":0,"29":0,"30":0,"31":0.01002,"32":0,"33":0,"34":0.01504,"35":0,"36":0,"37":0,"38":0.01002,"39":0,"40":0.00501,"41":0,"42":0,"43":0.01504,"44":0,"45":0,"46":0,"47":0,"48":0,"49":0.01002,"50":0,"51":0,"52":0,"53":0,"54":0,"55":0,"56":0,"57":0,"58":0.17041,"59":0,"60":0.00501,"61":0,"62":0.00501,"63":0.01504,"64":0.00501,"65":0,"66":0,"67":0.00501,"68":0.07017,"69":0.00501,"70":0,"71":0,"72":0.00501,"73":0,"74":0.02506,"75":0.01504,"76":0,"77":0,"78":0,"79":0.00501,"80":0.10525,"81":0.00501,"83":0,"84":0.04511,"85":0.01504,"86":0.02005,"87":0.03007,"88":0.00501,"89":0,"90":0.00501,"91":0.00501,"92":0.00501,"93":0.00501,"94":0.00501,"95":0,"96":0.01504,"97":0.01504,"98":0.02005,"99":0.02506,"100":0.00501,"101":0.01002,"102":0.02005,"103":0.11026,"104":0.0401,"105":0.05513,"106":0.04511,"107":1.51864,"108":5.79387,"109":6.67598,"110":0.00501,"111":0,"112":0},F:{"9":0,"11":0,"12":0,"15":0,"16":0,"17":0,"18":0,"19":0,"20":0,"21":0,"22":0,"23":0,"24":0,"25":0,"26":0,"27":0,"28":0.00501,"29":0,"30":0,"31":0,"32":0.00501,"33":0,"34":0,"35":0,"36":0,"37":0.02506,"38":0,"39":0,"40":0,"41":0,"42":0,"43":0,"44":0,"45":0,"46":0,"47":0,"48":0,"49":0,"50":0,"51":0,"52":0,"53":0,"54":0.01002,"55":0,"56":0.00501,"57":0,"58":0.00501,"60":0.01002,"62":0,"63":0.01002,"64":0.01002,"65":0.03508,"66":0.01504,"67":0.01504,"68":0,"69":0,"70":0,"71":0,"72":0.00501,"73":0,"74":0,"75":0,"76":0,"77":0,"78":0,"79":0,"80":0,"81":0,"82":0,"83":0,"84":0.00501,"85":0,"86":0,"87":0,"88":0.00501,"89":0.00501,"90":0,"91":0,"92":0,"93":0.01504,"94":0.39094,"9.5-9.6":0,"10.0-10.1":0,"10.5":0,"10.6":0,"11.1":0,"11.5":0,"11.6":0,"12.1":0.00501},B:{"12":0.04511,"13":0.01504,"14":0,"15":0,"16":0.01002,"17":0.00501,"18":0.02005,"79":0,"80":0,"81":0,"83":0,"84":0.00501,"85":0,"86":0,"87":0,"88":0,"89":0,"90":0.01504,"91":0.01002,"92":0.01504,"93":0.02506,"94":0,"95":0,"96":0,"97":0,"98":0,"99":0.01002,"100":0.02005,"101":0.02506,"102":0,"103":0.01002,"104":0.02005,"105":0.03508,"106":0.0401,"107":0.09022,"108":1.43844,"109":1.40336},E:{"4":0,"5":0,"6":0,"7":0,"8":0,"9":0,"10":0,"11":0,"12":0,"13":0,"14":0.02506,"15":0,_:"0","3.1":0,"3.2":0,"5.1":0,"6.1":0,"7.1":0,"9.1":0,"10.1":0,"11.1":0,"12.1":0.02506,"13.1":0.06014,"14.1":0.0852,"15.1":0.01504,"15.2-15.3":0.00501,"15.4":0.02005,"15.5":0.05513,"15.6":0.03508,"16.0":0.01002,"16.1":0.01002,"16.2":0.0852,"16.3":0.01504},G:{"8":0,"3.2":0,"4.0-4.1":0,"4.2-4.3":0,"5.0-5.1":0,"6.0-6.1":0,"7.0-7.1":0,"8.1-8.4":0,"9.0-9.2":0,"9.3":0.00089,"10.0-10.2":0,"10.3":0.11177,"11.0-11.2":0,"11.3-11.4":0.00177,"12.0-12.1":0.05766,"12.2-12.5":0.81347,"13.0-13.1":0.02839,"13.2":0.01331,"13.3":0.12863,"13.4-13.7":0.16678,"14.0-14.4":0.77799,"14.5-14.8":1.04767,"15.0-15.1":0.24839,"15.2-15.3":0.53137,"15.4":0.37879,"15.5":0.68662,"15.6":0.62186,"16.0":0.86492,"16.1":1.05299,"16.2":0.77976,"16.3":0.0621},P:{"4":0.23182,"5.0-5.4":0.02016,"6.2-6.4":0,"7.2-7.4":0.10079,"8.2":0,"9.2":0,"10.1":0.01008,"11.1-11.2":0.06048,"12.0":0.01008,"13.0":0.03024,"14.0":0.0504,"15.0":0.02016,"16.0":0.20158,"17.0":0.0504,"18.0":0.13103,"19.0":0.54428},I:{"0":0,"3":0,"4":0,"2.1":0,"2.2":0,"2.3":0,"4.1":0,"4.2-4.3":0,"4.4":0,"4.4.3-4.4.4":0.03005},K:{_:"0 10 11 12 11.1 11.5 12.1"},A:{"6":0,"7":0,"8":0,"9":0,"10":0,"11":0.04511,"5.5":0},J:{"7":0,"10":0},N:{"10":0,"11":0},S:{"2.5":0},R:{_:"0"},M:{"0":0.19952},Q:{"13.1":0},O:{"0":1.00259},H:{"0":0.95863},L:{"0":61.90145}};

View File

@@ -0,0 +1 @@
{"version":3,"file":"partition.js","sources":["../../src/internal/observable/partition.ts"],"names":[],"mappings":";;AAAA,mCAAkC;AAClC,mDAAkD;AAClD,8CAA6C;AAE7C,4CAA2C;AAqD3C,SAAgB,SAAS,CACvB,MAA0B,EAC1B,SAA+C,EAC/C,OAAa;IAEb,OAAO;QACL,eAAM,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC,IAAI,uBAAU,CAAI,yBAAW,CAAC,MAAM,CAAC,CAAC,CAAC;QAClE,eAAM,CAAC,SAAG,CAAC,SAAS,EAAE,OAAO,CAAQ,CAAC,CAAC,IAAI,uBAAU,CAAI,yBAAW,CAAC,MAAM,CAAC,CAAC,CAAC;KAC7C,CAAC;AACtC,CAAC;AATD,8BASC"}

View File

@@ -0,0 +1,4 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
require("rxjs-compat/add/operator/catch");
//# sourceMappingURL=catch.js.map

View File

@@ -0,0 +1 @@
export declare function delve(obj: Record<string, unknown>, fullKey: string): any;

View File

@@ -0,0 +1,18 @@
import { Subject } from './Subject';
import { Subscriber } from './Subscriber';
import { Subscription } from './Subscription';
/**
* A variant of Subject that requires an initial value and emits its current
* value whenever it is subscribed to.
*
* @class BehaviorSubject<T>
*/
export declare class BehaviorSubject<T> extends Subject<T> {
private _value;
constructor(_value: T);
readonly value: T;
/** @deprecated This is an internal implementation detail, do not use. */
_subscribe(subscriber: Subscriber<T>): Subscription;
getValue(): T;
next(value: T): void;
}

View File

@@ -0,0 +1,48 @@
import { MonoTypeOperatorFunction } from '../types';
/**
* Returns an Observable that mirrors the source Observable with the exception of an `error`. If the source Observable
* calls `error`, this method will resubscribe to the source Observable for a maximum of `count` resubscriptions (given
* as a number parameter) rather than propagating the `error` call.
*
* ![](retry.png)
*
* Any and all items emitted by the source Observable will be emitted by the resulting Observable, even those emitted
* during failed subscriptions. For example, if an Observable fails at first but emits [1, 2] then succeeds the second
* time and emits: [1, 2, 3, 4, 5] then the complete stream of emissions and notifications
* would be: [1, 2, 1, 2, 3, 4, 5, `complete`].
*
* ## Example
* ```ts
* import { interval, of, throwError } from 'rxjs';
* import { mergeMap, retry } from 'rxjs/operators';
*
* const source = interval(1000);
* const example = source.pipe(
* mergeMap(val => {
* if(val > 5){
* return throwError('Error!');
* }
* return of(val);
* }),
* //retry 2 times on error
* retry(2)
* );
*
* const subscribe = example.subscribe({
* next: val => console.log(val),
* error: val => console.log(`${val}: Retried 2 times then quit!`)
* });
*
* // Output:
* // 0..1..2..3..4..5..
* // 0..1..2..3..4..5..
* // 0..1..2..3..4..5..
* // "Error!: Retried 2 times then quit!"
* ```
*
* @param {number} count - Number of retry attempts before failing.
* @return {Observable} The source Observable modified with the retry logic.
* @method retry
* @owner Observable
*/
export declare function retry<T>(count?: number): MonoTypeOperatorFunction<T>;

View File

@@ -0,0 +1,18 @@
import { Subscriber } from '../Subscriber';
import { rxSubscriber as rxSubscriberSymbol } from '../symbol/rxSubscriber';
import { empty as emptyObserver } from '../Observer';
export function toSubscriber(nextOrObserver, error, complete) {
if (nextOrObserver) {
if (nextOrObserver instanceof Subscriber) {
return nextOrObserver;
}
if (nextOrObserver[rxSubscriberSymbol]) {
return nextOrObserver[rxSubscriberSymbol]();
}
}
if (!nextOrObserver && !error && !complete) {
return new Subscriber(emptyObserver);
}
return new Subscriber(nextOrObserver, error, complete);
}
//# sourceMappingURL=toSubscriber.js.map

View File

@@ -0,0 +1 @@
module.exports={A:{A:{"2":"J E F G A B 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:{"1":"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","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 DC EC"},D:{"1":"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":"0 1 2 3 4 5 6 7 8 9 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","194":"UB VB WB XB YB uB ZB vB aB bB"},E:{"1":"L H 1B LC MC 2B 3B 4B 5B sB 6B 7B 8B NC","2":"I u J E F G A B C GC zB HC IC JC KC 0B qB rB","66":"K"},F:{"1":"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":"0 1 2 3 4 5 6 7 8 9 G B C H M N O v w x y z AB BB CB DB EB FB GB OC PC QC RC qB 9B SC rB","194":"HB IB JB KB LB MB NB OB PB QB RB"},G:{"1":"jC kC lC mC 2B 3B 4B 5B sB 6B 7B 8B","2":"F zB TC AC UC VC WC XC YC ZC aC bC cC dC eC fC gC hC iC"},H:{"2":"nC"},I:{"1":"D","2":"tB I 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:{"1":"D"},N:{"2":"A B"},O:{"1":"uC"},P:{"1":"zC 0B 0C 1C 2C 3C 4C sB 5C 6C 7C","2":"I vC wC xC yC"},Q:{"1":"1B"},R:{"1":"8C"},S:{"2":"9C"}},B:5,C:"Resize Observer"};

View File

@@ -0,0 +1,278 @@
import { Observable } from '../Observable';
import { AsyncSubject } from '../AsyncSubject';
import { Subscriber } from '../Subscriber';
import { SchedulerAction, SchedulerLike } from '../types';
import { map } from '../operators/map';
import { canReportError } from '../util/canReportError';
import { isScheduler } from '../util/isScheduler';
import { isArray } from '../util/isArray';
/* tslint:disable:max-line-length */
/** @deprecated resultSelector is deprecated, pipe to map instead */
export function bindNodeCallback(callbackFunc: Function, resultSelector: Function, scheduler?: SchedulerLike): (...args: any[]) => Observable<any>;
export function bindNodeCallback<R1, R2, R3, R4>(callbackFunc: (callback: (err: any, res1: R1, res2: R2, res3: R3, res4: R4, ...args: any[]) => any) => any, scheduler?: SchedulerLike): (...args: any[]) => Observable<any[]>;
export function bindNodeCallback<R1, R2, R3>(callbackFunc: (callback: (err: any, res1: R1, res2: R2, res3: R3) => any) => any, scheduler?: SchedulerLike): () => Observable<[R1, R2, R3]>;
export function bindNodeCallback<R1, R2>(callbackFunc: (callback: (err: any, res1: R1, res2: R2) => any) => any, scheduler?: SchedulerLike): () => Observable<[R1, R2]>;
export function bindNodeCallback<R1>(callbackFunc: (callback: (err: any, res1: R1) => any) => any, scheduler?: SchedulerLike): () => Observable<R1>;
export function bindNodeCallback(callbackFunc: (callback: (err: any) => any) => any, scheduler?: SchedulerLike): () => Observable<void>;
export function bindNodeCallback<A1, R1, R2, R3, R4>(callbackFunc: (arg1: A1, callback: (err: any, res1: R1, res2: R2, res3: R3, res4: R4, ...args: any[]) => any) => any, scheduler?: SchedulerLike): (...args: any[]) => Observable<any[]>;
export function bindNodeCallback<A1, R1, R2, R3>(callbackFunc: (arg1: A1, callback: (err: any, res1: R1, res2: R2, res3: R3) => any) => any, scheduler?: SchedulerLike): (arg1: A1) => Observable<[R1, R2, R3]>;
export function bindNodeCallback<A1, R1, R2>(callbackFunc: (arg1: A1, callback: (err: any, res1: R1, res2: R2) => any) => any, scheduler?: SchedulerLike): (arg1: A1) => Observable<[R1, R2]>;
export function bindNodeCallback<A1, R1>(callbackFunc: (arg1: A1, callback: (err: any, res1: R1) => any) => any, scheduler?: SchedulerLike): (arg1: A1) => Observable<R1>;
export function bindNodeCallback<A1>(callbackFunc: (arg1: A1, callback: (err: any) => any) => any, scheduler?: SchedulerLike): (arg1: A1) => Observable<void>;
export function bindNodeCallback<A1, A2, R1, R2, R3, R4>(callbackFunc: (arg1: A1, arg2: A2, callback: (err: any, res1: R1, res2: R2, res3: R3, res4: R4, ...args: any[]) => any) => any, scheduler?: SchedulerLike): (...args: any[]) => Observable<any[]>;
export function bindNodeCallback<A1, A2, R1, R2, R3>(callbackFunc: (arg1: A1, arg2: A2, callback: (err: any, res1: R1, res2: R2, res3: R3) => any) => any, scheduler?: SchedulerLike): (arg1: A1, arg2: A2) => Observable<[R1, R2, R3]>;
export function bindNodeCallback<A1, A2, R1, R2>(callbackFunc: (arg1: A1, arg2: A2, callback: (err: any, res1: R1, res2: R2) => any) => any, scheduler?: SchedulerLike): (arg1: A1, arg2: A2) => Observable<[R1, R2]>;
export function bindNodeCallback<A1, A2, R1>(callbackFunc: (arg1: A1, arg2: A2, callback: (err: any, res1: R1) => any) => any, scheduler?: SchedulerLike): (arg1: A1, arg2: A2) => Observable<R1>;
export function bindNodeCallback<A1, A2>(callbackFunc: (arg1: A1, arg2: A2, callback: (err: any) => any) => any, scheduler?: SchedulerLike): (arg1: A1, arg2: A2) => Observable<void>;
export function bindNodeCallback<A1, A2, A3, R1, R2, R3, R4>(callbackFunc: (arg1: A1, arg2: A2, arg3: A3, callback: (err: any, res1: R1, res2: R2, res3: R3, res4: R4, ...args: any[]) => any) => any, scheduler?: SchedulerLike): (...args: any[]) => Observable<any[]>;
export function bindNodeCallback<A1, A2, A3, R1, R2, R3>(callbackFunc: (arg1: A1, arg2: A2, arg3: A3, callback: (err: any, res1: R1, res2: R2, res3: R3) => any) => any, scheduler?: SchedulerLike): (arg1: A1, arg2: A2, arg3: A3) => Observable<[R1, R2, R3]>;
export function bindNodeCallback<A1, A2, A3, R1, R2>(callbackFunc: (arg1: A1, arg2: A2, arg3: A3, callback: (err: any, res1: R1, res2: R2) => any) => any, scheduler?: SchedulerLike): (arg1: A1, arg2: A2, arg3: A3) => Observable<[R1, R2]>;
export function bindNodeCallback<A1, A2, A3, R1>(callbackFunc: (arg1: A1, arg2: A2, arg3: A3, callback: (err: any, res1: R1) => any) => any, scheduler?: SchedulerLike): (arg1: A1, arg2: A2, arg3: A3) => Observable<R1>;
export function bindNodeCallback<A1, A2, A3>(callbackFunc: (arg1: A1, arg2: A2, arg3: A3, callback: (err: any) => any) => any, scheduler?: SchedulerLike): (arg1: A1, arg2: A2, arg3: A3) => Observable<void>;
export function bindNodeCallback<A1, A2, A3, A4, R1, R2, R3, R4>(callbackFunc: (arg1: A1, arg2: A2, arg3: A3, arg4: A4, callback: (err: any, res1: R1, res2: R2, res3: R3, res4: R4, ...args: any[]) => any) => any, scheduler?: SchedulerLike): (...args: any[]) => Observable<any[]>;
export function bindNodeCallback<A1, A2, A3, A4, R1, R2, R3>(callbackFunc: (arg1: A1, arg2: A2, arg3: A3, arg4: A4, callback: (err: any, res1: R1, res2: R2, res3: R3) => any) => any, scheduler?: SchedulerLike): (arg1: A1, arg2: A2, arg3: A3, arg4: A4) => Observable<[R1, R2, R3]>;
export function bindNodeCallback<A1, A2, A3, A4, R1, R2>(callbackFunc: (arg1: A1, arg2: A2, arg3: A3, arg4: A4, callback: (err: any, res1: R1, res2: R2) => any) => any, scheduler?: SchedulerLike): (arg1: A1, arg2: A2, arg3: A3, arg4: A4) => Observable<[R1, R2]>;
export function bindNodeCallback<A1, A2, A3, A4, R1>(callbackFunc: (arg1: A1, arg2: A2, arg3: A3, arg4: A4, callback: (err: any, res1: R1) => any) => any, scheduler?: SchedulerLike): (arg1: A1, arg2: A2, arg3: A3, arg4: A4) => Observable<R1>;
export function bindNodeCallback<A1, A2, A3, A4>(callbackFunc: (arg1: A1, arg2: A2, arg3: A3, arg4: A4, callback: (err: any) => any) => any, scheduler?: SchedulerLike): (arg1: A1, arg2: A2, arg3: A3, arg4: A4) => Observable<void>;
export function bindNodeCallback<A1, A2, A3, A4, A5, R1, R2, R3, R4>(callbackFunc: (arg1: A1, arg2: A2, arg3: A3, arg4: A4, arg5: A5, callback: (err: any, res1: R1, res2: R2, res3: R3, res4: R4, ...args: any[]) => any) => any, scheduler?: SchedulerLike): (...args: any[]) => Observable<any[]>;
export function bindNodeCallback<A1, A2, A3, A4, A5, R1, R2, R3>(callbackFunc: (arg1: A1, arg2: A2, arg3: A3, arg4: A4, arg5: A5, callback: (err: any, res1: R1, res2: R2, res3: R3) => any) => any, scheduler?: SchedulerLike): (arg1: A1, arg2: A2, arg3: A3, arg4: A4, arg5: A5) => Observable<[R1, R2, R3]>;
export function bindNodeCallback<A1, A2, A3, A4, A5, R1, R2>(callbackFunc: (arg1: A1, arg2: A2, arg3: A3, arg4: A4, arg5: A5, callback: (err: any, res1: R1, res2: R2) => any) => any, scheduler?: SchedulerLike): (arg1: A1, arg2: A2, arg3: A3, arg4: A4, arg5: A5) => Observable<[R1, R2]>;
export function bindNodeCallback<A1, A2, A3, A4, A5, R1>(callbackFunc: (arg1: A1, arg2: A2, arg3: A3, arg4: A4, arg5: A5, callback: (err: any, res1: R1) => any) => any, scheduler?: SchedulerLike): (arg1: A1, arg2: A2, arg3: A3, arg4: A4, arg5: A5) => Observable<R1>;
export function bindNodeCallback<A1, A2, A3, A4, A5>(callbackFunc: (arg1: A1, arg2: A2, arg3: A3, arg4: A4, arg5: A5, callback: (err: any) => any) => any, scheduler?: SchedulerLike): (arg1: A1, arg2: A2, arg3: A3, arg4: A4, arg5: A5) => Observable<void>; /* tslint:enable:max-line-length */
export function bindNodeCallback(callbackFunc: Function, scheduler?: SchedulerLike): (...args: any[]) => Observable<any[]>;
/**
* Converts a Node.js-style callback API to a function that returns an
* Observable.
*
* <span class="informal">It's just like {@link bindCallback}, but the
* callback is expected to be of type `callback(error, result)`.</span>
*
* `bindNodeCallback` is not an operator because its input and output are not
* Observables. The input is a function `func` with some parameters, but the
* last parameter must be a callback function that `func` calls when it is
* done. The callback function is expected to follow Node.js conventions,
* where the first argument to the callback is an error object, signaling
* whether call was successful. If that object is passed to callback, it means
* something went wrong.
*
* The output of `bindNodeCallback` is a function that takes the same
* parameters as `func`, except the last one (the callback). When the output
* function is called with arguments, it will return an Observable.
* If `func` calls its callback with error parameter present, Observable will
* error with that value as well. If error parameter is not passed, Observable will emit
* second parameter. If there are more parameters (third and so on),
* Observable will emit an array with all arguments, except first error argument.
*
* Note that `func` will not be called at the same time output function is,
* but rather whenever resulting Observable is subscribed. By default call to
* `func` will happen synchronously after subscription, but that can be changed
* with proper `scheduler` provided as optional third parameter. {@link SchedulerLike}
* can also control when values from callback will be emitted by Observable.
* To find out more, check out documentation for {@link bindCallback}, where
* {@link SchedulerLike} works exactly the same.
*
* As in {@link bindCallback}, context (`this` property) of input function will be set to context
* of returned function, when it is called.
*
* After Observable emits value, it will complete immediately. This means
* even if `func` calls callback again, values from second and consecutive
* calls will never appear on the stream. If you need to handle functions
* that call callbacks multiple times, check out {@link fromEvent} or
* {@link fromEventPattern} instead.
*
* Note that `bindNodeCallback` can be used in non-Node.js environments as well.
* "Node.js-style" callbacks are just a convention, so if you write for
* browsers or any other environment and API you use implements that callback style,
* `bindNodeCallback` can be safely used on that API functions as well.
*
* Remember that Error object passed to callback does not have to be an instance
* of JavaScript built-in `Error` object. In fact, it does not even have to an object.
* Error parameter of callback function is interpreted as "present", when value
* of that parameter is truthy. It could be, for example, non-zero number, non-empty
* string or boolean `true`. In all of these cases resulting Observable would error
* with that value. This means usually regular style callbacks will fail very often when
* `bindNodeCallback` is used. If your Observable errors much more often then you
* would expect, check if callback really is called in Node.js-style and, if not,
* switch to {@link bindCallback} instead.
*
* Note that even if error parameter is technically present in callback, but its value
* is falsy, it still won't appear in array emitted by Observable.
*
* ## Examples
* ### Read a file from the filesystem and get the data as an Observable
* ```ts
* import * as fs from 'fs';
* const readFileAsObservable = bindNodeCallback(fs.readFile);
* const result = readFileAsObservable('./roadNames.txt', 'utf8');
* result.subscribe(x => console.log(x), e => console.error(e));
* ```
*
* ### Use on function calling callback with multiple arguments
* ```ts
* someFunction((err, a, b) => {
* console.log(err); // null
* console.log(a); // 5
* console.log(b); // "some string"
* });
* const boundSomeFunction = bindNodeCallback(someFunction);
* boundSomeFunction()
* .subscribe(value => {
* console.log(value); // [5, "some string"]
* });
* ```
*
* ### Use on function calling callback in regular style
* ```ts
* someFunction(a => {
* console.log(a); // 5
* });
* const boundSomeFunction = bindNodeCallback(someFunction);
* boundSomeFunction()
* .subscribe(
* value => {} // never gets called
* err => console.log(err) // 5
* );
* ```
*
* @see {@link bindCallback}
* @see {@link from}
*
* @param {function} func Function with a Node.js-style callback as the last parameter.
* @param {SchedulerLike} [scheduler] The scheduler on which to schedule the
* callbacks.
* @return {function(...params: *): Observable} A function which returns the
* Observable that delivers the same values the Node.js callback would
* deliver.
* @name bindNodeCallback
*/
export function bindNodeCallback<T>(
callbackFunc: Function,
resultSelector: Function|SchedulerLike,
scheduler?: SchedulerLike
): (...args: any[]) => Observable<T> {
if (resultSelector) {
if (isScheduler(resultSelector)) {
scheduler = resultSelector;
} else {
// DEPRECATED PATH
return (...args: any[]) => bindNodeCallback(callbackFunc, scheduler)(...args).pipe(
map(args => isArray(args) ? resultSelector(...args) : resultSelector(args))
);
}
}
return function(this: any, ...args: any[]): Observable<T> {
const params: ParamsState<T> = {
subject: undefined,
args,
callbackFunc,
scheduler,
context: this,
};
return new Observable<T>(subscriber => {
const { context } = params;
let { subject } = params;
if (!scheduler) {
if (!subject) {
subject = params.subject = new AsyncSubject<T>();
const handler = (...innerArgs: any[]) => {
const err = innerArgs.shift();
if (err) {
subject.error(err);
return;
}
subject.next(innerArgs.length <= 1 ? innerArgs[0] : innerArgs);
subject.complete();
};
try {
callbackFunc.apply(context, [...args, handler]);
} catch (err) {
if (canReportError(subject)) {
subject.error(err);
} else {
console.warn(err);
}
}
}
return subject.subscribe(subscriber);
} else {
return scheduler.schedule<DispatchState<T>>(dispatch, 0, { params, subscriber, context });
}
});
};
}
interface DispatchState<T> {
subscriber: Subscriber<T>;
context: any;
params: ParamsState<T>;
}
interface ParamsState<T> {
callbackFunc: Function;
args: any[];
scheduler: SchedulerLike;
subject: AsyncSubject<T>;
context: any;
}
function dispatch<T>(this: SchedulerAction<DispatchState<T>>, state: DispatchState<T>) {
const { params, subscriber, context } = state;
const { callbackFunc, args, scheduler } = params;
let subject = params.subject;
if (!subject) {
subject = params.subject = new AsyncSubject<T>();
const handler = (...innerArgs: any[]) => {
const err = innerArgs.shift();
if (err) {
this.add(scheduler.schedule<DispatchErrorArg<T>>(dispatchError, 0, { err, subject }));
} else {
const value = innerArgs.length <= 1 ? innerArgs[0] : innerArgs;
this.add(scheduler.schedule<DispatchNextArg<T>>(dispatchNext, 0, { value, subject }));
}
};
try {
callbackFunc.apply(context, [...args, handler]);
} catch (err) {
this.add(scheduler.schedule<DispatchErrorArg<T>>(dispatchError, 0, { err, subject }));
}
}
this.add(subject.subscribe(subscriber));
}
interface DispatchNextArg<T> {
subject: AsyncSubject<T>;
value: T;
}
function dispatchNext<T>(arg: DispatchNextArg<T>) {
const { value, subject } = arg;
subject.next(value);
subject.complete();
}
interface DispatchErrorArg<T> {
subject: AsyncSubject<T>;
err: any;
}
function dispatchError<T>(arg: DispatchErrorArg<T>) {
const { err, subject } = arg;
subject.error(err);
}

View File

@@ -0,0 +1 @@
module.exports={A:{A:{"2":"J E F G BC","33":"A B"},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","33":"C K L H M N O"},C:{"1":"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","33":"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 DC EC"},D:{"1":"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","33":"0 1 2 3 4 5 6 7 8 9 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"},E:{"1":"NC","33":"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"},F:{"1":"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","33":"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"},G:{"33":"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:{"1":"D","33":"tB I oC pC qC rC AC sC tC"},J:{"33":"E A"},K:{"1":"e","2":"A B C qB 9B rB"},L:{"1":"D"},M:{"1":"D"},N:{"33":"A B"},O:{"1":"uC"},P:{"1":"wC xC yC zC 0B 0C 1C 2C 3C 4C sB 5C 6C 7C","33":"I vC"},Q:{"1":"1B"},R:{"1":"8C"},S:{"33":"9C"}},B:5,C:"CSS user-select: none"};

View File

@@ -0,0 +1 @@
{"version":3,"file":"isIterable.js","sources":["../../../src/internal/util/isIterable.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,IAAI,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAGjE,MAAM,UAAU,UAAU,CAAC,KAAU;IACnC,OAAO,KAAK,IAAI,OAAO,KAAK,CAAC,eAAe,CAAC,KAAK,UAAU,CAAC;AAC/D,CAAC"}

View File

@@ -0,0 +1,72 @@
import { Operator } from '../Operator';
import { Subscriber } from '../Subscriber';
import { Observable } from '../Observable';
import { OperatorFunction } from '../types';
/**
* Emits the given constant value on the output Observable every time the source
* Observable emits a value.
*
* <span class="informal">Like {@link map}, but it maps every source value to
* the same output value every time.</span>
*
* ![](mapTo.png)
*
* Takes a constant `value` as argument, and emits that whenever the source
* Observable emits a value. In other words, ignores the actual source value,
* and simply uses the emission moment to know when to emit the given `value`.
*
* ## Example
* Map every click to the string 'Hi'
* ```ts
* import { fromEvent } from 'rxjs';
* import { mapTo } from 'rxjs/operators';
*
* const clicks = fromEvent(document, 'click');
* const greetings = clicks.pipe(mapTo('Hi'));
* greetings.subscribe(x => console.log(x));
* ```
*
* @see {@link map}
*
* @param {any} value The value to map each source value to.
* @return {Observable} An Observable that emits the given `value` every time
* the source Observable emits something.
* @method mapTo
* @owner Observable
*/
export function mapTo<T, R>(value: R): OperatorFunction<T, R> {
return (source: Observable<T>) => source.lift(new MapToOperator(value));
}
class MapToOperator<T, R> implements Operator<T, R> {
value: R;
constructor(value: R) {
this.value = value;
}
call(subscriber: Subscriber<R>, source: any): any {
return source.subscribe(new MapToSubscriber(subscriber, this.value));
}
}
/**
* We need this JSDoc comment for affecting ESDoc.
* @ignore
* @extends {Ignored}
*/
class MapToSubscriber<T, R> extends Subscriber<T> {
value: R;
constructor(destination: Subscriber<R>, value: R) {
super(destination);
this.value = value;
}
protected _next(x: T) {
this.destination.next(this.value);
}
}