latticesql 4.3.1 → 4.3.2
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.
- package/dist/cli.js +95 -57
- package/dist/desktop-entry.js +91 -53
- package/dist/index.cjs +49 -19
- package/dist/index.js +95 -57
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -23495,12 +23495,12 @@ var getNodeModulesParentDirs;
|
|
|
23495
23495
|
var init_getNodeModulesParentDirs = __esm({
|
|
23496
23496
|
"node_modules/@aws-sdk/core/dist-es/submodules/client/util-user-agent-node/getNodeModulesParentDirs.js"() {
|
|
23497
23497
|
"use strict";
|
|
23498
|
-
getNodeModulesParentDirs = (
|
|
23498
|
+
getNodeModulesParentDirs = (dirname19) => {
|
|
23499
23499
|
const cwd = process.cwd();
|
|
23500
|
-
if (!
|
|
23500
|
+
if (!dirname19) {
|
|
23501
23501
|
return [cwd];
|
|
23502
23502
|
}
|
|
23503
|
-
const normalizedPath = normalize(
|
|
23503
|
+
const normalizedPath = normalize(dirname19);
|
|
23504
23504
|
const parts = normalizedPath.split(sep3);
|
|
23505
23505
|
const nodeModulesIndex = parts.indexOf("node_modules");
|
|
23506
23506
|
const parentDir = nodeModulesIndex !== -1 ? parts.slice(0, nodeModulesIndex).join(sep3) : normalizedPath;
|
|
@@ -23578,8 +23578,8 @@ var init_getTypeScriptUserAgentPair = __esm({
|
|
|
23578
23578
|
tscVersion = null;
|
|
23579
23579
|
return void 0;
|
|
23580
23580
|
}
|
|
23581
|
-
const
|
|
23582
|
-
const nodeModulesParentDirs = getNodeModulesParentDirs(
|
|
23581
|
+
const dirname19 = typeof __dirname !== "undefined" ? __dirname : void 0;
|
|
23582
|
+
const nodeModulesParentDirs = getNodeModulesParentDirs(dirname19);
|
|
23583
23583
|
let versionFromApp;
|
|
23584
23584
|
for (const nodeModulesParentDir of nodeModulesParentDirs) {
|
|
23585
23585
|
try {
|
|
@@ -62153,9 +62153,9 @@ init_summarize();
|
|
|
62153
62153
|
init_http2();
|
|
62154
62154
|
import { createServer } from "http";
|
|
62155
62155
|
import { spawn as spawn2 } from "child_process";
|
|
62156
|
-
import { existsSync as
|
|
62156
|
+
import { existsSync as existsSync32 } from "fs";
|
|
62157
62157
|
import { WebSocketServer, WebSocket } from "ws";
|
|
62158
|
-
import { dirname as
|
|
62158
|
+
import { dirname as dirname17, resolve as resolve16 } from "path";
|
|
62159
62159
|
|
|
62160
62160
|
// src/gui/active-db.ts
|
|
62161
62161
|
init_adapter();
|
|
@@ -79982,8 +79982,16 @@ async function dispatchIngestRoute(req, res, ctx) {
|
|
|
79982
79982
|
|
|
79983
79983
|
// src/gui/sources-routes.ts
|
|
79984
79984
|
init_user_config();
|
|
79985
|
-
import {
|
|
79986
|
-
|
|
79985
|
+
import {
|
|
79986
|
+
statSync as statSync10,
|
|
79987
|
+
readdirSync as readdirSync8,
|
|
79988
|
+
readFileSync as readFileSync24,
|
|
79989
|
+
writeFileSync as writeFileSync9,
|
|
79990
|
+
existsSync as existsSync26,
|
|
79991
|
+
mkdirSync as mkdirSync11,
|
|
79992
|
+
rmSync
|
|
79993
|
+
} from "fs";
|
|
79994
|
+
import { resolve as resolve12, join as join30, basename as basename13, sep as sep8, dirname as dirname15 } from "path";
|
|
79987
79995
|
import { execFile } from "child_process";
|
|
79988
79996
|
import { randomUUID as randomUUID4 } from "crypto";
|
|
79989
79997
|
init_http2();
|
|
@@ -79991,20 +79999,49 @@ var MAX_LIST_ENTRIES = 2e3;
|
|
|
79991
79999
|
var MAX_INGEST_FILES = 500;
|
|
79992
80000
|
var MAX_INGEST_DEPTH = 8;
|
|
79993
80001
|
var SKIP_DIRS = /* @__PURE__ */ new Set([".git", "node_modules", ".DS_Store", "__pycache__", ".venv", "venv"]);
|
|
79994
|
-
function rootsFile() {
|
|
79995
|
-
return join30(
|
|
80002
|
+
function rootsFile(configPath) {
|
|
80003
|
+
return join30(dirname15(configPath), "sources.json");
|
|
80004
|
+
}
|
|
80005
|
+
function migrateGlobalRootsIfNeeded(configPath) {
|
|
80006
|
+
const wsFile = rootsFile(configPath);
|
|
80007
|
+
if (existsSync26(wsFile)) return;
|
|
80008
|
+
const globalFile = join30(configDir(), "sources.json");
|
|
80009
|
+
if (globalFile === wsFile || !existsSync26(globalFile)) return;
|
|
80010
|
+
let roots;
|
|
80011
|
+
try {
|
|
80012
|
+
const parsed = JSON.parse(readFileSync24(globalFile, "utf8"));
|
|
80013
|
+
if (!Array.isArray(parsed.roots) || parsed.roots.length === 0) return;
|
|
80014
|
+
roots = parsed.roots;
|
|
80015
|
+
} catch {
|
|
80016
|
+
return;
|
|
80017
|
+
}
|
|
80018
|
+
try {
|
|
80019
|
+
mkdirSync11(dirname15(wsFile), { recursive: true });
|
|
80020
|
+
writeFileSync9(wsFile, JSON.stringify({ roots }, null, 2), "utf8");
|
|
80021
|
+
} catch {
|
|
80022
|
+
return;
|
|
80023
|
+
}
|
|
80024
|
+
try {
|
|
80025
|
+
rmSync(globalFile, { force: true });
|
|
80026
|
+
} catch {
|
|
80027
|
+
try {
|
|
80028
|
+
writeFileSync9(globalFile, JSON.stringify({ roots: [] }, null, 2), "utf8");
|
|
80029
|
+
} catch {
|
|
80030
|
+
}
|
|
80031
|
+
}
|
|
79996
80032
|
}
|
|
79997
|
-
function readRoots() {
|
|
80033
|
+
function readRoots(configPath) {
|
|
80034
|
+
migrateGlobalRootsIfNeeded(configPath);
|
|
79998
80035
|
try {
|
|
79999
|
-
const raw = readFileSync24(rootsFile(), "utf8");
|
|
80036
|
+
const raw = readFileSync24(rootsFile(configPath), "utf8");
|
|
80000
80037
|
const parsed = JSON.parse(raw);
|
|
80001
80038
|
return Array.isArray(parsed.roots) ? parsed.roots : [];
|
|
80002
80039
|
} catch {
|
|
80003
80040
|
return [];
|
|
80004
80041
|
}
|
|
80005
80042
|
}
|
|
80006
|
-
function writeRoots(roots) {
|
|
80007
|
-
writeFileSync9(rootsFile(), JSON.stringify({ roots }, null, 2), "utf8");
|
|
80043
|
+
function writeRoots(configPath, roots) {
|
|
80044
|
+
writeFileSync9(rootsFile(configPath), JSON.stringify({ roots }, null, 2), "utf8");
|
|
80008
80045
|
}
|
|
80009
80046
|
function safeResolveInside2(target, roots) {
|
|
80010
80047
|
const abs = resolve12(target);
|
|
@@ -80094,14 +80131,14 @@ async function ingestFolder(abs, ingestFile) {
|
|
|
80094
80131
|
return { ingested, skipped };
|
|
80095
80132
|
}
|
|
80096
80133
|
async function dispatchSourcesRoute(req, res, deps) {
|
|
80097
|
-
const { pathname, method, ingestFile } = deps;
|
|
80134
|
+
const { pathname, method, ingestFile, configPath } = deps;
|
|
80098
80135
|
if (!pathname.startsWith("/api/sources/")) return false;
|
|
80099
80136
|
if (!localFileOpenEnabled()) {
|
|
80100
80137
|
sendJson(res, { enabled: false });
|
|
80101
80138
|
return true;
|
|
80102
80139
|
}
|
|
80103
80140
|
if (pathname === "/api/sources/roots" && method === "GET") {
|
|
80104
|
-
sendJson(res, { enabled: true, roots: readRoots() });
|
|
80141
|
+
sendJson(res, { enabled: true, roots: readRoots(configPath) });
|
|
80105
80142
|
return true;
|
|
80106
80143
|
}
|
|
80107
80144
|
if (pathname === "/api/sources/roots" && method === "POST") {
|
|
@@ -80127,12 +80164,12 @@ async function dispatchSourcesRoute(req, res, deps) {
|
|
|
80127
80164
|
sendJson(res, { error: `path not found: ${abs}` }, 400);
|
|
80128
80165
|
return true;
|
|
80129
80166
|
}
|
|
80130
|
-
const roots = readRoots();
|
|
80167
|
+
const roots = readRoots(configPath);
|
|
80131
80168
|
let root6 = roots.find((r6) => resolve12(r6.path) === abs);
|
|
80132
80169
|
if (!root6) {
|
|
80133
80170
|
root6 = { id: randomUUID4(), path: abs, kind, name: basename13(abs) || abs };
|
|
80134
80171
|
roots.push(root6);
|
|
80135
|
-
writeRoots(roots);
|
|
80172
|
+
writeRoots(configPath, roots);
|
|
80136
80173
|
}
|
|
80137
80174
|
let result;
|
|
80138
80175
|
if (kind === "folder") result = await ingestFolder(abs, ingestFile);
|
|
@@ -80143,8 +80180,8 @@ async function dispatchSourcesRoute(req, res, deps) {
|
|
|
80143
80180
|
const delMatch = /^\/api\/sources\/roots\/([^/]+)$/.exec(pathname);
|
|
80144
80181
|
if (delMatch && method === "DELETE") {
|
|
80145
80182
|
const id = decodeURIComponent(delMatch[1] ?? "");
|
|
80146
|
-
const roots = readRoots().filter((r6) => r6.id !== id);
|
|
80147
|
-
writeRoots(roots);
|
|
80183
|
+
const roots = readRoots(configPath).filter((r6) => r6.id !== id);
|
|
80184
|
+
writeRoots(configPath, roots);
|
|
80148
80185
|
sendJson(res, { ok: true });
|
|
80149
80186
|
return true;
|
|
80150
80187
|
}
|
|
@@ -80162,7 +80199,7 @@ async function dispatchSourcesRoute(req, res, deps) {
|
|
|
80162
80199
|
sendJson(res, { error: "path is required" }, 400);
|
|
80163
80200
|
return true;
|
|
80164
80201
|
}
|
|
80165
|
-
const abs = safeResolveInside2(target, readRoots());
|
|
80202
|
+
const abs = safeResolveInside2(target, readRoots(configPath));
|
|
80166
80203
|
if (!abs) {
|
|
80167
80204
|
sendJson(res, { error: "path is outside any registered source root" }, 403);
|
|
80168
80205
|
return true;
|
|
@@ -80177,7 +80214,7 @@ async function dispatchSourcesRoute(req, res, deps) {
|
|
|
80177
80214
|
if (pathname === "/api/sources/ingest-folder" && method === "POST") {
|
|
80178
80215
|
const body = await readJson(req).catch(() => ({}));
|
|
80179
80216
|
const target = typeof body.path === "string" ? body.path : "";
|
|
80180
|
-
const abs = safeResolveInside2(target, readRoots());
|
|
80217
|
+
const abs = safeResolveInside2(target, readRoots(configPath));
|
|
80181
80218
|
if (!abs) {
|
|
80182
80219
|
sendJson(res, { error: "path is outside any registered source root" }, 403);
|
|
80183
80220
|
return true;
|
|
@@ -80191,7 +80228,7 @@ async function dispatchSourcesRoute(req, res, deps) {
|
|
|
80191
80228
|
// src/gui/import-routes.ts
|
|
80192
80229
|
init_adapter();
|
|
80193
80230
|
init_http2();
|
|
80194
|
-
import { existsSync as
|
|
80231
|
+
import { existsSync as existsSync27, readFileSync as readFileSync25, statSync as statSync11 } from "fs";
|
|
80195
80232
|
import { isAbsolute as isAbsolute4, join as join31 } from "path";
|
|
80196
80233
|
init_native_entities();
|
|
80197
80234
|
function badRequest(message) {
|
|
@@ -80225,7 +80262,7 @@ async function readImportSourceFromFile(db, fileId, latticeRoot) {
|
|
|
80225
80262
|
);
|
|
80226
80263
|
if (!row) throw badRequest("Unknown import file: " + fileId);
|
|
80227
80264
|
const path3 = localPathOf2(row, latticeRoot);
|
|
80228
|
-
if (!path3 || !
|
|
80265
|
+
if (!path3 || !existsSync27(path3)) {
|
|
80229
80266
|
throw badRequest("The import file\u2019s bytes are not available locally.");
|
|
80230
80267
|
}
|
|
80231
80268
|
const sizeBytes = statSync11(path3).size;
|
|
@@ -80520,7 +80557,7 @@ init_dispatch();
|
|
|
80520
80557
|
init_column_descriptions();
|
|
80521
80558
|
init_mutations();
|
|
80522
80559
|
init_native_entities();
|
|
80523
|
-
import { createReadStream as createReadStream3, existsSync as
|
|
80560
|
+
import { createReadStream as createReadStream3, existsSync as existsSync28, realpathSync as realpathSync2, statSync as statSync12 } from "fs";
|
|
80524
80561
|
import { extname as extname3, join as join32, normalize as normalize2, sep as sep9 } from "path";
|
|
80525
80562
|
|
|
80526
80563
|
// src/gui/count-many.ts
|
|
@@ -80728,7 +80765,7 @@ async function handleReadRoutes(req, res, ctx, deps) {
|
|
|
80728
80765
|
const base = deps.guiAssetsDir.replace(/[/\\]+$/, "");
|
|
80729
80766
|
const target = normalize2(join32(base, rel));
|
|
80730
80767
|
const within = target === base || target.startsWith(base + sep9);
|
|
80731
|
-
if (!within || !
|
|
80768
|
+
if (!within || !existsSync28(target) || !statSync12(target).isFile()) {
|
|
80732
80769
|
sendJson(res, { error: "asset not found" }, 404);
|
|
80733
80770
|
return true;
|
|
80734
80771
|
}
|
|
@@ -81936,16 +81973,16 @@ async function handleHistoryRoutes(req, res, ctx, deps) {
|
|
|
81936
81973
|
// src/gui/workspaces-routes.ts
|
|
81937
81974
|
init_http2();
|
|
81938
81975
|
import { resolve as resolve13 } from "path";
|
|
81939
|
-
import { existsSync as
|
|
81976
|
+
import { existsSync as existsSync29, rmSync as rmSync2 } from "fs";
|
|
81940
81977
|
init_workspace();
|
|
81941
81978
|
init_lattice_root();
|
|
81942
81979
|
init_user_config();
|
|
81943
81980
|
function cleanupWorkspaceFiles(root6, ws) {
|
|
81944
81981
|
if (!ws.configPath && ws.kind === "local") {
|
|
81945
|
-
|
|
81982
|
+
rmSync2(workspaceDir(root6, ws.dir), { recursive: true, force: true });
|
|
81946
81983
|
} else if (ws.kind === "cloud") {
|
|
81947
|
-
if (ws.configPath &&
|
|
81948
|
-
|
|
81984
|
+
if (ws.configPath && existsSync29(ws.configPath)) {
|
|
81985
|
+
rmSync2(ws.configPath, { force: true });
|
|
81949
81986
|
}
|
|
81950
81987
|
const labelMatch = /^\$\{LATTICE_DB:([A-Za-z0-9._-]+)\}$/.exec(ws.db.trim());
|
|
81951
81988
|
const label = labelMatch?.[1];
|
|
@@ -82148,15 +82185,15 @@ async function handleWorkspacesRoutes(req, res, ctx, deps) {
|
|
|
82148
82185
|
// src/gui/databases-routes.ts
|
|
82149
82186
|
init_http2();
|
|
82150
82187
|
import { basename as basename15, resolve as resolve15 } from "path";
|
|
82151
|
-
import { existsSync as
|
|
82188
|
+
import { existsSync as existsSync31 } from "fs";
|
|
82152
82189
|
init_parser();
|
|
82153
82190
|
|
|
82154
82191
|
// src/gui/config-paths.ts
|
|
82155
82192
|
init_parser();
|
|
82156
|
-
import { basename as basename14, dirname as
|
|
82193
|
+
import { basename as basename14, dirname as dirname16, join as join33, resolve as resolve14 } from "path";
|
|
82157
82194
|
import {
|
|
82158
|
-
existsSync as
|
|
82159
|
-
mkdirSync as
|
|
82195
|
+
existsSync as existsSync30,
|
|
82196
|
+
mkdirSync as mkdirSync12,
|
|
82160
82197
|
readFileSync as readFileSync26,
|
|
82161
82198
|
readdirSync as readdirSync9,
|
|
82162
82199
|
unlinkSync as unlinkSync5,
|
|
@@ -82164,10 +82201,10 @@ import {
|
|
|
82164
82201
|
} from "fs";
|
|
82165
82202
|
import { parseDocument as parseDocument7 } from "yaml";
|
|
82166
82203
|
function resolveOutputDirForConfig(configPath) {
|
|
82167
|
-
const base =
|
|
82204
|
+
const base = dirname16(resolve14(configPath));
|
|
82168
82205
|
for (const dir of ["context", ".", "generated"]) {
|
|
82169
82206
|
const abs = resolve14(base, dir);
|
|
82170
|
-
if (
|
|
82207
|
+
if (existsSync30(join33(abs, ".lattice", "manifest.json"))) return abs;
|
|
82171
82208
|
}
|
|
82172
82209
|
return resolve14(base, "context");
|
|
82173
82210
|
}
|
|
@@ -82176,7 +82213,7 @@ function friendlyConfigName(parsedName, configPath) {
|
|
|
82176
82213
|
return basename14(configPath).replace(/\.(ya?ml)$/, "");
|
|
82177
82214
|
}
|
|
82178
82215
|
function listConfigs(activeConfigPath) {
|
|
82179
|
-
const dir =
|
|
82216
|
+
const dir = dirname16(activeConfigPath);
|
|
82180
82217
|
const entries = [];
|
|
82181
82218
|
for (const fname of readdirSync9(dir)) {
|
|
82182
82219
|
if (!fname.endsWith(".yml") && !fname.endsWith(".yaml")) continue;
|
|
@@ -82205,17 +82242,17 @@ function listConfigs(activeConfigPath) {
|
|
|
82205
82242
|
return entries.sort((a6, b6) => a6.label.localeCompare(b6.label));
|
|
82206
82243
|
}
|
|
82207
82244
|
function createBlankConfig(activeConfigPath, dbName) {
|
|
82208
|
-
const dir =
|
|
82245
|
+
const dir = dirname16(activeConfigPath);
|
|
82209
82246
|
const slug = dbName.toLowerCase().replace(/[^a-z0-9_-]+/g, "-").replace(/^-+|-+$/g, "");
|
|
82210
82247
|
if (!slug) throw new Error("Workspace name must contain at least one alphanumeric character");
|
|
82211
82248
|
const configPath = join33(dir, `${slug}.config.yml`);
|
|
82212
|
-
if (
|
|
82249
|
+
if (existsSync30(configPath)) throw new Error(`Config already exists: ${slug}.config.yml`);
|
|
82213
82250
|
const yaml = `db: ./data/${slug}.db
|
|
82214
82251
|
|
|
82215
82252
|
entities: {}
|
|
82216
82253
|
`;
|
|
82217
82254
|
writeFileSync10(configPath, yaml, "utf8");
|
|
82218
|
-
|
|
82255
|
+
mkdirSync12(join33(dir, "data"), { recursive: true });
|
|
82219
82256
|
return configPath;
|
|
82220
82257
|
}
|
|
82221
82258
|
function sqliteFileForConfig(configPath) {
|
|
@@ -82224,18 +82261,18 @@ function sqliteFileForConfig(configPath) {
|
|
|
82224
82261
|
if (!raw) return null;
|
|
82225
82262
|
if (isPostgresUrl(raw) || raw.startsWith("${LATTICE_DB:")) return null;
|
|
82226
82263
|
if (raw === ":memory:" || raw.startsWith("file:")) return null;
|
|
82227
|
-
return resolve14(
|
|
82264
|
+
return resolve14(dirname16(configPath), raw);
|
|
82228
82265
|
}
|
|
82229
82266
|
function deleteDatabaseFiles(targetConfigPath) {
|
|
82230
82267
|
const sqliteFile = sqliteFileForConfig(targetConfigPath);
|
|
82231
82268
|
unlinkSync5(targetConfigPath);
|
|
82232
82269
|
let deletedDbFile = null;
|
|
82233
|
-
if (sqliteFile &&
|
|
82270
|
+
if (sqliteFile && existsSync30(sqliteFile)) {
|
|
82234
82271
|
unlinkSync5(sqliteFile);
|
|
82235
82272
|
deletedDbFile = sqliteFile;
|
|
82236
82273
|
for (const suffix of ["-wal", "-shm", "-journal"]) {
|
|
82237
82274
|
const sidecar = sqliteFile + suffix;
|
|
82238
|
-
if (
|
|
82275
|
+
if (existsSync30(sidecar)) unlinkSync5(sidecar);
|
|
82239
82276
|
}
|
|
82240
82277
|
}
|
|
82241
82278
|
return { deletedConfig: basename14(targetConfigPath), deletedDbFile };
|
|
@@ -82269,7 +82306,7 @@ async function handleDatabasesRoutes(req, res, ctx, deps) {
|
|
|
82269
82306
|
return true;
|
|
82270
82307
|
}
|
|
82271
82308
|
const newPath = resolve15(body.path);
|
|
82272
|
-
if (!
|
|
82309
|
+
if (!existsSync31(newPath)) {
|
|
82273
82310
|
sendJson(res, { error: `Config not found: ${newPath}` }, 400);
|
|
82274
82311
|
return true;
|
|
82275
82312
|
}
|
|
@@ -82375,8 +82412,8 @@ async function handleDatabasesRoutes(req, res, ctx, deps) {
|
|
|
82375
82412
|
// src/gui/server.ts
|
|
82376
82413
|
init_user_config();
|
|
82377
82414
|
function resolveDefaultGuiAssetsDir() {
|
|
82378
|
-
const bundleSibling = process.argv[1] ? resolve16(
|
|
82379
|
-
if (bundleSibling &&
|
|
82415
|
+
const bundleSibling = process.argv[1] ? resolve16(dirname17(process.argv[1]), "gui-assets") : null;
|
|
82416
|
+
if (bundleSibling && existsSync32(bundleSibling)) return bundleSibling;
|
|
82380
82417
|
return resolve16(process.cwd(), "dist", "gui-assets");
|
|
82381
82418
|
}
|
|
82382
82419
|
function sendText(res, body, status = 200, contentType = "text/plain; charset=utf-8") {
|
|
@@ -82433,7 +82470,7 @@ async function startGuiServer(options) {
|
|
|
82433
82470
|
const sessionId = crypto.randomUUID();
|
|
82434
82471
|
let updateService = null;
|
|
82435
82472
|
let activeRef = bootConfigPath && bootOutputDir ? await openConfig(bootConfigPath, bootOutputDir, autoRender, options.realtimeWatchdogMs) : null;
|
|
82436
|
-
const latticeRoot = (bootConfigPath ? findLatticeRoot(
|
|
82473
|
+
const latticeRoot = (bootConfigPath ? findLatticeRoot(dirname17(bootConfigPath)) : null) ?? (options.latticeRoot ? resolve16(options.latticeRoot) : null);
|
|
82437
82474
|
let currentWorkspaceId = null;
|
|
82438
82475
|
if (latticeRoot && bootConfigPath) {
|
|
82439
82476
|
const launched = listWorkspaces(latticeRoot).find(
|
|
@@ -82787,7 +82824,7 @@ async function startGuiServer(options) {
|
|
|
82787
82824
|
createJunction: (otherTable) => createFileJunction(active, otherTable, sessionId),
|
|
82788
82825
|
createEntity: (entity, columns) => createUserEntity(active, entity, columns, sessionId),
|
|
82789
82826
|
aggressiveness: getAggressiveness(),
|
|
82790
|
-
latticeRoot:
|
|
82827
|
+
latticeRoot: dirname17(active.configPath),
|
|
82791
82828
|
configPath: active.configPath,
|
|
82792
82829
|
outputDir: active.outputDir,
|
|
82793
82830
|
sessionId,
|
|
@@ -82812,7 +82849,7 @@ async function startGuiServer(options) {
|
|
|
82812
82849
|
createJunction: (otherTable) => createFileJunction(active, otherTable, sessionId),
|
|
82813
82850
|
createEntity: (entity, columns) => createUserEntity(active, entity, columns, sessionId),
|
|
82814
82851
|
aggressiveness: getAggressiveness(),
|
|
82815
|
-
latticeRoot:
|
|
82852
|
+
latticeRoot: dirname17(active.configPath),
|
|
82816
82853
|
configPath: active.configPath,
|
|
82817
82854
|
outputDir: active.outputDir,
|
|
82818
82855
|
sessionId,
|
|
@@ -82823,6 +82860,7 @@ async function startGuiServer(options) {
|
|
|
82823
82860
|
return await dispatchSourcesRoute(req2, res2, {
|
|
82824
82861
|
db: active.db,
|
|
82825
82862
|
ingestFile: (p3) => ingestLocalFile(ingestCtx, mctx, p3, false),
|
|
82863
|
+
configPath: active.configPath,
|
|
82826
82864
|
pathname,
|
|
82827
82865
|
method
|
|
82828
82866
|
});
|
|
@@ -82838,7 +82876,7 @@ async function startGuiServer(options) {
|
|
|
82838
82876
|
return await dispatchImportRoute(req2, res2, {
|
|
82839
82877
|
db: active.db,
|
|
82840
82878
|
configPath: active.configPath,
|
|
82841
|
-
latticeRoot:
|
|
82879
|
+
latticeRoot: dirname17(active.configPath),
|
|
82842
82880
|
validTables: active.validTables,
|
|
82843
82881
|
softDeletable: active.softDeletable
|
|
82844
82882
|
});
|
|
@@ -82867,7 +82905,7 @@ async function startGuiServer(options) {
|
|
|
82867
82905
|
if (!pathname.startsWith("/api/files/")) return false;
|
|
82868
82906
|
return await dispatchFilesRoute(req2, res2, {
|
|
82869
82907
|
db: active.db,
|
|
82870
|
-
latticeRoot:
|
|
82908
|
+
latticeRoot: dirname17(active.configPath),
|
|
82871
82909
|
configPath: active.configPath,
|
|
82872
82910
|
pathname,
|
|
82873
82911
|
method
|
|
@@ -83078,8 +83116,8 @@ ${e6.stack ?? ""}`
|
|
|
83078
83116
|
}
|
|
83079
83117
|
|
|
83080
83118
|
// src/cloud/file-source-key-store.ts
|
|
83081
|
-
import { readFileSync as readFileSync27, writeFileSync as writeFileSync11, existsSync as
|
|
83082
|
-
import { dirname as
|
|
83119
|
+
import { readFileSync as readFileSync27, writeFileSync as writeFileSync11, existsSync as existsSync33, mkdirSync as mkdirSync13, renameSync as renameSync5, chmodSync as chmodSync3 } from "fs";
|
|
83120
|
+
import { dirname as dirname18, resolve as resolve17 } from "path";
|
|
83083
83121
|
import { createCipheriv as createCipheriv3, createDecipheriv as createDecipheriv3, randomBytes as randomBytes9, scryptSync as scryptSync3 } from "crypto";
|
|
83084
83122
|
var ENC_HEADER = "LATTICE-KMS-v1\n";
|
|
83085
83123
|
var SCRYPT_N = 1 << 15;
|
|
@@ -83130,9 +83168,9 @@ var FileSourceKeyStore = class {
|
|
|
83130
83168
|
// ── internals ────────────────────────────────────────────────────────
|
|
83131
83169
|
load() {
|
|
83132
83170
|
const out = /* @__PURE__ */ new Map();
|
|
83133
|
-
if (!
|
|
83134
|
-
const dir =
|
|
83135
|
-
if (!
|
|
83171
|
+
if (!existsSync33(this.path)) {
|
|
83172
|
+
const dir = dirname18(this.path);
|
|
83173
|
+
if (!existsSync33(dir)) mkdirSync13(dir, { recursive: true, mode: 448 });
|
|
83136
83174
|
return out;
|
|
83137
83175
|
}
|
|
83138
83176
|
const raw = readFileSync27(this.path);
|
package/package.json
CHANGED