Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
web3,
pollingInterval: 200,
});
const returnVal$ = createContractState$({
newBlock$,
artifact,
provider,
});
// tap observable to make sure it emitted a "0" and then a "5"
returnVal$
.pipe(
take(2),
toArray(),
tap(vals => {
const twoValues = vals.map(x =>
x.variables.storedData.value.toString(),
);
expect(twoValues).toEqual(["0", "5"]);
expect(vals[0]).toMatchSnapshot(stateMatcher);
expect(vals[1]).toMatchSnapshot(stateMatcher);
}),
finalize(() => {
expect.assertions(3);
done();
}),
)
.subscribe();
await contractInstance.methods.set(0).send({ from: accounts[0] });
await contractInstance.methods.set(5).send({ from: accounts[0] });
bufferAllResults,
map(({ spec, deprecations }) => {
const isRightVersion = spec.isVersionCompatible(config.get('pkg.version'));
const enabled = isRightVersion && spec.isEnabled(config);
return {
config,
spec,
deprecations,
enabledSpecs: enabled ? [spec] : [],
disabledSpecs: enabled ? [] : [spec],
invalidVersionSpecs: isRightVersion ? [] : [spec],
};
}),
// determine which plugins are disabled before actually removing things from the config
bufferAllResults,
tap(result => {
for (const spec of result.disabledSpecs) {
disableConfigExtension(spec, config);
}
})
)
)),
share()
// Trigger loading data form sortChange and page event
if (this.listOptions.enablePagination) {
this.cd.detectChanges()
merge(this.sort.sortChange, this.paginator.page)
.pipe(
tap(() => {
this.fetchDataQuery = this.getFetchDataQuery();
this.fetchData();
})
)
.subscribe();
}
else {
this.sort.sortChange
.pipe(
tap(() => {
this.fetchDataQuery = this.getFetchDataQuery();
this.fetchData();
})
)
.subscribe();
}
}
private _subscribeToClosingActions(): Subscription {
const firstStable = this._zone.onStable.asObservable().pipe(take(1));
const optionChanges = this.autocomplete.options.changes.pipe(
tap(() => {
this._positionStrategy.reapplyLastPosition();
}),
// Defer emitting to the stream until the next tick, because changing
// bindings in here will cause "changed after checked" errors.
delay(0),
);
// When the zone is stable initially, and when the option list changes...
return (
merge(firstStable, optionChanges)
.pipe(
// create a new stream of panelClosingActions, replacing any previous streams
// that were created, and flatten it so our stream only emits closing events...
switchMap(optionChange => {
this._resetActiveItem();
this.autocomplete._setVisibility();
private getTooltip(target: HTMLElement, ctx: AbsoluteRepoFilePosition): Observable {
return this.simpleProviderFns.fetchHover(ctx).pipe(
tap(data => {
if (isEmptyHover(data)) {
// short-cirtuit, no tooltip data
return
}
target.style.cursor = 'pointer'
target.classList.add('selection-highlight')
}),
map(data => ({ target, ctx, ...data }))
)
}
/**
private start(vm: VirtualMachine) {
const notificationId = this.jobsNotificationService.add('NOTIFICATIONS.VM.START_IN_PROGRESS');
this.update(vm, VmState.InProgress);
return this.vmService.command(vm, CSCommands.Start).pipe(
tap(runningVm => {
const message = 'NOTIFICATIONS.VM.START_DONE';
this.showNotificationsOnFinish(message, notificationId);
if (runningVm.password) {
this.showPasswordDialog(runningVm, 'VM_PASSWORD.PASSWORD_HAS_BEEN_SET');
}
}),
map((newVm: VirtualMachine) => new vmActions.UpdateVM(newVm)),
catchError((error: Error) => {
const message = 'NOTIFICATIONS.VM.START_FAILED';
this.dialogService.showNotificationsOnFail(error, message, notificationId);
return of(
new vmActions.VMUpdateError({
error,
vm,
state: VmState.Error,
}),
intercept(request: HttpRequest, next: HttpHandler): Observable> {
return next.handle(request).pipe(
tap(null, (err: HttpErrorResponse) => {
if (!(err.status === 401 && (err.message === '' || (err.url && err.url.includes('api/account'))))) {
this.eventManager.broadcast(new JhiEventWithContent('jhipsterMongodbSampleApplicationApp.httpError', err));
}
})
);
}
}
public enableField(appName: string, resource: Resource, version: Version): Observable {
const link = resource._links['enable'];
const url = this.apiUrl.buildUrl(link.href);
return HTTP.requestVersioned(this.http, link.method, url, version, {}).pipe(
map(({ payload }) => {
return parseSchemaWithDetails(payload.body);
}),
tap(() => {
this.analytics.trackEvent('Schema', 'FieldEnabled', appName);
}),
pretifyError('Failed to enable field. Please reload.'));
}
public canActivate(): Observable {
return this.currentLoadState.pipe(
filter(s => s !== 'uninitialized'),
withLatestFrom(this.currentToken),
map(([_, token]) => token.length > 0),
tap(result => {
if (!result) {
this.store.dispatch(new FailedToActivateRoute());
}
}),
);
}