@photostructure/sqlite 0.0.1 → 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.
Files changed (56) hide show
  1. package/CHANGELOG.md +36 -2
  2. package/README.md +45 -484
  3. package/SECURITY.md +27 -84
  4. package/binding.gyp +69 -22
  5. package/dist/index.cjs +185 -18
  6. package/dist/index.cjs.map +1 -1
  7. package/dist/index.d.cts +552 -100
  8. package/dist/index.d.mts +552 -100
  9. package/dist/index.d.ts +552 -100
  10. package/dist/index.mjs +183 -18
  11. package/dist/index.mjs.map +1 -1
  12. package/package.json +51 -41
  13. package/prebuilds/darwin-arm64/@photostructure+sqlite.glibc.node +0 -0
  14. package/prebuilds/darwin-x64/@photostructure+sqlite.glibc.node +0 -0
  15. package/prebuilds/linux-arm64/@photostructure+sqlite.glibc.node +0 -0
  16. package/prebuilds/linux-arm64/@photostructure+sqlite.musl.node +0 -0
  17. package/prebuilds/linux-x64/@photostructure+sqlite.glibc.node +0 -0
  18. package/prebuilds/linux-x64/@photostructure+sqlite.musl.node +0 -0
  19. package/prebuilds/test_extension.so +0 -0
  20. package/prebuilds/win32-x64/@photostructure+sqlite.glibc.node +0 -0
  21. package/src/aggregate_function.cpp +503 -235
  22. package/src/aggregate_function.h +57 -42
  23. package/src/binding.cpp +117 -14
  24. package/src/dirname.ts +1 -1
  25. package/src/index.ts +122 -332
  26. package/src/lru-cache.ts +84 -0
  27. package/src/shims/env-inl.h +6 -15
  28. package/src/shims/node_errors.h +4 -0
  29. package/src/shims/sqlite_errors.h +162 -0
  30. package/src/shims/util.h +29 -4
  31. package/src/sql-tag-store.ts +140 -0
  32. package/src/sqlite_exception.h +49 -0
  33. package/src/sqlite_impl.cpp +711 -127
  34. package/src/sqlite_impl.h +84 -6
  35. package/src/{stack_path.ts → stack-path.ts} +7 -1
  36. package/src/types/aggregate-options.ts +22 -0
  37. package/src/types/changeset-apply-options.ts +18 -0
  38. package/src/types/database-sync-instance.ts +203 -0
  39. package/src/types/database-sync-options.ts +69 -0
  40. package/src/types/session-options.ts +10 -0
  41. package/src/types/sql-tag-store-instance.ts +51 -0
  42. package/src/types/sqlite-authorization-actions.ts +77 -0
  43. package/src/types/sqlite-authorization-results.ts +15 -0
  44. package/src/types/sqlite-changeset-conflict-types.ts +19 -0
  45. package/src/types/sqlite-changeset-resolution.ts +15 -0
  46. package/src/types/sqlite-open-flags.ts +50 -0
  47. package/src/types/statement-sync-instance.ts +73 -0
  48. package/src/types/user-functions-options.ts +14 -0
  49. package/src/upstream/node_sqlite.cc +960 -259
  50. package/src/upstream/node_sqlite.h +127 -2
  51. package/src/upstream/sqlite.js +1 -14
  52. package/src/upstream/sqlite3.c +4510 -1411
  53. package/src/upstream/sqlite3.h +390 -195
  54. package/src/upstream/sqlite3ext.h +7 -0
  55. package/src/user_function.cpp +88 -36
  56. package/src/user_function.h +2 -1
package/dist/index.mjs CHANGED
@@ -9,7 +9,7 @@ var __dirname = /* @__PURE__ */ getDirname();
9
9
  import nodeGypBuild from "node-gyp-build";
10
10
  import { join } from "path";
11
11
 
12
- // src/stack_path.ts
12
+ // src/stack-path.ts
13
13
  import { dirname } from "path";
14
14
  function getCallerDirname() {
15
15
  const e = new Error();
@@ -19,6 +19,10 @@ function getCallerDirname() {
19
19
  return dirname(extractCallerPath(e.stack));
20
20
  }
21
21
  var patterns = process.platform === "win32" ? [
22
+ // File URLs: "at functionName (file:///C:/path/file.js:1:1)"
23
+ /\bat\s.+?\((?<path>file:\/\/\/.+?):\d+:\d+\)$/,
24
+ // File URLs direct: "at file:///C:/path/file.js:1:1"
25
+ /\bat\s(?<path>file:\/\/\/.+?):\d+:\d+$/,
22
26
  // Standard: "at functionName (C:\path\file.js:1:1)"
23
27
  /\bat\s.+?\((?<path>[A-Z]:\\.+):\d+:\d+\)$/,
24
28
  // direct: "at C:\path\file.js:1:1"
@@ -31,7 +35,8 @@ var patterns = process.platform === "win32" ? [
31
35
  // Standard: "at functionName (/path/file.js:1:1)"
32
36
  /\bat\s.+?\((?<path>\/.+?):\d+:\d+\)$/,
33
37
  // Anonymous or direct: "at /path/file.js:1:1"
34
- /\bat\s(.+[^/]\s)?(?<path>\/.+?):\d+:\d+$/
38
+ // eslint-disable-next-line security/detect-unsafe-regex -- Pattern is safe: no nested quantifiers
39
+ /\bat\s(?:[^\s()]+\s)?(?<path>\/[^:]+):\d+:\d+$/
35
40
  ];
36
41
  var MaybeUrlRE = /^[a-z]{2,5}:\/\//i;
37
42
  function extractCallerPath(stack) {
@@ -70,33 +75,193 @@ function _dirname() {
70
75
  return getCallerDirname();
71
76
  }
72
77
 
73
- // src/index.ts
74
- var binding = nodeGypBuild(join(_dirname(), ".."));
75
- if (binding.DatabaseSync && typeof Symbol.dispose !== "undefined") {
76
- binding.DatabaseSync.prototype[Symbol.dispose] = function() {
77
- try {
78
- this.close();
79
- } catch {
78
+ // src/lru-cache.ts
79
+ var LRUCache = class {
80
+ cache = /* @__PURE__ */ new Map();
81
+ maxCapacity;
82
+ constructor(capacity) {
83
+ if (capacity < 1) {
84
+ throw new RangeError("LRU cache capacity must be at least 1");
80
85
  }
81
- };
82
- }
83
- if (binding.StatementSync && typeof Symbol.dispose !== "undefined") {
84
- binding.StatementSync.prototype[Symbol.dispose] = function() {
85
- try {
86
- this.finalize();
87
- } catch {
86
+ this.maxCapacity = capacity;
87
+ }
88
+ /**
89
+ * Get a value from the cache.
90
+ * If found, moves the entry to the end (most recently used).
91
+ */
92
+ get(key) {
93
+ const value = this.cache.get(key);
94
+ if (value !== void 0) {
95
+ this.cache.delete(key);
96
+ this.cache.set(key, value);
88
97
  }
89
- };
90
- }
98
+ return value;
99
+ }
100
+ /**
101
+ * Set a value in the cache.
102
+ * If key exists, updates and moves to end.
103
+ * If at capacity, evicts the oldest entry first.
104
+ */
105
+ set(key, value) {
106
+ if (this.cache.has(key)) {
107
+ this.cache.delete(key);
108
+ } else if (this.cache.size >= this.maxCapacity) {
109
+ const oldestKey = this.cache.keys().next().value;
110
+ if (oldestKey !== void 0) {
111
+ this.cache.delete(oldestKey);
112
+ }
113
+ }
114
+ this.cache.set(key, value);
115
+ }
116
+ /**
117
+ * Delete an entry from the cache.
118
+ */
119
+ delete(key) {
120
+ return this.cache.delete(key);
121
+ }
122
+ /**
123
+ * Check if a key exists in the cache.
124
+ * Does NOT update recency.
125
+ */
126
+ has(key) {
127
+ return this.cache.has(key);
128
+ }
129
+ /**
130
+ * Clear all entries from the cache.
131
+ */
132
+ clear() {
133
+ this.cache.clear();
134
+ }
135
+ /**
136
+ * Get the current number of entries in the cache.
137
+ */
138
+ size() {
139
+ return this.cache.size;
140
+ }
141
+ /**
142
+ * Get the maximum capacity of the cache.
143
+ */
144
+ capacity() {
145
+ return this.maxCapacity;
146
+ }
147
+ };
148
+
149
+ // src/sql-tag-store.ts
150
+ var DEFAULT_CAPACITY = 1e3;
151
+ var SQLTagStore = class {
152
+ database;
153
+ cache;
154
+ maxCapacity;
155
+ constructor(db, capacity = DEFAULT_CAPACITY) {
156
+ if (!db.isOpen) {
157
+ throw new Error("Database is not open");
158
+ }
159
+ this.database = db;
160
+ this.maxCapacity = capacity;
161
+ this.cache = new LRUCache(capacity);
162
+ }
163
+ /**
164
+ * Returns the associated database instance.
165
+ */
166
+ get db() {
167
+ return this.database;
168
+ }
169
+ /**
170
+ * Returns the maximum capacity of the statement cache.
171
+ */
172
+ get capacity() {
173
+ return this.maxCapacity;
174
+ }
175
+ /**
176
+ * Returns the current number of cached statements.
177
+ */
178
+ size() {
179
+ return this.cache.size();
180
+ }
181
+ /**
182
+ * Clears all cached statements.
183
+ */
184
+ clear() {
185
+ this.cache.clear();
186
+ }
187
+ /**
188
+ * Execute an INSERT, UPDATE, DELETE or other statement that doesn't return rows.
189
+ * Returns an object with `changes` and `lastInsertRowid`.
190
+ */
191
+ run(strings, ...values) {
192
+ const stmt = this.getOrPrepare(strings);
193
+ return stmt.run(...values);
194
+ }
195
+ /**
196
+ * Execute a query and return the first row, or undefined if no rows.
197
+ */
198
+ get(strings, ...values) {
199
+ const stmt = this.getOrPrepare(strings);
200
+ return stmt.get(...values);
201
+ }
202
+ /**
203
+ * Execute a query and return all rows as an array.
204
+ */
205
+ all(strings, ...values) {
206
+ const stmt = this.getOrPrepare(strings);
207
+ return stmt.all(...values);
208
+ }
209
+ /**
210
+ * Execute a query and return an iterator over the rows.
211
+ */
212
+ iterate(strings, ...values) {
213
+ const stmt = this.getOrPrepare(strings);
214
+ return stmt.iterate(...values);
215
+ }
216
+ /**
217
+ * Get a cached statement or prepare a new one.
218
+ * If a cached statement has been finalized, it's evicted and a new one is prepared.
219
+ */
220
+ getOrPrepare(strings) {
221
+ if (!this.database.isOpen) {
222
+ throw new Error("Database is not open");
223
+ }
224
+ const sql = this.buildSQL(strings);
225
+ const cached = this.cache.get(sql);
226
+ if (cached) {
227
+ if (!cached.finalized) {
228
+ return cached;
229
+ }
230
+ this.cache.delete(sql);
231
+ }
232
+ const stmt = this.database.prepare(sql);
233
+ this.cache.set(sql, stmt);
234
+ return stmt;
235
+ }
236
+ /**
237
+ * Build the SQL string by joining template parts with `?` placeholders.
238
+ */
239
+ buildSQL(strings) {
240
+ let sql = strings[0] ?? "";
241
+ for (let i = 1; i < strings.length; i++) {
242
+ sql += "?" + (strings[i] ?? "");
243
+ }
244
+ return sql;
245
+ }
246
+ };
247
+
248
+ // src/index.ts
249
+ var binding = nodeGypBuild(join(_dirname(), ".."));
91
250
  var DatabaseSync = binding.DatabaseSync;
251
+ DatabaseSync.prototype.createTagStore = function(capacity) {
252
+ return new SQLTagStore(this, capacity);
253
+ };
92
254
  var StatementSync = binding.StatementSync;
93
255
  var Session = binding.Session;
94
256
  var constants = binding.constants;
257
+ var backup = binding.backup;
95
258
  var index_default = binding;
96
259
  export {
97
260
  DatabaseSync,
261
+ SQLTagStore,
98
262
  Session,
99
263
  StatementSync,
264
+ backup,
100
265
  constants,
101
266
  index_default as default
102
267
  };
@@ -1 +1 @@
1
- {"version":3,"sources":["../node_modules/tsup/assets/esm_shims.js","../src/index.ts","../src/stack_path.ts","../src/dirname.ts"],"sourcesContent":["// Shim globals in esm bundle\nimport path from 'node:path'\nimport { fileURLToPath } from 'node:url'\n\nconst getFilename = () => fileURLToPath(import.meta.url)\nconst getDirname = () => path.dirname(getFilename())\n\nexport const __dirname = /* @__PURE__ */ getDirname()\nexport const __filename = /* @__PURE__ */ getFilename()\n","// Load the native binding with support for both CJS and ESM\nimport nodeGypBuild from \"node-gyp-build\";\nimport { join } from \"node:path\";\nimport { _dirname } from \"./dirname\";\n\n// Use _dirname() helper that works in both CJS/ESM and Jest\nconst binding = nodeGypBuild(join(_dirname(), \"..\"));\n\n/**\n * Configuration options for opening a database.\n * This interface matches Node.js sqlite module's DatabaseSyncOptions.\n */\nexport interface DatabaseSyncOptions {\n /** Path to the database file. Use ':memory:' for an in-memory database. */\n readonly location?: string;\n /** If true, the database is opened in read-only mode. @default false */\n readonly readOnly?: boolean;\n /** If true, foreign key constraints are enforced. @default true */\n readonly enableForeignKeyConstraints?: boolean;\n /** \n * If true, double-quoted string literals are allowed. \n *\n * If enabled, double quotes can be misinterpreted as identifiers instead of\n * string literals, leading to confusing errors. \n *\n * **The SQLite documentation strongly recommends avoiding double-quoted\n * strings entirely.**\n\n * @see https://sqlite.org/quirks.html#dblquote\n * @default false \n */\n readonly enableDoubleQuotedStringLiterals?: boolean;\n /**\n * Sets the busy timeout in milliseconds.\n * @default 5000\n */\n readonly timeout?: number;\n /** If true, enables loading of SQLite extensions. @default false */\n readonly allowExtension?: boolean;\n}\n\n/**\n * Options for creating a prepared statement.\n */\nexport interface StatementOptions {\n /** If true, the prepared statement's expandedSQL property will contain the expanded SQL. @default false */\n readonly expandedSQL?: boolean;\n /** If true, anonymous parameters are enabled for the statement. @default false */\n readonly anonymousParameters?: boolean;\n}\n\n/**\n * A prepared SQL statement that can be executed multiple times with different parameters.\n * This interface represents an instance of the StatementSync class.\n */\nexport interface StatementSyncInstance {\n /** The original SQL source string. */\n readonly sourceSQL: string;\n /** The expanded SQL string with bound parameters, if expandedSQL option was set. */\n readonly expandedSQL: string | undefined;\n /**\n * This method executes a prepared statement and returns an object.\n * @param parameters Optional named and anonymous parameters to bind to the statement.\n * @returns An object with the number of changes and the last insert rowid.\n */\n run(...parameters: any[]): {\n changes: number;\n lastInsertRowid: number | bigint;\n };\n /**\n * This method executes a prepared statement and returns the first result row.\n * @param parameters Optional named and anonymous parameters to bind to the statement.\n * @returns The first row from the query results, or undefined if no rows.\n */\n get(...parameters: any[]): any;\n /**\n * This method executes a prepared statement and returns all results as an array.\n * @param parameters Optional named and anonymous parameters to bind to the statement.\n * @returns An array of row objects from the query results.\n */\n all(...parameters: any[]): any[];\n /**\n * This method executes a prepared statement and returns an iterable iterator of objects.\n * Each object represents a row from the query results.\n * @param parameters Optional named and anonymous parameters to bind to the statement.\n * @returns An iterable iterator of row objects.\n */\n iterate(...parameters: any[]): IterableIterator<any>;\n /**\n * Set whether to read integer values as JavaScript BigInt.\n * @param readBigInts If true, read integers as BigInts. @default false\n */\n setReadBigInts(readBigInts: boolean): void;\n /**\n * Set whether to allow bare named parameters in SQL.\n * @param allowBareNamedParameters If true, allows bare named parameters. @default false\n */\n setAllowBareNamedParameters(allowBareNamedParameters: boolean): void;\n /**\n * Set whether to return results as arrays rather than objects.\n * @param returnArrays If true, return results as arrays. @default false\n */\n setReturnArrays(returnArrays: boolean): void;\n /**\n * Returns an array of objects, each representing a column in the statement's result set.\n * Each object has a 'name' property for the column name and a 'type' property for the SQLite type.\n * @returns Array of column metadata objects.\n */\n columns(): Array<{ name: string; type?: string }>;\n /**\n * Finalizes the prepared statement and releases its resources.\n * Called automatically by Symbol.dispose.\n */\n finalize(): void;\n /** Dispose of the statement resources using the explicit resource management protocol. */\n [Symbol.dispose](): void;\n}\n\nexport interface UserFunctionOptions {\n /** If `true`, sets the `SQLITE_DETERMINISTIC` flag. @default false */\n readonly deterministic?: boolean;\n /** If `true`, sets the `SQLITE_DIRECTONLY` flag. @default false */\n readonly directOnly?: boolean;\n /** If `true`, converts integer arguments to `BigInt`s. @default false */\n readonly useBigIntArguments?: boolean;\n /** If `true`, allows function to be invoked with variable arguments. @default false */\n readonly varargs?: boolean;\n}\n\nexport interface AggregateOptions {\n /** The initial value for the aggregation. */\n readonly start?: any;\n /** Function called for each row to update the aggregate state. */\n readonly step: (accumulator: any, ...args: any[]) => any;\n /** Optional function for window function support to reverse a step. */\n readonly inverse?: (accumulator: any, ...args: any[]) => any;\n /** Optional function to compute the final result from the accumulator. */\n readonly result?: (accumulator: any) => any;\n /** If `true`, sets the `SQLITE_DETERMINISTIC` flag. @default false */\n readonly deterministic?: boolean;\n /** If `true`, sets the `SQLITE_DIRECTONLY` flag. @default false */\n readonly directOnly?: boolean;\n /** If `true`, converts integer arguments to `BigInt`s. @default false */\n readonly useBigIntArguments?: boolean;\n /** If `true`, allows function to be invoked with variable arguments. @default false */\n readonly varargs?: boolean;\n}\n\nexport interface SessionOptions {\n /** The table to track changes for. If omitted, all tables are tracked. */\n readonly table?: string;\n /** The database name. @default \"main\" */\n readonly db?: string;\n}\n\nexport interface Session {\n /**\n * Generate a changeset containing all changes recorded by the session.\n * @returns A Buffer containing the changeset data.\n */\n changeset(): Buffer;\n /**\n * Generate a patchset containing all changes recorded by the session.\n * @returns A Buffer containing the patchset data.\n */\n patchset(): Buffer;\n /**\n * Close the session and release its resources.\n */\n close(): void;\n}\n\nexport interface ChangesetApplyOptions {\n /**\n * Function called when a conflict is detected during changeset application.\n * @param conflictType The type of conflict (SQLITE_CHANGESET_CONFLICT, etc.)\n * @returns One of SQLITE_CHANGESET_OMIT, SQLITE_CHANGESET_REPLACE, or SQLITE_CHANGESET_ABORT\n */\n readonly onConflict?: (conflictType: number) => number;\n /**\n * Function called to filter which tables to apply changes to.\n * @param tableName The name of the table\n * @returns true to include the table, false to skip it\n */\n readonly filter?: (tableName: string) => boolean;\n}\n\n/**\n * Represents a SQLite database connection.\n * This interface represents an instance of the DatabaseSync class.\n */\nexport interface DatabaseSyncInstance {\n /** Indicates whether the database connection is open. */\n readonly isOpen: boolean;\n /** Indicates whether a transaction is currently active. */\n readonly isTransaction: boolean;\n\n /**\n * Opens a database connection. This method is called automatically when creating\n * a DatabaseSync instance, so typically should not be called directly.\n * @param configuration Optional configuration for opening the database.\n */\n open(configuration?: DatabaseSyncOptions): void;\n /**\n * Closes the database connection. This method should be called to ensure that\n * the database connection is properly cleaned up. Once a database is closed,\n * it cannot be used again.\n */\n close(): void;\n /**\n * Returns the location of the database file. For attached databases, you can specify\n * the database name. Returns null for in-memory databases.\n * @param dbName The name of the database. Defaults to 'main' (the primary database).\n * @returns The file path of the database, or null for in-memory databases.\n */\n location(dbName?: string): string | null;\n /**\n * Compiles an SQL statement and returns a StatementSyncInstance object.\n * @param sql The SQL statement to prepare.\n * @param options Optional configuration for the statement.\n * @returns A StatementSyncInstance object that can be executed multiple times.\n */\n prepare(sql: string, options?: StatementOptions): StatementSyncInstance;\n /**\n * This method allows one or more SQL statements to be executed without\n * returning any results. This is useful for commands like CREATE TABLE,\n * INSERT, UPDATE, or DELETE.\n * @param sql The SQL statement(s) to execute.\n */\n exec(sql: string): void;\n\n /**\n * This method creates SQLite user-defined functions, wrapping sqlite3_create_function_v2().\n * @param name The name of the SQLite function to create.\n * @param func The JavaScript function to call when the SQLite function is invoked.\n */\n function(name: string, func: Function): void;\n /**\n * This method creates SQLite user-defined functions, wrapping sqlite3_create_function_v2().\n * @param name The name of the SQLite function to create.\n * @param options Optional configuration settings.\n * @param func The JavaScript function to call when the SQLite function is invoked.\n */\n function(name: string, options: UserFunctionOptions, func: Function): void;\n\n /**\n * This method creates SQLite aggregate functions, wrapping sqlite3_create_window_function().\n * @param name The name of the SQLite aggregate function to create.\n * @param options Configuration object containing step function and other settings.\n */\n aggregate(name: string, options: AggregateOptions): void;\n /**\n * Create a new session to record database changes.\n * @param options Optional configuration for the session.\n * @returns A Session object for recording changes.\n */\n createSession(options?: SessionOptions): Session;\n /**\n * Apply a changeset to the database.\n * @param changeset The changeset data to apply.\n * @param options Optional configuration for applying the changeset.\n * @returns true if successful, false if aborted.\n */\n applyChangeset(changeset: Buffer, options?: ChangesetApplyOptions): boolean;\n /**\n * Enables or disables the loading of SQLite extensions.\n * @param enable If true, enables extension loading. If false, disables it.\n */\n enableLoadExtension(enable: boolean): void;\n /**\n * Loads an SQLite extension from the specified file path.\n * @param path The path to the extension library.\n * @param entryPoint Optional entry point function name. If not provided, uses the default entry point.\n */\n loadExtension(path: string, entryPoint?: string): void;\n\n /**\n * Makes a backup of the database. This method abstracts the sqlite3_backup_init(),\n * sqlite3_backup_step() and sqlite3_backup_finish() functions.\n *\n * The backed-up database can be used normally during the backup process. Mutations\n * coming from the same connection will be reflected in the backup right away.\n * However, mutations from other connections will cause the backup process to restart.\n *\n * @param path The path where the backup will be created. If the file already exists, the contents will be overwritten.\n * @param options Optional configuration for the backup operation.\n * @param options.rate Number of pages to be transmitted in each batch of the backup. @default 100\n * @param options.source Name of the source database. This can be 'main' (the default primary database) or any other database that have been added with ATTACH DATABASE. @default 'main'\n * @param options.target Name of the target database. This can be 'main' (the default primary database) or any other database that have been added with ATTACH DATABASE. @default 'main'\n * @param options.progress Callback function that will be called with the number of pages copied and the total number of pages.\n * @returns A promise that resolves when the backup is completed and rejects if an error occurs.\n *\n * @example\n * // Basic backup\n * await db.backup('./backup.db');\n *\n * @example\n * // Backup with progress\n * await db.backup('./backup.db', {\n * rate: 10,\n * progress: ({ totalPages, remainingPages }) => {\n * console.log(`Progress: ${totalPages - remainingPages}/${totalPages}`);\n * }\n * });\n */\n backup(\n path: string | Buffer | URL,\n options?: {\n rate?: number;\n source?: string;\n target?: string;\n progress?: (info: { totalPages: number; remainingPages: number }) => void;\n },\n ): Promise<number>;\n\n /** Dispose of the database resources using the explicit resource management protocol. */\n [Symbol.dispose](): void;\n}\n\n/**\n * The main SQLite module interface.\n */\nexport interface SqliteModule {\n /**\n * The DatabaseSync class represents a synchronous connection to a SQLite database.\n * All operations are performed synchronously, blocking until completion.\n */\n DatabaseSync: new (\n location?: string | Buffer | URL,\n options?: DatabaseSyncOptions,\n ) => DatabaseSyncInstance;\n /**\n * The StatementSync class represents a synchronous prepared statement.\n * This class should not be instantiated directly; use Database.prepare() instead.\n */\n StatementSync: new (\n database: DatabaseSyncInstance,\n sql: string,\n options?: StatementOptions,\n ) => StatementSyncInstance;\n /**\n * The Session class for recording database changes.\n * This class should not be instantiated directly; use Database.createSession() instead.\n */\n Session: new () => Session;\n /**\n * SQLite constants for various operations and flags.\n */\n constants: {\n /** Open database for reading only. */\n SQLITE_OPEN_READONLY: number;\n /** Open database for reading and writing. */\n SQLITE_OPEN_READWRITE: number;\n /** Create database if it doesn't exist. */\n SQLITE_OPEN_CREATE: number;\n // Changeset constants\n /** Skip conflicting changes. */\n SQLITE_CHANGESET_OMIT: number;\n /** Replace conflicting changes. */\n SQLITE_CHANGESET_REPLACE: number;\n /** Abort on conflict. */\n SQLITE_CHANGESET_ABORT: number;\n /** Data conflict type. */\n SQLITE_CHANGESET_DATA: number;\n /** Row not found conflict. */\n SQLITE_CHANGESET_NOTFOUND: number;\n /** General conflict. */\n SQLITE_CHANGESET_CONFLICT: number;\n /** Constraint violation. */\n SQLITE_CHANGESET_CONSTRAINT: number;\n /** Foreign key constraint violation. */\n SQLITE_CHANGESET_FOREIGN_KEY: number;\n // ... more constants\n };\n}\n\n// Add Symbol.dispose to the native classes\nif (binding.DatabaseSync && typeof Symbol.dispose !== \"undefined\") {\n binding.DatabaseSync.prototype[Symbol.dispose] = function () {\n try {\n this.close();\n } catch {\n // Ignore errors during disposal\n }\n };\n}\n\nif (binding.StatementSync && typeof Symbol.dispose !== \"undefined\") {\n binding.StatementSync.prototype[Symbol.dispose] = function () {\n try {\n this.finalize();\n } catch {\n // Ignore errors during disposal\n }\n };\n}\n\n// Export the native binding with TypeScript types\n\n/**\n * The DatabaseSync class represents a synchronous connection to a SQLite database.\n * All database operations are performed synchronously, blocking the thread until completion.\n *\n * @example\n * ```typescript\n * import { DatabaseSync } from '@photostructure/sqlite';\n *\n * // Create an in-memory database\n * const db = new DatabaseSync(':memory:');\n *\n * // Create a file-based database\n * const fileDb = new DatabaseSync('./mydata.db');\n *\n * // Create with options\n * const readOnlyDb = new DatabaseSync('./data.db', { readOnly: true });\n * ```\n */\nexport const DatabaseSync =\n binding.DatabaseSync as SqliteModule[\"DatabaseSync\"];\n\n/**\n * The StatementSync class represents a prepared SQL statement.\n * This class should not be instantiated directly; use DatabaseSync.prepare() instead.\n *\n * @example\n * ```typescript\n * const stmt = db.prepare('SELECT * FROM users WHERE id = ?');\n * const user = stmt.get(123);\n * stmt.finalize();\n * ```\n */\nexport const StatementSync =\n binding.StatementSync as SqliteModule[\"StatementSync\"];\n\n/**\n * The Session class for recording database changes.\n * This class should not be instantiated directly; use DatabaseSync.createSession() instead.\n *\n * @example\n * ```typescript\n * const session = db.createSession({ table: 'users' });\n * // Make some changes to the users table\n * const changeset = session.changeset();\n * session.close();\n * ```\n */\nexport const Session = binding.Session as SqliteModule[\"Session\"];\n\n/**\n * SQLite constants for various operations and flags.\n *\n * @example\n * ```typescript\n * import { constants } from '@photostructure/sqlite';\n *\n * const db = new DatabaseSync('./data.db', {\n * readOnly: true,\n * // Uses SQLITE_OPEN_READONLY internally\n * });\n * ```\n */\nexport const constants = binding.constants as SqliteModule[\"constants\"];\n\n// Default export for CommonJS compatibility\nexport default binding as SqliteModule;\n","import { dirname } from \"node:path\";\n\nexport function getCallerDirname(): string {\n const e = new Error();\n if (e.stack == null) {\n Error.captureStackTrace(e);\n }\n return dirname(extractCallerPath(e.stack as string));\n}\n\n// Comprehensive regex patterns for different stack frame formats\nconst patterns =\n process.platform === \"win32\"\n ? [\n // Standard: \"at functionName (C:\\path\\file.js:1:1)\"\n /\\bat\\s.+?\\((?<path>[A-Z]:\\\\.+):\\d+:\\d+\\)$/,\n // direct: \"at C:\\path\\file.js:1:1\"\n /\\bat\\s(?<path>[A-Z]:\\\\.+):\\d+:\\d+$/,\n // UNC: \"at functionName (\\\\server\\share\\path\\file.js:1:1)\"\n /\\bat\\s.+?\\((?<path>\\\\\\\\.+):\\d+:\\d+\\)$/,\n // direct: \"at \\\\server\\share\\path\\file.js:1:1\"\n /\\bat\\s(?<path>\\\\\\\\.+):\\d+:\\d+$/,\n ]\n : [\n // Standard: \"at functionName (/path/file.js:1:1)\"\n /\\bat\\s.+?\\((?<path>\\/.+?):\\d+:\\d+\\)$/,\n // Anonymous or direct: \"at /path/file.js:1:1\"\n /\\bat\\s(.+[^/]\\s)?(?<path>\\/.+?):\\d+:\\d+$/,\n ];\n\nconst MaybeUrlRE = /^[a-z]{2,5}:\\/\\//i;\n\n// only exposed for tests:\nexport function extractCallerPath(stack: string): string {\n const frames = stack.split(\"\\n\").filter(Boolean);\n\n // First find getCallerDirname() in the stack:\n const callerFrame = frames.findIndex((frame) =>\n frame.includes(\"getCallerDirname\"),\n );\n if (callerFrame === -1) {\n throw new Error(\"Invalid stack trace format: missing caller frame\");\n }\n for (let i = callerFrame + 1; i < frames.length; i++) {\n const frame = frames[i];\n for (const pattern of patterns) {\n const g = frame?.trim().match(pattern)?.groups;\n if (g != null && g[\"path\"]) {\n const path = g[\"path\"];\n // Windows requires us to check if it's a reasonable URL, as URL accepts\n // \"C:\\\\path\\\\file.txt\" as valid (!!)\n if (MaybeUrlRE.test(path)) {\n try {\n return new URL(path).pathname;\n } catch {\n // ignore\n }\n }\n return path;\n }\n }\n }\n throw new Error(\"Invalid stack trace format: no parsable frames\");\n}\n","import { getCallerDirname } from \"./stack_path\";\n\n// Thanks to tsup shims, __dirname should always be defined except when run by\n// jest (which will use the stack_path shim)\nexport function _dirname() {\n try {\n if (typeof __dirname !== \"undefined\") return __dirname;\n } catch {\n // ignore\n }\n // we must be in jest. Use the stack_path ~~hack~~ shim:\n return getCallerDirname();\n}\n"],"mappings":";AACA,OAAO,UAAU;AACjB,SAAS,qBAAqB;AAE9B,IAAM,cAAc,MAAM,cAAc,YAAY,GAAG;AACvD,IAAM,aAA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AA,EAC/C,QAAQ;AAAA,EAER;AAEA,SAAO,iBAAiB;AAC1B;;;AFNA,IAAM,UAAU,aAAa,KAAK,SAAS,GAAG,IAAI,CAAC;AAmXnD,IAAI,QAAQ,gBAAgB,OAAO,OAAO,YAAY,aAAa;AACjE,UAAQ,aAAa,UAAU,OAAO,OAAO,IAAI,WAAY;AAC3D,QAAI;AACF,WAAK,MAAM;AAAA,IACb,QAAQ;AAAA,IAER;AAAA,EACF;AACF;AAEA,IAAI,QAAQ,iBAAiB,OAAO,OAAO,YAAY,aAAa;AAClE,UAAQ,cAAc,UAAU,OAAO,OAAO,IAAI,WAAY;AAC5D,QAAI;AACF,WAAK,SAAS;AAAA,IAChB,QAAQ;AAAA,IAER;AAAA,EACF;AACF;AAsBO,IAAM,eACX,QAAQ;AAaH,IAAM,gBACX,QAAQ;AAcH,IAAM,UAAU,QAAQ;AAexB,IAAM,YAAY,QAAQ;AAGjC,IAAO,gBAAQ;","names":["path"]}
1
+ {"version":3,"sources":["../node_modules/tsup/assets/esm_shims.js","../src/index.ts","../src/stack-path.ts","../src/dirname.ts","../src/lru-cache.ts","../src/sql-tag-store.ts"],"sourcesContent":["// Shim globals in esm bundle\nimport path from 'node:path'\nimport { fileURLToPath } from 'node:url'\n\nconst getFilename = () => fileURLToPath(import.meta.url)\nconst getDirname = () => path.dirname(getFilename())\n\nexport const __dirname = /* @__PURE__ */ getDirname()\nexport const __filename = /* @__PURE__ */ getFilename()\n","// Load the native binding with support for both CJS and ESM\nimport nodeGypBuild from \"node-gyp-build\";\nimport { join } from \"node:path\";\nimport { _dirname } from \"./dirname\";\nimport { SQLTagStore } from \"./sql-tag-store\";\nimport { DatabaseSyncInstance } from \"./types/database-sync-instance\";\nimport { DatabaseSyncOptions } from \"./types/database-sync-options\";\nimport { SQLTagStoreInstance } from \"./types/sql-tag-store-instance\";\nimport { SqliteAuthorizationActions } from \"./types/sqlite-authorization-actions\";\nimport { SqliteAuthorizationResults } from \"./types/sqlite-authorization-results\";\nimport { SqliteChangesetConflictTypes } from \"./types/sqlite-changeset-conflict-types\";\nimport { SqliteChangesetResolution } from \"./types/sqlite-changeset-resolution\";\nimport { SqliteOpenFlags } from \"./types/sqlite-open-flags\";\nimport { StatementSyncInstance } from \"./types/statement-sync-instance\";\n\nexport type { AggregateOptions } from \"./types/aggregate-options\";\nexport type { ChangesetApplyOptions } from \"./types/changeset-apply-options\";\nexport type { DatabaseSyncInstance } from \"./types/database-sync-instance\";\nexport type { DatabaseSyncOptions } from \"./types/database-sync-options\";\nexport type { SessionOptions } from \"./types/session-options\";\nexport type { SQLTagStoreInstance } from \"./types/sql-tag-store-instance\";\nexport type { SqliteAuthorizationActions } from \"./types/sqlite-authorization-actions\";\nexport type { SqliteAuthorizationResults } from \"./types/sqlite-authorization-results\";\nexport type { SqliteChangesetConflictTypes } from \"./types/sqlite-changeset-conflict-types\";\nexport type { SqliteChangesetResolution } from \"./types/sqlite-changeset-resolution\";\nexport type { SqliteOpenFlags } from \"./types/sqlite-open-flags\";\nexport type { StatementSyncInstance } from \"./types/statement-sync-instance\";\nexport type { UserFunctionOptions } from \"./types/user-functions-options\";\n\n// Use _dirname() helper that works in both CJS/ESM and Jest\nconst binding = nodeGypBuild(join(_dirname(), \"..\"));\n\n/**\n * All SQLite constants exported by this module.\n *\n * This is a union of all constant category interfaces:\n * - {@link SqliteOpenFlags} - Database open flags (extension beyond `node:sqlite`)\n * - {@link SqliteChangesetResolution} - Changeset conflict resolution values\n * - {@link SqliteChangesetConflictTypes} - Changeset conflict type codes\n * - {@link SqliteAuthorizationResults} - Authorization return values\n * - {@link SqliteAuthorizationActions} - Authorization action codes\n *\n * **Note:** The categorized interfaces (`SqliteOpenFlags`, etc.) are extensions\n * provided by `@photostructure/sqlite`. The `node:sqlite` module exports only\n * a flat `constants` object without these type categories.\n */\nexport type SqliteConstants = SqliteOpenFlags &\n SqliteChangesetResolution &\n SqliteChangesetConflictTypes &\n SqliteAuthorizationResults &\n SqliteAuthorizationActions;\n\n/**\n * Options for creating a prepared statement.\n */\nexport interface StatementOptions {\n /** If true, the prepared statement's expandedSQL property will contain the expanded SQL. @default false */\n readonly expandedSQL?: boolean;\n /** If true, anonymous parameters are enabled for the statement. @default false */\n readonly anonymousParameters?: boolean;\n}\n\nexport interface Session {\n /**\n * Generate a changeset containing all changes recorded by the session.\n * @returns A Buffer containing the changeset data.\n */\n changeset(): Buffer;\n /**\n * Generate a patchset containing all changes recorded by the session.\n * @returns A Buffer containing the patchset data.\n */\n patchset(): Buffer;\n /**\n * Close the session and release its resources.\n */\n close(): void;\n}\n\n/**\n * The main SQLite module interface.\n */\nexport interface SqliteModule {\n /**\n * The DatabaseSync class represents a synchronous connection to a SQLite database.\n * All operations are performed synchronously, blocking until completion.\n */\n DatabaseSync: new (\n location?: string | Buffer | URL,\n options?: DatabaseSyncOptions,\n ) => DatabaseSyncInstance;\n /**\n * The StatementSync class represents a synchronous prepared statement.\n * This class should not be instantiated directly; use Database.prepare() instead.\n */\n StatementSync: new (\n database: DatabaseSyncInstance,\n sql: string,\n options?: StatementOptions,\n ) => StatementSyncInstance;\n /**\n * The Session class for recording database changes.\n * This class should not be instantiated directly; use Database.createSession() instead.\n */\n Session: new () => Session;\n /**\n * SQLite constants for various operations and flags.\n * @see {@link SqliteConstants} for the type definition\n * @see {@link SqliteOpenFlags} for database open flags (extension beyond `node:sqlite`)\n * @see {@link SqliteChangesetResolution} for changeset conflict resolution values\n * @see {@link SqliteChangesetConflictTypes} for changeset conflict type codes\n * @see {@link SqliteAuthorizationResults} for authorization return values\n * @see {@link SqliteAuthorizationActions} for authorization action codes\n */\n constants: SqliteConstants;\n}\n\n/**\n * The DatabaseSync class represents a synchronous connection to a SQLite database.\n * All database operations are performed synchronously, blocking the thread until completion.\n *\n * @example\n * ```typescript\n * import { DatabaseSync } from '@photostructure/sqlite';\n *\n * // Create an in-memory database\n * const db = new DatabaseSync(':memory:');\n *\n * // Create a file-based database\n * const fileDb = new DatabaseSync('./mydata.db');\n *\n * // Create with options\n * const readOnlyDb = new DatabaseSync('./data.db', { readOnly: true });\n * ```\n */\nexport const DatabaseSync =\n binding.DatabaseSync as SqliteModule[\"DatabaseSync\"];\n\n// node:sqlite implements createTagStore and SQLTagStore entirely in native C++.\n// We use a TypeScript implementation instead, attached via prototype extension.\n// This maintains API compatibility with node:sqlite while avoiding the complexity\n// of a native LRU cache. Performance is equivalent since the real cost is SQLite\n// execution, not cache lookups - V8's Map is highly optimized for string keys.\n(DatabaseSync.prototype as DatabaseSyncInstance).createTagStore = function (\n this: DatabaseSyncInstance,\n capacity?: number,\n): SQLTagStoreInstance {\n return new SQLTagStore(this, capacity);\n};\n\n/**\n * The StatementSync class represents a prepared SQL statement.\n * This class should not be instantiated directly; use DatabaseSync.prepare() instead.\n *\n * @example\n * ```typescript\n * const stmt = db.prepare('SELECT * FROM users WHERE id = ?');\n * const user = stmt.get(123);\n * stmt.finalize();\n * ```\n */\nexport const StatementSync =\n binding.StatementSync as SqliteModule[\"StatementSync\"];\n\n/**\n * The Session class for recording database changes.\n * This class should not be instantiated directly; use DatabaseSync.createSession() instead.\n *\n * @example\n * ```typescript\n * const session = db.createSession({ table: 'users' });\n * // Make some changes to the users table\n * const changeset = session.changeset();\n * session.close();\n * ```\n */\nexport const Session = binding.Session as SqliteModule[\"Session\"];\n\n/**\n * The SQLTagStore class for cached prepared statements via tagged template syntax.\n * This class should not be instantiated directly; use DatabaseSync.createTagStore() instead.\n *\n * @example\n * ```typescript\n * const sql = db.createTagStore();\n * sql.run`INSERT INTO users VALUES (${id}, ${name})`;\n * const user = sql.get`SELECT * FROM users WHERE id = ${id}`;\n * ```\n */\nexport { SQLTagStore };\n\n/**\n * SQLite constants for various operations and flags.\n *\n * @example\n * ```typescript\n * import { constants } from '@photostructure/sqlite';\n *\n * const db = new DatabaseSync('./data.db', {\n * readOnly: true,\n * // Uses SQLITE_OPEN_READONLY internally\n * });\n * ```\n */\nexport const constants: SqliteConstants = binding.constants;\n\n/**\n * Options for the backup() function.\n */\nexport interface BackupOptions {\n /** Number of pages to be transmitted in each batch of the backup. @default 100 */\n rate?: number;\n /** Name of the source database. Can be 'main' or any attached database. @default 'main' */\n source?: string;\n /** Name of the target database. Can be 'main' or any attached database. @default 'main' */\n target?: string;\n /** Callback function that will be called with progress information. */\n progress?: (info: { totalPages: number; remainingPages: number }) => void;\n}\n\n/**\n * Standalone function to make a backup of a database.\n *\n * This function matches the Node.js `node:sqlite` module API which exports\n * `backup()` as a standalone function in addition to the `db.backup()` method.\n *\n * @param sourceDb The database to backup from.\n * @param destination The path where the backup will be created.\n * @param options Optional configuration for the backup operation.\n * @returns A promise that resolves when the backup is completed.\n *\n * @example\n * ```typescript\n * import { DatabaseSync, backup } from '@photostructure/sqlite';\n *\n * const db = new DatabaseSync('./source.db');\n * await backup(db, './backup.db');\n *\n * // With options\n * await backup(db, './backup.db', {\n * rate: 10,\n * progress: ({ totalPages, remainingPages }) => {\n * console.log(`Progress: ${totalPages - remainingPages}/${totalPages}`);\n * }\n * });\n * ```\n */\nexport const backup: (\n sourceDb: DatabaseSyncInstance,\n destination: string | Buffer | URL,\n options?: BackupOptions,\n) => Promise<number> = binding.backup;\n\n// Default export for CommonJS compatibility\nexport default binding as SqliteModule;\n","import { dirname } from \"node:path\";\n\nexport function getCallerDirname(): string {\n const e = new Error();\n if (e.stack == null) {\n Error.captureStackTrace(e);\n }\n return dirname(extractCallerPath(e.stack as string));\n}\n\n// Comprehensive regex patterns for different stack frame formats\nconst patterns =\n process.platform === \"win32\"\n ? [\n // File URLs: \"at functionName (file:///C:/path/file.js:1:1)\"\n /\\bat\\s.+?\\((?<path>file:\\/\\/\\/.+?):\\d+:\\d+\\)$/,\n // File URLs direct: \"at file:///C:/path/file.js:1:1\"\n /\\bat\\s(?<path>file:\\/\\/\\/.+?):\\d+:\\d+$/,\n // Standard: \"at functionName (C:\\path\\file.js:1:1)\"\n /\\bat\\s.+?\\((?<path>[A-Z]:\\\\.+):\\d+:\\d+\\)$/,\n // direct: \"at C:\\path\\file.js:1:1\"\n /\\bat\\s(?<path>[A-Z]:\\\\.+):\\d+:\\d+$/,\n // UNC: \"at functionName (\\\\server\\share\\path\\file.js:1:1)\"\n /\\bat\\s.+?\\((?<path>\\\\\\\\.+):\\d+:\\d+\\)$/,\n // direct: \"at \\\\server\\share\\path\\file.js:1:1\"\n /\\bat\\s(?<path>\\\\\\\\.+):\\d+:\\d+$/,\n ]\n : [\n // Standard: \"at functionName (/path/file.js:1:1)\"\n /\\bat\\s.+?\\((?<path>\\/.+?):\\d+:\\d+\\)$/,\n // Anonymous or direct: \"at /path/file.js:1:1\"\n // eslint-disable-next-line security/detect-unsafe-regex -- Pattern is safe: no nested quantifiers\n /\\bat\\s(?:[^\\s()]+\\s)?(?<path>\\/[^:]+):\\d+:\\d+$/,\n ];\n\nconst MaybeUrlRE = /^[a-z]{2,5}:\\/\\//i;\n\n// only exposed for tests:\nexport function extractCallerPath(stack: string): string {\n const frames = stack.split(\"\\n\").filter(Boolean);\n\n // First find getCallerDirname() in the stack:\n const callerFrame = frames.findIndex((frame) =>\n frame.includes(\"getCallerDirname\"),\n );\n if (callerFrame === -1) {\n throw new Error(\"Invalid stack trace format: missing caller frame\");\n }\n for (let i = callerFrame + 1; i < frames.length; i++) {\n // eslint-disable-next-line security/detect-object-injection -- Index is from controlled for-loop\n const frame = frames[i];\n for (const pattern of patterns) {\n const g = frame?.trim().match(pattern)?.groups;\n if (g != null && g[\"path\"]) {\n const path = g[\"path\"];\n // Windows requires us to check if it's a reasonable URL, as URL accepts\n // \"C:\\\\path\\\\file.txt\" as valid (!!)\n if (MaybeUrlRE.test(path)) {\n try {\n return new URL(path).pathname;\n } catch {\n // ignore\n }\n }\n return path;\n }\n }\n }\n throw new Error(\"Invalid stack trace format: no parsable frames\");\n}\n","import { getCallerDirname } from \"./stack-path\";\n\n// Thanks to tsup shims, __dirname should always be defined except when run by\n// jest (which will use the stack_path shim)\nexport function _dirname() {\n try {\n if (typeof __dirname !== \"undefined\") return __dirname;\n } catch {\n // ignore\n }\n // we must be in jest. Use the stack_path ~~hack~~ shim:\n return getCallerDirname();\n}\n","/**\n * Simple LRU (Least Recently Used) cache implementation.\n * Uses Map's insertion order to track recency - first key is oldest.\n */\nexport class LRUCache<K, V> {\n private cache = new Map<K, V>();\n private readonly maxCapacity: number;\n\n constructor(capacity: number) {\n if (capacity < 1) {\n throw new RangeError(\"LRU cache capacity must be at least 1\");\n }\n this.maxCapacity = capacity;\n }\n\n /**\n * Get a value from the cache.\n * If found, moves the entry to the end (most recently used).\n */\n get(key: K): V | undefined {\n const value = this.cache.get(key);\n if (value !== undefined) {\n // Move to end (most recently used) by reinserting\n this.cache.delete(key);\n this.cache.set(key, value);\n }\n return value;\n }\n\n /**\n * Set a value in the cache.\n * If key exists, updates and moves to end.\n * If at capacity, evicts the oldest entry first.\n */\n set(key: K, value: V): void {\n if (this.cache.has(key)) {\n // Update existing - delete and reinsert at end\n this.cache.delete(key);\n } else if (this.cache.size >= this.maxCapacity) {\n // Evict oldest (first key in Map iteration order)\n const oldestKey = this.cache.keys().next().value;\n if (oldestKey !== undefined) {\n this.cache.delete(oldestKey);\n }\n }\n this.cache.set(key, value);\n }\n\n /**\n * Delete an entry from the cache.\n */\n delete(key: K): boolean {\n return this.cache.delete(key);\n }\n\n /**\n * Check if a key exists in the cache.\n * Does NOT update recency.\n */\n has(key: K): boolean {\n return this.cache.has(key);\n }\n\n /**\n * Clear all entries from the cache.\n */\n clear(): void {\n this.cache.clear();\n }\n\n /**\n * Get the current number of entries in the cache.\n */\n size(): number {\n return this.cache.size;\n }\n\n /**\n * Get the maximum capacity of the cache.\n */\n capacity(): number {\n return this.maxCapacity;\n }\n}\n","import { LRUCache } from \"./lru-cache\";\nimport { DatabaseSyncInstance } from \"./types/database-sync-instance\";\nimport type { StatementSyncInstance } from \"./types/statement-sync-instance\";\n\n/**\n * Default capacity for the statement cache.\n * Matches Node.js SQLTagStore default.\n */\nconst DEFAULT_CAPACITY = 1000;\n\n/**\n * SQLTagStore provides cached prepared statements via tagged template syntax.\n *\n * @example\n * ```js\n * const sql = db.createTagStore();\n * sql.run`INSERT INTO users VALUES (${id}, ${name})`;\n * const user = sql.get`SELECT * FROM users WHERE id = ${id}`;\n * ```\n */\nexport class SQLTagStore {\n private readonly database: DatabaseSyncInstance;\n private readonly cache: LRUCache<string, StatementSyncInstance>;\n private readonly maxCapacity: number;\n\n constructor(db: DatabaseSyncInstance, capacity: number = DEFAULT_CAPACITY) {\n if (!db.isOpen) {\n throw new Error(\"Database is not open\");\n }\n this.database = db;\n this.maxCapacity = capacity;\n this.cache = new LRUCache(capacity);\n }\n\n /**\n * Returns the associated database instance.\n */\n get db(): DatabaseSyncInstance {\n return this.database;\n }\n\n /**\n * Returns the maximum capacity of the statement cache.\n */\n get capacity(): number {\n return this.maxCapacity;\n }\n\n /**\n * Returns the current number of cached statements.\n */\n size(): number {\n return this.cache.size();\n }\n\n /**\n * Clears all cached statements.\n */\n clear(): void {\n this.cache.clear();\n }\n\n /**\n * Execute an INSERT, UPDATE, DELETE or other statement that doesn't return rows.\n * Returns an object with `changes` and `lastInsertRowid`.\n */\n run(\n strings: TemplateStringsArray,\n ...values: unknown[]\n ): { changes: number; lastInsertRowid: number | bigint } {\n const stmt = this.getOrPrepare(strings);\n return stmt.run(...values);\n }\n\n /**\n * Execute a query and return the first row, or undefined if no rows.\n */\n get(strings: TemplateStringsArray, ...values: unknown[]): unknown {\n const stmt = this.getOrPrepare(strings);\n return stmt.get(...values);\n }\n\n /**\n * Execute a query and return all rows as an array.\n */\n all(strings: TemplateStringsArray, ...values: unknown[]): unknown[] {\n const stmt = this.getOrPrepare(strings);\n return stmt.all(...values);\n }\n\n /**\n * Execute a query and return an iterator over the rows.\n */\n iterate(\n strings: TemplateStringsArray,\n ...values: unknown[]\n ): IterableIterator<unknown> {\n const stmt = this.getOrPrepare(strings);\n return stmt.iterate(...values);\n }\n\n /**\n * Get a cached statement or prepare a new one.\n * If a cached statement has been finalized, it's evicted and a new one is prepared.\n */\n private getOrPrepare(strings: TemplateStringsArray): StatementSyncInstance {\n if (!this.database.isOpen) {\n throw new Error(\"Database is not open\");\n }\n\n const sql = this.buildSQL(strings);\n\n // Check cache - evict if finalized\n const cached = this.cache.get(sql);\n if (cached) {\n if (!cached.finalized) {\n return cached;\n }\n // Statement was finalized externally - remove from cache\n this.cache.delete(sql);\n }\n\n // Prepare new statement and cache it\n const stmt = this.database.prepare(sql);\n this.cache.set(sql, stmt);\n return stmt;\n }\n\n /**\n * Build the SQL string by joining template parts with `?` placeholders.\n */\n private buildSQL(strings: TemplateStringsArray): string {\n let sql = strings[0] ?? \"\";\n for (let i = 1; i < strings.length; i++) {\n // eslint-disable-next-line security/detect-object-injection -- Index is from controlled for-loop\n sql += \"?\" + (strings[i] ?? \"\");\n }\n return sql;\n }\n}\n"],"mappings":";AACA,OAAO,UAAU;AACjB,SAAS,qBAAqB;AAE9B,IAAM,cAAc,MAAM,cAAc,YAAY,GAAG;AACvD,IAAM,aAAa,MAAM,KAAK,QAAQ,YAAY,CAAC;AAE5C,IAAM,YAA4B,2BAAW;;;ACNpD,OAAO,kBAAkB;AACzB,SAAS,YAAY;;;ACFrB,SAAS,eAAe;AAEjB,SAAS,mBAA2B;AACzC,QAAM,IAAI,IAAI,MAAM;AACpB,MAAI,EAAE,SAAS,MAAM;AACnB,UAAM,kBAAkB,CAAC;AAAA,EAC3B;AACA,SAAO,QAAQ,kBAAkB,EAAE,KAAe,CAAC;AACrD;AAGA,IAAM,WACJ,QAAQ,aAAa,UACjB;AAAA;AAAA,EAEE;AAAA;AAAA,EAEA;AAAA;AAAA,EAEA;AAAA;AAAA,EAEA;AAAA;AAAA,EAEA;AAAA;AAAA,EAEA;AACF,IACA;AAAA;AAAA,EAEE;AAAA;AAAA;AAAA,EAGA;AACF;AAEN,IAAM,aAAa;AAGZ,SAAS,kBAAkB,OAAuB;AACvD,QAAM,SAAS,MAAM,MAAM,IAAI,EAAE,OAAO,OAAO;AAG/C,QAAM,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Aa,KAAK,SAAS,GAAG,IAAI,CAAC;AAyG5C,IAAM,eACX,QAAQ;AAOT,aAAa,UAAmC,iBAAiB,SAEhE,UACqB;AACrB,SAAO,IAAI,YAAY,MAAM,QAAQ;AACvC;AAaO,IAAM,gBACX,QAAQ;AAcH,IAAM,UAAU,QAAQ;AA4BxB,IAAM,YAA6B,QAAQ;AA2C3C,IAAM,SAIU,QAAQ;AAG/B,IAAO,gBAAQ;","names":["path"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@photostructure/sqlite",
3
- "version": "0.0.1",
3
+ "version": "0.2.0",
4
4
  "description": "Drop-in replacement for node:sqlite",
5
5
  "homepage": "https://photostructure.github.io/node-sqlite/",
6
6
  "types": "./dist/index.d.ts",
@@ -29,54 +29,66 @@
29
29
  "install": "node-gyp-build",
30
30
  "clean": "run-p clean:*",
31
31
  "clean:dist": "del-cli dist \"*.tsbuildinfo\"",
32
- "clean:native": "node-gyp clean",
32
+ "clean:native": "node-gyp clean && del-cli prebuilds",
33
33
  "sync:node": "tsx scripts/sync-from-node.ts",
34
34
  "sync:sqlite": "tsx scripts/sync-from-sqlite.ts",
35
35
  "node-gyp-rebuild": "node-gyp rebuild",
36
+ "// rebuild": "`npm run rebuild` does what you'd expect. `npm rebuild` only rebuilds already-installed packages.",
37
+ "rebuild": "run-s clean build",
36
38
  "build": "run-p build:native build:dist",
37
- "build:native": "prebuildify --napi --tag-libc --strip",
39
+ "build:native": "tsx scripts/build-native.ts",
40
+ "// build:linux-glibc": "called by GHA build.yml",
38
41
  "build:linux-glibc": "bash scripts/prebuild-linux-glibc.sh",
39
42
  "build:dist": "tsup && node scripts/post-build.mjs",
43
+ "// pretests": "builds everything before running full test suite",
44
+ "pretests": "npm run build",
40
45
  "tests": "run-s tests:*",
41
- "tests:cjs": "jest",
42
- "tests:esm": "cross-env TEST_ESM=1 node --experimental-vm-modules --no-warnings node_modules/jest/bin/jest.js",
46
+ "tests:cjs": "node --expose-gc node_modules/jest/bin/jest.js",
47
+ "tests:esm": "cross-env TEST_ESM=1 node --expose-gc --experimental-vm-modules --no-warnings node_modules/jest/bin/jest.js",
48
+ "// pretest": "only builds TypeScript since native build should already exist",
49
+ "pretest": "npm run build:dist",
43
50
  "// test": "support `npm t name_of_file` (and don't fail due to missing coverage)",
44
51
  "test": "npm run tests:cjs -- --no-coverage",
45
52
  "test:serial": "npm run tests:cjs -- --runInBand --no-coverage",
46
53
  "test:all": "run-s \"tests:cjs -- {@}\" \"tests:esm -- {@}\" --",
47
- "// test:api-compat": "run by the api compability CI workflow",
54
+ "// test:api-compat": "run by the api compatibility CI workflow",
48
55
  "test:api-compat": "jest --config jest.config.api-compat.cjs",
49
- "test:node-compat": "cross-env NODE_OPTIONS=\"--experimental-sqlite --no-warnings\" npm run tests:cjs -- --no-coverage test/node-compatibility.test.ts",
56
+ "test:node-compat": "cross-env NODE_OPTIONS=\"--experimental-sqlite --no-warnings --expose-gc\" npm run tests:cjs -- --no-coverage test/node-compatibility.test.ts",
50
57
  "test:build-extension": "cd test/fixtures/test-extension && node build.js",
51
58
  "memory:test": "cross-env TEST_MEMORY=1 node --expose-gc node_modules/jest/bin/jest.js --no-coverage test/memory.test.ts",
52
59
  "memory:valgrind": "bash scripts/valgrind-test.sh",
53
60
  "memory:asan": "bash scripts/sanitizers-test.sh",
54
- "check:memory": "node scripts/check-memory.mjs",
61
+ "check:memory": "npx --yes tsx scripts/check-memory.ts",
55
62
  "benchmark": "cd benchmark && npm install && npm run bench",
56
63
  "benchmark:memory": "cd benchmark && npm install && npm run bench:memory",
57
64
  "benchmark:full": "cd benchmark && npm install && npm run bench && npm run bench:memory",
65
+ "stress-test": "cd benchmark && npm install && cd .. && tsx scripts/stress-test.ts",
66
+ "stress-test:validate": "npm run tests:cjs -- --no-coverage benchmark/stress-test.test.ts",
67
+ "stress-test:ci": "cd benchmark && npm install && cd .. && tsx scripts/stress-test.ts --ci --output-file stress-test-results.json",
58
68
  "lint": "run-p lint:*",
59
69
  "lint:ts": "tsc --noEmit",
60
70
  "lint:ts-build": "tsc -p tsconfig.build.json --noEmit",
61
71
  "lint:ts-scripts": "tsc --noEmit --module esnext --target es2022 --moduleResolution node --project scripts/tsconfig.json",
62
- "lint:eslint": "eslint src/ test/",
63
- "// lint:api-compat": "run by the api compability CI workflow",
72
+ "lint:ts-benchmark": "cd benchmark && npm install && tsc --noEmit",
73
+ "lint:eslint": "eslint src/ test/ scripts/",
74
+ "// lint:api-compat": "run by the api compatibility CI workflow",
64
75
  "lint:api-compat": "tsx scripts/check-api-compat.ts",
65
76
  "lint:native": "tsx scripts/clang-tidy.ts",
66
77
  "fmt": "run-p fmt:*",
67
- "fmt:ts": "prettier --write \"**/*.{ts,js,mjs,json,md}\"",
78
+ "fmt:prettier": "prettier --write .",
68
79
  "// fmt:native": "on ubuntu: `sudo apt install clang-format`. NOTE: we don't reformat src/upstream!",
69
80
  "fmt:native": "clang-format --style=LLVM -i src/shims/*.h src/*.cpp src/*.h test/fixtures/test-extension/*.c || true",
70
81
  "docs": "typedoc",
71
82
  "// precommit": "should be manually run by developers before they run `git commit`",
72
- "precommit": "tsx scripts/precommit.ts",
83
+ "precommit": "npx --yes tsx scripts/precommit.ts",
73
84
  "prepare-release": "npm run build:dist",
74
- "release": "release-it",
75
85
  "security": "run-s security:*",
76
- "security:audit": "npm audit --production",
77
86
  "security:audit-fix": "npm audit fix --force",
78
- "security:osv": "if command -v osv-scanner >/dev/null 2>&1; then osv-scanner scan source --recursive .; else echo 'OSV Scanner not installed. Install with: go install github.com/google/osv-scanner/cmd/osv-scanner@latest'; fi",
79
- "xsecurity:snyk": "snyk test"
87
+ "security:audit": "npm audit --production",
88
+ "install:osv-scanner": "go install github.com/google/osv-scanner/cmd/osv-scanner@latest",
89
+ "security:osv": "osv-scanner scan --recursive . || true",
90
+ "install:actions": "go install github.com/suzuki-shunsuke/pinact/cmd/pinact@latest",
91
+ "update:actions": "pinact run -u"
80
92
  },
81
93
  "gypfile": true,
82
94
  "publishConfig": {
@@ -108,37 +120,35 @@
108
120
  "performance"
109
121
  ],
110
122
  "dependencies": {
111
- "node-addon-api": "^8.3.1",
123
+ "node-addon-api": "^8.5.0",
112
124
  "node-gyp-build": "^4.8.4"
113
125
  },
114
126
  "devDependencies": {
115
- "@eslint/js": "^9.28.0",
116
- "@types/jest": "^29.5.14",
117
- "@types/node": "^24.0.1",
118
- "@typescript-eslint/eslint-plugin": "^8.34.0",
119
- "@typescript-eslint/parser": "^8.34.0",
120
- "cross-env": "^7.0.3",
121
- "del-cli": "^6.0.0",
122
- "eslint": "^9.28.0",
123
- "eslint-plugin-regexp": "^2.9.0",
124
- "globals": "^16.2.0",
125
- "jest": "^29.7.0",
126
- "node-gyp": "^11.2.0",
127
+ "@types/jest": "^30.0.0",
128
+ "@types/node": "^24.10.1",
129
+ "better-sqlite3": "^12.4.6",
130
+ "cross-env": "^10.1.0",
131
+ "del-cli": "^7.0.0",
132
+ "eslint": "^9.39.1",
133
+ "eslint-plugin-regexp": "^2.10.0",
134
+ "eslint-plugin-security": "^3.0.1",
135
+ "globals": "^16.5.0",
136
+ "jest": "^30.2.0",
137
+ "node-gyp": "^12.1.0",
138
+ "npm-check-updates": "^19",
127
139
  "npm-run-all": "4.1.5",
128
140
  "prebuildify": "^6.0.1",
129
- "prettier": "^3.5.3",
130
- "prettier-plugin-organize-imports": "^4.1.0",
131
- "release-it": "^19.0.3",
132
- "snyk": "^1.1297.1",
133
- "ts-jest": "^29.3.4",
134
- "tsup": "^8.5.0",
135
- "tsx": "^4.20.1",
136
- "typedoc": "^0.28.5",
137
- "typescript": "^5.8.3",
138
- "typescript-eslint": "^8.34.0"
141
+ "prettier": "^3.6.2",
142
+ "prettier-plugin-organize-imports": "^4.3.0",
143
+ "ts-jest": "^29.4.5",
144
+ "tsup": "^8.5.1",
145
+ "tsx": "^4.20.6",
146
+ "typedoc": "^0.28.14",
147
+ "typescript": "^5.9.3",
148
+ "typescript-eslint": "^8.48.0"
139
149
  },
140
150
  "versions": {
141
- "nodejs": "v24.2.1@b854f4d",
142
- "sqlite": "3.50.1"
151
+ "nodejs": "v25.2.2@327da7e",
152
+ "sqlite": "3.51.1"
143
153
  }
144
154
  }
Binary file