Socket
Socket
Sign inDemoInstall

fleuvejs

Package Overview
Dependencies
Maintainers
1
Versions
25
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fleuvejs - npm Package Compare versions

Comparing version 1.2.7 to 1.2.8

2

build/helpers/function.helper.js

@@ -18,4 +18,4 @@ export function isFunction(fn) {

}
var errorMsg = "Test failed\n" + message + " " + args.reduce(function (acc, curr) { return acc + " " + curr; }, "");
var errorMsg = "Test failed\n".concat(message, " ").concat(args.reduce(function (acc, curr) { return "".concat(acc, " ").concat(curr); }, ""));
throw new Error(errorMsg);
}

@@ -1,2 +0,1 @@

export * from "./models/types";
export * from "./operators";

@@ -1,2 +0,1 @@

export * from "./models/types";
export * from "./operators";
export * from "./operator";
export * from "./subscription";
export * from "./types";
export * from "./operator";
export * from "./subscription";
export * from "./types";

@@ -1,2 +0,2 @@

export declare type OperatorFunction<T, U = never> = (source: T) => U;
export type OperatorFunction<T, U = never> = (source: T) => U;
export declare class OperationResult<T> {

@@ -3,0 +3,0 @@ private _value;

@@ -11,3 +11,2 @@ export declare class Subscription {

export interface Subscriber<T = any> {
name?: string;
next?: OnNext<T>;

@@ -14,0 +13,0 @@ error?: OnError;

@@ -19,5 +19,10 @@ import { isFunction } from "../helpers/function.helper";

}
return fields.some(function (field) { return obj[field] !== undefined && obj[field] !== null && isFunction(obj[field]); });
return fields.some(function (field) {
return obj[field] !== undefined &&
obj[field] !== null &&
isFunction(obj[field]);
});
}
return !isFunction(obj) && hasAtLeastOneOfTheseFieldsAsAFunction(obj, 'next', 'error', 'complete');
return (!isFunction(obj) &&
hasAtLeastOneOfTheseFieldsAsAFunction(obj, "next", "error", "complete"));
}

@@ -31,2 +36,1 @@ export function subscriberOf(next, error, complete) {

}
;

@@ -1,1 +0,24 @@

export {};
"use strict";
// import { OperationResult, OperatorFunction } from "./operator";
// import { SubscribeFunction } from "./subscription";
// export namespace Types {
// export interface Observable<T = never> {
// pipe<U = any>(
// ...operations: OperatorFunction<T, OperationResult<U>>[]
// ): Observable<U>;
// subscribe: SubscribeFunction<T>;
// }
// export interface MutableObservable<T = never> extends Observable<T> {
// next(...events: T[]): this;
// compile(...operations: OperatorFunction<T, OperationResult<any>>[]): this;
// close(): this;
// }
// export interface ObservableFork<T = never> extends Observable<T> {
// close(): void;
// }
// export interface PromiseObservable<T = never> extends Observable<T> {}
// }
// export type Observable<T> = Types.Observable<T>;
// export type MutableObservable<T> = Types.MutableObservable<T>;
// export type ObservableFork<T> = Types.ObservableFork<T>;
// export type PromiseObservable<T> = Types.PromiseObservable<T>;
import { OperatorFunction, OperationResult } from "../models/operator";
import { OnNext, Subscriber, Subscription } from "../models/subscription";
import { Types } from "../models/types";
import { Observable } from "./observable";
export declare class MutableObservable<T = never> extends Observable<T> implements Types.MutableObservable<T> {
export declare class MutableObservable<T = never> extends Observable<T> {
private _preProcessOperations;

@@ -15,5 +13,4 @@ constructor(...initialSequence: T[]);

next(...events: T[]): this;
subscribe(subscriber?: Subscriber<T> | OnNext<T> | undefined): Subscription;
private _buildNewSequence;
private _triggerExecution;
}

@@ -16,6 +16,10 @@ var __extends = (this && this.__extends) || (function () {

})();
var __spreadArray = (this && this.__spreadArray) || function (to, from) {
for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
to[j] = from[i];
return to;
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
if (ar || !(i in from)) {
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
ar[i] = from[i];
}
}
return to.concat(ar || Array.prototype.slice.call(from));
};

@@ -62,3 +66,3 @@ import { OperationResult, OperationResultFlag, } from "../models/operator";

.filter(function (event) { return !event.isOperationError(); })
.map(function (event) { return event.value; }), __spreadArray(__spreadArray([], operations), this._preProcessOperations)).filter(function (event) { return !event.isMustStop(); });
.map(function (event) { return event.value; }), __spreadArray(__spreadArray([], operations, true), this._preProcessOperations, true)).filter(function (event) { return !event.isMustStop(); });
var idxError = newSequence.findIndex(function (opRes) { return opRes.isOperationError(); });

@@ -87,6 +91,2 @@ if (idxError > -1) {

};
MutableObservable.prototype.subscribe = function (subscriber) {
//TODO - TTO: might be useful not to assign a default one but rather a new empty one each time
return _super.prototype.subscribe.call(this, subscriber !== null && subscriber !== void 0 ? subscriber : MutableObservable.DEFAULT_SUBSCRIBER);
};
MutableObservable.prototype._buildNewSequence = function (events, operations) {

@@ -115,3 +115,3 @@ var newSequence = [];

var _this = this;
subscribers.forEach(function (s) { return _this.executeSubscriber(s, sequence); });
subscribers.forEach(function (s) { return _this.executeSubscriber(sequence, s); });
};

@@ -118,0 +118,0 @@ return MutableObservable;

