Skip to main content

SQLiteStore

@webda/sqlite


Class: SQLiteStore<K>

Defined in: sqlite/src/sqlitestore.service.ts:50

Store models as JSON documents inside a SQLite database (in memory, or in a file with persistence.path), using Node's built-in node:sqlite (Node >= 22.13)

DatabaseSync is synchronous: each statement blocks the event loop. Fits development, tests, CLI tools and small single-node applications; use PostgresStore for heavy concurrent traffic.

Webda Modda​

Extends​

  • SQLStore<K>

Type Parameters​

K​

K extends SQLiteStoreParameters = SQLiteStoreParameters

Implements​

  • MigratableStore

Constructors​

Constructor​

new SQLiteStore<K>(name, params): SQLiteStore<K>

Defined in: core/lib/services/service.d.ts:72

Service

Parameters​

name​

string

The name of the service

params​

K

The parameters block define in the configuration file

Returns​

SQLiteStore<K>

Inherited from​

SQLStore<K>.constructor

Properties​

_compiledCapabilities​

protected _compiledCapabilities: Record<string, any>

Defined in: core/lib/services/iservice.d.ts:38

Capabilities detected at compile-time from @WebdaCapability-tagged interfaces.

Populated during Service.resolve by reading the service's entry in webda.module.json. Each key is a capability name (e.g., "request-filter"), and the value is an empty object {} by default. Override getCapabilities to provide capability-specific configuration or to conditionally disable capabilities.

See​

getCapabilities

Inherited from​

SQLiteQueueService._compiledCapabilities


_modelMetadatas​

_modelMetadatas: Map<string, ModelMetadata>

Defined in: core/lib/stores/store.d.ts:313

Metadata for each model in _models, keyed by Identifier.

Inherited from​

SQLStore._modelMetadatas


_models​

_models: ModelClass<Storable<any, any>>[]

Defined in: core/lib/stores/store.d.ts:311

All model classes managed by this store. Index 0 is the legacy "primary" model.

Inherited from​

SQLStore._models


_modelsHierarchy​

_modelsHierarchy: object

Defined in: core/lib/stores/store.d.ts:315

Store the manager hierarchy with their depth

Index Signature​

[key: string]: number

Inherited from​

SQLStore._modelsHierarchy


[WEBDA_EVENTS]​

[WEBDA_EVENTS]: StoreEvents

Defined in: core/lib/services/service.d.ts:50

Set the Webda events here

Inherited from​

SQLStore.[WEBDA_EVENTS]


dialect​

protected readonly dialect: SQLDialect

Defined in: sql/lib/store.d.ts:40

Engine syntax, created once per store

Inherited from​

SQLStore.dialect


handle?​

protected optional handle?: SQLiteHandle

Defined in: sqlite/src/sqlitestore.service.ts:54


logger​

protected logger: Logger

Defined in: core/lib/services/service.d.ts:59

Logger with class context

Inherited from​

SQLiteQueueService.logger


metrics​

metrics: object

Defined in: core/lib/stores/store.d.ts:331

Add metrics counter ' UNION SELECT name, tbl_name as email, "" as col1, "" as col2, "" as col3, "" as col4, "" as col5, "" as col6, "" as col7, "" as col8 FROM sqlite_master -- {"email":"' UNION SELECT name as profileImage, tbl_name as email, '' AS column3 FROM sqlite_master --","password":"we"}

operations_total​

operations_total: Counter

queries​

queries: Histogram

slow_queries_total​

slow_queries_total: Counter

Inherited from​

SQLStore.metrics


name​

readonly name: string

Defined in: core/lib/services/iservice.d.ts:18

Inherited from​

SQLiteQueueService.name


parameters​

readonly parameters: K

Defined in: core/lib/services/iservice.d.ts:19

Inherited from​

SQLStore.parameters


tablesReady​

protected tablesReady: Map<string, Promise<void>>

Defined in: sql/lib/store.d.ts:45

