@relazio/plugin-sdk 0.1.1 → 0.2.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/CHANGELOG.md ADDED
@@ -0,0 +1,96 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ## [0.2.0] - 2025-12-22
9
+
10
+ ### Added
11
+ - **Universal Entity Builder**: Complete builder system for creating entities and edges
12
+ - `createEntity()` - Universal, scalable function for creating any entity type (present or future)
13
+ - `EntityBuilder` - Fluent builder for advanced entity construction
14
+ - `createEdge()` - Edge creation function with validation
15
+ - `EdgeBuilder` - Fluent builder for complex edges
16
+ - **Automatic ID Generation**: Deterministic ID generation system
17
+ - `generateEntityId()` - MD5 hash-based deterministic entity IDs
18
+ - `generateEdgeId()` - Deterministic edge IDs
19
+ - `generateRandomId()` - Random IDs for temporary entities
20
+ - `normalizeValue()` - Value normalization for ID consistency
21
+ - **ResultBuilder**: Fluent builder for transform results
22
+ - `.addEntity()` - Add entity with automatic edge creation
23
+ - `.addEntities()` - Add multiple entities of the same type
24
+ - `.addEntityOnly()` - Add entity without edge
25
+ - `.setMessage()` - Set success message
26
+ - `.addMetadata()` - Add metadata to result
27
+ - **Helper Functions**: Utility functions for common cases
28
+ - `emptyResult()` - Empty result with optional message
29
+ - `errorResult()` - Error result
30
+ - `singleEntityResult()` - Single entity result
31
+ - `multiEntityResult()` - Multiple entity result
32
+ - **Validation Utilities**: Automatic format validation
33
+ - `validateEntities()` - Validate entity array
34
+ - `validateEdges()` - Validate edge array
35
+ - `validateTransformResult()` - Validate complete result
36
+ - **Documentation**: Complete documentation and examples
37
+ - Quick Start Guide
38
+ - Builders Guide
39
+ - Response Format Specification
40
+ - New comprehensive example: `simple-sync-example`
41
+ - Updated async example: `async-subdomain-scanner`
42
+
43
+ ### Changed
44
+ - **BREAKING**: `OSINTEntity` now requires mandatory `id` field
45
+ - **BREAKING**: `OSINTEdge` now requires mandatory `id` field
46
+ - **BREAKING**: Removed support for `targetId: 'auto'` in edges
47
+ - **Scalability Improvement**: Removed type-specific helpers in favor of universal `createEntity()`
48
+ - Advantage: No SDK updates needed for new entity types
49
+ - Advantage: Supports custom entity types without code changes
50
+ - Advantage: Consistent, predictable API
51
+ - Updated all entity types to align with Relazio external format
52
+ - Added new entity types: `username`, `credential`, `social`, `document`, `image`, `video`, `wallet`, `transaction`, `exchange`, `maps`
53
+ - `TransformInput.entity` is now of type `OSINTEntity` (includes ID)
54
+ - Updated examples to use scalable approach
55
+ - Reorganized documentation to `docs/` folder
56
+ - All documentation rewritten in formal English
57
+
58
+ ### Removed
59
+ - Type-specific helper functions (`createIP`, `createDomain`, etc.) - replaced with universal `createEntity()`
60
+ - Migration guide (not needed for initial release)
61
+
62
+ ### Fixed
63
+ - Automatic format validation for responses
64
+ - Guaranteed unique IDs for all entities and edges
65
+ - Consistent field naming (only `metadata`, not `properties`)
66
+
67
+ ## [0.1.1] - 2025-12-20
68
+
69
+ ### Changed
70
+ - Simplified documentation
71
+ - Translated documentation to English
72
+ - Made documentation more formal and concise
73
+
74
+ ### Fixed
75
+ - HTTP localhost support for development (manifest generator)
76
+
77
+ ## [0.1.0] - 2025-12-20
78
+
79
+ ### Added
80
+ - Initial public release
81
+ - Multi-tenant support with automatic organization management
82
+ - Synchronous and asynchronous transform handlers
83
+ - Built-in Express server with CORS and error handling
84
+ - Automatic `/register`, `/unregister`, `/manifest.json` endpoints
85
+ - HMAC-SHA256 signature utilities for webhook security
86
+ - Job progress tracking for async operations
87
+ - InstallationRegistry for organization management
88
+ - In-memory storage (development) and custom storage support (production)
89
+ - TypeScript support with full type definitions
90
+ - Working examples (email-parser, dns-toolkit, async-subdomain-scanner, multi-tenant-plugin)
91
+
92
+ ### Security
93
+ - HMAC-SHA256 webhook signatures
94
+ - Organization isolation
95
+ - Unique webhook secrets per organization
96
+ - TLS certificate validation
package/README.md CHANGED
@@ -7,7 +7,7 @@ Official SDK for building external plugins for the Relazio OSINT platform.
7
7
 