import { Observable } from "./observable";
import { OperatorFunction, OperationResult } from "../models/operator";
import { OnNext, Subscriber, Subscription } from "../models/subscription";
import { Types } from "../models";
export declare class ObservableFork<T> extends Observable<T> implements Types.ObservableFork<T> {
export declare class ObservableFork<T> extends Observable<T> {
private sourceObs$;

@@ -12,3 +11,3 @@ private subscriptions;

protected set innerSequence(sequence: OperationResult<T>[]);
constructor(sourceObs$: Types.Observable<T>, ...operators: OperatorFunction<T, OperationResult<any>>[]);
constructor(sourceObs$: Observable<T>, ...operators: OperatorFunction<T, OperationResult<any>>[]);
subscribe(subscriber?: Subscriber<T> | OnNext<T> | undefined): Subscription;

@@ -15,0 +14,0 @@ close(): void;

@@ -78,4 +78,3 @@ var __extends = (this && this.__extends) || (function () {

if (subscriber === undefined) {
//TODO - TTO: might be useful not to assign a default one but rather a new empty one each time
subscriber = ObservableFork.DEFAULT_SUBSCRIBER;
subscriber = subscriberOf(function () { });
}

@@ -107,3 +106,3 @@ if (!isFunction(subscriber) && !isInstanceOfSubscriber(subscriber)) {

else {
this.executeSubscriber(_subscriber, newSequence);
this.executeSubscriber(newSequence, _subscriber);
}

@@ -110,0 +109,0 @@ return new Subscription(function () {

import { OperationResult, OperatorFunction } from "../models/operator";
import { OnNext, Subscriber, Subscription } from "../models/subscription";
import { ObservableFork, Types } from '../models/types';
export declare class Observable<T = never> implements Types.Observable<T> {
protected static readonly DEFAULT_SUBSCRIBER: Subscriber<unknown>;
import { ObservableFork } from "./observable-fork";
export declare class Observable<T = never> {
protected _innerSequence: OperationResult<T>[];

@@ -16,5 +15,5 @@ protected _subscribers: Subscriber<T>[];

subscribe(subscriber?: OnNext<T> | Subscriber<T> | undefined): Subscription;
protected executeSubscriber(_subscriber: Subscriber<T>, sequence: OperationResult<T>[]): void;
protected executeSubscriber(sequence: OperationResult<T>[], _subscriber?: Subscriber<T> | undefined): void;
private _computeValue;
protected _executeOperations<T, U = any>(value: T, operators: OperatorFunction<T, OperationResult<U>>[]): OperationResult<U>;
}

@@ -1,5 +0,9 @@

var __spreadArray = (this && this.__spreadArray) || function (to, from) {
for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
to[j] = from[i];
return to;
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
if (ar || !(i in from)) {
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
ar[i] = from[i];
}
}
return to.concat(ar || Array.prototype.slice.call(from));
};

@@ -56,3 +60,3 @@ import { filterNonFunctions, isFunction } from "../helpers/function.helper";

if (subscriber === undefined) {
this.executeSubscriber(Observable.DEFAULT_SUBSCRIBER, this.innerSequence);
this.executeSubscriber(this.innerSequence);
return new Subscription();

@@ -67,3 +71,3 @@ }

this._subscribers.push(_subscriber);
this.executeSubscriber(_subscriber, this.innerSequence);
this.executeSubscriber(this.innerSequence, _subscriber);
return new Subscription(function () {

@@ -73,3 +77,3 @@ return (_this._subscribers = _this._subscribers.filter(function (s) { return s !== subscriber; }));

};
Observable.prototype.executeSubscriber = function (_subscriber, sequence) {
Observable.prototype.executeSubscriber = function (sequence, _subscriber) {
var _loop_1 = function (i, l) {

@@ -79,3 +83,3 @@ var operationResult = sequence[i];

this_1._error = operationResult.error;
(_subscriber.error || (function () { throw operationResult.error; }))(operationResult.error);
((_subscriber === null || _subscriber === void 0 ? void 0 : _subscriber.error) || (function () { throw operationResult.error; }))(operationResult.error);
return "break";

@@ -89,3 +93,3 @@ }

}
_subscriber.next && _subscriber.next(operationResult.value);
(_subscriber === null || _subscriber === void 0 ? void 0 : _subscriber.next) && _subscriber.next(operationResult.value);
};

@@ -98,3 +102,3 @@ var this_1 = this;

}
this._isComplete && _subscriber.complete && _subscriber.complete();
this._isComplete && (_subscriber === null || _subscriber === void 0 ? void 0 : _subscriber.complete) && _subscriber.complete();
};

@@ -125,8 +129,7 @@ Observable.prototype._computeValue = function (initValue) {

Observable.prototype._executeOperations = function (value, operators) {
var computedValue = this._computeValue.apply(this, __spreadArray([value], filterNonFunctions.apply(void 0, operators)));
var computedValue = this._computeValue.apply(this, __spreadArray([value], filterNonFunctions.apply(void 0, operators), false));
return computedValue;
};
Observable.DEFAULT_SUBSCRIBER = subscriberOf(function () { });
return Observable;
}());
export { Observable };

@@ -1,5 +0,5 @@

import { OnNext, Subscriber, Subscription, Types } from "../models";
import { OnNext, Subscriber, Subscription } from "../models";
import { OperationResult, OperatorFunction } from "../models/operator";
import { Observable } from "./observable";
export declare class PromiseObservable<T> extends Observable<T> implements Types.PromiseObservable<T> {
export declare class PromiseObservable<T> extends Observable<T> {
private promise;

@@ -6,0 +6,0 @@ constructor(promise: Promise<T>);

@@ -16,6 +16,10 @@ var __extends = (this && this.__extends) || (function () {

})();
var __spreadArray = (this && this.__spreadArray) || function (to, from) {
for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
to[j] = from[i];
return to;
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
if (ar || !(i in from)) {
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
ar[i] = from[i];
}
}
return to.concat(ar || Array.prototype.slice.call(from));
};

@@ -45,3 +49,3 @@ import { isFunction } from "../helpers/function.helper";

}
return fork.apply(void 0, __spreadArray([this], operations));
return fork.apply(void 0, __spreadArray([this], operations, false));
};

@@ -52,3 +56,3 @@ PromiseObservable.prototype.subscribe = function (subscriber) {

//TODO - TTO: might be useful not to assign a default one but rather a new empty one each time
subscriber = PromiseObservable.DEFAULT_SUBSCRIBER;
subscriber = subscriberOf(function () { });
}

@@ -62,3 +66,3 @@ if (!isFunction(subscriber) && !isInstanceOfSubscriber(subscriber)) {

this._subscribers.push(_subscriber);
var handler = function () { return _this.executeSubscriber(_subscriber, _this.innerSequence); };
var handler = function () { return _this.executeSubscriber(_this.innerSequence, _subscriber); };
this.promise.then(handler);

@@ -65,0 +69,0 @@ return new Subscription(function () {

@@ -1,5 +0,9 @@

var __spreadArray = (this && this.__spreadArray) || function (to, from) {
for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
to[j] = from[i];
return to;
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
if (ar || !(i in from)) {
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
ar[i] = from[i];
}
}
return to.concat(ar || Array.prototype.slice.call(from));
};

@@ -12,4 +16,4 @@ import { ObservableFork } from "../../../observable/observable-fork";

}
var rest = new (ObservableFork.bind.apply(ObservableFork, __spreadArray([void 0, obs], operators)))();
var rest = new (ObservableFork.bind.apply(ObservableFork, __spreadArray([void 0, obs], operators, false)))();
return rest;
};

@@ -1,9 +0,13 @@

var __spreadArray = (this && this.__spreadArray) || function (to, from) {
for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
to[j] = from[i];
return to;
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
if (ar || !(i in from)) {
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
ar[i] = from[i];
}
}
return to.concat(ar || Array.prototype.slice.call(from));
};
import { Observable } from "../../../observable/observable";
export var from = function (values) {
return new (Observable.bind.apply(Observable, __spreadArray([void 0], values)))();
return new (Observable.bind.apply(Observable, __spreadArray([void 0], values, false)))();
};

@@ -1,9 +0,13 @@

var __spreadArray = (this && this.__spreadArray) || function (to, from) {
for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
to[j] = from[i];
return to;
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
if (ar || !(i in from)) {
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
ar[i] = from[i];
}
}
return to.concat(ar || Array.prototype.slice.call(from));
};
import { MutableObservable } from "../../../observable/mutable-observable";
export var mutableFrom = function (values) {
return new (MutableObservable.bind.apply(MutableObservable, __spreadArray([void 0], values)))();
return new (MutableObservable.bind.apply(MutableObservable, __spreadArray([void 0], values, false)))();
};

@@ -1,5 +0,9 @@

var __spreadArray = (this && this.__spreadArray) || function (to, from) {
for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
to[j] = from[i];
return to;
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
if (ar || !(i in from)) {
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
ar[i] = from[i];
}
}
return to.concat(ar || Array.prototype.slice.call(from));
};

@@ -12,3 +16,3 @@ import { MutableObservable } from "../../../observable/mutable-observable";

}
return new (MutableObservable.bind.apply(MutableObservable, __spreadArray([void 0], values)))();
return new (MutableObservable.bind.apply(MutableObservable, __spreadArray([void 0], values, false)))();
};

@@ -1,5 +0,9 @@

var __spreadArray = (this && this.__spreadArray) || function (to, from) {
for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
to[j] = from[i];
return to;
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
if (ar || !(i in from)) {
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
ar[i] = from[i];
}
}
return to.concat(ar || Array.prototype.slice.call(from));
};

@@ -12,3 +16,3 @@ import { Observable } from "../../../observable/observable";

}
return new (Observable.bind.apply(Observable, __spreadArray([void 0], values)))();
return new (Observable.bind.apply(Observable, __spreadArray([void 0], values, false)))();
};

@@ -1,8 +0,10 @@

