cybertipline-tools 0.1.0 → 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/README.md CHANGED
@@ -5,50 +5,132 @@ A **unofficial** collection of tools for interacting with the National Center fo
5
5
  ## Installation
6
6
 
7
7
  ```bash
8
- pnpm install cybertipline-tools
8
+ # Using pnpm
9
+ pnpm add cybertipline-tools
10
+
11
+ # Using npm
12
+ npm install cybertipline-tools
13
+
14
+ # Using yarn
15
+ yarn add cybertipline-tools
9
16
  ```
10
17
 
11
- ## Requirements
18
+ ## Quick Start
19
+
20
+ ```typescript
21
+ import { Client, Environment, IncidentType } from 'cybertipline-tools';
22
+
23
+ // Create a new client
24
+ const client = new Client({
25
+ environment: Environment.Testing, // Use Testing for development
26
+ credentials: {
27
+ username: 'your-username',
28
+ password: 'your-password',
29
+ },
30
+ });
31
+
32
+ // Test your connection
33
+ const status = await client.getStatus();
34
+ console.log('Connected:', status.data.responseDescription);
35
+
36
+ // Submit a report
37
+ const report = await client.submitReport({
38
+ incidentSummary: {
39
+ incidentType: IncidentType.ChildSexTourism,
40
+ // ... other required fields
41
+ },
42
+ reporter: {
43
+ reportingPerson: {
44
+ email: 'reporter@example.com',
45
+ // ... other required fields
46
+ },
47
+ },
48
+ });
49
+ console.log('Report ID:', report.data.reportId);
50
+
51
+ // Upload a file
52
+ const fileUpload = await client.uploadFile({
53
+ id: report.data.reportId,
54
+ file: new File(['...'], 'evidence.jpg'),
55
+ });
56
+ console.log('File ID:', fileUpload.data.fileId);
57
+
58
+ // Add file details
59
+ await client.submitFileDetails({
60
+ reportId: Number(report.data.reportId),
61
+ fileId: fileUpload.data.fileId,
62
+ fileName: 'evidence.jpg',
63
+ // ... other optional fields
64
+ });
65
+
66
+ // Mark report as complete
67
+ await client.finishReport({
68
+ id: report.data.reportId,
69
+ });
70
+ ```
12
71
 
13
- We officially support Node.js 22.x and later, but the library may work on older versions.
72
+ ## Requirements
14
73
 
15
- The package exports ESM modules, so you may need to do some extra configuration to use it in a CommonJS environment.
74
+ - Node.js 24.x or later (TypeScript 5.x for type definitions)
75
+ - Older versions may work, but are not officially verified.
76
+ - ESM module support
77
+ - CommonJS is exported, but not officially tested. We welcome contributions to improve this.
16
78
 
17
79
  ## Features
18
80
 
19
- - TypeScript support
20
- - We export TypeScript declaration files with the package for all documented APIs.
21
- - Inline documentation
22
- - We document all our APIs and types with JSDoc comments to give you inline documentation in your editor.
23
- - Standalone utils
24
- - Don't need the API client? Just import the utils you need.
25
-
26
- Coming soon™️:
27
- - [ ] API client, ability to call the CyberTipline APIs.
28
- - [ ] JSON to XML builder. Convert input JSON objects to XML for post calls.
29
- - [ ] XML to JSON conversion for responses from the API.
30
- - APIs to support:
31
- - [ ] GET /status
32
- - [ ] POST /submit
33
- - [ ] POST /upload
34
- - [ ] POST /fileinfo
35
- - [ ] POST /finish
36
- - [ ] POST /retract
37
- - [ ] Support batch reporting.
38
- - [ ] Generate a full report and batch send.
39
- - [ ] Strict schema validation (Zod, or similar).
40
- - [ ] Full test coverage.
41
-
42
-
43
- Maybe in the future:
44
- - [ ] E2E Validation against the CyberTipline API test endpoint.
45
- - [ ] Automatically generate TypeScript types from the CyberTipline xsd schema.
81
+ **Type Safety**
82
+ - Full TypeScript support with detailed type definitions
83
+ - Inline documentation with JSDoc comments
84
+ - Allowing for IDE autocompletion for all APIs
85
+
86
+ 🐛 **Error Handling**
87
+ - Request ID extraction for all operations
88
+ - Error handling with detailed messages
89
+
90
+ 🛠️ **API Support**
91
+ - `GET /status` - Test API connectivity
92
+ - `POST /submit` - Submit new reports
93
+ - `POST /upload` - Upload evidence files
94
+ - `POST /fileinfo` - Add file metadata
95
+ - `POST /finish` - Complete reports
96
+ - `POST /retract` - Cancel reports
97
+
98
+ - You provide JSON, we convert it to XML and back, so no need to worry about XML!
99
+
100
+ ## Error Handling
101
+
102
+ The client includes built-in error handling:
103
+
104
+ ```typescript
105
+ try {
106
+ await client.getStatus();
107
+ } catch (error) {
108
+ // All API errors include the Request-ID for troubleshooting
109
+ console.error('API Error:', error.message);
110
+ // Example: "Authentication failed (Request-ID: abc-123)"
111
+ }
112
+ ```
113
+
114
+ ## Development Status
115
+
116
+ 🚧 **Todo**
117
+ - [ ] Schema validation (Zod?)
118
+ - [ ] Examples and demos
119
+ - [ ] Documentation improvements
120
+ - [ ] Performance optimizations
121
+ - [ ] Stabilize developer experience
122
+
123
+ 🔮 **Possible Future Plans**
124
+ - [ ] E2E testing against running CyberTipline test environment
125
+ - [ ] Batch reporting support
126
+ - [ ] XSD schema to TypeScript generation
46
127
 
47
128
  ## License
48
129
 
49
- This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
130
+ MIT License - see the [LICENSE](LICENSE) file for details.
50
131
 
51
- ## Links
132
+ ## Resources
52
133
 
53
- - Official API documentation: [CyberTipline Reporting API](https://report.cybertip.org/ispws/documentation)
54
- - Apply for access to [NCMEC CyberTipline](https://esp.ncmec.org/registration)
134
+ - [CyberTipline API Documentation](https://report.cybertip.org/ispws/documentation) (official documentation from NCMEC)
135
+ - [Apply for API Access](https://esp.ncmec.org/registration) (done by the NCMEC team)
136
+ - [Report Issues](https://github.com/Johannes-Andersen/cybertipline-tools/issues)