Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
// Ensure we have at least one connected cf
filter(cfs => {
for (let i = 0; i < cfs.length; i++) {
if (cfs[i].connectionStatus === 'connected') {
return true;
}
}
return false;
}),
first(),
map((endpoints: EndpointModel[]) => {
return Object.values(endpoints).sort((a: EndpointModel, b: EndpointModel) => a.name.localeCompare(b.name));
})
),
loading$: this.allOrgsLoading$,
select: new BehaviorSubject(undefined)
};
}
private popperInstance: Popper;
private pattern: string;
/** The class that traps and manages focus within the dialog. */
private focusTrap: FocusTrap;
set open(open: boolean) {
this._open.next(open);
}
get open() {
return this._open.value;
}
private _open = new BehaviorSubject(false);
private _value: string | null = null;
// Calendar date
date: Date;
constructor(private element: ElementRef, private renderer: Renderer2,
private cd: ChangeDetectorRef, private hostService: HostService,
private adapter: NglDateAdapter, @Inject(DOCUMENT) private document: any,
@Optional() private nglModal: NglModal,
private _viewContainerRef: ViewContainerRef,
private componentFactoryResolver: ComponentFactoryResolver,
private appRef: ApplicationRef,
private injector: Injector,
private focusTrapFactory: FocusTrapFactory) {
this.renderer.addClass(this.element.nativeElement, 'slds-form-element');
function RxReplicationState(collection) {
var _this = this;
this._subs = [];
this.collection = collection;
this._pouchEventEmitterObject = null;
this._subjects = {
change: new _rxjs.Subject(),
docs: new _rxjs.Subject(),
denied: new _rxjs.Subject(),
active: new _rxjs.BehaviorSubject(false),
complete: new _rxjs.BehaviorSubject(false),
error: new _rxjs.Subject()
}; // create getters
Object.keys(this._subjects).forEach(function (key) {
Object.defineProperty(_this, key + '$', {
get: function get() {
return this._subjects[key].asObservable();
}
});
});
}
import { SeaClient } from '../infra/seaClient'
import { clientId, clientSecret, restEndpoint, wsEndpoint, endpoint } from '../config'
const USER_TOKEN_KEY = 'userToken'
export class AuthBloc {
// Input Controllers
private _linkToSignInURL$ = new Subject()
private _linkToAuthzURL$ = new Subject()
private _authorizeWithCode$ = new Subject()
private _signOut$ = new Subject()
// Output Controllers
private _seaClient$ = new BehaviorSubject(undefined)
private _loading$ = new BehaviorSubject(true)
private _authorizing$ = new BehaviorSubject(false)
private _invalidCodeError$ = new Subject()
// Inputs
get linkToSignInURL$(): Observer {
return this._linkToSignInURL$
}
get linkToAuthzURL$(): Observer {
return this._linkToAuthzURL$
}
get authorizeWithCode$(): Observer {
return this._authorizeWithCode$
}
get signOut$(): Observer {
return this._signOut$
}
providers: [
{provide: ComponentFixtureAutoDetect, useValue: true},
{provide: Damaged, useClass: DamagedMock},
{provide: Extend, useClass: ExtendMock},
{provide: GuestMode, useClass: GuestModeMock},
{provide: Lost, useClass: LostMock},
{provide: Unenroll, useClass: UnenrollMock},
],
})
export class SharedMocksModule {
}
/** Mock of service to interact with the animation menu between components. */
@Injectable()
export class AnimationMenuServiceMock {
playbackRate = new BehaviorSubject(100);
/**
* Set the animation speed in Chrome Storage.
* @param value The value to store for animationSpeed in Chrome Storage.
*/
setAnimationSpeed(value: number) {
this.playbackRate.next(value);
}
/** Gets the animation speed. */
getAnimationSpeed(): Observable {
return this.playbackRate.asObservable();
}
}
/**
public getLoggedInUser() {
if (this.loggedInUser == null) {
this.loggedInUser = new BehaviorSubject(null);
this.dataService.getSingle('users', 'me')
.subscribe(a => this.loggedInUser.next(a), e => this.loggedInUser.error(e));
}
return this.loggedInUser.asObservable();
}
function setVariables() {
getActiveBehavior = new BehaviorSubject('');
getConsentBehavior = new BehaviorSubject([{}]);
isConsentGivenValue = true;
routerEventsBehavior = new BehaviorSubject(
new NavigationStart(0, 'test.com', 'popstate')
);
orderEntryBehavior = new ReplaySubject();
cartBehavior = new ReplaySubject();
consentsService = {
getConsent: () => getConsentBehavior,
isConsentGiven: () => isConsentGivenValue,
};
router = {
events: routerEventsBehavior,
};
baseSiteService = {
getActive: () => getActiveBehavior,
};
cartService = {
getEntries: () => orderEntryBehavior,
constructor() {
when(this.mockedActivatedRoute.params).thenReturn(of({ projectId: 'project01' }));
when(this.mockedNoticeService.isLoading).thenCall(() => this.isLoading);
this.paratectProjects$ = new BehaviorSubject([
{
paratextId: 'paratextId01',
name: 'ParatextP1',
languageTag: 'qaa',
languageName: 'unspecified',
isConnectable: true
},
{
paratextId: 'paratextId02',
name: 'ParatextP2',
languageTag: 'qaa',
languageName: 'unspecified',
isConnectable: true
}
]);
when(this.mockedParatextService.getProjects()).thenReturn(this.paratectProjects$);
import { Injectable } from '@angular/core';
import { BehaviorSubject, Observable } from 'rxjs';
import { OneSell } from '../interfaces/sell.interface';
import { sells } from './sells.data';
import { map } from 'rxjs/operators';
@Injectable({
providedIn: 'root',
})
export class SellService {
private sells$: BehaviorSubject = new BehaviorSubject(sells);
public getSells(): Observable {
return this.sells$.asObservable().pipe(map(this.sellsDeepCopy.bind(this)));
}
public addSell(sell: OneSell): void {
this.sells$.next([sell, ...this.sells$.getValue()]);
}
public getOneSell(id: string): Observable {
return this.sells$.pipe(
map(sells => sells.find(s => s.id === id)),
map(this.sellDeepCopy),
);
}
beforeEach(() => {
subs = [];
favoritesSavedData = new BehaviorSubject([]);
armAccountSpy = {
accounts: new BehaviorSubject(List([armAccount1, armAccount2])),
get: jasmine.createSpy("armGet").and.callFake((id) => {
if (id in armAccounts) {
return of(armAccounts[id]);
} else {
return throwError(new ServerError({ status: 404 } as any));
}
}),
};
localAccountSpy = {
accounts: new BehaviorSubject(List([localAccount1, localAccount2])),
get: jasmine.createSpy("localGet").and.callFake((id) => {
if (id in localAccounts) {
return of(localAccounts[id]);
} else {