@uploadista/flow-security-nodes 0.0.20-beta.7 → 0.0.20-beta.8

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.
@@ -1,23 +1,22 @@
1
1
 
2
2
  
3
3
  > @uploadista/flow-security-nodes@0.0.20-beta.7 build /Users/denislaboureyras/Documents/uploadista/dev/uploadista-workspace/uploadista-sdk/packages/flow/security/nodes
4
- > tsdown
4
+ > tsc --noEmit && tsdown
5
5
 
6
- ℹ tsdown v0.17.2 powered by rolldown v1.0.0-beta.53
6
+ ℹ tsdown v0.18.0 powered by rolldown v1.0.0-beta.53
7
7
  ℹ config file: /Users/denislaboureyras/Documents/uploadista/dev/uploadista-workspace/uploadista-sdk/packages/flow/security/nodes/tsdown.config.ts
8
8
  ℹ entry: src/index.ts
9
9
  ℹ tsconfig: tsconfig.json
10
10
  ℹ Build start
11
- ℹ Cleaning 7 files
12
11
  ℹ [CJS] dist/index.cjs 1.23 kB │ gzip: 0.69 kB
13
12
  ℹ [CJS] 1 files, total: 1.23 kB
14
13
  ℹ [ESM] dist/index.mjs 1.26 kB │ gzip: 0.73 kB
15
14
  ℹ [ESM] dist/index.mjs.map 5.67 kB │ gzip: 2.19 kB
16
15
  ℹ [ESM] dist/index.d.mts.map 0.54 kB │ gzip: 0.29 kB
17
- ℹ [ESM] dist/index.d.mts 3.29 kB │ gzip: 1.20 kB
16
+ ℹ [ESM] dist/index.d.mts 3.29 kB │ gzip: 1.21 kB
18
17
  ℹ [ESM] 4 files, total: 10.76 kB
19
- ✔ Build complete in 5076ms
20
18
  ℹ [CJS] dist/index.d.cts.map 0.54 kB │ gzip: 0.29 kB
21
19
  ℹ [CJS] dist/index.d.cts 3.29 kB │ gzip: 1.20 kB
22
20
  ℹ [CJS] 2 files, total: 3.83 kB
23
- ✔ Build complete in 5077ms
21
+ ✔ Build complete in 1867ms
22
+ ✔ Build complete in 1865ms
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # @uploadista/flow-security-nodes
2
2
 
3
- Security processing nodes for Uploadista Flow, including virus scanning and malware detection.
3
+ Security processing nodes for Uploadista flows. Includes virus scanning and malware detection.
4
4
 
5
5
  ## Installation
6
6
 
@@ -8,74 +8,94 @@ Security processing nodes for Uploadista Flow, including virus scanning and malw
8
8
  npm install @uploadista/flow-security-nodes
9
9
  # or
10
10
  pnpm add @uploadista/flow-security-nodes
11
- # or
12
- yarn add @uploadista/flow-security-nodes
13
11
  ```
14
12
 
15
- ## Features
13
+ ## Quick Start
16
14
 
17
- - **Virus Scanning**: Scan files for viruses and malware using pluggable antivirus engines
18
- - **Configurable Actions**: Choose to fail flow or continue with metadata on virus detection
19
- - **Effect-based**: Built on Effect-TS for type-safe, composable error handling
20
- - **Plugin Architecture**: Support for multiple antivirus engines (ClamAV, cloud services, etc.)
15
+ ```typescript
16
+ import { createScanVirusNode } from "@uploadista/flow-security-nodes";
17
+ ```
21
18
 
22
- ## Available Nodes
19
+ ## Node Types
23
20
 
24
21
  ### Scan Virus Node
25
22
 
26
- Scans files for viruses and malware. Requires a `VirusScanPlugin` implementation (e.g., `@uploadista/flow-security-clamscan`).
27
-
28
- #### Usage
23
+ Scan files for viruses and malware using ClamAV.
29
24
 
30
25
  ```typescript
31
26
  import { createScanVirusNode } from "@uploadista/flow-security-nodes";
32
- import { Effect } from "effect";
33
27
 
