inibase 1.0.0-rc.89 → 1.0.0-rc.90

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
@@ -147,7 +147,7 @@ export default class Inibase {
147
147
  * @param {false} [returnUpdatedData]
148
148
  * @return {*} {Promise<Data | Data[] | null | undefined | void>}
149
149
  */
150
- put(tableName: string, data: Data | Data[], where?: number | string | (number | string)[] | Criteria, options?: Options, returnUpdatedData?: false): Promise<void>;
150
+ put(tableName: string, data: Data | Data[], where: number | string | (number | string)[] | Criteria | undefined, options: Options | undefined, returnUpdatedData: false): Promise<void>;
151
151
  put(tableName: string, data: Data, where: number | string | (number | string)[] | Criteria | undefined, options: Options | undefined, returnUpdatedData: true): Promise<Data | null>;
152
152
  put(tableName: string, data: Data[], where: number | string | (number | string)[] | Criteria | undefined, options: Options | undefined, returnUpdatedData: true): Promise<Data[] | null>;
153
153
  /**
package/dist/index.js CHANGED
@@ -1131,12 +1131,12 @@ export default class Inibase {
1131
1131
  if (!data.every((item) => Object.hasOwn(item, "id") && Utils.isValidID(item.id)))
1132
1132
  throw this.throwError("INVALID_ID");
1133
1133
  // TODO: Reduce I/O
1134
- return this.put(tableName, data, data.map(({ id }) => id));
1134
+ return this.put(tableName, data, data.map(({ id }) => id), options, returnUpdatedData || undefined);
1135
1135
  }
1136
1136
  if (Object.hasOwn(data, "id")) {
1137
1137
  if (!Utils.isValidID(data.id))
1138
1138
  throw this.throwError("INVALID_ID", data.id);
1139
- return this.put(tableName, data, data.id);
1139
+ return this.put(tableName, data, data.id, options, returnUpdatedData || undefined);
1140
1140
  }
1141
1141
  let totalItems;
1142
1142
  if (await File.isExists(join(tablePath, ".cache", ".pagination")))
@@ -1175,7 +1175,7 @@ export default class Inibase {
1175
1175
  else if ((Array.isArray(where) && where.every(Utils.isValidID)) ||
1176
1176
  Utils.isValidID(where)) {
1177
1177
  const lineNumbers = await this.get(tableName, where, undefined, undefined, true);
1178
- return this.put(tableName, data, lineNumbers);
1178
+ return this.put(tableName, data, lineNumbers, options, returnUpdatedData || undefined);
1179
1179
  }
1180
1180
  else if ((Array.isArray(where) && where.every(Utils.isNumber)) ||
1181
1181
  Utils.isNumber(where)) {
@@ -1215,9 +1215,7 @@ export default class Inibase {
1215
1215
  }
1216
1216
  else if (Utils.isObject(where)) {
1217
1217
  const lineNumbers = await this.get(tableName, where, undefined, undefined, true);
1218
- if (returnUpdatedData)
1219
- return this.put(tableName, data, lineNumbers, options, returnUpdatedData);
1220
- await this.put(tableName, data, lineNumbers, options, returnUpdatedData);
1218
+ return this.put(tableName, data, lineNumbers, options, returnUpdatedData || undefined);
1221
1219
  }
1222
1220
  else
1223
1221
  throw this.throwError("INVALID_PARAMETERS");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "inibase",
3
- "version": "1.0.0-rc.89",
3
+ "version": "1.0.0-rc.90",
4
4
  "type": "module",
5
5
  "author": {
6
6
  "name": "Karim Amahtil",