Skip to content

Add Flow lib defs for node:sqlite#55284

Closed
robhogan wants to merge 1 commit intomainfrom
export-D90764441
Closed

Add Flow lib defs for node:sqlite#55284
robhogan wants to merge 1 commit intomainfrom
export-D90764441

Conversation

@robhogan
Copy link
Copy Markdown
Contributor

Summary:
This diff adds Flow type definitions for the node:sqlite module, Node.js's built-in SQLite database interface added experimentally in v22.5.0.

Module Overview:

The node:sqlite module provides synchronous SQLite database operations, enabling embedded database functionality without external dependencies.

Core Classes:

  1. DatabaseSync - Main database interface

    • constructor(location: string, options?: DatabaseSyncOptions)
    • exec(sql: string) - Execute SQL without returning results
    • prepare(sql: string) - Create prepared statement
    • close() / open() - Manage connection lifecycle
    • function() - Register custom SQL functions
    • createSession() / applyChangeset() - Session/changeset support
    • https://nodejs.org/api/sqlite.html#class-databasesync
  2. StatementSync - Prepared statement interface

    • all(...params) - Return all rows as array
    • get(...params) - Return first row
    • run(...params) - Execute and return changes/lastInsertRowid
    • iterate(...params) - Return iterator over rows
    • expandedSQL / sourceSQL - SQL inspection
    • https://nodejs.org/api/sqlite.html#class-statementsync
  3. Session - Change tracking interface

    • changeset() - Get changes as Uint8Array
    • patchset() - Get minimal changes
    • close() - End session

References:

Stability: Experimental (added in v22.5.0)

Changelog: [Internal]

Reviewed By: GijsWeterings

Differential Revision: D90764441

Summary:
This diff adds Flow type definitions for the `node:sqlite` module, Node.js's built-in SQLite database interface added experimentally in v22.5.0.

**Module Overview:**

The `node:sqlite` module provides synchronous SQLite database operations, enabling embedded database functionality without external dependencies.

**Core Classes:**

1. **DatabaseSync** - Main database interface
   - `constructor(location: string, options?: DatabaseSyncOptions)`
   - `exec(sql: string)` - Execute SQL without returning results
   - `prepare(sql: string)` - Create prepared statement
   - `close()` / `open()` - Manage connection lifecycle
   - `function()` - Register custom SQL functions
   - `createSession()` / `applyChangeset()` - Session/changeset support
   - https://nodejs.org/api/sqlite.html#class-databasesync

2. **StatementSync** - Prepared statement interface
   - `all(...params)` - Return all rows as array
   - `get(...params)` - Return first row
   - `run(...params)` - Execute and return changes/lastInsertRowid
   - `iterate(...params)` - Return iterator over rows
   - `expandedSQL` / `sourceSQL` - SQL inspection
   - https://nodejs.org/api/sqlite.html#class-statementsync

3. **Session** - Change tracking interface
   - `changeset()` - Get changes as Uint8Array
   - `patchset()` - Get minimal changes
   - `close()` - End session

**References:**
- Node.js sqlite module documentation: https://nodejs.org/api/sqlite.html

**Stability:** Experimental (added in v22.5.0)

Changelog: [Internal]

Reviewed By: GijsWeterings

Differential Revision: D90764441
@meta-codesync
Copy link
Copy Markdown

meta-codesync Bot commented Jan 23, 2026

@robhogan has exported this pull request. If you are a Meta employee, you can view the originating Diff in D90764441.

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Jan 23, 2026
meta-codesync Bot pushed a commit to facebook/metro that referenced this pull request Jan 23, 2026
Summary:
X-link: facebook/react-native#55284

This diff adds Flow type definitions for the `node:sqlite` module, Node.js's built-in SQLite database interface added experimentally in v22.5.0.

**Module Overview:**

The `node:sqlite` module provides synchronous SQLite database operations, enabling embedded database functionality without external dependencies.

**Core Classes:**

1. **DatabaseSync** - Main database interface
   - `constructor(location: string, options?: DatabaseSyncOptions)`
   - `exec(sql: string)` - Execute SQL without returning results
   - `prepare(sql: string)` - Create prepared statement
   - `close()` / `open()` - Manage connection lifecycle
   - `function()` - Register custom SQL functions
   - `createSession()` / `applyChangeset()` - Session/changeset support
   - https://nodejs.org/api/sqlite.html#class-databasesync

2. **StatementSync** - Prepared statement interface
   - `all(...params)` - Return all rows as array
   - `get(...params)` - Return first row
   - `run(...params)` - Execute and return changes/lastInsertRowid
   - `iterate(...params)` - Return iterator over rows
   - `expandedSQL` / `sourceSQL` - SQL inspection
   - https://nodejs.org/api/sqlite.html#class-statementsync

3. **Session** - Change tracking interface
   - `changeset()` - Get changes as Uint8Array
   - `patchset()` - Get minimal changes
   - `close()` - End session

**References:**
- Node.js sqlite module documentation: https://nodejs.org/api/sqlite.html

**Stability:** Experimental (added in v22.5.0)

Changelog: [Internal]

Reviewed By: GijsWeterings

Differential Revision: D90764441

fbshipit-source-id: 9bce1e13bf8d550211c62d7d5cde255854379363
@meta-codesync meta-codesync Bot closed this in 3d0aa9f Jan 23, 2026
@facebook-github-bot facebook-github-bot added the Merged This PR has been merged. label Jan 23, 2026
@meta-codesync
Copy link
Copy Markdown

meta-codesync Bot commented Jan 23, 2026

This pull request has been merged in 3d0aa9f.

@react-native-bot
Copy link
Copy Markdown
Collaborator

This pull request was successfully merged by @robhogan in 3d0aa9f

When will my fix make it into a release? | How to file a pick request?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. fb-exported Merged This PR has been merged. meta-exported p: Facebook Partner: Facebook Partner

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants