Interface DesktopBeta

Interface for desktop actions.

interface Desktop {
    addAttachment: ((entity: WorkspaceItem<any>, file?: WorkspaceItem<any>) => void);
    addComment: ((about: Entity, comment: AddCommentParams) => Promise<Entity>);
    addToFocusList: ((entities: Entity[], type?: "group" | "single", tabName?: string) => Promise<FocusListItem[]>);
    addWatchIntent: ((entity: Entity, watcher: Watcher) => Promise<Entity>);
    applyTag: ((os_workspace: string, tag: TagAttributes | OsTag, entity: Entity | Entity[]) => Promise<void>);
    callAppService: ((props: AppServiceCallProps) => Promise<any>);
    clearToast: ((id: string) => Promise<void>);
    closeTab: ((props: ShowTabProps) => Promise<void>);
    closeWorkspace: ((ws: WorkspaceIdentifier<any>) => Promise<void>);
    connect: ((relationship: string | Relationship, from: Entity, to: Entity, os_workspace?: string) => Promise<WorkspaceItem<any>>);
    copy: ((source: WorkspaceItem<any>, target: WorkspaceItem<any>, options?: CopyOptions) => Promise<WorkspaceItem<any>[]>);
    createWorkspace: ((name: string) => Promise<WorkspaceItem<any>>);
    delete: ((item: WorkspaceRecordIdentifier | WorkspaceRecordIdentifier[], recurse?: boolean) => Promise<void>);
    delete_local_concept_records: ((workspace_id: string, base_concept: string) => Promise<void>);
    delete_workspace_records: ((workspace_id: string) => Promise<void>);
    deployApp: ((app: WorkspaceItem<any> | App, initialSecrets?: {
        [key: string]: string;
    }) => Promise<WorkspaceItem<any>>);
    export: ((item: WorkspaceItem<any> | WorkspaceItem<any>[], options?: ExportOptions) => Promise<void>);
    extractEntities: ((text: string, options?: ExtractEntitiesOptions) => Promise<Entity[]>);
    failedWorkspaceModal: undefined | Promise<OS_CONFIRM_MODAL_RESPONSE>;
    getActiveWorkspace: ((prompt?: boolean) => Promise<undefined | string>);
    getApp: ((name: string) => Promise<undefined | WorkspaceItem<any>>);
    getAttachment: (<T>(entity: Entity, options?: GetAttachmentOptions<T>) => Promise<T>);
    getAvailableTags: ((entity: Entity, workspace?: string) => Promise<OsTag[]>);
    getConfigFiles: ((name: string) => Promise<WorkspaceItem<any>[]>);
    getFilesTree: ((workspace_or_folder: WorkspaceItem<any>, options?: FileTreeOptions) => Promise<WorkspaceItem<any>[]>);
    getFocusList: (() => Promise<FocusListItem[]>);
    getImages: ((entity: Entity) => Promise<Entity[]>);
    getItem: (<T>(ws: WorkspaceIdentifier<T>) => Promise<WorkspaceItem<T>>);
    getItems: ((ws: WorkspaceIdentifier<any>[]) => Promise<WorkspaceItem<any>[]>);
    getJSONSchema: ((concept: string) => Promise<{
        schema: string;
        schemaUI: string;
    }>);
    getOntology: (() => Promise<Ontology>);
    getOpenWorkspaceIds: (() => Promise<string[]>);
    getOpenWorkspaces: (() => Promise<Workspace[]>);
    getPasteContext: ((options: PasteContextOptions) => Promise<Entity[]>);
    getSearchResults: ((params: undefined | string | SearchProps, enableSelection?: boolean) => Promise<undefined | Entity[]>);
    getStyler: ((name: string, context: DesktopStylerContext) => Promise<Styler>);
    getStylerOptions: (() => Promise<StylerOption[]>);
    getTags: ((entity: Entity) => Promise<TagWithRelationship[]>);
    getTemplate: ((name: string | Entity | ((template: SavedTemplate) => boolean), defaultTemplate?: string) => Promise<SavedTemplate>);
    getTemplates: ((layout?: string | ((template: SavedTemplate) => boolean)) => Promise<SavedTemplate[]>);
    getUser: (() => Promise<UserProfile>);
    getWorkspace: ((ws: WorkspaceIdentifier<any>) => Promise<undefined | Workspace>);
    getWorkspacePermission: ((os_worpsaces: string[]) => Promise<{
        [os_workspace: string]: WorkspacePermission;
    }>);
    handleFailedWorkspace: ((wsuuid: string) => Promise<OS_CONFIRM_MODAL_RESPONSE>);
    import: ((items: any[]) => Promise<void>);
    importZip: ((file: File, options?: ImportZipOptions) => Promise<void>);
    internalGetIconCode: ((x: string | Concept | Entity, defaultIcon?: string) => Promise<string>);
    listAllWorkspaces: ((permissions?: WorkspacePermissionValue) => Promise<WorkspaceItem<any>[]>);
    onOpenWorkspaceIdsChanged: AddListener<string[]>;
    onOpenWorkspacesChanged: AddListener<Workspace[]>;
    onWorkspaceChanged: ((ws: WorkspaceIdentifier<any>, callback: Callback<Workspace>) => Promise<Unsubscribe>);
    onWorkspaceItemChanged: ((item: WorkspaceItemIdentifier<any>, callback: Callback<WorkspaceItem<any>>) => Promise<Unsubscribe>);
    openWorkspace: ((ws: WorkspaceIdentifier<any>, showTab?: boolean) => Promise<void>);
    refresh: (() => Promise<void>);
    removeFromFocusList: ((entities: Entity[], type?: "group" | "single", tabName?: string) => Promise<FocusListItem[]>);
    removeTag: ((os_workspace: string, tag: TagAttributes | OsTag, entity: Entity | Entity[]) => Promise<void>);
    removeWatchIntent: ((os_workspace: string, intent_id: string) => Promise<void>);
    save: ((item: WorkspaceRecordIdentifier | WorkspaceRecordWithRelationships | Partial<WorkspaceItem<any>> & WorkspaceItemModel, options?: SaveOptions) => Promise<WorkspaceItem<any>>);
    saveFile: ((item: WorkspaceItem<any>, file: string | File, options?: SaveOptions) => Promise<WorkspaceItem<any>>);
    searchXperience: ((options?: SearchXperienceProps) => Promise<Entity[]>);
    setActiveWorkspace: ((workspace: undefined | string) => Promise<void>);
    setOpenWorkspaceIds: ((ids: string[]) => Promise<void>);
    showConfirm: ((props: OsConfirmProps) => Promise<OS_CONFIRM_MODAL_RESPONSE>);
    showContextMenu: ((props: ContextMenuRequest) => Promise<void>);
    showCreateEntityForm: ((props: CreateEntityFormProps) => Promise<OsWorkspaceEntity[]>);
    showCreateRelationsDialog: ((props: CreateRelationsDialogProps) => Promise<void>);
    showFileUpload: ((folder: WorkspaceItem<any>) => Promise<WorkspaceItem<any>[]>);
    showModalTemplate: ((props: ModalTemplateProps) => Promise<void>);
    showProgress: ((progress: OsProgress) => Promise<void>);
    showSaveAsModal: ((props: SaveAsModalProps) => Promise<undefined | WorkspaceItem<any>>);
    showTab: ((props: ShowTabProps) => Promise<void>);
    showToast: ((notification: OsNotification) => Promise<void>);
    undeployApp: ((app: WorkspaceItem<any> | App) => Promise<WorkspaceItem<any>>);
    unzipFiles: ((entity: WorkspaceItem<any>, file: File) => void);
    updateTag: ((tag: OsTag) => Promise<OsTag>);
    whoami: (() => Promise<Whoami>);
    withProgressBar: (<T>(promise: Promise<T>, options?: WithProgressBarOptions) => Promise<T>);
    workspaceStore: {
        [os_workspace: string]: Workspace;
    };
    getSchemaItems(os_item_content_type: string): Promise<WorkspaceItem<any>[]>;
    getWhitelabelingInfo(): Promise<{
        OCTOSTAR_FAVICON: string;
        OCTOSTAR_MAIN_LOGO: string;
        OCTOSTAR_SPINNER: string;
    }>;
    getWorkspaceItems(os_item_name: string): Promise<WorkspaceItem<any>[]>;
    open(records: Entity | Entity[], options?: DesktopActionOptions): Promise<void>;
}

