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 executeCellStream(
channels: Channels,
id: string,
message: ExecuteRequest,
contentRef: ContentRef
) {
const executeRequest = message;
// All the streams intended for all frontends
const cellMessages: Observable> = channels.pipe(childOf(executeRequest), share());
// All the payload streams, intended for one user
const payloadStream = cellMessages.pipe(payloads());
const cellAction$ = merge(
payloadStream.pipe(
map((payload: PayloadMessage) =>
actions.acceptPayloadMessage({ id, payload, contentRef })
)
),
// All actions for updating cell status
cellMessages.pipe(
kernelStatuses() as any,
map((status: string) =>
actions.updateCellStatus({ id, status, contentRef })
)
),
contentRef: ContentRef
) {
if (!channels || !channels.pipe) {
return throwError(new Error("kernel not connected"));
}
const executeRequest = message;
// All the streams intended for all frontends
const cellMessages: Observable> = channels.pipe(childOf(executeRequest), share());
// All the payload streams, intended for one user
const payloadStream = cellMessages.pipe(payloads());
const cellAction$ = merge(
payloadStream.pipe(
map((payload: PayloadMessage) =>
actions.acceptPayloadMessage({ id, payload, contentRef })
)
),
// All actions for updating cell status
cellMessages.pipe(
kernelStatuses() as any,
map((status: string) =>
actions.updateCellStatus({ id, status, contentRef })
)
),
contentRef: ContentRef
) {
if (!channels || !channels.pipe) {
return throwError(new Error("kernel not connected"));
}
const executeRequest = message;
// All the streams intended for all frontends
const cellMessages = channels.pipe(
childOf(executeRequest),
share()
);
// All the payload streams, intended for one user
const payloadStream = cellMessages.pipe(payloads());
const cellAction$ = merge(
payloadStream.pipe(
map(payload => actions.acceptPayloadMessage({ id, payload, contentRef }))
),
// All actions for updating cell status
cellMessages.pipe(
kernelStatuses(),
map(status => actions.updateCellStatus({ id, status, contentRef }))
),
// Update the input numbering: `[ ]`
cellMessages.pipe(
executionCounts(),
map(ct => actions.updateCellExecutionCount({ id, value: ct, contentRef }))