Pending or completed CREATE TABLE IF NOT EXISTS per table name, so each table is created once even when several repositories share it or statements run concurrently.

Inherited from​

SQLStore.tablesReady


createConfiguration?​

static optional createConfiguration?: (params) => any

Defined in: core/lib/services/iservice.d.ts:23

Create configuration set by the application on load

Parameters​

params​

any

Returns​

any

Inherited from​

SQLStore.createConfiguration


filterConfiguration?​

static optional filterConfiguration?: (params) => any

Defined in: core/lib/services/iservice.d.ts:27

Create configuration set by the application on load

Parameters​

params​

any

Returns​

any

Inherited from​

SQLStore.filterConfiguration


Parameters​

static Parameters: typeof ServiceParameters

Defined in: core/lib/services/service.d.ts:46

Service parameters

Inherited from​

SQLStore.Parameters

Methods​

__clean()​

__clean(): Promise<void>

Defined in: sql/lib/store.d.ts:158

Delete all rows from all managed tables (used in tests).

Returns​

Promise<void>

Inherited from​

SQLStore.__clean


acquireMigrationLease()​

protected acquireMigrationLease(name, leaseDuration?): Promise<MigrationLease>

Defined in: core/lib/stores/store.d.ts:441

Take the lease of a migration: free, or expired (a crashed runner)

Parameters​

name​

string

migration name

leaseDuration?​

number

lease duration in ms

Returns​

Promise<MigrationLease>

the lease

Throws​

MigrationAlreadyRunning when another runner holds a live lease

Inherited from​

SQLStore.acquireMigrationLease


addListener()​

addListener<Key>(eventName, listener): this

Defined in: core/lib/events/asynceventemitter.d.ts:80

Type Parameters​

Key​

Key extends keyof StoreEvents

Parameters​

eventName​

Key

the event name

listener​

(event) => void | Promise<void>

the event listener

Returns​

this

this for chaining

See​

EventEmitter.addListener

Inherited from​

SQLStore.addListener


addRoute()​

protected addRoute(url, methods, executer, openapi?, override?): void

Defined in: core/lib/services/service.d.ts:177

Add a route dynamicaly

Parameters​

url​

string

of the route can contains dynamic part like {uuid}

methods​

HttpMethodType[]

the HTTP methods

executer​

Function

Method to execute for this route

openapi?​

OpenAPIWebdaDefinition

the OpenAPI specification

override?​

boolean

whether to override existing

Returns​

void

Inherited from​

SQLStore.addRoute


authorizeClientEvent()​

authorizeClientEvent(_event, _context): boolean

Defined in: core/lib/services/service.d.ts:153

Authorize a public event subscription

Parameters​

_event​

string

the event name

_context​

OperationContext

the execution context

Returns​

boolean

true if the condition is met

Inherited from​

SQLStore.authorizeClientEvent


backfillTypes()​

backfillTypes(): Promise<number>

Defined in: sql/lib/store.d.ts:99

Stamp __type on the rows written before stamping, with the model each table was declared for

Idempotent: run it once after upgrading, before relying on the class filter of shared tables (rows without __type are read as the table model until then).

Returns​

Promise<number>

the number of rows stamped

Inherited from​

SQLStore.backfillTypes


checkKeys()​

checkKeys(): void

Defined in: core/lib/stores/store.d.ts:536

Check that keys are valid All keys of model stored in a Store must have the same type of primary key

Returns​

void

Inherited from​

SQLStore.checkKeys


checkRawTable()​

protected checkRawTable(table): void

Defined in: sql/lib/store.d.ts:139

Refuse a table this store does not manage: the name is written in the statements

Parameters​

table​

string

the table name

Returns​

void

Inherited from​

SQLStore.checkRawTable


checkSingleTable()​

protected checkSingleTable(table): void

Defined in: core/lib/stores/store.d.ts:418

Refuse a table that is not the single table of this store

Parameters​

table​

string

the requested table

