@secrez/fs 1.1.0 → 1.1.1
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 +2 -2
- package/coverage.report +128 -124
- package/package.json +6 -6
package/README.md
CHANGED
|
@@ -25,7 +25,7 @@ API documentation
|
|
|
25
25
|
- strengthen password-based export encryption in `FileCipher`: new **v2** format (PBKDF2, random salt in file, iterations out of band)
|
|
26
26
|
- write vault blobs and cache files with mode `0o600` via `VaultPermissions` (FS-1)
|
|
27
27
|
- add `fileCipherLegacy` module and `FileCipherLegacy` export for **v1** password-encrypted files (import compatibility and test fixtures)
|
|
28
|
-
- require Node.js
|
|
28
|
+
- require Node.js 22.23.4 or later (`engines.node >=22.23.4`)
|
|
29
29
|
|
|
30
30
|
**1.0.3**
|
|
31
31
|
|
|
@@ -38,7 +38,7 @@ API documentation
|
|
|
38
38
|
## Test coverage
|
|
39
39
|
|
|
40
40
|
```
|
|
41
|
-
108 passing (
|
|
41
|
+
108 passing (2s)
|
|
42
42
|
|
|
43
43
|
-----------------------|---------|----------|---------|---------|-----------------------------------
|
|
44
44
|
File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s
|
package/coverage.report
CHANGED
|
@@ -1,199 +1,203 @@
|
|
|
1
1
|
|
|
2
|
-
> @secrez/fs@1.
|
|
2
|
+
> @secrez/fs@1.0.7 test /Users/francescosullo/Projects/Secrez/secrez/packages/fs
|
|
3
3
|
> cross-env NODE_ENV=test nyc --reporter=lcov --reporter=text mocha test/*.test.js test/**/*.test.js --exit
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
#DataCache
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
8
|
+
✓ should initialize a dataCache
|
|
9
|
+
✓ should put and get data
|
|
10
|
+
✓ should load data from disk, if any
|
|
11
|
+
✓ should not load if no data
|
|
12
|
+
✓ should load plaintext data from disk, if any
|
|
13
|
+
✓ should load encrypted data from disk, if any
|
|
14
14
|
|
|
15
15
|
#ExternalFs
|
|
16
16
|
getNormalizedPath
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
17
|
+
✓ should normalize "~/fileSystems"
|
|
18
|
+
✓ should normalize "~"
|
|
19
|
+
✓ should normalize "/var"
|
|
20
20
|
fileCompletion
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
21
|
+
✓ should return a list of files
|
|
22
|
+
✓ should return a list of only directories
|
|
23
|
+
✓ should return a list of only files
|
|
24
|
+
✓ should return the file itself, if it is not a directory
|
|
25
|
+
✓ should return the list of the files satisfying wildcards
|
|
26
|
+
✓ should return an empty list if the files does not exist
|
|
27
27
|
getVersionedBasename
|
|
28
|
-
|
|
28
|
+
✓ should version a file
|
|
29
29
|
isDir
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
30
|
+
✓ should confirm that "utils" is a dir
|
|
31
|
+
✓ should return that "config.test.js" is not a dir
|
|
32
|
+
✓ should return that a not-existent file is not a dir
|
|
33
33
|
isFile
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
34
|
+
✓ should return that "config.test.js" is a file
|
|
35
|
+
✓ should confirm that "utils" is not a file
|
|
36
|
+
✓ should return that a not-existent file is not a dir
|
|
37
37
|
|
|
38
38
|
#FileCipher
|
|
39
39
|
encrypt/decrypt external file
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
✔ should encrypt a file using user's own public key
|
|
40
|
+
✓ should encrypt a file using a specific password
|
|
41
|
+
✓ should encrypt a file using a shared key
|
|
42
|
+
✓ should encrypt a file using user's own public key
|
|
44
43
|
|
|
45
44
|
#FsUtils
|
|
46
45
|
preParseCommandLine
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
46
|
+
✓ should preParse a command line
|
|
47
|
+
✓ should preParse a command line with escaped pars
|
|
48
|
+
✓ should preParse a command line using quotes for params
|
|
50
49
|
parseCommandLine
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
50
|
+
✓ should parse a command line with definitions
|
|
51
|
+
✓ should return a {} w/out definitions
|
|
52
|
+
✓ should return a {} w/out params
|
|
53
|
+
✓ should return an _unknown if not supported option is passed
|
|
55
54
|
filterLs
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
55
|
+
✓ should filter an array of files and return itself
|
|
56
|
+
✓ should filter an array of files starting from "te"
|
|
57
|
+
✓ should filter an array of files of type .log
|
|
58
|
+
✓ should filter an array of files and find the folders
|
|
59
|
+
✓ should get all the files
|
|
60
|
+
✓ should return an empty array if nothing is found
|
|
61
|
+
✓ should return an empty array if parameters are missed or empty
|
|
62
|
+
✓ should return all the list array if files are missed
|
|
64
63
|
|
|
65
64
|
#GitConflictChecker
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
with
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
65
|
+
✓ should detect non-git repository
|
|
66
|
+
✓ should return null status for non-git repository
|
|
67
|
+
✓ should not detect conflict risk in non-git repository
|
|
68
|
+
with real GitHub repository
|
|
69
|
+
✓ should detect git repository
|
|
70
|
+
✓ should get git status when up to date with remote (3471ms)
|
|
71
|
+
✓ should detect conflict risk when behind remote (5794ms)
|
|
72
|
+
✓ should get warning message for conflict risk
|
|
73
|
+
✓ should not show alert again after user proceeds (3582ms)
|
|
74
|
+
✓ should reset cache
|
|
76
75
|
|
|
77
76
|
#InternalFs
|
|
78
77
|
#constructor
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
78
|
+
✓ should instantiate the internal file system and initialize it
|
|
79
|
+
✓ should initialize the internal fs
|
|
80
|
+
✓ should throw if passing not a Secrez instance
|
|
82
81
|
getFullPath
|
|
83
|
-
|
|
82
|
+
✓ should return the fullPath of an entry
|
|
84
83
|
normalizePath
|
|
85
|
-
|
|
86
|
-
|
|
84
|
+
✓ should normalize a path
|
|
85
|
+
✓ should throw if the path is empty, is not a string or is longer than 255 chars
|
|
87
86
|
getNormalizedPath
|
|
88
|
-
|
|
87
|
+
✓ should normalize a path
|
|
89
88
|
make
|
|
90
|
-
|
|
91
|
-
|
|
89
|
+
✓ should create directories and files
|
|
90
|
+
✓ should throw trying to re-add the same entry
|
|
92
91
|
change
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
92
|
+
✓ should create directories and files and update them
|
|
93
|
+
✓ should return an error
|
|
94
|
+
✓ should move files between datasets
|
|
96
95
|
remove
|
|
97
|
-
|
|
96
|
+
✓ should remove a file from the tree
|
|
98
97
|
load
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
98
|
+
✓ should create directories and files and loading a tree from disk
|
|
99
|
+
✓ should create directories and files, and load a tree from disk
|
|
100
|
+
✓ should create directories and files, delete everything and loading a tree from disk
|
|
101
|
+
✓ should compress and reload an empty set of entries
|
|
103
102
|
#getFileList
|
|
104
|
-
|
|
103
|
+
✓ should get the current folder dir
|
|
105
104
|
|
|
106
105
|
#Node
|
|
107
106
|
#constructor
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
107
|
+
✓ should instantiate the Node
|
|
108
|
+
✓ should throw if passing a rot without required parameters
|
|
109
|
+
✓ should throw if not passing an object
|
|
110
|
+
✓ should throw if not passing wrong type
|
|
112
111
|
#getName && #getFile && #getContent && getOptions
|
|
113
|
-
|
|
114
|
-
|
|
112
|
+
✓ should get name, file and options
|
|
113
|
+
✓ should throw if version not found
|
|
115
114
|
#getFindRe
|
|
116
|
-
|
|
115
|
+
✓ should get a re to check a filepath
|
|
117
116
|
#getNames
|
|
118
|
-
|
|
119
|
-
|
|
117
|
+
✓ should get the names of all children
|
|
118
|
+
✓ should throw if trying to get children of a file
|
|
120
119
|
#find
|
|
121
|
-
|
|
120
|
+
✓ should find all childrens satisfying criterias
|
|
122
121
|
#add
|
|
123
|
-
|
|
124
|
-
|
|
122
|
+
✓ should add children to root
|
|
123
|
+
✓ should throw if node is a file
|
|
125
124
|
#move
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
125
|
+
✓ should rename a node
|
|
126
|
+
✓ should move a node
|
|
127
|
+
✓ should throw trying to move root
|
|
128
|
+
✓ should throw trying to modify a node with different id
|
|
130
129
|
#remove
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
130
|
+
✓ should remove a node
|
|
131
|
+
✓ should remove itself
|
|
132
|
+
✓ should throw trying to remove root
|
|
134
133
|
#toCompressedJSON && Node#fromJSON
|
|
135
|
-
|
|
136
|
-
|
|
134
|
+
✓ should prepare a json for saving
|
|
135
|
+
✓ should build an index from a json file
|
|
137
136
|
#getChildFromPath
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
137
|
+
✓ should find a node starting from a path
|
|
138
|
+
✓ should find the last ancestor starting from a path
|
|
139
|
+
✓ should throw if the path is incorrect or does not exist
|
|
140
|
+
✓ should throw if looking for last ancestor and find existent node
|
|
142
141
|
#getPathToChild
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
142
|
+
✓ should find a node starting from a path
|
|
143
|
+
✓ should throw if child is not a Node
|
|
144
|
+
✓ should throw if child belows to another tree
|
|
146
145
|
#findDirectChildByName && #findChildById
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
146
|
+
✓ should find a direct child by name and by id
|
|
147
|
+
✓ should throw if looking for child of a file
|
|
148
|
+
✓ should throw if looking for child of a file
|
|
150
149
|
|
|
151
150
|
#Tree
|
|
152
151
|
#constructor
|
|
153
|
-
|
|
154
|
-
|
|
152
|
+
✓ should instantiate the Tree
|
|
153
|
+
✓ should throw if passing not an Secrez instance
|
|
155
154
|
#load
|
|
156
|
-
|
|
157
|
-
|
|
155
|
+
✓ should load an empty Tree
|
|
156
|
+
✓ should do nothing if already loaded
|
|
158
157
|
getEntryDetails
|
|
159
|
-
|
|
158
|
+
✓ should return the entry details of a node
|
|
160
159
|
#Fix
|
|
161
|
-
|
|
160
|
+
✓ should load a tree with tags (52ms)
|
|
162
161
|
1) should simulate a conflict in the repo and recover lost entries when a valid tree exists
|
|
163
|
-
|
|
162
|
+
✓ should simulate a lost index in the repo and recover the entries when no valid tree is found (73ms)
|
|
164
163
|
Multi data sets
|
|
165
|
-
|
|
164
|
+
✓ should load the trees of two data sets
|
|
166
165
|
|
|
167
166
|
|
|
168
|
-
|
|
167
|
+
106 passing (44s)
|
|
169
168
|
1 failing
|
|
170
169
|
|
|
171
170
|
1) #Tree
|
|
172
171
|
#Fix
|
|
173
172
|
should simulate a conflict in the repo and recover lost entries when a valid tree exists:
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
173
|
+
|
|
174
|
+
AssertionError: expected [ '/B/D/g', '/B/b', '/E/L/N', …(1) ] to deeply equal [ '/B/D/g', '/B/b', '/E/L/N', '/E/c' ]
|
|
175
|
+
+ expected - actual
|
|
176
|
+
|
|
177
|
+
[
|
|
178
|
+
"/B/D/g"
|
|
179
|
+
"/B/b"
|
|
180
|
+
"/E/L/N"
|
|
181
|
+
- "/REC_20251009101127/d"
|
|
182
|
+
+ "/E/c"
|
|
183
|
+
]
|
|
184
|
+
|
|
185
|
+
at Context.<anonymous> (test/Tree.test.js:306:14)
|
|
181
186
|
|
|
182
187
|
|
|
183
188
|
|
|
184
189
|
-----------------------|---------|----------|---------|---------|-----------------------------------
|
|
185
190
|
File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s
|
|
186
191
|
-----------------------|---------|----------|---------|---------|-----------------------------------
|
|
187
|
-
All files |
|
|
188
|
-
DataCache.js | 89.
|
|
192
|
+
All files | 81.85 | 67.77 | 86.27 | 81.52 |
|
|
193
|
+
DataCache.js | 89.41 | 74.07 | 90.9 | 89.28 | 17-23,122-123,149
|
|
189
194
|
ExternalFs.js | 94.02 | 76.92 | 100 | 93.93 | 9,29,35,54
|
|
190
|
-
FileCipher.js | 88.
|
|
195
|
+
FileCipher.js | 88.63 | 73.33 | 100 | 88.63 | 8,52,80,85,94
|
|
191
196
|
FsUtils.js | 100 | 100 | 100 | 100 |
|
|
192
197
|
GitConflictChecker.js | 72.81 | 61.9 | 90 | 72.81 | ...95,204,222,254,259,277,289,308
|
|
193
|
-
InternalFs.js |
|
|
198
|
+
InternalFs.js | 85.09 | 71.87 | 85.18 | 84.98 | ...33,344,364,423-428,460,470-487
|
|
194
199
|
Messages.js | 100 | 100 | 100 | 100 |
|
|
195
|
-
Node.js |
|
|
196
|
-
Tree.js |
|
|
197
|
-
fileCipherLegacy.js | 100 | 100 | 100 | 100 |
|
|
200
|
+
Node.js | 66.1 | 54.81 | 78.72 | 65.31 | ...05,644-648,666,669,683-720,729
|
|
201
|
+
Tree.js | 90.19 | 74.09 | 86.48 | 89.91 | ...39,466,476,530,622,630,661-672
|
|
198
202
|
-----------------------|---------|----------|---------|---------|-----------------------------------
|
|
199
203
|
ELIFECYCLE Test failed. See above for more details.
|
package/package.json
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@secrez/fs",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.1",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
7
7
|
},
|
|
8
8
|
"dependencies": {
|
|
9
|
-
"@secrez/core": "~1.1.
|
|
10
|
-
"@secrez/crypto": "~1.1.
|
|
11
|
-
"@secrez/utils": "~1.1.
|
|
9
|
+
"@secrez/core": "~1.1.1",
|
|
10
|
+
"@secrez/crypto": "~1.1.1",
|
|
11
|
+
"@secrez/utils": "~1.1.1",
|
|
12
12
|
"command-line-args": "^5.2.1",
|
|
13
13
|
"fs-extra": "^9.1.0",
|
|
14
14
|
"lodash": "^4.17.21"
|
|
15
15
|
},
|
|
16
16
|
"devDependencies": {
|
|
17
|
-
"@secrez/test-helpers": "~2.0.
|
|
17
|
+
"@secrez/test-helpers": "~2.0.4",
|
|
18
18
|
"chai": "^4.5.0",
|
|
19
19
|
"cross-env": "^7.0.3",
|
|
20
20
|
"mocha": "^10.8.2",
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"email": "francesco@sullo.co"
|
|
32
32
|
},
|
|
33
33
|
"engines": {
|
|
34
|
-
"node": ">=
|
|
34
|
+
"node": ">=22.23.4"
|
|
35
35
|
},
|
|
36
36
|
"scripts": {
|
|
37
37
|
"all-tests": "find test/** -name '*.test.js' | xargs ./node_modules/.bin/mocha -R spec",
|