Hierarchy (view full)

Properties

addAttachment: ((entity: WorkspaceItem<any>, file?: WorkspaceItem<any>) => void)

Connect an attachment to an entity as featured_in

addComment: ((about: Entity, comment: AddCommentParams) => Promise<Entity>)

Adds a comment to an entity.

addToFocusList: ((entities: Entity[], type?: "group" | "single", tabName?: string) => Promise<FocusListItem[]>)

Adds entities to the focus list with optional type and tab name.

addWatchIntent: ((entity: Entity, watcher: Watcher) => Promise<Entity>)

Adds a watch intent to an entity.

applyTag: ((os_workspace: string, tag: TagAttributes | OsTag, entity: Entity | Entity[]) => Promise<void>)

Applies a tag to an entity.

callAppService: ((props: AppServiceCallProps) => Promise<any>)

Calls an application service with given properties.

clearToast: ((id: string) => Promise<void>)

Clears a toast notification by ID.

closeTab: ((props: ShowTabProps) => Promise<void>)

Closes a tab with given properties.

closeWorkspace: ((ws: WorkspaceIdentifier<any>) => Promise<void>)

Closes a workspace.

connect: ((relationship: string | Relationship, from: Entity, to: Entity, os_workspace?: string) => Promise<WorkspaceItem<any>>)

