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 CHANGED
@@ -61,6 +61,7 @@ export default class Inibase {
61
61
  private totalItems;
62
62
  constructor(database: string, mainFolder?: string);
63
63
  private Error;
64
+ clear(): void;
64
65
  private getFileExtension;
65
66
  private _schemaToIdsPath;
66
67
  /**
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
- getFileExtension = (tableName) => {
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 = (tableName, schema, prefix = "") => {
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[field.id] = `${(prefix ?? "") + field.key}${this.getFileExtension(tableName)}`;
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
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "inibase",
3
- "version": "1.0.0-rc.117",
3
+ "version": "1.0.0-rc.118",
4
4
  "type": "module",
5
5
  "author": {
6
6
  "name": "Karim Amahtil",