inibase 1.0.0-rc.69 → 1.0.0-rc.70
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/index.js +5 -3
- package/dist/utils.js +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -952,10 +952,12 @@ export default class Inibase {
|
|
|
952
952
|
.split(",")
|
|
953
953
|
.map(Number);
|
|
954
954
|
else {
|
|
955
|
-
|
|
955
|
+
lastId = Number(Object.keys((await File.get(join(tablePath, `id${this.getFileExtension(tableName)}`), -1, "number", undefined, this.salt, true))?.[0] ?? 0));
|
|
956
956
|
this.totalItems[`${tableName}-*`] = await File.count(join(tablePath, `id${this.getFileExtension(tableName)}`));
|
|
957
957
|
}
|
|
958
958
|
}
|
|
959
|
+
else
|
|
960
|
+
this.totalItems[`${tableName}-*`] = 0;
|
|
959
961
|
if (Utils.isArrayOfObjects(data))
|
|
960
962
|
RETURN = data.map(({ id, updatedAt, createdAt, ...rest }) => ({
|
|
961
963
|
id: ++lastId,
|
|
@@ -981,11 +983,11 @@ export default class Inibase {
|
|
|
981
983
|
: await File.append(path, content))));
|
|
982
984
|
await Promise.all(renameList.map(async ([tempPath, filePath]) => rename(tempPath, filePath)));
|
|
983
985
|
renameList = [];
|
|
986
|
+
if (this.tables[tableName].config.cache)
|
|
987
|
+
await this.clearCache(tableName);
|
|
984
988
|
this.totalItems[`${tableName}-*`] += Array.isArray(RETURN)
|
|
985
989
|
? RETURN.length
|
|
986
990
|
: 1;
|
|
987
|
-
if (this.tables[tableName].config.cache)
|
|
988
|
-
await this.clearCache(tableName);
|
|
989
991
|
await writeFile(join(tablePath, ".pagination"), `${lastId},${this.totalItems[`${tableName}-*`]}`);
|
|
990
992
|
if (returnPostedData)
|
|
991
993
|
return this.get(tableName, this.tables[tableName].config.prepend
|
package/dist/utils.js
CHANGED
|
@@ -118,7 +118,7 @@ export const isHTML = (input) => /<\/?\s*[a-z-][^>]*\s*>|(\&(?:[\w\d]+|#\d+|#x[a
|
|
|
118
118
|
* Note: Validates the input against being a number, boolean, email, URL, or IP address to ensure it's a general string.
|
|
119
119
|
*/
|
|
120
120
|
export const isString = (input) => Object.prototype.toString.call(input) === "[object String]" &&
|
|
121
|
-
|
|
121
|
+
!isNumber(input);
|
|
122
122
|
/**
|
|
123
123
|
* Checks if the input is a valid IP address format.
|
|
124
124
|
*
|