Connects two entities with a relationship in a workspace.

copy: ((source: WorkspaceItem<any>, target: WorkspaceItem<any>, options?: CopyOptions) => Promise<WorkspaceItem<any>[]>)

Copies an item.

createWorkspace: ((name: string) => Promise<WorkspaceItem<any>>)

Creates a workspace by name.

delete: ((item: WorkspaceRecordIdentifier | WorkspaceRecordIdentifier[], recurse?: boolean) => Promise<void>)

Deletes an item or items recursively.

delete_local_concept_records: ((workspace_id: string, base_concept: string) => Promise<void>)

Deletes local concept records in a workspace by base concept.

delete_workspace_records: ((workspace_id: string) => Promise<void>)

Deletes records in a workspace by ID.

deployApp: ((app: WorkspaceItem<any> | App, initialSecrets?: {
    [key: string]: string;
}) => Promise<WorkspaceItem<any>>)

Deploys an application with optional initial secrets.

export: ((item: WorkspaceItem<any> | WorkspaceItem<any>[], options?: ExportOptions) => Promise<void>)

Exports an item or items with optional export options.

extractEntities: ((text: string, options?: ExtractEntitiesOptions) => Promise<Entity[]>)

Extracts entities from some text which may be json or a list of urls.

failedWorkspaceModal: undefined | Promise<OS_CONFIRM_MODAL_RESPONSE>

Property to know if should show or not the modal

getActiveWorkspace: ((prompt?: boolean) => Promise<undefined | string>)

Gets the active workspace.

getApp: ((name: string) => Promise<undefined | WorkspaceItem<any>>)

Gets the named app if it is on the desktop and in a running state.

getAttachment: (<T>(entity: Entity, options?: GetAttachmentOptions<T>) => Promise<T>)

Fetches an attachment based on the provided workspace identifier and path or ID.

Type declaration

    • <T>(entity, options?): Promise<T>
    • Type Parameters

      Parameters

      Returns Promise<T>

      A promise that resolves to the attachment of type T.

getAvailableTags: ((entity: Entity, workspace?: string) => Promise<OsTag[]>)

