@eckidevs/dow-sdk
v1.0.0-beta.8
Published
A module to interface with the Dow Jones Screening and Monitoring API in a type-safe way
Downloads
2
Readme
dow-sdk
A module to interface with the Dow Jones Screening and Monitoring API in a type-safe way
Quick example
import {DowJonesSDK} from '@eckidevs/dow-sdk';
const {id_token} = await DowJonesSDK.getAuthNToken({
client_id: 'your-client-id',
username: 'your-username',
password: 'your-password',
device: 'your-device-id',
});
const {access_token} = await DowJonesSDK.getAuthZToken({
client_id: 'your-client-id',
id_token,
});
const sdk = new DowJonesSDK({accessToken: access_token});
// List all cases / associations
const cases = await sdk.listCases();
const associations = await sdk.listAssociations();
// Create a new case
const newCase = await sdk.addCase({
data: {
type: 'risk-entity-screening-cases',
attributes: {
case_name: 'Some Name for your Case',
options: {
search_type: 'NEAR',
// See docs for more types
filter_content_category: ['SL', 'WL', 'PEP'],
},
},
},
});
// Create a new association
const association = await sdk.addAssociation({
data: {
type: 'risk-entity-screening-associations',
attributes: {
record_type: 'PERSON', // or ENTITY or UNKNOWN
names: [
{
single_string_name: 'John Doe III',
name_type: 'PRIMARY',
},
],
},
},
});
// Correlate an association to a case
await sdk.addExistingAssociationsToCase({
case_id: newCase.data.id,
data: [association.data],
});
// Get matches for entire case
const caseMatches = await sdk.getMatches({
case_id: newCase.data.id,
});
// Get matches for specific association
const associationMatches = await sdk.getMatches({
case_id: newCase.data.id,
associationId: association.data.id,
});
if (!associationMatches?.data?.length) {
console.log('no matches');
process.exit(0);
}
for (const associationMatch of associationMatches.data) {
const associationId = associationMatch.id; // Always the association id
const hasAlerts = associationMatch.attributes.has_alerts; // If there are still matches with an OPEN status
if (!associationMatch.attributes?.matches?.length) continue; // 'empty results';
for (const match of associationMatch.attributes.matches) {
console.log(match.match_name); // The person / entity name
console.log(match.current_state.state); // The person / entity state (OPEN, CLEARED etc.)
// Update the status of a match
await sdk.addMatchFeedback({
case_id: newCase.data.id,
match_id: match.match_id,
data: {
type: 'risk-entity-screening-matches',
attributes: {
comment: 'This is not a match',
current_state: 'PERMANENTLY_CLEARED', // CONFIRMED etc.
},
},
});
}
}
Please consult the documentation for more
Contribute
To install dependencies:
npm install
To build
npm run build
To test
npm test