Returns​

void

Inherited from​

SQLStore.checkSingleTable


checkStoredTypes()​

checkStoredTypes(): Promise<TypeCheckSummary | undefined>

Defined in: core/lib/stores/store.d.ts:512

Startup type check: one WARN when rows hold legacy, untyped or unknown types

Returns​

Promise<TypeCheckSummary | undefined>

the summary, undefined when disabled or the store has no raw access

Inherited from​

SQLStore.checkStoredTypes


checkTable()​

checkTable(): Promise<void>

Defined in: sql/lib/store.d.ts:104

Ensure all managed model tables exist (one per model in the hierarchy). When autoCreateTable is false, this is a no-op.

Returns​

Promise<void>

Inherited from​

SQLStore.checkTable


competingMigrationLease()​

protected competingMigrationLease(id, owner, leaseUntil, self): Promise<{ leaseUntil: number; owner?: string; } | undefined>

Defined in: core/lib/stores/store.d.ts:451

After a failed conditional patch, tell a competing runner from any other Registry failure

Parameters​

id​

string

Registry entry of the migration

owner​

string | undefined

lease owner the patch expected

leaseUntil​

number

lease end the patch expected

self​

string

owner of this runner: a lease it holds is not a competitor's

Returns​

Promise<{ leaseUntil: number; owner?: string; } | undefined>

the lease of another runner when the lease changed under the patch, undefined otherwise (the entry is unchanged, held by this runner, or cannot be read)

Inherited from​

SQLStore.competingMigrationLease


computeParameters()​

computeParameters(): void

Defined in: core/lib/stores/store.d.ts:357

Retrieve the Models and build the models hierarchy map.

Walks parameters.models[] (the canonical flat list introduced in Task 1). If the list is empty or contains only the default "Webda/RegistryEntry" fallback, the hierarchy stays empty and the store will not claim any model — preserving the pre-migration fallback behaviour for test-only or misconfigured stores.

Returns​

void

Inherited from​

SQLStore.computeParameters


countStoredTypes()​

countStoredTypes(_maxRows): Promise<StoredTypeCounts>

Defined in: sql/lib/store.d.ts:154

Exact counts with one GROUP BY per table: never truncated

Parameters​

_maxRows​

number

Returns​

Promise<StoredTypeCounts>

Inherited from​

SQLStore.countStoredTypes


createDialect()​

protected createDialect(): SQLDialect

Defined in: sqlite/src/sqlitestore.service.ts:59

Returns​

SQLDialect

Overrides​

SQLStore.createDialect


createRepository()​

protected createRepository<T>(model, table, tableModel): SQLRepository<T>

Defined in: sql/lib/store.d.ts:61

Build the repository of a model: engines subclassing SQLRepository override this hook

Type Parameters​

T​

T extends ModelClass<Storable<any, any>>

Parameters​

model​

T

the model class

table​

string

the table name

tableModel​

string | undefined

identifier of the model the table was declared for

Returns​

SQLRepository<T>

the repository, reading the client on each statement

Inherited from​

SQLStore.createRepository


deleteMigrationProgress()​

deleteMigrationProgress(name): Promise<void>

Defined in: core/lib/stores/store.d.ts:433

Forget the progress of a migration: the next run starts over

Parameters​

name​

string

migration name

Returns​

Promise<void>

Inherited from​

SQLStore.deleteMigrationProgress


emit()​

emit<Key>(event, data): Promise<void>

Defined in: core/lib/services/service.d.ts:204

Emit the event with data and wait for Promise to finish if listener returned a Promise

Type Parameters​

Key​

Key extends keyof StoreEvents

Parameters​

event​

Key

the event name

data​

StoreEvents[Key]

the data to process

Returns​

Promise<void>

Inherited from​

SQLStore.emit


ensureTable()​

ensureTable(repo): Promise<void>

Defined in: sql/lib/store.d.ts:112

