JupyterLab utilities for API communication and metadata management in Elyra extensions
npx @tessl/cli install tessl/npm-elyra--application@1.5.0@elyra/application provides essential utility classes and services for the Elyra JupyterLab extension ecosystem, focusing on API communication, metadata management, and notebook parsing capabilities. It serves as a foundational dependency for other Elyra packages that need to communicate with backend services, manage configuration metadata, or handle user interactions in the JupyterLab environment.
npm install @elyra/applicationimport { NotebookParser, FrontendServices, RequestHandler, IDictionary } from "@elyra/application";For CommonJS:
const { NotebookParser, FrontendServices, RequestHandler, IDictionary } = require("@elyra/application");Note: This package requires JupyterLab dependencies. In a JupyterLab extension context, you'll also need:
import { Dialog } from '@jupyterlab/apputils';
import { ServerConnection } from '@jupyterlab/services';import { RequestHandler, FrontendServices, NotebookParser } from "@elyra/application";
// Make HTTP requests to Jupyter Lab server
const response = await RequestHandler.makeGetRequest('elyra/schema/code-snippets', false);
// Get metadata from Elyra API
const metadata = await FrontendServices.getMetadata('code-snippets');
// Parse notebook for environment variables
const envVars = NotebookParser.getEnvVars(notebookJsonString);@elyra/application is built around three core components:
Low-level HTTP request abstraction for communicating with the Jupyter Lab server. Provides GET, POST, PUT, and DELETE methods with built-in error handling and user feedback dialogs.
class RequestHandler {
static makeGetRequest(requestPath: string, longRequest: boolean): Promise<any>;
static makePostRequest(requestPath: string, requestBody: any, longRequest: boolean): Promise<any>;
static makePutRequest(requestPath: string, requestBody: any, longRequest: boolean): Promise<any>;
static makeDeleteRequest(requestPath: string, longRequest: boolean): Promise<any>;
static makeServerRequest(requestPath: string, requestInit: RequestInit, longRequest: boolean): Promise<any>;
}High-level service methods for interacting with Elyra's schema and metadata APIs. Provides CRUD operations for metadata management and schema retrieval with caching.
class FrontendServices {
static noMetadataError(namespace: string): Promise<Dialog.IResult<any>>;
static getMetadata(namespace: string): Promise<any>;
static postMetadata(namespace: string, requestBody: any): Promise<any>;
static putMetadata(namespace: string, name: string, requestBody: any): Promise<any>;
static deleteMetadata(namespace: string, name: string): Promise<any>;
static getSchema(namespace: string): Promise<any>;
static getAllSchema(): Promise<any>;
}Utilities for analyzing Jupyter notebook content and extracting metadata like environment variables used in notebook cells.
class NotebookParser {
static getEnvVars(notebookStr: string): string[];
static findInCode(code: string, regex: RegExp): string[][];
}
interface IDictionary<T> {
[key: string]: T;
}interface IDictionary<T> {
[key: string]: T;
}