@surfaces-ui/engine-duckdb 0.0.0-stage → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAuB,YAAY,EAAE,MAAM,mCAAmC,CAAC;AACtF,OAAO,EAGL,WAAW,EAOX,cAAc,GACf,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACL,cAAc,EACd,MAAM,IAAI,UAAU,EACpB,aAAa,EACb,UAAU,EACV,WAAW,EACX,SAAS,GAGV,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAoB,KAAK,EAAE,IAAI,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AA8FpG,MAAM,OAAO,GAAG,QAAQ,CAAC;AACzB,MAAM,MAAM,GAAG,MAAM,CAAC;AAEtB,MAAM,MAAM,GAA2C;IACrD,OAAO,EAAE,WAAW,CAAC,OAAO;IAC5B,GAAG,EAAE,WAAW,CAAC,GAAG;IACpB,IAAI,EAAE,WAAW,CAAC,IAAI;IACtB,KAAK,EAAE,WAAW,CAAC,KAAK;IACxB,OAAO,EAAE,WAAW,CAAC,OAAO;CAC7B,CAAC;AAEF,gGAAgG;AAChG,MAAM,UAAU,iBAAiB;IAC/B,OAAO,cAAc,EAAE,CAAC;AAC1B,CAAC;AAED,SAAS,cAAc;IACrB,MAAM,OAAO,GAAG,aAAa,CAAC,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC;IAC/C,MAAM,IAAI,GACR,OAAO,CAAC,QAAQ,KAA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AY,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,EAAE,MAAM,CAAC;yBAC1C,KAAK,CAAC,IAAI,CAAC;yBACX,MAAM,CAAC,OAAO,CAAC;yBACf,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAgE,CAAC;yBAC9F,IAAI,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,UAAU,CAAC,EAAE,UAAU,CAAC;oBACjD,OAAO;wBACL,EAAE,EAAE,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC;wBACrC,WAAW,EAAE,IAAI,EAAE,SAAS,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC,EAAE;wBAC1E,SAAS,EAAE,IAAI,EAAE,SAAS,IAAI,EAAE;qBACjC,CAAC;gBACJ,CAAC,CAAC,CAAC;YACP,CAAC;YACD,OAAO,EAAE,CAAC;QACZ,CAAC;QAED,OAAO,EAAE,GAAG,EAAE,CAAC,cAAc,CAAC,KAAK,EAAE,CAAC,EAAE,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,KAAK,CAAC,uBAAuB,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,IAAI,EAAE,CAAC,CAAC;QAC5G,KAAK,EAAE,GAAG,EAAE,CAAC,QAAQ,CAAC,KAAK,EAAE;KAC9B,CAAC;AACJ,CAAC","sourcesContent":["import { randomUUID } from \"node:crypto\";\nimport fs from \"node:fs\";\nimport { createRequire } from \"node:module\";\nimport path from \"node:path\";\nimport { type AdbcConnection, AdbcDatabase } from \"@apache-arrow/adbc-driver-manager\";\nimport {\n type Engine,\n type EngineCheck,\n EngineError,\n type EngineResult,\n type ExecuteOptions,\n type Param,\n type StoreOptions,\n type StoredRelation,\n type TableModel,\n withTableModel,\n} from \"@surfaces-ui/engine\";\nimport {\n ConnectionKind,\n Engine as EngineKind,\n FileEntryKind,\n SqlDialect,\n TableFormat,\n TableKind,\n type TableRef,\n type TimeTravel,\n} from \"@surfaces-ui/proto\";\nimport { Bool, Float64, Int64, type RecordBatch, Table, Utf8, vectorFromArray } from \"apache-arrow\";\n\nexport type DuckDbTableFormat = \"parquet\" | \"csv\" | \"json\" | \"delta\" | \"iceberg\";\n\n/** One table the engine exposes. Queries refer to it by `name`. */\nexport interface DuckDbTable {\n name: string;\n format: DuckDbTableFormat;\n /**\n * Where the data is. A file or glob for parquet/csv/json, the table root\n * for Delta, and the table root or a metadata.json file for Iceberg.\n */\n path: string;\n comment?: string;\n /** Keys and column descriptions the files themselves do not hold. */\n model?: TableModel;\n}\n\n/** Credentials for one connection, as resolved on the server. Never sent to a client or logged. */\nexport interface DuckDbSecretValues {\n /** Access key ID (S3, GCS HMAC). */\n keyId?: string;\n /** Secret access key. */\n secret?: string;\n sessionToken?: string;\n /** Azure storage connection string. */\n connectionString?: string;\n /** Bearer token (HTTP, Iceberg REST catalogs). */\n token?: string;\n /** Database password (Postgres). */\n password?: string;\n}\n\n/**\n * How the engine reaches data that is not on this machine: an object store\n * or web location that tables read from. Only paths under `scope` can be\n * read, and credentials are named, never written here.\n */\nexport interface DuckDbConnection {\n name: string;\n kind: \"s3\" | \"gcs\" | \"azure\" | \"http\";\n /** Bucket or prefix this connection covers, e.g. `s3://acme-lake/sales` or `https://data.example.com/`. */\n scope: string;\n /** Name of a secret the server resolves. Omit for public data. */\n secret?: string;\n /** Use the credentials this machine already has (AWS profile, instance role, workload identity) instead of a named secret. */\n ambientCredentials?: boolean;\n region?: string;\n /** For S3-compatible stores such as MinIO or R2, e.g. `minio.internal:9000`. */\n endpoint?: string;\n urlStyle?: \"path\" | \"vhost\";\n useSsl?: boolean;\n /** Azure storage account name, when not using a connection string. */\n accountName?: string;\n}\n\n/** A catalog attached to the engine: every table in it is listed under its own catalog and schema. */\nexport interface DuckDbCatalog {\n /** The catalog's name in SQL: tables are `name.schema.table`. */\n name: string;\n /**\n * `iceberg-rest` is an Iceberg REST catalog (also Polaris, Lakekeeper, S3 Tables, Unity's Iceberg endpoint);\n * `postgres` is a Postgres database (also Supabase, Neon, RDS); `duckdb` is a DuckDB database file.\n */\n kind: \"iceberg-rest\" | \"postgres\" | \"duckdb\";\n /**\n * REST endpoint for `iceberg-rest`; file path for `duckdb`; for `postgres`\n * a connection string without the password, e.g.\n * `host=db.example.com port=5432 dbname=shop user=reader sslmode=require`.\n */\n uri: string;\n /** Warehouse name or location, for `iceberg-rest`. */\n warehouse?: string;\n /** Name of a secret holding a bearer `token` (`iceberg-rest`) or a `password` (`postgres`). */\n secret?: string;\n}\n\nexport interface DuckDbEngineOptions {\n tables: DuckDbTable[];\n /** Object stores and web locations the tables read from. */\n connections?: DuckDbConnection[];\n /** Catalogs to attach read-only. */\n catalogs?: DuckDbCatalog[];\n /** Looks up a named secret. Required when a connection or catalog names one. */\n resolveSecret?(name: string): DuckDbSecretValues | undefined | Promise<DuckDbSecretValues | undefined>;\n /** Path to the DuckDB shared library. Defaults to the one shipped with `@duckdb/node-bindings`. */\n libraryPath?: string;\n /**\n * After setup, restrict file access to the directories of the registered\n * tables so queries cannot read arbitrary files. Defaults to true.\n */\n lockFileAccess?: boolean;\n}\n\nconst CATALOG = \"memory\";\nconst SCHEMA = \"main\";\n\nconst FORMAT: Record<DuckDbTableFormat, TableFormat> = {\n parquet: TableFormat.PARQUET,\n csv: TableFormat.CSV,\n json: TableFormat.JSON,\n delta: TableFormat.DELTA,\n iceberg: TableFormat.ICEBERG,\n};\n\n/** Path of the DuckDB shared library shipped with `@duckdb/node-bindings` for this platform. */\nexport function duckDbLibraryPath(): string {\n return defaultLibrary();\n}\n\nfunction defaultLibrary(): string {\n const require = createRequire(import.meta.url);\n const file =\n process.platform === \"darwin\" ? \"libduckdb.dylib\" : process.platform === \"win32\" ? \"duckdb.dll\" : \"libduckdb.so\";\n const pkg = `@duckdb/node-bindings-${process.platform}-${process.arch}`;\n const bindings = path.dirname(require.resolve(\"@duckdb/node-bindings/package.json\"));\n const local = createRequire(path.join(bindings, \"package.json\"));\n return path.join(path.dirname(local.resolve(`${pkg}/package.json`)), file);\n}\n\nconst ident = (name: string) => `\"${name.replace(/\"/g, '\"\"')}\"`;\nconst text = (value: string) => `'${value.replace(/'/g, \"''\")}'`;\n\n/** The most entries one folder listing returns; a larger folder is reported as not read to the end. */\nconst FILE_LIST_CAP = 5000;\n\n/** The folder a local table reads from: the path itself when it is a folder (Delta, Iceberg), its parent otherwise. */\nconst localFolder = (tablePath: string) => (fs.existsSync(tablePath) && fs.statSync(tablePath).isDirectory() ? path.resolve(tablePath) : path.dirname(path.resolve(tablePath)));\n\n/** What a file can be read as, by its extension. */\nfunction fileFormat(name: string): TableFormat {\n const lower = name.toLowerCase().replace(/\\.(gz|zst)$/, \"\");\n if (lower.endsWith(\".parquet\")) return TableFormat.PARQUET;\n if (lower.endsWith(\".csv\") || lower.endsWith(\".tsv\")) return TableFormat.CSV;\n if (lower.endsWith(\".json\") || lower.endsWith(\".ndjson\") || lower.endsWith(\".jsonl\")) return TableFormat.JSON;\n return TableFormat.UNSPECIFIED;\n}\n\n/** A local folder that is the root of a Delta or Iceberg table, by what it holds. */\nfunction folderFormat(folder: string): TableFormat {\n try {\n if (fs.existsSync(path.join(folder, \"_delta_log\"))) return TableFormat.DELTA;\n const metadata = path.join(folder, \"metadata\");\n if (fs.existsSync(metadata) && fs.readdirSync(metadata).some((name) => name.endsWith(\".metadata.json\"))) return TableFormat.ICEBERG;\n } catch {\n // Unreadable: not a table as far as a listing can tell.\n }\n return TableFormat.UNSPECIFIED;\n}\n\n\nfunction bindTable(params: Param[]): Table {\n return new Table(\n Object.fromEntries(\n params.map((value, i) => {\n const type =\n typeof value === \"bigint\"\n ? new Int64()\n : typeof value === \"number\"\n ? new Float64()\n : typeof value === \"boolean\"\n ? new Bool()\n : new Utf8();\n return [`p${i}`, vectorFromArray([value], type)];\n }),\n ),\n );\n}\n\nfunction rows(table: Table): Record<string, unknown>[] {\n return table.toArray().map((r) => (r as { toJSON(): Record<string, unknown> }).toJSON());\n}\n\nconst RESULTS = \"_sf_results\";\nconst REMOTE = /^[a-z][a-z0-9+.-]*:\\/\\//i;\n/** Functions that describe stored credentials. They redact values, but queries have no business calling them. */\nconst SECRET_FUNCTIONS = /\\b(duckdb_secrets|which_secret)\\s*\\(/i;\n/**\n * Functions that hand a string of SQL to an attached database to run as it\n * is. They would let a query do anything the server's database login can,\n * out of sight of the read-only check, so they are refused.\n */\nconst PASS_THROUGH = /\\b(postgres|mysql|sqlite)_(query|execute|scan|scan_pushdown|attach)\\s*\\(/i;\n\n/** True for `s3://`, `gs://`, `az://`, `https://` and similar; false for paths on this machine. */\nexport function isRemotePath(location: string): boolean {\n return REMOTE.test(location);\n}\n\n/**\n * The statement that registers a connection's credentials with DuckDB. The\n * values are written into SQL text that goes only to the engine, so each is\n * escaped as a string literal.\n */\nexport function secretSql(connection: DuckDbConnection, values: DuckDbSecretValues | undefined): string | undefined {\n if (connection.kind === \"http\" && !values?.token) return undefined;\n // Where the store is (its endpoint, region, address style) has to reach the engine even when there are no credentials: public data on a store that is not AWS is read anonymously, but still from that store.\n const placed = connection.kind !== \"http\" && (connection.endpoint !== undefined || connection.urlStyle !== undefined || connection.useSsl !== undefined || connection.region !== undefined);\n if (!values && !connection.ambientCredentials && connection.kind !== \"azure\" && !placed) return undefined;\n const options: string[] = [`TYPE ${connection.kind}`];\n const add = (key: string, value: string | undefined) => value !== undefined && value !== \"\" && options.push(`${key} ${text(value)}`);\n if (connection.ambientCredentials) options.push(\"PROVIDER credential_chain\");\n if (connection.kind === \"http\") add(\"BEARER_TOKEN\", values?.token);\n else if (connection.kind === \"azure\") {\n add(\"CONNECTION_STRING\", values?.connectionString);\n add(\"ACCOUNT_NAME\", connection.accountName);\n } else {\n add(\"KEY_ID\", values?.keyId);\n add(\"SECRET\", values?.secret);\n add(\"SESSION_TOKEN\", values?.sessionToken);\n add(\"REGION\", connection.region);\n add(\"ENDPOINT\", connection.endpoint);\n add(\"URL_STYLE\", connection.urlStyle);\n if (connection.useSsl !== undefined) options.push(`USE_SSL ${connection.useSsl ? \"true\" : \"false\"}`);\n }\n add(\"SCOPE\", connection.scope);\n return `CREATE OR REPLACE SECRET ${ident(`sf_${connection.name}`)} (${options.join(\", \")})`;\n}\n\n/**\n * Errors arrive as JSON (errors_as_json is set at start-up), which carries\n * the kind of error and where in the SQL it is. `shift` is the length of\n * anything this adapter put in front of the caller's SQL.\n */\nfunction engineError(error: unknown, shift = 0): EngineError {\n if (error instanceof EngineError) return error;\n const raw = error instanceof Error ? error.message : String(error);\n const start = raw.indexOf(\"{\");\n let parsed: { exception_type?: string; exception_message?: string; position?: string; error_subtype?: string } | undefined;\n if (start >= 0) {\n try {\n parsed = JSON.parse(raw.slice(start));\n } catch {\n parsed = undefined;\n }\n }\n if (!parsed) {\n const clean = raw.replace(/^.*?(?=(Binder|Catalog|Parser|Conversion|Invalid Input|IO|Permission|Not implemented) Error)/s, \"\");\n return new EngineError(/^Catalog Error/.test(clean) ? \"UNKNOWN_TABLE\" : \"ENGINE\", clean.split(\"\\n\")[0]!.trim() || \"The query failed.\");\n }\n const kind = parsed.exception_type ?? \"\";\n const code =\n kind === \"Parser\"\n ? \"SYNTAX\"\n : kind === \"Catalog\"\n ? \"UNKNOWN_TABLE\"\n : parsed.error_subtype === \"COLUMN_NOT_FOUND\"\n ? \"UNKNOWN_COLUMN\"\n : \"ENGINE\";\n // The first line says what is wrong; later lines are suggestions, which are kept after it.\n const lines = (parsed.exception_message ?? \"\").split(\"\\n\").map((l) => l.trim()).filter(Boolean);\n const message = `${kind ? `${kind} error: ` : \"\"}${lines.join(\" \")}` || \"The query failed.\";\n const offset = parsed.position === undefined ? Number.NaN : Number(parsed.position) - shift;\n return new EngineError(code, message, parsed.error_subtype ?? \"\", Number.isInteger(offset) && offset >= 0 ? offset : undefined);\n}\n\n/**\n * Arguments that locate an Iceberg table. Given a table root, the newest\n * metadata file is named explicitly (no version hint file is needed) and\n * moved paths are allowed, so a table copied to another folder still reads.\n */\nfunction icebergArgs(location: string, forSnapshots = false): string {\n const metadata = path.join(location, \"metadata\");\n const newest =\n fs.existsSync(metadata) && fs.statSync(metadata).isDirectory()\n ? fs\n .readdirSync(metadata)\n .filter((f) => f.endsWith(\".metadata.json\"))\n .sort()\n .at(-1)\n : undefined;\n if (!newest) return text(location);\n // iceberg_snapshots reads only the metadata file and takes no relocation options.\n if (forSnapshots) return text(path.join(metadata, newest));\n return `${text(location)}, allow_moved_paths => true, version => ${text(newest.replace(/\\.metadata\\.json$/, \"\"))}`;\n}\n\n/** The relation expression for a table, optionally pinned to an earlier point. */\nfunction scan(table: DuckDbTable, at?: TimeTravel): string {\n const p = text(table.path);\n const pin = at?.at;\n switch (table.format) {\n case \"parquet\":\n return `read_parquet(${p})`;\n case \"csv\":\n return `read_csv(${p})`;\n case \"json\":\n return `read_json(${p})`;\n case \"delta\": {\n if (!pin?.case) return `delta_scan(${p})`;\n if (pin.case === \"version\") return `delta_scan(${p}, version => ${BigInt(pin.value)})`;\n if (pin.case === \"snapshotId\" && /^\\d+$/.test(pin.value)) return `delta_scan(${p}, version => ${pin.value})`;\n throw new EngineError(\"UNSUPPORTED\", \"Delta tables can be read at a version number, not a timestamp.\");\n }\n case \"iceberg\": {\n const base = `iceberg_scan(${icebergArgs(table.path)}`;\n if (!pin?.case) return `${base})`;\n if (pin.case === \"snapshotId\" && /^\\d+$/.test(pin.value)) return `${base}, snapshot_from_id => ${pin.value})`;\n if (pin.case === \"timestamp\") {\n const when = new Date(pin.value);\n if (Number.isNaN(when.getTime())) throw new EngineError(\"UNSUPPORTED\", \"The time travel timestamp is not valid.\");\n const stamp = when.toISOString().replace(\"T\", \" \").replace(\"Z\", \"\");\n return `${base}, snapshot_from_timestamp => TIMESTAMP ${text(stamp)})`;\n }\n throw new EngineError(\"UNSUPPORTED\", \"Iceberg tables can be read at a snapshot ID or a timestamp.\");\n }\n }\n}\n\n/**\n * DuckDB behind the Engine interface, reached through ADBC so results arrive\n * as Arrow batches with their types intact.\n *\n * Tables are registered as views over files and lake tables. Each query runs\n * on its own connection; time travel is done by shadowing the view with a\n * connection-local temporary view pinned to the requested snapshot.\n */\nexport async function createDuckDbEngine(options: DuckDbEngineOptions): Promise<Engine> {\n const tables = new Map(options.tables.map((t) => [t.name.toLowerCase(), { ...t, path: isRemotePath(t.path) ? t.path : path.resolve(t.path) }]));\n const connections = options.connections ?? [];\n const catalogs = options.catalogs ?? [];\n const attached = new Set(catalogs.map((c) => c.name.toLowerCase()));\n for (const name of [...connections.map((c) => c.name), ...catalogs.map((c) => c.name)]) {\n if (!/^[A-Za-z_][A-Za-z0-9_]*$/.test(name)) throw new EngineError(\"UNSUPPORTED\", `Connection and catalog names use letters, digits and underscores: ${name}`);\n }\n const secretOf = async (name: string | undefined) => {\n if (!name) return undefined;\n const values = await options.resolveSecret?.(name);\n // The name is safe to show; it tells the person which secret to set.\n if (!values) throw new EngineError(\"UNSUPPORTED\", `The secret \"${name}\" is not set on the server.`);\n return values;\n };\n const database = new AdbcDatabase({ driver: options.libraryPath ?? defaultLibrary(), entrypoint: \"duckdb_adbc_init\" });\n\n const withConnection = async <T>(run: (connection: AdbcConnection) => Promise<T>): Promise<T> => {\n const connection = await database.connect();\n try {\n return await run(connection);\n } catch (error) {\n throw engineError(error);\n } finally {\n await connection.close().catch(() => {});\n }\n };\n\n const formats = new Set([...tables.values()].map((t) => t.format));\n /** Remote tables and catalogs that could not be opened at start-up, with the reason. */\n const unreachable = new Map<string, string>();\n const CATALOG_KIND = { duckdb: ConnectionKind.DATABASE_FILE, postgres: ConnectionKind.POSTGRES, \"iceberg-rest\": ConnectionKind.ICEBERG_REST } as const;\n /** A connection string with only what is safe to show: where it points, not who signs in. */\n const shown = (catalog: DuckDbCatalog) =>\n catalog.kind === \"duckdb\"\n ? path.basename(catalog.uri)\n : catalog.kind === \"postgres\"\n ? [\"host\", \"port\", \"dbname\"].map((key) => new RegExp(`\\\\b${key}\\\\s*=\\\\s*(\\\\S+)`, \"i\").exec(catalog.uri)?.[1]).filter(Boolean).join(\" / \")\n : catalog.uri;\n await withConnection(async (connection) => {\n const extensions = new Set<string>();\n for (const extension of [\"delta\", \"iceberg\"] as const) if (formats.has(extension)) extensions.add(extension);\n if (connections.length > 0 || [...tables.values()].some((t) => isRemotePath(t.path))) extensions.add(\"httpfs\");\n if (connections.some((c) => c.kind === \"azure\")) extensions.add(\"azure\");\n if (connections.some((c) => c.ambientCredentials && c.kind === \"s3\")) extensions.add(\"aws\");\n if (catalogs.some((c) => c.kind === \"iceberg-rest\")) extensions.add(\"iceberg\").add(\"httpfs\");\n if (catalogs.some((c) => c.kind === \"postgres\")) extensions.add(\"postgres\");\n for (const extension of extensions) await connection.query(`INSTALL ${extension}; LOAD ${extension};`);\n for (const item of connections) {\n const sql = secretSql(item, await secretOf(item.secret));\n if (sql) await connection.query(sql);\n }\n // Dates and times mean the same wherever the server runs: truncating to a day or month uses UTC.\n await connection.query(\"SET GLOBAL TimeZone = 'UTC'\");\n for (const catalog of catalogs) {\n const secret = ident(`sf_catalog_${catalog.name}`);\n try {\n if (catalog.kind === \"duckdb\") {\n await connection.query(`ATTACH ${text(path.resolve(catalog.uri))} AS ${ident(catalog.name)} (READ_ONLY)`);\n } else if (catalog.kind === \"postgres\") {\n if (/\\bpassword\\s*=/i.test(catalog.uri)) throw new EngineError(\"UNSUPPORTED\", `Take the password out of the address for \"${catalog.name}\" and name a secret instead.`);\n const password = (await secretOf(catalog.secret))?.password;\n if (password) await connection.query(`CREATE OR REPLACE SECRET ${secret} (TYPE postgres, PASSWORD ${text(password)})`);\n await connection.query(`ATTACH ${text(catalog.uri)} AS ${ident(catalog.name)} (TYPE postgres${password ? `, SECRET ${secret}` : \"\"}, READ_ONLY)`);\n } else {\n const token = (await secretOf(catalog.secret))?.token;\n if (token) await connection.query(`CREATE OR REPLACE SECRET ${secret} (TYPE iceberg, TOKEN ${text(token)})`);\n await connection.query(\n `ATTACH ${text(catalog.warehouse ?? \"\")} AS ${ident(catalog.name)} (TYPE iceberg, ENDPOINT ${text(catalog.uri)}${token ? `, SECRET ${secret}` : \"\"})`,\n );\n }\n } catch (error) {\n // A missing secret or a bad address is a mistake in the config: say so at once.\n if (error instanceof EngineError || catalog.kind === \"duckdb\") throw error;\n // A database that is down must not stop the other sources from working.\n unreachable.set(catalog.name, engineError(error).message);\n attached.delete(catalog.name.toLowerCase());\n }\n }\n for (const table of tables.values()) {\n try {\n await connection.query(`CREATE OR REPLACE VIEW ${ident(table.name)} AS SELECT * FROM ${scan(table)}`);\n if (table.comment) await connection.query(`COMMENT ON VIEW ${ident(table.name)} IS ${text(table.comment)}`);\n } catch (error) {\n // A table on a store that cannot be reached must not stop the others from working.\n if (!isRemotePath(table.path)) throw error;\n unreachable.set(table.name, engineError(error).message);\n }\n }\n await connection.query(`CREATE SCHEMA IF NOT EXISTS ${ident(RESULTS)}`);\n await connection.query(\"SET GLOBAL errors_as_json = true\");\n if (options.lockFileAccess ?? true) {\n // Only the registered tables' folders, the connections' scopes and the catalogs' endpoints can be read.\n const local = [...tables.values()].filter((t) => !isRemotePath(t.path)).map((t) => (fs.existsSync(t.path) && fs.statSync(t.path).isDirectory() ? t.path : path.dirname(t.path)));\n const remote = [...tables.values()].filter((t) => isRemotePath(t.path) && !connections.some((c) => t.path.startsWith(c.scope))).map((t) => t.path);\n const roots = [...new Set([...local, ...remote, ...connections.map((c) => c.scope), ...catalogs.map((c) => (c.kind === \"duckdb\" ? path.dirname(path.resolve(c.uri)) : c.uri))])];\n await connection.query(`SET allowed_directories = [${roots.map(text).join(\", \")}]`);\n await connection.query(\"SET enable_external_access = false\");\n await connection.query(\"SET lock_configuration = true\");\n }\n });\n\n /** Tables and views built by pipelines, by lower-cased name. */\n const built = new Map<string, { name: string; view: boolean }>();\n const FORMAT_NAME: Partial<Record<TableFormat, DuckDbTableFormat>> = {\n [TableFormat.PARQUET]: \"parquet\",\n [TableFormat.CSV]: \"csv\",\n [TableFormat.JSON]: \"json\",\n [TableFormat.DELTA]: \"delta\",\n [TableFormat.ICEBERG]: \"iceberg\",\n };\n\n /** Queries may not inspect stored credentials, even though the engine redacts them. */\n const guard = (sql: string) => {\n if (SECRET_FUNCTIONS.test(sql)) throw new EngineError(\"UNSUPPORTED\", \"Queries cannot read connection secrets.\");\n if (PASS_THROUGH.test(sql)) throw new EngineError(\"UNSUPPORTED\", \"Queries cannot send SQL straight to an attached database. Name its tables instead, e.g. pg.sales.orders.\");\n };\n const isAttached = (ref: TableRef | undefined) => attached.has((ref?.catalog ?? \"\").toLowerCase());\n const qualified = (ref: TableRef) => [ref.catalog, ref.schema, ref.table].map(ident).join(\".\");\n\n const lookup = (ref: TableRef | undefined): DuckDbTable => {\n const table = tables.get((ref?.table ?? \"\").toLowerCase());\n if (!table) throw new EngineError(\"UNKNOWN_TABLE\", `Table not found: ${ref?.table ?? \"\"}`);\n return table;\n };\n\n const pinned = (at: TimeTravel | undefined): DuckDbTable[] => {\n if (!at?.at.case) return [];\n if (at.table) return [lookup({ table: at.table } as TableRef)];\n // With no table named, pin every table that understands this kind of pin:\n // version numbers belong to Delta, snapshot IDs and timestamps to Iceberg.\n const format = at.at.case === \"version\" ? \"delta\" : \"iceberg\";\n return [...tables.values()].filter((t) => t.format === format);\n };\n\n return {\n kind: EngineKind.DUCKDB,\n dialect: SqlDialect.DUCKDB,\n capabilities: {\n cancel: true,\n explain: true,\n explainJson: true,\n timeTravel: formats.has(\"delta\") || formats.has(\"iceberg\"),\n keysetPaging: false,\n storedResults: true,\n exactCount: true,\n columnStats: false,\n },\n\n connections: [\n ...connections.map((c) => ({\n name: c.name,\n kind: { s3: ConnectionKind.S3, gcs: ConnectionKind.GCS, azure: ConnectionKind.AZURE, http: ConnectionKind.HTTP }[c.kind],\n scope: c.scope,\n credentialsSecret: c.secret ?? \"\",\n region: c.region ?? \"\",\n ambientCredentials: c.ambientCredentials ?? false,\n })),\n ...catalogs.map((c) => ({\n name: c.name,\n kind: CATALOG_KIND[c.kind],\n scope: shown(c),\n credentialsSecret: c.secret ?? \"\",\n })),\n ],\n\n async check(): Promise<EngineCheck[]> {\n const targets = [\n ...[...tables.values()].filter((t) => !unreachable.has(t.name)).map((t) => ({ name: t.name, sql: `SELECT * FROM ${ident(t.name)} LIMIT 0` })),\n ...catalogs.filter((c) => !unreachable.has(c.name)).map((c) => ({ name: c.name, sql: `SELECT 1 FROM information_schema.schemata WHERE catalog_name = ${text(c.name)} LIMIT 1` })),\n ];\n const failed = [...unreachable].map(([name, message]) => ({ name, ok: false, message, elapsedMs: 0 }));\n const checked = await Promise.all(\n targets.map(async (target) => {\n const started = Date.now();\n try {\n await withConnection((connection) => connection.query(target.sql));\n return { name: target.name, ok: true, message: \"Reachable\", elapsedMs: Date.now() - started };\n } catch (error) {\n return { name: target.name, ok: false, message: error instanceof Error ? error.message : String(error), elapsedMs: Date.now() - started };\n }\n }),\n );\n return [...checked, ...failed].sort((a, b) => a.name.localeCompare(b.name));\n },\n\n async execute(sql: string, params: Param[], executeOptions: ExecuteOptions = {}): Promise<EngineResult> {\n guard(sql);\n const connection = await database.connect();\n const close = () => connection.close().catch(() => {});\n try {\n for (const table of pinned(executeOptions.timeTravel)) {\n await connection.query(\n `CREATE OR REPLACE TEMP VIEW ${ident(table.name)} AS SELECT * FROM ${scan(table, executeOptions.timeTravel)}`,\n );\n }\n const reader = await connection.queryStream(sql, params.length > 0 ? bindTable(params) : undefined);\n // The reader's schema is only known once it has been opened.\n const iterator = reader[Symbol.asyncIterator]();\n const first = await iterator.next();\n const signal = executeOptions.signal;\n async function* batches(): AsyncGenerator<RecordBatch> {\n try {\n let current = first;\n while (!current.done) {\n if (signal?.aborted) throw new EngineError(\"CANCELLED\", \"The query was cancelled.\");\n yield current.value;\n current = await iterator.next();\n }\n } catch (error) {\n throw engineError(error);\n } finally {\n await iterator.return?.();\n await close();\n }\n }\n return { schema: reader.schema, batches: batches() };\n } catch (error) {\n await close();\n throw engineError(error);\n }\n },\n\n async explain(sql, params) {\n guard(sql);\n const connection = await database.connect();\n try {\n const bound = params.length > 0 ? bindTable(params) : undefined;\n const plan = rows(await connection.query(`EXPLAIN ${sql}`, bound));\n const json = rows(await connection.query(`EXPLAIN (FORMAT JSON) ${sql}`, bound));\n const value = (r: Record<string, unknown>[]) => r.map((x) => String(x.explain_value ?? \"\")).join(\"\\n\");\n return { planText: value(plan), planJson: value(json) };\n } catch (error) {\n throw engineError(error, \"EXPLAIN \".length);\n } finally {\n await connection.close().catch(() => {});\n }\n },\n\n async store(sql: string, params: Param[], storeOptions: StoreOptions): Promise<StoredRelation> {\n guard(sql);\n const relation = `${ident(RESULTS)}.${ident(`r_${randomUUID().replace(/-/g, \"\")}`)}`;\n const connection = await database.connect();\n try {\n for (const table of pinned(storeOptions.timeTravel)) {\n await connection.query(\n `CREATE OR REPLACE TEMP VIEW ${ident(table.name)} AS SELECT * FROM ${scan(table, storeOptions.timeTravel)}`,\n );\n }\n // One row past the limit shows whether the result was cut short.\n const created = await connection.query(\n `CREATE TABLE ${relation} AS SELECT * FROM (${sql}) AS \"_sf\" LIMIT ${storeOptions.maxRows + 1}`,\n params.length > 0 ? bindTable(params) : undefined,\n );\n const rowCount = Number(rows(created)[0]?.Count ?? 0);\n if (storeOptions.signal?.aborted) {\n await connection.query(`DROP TABLE IF EXISTS ${relation}`);\n throw new EngineError(\"CANCELLED\", \"The query was cancelled.\");\n }\n return { relation, rowCount: Math.min(rowCount, storeOptions.maxRows), complete: rowCount <= storeOptions.maxRows };\n } catch (error) {\n throw engineError(error);\n } finally {\n await connection.close().catch(() => {});\n }\n },\n\n async materialize(name, sql, materializeOptions = {}) {\n if (!/^[A-Za-z_][A-Za-z0-9_]*$/.test(name)) throw new EngineError(\"UNSUPPORTED\", `Dataset names use letters, digits and underscores: ${name}`);\n if (tables.has(name.toLowerCase())) throw new EngineError(\"UNSUPPORTED\", `\"${name}\" is already a table of this source.`);\n guard(sql);\n return withConnection(async (connection) => {\n const existing = built.get(name.toLowerCase());\n // A table cannot replace a view of the same name, or the reverse, without dropping it first.\n if (existing && existing.view !== Boolean(materializeOptions.view)) await connection.query(`DROP ${existing.view ? \"VIEW\" : \"TABLE\"} IF EXISTS ${ident(existing.name)}`);\n if (materializeOptions.view) {\n await connection.query(`CREATE OR REPLACE VIEW ${ident(name)} AS ${sql}`);\n built.set(name.toLowerCase(), { name, view: true });\n return { rowCount: 0 };\n }\n const created = await connection.query(`CREATE OR REPLACE TABLE ${ident(name)} AS ${sql}`);\n built.set(name.toLowerCase(), { name, view: false });\n return { rowCount: Number(rows(created)[0]?.Count ?? 0) };\n });\n },\n\n dropMaterialized: (name) =>\n withConnection(async (connection) => {\n const existing = built.get(name.toLowerCase());\n if (!existing) return;\n await connection.query(`DROP ${existing.view ? \"VIEW\" : \"TABLE\"} IF EXISTS ${ident(existing.name)}`);\n built.delete(name.toLowerCase());\n }),\n\n async listFiles(dir) {\n // The same places queries may read: the folders of the registered tables and the connections' scopes.\n const everyFolder = [...new Set([...tables.values()].filter((t) => !isRemotePath(t.path)).map((t) => localFolder(t.path)))];\n // A table's folder inside another table's folder is reached through it, not listed twice.\n const localRoots = everyFolder.filter((folder) => !everyFolder.some((other) => other !== folder && folder.startsWith(other + path.sep)));\n const scopes = connections.map((c) => c.scope.replace(/\\/+$/, \"\"));\n const tableAt = (where: string) => [...tables.values()].find((t) => (isRemotePath(t.path) ? t.path.replace(/\\/+$/, \"\") === where : path.resolve(t.path) === where))?.name ?? \"\";\n if (!dir) {\n return {\n entries: [\n ...localRoots.map((root) => ({ name: path.basename(root) || root, path: root, kind: FileEntryKind.FOLDER, format: folderFormat(root), table: tableAt(root) })),\n ...scopes.map((scope) => ({ name: scope, path: scope, kind: FileEntryKind.FOLDER, format: TableFormat.UNSPECIFIED, table: tableAt(scope) })),\n ],\n };\n }\n if (isRemotePath(dir)) {\n const folder = dir.replace(/\\/+$/, \"\");\n if (!scopes.some((scope) => folder === scope || folder.startsWith(`${scope}/`))) throw new EngineError(\"UNSUPPORTED\", \"That location is outside what this source may read.\");\n // An object store has no folders: everything under the prefix is listed (up to a cap) and grouped by its next path part.\n const found = await withConnection(async (connection) => rows(await connection.query(`SELECT file FROM glob(${text(`${folder}/**`)}) LIMIT ${FILE_LIST_CAP + 1}`)));\n const folders = new Set<string>();\n const files: string[] = [];\n for (const row of found.slice(0, FILE_LIST_CAP)) {\n const rest = String(row.file).slice(folder.length + 1);\n const cut = rest.indexOf(\"/\");\n if (cut < 0) files.push(rest);\n else folders.add(rest.slice(0, cut));\n }\n return {\n entries: [\n ...[...folders].sort().map((name) => ({ name, path: `${folder}/${name}`, kind: FileEntryKind.FOLDER, format: TableFormat.UNSPECIFIED, table: tableAt(`${folder}/${name}`) })),\n ...files.sort().map((name) => ({ name, path: `${folder}/${name}`, kind: FileEntryKind.FILE, format: fileFormat(name), table: tableAt(`${folder}/${name}`) })),\n ],\n truncated: found.length > FILE_LIST_CAP,\n };\n }\n // A local folder is read from disk, after checking where it really is: `..` and links cannot lead outside the roots.\n let real: string;\n try {\n real = fs.realpathSync(path.resolve(dir));\n } catch {\n throw new EngineError(\"UNSUPPORTED\", \"That folder does not exist.\");\n }\n const inside = localRoots.some((root) => {\n const base = fs.existsSync(root) ? fs.realpathSync(root) : root;\n return real === base || real.startsWith(base + path.sep);\n });\n if (!inside) throw new EngineError(\"UNSUPPORTED\", \"That location is outside what this source may read.\");\n if (!fs.statSync(real).isDirectory()) throw new EngineError(\"UNSUPPORTED\", \"That is a file, not a folder.\");\n const names = fs.readdirSync(real, { withFileTypes: true }).filter((entry) => !entry.name.startsWith(\".\"));\n const entries = names.slice(0, FILE_LIST_CAP).flatMap((entry) => {\n const full = path.join(real, entry.name);\n let stat: fs.Stats;\n try {\n stat = fs.statSync(full);\n } catch {\n return [];\n }\n const folder = stat.isDirectory();\n return [\n {\n name: entry.name,\n path: full,\n kind: folder ? FileEntryKind.FOLDER : FileEntryKind.FILE,\n ...(folder ? {} : { sizeBytes: BigInt(stat.size) }),\n modifiedAt: stat.mtime.toISOString(),\n format: folder ? folderFormat(full) : fileFormat(entry.name),\n table: tableAt(full),\n },\n ];\n });\n entries.sort((a, b) => a.kind - b.kind || a.name.localeCompare(b.name));\n return { entries, truncated: names.length > FILE_LIST_CAP };\n },\n\n inspect: (format, location) =>\n withConnection(async (connection) => {\n const kind = FORMAT_NAME[format];\n if (!kind) throw new EngineError(\"UNSUPPORTED\", \"Choose Parquet, CSV, JSON, Delta or Iceberg.\");\n if (!isRemotePath(location) && !path.isAbsolute(location)) throw new EngineError(\"UNSUPPORTED\", \"Give the full path, or an address such as s3://bucket/folder.\");\n // The location is a quoted literal, and the engine's own access rules decide whether it may be read.\n const relation = scan({ name: \"inspect\", format: kind, path: location });\n const described = rows(await connection.query(`DESCRIBE SELECT * FROM ${relation}`));\n const schema = (await connection.query(`SELECT * FROM ${relation} LIMIT 0`)).schema;\n const counted = kind === \"csv\" || kind === \"json\" ? undefined : rows(await connection.query(`SELECT COUNT(*) AS n FROM ${relation}`))[0]?.n;\n return {\n columns: described.map((column, i) => ({\n name: String(column.column_name),\n nativeType: String(column.column_type),\n arrowType: String(schema.fields[i]?.type ?? \"\"),\n nullable: column.null !== \"NO\",\n ordinal: i + 1,\n })),\n rowCount: counted === undefined ? undefined : BigInt(counted as bigint | number),\n };\n }),\n\n dropStored: (relation) =>\n withConnection(async (connection) => {\n // Only names this adapter made are dropped.\n if (!relation.startsWith(`${ident(RESULTS)}.\"r_`)) return;\n await connection.query(`DROP TABLE IF EXISTS ${relation}`);\n }),\n\n listCatalogs: async () => [{ name: CATALOG }, ...catalogs.filter((c) => attached.has(c.name.toLowerCase())).map((c) => ({ name: c.name }))],\n\n async listSchemas(catalog) {\n if (!attached.has(catalog.toLowerCase())) return catalog === \"\" || catalog === CATALOG ? [{ catalog: CATALOG, name: SCHEMA }] : [];\n return withConnection(async (connection) => {\n const found = await connection.query(\n `SELECT schema_name AS name FROM information_schema.schemata WHERE catalog_name = ${text(catalog)} AND schema_name NOT IN ('information_schema') AND schema_name NOT LIKE 'pg\\\\_%' ESCAPE '\\\\' ORDER BY 1`,\n );\n return rows(found).map((r) => ({ catalog, name: String(r.name) }));\n });\n },\n\n async listTables({ catalog, schema, search }) {\n const needle = search.toLowerCase();\n const registered =\n catalog === \"\" || catalog === CATALOG\n ? [...tables.values()]\n .filter((t) => t.name.toLowerCase().includes(needle))\n .sort((a, b) => a.name.localeCompare(b.name))\n .map((t) => ({\n ref: { catalog: CATALOG, schema: SCHEMA, table: t.name },\n kind: TableKind.EXTERNAL,\n format: FORMAT[t.format],\n comment: t.comment ?? \"\",\n }))\n : [];\n if (catalog === \"\" || catalog === CATALOG) {\n for (const item of [...built.values()].sort((a, b) => a.name.localeCompare(b.name))) {\n if (!item.name.toLowerCase().includes(needle)) continue;\n registered.push({ ref: { catalog: CATALOG, schema: SCHEMA, table: item.name }, kind: item.view ? TableKind.VIEW : TableKind.TABLE, format: TableFormat.UNSPECIFIED, comment: \"Built by a pipeline\" });\n }\n }\n const wanted = catalogs.filter((c) => attached.has(c.name.toLowerCase()) && (catalog === \"\" || c.name.toLowerCase() === catalog.toLowerCase()));\n if (wanted.length === 0) return registered;\n const kindOf = new Map(catalogs.map((c) => [c.name.toLowerCase(), c.kind]));\n // The engine filters and caps the list, so a catalog with very many tables is never read whole.\n const found = await withConnection((connection) =>\n connection.query(\n `SELECT table_catalog AS c, table_schema AS s, table_name AS t, table_type AS k FROM information_schema.tables WHERE table_catalog IN (${wanted.map((c) => text(c.name)).join(\", \")})${schema ? ` AND table_schema = ${text(schema)}` : \"\"} AND table_schema NOT IN ('information_schema', ${text(RESULTS)}) AND table_schema NOT LIKE 'pg\\\\_%' ESCAPE '\\\\' AND lower(table_name) LIKE ${text(`%${needle.replace(/[\\\\%_]/g, (ch) => `\\\\${ch}`)}%`)} ESCAPE '\\\\' ORDER BY 1, 2, 3 LIMIT 5000`,\n ),\n );\n return [\n ...registered,\n ...rows(found).map((r) => ({\n ref: { catalog: String(r.c), schema: String(r.s), table: String(r.t) },\n kind: r.k === \"VIEW\" ? TableKind.VIEW : TableKind.TABLE,\n format: kindOf.get(String(r.c).toLowerCase()) === \"iceberg-rest\" ? TableFormat.ICEBERG : TableFormat.UNSPECIFIED,\n comment: \"\",\n })),\n ];\n },\n\n describeTable: (ref, includeStats) =>\n withConnection(async (connection) => {\n // A table named without its catalog is looked for in the attached ones, when it is not one of this source's own.\n if (!isAttached(ref) && attached.size > 0 && !tables.has((ref?.table ?? \"\").toLowerCase()) && !built.has((ref?.table ?? \"\").toLowerCase())) {\n const found = rows(\n await connection.query(\n `SELECT table_catalog AS c, table_schema AS s, table_name AS t FROM information_schema.tables WHERE table_catalog IN (${[...attached].map(text).join(\", \")}) AND lower(table_name) = ${text((ref?.table ?? \"\").toLowerCase())}${ref?.schema ? ` AND table_schema = ${text(ref.schema)}` : \"\"} AND table_schema NOT LIKE 'pg\\\\_%' ESCAPE '\\\\' AND table_schema <> 'information_schema' LIMIT 2`,\n ),\n );\n if (found.length > 1) throw new EngineError(\"UNKNOWN_TABLE\", `More than one table is called ${ref?.table}. Say which schema it is in.`);\n if (found.length === 1) ref = { ...ref, catalog: String(found[0]!.c), schema: String(found[0]!.s), table: String(found[0]!.t) } as TableRef;\n }\n if (isAttached(ref)) {\n const name = qualified(ref);\n const columns = rows(await connection.query(`DESCRIBE ${name}`));\n const schema = (await connection.query(`SELECT * FROM ${name} LIMIT 0`)).schema;\n const total = includeStats ? rows(await connection.query(`SELECT COUNT(*) AS n FROM ${name}`))[0]?.n : undefined;\n return {\n summary: { ref: { catalog: ref.catalog, schema: ref.schema, table: ref.table }, kind: TableKind.TABLE },\n columns: columns.map((column, i) => ({\n name: String(column.column_name),\n nativeType: String(column.column_type),\n arrowType: String(schema.fields[i]?.type ?? \"\"),\n nullable: column.null !== \"NO\",\n ordinal: i + 1,\n })),\n rowCount: total === undefined ? undefined : BigInt(total as bigint | number),\n };\n }\n const made = built.get((ref?.table ?? \"\").toLowerCase());\n if (made) {\n const columns = rows(await connection.query(`DESCRIBE ${ident(made.name)}`));\n const schema = (await connection.query(`SELECT * FROM ${ident(made.name)} LIMIT 0`)).schema;\n const total = includeStats ? rows(await connection.query(`SELECT COUNT(*) AS n FROM ${ident(made.name)}`))[0]?.n : undefined;\n return {\n summary: { ref: { catalog: CATALOG, schema: SCHEMA, table: made.name }, kind: made.view ? TableKind.VIEW : TableKind.TABLE, comment: \"Built by a pipeline\" },\n columns: columns.map((column, i) => ({\n name: String(column.column_name),\n nativeType: String(column.column_type),\n arrowType: String(schema.fields[i]?.type ?? \"\"),\n nullable: column.null !== \"NO\",\n ordinal: i + 1,\n })),\n rowCount: total === undefined ? undefined : BigInt(total as bigint | number),\n };\n }\n const table = lookup(ref);\n const described = rows(await connection.query(`DESCRIBE ${ident(table.name)}`));\n const arrow = (await connection.query(`SELECT * FROM ${ident(table.name)} LIMIT 0`)).schema;\n const count = includeStats\n ? rows(await connection.query(`SELECT COUNT(*) AS n FROM ${ident(table.name)}`))[0]?.n\n : undefined;\n return withTableModel({\n summary: {\n ref: { catalog: CATALOG, schema: SCHEMA, table: table.name },\n kind: TableKind.EXTERNAL,\n format: FORMAT[table.format],\n comment: table.comment ?? \"\",\n },\n columns: described.map((column, i) => ({\n name: String(column.column_name),\n nativeType: String(column.column_type),\n arrowType: String(arrow.fields[i]?.type ?? \"\"),\n nullable: column.null !== \"NO\",\n ordinal: i + 1,\n })),\n rowCount: count === undefined ? undefined : BigInt(count as bigint | number),\n location: table.path,\n properties: { format: table.format },\n }, table.model);\n }),\n\n async listSnapshots(ref) {\n if (isAttached(ref) || built.has((ref?.table ?? \"\").toLowerCase())) return [];\n const table = lookup(ref);\n if (table.format === \"iceberg\") {\n return withConnection(async (connection) => {\n const found = await connection.query(\n `SELECT CAST(snapshot_id AS VARCHAR) AS id, CAST(sequence_number AS VARCHAR) AS seq, strftime(timestamp_ms, '%Y-%m-%dT%H:%M:%S.%gZ') AS at FROM iceberg_snapshots(${icebergArgs(table.path, true)}) ORDER BY sequence_number DESC`,\n );\n return rows(found).map((s) => ({\n id: String(s.id),\n committedAt: String(s.at),\n operation: \"\",\n summary: { sequence_number: String(s.seq) },\n }));\n });\n }\n if (table.format === \"delta\") {\n const log = path.join(table.path, \"_delta_log\");\n const commits = fs.existsSync(log) ? fs.readdirSync(log).filter((f) => /^\\d{20}\\.json$/.test(f)) : [];\n return commits\n .sort()\n .reverse()\n .map((file) => {\n const info = fs\n .readFileSync(path.join(log, file), \"utf8\")\n .split(\"\\n\")\n .filter(Boolean)\n .map((line) => JSON.parse(line) as { commitInfo?: { timestamp?: number; operation?: string } })\n .find((entry) => entry.commitInfo)?.commitInfo;\n return {\n id: String(Number(file.slice(0, 20))),\n committedAt: info?.timestamp ? new Date(info.timestamp).toISOString() : \"\",\n operation: info?.operation ?? \"\",\n };\n });\n }\n return [];\n },\n\n version: () => withConnection(async (c) => String(rows(await c.query(\"SELECT version() AS v\"))[0]?.v ?? \"\")),\n close: () => database.close(),\n };\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,57 @@
1
1
  {
2
2
  "name": "@surfaces-ui/engine-duckdb",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
3
+ "version": "0.2.0",
4
+ "description": "DuckDB engine adapter (Node, ADBC)",
5
+ "keywords": [
6
+ "surfaces-ui",
7
+ "analytics",
8
+ "data",
9
+ "duckdb",
10
+ "parquet",
11
+ "delta",
12
+ "iceberg"
13
+ ],
14
+ "license": "Apache-2.0",
15
+ "repository": {
16
+ "type": "git",
17
+ "url": "git+https://github.com/teradata-labs/surfaces-ui.git",
18
+ "directory": "packages/engine-duckdb"
19
+ },
20
+ "homepage": "https://github.com/teradata-labs/surfaces-ui#readme",
21
+ "bugs": {
22
+ "url": "https://github.com/teradata-labs/surfaces-ui/issues"
23
+ },
24
+ "type": "module",
25
+ "main": "./dist/index.js",
26
+ "types": "./dist/index.d.ts",
27
+ "exports": {
28
+ ".": {
29
+ "types": "./dist/index.d.ts",
30
+ "default": "./dist/index.js"
31
+ }
32
+ },
33
+ "files": [
34
+ "dist",
35
+ "NOTICE"
36
+ ],
37
+ "dependencies": {
38
+ "@apache-arrow/adbc-driver-manager": "^0.25.0",
39
+ "@bufbuild/protobuf": "^2.17.0",
40
+ "@duckdb/node-bindings": "2.0.0-r.1",
41
+ "apache-arrow": "^21.2.0",
42
+ "@surfaces-ui/engine": "0.2.0",
43
+ "@surfaces-ui/proto": "0.2.0"
44
+ },
45
+ "devDependencies": {
46
+ "@types/node": "^26.6.6"
47
+ },
48
+ "publishConfig": {
49
+ "access": "public",
50
+ "provenance": true
51
+ },
52
+ "scripts": {
53
+ "build": "tsc -p tsconfig.build.json",
54
+ "typecheck": "tsc -p tsconfig.json --noEmit",
55
+ "test": "vitest run --passWithNoTests"
56
+ }
6
57
  }