From d4b459b5e93e4a94a136d2e815476c35a0309566 Mon Sep 17 00:00:00 2001 From: DCtheTall Date: Tue, 8 Sep 2020 10:40:00 -0400 Subject: [PATCH 01/16] feat(ajax.ts): send XSRF cookies in a custom header --- src/internal/ajax/ajax.ts | 15 +++++++++++++++ src/internal/ajax/types.ts | 10 ++++++++++ 2 files changed, 25 insertions(+) diff --git a/src/internal/ajax/ajax.ts b/src/internal/ajax/ajax.ts index 7f32bf38e9..ebb72a4f45 100644 --- a/src/internal/ajax/ajax.ts +++ b/src/internal/ajax/ajax.ts @@ -295,6 +295,21 @@ export function fromAjax(config: AjaxConfig): Observable> { headers['x-requested-with'] = 'XMLHttpRequest'; } + // Allow users to provide their XSRF cookie name and the name of a custom header to use to + // send the cookie. This + if (config.withCredentials && config.xsrfCookieName && config.xsrfHeaderName) { + try { + const match = document.cookie.match(new RegExp(`(^|;\\s*)(${name})=([^;]*)`)); + if (match) { + headers[config.xsrfHeaderName] = match[3]; + } + } catch (err) { + if (err instanceof ReferenceError && err.message.includes('document')) { + throw new TypeError('xsrfCookieName and xsrfHeaderName used in non-browser environment'); + } + } + } + // Examine the body and determine whether or not to serialize it // and set the content-type in `headers`, if we're able. let body: any; diff --git a/src/internal/ajax/types.ts b/src/internal/ajax/types.ts index bbdbba1c5b..401df44420 100644 --- a/src/internal/ajax/types.ts +++ b/src/internal/ajax/types.ts @@ -133,6 +133,16 @@ export interface AjaxConfig { */ withCredentials?: boolean; + /** + * The name of your site's XSRF cookie. + */ + xsrfCookieName?: string; + + /** + * The name of a custom header that you can use to send your XSRF cookie. + */ + xsrfHeaderName?: string; + /** * Can be set to change the response type. * Valid values are `"arraybuffer"`, `"blob"`, `"document"`, `"json"`, and `"text"`. From 78015a0ac376299611dc34edbf7927fd6beda0c3 Mon Sep 17 00:00:00 2001 From: DCtheTall Date: Tue, 8 Sep 2020 10:53:57 -0400 Subject: [PATCH 02/16] feat(ajax.ts): update API guardian --- api_guard/dist/types/ajax/index.d.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/api_guard/dist/types/ajax/index.d.ts b/api_guard/dist/types/ajax/index.d.ts index 76a2ed7caa..6bb7e1a02b 100644 --- a/api_guard/dist/types/ajax/index.d.ts +++ b/api_guard/dist/types/ajax/index.d.ts @@ -14,6 +14,8 @@ export interface AjaxConfig { url: string; user?: string; withCredentials?: boolean; + xsrfCookieName?: string; + xsrfHeaderName?: string; } export interface AjaxError extends Error { From e8fb435f80849087e7109b8256dcfc9a05d60b5e Mon Sep 17 00:00:00 2001 From: DCtheTall Date: Wed, 9 Sep 2020 14:10:39 -0400 Subject: [PATCH 03/16] feat(ajax.ts): review comments --- src/internal/ajax/ajax.ts | 35 +++++++++++++++++++++++++---------- 1 file changed, 25 insertions(+), 10 deletions(-) diff --git a/src/internal/ajax/ajax.ts b/src/internal/ajax/ajax.ts index ebb72a4f45..af2d82ac35 100644 --- a/src/internal/ajax/ajax.ts +++ b/src/internal/ajax/ajax.ts @@ -4,6 +4,7 @@ import { Observable } from '../Observable'; import { AjaxConfig, AjaxRequest } from './types'; import { AjaxResponse } from './AjaxResponse'; import { AjaxTimeoutError, AjaxError } from './errors'; +import { read } from 'fs'; export interface AjaxCreationMethod { /** @@ -297,16 +298,10 @@ export function fromAjax(config: AjaxConfig): Observable> { // Allow users to provide their XSRF cookie name and the name of a custom header to use to // send the cookie. This - if (config.withCredentials && config.xsrfCookieName && config.xsrfHeaderName) { - try { - const match = document.cookie.match(new RegExp(`(^|;\\s*)(${name})=([^;]*)`)); - if (match) { - headers[config.xsrfHeaderName] = match[3]; - } - } catch (err) { - if (err instanceof ReferenceError && err.message.includes('document')) { - throw new TypeError('xsrfCookieName and xsrfHeaderName used in non-browser environment'); - } + if ((config.withCredentials || isSameOrigin(config.url)) && config.xsrfCookieName && config.xsrfHeaderName) { + const xsrfCookie = readCookie(config.xsrfCookieName); + if (xsrfCookie) { + headers[config.xsrfHeaderName] = xsrfCookie; } } @@ -522,3 +517,23 @@ function isURLSearchParams(body: any): body is URLSearchParams { function isReadableStream(body: any): body is ReadableStream { return typeof ReadableStream !== 'undefined' && body instanceof ReadableStream; } + +function isSameOrigin(url: string): boolean { + try { + return new URL(url).origin === new URL(document.location.href).origin; + } catch (err) { + // Indicates this is a non-standard browsing env. + if (err instanceof ReferenceError && err.message.includes('document')) { return false; } + throw err; + } +} + +function readCookie(name: string): string { + try { + return document.cookie.match(new RegExp(`(^|;\\s*)(${name})=([^;]*)`))?.pop() ?? ''; + } catch (err) { + // Indicates this is a non-standard browsing env. + if (err instanceof ReferenceError && err.message.includes('document')) { return ''; } + throw err; + } +} From fbf10d830f7acaca0ed3ca370870991a69a701e3 Mon Sep 17 00:00:00 2001 From: DCtheTall Date: Wed, 9 Sep 2020 14:40:40 -0400 Subject: [PATCH 04/16] feat(ajax.ts): fix tests --- src/internal/ajax/ajax.ts | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/src/internal/ajax/ajax.ts b/src/internal/ajax/ajax.ts index af2d82ac35..7c93e6ba1c 100644 --- a/src/internal/ajax/ajax.ts +++ b/src/internal/ajax/ajax.ts @@ -297,11 +297,12 @@ export function fromAjax(config: AjaxConfig): Observable> { } // Allow users to provide their XSRF cookie name and the name of a custom header to use to - // send the cookie. This - if ((config.withCredentials || isSameOrigin(config.url)) && config.xsrfCookieName && config.xsrfHeaderName) { - const xsrfCookie = readCookie(config.xsrfCookieName); + // send the cookie. + const { url, withCredentials, xsrfCookieName, xsrfHeaderName } = config; + if ((withCredentials || isSameOrigin(url)) && xsrfCookieName && xsrfHeaderName) { + const xsrfCookie = readCookie(xsrfCookieName); if (xsrfCookie) { - headers[config.xsrfHeaderName] = xsrfCookie; + headers[xsrfHeaderName] = xsrfCookie; } } @@ -518,12 +519,22 @@ function isReadableStream(body: any): body is ReadableStream { return typeof ReadableStream !== 'undefined' && body instanceof ReadableStream; } +function isDocumentNotDefinedError(err: Error): boolean { + return err instanceof ReferenceError && err.message.includes('document'); +} + +function isInvalidURLError(err: Error): boolean { + return err instanceof TypeError && err.message.includes('Invalid URL'); +} + function isSameOrigin(url: string): boolean { try { return new URL(url).origin === new URL(document.location.href).origin; } catch (err) { // Indicates this is a non-standard browsing env. - if (err instanceof ReferenceError && err.message.includes('document')) { return false; } + if (isDocumentNotDefinedError(err) || isInvalidURLError(err)) { + return false; + } throw err; } } @@ -533,7 +544,9 @@ function readCookie(name: string): string { return document.cookie.match(new RegExp(`(^|;\\s*)(${name})=([^;]*)`))?.pop() ?? ''; } catch (err) { // Indicates this is a non-standard browsing env. - if (err instanceof ReferenceError && err.message.includes('document')) { return ''; } + if (isDocumentNotDefinedError(err)) { + return ''; + } throw err; } } From 4d2b8ea88afbc5076839d8ac0a351488d54bdd88 Mon Sep 17 00:00:00 2001 From: DCtheTall Date: Wed, 9 Sep 2020 14:55:48 -0400 Subject: [PATCH 05/16] feat(ajax.ts): better isSameOrigin(). --- src/internal/ajax/ajax.ts | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/internal/ajax/ajax.ts b/src/internal/ajax/ajax.ts index 7c93e6ba1c..bbf2b09be1 100644 --- a/src/internal/ajax/ajax.ts +++ b/src/internal/ajax/ajax.ts @@ -523,16 +523,12 @@ function isDocumentNotDefinedError(err: Error): boolean { return err instanceof ReferenceError && err.message.includes('document'); } -function isInvalidURLError(err: Error): boolean { - return err instanceof TypeError && err.message.includes('Invalid URL'); -} - function isSameOrigin(url: string): boolean { try { - return new URL(url).origin === new URL(document.location.href).origin; + return new URL(url, document.location.href).origin === new URL(document.location.href).origin; } catch (err) { // Indicates this is a non-standard browsing env. - if (isDocumentNotDefinedError(err) || isInvalidURLError(err)) { + if (isDocumentNotDefinedError(err)) { return false; } throw err; From 8ee797e0a20fc75730727ad472b056974fb72861 Mon Sep 17 00:00:00 2001 From: DCtheTall Date: Wed, 9 Sep 2020 15:21:47 -0400 Subject: [PATCH 06/16] feat(ajax.ts): use globalThis --- src/internal/ajax/ajax.ts | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-) diff --git a/src/internal/ajax/ajax.ts b/src/internal/ajax/ajax.ts index bbf2b09be1..2c4ba9af69 100644 --- a/src/internal/ajax/ajax.ts +++ b/src/internal/ajax/ajax.ts @@ -525,24 +525,13 @@ function isDocumentNotDefinedError(err: Error): boolean { function isSameOrigin(url: string): boolean { try { - return new URL(url, document.location.href).origin === new URL(document.location.href).origin; + return new URL(url, globalThis?.document.location.href).origin === new URL(globalThis?.document.location.href).origin; } catch (err) { - // Indicates this is a non-standard browsing env. - if (isDocumentNotDefinedError(err)) { - return false; - } - throw err; + // Invalid URL... + return false; } } function readCookie(name: string): string { - try { - return document.cookie.match(new RegExp(`(^|;\\s*)(${name})=([^;]*)`))?.pop() ?? ''; - } catch (err) { - // Indicates this is a non-standard browsing env. - if (isDocumentNotDefinedError(err)) { - return ''; - } - throw err; - } + return globalThis?.document.cookie.match(new RegExp(`(^|;\\s*)(${name})=([^;]*)`))?.pop() ?? ''; } From cc9dc3835f9bb2c86a7316c1a5c73af6d4f8b323 Mon Sep 17 00:00:00 2001 From: DCtheTall Date: Wed, 9 Sep 2020 15:33:41 -0400 Subject: [PATCH 07/16] feat(ajax.ts): rm unused fn --- src/internal/ajax/ajax.ts | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/internal/ajax/ajax.ts b/src/internal/ajax/ajax.ts index 2c4ba9af69..3762e03b73 100644 --- a/src/internal/ajax/ajax.ts +++ b/src/internal/ajax/ajax.ts @@ -519,10 +519,6 @@ function isReadableStream(body: any): body is ReadableStream { return typeof ReadableStream !== 'undefined' && body instanceof ReadableStream; } -function isDocumentNotDefinedError(err: Error): boolean { - return err instanceof ReferenceError && err.message.includes('document'); -} - function isSameOrigin(url: string): boolean { try { return new URL(url, globalThis?.document.location.href).origin === new URL(globalThis?.document.location.href).origin; From 22165289df06a76bbf76fdb3438c141529e17075 Mon Sep 17 00:00:00 2001 From: DCtheTall Date: Thu, 10 Sep 2020 10:33:43 -0400 Subject: [PATCH 08/16] feat(ajax.ts): add tests and use config.crossDomain --- spec/observables/dom/ajax-spec.ts | 100 ++++++++++++++++++++++++++++++ src/internal/ajax/ajax.ts | 15 +---- 2 files changed, 103 insertions(+), 12 deletions(-) diff --git a/spec/observables/dom/ajax-spec.ts b/spec/observables/dom/ajax-spec.ts index a8e9a8414f..30ed361dac 100644 --- a/spec/observables/dom/ajax-spec.ts +++ b/spec/observables/dom/ajax-spec.ts @@ -113,6 +113,106 @@ describe('ajax', () => { }); }); + describe('ajax XSRF cookie in custom header', () => { + beforeEach(() => { + globalThis.document = { + cookie: 'foo=bar', + } as Document; + }); + + afterEach(() => { + delete (globalThis as {document?: Document}).document; + }); + + it('should send the cookie with a custom header to the same domain', () => { + const obj: AjaxConfig = { + url: '/some/path', + xsrfCookieName: 'foo', + xsrfHeaderName: 'Custom-Header-Name', + }; + + ajax(obj).subscribe(); + + const request = MockXMLHttpRequest.mostRecent; + + expect(request.url).to.equal('/some/path'); + expect(request.requestHeaders).to.deep.equal({ + 'Custom-Header-Name': 'bar', + 'x-requested-with': 'XMLHttpRequest', + }); + }); + + it('should send the cookie cross-domain with a custom header when withCredentials is set', () => { + const obj: AjaxConfig = { + url: 'https://some.subresouce.net/some/page', + xsrfCookieName: 'foo', + xsrfHeaderName: 'Custom-Header-Name', + crossDomain: true, + withCredentials: true, + }; + + ajax(obj).subscribe(); + + const request = MockXMLHttpRequest.mostRecent; + + expect(request.url).to.equal('https://some.subresouce.net/some/page'); + expect(request.requestHeaders).to.deep.equal({ + 'Custom-Header-Name': 'bar', + }); + }); + + it('should not send the cookie cross-domain with a custom header when withCredentials is not set', () => { + const obj: AjaxConfig = { + url: 'https://some.subresouce.net/some/page', + xsrfCookieName: 'foo', + xsrfHeaderName: 'Custom-Header-Name', + crossDomain: true, + }; + + ajax(obj).subscribe(); + + const request = MockXMLHttpRequest.mostRecent; + + expect(request.url).to.equal('https://some.subresouce.net/some/page'); + expect(request.requestHeaders).to.deep.equal({}); + }); + + it('should not send the cookie if "document" is not defined', () => { + delete (globalThis as {document?: Document}).document; + + const obj: AjaxConfig = { + url: '/some/path', + xsrfCookieName: 'foo', + xsrfHeaderName: 'Custom-Header-Name', + }; + + ajax(obj).subscribe(); + + const request = MockXMLHttpRequest.mostRecent; + + expect(request.url).to.equal('/some/path'); + expect(request.requestHeaders).to.deep.equal({ + 'x-requested-with': 'XMLHttpRequest', + }); + }); + + it('should not send the cookie if there is no xsrfHeaderName option', () => { + const obj: AjaxConfig = { + url: '/some/page', + xsrfCookieName: 'foo', + }; + + ajax(obj).subscribe(); + + const request = MockXMLHttpRequest.mostRecent; + + expect(request.url).to.equal('/some/page'); + expect(request.requestHeaders).to.deep.equal({ + 'x-requested-with': 'XMLHttpRequest', + }); + }); + }); + it('should set the X-Requested-With if crossDomain is false', () => { ajax({ url: '/test/monkey', diff --git a/src/internal/ajax/ajax.ts b/src/internal/ajax/ajax.ts index 3762e03b73..2396191a70 100644 --- a/src/internal/ajax/ajax.ts +++ b/src/internal/ajax/ajax.ts @@ -298,8 +298,8 @@ export function fromAjax(config: AjaxConfig): Observable> { // Allow users to provide their XSRF cookie name and the name of a custom header to use to // send the cookie. - const { url, withCredentials, xsrfCookieName, xsrfHeaderName } = config; - if ((withCredentials || isSameOrigin(url)) && xsrfCookieName && xsrfHeaderName) { + const { withCredentials, xsrfCookieName, xsrfHeaderName } = config; + if ((withCredentials || !config.crossDomain) && xsrfCookieName && xsrfHeaderName) { const xsrfCookie = readCookie(xsrfCookieName); if (xsrfCookie) { headers[xsrfHeaderName] = xsrfCookie; @@ -519,15 +519,6 @@ function isReadableStream(body: any): body is ReadableStream { return typeof ReadableStream !== 'undefined' && body instanceof ReadableStream; } -function isSameOrigin(url: string): boolean { - try { - return new URL(url, globalThis?.document.location.href).origin === new URL(globalThis?.document.location.href).origin; - } catch (err) { - // Invalid URL... - return false; - } -} - function readCookie(name: string): string { - return globalThis?.document.cookie.match(new RegExp(`(^|;\\s*)(${name})=([^;]*)`))?.pop() ?? ''; + return globalThis.document?.cookie.match(new RegExp(`(^|;\\s*)(${name})=([^;]*)`))?.pop() ?? ''; } From 040fd8d89509b1f63ecd3ca6e59351fd4d3bdd06 Mon Sep 17 00:00:00 2001 From: DCtheTall Date: Thu, 10 Sep 2020 10:44:43 -0400 Subject: [PATCH 09/16] feat(ajax.ts): fix in Node 11 --- src/internal/ajax/ajax.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/internal/ajax/ajax.ts b/src/internal/ajax/ajax.ts index 2396191a70..6bffe6b7cf 100644 --- a/src/internal/ajax/ajax.ts +++ b/src/internal/ajax/ajax.ts @@ -520,5 +520,10 @@ function isReadableStream(body: any): body is ReadableStream { } function readCookie(name: string): string { - return globalThis.document?.cookie.match(new RegExp(`(^|;\\s*)(${name})=([^;]*)`))?.pop() ?? ''; + try { + return globalThis.document?.cookie.match(new RegExp(`(^|;\\s*)(${name})=([^;]*)`))?.pop() ?? ''; + } catch (err) { + if (err instanceof ReferenceError) { return ''; } + throw err; + } } From a4817aee26da54f4629397a0f93c9e055b241724 Mon Sep 17 00:00:00 2001 From: DCtheTall Date: Thu, 10 Sep 2020 10:46:44 -0400 Subject: [PATCH 10/16] feat(ajax.ts): rm globalThis --- src/internal/ajax/ajax.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/internal/ajax/ajax.ts b/src/internal/ajax/ajax.ts index 6bffe6b7cf..a9c37e03b1 100644 --- a/src/internal/ajax/ajax.ts +++ b/src/internal/ajax/ajax.ts @@ -521,9 +521,11 @@ function isReadableStream(body: any): body is ReadableStream { function readCookie(name: string): string { try { - return globalThis.document?.cookie.match(new RegExp(`(^|;\\s*)(${name})=([^;]*)`))?.pop() ?? ''; + return document?.cookie.match(new RegExp(`(^|;\\s*)(${name})=([^;]*)`))?.pop() ?? ''; } catch (err) { - if (err instanceof ReferenceError) { return ''; } + if (err instanceof ReferenceError) { + return ''; + } throw err; } } From 7acc2e62e8b3c3ce37fc7aa56f2b19b4515ef3bd Mon Sep 17 00:00:00 2001 From: DCtheTall Date: Thu, 10 Sep 2020 10:51:31 -0400 Subject: [PATCH 11/16] feat(ajax.ts): fix globalThis in tests --- spec/observables/dom/ajax-spec.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/spec/observables/dom/ajax-spec.ts b/spec/observables/dom/ajax-spec.ts index 30ed361dac..ada9ef2703 100644 --- a/spec/observables/dom/ajax-spec.ts +++ b/spec/observables/dom/ajax-spec.ts @@ -115,13 +115,13 @@ describe('ajax', () => { describe('ajax XSRF cookie in custom header', () => { beforeEach(() => { - globalThis.document = { + (global as any).document = { cookie: 'foo=bar', } as Document; }); afterEach(() => { - delete (globalThis as {document?: Document}).document; + delete (global as any).document; }); it('should send the cookie with a custom header to the same domain', () => { @@ -178,7 +178,7 @@ describe('ajax', () => { }); it('should not send the cookie if "document" is not defined', () => { - delete (globalThis as {document?: Document}).document; + delete (global as any).document; const obj: AjaxConfig = { url: '/some/path', From 24c10971972e1681a3b6f5b8bdf66e997ff44ff4 Mon Sep 17 00:00:00 2001 From: DCtheTall Date: Sun, 13 Sep 2020 11:26:27 -0400 Subject: [PATCH 12/16] feat(ajax.ts): rm incorrect import --- src/internal/ajax/ajax.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/src/internal/ajax/ajax.ts b/src/internal/ajax/ajax.ts index a9c37e03b1..c03510606f 100644 --- a/src/internal/ajax/ajax.ts +++ b/src/internal/ajax/ajax.ts @@ -4,7 +4,6 @@ import { Observable } from '../Observable'; import { AjaxConfig, AjaxRequest } from './types'; import { AjaxResponse } from './AjaxResponse'; import { AjaxTimeoutError, AjaxError } from './errors'; -import { read } from 'fs'; export interface AjaxCreationMethod { /** From 8c56f55e282c110832f2703dffeb72c8b404ff33 Mon Sep 17 00:00:00 2001 From: DCtheTall Date: Mon, 14 Sep 2020 09:17:56 -0400 Subject: [PATCH 13/16] feat(ajax.ts): update api_guardian --- api_guard/dist/types/operators/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/api_guard/dist/types/operators/index.d.ts b/api_guard/dist/types/operators/index.d.ts index ff43e7dbf5..8735f19592 100644 --- a/api_guard/dist/types/operators/index.d.ts +++ b/api_guard/dist/types/operators/index.d.ts @@ -306,7 +306,7 @@ export declare function tap(observer: PartialObserver): MonoTypeOperatorFu export declare function throttle(durationSelector: (value: T) => SubscribableOrPromise, config?: ThrottleConfig): MonoTypeOperatorFunction; -export declare function throttleTime(duration: number, scheduler?: SchedulerLike, config?: ThrottleConfig): MonoTypeOperatorFunction; +export declare function throttleTime(duration: number, scheduler?: SchedulerLike, { leading, trailing }?: ThrottleConfig): MonoTypeOperatorFunction; export declare function throwIfEmpty(errorFactory?: (() => any)): MonoTypeOperatorFunction; From 69c77deadbac4bf2a868783cb9ea5126fadbed1c Mon Sep 17 00:00:00 2001 From: DCtheTall Date: Sun, 20 Sep 2020 17:12:53 -0400 Subject: [PATCH 14/16] feat(ajax.ts): delete readCookie --- spec/observables/dom/ajax-spec.ts | 19 ------------------- src/internal/ajax/ajax.ts | 13 +------------ 2 files changed, 1 insertion(+), 31 deletions(-) diff --git a/spec/observables/dom/ajax-spec.ts b/spec/observables/dom/ajax-spec.ts index ada9ef2703..a8345ee98d 100644 --- a/spec/observables/dom/ajax-spec.ts +++ b/spec/observables/dom/ajax-spec.ts @@ -177,25 +177,6 @@ describe('ajax', () => { expect(request.requestHeaders).to.deep.equal({}); }); - it('should not send the cookie if "document" is not defined', () => { - delete (global as any).document; - - const obj: AjaxConfig = { - url: '/some/path', - xsrfCookieName: 'foo', - xsrfHeaderName: 'Custom-Header-Name', - }; - - ajax(obj).subscribe(); - - const request = MockXMLHttpRequest.mostRecent; - - expect(request.url).to.equal('/some/path'); - expect(request.requestHeaders).to.deep.equal({ - 'x-requested-with': 'XMLHttpRequest', - }); - }); - it('should not send the cookie if there is no xsrfHeaderName option', () => { const obj: AjaxConfig = { url: '/some/page', diff --git a/src/internal/ajax/ajax.ts b/src/internal/ajax/ajax.ts index c03510606f..b703af04e7 100644 --- a/src/internal/ajax/ajax.ts +++ b/src/internal/ajax/ajax.ts @@ -299,7 +299,7 @@ export function fromAjax(config: AjaxConfig): Observable> { // send the cookie. const { withCredentials, xsrfCookieName, xsrfHeaderName } = config; if ((withCredentials || !config.crossDomain) && xsrfCookieName && xsrfHeaderName) { - const xsrfCookie = readCookie(xsrfCookieName); + const xsrfCookie = document?.cookie.match(new RegExp(`(^|;\\s*)(${xsrfCookieName})=([^;]*)`))?.pop() ?? ''; if (xsrfCookie) { headers[xsrfHeaderName] = xsrfCookie; } @@ -517,14 +517,3 @@ function isURLSearchParams(body: any): body is URLSearchParams { function isReadableStream(body: any): body is ReadableStream { return typeof ReadableStream !== 'undefined' && body instanceof ReadableStream; } - -function readCookie(name: string): string { - try { - return document?.cookie.match(new RegExp(`(^|;\\s*)(${name})=([^;]*)`))?.pop() ?? ''; - } catch (err) { - if (err instanceof ReferenceError) { - return ''; - } - throw err; - } -} From 14d5dde27e3543c474e544848cfb141946bcb5e9 Mon Sep 17 00:00:00 2001 From: DCtheTall Date: Fri, 25 Sep 2020 09:54:38 -0400 Subject: [PATCH 15/16] feat(ajax.ts): update api_guard --- .eslintcache | 1 + api_guard/dist/types/index.d.ts | 46 +++++++++++------------ api_guard/dist/types/operators/index.d.ts | 20 +++++----- 3 files changed, 34 insertions(+), 33 deletions(-) create mode 100644 .eslintcache diff --git a/.eslintcache b/.eslintcache new file mode 100644 index 0000000000..414de17ff9 --- /dev/null +++ b/.eslintcache @@ -0,0 +1 @@ +[{"/Users/dylancutler/Desktop/rxjs/docs_app/tools/transforms/angular-content-package/index.js":"1","/Users/dylancutler/Desktop/rxjs/wallaby.js":"2"},{"size":2715,"mtime":1601041889135},{"size":1353,"mtime":1601041889193,"results":"3","hashOfConfig":"4"},{"filePath":"5","messages":"6","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"2drjnf","/Users/dylancutler/Desktop/rxjs/wallaby.js",[]] \ No newline at end of file diff --git a/api_guard/dist/types/index.d.ts b/api_guard/dist/types/index.d.ts index 45c154eb28..fcc54fcd84 100644 --- a/api_guard/dist/types/index.d.ts +++ b/api_guard/dist/types/index.d.ts @@ -21,15 +21,16 @@ export declare const async: AsyncScheduler; export declare const asyncScheduler: AsyncScheduler; export declare class AsyncSubject extends Subject { - protected _checkFinalizedStatuses(subscriber: Subscriber): void; + _subscribe(subscriber: Subscriber): Subscription; complete(): void; + error(error: any): void; next(value: T): void; } export declare class BehaviorSubject extends Subject { get value(): T; constructor(_value: T); - protected _subscribe(subscriber: Subscriber): Subscription; + _subscribe(subscriber: Subscriber): Subscription; getValue(): T; next(value: T): void; } @@ -189,20 +190,21 @@ export declare function concat[]>(...observables: export declare const config: { onUnhandledError: ((err: any) => void) | null; + quietBadConfig: boolean; Promise: PromiseConstructorLike; useDeprecatedSynchronousErrorHandling: boolean; useDeprecatedNextContext: boolean; }; export declare class ConnectableObservable extends Observable { - protected _connection: Subscription | null; + protected _connection: Subscription | null | undefined; + _isComplete: boolean; protected _refCount: number; - protected _subject: Subject | null; + protected _subject: Subject | undefined; source: Observable; protected subjectFactory: () => Subject; constructor(source: Observable, subjectFactory: () => Subject); - protected _subscribe(subscriber: Subscriber): Subscription; - protected _teardown(): void; + _subscribe(subscriber: Subscriber): Subscription; connect(): Subscription; protected getSubject(): Subject; refCount(): Observable; @@ -273,8 +275,10 @@ export declare function generate(initialState: S, condition: ConditionFunc export declare function generate(options: GenerateBaseOptions): Observable; export declare function generate(options: GenerateOptions): Observable; -export interface GroupedObservable extends Observable { - readonly key: K; +export declare class GroupedObservable extends Observable { + key: K; + constructor(key: K, groupSubject: Subject, refCountSubscription?: RefCountSubscription | undefined); + _subscribe(subscriber: Subscriber): Subscription; } export declare type Head = ((...args: X) => any) extends ((arg: infer U, ...rest: any[]) => any) ? U : never; @@ -306,17 +310,17 @@ export declare function merge(v1: ObservableInput, v2: Obs export declare function merge(v1: ObservableInput, v2: ObservableInput, v3: ObservableInput, v4: ObservableInput, v5: ObservableInput, v6: ObservableInput, scheduler: SchedulerLike): Observable; export declare function merge(v1: ObservableInput, v2: ObservableInput, v3: ObservableInput, v4: ObservableInput, v5: ObservableInput, v6: ObservableInput, concurrent: number, scheduler: SchedulerLike): Observable; export declare function merge(v1: ObservableInput): Observable; -export declare function merge(v1: ObservableInput, concurrent: number): Observable; +export declare function merge(v1: ObservableInput, concurrent?: number): Observable; export declare function merge(v1: ObservableInput, v2: ObservableInput): Observable; -export declare function merge(v1: ObservableInput, v2: ObservableInput, concurrent: number): Observable; +export declare function merge(v1: ObservableInput, v2: ObservableInput, concurrent?: number): Observable; export declare function merge(v1: ObservableInput, v2: ObservableInput, v3: ObservableInput): Observable; -export declare function merge(v1: ObservableInput, v2: ObservableInput, v3: ObservableInput, concurrent: number): Observable; +export declare function merge(v1: ObservableInput, v2: ObservableInput, v3: ObservableInput, concurrent?: number): Observable; export declare function merge(v1: ObservableInput, v2: ObservableInput, v3: ObservableInput, v4: ObservableInput): Observable; -export declare function merge(v1: ObservableInput, v2: ObservableInput, v3: ObservableInput, v4: ObservableInput, concurrent: number): Observable; +export declare function merge(v1: ObservableInput, v2: ObservableInput, v3: ObservableInput, v4: ObservableInput, concurrent?: number): Observable; export declare function merge(v1: ObservableInput, v2: ObservableInput, v3: ObservableInput, v4: ObservableInput, v5: ObservableInput): Observable; -export declare function merge(v1: ObservableInput, v2: ObservableInput, v3: ObservableInput, v4: ObservableInput, v5: ObservableInput, concurrent: number): Observable; +export declare function merge(v1: ObservableInput, v2: ObservableInput, v3: ObservableInput, v4: ObservableInput, v5: ObservableInput, concurrent?: number): Observable; export declare function merge(v1: ObservableInput, v2: ObservableInput, v3: ObservableInput, v4: ObservableInput, v5: ObservableInput, v6: ObservableInput): Observable; -export declare function merge(v1: ObservableInput, v2: ObservableInput, v3: ObservableInput, v4: ObservableInput, v5: ObservableInput, v6: ObservableInput, concurrent: number): Observable; +export declare function merge(v1: ObservableInput, v2: ObservableInput, v3: ObservableInput, v4: ObservableInput, v5: ObservableInput, v6: ObservableInput, concurrent?: number): Observable; export declare function merge(...observables: (ObservableInput | number)[]): Observable; export declare function merge(...observables: (ObservableInput | SchedulerLike | number)[]): Observable; export declare function merge(...observables: (ObservableInput | number)[]): Observable; @@ -494,8 +498,7 @@ export declare function range(start?: number, count?: number, scheduler?: Schedu export declare class ReplaySubject extends Subject { constructor(bufferSize?: number, windowTime?: number, timestampProvider?: TimestampProvider); - protected _subscribe(subscriber: Subscriber): Subscription; - next(value: T): void; + _subscribe(subscriber: Subscriber): Subscription; } export declare function scheduled(input: ObservableInput, scheduler: SchedulerLike): Observable; @@ -527,11 +530,8 @@ export declare class Subject extends Observable implements SubscriptionLik observers: Observer[]; thrownError: any; constructor(); - protected _checkFinalizedStatuses(subscriber: Subscriber): void; - protected _innerSubscribe(subscriber: Subscriber): Subscription; - protected _subscribe(subscriber: Subscriber): Subscription; - protected _throwIfClosed(): void; - protected _trySubscribe(subscriber: Subscriber): TeardownLogic; + _subscribe(subscriber: Subscriber): Subscription; + _trySubscribe(subscriber: Subscriber): TeardownLogic; asObservable(): Observable; complete(): void; error(err: any): void; @@ -552,9 +552,9 @@ export interface Subscribable { export declare type SubscribableOrPromise = Subscribable | Subscribable | PromiseLike | InteropObservable; export declare class Subscriber extends Subscription implements Observer { - protected destination: Subscriber | Observer; + protected destination: Observer | Subscriber; protected isStopped: boolean; - constructor(destination?: Subscriber | Observer); + constructor(destinationOrNext?: PartialObserver | ((value: T) => void) | null, error?: ((e?: any) => void) | null, complete?: (() => void) | null); protected _complete(): void; protected _error(err: any): void; protected _next(value: T): void; diff --git a/api_guard/dist/types/operators/index.d.ts b/api_guard/dist/types/operators/index.d.ts index c757d024a4..8735f19592 100644 --- a/api_guard/dist/types/operators/index.d.ts +++ b/api_guard/dist/types/operators/index.d.ts @@ -12,7 +12,7 @@ export declare function bufferTime(bufferTimeSpan: number, bufferCreationInte export declare function bufferToggle(openings: SubscribableOrPromise, closingSelector: (value: O) => SubscribableOrPromise): OperatorFunction; -export declare function bufferWhen(closingSelector: () => ObservableInput): OperatorFunction; +export declare function bufferWhen(closingSelector: () => Observable): OperatorFunction; export declare function catchError>(selector: (err: any, caught: Observable) => O): OperatorFunction>; @@ -180,7 +180,7 @@ export declare function mergeMapTo>(innerOb export declare function mergeScan(accumulator: (acc: R, value: T, index: number) => ObservableInput, seed: R, concurrent?: number): OperatorFunction; export declare function mergeWith(): OperatorFunction; -export declare function mergeWith[]>(...otherSources: A): OperatorFunction>; +export declare function mergeWith[]>(...otherSources: A): OperatorFunction)>; export declare function min(comparer?: (x: T, y: T) => number): MonoTypeOperatorFunction; @@ -260,7 +260,7 @@ export declare function single(predicate?: (value: T, index: number, source: export declare function skip(count: number): MonoTypeOperatorFunction; -export declare function skipLast(skipCount: number): MonoTypeOperatorFunction; +export declare function skipLast(count: number): MonoTypeOperatorFunction; export declare function skipUntil(notifier: Observable): MonoTypeOperatorFunction; @@ -292,7 +292,7 @@ export declare function take(count: number): MonoTypeOperatorFunction; export declare function takeLast(count: number): MonoTypeOperatorFunction; -export declare function takeUntil(notifier: ObservableInput): MonoTypeOperatorFunction; +export declare function takeUntil(notifier: Observable): MonoTypeOperatorFunction; export declare function takeWhile(predicate: (value: T, index: number) => value is S): OperatorFunction; export declare function takeWhile(predicate: (value: T, index: number) => value is S, inclusive: false): OperatorFunction; @@ -304,11 +304,11 @@ export declare function tap(next: (value: T) => void, error: null | undefined export declare function tap(next?: (x: T) => void, error?: (e: any) => void, complete?: () => void): MonoTypeOperatorFunction; export declare function tap(observer: PartialObserver): MonoTypeOperatorFunction; -export declare function throttle(durationSelector: (value: T) => SubscribableOrPromise, { leading, trailing }?: ThrottleConfig): MonoTypeOperatorFunction; +export declare function throttle(durationSelector: (value: T) => SubscribableOrPromise, config?: ThrottleConfig): MonoTypeOperatorFunction; -export declare function throttleTime(duration: number, scheduler?: SchedulerLike, config?: import("./throttle").ThrottleConfig): MonoTypeOperatorFunction; +export declare function throttleTime(duration: number, scheduler?: SchedulerLike, { leading, trailing }?: ThrottleConfig): MonoTypeOperatorFunction; -export declare function throwIfEmpty(errorFactory?: () => any): MonoTypeOperatorFunction; +export declare function throwIfEmpty(errorFactory?: (() => any)): MonoTypeOperatorFunction; export declare function timeInterval(scheduler?: SchedulerLike): OperatorFunction>; @@ -332,11 +332,11 @@ export declare function windowCount(windowSize: number, startWindowEvery?: nu export declare function windowTime(windowTimeSpan: number, scheduler?: SchedulerLike): OperatorFunction>; export declare function windowTime(windowTimeSpan: number, windowCreationInterval: number, scheduler?: SchedulerLike): OperatorFunction>; -export declare function windowTime(windowTimeSpan: number, windowCreationInterval: number | null | void, maxWindowSize: number, scheduler?: SchedulerLike): OperatorFunction>; +export declare function windowTime(windowTimeSpan: number, windowCreationInterval: number, maxWindowSize: number, scheduler?: SchedulerLike): OperatorFunction>; -export declare function windowToggle(openings: ObservableInput, closingSelector: (openValue: O) => ObservableInput): OperatorFunction>; +export declare function windowToggle(openings: Observable, closingSelector: (openValue: O) => Observable): OperatorFunction>; -export declare function windowWhen(closingSelector: () => ObservableInput): OperatorFunction>; +export declare function windowWhen(closingSelector: () => Observable): OperatorFunction>; export declare function withLatestFrom(project: (v1: T) => R): OperatorFunction; export declare function withLatestFrom, R>(source2: O2, project: (v1: T, v2: ObservedValueOf) => R): OperatorFunction; From 0221de1fd0ad6e9dfb627b402783403cf3dee227 Mon Sep 17 00:00:00 2001 From: DCtheTall Date: Fri, 25 Sep 2020 10:02:37 -0400 Subject: [PATCH 16/16] feat(ajax.ts): checkout master on unrelated files --- .eslintcache | 1 - api_guard/dist/types/index.d.ts | 46 +++++++++++------------ api_guard/dist/types/operators/index.d.ts | 20 +++++----- 3 files changed, 33 insertions(+), 34 deletions(-) delete mode 100644 .eslintcache diff --git a/.eslintcache b/.eslintcache deleted file mode 100644 index 414de17ff9..0000000000 --- a/.eslintcache +++ /dev/null @@ -1 +0,0 @@ -[{"/Users/dylancutler/Desktop/rxjs/docs_app/tools/transforms/angular-content-package/index.js":"1","/Users/dylancutler/Desktop/rxjs/wallaby.js":"2"},{"size":2715,"mtime":1601041889135},{"size":1353,"mtime":1601041889193,"results":"3","hashOfConfig":"4"},{"filePath":"5","messages":"6","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"2drjnf","/Users/dylancutler/Desktop/rxjs/wallaby.js",[]] \ No newline at end of file diff --git a/api_guard/dist/types/index.d.ts b/api_guard/dist/types/index.d.ts index fcc54fcd84..45c154eb28 100644 --- a/api_guard/dist/types/index.d.ts +++ b/api_guard/dist/types/index.d.ts @@ -21,16 +21,15 @@ export declare const async: AsyncScheduler; export declare const asyncScheduler: AsyncScheduler; export declare class AsyncSubject extends Subject { - _subscribe(subscriber: Subscriber): Subscription; + protected _checkFinalizedStatuses(subscriber: Subscriber): void; complete(): void; - error(error: any): void; next(value: T): void; } export declare class BehaviorSubject extends Subject { get value(): T; constructor(_value: T); - _subscribe(subscriber: Subscriber): Subscription; + protected _subscribe(subscriber: Subscriber): Subscription; getValue(): T; next(value: T): void; } @@ -190,21 +189,20 @@ export declare function concat[]>(...observables: export declare const config: { onUnhandledError: ((err: any) => void) | null; - quietBadConfig: boolean; Promise: PromiseConstructorLike; useDeprecatedSynchronousErrorHandling: boolean; useDeprecatedNextContext: boolean; }; export declare class ConnectableObservable extends Observable { - protected _connection: Subscription | null | undefined; - _isComplete: boolean; + protected _connection: Subscription | null; protected _refCount: number; - protected _subject: Subject | undefined; + protected _subject: Subject | null; source: Observable; protected subjectFactory: () => Subject; constructor(source: Observable, subjectFactory: () => Subject); - _subscribe(subscriber: Subscriber): Subscription; + protected _subscribe(subscriber: Subscriber): Subscription; + protected _teardown(): void; connect(): Subscription; protected getSubject(): Subject; refCount(): Observable; @@ -275,10 +273,8 @@ export declare function generate(initialState: S, condition: ConditionFunc export declare function generate(options: GenerateBaseOptions): Observable; export declare function generate(options: GenerateOptions): Observable; -export declare class GroupedObservable extends Observable { - key: K; - constructor(key: K, groupSubject: Subject, refCountSubscription?: RefCountSubscription | undefined); - _subscribe(subscriber: Subscriber): Subscription; +export interface GroupedObservable extends Observable { + readonly key: K; } export declare type Head = ((...args: X) => any) extends ((arg: infer U, ...rest: any[]) => any) ? U : never; @@ -310,17 +306,17 @@ export declare function merge(v1: ObservableInput, v2: Obs export declare function merge(v1: ObservableInput, v2: ObservableInput, v3: ObservableInput, v4: ObservableInput, v5: ObservableInput, v6: ObservableInput, scheduler: SchedulerLike): Observable; export declare function merge(v1: ObservableInput, v2: ObservableInput, v3: ObservableInput, v4: ObservableInput, v5: ObservableInput, v6: ObservableInput, concurrent: number, scheduler: SchedulerLike): Observable; export declare function merge(v1: ObservableInput): Observable; -export declare function merge(v1: ObservableInput, concurrent?: number): Observable; +export declare function merge(v1: ObservableInput, concurrent: number): Observable; export declare function merge(v1: ObservableInput, v2: ObservableInput): Observable; -export declare function merge(v1: ObservableInput, v2: ObservableInput, concurrent?: number): Observable; +export declare function merge(v1: ObservableInput, v2: ObservableInput, concurrent: number): Observable; export declare function merge(v1: ObservableInput, v2: ObservableInput, v3: ObservableInput): Observable; -export declare function merge(v1: ObservableInput, v2: ObservableInput, v3: ObservableInput, concurrent?: number): Observable; +export declare function merge(v1: ObservableInput, v2: ObservableInput, v3: ObservableInput, concurrent: number): Observable; export declare function merge(v1: ObservableInput, v2: ObservableInput, v3: ObservableInput, v4: ObservableInput): Observable; -export declare function merge(v1: ObservableInput, v2: ObservableInput, v3: ObservableInput, v4: ObservableInput, concurrent?: number): Observable; +export declare function merge(v1: ObservableInput, v2: ObservableInput, v3: ObservableInput, v4: ObservableInput, concurrent: number): Observable; export declare function merge(v1: ObservableInput, v2: ObservableInput, v3: ObservableInput, v4: ObservableInput, v5: ObservableInput): Observable; -export declare function merge(v1: ObservableInput, v2: ObservableInput, v3: ObservableInput, v4: ObservableInput, v5: ObservableInput, concurrent?: number): Observable; +export declare function merge(v1: ObservableInput, v2: ObservableInput, v3: ObservableInput, v4: ObservableInput, v5: ObservableInput, concurrent: number): Observable; export declare function merge(v1: ObservableInput, v2: ObservableInput, v3: ObservableInput, v4: ObservableInput, v5: ObservableInput, v6: ObservableInput): Observable; -export declare function merge(v1: ObservableInput, v2: ObservableInput, v3: ObservableInput, v4: ObservableInput, v5: ObservableInput, v6: ObservableInput, concurrent?: number): Observable; +export declare function merge(v1: ObservableInput, v2: ObservableInput, v3: ObservableInput, v4: ObservableInput, v5: ObservableInput, v6: ObservableInput, concurrent: number): Observable; export declare function merge(...observables: (ObservableInput | number)[]): Observable; export declare function merge(...observables: (ObservableInput | SchedulerLike | number)[]): Observable; export declare function merge(...observables: (ObservableInput | number)[]): Observable; @@ -498,7 +494,8 @@ export declare function range(start?: number, count?: number, scheduler?: Schedu export declare class ReplaySubject extends Subject { constructor(bufferSize?: number, windowTime?: number, timestampProvider?: TimestampProvider); - _subscribe(subscriber: Subscriber): Subscription; + protected _subscribe(subscriber: Subscriber): Subscription; + next(value: T): void; } export declare function scheduled(input: ObservableInput, scheduler: SchedulerLike): Observable; @@ -530,8 +527,11 @@ export declare class Subject extends Observable implements SubscriptionLik observers: Observer[]; thrownError: any; constructor(); - _subscribe(subscriber: Subscriber): Subscription; - _trySubscribe(subscriber: Subscriber): TeardownLogic; + protected _checkFinalizedStatuses(subscriber: Subscriber): void; + protected _innerSubscribe(subscriber: Subscriber): Subscription; + protected _subscribe(subscriber: Subscriber): Subscription; + protected _throwIfClosed(): void; + protected _trySubscribe(subscriber: Subscriber): TeardownLogic; asObservable(): Observable; complete(): void; error(err: any): void; @@ -552,9 +552,9 @@ export interface Subscribable { export declare type SubscribableOrPromise = Subscribable | Subscribable | PromiseLike | InteropObservable; export declare class Subscriber extends Subscription implements Observer { - protected destination: Observer | Subscriber; + protected destination: Subscriber | Observer; protected isStopped: boolean; - constructor(destinationOrNext?: PartialObserver | ((value: T) => void) | null, error?: ((e?: any) => void) | null, complete?: (() => void) | null); + constructor(destination?: Subscriber | Observer); protected _complete(): void; protected _error(err: any): void; protected _next(value: T): void; diff --git a/api_guard/dist/types/operators/index.d.ts b/api_guard/dist/types/operators/index.d.ts index 8735f19592..c757d024a4 100644 --- a/api_guard/dist/types/operators/index.d.ts +++ b/api_guard/dist/types/operators/index.d.ts @@ -12,7 +12,7 @@ export declare function bufferTime(bufferTimeSpan: number, bufferCreationInte export declare function bufferToggle(openings: SubscribableOrPromise, closingSelector: (value: O) => SubscribableOrPromise): OperatorFunction; -export declare function bufferWhen(closingSelector: () => Observable): OperatorFunction; +export declare function bufferWhen(closingSelector: () => ObservableInput): OperatorFunction; export declare function catchError>(selector: (err: any, caught: Observable) => O): OperatorFunction>; @@ -180,7 +180,7 @@ export declare function mergeMapTo>(innerOb export declare function mergeScan(accumulator: (acc: R, value: T, index: number) => ObservableInput, seed: R, concurrent?: number): OperatorFunction; export declare function mergeWith(): OperatorFunction; -export declare function mergeWith[]>(...otherSources: A): OperatorFunction)>; +export declare function mergeWith[]>(...otherSources: A): OperatorFunction>; export declare function min(comparer?: (x: T, y: T) => number): MonoTypeOperatorFunction; @@ -260,7 +260,7 @@ export declare function single(predicate?: (value: T, index: number, source: export declare function skip(count: number): MonoTypeOperatorFunction; -export declare function skipLast(count: number): MonoTypeOperatorFunction; +export declare function skipLast(skipCount: number): MonoTypeOperatorFunction; export declare function skipUntil(notifier: Observable): MonoTypeOperatorFunction; @@ -292,7 +292,7 @@ export declare function take(count: number): MonoTypeOperatorFunction; export declare function takeLast(count: number): MonoTypeOperatorFunction; -export declare function takeUntil(notifier: Observable): MonoTypeOperatorFunction; +export declare function takeUntil(notifier: ObservableInput): MonoTypeOperatorFunction; export declare function takeWhile(predicate: (value: T, index: number) => value is S): OperatorFunction; export declare function takeWhile(predicate: (value: T, index: number) => value is S, inclusive: false): OperatorFunction; @@ -304,11 +304,11 @@ export declare function tap(next: (value: T) => void, error: null | undefined export declare function tap(next?: (x: T) => void, error?: (e: any) => void, complete?: () => void): MonoTypeOperatorFunction; export declare function tap(observer: PartialObserver): MonoTypeOperatorFunction; -export declare function throttle(durationSelector: (value: T) => SubscribableOrPromise, config?: ThrottleConfig): MonoTypeOperatorFunction; +export declare function throttle(durationSelector: (value: T) => SubscribableOrPromise, { leading, trailing }?: ThrottleConfig): MonoTypeOperatorFunction; -export declare function throttleTime(duration: number, scheduler?: SchedulerLike, { leading, trailing }?: ThrottleConfig): MonoTypeOperatorFunction; +export declare function throttleTime(duration: number, scheduler?: SchedulerLike, config?: import("./throttle").ThrottleConfig): MonoTypeOperatorFunction; -export declare function throwIfEmpty(errorFactory?: (() => any)): MonoTypeOperatorFunction; +export declare function throwIfEmpty(errorFactory?: () => any): MonoTypeOperatorFunction; export declare function timeInterval(scheduler?: SchedulerLike): OperatorFunction>; @@ -332,11 +332,11 @@ export declare function windowCount(windowSize: number, startWindowEvery?: nu export declare function windowTime(windowTimeSpan: number, scheduler?: SchedulerLike): OperatorFunction>; export declare function windowTime(windowTimeSpan: number, windowCreationInterval: number, scheduler?: SchedulerLike): OperatorFunction>; -export declare function windowTime(windowTimeSpan: number, windowCreationInterval: number, maxWindowSize: number, scheduler?: SchedulerLike): OperatorFunction>; +export declare function windowTime(windowTimeSpan: number, windowCreationInterval: number | null | void, maxWindowSize: number, scheduler?: SchedulerLike): OperatorFunction>; -export declare function windowToggle(openings: Observable, closingSelector: (openValue: O) => Observable): OperatorFunction>; +export declare function windowToggle(openings: ObservableInput, closingSelector: (openValue: O) => ObservableInput): OperatorFunction>; -export declare function windowWhen(closingSelector: () => Observable): OperatorFunction>; +export declare function windowWhen(closingSelector: () => ObservableInput): OperatorFunction>; export declare function withLatestFrom(project: (v1: T) => R): OperatorFunction; export declare function withLatestFrom, R>(source2: O2, project: (v1: T, v2: ObservedValueOf) => R): OperatorFunction;