inibase 1.0.0-rc.21 → 1.0.0-rc.22

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/README.md CHANGED
@@ -40,13 +40,6 @@ const users = await db.get("user", { favoriteFoods: "![]Pizza" });
40
40
 
41
41
  If you like Inibase, please sponsor: [GitHub Sponsors](https://github.com/sponsors/inicontent) || [Paypal](https://paypal.me/KarimAmahtil).
42
42
 
43
- ## Sponsors
44
-
45
- <br>
46
- <br>
47
-
48
- Become a sponsor and have your company logo here 👉 [GitHub Sponsors](https://github.com/sponsors/inicontent) || [paypal](https://paypal.me/KarimAmahtil).
49
-
50
43
  ## Install
51
44
 
52
45
  ```js
@@ -58,17 +51,13 @@ Become a sponsor and have your company logo here 👉 [GitHub Sponsors](https://
58
51
  To semplify the idea, each database has tables, each table has columns, each column will be stored in a seperated file. When POSTing new data, it will be appended to each columns file as new line. When GETing data, the file will be readed line-by-line so it can handle large data (without consuming a lot of resources)
59
52
 
60
53
  ## Benchmark
61
- ```js
62
- Bulk
63
- ┌─────────┬─────────┬─────────┐
64
- 10 │ 100 │ 1000 │
65
- ┌─────────┼─────────┼─────────┼─────────┤
66
- POST '23 ms' '20 ms' '83 ms'
67
- GET │ '12 ms' '16 ms' '45 ms'
68
- │ PUT │ '6 ms' │ '4 ms' │ '11 ms' │
69
- │ DELETE │ '18 ms' │ '21 ms' │ '27 ms' │
70
- └─────────┴─────────┴─────────┴─────────┘
71
- ```
54
+
55
+ | | 10 | 100 | 1000 |
56
+ |--------|-------|-------|-------|
57
+ | POST | 23 ms | 20 ms | 83 ms |
58
+ | GET | 12 ms | 16 ms | 45 ms |
59
+ | PUT | 6 ms | 4 ms | 11 ms |
60
+ | DELETE | 18 ms | 21 ms | 27 ms |
72
61
 
73
62
  ## Examples
74
63
 
package/dist/index.js CHANGED
@@ -449,8 +449,7 @@ export default class Inibase {
449
449
  switch (value[0]) {
450
450
  case ">":
451
451
  case "<":
452
- case "[":
453
- return ["=", "]", "*"].includes(value[1])
452
+ return value[1] === "="
454
453
  ? [
455
454
  value.slice(0, 2),
456
455
  value.slice(2),
@@ -459,6 +458,13 @@ export default class Inibase {
459
458
  value.slice(0, 1),
460
459
  value.slice(1),
461
460
  ];
461
+ case "[":
462
+ return value[1] === "]"
463
+ ? [
464
+ value.slice(0, 2),
465
+ value.slice(2).toString().split(","),
466
+ ]
467
+ : ["[]", value.slice(1)];
462
468
  case "!":
463
469
  return ["=", "*"].includes(value[1])
464
470
  ? [
package/dist/utils.js CHANGED
@@ -7,7 +7,7 @@ export const isObject = (obj) => obj != null &&
7
7
  export const deepMerge = (target, source) => {
8
8
  for (const key in source) {
9
9
  if (source.hasOwnProperty(key)) {
10
- if (source[key] instanceof Object && target[key] instanceof Object)
10
+ if (isObject(source[key]) && isObject(target[key]))
11
11
  target[key] = deepMerge(target[key], source[key]);
12
12
  else
13
13
  target[key] = source[key];
@@ -2,12 +2,12 @@
2
2
  import { type Schema } from "./index.js";
3
3
  export declare const hashPassword: (password: string) => string;
4
4
  export declare const comparePassword: (hashedPassword: string, inputPassword: string) => boolean;
5
- export declare const encodeID: (id: number, secretKeyOrSalt: string | number | Buffer) => string;
5
+ export declare const encodeID: (id: number | string, secretKeyOrSalt: string | number | Buffer) => string;
6
6
  export declare const decodeID: (input: string, secretKeyOrSalt: string | number | Buffer) => number;
7
7
  export declare const findLastIdNumber: (schema: Schema, secretKeyOrSalt: string | number | Buffer) => number;
8
8
  export declare const addIdToSchema: (schema: Schema, oldIndex: number, secretKeyOrSalt: string | number | Buffer) => import("./index.js").Field[];
9
9
  export default class UtilsServer {
10
- static encodeID: (id: number, secretKeyOrSalt: string | number | Buffer) => string;
10
+ static encodeID: (id: string | number, secretKeyOrSalt: string | number | Buffer) => string;
11
11
  static decodeID: (input: string, secretKeyOrSalt: string | number | Buffer) => number;
12
12
  static hashPassword: (password: string) => string;
13
13
  static comparePassword: (hashedPassword: string, inputPassword: string) => boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "inibase",
3
- "version": "1.0.0-rc.21",
3
+ "version": "1.0.0-rc.22",
4
4
  "description": "File-based Relational Database for large data",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist",