Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export function applyConverter$(
datasets$: Datasets$,
converter$: Observable>
): Datasets$ {
return combineLatest(datasets$, converter$).pipe(
tag("applyConverter$/zipped"),
// Take latest output and merge with most recent
scan(
(acc: Datasets, [datasets, converter]) =>
applyConverterDatasets(acc, datasets, converter),
new Map()
),
shareReplay({ bufferSize: 1, refCount: true }),
tag("applyConverter$/scanned")
);
}
constructor(observable: Observable) {
observable.pipe(tag('ToPromise')).subscribe(next => {
const promise = this._promises.pop();
if (promise === undefined) {
this._values.push(next);
} else {
promise(next);
}
});
}
}
poll(interval = 10000, action: Function, getActionState: (request: RequestInfoState) => ActionState) {
return observableInterval(interval)
.pipe(
tag('poll'),
withLatestFrom(
this.entity$,
this.entityRequest$
),
map(([poll, resource, requestState]) => ({
resource,
updatingSection: getActionState(requestState)
})),
tap(({ resource, updatingSection }) => {
if (!updatingSection || !updatingSection.busy) {
action();
}
}),
filter(({ resource, updatingSection }) => {
return !!updatingSection;
}),
})),
currentPageNumber$,
).pipe(
map(([entities, pageSize, currentPage]) => {
const pages = this.pageSplitCache ? this.pageSplitCache : entities;
const data = splitCurrentPage(
pages,
pageSize,
currentPage
);
this.pageSplitCache = data.entities;
return (data.entities[data.index] || []) as T[];
}),
publishReplay(1),
refCount(),
tag('local-list')
);
}
const appGuid = app.metadata.guid;
const cfGuid = app.entity.cfGuid;
if (appState === 'STARTED') {
const appStatsEntity = entityCatalogue.getEntity(CF_ENDPOINT_TYPE, appStatsEntityType);
const actionBuilder = appStatsEntity.actionOrchestrator.getActionBuilder('get');
const getAction = actionBuilder(appGuid, cfGuid);
actions.push({
id: appGuid,
action: getAction
});
}
});
return actions;
}),
dispatchSequencer.sequence.bind(dispatchSequencer),
tag('stat-obs')
).subscribe();
this.subs = [statsSub];
}
entities = dataFunctions.reduce((value, fn) => {
return fn(value, paginationEntity);
}, entities);
}
const pages = this.splitClientPages(entities, paginationEntity.clientPagination.pageSize);
if (
paginationEntity.totalResults !== entities.length ||
paginationEntity.clientPagination.totalResults !== entities.length
) {
this.store.dispatch(new SetResultCount(this.entityKey, this.paginationKey, entities.length));
}
const pageIndex = paginationEntity.clientPagination.currentPage - 1;
return pages[pageIndex];
}),
shareReplay(1),
tag('local-list')
);
}
})),
currentPageNumber$,
).pipe(
map(([entities, pageSize, currentPage]) => {
const pages = this.pageSplitCache ? this.pageSplitCache : entities;
const data = splitCurrentPage(
pages,
pageSize,
currentPage
);
this.pageSplitCache = data.entities;
return (data.entities[data.index] || []) as T[];
}),
publishReplay(1),
refCount(),
tag('local-list')
);
}
constructor(values: Iterable) {
this.observable = this._observable.pipe(tag("ObservableSet"));
this.add(...values);
}
const appGuid = app.metadata.guid;
const cfGuid = app.entity.cfGuid;
if (appState === 'STARTED') {
const appStatsEntity = entityCatalogue.getEntity(STRATOS_ENDPOINT_TYPE, appStatsEntityType);
const actionBuilder = appStatsEntity.actionOrchestrator.getActionBuilder('get');
const action = actionBuilder(appGuid, cfGuid);
actions.push({
id: appGuid,
action
});
}
});
return actions;
}),
dispatchSequencer.sequence.bind(dispatchSequencer),
tag('stat-obs')
).subscribe();
this.subs = [statsSub];
}
page.forEach(app => {
const appState = app.entity.state;
const appGuid = app.metadata.guid;
const cfGuid = app.entity.cfGuid;
const dispatching = false;
if (appState === 'STARTED') {
actions.push({
id: appGuid,
action: new GetAppStatsAction(appGuid, cfGuid)
});
}
});
return actions;
}),
dispatchSequencer.sequence.bind(dispatchSequencer),
tag('stat-obs')).subscribe();
}
}