How to use the @nteract/messaging.createExecuteRequest function in @nteract/messaging

To help you get started, we’ve selected a few @nteract/messaging examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github nteract / nteract / packages / epics / src / execute.ts View on Github external
if (!model || model.type !== "notebook") {
            return empty();
          }

          const cell = selectors.notebook.cellById(model, {
            id
          });
          if (!cell) {
            return empty();
          }

          // We only execute code cells
          if ((cell as any).get("cell_type") === "code") {
            const source = cell.get("source", "");

            const message = createExecuteRequest(source);

            return createExecuteCellStream(
              action$,
              state,
              message,
              id,
              action.payload.contentRef
            ).pipe(
              catchError((error, source) =>
                merge(
                  of(
                    actions.executeFailed({
                      error,
                      contentRef: action.payload.contentRef
                    })
                  ),
github nteract / nteract / packages / epics / src / jupyter / generic / execution / notebook.ts View on Github external
if (!model || model.type !== "notebook") {
        return empty();
      }

      const cell = selectors.notebook.cellById(model, {
        id
      });
      if (!cell) {
        return empty();
      }

      // We only execute code cells
      if ((cell as any).get("cell_type") === "code") {
        const source = cell.get("source", "");

        const message = createExecuteRequest(source);

        return of(actions.sendExecuteRequest());
      }
      return empty();
    })
  );
github nteract / nteract / packages / core / src / epics / execute.js View on Github external
return empty();
          }

          const cell = selectors.notebook.cellById(model, { id });
          if (!cell) {
            return empty();
          }

          // We only execute code cells
          if (cell.get("cell_type") !== "code") {
            return empty();
          }

          const source = cell.get("source", "");

          const message = createExecuteRequest(source);

          return createExecuteCellStream(
            action$,
            state,
            message,
            id,
            action.payload.contentRef
          ).pipe(
            catchError((error, source) =>
              merge(
                of(
                  actions.executeFailed({
                    error,
                    contentRef: action.payload.contentRef
                  })
                ),
github nteract / nteract / packages / core / __tests__ / epics / execute-spec.js View on Github external
byRef: Immutable.Map({
                fake: stateModule.makeRemoteKernelRecord({
                  channels,
                  status: "connected"
                })
              })
            })
          })
        }),
        app: {
          notificationSystem: { addNotification: jest.fn() }
        }
      }
    };
    const action$ = ActionsObservable.from([]);
    const message = createExecuteRequest("source");

    const observable = createExecuteCellStream(
      action$,
      state$.value,
      message,
      "id"
    );
    const actionBuffer = [];
    observable.subscribe(x => actionBuffer.push(x), err => done.fail(err));
    expect(actionBuffer).toEqual([
      actions.sendExecuteRequest({ id: "id", message })
    ]);
    done();
  });
});
github nteract / nteract / packages / epics / __tests__ / execute.spec.ts View on Github external
byRef: Immutable.Map({
                fake: stateModule.makeRemoteKernelRecord({
                  channels,
                  status: "connected"
                })
              })
            })
          })
        }),
        app: {
          notificationSystem: { addNotification: jest.fn() }
        }
      }
    };
    const action$ = ActionsObservable.from([]);
    const message = createExecuteRequest("source");

    const observable = createExecuteCellStream(
      action$,
      state$.value,
      message,
      "id",
      "fakeContentRef"
    );
    const actionBuffer = [];
    observable.subscribe(x => actionBuffer.push(x), err => done.fail(err));
    expect(actionBuffer).toEqual([
      actions.sendExecuteRequest({
        id: "id",
        message,
        contentRef: "fakeContentRef"
      })