inibase 1.0.0-rc.50 → 1.0.0-rc.51
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/config.d.ts +3 -5
- package/dist/config.js +3 -5
- package/dist/file.d.ts +1 -32
- package/dist/file.js +65 -79
- package/dist/file.thread.js +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +149 -157
- package/dist/utils.d.ts +0 -25
- package/dist/utils.js +23 -51
- package/dist/utils.server.d.ts +1 -16
- package/dist/utils.server.js +4 -19
- package/package.json +1 -1
package/dist/config.d.ts
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
export
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
static isReverseEnabled: boolean;
|
|
5
|
-
}
|
|
1
|
+
export declare const isCompressionEnabled: boolean;
|
|
2
|
+
export declare const isCacheEnabled: boolean;
|
|
3
|
+
export declare const isReverseEnabled: boolean;
|
package/dist/config.js
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
export
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
static isReverseEnabled = process.env.INIBASE_REVERSE === "true";
|
|
5
|
-
}
|
|
1
|
+
export const isCompressionEnabled = process.env.INIBASE_COMPRESSION === "true";
|
|
2
|
+
export const isCacheEnabled = process.env.INIBASE_CACHE === "true";
|
|
3
|
+
export const isReverseEnabled = process.env.INIBASE_REVERSE === "true";
|
package/dist/file.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="node" resolution-mode="require"/>
|
|
2
|
-
import { ComparisonOperator, FieldType, Schema } from "./index.js";
|
|
2
|
+
import type { ComparisonOperator, FieldType, Schema } from "./index.js";
|
|
3
3
|
export declare const lock: (folderPath: string, prefix?: string) => Promise<void>;
|
|
4
4
|
export declare const unlock: (folderPath: string, prefix?: string) => Promise<void>;
|
|
5
5
|
export declare const write: (filePath: string, data: any, disableCompression?: boolean) => Promise<void>;
|
|
@@ -143,34 +143,3 @@ export declare const max: (filePath: string, lineNumbers?: number | number[]) =>
|
|
|
143
143
|
*/
|
|
144
144
|
export declare const min: (filePath: string, lineNumbers?: number | number[]) => Promise<number>;
|
|
145
145
|
export declare function createWorker(functionName: "get" | "remove" | "search" | "replace" | "sum" | "min" | "max" | "append" | "count", arg: any[]): Promise<any>;
|
|
146
|
-
/**
|
|
147
|
-
* Asynchronously sorts the lines in a file in the specified direction.
|
|
148
|
-
*
|
|
149
|
-
* @param filePath - Path of the file to be sorted.
|
|
150
|
-
* @param sortDirection - Direction for sorting: 1 or 'asc' for ascending, -1 or 'desc' for descending.
|
|
151
|
-
* @param lineNumbers - Optional specific line numbers to sort. If not provided, sorts all lines.
|
|
152
|
-
* @param _lineNumbersPerChunk - Optional parameter for handling large files, specifying the number of lines per chunk.
|
|
153
|
-
* @returns Promise<void>. Modifies the file by sorting specified lines.
|
|
154
|
-
*
|
|
155
|
-
* Note: The sorting is applied either to the entire file or to the specified lines. Large files are handled in chunks.
|
|
156
|
-
*/
|
|
157
|
-
export declare const sort: (filePath: string, sortDirection: 1 | -1 | "asc" | "desc", lineNumbers?: number | number[], _lineNumbersPerChunk?: number) => Promise<void>;
|
|
158
|
-
export default class File {
|
|
159
|
-
static get: typeof get;
|
|
160
|
-
static remove: (filePath: string, linesToDelete: number | number[]) => Promise<string[]>;
|
|
161
|
-
static search: (filePath: string, operator: ComparisonOperator | ComparisonOperator[], comparedAtValue: string | number | boolean | (string | number | boolean | null)[] | null, logicalOperator?: "and" | "or" | undefined, fieldType?: FieldType | FieldType[] | undefined, fieldChildrenType?: FieldType | FieldType[] | Schema | undefined, limit?: number | undefined, offset?: number | undefined, readWholeFile?: boolean | undefined, secretKey?: string | Buffer | undefined) => Promise<[Record<number, string | number | boolean | (string | number | boolean | null)[] | null> | null, number, Set<number> | null]>;
|
|
162
|
-
static replace: (filePath: string, replacements: string | number | boolean | (string | number | boolean | null)[] | Record<number, string | number | boolean | (string | number | boolean | null)[] | null> | null) => Promise<string[]>;
|
|
163
|
-
static encode: (input: string | number | boolean | (string | number | boolean | null)[] | null) => string | number | boolean | null;
|
|
164
|
-
static decode: (input: string | number | null, fieldType?: FieldType | FieldType[] | undefined, fieldChildrenType?: FieldType | FieldType[] | Schema | undefined, secretKey?: string | Buffer | undefined) => string | number | boolean | (string | number | boolean | null)[] | null;
|
|
165
|
-
static isExists: (path: string) => Promise<boolean>;
|
|
166
|
-
static sum: (filePath: string, lineNumbers?: number | number[] | undefined) => Promise<number>;
|
|
167
|
-
static min: (filePath: string, lineNumbers?: number | number[] | undefined) => Promise<number>;
|
|
168
|
-
static max: (filePath: string, lineNumbers?: number | number[] | undefined) => Promise<number>;
|
|
169
|
-
static append: (filePath: string, data: string | number | (string | number)[]) => Promise<string[]>;
|
|
170
|
-
static count: (filePath: string) => Promise<number>;
|
|
171
|
-
static write: (filePath: string, data: any, disableCompression?: boolean) => Promise<void>;
|
|
172
|
-
static read: (filePath: string, disableCompression?: boolean) => Promise<string>;
|
|
173
|
-
static lock: (folderPath: string, prefix?: string | undefined) => Promise<void>;
|
|
174
|
-
static unlock: (folderPath: string, prefix?: string | undefined) => Promise<void>;
|
|
175
|
-
static createWorker: typeof createWorker;
|
|
176
|
-
}
|
package/dist/file.js
CHANGED
|
@@ -7,10 +7,11 @@ import { join } from "node:path";
|
|
|
7
7
|
import { Worker } from "node:worker_threads";
|
|
8
8
|
import { detectFieldType, isArrayOfObjects, isJSON, isNumber, isObject, } from "./utils.js";
|
|
9
9
|
import { encodeID, compare } from "./utils.server.js";
|
|
10
|
-
import Config from "./config.js";
|
|
10
|
+
import * as Config from "./config.js";
|
|
11
11
|
import Inison from "inison";
|
|
12
12
|
export const lock = async (folderPath, prefix) => {
|
|
13
|
-
let lockFile
|
|
13
|
+
let lockFile = null;
|
|
14
|
+
const lockFilePath = join(folderPath, `${prefix ?? ""}.locked`);
|
|
14
15
|
try {
|
|
15
16
|
lockFile = await open(lockFilePath, "wx");
|
|
16
17
|
return;
|
|
@@ -60,7 +61,7 @@ const readLineInternface = (fileHandle) => {
|
|
|
60
61
|
input: Config.isCompressionEnabled
|
|
61
62
|
? fileHandle.createReadStream().pipe(createGunzip())
|
|
62
63
|
: fileHandle.createReadStream(),
|
|
63
|
-
crlfDelay:
|
|
64
|
+
crlfDelay: Number.POSITIVE_INFINITY,
|
|
64
65
|
});
|
|
65
66
|
};
|
|
66
67
|
/**
|
|
@@ -152,6 +153,7 @@ const decodeHelper = (value, fieldType, fieldChildrenType, secretKey) => {
|
|
|
152
153
|
? detectFieldType(v, fieldChildrenType)
|
|
153
154
|
: fieldChildrenType, undefined, secretKey))
|
|
154
155
|
: value;
|
|
156
|
+
break;
|
|
155
157
|
case "table":
|
|
156
158
|
case "id":
|
|
157
159
|
return isNumber(value) && secretKey
|
|
@@ -187,25 +189,30 @@ export const decode = (input, fieldType, fieldChildrenType, secretKey) => {
|
|
|
187
189
|
: input, fieldType, fieldChildrenType, secretKey);
|
|
188
190
|
};
|
|
189
191
|
export async function get(filePath, lineNumbers, fieldType, fieldChildrenType, secretKey, readWholeFile = false) {
|
|
190
|
-
let fileHandle
|
|
192
|
+
let fileHandle = null;
|
|
193
|
+
let rl = null;
|
|
191
194
|
try {
|
|
192
195
|
fileHandle = await open(filePath, "r");
|
|
193
196
|
rl = readLineInternface(fileHandle);
|
|
194
|
-
|
|
197
|
+
const lines = {};
|
|
198
|
+
let linesCount = 0;
|
|
195
199
|
if (!lineNumbers) {
|
|
196
|
-
for await (const line of rl)
|
|
197
|
-
linesCount
|
|
198
|
-
|
|
200
|
+
for await (const line of rl) {
|
|
201
|
+
linesCount++;
|
|
202
|
+
lines[linesCount] = decode(line, fieldType, fieldChildrenType, secretKey);
|
|
203
|
+
}
|
|
199
204
|
}
|
|
200
205
|
else if (lineNumbers === -1) {
|
|
201
206
|
let lastLine = null;
|
|
202
|
-
for await (const line of rl)
|
|
203
|
-
linesCount
|
|
207
|
+
for await (const line of rl) {
|
|
208
|
+
linesCount++;
|
|
209
|
+
lastLine = line;
|
|
210
|
+
}
|
|
204
211
|
if (lastLine)
|
|
205
212
|
lines[linesCount] = decode(lastLine, fieldType, fieldChildrenType, secretKey);
|
|
206
213
|
}
|
|
207
214
|
else {
|
|
208
|
-
|
|
215
|
+
const lineNumbersArray = new Set(Array.isArray(lineNumbers) ? lineNumbers : [lineNumbers]);
|
|
209
216
|
for await (const line of rl) {
|
|
210
217
|
linesCount++;
|
|
211
218
|
if (!lineNumbersArray.has(linesCount))
|
|
@@ -235,9 +242,11 @@ export async function get(filePath, lineNumbers, fieldType, fieldChildrenType, s
|
|
|
235
242
|
* Note: If the file doesn't exist and replacements is an object, it creates a new file with the specified replacements.
|
|
236
243
|
*/
|
|
237
244
|
export const replace = async (filePath, replacements) => {
|
|
238
|
-
const fileTempPath = filePath.replace(/([^/]+)\/?$/,
|
|
245
|
+
const fileTempPath = filePath.replace(/([^/]+)\/?$/, ".tmp/$1");
|
|
239
246
|
if (await isExists(filePath)) {
|
|
240
|
-
let fileHandle
|
|
247
|
+
let fileHandle = null;
|
|
248
|
+
let fileTempHandle = null;
|
|
249
|
+
let rl = null;
|
|
241
250
|
try {
|
|
242
251
|
let linesCount = 0;
|
|
243
252
|
fileHandle = await open(filePath, "r");
|
|
@@ -247,11 +256,11 @@ export const replace = async (filePath, replacements) => {
|
|
|
247
256
|
transform(line, encoding, callback) {
|
|
248
257
|
linesCount++;
|
|
249
258
|
const replacement = isObject(replacements)
|
|
250
|
-
?
|
|
259
|
+
? Object.hasOwn(replacements, linesCount)
|
|
251
260
|
? replacements[linesCount]
|
|
252
261
|
: line
|
|
253
262
|
: replacements;
|
|
254
|
-
return callback(null, replacement
|
|
263
|
+
return callback(null, `${replacement}\n`);
|
|
255
264
|
},
|
|
256
265
|
}));
|
|
257
266
|
return [fileTempPath, filePath];
|
|
@@ -264,17 +273,16 @@ export const replace = async (filePath, replacements) => {
|
|
|
264
273
|
}
|
|
265
274
|
}
|
|
266
275
|
else if (isObject(replacements)) {
|
|
267
|
-
|
|
276
|
+
const replacementsKeys = Object.keys(replacements)
|
|
268
277
|
.map(Number)
|
|
269
278
|
.toSorted((a, b) => a - b);
|
|
270
|
-
await write(fileTempPath, "\n".repeat(replacementsKeys[0] - 1) +
|
|
279
|
+
await write(fileTempPath, `${"\n".repeat(replacementsKeys[0] - 1) +
|
|
271
280
|
replacementsKeys
|
|
272
281
|
.map((lineNumber, index) => index === 0 || lineNumber - replacementsKeys[index - 1] - 1 === 0
|
|
273
282
|
? replacements[lineNumber]
|
|
274
283
|
: "\n".repeat(lineNumber - replacementsKeys[index - 1] - 1) +
|
|
275
284
|
replacements[lineNumber])
|
|
276
|
-
.join("\n")
|
|
277
|
-
"\n");
|
|
285
|
+
.join("\n")}\n`);
|
|
278
286
|
return [fileTempPath, filePath];
|
|
279
287
|
}
|
|
280
288
|
return [];
|
|
@@ -288,14 +296,16 @@ export const replace = async (filePath, replacements) => {
|
|
|
288
296
|
*
|
|
289
297
|
*/
|
|
290
298
|
export const append = async (filePath, data) => {
|
|
291
|
-
const fileTempPath = filePath.replace(/([^/]+)\/?$/,
|
|
299
|
+
const fileTempPath = filePath.replace(/([^/]+)\/?$/, ".tmp/$1");
|
|
292
300
|
if (await isExists(filePath)) {
|
|
293
301
|
if (!Config.isReverseEnabled && !Config.isCompressionEnabled) {
|
|
294
302
|
await copyFile(filePath, fileTempPath);
|
|
295
303
|
await appendFile(fileTempPath, `${Array.isArray(data) ? data.join("\n") : data}\n`);
|
|
296
304
|
}
|
|
297
305
|
else {
|
|
298
|
-
let fileHandle
|
|
306
|
+
let fileHandle = null;
|
|
307
|
+
let fileTempHandle = null;
|
|
308
|
+
let rl = null;
|
|
299
309
|
try {
|
|
300
310
|
fileHandle = await open(filePath, "r");
|
|
301
311
|
fileTempHandle = await open(fileTempPath, "w");
|
|
@@ -305,11 +315,9 @@ export const append = async (filePath, data) => {
|
|
|
305
315
|
transform(line, encoding, callback) {
|
|
306
316
|
if (!isAppended) {
|
|
307
317
|
isAppended = true;
|
|
308
|
-
return callback(null, `${Array.isArray(data) ? data.join("\n") : data}\n`
|
|
309
|
-
(line.length ? `${line}\n` : ""));
|
|
318
|
+
return callback(null, `${Array.isArray(data) ? data.join("\n") : data}\n${line.length ? `${line}\n` : ""}`);
|
|
310
319
|
}
|
|
311
|
-
|
|
312
|
-
return callback(null, `${line}\n`);
|
|
320
|
+
return callback(null, `${line}\n`);
|
|
313
321
|
},
|
|
314
322
|
}));
|
|
315
323
|
}
|
|
@@ -335,10 +343,15 @@ export const append = async (filePath, data) => {
|
|
|
335
343
|
* Note: Creates a temporary file during the process and replaces the original file with it after removing lines.
|
|
336
344
|
*/
|
|
337
345
|
export const remove = async (filePath, linesToDelete) => {
|
|
338
|
-
let linesCount = 0
|
|
339
|
-
|
|
346
|
+
let linesCount = 0;
|
|
347
|
+
let deletedCount = 0;
|
|
348
|
+
const fileHandle = await open(filePath, "r");
|
|
349
|
+
const fileTempPath = filePath.replace(/([^/]+)\/?$/, ".tmp/$1");
|
|
350
|
+
const fileTempHandle = await open(fileTempPath, "w");
|
|
351
|
+
const linesToDeleteArray = new Set(Array.isArray(linesToDelete)
|
|
340
352
|
? linesToDelete.map(Number)
|
|
341
|
-
: [Number(linesToDelete)])
|
|
353
|
+
: [Number(linesToDelete)]);
|
|
354
|
+
const rl = readLineInternface(fileHandle);
|
|
342
355
|
await _pipeline(rl, fileTempHandle.createWriteStream(), new Transform({
|
|
343
356
|
transform(line, encoding, callback) {
|
|
344
357
|
linesCount++;
|
|
@@ -346,8 +359,7 @@ export const remove = async (filePath, linesToDelete) => {
|
|
|
346
359
|
deletedCount++;
|
|
347
360
|
return callback();
|
|
348
361
|
}
|
|
349
|
-
|
|
350
|
-
return callback(null, `${line}\n`);
|
|
362
|
+
return callback(null, `${line}\n`);
|
|
351
363
|
},
|
|
352
364
|
final(callback) {
|
|
353
365
|
if (deletedCount === linesCount)
|
|
@@ -382,8 +394,11 @@ export const search = async (filePath, operator, comparedAtValue, logicalOperato
|
|
|
382
394
|
// Initialize a Map to store the matching lines with their line numbers.
|
|
383
395
|
const matchingLines = {};
|
|
384
396
|
// Initialize counters for line number, found items, and processed items.
|
|
385
|
-
let linesCount = 0
|
|
386
|
-
let
|
|
397
|
+
let linesCount = 0;
|
|
398
|
+
let foundItems = 0;
|
|
399
|
+
const linesNumbers = new Set();
|
|
400
|
+
let fileHandle = null;
|
|
401
|
+
let rl = null;
|
|
387
402
|
try {
|
|
388
403
|
// Open the file for reading.
|
|
389
404
|
fileHandle = await open(filePath, "r");
|
|
@@ -412,11 +427,11 @@ export const search = async (filePath, operator, comparedAtValue, logicalOperato
|
|
|
412
427
|
if (offset && foundItems < offset)
|
|
413
428
|
continue;
|
|
414
429
|
// Check if the limit has been reached.
|
|
415
|
-
if (limit && foundItems > limit)
|
|
430
|
+
if (limit && foundItems > limit) {
|
|
416
431
|
if (readWholeFile)
|
|
417
432
|
continue;
|
|
418
|
-
|
|
419
|
-
|
|
433
|
+
break;
|
|
434
|
+
}
|
|
420
435
|
// Store the decoded line in the result object.
|
|
421
436
|
matchingLines[linesCount] = decodedLine;
|
|
422
437
|
}
|
|
@@ -444,11 +459,12 @@ export const count = async (filePath) => {
|
|
|
444
459
|
// return Number((await exec(`wc -l < ${filePath}`)).stdout.trim());
|
|
445
460
|
let linesCount = 0;
|
|
446
461
|
if (await isExists(filePath)) {
|
|
447
|
-
let fileHandle
|
|
462
|
+
let fileHandle = null;
|
|
463
|
+
let rl = null;
|
|
448
464
|
try {
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
for await (const
|
|
465
|
+
fileHandle = await open(filePath, "r");
|
|
466
|
+
rl = readLineInternface(fileHandle);
|
|
467
|
+
for await (const _ of rl)
|
|
452
468
|
linesCount++;
|
|
453
469
|
}
|
|
454
470
|
finally {
|
|
@@ -469,10 +485,11 @@ export const count = async (filePath) => {
|
|
|
469
485
|
*/
|
|
470
486
|
export const sum = async (filePath, lineNumbers) => {
|
|
471
487
|
let sum = 0;
|
|
472
|
-
const fileHandle = await open(filePath, "r")
|
|
488
|
+
const fileHandle = await open(filePath, "r");
|
|
489
|
+
const rl = readLineInternface(fileHandle);
|
|
473
490
|
if (lineNumbers) {
|
|
474
491
|
let linesCount = 0;
|
|
475
|
-
|
|
492
|
+
const lineNumbersArray = new Set(Array.isArray(lineNumbers) ? lineNumbers : [lineNumbers]);
|
|
476
493
|
for await (const line of rl) {
|
|
477
494
|
linesCount++;
|
|
478
495
|
if (!lineNumbersArray.has(linesCount))
|
|
@@ -500,10 +517,11 @@ export const sum = async (filePath, lineNumbers) => {
|
|
|
500
517
|
*/
|
|
501
518
|
export const max = async (filePath, lineNumbers) => {
|
|
502
519
|
let max = 0;
|
|
503
|
-
const fileHandle = await open(filePath, "r")
|
|
520
|
+
const fileHandle = await open(filePath, "r");
|
|
521
|
+
const rl = readLineInternface(fileHandle);
|
|
504
522
|
if (lineNumbers) {
|
|
505
523
|
let linesCount = 0;
|
|
506
|
-
|
|
524
|
+
const lineNumbersArray = new Set(Array.isArray(lineNumbers) ? lineNumbers : [lineNumbers]);
|
|
507
525
|
for await (const line of rl) {
|
|
508
526
|
linesCount++;
|
|
509
527
|
if (!lineNumbersArray.has(linesCount))
|
|
@@ -536,10 +554,11 @@ export const max = async (filePath, lineNumbers) => {
|
|
|
536
554
|
*/
|
|
537
555
|
export const min = async (filePath, lineNumbers) => {
|
|
538
556
|
let min = 0;
|
|
539
|
-
const fileHandle = await open(filePath, "r")
|
|
557
|
+
const fileHandle = await open(filePath, "r");
|
|
558
|
+
const rl = readLineInternface(fileHandle);
|
|
540
559
|
if (lineNumbers) {
|
|
541
560
|
let linesCount = 0;
|
|
542
|
-
|
|
561
|
+
const lineNumbersArray = new Set(Array.isArray(lineNumbers) ? lineNumbers : [lineNumbers]);
|
|
543
562
|
for await (const line of rl) {
|
|
544
563
|
linesCount++;
|
|
545
564
|
if (!lineNumbersArray.has(linesCount))
|
|
@@ -562,7 +581,7 @@ export const min = async (filePath, lineNumbers) => {
|
|
|
562
581
|
return min;
|
|
563
582
|
};
|
|
564
583
|
export function createWorker(functionName, arg) {
|
|
565
|
-
return new Promise(
|
|
584
|
+
return new Promise((resolve, reject) => {
|
|
566
585
|
const worker = new Worker("./dist/file.thread.js", {
|
|
567
586
|
workerData: { functionName, arg },
|
|
568
587
|
});
|
|
@@ -574,36 +593,3 @@ export function createWorker(functionName, arg) {
|
|
|
574
593
|
});
|
|
575
594
|
});
|
|
576
595
|
}
|
|
577
|
-
/**
|
|
578
|
-
* Asynchronously sorts the lines in a file in the specified direction.
|
|
579
|
-
*
|
|
580
|
-
* @param filePath - Path of the file to be sorted.
|
|
581
|
-
* @param sortDirection - Direction for sorting: 1 or 'asc' for ascending, -1 or 'desc' for descending.
|
|
582
|
-
* @param lineNumbers - Optional specific line numbers to sort. If not provided, sorts all lines.
|
|
583
|
-
* @param _lineNumbersPerChunk - Optional parameter for handling large files, specifying the number of lines per chunk.
|
|
584
|
-
* @returns Promise<void>. Modifies the file by sorting specified lines.
|
|
585
|
-
*
|
|
586
|
-
* Note: The sorting is applied either to the entire file or to the specified lines. Large files are handled in chunks.
|
|
587
|
-
*/
|
|
588
|
-
export const sort = async (filePath, sortDirection, lineNumbers, _lineNumbersPerChunk = 100000) => {
|
|
589
|
-
// return Number((await exec(`wc -l < ${filePath}`)).stdout.trim());
|
|
590
|
-
};
|
|
591
|
-
export default class File {
|
|
592
|
-
static get = get;
|
|
593
|
-
static remove = remove;
|
|
594
|
-
static search = search;
|
|
595
|
-
static replace = replace;
|
|
596
|
-
static encode = encode;
|
|
597
|
-
static decode = decode;
|
|
598
|
-
static isExists = isExists;
|
|
599
|
-
static sum = sum;
|
|
600
|
-
static min = min;
|
|
601
|
-
static max = max;
|
|
602
|
-
static append = append;
|
|
603
|
-
static count = count;
|
|
604
|
-
static write = write;
|
|
605
|
-
static read = read;
|
|
606
|
-
static lock = lock;
|
|
607
|
-
static unlock = unlock;
|
|
608
|
-
static createWorker = createWorker;
|
|
609
|
-
}
|
package/dist/file.thread.js
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -76,10 +76,10 @@ export default class Inibase {
|
|
|
76
76
|
clearCache(tablePath: string): Promise<void>;
|
|
77
77
|
get(tableName: string, where?: string | number | (string | number)[] | Criteria | undefined, options?: Options | undefined, onlyOne?: true, onlyLinesNumbers?: undefined, tableSchema?: Schema, skipIdColumn?: boolean): Promise<Data | null>;
|
|
78
78
|
get(tableName: string, where?: string | number | (string | number)[] | Criteria | undefined, options?: Options | undefined, onlyOne?: boolean | undefined, onlyLinesNumbers?: true, tableSchema?: Schema, skipIdColumn?: boolean): Promise<number[]>;
|
|
79
|
-
post(tableName: string, data: Data | Data[], options?: Options, returnPostedData?: boolean): Promise<void
|
|
79
|
+
post(tableName: string, data: Data | Data[], options?: Options, returnPostedData?: boolean): Promise<void>;
|
|
80
80
|
post(tableName: string, data: Data, options: Options | undefined, returnPostedData: true): Promise<Data | null>;
|
|
81
81
|
post(tableName: string, data: Data[], options: Options | undefined, returnPostedData: true): Promise<Data[] | null>;
|
|
82
|
-
put(tableName: string, data: Data | Data[], where?: number | string | (number | string)[] | Criteria, options?: Options, returnUpdatedData?: false): Promise<void
|
|
82
|
+
put(tableName: string, data: Data | Data[], where?: number | string | (number | string)[] | Criteria, options?: Options, returnUpdatedData?: false): Promise<void>;
|
|
83
83
|
put(tableName: string, data: Data, where: number | string | (number | string)[] | Criteria | undefined, options: Options | undefined, returnUpdatedData: true): Promise<Data | null>;
|
|
84
84
|
put(tableName: string, data: Data[], where: number | string | (number | string)[] | Criteria | undefined, options: Options | undefined, returnUpdatedData: true): Promise<Data[] | null>;
|
|
85
85
|
delete(tableName: string, where?: number | string, _id?: string | string[]): Promise<string | null>;
|