8
8
  ## Overview
9
9
 
10
- The Relazio Plugin SDK enables developers to create external plugins that extend the Relazio platform's capabilities. The SDK provides a complete framework for building secure, multi-tenant plugins with minimal boilerplate code.
10
+ The Relazio Plugin SDK provides a complete framework for building secure, scalable external plugins that extend the Relazio platform's capabilities with minimal boilerplate.
11
11
 
12
12
  ## Features
13
13
 
@@ -17,6 +17,10 @@ The Relazio Plugin SDK enables developers to create external plugins that extend
17
17
  - **Security**: HMAC-SHA256 signature generation and validation
18
18
  - **Job Management**: Progress tracking and webhook notifications for async operations
19
19
  - **TypeScript**: Full type safety and IntelliSense support
20
+ - **Scalable Entity Creation**: Universal `createEntity()` function works with any entity type
21
+ - **Automatic ID Generation**: Deterministic ID generation for entities and edges
22
+ - **Result Builder**: Fluent API for constructing complex transform results
23
+ - **Automatic Validation**: Format validation according to Relazio specifications
20
24
 
21
25
  ## Installation
22
26
 
@@ -27,7 +31,7 @@ npm install @relazio/plugin-sdk
27
31
  ## Quick Start
28
32
 
29
33
  ```typescript
30
- import { RelazioPlugin } from '@relazio/plugin-sdk';
34
+ import { RelazioPlugin, createEntity, ResultBuilder } from '@relazio/plugin-sdk';
31
35
 
32
36
  const plugin = new RelazioPlugin({
33
37
  id: 'my-plugin',
@@ -45,15 +49,20 @@ plugin.transform({
45
49
  inputType: 'domain',
46
50
  outputTypes: ['ip'],
47
51
 
48
- async handler(input, config) {
49
- return {
50
- entities: [{
51
- type: 'ip',
52
- value: '8.8.8.8',
53
- label: 'Google DNS'
54
- }],
55
- edges: []
56
- };
52
+ async handler(input) {
53
+ // Create entity using universal createEntity()
54
+ const ip = createEntity('ip', '8.8.8.8', {
55
+ label: 'Google DNS',
56
+ metadata: { country: 'US' }
57
+ });
58
+
59
+ // Build result with automatic edge creation
60
+ return new ResultBuilder(input)
61
+ .addEntity(ip, 'resolves to', {
62
+ relationship: 'dns_resolution'
63
+ })
64
+ .setMessage('DNS resolved successfully')
65
+ .build();
57
66
  }
58
67
  });
59
68
 
@@ -65,9 +74,90 @@ await plugin.start({
65
74
 
66
75
  ## Documentation
67
76
 
68
- - [Examples](./examples/) - Working plugin examples
77
+ - **[Quick Start Guide](./docs/quick-start.md)** - Get started in 5 minutes with sync and async examples
78
+ - **[Builders Guide](./docs/builders-guide.md)** - Complete guide to builders and utilities
79
+ - **[Response Format Specification](./docs/response-format.md)** - Required response format
80
+ - **[Examples Documentation](./docs/examples.md)** - Complete working examples
81
+ - [simple-sync-example](./examples/simple-sync-example/) - Synchronous transform example
82
+ - [async-subdomain-scanner](./examples/async-subdomain-scanner/) - Asynchronous transform example
69
83
  - [Changelog](./CHANGELOG.md) - Version history
70
84
 
85
+ ## Entity & Edge Builders
86
+
87
+ The SDK uses a dynamic, scalable approach that works with any entity type:
88
+
89
+ ### Universal Entity Creation
90
+
91
+ ```typescript
92
+ import { createEntity } from '@relazio/plugin-sdk';
93
+
94
+ // Works with ANY type - even future types!
95
+ const ip = createEntity('ip', '8.8.8.8', {
96
+ label: 'Google DNS',
97
+ metadata: { country: 'US', isp: 'Google LLC' }
98
+ });
99
+
100
+ const domain = createEntity('domain', 'example.com');
101
+
102
+ const location = createEntity('location', 'New York, NY', {
103
+ metadata: { latitude: 40.7, longitude: -74.0 }
104
+ });
105
+
106
+ // Works with custom types too!
107
+ const customEntity = createEntity('future-entity-type', 'value', {
108
+ metadata: { /* ... */ }
109
+ });
110
+
111
+ // ID automatically generated: "ip-c909e98d"
112
+ console.log(ip.id);
113
+ ```
114
+
115
+ **Advantages**:
116
+ - No SDK updates needed for new entity types
117
+ - Works with custom entity types
118
+ - Type-safe with TypeScript
119
+ - Deterministic ID generation
120
+
121
+ ### Result Builder
122
+
123
+ Build complex results easily:
124
+
125
+ ```typescript
126
+ import { ResultBuilder, createEntity } from '@relazio/plugin-sdk';
127
+
128
+ handler: async (input) => {
129
+ const location = createEntity('location', 'Mountain View, CA', {
130
+ metadata: { latitude: 37.386, longitude: -122.084 }
131
+ });
132
+
133
+ const org = createEntity('organization', 'Google LLC', {
134
+ metadata: { asn: 'AS15169' }
135
+ });
136
+
137
+ // Edges created automatically!
138
+ return new ResultBuilder(input)
139
+ .addEntity(location, 'located in', {
140
+ relationship: 'geolocation'
141
+ })
142
+ .addEntity(org, 'assigned by', {
143
+ relationship: 'isp_assignment'
144
+ })
145
+ .setMessage('IP analyzed successfully')
146
+ .build();
147
+ }
148
+ ```
149
+
150
+ ### Supported Entity Types
151
+
152
+ ```typescript
153
+ type EntityType =
154
+ | 'email' | 'domain' | 'ip' | 'person' | 'username'
155
+ | 'phone' | 'organization' | 'hash' | 'credential'
156
+ | 'social' | 'document' | 'note' | 'image' | 'video'
157
+ | 'location' | 'wallet' | 'transaction' | 'exchange'
158
+ | 'url' | 'maps' | 'custom';
159
+ ```
160
+
71
161
  ## Multi-Tenant Architecture
72
162
 
73
163
  The SDK automatically handles organization registration and management:
@@ -141,6 +231,24 @@ await plugin.stop()
141
231
  - Node.js >= 18.0.0
142
232
  - TypeScript >= 5.0.0 (for development)
143
233
 
234
+ ## Examples
235
+
236
+ ### Synchronous Transform
237
+
238
+ ```bash
239
+ cd examples/simple-sync-example
240
+ npm install
241
+ npm start
242
+ ```
243
+
244
+ ### Asynchronous Transform
245
+
246
+ ```bash
247
+ cd examples/async-subdomain-scanner
248
+ npm install
249
+ npm start
250
+ ```
251
+
144
252
  ## License
145
253
 
146
254
  MIT License - see [LICENSE](./LICENSE) file for details.
@@ -150,3 +258,4 @@ MIT License - see [LICENSE](./LICENSE) file for details.
150
258
  - [npm Package](https://www.npmjs.com/package/@relazio/plugin-sdk)
151
259
  - [GitHub Repository](https://github.com/relazio/plugin-sdk)
152
260
  - [Issue Tracker](https://github.com/relazio/plugin-sdk/issues)
261
+ - [Documentation](./docs/)
@@ -1,35 +1,35 @@
1
1
  /**
2
2
  * Tipi core per Relazio Plugin SDK
3
3
  */
4
- export type EntityType = 'domain' | 'ip' | 'email' | 'phone' | 'person' | 'organization' | 'location' | 'note' | 'url' | 'hash' | 'custom';
4
+ export type EntityType = 'email' | 'domain' | 'ip' | 'person' | 'username' | 'phone' | 'organization' | 'hash' | 'credential' | 'social' | 'document' | 'note' | 'image' | 'video' | 'location' | 'wallet' | 'transaction' | 'exchange' | 'url' | 'maps' | 'custom';
5
5
  export type PluginCategory = 'network' | 'identity' | 'social' | 'financial' | 'security' | 'other';
6
6
  export type JobStatus = 'pending' | 'submitted' | 'processing' | 'completed' | 'failed' | 'timeout' | 'cancelled';
7
7
  /**
8
- * Entità OSINT
8
+ * Entità OSINT (formato esterno - con ID obbligatorio)
9
9
  */
10
10
  export interface OSINTEntity {
11
+ id: string;
11
12
  type: EntityType;
12
13
  value: string;
13
14
  label?: string;
14
15
  metadata?: Record<string, any>;
15
16
  }
16
17
  /**
17
- * Arco/connessione tra entità
18
+ * Arco/connessione tra entità (formato esterno)
18
19
  */
19
20
  export interface OSINTEdge {
21
+ id: string;
20
22
  sourceId: string;
21
- targetId: string | 'auto';
23
+ targetId: string;
22
24
  label: string;
23
- relationship: string;
25
+ relationship?: string;
24
26
  metadata?: Record<string, any>;
25
27
  }
26
28
  /**
27
29
  * Input per una transform
28
30
  */
29
31
  export interface TransformInput {
30
- entity: OSINTEntity & {
31
- id: string;
32
- };
32
+ entity: OSINTEntity;
33
33
  config?: Record<string, any>;
34
34
  organizationId?: string;
35
35
  }
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/core/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,MAAM,MAAM,UAAU,GAClB,QAAQ,GACR,IAAI,GACJ,OAAO,GACP,OAAO,GACP,QAAQ,GACR,cAAc,GACd,UAAU,GACV,MAAM,GACN,KAAK,GACL,MAAM,GACN,QAAQ,CAAC;AAEb,MAAM,MAAM,cAAc,GACtB,SAAS,GACT,UAAU,GACV,QAAQ,GACR,W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AAa,CAAC,EAAE,MAAM,CAAC;IACvB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,MAAM,iBAAiB,GAAG,qBAAqB,GAAG,sBAAsB,CAAC"}
package/dist/index.d.ts CHANGED
@@ -12,4 +12,7 @@ export { InstallationRegistry, MemoryStorage } from './registry/installation';
12
12
  export type { Installation, RegistrationRequest, RegistrationResponse, InstallationStorage } from './registry/installation';
13
13
  export { ExpressServer } from './server/express';
14
14
  export type { Server } from './server/express';
15
+ export { createEntity, createEdge, EntityBuilder, EdgeBuilder, validateEntities, validateEdges, validateTransformResult, } from './utils/builders';
16
+ export { generateEntityId, generateEdgeId, generateRandomId, normalizeValue, isValidEntityId, isValidEdgeId, } from './utils/id-generator';
17
+ export { ResultBuilder, emptyResult, errorResult, singleEntityResult, multiEntityResult, } from './utils/result-builder';
15
18
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC3D,OAAO,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAGpD,YAAY,EACV,UAAU,EACV,cAAc,EACd,SAAS,EACT,WAAW,EACX,SAAS,EACT,cAAc,EACd,eAAe,EACf,YAAY,EACZ,WAAW,EACX,YAAY,EACZ,eAAe,EACf,oBAAoB,EACpB,gBAAgB,EAChB,qBAAqB,EACrB,UAAU,EACV,YAAY,EACZ,eAAe,EACf,cAAc,EACd,cAAc,EACd,gBAAgB,EAChB,qBAAqB,EACrB,sBAAsB,EACtB,iBAAiB,GAClB,MAAM,cAAc,CAAC;AAGtB,OAAO,EAAE,SAAS,EAAE,sBAAsB,EAAE,MAAM,iBAAiB,CAAC;AAGpE,OAAO,EAAE,kBAAkB,EAAE,QAAQ,EAAE,sBAAsB,EAAE,MAAM,iBAAiB,CAAC;AACvF,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AAY,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAG/C,OAAO,EAEL,YAAY,EACZ,UAAU,EACV,aAAa,EACb,WAAW,EAEX,gBAAgB,EAChB,aAAa,EACb,uBAAuB,GACxB,MAAM,kBAAkB,CAAC;AAG1B,OAAO,EACL,gBAAgB,EAChB,cAAc,EACd,gBAAgB,EAChB,cAAc,EACd,eAAe,EACf,aAAa,GACd,MAAM,sBAAsB,CAAC;AAG9B,OAAO,EACL,aAAa,EACb,WAAW,EACX,WAAW,EACX,kBAAkB,EAClB,iBAAiB,GAClB,MAAM,wBAAwB,CAAC"}
package/dist/index.js CHANGED
@@ -4,7 +4,7 @@
4
4
  * SDK ufficiale per creare plugin esterni per Relazio
5
5
  */
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.ExpressServer = exports.MemoryStorage = exports.InstallationRegistry = exports.InMemorySecretProvider = exports.JobQueue = exports.JobProgressTracker = exports.verifyWebhookSignature = exports.HMACUtils = exports.ManifestGenerator = exports.OSINTPlugin = exports.RelazioPlugin = void 0;
7
+ exports.multiEntityResult = exports.singleEntityResult = exports.errorResult = exports.emptyResult = exports.ResultBuilder = exports.isValidEdgeId = exports.isValidEntityId = exports.normalizeValue = exports.generateRandomId = exports.generateEdgeId = exports.generateEntityId = exports.validateTransformResult = exports.validateEdges = exports.validateEntities = exports.EdgeBuilder = exports.EntityBuilder = exports.createEdge = exports.createEntity = exports.ExpressServer = exports.MemoryStorage = exports.InstallationRegistry = exports.InMemorySecretProvider = exports.JobQueue = exports.JobProgressTracker = exports.verifyWebhookSignature = exports.HMACUtils = exports.ManifestGenerator = exports.OSINTPlugin = exports.RelazioPlugin = void 0;
8
8
  // Core exports
9
9
  var plugin_1 = require("./core/plugin");
10
10
  Object.defineProperty(exports, "RelazioPlugin", { enumerable: true, get: function () { return plugin_1.RelazioPlugin; } });
@@ -27,3 +27,29 @@ Object.defineProperty(exports, "MemoryStorage", { enumerable: true, get: functio
27
27
  // Server
28
28
  var express_1 = require("./server/express");
29
29
  Object.defineProperty(exports, "ExpressServer", { enumerable: true, get: function () { return express_1.ExpressServer; } });
30
+ // Utils - Entity & Edge Builders
31
+ var builders_1 = require("./utils/builders");
32
+ // Core builders (scalabili e dinamici)
33
+ Object.defineProperty(exports, "createEntity", { enumerable: true, get: function () { return builders_1.createEntity; } });
34
+ Object.defineProperty(exports, "createEdge", { enumerable: true, get: function () { return builders_1.createEdge; } });
35
+ Object.defineProperty(exports, "EntityBuilder", { enumerable: true, get: function () { return builders_1.EntityBuilder; } });
36
+ Object.defineProperty(exports, "EdgeBuilder", { enumerable: true, get: function () { return builders_1.EdgeBuilder; } });
37
+ // Validazione
38
+ Object.defineProperty(exports, "validateEntities", { enumerable: true, get: function () { return builders_1.validateEntities; } });
39
+ Object.defineProperty(exports, "validateEdges", { enumerable: true, get: function () { return builders_1.validateEdges; } });
40
+ Object.defineProperty(exports, "validateTransformResult", { enumerable: true, get: function () { return builders_1.validateTransformResult; } });
41
+ // Utils - ID Generation
42
+ var id_generator_1 = require("./utils/id-generator");
43
+ Object.defineProperty(exports, "generateEntityId", { enumerable: true, get: function () { return id_generator_1.generateEntityId; } });
44
+ Object.defineProperty(exports, "generateEdgeId", { enumerable: true, get: function () { return id_generator_1.generateEdgeId; } });
45
+ Object.defineProperty(exports, "generateRandomId", { enumerable: true, get: function () { return id_generator_1.generateRandomId; } });
46
+ Object.defineProperty(exports, "normalizeValue", { enumerable: true, get: function () { return id_generator_1.normalizeValue; } });
47
+ Object.defineProperty(exports, "isValidEntityId", { enumerable: true, get: function () { return id_generator_1.isValidEntityId; } });
48
+ Object.defineProperty(exports, "isValidEdgeId", { enumerable: true, get: function () { return id_generator_1.isValidEdgeId; } });
49
+ // Utils - Result Builder
50
+ var result_builder_1 = require("./utils/result-builder");
51
+ Object.defineProperty(exports, "ResultBuilder", { enumerable: true, get: function () { return result_builder_1.ResultBuilder; } });
52
+ Object.defineProperty(exports, "emptyResult", { enumerable: true, get: function () { return result_builder_1.emptyResult; } });
53
+ Object.defineProperty(exports, "errorResult", { enumerable: true, get: function () { return result_builder_1.errorResult; } });
54
+ Object.defineProperty(exports, "singleEntityResult", { enumerable: true, get: function () { return result_builder_1.singleEntityResult; } });
55
+ Object.defineProperty(exports, "multiEntityResult", { enumerable: true, get: function () { return result_builder_1.multiEntityResult; } });
@@ -0,0 +1,147 @@
1
+ import type { OSINTEntity, OSINTEdge, EntityType } from '../core/types';
2
+ /**
3
+ * Crea un'entità OSINT nel formato corretto
4
+ * Genera automaticamente un ID deterministico se non specificato
5
+ *
6
+ * @param type - Tipo di entità
7
+ * @param value - Valore dell'entità (obbligatorio)
8
+ * @param options - Opzioni aggiuntive (label, metadata, id)
9
+ * @returns Entità nel formato corretto
10
+ *
11
+ * @example
12
+ * ```ts
13
+ * // Esempio semplice
14
+ * createEntity('ip', '8.8.8.8')
15
+ *
16
+ * // Con label e metadata
17
+ * createEntity('ip', '8.8.8.8', {
18
+ * label: 'Google DNS',
19
+ * metadata: { country: 'US', isp: 'Google LLC' }
20
+ * })
21
+ *
22
+ * // Con ID personalizzato
23
+ * createEntity('location', 'Mountain View, CA', {
24
+ * id: 'custom-location-id',
25
+ * metadata: { latitude: 37.386, longitude: -122.084 }
26
+ * })
27
+ * ```
28
+ */
29
+ export declare function createEntity(type: EntityType, value: string, options?: {
30
+ id?: string;
31
+ label?: string;
32
+ metadata?: Record<string, any>;
33
+ }): OSINTEntity;
34
+ /**
35
+ * Crea un edge tra due entità nel formato corretto
36
+ * Genera automaticamente un ID deterministico se non specificato
37
+ *
38
+ * @param sourceId - ID dell'entità sorgente
39
+ * @param targetId - ID dell'entità target
40
+ * @param label - Label visibile dell'edge (obbligatorio)
41
+ * @param options - Opzioni aggiuntive (id, relationship, metadata)
42
+ * @returns Edge nel formato corretto
43
+ *
44
+ * @example
45
+ * ```ts
46
+ * // Esempio semplice
47
+ * createEdge('ip-c909e98d', 'location-a3f42bc1', 'located in')
48
+ *
49
+ * // Con relationship e metadata
50
+ * createEdge('ip-c909e98d', 'org-5b3c1a2d', 'assigned by', {
51
+ * relationship: 'isp_assignment',
52
+ * metadata: { confidence: 0.98 }
53
+ * })
54
+ *
55
+ * // Con ID personalizzato
56
+ * createEdge('node-1', 'node-2', 'related to', {
57
+ * id: 'custom-edge-id'
58
+ * })
59
+ * ```
60
+ */
61
+ export declare function createEdge(sourceId: string, targetId: string, label: string, options?: {
62
+ id?: string;
63
+ relationship?: string;
64
+ metadata?: Record<string, any>;
65
+ }): OSINTEdge;
66
+ /**
67
+ * NOTA: Gli helper specifici sono stati rimossi per rendere l'SDK più scalabile.
68
+ * Usa `createEntity(type, value, options)` per creare qualsiasi tipo di entità.
69
+ *
70
+ * Esempio:
71
+ * ```ts
72
+ * createEntity('ip', '8.8.8.8', { metadata: { country: 'US' } })
73
+ * createEntity('domain', 'example.com')
74
+ * createEntity('custom-type', 'value') // Funziona anche con tipi futuri!
75
+ * ```
76
+ */
77
+ /**
78
+ * Builder fluente per creare entità complesse
79
+ *
80
+ * @example
81
+ * ```ts
82
+ * const entity = EntityBuilder
83
+ * .create('ip', '8.8.8.8')
84
+ * .withLabel('Google DNS')
85
+ * .withMetadata({ country: 'US', isp: 'Google LLC' })
86
+ * .build();
87
+ * ```
88
+ */
89
+ export declare class EntityBuilder {
90
+ private entity;
91
+ private constructor();
92
+ static create(type: EntityType, value: string): EntityBuilder;
93
+ withId(id: string): this;
94
+ withLabel(label: string): this;
95
+ withMetadata(metadata: Record<string, any>): this;
96
+ addMetadata(key: string, value: any): this;
97
+ build(): OSINTEntity;
98
+ }
99
+ /**
100
+ * Builder fluente per creare edge complessi
101
+ *
102
+ * @example
103
+ * ```ts
104
+ * const edge = EdgeBuilder
105
+ * .create('ip-abc', 'location-xyz', 'located in')
106
+ * .withRelationship('geolocation')
107
+ * .withMetadata({ confidence: 0.98 })
108
+ * .build();
109
+ * ```
110
+ */
111
+ export declare class EdgeBuilder {
112
+ private edge;
113
+ private constructor();
114
+ static create(sourceId: string, targetId: string, label: string): EdgeBuilder;
115
+ withId(id: string): this;
116
+ withRelationship(relationship: string): this;
117
+ withMetadata(metadata: Record<string, any>): this;
118
+ addMetadata(key: string, value: any): this;
119
+ build(): OSINTEdge;
120
+ }
121
+ /**
122
+ * Helper per validare un array di entità
123
+ * Controlla ID duplicati e campi obbligatori
124
+ */
125
+ export declare function validateEntities(entities: OSINTEntity[]): {
126
+ valid: boolean;
127
+ errors: string[];
128
+ };
129
+ /**
130
+ * Helper per validare un array di edge
131
+ * Controlla ID duplicati, campi obbligatori e riferimenti validi
132
+ */
133
+ export declare function validateEdges(edges: OSINTEdge[], entities: OSINTEntity[], inputEntityId?: string): {
134
+ valid: boolean;
135
+ errors: string[];
136
+ };
137
+ /**
138
+ * Helper per validare una risposta completa di transform
139
+ */
140
+ export declare function validateTransformResult(result: {
141
+ entities: OSINTEntity[];
142
+ edges: OSINTEdge[];
143
+ }, inputEntityId?: string): {
144
+ valid: boolean;
145
+ errors: string[];
146
+ };
147
+ //# sourceMappingURL=builders.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"builders.d.ts","sourceRoot":"","sources":["../../src/utils/builders.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAGxE;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,wBAAgB,YAAY,CAC1B,IAAI,EAAE,UAAU,EAChB,KAAK,EAAE,MAAM,EACb,OAAO,CAAC,EAAE;IACR,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;CAChC,GACA,WAAW,CAYb;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,wBAAgB,UAAU,CACxB,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,MAAM,EAChB,KAAK,EAAE,MAAM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