@plyaz/types 1.15.20 → 1.16.0
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/dist/api/aws/index.d.ts +5 -0
- package/dist/api/aws/signature.d.ts +42 -0
- package/dist/api/endpoints/cdn/endpoints.d.ts +57 -0
- package/dist/api/endpoints/cdn/index.d.ts +6 -0
- package/dist/api/endpoints/cdn/types.d.ts +151 -0
- package/dist/api/endpoints/index.d.ts +2 -0
- package/dist/api/endpoints/types.d.ts +3 -1
- package/dist/api/endpoints/virustotal/endpoints.d.ts +37 -0
- package/dist/api/endpoints/virustotal/index.d.ts +6 -0
- package/dist/api/endpoints/virustotal/types.d.ts +202 -0
- package/dist/api/index.cjs +1317 -1
- package/dist/api/index.cjs.map +1 -1
- package/dist/api/index.d.ts +3 -0
- package/dist/api/index.js +1317 -1
- package/dist/api/index.js.map +1 -1
- package/dist/core/idempotency.d.ts +48 -0
- package/dist/core/index.d.ts +1 -0
- package/dist/errors/codes.d.ts +296 -0
- package/dist/errors/enums.d.ts +10 -0
- package/dist/errors/index.cjs +1482 -1
- package/dist/errors/index.cjs.map +1 -1
- package/dist/errors/index.d.ts +1 -0
- package/dist/errors/index.js +1482 -2
- package/dist/errors/index.js.map +1 -1
- package/dist/errors/validation.d.ts +71 -0
- package/dist/index.cjs +2268 -132
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +11 -0
- package/dist/index.js +2227 -133
- package/dist/index.js.map +1 -1
- package/dist/logger/enums.d.ts +10 -0
- package/dist/notifications/types.d.ts +1 -2
- package/dist/storage/compliance.d.ts +247 -0
- package/dist/storage/enums.d.ts +527 -0
- package/dist/storage/event-handler-mapping.d.ts +69 -0
- package/dist/storage/index.d.ts +13 -0
- package/dist/storage/interfaces.d.ts +2242 -0
- package/dist/storage/plugins.d.ts +996 -0
- package/dist/storage/schemas.d.ts +224 -0
- package/dist/storage/webhooks.d.ts +340 -0
- package/package.json +6 -1
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AWS Signature V4 Type Definitions
|
|
3
|
+
* Types for AWS authentication and signing
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Options for generating AWS Signature Version 4
|
|
7
|
+
*/
|
|
8
|
+
export interface AWSSignatureV4Options {
|
|
9
|
+
/** AWS Access Key ID */
|
|
10
|
+
accessKeyId: string;
|
|
11
|
+
/** AWS Secret Access Key */
|
|
12
|
+
secretAccessKey: string;
|
|
13
|
+
/** AWS Session Token (optional, for temporary credentials) */
|
|
14
|
+
sessionToken?: string;
|
|
15
|
+
/** AWS Region (e.g., 'us-east-1') */
|
|
16
|
+
region: string;
|
|
17
|
+
/** AWS Service name (e.g., 'cloudfront', 's3') */
|
|
18
|
+
service: string;
|
|
19
|
+
/** HTTP method (e.g., 'GET', 'POST') */
|
|
20
|
+
method: string;
|
|
21
|
+
/** Request path (e.g., '/2020-05-31/distribution/E1234/invalidation') */
|
|
22
|
+
path: string;
|
|
23
|
+
/** Query string (optional, e.g., 'key1=value1&key2=value2') */
|
|
24
|
+
queryString?: string;
|
|
25
|
+
/** Additional headers to include in signature */
|
|
26
|
+
headers: Record<string, string>;
|
|
27
|
+
/** Request body/payload */
|
|
28
|
+
payload: string;
|
|
29
|
+
/** ISO 8601 timestamp (optional, auto-generated if not provided) */
|
|
30
|
+
timestamp?: string;
|
|
31
|
+
/** Host header (e.g., 'cloudfront.amazonaws.com') - Required for AWS Signature V4 */
|
|
32
|
+
host: string;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Result of AWS Signature V4 generation
|
|
36
|
+
*/
|
|
37
|
+
export interface AWSSignatureV4Result {
|
|
38
|
+
/** Signed headers including Host, X-Amz-Date, and optionally X-Amz-Security-Token */
|
|
39
|
+
headers: Record<string, string>;
|
|
40
|
+
/** Authorization header value with signature */
|
|
41
|
+
authorization: string;
|
|
42
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CDN Provider Endpoint Type Definitions
|
|
3
|
+
*
|
|
4
|
+
* This file contains endpoint type definitions for CDN cache invalidation operations:
|
|
5
|
+
* - Cloudflare cache purging
|
|
6
|
+
* - AWS CloudFront invalidation
|
|
7
|
+
* - Fastly URL purging
|
|
8
|
+
*
|
|
9
|
+
* @see ./types.ts
|
|
10
|
+
*/
|
|
11
|
+
import type { Endpoint, Req } from 'fetchff';
|
|
12
|
+
import type { CloudflarePurgeCacheRequest, CloudflarePurgeCacheResponse, CloudFrontInvalidationRequest, CloudFrontInvalidationResponse, FastlyPurgeUrlRequest, FastlyPurgeUrlResponse } from './types';
|
|
13
|
+
/**
|
|
14
|
+
* Cloudflare CDN endpoint types
|
|
15
|
+
* Cache purging endpoints for Cloudflare
|
|
16
|
+
*/
|
|
17
|
+
export interface CloudflareEndpointTypes {
|
|
18
|
+
/**
|
|
19
|
+
* POST /zones/:zoneId/purge_cache - Purge files from cache
|
|
20
|
+
* Zone-based cache purging with URL list
|
|
21
|
+
*/
|
|
22
|
+
cloudflarePurgeCache: Endpoint<Req<CloudflarePurgeCacheResponse, CloudflarePurgeCacheRequest>>;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* CloudFront CDN endpoint types
|
|
26
|
+
* Note: CloudFront uses AWS SDK, not REST endpoints
|
|
27
|
+
*/
|
|
28
|
+
export interface CloudFrontEndpointTypes {
|
|
29
|
+
/**
|
|
30
|
+
* CloudFront CreateInvalidation (AWS SDK)
|
|
31
|
+
* Creates invalidation batch for specified paths
|
|
32
|
+
*/
|
|
33
|
+
cloudFrontCreateInvalidation: Endpoint<Req<CloudFrontInvalidationResponse, CloudFrontInvalidationRequest>>;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Fastly CDN endpoint types
|
|
37
|
+
* URL-based cache purging for Fastly
|
|
38
|
+
*/
|
|
39
|
+
export interface FastlyEndpointTypes {
|
|
40
|
+
/**
|
|
41
|
+
* POST /service/:serviceId/purge/:url - Purge single URL
|
|
42
|
+
* Instant soft-purge of specific URL
|
|
43
|
+
*/
|
|
44
|
+
fastlyPurgeUrl: Endpoint<Req<FastlyPurgeUrlResponse, FastlyPurgeUrlRequest>>;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* All CDN endpoint types combined
|
|
48
|
+
*/
|
|
49
|
+
export interface CDNEndpointTypes extends CloudflareEndpointTypes, CloudFrontEndpointTypes, FastlyEndpointTypes {
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Type guards to check if an endpoint key is valid
|
|
53
|
+
*/
|
|
54
|
+
export type CloudflareEndpointKey = keyof CloudflareEndpointTypes;
|
|
55
|
+
export type CloudFrontEndpointKey = keyof CloudFrontEndpointTypes;
|
|
56
|
+
export type FastlyEndpointKey = keyof FastlyEndpointTypes;
|
|
57
|
+
export type CDNEndpointKey = keyof CDNEndpointTypes;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CDN Provider Types Export
|
|
3
|
+
* Aggregates all CDN-related type definitions
|
|
4
|
+
*/
|
|
5
|
+
export type { CloudflareEndpointTypes, CloudFrontEndpointTypes, FastlyEndpointTypes, CDNEndpointTypes, CloudflareEndpointKey, CloudFrontEndpointKey, FastlyEndpointKey, CDNEndpointKey, } from './endpoints';
|
|
6
|
+
export type { CloudflarePurgeCacheRequest, CloudflarePurgeCacheBody, CloudflarePurgeCacheResponse, CloudFrontInvalidationRequest, CloudFrontInvalidationResponse, FastlyPurgeUrlRequest, FastlyPurgeUrlResponse, CDNInvalidationRequest, CDNInvalidationResponse, } from './types';
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CDN Provider API Type Definitions
|
|
3
|
+
*
|
|
4
|
+
* Types for CDN cache invalidation operations:
|
|
5
|
+
* - Cloudflare cache purging
|
|
6
|
+
* - AWS CloudFront invalidation
|
|
7
|
+
* - Fastly URL purging
|
|
8
|
+
*
|
|
9
|
+
* Based on Cloudflare API v4, AWS CloudFront API, and Fastly API specifications
|
|
10
|
+
* @see https://developers.cloudflare.com/api/operations/zone-purge
|
|
11
|
+
* @see https://docs.aws.amazon.com/cloudfront/latest/APIReference/API_CreateInvalidation.html
|
|
12
|
+
* @see https://developer.fastly.com/reference/api/purging/
|
|
13
|
+
*/
|
|
14
|
+
/**
|
|
15
|
+
* Cloudflare cache purge request (service function payload)
|
|
16
|
+
* POST /zones/{zoneId}/purge_cache
|
|
17
|
+
*/
|
|
18
|
+
export interface CloudflarePurgeCacheRequest {
|
|
19
|
+
/** Zone ID to purge cache for */
|
|
20
|
+
zoneId: string;
|
|
21
|
+
/** Cloudflare API Token with Cache Purge permission */
|
|
22
|
+
apiToken: string;
|
|
23
|
+
/** List of fully qualified URLs to purge */
|
|
24
|
+
files: string[];
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Cloudflare cache purge body (HTTP request body)
|
|
28
|
+
*/
|
|
29
|
+
export interface CloudflarePurgeCacheBody {
|
|
30
|
+
/** List of fully qualified URLs to purge */
|
|
31
|
+
files: string[];
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Cloudflare cache purge response
|
|
35
|
+
*/
|
|
36
|
+
export interface CloudflarePurgeCacheResponse {
|
|
37
|
+
/** Success status */
|
|
38
|
+
success: boolean;
|
|
39
|
+
/** Error messages (if any) */
|
|
40
|
+
errors?: Array<{
|
|
41
|
+
code: number;
|
|
42
|
+
message: string;
|
|
43
|
+
}>;
|
|
44
|
+
/** Purge result */
|
|
45
|
+
result?: {
|
|
46
|
+
/** Purge ID for tracking */
|
|
47
|
+
id: string;
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* CloudFront invalidation request (service function payload)
|
|
52
|
+
* POST /2020-05-31/distribution/{distributionId}/invalidation
|
|
53
|
+
*/
|
|
54
|
+
export interface CloudFrontInvalidationRequest {
|
|
55
|
+
/** CloudFront Distribution ID */
|
|
56
|
+
distributionId: string;
|
|
57
|
+
/** AWS Access Key ID (for AWS Signature V4) */
|
|
58
|
+
accessKeyId: string;
|
|
59
|
+
/** AWS Secret Access Key (for AWS Signature V4) */
|
|
60
|
+
secretAccessKey: string;
|
|
61
|
+
/** AWS Region (default: us-east-1) */
|
|
62
|
+
region?: string;
|
|
63
|
+
/** AWS Session Token (optional, for temporary credentials) */
|
|
64
|
+
sessionToken?: string;
|
|
65
|
+
/** List of paths to invalidate (e.g., ['/images/*', '/styles/main.css']) */
|
|
66
|
+
paths: string[];
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* CloudFront invalidation body (HTTP request body - XML format)
|
|
70
|
+
* Note: This is converted to XML in the service function
|
|
71
|
+
*/
|
|
72
|
+
export interface CloudFrontInvalidationBody {
|
|
73
|
+
/** Paths to invalidate */
|
|
74
|
+
Paths: {
|
|
75
|
+
Quantity: number;
|
|
76
|
+
Items: string[];
|
|
77
|
+
};
|
|
78
|
+
/** Unique caller reference (timestamp-based) */
|
|
79
|
+
CallerReference: string;
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* CloudFront invalidation response (XML parsed to JSON)
|
|
83
|
+
*/
|
|
84
|
+
export interface CloudFrontInvalidationResponse {
|
|
85
|
+
/** Invalidation details */
|
|
86
|
+
Invalidation?: {
|
|
87
|
+
/** Unique invalidation ID */
|
|
88
|
+
Id: string;
|
|
89
|
+
/** Invalidation status (InProgress, Completed) */
|
|
90
|
+
Status: string;
|
|
91
|
+
/** Creation time */
|
|
92
|
+
CreateTime: string;
|
|
93
|
+
/** Invalidation batch details */
|
|
94
|
+
InvalidationBatch: {
|
|
95
|
+
Paths: {
|
|
96
|
+
Quantity: number;
|
|
97
|
+
Items: string[];
|
|
98
|
+
};
|
|
99
|
+
CallerReference: string;
|
|
100
|
+
};
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Fastly URL purge request
|
|
105
|
+
* POST /service/{serviceId}/purge/{url}
|
|
106
|
+
*/
|
|
107
|
+
export interface FastlyPurgeUrlRequest {
|
|
108
|
+
/** Fastly Service ID */
|
|
109
|
+
serviceId: string;
|
|
110
|
+
/** Fastly API Token with Purge permission */
|
|
111
|
+
apiToken: string;
|
|
112
|
+
/** URL to purge (will be URL-encoded) */
|
|
113
|
+
url: string;
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* Fastly URL purge response
|
|
117
|
+
*/
|
|
118
|
+
export interface FastlyPurgeUrlResponse {
|
|
119
|
+
/** Purge status */
|
|
120
|
+
status: 'ok' | 'error';
|
|
121
|
+
/** Purge ID for tracking */
|
|
122
|
+
id?: string;
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* Unified CDN invalidation request
|
|
126
|
+
* Used by service functions to handle all CDN providers
|
|
127
|
+
*/
|
|
128
|
+
export interface CDNInvalidationRequest {
|
|
129
|
+
/** CDN provider type */
|
|
130
|
+
provider: 'cloudflare' | 'cloudfront' | 'fastly';
|
|
131
|
+
/** Provider-specific configuration */
|
|
132
|
+
config: CloudflarePurgeCacheRequest | CloudFrontInvalidationRequest | FastlyPurgeUrlRequest;
|
|
133
|
+
/** URLs to invalidate */
|
|
134
|
+
urls: string[];
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* Unified CDN invalidation response
|
|
138
|
+
* Normalized response across all providers
|
|
139
|
+
*/
|
|
140
|
+
export interface CDNInvalidationResponse {
|
|
141
|
+
/** Provider that handled the invalidation */
|
|
142
|
+
provider: 'cloudflare' | 'cloudfront' | 'fastly';
|
|
143
|
+
/** Success status */
|
|
144
|
+
success: boolean;
|
|
145
|
+
/** URLs that were invalidated */
|
|
146
|
+
urls: string[];
|
|
147
|
+
/** Provider-specific invalidation ID */
|
|
148
|
+
invalidationId: string;
|
|
149
|
+
/** Error message (if failed) */
|
|
150
|
+
error?: string;
|
|
151
|
+
}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import type { CampaignEndpointTypes } from './campaigns';
|
|
2
2
|
import type { PollingEndpointTypes } from './health';
|
|
3
3
|
import type { InfobipEndpointTypes } from './infobip';
|
|
4
|
+
import type { VirusTotalEndpointTypes } from './virustotal';
|
|
5
|
+
import type { CloudflareEndpointTypes, CloudFrontEndpointTypes, FastlyEndpointTypes } from './cdn';
|
|
4
6
|
/**
|
|
5
7
|
* Query parameters type - matches fetchff's flexible param handling
|
|
6
8
|
* Supports objects, URLSearchParams, and arrays of name-value pairs
|
|
@@ -9,5 +11,5 @@ export type QueryParams = Record<string, string | number | boolean | string[] |
|
|
|
9
11
|
/**
|
|
10
12
|
* All endpoint types combined
|
|
11
13
|
*/
|
|
12
|
-
export interface EndpointTypes extends CampaignEndpointTypes, PollingEndpointTypes, InfobipEndpointTypes {
|
|
14
|
+
export interface EndpointTypes extends CampaignEndpointTypes, PollingEndpointTypes, InfobipEndpointTypes, VirusTotalEndpointTypes, CloudflareEndpointTypes, CloudFrontEndpointTypes, FastlyEndpointTypes {
|
|
13
15
|
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* VirusTotal Endpoint Type Definitions
|
|
3
|
+
*
|
|
4
|
+
* This file contains endpoint type definitions for virus/malware scanning operations:
|
|
5
|
+
* - File upload for scanning
|
|
6
|
+
* - Analysis result retrieval
|
|
7
|
+
* - API health checks
|
|
8
|
+
*
|
|
9
|
+
* @see ./types.ts
|
|
10
|
+
*/
|
|
11
|
+
import type { Endpoint, Req } from 'fetchff';
|
|
12
|
+
import type { VirusTotalUploadFileRequest, VirusTotalUploadFileResponse, VirusTotalGetAnalysisResponse, VirusTotalGetAnalysisParams, VirusTotalGetVersionResponse } from './types';
|
|
13
|
+
/**
|
|
14
|
+
* VirusTotal API endpoint types
|
|
15
|
+
* Complete type definitions for virus scanning endpoints
|
|
16
|
+
*/
|
|
17
|
+
export interface VirusTotalEndpointTypes {
|
|
18
|
+
/**
|
|
19
|
+
* POST /files - Upload file for scanning
|
|
20
|
+
* Supports multipart/form-data uploads up to 650MB (free tier)
|
|
21
|
+
*/
|
|
22
|
+
uploadFileForScanning: Endpoint<Req<VirusTotalUploadFileResponse, VirusTotalUploadFileRequest>>;
|
|
23
|
+
/**
|
|
24
|
+
* GET /analyses/:id - Get analysis result
|
|
25
|
+
* Retrieve scan results for previously uploaded file
|
|
26
|
+
*/
|
|
27
|
+
getAnalysisResult: Endpoint<Req<VirusTotalGetAnalysisResponse, never, VirusTotalGetAnalysisParams>>;
|
|
28
|
+
/**
|
|
29
|
+
* GET /version - Get API version (health check)
|
|
30
|
+
* Simple endpoint to verify API availability
|
|
31
|
+
*/
|
|
32
|
+
getApiVersion: Endpoint<Req<VirusTotalGetVersionResponse>>;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Type guard to check if an endpoint key is a valid VirusTotal endpoint
|
|
36
|
+
*/
|
|
37
|
+
export type VirusTotalEndpointKey = keyof VirusTotalEndpointTypes;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* VirusTotal API Endpoint Types
|
|
3
|
+
* Export all VirusTotal-related types
|
|
4
|
+
*/
|
|
5
|
+
export type { VirusTotalEndpointTypes, VirusTotalEndpointKey } from './endpoints';
|
|
6
|
+
export type { VirusTotalErrorCode, VirusTotalUploadFileRequest, VirusTotalUploadFileResponse, VirusTotalUploadFileError400, VirusTotalUploadFileError401, VirusTotalUploadFileError413, VirusTotalUploadFileError429, VirusTotalGetAnalysisRequest, VirusTotalGetAnalysisParams, VirusTotalGetAnalysisResponse, VirusTotalGetAnalysisError404, VirusTotalGetAnalysisError401, VirusTotalAnalysisStatus, VirusTotalResultCategory, VirusTotalEngineResult, VirusTotalAnalysisStats, VirusTotalGetVersionResponse, VirusTotalErrorResponse, } from './types';
|
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* VirusTotal API Type Definitions
|
|
3
|
+
*
|
|
4
|
+
* Types for virus/malware scanning operations:
|
|
5
|
+
* - File upload for scanning
|
|
6
|
+
* - Analysis result retrieval
|
|
7
|
+
* - API health checks
|
|
8
|
+
*
|
|
9
|
+
* Based on VirusTotal API v3 specification
|
|
10
|
+
* @see https://developers.virustotal.com/reference/overview
|
|
11
|
+
*/
|
|
12
|
+
import type { STORAGE_ERROR_CODES } from '../../../errors/codes';
|
|
13
|
+
/**
|
|
14
|
+
* Upload file for scanning request
|
|
15
|
+
* POST /files
|
|
16
|
+
*
|
|
17
|
+
* Service function payload (not the raw HTTP request)
|
|
18
|
+
*/
|
|
19
|
+
export interface VirusTotalUploadFileRequest {
|
|
20
|
+
/** File buffer to scan */
|
|
21
|
+
file: globalThis.Buffer;
|
|
22
|
+
/** Original filename */
|
|
23
|
+
filename: string;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Upload file response - returns analysis ID for polling
|
|
27
|
+
*/
|
|
28
|
+
export interface VirusTotalUploadFileResponse {
|
|
29
|
+
data: {
|
|
30
|
+
/** Resource type (always "analysis") */
|
|
31
|
+
type: 'analysis';
|
|
32
|
+
/** Analysis ID - use this to poll for results */
|
|
33
|
+
id: string;
|
|
34
|
+
/** Additional links */
|
|
35
|
+
links?: {
|
|
36
|
+
self: string;
|
|
37
|
+
};
|
|
38
|
+
};
|
|
39
|
+
/** Additional metadata */
|
|
40
|
+
meta?: {
|
|
41
|
+
file_info?: {
|
|
42
|
+
/** SHA256 hash of uploaded file */
|
|
43
|
+
sha256?: string;
|
|
44
|
+
/** File size in bytes */
|
|
45
|
+
size?: number;
|
|
46
|
+
};
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* VirusTotal API error code types
|
|
51
|
+
*/
|
|
52
|
+
export type VirusTotalErrorCode = typeof STORAGE_ERROR_CODES.VIRUSTOTAL_BAD_REQUEST | typeof STORAGE_ERROR_CODES.VIRUSTOTAL_AUTHENTICATION_REQUIRED | typeof STORAGE_ERROR_CODES.VIRUSTOTAL_WRONG_CREDENTIALS | typeof STORAGE_ERROR_CODES.VIRUSTOTAL_FILE_TOO_LARGE | typeof STORAGE_ERROR_CODES.VIRUSTOTAL_QUOTA_EXCEEDED | typeof STORAGE_ERROR_CODES.VIRUSTOTAL_ANALYSIS_NOT_FOUND | typeof STORAGE_ERROR_CODES.VIRUSTOTAL_SCAN_TIMEOUT | typeof STORAGE_ERROR_CODES.VIRUSTOTAL_SCAN_FAILED;
|
|
53
|
+
/**
|
|
54
|
+
* Upload file error responses
|
|
55
|
+
*/
|
|
56
|
+
export interface VirusTotalUploadFileError400 {
|
|
57
|
+
error: {
|
|
58
|
+
message: string;
|
|
59
|
+
code: typeof STORAGE_ERROR_CODES.VIRUSTOTAL_BAD_REQUEST;
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
export interface VirusTotalUploadFileError401 {
|
|
63
|
+
error: {
|
|
64
|
+
message: string;
|
|
65
|
+
code: typeof STORAGE_ERROR_CODES.VIRUSTOTAL_AUTHENTICATION_REQUIRED | typeof STORAGE_ERROR_CODES.VIRUSTOTAL_WRONG_CREDENTIALS;
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
export interface VirusTotalUploadFileError413 {
|
|
69
|
+
error: {
|
|
70
|
+
message: string;
|
|
71
|
+
code: typeof STORAGE_ERROR_CODES.VIRUSTOTAL_FILE_TOO_LARGE;
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
export interface VirusTotalUploadFileError429 {
|
|
75
|
+
error: {
|
|
76
|
+
message: string;
|
|
77
|
+
code: typeof STORAGE_ERROR_CODES.VIRUSTOTAL_QUOTA_EXCEEDED;
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Get analysis result request
|
|
82
|
+
* GET /analyses/:id
|
|
83
|
+
*
|
|
84
|
+
* Service function payload
|
|
85
|
+
*/
|
|
86
|
+
export interface VirusTotalGetAnalysisRequest {
|
|
87
|
+
/** Analysis ID from upload response */
|
|
88
|
+
analysisId: string;
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Get analysis result params
|
|
92
|
+
* URL path parameters for GET /analyses/:id
|
|
93
|
+
*/
|
|
94
|
+
export interface VirusTotalGetAnalysisParams {
|
|
95
|
+
/** Analysis ID in URL path */
|
|
96
|
+
id: string;
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Analysis status
|
|
100
|
+
*/
|
|
101
|
+
export type VirusTotalAnalysisStatus = 'queued' | 'in-progress' | 'completed';
|
|
102
|
+
/**
|
|
103
|
+
* Individual engine result category
|
|
104
|
+
*/
|
|
105
|
+
export type VirusTotalResultCategory = 'malicious' | 'suspicious' | 'undetected' | 'harmless' | 'type-unsupported' | 'failure' | 'timeout';
|
|
106
|
+
/**
|
|
107
|
+
* Individual antivirus engine scan result
|
|
108
|
+
*/
|
|
109
|
+
export interface VirusTotalEngineResult {
|
|
110
|
+
/** Detection category */
|
|
111
|
+
category: VirusTotalResultCategory;
|
|
112
|
+
/** Antivirus engine name */
|
|
113
|
+
engine_name: string;
|
|
114
|
+
/** Detected malware name (if any) */
|
|
115
|
+
result: string | null;
|
|
116
|
+
/** Detection method */
|
|
117
|
+
method: string;
|
|
118
|
+
/** Engine version */
|
|
119
|
+
engine_version?: string;
|
|
120
|
+
/** Engine update timestamp */
|
|
121
|
+
engine_update?: string;
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* Analysis statistics
|
|
125
|
+
*/
|
|
126
|
+
export interface VirusTotalAnalysisStats {
|
|
127
|
+
/** Number of engines that detected malware */
|
|
128
|
+
malicious: number;
|
|
129
|
+
/** Number of engines that flagged as suspicious */
|
|
130
|
+
suspicious: number;
|
|
131
|
+
/** Number of engines with no detection */
|
|
132
|
+
undetected: number;
|
|
133
|
+
/** Number of engines that marked as harmless */
|
|
134
|
+
harmless: number;
|
|
135
|
+
/** Number of engines that don't support this file type */
|
|
136
|
+
'type-unsupported': number;
|
|
137
|
+
/** Number of engines that failed to scan */
|
|
138
|
+
failure: number;
|
|
139
|
+
/** Number of engines that timed out */
|
|
140
|
+
timeout: number;
|
|
141
|
+
}
|
|
142
|
+
/**
|
|
143
|
+
* Get analysis result response
|
|
144
|
+
*/
|
|
145
|
+
export interface VirusTotalGetAnalysisResponse {
|
|
146
|
+
data: {
|
|
147
|
+
/** Resource type (always "analysis") */
|
|
148
|
+
type: 'analysis';
|
|
149
|
+
/** Analysis ID */
|
|
150
|
+
id: string;
|
|
151
|
+
/** Analysis attributes */
|
|
152
|
+
attributes: {
|
|
153
|
+
/** Current analysis status */
|
|
154
|
+
status: VirusTotalAnalysisStatus;
|
|
155
|
+
/** Aggregated statistics */
|
|
156
|
+
stats: VirusTotalAnalysisStats;
|
|
157
|
+
/** Individual engine results (only when status is "completed") */
|
|
158
|
+
results?: Record<string, VirusTotalEngineResult>;
|
|
159
|
+
/** Analysis date */
|
|
160
|
+
date?: number;
|
|
161
|
+
/** File info */
|
|
162
|
+
file_info?: {
|
|
163
|
+
sha256: string;
|
|
164
|
+
md5: string;
|
|
165
|
+
sha1: string;
|
|
166
|
+
size: number;
|
|
167
|
+
};
|
|
168
|
+
};
|
|
169
|
+
/** Additional links */
|
|
170
|
+
links?: {
|
|
171
|
+
self: string;
|
|
172
|
+
item?: string;
|
|
173
|
+
};
|
|
174
|
+
};
|
|
175
|
+
}
|
|
176
|
+
/**
|
|
177
|
+
* Get analysis error responses
|
|
178
|
+
*/
|
|
179
|
+
export interface VirusTotalGetAnalysisError404 {
|
|
180
|
+
error: {
|
|
181
|
+
message: string;
|
|
182
|
+
code: typeof STORAGE_ERROR_CODES.VIRUSTOTAL_ANALYSIS_NOT_FOUND;
|
|
183
|
+
};
|
|
184
|
+
}
|
|
185
|
+
export interface VirusTotalGetAnalysisError401 {
|
|
186
|
+
error: {
|
|
187
|
+
message: string;
|
|
188
|
+
code: typeof STORAGE_ERROR_CODES.VIRUSTOTAL_AUTHENTICATION_REQUIRED | typeof STORAGE_ERROR_CODES.VIRUSTOTAL_WRONG_CREDENTIALS;
|
|
189
|
+
};
|
|
190
|
+
}
|
|
191
|
+
/**
|
|
192
|
+
* Get API version response (used for health checks)
|
|
193
|
+
*/
|
|
194
|
+
export interface VirusTotalGetVersionResponse {
|
|
195
|
+
data: {
|
|
196
|
+
version: string;
|
|
197
|
+
};
|
|
198
|
+
}
|
|
199
|
+
/**
|
|
200
|
+
* All possible VirusTotal error responses
|
|
201
|
+
*/
|
|
202
|
+
export type VirusTotalErrorResponse = VirusTotalUploadFileError400 | VirusTotalUploadFileError401 | VirusTotalUploadFileError413 | VirusTotalUploadFileError429 | VirusTotalGetAnalysisError404 | VirusTotalGetAnalysisError401;
|