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,278 @@
/// <reference types="node"/>
import {SpinnerName} from 'cli-spinners';
declare namespace ora {
interface Spinner {
readonly interval?: number;
readonly frames: string[];
}
type Color =
| 'black'
| 'red'
| 'green'
| 'yellow'
| 'blue'
| 'magenta'
| 'cyan'
| 'white'
| 'gray';
type PrefixTextGenerator = () => string;
interface Options {
/**
Text to display after the spinner.
*/
readonly text?: string;
/**
Text or a function that returns text to display before the spinner. No prefix text will be displayed if set to an empty string.
*/
readonly prefixText?: string | PrefixTextGenerator;
/**
Name of one of the provided spinners. See [`example.js`](https://github.com/BendingBender/ora/blob/main/example.js) in this repo if you want to test out different spinners. On Windows, it will always use the line spinner as the Windows command-line doesn't have proper Unicode support.
@default 'dots'
Or an object like:
@example
```
{
interval: 80, // Optional
frames: ['-', '+', '-']
}
```
*/
readonly spinner?: SpinnerName | Spinner;
/**
Color of the spinner.
@default 'cyan'
*/
readonly color?: Color;
/**
Set to `false` to stop Ora from hiding the cursor.
@default true
*/
readonly hideCursor?: boolean;
/**
Indent the spinner with the given number of spaces.
@default 0
*/
readonly indent?: number;
/**
Interval between each frame.
Spinners provide their own recommended interval, so you don't really need to specify this.
Default: Provided by the spinner or `100`.
*/
readonly interval?: number;
/**
Stream to write the output.
You could for example set this to `process.stdout` instead.
@default process.stderr
*/
readonly stream?: NodeJS.WritableStream;
/**
Force enable/disable the spinner. If not specified, the spinner will be enabled if the `stream` is being run inside a TTY context (not spawned or piped) and/or not in a CI environment.
Note that `{isEnabled: false}` doesn't mean it won't output anything. It just means it won't output the spinner, colors, and other ansi escape codes. It will still log text.
*/
readonly isEnabled?: boolean;
/**
Disable the spinner and all log text. All output is suppressed and `isEnabled` will be considered `false`.
@default false
*/
readonly isSilent?: boolean;
/**
Discard stdin input (except Ctrl+C) while running if it's TTY. This prevents the spinner from twitching on input, outputting broken lines on `Enter` key presses, and prevents buffering of input while the spinner is running.
This has no effect on Windows as there's no good way to implement discarding stdin properly there.
@default true
*/
readonly discardStdin?: boolean;
}
interface PersistOptions {
/**
Symbol to replace the spinner with.
@default ' '
*/
readonly symbol?: string;
/**
Text to be persisted after the symbol.
Default: Current `text`.
*/
readonly text?: string;
/**
Text or a function that returns text to be persisted before the symbol. No prefix text will be displayed if set to an empty string.
Default: Current `prefixText`.
*/
readonly prefixText?: string | PrefixTextGenerator;
}
interface Ora {
/**
A boolean of whether the instance is currently spinning.
*/
readonly isSpinning: boolean;
/**
Change the text after the spinner.
*/
text: string;
/**
Change the text or function that returns text before the spinner. No prefix text will be displayed if set to an empty string.
*/
prefixText: string | PrefixTextGenerator;
/**
Change the spinner color.
*/
color: Color;
/**
Change the spinner.
*/
spinner: SpinnerName | Spinner;
/**
Change the spinner indent.
*/
indent: number;
/**
Start the spinner.
@param text - Set the current text.
@returns The spinner instance.
*/
start(text?: string): Ora;
/**
Stop and clear the spinner.
@returns The spinner instance.
*/
stop(): Ora;
/**
Stop the spinner, change it to a green `✔` and persist the current text, or `text` if provided.
@param text - Will persist text if provided.
@returns The spinner instance.
*/
succeed(text?: string): Ora;
/**
Stop the spinner, change it to a red `✖` and persist the current text, or `text` if provided.
@param text - Will persist text if provided.
@returns The spinner instance.
*/
fail(text?: string): Ora;
/**
Stop the spinner, change it to a yellow `⚠` and persist the current text, or `text` if provided.
@param text - Will persist text if provided.
@returns The spinner instance.
*/
warn(text?: string): Ora;
/**
Stop the spinner, change it to a blue `` and persist the current text, or `text` if provided.
@param text - Will persist text if provided.
@returns The spinner instance.
*/
info(text?: string): Ora;
/**
Stop the spinner and change the symbol or text.
@returns The spinner instance.
*/
stopAndPersist(options?: PersistOptions): Ora;
/**
Clear the spinner.
@returns The spinner instance.
*/
clear(): Ora;
/**
Manually render a new frame.
@returns The spinner instance.
*/
render(): Ora;
/**
Get a new frame.
@returns The spinner instance text.
*/
frame(): string;
}
}
declare const ora: {
/**
Elegant terminal spinner.
@param options - If a string is provided, it is treated as a shortcut for `options.text`.
@example
```
import ora = require('ora');
const spinner = ora('Loading unicorns').start();
setTimeout(() => {
spinner.color = 'yellow';
spinner.text = 'Loading rainbows';
}, 1000);
```
*/
(options?: ora.Options | string): ora.Ora;
/**
Starts a spinner for a promise. The spinner is stopped with `.succeed()` if the promise fulfills or with `.fail()` if it rejects.
@param action - The promise to start the spinner for.
@param options - If a string is provided, it is treated as a shortcut for `options.text`.
@returns The spinner instance.
*/
promise(
action: PromiseLike<unknown>,
options?: ora.Options | string
): ora.Ora;
};
export = ora;

View File

