inibase 1.4.9 → 1.5.1
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 +1 -1
- package/dist/file.js +4 -4
- package/dist/index.js +14 -6
- package/dist/utils.server.js +1 -0
- package/package.json +5 -3
package/dist/cli.js
CHANGED
|
@@ -52,7 +52,7 @@ rl.on("line", async (input) => {
|
|
|
52
52
|
break;
|
|
53
53
|
case "exit":
|
|
54
54
|
return process.exit();
|
|
55
|
-
// biome-ignore format:
|
|
55
|
+
// biome-ignore format: keep help text aligned for readability
|
|
56
56
|
case "help": {
|
|
57
57
|
if (!table)
|
|
58
58
|
console.log(` ${textBlue("table")} | ${textBlue("t")} ${textRed("<")}tableName${textRed(">*")}`);
|
package/dist/file.js
CHANGED
|
@@ -179,14 +179,14 @@ export const decode = (input, field) => {
|
|
|
179
179
|
if (input === null || input === "")
|
|
180
180
|
return undefined;
|
|
181
181
|
// Detect the fieldType based on the input and the provided array of possible types.
|
|
182
|
-
if (Array.isArray(field.type))
|
|
183
|
-
field.type = detectFieldType(String(input), field.type);
|
|
184
182
|
// Decode the input using the decodeHelper function.
|
|
185
183
|
return decodeHelper(typeof input === "string"
|
|
186
184
|
? isStringified(input)
|
|
187
185
|
? Inison.unstringify(input)
|
|
188
186
|
: unSecureString(input)
|
|
189
|
-
: input, field)
|
|
187
|
+
: input, Array.isArray(field.type)
|
|
188
|
+
? { ...field, type: detectFieldType(String(input), field.type) }
|
|
189
|
+
: field);
|
|
190
190
|
};
|
|
191
191
|
function _groupIntoRanges(arr, action = "p") {
|
|
192
192
|
if (arr.length === 0)
|
|
@@ -224,7 +224,7 @@ export async function get(filePath, lineNumbers, field, readWholeFile = false) {
|
|
|
224
224
|
lines[linesCount] = decode(line, field);
|
|
225
225
|
}
|
|
226
226
|
}
|
|
227
|
-
else if (lineNumbers
|
|
227
|
+
else if (lineNumbers === -1) {
|
|
228
228
|
const escapedFilePath = escapeShellPath(filePath);
|
|
229
229
|
const command = filePath.endsWith(".gz")
|
|
230
230
|
? `zcat ${escapedFilePath} | sed -n '$p'`
|
package/dist/index.js
CHANGED
|
@@ -171,7 +171,7 @@ export default class Inibase {
|
|
|
171
171
|
// if config not set => load default global env config
|
|
172
172
|
if (!config)
|
|
173
173
|
config = {
|
|
174
|
-
compression: process.env.INIBASE_COMPRESSION
|
|
174
|
+
compression: process.env.INIBASE_COMPRESSION === "true",
|
|
175
175
|
cache: process.env.INIBASE_CACHE === "true",
|
|
176
176
|
prepend: process.env.INIBASE_PREPEND === "true",
|
|
177
177
|
decodeID: process.env.INIBASE_ENCODEID === "true",
|
|
@@ -555,7 +555,7 @@ export default class Inibase {
|
|
|
555
555
|
return null;
|
|
556
556
|
}
|
|
557
557
|
default:
|
|
558
|
-
return typeof value ===
|
|
558
|
+
return typeof value === "string" ? value.trim() : value;
|
|
559
559
|
}
|
|
560
560
|
return null;
|
|
561
561
|
}
|
|
@@ -1451,7 +1451,9 @@ export default class Inibase {
|
|
|
1451
1451
|
}
|
|
1452
1452
|
finally {
|
|
1453
1453
|
if (renameList.length)
|
|
1454
|
-
await Promise.allSettled(renameList
|
|
1454
|
+
await Promise.allSettled(renameList
|
|
1455
|
+
.filter(([_, filePath]) => filePath)
|
|
1456
|
+
.map(async ([tempPath, _]) => unlink(tempPath)));
|
|
1455
1457
|
await File.unlock(join(tablePath, ".tmp"), keys);
|
|
1456
1458
|
}
|
|
1457
1459
|
}
|
|
@@ -1497,7 +1499,9 @@ export default class Inibase {
|
|
|
1497
1499
|
}
|
|
1498
1500
|
finally {
|
|
1499
1501
|
if (renameList.length)
|
|
1500
|
-
await Promise.allSettled(renameList
|
|
1502
|
+
await Promise.allSettled(renameList
|
|
1503
|
+
.filter(([_, filePath]) => filePath)
|
|
1504
|
+
.map(async ([tempPath, _]) => unlink(tempPath)));
|
|
1501
1505
|
await File.unlock(join(tablePath, ".tmp"));
|
|
1502
1506
|
}
|
|
1503
1507
|
}
|
|
@@ -1536,7 +1540,9 @@ export default class Inibase {
|
|
|
1536
1540
|
}
|
|
1537
1541
|
finally {
|
|
1538
1542
|
if (renameList.length)
|
|
1539
|
-
await Promise.allSettled(renameList
|
|
1543
|
+
await Promise.allSettled(renameList
|
|
1544
|
+
.filter(([_, filePath]) => filePath)
|
|
1545
|
+
.map(async ([tempPath, _]) => unlink(tempPath)));
|
|
1540
1546
|
await File.unlock(join(tablePath, ".tmp"), keys);
|
|
1541
1547
|
}
|
|
1542
1548
|
}
|
|
@@ -1631,7 +1637,9 @@ export default class Inibase {
|
|
|
1631
1637
|
}
|
|
1632
1638
|
finally {
|
|
1633
1639
|
if (renameList.length)
|
|
1634
|
-
await Promise.allSettled(renameList
|
|
1640
|
+
await Promise.allSettled(renameList
|
|
1641
|
+
.filter(([_, filePath]) => filePath)
|
|
1642
|
+
.map(async ([tempPath, _]) => unlink(tempPath)));
|
|
1635
1643
|
await File.unlock(join(tablePath, ".tmp"));
|
|
1636
1644
|
}
|
|
1637
1645
|
}
|
package/dist/utils.server.js
CHANGED
|
@@ -198,6 +198,7 @@ export const isArrayEqual = (originalValue, comparedValue) => {
|
|
|
198
198
|
return originalValue.includes(comparedValue);
|
|
199
199
|
if (Array.isArray(comparedValue))
|
|
200
200
|
return comparedValue.includes(originalValue);
|
|
201
|
+
// biome-ignore lint/suspicious/noDoubleEquals: intended loose comparison
|
|
201
202
|
return originalValue == comparedValue;
|
|
202
203
|
};
|
|
203
204
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "inibase",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.5.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Karim Amahtil",
|
|
@@ -68,7 +68,7 @@
|
|
|
68
68
|
}
|
|
69
69
|
},
|
|
70
70
|
"devDependencies": {
|
|
71
|
-
"@biomejs/biome": "
|
|
71
|
+
"@biomejs/biome": "2.3.10",
|
|
72
72
|
"@types/bun": "^1.2.10",
|
|
73
73
|
"@types/node": "^22.15.2",
|
|
74
74
|
"lefthook": "^1.11.11",
|
|
@@ -78,7 +78,9 @@
|
|
|
78
78
|
},
|
|
79
79
|
"dependencies": {
|
|
80
80
|
"dotenv": "^16.5.0",
|
|
81
|
-
"inison": "^2.0.1"
|
|
81
|
+
"inison": "^2.0.1"
|
|
82
|
+
},
|
|
83
|
+
"optionalDependencies": {
|
|
82
84
|
"re2": "^1.22.1"
|
|
83
85
|
},
|
|
84
86
|
"scripts": {
|