Add production dependencies

This commit is contained in:
Jay Trees 2022-01-21 09:28:41 +01:00
parent 5a0114f3e2
commit 579ccdc29f
12113 changed files with 978046 additions and 3 deletions

View file

@ -0,0 +1,151 @@
import { Observable } from '../../Observable';
import { Subscriber } from '../../Subscriber';
import { TeardownLogic } from '../../types';
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;
}
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 declare function ajaxGet(url: string, headers?: Object): AjaxObservable<AjaxResponse>;
export declare function ajaxPost(url: string, body?: any, headers?: Object): Observable<AjaxResponse>;
export declare function ajaxDelete(url: string, headers?: Object): Observable<AjaxResponse>;
export declare function ajaxPut(url: string, body?: any, headers?: Object): Observable<AjaxResponse>;
export declare function ajaxPatch(url: string, body?: any, headers?: Object): Observable<AjaxResponse>;
export declare function ajaxGetJSON<T>(url: string, headers?: Object): Observable<T>;
/**
* We need this JSDoc comment for affecting ESDoc.
* @extends {Ignored}
* @hide true
*/
export declare 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;
private request;
constructor(urlOrRequest: string | AjaxRequest);
/** @deprecated This is an internal implementation detail, do not use. */
_subscribe(subscriber: Subscriber<T>): TeardownLogic;
}
/**
* We need this JSDoc comment for affecting ESDoc.
* @ignore
* @extends {Ignored}
*/
export declare class AjaxSubscriber<T> extends Subscriber<Event> {
request: AjaxRequest;
private xhr;
private done;
constructor(destination: Subscriber<T>, request: AjaxRequest);
next(e: Event): void;
private send;
private serializeBody;
private setHeaders;
private getHeader;
private setupEvents;
unsubscribe(): void;
}
/**
* A normalized AJAX response.
*
* @see {@link ajax}
*
* @class AjaxResponse
*/
export declare class AjaxResponse {
originalEvent: Event;
xhr: XMLHttpRequest;
request: AjaxRequest;
/** @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(originalEvent: Event, xhr: XMLHttpRequest, request: AjaxRequest);
}
export declare 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;
}
export declare const AjaxError: AjaxErrorCtor;
export interface AjaxTimeoutError extends AjaxError {
}
export interface AjaxTimeoutErrorCtor {
new (xhr: XMLHttpRequest, request: AjaxRequest): AjaxTimeoutError;
}
/**
* @see {@link ajax}
*
* @class AjaxTimeoutError
*/
export declare const AjaxTimeoutError: AjaxTimeoutErrorCtor;

View file

@ -0,0 +1,391 @@
"use strict";
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
}
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
var root_1 = require("../../util/root");
var Observable_1 = require("../../Observable");
var Subscriber_1 = require("../../Subscriber");
var map_1 = require("../../operators/map");
function getCORSRequest() {
if (root_1.root.XMLHttpRequest) {
return new root_1.root.XMLHttpRequest();
}
else if (!!root_1.root.XDomainRequest) {
return new root_1.root.XDomainRequest();
}
else {
throw new Error('CORS is not supported by your browser');
}
}
function getXMLHttpRequest() {
if (root_1.root.XMLHttpRequest) {
return new root_1.root.XMLHttpRequest();
}
else {
var progId = void 0;
try {
var progIds = ['Msxml2.XMLHTTP', 'Microsoft.XMLHTTP', 'Msxml2.XMLHTTP.4.0'];
for (var i = 0; i < 3; i++) {
try {
progId = progIds[i];
if (new root_1.root.ActiveXObject(progId)) {
break;
}
}
catch (e) {
}
}
return new root_1.root.ActiveXObject(progId);
}
catch (e) {
throw new Error('XMLHttpRequest is not supported by your browser');
}
}
}
function ajaxGet(url, headers) {
if (headers === void 0) { headers = null; }
return new AjaxObservable({ method: 'GET', url: url, headers: headers });
}
exports.ajaxGet = ajaxGet;
function ajaxPost(url, body, headers) {
return new AjaxObservable({ method: 'POST', url: url, body: body, headers: headers });
}
exports.ajaxPost = ajaxPost;
function ajaxDelete(url, headers) {
return new AjaxObservable({ method: 'DELETE', url: url, headers: headers });
}
exports.ajaxDelete = ajaxDelete;
function ajaxPut(url, body, headers) {
return new AjaxObservable({ method: 'PUT', url: url, body: body, headers: headers });
}
exports.ajaxPut = ajaxPut;
function ajaxPatch(url, body, headers) {
return new AjaxObservable({ method: 'PATCH', url: url, body: body, headers: headers });
}
exports.ajaxPatch = ajaxPatch;
var mapResponse = map_1.map(function (x, index) { return x.response; });
function ajaxGetJSON(url, headers) {
return mapResponse(new AjaxObservable({
method: 'GET',
url: url,
responseType: 'json',
headers: headers
}));
}
exports.ajaxGetJSON = ajaxGetJSON;
var AjaxObservable = (function (_super) {
__extends(AjaxObservable, _super);
function AjaxObservable(urlOrRequest) {
var _this = _super.call(this) || this;
var request = {
async: true,
createXHR: function () {
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 (var prop in urlOrRequest) {
if (urlOrRequest.hasOwnProperty(prop)) {
request[prop] = urlOrRequest[prop];
}
}
}
_this.request = request;
return _this;
}
AjaxObservable.prototype._subscribe = function (subscriber) {
return new AjaxSubscriber(subscriber, this.request);
};
AjaxObservable.create = (function () {
var create = function (urlOrRequest) {
return new AjaxObservable(urlOrRequest);
};
create.get = ajaxGet;
create.post = ajaxPost;
create.delete = ajaxDelete;
create.put = ajaxPut;
create.patch = ajaxPatch;
create.getJSON = ajaxGetJSON;
return create;
})();
return AjaxObservable;
}(Observable_1.Observable));
exports.AjaxObservable = AjaxObservable;
var AjaxSubscriber = (function (_super) {
__extends(AjaxSubscriber, _super);
function AjaxSubscriber(destination, request) {
var _this = _super.call(this, destination) || this;
_this.request = request;
_this.done = false;
var headers = request.headers = request.headers || {};
if (!request.crossDomain && !_this.getHeader(headers, 'X-Requested-With')) {
headers['X-Requested-With'] = 'XMLHttpRequest';
}
var contentTypeHeader = _this.getHeader(headers, 'Content-Type');
if (!contentTypeHeader && !(root_1.root.FormData && request.body instanceof root_1.root.FormData) && typeof request.body !== 'undefined') {
headers['Content-Type'] = 'application/x-www-form-urlencoded; charset=UTF-8';
}
request.body = _this.serializeBody(request.body, _this.getHeader(request.headers, 'Content-Type'));
_this.send();
return _this;
}
AjaxSubscriber.prototype.next = function (e) {
this.done = true;
var _a = this, xhr = _a.xhr, request = _a.request, destination = _a.destination;
var result;
try {
result = new AjaxResponse(e, xhr, request);
}
catch (err) {
return destination.error(err);
}
destination.next(result);
};
AjaxSubscriber.prototype.send = function () {
var _a = this, request = _a.request, _b = _a.request, user = _b.user, method = _b.method, url = _b.url, async = _b.async, password = _b.password, headers = _b.headers, body = _b.body;
try {
var xhr = this.xhr = request.createXHR();
this.setupEvents(xhr, request);
if (user) {
xhr.open(method, url, async, user, password);
}
else {
xhr.open(method, url, async);
}
if (async) {
xhr.timeout = request.timeout;
xhr.responseType = request.responseType;
}
if ('withCredentials' in xhr) {
xhr.withCredentials = !!request.withCredentials;
}
this.setHeaders(xhr, headers);
if (body) {
xhr.send(body);
}
else {
xhr.send();
}
}
catch (err) {
this.error(err);
}
};
AjaxSubscriber.prototype.serializeBody = function (body, contentType) {
if (!body || typeof body === 'string') {
return body;
}
else if (root_1.root.FormData && body instanceof root_1.root.FormData) {
return body;
}
if (contentType) {
var splitIndex = contentType.indexOf(';');
if (splitIndex !== -1) {
contentType = contentType.substring(0, splitIndex);
}
}
switch (contentType) {
case 'application/x-www-form-urlencoded':
return Object.keys(body).map(function (key) { return encodeURIComponent(key) + "=" + encodeURIComponent(body[key]); }).join('&');
case 'application/json':
return JSON.stringify(body);
default:
return body;
}
};
AjaxSubscriber.prototype.setHeaders = function (xhr, headers) {
for (var key in headers) {
if (headers.hasOwnProperty(key)) {
xhr.setRequestHeader(key, headers[key]);
}
}
};
AjaxSubscriber.prototype.getHeader = function (headers, headerName) {
for (var key in headers) {
if (key.toLowerCase() === headerName.toLowerCase()) {
return headers[key];
}
}
return undefined;
};
AjaxSubscriber.prototype.setupEvents = function (xhr, request) {
var progressSubscriber = request.progressSubscriber;
function xhrTimeout(e) {
var _a = xhrTimeout, subscriber = _a.subscriber, progressSubscriber = _a.progressSubscriber, request = _a.request;
if (progressSubscriber) {
progressSubscriber.error(e);
}
var error;
try {
error = new exports.AjaxTimeoutError(this, request);
}
catch (err) {
error = err;
}
subscriber.error(error);
}
xhr.ontimeout = xhrTimeout;
xhrTimeout.request = request;
xhrTimeout.subscriber = this;
xhrTimeout.progressSubscriber = progressSubscriber;
if (xhr.upload && 'withCredentials' in xhr) {
if (progressSubscriber) {
var xhrProgress_1;
xhrProgress_1 = function (e) {
var progressSubscriber = xhrProgress_1.progressSubscriber;
progressSubscriber.next(e);
};
if (root_1.root.XDomainRequest) {
xhr.onprogress = xhrProgress_1;
}
else {
xhr.upload.onprogress = xhrProgress_1;
}
xhrProgress_1.progressSubscriber = progressSubscriber;
}
var xhrError_1;
xhrError_1 = function (e) {
var _a = xhrError_1, progressSubscriber = _a.progressSubscriber, subscriber = _a.subscriber, request = _a.request;
if (progressSubscriber) {
progressSubscriber.error(e);
}
var error;
try {
error = new exports.AjaxError('ajax error', this, request);
}
catch (err) {
error = err;
}
subscriber.error(error);
};
xhr.onerror = xhrError_1;
xhrError_1.request = request;
xhrError_1.subscriber = this;
xhrError_1.progressSubscriber = progressSubscriber;
}
function xhrReadyStateChange(e) {
return;
}
xhr.onreadystatechange = xhrReadyStateChange;
xhrReadyStateChange.subscriber = this;
xhrReadyStateChange.progressSubscriber = progressSubscriber;
xhrReadyStateChange.request = request;
function xhrLoad(e) {
var _a = xhrLoad, subscriber = _a.subscriber, progressSubscriber = _a.progressSubscriber, request = _a.request;
if (this.readyState === 4) {
var status_1 = this.status === 1223 ? 204 : this.status;
var response = (this.responseType === 'text' ? (this.response || this.responseText) : this.response);
if (status_1 === 0) {
status_1 = response ? 200 : 0;
}
if (status_1 < 400) {
if (progressSubscriber) {
progressSubscriber.complete();
}
subscriber.next(e);
subscriber.complete();
}
else {
if (progressSubscriber) {
progressSubscriber.error(e);
}
var error = void 0;
try {
error = new exports.AjaxError('ajax error ' + status_1, this, request);
}
catch (err) {
error = err;
}
subscriber.error(error);
}
}
}
xhr.onload = xhrLoad;
xhrLoad.subscriber = this;
xhrLoad.progressSubscriber = progressSubscriber;
xhrLoad.request = request;
};
AjaxSubscriber.prototype.unsubscribe = function () {
var _a = this, done = _a.done, xhr = _a.xhr;
if (!done && xhr && xhr.readyState !== 4 && typeof xhr.abort === 'function') {
xhr.abort();
}
_super.prototype.unsubscribe.call(this);
};
return AjaxSubscriber;
}(Subscriber_1.Subscriber));
exports.AjaxSubscriber = AjaxSubscriber;
var AjaxResponse = (function () {
function AjaxResponse(originalEvent, xhr, request) {
this.originalEvent = originalEvent;
this.xhr = xhr;
this.request = request;
this.status = xhr.status;
this.responseType = xhr.responseType || request.responseType;
this.response = parseXhrResponse(this.responseType, xhr);
}
return AjaxResponse;
}());
exports.AjaxResponse = AjaxResponse;
var AjaxErrorImpl = (function () {
function AjaxErrorImpl(message, xhr, request) {
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;
})();
exports.AjaxError = AjaxErrorImpl;
function parseJson(xhr) {
if ('response' in xhr) {
return xhr.responseType ? xhr.response : JSON.parse(xhr.response || xhr.responseText || 'null');
}
else {
return JSON.parse(xhr.responseText || 'null');
}
}
function parseXhrResponse(responseType, xhr) {
switch (responseType) {
case 'json':
return parseJson(xhr);
case 'xml':
return xhr.responseXML;
case 'text':
default:
return ('response' in xhr) ? xhr.response : xhr.responseText;
}
}
function AjaxTimeoutErrorImpl(xhr, request) {
exports.AjaxError.call(this, 'ajax timeout', xhr, request);
this.name = 'AjaxTimeoutError';
return this;
}
exports.AjaxTimeoutError = AjaxTimeoutErrorImpl;
//# sourceMappingURL=AjaxObservable.js.map

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,170 @@
import { Subject, AnonymousSubject } from '../../Subject';
import { Subscriber } from '../../Subscriber';
import { Observable } from '../../Observable';
import { Subscription } from '../../Subscription';
import { Operator } from '../../Operator';
import { Observer, NextObserver } from '../../types';
/**
* WebSocketSubjectConfig is a plain Object that allows us to make our
* webSocket configurable.
*
* <span class="informal">Provides flexibility to {@link webSocket}</span>
*
* It defines a set of properties to provide custom behavior in specific
* moments of the socket's lifecycle. When the connection opens we can
* use `openObserver`, when the connection is closed `closeObserver`, if we
* are interested in listening for data comming from server: `deserializer`,
* which allows us to customize the deserialization strategy of data before passing it
* to the socket client. By default `deserializer` is going to apply `JSON.parse` to each message comming
* from the Server.
*
* ## Example
* **deserializer**, the default for this property is `JSON.parse` but since there are just two options
* for incomming data, either be text or binarydata. We can apply a custom deserialization strategy
* or just simply skip the default behaviour.
* ```ts
* import { webSocket } from 'rxjs/webSocket';
*
* const wsSubject = webSocket({
* url: 'ws://localhost:8081',
* //Apply any transformation of your choice.
* deserializer: ({data}) => data
* });
*
* wsSubject.subscribe(console.log);
*
* // Let's suppose we have this on the Server: ws.send("This is a msg from the server")
* //output
* //
* // This is a msg from the server
* ```
*
* **serializer** allows us tom apply custom serialization strategy but for the outgoing messages
* ```ts
* import { webSocket } from 'rxjs/webSocket';
*
* const wsSubject = webSocket({
* url: 'ws://localhost:8081',
* //Apply any transformation of your choice.
* serializer: msg => JSON.stringify({channel: "webDevelopment", msg: msg})
* });
*
* wsSubject.subscribe(() => subject.next("msg to the server"));
*
* // Let's suppose we have this on the Server: ws.send("This is a msg from the server")
* //output
* //
* // {"channel":"webDevelopment","msg":"msg to the server"}
* ```
*
* **closeObserver** allows us to set a custom error when an error raise up.
* ```ts
* import { webSocket } from 'rxjs/webSocket';
*
* const wsSubject = webSocket({
* url: 'ws://localhost:8081',
* closeObserver: {
next(closeEvent) {
const customError = { code: 6666, reason: "Custom evil reason" }
console.log(`code: ${customError.code}, reason: ${customError.reason}`);
}
}
* });
*
* //output
* // code: 6666, reason: Custom evil reason
* ```
*
* **openObserver**, Let's say we need to make some kind of init task before sending/receiving msgs to the
* webSocket or sending notification that the connection was successful, this is when
* openObserver is usefull for.
* ```ts
* import { webSocket } from 'rxjs/webSocket';
*
* const wsSubject = webSocket({
* url: 'ws://localhost:8081',
* openObserver: {
* next: () => {
* console.log('connetion ok');
* }
* },
* });
*
* //output
* // connetion ok`
* ```
* */
export interface WebSocketSubjectConfig<T> {
/** The url of the socket server to connect to */
url: string;
/** The protocol to use to connect */
protocol?: string | Array<string>;
/** @deprecated use {@link deserializer} */
resultSelector?: (e: MessageEvent) => T;
/**
* A serializer used to create messages from passed values before the
* messages are sent to the server. Defaults to JSON.stringify.
*/
serializer?: (value: T) => WebSocketMessage;
/**
* A deserializer used for messages arriving on the socket from the
* server. Defaults to JSON.parse.
*/
deserializer?: (e: MessageEvent) => T;
/**
* An Observer that watches when open events occur on the underlying web socket.
*/
openObserver?: NextObserver<Event>;
/**
* An Observer than watches when close events occur on the underlying webSocket
*/
closeObserver?: NextObserver<CloseEvent>;
/**
* An Observer that watches when a close is about to occur due to
* unsubscription.
*/
closingObserver?: NextObserver<void>;
/**
* A WebSocket constructor to use. This is useful for situations like using a
* WebSocket impl in Node (WebSocket is a DOM API), or for mocking a WebSocket
* for testing purposes
*/
WebSocketCtor?: {
new (url: string, protocols?: string | string[]): WebSocket;
};
/** Sets the `binaryType` property of the underlying WebSocket. */
binaryType?: 'blob' | 'arraybuffer';
}
export declare type WebSocketMessage = string | ArrayBuffer | Blob | ArrayBufferView;
export declare class WebSocketSubject<T> extends AnonymousSubject<T> {
private _config;
/** @deprecated This is an internal implementation detail, do not use. */
_output: Subject<T>;
private _socket;
constructor(urlConfigOrSource: string | WebSocketSubjectConfig<T> | Observable<T>, destination?: Observer<T>);
lift<R>(operator: Operator<T, R>): WebSocketSubject<R>;
private _resetState;
/**
* Creates an {@link Observable}, that when subscribed to, sends a message,
* defined by the `subMsg` function, to the server over the socket to begin a
* subscription to data over that socket. Once data arrives, the
* `messageFilter` argument will be used to select the appropriate data for
* the resulting Observable. When teardown occurs, either due to
* unsubscription, completion or error, a message defined by the `unsubMsg`
* argument will be send to the server over the WebSocketSubject.
*
* @param subMsg A function to generate the subscription message to be sent to
* the server. This will still be processed by the serializer in the
* WebSocketSubject's config. (Which defaults to JSON serialization)
* @param unsubMsg A function to generate the unsubscription message to be
* sent to the server at teardown. This will still be processed by the
* serializer in the WebSocketSubject's config.
* @param messageFilter A predicate for selecting the appropriate messages
* from the server for the output stream.
*/
multiplex(subMsg: () => any, unsubMsg: () => any, messageFilter: (value: T) => boolean): Observable<any>;
private _connectSocket;
/** @deprecated This is an internal implementation detail, do not use. */
_subscribe(subscriber: Subscriber<T>): Subscription;
unsubscribe(): void;
}

View file

@ -0,0 +1,241 @@
"use strict";
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
}
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var __assign = (this && this.__assign) || function () {
__assign = Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};
Object.defineProperty(exports, "__esModule", { value: true });
var Subject_1 = require("../../Subject");
var Subscriber_1 = require("../../Subscriber");
var Observable_1 = require("../../Observable");
var Subscription_1 = require("../../Subscription");
var ReplaySubject_1 = require("../../ReplaySubject");
var DEFAULT_WEBSOCKET_CONFIG = {
url: '',
deserializer: function (e) { return JSON.parse(e.data); },
serializer: function (value) { return JSON.stringify(value); },
};
var WEBSOCKETSUBJECT_INVALID_ERROR_OBJECT = 'WebSocketSubject.error must be called with an object with an error code, and an optional reason: { code: number, reason: string }';
var WebSocketSubject = (function (_super) {
__extends(WebSocketSubject, _super);
function WebSocketSubject(urlConfigOrSource, destination) {
var _this = _super.call(this) || this;
if (urlConfigOrSource instanceof Observable_1.Observable) {
_this.destination = destination;
_this.source = urlConfigOrSource;
}
else {
var config = _this._config = __assign({}, DEFAULT_WEBSOCKET_CONFIG);
_this._output = new Subject_1.Subject();
if (typeof urlConfigOrSource === 'string') {
config.url = urlConfigOrSource;
}
else {
for (var key in urlConfigOrSource) {
if (urlConfigOrSource.hasOwnProperty(key)) {
config[key] = urlConfigOrSource[key];
}
}
}
if (!config.WebSocketCtor && WebSocket) {
config.WebSocketCtor = WebSocket;
}
else if (!config.WebSocketCtor) {
throw new Error('no WebSocket constructor can be found');
}
_this.destination = new ReplaySubject_1.ReplaySubject();
}
return _this;
}
WebSocketSubject.prototype.lift = function (operator) {
var sock = new WebSocketSubject(this._config, this.destination);
sock.operator = operator;
sock.source = this;
return sock;
};
WebSocketSubject.prototype._resetState = function () {
this._socket = null;
if (!this.source) {
this.destination = new ReplaySubject_1.ReplaySubject();
}
this._output = new Subject_1.Subject();
};
WebSocketSubject.prototype.multiplex = function (subMsg, unsubMsg, messageFilter) {
var self = this;
return new Observable_1.Observable(function (observer) {
try {
self.next(subMsg());
}
catch (err) {
observer.error(err);
}
var subscription = self.subscribe(function (x) {
try {
if (messageFilter(x)) {
observer.next(x);
}
}
catch (err) {
observer.error(err);
}
}, function (err) { return observer.error(err); }, function () { return observer.complete(); });
return function () {
try {
self.next(unsubMsg());
}
catch (err) {
observer.error(err);
}
subscription.unsubscribe();
};
});
};
WebSocketSubject.prototype._connectSocket = function () {
var _this = this;
var _a = this._config, WebSocketCtor = _a.WebSocketCtor, protocol = _a.protocol, url = _a.url, binaryType = _a.binaryType;
var observer = this._output;
var socket = null;
try {
socket = protocol ?
new WebSocketCtor(url, protocol) :
new WebSocketCtor(url);
this._socket = socket;
if (binaryType) {
this._socket.binaryType = binaryType;
}
}
catch (e) {
observer.error(e);
return;
}
var subscription = new Subscription_1.Subscription(function () {
_this._socket = null;
if (socket && socket.readyState === 1) {
socket.close();
}
});
socket.onopen = function (e) {
var _socket = _this._socket;
if (!_socket) {
socket.close();
_this._resetState();
return;
}
var openObserver = _this._config.openObserver;
if (openObserver) {
openObserver.next(e);
}
var queue = _this.destination;
_this.destination = Subscriber_1.Subscriber.create(function (x) {
if (socket.readyState === 1) {
try {
var serializer = _this._config.serializer;
socket.send(serializer(x));
}
catch (e) {
_this.destination.error(e);
}
}
}, function (e) {
var closingObserver = _this._config.closingObserver;
if (closingObserver) {
closingObserver.next(undefined);
}
if (e && e.code) {
socket.close(e.code, e.reason);
}
else {
observer.error(new TypeError(WEBSOCKETSUBJECT_INVALID_ERROR_OBJECT));
}
_this._resetState();
}, function () {
var closingObserver = _this._config.closingObserver;
if (closingObserver) {
closingObserver.next(undefined);
}
socket.close();
_this._resetState();
});
if (queue && queue instanceof ReplaySubject_1.ReplaySubject) {
subscription.add(queue.subscribe(_this.destination));
}
};
socket.onerror = function (e) {
_this._resetState();
observer.error(e);
};
socket.onclose = function (e) {
_this._resetState();
var closeObserver = _this._config.closeObserver;
if (closeObserver) {
closeObserver.next(e);
}
if (e.wasClean) {
observer.complete();
}
else {
observer.error(e);
}
};
socket.onmessage = function (e) {
try {
var deserializer = _this._config.deserializer;
observer.next(deserializer(e));
}
catch (err) {
observer.error(err);
}
};
};
WebSocketSubject.prototype._subscribe = function (subscriber) {
var _this = this;
var source = this.source;
if (source) {
return source.subscribe(subscriber);
}
if (!this._socket) {
this._connectSocket();
}
this._output.subscribe(subscriber);
subscriber.add(function () {
var _socket = _this._socket;
if (_this._output.observers.length === 0) {
if (_socket && _socket.readyState === 1) {
_socket.close();
}
_this._resetState();
}
});
return subscriber;
};
WebSocketSubject.prototype.unsubscribe = function () {
var _socket = this._socket;
if (_socket && _socket.readyState === 1) {
_socket.close();
}
this._resetState();
_super.prototype.unsubscribe.call(this);
};
return WebSocketSubject;
}(Subject_1.AnonymousSubject));
exports.WebSocketSubject = WebSocketSubject;
//# sourceMappingURL=WebSocketSubject.js.map

File diff suppressed because one or more lines are too long

82
node_modules/rxjs/internal/observable/dom/ajax.d.ts generated vendored Normal file
View file

@ -0,0 +1,82 @@
import { AjaxCreationMethod } from './AjaxObservable';
/**
* There is an ajax operator on the Rx object.
*
* It creates an observable for an Ajax request with either a request object with
* url, headers, etc or a string for a URL.
*
*
* ## Using ajax() to fetch the response object that is being returned from API.
* ```ts
* import { ajax } from 'rxjs/ajax';
* import { map, catchError } from 'rxjs/operators';
* import { of } from 'rxjs';
*
* const obs$ = ajax(`https://api.github.com/users?per_page=5`).pipe(
* map(userResponse => console.log('users: ', userResponse)),
* catchError(error => {
* console.log('error: ', error);
* return of(error);
* })
* );
*
* ```
*
* ## Using ajax.getJSON() to fetch data from API.
* ```ts
* import { ajax } from 'rxjs/ajax';
* import { map, catchError } from 'rxjs/operators';
* import { of } from 'rxjs';
*
* const obs$ = ajax.getJSON(`https://api.github.com/users?per_page=5`).pipe(
* map(userResponse => console.log('users: ', userResponse)),
* catchError(error => {
* console.log('error: ', error);
* return of(error);
* })
* );
*
* ```
*
* ## Using ajax() with object as argument and method POST with a two seconds delay.
* ```ts
* import { ajax } from 'rxjs/ajax';
* import { of } from 'rxjs';
*
* const users = ajax({
* url: 'https://httpbin.org/delay/2',
* method: 'POST',
* headers: {
* 'Content-Type': 'application/json',
* 'rxjs-custom-header': 'Rxjs'
* },
* body: {
* rxjs: 'Hello World!'
* }
* }).pipe(
* map(response => console.log('response: ', response)),
* catchError(error => {
* console.log('error: ', error);
* return of(error);
* })
* );
*
* ```
*
* ## Using ajax() to fetch. An error object that is being returned from the request.
* ```ts
* import { ajax } from 'rxjs/ajax';
* import { map, catchError } from 'rxjs/operators';
* import { of } from 'rxjs';
*
* const obs$ = ajax(`https://api.github.com/404`).pipe(
* map(userResponse => console.log('users: ', userResponse)),
* catchError(error => {
* console.log('error: ', error);
* return of(error);
* })
* );
*
* ```
*/
export declare const ajax: AjaxCreationMethod;

5
node_modules/rxjs/internal/observable/dom/ajax.js generated vendored Normal file
View file

@ -0,0 +1,5 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var AjaxObservable_1 = require("./AjaxObservable");
exports.ajax = (function () { return AjaxObservable_1.AjaxObservable.create; })();
//# sourceMappingURL=ajax.js.map

View file

@ -0,0 +1 @@
{"version":3,"file":"ajax.js","sources":["../../../src/internal/observable/dom/ajax.ts"],"names":[],"mappings":";;AAAA,mDAAwE;AAiF3D,QAAA,IAAI,GAAuB,CAAC,cAAM,OAAA,+BAAc,CAAC,MAAM,EAArB,CAAqB,CAAC,EAAE,CAAC"}

6
node_modules/rxjs/internal/observable/dom/fetch.d.ts generated vendored Normal file
View file

@ -0,0 +1,6 @@
import { Observable } from '../../Observable';
import { ObservableInput } from '../../types';
export declare function fromFetch<T>(input: string | Request, init: RequestInit & {
selector: (response: Response) => ObservableInput<T>;
}): Observable<T>;
export declare function fromFetch(input: string | Request, init?: RequestInit): Observable<Response>;

90
node_modules/rxjs/internal/observable/dom/fetch.js generated vendored Normal file
View file

@ -0,0 +1,90 @@
"use strict";
var __assign = (this && this.__assign) || function () {
__assign = Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};
var __rest = (this && this.__rest) || function (s, e) {
var t = {};
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
t[p] = s[p];
if (s != null && typeof Object.getOwnPropertySymbols === "function")
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) if (e.indexOf(p[i]) < 0)
t[p[i]] = s[p[i]];
return t;
};
Object.defineProperty(exports, "__esModule", { value: true });
var Observable_1 = require("../../Observable");
var Subscription_1 = require("../../Subscription");
var from_1 = require("../../observable/from");
function fromFetch(input, initWithSelector) {
if (initWithSelector === void 0) { initWithSelector = {}; }
var selector = initWithSelector.selector, init = __rest(initWithSelector, ["selector"]);
return new Observable_1.Observable(function (subscriber) {
var controller = new AbortController();
var signal = controller.signal;
var abortable = true;
var unsubscribed = false;
var subscription = new Subscription_1.Subscription();
subscription.add(function () {
unsubscribed = true;
if (abortable) {
controller.abort();
}
});
var perSubscriberInit;
if (init) {
if (init.signal) {
if (init.signal.aborted) {
controller.abort();
}
else {
var outerSignal_1 = init.signal;
var outerSignalHandler_1 = function () {
if (!signal.aborted) {
controller.abort();
}
};
outerSignal_1.addEventListener('abort', outerSignalHandler_1);
subscription.add(function () { return outerSignal_1.removeEventListener('abort', outerSignalHandler_1); });
}
}
perSubscriberInit = __assign({}, init, { signal: signal });
}
else {
perSubscriberInit = { signal: signal };
}
fetch(input, perSubscriberInit).then(function (response) {
if (selector) {
subscription.add(from_1.from(selector(response)).subscribe(function (value) { return subscriber.next(value); }, function (err) {
abortable = false;
if (!unsubscribed) {
subscriber.error(err);
}
}, function () {
abortable = false;
subscriber.complete();
}));
}
else {
abortable = false;
subscriber.next(response);
subscriber.complete();
}
}).catch(function (err) {
abortable = false;
if (!unsubscribed) {
subscriber.error(err);
}
});
return subscription;
});
}
exports.fromFetch = fromFetch;
//# sourceMappingURL=fetch.js.map

