elit 3.1.8 → 3.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.
- package/dist/cli.js +307 -8
- package/dist/config.d.ts.map +1 -1
- package/dist/database.d.mts +10 -1
- package/dist/database.d.ts +9 -0
- package/dist/database.d.ts.map +1 -1
- package/dist/database.js +293 -2
- package/dist/database.mjs +291 -1
- package/dist/server.js +290 -1
- package/dist/server.mjs +290 -1
- package/package.json +1 -1
- package/src/config.ts +20 -6
- package/src/database.ts +364 -2
package/dist/cli.js
CHANGED
|
@@ -1435,7 +1435,7 @@ var require_package = __commonJS({
|
|
|
1435
1435
|
"package.json"(exports2, module2) {
|
|
1436
1436
|
module2.exports = {
|
|
1437
1437
|
name: "elit",
|
|
1438
|
-
version: "3.
|
|
1438
|
+
version: "3.2.0",
|
|
1439
1439
|
description: "Optimized lightweight library for creating DOM elements with reactive state",
|
|
1440
1440
|
main: "dist/index.js",
|
|
1441
1441
|
module: "dist/index.mjs",
|
|
@@ -1702,20 +1702,30 @@ async function loadConfigFile(configPath) {
|
|
|
1702
1702
|
const { join: join2, dirname: dirname2 } = await Promise.resolve().then(() => (init_path(), path_exports));
|
|
1703
1703
|
const tempFile = join2(tmpdir(), `elit-config-${Date.now()}.mjs`);
|
|
1704
1704
|
const configDir = dirname2(configPath);
|
|
1705
|
-
|
|
1705
|
+
const buildOptions = {
|
|
1706
1706
|
entryPoints: [configPath],
|
|
1707
1707
|
bundle: true,
|
|
1708
1708
|
format: "esm",
|
|
1709
|
-
platform: "
|
|
1709
|
+
platform: "neutral",
|
|
1710
1710
|
outfile: tempFile,
|
|
1711
1711
|
write: true,
|
|
1712
1712
|
target: "es2020",
|
|
1713
|
-
//
|
|
1714
|
-
|
|
1715
|
-
|
|
1713
|
+
// Don't bundle any dependencies, only bundle the config file itself
|
|
1714
|
+
packages: "external",
|
|
1715
|
+
// External node_modules but allow inline of elit package
|
|
1716
|
+
external: (context) => {
|
|
1717
|
+
if (context.path.includes("node_modules/elit") || context.path.startsWith("elit/")) {
|
|
1718
|
+
return false;
|
|
1719
|
+
}
|
|
1720
|
+
if (context.path.includes("node_modules")) {
|
|
1721
|
+
return true;
|
|
1722
|
+
}
|
|
1723
|
+
return false;
|
|
1724
|
+
},
|
|
1716
1725
|
// Use the config directory as the working directory for resolution
|
|
1717
1726
|
absWorkingDir: configDir
|
|
1718
|
-
}
|
|
1727
|
+
};
|
|
1728
|
+
await build3(buildOptions);
|
|
1719
1729
|
const config = await importConfigModule(tempFile);
|
|
1720
1730
|
await safeCleanup(tempFile);
|
|
1721
1731
|
return config;
|
|
@@ -3120,8 +3130,16 @@ var Database = class {
|
|
|
3120
3130
|
acc[type] = (...args) => logs.push({ type, args });
|
|
3121
3131
|
return acc;
|
|
3122
3132
|
}, {});
|
|
3133
|
+
const systemBase = {
|
|
3134
|
+
update,
|
|
3135
|
+
remove,
|
|
3136
|
+
rename: rename2,
|
|
3137
|
+
read,
|
|
3138
|
+
create,
|
|
3139
|
+
save
|
|
3140
|
+
};
|
|
3123
3141
|
this.register({
|
|
3124
|
-
|
|
3142
|
+
dbConsole: { ...customConsole, ...systemBase }
|
|
3125
3143
|
});
|
|
3126
3144
|
let stringCode;
|
|
3127
3145
|
if (typeof code === "function") {
|
|
@@ -3216,6 +3234,287 @@ var Database = class {
|
|
|
3216
3234
|
return await this.vmRun(code, options);
|
|
3217
3235
|
}
|
|
3218
3236
|
};
|
|
3237
|
+
function create(dbName, code) {
|
|
3238
|
+
const DIR = "databases";
|
|
3239
|
+
const basePath = process.cwd();
|
|
3240
|
+
const baseDir = import_node_path.default.resolve(basePath, DIR);
|
|
3241
|
+
const dbPath = import_node_path.default.join(baseDir, `${dbName}.ts`);
|
|
3242
|
+
import_node_fs.default.appendFileSync(dbPath, code.toString(), "utf8");
|
|
3243
|
+
}
|
|
3244
|
+
function read(dbName) {
|
|
3245
|
+
const DIR = "databases";
|
|
3246
|
+
const basePath = process.cwd();
|
|
3247
|
+
const baseDir = import_node_path.default.resolve(basePath, DIR);
|
|
3248
|
+
const dbPath = import_node_path.default.join(baseDir, `${dbName}.ts`);
|
|
3249
|
+
if (!import_node_fs.default.existsSync(dbPath)) {
|
|
3250
|
+
throw new Error(`Database '${dbName}' not found`);
|
|
3251
|
+
}
|
|
3252
|
+
return import_node_fs.default.readFileSync(dbPath, "utf8");
|
|
3253
|
+
}
|
|
3254
|
+
function remove(dbName, fnName) {
|
|
3255
|
+
const DIR = "databases";
|
|
3256
|
+
const basePath = process.cwd();
|
|
3257
|
+
const baseDir = import_node_path.default.resolve(basePath, DIR);
|
|
3258
|
+
const dbPath = import_node_path.default.join(baseDir, `${dbName}.ts`);
|
|
3259
|
+
if (!import_node_fs.default.existsSync(dbPath)) return false;
|
|
3260
|
+
if (!fnName) {
|
|
3261
|
+
const bak2 = `${dbPath}.bak`;
|
|
3262
|
+
try {
|
|
3263
|
+
import_node_fs.default.copyFileSync(dbPath, bak2);
|
|
3264
|
+
} catch (e) {
|
|
3265
|
+
}
|
|
3266
|
+
try {
|
|
3267
|
+
import_node_fs.default.unlinkSync(dbPath);
|
|
3268
|
+
return "Removed successfully";
|
|
3269
|
+
} catch (e) {
|
|
3270
|
+
return "Removed failed";
|
|
3271
|
+
}
|
|
3272
|
+
}
|
|
3273
|
+
const bak = `${dbPath}.bak`;
|
|
3274
|
+
try {
|
|
3275
|
+
import_node_fs.default.copyFileSync(dbPath, bak);
|
|
3276
|
+
} catch (e) {
|
|
3277
|
+
}
|
|
3278
|
+
let src = import_node_fs.default.readFileSync(dbPath, "utf8");
|
|
3279
|
+
const escaped = fnName.replace(/[-/\\^$*+?.()|[\]{}]/g, "\\$&");
|
|
3280
|
+
const startRe = new RegExp(
|
|
3281
|
+
`function\\s+${escaped}\\s*\\(|\\bclass\\s+${escaped}\\b|\\b(?:const|let|var)\\s+${escaped}\\s*=\\s*(?:function\\b|class\\b|\\(|\\{|\\[)`,
|
|
3282
|
+
"m"
|
|
3283
|
+
);
|
|
3284
|
+
const startMatch = src.match(startRe);
|
|
3285
|
+
if (startMatch) {
|
|
3286
|
+
const startIdx = startMatch.index;
|
|
3287
|
+
const len = src.length;
|
|
3288
|
+
const idxCurly = src.indexOf("{", startIdx);
|
|
3289
|
+
const idxBracket = src.indexOf("[", startIdx);
|
|
3290
|
+
let braceOpen = -1;
|
|
3291
|
+
if (idxCurly === -1) braceOpen = idxBracket;
|
|
3292
|
+
else if (idxBracket === -1) braceOpen = idxCurly;
|
|
3293
|
+
else braceOpen = Math.min(idxCurly, idxBracket);
|
|
3294
|
+
if (braceOpen !== -1) {
|
|
3295
|
+
const openingChar = src[braceOpen];
|
|
3296
|
+
const closingChar = openingChar === "[" ? "]" : "}";
|
|
3297
|
+
let i = braceOpen + 1;
|
|
3298
|
+
let depth = 1;
|
|
3299
|
+
while (i < len && depth > 0) {
|
|
3300
|
+
const ch = src[i];
|
|
3301
|
+
if (ch === openingChar) depth++;
|
|
3302
|
+
else if (ch === closingChar) depth--;
|
|
3303
|
+
i++;
|
|
3304
|
+
}
|
|
3305
|
+
let braceClose = i;
|
|
3306
|
+
let endIdx = braceClose;
|
|
3307
|
+
if (src.slice(braceClose, braceClose + 1) === ";")
|
|
3308
|
+
endIdx = braceClose + 1;
|
|
3309
|
+
const before = src.slice(0, startIdx);
|
|
3310
|
+
const after = src.slice(endIdx);
|
|
3311
|
+
src = before + after;
|
|
3312
|
+
} else {
|
|
3313
|
+
const semi = src.indexOf(";", startIdx);
|
|
3314
|
+
let endIdx = semi !== -1 ? semi + 1 : src.indexOf("\n\n", startIdx);
|
|
3315
|
+
if (endIdx === -1) endIdx = len;
|
|
3316
|
+
src = src.slice(0, startIdx) + src.slice(endIdx);
|
|
3317
|
+
}
|
|
3318
|
+
}
|
|
3319
|
+
const exportRe = new RegExp(
|
|
3320
|
+
`export\\s+const\\s+${escaped}\\s*:\\s*any\\s*=\\s*${escaped}\\s*;?`,
|
|
3321
|
+
"g"
|
|
3322
|
+
);
|
|
3323
|
+
src = src.replace(exportRe, "");
|
|
3324
|
+
src = src.replace(/\n{3,}/g, "\n\n");
|
|
3325
|
+
import_node_fs.default.writeFileSync(dbPath, src, "utf8");
|
|
3326
|
+
return `Removed ${fnName} from database ${dbName}.`;
|
|
3327
|
+
}
|
|
3328
|
+
function rename2(oldName, newName) {
|
|
3329
|
+
const DIR = "databases";
|
|
3330
|
+
const basePath = process.cwd();
|
|
3331
|
+
const baseDir = import_node_path.default.resolve(basePath, DIR);
|
|
3332
|
+
const oldPath = import_node_path.default.join(baseDir, `${oldName}.ts`);
|
|
3333
|
+
const newPath = import_node_path.default.join(baseDir, `${newName}.ts`);
|
|
3334
|
+
if (!import_node_fs.default.existsSync(oldPath)) {
|
|
3335
|
+
return `Error: File '${oldName}.ts' does not exist in the database`;
|
|
3336
|
+
}
|
|
3337
|
+
if (import_node_fs.default.existsSync(newPath)) {
|
|
3338
|
+
return `Error: File '${newName}.ts' already exists in the database`;
|
|
3339
|
+
}
|
|
3340
|
+
try {
|
|
3341
|
+
import_node_fs.default.renameSync(oldPath, newPath);
|
|
3342
|
+
return `Successfully renamed '${oldName}.ts' to '${newName}.ts'`;
|
|
3343
|
+
} catch (error) {
|
|
3344
|
+
return `Error renaming file: ${error instanceof Error ? error.message : String(error)}`;
|
|
3345
|
+
}
|
|
3346
|
+
}
|
|
3347
|
+
function save(dbName, code) {
|
|
3348
|
+
const DIR = "databases";
|
|
3349
|
+
const basePath = process.cwd();
|
|
3350
|
+
const baseDir = import_node_path.default.resolve(basePath, DIR);
|
|
3351
|
+
const dbPath = import_node_path.default.join(baseDir, `${dbName}.ts`);
|
|
3352
|
+
let fileContent = typeof code === "function" ? code.toString() : code;
|
|
3353
|
+
import_node_fs.default.writeFileSync(dbPath, fileContent, "utf8");
|
|
3354
|
+
}
|
|
3355
|
+
function update(dbName, fnName, code) {
|
|
3356
|
+
const DIR = "databases";
|
|
3357
|
+
const basePath = process.cwd();
|
|
3358
|
+
const baseDir = import_node_path.default.resolve(basePath, DIR);
|
|
3359
|
+
const dbPath = import_node_path.default.join(baseDir, `${dbName}.ts`);
|
|
3360
|
+
let src;
|
|
3361
|
+
if (!import_node_fs.default.existsSync(dbPath)) {
|
|
3362
|
+
try {
|
|
3363
|
+
import_node_fs.default.writeFileSync(dbPath, "", "utf8");
|
|
3364
|
+
return `Created new database file: ${dbPath}`;
|
|
3365
|
+
} catch (e) {
|
|
3366
|
+
return `Failed to create dbPath file: ${dbPath}`;
|
|
3367
|
+
}
|
|
3368
|
+
}
|
|
3369
|
+
src = import_node_fs.default.readFileSync(dbPath, "utf8");
|
|
3370
|
+
const originalSrc = src;
|
|
3371
|
+
const escaped = fnName.replace(/[-/\\^$*+?.()|[\]{}]/g, "\\$&");
|
|
3372
|
+
const startRe = new RegExp(
|
|
3373
|
+
`function\\s+${escaped}\\s*\\(|\\bclass\\s+${escaped}\\b|\\b(?:const|let|var)\\s+${escaped}\\s*=\\s*(?:function\\b|class\\b|\\(|\\{|\\[)`,
|
|
3374
|
+
"m"
|
|
3375
|
+
);
|
|
3376
|
+
const startMatch = src.match(startRe);
|
|
3377
|
+
let declKind = null;
|
|
3378
|
+
if (startMatch) {
|
|
3379
|
+
let startIdx = startMatch.index;
|
|
3380
|
+
const snippet = src.slice(startIdx, startIdx + 80);
|
|
3381
|
+
if (/^function\b/.test(snippet)) declKind = "functionDecl";
|
|
3382
|
+
else if (/^class\b/.test(snippet)) declKind = "classDecl";
|
|
3383
|
+
else if (/^\b(?:const|let|var)\b/.test(snippet)) declKind = "varAssign";
|
|
3384
|
+
}
|
|
3385
|
+
let newCode;
|
|
3386
|
+
if (typeof code === "function") {
|
|
3387
|
+
const fnStr = code.toString();
|
|
3388
|
+
if (declKind === "functionDecl") {
|
|
3389
|
+
if (/^function\s+\w+/.test(fnStr)) newCode = fnStr;
|
|
3390
|
+
else
|
|
3391
|
+
newCode = `function ${fnName}${fnStr.replace(
|
|
3392
|
+
/^function\s*\(/,
|
|
3393
|
+
"("
|
|
3394
|
+
)}`;
|
|
3395
|
+
} else if (declKind === "classDecl") {
|
|
3396
|
+
if (/^class\s+\w+/.test(fnStr)) newCode = fnStr;
|
|
3397
|
+
else if (/^class\s*\{/.test(fnStr))
|
|
3398
|
+
newCode = fnStr.replace(/^class\s*\{/, `class ${fnName} {`);
|
|
3399
|
+
else newCode = `const ${fnName} = ${fnStr};`;
|
|
3400
|
+
} else {
|
|
3401
|
+
newCode = `const ${fnName} = ${fnStr};`;
|
|
3402
|
+
}
|
|
3403
|
+
} else {
|
|
3404
|
+
newCode = `const ${fnName} = ${valueToCode(code, 0)};`;
|
|
3405
|
+
}
|
|
3406
|
+
if (startMatch) {
|
|
3407
|
+
const startIdx = startMatch.index;
|
|
3408
|
+
const idxCurly = src.indexOf("{", startIdx);
|
|
3409
|
+
const idxBracket = src.indexOf("[", startIdx);
|
|
3410
|
+
let braceOpen = -1;
|
|
3411
|
+
if (idxCurly === -1) braceOpen = idxBracket;
|
|
3412
|
+
else if (idxBracket === -1) braceOpen = idxCurly;
|
|
3413
|
+
else braceOpen = Math.min(idxCurly, idxBracket);
|
|
3414
|
+
if (braceOpen === -1) {
|
|
3415
|
+
const exportRe = new RegExp(
|
|
3416
|
+
`export\\s+const\\s+${escaped}\\s*:\\s*any\\s*=\\s*${escaped}\\s*;?`,
|
|
3417
|
+
"m"
|
|
3418
|
+
);
|
|
3419
|
+
if (exportRe.test(src)) {
|
|
3420
|
+
src = src.replace(
|
|
3421
|
+
exportRe,
|
|
3422
|
+
`${newCode}
|
|
3423
|
+
|
|
3424
|
+
export const ${fnName}: any = ${fnName};`
|
|
3425
|
+
);
|
|
3426
|
+
} else {
|
|
3427
|
+
src = src + `
|
|
3428
|
+
|
|
3429
|
+
${newCode}
|
|
3430
|
+
|
|
3431
|
+
export const ${fnName}: any = ${fnName};`;
|
|
3432
|
+
}
|
|
3433
|
+
} else {
|
|
3434
|
+
const openingChar = src[braceOpen];
|
|
3435
|
+
const closingChar = openingChar === "[" ? "]" : "}";
|
|
3436
|
+
let i = braceOpen + 1;
|
|
3437
|
+
let depth = 1;
|
|
3438
|
+
const len = src.length;
|
|
3439
|
+
while (i < len && depth > 0) {
|
|
3440
|
+
const ch = src[i];
|
|
3441
|
+
if (ch === openingChar) depth++;
|
|
3442
|
+
else if (ch === closingChar) depth--;
|
|
3443
|
+
i++;
|
|
3444
|
+
}
|
|
3445
|
+
let braceClose = i;
|
|
3446
|
+
let endIdx = braceClose;
|
|
3447
|
+
if (src.slice(braceClose, braceClose + 1) === ";")
|
|
3448
|
+
endIdx = braceClose + 1;
|
|
3449
|
+
const before = src.slice(0, startIdx);
|
|
3450
|
+
const after = src.slice(endIdx);
|
|
3451
|
+
src = before + newCode + after;
|
|
3452
|
+
}
|
|
3453
|
+
} else {
|
|
3454
|
+
const exportRe = new RegExp(
|
|
3455
|
+
`export\\s+const\\s+${escaped}\\s*:\\s*any\\s*=\\s*${escaped}\\s*;?`,
|
|
3456
|
+
"m"
|
|
3457
|
+
);
|
|
3458
|
+
if (exportRe.test(src)) {
|
|
3459
|
+
src = src.replace(
|
|
3460
|
+
exportRe,
|
|
3461
|
+
`${newCode}
|
|
3462
|
+
|
|
3463
|
+
export const ${fnName}: any = ${fnName};`
|
|
3464
|
+
);
|
|
3465
|
+
} else {
|
|
3466
|
+
src = src + `
|
|
3467
|
+
|
|
3468
|
+
${newCode}
|
|
3469
|
+
|
|
3470
|
+
export const ${fnName}: any = ${fnName};`;
|
|
3471
|
+
}
|
|
3472
|
+
}
|
|
3473
|
+
import_node_fs.default.writeFileSync(dbPath, src, "utf8");
|
|
3474
|
+
if (src === originalSrc) {
|
|
3475
|
+
return `Saved ${fnName} to database ${dbName}.`;
|
|
3476
|
+
} else {
|
|
3477
|
+
return `Updated ${dbName} with ${fnName}.`;
|
|
3478
|
+
}
|
|
3479
|
+
}
|
|
3480
|
+
function valueToCode(val, depth = 0) {
|
|
3481
|
+
const indentUnit = " ";
|
|
3482
|
+
const indent = indentUnit.repeat(depth);
|
|
3483
|
+
const indentInner = indentUnit.repeat(depth + 1);
|
|
3484
|
+
if (val === null) return "null";
|
|
3485
|
+
const t = typeof val;
|
|
3486
|
+
if (t === "string") return JSON.stringify(val);
|
|
3487
|
+
if (t === "number" || t === "boolean") return String(val);
|
|
3488
|
+
if (t === "function") return val.toString();
|
|
3489
|
+
if (Array.isArray(val)) {
|
|
3490
|
+
if (val.length === 0) return "[]";
|
|
3491
|
+
const items = val.map((v) => valueToCode(v, depth + 1));
|
|
3492
|
+
return "[\n" + items.map((it) => indentInner + it).join(",\n") + "\n" + indent + "]";
|
|
3493
|
+
}
|
|
3494
|
+
if (t === "object") {
|
|
3495
|
+
const keys = Object.keys(val);
|
|
3496
|
+
if (keys.length === 0) return "{}";
|
|
3497
|
+
const entries = keys.map((k) => {
|
|
3498
|
+
const keyPart = isIdentifier(k) ? k : JSON.stringify(k);
|
|
3499
|
+
const v = valueToCode(val[k], depth + 1);
|
|
3500
|
+
return indentInner + keyPart + ": " + v;
|
|
3501
|
+
});
|
|
3502
|
+
return "{\n" + entries.join(",\n") + "\n" + indent + "}";
|
|
3503
|
+
}
|
|
3504
|
+
return String(val);
|
|
3505
|
+
}
|
|
3506
|
+
function isIdentifier(key) {
|
|
3507
|
+
return /^[A-Za-z_$][A-Za-z0-9_$]*$/.test(key);
|
|
3508
|
+
}
|
|
3509
|
+
var dbConsole = {
|
|
3510
|
+
create,
|
|
3511
|
+
read,
|
|
3512
|
+
remove,
|
|
3513
|
+
rename: rename2,
|
|
3514
|
+
save,
|
|
3515
|
+
update,
|
|
3516
|
+
...console
|
|
3517
|
+
};
|
|
3219
3518
|
|
|
3220
3519
|
// src/server.ts
|
|
3221
3520
|
var ServerDatabase = class {
|
package/dist/config.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH,OAAO,KAAK,EAAE,gBAAgB,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,SA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AACH,wBAAgB,WAAW,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EACrD,MAAM,EAAE,CAAC,GAAG,SAAS,EACrB,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC,GACpB,CAAC,CAWH"}
|
package/dist/database.d.mts
CHANGED
|
@@ -27,5 +27,14 @@ declare class Database {
|
|
|
27
27
|
}>;
|
|
28
28
|
}
|
|
29
29
|
declare function database(): Database;
|
|
30
|
+
interface DatabaseConsole extends Console {
|
|
31
|
+
create?(dbName: string, code: string | Function): void;
|
|
32
|
+
read(dbName: string): string;
|
|
33
|
+
remove(dbName: string, fnName: string): any;
|
|
34
|
+
rename(oldName: string, newName: string): string;
|
|
35
|
+
save(dbName: string, code: string | Function | any): void;
|
|
36
|
+
update(dbName: string, fnName: string, code: string | Function): any;
|
|
37
|
+
}
|
|
38
|
+
declare const dbConsole: DatabaseConsole;
|
|
30
39
|
|
|
31
|
-
export { Database, type DatabaseConfig, database, database as default };
|
|
40
|
+
export { Database, type DatabaseConfig, type DatabaseConsole, database, dbConsole, database as default };
|
package/dist/database.d.ts
CHANGED
|
@@ -26,5 +26,14 @@ export declare class Database {
|
|
|
26
26
|
}>;
|
|
27
27
|
}
|
|
28
28
|
export declare function database(): Database;
|
|
29
|
+
export interface DatabaseConsole extends Console {
|
|
30
|
+
create?(dbName: string, code: string | Function): void;
|
|
31
|
+
read(dbName: string): string;
|
|
32
|
+
remove(dbName: string, fnName: string): any;
|
|
33
|
+
rename(oldName: string, newName: string): string;
|
|
34
|
+
save(dbName: string, code: string | Function | any): void;
|
|
35
|
+
update(dbName: string, fnName: string, code: string | Function): any;
|
|
36
|
+
}
|
|
37
|
+
export declare const dbConsole: DatabaseConsole;
|
|
29
38
|
export default database;
|
|
30
39
|
//# sourceMappingURL=database.d.ts.map
|
package/dist/database.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"database.d.ts","sourceRoot":"","sources":["../src/database.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