inibase 1.0.0-rc.104 → 1.0.0-rc.106

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 +9 -9
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -258,6 +258,7 @@ export default class Inibase {
258
258
  type: "id",
259
259
  required: true,
260
260
  },
261
+ ...schema,
261
262
  {
262
263
  id: -1,
263
264
  key: "createdAt",
@@ -268,9 +269,7 @@ export default class Inibase {
268
269
  id: -2,
269
270
  key: "updatedAt",
270
271
  type: "date",
271
- required: false,
272
272
  },
273
- ...schema,
274
273
  ];
275
274
  if (!encodeIDs)
276
275
  return schema;
@@ -1075,8 +1074,8 @@ export default class Inibase {
1075
1074
  if (!returnPostedData)
1076
1075
  returnPostedData = false;
1077
1076
  const keys = UtilsServer.hashString(Object.keys(Array.isArray(data) ? data[0] : data).join("."));
1078
- // Skip Id and (created|updated)At
1079
- this.validateData(data, schema.slice(3));
1077
+ // Skip ID and (created|updated)At
1078
+ this.validateData(data, schema.slice(1, -2));
1080
1079
  let lastId = 0;
1081
1080
  const renameList = [];
1082
1081
  try {
@@ -1154,9 +1153,10 @@ export default class Inibase {
1154
1153
  throw this.Error("INVALID_ID", data.id);
1155
1154
  return this.put(tableName, data, data.id, options, returnUpdatedData || undefined);
1156
1155
  }
1157
- this.validateData(data, schema, true);
1156
+ // Skip ID and (created|updated)At
1157
+ this.validateData(data, schema.slice(1, -2), true);
1158
1158
  await this.checkUnique(tableName, schema);
1159
- data = this.formatData(data, schema, true);
1159
+ this.formatData(data, schema, true);
1160
1160
  const pathesContents = this.joinPathesContents(tableName, {
1161
1161
  ...(({ id, ...restOfData }) => restOfData)(data),
1162
1162
  updatedAt: Date.now(),
@@ -1192,9 +1192,9 @@ export default class Inibase {
1192
1192
  else if ((Array.isArray(where) && where.every(Utils.isNumber)) ||
1193
1193
  Utils.isNumber(where)) {
1194
1194
  // "where" in this case, is the line(s) number(s) and not id(s)
1195
- this.validateData(data, schema, true);
1196
- await this.checkUnique(tableName, schema);
1197
- data = this.formatData(data, schema, true);
1195
+ this.validateData(data, schema.slice(1, -2), true);
1196
+ await this.checkUnique(tableName, schema.slice(1, -2));
1197
+ this.formatData(data, schema, true);
1198
1198
  const pathesContents = Object.fromEntries(Object.entries(this.joinPathesContents(tableName, Utils.isArrayOfObjects(data)
1199
1199
  ? data.map((item) => ({
1200
1200
  ...item,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "inibase",
3
- "version": "1.0.0-rc.104",
3
+ "version": "1.0.0-rc.106",
4
4
  "type": "module",
5
5
  "author": {
6
6
  "name": "Karim Amahtil",