View file

@ -0,0 +1 @@
{"version":3,"file":"fetch.js","sources":["../../../src/internal/observable/dom/fetch.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA,+CAA8C;AAC9C,mDAAkD;AAClD,8CAA6C;AA8F7C,SAAgB,SAAS,CACvB,KAAuB,EACvB,gBAEM;IAFN,iCAAA,EAAA,qBAEM;IAEE,IAAA,oCAAQ,EAAE,6CAAO,CAAsB;IAC/C,OAAO,IAAI,uBAAU,CAAe,UAAA,UAAU;QAC5C,IAAM,UAAU,GAAG,IAAI,eAAe,EAAE,CAAC;QACzC,IAAM,MAAM,GAAG,UAAU,CAAC,MAAM,CAAC;QACjC,IAAI,SAAS,GAAG,IAAI,CAAC;QACrB,IAAI,YAAY,GAAG,KAAK,CAAC;QAEzB,IAAM,YAAY,GAAG,IAAI,2BAAY,EAAE,CAAC;QACxC,YAAY,CAAC,GAAG,CAAC;YACf,YAAY,GAAG,IAAI,CAAC;YACpB,IAAI,SAAS,EAAE;gBACb,UAAU,CAAC,KAAK,EAAE,CAAC;aACpB;QACH,CAAC,CAAC,CAAC;QAEH,IAAI,iBAA8B,CAAC;QACnC,IAAI,IAAI,EAAE;YAER,IAAI,IAAI,CAAC,MAAM,EAAE;gBACf,IAAI,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE;oBACvB,UAAU,CAAC,KAAK,EAAE,CAAC;iBACpB;qBAAM;oBACL,IAAM,aAAW,GAAG,IAAI,CAAC,MAAM,CAAC;oBAChC,IAAM,oBAAkB,GAAG;wBACzB,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE;4BACnB,UAAU,CAAC,KAAK,EAAE,CAAC;yBACpB;oBACH,CAAC,CAAC;oBACF,aAAW,CAAC,gBAAgB,CAAC,OAAO,EAAE,oBAAkB,CAAC,CAAC;oBAC1D,YAAY,CAAC,GAAG,CAAC,cAAM,OAAA,aAAW,CAAC,mBAAmB,CAAC,OAAO,EAAE,oBAAkB,CAAC,EAA5D,CAA4D,CAAC,CAAC;iBACtF;aACF;YAGD,iBAAiB,gBAAQ,IAAI,IAAE,MAAM,QAAA,GAAE,CAAC;SACzC;aAAM;YACL,iBAAiB,GAAG,EAAE,MAAM,QAAA,EAAE,CAAC;SAChC;QAED,KAAK,CAAC,KAAK,EAAE,iBAAiB,CAAC,CAAC,IAAI,CAAC,UAAA,QAAQ;YAC3C,IAAI,QAAQ,EAAE;gBACZ,YAAY,CAAC,GAAG,CAAC,WAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,CAAC,SAAS,CACjD,UAAA,KAAK,IAAI,OAAA,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC,EAAtB,CAAsB,EAC/B,UAAA,GAAG;oBACD,SAAS,GAAG,KAAK,CAAC;oBAClB,IAAI,CAAC,YAAY,EAAE;wBAEjB,UAAU,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;qBACvB;gBACH,CAAC,EACD;oBACE,SAAS,GAAG,KAAK,CAAC;oBAClB,UAAU,CAAC,QAAQ,EAAE,CAAC;gBACxB,CAAC,CACF,CAAC,CAAC;aACJ;iBAAM;gBACL,SAAS,GAAG,KAAK,CAAC;gBAClB,UAAU,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;gBAC1B,UAAU,CAAC,QAAQ,EAAE,CAAC;aACvB;QACH,CAAC,CAAC,CAAC,KAAK,CAAC,UAAA,GAAG;YACV,SAAS,GAAG,KAAK,CAAC;YAClB,IAAI,CAAC,YAAY,EAAE;gBAEjB,UAAU,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;aACvB;QACH,CAAC,CAAC,CAAC;QAEH,OAAO,YAAY,CAAC;IACtB,CAAC,CAAC,CAAC;AACL,CAAC;AA5ED,8BA4EC"}

View file

@ -0,0 +1,153 @@
import { WebSocketSubject, WebSocketSubjectConfig } from './WebSocketSubject';
/**
* Wrapper around the w3c-compatible WebSocket object provided by the browser.
*
* <span class="informal">{@link Subject} that communicates with a server via WebSocket</span>
*
* `webSocket` is a factory function that produces a `WebSocketSubject`,
* which can be used to make WebSocket connection with an arbitrary endpoint.
* `webSocket` accepts as an argument either a string with url of WebSocket endpoint, or an
* {@link WebSocketSubjectConfig} object for providing additional configuration, as
* well as Observers for tracking lifecycle of WebSocket connection.
*
* When `WebSocketSubject` is subscribed, it attempts to make a socket connection,
* unless there is one made already. This means that many subscribers will always listen
* on the same socket, thus saving resources. If however, two instances are made of `WebSocketSubject`,
* even if these two were provided with the same url, they will attempt to make separate
* connections. When consumer of a `WebSocketSubject` unsubscribes, socket connection is closed,
* only if there are no more subscribers still listening. If after some time a consumer starts
* subscribing again, connection is reestablished.
*
* Once connection is made, whenever a new message comes from the server, `WebSocketSubject` will emit that
* message as a value in the stream. By default, a message from the socket is parsed via `JSON.parse`. If you
* want to customize how deserialization is handled (if at all), you can provide custom `resultSelector`
* function in {@link WebSocketSubject}. When connection closes, stream will complete, provided it happened without
* any errors. If at any point (starting, maintaining or closing a connection) there is an error,
* stream will also error with whatever WebSocket API has thrown.
*
* By virtue of being a {@link Subject}, `WebSocketSubject` allows for receiving and sending messages from the server. In order
* to communicate with a connected endpoint, use `next`, `error` and `complete` methods. `next` sends a value to the server, so bear in mind
* that this value will not be serialized beforehand. Because of This, `JSON.stringify` will have to be called on a value by hand,
* before calling `next` with a result. Note also that if at the moment of nexting value
* there is no socket connection (for example no one is subscribing), those values will be buffered, and sent when connection
* is finally established. `complete` method closes socket connection. `error` does the same,
* as well as notifying the server that something went wrong via status code and string with details of what happened.
* Since status code is required in WebSocket API, `WebSocketSubject` does not allow, like regular `Subject`,
* arbitrary values being passed to the `error` method. It needs to be called with an object that has `code`
* property with status code number and optional `reason` property with string describing details
* of an error.
*
* Calling `next` does not affect subscribers of `WebSocketSubject` - they have no
* information that something was sent to the server (unless of course the server
* responds somehow to a message). On the other hand, since calling `complete` triggers
* an attempt to close socket connection. If that connection is closed without any errors, stream will
* complete, thus notifying all subscribers. And since calling `error` closes
* socket connection as well, just with a different status code for the server, if closing itself proceeds
* without errors, subscribed Observable will not error, as one might expect, but complete as usual. In both cases
* (calling `complete` or `error`), if process of closing socket connection results in some errors, *then* stream
* will error.
*
* **Multiplexing**
*
* `WebSocketSubject` has an additional operator, not found in other Subjects. It is called `multiplex` and it is
* used to simulate opening several socket connections, while in reality maintaining only one.
* For example, an application has both chat panel and real-time notifications about sport news. Since these are two distinct functions,
* it would make sense to have two separate connections for each. Perhaps there could even be two separate services with WebSocket
* endpoints, running on separate machines with only GUI combining them together. Having a socket connection
* for each functionality could become too resource expensive. It is a common pattern to have single
* WebSocket endpoint that acts as a gateway for the other services (in this case chat and sport news services).
* Even though there is a single connection in a client app, having the ability to manipulate streams as if it
* were two separate sockets is desirable. This eliminates manually registering and unregistering in a gateway for
* given service and filter out messages of interest. This is exactly what `multiplex` method is for.
*
* Method accepts three parameters. First two are functions returning subscription and unsubscription messages
* respectively. These are messages that will be sent to the server, whenever consumer of resulting Observable
* subscribes and unsubscribes. Server can use them to verify that some kind of messages should start or stop
* being forwarded to the client. In case of the above example application, after getting subscription message with proper identifier,
* gateway server can decide that it should connect to real sport news service and start forwarding messages from it.
* Note that both messages will be sent as returned by the functions, they are by default serialized using JSON.stringify, just
* as messages pushed via `next`. Also bear in mind that these messages will be sent on *every* subscription and
* unsubscription. This is potentially dangerous, because one consumer of an Observable may unsubscribe and the server
* might stop sending messages, since it got unsubscription message. This needs to be handled
* on the server or using {@link publish} on a Observable returned from 'multiplex'.
*
* Last argument to `multiplex` is a `messageFilter` function which should return a boolean. It is used to filter out messages
* sent by the server to only those that belong to simulated WebSocket stream. For example, server might mark these
* messages with some kind of string identifier on a message object and `messageFilter` would return `true`
* if there is such identifier on an object emitted by the socket. Messages which returns `false` in `messageFilter` are simply skipped,
* and are not passed down the stream.
*
* Return value of `multiplex` is an Observable with messages incoming from emulated socket connection. Note that this
* is not a `WebSocketSubject`, so calling `next` or `multiplex` again will fail. For pushing values to the
* server, use root `WebSocketSubject`.
*
* ### Examples
* #### Listening for messages from the server
* ```ts
* import { webSocket } from "rxjs/webSocket";
* const subject = webSocket("ws://localhost:8081");
*
* subject.subscribe(
* msg => console.log('message received: ' + msg), // Called whenever there is a message from the server.
* err => console.log(err), // Called if at any point WebSocket API signals some kind of error.
* () => console.log('complete') // Called when connection is closed (for whatever reason).
* );
* ```
*
* #### Pushing messages to the server
* ```ts
* import { webSocket } from "rxjs/webSocket";
* const subject = webSocket('ws://localhost:8081');
*
* subject.subscribe();
* // Note that at least one consumer has to subscribe to the created subject - otherwise "nexted" values will be just buffered and not sent,
* // since no connection was established!
*
* subject.next({message: 'some message'});
* // This will send a message to the server once a connection is made. Remember value is serialized with JSON.stringify by default!
*
* subject.complete(); // Closes the connection.
*
* subject.error({code: 4000, reason: 'I think our app just broke!'});
* // Also closes the connection, but let's the server know that this closing is caused by some error.
* ```
*
* #### Multiplexing WebSocket
* ```ts
* import { webSocket } from "rxjs/webSocket";
* const subject = webSocket('ws://localhost:8081');
*
* const observableA = subject.multiplex(
* () => ({subscribe: 'A'}), // When server gets this message, it will start sending messages for 'A'...
* () => ({unsubscribe: 'A'}), // ...and when gets this one, it will stop.
* message => message.type === 'A' // If the function returns `true` message is passed down the stream. Skipped if the function returns false.
* );
*
* const observableB = subject.multiplex( // And the same goes for 'B'.
* () => ({subscribe: 'B'}),
* () => ({unsubscribe: 'B'}),
* message => message.type === 'B'
* );
*
* const subA = observableA.subscribe(messageForA => console.log(messageForA));
* // At this moment WebSocket connection is established. Server gets '{"subscribe": "A"}' message and starts sending messages for 'A',
* // which we log here.
*
* const subB = observableB.subscribe(messageForB => console.log(messageForB));
* // Since we already have a connection, we just send '{"subscribe": "B"}' message to the server. It starts sending messages for 'B',
* // which we log here.
*
* subB.unsubscribe();
* // Message '{"unsubscribe": "B"}' is sent to the server, which stops sending 'B' messages.
*
* subA.unsubscribe();
* // Message '{"unsubscribe": "A"}' makes the server stop sending messages for 'A'. Since there is no more subscribers to root Subject,
* // socket connection closes.
* ```
*
*
* @param {string|WebSocketSubjectConfig} urlConfigOrSource The WebSocket endpoint as an url or an object with
* configuration and additional Observers.
* @return {WebSocketSubject} Subject which allows to both send and receive messages via WebSocket connection.
*/
export declare function webSocket<T>(urlConfigOrSource: string | WebSocketSubjectConfig<T>): WebSocketSubject<T>;

View file

@ -0,0 +1,8 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var WebSocketSubject_1 = require("./WebSocketSubject");
function webSocket(urlConfigOrSource) {
return new WebSocketSubject_1.WebSocketSubject(urlConfigOrSource);
}
exports.webSocket = webSocket;
//# sourceMappingURL=webSocket.js.map

View file

@ -0,0 +1 @@
{"version":3,"file":"webSocket.js","sources":["../../../src/internal/observable/dom/webSocket.ts"],"names":[],"mappings":";;AAAA,uDAA8E;AAyJ9E,SAAgB,SAAS,CAAI,iBAAqD;IAChF,OAAO,IAAI,mCAAgB,CAAI,iBAAiB,CAAC,CAAC;AACpD,CAAC;AAFD,8BAEC"}