mirror of
https://github.com/simplex-chat/simplex-chat.git
synced 2026-10-22 17:31:55 +00:00
nodejs: lazy per-backend libsimplex download (#7543)
* ci: drop dlltool from nodejs libs release * nodejs: download libsimplex into the user cache * nodejs: load libsimplex at runtime per backend * support bot: select db backend with --db * python: match backend switch error text * nodejs: download prebuilt add-on at runtime * ci: build nodejs add-on for libs release * calculator bot: load libs and add-on in image * support bot: document add-on override * nodejs: keep worker test output free of colors * nodejs: verify sha-256 of downloaded assets * python: pin core libs release with sha-256 * ci: add packages release script * ci: release nodejs add-on and open release PR * ci: publish packages after release PR * nodejs: keep npm from building the add-on * calculator bot: build the add-on in the image * ci: merge package release workflows * ci: open release PR when publishing fails * ci: build the add-on with node-addon-api only * ci: skip publishing in a called packages workflow * ci: update package release actions to Node 24 * nodejs: fix receive test timeout * ci: test packages on pull requests * nodejs: reuse the database in the close stress test * ci: keep failed package tests from hanging * ci: skip preset server tests * ci: plan package builds from the changes * ci: test packages with a given libsimplex * ci: test packages with libsimplex of core changes
This commit is contained in:
73 files changed
+2823
-650
No files matched your search
@@ -57,10 +57,8 @@ interface EventSubscriber<K extends CEvt.Tag> {
|
||||
}
|
||||
|
||||
/**
|
||||
* Database configuration. The native library is built against exactly one
|
||||
* backend (see `simplex_backend` / `SIMPLEX_BACKEND` at install time); this
|
||||
* type makes the caller state which one they are targeting so field names
|
||||
* can't lie about their meaning.
|
||||
* Database configuration. `type` selects the libsimplex backend loaded by
|
||||
* `ChatApi.init`; one backend per process.
|
||||
*/
|
||||
export type DbConfig =
|
||||
| {
|
||||
@@ -108,7 +106,7 @@ export class ChatApi {
|
||||
private constructor(protected ctrl_: bigint | undefined) {}
|
||||
|
||||
/**
|
||||
* Initializes the ChatApi.
|
||||
* Initializes the ChatApi, loading libsimplex for `db.type` (downloaded on first use).
|
||||
* @param {DbConfig} db - Database configuration (sqlite or postgres).
|
||||
* @param {core.MigrationConfirmation} [confirm=core.MigrationConfirmation.YesUp] - Migration confirmation mode.
|
||||
* @param {number} [queueSize] - Size of internal queues, the core default is used when omitted.
|
||||
@@ -119,6 +117,7 @@ export class ChatApi {
|
||||
queueSize?: number
|
||||
): Promise<ChatApi> {
|
||||
const [path, key] = dbConfigToMigrateArgs(db)
|
||||
await core.loadLibrary(db.type)
|
||||
const ctrl = await core.chatMigrateInit(path, key, confirm, queueSize)
|
||||
return new ChatApi(ctrl)
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user