Gets available tags for an entity in a workspace.

getConfigFiles: ((name: string) => Promise<WorkspaceItem<any>[]>)

Get config files

getFilesTree: ((workspace_or_folder: WorkspaceItem<any>, options?: FileTreeOptions) => Promise<WorkspaceItem<any>[]>)

Gets a file tree for a workspace or folder with optional file tree options.

getFocusList: (() => Promise<FocusListItem[]>)

Gets the focus list.

getImages: ((entity: Entity) => Promise<Entity[]>)

Gets images for an entity.

getItem: (<T>(ws: WorkspaceIdentifier<T>) => Promise<WorkspaceItem<T>>)

Gets an item by workspace identifier.

getItems: ((ws: WorkspaceIdentifier<any>[]) => Promise<WorkspaceItem<any>[]>)

Gets items by workspace identifiers.

getJSONSchema: ((concept: string) => Promise<{
    schema: string;
    schemaUI: string;
}>)

Gets JSON schema for a concept.

getOntology: (() => Promise<Ontology>)

Gets the OntologyAPI.

Type declaration

    • (): Promise<Ontology>
    • Returns Promise<Ontology>

      a promise that resolves to the current ontology

getOpenWorkspaceIds: (() => Promise<string[]>)

Gets the IDs of open workspaces.

getOpenWorkspaces: (() => Promise<Workspace[]>)

This might not be enough, add a listener to WorkspaceChangeEmitter.onOpenWorkspacesChanged to keep getting updated. In react components, prefer useDesktopWorkspaces hook.

getPasteContext: ((options: PasteContextOptions) => Promise<Entity[]>)

Gets a paste context with optional options.

getSearchResults: ((params: undefined | string | SearchProps, enableSelection?: boolean) => Promise<undefined | Entity[]>)

Show the search modal and return the selected results.

getStyler: ((name: string, context: DesktopStylerContext) => Promise<Styler>)

Gets a styler by name and context.

getStylerOptions: (() => Promise<StylerOption[]>)

Gets options for stylers.

getTags: ((entity: Entity) => Promise<TagWithRelationship[]>)

Gets tags for an entity.

getTemplate: ((name: string | Entity | ((template: SavedTemplate) => boolean), defaultTemplate?: string) => Promise<SavedTemplate>)

Gets a template by name or entity or filter with an optional default template.

getTemplates: ((layout?: string | ((template: SavedTemplate) => boolean)) => Promise<SavedTemplate[]>)

Gets templates by layout or filter

getUser: (() => Promise<UserProfile>)

Gets the user profile.

getWorkspace: ((ws: WorkspaceIdentifier<any>) => Promise<undefined | Workspace>)

Gets a workspace by identifier.

getWorkspacePermission: ((os_worpsaces: string[]) => Promise<{
    [os_workspace: string]: WorkspacePermission;
}>)

Gets workspace permissions by IDs.

handleFailedWorkspace: ((wsuuid: string) => Promise<OS_CONFIRM_MODAL_RESPONSE>)

Method to show workspace modal error only once per time

import: ((items: any[]) => Promise<void>)

Imports items.

importZip: ((file: File, options?: ImportZipOptions) => Promise<void>)

Imports a ZIP file with optional import options.

internalGetIconCode: ((x: string | Concept | Entity, defaultIcon?: string) => Promise<string>)

Gets icon code for an entity, concept, or string.

listAllWorkspaces: ((permissions?: WorkspacePermissionValue) => Promise<WorkspaceItem<any>[]>)

Lists all workspaces with optional permissions.

onOpenWorkspaceIdsChanged: AddListener<string[]>

Listener for changes in open workspace IDs list (list gets updated on eg close / open event)

onOpenWorkspacesChanged: AddListener<Workspace[]>

Subscribes to changes for the currently open workspaces.

The callback to invoke with the current open workspaces.

A promise that resolves to an unsubscribe function.

onWorkspaceChanged: ((ws: WorkspaceIdentifier<any>, callback: Callback<Workspace>) => Promise<Unsubscribe>)