@@ -0,0 +1,118 @@
'use strict';
Object.defineProperty(exports, '__esModule', { value: true });
var internal = require('../internal/index.js');
const subscriber_queue = [];
/**
* Creates a `Readable` store that allows reading by subscription.
* @param value initial value
* @param {StartStopNotifier}start start and stop notifications for subscriptions
*/
function readable(value, start) {
return {
subscribe: writable(value, start).subscribe
};
}
/**
* Create a `Writable` store that allows both updating and reading by subscription.
* @param {*=}value initial value
* @param {StartStopNotifier=}start start and stop notifications for subscriptions
*/
function writable(value, start = internal.noop) {
let stop;
const subscribers = [];
function set(new_value) {
if (internal.safe_not_equal(value, new_value)) {
value = new_value;
if (stop) { // store is ready
const run_queue = !subscriber_queue.length;
for (let i = 0; i < subscribers.length; i += 1) {
const s = subscribers[i];
s[1]();
subscriber_queue.push(s, value);
}
if (run_queue) {
for (let i = 0; i < subscriber_queue.length; i += 2) {
subscriber_queue[i][0](subscriber_queue[i + 1]);
}
subscriber_queue.length = 0;
}
}
}
}
function update(fn) {
set(fn(value));
}
function subscribe(run, invalidate = internal.noop) {
const subscriber = [run, invalidate];
subscribers.push(subscriber);
if (subscribers.length === 1) {
stop = start(set) || internal.noop;
}
run(value);
return () => {
const index = subscribers.indexOf(subscriber);
if (index !== -1) {
subscribers.splice(index, 1);
}
if (subscribers.length === 0) {
stop();
stop = null;
}
};
}
return { set, update, subscribe };
}
function derived(stores, fn, initial_value) {
const single = !Array.isArray(stores);
const stores_array = single
? [stores]
: stores;
const auto = fn.length < 2;
return readable(initial_value, (set) => {
let inited = false;
const values = [];
let pending = 0;
let cleanup = internal.noop;
const sync = () => {
if (pending) {
return;
}
cleanup();
const result = fn(single ? values[0] : values, set);
if (auto) {
set(result);
}
else {
cleanup = internal.is_function(result) ? result : internal.noop;
}
};
const unsubscribers = stores_array.map((store, i) => internal.subscribe(store, (value) => {
values[i] = value;
pending &= ~(1 << i);
if (inited) {
sync();
}
}, () => {
pending |= (1 << i);
}));
inited = true;
sync();
return function stop() {
internal.run_all(unsubscribers);
cleanup();
};
});
}
Object.defineProperty(exports, 'get', {
enumerable: true,
get: function () {
return internal.get_store_value;
}
});
exports.derived = derived;
exports.readable = readable;
exports.writable = writable;

View File

@@ -0,0 +1 @@
{"name":"decompress-response","version":"3.3.0","files":{"package.json":{"checkedAt":1678887830333,"integrity":"sha512-qGevt/oSaA6njTsLFJ73czw5arLNEfw4hj34fRNZemBZ1MKkDjNtUUyMw0CUjVte9GqFk8s4Z8qCxT3wxCjRoA==","mode":420,"size":951},"license":{"checkedAt":1678887830333,"integrity":"sha512-jtZBtvmsdIy9+jBAOIeY8N99fR9h0mBHYyZg4vda8qE/sQpKUjFvYezdLGWIsW6Jui1Xnnn1mNKOGc594lsAHQ==","mode":420,"size":1120},"readme.md":{"checkedAt":1678887830333,"integrity":"sha512-nyU57bkkZxwWP4JoX7BePS131APYw3G4IJPsiDgiazaKqeOz/G5q0uR8q7jKyumi1wsTRk/xnbnug/Uk25Q6Pw==","mode":420,"size":841},"index.js":{"checkedAt":1678887830333,"integrity":"sha512-ELwoeyuU/u1jmwexh+fM37zXe8p/Y2h9WwVOOG7UcKzeuLm43lEpaIKqWZTnuqHVUNA7SqLlj8Qn6VKcOlPvsg==","mode":420,"size":628}}}

View File

@@ -0,0 +1 @@
{"version":3,"file":"windowTime.js","sources":["../../src/add/operator/windowTime.ts"],"names":[],"mappings":";;AAAA,+CAA6C"}

View File

@@ -0,0 +1,49 @@
let flexSpec = require('./flex-spec')
let Declaration = require('../declaration')
class AlignContent extends Declaration {
/**
* Change property name for 2012 spec
*/
prefixed (prop, prefix) {
let spec
;[spec, prefix] = flexSpec(prefix)
if (spec === 2012) {
return prefix + 'flex-line-pack'
}
return super.prefixed(prop, prefix)
}
/**
* Return property name by final spec
*/
normalize () {
return 'align-content'
}
/**
* Change value for 2012 spec and ignore prefix for 2009
*/
set (decl, prefix) {
let spec = flexSpec(prefix)[0]
if (spec === 2012) {
decl.value = AlignContent.oldValues[decl.value] || decl.value
return super.set(decl, prefix)
}
if (spec === 'final') {
return super.set(decl, prefix)
}
return undefined
}
}
AlignContent.names = ['align-content', 'flex-line-pack']
AlignContent.oldValues = {
'flex-end': 'end',
'flex-start': 'start',
'space-between': 'justify',
'space-around': 'distribute'
}
module.exports = AlignContent

View File

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

View File

@@ -0,0 +1,147 @@
import { Operator } from '../Operator';
import { Subscriber } from '../Subscriber';
import { Observable } from '../Observable';
import { MonoTypeOperatorFunction, PartialObserver, TeardownLogic } from '../types';
import { noop } from '../util/noop';
import { isFunction } from '../util/isFunction';
/* tslint:disable:max-line-length */
/** @deprecated Use an observer instead of a complete callback */
export function tap<T>(next: null | undefined, error: null | undefined, complete: () => void): MonoTypeOperatorFunction<T>;
/** @deprecated Use an observer instead of an error callback */
export function tap<T>(next: null | undefined, error: (error: any) => void, complete?: () => void): MonoTypeOperatorFunction<T>;
/** @deprecated Use an observer instead of a complete callback */
export function tap<T>(next: (value: T) => void, error: null | undefined, complete: () => void): MonoTypeOperatorFunction<T>;
export function tap<T>(next?: (x: T) => void, error?: (e: any) => void, complete?: () => void): MonoTypeOperatorFunction<T>;
export function tap<T>(observer: PartialObserver<T>): MonoTypeOperatorFunction<T>;
/* tslint:enable:max-line-length */
/**
* Perform a side effect for every emission on the source Observable, but return
* an Observable that is identical to the source.
*
* <span class="informal">Intercepts each emission on the source and runs a
* function, but returns an output which is identical to the source as long as errors don't occur.</span>
*
* ![](do.png)
*
* Returns a mirrored Observable of the source Observable, but modified so that
* the provided Observer is called to perform a side effect for every value,
* error, and completion emitted by the source. Any errors that are thrown in
* the aforementioned Observer or handlers are safely sent down the error path
* of the output Observable.
*
* This operator is useful for debugging your Observables for the correct values
* or performing other side effects.
*
* Note: this is different to a `subscribe` on the Observable. If the Observable
* returned by `tap` is not subscribed, the side effects specified by the
* Observer will never happen. `tap` therefore simply spies on existing
* execution, it does not trigger an execution to happen like `subscribe` does.
*
* ## Example
* Map every click to the clientX position of that click, while also logging the click event
* ```ts
* import { fromEvent } from 'rxjs';
* import { tap, map } from 'rxjs/operators';
*
* const clicks = fromEvent(document, 'click');
* const positions = clicks.pipe(
* tap(ev => console.log(ev)),
* map(ev => ev.clientX),
* );
* positions.subscribe(x => console.log(x));
* ```
*
* @see {@link map}
* @see {@link Observable#subscribe}
*
* @param {Observer|function} [nextOrObserver] A normal Observer object or a
* callback for `next`.
* @param {function} [error] Callback for errors in the source.
* @param {function} [complete] Callback for the completion of the source.
* @return {Observable} An Observable identical to the source, but runs the
* specified Observer or callback(s) for each item.
* @name tap
*/
export function tap<T>(nextOrObserver?: PartialObserver<T> | ((x: T) => void),
error?: (e: any) => void,
complete?: () => void): MonoTypeOperatorFunction<T> {
return function tapOperatorFunction(source: Observable<T>): Observable<T> {
return source.lift(new DoOperator(nextOrObserver, error, complete));
};
}
class DoOperator<T> implements Operator<T, T> {
constructor(private nextOrObserver?: PartialObserver<T> | ((x: T) => void),
private error?: (e: any) => void,
private complete?: () => void) {
}
call(subscriber: Subscriber<T>, source: any): TeardownLogic {
return source.subscribe(new TapSubscriber(subscriber, this.nextOrObserver, this.error, this.complete));
}
}
/**
* We need this JSDoc comment for affecting ESDoc.
* @ignore
* @extends {Ignored}
*/
class TapSubscriber<T> extends Subscriber<T> {
private _context: any;
private _tapNext: ((value: T) => void) = noop;
private _tapError: ((err: any) => void) = noop;
private _tapComplete: (() => void) = noop;
constructor(destination: Subscriber<T>,
observerOrNext?: PartialObserver<T> | ((value: T) => void),
error?: (e?: any) => void,
complete?: () => void) {
super(destination);
this._tapError = error || noop;
this._tapComplete = complete || noop;
if (isFunction(observerOrNext)) {
this._context = this;
this._tapNext = observerOrNext;
} else if (observerOrNext) {
this._context = observerOrNext;
this._tapNext = observerOrNext.next || noop;
this._tapError = observerOrNext.error || noop;
this._tapComplete = observerOrNext.complete || noop;
}
}
_next(value: T) {
try {
this._tapNext.call(this._context, value);
} catch (err) {
this.destination.error(err);
return;
}
this.destination.next(value);
}
_error(err: any) {
try {
this._tapError.call(this._context, err);
} catch (err) {
this.destination.error(err);
return;
}
this.destination.error(err);
}
_complete() {
try {
this._tapComplete.call(this._context, );
} catch (err) {
this.destination.error(err);
return;
}
return this.destination.complete();
}
}