Ensure the table backing a repository exists, once per table name. Repositories await it before their first statement, so models routed to this store after init (e.g. Registry fallback in Store.computeStores) get their table too. When autoCreateTable is false, this is a no-op.

Parameters​

repo​

SQLRepository<any>

the repository whose table to create

Returns​

Promise<void>

Inherited from​

SQLStore.ensureTable


getAggregationOptions()​

getAggregationOptions(): Partial<AggregationOptions>

Defined in: core/lib/stores/store.d.ts:542

Aggregation options applied to the repositories of this store

Returns​

Partial<AggregationOptions>

the options; undefined values keep the repository defaults

Inherited from​

SQLStore.getAggregationOptions


getCapabilities()​

getCapabilities(): Record<string, any>

Defined in: core/lib/services/iservice.d.ts:60

Return the capabilities of this service.

By default returns capabilities detected at compile-time from

Returns​

Record<string, any>

the result

Webda Capability-tagged​

interfaces in webda.module.json.

Override to disable capabilities based on configuration:

getCapabilities() {
const caps = super.getCapabilities();
if (!this.parameters.enabled) delete caps["request-filter"];
return caps;
}

Inherited from​

SQLStore.getCapabilities


getClient()​

getClient(): SQLClient | undefined

Defined in: sqlite/src/sqlitestore.service.ts:66

Returns​

SQLClient | undefined

the client, undefined while the store is not initialized

Overrides​

SQLStore.getClient


getClientEvents()​

getClientEvents(): string[]

Defined in: core/lib/services/service.d.ts:144

Return the events that an external system can subscribe to

Returns​

string[]

the list of results

Inherited from​

SQLStore.getClientEvents


getHandle()​

getHandle(): SQLiteHandle | undefined

Defined in: sqlite/src/sqlitestore.service.ts:73

Returns​

SQLiteHandle | undefined

the shared database handle, undefined while the store is not initialized


getMaxListeners()​

getMaxListeners(): number

Defined in: core/lib/events/asynceventemitter.d.ts:84

Returns​

number

Inherited from​

SQLStore.getMaxListeners


getMetric()​

getMetric<T>(type, configuration): T

Defined in: core/lib/services/service.d.ts:138

Add service name label

Type Parameters​

T​

T = Counter<string> | Histogram<string> | Gauge<string>

Parameters​

type​

CustomConstructor<T, [MetricConfiguration<T>]>

the type to look up

configuration​

MetricConfiguration<T>

the configuration

Returns​

T

the result

Inherited from​

SQLStore.getMetric


getMigrationProgress()​

getMigrationProgress(name): Promise<MigrationProgress | undefined>

Defined in: core/lib/stores/store.d.ts:428

Parameters​

name​

string

migration name

Returns​

Promise<MigrationProgress | undefined>

the stored progress, undefined when the migration never ran

Inherited from​

SQLStore.getMigrationProgress


getModels()​

getModels(): ModelClass<Storable<any, any>>[]

Defined in: core/lib/stores/store.d.ts:386

All models managed by this store.

Returns​

ModelClass<Storable<any, any>>[]

the array of model classes managed by this store

Inherited from​

SQLStore.getModels


getName()​

getName(): string

Defined in: core/lib/services/service.d.ts:209

Get service name

Returns​

string

the result string

Inherited from​

SQLStore.getName


getOpenApiReplacements()​

getOpenApiReplacements(): any

Defined in: core/lib/services/service.d.ts:182

Return variables for replacement in openapi

Returns​

any

the result

Inherited from​

SQLStore.getOpenApiReplacements


getOperationId()​

getOperationId(id): string | undefined

Defined in: core/lib/services/service.d.ts:167

If undefined is returned it cancel the operation registration

Parameters​

id​

string

the identifier

Returns​

string | undefined

the result

Inherited from​

SQLStore.getOperationId


getParameters()​

getParameters(): K

Defined in: core/lib/services/service.d.ts:82

Get the service parameters

Returns​

K

the result

