inibase 1.0.0-rc.76 → 1.0.0-rc.77

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.
Files changed (2) hide show
  1. package/dist/index.js +10 -8
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -222,30 +222,32 @@ export default class Inibase {
222
222
  const schemaFile = await readFile(tableSchemaPath, "utf8");
223
223
  if (!schemaFile)
224
224
  return undefined;
225
- const schema = JSON.parse(schemaFile), lastIdNumber = UtilsServer.findLastIdNumber(schema, this.salt);
226
- if (!encodeIDs)
227
- return schema;
228
- return [
225
+ let schema = JSON.parse(schemaFile);
226
+ const lastIdNumber = UtilsServer.findLastIdNumber(schema, this.salt);
227
+ schema = [
229
228
  {
230
- id: UtilsServer.encodeID(0, this.salt),
229
+ id: 0,
231
230
  key: "id",
232
231
  type: "id",
233
232
  required: true,
234
233
  },
235
- ...UtilsServer.encodeSchemaID(schema, this.salt),
234
+ ...schema,
236
235
  {
237
- id: UtilsServer.encodeID(lastIdNumber + 1, this.salt),
236
+ id: lastIdNumber + 1,
238
237
  key: "createdAt",
239
238
  type: "date",
240
239
  required: true,
241
240
  },
242
241
  {
243
- id: UtilsServer.encodeID(lastIdNumber + 2, this.salt),
242
+ id: lastIdNumber + 2,
244
243
  key: "updatedAt",
245
244
  type: "date",
246
245
  required: false,
247
246
  },
248
247
  ];
248
+ if (!encodeIDs)
249
+ return schema;
250
+ return UtilsServer.encodeSchemaID(schema, this.salt);
249
251
  }
250
252
  async throwErrorIfTableEmpty(tableName) {
251
253
  const table = await this.getTable(tableName);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "inibase",
3
- "version": "1.0.0-rc.76",
3
+ "version": "1.0.0-rc.77",
4
4
  "type": "module",
5
5
  "author": {
6
6
  "name": "Karim Amahtil",