inibase 1.0.0-rc.22 → 1.0.0-rc.24
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 +22 -10
- package/dist/file.d.ts +10 -10
- package/dist/file.js +192 -284
- package/dist/index.d.ts +6 -5
- package/dist/index.js +182 -137
- package/dist/utils.d.ts +5 -5
- package/dist/utils.js +3 -12
- package/dist/utils.server.d.ts +2 -2
- package/dist/utils.server.js +5 -5
- package/package.json +39 -35
package/dist/utils.server.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createCipheriv, createDecipheriv, randomBytes, scryptSync, createHash, } from "node:crypto";
|
|
2
|
-
import
|
|
2
|
+
import { isArrayOfObjects, isNumber, isValidID } from "./utils.js";
|
|
3
3
|
export const hashPassword = (password) => {
|
|
4
4
|
const salt = randomBytes(16).toString("hex");
|
|
5
5
|
const hash = createHash("sha256")
|
|
@@ -38,10 +38,10 @@ export const findLastIdNumber = (schema, secretKeyOrSalt) => {
|
|
|
38
38
|
const lastField = schema[schema.length - 1];
|
|
39
39
|
if (lastField) {
|
|
40
40
|
if ((lastField.type === "array" || lastField.type === "object") &&
|
|
41
|
-
|
|
41
|
+
isArrayOfObjects(lastField.children))
|
|
42
42
|
return findLastIdNumber(lastField.children, secretKeyOrSalt);
|
|
43
43
|
else if (lastField.id)
|
|
44
|
-
return
|
|
44
|
+
return isValidID(lastField.id)
|
|
45
45
|
? decodeID(lastField.id, secretKeyOrSalt)
|
|
46
46
|
: lastField.id;
|
|
47
47
|
}
|
|
@@ -53,7 +53,7 @@ export const addIdToSchema = (schema, oldIndex = 0, secretKeyOrSalt) => schema.m
|
|
|
53
53
|
field.id = encodeID(oldIndex, secretKeyOrSalt);
|
|
54
54
|
}
|
|
55
55
|
else {
|
|
56
|
-
if (!
|
|
56
|
+
if (!isNumber(field.id))
|
|
57
57
|
oldIndex = decodeID(field.id, secretKeyOrSalt);
|
|
58
58
|
else {
|
|
59
59
|
oldIndex = field.id;
|
|
@@ -61,7 +61,7 @@ export const addIdToSchema = (schema, oldIndex = 0, secretKeyOrSalt) => schema.m
|
|
|
61
61
|
}
|
|
62
62
|
}
|
|
63
63
|
if ((field.type === "array" || field.type === "object") &&
|
|
64
|
-
|
|
64
|
+
isArrayOfObjects(field.children)) {
|
|
65
65
|
field.children = addIdToSchema(field.children, oldIndex, secretKeyOrSalt);
|
|
66
66
|
oldIndex += field.children.length;
|
|
67
67
|
}
|
package/package.json
CHANGED
|
@@ -1,50 +1,50 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "inibase",
|
|
3
|
-
"version": "1.0.0-rc.
|
|
4
|
-
"
|
|
3
|
+
"version": "1.0.0-rc.24",
|
|
4
|
+
"author": {
|
|
5
|
+
"name": "Karim Amahtil",
|
|
6
|
+
"email": "karim.amahtil@gmail.com"
|
|
7
|
+
},
|
|
8
|
+
"repository": "inicontent/inibase",
|
|
5
9
|
"main": "./dist/index.js",
|
|
6
|
-
"
|
|
10
|
+
"exports": {
|
|
11
|
+
".": "./dist/index.js",
|
|
12
|
+
"./file": "./dist/file.js",
|
|
13
|
+
"./utils": "./dist/utils.js",
|
|
14
|
+
"./utils.server": "./dist/utils.server.js"
|
|
15
|
+
},
|
|
16
|
+
"bugs": {
|
|
17
|
+
"url": "https://github.com/inicontent/inibase/issues"
|
|
18
|
+
},
|
|
19
|
+
"description": "NoSQL & NoJSON File-based Relational Database",
|
|
20
|
+
"engines": {
|
|
21
|
+
"node": ">=16"
|
|
22
|
+
},
|
|
7
23
|
"files": [
|
|
8
24
|
"/dist"
|
|
9
25
|
],
|
|
10
|
-
"
|
|
11
|
-
"
|
|
26
|
+
"funding": "https://github.com/sponsors/inicontent",
|
|
27
|
+
"homepage": "https://github.com/inicontent/inibase#readme",
|
|
12
28
|
"keywords": [
|
|
13
|
-
"db",
|
|
14
29
|
"nosql",
|
|
30
|
+
"sqlite",
|
|
31
|
+
"postgresql",
|
|
32
|
+
"database",
|
|
33
|
+
"supabase",
|
|
34
|
+
"pocketbase",
|
|
35
|
+
"firebase",
|
|
36
|
+
"db",
|
|
15
37
|
"mongoose",
|
|
16
38
|
"mongodb",
|
|
17
|
-
"database",
|
|
18
39
|
"relational",
|
|
19
40
|
"local",
|
|
20
41
|
"storage",
|
|
21
42
|
"json",
|
|
22
|
-
"sql"
|
|
23
|
-
"sqlite",
|
|
24
|
-
"supabase",
|
|
25
|
-
"pocketbase",
|
|
26
|
-
"firebase"
|
|
43
|
+
"sql"
|
|
27
44
|
],
|
|
28
|
-
"author": {
|
|
29
|
-
"name": "Karim Amahtil",
|
|
30
|
-
"email": "karim.amahtil@gmail.com"
|
|
31
|
-
},
|
|
32
|
-
"funding": "https://github.com/sponsors/inicontent",
|
|
33
45
|
"license": "MIT",
|
|
34
|
-
"
|
|
35
|
-
|
|
36
|
-
},
|
|
37
|
-
"homepage": "https://github.com/inicontent/inibase#readme",
|
|
38
|
-
"devDependencies": {
|
|
39
|
-
"@types/node": "^20.10.0",
|
|
40
|
-
"typescript": "^5.3.2"
|
|
41
|
-
},
|
|
42
|
-
"exports": {
|
|
43
|
-
".": "./dist/index.js",
|
|
44
|
-
"./file": "./dist/file.js",
|
|
45
|
-
"./utils": "./dist/utils.js",
|
|
46
|
-
"./utils.server": "./dist/utils.server.js"
|
|
47
|
-
},
|
|
46
|
+
"type": "module",
|
|
47
|
+
"types": "./dist",
|
|
48
48
|
"typesVersions": {
|
|
49
49
|
"*": {
|
|
50
50
|
"file": [
|
|
@@ -58,12 +58,16 @@
|
|
|
58
58
|
]
|
|
59
59
|
}
|
|
60
60
|
},
|
|
61
|
-
"
|
|
62
|
-
"node": "
|
|
61
|
+
"devDependencies": {
|
|
62
|
+
"@types/node": "^20.10.4",
|
|
63
|
+
"typescript": "^5.3.3"
|
|
64
|
+
},
|
|
65
|
+
"dependencies": {
|
|
66
|
+
"csv-parser": "^3.0.0"
|
|
63
67
|
},
|
|
64
68
|
"scripts": {
|
|
65
69
|
"build": "npx tsc",
|
|
66
|
-
"test": "npx tsx watch ./
|
|
67
|
-
"benchmark": "npx tsx watch ./benchmark
|
|
70
|
+
"test": "npx tsx watch --expose-gc --env-file=.env ./index.test",
|
|
71
|
+
"benchmark": "npx tsx watch --expose-gc --env-file=.env ./benchmark"
|
|
68
72
|
}
|
|
69
73
|
}
|