Review funkt

This commit is contained in:
2026-08-09 21:56:00 +00:00
parent f522ae9953
commit fe9dfa4519
11366 changed files with 2335077 additions and 97 deletions

67
node_modules/bullmq/dist/cjs/postgres/sql-loader.js generated vendored Normal file
View File

@@ -0,0 +1,67 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.loadMigrationSql = loadMigrationSql;
exports.loadCommandSql = loadCommandSql;
const fs_1 = require("fs");
const path_1 = require("path");
const url_1 = require("url");
function getDirname() {
if (typeof __dirname !== 'undefined' && __dirname) {
return __dirname;
}
const stack = new Error().stack || '';
for (const line of stack.split('\n')) {
const match = line.match(/(file:\/\/\/[^\s)]+)/);
if (match) {
try {
return (0, path_1.dirname)((0, url_1.fileURLToPath)(match[1]));
}
catch (_a) {
// continue searching
}
}
}
throw new Error('Could not determine sql-loader directory path');
}
const currentDir = getDirname();
/**
* Loads a migration's SQL from its `.sql` file — the portable source of truth
* shared with the Elixir/Python ports. Results are cached after the first read.
*
* The `.sql` files live next to this module under `migrations/`. The published
* build copies them alongside the compiled output (a `copy:sql` build step,
* analogous to how the Lua scripts are bundled), so the same relative lookup
* works at runtime.
*/
const MIGRATIONS_DIR = (0, path_1.join)(currentDir, 'migrations');
/**
* Runtime queries live under `commands/`. Each `.sql` file is one parameterized
* statement (a `SELECT fn(...)` for the PL/pgSQL operations, or a direct
* query). They contain NO schema/namespace references — the connection's
* `search_path` selects the schema — so they are portable verbatim to the
* Python/Elixir/PHP/Rust ports (mirroring how the Redis backend's `.lua`
* scripts never hardcode the key prefix).
*/
const COMMANDS_DIR = (0, path_1.join)(currentDir, 'commands');
const migrationCache = new Map();
const commandCache = new Map();
function loadMigrationSql(file) {
let sql = migrationCache.get(file);
if (sql === undefined) {
sql = (0, fs_1.readFileSync)((0, path_1.join)(MIGRATIONS_DIR, file), 'utf8');
migrationCache.set(file, sql);
}
return sql;
}
/**
* Loads a runtime command's SQL by name (without the `.sql` extension), cached
* after the first read.
*/
function loadCommandSql(name) {
let sql = commandCache.get(name);
if (sql === undefined) {
sql = (0, fs_1.readFileSync)((0, path_1.join)(COMMANDS_DIR, `${name}.sql`), 'utf8');
commandCache.set(name, sql);
}
return sql;
}