Subscribes to changes for a given workspace.

Type declaration

onWorkspaceItemChanged: ((item: WorkspaceItemIdentifier<any>, callback: Callback<WorkspaceItem<any>>) => Promise<Unsubscribe>)

Subscribes to changes for a given workspace item.

Type declaration

openWorkspace: ((ws: WorkspaceIdentifier<any>, showTab?: boolean) => Promise<void>)

Opens a workspace.

refresh: (() => Promise<void>)

Refreshes the desktop.

removeFromFocusList: ((entities: Entity[], type?: "group" | "single", tabName?: string) => Promise<FocusListItem[]>)

Removes entities from the focus list with optional type and tab name.

removeTag: ((os_workspace: string, tag: TagAttributes | OsTag, entity: Entity | Entity[]) => Promise<void>)

Removes a tag from an entity.

removeWatchIntent: ((os_workspace: string, intent_id: string) => Promise<void>)

Removes a watch intent by workspace and intent ID.

Saves an item with optional save options.

saveFile: ((item: WorkspaceItem<any>, file: string | File, options?: SaveOptions) => Promise<WorkspaceItem<any>>)

Saves a file to an item with optional save options.

searchXperience: ((options?: SearchXperienceProps) => Promise<Entity[]>)

Searches experience with optional search options.

setActiveWorkspace: ((workspace: undefined | string) => Promise<void>)

Sets the active workspace.

setOpenWorkspaceIds: ((ids: string[]) => Promise<void>)

Sets the IDs of open workspaces.

showConfirm: ((props: OsConfirmProps) => Promise<OS_CONFIRM_MODAL_RESPONSE>)

Shows a confirmation modal.

showContextMenu: ((props: ContextMenuRequest) => Promise<void>)

Shows a context menu with given properties.

showCreateEntityForm: ((props: CreateEntityFormProps) => Promise<OsWorkspaceEntity[]>)

Shows a form for creating an entity.

showCreateRelationsDialog: ((props: CreateRelationsDialogProps) => Promise<void>)

Shows a dialog for creating relations.

showFileUpload: ((folder: WorkspaceItem<any>) => Promise<WorkspaceItem<any>[]>)

Shows a file upload dialog.

showModalTemplate: ((props: ModalTemplateProps) => Promise<void>)

Shows a modal template.

showProgress: ((progress: OsProgress) => Promise<void>)

Shows a progress item.

showSaveAsModal: ((props: SaveAsModalProps) => Promise<undefined | WorkspaceItem<any>>)

Shows a modal for saving as.

showTab: ((props: ShowTabProps) => Promise<void>)

Shows a tab with given properties.

showToast: ((notification: OsNotification) => Promise<void>)

Shows a toast notification.

undeployApp: ((app: WorkspaceItem<any> | App) => Promise<WorkspaceItem<any>>)

Undeploys an application.

unzipFiles: ((entity: WorkspaceItem<any>, file: File) => void)

Trigger a modal to allow users to manage the unzipping and extraction process within the workspace.

updateTag: ((tag: OsTag) => Promise<OsTag>)

Updates a tag.

whoami: (() => Promise<Whoami>)

Gets information about the current user.

withProgressBar: (<T>(promise: Promise<T>, options?: WithProgressBarOptions) => Promise<T>)

Wraps a promise with a progress bar.

workspaceStore: {
    [os_workspace: string]: Workspace;
}

"Cache" for workspaces, avoiding to return a modal error, if this workspace was fetched before

Methods

  • Beta

    Gets schema items by content type.

    Parameters

    • os_item_content_type: string

    Returns Promise<WorkspaceItem<any>[]>

  • Beta

    Returns Promise<{
        OCTOSTAR_FAVICON: string;
        OCTOSTAR_MAIN_LOGO: string;
        OCTOSTAR_SPINNER: string;
    }>

  • Beta

    Opens records with default action or as specified in the optional desktop action options.

    Parameters

    Returns Promise<void>