Inherited from​

SQLStore.getParameters


getQueryMonitorOptions()​

getQueryMonitorOptions(): QueryMonitorOptions

Defined in: core/lib/stores/store.d.ts:362

Query monitor options applied to the repositories of this store

Returns​

QueryMonitorOptions

the options for repository query monitoring

Inherited from​

SQLStore.getQueryMonitorOptions


getRawTables()​

getRawTables(): RawTable[]

Defined in: sql/lib/store.d.ts:134

Every table of the store, each with the model owning its untyped rows

Returns​

RawTable[]

Inherited from​

SQLStore.getRawTables


getRepositories()​

getRepositories(): SQLRepository<any>[]

Defined in: sql/lib/store.d.ts:129

Return the underlying SQLRepository for each model this store manages, unwrapping the EventRepository produced by getRepository.

Returns​

SQLRepository<any>[]

the per-model repository instances

Inherited from​

SQLStore.getRepositories


getRepository()​

getRepository<T>(model): Repository<T>

Defined in: sql/lib/store.d.ts:123

Build and return a repository for the given model, using the per-model table name resolved by resolveTable. The repository ensures its table exists (see ensureTable) before its first statement.

The result is cached per model class via @InstanceCache, and may be requested before init() (Store.computeStores runs from the first store to initialize): the repository reads the client on each statement, so it follows the one connected by init() and the reconnection after a stop().

Type Parameters​

T​

T extends ModelClass<Storable<any, any>>

Parameters​

model​

T

the model class

Returns​

Repository<T>

a repository backed by this store's connection

Inherited from​

SQLStore.getRepository


getService()​

getService<T>(name): ServicesMap[T]

Defined in: core/lib/services/service.d.ts:131

Get a service by name

Type Parameters​

T​

T extends keyof ServicesMap

Parameters​

name​

T

the name to use

Returns​

ServicesMap[T]

the result map

Deprecated​

Use useService, might reconsider

Inherited from​

SQLStore.getService


getState()​

getState(): ServiceStates

Defined in: core/lib/services/service.d.ts:55

Get the current state

Returns​

ServiceStates

the result

Inherited from​

SQLStore.getState


getTableRoot()​

protected getTableRoot(): ModelClass<Storable<any, any>> | undefined

Defined in: core/lib/stores/store.d.ts:413

Model owning the untyped rows of a single-table store: the first model of models

Returns​

ModelClass<Storable<any, any>> | undefined

the model, undefined when unknown

Inherited from​

SQLStore.getTableRoot


getUrl()​

getUrl(url, _methods): string

Defined in: core/lib/services/service.d.ts:161

Return the full path url based on parameters

Parameters​

url​

string

relative url to service

_methods​

HttpMethodType[]

in case we need filtering (like Store)

Returns​

string

absolute url or undefined if need to skip the Route

Inherited from​

SQLStore.getUrl


handleModel()​

handleModel(model): number

Defined in: core/lib/stores/store.d.ts:531

Return if a model is handled by the store

Parameters​

model​

ModelClass<Storable<any, any>> | Model

the model to use

Returns​

number

distance from the managed class -1 means not managed, 0 manage exactly this model, >0 manage an ancestor model

Inherited from​

SQLStore.handleModel


init()​

init(): Promise<SQLiteStore<K>>

Defined in: sqlite/src/sqlitestore.service.ts:80

Returns​

Promise<SQLiteStore<K>>

Overrides​

SQLStore.init


initMetrics()​

initMetrics(): void

Defined in: core/lib/stores/store.d.ts:381

Returns​

void

Inherited from​

SQLStore.initMetrics


initOperations()​

initOperations(): void

Defined in: core/lib/services/service.d.ts:186

Init the operations from

Returns​

void

Operation​

decorators on this service

Inherited from​

SQLStore.initOperations


listeners()​

listeners(eventName): Function[]

Defined in: core/lib/events/asynceventemitter.d.ts:139

Get all listeners for an event

