@e-mc/types 0.9.18 → 0.9.19
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/LICENSE +4 -8
- package/README.md +3 -3
- package/constant.d.ts +1 -1
- package/index.js +10 -5
- package/lib/index.d.ts +1 -1
- package/lib/watch.d.ts +2 -2
- package/package.json +2 -2
package/LICENSE
CHANGED
|
@@ -1,11 +1,7 @@
|
|
|
1
|
-
Copyright
|
|
1
|
+
Copyright 2025 An Pham
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
|
|
10
|
-
|
|
11
|
-
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
7
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
package/README.md
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
|
|
10
10
|
## Interface
|
|
11
11
|
|
|
12
|
-
* [View Source](https://www.unpkg.com/@e-mc/types@0.9.
|
|
12
|
+
* [View Source](https://www.unpkg.com/@e-mc/types@0.9.19/index.d.ts)
|
|
13
13
|
|
|
14
14
|
```typescript
|
|
15
15
|
import type { LogArguments } from "./lib/logger";
|
|
@@ -194,8 +194,8 @@ const IMPORT_MAP: Record<string, string | undefined>;
|
|
|
194
194
|
|
|
195
195
|
## References
|
|
196
196
|
|
|
197
|
-
- https://www.unpkg.com/@e-mc/types@0.9.
|
|
198
|
-
- https://www.unpkg.com/@e-mc/types@0.9.
|
|
197
|
+
- https://www.unpkg.com/@e-mc/types@0.9.19/lib/logger.d.ts
|
|
198
|
+
- https://www.unpkg.com/@e-mc/types@0.9.19/lib/module.d.ts
|
|
199
199
|
|
|
200
200
|
* https://nodejs.org/api/perf_hooks.html
|
|
201
201
|
* https://www.npmjs.com/package/@types/bytes
|
package/constant.d.ts
CHANGED
package/index.js
CHANGED
|
@@ -205,7 +205,6 @@ function getProperties(obj, inherited, nonenumerable, symbol) {
|
|
|
205
205
|
}
|
|
206
206
|
return symbol ? attrs.concat(Object.getOwnPropertySymbols(obj)) : attrs;
|
|
207
207
|
}
|
|
208
|
-
const convertScrypt = (key, iv, data) => crypto.scryptSync(key, iv, Math.ceil(data.length / 16) * 16);
|
|
209
208
|
const isFunction = (value) => typeof value === 'function';
|
|
210
209
|
var LOG_TYPE;
|
|
211
210
|
(function (LOG_TYPE) {
|
|
@@ -947,23 +946,29 @@ function getEncoding(value, fallback = 'utf-8') {
|
|
|
947
946
|
exports.getEncoding = getEncoding;
|
|
948
947
|
function encryptUTF8(algorithm, key, iv, data, encoding = 'hex') {
|
|
949
948
|
if (checkCipherType(algorithm) && isString(data)) {
|
|
949
|
+
let result;
|
|
950
950
|
try {
|
|
951
|
-
const gcm = crypto.createCipheriv(algorithm,
|
|
952
|
-
|
|
951
|
+
const gcm = crypto.createCipheriv(algorithm, crypto.scryptSync(key, iv, 32), iv);
|
|
952
|
+
result = gcm.update(data, 'utf8', encoding);
|
|
953
|
+
result += gcm.final(encoding);
|
|
953
954
|
}
|
|
954
955
|
catch {
|
|
955
956
|
}
|
|
957
|
+
return result;
|
|
956
958
|
}
|
|
957
959
|
}
|
|
958
960
|
exports.encryptUTF8 = encryptUTF8;
|
|
959
961
|
function decryptUTF8(algorithm, key, iv, data, encoding = 'hex') {
|
|
960
962
|
if (checkCipherType(algorithm) && isString(data)) {
|
|
963
|
+
let result;
|
|
961
964
|
try {
|
|
962
|
-
const gcm = crypto.createDecipheriv(algorithm,
|
|
963
|
-
|
|
965
|
+
const gcm = crypto.createDecipheriv(algorithm, crypto.scryptSync(key, iv, 32), iv);
|
|
966
|
+
result = gcm.update(data, encoding, 'utf8');
|
|
967
|
+
result += gcm.final('utf8');
|
|
964
968
|
}
|
|
965
969
|
catch {
|
|
966
970
|
}
|
|
971
|
+
return result;
|
|
967
972
|
}
|
|
968
973
|
}
|
|
969
974
|
exports.decryptUTF8 = decryptUTF8;
|
package/lib/index.d.ts
CHANGED
|
@@ -298,7 +298,7 @@ declare namespace functions {
|
|
|
298
298
|
createServer(port: number, secure?: Null<SecureOptions>, active?: boolean): Null<ws.Server>;
|
|
299
299
|
shutdown(): void;
|
|
300
300
|
setTimeout(value: NumString): void;
|
|
301
|
-
checkTimeout(client: ws
|
|
301
|
+
checkTimeout(client: ws.WebSocket): boolean;
|
|
302
302
|
readonly prototype: IWatch<T, U, V, W>;
|
|
303
303
|
new(module?: V): IWatch<T, U, V, W>;
|
|
304
304
|
new(interval?: number, port?: number, securePort?: number, extensions?: unknown[]): IWatch<T, U, V, W>;
|
package/lib/watch.d.ts
CHANGED
|
@@ -58,8 +58,8 @@ export interface IFileGroup<T extends ExternalAsset = ExternalAsset> extends IAb
|
|
|
58
58
|
|
|
59
59
|
export interface FileGroupConstructor<T extends ExternalAsset = ExternalAsset> {
|
|
60
60
|
CONNECTION_TIMEOUT: number;
|
|
61
|
-
CLIENT_SESSION: Map<
|
|
62
|
-
checkTimeout(client: ws
|
|
61
|
+
CLIENT_SESSION: Map<ws.WebSocket, number>;
|
|
62
|
+
checkTimeout(client: ws.WebSocket): boolean;
|
|
63
63
|
cloneAsset(asset: T): T;
|
|
64
64
|
readonly prototype: IFileGroup<T>;
|
|
65
65
|
new(uri: string, assets: T[], abortable: boolean): IFileGroup<T>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@e-mc/types",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.19",
|
|
4
4
|
"description": "Type definitions for E-mc.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"types": "index.d.ts",
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"squared-functions"
|
|
18
18
|
],
|
|
19
19
|
"author": "An Pham <anpham6@gmail.com>",
|
|
20
|
-
"license": "
|
|
20
|
+
"license": "MIT",
|
|
21
21
|
"homepage": "https://github.com/anpham6/e-mc#readme",
|
|
22
22
|
"dependencies": {
|
|
23
23
|
"bytes": "^3.1.2",
|