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 +117 -35
- package/dist/index.cjs +1457 -69
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +849 -174
- package/dist/index.d.ts +849 -174
- package/dist/index.js +1415 -66
- package/dist/index.js.map +1 -1
- package/package.json +15 -10
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
|
-
|
|
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
|
-
##
|
|
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
|
-
|
|
72
|
+
## Requirements
|
|
14
73
|
|
|
15
|
-
|
|
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
|
-
|
|
20
|
-
|
|
21
|
-
- Inline documentation
|
|
22
|
-
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
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
|
-
|
|
130
|
+
MIT License - see the [LICENSE](LICENSE) file for details.
|
|
50
131
|
|
|
51
|
-
##
|
|
132
|
+
## Resources
|
|
52
133
|
|
|
53
|
-
-
|
|
54
|
-
- Apply for
|
|
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)
|