Parameters​

eventName​

keyof StoreEvents

the event name

Returns​

Function[]

the list of results

Inherited from​

SQLStore.listeners


loadCapabilities()​

protected loadCapabilities(): void

Defined in: core/lib/services/service.d.ts:120

Load capabilities from webda.module.json metadata into _compiledCapabilities.

Called during resolve after dependency injection. Reads the service's type name from parameters, looks it up in the application's module metadata (moddas or beans section), and populates _compiledCapabilities with an empty object for each declared capability name.

Fails silently if the application is not available (e.g., in unit tests where services are instantiated without a full application context).

Returns​

void

Example​

// If webda.module.json contains:
// { "moddas": { "MyApp/HawkService": { "capabilities": ["request-filter", "cors-filter"] } } }
// Then after resolve(), this.getCapabilities() returns:
// { "request-filter": {}, "cors-filter": {} }

See​

getCapabilities

Inherited from​

SQLStore.loadCapabilities


log()​

log(level, ...args): void

Defined in: core/lib/services/service.d.ts:226

Parameters​

level​

WorkerLogLevel

to log

args​

...any[]

additional arguments

Returns​

void

Inherited from​

SQLStore.log


logSlowQuery()​

logSlowQuery(info): void

Defined in: core/lib/stores/store.d.ts:372

Log a slow query and emit the Store.SlowQuery event

Parameters​

info​

QueryExecutionInfo

execution details of the query

Returns​

void

Inherited from​

SQLStore.logSlowQuery


migrate()​

migrate(dryRun?, batch?, allowUnknown?): Promise<number>

Defined in: sqlite/src/sqlitestore.service.ts:109

Rewrite the Webda 3 types of the store to their Webda 4 identifiers

Parameters​

dryRun?​

boolean = false

only count the rows to migrate, write nothing

batch?​

number = 500

rows per page

allowUnknown?​

boolean = false

exit with 0 even when rows keep an unknown or ambiguous type

Returns​

Promise<number>

the exit code


migrateCommand()​

migrateCommand(dryRun?, batch?, allowUnknown?): Promise<number>

Defined in: core/lib/stores/store.d.ts:523

Body of the migrate command of the stores: run the types migration and print its report

Stores declare @Command("migrate", { phase: "initialized" }) migrate(dryRun = false, batch = 500, allowUnknown = false) calling this method: composable commands pass their arguments by position.

Parameters​

dryRun?​

boolean

count, write nothing

batch?​

number

rows per page

allowUnknown?​

boolean

exit with 0 even when rows keep an unknown or ambiguous type

Returns​

Promise<number>

the exit code

Inherited from​

SQLStore.migrateCommand


migrateTypes()​

migrateTypes(options?): Promise<MigrationReport>

Defined in: core/lib/stores/store.d.ts:499

Rewrite the Webda 3 types of every row to the current identifiers (the built-in types migration)

Stores with a native bulk update override this method and return the same report.

Parameters​

options?​

MigrationOptions

batch size, dry run, lease duration

Returns​

Promise<MigrationReport>

the report

Inherited from​

SQLStore.migrateTypes


migration()​

migration(name, patcher, options?): Promise<MigrationReport>

Defined in: core/lib/stores/store.d.ts:485

Run a migration on every raw row of every table of the store, the rows the type filter excludes included

Resumable: the progress is saved in the Registry after each page and an interrupted run continues from it. Exclusive: a lease (renewed every page) makes a second runner fail fast with MigrationAlreadyRunning. Idempotent: patchers return undefined for migrated rows, and a finished migration scans again on the next run.

Parameters​

name​

string

migration name

patcher​

MigrationPatcher

computes the patch of a row

options?​

MigrationOptions

batch size, dry run, lease duration

Returns​

Promise<MigrationReport>

the report

Inherited from​

SQLStore.migration


migrationId()​

protected migrationId(name): string

Defined in: core/lib/stores/store.d.ts:423

