inibase 1.0.0-rc.117 → 1.0.0-rc.118
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.d.ts +1 -0
- package/dist/index.js +14 -7
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -61,7 +61,13 @@ export default class Inibase {
|
|
|
61
61
|
: errorMessage.replaceAll("{variable}", `'${variable.toString()}'`)
|
|
62
62
|
: errorMessage.replaceAll("{variable}", ""));
|
|
63
63
|
}
|
|
64
|
-
|
|
64
|
+
clear() {
|
|
65
|
+
this.tables = {};
|
|
66
|
+
this.totalItems = {};
|
|
67
|
+
this.pageInfo = {};
|
|
68
|
+
this.checkIFunique = {};
|
|
69
|
+
}
|
|
70
|
+
getFileExtension(tableName) {
|
|
65
71
|
let mainExtension = this.fileExtension;
|
|
66
72
|
// TODO: ADD ENCRYPTION
|
|
67
73
|
// if(this.tables[tableName].config.encryption)
|
|
@@ -69,19 +75,20 @@ export default class Inibase {
|
|
|
69
75
|
if (this.tables[tableName].config.compression)
|
|
70
76
|
mainExtension += ".gz";
|
|
71
77
|
return mainExtension;
|
|
72
|
-
}
|
|
73
|
-
_schemaToIdsPath
|
|
78
|
+
}
|
|
79
|
+
_schemaToIdsPath(tableName, schema, prefix = "") {
|
|
74
80
|
const RETURN = {};
|
|
75
81
|
for (const field of schema)
|
|
76
82
|
if ((field.type === "array" || field.type === "object") &&
|
|
77
83
|
field.children &&
|
|
78
|
-
Utils.isArrayOfObjects(field.children))
|
|
84
|
+
Utils.isArrayOfObjects(field.children))
|
|
79
85
|
Utils.deepMerge(RETURN, this._schemaToIdsPath(tableName, field.children, `${(prefix ?? "") + field.key}.`));
|
|
80
|
-
}
|
|
81
86
|
else if (field.id)
|
|
82
|
-
RETURN[
|
|
87
|
+
RETURN[Utils.isValidID(field.id)
|
|
88
|
+
? UtilsServer.decodeID(field.id, this.salt)
|
|
89
|
+
: field.id] = `${(prefix ?? "") + field.key}${this.getFileExtension(tableName)}`;
|
|
83
90
|
return RETURN;
|
|
84
|
-
}
|
|
91
|
+
}
|
|
85
92
|
/**
|
|
86
93
|
* Create a new table inside database, with predefined schema and config
|
|
87
94
|
*
|