@venizia/ignis-helpers 0.0.1-2 → 0.0.1-4
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.md +102 -0
- package/README.md +43 -0
- package/dist/common/constants/app.d.ts +1 -1
- package/dist/common/constants/app.js +8 -8
- package/dist/common/constants/http.d.ts +1 -1
- package/dist/common/constants/http.js +13 -13
- package/dist/common/constants/index.d.ts +3 -3
- package/dist/common/constants/mime.d.ts +1 -1
- package/dist/common/constants/mime.js +4 -4
- package/dist/common/index.d.ts +2 -2
- package/dist/common/types.d.ts +13 -13
- package/dist/common/types.js +2 -2
- package/dist/helpers/base.d.ts +1 -1
- package/dist/helpers/base.js +3 -3
- package/dist/helpers/cron/cron.helper.d.ts +2 -2
- package/dist/helpers/cron/cron.helper.js +2 -2
- package/dist/helpers/cron/index.d.ts +1 -1
- package/dist/helpers/crypto/algorithms/aes.algorithm.d.ts +3 -3
- package/dist/helpers/crypto/algorithms/aes.algorithm.js +10 -10
- package/dist/helpers/crypto/algorithms/base.algorithm.d.ts +2 -2
- package/dist/helpers/crypto/algorithms/base.algorithm.js +1 -1
- package/dist/helpers/crypto/algorithms/index.d.ts +3 -3
- package/dist/helpers/crypto/algorithms/rsa.algorithm.d.ts +3 -3
- package/dist/helpers/crypto/algorithms/rsa.algorithm.js +10 -10
- package/dist/helpers/crypto/common/index.d.ts +2 -2
- package/dist/helpers/crypto/index.d.ts +2 -2
- package/dist/helpers/env/app-env.d.ts +1 -1
- package/dist/helpers/env/app-env.js +9 -9
- package/dist/helpers/env/index.d.ts +2 -2
- package/dist/helpers/error/app-error.d.ts +1 -1
- package/dist/helpers/error/index.d.ts +2 -2
- package/dist/helpers/error/types.d.ts +1 -1
- package/dist/helpers/error/types.js +5 -5
- package/dist/helpers/index.d.ts +14 -14
- package/dist/helpers/inversion/common/index.d.ts +2 -2
- package/dist/helpers/inversion/common/keys.js +6 -6
- package/dist/helpers/inversion/common/types.d.ts +4 -4
- package/dist/helpers/inversion/container.d.ts +2 -2
- package/dist/helpers/inversion/index.d.ts +4 -4
- package/dist/helpers/inversion/registry.d.ts +2 -2
- package/dist/helpers/logger/application-logger.d.ts +2 -2
- package/dist/helpers/logger/application-logger.js +8 -8
- package/dist/helpers/logger/default-logger.d.ts +3 -3
- package/dist/helpers/logger/default-logger.js +23 -23
- package/dist/helpers/logger/factory.d.ts +1 -1
- package/dist/helpers/logger/factory.js +1 -1
- package/dist/helpers/logger/index.d.ts +5 -5
- package/dist/helpers/logger/transports/dgram.transport.d.ts +2 -2
- package/dist/helpers/logger/transports/dgram.transport.js +5 -5
- package/dist/helpers/logger/transports/index.d.ts +1 -1
- package/dist/helpers/logger/types.d.ts +1 -1
- package/dist/helpers/logger/types.js +9 -9
- package/dist/helpers/network/http-request/base-network-request.helper.d.ts +12 -12
- package/dist/helpers/network/http-request/base-network-request.helper.js +10 -10
- package/dist/helpers/network/http-request/fetcher/axios-fetcher.d.ts +5 -5
- package/dist/helpers/network/http-request/fetcher/axios-fetcher.js +5 -5
- package/dist/helpers/network/http-request/fetcher/base-fetcher.d.ts +1 -1
- package/dist/helpers/network/http-request/fetcher/base-fetcher.js +8 -8
- package/dist/helpers/network/http-request/fetcher/index.d.ts +3 -3
- package/dist/helpers/network/http-request/fetcher/node-fetcher.d.ts +2 -2
- package/dist/helpers/network/http-request/fetcher/node-fetcher.js +6 -6
- package/dist/helpers/network/http-request/index.d.ts +2 -2
- package/dist/helpers/network/http-request/types.d.ts +4 -4
- package/dist/helpers/network/index.d.ts +3 -3
- package/dist/helpers/network/tcp-socket/base-tcp-client.helper.d.ts +4 -4
- package/dist/helpers/network/tcp-socket/base-tcp-client.helper.js +17 -17
- package/dist/helpers/network/tcp-socket/base-tcp-server.helper.d.ts +6 -6
- package/dist/helpers/network/tcp-socket/base-tcp-server.helper.js +18 -18
- package/dist/helpers/network/tcp-socket/index.d.ts +6 -6
- package/dist/helpers/network/tcp-socket/network-tcp-client.helper.d.ts +4 -4
- package/dist/helpers/network/tcp-socket/network-tcp-server.helper.d.ts +4 -4
- package/dist/helpers/network/tcp-socket/network-tls-tcp-client.helper.d.ts +4 -4
- package/dist/helpers/network/tcp-socket/network-tls-tcp-server.helper.d.ts +4 -4
- package/dist/helpers/network/udp-socket/index.d.ts +1 -1
- package/dist/helpers/network/udp-socket/network-udp-client.helper.d.ts +3 -3
- package/dist/helpers/network/udp-socket/network-udp-client.helper.js +14 -14
- package/dist/helpers/queue/bullmq/helper.d.ts +4 -4
- package/dist/helpers/queue/bullmq/helper.js +10 -10
- package/dist/helpers/queue/bullmq/index.d.ts +1 -1
- package/dist/helpers/queue/common/index.d.ts +1 -1
- package/dist/helpers/queue/common/types.d.ts +1 -1
- package/dist/helpers/queue/index.d.ts +4 -4
- package/dist/helpers/queue/internal/helper.d.ts +3 -3
- package/dist/helpers/queue/internal/helper.js +11 -11
- package/dist/helpers/queue/internal/index.d.ts +1 -1
- package/dist/helpers/queue/mqtt/helper.d.ts +2 -2
- package/dist/helpers/queue/mqtt/helper.js +8 -8
- package/dist/helpers/queue/mqtt/index.d.ts +1 -1
- package/dist/helpers/redis/cluster.helper.d.ts +3 -3
- package/dist/helpers/redis/default.helper.d.ts +3 -3
- package/dist/helpers/redis/default.helper.js +40 -40
- package/dist/helpers/redis/index.d.ts +4 -4
- package/dist/helpers/redis/single.helper.d.ts +3 -3
- package/dist/helpers/redis/types.d.ts +3 -3
- package/dist/helpers/socket-io/client/helper.d.ts +3 -3
- package/dist/helpers/socket-io/client/helper.js +8 -8
- package/dist/helpers/socket-io/client/index.d.ts +1 -1
- package/dist/helpers/socket-io/common/constants.js +10 -10
- package/dist/helpers/socket-io/common/index.d.ts +2 -2
- package/dist/helpers/socket-io/common/types.d.ts +6 -6
- package/dist/helpers/socket-io/index.d.ts +3 -3
- package/dist/helpers/socket-io/server/helper.d.ts +3 -3
- package/dist/helpers/socket-io/server/helper.js +41 -41
- package/dist/helpers/socket-io/server/index.d.ts +1 -1
- package/dist/helpers/storage/in-memory/helper.d.ts +2 -2
- package/dist/helpers/storage/in-memory/index.d.ts +1 -1
- package/dist/helpers/storage/index.d.ts +2 -2
- package/dist/helpers/storage/minio/helper.d.ts +3 -3
- package/dist/helpers/storage/minio/helper.js +7 -7
- package/dist/helpers/storage/minio/index.d.ts +1 -1
- package/dist/helpers/testing/base-test-plan.d.ts +2 -2
- package/dist/helpers/testing/base-test-plan.js +4 -4
- package/dist/helpers/testing/common/constants.d.ts +1 -1
- package/dist/helpers/testing/common/constants.js +3 -3
- package/dist/helpers/testing/common/index.d.ts +2 -2
- package/dist/helpers/testing/common/types.d.ts +3 -3
- package/dist/helpers/testing/describe.d.ts +2 -2
- package/dist/helpers/testing/describe.js +5 -5
- package/dist/helpers/testing/index.d.ts +6 -6
- package/dist/helpers/testing/test-case.d.ts +3 -3
- package/dist/helpers/testing/test-case.js +1 -1
- package/dist/helpers/testing/test-handler.d.ts +3 -3
- package/dist/helpers/testing/test-handler.js +2 -2
- package/dist/helpers/testing/test-plan.d.ts +2 -2
- package/dist/helpers/worker-thread/base.d.ts +6 -6
- package/dist/helpers/worker-thread/base.js +15 -15
- package/dist/helpers/worker-thread/base.js.map +1 -1
- package/dist/helpers/worker-thread/index.d.ts +4 -4
- package/dist/helpers/worker-thread/types.d.ts +2 -2
- package/dist/helpers/worker-thread/worker-bus.d.ts +4 -4
- package/dist/helpers/worker-thread/worker-bus.d.ts.map +1 -1
- package/dist/helpers/worker-thread/worker-bus.js +14 -9
- package/dist/helpers/worker-thread/worker-bus.js.map +1 -1
- package/dist/helpers/worker-thread/worker-pool.d.ts +2 -2
- package/dist/helpers/worker-thread/worker-pool.js +6 -6
- package/dist/index.d.ts +4 -4
- package/dist/utilities/crypto.utility.d.ts +1 -1
- package/dist/utilities/crypto.utility.js +2 -2
- package/dist/utilities/date.utility.d.ts +1 -1
- package/dist/utilities/date.utility.js +6 -6
- package/dist/utilities/index.d.ts +7 -7
- package/dist/utilities/module.utility.js +2 -2
- package/dist/utilities/parse.utility.js +18 -18
- package/dist/utilities/performance.utility.d.ts +1 -1
- package/dist/utilities/performance.utility.js +5 -5
- package/dist/utilities/promise.utility.d.ts +1 -1
- package/dist/utilities/promise.utility.js +3 -3
- package/dist/utilities/request.utility.d.ts +1 -1
- package/dist/utilities/request.utility.js +7 -7
- package/package.json +23 -29
|
@@ -8,14 +8,14 @@ const error_1 = require("../helpers/error");
|
|
|
8
8
|
const node_fs_1 = __importDefault(require("node:fs"));
|
|
9
9
|
const node_path_1 = __importDefault(require("node:path"));
|
|
10
10
|
const parseMultipartBody = async (opts) => {
|
|
11
|
-
const { storage =
|
|
12
|
-
if (storage ===
|
|
11
|
+
const { storage = 'memory', uploadDir = './uploads', context } = opts;
|
|
12
|
+
if (storage === 'disk' && !node_fs_1.default.existsSync(uploadDir)) {
|
|
13
13
|
node_fs_1.default.mkdirSync(uploadDir, { recursive: true });
|
|
14
14
|
}
|
|
15
15
|
const formData = await context.req.formData();
|
|
16
16
|
const files = [];
|
|
17
17
|
for (const [fieldname, value] of formData.entries()) {
|
|
18
|
-
if (typeof value ===
|
|
18
|
+
if (typeof value === 'string') {
|
|
19
19
|
continue;
|
|
20
20
|
}
|
|
21
21
|
const file = value;
|
|
@@ -24,21 +24,21 @@ const parseMultipartBody = async (opts) => {
|
|
|
24
24
|
const parsedFile = {
|
|
25
25
|
fieldname,
|
|
26
26
|
originalname: file.name,
|
|
27
|
-
encoding:
|
|
27
|
+
encoding: 'utf8', // Default encoding
|
|
28
28
|
mimetype: file.type,
|
|
29
29
|
size: file.size,
|
|
30
30
|
};
|
|
31
31
|
switch (storage) {
|
|
32
|
-
case
|
|
32
|
+
case 'memory': {
|
|
33
33
|
parsedFile.buffer = buffer;
|
|
34
34
|
break;
|
|
35
35
|
}
|
|
36
|
-
case
|
|
36
|
+
case 'disk': {
|
|
37
37
|
// Store on disk (like multer.diskStorage())
|
|
38
38
|
const timestamp = Date.now();
|
|
39
39
|
const randomString = Math.random().toString(36).substring(7);
|
|
40
40
|
// Sanitize filename to prevent path traversal
|
|
41
|
-
const sanitizedName = node_path_1.default.basename(file.name).replace(/[^a-zA-Z0-9._-]/g,
|
|
41
|
+
const sanitizedName = node_path_1.default.basename(file.name).replace(/[^a-zA-Z0-9._-]/g, '_');
|
|
42
42
|
const filename = `${timestamp}-${randomString}-${sanitizedName}`;
|
|
43
43
|
const filepath = node_path_1.default.join(uploadDir, filename);
|
|
44
44
|
node_fs_1.default.writeFileSync(filepath, buffer);
|
package/package.json
CHANGED
|
@@ -1,29 +1,27 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@venizia/ignis-helpers",
|
|
3
|
-
"version": "0.0.1-
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "0.0.1-4",
|
|
4
|
+
"description": "Utility helpers for the Ignis Framework - logging, cron, Redis, queues, storage, and more",
|
|
5
5
|
"keywords": [
|
|
6
|
-
"
|
|
7
|
-
"
|
|
8
|
-
"
|
|
9
|
-
"
|
|
10
|
-
"
|
|
11
|
-
"
|
|
12
|
-
"
|
|
13
|
-
"
|
|
14
|
-
"
|
|
6
|
+
"helpers",
|
|
7
|
+
"utilities",
|
|
8
|
+
"logging",
|
|
9
|
+
"winston",
|
|
10
|
+
"cron",
|
|
11
|
+
"redis",
|
|
12
|
+
"ioredis",
|
|
13
|
+
"queue",
|
|
14
|
+
"bullmq",
|
|
15
|
+
"storage",
|
|
16
|
+
"minio",
|
|
17
|
+
"s3",
|
|
18
|
+
"mqtt",
|
|
19
|
+
"socket.io",
|
|
15
20
|
"venizia",
|
|
16
|
-
"
|
|
17
|
-
"infra",
|
|
21
|
+
"ignis",
|
|
18
22
|
"bun",
|
|
19
23
|
"nodejs",
|
|
20
|
-
"
|
|
21
|
-
"class-based",
|
|
22
|
-
"framework",
|
|
23
|
-
"dependency injection",
|
|
24
|
-
"backend framework",
|
|
25
|
-
"nodejs framework",
|
|
26
|
-
"web framework"
|
|
24
|
+
"typescript"
|
|
27
25
|
],
|
|
28
26
|
"exports": {
|
|
29
27
|
".": {
|
|
@@ -34,7 +32,7 @@
|
|
|
34
32
|
},
|
|
35
33
|
"files": [
|
|
36
34
|
"README.md",
|
|
37
|
-
"LICENSE",
|
|
35
|
+
"LICENSE.md",
|
|
38
36
|
"dist",
|
|
39
37
|
"!/**/tests",
|
|
40
38
|
"!/**/dist/tests",
|
|
@@ -55,17 +53,12 @@
|
|
|
55
53
|
"prettier:cli": "prettier \"**/*.{js,ts}\" -l",
|
|
56
54
|
"prettier:fix": "bun run prettier:cli --write",
|
|
57
55
|
"rebuild": "sh ./scripts/rebuild.sh no-version",
|
|
58
|
-
"
|
|
59
|
-
"rebuild:minor": "sh ./scripts/rebuild.sh minor",
|
|
60
|
-
"rebuild:patch": "sh ./scripts/rebuild.sh patch",
|
|
61
|
-
"rebuild:premajor": "sh ./scripts/rebuild.sh premajor",
|
|
62
|
-
"rebuild:preminor": "sh ./scripts/rebuild.sh preminor",
|
|
63
|
-
"rebuild:prepatch": "sh ./scripts/rebuild.sh prepatch",
|
|
64
|
-
"rebuild:prerelease": "sh ./scripts/rebuild.sh prerelease"
|
|
56
|
+
"prepublishOnly": "bun run rebuild"
|
|
65
57
|
},
|
|
66
58
|
"repository": {
|
|
67
59
|
"type": "git",
|
|
68
|
-
"url": "git+https://github.com/VENIZIA-AI/ignis.git"
|
|
60
|
+
"url": "git+https://github.com/VENIZIA-AI/ignis.git",
|
|
61
|
+
"directory": "packages/helpers"
|
|
69
62
|
},
|
|
70
63
|
"author": {
|
|
71
64
|
"name": "VENIZIA AI Developer",
|
|
@@ -115,6 +108,7 @@
|
|
|
115
108
|
"@hono/zod-openapi": "^1.1.5",
|
|
116
109
|
"@types/bun": "^1.3.4",
|
|
117
110
|
"@types/lodash": "^4.17.20",
|
|
111
|
+
"@types/node": "^25.0.0",
|
|
118
112
|
"@venizia/dev-configs": "latest",
|
|
119
113
|
"eslint": "^9.36.0",
|
|
120
114
|
"prettier": "^3.6.2",
|