View File

@@ -0,0 +1 @@
{"version":3,"file":"observeOn.js","sources":["../../../src/internal/operators/observeOn.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAE3C,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAuD/C,MAAM,UAAU,SAAS,CAAI,SAAwB,EAAE,KAAiB;IAAjB,sBAAA,EAAA,SAAiB;IACtE,OAAO,SAAS,yBAAyB,CAAC,MAAqB;QAC7D,OAAO,MAAM,CAAC,IAAI,CAAC,IAAI,iBAAiB,CAAC,SAAS,EAAE,KAAK,CAAC,CAAC,CAAC;IAC9D,CAAC,CAAC;AACJ,CAAC;AAED;IACE,2BAAoB,SAAwB,EAAU,KAAiB;QAAjB,sBAAA,EAAA,SAAiB;QAAnD,cAAS,GAAT,SAAS,CAAe;QAAU,UAAK,GAAL,KAAK,CAAY;IACvE,CAAC;IAED,gCAAI,GAAJ,UAAK,UAAyB,EAAE,MAAW;QACzC,OAAO,MAAM,CAAC,SAAS,CAAC,IAAI,mBAAmB,CAAC,UAAU,EAAE,IAAI,CAAC,SAAS,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC;IAC3F,CAAC;IACH,wBAAC;AAAD,CAAC,AAPD,IAOC;;AAOD;IAA4C,+CAAa;IAQvD,6BAAY,WAA0B,EAClB,SAAwB,EACxB,KAAiB;QAAjB,sBAAA,EAAA,SAAiB;QAFrC,YAGE,kBAAM,WAAW,CAAC,SACnB;QAHmB,eAAS,GAAT,SAAS,CAAe;QACxB,WAAK,GAAL,KAAK,CAAY;;IAErC,CAAC;IAVM,4BAAQ,GAAf,UAAyD,GAAqB;QACpE,IAAA,+BAAY,EAAE,6BAAW,CAAS;QAC1C,YAAY,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;QAClC,IAAI,CAAC,WAAW,EAAE,CAAC;IACrB,CAAC;IAQO,6CAAe,GAAvB,UAAwB,YAA+B;QACrD,IAAM,WAAW,GAAG,IAAI,CAAC,WAA2B,CAAC;QACrD,WAAW,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,QAAQ,CACrC,mBAAmB,CAAC,QAAQ,EAC5B,IAAI,CAAC,KAAK,EACV,IAAI,gBAAgB,CAAC,YAAY,EAAE,IAAI,CAAC,WAAW,CAAC,CACrD,CAAC,CAAC;IACL,CAAC;IAES,mCAAK,GAAf,UAAgB,KAAQ;QACtB,IAAI,CAAC,eAAe,CAAC,YAAY,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC;IACvD,CAAC;IAES,oCAAM,GAAhB,UAAiB,GAAQ;QACvB,IAAI,CAAC,eAAe,CAAC,YAAY,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,CAAC;QACpD,IAAI,CAAC,WAAW,EAAE,CAAC;IACrB,CAAC;IAES,uCAAS,GAAnB;QACE,IAAI,CAAC,eAAe,CAAC,YAAY,CAAC,cAAc,EAAE,CAAC,CAAC;QACpD,IAAI,CAAC,WAAW,EAAE,CAAC;IACrB,CAAC;IACH,0BAAC;AAAD,CAAC,AApCD,CAA4C,UAAU,GAoCrD;;AAED;IACE,0BAAmB,YAA+B,EAC/B,WAAiC;QADjC,iBAAY,GAAZ,YAAY,CAAmB;QAC/B,gBAAW,GAAX,WAAW,CAAsB;IACpD,CAAC;IACH,uBAAC;AAAD,CAAC,AAJD,IAIC"}

View File

@@ -0,0 +1,105 @@
/* Operator exports */
export { audit } from '../internal/operators/audit';
export { auditTime } from '../internal/operators/auditTime';
export { buffer } from '../internal/operators/buffer';
export { bufferCount } from '../internal/operators/bufferCount';
export { bufferTime } from '../internal/operators/bufferTime';
export { bufferToggle } from '../internal/operators/bufferToggle';
export { bufferWhen } from '../internal/operators/bufferWhen';
export { catchError } from '../internal/operators/catchError';
export { combineAll } from '../internal/operators/combineAll';
export { combineLatest } from '../internal/operators/combineLatest';
export { concat } from '../internal/operators/concat';
export { concatAll } from '../internal/operators/concatAll';
export { concatMap } from '../internal/operators/concatMap';
export { concatMapTo } from '../internal/operators/concatMapTo';
export { count } from '../internal/operators/count';
export { debounce } from '../internal/operators/debounce';
export { debounceTime } from '../internal/operators/debounceTime';
export { defaultIfEmpty } from '../internal/operators/defaultIfEmpty';
export { delay } from '../internal/operators/delay';
export { delayWhen } from '../internal/operators/delayWhen';
export { dematerialize } from '../internal/operators/dematerialize';
export { distinct } from '../internal/operators/distinct';
export { distinctUntilChanged } from '../internal/operators/distinctUntilChanged';
export { distinctUntilKeyChanged } from '../internal/operators/distinctUntilKeyChanged';
export { elementAt } from '../internal/operators/elementAt';
export { endWith } from '../internal/operators/endWith';
export { every } from '../internal/operators/every';
export { exhaust } from '../internal/operators/exhaust';
export { exhaustMap } from '../internal/operators/exhaustMap';
export { expand } from '../internal/operators/expand';
export { filter } from '../internal/operators/filter';
export { finalize } from '../internal/operators/finalize';
export { find } from '../internal/operators/find';
export { findIndex } from '../internal/operators/findIndex';
export { first } from '../internal/operators/first';
export { groupBy } from '../internal/operators/groupBy';
export { ignoreElements } from '../internal/operators/ignoreElements';
export { isEmpty } from '../internal/operators/isEmpty';
export { last } from '../internal/operators/last';
export { map } from '../internal/operators/map';
export { mapTo } from '../internal/operators/mapTo';
export { materialize } from '../internal/operators/materialize';
export { max } from '../internal/operators/max';
export { merge } from '../internal/operators/merge';
export { mergeAll } from '../internal/operators/mergeAll';
export { mergeMap, flatMap } from '../internal/operators/mergeMap';
export { mergeMapTo } from '../internal/operators/mergeMapTo';
export { mergeScan } from '../internal/operators/mergeScan';
export { min } from '../internal/operators/min';
export { multicast } from '../internal/operators/multicast';
export { observeOn } from '../internal/operators/observeOn';
export { onErrorResumeNext } from '../internal/operators/onErrorResumeNext';
export { pairwise } from '../internal/operators/pairwise';
export { partition } from '../internal/operators/partition';
export { pluck } from '../internal/operators/pluck';
export { publish } from '../internal/operators/publish';
export { publishBehavior } from '../internal/operators/publishBehavior';
export { publishLast } from '../internal/operators/publishLast';
export { publishReplay } from '../internal/operators/publishReplay';
export { race } from '../internal/operators/race';
export { reduce } from '../internal/operators/reduce';
export { repeat } from '../internal/operators/repeat';
export { repeatWhen } from '../internal/operators/repeatWhen';
export { retry } from '../internal/operators/retry';
export { retryWhen } from '../internal/operators/retryWhen';
export { refCount } from '../internal/operators/refCount';
export { sample } from '../internal/operators/sample';
export { sampleTime } from '../internal/operators/sampleTime';
export { scan } from '../internal/operators/scan';
export { sequenceEqual } from '../internal/operators/sequenceEqual';
export { share } from '../internal/operators/share';
export { shareReplay } from '../internal/operators/shareReplay';
export { single } from '../internal/operators/single';
export { skip } from '../internal/operators/skip';
export { skipLast } from '../internal/operators/skipLast';
export { skipUntil } from '../internal/operators/skipUntil';
export { skipWhile } from '../internal/operators/skipWhile';
export { startWith } from '../internal/operators/startWith';
export { subscribeOn } from '../internal/operators/subscribeOn';
export { switchAll } from '../internal/operators/switchAll';
export { switchMap } from '../internal/operators/switchMap';
export { switchMapTo } from '../internal/operators/switchMapTo';
export { take } from '../internal/operators/take';
export { takeLast } from '../internal/operators/takeLast';
export { takeUntil } from '../internal/operators/takeUntil';
export { takeWhile } from '../internal/operators/takeWhile';
export { tap } from '../internal/operators/tap';
export { throttle } from '../internal/operators/throttle';
export { throttleTime } from '../internal/operators/throttleTime';
export { throwIfEmpty } from '../internal/operators/throwIfEmpty';
export { timeInterval } from '../internal/operators/timeInterval';
export { timeout } from '../internal/operators/timeout';
export { timeoutWith } from '../internal/operators/timeoutWith';
export { timestamp } from '../internal/operators/timestamp';
export { toArray } from '../internal/operators/toArray';
export { window } from '../internal/operators/window';
export { windowCount } from '../internal/operators/windowCount';
export { windowTime } from '../internal/operators/windowTime';
export { windowToggle } from '../internal/operators/windowToggle';
export { windowWhen } from '../internal/operators/windowWhen';
export { withLatestFrom } from '../internal/operators/withLatestFrom';
export { zip } from '../internal/operators/zip';
export { zipAll } from '../internal/operators/zipAll';

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.00174,"35":0,"36":0,"37":0,"38":0,"39":0,"40":0,"41":0,"42":0,"43":0.00174,"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.00174,"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,"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,"92":0,"93":0,"94":0,"95":0,"96":0,"97":0,"98":0,"99":0,"100":0,"101":0,"102":0.00174,"103":0,"104":0,"105":0,"106":0,"107":0.00174,"108":0.12557,"109":0.07674,"110":0.00349,"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.00523,"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.01046,"41":0,"42":0,"43":0,"44":0,"45":0,"46":0.00174,"47":0,"48":0,"49":0.00174,"50":0.00174,"51":0,"52":0,"53":0,"54":0,"55":0,"56":0,"57":0,"58":0,"59":0,"60":0.00523,"61":0,"62":0,"63":0.00174,"64":0.00523,"65":0.00349,"66":0,"67":0,"68":0.00174,"69":0,"70":0.00174,"71":0.00174,"72":0.00349,"73":0,"74":0.00349,"75":0.00174,"76":0.00174,"77":0.00174,"78":0.00174,"79":0.22672,"80":0.00174,"81":0.00698,"83":0.00349,"84":0.00174,"85":0.00349,"86":0.00174,"87":0.00349,"88":0.00174,"89":0.00349,"90":0.00349,"91":0.00349,"92":0,"93":0.03139,"94":0,"95":0.00523,"96":0,"97":0.00174,"98":0,"99":0.00174,"100":0,"101":0.00349,"102":0.00174,"103":0.01395,"104":0.00698,"105":0.00174,"106":0.00349,"107":0.0279,"108":0.48483,"109":0.43251,"110":0.00174,"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.00698,"51":0,"52":0,"53":0,"54":0.00174,"55":0,"56":0,"57":0,"58":0,"60":0.00523,"62":0,"63":0.00872,"64":0.00349,"65":0.00174,"66":0.00872,"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.00174,"86":0,"87":0,"88":0,"89":0,"90":0,"91":0,"92":0,"93":0.00174,"94":0.05058,"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.00174},B:{"12":0.00174,"13":0.00349,"14":0,"15":0,"16":0,"17":0,"18":0.00174,"79":0,"80":0,"81":0,"83":0,"84":0.00174,"85":0,"86":0,"87":0,"88":0,"89":0,"90":0,"91":0,"92":0.00349,"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.00174,"106":0,"107":0.00698,"108":0.17963,"109":0.12382},E:{"4":0,"5":0,"6":0,"7":0,"8":0,"9":0,"10":0,"11":0,"12":0,"13":0,"14":0.00349,"15":0,_:"0","3.1":0,"3.2":0,"5.1":0.00174,"6.1":0,"7.1":0,"9.1":0.00523,"10.1":0,"11.1":0,"12.1":0.00174,"13.1":0.00523,"14.1":0.01221,"15.1":0,"15.2-15.3":0,"15.4":0.00349,"15.5":0.00698,"15.6":0.06802,"16.0":0,"16.1":0.01395,"16.2":0.0157,"16.3":0},G:{"8":0,"3.2":0,"4.0-4.1":0,"4.2-4.3":0,"5.0-5.1":0.05819,"6.0-6.1":0,"7.0-7.1":0.01791,"8.1-8.4":0,"9.0-9.2":0.00224,"9.3":0.67147,"10.0-10.2":0,"10.3":0.74534,"11.0-11.2":0.00448,"11.3-11.4":0.0291,"12.0-12.1":1.87341,"12.2-12.5":4.05794,"13.0-13.1":0.37603,"13.2":0.0761,"13.3":0.64685,"13.4-13.7":0.16563,"14.0-14.4":1.33176,"14.5-14.8":1.58468,"15.0-15.1":0.5618,"15.2-15.3":0.65357,"15.4":0.84382,"15.5":0.7901,"15.6":0.82591,"16.0":1.47501,"16.1":2.50012,"16.2":1.66749,"16.3":0.12982},P:{"4":1.54597,"5.0-5.4":0.03134,"6.2-6.4":0.02089,"7.2-7.4":0.1149,"8.2":0,"9.2":0.05223,"10.1":0.06267,"11.1-11.2":0.02089,"12.0":0,"13.0":0.01045,"14.0":0.07312,"15.0":0.01045,"16.0":0.04178,"17.0":0.07312,"18.0":0.15669,"19.0":0.69987},I:{"0":0,"3":0,"4":0.00056,"2.1":0,"2.2":0,"2.3":0,"4.1":0.00265,"4.2-4.3":0.01886,"4.4":0,"4.4.3-4.4.4":0.05026},K:{_:"0 10 11 12 11.1 11.5 12.1"},A:{"6":0,"7":0,"8":0,"9":0,"10":0,"11":0.00174,"5.5":0},J:{"7":0,"10":0},N:{"10":0,"11":0},R:{_:"0"},M:{"0":0.04954},Q:{"13.1":0},O:{"0":0.40454},H:{"0":0.90668},L:{"0":71.62133},S:{"2.5":0.00826}};

View File

@@ -0,0 +1,32 @@
{
"name": "deprecated-obj",
"version": "2.0.0",
"description": "Compares deprecations against a configuration object, and returns a compliant object and violations",
"main": "index.js",
"scripts": {
"test": "node test.js"
},
"keywords": [
"deprecate",
"deprecated",
"configuration"
],
"author": {
"email": "lars@webpro.nl",
"name": "Lars Kappert"
},
"license": "MIT",
"dependencies": {
"flat": "^5.0.2",
"lodash": "^4.17.20"
},
"repository": {
"type": "git",
"url": "https://github.com/webpro/deprecated-obj.git"
},
"homepage": "https://github.com/webpro/deprecated-obj#readme",
"bugs": "https://github.com/webpro/deprecated-obj/issues",
"engines": {
"node": ">=10"
}
}

View File

@@ -0,0 +1,59 @@
'use strict'
let Container = require('./container')
let LazyResult, Processor
class Root extends Container {
constructor(defaults) {
super(defaults)
this.type = 'root'
if (!this.nodes) this.nodes = []
}
removeChild(child, ignore) {
let index = this.index(child)
if (!ignore && index === 0 && this.nodes.length > 1) {
this.nodes[1].raws.before = this.nodes[index].raws.before
}
return super.removeChild(child)
}
normalize(child, sample, type) {
let nodes = super.normalize(child)
if (sample) {
if (type === 'prepend') {
if (this.nodes.length > 1) {
sample.raws.before = this.nodes[1].raws.before
} else {
delete sample.raws.before
}
} else if (this.first !== sample) {
for (let node of nodes) {
node.raws.before = sample.raws.before
}
}
}
return nodes
}
toResult(opts = {}) {
let lazy = new LazyResult(new Processor(), this, opts)
return lazy.stringify()
}
}
Root.registerLazyResult = dependant => {
LazyResult = dependant
}
Root.registerProcessor = dependant => {
Processor = dependant
}
module.exports = Root
Root.default = Root

View File

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

View File

@@ -0,0 +1,83 @@
# decode-uri-component
![CI](https://github.com/SamVerschueren/decode-uri-component/workflows/CI/badge.svg) [![Coverage Status](https://coveralls.io/repos/SamVerschueren/decode-uri-component/badge.svg?branch=master&service=github)](https://coveralls.io/github/SamVerschueren/decode-uri-component?branch=master)
> A better [decodeURIComponent](https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/decodeURIComponent)
## Why?
- Decodes `+` to a space.
- Converts the [BOM](https://en.wikipedia.org/wiki/Byte_order_mark) to a [replacement character](https://en.wikipedia.org/wiki/Specials_(Unicode_block)#Replacement_character) `<60>`.
- Does not throw with invalid encoded input.
- Decodes as much of the string as possible.
## Install
```
$ npm install --save decode-uri-component
```
## Usage
```js
const decodeUriComponent = require('decode-uri-component');
decodeUriComponent('%25');
//=> '%'
decodeUriComponent('%');
//=> '%'
decodeUriComponent('st%C3%A5le');
//=> 'ståle'
decodeUriComponent('%st%C3%A5le%');
//=> '%ståle%'
decodeUriComponent('%%7Bst%C3%A5le%7D%');
//=> '%{ståle}%'
decodeUriComponent('%7B%ab%%7C%de%%7D');
//=> '{%ab%|%de%}'
decodeUriComponent('%FE%FF');
//=> '\uFFFD\uFFFD'
decodeUriComponent('%C2');
//=> '\uFFFD'
decodeUriComponent('%C2%B5');
//=> 'µ'
```
## API
### decodeUriComponent(encodedURI)
#### encodedURI
Type: `string`
An encoded component of a Uniform Resource Identifier.
## License
MIT © [Sam Verschueren](https://github.com/SamVerschueren)
---
<div align="center">
<b>
<a href="https://tidelift.com/subscription/pkg/npm-decode-uri-component?utm_source=npm-decode-uri-component&utm_medium=referral&utm_campaign=readme">Get professional support for this package with a Tidelift subscription</a>
</b>
<br>
<sub>
Tidelift helps make open source sustainable for maintainers while giving companies<br>assurances about security, maintenance, and licensing for their dependencies.
</sub>
</div>

View File

@@ -0,0 +1 @@
module.exports={A:{A:{"1":"A B","2":"J E F G BC"},B:{"1":"C K L H M 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"},C:{"1":"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 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":"CC tB DC EC"},D:{"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 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","16":"I u J E F G A B C K L"},E:{"1":"J E F G A B C K L H HC IC JC KC 0B qB rB 1B LC MC 2B 3B 4B 5B sB 6B 7B 8B NC","2":"I u GC zB"},F:{"1":"0 1 2 3 4 5 6 7 8 9 B C 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 RC qB 9B SC rB","2":"G OC","16":"PC QC"},G:{"1":"F 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","2":"zB TC AC"},H:{"1":"nC"},I:{"1":"I D rC AC sC tC","2":"oC pC qC","16":"tB"},J:{"1":"A","2":"E"},K:{"1":"B C e qB 9B rB","16":"A"},L:{"1":"D"},M:{"1":"D"},N:{"1":"A B"},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:{"1":"9C"}},B:1,C:"Attributes for form submission"};

View File

@@ -0,0 +1,48 @@
import { Observable } from '../Observable';
import { Subscription } from '../Subscription';
import { Scheduler } from '../Scheduler';
import { TestMessage } from './TestMessage';
import { SubscriptionLog } from './SubscriptionLog';
import { SubscriptionLoggable } from './SubscriptionLoggable';
import { applyMixins } from '../util/applyMixins';
import { Subscriber } from '../Subscriber';
/**
* We need this JSDoc comment for affecting ESDoc.
* @ignore
* @extends {Ignored}
*/
export class ColdObservable<T> extends Observable<T> implements SubscriptionLoggable {
public subscriptions: SubscriptionLog[] = [];
scheduler: Scheduler;
logSubscribedFrame: () => number;
logUnsubscribedFrame: (index: number) => void;
constructor(public messages: TestMessage[],
scheduler: Scheduler) {
super(function (this: Observable<T>, subscriber: Subscriber<any>) {
const observable: ColdObservable<T> = this as any;
const index = observable.logSubscribedFrame();
const subscription = new Subscription();
subscription.add(new Subscription(() => {
observable.logUnsubscribedFrame(index);
}));
observable.scheduleMessages(subscriber);
return subscription;
});
this.scheduler = scheduler;
}
scheduleMessages(subscriber: Subscriber<any>) {
const messagesLength = this.messages.length;
for (let i = 0; i < messagesLength; i++) {
const message = this.messages[i];
subscriber.add(
this.scheduler.schedule(({ message, subscriber }) => { message.notification.observe(subscriber); },
message.frame,
{ message, subscriber })
);
}
}
}
applyMixins(ColdObservable, [SubscriptionLoggable]);

View File

@@ -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/operators/switchMapTo"));
//# sourceMappingURL=switchMapTo.js.map

View File

@@ -0,0 +1,550 @@
import { root } from '../../util/root';
import { Observable } from '../../Observable';
import { Subscriber } from '../../Subscriber';
import { TeardownLogic } from '../../types';
import { map } from '../../operators/map';
export interface AjaxRequest {
url?: string;
body?: any;
user?: string;
async?: boolean;
method?: string;
headers?: Object;
timeout?: number;
password?: string;
hasContent?: boolean;
crossDomain?: boolean;
withCredentials?: boolean;
createXHR?: () => XMLHttpRequest;
progressSubscriber?: Subscriber<any>;
responseType?: string;
}
function getCORSRequest(): XMLHttpRequest {
if (root.XMLHttpRequest) {
return new root.XMLHttpRequest();
} else if (!!root.XDomainRequest) {
return new root.XDomainRequest();
} else {
throw new Error('CORS is not supported by your browser');
}
}
function getXMLHttpRequest(): XMLHttpRequest {
if (root.XMLHttpRequest) {
return new root.XMLHttpRequest();
} else {
let progId: string;
try {
const progIds = ['Msxml2.XMLHTTP', 'Microsoft.XMLHTTP', 'Msxml2.XMLHTTP.4.0'];
for (let i = 0; i < 3; i++) {
try {
progId = progIds[i];
if (new root.ActiveXObject(progId)) {
break;
}
} catch (e) {
//suppress exceptions
}
}
return new root.ActiveXObject(progId);
} catch (e) {
throw new Error('XMLHttpRequest is not supported by your browser');
}
}
}
export interface AjaxCreationMethod {
(urlOrRequest: string | AjaxRequest): Observable<AjaxResponse>;
get(url: string, headers?: Object): Observable<AjaxResponse>;
post(url: string, body?: any, headers?: Object): Observable<AjaxResponse>;
put(url: string, body?: any, headers?: Object): Observable<AjaxResponse>;
patch(url: string, body?: any, headers?: Object): Observable<AjaxResponse>;
delete(url: string, headers?: Object): Observable<AjaxResponse>;
getJSON<T>(url: string, headers?: Object): Observable<T>;
}
export function ajaxGet(url: string, headers: Object = null) {
return new AjaxObservable<AjaxResponse>({ method: 'GET', url, headers });
}
export function ajaxPost(url: string, body?: any, headers?: Object): Observable<AjaxResponse> {
return new AjaxObservable<AjaxResponse>({ method: 'POST', url, body, headers });
}
export function ajaxDelete(url: string, headers?: Object): Observable<AjaxResponse> {
return new AjaxObservable<AjaxResponse>({ method: 'DELETE', url, headers });
}
export function ajaxPut(url: string, body?: any, headers?: Object): Observable<AjaxResponse> {
return new AjaxObservable<AjaxResponse>({ method: 'PUT', url, body, headers });
}
export function ajaxPatch(url: string, body?: any, headers?: Object): Observable<AjaxResponse> {
return new AjaxObservable<AjaxResponse>({ method: 'PATCH', url, body, headers });
}
const mapResponse = map((x: AjaxResponse, index: number) => x.response);
export function ajaxGetJSON<T>(url: string, headers?: Object): Observable<T> {
return mapResponse(
new AjaxObservable<AjaxResponse>({
method: 'GET',
url,
responseType: 'json',
headers
})
);
}
/**
* We need this JSDoc comment for affecting ESDoc.
* @extends {Ignored}
* @hide true
*/
export class AjaxObservable<T> extends Observable<T> {
/**
* Creates an observable for an Ajax request with either a request object with
* url, headers, etc or a string for a URL.
*
* ## Example
* ```ts
* import { ajax } from 'rxjs/ajax';
*
* const source1 = ajax('/products');
* const source2 = ajax({ url: 'products', method: 'GET' });
* ```
*
* @param {string|Object} request Can be one of the following:
* A string of the URL to make the Ajax call.
* An object with the following properties
* - url: URL of the request
* - body: The body of the request
* - method: Method of the request, such as GET, POST, PUT, PATCH, DELETE
* - async: Whether the request is async
* - headers: Optional headers
* - crossDomain: true if a cross domain request, else false
* - createXHR: a function to override if you need to use an alternate
* XMLHttpRequest implementation.
* - resultSelector: a function to use to alter the output value type of
* the Observable. Gets {@link AjaxResponse} as an argument.
* @return {Observable} An observable sequence containing the XMLHttpRequest.
* @static true
* @name ajax
* @owner Observable
* @nocollapse
*/
static create: AjaxCreationMethod = (() => {
const create: any = (urlOrRequest: string | AjaxRequest) => {
return new AjaxObservable(urlOrRequest);
};
create.get = ajaxGet;
create.post = ajaxPost;
create.delete = ajaxDelete;
create.put = ajaxPut;
create.patch = ajaxPatch;
create.getJSON = ajaxGetJSON;
return <AjaxCreationMethod>create;
})();
private request: AjaxRequest;
constructor(urlOrRequest: string | AjaxRequest) {
super();
const request: AjaxRequest = {
async: true,
createXHR: function(this: AjaxRequest) {
return this.crossDomain ? getCORSRequest() : getXMLHttpRequest();
},
crossDomain: true,
withCredentials: false,
headers: {},
method: 'GET',
responseType: 'json',
timeout: 0
};
if (typeof urlOrRequest === 'string') {
request.url = urlOrRequest;
} else {
for (const prop in urlOrRequest) {
if (urlOrRequest.hasOwnProperty(prop)) {
request[prop] = urlOrRequest[prop];
}
}
}
this.request = request;
}
/** @deprecated This is an internal implementation detail, do not use. */
_subscribe(subscriber: Subscriber<T>): TeardownLogic {
return new AjaxSubscriber(subscriber, this.request);
}
}
/**
* We need this JSDoc comment for affecting ESDoc.
* @ignore
* @extends {Ignored}
*/
export class AjaxSubscriber<T> extends Subscriber<Event> {
private xhr: XMLHttpRequest;
private done: boolean = false;
constructor(destination: Subscriber<T>, public request: AjaxRequest) {
super(destination);
const headers = request.headers = request.headers || {};
// force CORS if requested
if (!request.crossDomain && !this.getHeader(headers, 'X-Requested-With')) {
headers['X-Requested-With'] = 'XMLHttpRequest';
}
// ensure content type is set
let contentTypeHeader = this.getHeader(headers, 'Content-Type');
if (!contentTypeHeader && !(root.FormData && request.body instanceof root.FormData) && typeof request.body !== 'undefined') {
headers['Content-Type'] = 'application/x-www-form-urlencoded; charset=UTF-8';
}
// properly serialize body
request.body = this.serializeBody(request.body, this.getHeader(request.headers, 'Content-Type'));
this.send();
}
next(e: Event): void {
this.done = true;
const { xhr, request, destination } = this;
let result;
try {
result = new AjaxResponse(e, xhr, request);
} catch (err) {
return destination.error(err);
}
destination.next(result);
}
private send(): void {
const {
request,
request: { user, method, url, async, password, headers, body }
} = this;
try {
const xhr = this.xhr = request.createXHR();
// set up the events before open XHR
// https://developer.mozilla.org/en/docs/Web/API/XMLHttpRequest/Using_XMLHttpRequest
// You need to add the event listeners before calling open() on the request.
// Otherwise the progress events will not fire.
this.setupEvents(xhr, request);
// open XHR
if (user) {
xhr.open(method, url, async, user, password);
} else {
xhr.open(method, url, async);
}
// timeout, responseType and withCredentials can be set once the XHR is open
if (async) {
xhr.timeout = request.timeout;
xhr.responseType = request.responseType as any;
}
if ('withCredentials' in xhr) {
xhr.withCredentials = !!request.withCredentials;
}
// set headers
this.setHeaders(xhr, headers);
// finally send the request
if (body) {
xhr.send(body);
} else {
xhr.send();
}
} catch (err) {
this.error(err);
}
}
private serializeBody(body: any, contentType?: string) {
if (!body || typeof body === 'string') {
return body;
} else if (root.FormData && body instanceof root.FormData) {
return body;
}
if (contentType) {
const splitIndex = contentType.indexOf(';');
if (splitIndex !== -1) {
contentType = contentType.substring(0, splitIndex);
}
}
switch (contentType) {
case 'application/x-www-form-urlencoded':
return Object.keys(body).map(key => `${encodeURIComponent(key)}=${encodeURIComponent(body[key])}`).join('&');
case 'application/json':
return JSON.stringify(body);
default:
return body;
}
}
private setHeaders(xhr: XMLHttpRequest, headers: Object) {
for (let key in headers) {
if (headers.hasOwnProperty(key)) {
xhr.setRequestHeader(key, headers[key]);
}
}
}
private getHeader(headers: {}, headerName: string): any {
for (let key in headers) {
if (key.toLowerCase() === headerName.toLowerCase()) {
return headers[key];
}
}
return undefined;
}
private setupEvents(xhr: XMLHttpRequest, request: AjaxRequest) {
const progressSubscriber = request.progressSubscriber;
function xhrTimeout(this: XMLHttpRequest, e: ProgressEvent): void {
const {subscriber, progressSubscriber, request } = (<any>xhrTimeout);
if (progressSubscriber) {
progressSubscriber.error(e);
}
let error;
try {
error = new AjaxTimeoutError(this, request); // TODO: Make betterer.
} catch (err) {
error = err;
}
subscriber.error(error);
}
xhr.ontimeout = xhrTimeout;
(<any>xhrTimeout).request = request;
(<any>xhrTimeout).subscriber = this;
(<any>xhrTimeout).progressSubscriber = progressSubscriber;
if (xhr.upload && 'withCredentials' in xhr) {
if (progressSubscriber) {
let xhrProgress: (e: ProgressEvent) => void;
xhrProgress = function(e: ProgressEvent) {
const { progressSubscriber } = (<any>xhrProgress);
progressSubscriber.next(e);
};
if (root.XDomainRequest) {
xhr.onprogress = xhrProgress;
} else {
xhr.upload.onprogress = xhrProgress;
}
(<any>xhrProgress).progressSubscriber = progressSubscriber;
}
let xhrError: (e: any) => void;
xhrError = function(this: XMLHttpRequest, e: ErrorEvent) {
const { progressSubscriber, subscriber, request } = (<any>xhrError);
if (progressSubscriber) {
progressSubscriber.error(e);
}
let error;
try {
error = new AjaxError('ajax error', this, request);
} catch (err) {
error = err;
}
subscriber.error(error);
};
xhr.onerror = xhrError;
(<any>xhrError).request = request;
(<any>xhrError).subscriber = this;
(<any>xhrError).progressSubscriber = progressSubscriber;
}
function xhrReadyStateChange(this: XMLHttpRequest, e: Event) {
return;
}
xhr.onreadystatechange = xhrReadyStateChange;
(<any>xhrReadyStateChange).subscriber = this;
(<any>xhrReadyStateChange).progressSubscriber = progressSubscriber;
(<any>xhrReadyStateChange).request = request;
function xhrLoad(this: XMLHttpRequest, e: Event) {
const { subscriber, progressSubscriber, request } = (<any>xhrLoad);
if (this.readyState === 4) {
// normalize IE9 bug (http://bugs.jquery.com/ticket/1450)
let status: number = this.status === 1223 ? 204 : this.status;
let response: any = (this.responseType === 'text' ? (
this.response || this.responseText) : this.response);
// fix status code when it is 0 (0 status is undocumented).
// Occurs when accessing file resources or on Android 4.1 stock browser
// while retrieving files from application cache.
if (status === 0) {
status = response ? 200 : 0;
}
// 4xx and 5xx should error (https://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html)
if (status < 400) {
if (progressSubscriber) {
progressSubscriber.complete();
}
subscriber.next(e);
subscriber.complete();
} else {
if (progressSubscriber) {
progressSubscriber.error(e);
}
let error;
try {
error = new AjaxError('ajax error ' + status, this, request);
} catch (err) {
error = err;
}
subscriber.error(error);
}
}
}
xhr.onload = xhrLoad;
(<any>xhrLoad).subscriber = this;
(<any>xhrLoad).progressSubscriber = progressSubscriber;
(<any>xhrLoad).request = request;
}
unsubscribe() {
const { done, xhr } = this;
if (!done && xhr && xhr.readyState !== 4 && typeof xhr.abort === 'function') {
xhr.abort();
}
super.unsubscribe();
}
}
/**
* A normalized AJAX response.
*
* @see {@link ajax}
*
* @class AjaxResponse
*/
export class AjaxResponse {
/** @type {number} The HTTP status code */
status: number;
/** @type {string|ArrayBuffer|Document|object|any} The response data */
response: any;
/** @type {string} The raw responseText */
responseText: string;
/** @type {string} The responseType (e.g. 'json', 'arraybuffer', or 'xml') */
responseType: string;
constructor(public originalEvent: Event, public xhr: XMLHttpRequest, public request: AjaxRequest) {
this.status = xhr.status;
this.responseType = xhr.responseType || request.responseType;
this.response = parseXhrResponse(this.responseType, xhr);
}
}
export type AjaxErrorNames = 'AjaxError' | 'AjaxTimeoutError';
/**
* A normalized AJAX error.
*
* @see {@link ajax}
*
* @class AjaxError
*/
export interface AjaxError extends Error {
/** @type {XMLHttpRequest} The XHR instance associated with the error */
xhr: XMLHttpRequest;
/** @type {AjaxRequest} The AjaxRequest associated with the error */
request: AjaxRequest;
/** @type {number} The HTTP status code */
status: number;
/** @type {string} The responseType (e.g. 'json', 'arraybuffer', or 'xml') */
responseType: string;
/** @type {string|ArrayBuffer|Document|object|any} The response data */
response: any;
}
export interface AjaxErrorCtor {
new(message: string, xhr: XMLHttpRequest, request: AjaxRequest): AjaxError;
}
const AjaxErrorImpl = (() => {
function AjaxErrorImpl(this: any, message: string, xhr: XMLHttpRequest, request: AjaxRequest): AjaxError {
Error.call(this);
this.message = message;
this.name = 'AjaxError';
this.xhr = xhr;
this.request = request;
this.status = xhr.status;
this.responseType = xhr.responseType || request.responseType;
this.response = parseXhrResponse(this.responseType, xhr);
return this;
}
AjaxErrorImpl.prototype = Object.create(Error.prototype);
return AjaxErrorImpl;
})();
export const AjaxError: AjaxErrorCtor = AjaxErrorImpl as any;
function parseJson(xhr: XMLHttpRequest) {
// HACK(benlesh): TypeScript shennanigans
// tslint:disable-next-line:no-any XMLHttpRequest is defined to always have 'response' inferring xhr as never for the else clause.
if ('response' in (xhr as any)) {
//IE does not support json as responseType, parse it internally
return xhr.responseType ? xhr.response : JSON.parse(xhr.response || xhr.responseText || 'null');
} else {
return JSON.parse((xhr as any).responseText || 'null');
}
}
function parseXhrResponse(responseType: string, xhr: XMLHttpRequest) {
switch (responseType) {
case 'json':
return parseJson(xhr);
case 'xml':
return xhr.responseXML;
case 'text':
default:
// HACK(benlesh): TypeScript shennanigans
// tslint:disable-next-line:no-any XMLHttpRequest is defined to always have 'response' inferring xhr as never for the else sub-expression.
return ('response' in (xhr as any)) ? xhr.response : xhr.responseText;
}
}
export interface AjaxTimeoutError extends AjaxError {
}
export interface AjaxTimeoutErrorCtor {
new(xhr: XMLHttpRequest, request: AjaxRequest): AjaxTimeoutError;
}
function AjaxTimeoutErrorImpl(this: any, xhr: XMLHttpRequest, request: AjaxRequest) {
AjaxError.call(this, 'ajax timeout', xhr, request);
this.name = 'AjaxTimeoutError';
return this;
}
/**
* @see {@link ajax}
*
* @class AjaxTimeoutError
*/
export const AjaxTimeoutError: AjaxTimeoutErrorCtor = AjaxTimeoutErrorImpl as any;

View File

@@ -0,0 +1 @@
module.exports={A:{A:{"2":"J E F G A B BC"},B:{"2":"C K L H M N O","194":"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:{"1":"0 1 2 3 4 5 6 7 8 9 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","2":"CC"},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","194":"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"},E:{"1":"NC","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"},F:{"2":"0 1 2 3 4 5 G B C H M N O v w x y z OC PC QC RC qB 9B SC rB","194":"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"},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:{"2":"A B C e qB 9B rB"},L:{"2":"D"},M:{"1":"D"},N:{"2":"A B"},O:{"2":"uC"},P:{"2":"I vC wC xC yC zC 0B 0C 1C 2C 3C 4C sB 5C 6C 7C"},Q:{"194":"1B"},R:{"2":"8C"},S:{"2":"9C"}},B:2,C:"CSS font-size-adjust"};