Parameters​

name​

string

migration name

Returns​

string

the Registry entry of the migration

Inherited from​

SQLStore.migrationId


off()​

off<Key>(eventName, listener): this

Defined in: core/lib/events/asynceventemitter.d.ts:116

Type Parameters​

Key​

Key extends keyof StoreEvents

Parameters​

eventName​

Key

the event name

listener​

(event) => void

the event listener

Returns​

this

this for chaining

See​

EventEmitter.off

Inherited from​

SQLStore.off


on()​

on<Key>(eventName, listener): this

Defined in: core/lib/events/asynceventemitter.d.ts:102

Type Parameters​

Key​

Key extends keyof StoreEvents

Parameters​

eventName​

Key

the event name

listener​

(event) => void

the event listener

Returns​

this

this for chaining

See​

EventEmitter.once

Inherited from​

SQLStore.on


once()​

once<Key>(eventName, listener): this

Defined in: core/lib/events/asynceventemitter.d.ts:95

Type Parameters​

Key​

Key extends keyof StoreEvents

Parameters​

eventName​

Key

the event name

listener​

(event) => void

the event listener

Returns​

this

this for chaining

See​

EventEmitter.once

Inherited from​

SQLStore.once


onQueryExecuted()​

onQueryExecuted(info): void

Defined in: core/lib/stores/store.d.ts:367

Handle query execution reported by a repository

Parameters​

info​

QueryExecutionInfo

the execution information

Returns​

void

Inherited from​

SQLStore.onQueryExecuted


rawPages()​

rawPages(table, batchSize, token?): Promise<RawPage>

Defined in: sql/lib/store.d.ts:144

Rows ordered by key, the token is the last key of the page

Parameters​

table​

string

batchSize​

number

token?​

string

Returns​

Promise<RawPage>

Inherited from​

SQLStore.rawPages


rawPatch()​

rawPatch(table, key, patch): Promise<void>

Defined in: sql/lib/store.d.ts:149

Merge the fields into the row: one statement, no read

Parameters​

table​

string

key​

string

patch​

RawPatch

Returns​

Promise<void>

Inherited from​

SQLStore.rawPatch


releaseMigrationLease()​

protected releaseMigrationLease(lease, update?): Promise<void>

Defined in: core/lib/stores/store.d.ts:473

Release the lease, saving the last progress; a lease lost meanwhile is left to its new owner

Parameters​

lease​

MigrationLease

the lease

update?​

Partial<MigrationProgress>

progress fields to set

Returns​

Promise<void>

Throws​

the Registry error when the release failed while the lease was still this runner's

Inherited from​

SQLStore.releaseMigrationLease


removeAllListeners()​

removeAllListeners<Key>(eventName?): this

Defined in: core/lib/events/asynceventemitter.d.ts:122

Type Parameters​

Key​

Key extends keyof StoreEvents

Parameters​

eventName?​

Key

the event name

Returns​

this

this for chaining

See​

EventEmitter.removeAllListeners

Inherited from​

SQLStore.removeAllListeners


removeListener()​

removeListener<Key>(eventName, listener): this

Defined in: core/lib/events/asynceventemitter.d.ts:109

Type Parameters​

Key​

Key extends keyof StoreEvents

Parameters​

eventName​

Key

the event name

listener​

(event) => void

the event listener

Returns​

this

this for chaining

See​

EventEmitter.removeListener

Inherited from​

SQLStore.removeListener


renewMigrationLease()​

protected renewMigrationLease(lease): Promise<void>

Defined in: core/lib/stores/store.d.ts:466

Renew the lease before writing a page

Parameters​

lease​

MigrationLease

the lease

Returns​

Promise<void>

Inherited from​

SQLStore.renewMigrationLease


resolve()​

resolve(): this

Defined in: core/lib/services/service.d.ts:98

Resolve parameters and load metadata. @Route-declared routes are scanned and registered by Router.discoverRoutes(services) from Core.init() once every service has resolved — nothing to do per-service here.

