h-sphere_sql-seal/types-package
Kacper Kula 285684dfc4
Refactoring Project to use proper Inversion of Control (#171)
* chore: reworking plugin internals into modules

* feat: settings module is now working, added debug module, enabled new api module

* chore: restoring external API

* feat: refactoring project to use proper inversion of control

* feat: plugins can now be loaded in any order

* chore: final file migration, all typescript is in modules now

* chore: fixing dependencies of cellParser

* feat: csv and json views are only registered when they are not colliding with other plugins

* feat: fixed library behaviour on canvas
2025-08-10 09:34:54 +01:00
..
src Refactoring Project to use proper Inversion of Control (#171) 2025-08-10 09:34:54 +01:00
package.json chore: bumping version of typed package 2025-04-02 17:06:18 +01:00
pnpm-lock.yaml feat: external API for registering views and custom functions. Added subproject for publishing npm package with types for external plugins. 2025-01-29 22:36:19 +00:00
README.md feat: external API for registering views and custom functions. Added subproject for publishing npm package with types for external plugins. 2025-01-29 22:36:19 +00:00
tsconfig.json feat: external API for registering views and custom functions. Added subproject for publishing npm package with types for external plugins. 2025-01-29 22:36:19 +00:00

SQLSeal Types Package

This package helps you type your external plugin that uses SQLSeal internally.

Installation

npm install --save-dev @hypersphere/sqlseal

Usage

Example usage from SQLSeal Charts library.

import { Plugin } from 'obsidian';
import { ChartRenderer } from './chartRenderer';
import { pluginApi } from '@vanakat/plugin-api';
import type { SQLSealRegisterApi } from '@hypersphere/sqlseal'

export default class SQLSealCharts extends Plugin {

  async onload() {
    this.registerWithSQLSeal();
  }

  private registerWithSQLSeal() {
    const api = pluginApi('sqlseal') as SQLSealRegisterApi
    const registar = api.registerForPlugin(this)
    registar.registerView('sqlseal-charts', new ChartRenderer(this.app))
  }
}

Unregistering will be automatically done by SQLSeal when you unload your plugin so no need to implement custom onunload() logic.

Checking SQLSeal Version

You can check current SQLSeal version by calling:

const api = pluginApi('sqlseal') as SQLSealRegisterApi
console.log(api.sqlSealVersion) // i.e. '0.20.0'

Checking SQLSeal Version

You can check current SQLSeal version by calling:

const api = pluginApi('sqlseal') as SQLSealRegisterApi
if (api.apiVersion >= 2) {
    // Targetting API 2+
} else {
    console.log("Plugin is incompatible with SQLSeal installed. Please update SQLSeal to the latest version and try again")
}