| 187 | Object.defineProperty(DuckDBClient.prototype, "dialect", {value: "duckdb"}); |
| 188 | |
| 189 | async function registerExtensions(db, extensions) { |
| 190 | const {mainModule} = await bundle; |
| 191 | const platform = Object.keys(bundles).find((platform) => mainModule === bundles[platform].mainModule); |
| 192 | const con = await db.connect(); |
| 193 | try { |
| 194 | await Promise.all( |
| 195 | Object.entries(DUCKDB_MANIFEST.extensions).map(([name, {load, [platform]: ref}]) => |
| 196 | con |
| 197 | .query(`INSTALL "${name}" FROM '${import.meta.resolve(ref)}'`) |
| 198 | .then(() => (extensions === undefined ? load : extensions.includes(name)) && con.query(`LOAD "${name}"`)) |
| 199 | ) |
| 200 | ); |
| 201 | } finally { |
| 202 | await con.close(); |
| 203 | } |
| 204 | } |
| 205 | |
| 206 | async function insertSource(database, name, source) { |
| 207 | source = await source; |