34
- const program = Effect.gen(function* () {
35
- // Create a scan virus node that fails on detection
36
- const scanNode = yield* createScanVirusNode("virus-scan-1", {
37
- action: "fail", // Stop flow if virus detected
38
- timeout: 60000, // 60 second timeout
39
- });
40
-
41
- // Or create a node that passes with metadata
42
- const auditNode = yield* createScanVirusNode("virus-scan-2", {
43
- action: "pass", // Continue flow even if virus detected
44
- timeout: 120000, // 2 minute timeout for large files
45
- });
28
+ // Fail flow if virus detected (recommended for production)
29
+ const scanNode = yield* createScanVirusNode("scan-1", {
30
+ action: "fail",
31
+ timeout: 60000,
32
+ });
33
+
34
+ // Continue with metadata (useful for logging/auditing)
35
+ const auditNode = yield* createScanVirusNode("scan-2", {
36
+ action: "pass",
37
+ timeout: 120000,
38
+ });
39
+
40
+ // With keepOutput option
41
+ const keepOutputNode = yield* createScanVirusNode("scan-3", {
42
+ action: "fail",
43
+ }, {
44
+ keepOutput: true,
46
45
  });
47
46
  ```
48
47
 
49
48
  #### Parameters
50
49
 
51
- - `id` (required): Unique node identifier
52
- - `params` (optional): Configuration object
53
- - `action`: `"fail"` | `"pass"` (default: `"fail"`)
54
- - `"fail"`: Mark flow task as FAILED and stop processing when virus detected
55
- - `"pass"`: Continue processing but add virus metadata to file
56
- - `timeout`: Maximum scan time in milliseconds (default: 60000, max: 300000)
50
+ | Parameter | Type | Required | Default | Description |
51
+ |-----------|------|----------|---------|-------------|
52
+ | `action` | `"fail" \| "pass"` | No | `"fail"` | Action when virus detected |
53
+ | `timeout` | `number` (1000-300000) | No | `60000` | Max scan time in milliseconds |
54
+
55
+ #### Options
57
56
 
58
- #### Scan Metadata
57
+ | Option | Type | Default | Description |
58
+ |--------|------|---------|-------------|
59
+ | `keepOutput` | `boolean` | `false` | Keep output in flow results |
60
+
61
+ #### Actions
62
+
63
+ | Action | Description |
64
+ |--------|-------------|
65
+ | `fail` | Stop flow execution when virus detected (recommended for production) |
66
+ | `pass` | Continue processing with detection metadata (useful for logging/auditing) |
67
+
68
+ #### Scan Results Metadata
59
69
 
60
70
  All scan results are stored in `file.metadata.virusScan`:
61
71
 
62
72
  ```typescript
63
73
  type VirusScanMetadata = {
64
- scanned: boolean; // Whether file was scanned
65
- isClean: boolean; // Whether file is clean (no viruses)
74
+ scanned: boolean; // Whether file was scanned
75
+ isClean: boolean; // Whether file is clean (no viruses)
66
76
  detectedViruses: string[]; // Array of detected virus names
67
- scanDate: string; // ISO 8601 timestamp
68
- engineVersion: string; // Antivirus engine version
77
+ scanDate: string; // ISO 8601 timestamp
78
+ engineVersion: string; // Antivirus engine version
69
79
  definitionsDate: string; // Virus definitions date
70
80
  };
71
81
  ```
72
82
 
73
- #### Example Flow
83
+ #### Error Codes
84
+
85
+ | Error Code | Description |
86
+ |------------|-------------|
87
+ | `VIRUS_DETECTED` | Malware found in file (when action=fail) |
88
+ | `CLAMAV_NOT_INSTALLED` | ClamAV not available on system |
89
+ | `VIRUS_SCAN_FAILED` | Generic scanning operation failure |
90
+ | `SCAN_TIMEOUT` | Scanning exceeded timeout limit |
91
+
92
+ ## Example Flow
74
93
 
75
94
  ```typescript
76
95
  import { createFlow } from "@uploadista/core/flow";
77
96
  import { createScanVirusNode } from "@uploadista/flow-security-nodes";
78
97
  import { ClamScanPluginLayer } from "@uploadista/flow-security-clamscan";
98
+ import { Effect } from "effect";
79
99
 
80
100
  const secureUploadFlow = createFlow({
81
101
  nodes: [
@@ -83,13 +103,13 @@ const secureUploadFlow = createFlow({
83
103
  createInputNode("input-1"),
84
104
 
85
105
  // 2. Scan for viruses - fail if infected
86
- createScanVirusNode("scan-1", {
106
+ yield* createScanVirusNode("scan-1", {
87
107
  action: "fail",
88
108
  timeout: 60000,
89
109
  }),
90
110
 
91
111
  // 3. Process clean files
92
- createImageResizeNode("resize-1", {
112
+ yield* createResizeNode("resize-1", {
93
113
  width: 1920,
94
114
  height: 1080,
95
115
  }),
@@ -107,22 +127,12 @@ const secureUploadFlow = createFlow({
107
127
  }).pipe(Effect.provide(ClamScanPluginLayer()));
108
128
  ```
109
129
 
110
- ## Error Codes
111
-
112
- The scan virus node may return the following error codes:
113
-
114
- - `VIRUS_DETECTED`: Virus or malware detected in file (when `action: "fail"`)
115
- - `VIRUS_SCAN_FAILED`: Generic scanning operation failure
116
- - `CLAMAV_NOT_INSTALLED`: ClamAV or configured antivirus not available
117
- - `SCAN_TIMEOUT`: Scanning exceeded timeout limit
118
-
119
130
  ## Requirements
120
131
 
121
- This package requires a `VirusScanPlugin` implementation. See [@uploadista/flow-security-clamscan](../clamscan) for ClamAV support.
122
-
123
- ## TypeScript
132
+ - **VirusScanPlugin**: Required for scanning (e.g., `@uploadista/flow-security-clamscan`)
133
+ - ClamAV installed on the system (daemon or binary)
124
134
 
125
- This package is written in TypeScript and includes full type definitions.
135
+ See [@uploadista/flow-security-clamscan](../clamscan) for ClamAV plugin setup.
126
136
 
127
137
  ## License
128
138
 
package/dist/index.d.cts CHANGED
@@ -83,7 +83,7 @@ declare function createScanVirusNode(id: string, params?: ScanVirusParams, optio
83
83
  circuitBreaker?: _uploadista_core_flow0.FlowCircuitBreakerConfig;
84
84
  } & {
85
85
  type: _uploadista_core_flow0.NodeType;
86
- }, _uploadista_core_errors0.UploadistaError, VirusScanPlugin | _uploadista_core_upload0.UploadServer>;
86
+ }, _uploadista_core_errors0.UploadistaError, VirusScanPlugin | _uploadista_core_upload0.UploadEngine>;
87
87
  //#endregion
88
88
  export { ScanAction, type ScanAction as ScanActionType, type ScanMetadata, type ScanResult, ScanVirusParams, type ScanVirusParams as ScanVirusParamsType, createScanVirusNode };
89
89
  //# sourceMappingURL=index.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.cts","names":[],"sources":["../src/scan-virus-node.ts"],"sourcesContent":[],"mappings":";;;;;;;;;;;;cAaa,YAAU,CAAA,CAAA;;;AAAvB,CAAA,CAAA;AACY,KAAA,UAAA,GAAa,CAAA,CAAE,KAAa,CAAA,OAAA,UAAR,CAAA;AAKhC;;;cAAa,iBAAe,CAAA,CAAA;;;;EAAA,CAAA,CAAA,CAAA;EAAA,OAAA,cAAA,cAAA,YAAA,CAAA,CAAA;AAgB5B,CAAA,eAAY,CAAA;AA8BI,KA9BJ,eAAA,GAAkB,CAAA,CAAE,KA8BG,CAAA,OA9BU,eA8BV,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAAnB,mBAAA,sBAEN;;IAC0B,MAAA,CAAA,OAD0B,sBAAA,CAC1B,YAAA;yBAAA,uBAAA,CAAA,UAAA;;;;;;;aAqEug8L;;iEAAA,uBAAA,CAAA,UAAA"}
1
+ {"version":3,"file":"index.d.cts","names":[],"sources":["../src/scan-virus-node.ts"],"sourcesContent":[],"mappings":";;;;;;;;;;;;cAaa,YAAU,CAAA,CAAA;;;AAAvB,CAAA,CAAA;AACY,KAAA,UAAA,GAAa,CAAA,CAAE,KAAa,CAAA,OAAA,UAAR,CAAA;AAKhC;;;cAAa,iBAAe,CAAA,CAAA;;;;EAAA,CAAA,CAAA,CAAA;EAAA,OAAA,cAAA,cAAA,YAAA,CAAA,CAAA;AAgB5B,CAAA,eAAY,CAAA;AA8BI,KA9BJ,eAAA,GAAkB,CAAA,CAAE,KA8BG,CAAA,OA9BU,eA8BV,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAAnB,mBAAA,sBAEN;;IAC0B,MAAA,CAAA,OAD0B,sBAAA,CAC1B,YAAA;yBAAA,uBAAA,CAAA,UAAA;;;;;;;aAqE2l1M;;iEAAA,uBAAA,CAAA,UAAA"}
package/dist/index.d.mts CHANGED
@@ -83,7 +83,7 @@ declare function createScanVirusNode(id: string, params?: ScanVirusParams, optio
83
83
  circuitBreaker?: _uploadista_core_flow0.FlowCircuitBreakerConfig;
84
84
  } & {
85
85
  type: _uploadista_core_flow0.NodeType;
86
- }, _uploadista_core_errors0.UploadistaError, VirusScanPlugin | _uploadista_core_upload0.UploadServer>;
86
+ }, _uploadista_core_errors0.UploadistaError, VirusScanPlugin | _uploadista_core_upload0.UploadEngine>;
87
87
  //#endregion
88
88
  export { ScanAction, type ScanAction as ScanActionType, type ScanMetadata, type ScanResult, ScanVirusParams, type ScanVirusParams as ScanVirusParamsType, createScanVirusNode };
89
89
  //# sourceMappingURL=index.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.mts","names":[],"sources":["../src/scan-virus-node.ts"],"sourcesContent":[],"mappings":";;;;;;;;;;;;cAaa,YAAU,CAAA,CAAA;;;AAAvB,CAAA,CAAA;AACY,KAAA,UAAA,GAAa,CAAA,CAAE,KAAa,CAAA,OAAA,UAAR,CAAA;AAKhC;;;cAAa,iBAAe,CAAA,CAAA;;;;EAAA,CAAA,CAAA,CAAA;EAAA,OAAA,cAAA,cAAA,YAAA,CAAA,CAAA;AAgB5B,CAAA,eAAY,CAAA;AA8BI,KA9BJ,eAAA,GAAkB,CAAA,CAAE,KA8BG,CAAA,OA9BU,eA8BV,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAAnB,mBAAA,sBAEN;;IAC0B,MAAA,CAAA,OAD0B,sBAAA,CAC1B,YAAA;yBAAA,uBAAA,CAAA,UAAA;;;;;;;aAqEug8L;;iEAAA,uBAAA,CAAA,UAAA"}
1
+ {"version":3,"file":"index.d.mts","names":[],"sources":["../src/scan-virus-node.ts"],"sourcesContent":[],"mappings":";;;;;;;;;;;;cAaa,YAAU,CAAA,CAAA;;;AAAvB,CAAA,CAAA;AACY,KAAA,UAAA,GAAa,CAAA,CAAE,KAAa,CAAA,OAAA,UAAR,CAAA;AAKhC;;;cAAa,iBAAe,CAAA,CAAA;;;;EAAA,CAAA,CAAA,CAAA;EAAA,OAAA,cAAA,cAAA,YAAA,CAAA,CAAA;AAgB5B,CAAA,eAAY,CAAA;AA8BI,KA9BJ,eAAA,GAAkB,CAAA,CAAE,KA8BG,CAAA,OA9BU,eA8BV,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAAnB,mBAAA,sBAEN;;IAC0B,MAAA,CAAA,OAD0B,sBAAA,CAC1B,YAAA;yBAAA,uBAAA,CAAA,UAAA;;;;;;;aAqE2l1M;;iEAAA,uBAAA,CAAA,UAAA"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@uploadista/flow-security-nodes",
3
3
  "type": "module",
4
- "version": "0.0.20-beta.7",
4
+ "version": "0.0.20-beta.8",
5
5
  "description": "Security processing nodes for Uploadista Flow",
6
6
  "license": "MIT",
7
7
  "author": "Uploadista",
@@ -14,7 +14,7 @@
14
14
  }
15
15
  },
16
16
  "dependencies": {
17
- "@uploadista/core": "0.0.20-beta.7"
17
+ "@uploadista/core": "0.0.20-beta.8"
18
18
  },
19
19
  "peerDependencies": {
20
20
  "effect": "^3.0.0",
@@ -22,15 +22,15 @@
22
22
  },
23
23
  "devDependencies": {
24
24
  "@effect/vitest": "0.27.0",
25
- "@types/node": "24.10.3",
26
- "effect": "3.19.11",
27
- "tsdown": "0.17.2",
25
+ "@types/node": "24.10.4",
26
+ "effect": "3.19.12",
27
+ "tsdown": "0.18.0",
28
28
  "vitest": "4.0.15",
29
- "zod": "4.1.13",
30
- "@uploadista/typescript-config": "0.0.20-beta.7"
29
+ "zod": "4.2.0",
30
+ "@uploadista/typescript-config": "0.0.20-beta.8"
31
31
  },
32
32
  "scripts": {
33
- "build": "tsdown",
33
+ "build": "tsc --noEmit && tsdown",
34
34
  "format": "biome format --write ./src",
35
35
  "lint": "biome lint --write ./src",
36
36
  "check": "biome check --write ./src",