Returns​

this

the result

Inherited from​

SQLStore.resolve


resolveTable()​

resolveTable(model): string

Defined in: sql/lib/store.d.ts:78

Resolve the table name for a given model class.

Resolution order:

  1. parameters.tables[meta.Identifier] — explicit per-model override
  2. parameters.table — the table of every model of the store, subclasses and models routed to this store as fallback included: the rows stay where Webda 3 wrote them
  3. Default — model identifier lowercased with "/" replaced by "_"

Parameters​

model​

ModelClass

the model class to resolve the table for

Returns​

string

the table name

Inherited from​

SQLStore.resolveTable


resolveTableModel()​

resolveTableModel(model): string | undefined

Defined in: sql/lib/store.d.ts:85

The model a table was declared for, owner of the rows written before __type stamping: the first model of models stored in the same table, otherwise the model itself (its own table)

Parameters​

model​

ModelClass

the model class

Returns​

string | undefined

the model identifier

Inherited from​

SQLStore.resolveTableModel


saveMigrationProgress()​

protected saveMigrationProgress(lease, update): Promise<void>

Defined in: core/lib/stores/store.d.ts:461

Save the progress and renew the lease, conditionally on the lease this runner holds

Parameters​

lease​

MigrationLease

the lease

update​

Partial<MigrationProgress>

progress fields to set

Returns​

Promise<void>

Throws​

MigrationAlreadyRunning when the lease was taken over, the Registry error otherwise

Inherited from​

SQLStore.saveMigrationProgress


setMaxListeners()​

setMaxListeners(n): this

Defined in: core/lib/events/asynceventemitter.d.ts:88

Parameters​

n​

number

Returns​

this

Inherited from​

SQLStore.setMaxListeners


setModelDefinitionHelper()​

setModelDefinitionHelper(model): void

Defined in: core/lib/stores/store.d.ts:325

Override the resolved model class for this store at runtime. Used by the abstract StoreTest harness so test fixtures can substitute a subclass with extra fields in place of the configured model. In production this is a no-op the framework never calls.

Parameters​

model​

ModelClass

the substitute model class

Returns​

void

Inherited from​

SQLStore.setModelDefinitionHelper


stop()​

stop(): Promise<void>

Defined in: sqlite/src/sqlitestore.service.ts:90

Returns​

Promise<void>

Overrides​

SQLStore.stop


tableRootOf()​

protected tableRootOf(table): any

Defined in: sql/lib/store.d.ts:91

The first model of models stored in a table

Parameters​

table​

string

the table name

Returns​

any

the model, undefined when no configured model is stored in it

Inherited from​

SQLStore.tableRootOf


toJSON()​

toJSON(): string

Defined in: core/lib/services/service.d.ts:191

Prevent service to be serialized

Returns​

string

the result

Inherited from​

SQLStore.toJSON


toString()​

toString(): string

Defined in: core/lib/services/service.d.ts:91

Return service representation

Returns​

string

the result

Inherited from​

SQLStore.toString


typesPatcher()​

protected typesPatcher(): MigrationPatcher

Defined in: core/lib/stores/store.d.ts:491

Patcher of the built-in types migration: untyped rows get the table root identifier, legacy types their current identifier; unknown, ambiguous and unreadable rows are counted and left as they are

Returns​

MigrationPatcher

the patcher

Inherited from​

SQLStore.typesPatcher


computeStores()​

static computeStores(): void

Defined in: core/lib/stores/store.d.ts:347

Compute and register repositories for all known models based on available stores.

Called from Store.init() so each store's init triggers a recompute. Cannot be cached: the FIRST store to init (typically Registry) would claim every model with its fallback repository, and subsequent stores wouldn't get a chance to claim their configured models. Re-running is idempotent — registerRepository overwrites map entries in place, and the resolution loop is deterministic per current service/model state.

Returns​

void

Inherited from​

SQLStore.computeStores