@datalayer/core
Version:
[](https://datalayer.io)
112 lines (111 loc) • 4.86 kB
TypeScript
import type { Constructor } from '../utils/mixins';
import { NotebookDTO } from '../../models/NotebookDTO';
import { LexicalDTO } from '../../models/LexicalDTO';
import { SpaceDTO } from '../../models/SpaceDTO';
import { HealthCheck } from '../../models/HealthCheck';
/** Options for content loading with CDN support. */
export interface ContentLoadingOptions {
/** Whether to try CDN first before API (default: true) */
preferCDN?: boolean;
/** CDN base URL (default: https://cdn.datalayer.run) */
cdnBaseUrl?: string;
}
/** Spacer mixin providing workspace and content management. */
export declare function SpacerMixin<TBase extends Constructor>(Base: TBase): {
new (...args: any[]): {
/**
* Get all workspaces for the authenticated user.
* @returns Array of Space instances
*/
getMySpaces(): Promise<SpaceDTO[]>;
/**
* Create a new workspace.
* @param name - Space name
* @param description - Space description
* @param variant - Space variant type
* @param spaceHandle - Unique handle for the space
* @param organizationId - Organization ID
* @param seedSpaceId - Seed space ID for initialization
* @param isPublic - Whether the space is public
* @returns Created Space instance
*/
createSpace(name: string, description: string, variant: string, spaceHandle: string, organizationId: string, seedSpaceId: string, isPublic: boolean): Promise<SpaceDTO>;
/**
* Create a new notebook.
* @param spaceId - ID of the space to create the notebook in
* @param name - Name of the notebook
* @param description - Description of the notebook
* @param file - Optional file for notebook content
* @returns Created Notebook instance
*/
createNotebook(spaceId: string, name: string, description: string, file?: File | Blob): Promise<NotebookDTO>;
/**
* Get a notebook by ID.
* @param id - Notebook ID
* @returns Notebook instance
*/
getNotebook(id: string): Promise<NotebookDTO>;
/**
* Update a notebook.
* @param id - Notebook ID
* @param name - Optional new name for the notebook
* @param description - Optional new description for the notebook
* @returns Updated Notebook instance
*/
updateNotebook(id: string, name?: string, description?: string): Promise<NotebookDTO>;
/**
* Create a new lexical document.
* @param spaceId - ID of the space to create the lexical document in
* @param name - Name of the lexical document
* @param description - Description of the lexical document
* @param file - Optional file for document content
* @returns Created Lexical instance
*/
createLexical(spaceId: string, name: string, description: string, file?: File | Blob): Promise<LexicalDTO>;
/**
* Get a lexical document by ID.
* @param id - Document ID
* @returns Lexical instance
*/
getLexical(id: string): Promise<LexicalDTO>;
/**
* Update a lexical document.
* @param id - Document ID
* @param name - Optional new name for the lexical document
* @param description - Optional new description for the lexical document
* @returns Updated Lexical instance
*/
updateLexical(id: string, name?: string, description?: string): Promise<LexicalDTO>;
/**
* Get the items of a space as model instances.
* @param spaceId - Space ID
* @returns Array of Notebook and Lexical model instances
*/
getSpaceItems(spaceId: string): Promise<(NotebookDTO | LexicalDTO)[]>;
/**
* Get a single item from a space.
* @param itemId - Item ID to retrieve
* @returns Notebook or Lexical model instance
* @throws Error if item not found
*/
getSpaceItem(itemId: string): Promise<NotebookDTO | LexicalDTO>;
/**
* Delete an item from a space.
* @param itemId - Item ID to delete
* @throws Error if deletion fails
*/
deleteSpaceItem(itemId: string): Promise<void>;
getContent(itemId: string): Promise<any>;
/**
* Check the health status of the Spacer service.
* Performs a lightweight check to verify service accessibility.
*
* @returns Health check result with status and response time
*/
checkSpacerHealth(): Promise<HealthCheck>;
/**
* Get collaboration session ID for a document
*/
getCollaborationSessionId(documentId: string): Promise<string>;
};
} & TBase;