import { Types } from "../../../models";
import { OnNext, OperationResult, OperatorFunction, Subscriber, Subscription } from "../../../models";
import { Observable } from "../../../observable/observable";
export interface ProxyObservableFunction<T = never> extends Types.Observable<T> {
export interface ProxyObservableFunction<T = never> {
(...args: any): any;
asObservable: () => ProxyObservable<T>;
subscribe: (subscriber?: OnNext<T> | Subscriber<T> | undefined) => Subscription;
pipe: <U>(...operations: OperatorFunction<T, OperationResult<U>>[]) => Observable<U>;
}
declare class ProxyObservable<T = never> extends Observable<T> implements Types.Observable<T> {
declare class ProxyObservable<T = never> extends Observable<T> implements Observable<T> {
private proxy;

@@ -9,0 +11,0 @@ private constructor();

@@ -33,3 +33,3 @@ var __extends = (this && this.__extends) || (function () {

_this.innerSequence = [operationResult];
_this._subscribers.forEach(function (s) { return _this.executeSubscriber(s, _this.innerSequence); });
_this._subscribers.forEach(function (s) { return _this.executeSubscriber(_this.innerSequence, s); });
if (operationResult.isOperationError()) {

@@ -54,3 +54,3 @@ throw operationResult.error;

res.subscribe = function (subscriber) {
return instance.subscribe.apply(instance, [subscriber !== null && subscriber !== void 0 ? subscriber : ProxyObservable.DEFAULT_SUBSCRIBER]);
return instance.subscribe.apply(instance, [subscriber !== null && subscriber !== void 0 ? subscriber : void 0]);
};

@@ -57,0 +57,0 @@ res.pipe = instance.pipe.bind(instance);

@@ -1,4 +0,4 @@

export declare type HttpOptions = RequestInit & {
export type HttpOptions = RequestInit & {
type?: HttpResultOption;
};
export declare type HttpResultOption = 'text' | 'json' | 'blob';
export type HttpResultOption = 'text' | 'json' | 'blob';

@@ -1,1 +0,1 @@

var t={d:(r,e)=>{for(var n in e)t.o(e,n)&&!t.o(r,n)&&Object.defineProperty(r,n,{enumerable:!0,get:e[n]})},o:(t,r)=>Object.prototype.hasOwnProperty.call(t,r)},r={};t.d(r,{gC:()=>i,hX:()=>o,rM:()=>F,Dp:()=>O,iT:()=>T,dJ:()=>$,KJ:()=>u,UI:()=>p,Nl:()=>E,hL:()=>J,of:()=>j,IH:()=>c,d_:()=>P,wt:()=>f,qn:()=>H,bw:()=>a,C4:()=>s});var e,n=function(){function t(t,r,e){this._value=t,this._flag=r,this._error=e}return Object.defineProperty(t.prototype,"value",{get:function(){return this._value},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"flag",{get:function(){return this._flag},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"error",{get:function(){return this._error},enumerable:!1,configurable:!0}),t.prototype.isUnwrapSwitch=function(){return this._flag===e.UnwrapSwitch},t.prototype.isMustStop=function(){return this._flag===e.MustStop},t.prototype.isFilterNotMatched=function(){return this._flag===e.FilterNotMatched},t.prototype.isOperationError=function(){return this._flag===e.OperationError},t}();!function(t){t.UnwrapSwitch="UnwrapSwitch",t.MustStop="MustStop",t.FilterNotMatched="FilterNotMatched",t.OperationError="OperationError"}(e||(e={}));var o=function(t){return function(r){return new n(r,t(r)?void 0:e.FilterNotMatched)}},i=function(t){var r=!1;return function(i){return new n(i,(r=r||o(t)(i).isFilterNotMatched())?e.MustStop:void 0)}},u=function(t,r,e){return function(n){var i=o(t)(n),u=i.isFilterNotMatched()?null!=e?e:[]:r,c=u.shift();return c?u.reduce((function(t,r){return r(t.value)}),c(n)):i}},c=function(t){var r=!1;return function(o){return r?new n(o,e.MustStop):!t||t(o)?(r=!0,new n(o)):new n(o,e.FilterNotMatched)}},s=function(t){var r=!1;return function(i){return new n(i,(r=r||!o(t)(i).isFilterNotMatched())?e.MustStop:void 0)}},p=function(t){return function(r){return new n(t(r))}};function f(t){return function(r){return new n(t(r),e.UnwrapSwitch)}}var a=function(t){return function(r){return t(r),new n(r)}};function l(t){return"function"==typeof t}function h(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return t.filter((function(t){return l(t)}))}var b=function(){function t(t){this._unsubscribeCallback=t}return t.prototype.unsubscribe=function(){this._unsubscribeCallback&&this._unsubscribeCallback()},t}();function y(t){return!l(t)&&function(t){for(var r=[],e=1;e<arguments.length;e++)r[e-1]=arguments[e];return r.some((function(r){return void 0!==t[r]&&null!==t[r]&&l(t[r])}))}(t,"next","error","complete")}function v(t,r,e){var n={next:t,error:r,complete:e};if(!y(n))throw new Error("Please provide functions for next, error and complete");return n}new b;var w,_=function(){function t(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];this._subscribers=[],this._isComplete=!0,this._forks=[],this.innerSequence=t.map((function(t){return new n(t)}))}return Object.defineProperty(t.prototype,"innerSequence",{get:function(){return this._innerSequence},set:function(t){this._innerSequence=t},enumerable:!1,configurable:!0}),t.prototype.pipe=function(){for(var r=[],o=0;o<arguments.length;o++)r[o]=arguments[o];for(var i=new t,u=[],c=this.innerSequence,s=0,p=c.length;s<p&&!c[s].isMustStop();s++)try{var f=this._executeOperations(c[s].value,r);f.isFilterNotMatched()||u.push(f)}catch(t){u.push(new n(c[s].value,e.OperationError,t)),s=p}return i.innerSequence=u,i},t.prototype.subscribe=function(r){var e=this;if(void 0===r)return this.executeSubscriber(t.DEFAULT_SUBSCRIBER,this.innerSequence),new b;if(!l(r)&&!y(r))throw new Error("Please provide either a function or a Subscriber");var n=y(r)?r:v(r);return this._subscribers.push(n),this.executeSubscriber(n,this.innerSequence),new b((function(){return e._subscribers=e._subscribers.filter((function(t){return t!==r}))}))},t.prototype.executeSubscriber=function(t,r){for(var e=function(e,o){var i=r[e];return i.isOperationError()?(n._error=i.error,(t.error||function(){throw i.error})(i.error),"break"):i.isFilterNotMatched()?"continue":i.isMustStop()?"break":void(t.next&&t.next(i.value))},n=this,o=0,i=r.length;o<i&&"break"!==e(o);o++);this._isComplete&&t.complete&&t.complete()},t.prototype._computeValue=function(t){for(var r,o=[],i=1;i<arguments.length;i++)o[i-1]=arguments[i];for(var u=new n(t),c=0;c<o.length;c++)switch((u=o[c](u.value)).flag){case e.FilterNotMatched:case e.MustStop:c=o.length;break;case e.UnwrapSwitch:u=new n(null===(r=u.value.innerSequence[u.value.innerSequence.length-1])||void 0===r?void 0:r.value)}return u},t.prototype._executeOperations=function(t,r){return this._computeValue.apply(this,function(t,r){for(var e=0,n=r.length,o=t.length;e<n;e++,o++)t[o]=r[e];return t}([t],h.apply(void 0,r)))},t.DEFAULT_SUBSCRIBER=v((function(){})),t}(),O=function(t){return new(_.bind.apply(_,function(t,r){for(var e=0,n=r.length,o=t.length;e<n;e++,o++)t[o]=r[e];return t}([void 0],t)))},g=(w=function(t,r){return(w=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,r){t.__proto__=r}||function(t,r){for(var e in r)Object.prototype.hasOwnProperty.call(r,e)&&(t[e]=r[e])})(t,r)},function(t,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function e(){this.constructor=t}w(t,r),t.prototype=null===r?Object.create(r):(e.prototype=r.prototype,new e)}),S=function(t,r){for(var e=0,n=r.length,o=t.length;e<n;e++,o++)t[o]=r[e];return t},d=function(t){function r(){for(var r=[],e=0;e<arguments.length;e++)r[e]=arguments[e];var n=t.apply(this,r)||this;return n._preProcessOperations=[],n._isComplete=!1,n}return g(r,t),r.prototype.close=function(){return this._isComplete||(this._isComplete=!0,this._subscribers.filter((function(t){return t.complete})).forEach((function(t){t.complete()}))),this},r.prototype.compile=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];if(this._isComplete)return this;var e=this._buildNewSequence(this.innerSequence.filter((function(t){return!t.isOperationError()})).map((function(t){return t.value})),S(S([],t),this._preProcessOperations)).filter((function(t){return!t.isMustStop()})),n=e.findIndex((function(t){return t.isOperationError()}));return n>-1?(this.innerSequence=e.slice(0,n),this.next.apply(this,this.innerSequence.map((function(t){return t.value}))),this.innerSequence.push(e[n]),this._triggerExecution([e[n]],this._subscribers),this):(this._triggerExecution(this.innerSequence=e,this._subscribers),this)},r.prototype.next=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return this._isComplete||(this.innerSequence=this._buildNewSequence(t,this._preProcessOperations),this._triggerExecution(this.innerSequence,this._subscribers)),this},r.prototype.subscribe=function(e){return t.prototype.subscribe.call(this,null!=e?e:r.DEFAULT_SUBSCRIBER)},r.prototype._buildNewSequence=function(t,r){for(var o=[],i=0,u=t.length;i<u;i++)try{var c=this._executeOperations(t[i],r);if(c.isMustStop()){o.push(c);break}c.isFilterNotMatched()||o.push(c)}catch(r){this._error=r,o.push(new n(t[i],e.OperationError,r)),i=u}return o},r.prototype._triggerExecution=function(t,r){var e=this;r.forEach((function(r){return e.executeSubscriber(r,t)}))},r}(_),m=function(t,r){for(var e=0,n=r.length,o=t.length;e<n;e++,o++)t[o]=r[e];return t},E=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return new(d.bind.apply(d,m([void 0],t)))},x=function(t,r){for(var e=0,n=r.length,o=t.length;e<n;e++,o++)t[o]=r[e];return t},j=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return new(_.bind.apply(_,x([void 0],t)))};function P(){for(var t,r=[],e=0;e<arguments.length;e++)r[e]=arguments[e];var n=new d;return(t=n._preProcessOperations).push.apply(t,r),n}var M=function(){var t=function(r,e){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,r){t.__proto__=r}||function(t,r){for(var e in r)Object.prototype.hasOwnProperty.call(r,e)&&(t[e]=r[e])})(r,e)};return function(r,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function n(){this.constructor=r}t(r,e),r.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}}(),q=function(t){function r(r){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];var o=t.call(this)||this;return o.sourceObs$=r,o.subscriptions=[],o.operators=[],o._isClosed=!1,o.operators=e,o._isComplete=r._isComplete,o.sourceObs$._forks.push(o),o.sourceObs$.subscribe({next:function(t){o._subscribers.filter((function(t){return t.next})).forEach((function(r){var n=o._executeOperations(t,e);if(!n.isFilterNotMatched()&&!n.isMustStop())return r.next(n.value);n.isMustStop()&&o.close()}))},error:function(t){o._error=t,o._subscribers.filter((function(t){return t.error})).forEach((function(r){return r.error(t)}))},complete:function(){o._isComplete=!0,o.unsubscribe(),o._subscribers.filter((function(t){return t.complete})).forEach((function(t){return t.complete()}))}}),o}return M(r,t),Object.defineProperty(r.prototype,"innerSequence",{get:function(){return this.sourceObs$.innerSequence},set:function(t){this._innerSequence=t},enumerable:!1,configurable:!0}),r.prototype.subscribe=function(t){var o=this;if(void 0===t&&(t=r.DEFAULT_SUBSCRIBER),!l(t)&&!y(t))throw new Error("Please provide either a function or a Subscriber");var i=y(t)?t:v(t);this._subscribers.push(i);for(var u=[],c=this.sourceObs$.innerSequence,s=0,p=c.length;s<p;s++)try{if(c[s].isOperationError())throw c[s].error;u.push(this._executeOperations(c[s].value,this.operators))}catch(t){u.push(new n(c[s].value,e.OperationError,t)),s=p}return this._isClosed?i.complete&&i.complete():this.executeSubscriber(i,u),new b((function(){return o._subscribers=o._subscribers.filter((function(r){return r!==t}))}))},r.prototype.close=function(){this._isClosed=!0,this._forks.forEach((function(t){return t.close()})),this._subscribers.forEach((function(t){return t.complete&&t.complete()})),this.unsubscribe()},r.prototype.unsubscribe=function(){this.subscriptions.forEach((function(t){return t.unsubscribe()}))},r}(_),C=function(t,r){for(var e=0,n=r.length,o=t.length;e<n;e++,o++)t[o]=r[e];return t},F=function(t){for(var r=[],e=1;e<arguments.length;e++)r[e-1]=arguments[e];var n=new(q.bind.apply(q,C([void 0,t],r)));return n},U=function(){var t=function(r,e){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,r){t.__proto__=r}||function(t,r){for(var e in r)Object.prototype.hasOwnProperty.call(r,e)&&(t[e]=r[e])})(r,e)};return function(r,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function n(){this.constructor=r}t(r,e),r.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}}(),N=function(t){function r(r){var o=t.call(this)||this;return o.proxy=Object.assign(new Proxy(r,{apply:function(t,r,i){var u,c;try{c=new n(u=t.apply(r,i))}catch(t){c=new n(u,e.OperationError,t)}if(o.innerSequence=[c],o._subscribers.forEach((function(t){return o.executeSubscriber(t,o.innerSequence)})),c.isOperationError())throw c.error;return u}})),o}return U(r,t),r.create=function(t){var e=new r(t),n=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return e.proxy.apply(e,t)};return e.innerSequence=[],n.subscribe=function(t){return e.subscribe.apply(e,[null!=t?t:r.DEFAULT_SUBSCRIBER])},n.pipe=e.pipe.bind(e),n.asObservable=function(){return e},n},r}(_),T=function(t){return N.create(t)},k=function(){var t=function(r,e){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,r){t.__proto__=r}||function(t,r){for(var e in r)Object.prototype.hasOwnProperty.call(r,e)&&(t[e]=r[e])})(r,e)};return function(r,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function n(){this.constructor=r}t(r,e),r.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}}(),I=function(t,r){for(var e=0,n=r.length,o=t.length;e<n;e++,o++)t[o]=r[e];return t},B=function(t){function r(r){var o=t.call(this)||this;return o.promise=r.then((function(t){o.innerSequence.push(new n(t))})).catch((function(t){o.innerSequence.push(new n(void 0,e.OperationError,t))})),o}return k(r,t),r.prototype.pipe=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return F.apply(void 0,I([this],t))},r.prototype.subscribe=function(t){var e=this;if(void 0===t&&(t=r.DEFAULT_SUBSCRIBER),!l(t)&&!y(t))throw new Error("Please provide either a function or a Subscriber");var n=y(t)?t:v(t);return this._subscribers.push(n),this.promise.then((function(){return e.executeSubscriber(n,e.innerSequence)})),new b((function(){return e._subscribers=e._subscribers.filter((function(r){return r!==t}))}))},r}(_),R=function(){return(R=Object.assign||function(t){for(var r,e=1,n=arguments.length;e<n;e++)for(var o in r=arguments[e])Object.prototype.hasOwnProperty.call(r,o)&&(t[o]=r[o]);return t}).apply(this,arguments)},A=function(){return(A=Object.assign||function(t){for(var r,e=1,n=arguments.length;e<n;e++)for(var o in r=arguments[e])Object.prototype.hasOwnProperty.call(r,o)&&(t[o]=r[o]);return t}).apply(this,arguments)},L=function(){return(L=Object.assign||function(t){for(var r,e=1,n=arguments.length;e<n;e++)for(var o in r=arguments[e])Object.prototype.hasOwnProperty.call(r,o)&&(t[o]=r[o]);return t}).apply(this,arguments)},D=function(){return(D=Object.assign||function(t){for(var r,e=1,n=arguments.length;e<n;e++)for(var o in r=arguments[e])Object.prototype.hasOwnProperty.call(r,o)&&(t[o]=r[o]);return t}).apply(this,arguments)},$={get:function(t,r){void 0===r&&(r={type:"json"});var e=r.type,n=function(t,r){var e={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&r.indexOf(n)<0&&(e[n]=t[n]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(n=Object.getOwnPropertySymbols(t);o<n.length;o++)r.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(t,n[o])&&(e[n[o]]=t[n[o]])}return e}(r,["type"]);return new B(new Promise((function(r,o){fetch(t,R(R({},n),{method:"GET"})).then((function(t){if(!t.ok)throw Error(t.statusText);return t})).then((function(t){return r("text"===e?t.text():"blob"===e?t.blob():t.json())})).catch((function(t){return o(t)}))})))},post:function(t,r){void 0===r&&(r={type:"json"});var e=r.type,n=function(t,r){var e={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&r.indexOf(n)<0&&(e[n]=t[n]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(n=Object.getOwnPropertySymbols(t);o<n.length;o++)r.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(t,n[o])&&(e[n[o]]=t[n[o]])}return e}(r,["type"]);return new B(new Promise((function(r,o){fetch(t,A(A({},n),{method:"POST"})).then((function(t){if(!t.ok)throw Error(t.statusText);return t})).then((function(t){return r("text"===e?t.text():"blob"===e?t.blob():t.json())})).catch((function(t){return o(t)}))})))},put:function(t,r){void 0===r&&(r={type:"json"});var e=r.type,n=function(t,r){var e={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&r.indexOf(n)<0&&(e[n]=t[n]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(n=Object.getOwnPropertySymbols(t);o<n.length;o++)r.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(t,n[o])&&(e[n[o]]=t[n[o]])}return e}(r,["type"]);return new B(new Promise((function(r,o){fetch(t,L(L({},n),{method:"PUT"})).then((function(t){if(!t.ok)throw Error(t.statusText);return t})).then((function(t){return r("text"===e?t.text():"blob"===e?t.blob():t.json())})).catch((function(t){return o(t)}))})))},delete:function(t,r){void 0===r&&(r={type:"json"});var e=r.type,n=function(t,r){var e={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&r.indexOf(n)<0&&(e[n]=t[n]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(n=Object.getOwnPropertySymbols(t);o<n.length;o++)r.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(t,n[o])&&(e[n[o]]=t[n[o]])}return e}(r,["type"]);return new B(new Promise((function(r,o){fetch(t,D(D({},n),{method:"DELETE"})).then((function(t){if(!t.ok)throw Error(t.statusText);return t})).then((function(t){return r("text"===e?t.text():"blob"===e?t.blob():t.json())})).catch((function(t){return o(t)}))})))}},J=function(t){var r=0;return function(o){return++r===t?new n(o):new n(o,r<t?e.FilterNotMatched:e.MustStop)}},H=function(t){var r=0;return function(o){return++r>t?new n(o,e.MustStop):new n(o)}},K=r.gC,V=r.hX,X=r.rM,G=r.Dp,z=r.iT,Q=r.dJ,W=r.KJ,Y=r.UI,Z=r.Nl,tt=r.hL,rt=r.of,et=r.IH,nt=r.d_,ot=r.wt,it=r.qn,ut=r.bw,ct=r.C4;export{K as asLongAs,V as filter,X as fork,G as from,z as fromFunction,Q as http,W as ifElse,Y as map,Z as mutable,tt as nth,rt as of,et as once,nt as preProcess,ot as switchMap,it as take,ut as tap,ct as until};
var t={d:(r,e)=>{for(var n in e)t.o(e,n)&&!t.o(r,n)&&Object.defineProperty(r,n,{enumerable:!0,get:e[n]})},o:(t,r)=>Object.prototype.hasOwnProperty.call(t,r)},r={};t.d(r,{gC:()=>i,hX:()=>o,rM:()=>M,Dp:()=>_,iT:()=>N,dJ:()=>$,KJ:()=>u,UI:()=>a,Nl:()=>m,hL:()=>J,of:()=>x,IH:()=>c,d_:()=>j,wt:()=>p,qn:()=>L,bw:()=>f,C4:()=>s});var e,n=function(){function t(t,r,e){this._value=t,this._flag=r,this._error=e}return Object.defineProperty(t.prototype,"value",{get:function(){return this._value},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"flag",{get:function(){return this._flag},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"error",{get:function(){return this._error},enumerable:!1,configurable:!0}),t.prototype.isUnwrapSwitch=function(){return this._flag===e.UnwrapSwitch},t.prototype.isMustStop=function(){return this._flag===e.MustStop},t.prototype.isFilterNotMatched=function(){return this._flag===e.FilterNotMatched},t.prototype.isOperationError=function(){return this._flag===e.OperationError},t}();!function(t){t.UnwrapSwitch="UnwrapSwitch",t.MustStop="MustStop",t.FilterNotMatched="FilterNotMatched",t.OperationError="OperationError"}(e||(e={}));var o=function(t){return function(r){return new n(r,t(r)?void 0:e.FilterNotMatched)}},i=function(t){var r=!1;return function(i){return new n(i,(r=r||o(t)(i).isFilterNotMatched())?e.MustStop:void 0)}},u=function(t,r,e){return function(n){var i=o(t)(n),u=i.isFilterNotMatched()?null!=e?e:[]:r,c=u.shift();return c?u.reduce((function(t,r){return r(t.value)}),c(n)):i}},c=function(t){var r=!1;return function(o){return r?new n(o,e.MustStop):!t||t(o)?(r=!0,new n(o)):new n(o,e.FilterNotMatched)}},s=function(t){var r=!1;return function(i){return new n(i,(r=r||!o(t)(i).isFilterNotMatched())?e.MustStop:void 0)}},a=function(t){return function(r){return new n(t(r))}};function p(t){return function(r){return new n(t(r),e.UnwrapSwitch)}}var f=function(t){return function(r){return t(r),new n(r)}};function l(t){return"function"==typeof t}function h(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return t.filter((function(t){return l(t)}))}var b=function(){function t(t){this._unsubscribeCallback=t}return t.prototype.unsubscribe=function(){this._unsubscribeCallback&&this._unsubscribeCallback()},t}();function y(t){return!l(t)&&function(t){for(var r=[],e=1;e<arguments.length;e++)r[e-1]=arguments[e];return r.some((function(r){return void 0!==t[r]&&null!==t[r]&&l(t[r])}))}(t,"next","error","complete")}function v(t,r,e){var n={next:t,error:r,complete:e};if(!y(n))throw new Error("Please provide functions for next, error and complete");return n}new b;var w,O=function(){function t(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];this._subscribers=[],this._isComplete=!0,this._forks=[],this.innerSequence=t.map((function(t){return new n(t)}))}return Object.defineProperty(t.prototype,"innerSequence",{get:function(){return this._innerSequence},set:function(t){this._innerSequence=t},enumerable:!1,configurable:!0}),t.prototype.pipe=function(){for(var r=[],o=0;o<arguments.length;o++)r[o]=arguments[o];for(var i=new t,u=[],c=this.innerSequence,s=0,a=c.length;s<a&&!c[s].isMustStop();s++)try{var p=this._executeOperations(c[s].value,r);p.isFilterNotMatched()||u.push(p)}catch(t){u.push(new n(c[s].value,e.OperationError,t)),s=a}return i.innerSequence=u,i},t.prototype.subscribe=function(t){var r=this;if(void 0===t)return this.executeSubscriber(this.innerSequence),new b;if(!l(t)&&!y(t))throw new Error("Please provide either a function or a Subscriber");var e=y(t)?t:v(t);return this._subscribers.push(e),this.executeSubscriber(this.innerSequence,e),new b((function(){return r._subscribers=r._subscribers.filter((function(r){return r!==t}))}))},t.prototype.executeSubscriber=function(t,r){for(var e=function(e,o){var i=t[e];return i.isOperationError()?(n._error=i.error,((null==r?void 0:r.error)||function(){throw i.error})(i.error),"break"):i.isFilterNotMatched()?"continue":i.isMustStop()?"break":void((null==r?void 0:r.next)&&r.next(i.value))},n=this,o=0,i=t.length;o<i&&"break"!==e(o);o++);this._isComplete&&(null==r?void 0:r.complete)&&r.complete()},t.prototype._computeValue=function(t){for(var r,o=[],i=1;i<arguments.length;i++)o[i-1]=arguments[i];for(var u=new n(t),c=0;c<o.length;c++)switch((u=o[c](u.value)).flag){case e.FilterNotMatched:case e.MustStop:c=o.length;break;case e.UnwrapSwitch:u=new n(null===(r=u.value.innerSequence[u.value.innerSequence.length-1])||void 0===r?void 0:r.value)}return u},t.prototype._executeOperations=function(t,r){return this._computeValue.apply(this,function(t,r,e){if(e||2===arguments.length)for(var n,o=0,i=r.length;o<i;o++)!n&&o in r||(n||(n=Array.prototype.slice.call(r,0,o)),n[o]=r[o]);return t.concat(n||Array.prototype.slice.call(r))}([t],h.apply(void 0,r),!1))},t}(),_=function(t){return new(O.bind.apply(O,function(t,r,e){if(e||2===arguments.length)for(var n,o=0,i=r.length;o<i;o++)!n&&o in r||(n||(n=Array.prototype.slice.call(r,0,o)),n[o]=r[o]);return t.concat(n||Array.prototype.slice.call(r))}([void 0],t,!1)))},g=(w=function(t,r){return w=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,r){t.__proto__=r}||function(t,r){for(var e in r)Object.prototype.hasOwnProperty.call(r,e)&&(t[e]=r[e])},w(t,r)},function(t,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function e(){this.constructor=t}w(t,r),t.prototype=null===r?Object.create(r):(e.prototype=r.prototype,new e)}),d=function(t,r,e){if(e||2===arguments.length)for(var n,o=0,i=r.length;o<i;o++)!n&&o in r||(n||(n=Array.prototype.slice.call(r,0,o)),n[o]=r[o]);return t.concat(n||Array.prototype.slice.call(r))},S=function(t){function r(){for(var r=[],e=0;e<arguments.length;e++)r[e]=arguments[e];var n=t.apply(this,r)||this;return n._preProcessOperations=[],n._isComplete=!1,n}return g(r,t),r.prototype.close=function(){return this._isComplete||(this._isComplete=!0,this._subscribers.filter((function(t){return t.complete})).forEach((function(t){t.complete()}))),this},r.prototype.compile=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];if(this._isComplete)return this;var e=this._buildNewSequence(this.innerSequence.filter((function(t){return!t.isOperationError()})).map((function(t){return t.value})),d(d([],t,!0),this._preProcessOperations,!0)).filter((function(t){return!t.isMustStop()})),n=e.findIndex((function(t){return t.isOperationError()}));return n>-1?(this.innerSequence=e.slice(0,n),this.next.apply(this,this.innerSequence.map((function(t){return t.value}))),this.innerSequence.push(e[n]),this._triggerExecution([e[n]],this._subscribers),this):(this._triggerExecution(this.innerSequence=e,this._subscribers),this)},r.prototype.next=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return this._isComplete||(this.innerSequence=this._buildNewSequence(t,this._preProcessOperations),this._triggerExecution(this.innerSequence,this._subscribers)),this},r.prototype._buildNewSequence=function(t,r){for(var o=[],i=0,u=t.length;i<u;i++)try{var c=this._executeOperations(t[i],r);if(c.isMustStop()){o.push(c);break}c.isFilterNotMatched()||o.push(c)}catch(r){this._error=r,o.push(new n(t[i],e.OperationError,r)),i=u}return o},r.prototype._triggerExecution=function(t,r){var e=this;r.forEach((function(r){return e.executeSubscriber(t,r)}))},r}(O),m=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return new(S.bind.apply(S,function(t,r,e){if(e||2===arguments.length)for(var n,o=0,i=r.length;o<i;o++)!n&&o in r||(n||(n=Array.prototype.slice.call(r,0,o)),n[o]=r[o]);return t.concat(n||Array.prototype.slice.call(r))}([void 0],t,!1)))},x=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return new(O.bind.apply(O,function(t,r,e){if(e||2===arguments.length)for(var n,o=0,i=r.length;o<i;o++)!n&&o in r||(n||(n=Array.prototype.slice.call(r,0,o)),n[o]=r[o]);return t.concat(n||Array.prototype.slice.call(r))}([void 0],t,!1)))};function j(){for(var t,r=[],e=0;e<arguments.length;e++)r[e]=arguments[e];var n=new S;return(t=n._preProcessOperations).push.apply(t,r),n}var E=function(){var t=function(r,e){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,r){t.__proto__=r}||function(t,r){for(var e in r)Object.prototype.hasOwnProperty.call(r,e)&&(t[e]=r[e])},t(r,e)};return function(r,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function n(){this.constructor=r}t(r,e),r.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}}(),P=function(t){function r(r){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];var o=t.call(this)||this;return o.sourceObs$=r,o.subscriptions=[],o.operators=[],o._isClosed=!1,o.operators=e,o._isComplete=r._isComplete,o.sourceObs$._forks.push(o),o.sourceObs$.subscribe({next:function(t){o._subscribers.filter((function(t){return t.next})).forEach((function(r){var n=o._executeOperations(t,e);if(!n.isFilterNotMatched()&&!n.isMustStop())return r.next(n.value);n.isMustStop()&&o.close()}))},error:function(t){o._error=t,o._subscribers.filter((function(t){return t.error})).forEach((function(r){return r.error(t)}))},complete:function(){o._isComplete=!0,o.unsubscribe(),o._subscribers.filter((function(t){return t.complete})).forEach((function(t){return t.complete()}))}}),o}return E(r,t),Object.defineProperty(r.prototype,"innerSequence",{get:function(){return this.sourceObs$.innerSequence},set:function(t){this._innerSequence=t},enumerable:!1,configurable:!0}),r.prototype.subscribe=function(t){var r=this;if(void 0===t&&(t=v((function(){}))),!l(t)&&!y(t))throw new Error("Please provide either a function or a Subscriber");var o=y(t)?t:v(t);this._subscribers.push(o);for(var i=[],u=this.sourceObs$.innerSequence,c=0,s=u.length;c<s;c++)try{if(u[c].isOperationError())throw u[c].error;i.push(this._executeOperations(u[c].value,this.operators))}catch(t){i.push(new n(u[c].value,e.OperationError,t)),c=s}return this._isClosed?o.complete&&o.complete():this.executeSubscriber(i,o),new b((function(){return r._subscribers=r._subscribers.filter((function(r){return r!==t}))}))},r.prototype.close=function(){this._isClosed=!0,this._forks.forEach((function(t){return t.close()})),this._subscribers.forEach((function(t){return t.complete&&t.complete()})),this.unsubscribe()},r.prototype.unsubscribe=function(){this.subscriptions.forEach((function(t){return t.unsubscribe()}))},r}(O),M=function(t){for(var r=[],e=1;e<arguments.length;e++)r[e-1]=arguments[e];return new(P.bind.apply(P,function(t,r,e){if(e||2===arguments.length)for(var n,o=0,i=r.length;o<i;o++)!n&&o in r||(n||(n=Array.prototype.slice.call(r,0,o)),n[o]=r[o]);return t.concat(n||Array.prototype.slice.call(r))}([void 0,t],r,!1)))},q=function(){var t=function(r,e){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,r){t.__proto__=r}||function(t,r){for(var e in r)Object.prototype.hasOwnProperty.call(r,e)&&(t[e]=r[e])},t(r,e)};return function(r,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function n(){this.constructor=r}t(r,e),r.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}}(),C=function(t){function r(r){var o=t.call(this)||this;return o.proxy=Object.assign(new Proxy(r,{apply:function(t,r,i){var u,c;try{c=new n(u=t.apply(r,i))}catch(t){c=new n(u,e.OperationError,t)}if(o.innerSequence=[c],o._subscribers.forEach((function(t){return o.executeSubscriber(o.innerSequence,t)})),c.isOperationError())throw c.error;return u}})),o}return q(r,t),r.create=function(t){var e=new r(t),n=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return e.proxy.apply(e,t)};return e.innerSequence=[],n.subscribe=function(t){return e.subscribe.apply(e,[null!=t?t:void 0])},n.pipe=e.pipe.bind(e),n.asObservable=function(){return e},n},r}(O),N=function(t){return C.create(t)},A=function(){var t=function(r,e){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,r){t.__proto__=r}||function(t,r){for(var e in r)Object.prototype.hasOwnProperty.call(r,e)&&(t[e]=r[e])},t(r,e)};return function(r,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function n(){this.constructor=r}t(r,e),r.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}}(),k=function(t){function r(r){var o=t.call(this)||this;return o.promise=r.then((function(t){o.innerSequence.push(new n(t))})).catch((function(t){o.innerSequence.push(new n(void 0,e.OperationError,t))})),o}return A(r,t),r.prototype.pipe=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return M.apply(void 0,function(t,r,e){if(e||2===arguments.length)for(var n,o=0,i=r.length;o<i;o++)!n&&o in r||(n||(n=Array.prototype.slice.call(r,0,o)),n[o]=r[o]);return t.concat(n||Array.prototype.slice.call(r))}([this],t,!1))},r.prototype.subscribe=function(t){var r=this;if(void 0===t&&(t=v((function(){}))),!l(t)&&!y(t))throw new Error("Please provide either a function or a Subscriber");var e=y(t)?t:v(t);return this._subscribers.push(e),this.promise.then((function(){return r.executeSubscriber(r.innerSequence,e)})),new b((function(){return r._subscribers=r._subscribers.filter((function(r){return r!==t}))}))},r}(O),F=function(){return F=Object.assign||function(t){for(var r,e=1,n=arguments.length;e<n;e++)for(var o in r=arguments[e])Object.prototype.hasOwnProperty.call(r,o)&&(t[o]=r[o]);return t},F.apply(this,arguments)},T=function(){return T=Object.assign||function(t){for(var r,e=1,n=arguments.length;e<n;e++)for(var o in r=arguments[e])Object.prototype.hasOwnProperty.call(r,o)&&(t[o]=r[o]);return t},T.apply(this,arguments)},I=function(){return I=Object.assign||function(t){for(var r,e=1,n=arguments.length;e<n;e++)for(var o in r=arguments[e])Object.prototype.hasOwnProperty.call(r,o)&&(t[o]=r[o]);return t},I.apply(this,arguments)},U=function(){return U=Object.assign||function(t){for(var r,e=1,n=arguments.length;e<n;e++)for(var o in r=arguments[e])Object.prototype.hasOwnProperty.call(r,o)&&(t[o]=r[o]);return t},U.apply(this,arguments)},$={get:function(t,r){void 0===r&&(r={type:"json"});var e=r.type,n=function(t,r){var e={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&r.indexOf(n)<0&&(e[n]=t[n]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(n=Object.getOwnPropertySymbols(t);o<n.length;o++)r.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(t,n[o])&&(e[n[o]]=t[n[o]])}return e}(r,["type"]);return new k(new Promise((function(r,o){fetch(t,F(F({},n),{method:"GET"})).then((function(t){if(!t.ok)throw Error(t.statusText);return t})).then((function(t){return r("text"===e?t.text():"blob"===e?t.blob():t.json())})).catch((function(t){return o(t)}))})))},post:function(t,r){void 0===r&&(r={type:"json"});var e=r.type,n=function(t,r){var e={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&r.indexOf(n)<0&&(e[n]=t[n]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(n=Object.getOwnPropertySymbols(t);o<n.length;o++)r.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(t,n[o])&&(e[n[o]]=t[n[o]])}return e}(r,["type"]);return new k(new Promise((function(r,o){fetch(t,T(T({},n),{method:"POST"})).then((function(t){if(!t.ok)throw Error(t.statusText);return t})).then((function(t){return r("text"===e?t.text():"blob"===e?t.blob():t.json())})).catch((function(t){return o(t)}))})))},put:function(t,r){void 0===r&&(r={type:"json"});var e=r.type,n=function(t,r){var e={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&r.indexOf(n)<0&&(e[n]=t[n]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(n=Object.getOwnPropertySymbols(t);o<n.length;o++)r.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(t,n[o])&&(e[n[o]]=t[n[o]])}return e}(r,["type"]);return new k(new Promise((function(r,o){fetch(t,I(I({},n),{method:"PUT"})).then((function(t){if(!t.ok)throw Error(t.statusText);return t})).then((function(t){return r("text"===e?t.text():"blob"===e?t.blob():t.json())})).catch((function(t){return o(t)}))})))},delete:function(t,r){void 0===r&&(r={type:"json"});var e=r.type,n=function(t,r){var e={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&r.indexOf(n)<0&&(e[n]=t[n]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(n=Object.getOwnPropertySymbols(t);o<n.length;o++)r.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(t,n[o])&&(e[n[o]]=t[n[o]])}return e}(r,["type"]);return new k(new Promise((function(r,o){fetch(t,U(U({},n),{method:"DELETE"})).then((function(t){if(!t.ok)throw Error(t.statusText);return t})).then((function(t){return r("text"===e?t.text():"blob"===e?t.blob():t.json())})).catch((function(t){return o(t)}))})))}},J=function(t){var r=0;return function(o){return++r===t?new n(o):new n(o,r<t?e.FilterNotMatched:e.MustStop)}},L=function(t){var r=0;return function(o){return++r>t?new n(o,e.MustStop):new n(o)}},D=r.gC,H=r.hX,K=r.rM,V=r.Dp,X=r.iT,G=r.dJ,z=r.KJ,B=r.UI,Q=r.Nl,R=r.hL,W=r.of,Y=r.IH,Z=r.d_,tt=r.wt,rt=r.qn,et=r.bw,nt=r.C4;export{D as asLongAs,H as filter,K as fork,V as from,X as fromFunction,G as http,z as ifElse,B as map,Q as mutable,R as nth,W as of,Y as once,Z as preProcess,tt as switchMap,rt as take,et as tap,nt as until};
{
"name": "fleuvejs",
"version": "1.2.7",
"version": "1.2.8",
"description": "A simple JavaScript Library for Observables",

@@ -29,7 +29,7 @@ "main": "build/index.js",

"devDependencies": {
"@types/jest": "^26.0.23",
"@types/jest": "^27.5.2",
"exports-loader": "^3.0.0",
"jest": "^27.0.6",
"jest-fetch-mock": "^3.0.3",
"ts-jest": "^27.0.3",
"ts-jest": "^27.1.5",
"ts-loader": "^9.2.3",

@@ -36,0 +36,0 @@ "tsconfig-paths-webpack-plugin": "^3.5.1",

@@ -1,2 +0,1 @@

export * from "./models/types";
export * from "./operators";
export * from "./operator";
export * from "./subscription";
export * from "./types";
import { isFunction } from "../helpers/function.helper";
export class Subscription {
constructor(private _unsubscribeCallback?: UnsubscribeCallback) {}
unsubscribe(): void {
this._unsubscribeCallback && this._unsubscribeCallback();
}
constructor(private _unsubscribeCallback?: UnsubscribeCallback) {}
unsubscribe(): void {
this._unsubscribeCallback && this._unsubscribeCallback();
}
}

@@ -13,19 +13,35 @@

interface UnsubscribeCallback {
(): void
(): void;
}
export interface Subscriber<T = any> {
name?: string;
next?: OnNext<T>, error?: OnError, complete?: OnComplete
next?: OnNext<T>;
error?: OnError;
complete?: OnComplete;
}
export function isInstanceOfSubscriber(obj: any): obj is Subscriber {
function hasAtLeastOneOfTheseFieldsAsAFunction(obj: {[k: string]: any}, ...fields: string[]): boolean {
return fields.some(field => obj[field] !== undefined && obj[field] !== null && isFunction(obj[field]));
function hasAtLeastOneOfTheseFieldsAsAFunction(
obj: { [k: string]: any },
...fields: string[]
): boolean {
return fields.some(
(field) =>
obj[field] !== undefined &&
obj[field] !== null &&
isFunction(obj[field])
);
}
return !isFunction(obj) && hasAtLeastOneOfTheseFieldsAsAFunction(obj, 'next', 'error', 'complete');
return (
!isFunction(obj) &&
hasAtLeastOneOfTheseFieldsAsAFunction(obj, "next", "error", "complete")
);
}
export function subscriberOf<T>(next?: OnNext<T>, error?: OnError, complete?: OnComplete): Subscriber<T> {
const subscriber: Subscriber<T> = {next, error, complete};
export function subscriberOf<T>(
next?: OnNext<T>,
error?: OnError,
complete?: OnComplete
): Subscriber<T> {
const subscriber: Subscriber<T> = { next, error, complete };
if (!isInstanceOfSubscriber(subscriber)) {

@@ -37,18 +53,16 @@ throw new Error(`Please provide functions for next, error and complete`);

export interface OnNext<T> {
(t: T): void;
}
export interface OnError {
(err: Error): void
}
export interface OnComplete {
(): void
};
export interface OnNext<T> {
(t: T): void;
}
export interface SubscribeFunction<T> {
(subscriber: OnNext<T> | Subscriber<T>): Subscription;
}
export interface OnError {
(err: Error): void;
}
export interface OnComplete {
(): void;
}
export interface SubscribeFunction<T> {
(subscriber: OnNext<T> | Subscriber<T>): Subscription;
}

@@ -1,28 +0,28 @@

import { OperationResult, OperatorFunction } from "./operator";
import { SubscribeFunction } from "./subscription";
// import { OperationResult, OperatorFunction } from "./operator";
// import { SubscribeFunction } from "./subscription";
export namespace Types {
export interface Observable<T = never> {
pipe<U = any>(
...operations: OperatorFunction<T, OperationResult<U>>[]
): Observable<U>;
subscribe: SubscribeFunction<T>;
}
// export namespace Types {
// export interface Observable<T = never> {
// pipe<U = any>(
// ...operations: OperatorFunction<T, OperationResult<U>>[]
// ): Observable<U>;
// subscribe: SubscribeFunction<T>;
// }
export interface MutableObservable<T = never> extends Observable<T> {
next(...events: T[]): this;
compile(...operations: OperatorFunction<T, OperationResult<any>>[]): this;
close(): void;
}
// export interface MutableObservable<T = never> extends Observable<T> {
// next(...events: T[]): this;
// compile(...operations: OperatorFunction<T, OperationResult<any>>[]): this;
// close(): this;
// }
export interface ObservableFork<T = never> extends Observable<T> {
close(): void;
}
// export interface ObservableFork<T = never> extends Observable<T> {
// close(): void;
// }
export interface PromiseObservable<T = never> extends Observable<T> {}
}
// export interface PromiseObservable<T = never> extends Observable<T> {}
// }
export type Observable<T> = Types.Observable<T>;
export type MutableObservable<T> = Types.MutableObservable<T>;
export type ObservableFork<T> = Types.ObservableFork<T>;
export type PromiseObservable<T> = Types.PromiseObservable<T>;
// export type Observable<T> = Types.Observable<T>;
// export type MutableObservable<T> = Types.MutableObservable<T>;
// export type ObservableFork<T> = Types.ObservableFork<T>;
// export type PromiseObservable<T> = Types.PromiseObservable<T>;

@@ -7,3 +7,2 @@ import {

import { OnComplete, OnNext, Subscriber, Subscription } from "../models/subscription";
import { Types } from "../models/types";
import { Observable } from "./observable";

@@ -13,3 +12,2 @@

extends Observable<T>
implements Types.MutableObservable<T>
{

@@ -82,7 +80,2 @@ private _preProcessOperations: OperatorFunction<T, any>[] = [];

subscribe(subscriber?: Subscriber<T> | OnNext<T> | undefined): Subscription {
//TODO - TTO: might be useful not to assign a default one but rather a new empty one each time
return super.subscribe(subscriber ?? MutableObservable.DEFAULT_SUBSCRIBER);
}
private _buildNewSequence(

@@ -123,4 +116,4 @@ events: T[],

): void {
subscribers.forEach((s) => this.executeSubscriber(s, sequence));
subscribers.forEach((s) => this.executeSubscriber(sequence, s));
}
}

@@ -17,7 +17,5 @@ import { Observable } from "./observable";

} from "../models/subscription";
import { Types } from "../models";
export class ObservableFork<T>
extends Observable<T>
implements Types.ObservableFork<T>
{

@@ -37,3 +35,3 @@ private subscriptions: Subscription[] = [];

constructor(
private sourceObs$: Types.Observable<T>,
private sourceObs$: Observable<T>,
...operators: OperatorFunction<T, OperationResult<any>>[]

@@ -80,4 +78,3 @@ ) {

if (subscriber === undefined) {
//TODO - TTO: might be useful not to assign a default one but rather a new empty one each time
subscriber = ObservableFork.DEFAULT_SUBSCRIBER;
subscriber = subscriberOf(() => {});
}

@@ -121,3 +118,3 @@

} else {
this.executeSubscriber(_subscriber, newSequence);
this.executeSubscriber(newSequence, _subscriber);
}

@@ -124,0 +121,0 @@

@@ -14,9 +14,7 @@ import { filterNonFunctions, isFunction } from "../helpers/function.helper";

} from "../models/subscription";
import { ObservableFork } from "./observable-fork";
import {ObservableFork, Types} from '../models/types';
export class Observable<T = never> implements Types.Observable<T> {
export class Observable<T = never> {
protected static readonly DEFAULT_SUBSCRIBER = subscriberOf(() => {});
protected _innerSequence!: OperationResult<T>[];

@@ -72,3 +70,3 @@ protected _subscribers: Subscriber<T>[] = [];

if (subscriber === undefined) {
this.executeSubscriber(Observable.DEFAULT_SUBSCRIBER, this.innerSequence);
this.executeSubscriber(this.innerSequence);
return new Subscription();

@@ -85,3 +83,3 @@ }

this._subscribers.push(_subscriber);
this.executeSubscriber(_subscriber, this.innerSequence);
this.executeSubscriber(this.innerSequence, _subscriber);

@@ -95,4 +93,4 @@ return new Subscription(

protected executeSubscriber(
_subscriber: Subscriber<T>,
sequence: OperationResult<T>[]
sequence: OperationResult<T>[],
_subscriber?: Subscriber<T> | undefined,
): void {

@@ -103,3 +101,3 @@ for (let i = 0, l = sequence.length; i < l; i++) {

this._error = operationResult.error as Error;
(_subscriber.error || (() => {throw operationResult.error}))(operationResult.error as Error);
(_subscriber?.error || (() => {throw operationResult.error}))(operationResult.error as Error);
break;

@@ -116,7 +114,7 @@ }

_subscriber.next && _subscriber.next(operationResult.value);
_subscriber?.next && _subscriber.next(operationResult.value);
}
this._isComplete && _subscriber.complete && _subscriber.complete();
this._isComplete && _subscriber?.complete && _subscriber.complete();
}

@@ -123,0 +121,0 @@

@@ -8,3 +8,2 @@ import { isFunction } from "../helpers/function.helper";

Subscription,
Types,
} from "../models";

@@ -21,3 +20,2 @@ import {

extends Observable<T>
implements Types.PromiseObservable<T>
{

@@ -52,3 +50,3 @@ private promise: Promise<void>;

//TODO - TTO: might be useful not to assign a default one but rather a new empty one each time
subscriber = PromiseObservable.DEFAULT_SUBSCRIBER;
subscriber = subscriberOf(() => {})
}

@@ -65,3 +63,3 @@

const handler = () => this.executeSubscriber(_subscriber, this.innerSequence);
const handler = () => this.executeSubscriber(this.innerSequence, _subscriber);

@@ -68,0 +66,0 @@ this.promise.then(handler);

@@ -0,1 +1,2 @@

import { OperationResult, OperatorFunction } from "../../../models/operator";

@@ -2,0 +3,0 @@ import { Observable } from "../../../observable/observable";

@@ -1,10 +0,12 @@

import { OnNext, OperationResult, OperationResultFlag, Subscriber, Subscription, Types } from "../../../models";
import { OnNext, OperationResult, OperationResultFlag, OperatorFunction, Subscriber, Subscription } from "../../../models";
import { Observable } from "../../../observable/observable";
export interface ProxyObservableFunction<T = never> extends Types.Observable<T> {
export interface ProxyObservableFunction<T = never> {
(...args: any): any;
asObservable: () => ProxyObservable<T>;
subscribe: (subscriber?: OnNext<T> | Subscriber<T> | undefined) => Subscription;
pipe: <U>(...operations: OperatorFunction<T, OperationResult<U>>[]) => Observable<U>;
}
class ProxyObservable<T = never> extends Observable<T> implements Types.Observable<T> {
class ProxyObservable<T = never> extends Observable<T> implements Observable<T> {
private proxy: {(...args: any): T};

@@ -25,3 +27,3 @@

this.innerSequence = [operationResult];
this._subscribers.forEach((s) => this.executeSubscriber(s, this.innerSequence));
this._subscribers.forEach((s) => this.executeSubscriber(this.innerSequence, s));

@@ -43,3 +45,3 @@ if (operationResult.isOperationError()) {

res.subscribe = function(subscriber?: OnNext<T> | Subscriber<T> | undefined): Subscription {
return instance.subscribe.apply(instance, [subscriber ?? ProxyObservable.DEFAULT_SUBSCRIBER]);
return instance.subscribe.apply(instance, [subscriber ?? void 0]);
}

@@ -46,0 +48,0 @@ res.pipe = instance.pipe.bind(instance);

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc