inibase 1.6.2 → 1.6.4
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/README.md +5 -0
- package/dist/index.js +6 -3
- package/dist/utils.d.ts +1 -1
- package/dist/utils.server.js +3 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -633,6 +633,11 @@ const db = new Inibase("/databaseName");
|
|
|
633
633
|
const users = await db.get("user", undefined, {
|
|
634
634
|
columns: ["!username", "!address.street"],
|
|
635
635
|
});
|
|
636
|
+
|
|
637
|
+
// Get all columns explicitly with the "*" wildcard
|
|
638
|
+
const all = await db.get("user", undefined, {
|
|
639
|
+
columns: ["*"],
|
|
640
|
+
});
|
|
636
641
|
```
|
|
637
642
|
|
|
638
643
|
</blockquote>
|
package/dist/index.js
CHANGED
|
@@ -1110,7 +1110,8 @@ export default class Inibase {
|
|
|
1110
1110
|
? options.columns
|
|
1111
1111
|
: [options.columns];
|
|
1112
1112
|
for (const column of options.columns)
|
|
1113
|
-
|
|
1113
|
+
if (column !== "*")
|
|
1114
|
+
this.validateName(column);
|
|
1114
1115
|
if (options.columns.length && !options.columns.includes("id"))
|
|
1115
1116
|
options.columns.push("id");
|
|
1116
1117
|
}
|
|
@@ -1358,7 +1359,8 @@ export default class Inibase {
|
|
|
1358
1359
|
for (const column of (Array.isArray(options.columns)
|
|
1359
1360
|
? options.columns
|
|
1360
1361
|
: [options.columns]))
|
|
1361
|
-
|
|
1362
|
+
if (column !== "*")
|
|
1363
|
+
this.validateName(column);
|
|
1362
1364
|
const tablePath = join(this.databasePath, tableName);
|
|
1363
1365
|
await this.getTable(tableName);
|
|
1364
1366
|
if (!globalConfig[this.databasePath].tables?.get(tableName)?.schema)
|
|
@@ -1444,7 +1446,8 @@ export default class Inibase {
|
|
|
1444
1446
|
for (const column of (Array.isArray(options.columns)
|
|
1445
1447
|
? options.columns
|
|
1446
1448
|
: [options.columns]))
|
|
1447
|
-
|
|
1449
|
+
if (column !== "*")
|
|
1450
|
+
this.validateName(column);
|
|
1448
1451
|
const tablePath = join(this.databasePath, tableName);
|
|
1449
1452
|
await this.throwErrorIfTableEmpty(tableName);
|
|
1450
1453
|
let clonedData = structuredClone(data);
|
package/dist/utils.d.ts
CHANGED
|
@@ -147,7 +147,7 @@ export declare const deepMerge: (target: any, source: any) => any;
|
|
|
147
147
|
* @param obj2 - The second object for comparison, with string keys and values.
|
|
148
148
|
* @returns A record of changed properties with original values from obj1 and new values from obj2, or null if no changes are found.
|
|
149
149
|
*/
|
|
150
|
-
export declare const findChangedProperties: (obj1: Record<string, string>, obj2: Record<string, string>) => Record<string, string> | null;
|
|
150
|
+
export declare const findChangedProperties: (obj1: Record<string, string>, obj2: Record<string, string>) => Record<string, string | null> | null;
|
|
151
151
|
/**
|
|
152
152
|
* Detects the field type of an input based on available types.
|
|
153
153
|
*
|
package/dist/utils.server.js
CHANGED
|
@@ -47,7 +47,9 @@ const getKeyAndIv = () => {
|
|
|
47
47
|
if (Buffer.isBuffer(globalConfig.salt)) {
|
|
48
48
|
return { key: globalConfig.salt, iv: globalConfig.salt.subarray(0, 16) };
|
|
49
49
|
}
|
|
50
|
-
const cacheKey = globalConfig.salt
|
|
50
|
+
const cacheKey = globalConfig.salt?.toString();
|
|
51
|
+
if (!cacheKey)
|
|
52
|
+
throw new Error("Invalid salt configuration");
|
|
51
53
|
let key = derivedKeyCache.get(cacheKey);
|
|
52
54
|
if (!key) {
|
|
53
55
|
key = scryptSync(cacheKey, `${INIBASE_SECRET}`, 32);
|