inibase 1.0.0-rc.122 → 1.0.0-rc.124
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/file.js +1 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.js +7 -10
- package/package.json +1 -1
package/dist/file.js
CHANGED
|
@@ -542,7 +542,7 @@ export const search = async (filePath, operator, comparedAtValue, logicalOperato
|
|
|
542
542
|
// Increment the line count for each line.
|
|
543
543
|
linesCount++;
|
|
544
544
|
// Search only in provided linesNumbers
|
|
545
|
-
if (
|
|
545
|
+
if (searchIn && (!searchIn.has(linesCount) || searchIn.has(-linesCount)))
|
|
546
546
|
continue;
|
|
547
547
|
// Decode the line for comparison.
|
|
548
548
|
const decodedLine = decode(line, fieldType, fieldChildrenType, secretKey);
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -381,13 +381,13 @@ export default class Inibase {
|
|
|
381
381
|
if (!Array.isArray(value))
|
|
382
382
|
value = [value];
|
|
383
383
|
if (Utils.isArrayOfObjects(fieldChildrenType))
|
|
384
|
-
return this.
|
|
384
|
+
return this.formatData(value, fieldChildrenType);
|
|
385
385
|
if (!value.length)
|
|
386
386
|
return null;
|
|
387
387
|
return value.map((_value) => this.formatField(_value, fieldChildrenType));
|
|
388
388
|
case "object":
|
|
389
389
|
if (Utils.isArrayOfObjects(fieldChildrenType))
|
|
390
|
-
return this.
|
|
390
|
+
return this.formatData(value, fieldChildrenType, _formatOnlyAvailiableKeys);
|
|
391
391
|
break;
|
|
392
392
|
case "table":
|
|
393
393
|
if (Utils.isObject(value)) {
|
|
@@ -452,10 +452,10 @@ export default class Inibase {
|
|
|
452
452
|
}
|
|
453
453
|
this.uniqueMap = new Map();
|
|
454
454
|
}
|
|
455
|
-
|
|
455
|
+
formatData(data, schema, formatOnlyAvailiableKeys) {
|
|
456
456
|
const clonedData = JSON.parse(JSON.stringify(data));
|
|
457
457
|
if (Utils.isArrayOfObjects(clonedData))
|
|
458
|
-
return clonedData.map((singleData) => this.
|
|
458
|
+
return clonedData.map((singleData) => this.formatData(singleData, schema, formatOnlyAvailiableKeys));
|
|
459
459
|
if (Utils.isObject(clonedData)) {
|
|
460
460
|
const RETURN = {};
|
|
461
461
|
for (const field of schema) {
|
|
@@ -471,9 +471,6 @@ export default class Inibase {
|
|
|
471
471
|
}
|
|
472
472
|
return [];
|
|
473
473
|
}
|
|
474
|
-
formatData(tableName, data, formatOnlyAvailiableKeys) {
|
|
475
|
-
data = this._formatData(data, this.tablesMap.get(tableName).schema, formatOnlyAvailiableKeys);
|
|
476
|
-
}
|
|
477
474
|
getDefaultValue(field) {
|
|
478
475
|
if (Array.isArray(field.type))
|
|
479
476
|
return this.getDefaultValue({
|
|
@@ -1192,7 +1189,7 @@ export default class Inibase {
|
|
|
1192
1189
|
data.createdAt = Date.now();
|
|
1193
1190
|
data.updatedAt = undefined;
|
|
1194
1191
|
}
|
|
1195
|
-
this.formatData(tableName,
|
|
1192
|
+
data = this.formatData(data, this.tablesMap.get(tableName).schema, true);
|
|
1196
1193
|
const pathesContents = this.joinPathesContents(tableName, this.tablesMap.get(tableName).config.prepend
|
|
1197
1194
|
? Array.isArray(data)
|
|
1198
1195
|
? data.toReversed()
|
|
@@ -1245,7 +1242,7 @@ export default class Inibase {
|
|
|
1245
1242
|
return this.put(tableName, data, data.id, options, returnUpdatedData || undefined);
|
|
1246
1243
|
}
|
|
1247
1244
|
await this.validateData(tableName, data, true);
|
|
1248
|
-
this.formatData(
|
|
1245
|
+
data = this.formatData(data, this.tablesMap.get(tableName).schema, true);
|
|
1249
1246
|
const pathesContents = this.joinPathesContents(tableName, {
|
|
1250
1247
|
...(({ id, ...restOfData }) => restOfData)(data),
|
|
1251
1248
|
updatedAt: Date.now(),
|
|
@@ -1280,7 +1277,7 @@ export default class Inibase {
|
|
|
1280
1277
|
Utils.isNumber(where)) {
|
|
1281
1278
|
// "where" in this case, is the line(s) number(s) and not id(s)
|
|
1282
1279
|
await this.validateData(tableName, data, true);
|
|
1283
|
-
this.formatData(
|
|
1280
|
+
data = this.formatData(data, this.tablesMap.get(tableName).schema, true);
|
|
1284
1281
|
const pathesContents = Object.fromEntries(Object.entries(this.joinPathesContents(tableName, Utils.isArrayOfObjects(data)
|
|
1285
1282
|
? data.map((item) => ({
|
|
1286
1283
|
...item,
|