Skip to content

Use the TypeScript SDK

@lexopti/sdk is the TypeScript client of the API. Its operations are generated from the same contract as the API itself: every input and every answer is typed, and the examples on this page are type-checked against the package when the portal is built. The SDK reference lists every export.

Terminal window
npm install @lexopti/sdk

It runs wherever fetch exists: Node.js 20+, Bun, Deno, edge runtimes. Call it from your server only: the access token it sends is the member’s.

import {
function createLexOptiClient(options: LexOptiClientOptions): LexOptiClient

A typed client of the LexOpti API. Every idempotent POST gets an Idempotency-Key (kept across its retries); only requests safe to repeat are retried after a failure, with jittered backoff or Retry-After. Errors are oRPC errors: problemOf(error) reads the problem details.

createLexOptiClient
} from "@lexopti/sdk";
const
const lexopti: LexOptiClient
lexopti
=
function createLexOptiClient(options: LexOptiClientOptions): LexOptiClient

A typed client of the LexOpti API. Every idempotent POST gets an Idempotency-Key (kept across its retries); only requests safe to repeat are retried after a failure, with jittered backoff or Retry-After. Errors are oRPC errors: problemOf(error) reads the problem details.

createLexOptiClient
({
LexOptiClientOptions.accessToken: () => Promise<string> | string

Returns the OAuth access token for each request: refresh it there when it expires (access tokens live 15 minutes).

accessToken
: () =>
function getAccessToken(): Promise<string>
getAccessToken
(),
LexOptiClientOptions.locale?: "fr" | "en" | undefined

fr for French service messages; English otherwise.

locale
: "fr",
});
const
const organization: {
id: string;
name: string;
sandbox: boolean;
member: {
user_id: string;
role: string;
};
integration: {
client_id: string;
delegated_mode: boolean;
};
}
organization
= await
const lexopti: LexOptiClient
lexopti
.
organization: {
get: Client<Record<never, never>, unknown, {
id: string;
name: string;
sandbox: boolean;
member: {
user_id: string;
role: string;
};
integration: {
client_id: string;
delegated_mode: boolean;
};
}, Error>;
}
organization
.
get: Client
(input?: unknown, options?: FriendlyClientOptions<Record<never, never>> | undefined) => ClientPromiseResult<{
id: string;
name: string;
sandbox: boolean;
member: {
user_id: string;
role: string;
};
integration: {
client_id: string;
delegated_mode: boolean;
};
}, Error>
get
();
var console: Console

The console module provides a simple debugging console that is similar to the JavaScript console mechanism provided by web browsers.

The module exports two specific components:

  • A Console class with methods such as console.log(), console.error() and console.warn() that can be used to write to any Node.js stream.
  • A global console instance configured to write to process.stdout and process.stderr. The global console can be used without importing the node:console module.

Warning: The global console object's methods are neither consistently synchronous like the browser APIs they resemble, nor are they consistently asynchronous like all other Node.js streams. See the note on process I/O for more information.

Example using the global console:

console.log('hello world');
// Prints: hello world, to stdout
console.log('hello %s', 'world');
// Prints: hello world, to stdout
console.error(new Error('Whoops, something bad happened'));
// Prints error message and stack trace to stderr:
// Error: Whoops, something bad happened
// at [eval]:5:15
// at Script.runInThisContext (node:vm:132:18)
// at Object.runInThisContext (node:vm:309:38)
// at node:internal/process/execution:77:19
// at [eval]-wrapper:6:22
// at evalScript (node:internal/process/execution:76:60)
// at node:internal/main/eval_string:23:3
const name = 'Will Robinson';
console.warn(`Danger ${name}! Danger!`);
// Prints: Danger Will Robinson! Danger!, to stderr

Example using the Console class:

const out = getStreamSomehow();
const err = getStreamSomehow();
const myConsole = new console.Console(out, err);
myConsole.log('hello world');
// Prints: hello world, to out
myConsole.log('hello %s', 'world');
// Prints: hello world, to out
myConsole.error(new Error('Whoops, something bad happened'));
// Prints: [Error: Whoops, something bad happened], to err
const name = 'Will Robinson';
myConsole.warn(`Danger ${name}! Danger!`);
// Prints: Danger Will Robinson! Danger!, to err

@see ― source

console
.
Console.log(message?: any, ...optionalParams: any[]): void (+1 overload)

Prints to stdout with newline. Multiple arguments can be passed, with the first used as the primary message and all additional used as substitution values similar to printf(3) (the arguments are all passed to util.format()).

const count = 5;
console.log('count: %d', count);
// Prints: count: 5, to stdout
console.log('count:', count);
// Prints: count: 5, to stdout

See util.format() for more information.

@since ― v0.1.100

log
(
const organization: {
id: string;
name: string;
sandbox: boolean;
member: {
user_id: string;
role: string;
};
integration: {
client_id: string;
delegated_mode: boolean;
};
}
organization
.
name: string
name
,
const organization: {
id: string;
name: string;
sandbox: boolean;
member: {
user_id: string;
role: string;
};
integration: {
client_id: string;
delegated_mode: boolean;
};
}
organization
.
sandbox: boolean
sandbox
);
Option Default Use
accessToken required Returns the member’s OAuth access token, once per operation (its retries reuse it)
baseUrl https://app.lexopti.com/v1 Another environment
locale en fr for French detail messages (code stays English)
maxRetries 2 How many times a failed request runs again (retries)
maxRetryWait 60000 The longest Retry-After wait, in milliseconds
fetch global fetch A proxy or a test double
sleep a timer How the client waits between attempts, for tests

Access tokens live 15 minutes. accessToken is called once per operation, before its first attempt: refresh there, with the refresh token you stored when the member authorized your application (authentication).

import {
function createLexOptiClient(options: LexOptiClientOptions): LexOptiClient

A typed client of the LexOpti API. Every idempotent POST gets an Idempotency-Key (kept across its retries); only requests safe to repeat are retried after a failure, with jittered backoff or Retry-After. Errors are oRPC errors: problemOf(error) reads the problem details.

createLexOptiClient
} from "@lexopti/sdk";
let
let current: {
token: string;
expiresAt: number;
} | null
current
: {
token: string
token
: string;
expiresAt: number
expiresAt
: number } | null = null;
async function
function accessToken(): Promise<string>
accessToken
():
interface Promise<T>

Represents the completion of an asynchronous operation

Promise
<string> {
// Refresh one minute before expiry.
if (!
let current: {
token: string;
expiresAt: number;
} | null
current
||
let current: {
token: string;
expiresAt: number;
}
current
.
expiresAt: number
expiresAt
- 60_000 <
var Date: DateConstructor

Enables basic storage and retrieval of dates and times.

Date
.
DateConstructor.now(): number

Returns the number of milliseconds elapsed since midnight, January 1, 1970 Universal Coordinated Time (UTC).

now
()) {
const
const tokens: {
access_token: string;
expires_in: number;
refresh_token: string;
}
tokens
= await
function refreshTokens(refreshToken: string): Promise<{
access_token: string;
expires_in: number;
refresh_token: string;
}>
refreshTokens
(
const stored: {
refreshToken: string;
}
stored
.
refreshToken: string
refreshToken
);
const stored: {
refreshToken: string;
}
stored
.
refreshToken: string
refreshToken
=
const tokens: {
access_token: string;
expires_in: number;
refresh_token: string;
}
tokens
.
refresh_token: string
refresh_token
; // Refresh tokens rotate.
let current: {
token: string;
expiresAt: number;
} | null
current
= {
expiresAt: number
expiresAt
:
var Date: DateConstructor

Enables basic storage and retrieval of dates and times.

Date
.
DateConstructor.now(): number

Returns the number of milliseconds elapsed since midnight, January 1, 1970 Universal Coordinated Time (UTC).

now
() +
const tokens: {
access_token: string;
expires_in: number;
refresh_token: string;
}
tokens
.
expires_in: number
expires_in
* 1000,
token: string
token
:
const tokens: {
access_token: string;
expires_in: number;
refresh_token: string;
}
tokens
.
access_token: string
access_token
,
};
}
return
let current: {
token: string;
expiresAt: number;
}
current
.
token: string
token
;
}
const
const lexopti: LexOptiClient
lexopti
=
function createLexOptiClient(options: LexOptiClientOptions): LexOptiClient

A typed client of the LexOpti API. Every idempotent POST gets an Idempotency-Key (kept across its retries); only requests safe to repeat are retried after a failure, with jittered backoff or Retry-After. Errors are oRPC errors: problemOf(error) reads the problem details.

createLexOptiClient
({
LexOptiClientOptions.accessToken: () => Promise<string> | string

Returns the OAuth access token for each request: refresh it there when it expires (access tokens live 15 minutes).

accessToken
});
// Clients: identity only, nothing is screened yet.
const
const client: {
id: string;
external_ref: string | null;
type: "person" | "company";
name: string;
person: {
first_name: string | null;
last_name: string | null;
usage_name: string | null;
birth_date: string | null;
birth_city: string | null;
birth_country: string | null;
nationalities: string[];
} | null;
company: {
name: string | null;
siren: string | null;
siret: string | null;
legal_form: string | null;
registration_country: string | null;
rcs: string | null;
} | null;
address: {
line: string | null;
postal_code: string | null;
city: string | null;
country: string | null;
};
... 10 more ...;
cases?: {
...;
} | undefined;
}
client
= await
const lexopti: LexOptiClient
lexopti
.
clients: {
setExternalRef: Client<Record<never, never>, {
id: string;
external_ref: string;
}, {
id: string;
external_ref: string | null;
type: "person" | "company";
name: string;
person: {
first_name: string | null;
last_name: string | null;
usage_name: string | null;
birth_date: string | null;
birth_city: string | null;
birth_country: string | null;
nationalities: string[];
} | null;
company: {
name: string | null;
siren: string | null;
siret: string | null;
legal_form: string | null;
registration_country: string | null;
rcs: string | null;
} | null;
address: {
line: string | null;
postal_code: string | null;
city: string | null;
country: string | null;
};
... 10 more ...;
cases?: {
...;
} | undefined;
}, Error>;
... 7 more ...;
requestPreliminaryScreening: Client<...>;
}
clients
.
create: Client
(input: {
type: "person";
person: {
first_name: string;
last_name: string;
usage_name?: string | undefined;
birth_date?: string | undefined;
birth_city?: string | undefined;
birth_country?: string | undefined;
nationalities?: string[] | undefined;
};
address?: {
line?: string | undefined;
postal_code?: string | undefined;
city?: string | undefined;
country?: string | undefined;
} | undefined;
external_ref?: string | undefined;
} | {
type: "company";
company: {
name: string;
siren?: string | undefined;
siret?: string | undefined;
legal_form?: string | undefined;
registration_country?: string | undefined;
rcs?: string | undefined;
};
address?: {
line?: string | undefined;
postal_code?: string | undefined;
city?: string | undefined;
country?: string | undefined;
} | undefined;
external_ref?: string | undefined;
}, options?: FriendlyClientOptions<...> | undefined) => ClientPromiseResult<...>
create
({
type: "company"
type
: "company",
company: {
name: string;
siren?: string | undefined;
siret?: string | undefined;
legal_form?: string | undefined;
registration_country?: string | undefined;
rcs?: string | undefined;
}
company
: {
name: string
name
: "Durand SAS",
siren?: string | undefined
siren
: "123456789",
registration_country?: string | undefined
registration_country
: "FR",
},
address?: {
line?: string | undefined;
postal_code?: string | undefined;
city?: string | undefined;
country?: string | undefined;
} | undefined
address
: {
city?: string | undefined
city
: "Nice",
country?: string | undefined
country
: "FR" },
});
const
const same: {
id: string;
external_ref: string | null;
type: "person" | "company";
name: string;
person: {
first_name: string | null;
last_name: string | null;
usage_name: string | null;
birth_date: string | null;
birth_city: string | null;
birth_country: string | null;
nationalities: string[];
} | null;
company: {
name: string | null;
siren: string | null;
siret: string | null;
legal_form: string | null;
registration_country: string | null;
rcs: string | null;
} | null;
address: {
line: string | null;
postal_code: string | null;
city: string | null;
country: string | null;
};
... 10 more ...;
cases?: {
...;
} | undefined;
}
same
= await
const lexopti: LexOptiClient
lexopti
.
clients: {
setExternalRef: Client<Record<never, never>, {
id: string;
external_ref: string;
}, {
id: string;
external_ref: string | null;
type: "person" | "company";
name: string;
person: {
first_name: string | null;
last_name: string | null;
usage_name: string | null;
birth_date: string | null;
birth_city: string | null;
birth_country: string | null;
nationalities: string[];
} | null;
company: {
name: string | null;
siren: string | null;
siret: string | null;
legal_form: string | null;
registration_country: string | null;
rcs: string | null;
} | null;
address: {
line: string | null;
postal_code: string | null;
city: string | null;
country: string | null;
};
... 10 more ...;
cases?: {
...;
} | undefined;
}, Error>;
... 7 more ...;
requestPreliminaryScreening: Client<...>;
}
clients
.
get: Client
(input: {
id: string;
expand?: ("cases" | "classification_state" | "last_check" | "open_alerts_count")[] | undefined;
}, options?: FriendlyClientOptions<Record<never, never>> | undefined) => ClientPromiseResult<{
id: string;
external_ref: string | null;
type: "person" | "company";
name: string;
person: {
first_name: string | null;
last_name: string | null;
usage_name: string | null;
birth_date: string | null;
birth_city: string | null;
birth_country: string | null;
nationalities: string[];
} | null;
company: {
name: string | null;
siren: string | null;
siret: string | null;
legal_form: string | null;
registration_country: string | null;
rcs: string | null;
} | null;
... 11 more ...;
cases?: {
...;
} | undefined;
}, Error>
get
({
id: string
id
:
const client: {
id: string;
external_ref: string | null;
type: "person" | "company";
name: string;
person: {
first_name: string | null;
last_name: string | null;
usage_name: string | null;
birth_date: string | null;
birth_city: string | null;
birth_country: string | null;
nationalities: string[];
} | null;
company: {
name: string | null;
siren: string | null;
siret: string | null;
legal_form: string | null;
registration_country: string | null;
rcs: string | null;
} | null;
address: {
line: string | null;
postal_code: string | null;
city: string | null;
country: string | null;
};
... 10 more ...;
cases?: {
...;
} | undefined;
}
client
.
id: string
id
});
// Checks: screen the client and its related parties (asynchronous).
const
const check: {
id: string;
client_id: string;
status: "running" | "completed" | "failed";
sources: {
source: "international_sanctions" | "eu_sanctions" | "french_asset_freezes" | "politically_exposed_persons" | "high_risk_countries" | "bodacc_announcements" | "bodacc_insolvency" | "company_register" | "adverse_media";
entity_id: string | null;
status: "pending" | "running" | "completed" | "failed" | "skipped";
completed_at: string | null;
}[];
created_at: string;
completed_at: string | null;
}
check
= await
const lexopti: LexOptiClient
lexopti
.
checks: {
list: Client<Record<never, never>, {
limit?: number | undefined;
cursor?: string | undefined;
client_id?: string | undefined;
}, {
data: {
id: string;
client_id: string;
status: "running" | "completed" | "failed";
sources: {
source: "international_sanctions" | "eu_sanctions" | "french_asset_freezes" | "politically_exposed_persons" | "high_risk_countries" | "bodacc_announcements" | "bodacc_insolvency" | "company_register" | "adverse_media";
entity_id: string | null;
status: "pending" | "running" | "completed" | "failed" | "skipped";
completed_at: string | null;
}[];
created_at: string;
completed_at: string | null;
}[];
has_more: boolean;
next_cursor: string | null;
}, Error>;
get: Client<...>;
create: Client<...>;
}
checks
.
create: Client
(input: {
client_id: string;
case_id?: string | undefined;
}, options?: FriendlyClientOptions<Record<never, never>> | undefined) => ClientPromiseResult<{
id: string;
client_id: string;
status: "running" | "completed" | "failed";
sources: {
source: "international_sanctions" | "eu_sanctions" | "french_asset_freezes" | "politically_exposed_persons" | "high_risk_countries" | "bodacc_announcements" | "bodacc_insolvency" | "company_register" | "adverse_media";
entity_id: string | null;
status: "pending" | "running" | "completed" | "failed" | "skipped";
completed_at: string | null;
}[];
created_at: string;
completed_at: string | null;
}, Error>
create
({
client_id: string
client_id
:
const client: {
id: string;
external_ref: string | null;
type: "person" | "company";
name: string;
person: {
first_name: string | null;
last_name: string | null;
usage_name: string | null;
birth_date: string | null;
birth_city: string | null;
birth_country: string | null;
nationalities: string[];
} | null;
company: {
name: string | null;
siren: string | null;
siret: string | null;
legal_form: string | null;
registration_country: string | null;
rcs: string | null;
} | null;
address: {
line: string | null;
postal_code: string | null;
city: string | null;
country: string | null;
};
... 10 more ...;
cases?: {
...;
} | undefined;
}
client
.
id: string
id
});
const
const followed: {
id: string;
client_id: string;
status: "running" | "completed" | "failed";
sources: {
source: "international_sanctions" | "eu_sanctions" | "french_asset_freezes" | "politically_exposed_persons" | "high_risk_countries" | "bodacc_announcements" | "bodacc_insolvency" | "company_register" | "adverse_media";
entity_id: string | null;
status: "pending" | "running" | "completed" | "failed" | "skipped";
completed_at: string | null;
}[];
created_at: string;
completed_at: string | null;
}
followed
= await
const lexopti: LexOptiClient
lexopti
.
checks: {
list: Client<Record<never, never>, {
limit?: number | undefined;
cursor?: string | undefined;
client_id?: string | undefined;
}, {
data: {
id: string;
client_id: string;
status: "running" | "completed" | "failed";
sources: {
source: "international_sanctions" | "eu_sanctions" | "french_asset_freezes" | "politically_exposed_persons" | "high_risk_countries" | "bodacc_announcements" | "bodacc_insolvency" | "company_register" | "adverse_media";
entity_id: string | null;
status: "pending" | "running" | "completed" | "failed" | "skipped";
completed_at: string | null;
}[];
created_at: string;
completed_at: string | null;
}[];
has_more: boolean;
next_cursor: string | null;
}, Error>;
get: Client<...>;
create: Client<...>;
}
checks
.
get: Client
(input: {
id: string;
}, options?: FriendlyClientOptions<Record<never, never>> | undefined) => ClientPromiseResult<{
id: string;
client_id: string;
status: "running" | "completed" | "failed";
sources: {
source: "international_sanctions" | "eu_sanctions" | "french_asset_freezes" | "politically_exposed_persons" | "high_risk_countries" | "bodacc_announcements" | "bodacc_insolvency" | "company_register" | "adverse_media";
entity_id: string | null;
status: "pending" | "running" | "completed" | "failed" | "skipped";
completed_at: string | null;
}[];
created_at: string;
completed_at: string | null;
}, Error>
get
({
id: string
id
:
const check: {
id: string;
client_id: string;
status: "running" | "completed" | "failed";
sources: {
source: "international_sanctions" | "eu_sanctions" | "french_asset_freezes" | "politically_exposed_persons" | "high_risk_countries" | "bodacc_announcements" | "bodacc_insolvency" | "company_register" | "adverse_media";
entity_id: string | null;
status: "pending" | "running" | "completed" | "failed" | "skipped";
completed_at: string | null;
}[];
created_at: string;
completed_at: string | null;
}
check
.
id: string
id
});
var console: Console

The console module provides a simple debugging console that is similar to the JavaScript console mechanism provided by web browsers.

The module exports two specific components:

  • A Console class with methods such as console.log(), console.error() and console.warn() that can be used to write to any Node.js stream.
  • A global console instance configured to write to process.stdout and process.stderr. The global console can be used without importing the node:console module.

Warning: The global console object's methods are neither consistently synchronous like the browser APIs they resemble, nor are they consistently asynchronous like all other Node.js streams. See the note on process I/O for more information.

Example using the global console:

console.log('hello world');
// Prints: hello world, to stdout
console.log('hello %s', 'world');
// Prints: hello world, to stdout
console.error(new Error('Whoops, something bad happened'));
// Prints error message and stack trace to stderr:
// Error: Whoops, something bad happened
// at [eval]:5:15
// at Script.runInThisContext (node:vm:132:18)
// at Object.runInThisContext (node:vm:309:38)
// at node:internal/process/execution:77:19
// at [eval]-wrapper:6:22
// at evalScript (node:internal/process/execution:76:60)
// at node:internal/main/eval_string:23:3
const name = 'Will Robinson';
console.warn(`Danger ${name}! Danger!`);
// Prints: Danger Will Robinson! Danger!, to stderr

Example using the Console class:

const out = getStreamSomehow();
const err = getStreamSomehow();
const myConsole = new console.Console(out, err);
myConsole.log('hello world');
// Prints: hello world, to out
myConsole.log('hello %s', 'world');
// Prints: hello world, to out
myConsole.error(new Error('Whoops, something bad happened'));
// Prints: [Error: Whoops, something bad happened], to err
const name = 'Will Robinson';
myConsole.warn(`Danger ${name}! Danger!`);
// Prints: Danger Will Robinson! Danger!, to err

@see ― source

console
.
Console.log(message?: any, ...optionalParams: any[]): void (+1 overload)

Prints to stdout with newline. Multiple arguments can be passed, with the first used as the primary message and all additional used as substitution values similar to printf(3) (the arguments are all passed to util.format()).

const count = 5;
console.log('count: %d', count);
// Prints: count: 5, to stdout
console.log('count:', count);
// Prints: count: 5, to stdout

See util.format() for more information.

@since ― v0.1.100

log
(
const same: {
id: string;
external_ref: string | null;
type: "person" | "company";
name: string;
person: {
first_name: string | null;
last_name: string | null;
usage_name: string | null;
birth_date: string | null;
birth_city: string | null;
birth_country: string | null;
nationalities: string[];
} | null;
company: {
name: string | null;
siren: string | null;
siret: string | null;
legal_form: string | null;
registration_country: string | null;
rcs: string | null;
} | null;
address: {
line: string | null;
postal_code: string | null;
city: string | null;
country: string | null;
};
... 10 more ...;
cases?: {
...;
} | undefined;
}
same
.
vigilance_level: "simplified" | "standard" | "enhanced" | null
vigilance_level
,
const followed: {
id: string;
client_id: string;
status: "running" | "completed" | "failed";
sources: {
source: "international_sanctions" | "eu_sanctions" | "french_asset_freezes" | "politically_exposed_persons" | "high_risk_countries" | "bodacc_announcements" | "bodacc_insolvency" | "company_register" | "adverse_media";
entity_id: string | null;
status: "pending" | "running" | "completed" | "failed" | "skipped";
completed_at: string | null;
}[];
created_at: string;
completed_at: string | null;
}
followed
.
status: "running" | "completed" | "failed"
status
);
// Cases and alerts.
const
const cases: {
data: {
id: string;
external_ref: string | null;
label: string | null;
type: string | null;
types: string[];
type_label: string | null;
status: "pending" | "running" | "completed" | "failed";
client_id: string | null;
client_ids: string[];
clients: {
id: string;
external_ref: string | null;
main: boolean;
}[];
parties: {
id: string;
entity_id: string;
external_ref: string | null;
role: "demandeur" | "defendeur" | "appelant" | "intime" | "intervenant" | "partie_adverse" | "vendeur" | "acquereur" | "cedant" | "cessionnaire" | "contrepartie" | "bailleur" | "locataire" | ... 16 more ... | "autre";
type: "person" | "company";
name: string;
monitoring_enabled: boolean;
}[];
... 8 more ...;
updated_at: string;
}[];
has_more: boolean;
next_cursor: string | null;
}
cases
= await
const lexopti: LexOptiClient
lexopti
.
cases: {
setPartyExternalRef: Client<Record<never, never>, {
id: string;
external_ref: string;
party_id: string;
}, {
id: string;
external_ref: string | null;
label: string | null;
type: string | null;
types: string[];
type_label: string | null;
status: "pending" | "running" | "completed" | "failed";
client_id: string | null;
client_ids: string[];
clients: {
id: string;
external_ref: string | null;
main: boolean;
}[];
parties: {
id: string;
entity_id: string;
external_ref: string | null;
role: "demandeur" | "defendeur" | "appelant" | "intime" | "intervenant" | "partie_adverse" | "vendeur" | "acquereur" | "cedant" | "cessionnaire" | "contrepartie" | "bailleur" | "locataire" | ... 16 more ... | "autre";
type: "person" | "company";
name: string;
monitoring_enabled: boolean;
}[];
... 8 more ...;
updated_at: string;
}, Error>;
... 10 more ...;
listDocuments: Client<...>;
}
cases
.
list: Client
(input: {
limit?: number | undefined;
cursor?: string | undefined;
external_ref?: string | undefined;
ids?: string | undefined;
client_id?: string | undefined;
party_external_ref?: string | undefined;
}, options?: FriendlyClientOptions<Record<never, never>> | undefined) => ClientPromiseResult<{
data: {
id: string;
external_ref: string | null;
label: string | null;
type: string | null;
types: string[];
type_label: string | null;
status: "pending" | "running" | "completed" | "failed";
client_id: string | null;
client_ids: string[];
clients: {
...;
}[];
... 9 more ...;
updated_at: string;
}[];
has_more: boolean;
next_cursor: string | null;
}, Error>
list
({
client_id?: string | undefined
client_id
:
const client: {
id: string;
external_ref: string | null;
type: "person" | "company";
name: string;
person: {
first_name: string | null;
last_name: string | null;
usage_name: string | null;
birth_date: string | null;
birth_city: string | null;
birth_country: string | null;
nationalities: string[];
} | null;
company: {
name: string | null;
siren: string | null;
siret: string | null;
legal_form: string | null;
registration_country: string | null;
rcs: string | null;
} | null;
address: {
line: string | null;
postal_code: string | null;
city: string | null;
country: string | null;
};
... 10 more ...;
cases?: {
...;
} | undefined;
}
client
.
id: string
id
});
const
const alerts: {
data: {
id: string;
client_id: string;
case_id: string | null;
entity_id: string;
source: "international_sanctions" | "eu_sanctions" | "french_asset_freezes" | "politically_exposed_persons" | "high_risk_countries" | "bodacc_announcements" | "bodacc_insolvency" | "company_register" | "adverse_media" | null;
status: "pending" | "reviewed" | "dismissed" | "confirmed";
level: "simplified" | "standard" | "enhanced";
change: string | null;
subject: string | null;
detail: string | null;
source_name: string;
url: string | null;
created_at: string;
reviewed_at: string | null;
review_notes: string | null;
}[];
has_more: boolean;
next_cursor: string | null;
}
alerts
= await
const lexopti: LexOptiClient
lexopti
.
alerts: {
list: Client<Record<never, never>, {
limit?: number | undefined;
cursor?: string | undefined;
client_id?: string | undefined;
client_ids?: string | undefined;
status?: "pending" | "reviewed" | "dismissed" | "confirmed" | undefined;
}, {
data: {
id: string;
client_id: string;
case_id: string | null;
entity_id: string;
source: "international_sanctions" | "eu_sanctions" | "french_asset_freezes" | "politically_exposed_persons" | "high_risk_countries" | "bodacc_announcements" | "bodacc_insolvency" | "company_register" | "adverse_media" | null;
status: "pending" | "reviewed" | "dismissed" | "confirmed";
level: "simplified" | "standard" | "enhanced";
change: string | null;
subject: string | null;
detail: string | null;
source_name: string;
url: string | null;
created_at: string;
reviewed_at: string | null;
review_notes: string | null;
}[];
has_more: boolean;
next_cursor: string | null;
}, Error>;
get: Client<...>;
update: Client<...>;
}
alerts
.
list: Client
(input: {
limit?: number | undefined;
cursor?: string | undefined;
client_id?: string | undefined;
client_ids?: string | undefined;
status?: "pending" | "reviewed" | "dismissed" | "confirmed" | undefined;
}, options?: FriendlyClientOptions<Record<never, never>> | undefined) => ClientPromiseResult<{
data: {
id: string;
client_id: string;
case_id: string | null;
entity_id: string;
source: "international_sanctions" | "eu_sanctions" | "french_asset_freezes" | "politically_exposed_persons" | "high_risk_countries" | "bodacc_announcements" | "bodacc_insolvency" | "company_register" | "adverse_media" | null;
... 9 more ...;
review_notes: string | null;
}[];
has_more: boolean;
next_cursor: string | null;
}, Error>
list
({
client_id?: string | undefined
client_id
:
const client: {
id: string;
external_ref: string | null;
type: "person" | "company";
name: string;
person: {
first_name: string | null;
last_name: string | null;
usage_name: string | null;
birth_date: string | null;
birth_city: string | null;
birth_country: string | null;
nationalities: string[];
} | null;
company: {
name: string | null;
siren: string | null;
siret: string | null;
legal_form: string | null;
registration_country: string | null;
rcs: string | null;
} | null;
address: {
line: string | null;
postal_code: string | null;
city: string | null;
country: string | null;
};
... 10 more ...;
cases?: {
...;
} | undefined;
}
client
.
id: string
id
,
status?: "pending" | "reviewed" | "dismissed" | "confirmed" | undefined
status
: "pending",
});
const [
const alert: {
id: string;
client_id: string;
case_id: string | null;
entity_id: string;
source: "international_sanctions" | "eu_sanctions" | "french_asset_freezes" | "politically_exposed_persons" | "high_risk_countries" | "bodacc_announcements" | "bodacc_insolvency" | "company_register" | "adverse_media" | null;
status: "pending" | "reviewed" | "dismissed" | "confirmed";
level: "simplified" | "standard" | "enhanced";
change: string | null;
subject: string | null;
detail: string | null;
source_name: string;
url: string | null;
created_at: string;
reviewed_at: string | null;
review_notes: string | null;
}
alert
] =
const alerts: {
data: {
id: string;
client_id: string;
case_id: string | null;
entity_id: string;
source: "international_sanctions" | "eu_sanctions" | "french_asset_freezes" | "politically_exposed_persons" | "high_risk_countries" | "bodacc_announcements" | "bodacc_insolvency" | "company_register" | "adverse_media" | null;
status: "pending" | "reviewed" | "dismissed" | "confirmed";
level: "simplified" | "standard" | "enhanced";
change: string | null;
subject: string | null;
detail: string | null;
source_name: string;
url: string | null;
created_at: string;
reviewed_at: string | null;
review_notes: string | null;
}[];
has_more: boolean;
next_cursor: string | null;
}
alerts
.
data: {
id: string;
client_id: string;
case_id: string | null;
entity_id: string;
source: "international_sanctions" | "eu_sanctions" | "french_asset_freezes" | "politically_exposed_persons" | "high_risk_countries" | "bodacc_announcements" | "bodacc_insolvency" | "company_register" | "adverse_media" | null;
status: "pending" | "reviewed" | "dismissed" | "confirmed";
level: "simplified" | "standard" | "enhanced";
change: string | null;
subject: string | null;
detail: string | null;
source_name: string;
url: string | null;
created_at: string;
reviewed_at: string | null;
review_notes: string | null;
}[]
data
;
if (
const alert: {
id: string;
client_id: string;
case_id: string | null;
entity_id: string;
source: "international_sanctions" | "eu_sanctions" | "french_asset_freezes" | "politically_exposed_persons" | "high_risk_countries" | "bodacc_announcements" | "bodacc_insolvency" | "company_register" | "adverse_media" | null;
status: "pending" | "reviewed" | "dismissed" | "confirmed";
level: "simplified" | "standard" | "enhanced";
change: string | null;
subject: string | null;
detail: string | null;
source_name: string;
url: string | null;
created_at: string;
reviewed_at: string | null;
review_notes: string | null;
}
alert
) {
await
const lexopti: LexOptiClient
lexopti
.
alerts: {
list: Client<Record<never, never>, {
limit?: number | undefined;
cursor?: string | undefined;
client_id?: string | undefined;
client_ids?: string | undefined;
status?: "pending" | "reviewed" | "dismissed" | "confirmed" | undefined;
}, {
data: {
id: string;
client_id: string;
case_id: string | null;
entity_id: string;
source: "international_sanctions" | "eu_sanctions" | "french_asset_freezes" | "politically_exposed_persons" | "high_risk_countries" | "bodacc_announcements" | "bodacc_insolvency" | "company_register" | "adverse_media" | null;
status: "pending" | "reviewed" | "dismissed" | "confirmed";
level: "simplified" | "standard" | "enhanced";
change: string | null;
subject: string | null;
detail: string | null;
source_name: string;
url: string | null;
created_at: string;
reviewed_at: string | null;
review_notes: string | null;
}[];
has_more: boolean;
next_cursor: string | null;
}, Error>;
get: Client<...>;
update: Client<...>;
}
alerts
.
update: Client
(input: {
id: string;
status: "reviewed" | "dismissed" | "confirmed";
notes?: string | undefined;
}, options?: FriendlyClientOptions<Record<never, never>> | undefined) => ClientPromiseResult<{
id: string;
client_id: string;
case_id: string | null;
entity_id: string;
source: "international_sanctions" | "eu_sanctions" | "french_asset_freezes" | "politically_exposed_persons" | "high_risk_countries" | "bodacc_announcements" | "bodacc_insolvency" | "company_register" | "adverse_media" | null;
status: "pending" | "reviewed" | "dismissed" | "confirmed";
... 8 more ...;
review_notes: string | null;
}, Error>
update
({
id: string
id
:
const alert: {
id: string;
client_id: string;
case_id: string | null;
entity_id: string;
source: "international_sanctions" | "eu_sanctions" | "french_asset_freezes" | "politically_exposed_persons" | "high_risk_countries" | "bodacc_announcements" | "bodacc_insolvency" | "company_register" | "adverse_media" | null;
status: "pending" | "reviewed" | "dismissed" | "confirmed";
level: "simplified" | "standard" | "enhanced";
change: string | null;
subject: string | null;
detail: string | null;
source_name: string;
url: string | null;
created_at: string;
reviewed_at: string | null;
review_notes: string | null;
}
alert
.
id: string
id
,
status: "reviewed" | "dismissed" | "confirmed"
status
: "reviewed",
notes?: string | undefined
notes
: "Homonyme",
});
}
var console: Console

The console module provides a simple debugging console that is similar to the JavaScript console mechanism provided by web browsers.

The module exports two specific components:

  • A Console class with methods such as console.log(), console.error() and console.warn() that can be used to write to any Node.js stream.
  • A global console instance configured to write to process.stdout and process.stderr. The global console can be used without importing the node:console module.

Warning: The global console object's methods are neither consistently synchronous like the browser APIs they resemble, nor are they consistently asynchronous like all other Node.js streams. See the note on process I/O for more information.

Example using the global console:

console.log('hello world');
// Prints: hello world, to stdout
console.log('hello %s', 'world');
// Prints: hello world, to stdout
console.error(new Error('Whoops, something bad happened'));
// Prints error message and stack trace to stderr:
// Error: Whoops, something bad happened
// at [eval]:5:15
// at Script.runInThisContext (node:vm:132:18)
// at Object.runInThisContext (node:vm:309:38)
// at node:internal/process/execution:77:19
// at [eval]-wrapper:6:22
// at evalScript (node:internal/process/execution:76:60)
// at node:internal/main/eval_string:23:3
const name = 'Will Robinson';
console.warn(`Danger ${name}! Danger!`);
// Prints: Danger Will Robinson! Danger!, to stderr

Example using the Console class:

const out = getStreamSomehow();
const err = getStreamSomehow();
const myConsole = new console.Console(out, err);
myConsole.log('hello world');
// Prints: hello world, to out
myConsole.log('hello %s', 'world');
// Prints: hello world, to out
myConsole.error(new Error('Whoops, something bad happened'));
// Prints: [Error: Whoops, something bad happened], to err
const name = 'Will Robinson';
myConsole.warn(`Danger ${name}! Danger!`);
// Prints: Danger Will Robinson! Danger!, to err

@see ― source

console
.
Console.log(message?: any, ...optionalParams: any[]): void (+1 overload)

Prints to stdout with newline. Multiple arguments can be passed, with the first used as the primary message and all additional used as substitution values similar to printf(3) (the arguments are all passed to util.format()).

const count = 5;
console.log('count: %d', count);
// Prints: count: 5, to stdout
console.log('count:', count);
// Prints: count: 5, to stdout

See util.format() for more information.

@since ― v0.1.100

log
(
const cases: {
data: {
id: string;
external_ref: string | null;
label: string | null;
type: string | null;
types: string[];
type_label: string | null;
status: "pending" | "running" | "completed" | "failed";
client_id: string | null;
client_ids: string[];
clients: {
id: string;
external_ref: string | null;
main: boolean;
}[];
parties: {
id: string;
entity_id: string;
external_ref: string | null;
role: "demandeur" | "defendeur" | "appelant" | "intime" | "intervenant" | "partie_adverse" | "vendeur" | "acquereur" | "cedant" | "cessionnaire" | "contrepartie" | "bailleur" | "locataire" | ... 16 more ... | "autre";
type: "person" | "company";
name: string;
monitoring_enabled: boolean;
}[];
... 8 more ...;
updated_at: string;
}[];
has_more: boolean;
next_cursor: string | null;
}
cases
.
data: {
id: string;
external_ref: string | null;
label: string | null;
type: string | null;
types: string[];
type_label: string | null;
status: "pending" | "running" | "completed" | "failed";
client_id: string | null;
client_ids: string[];
clients: {
id: string;
external_ref: string | null;
main: boolean;
}[];
parties: {
id: string;
entity_id: string;
external_ref: string | null;
role: "demandeur" | "defendeur" | "appelant" | "intime" | "intervenant" | "partie_adverse" | "vendeur" | "acquereur" | "cedant" | "cessionnaire" | "contrepartie" | "bailleur" | "locataire" | ... 16 more ... | "autre";
type: "person" | "company";
name: string;
monitoring_enabled: boolean;
}[];
... 8 more ...;
updated_at: string;
}[]
data
.
Array<T>.length: number

Gets or sets the length of the array. This is a number one higher than the highest index in the array.

length
);
// Events, by position: read what happened since the last one you processed.
const
const events: {
data: {
id: string;
position: string;
type: "check.completed" | "check.failed" | "client.created" | "client.updated" | "client.vigilance_level_changed" | "client.risk_level_changed" | "client.preliminary_screening_completed" | "classification.validated" | "case.created" | "case.updated" | "case.risk_level_changed" | "report.generated" | "alert.created" | "alert.resolved" | "decision.pending" | "quota.exhausted" | "subscription.inactive" | "access.revoked" | "member.enrolled" | "member.joined";
timestamp: string;
livemode: boolean;
data: {
...;
};
}[];
has_more: boolean;
next_cursor: string | null;
}
events
= await
const lexopti: LexOptiClient
lexopti
.
events: {
list: Client<Record<never, never>, {
limit?: number | undefined;
cursor?: string | undefined;
type?: "check.completed" | "check.failed" | "client.created" | "client.updated" | "client.vigilance_level_changed" | "client.risk_level_changed" | "client.preliminary_screening_completed" | "classification.validated" | "case.created" | "case.updated" | "case.risk_level_changed" | "report.generated" | "alert.created" | "alert.resolved" | "decision.pending" | "quota.exhausted" | "subscription.inactive" | "access.revoked" | "member.enrolled" | "member.joined" | undefined;
after?: string | undefined;
}, {
...;
}, Error>;
}
events
.
list: Client
(input: {
limit?: number | undefined;
cursor?: string | undefined;
type?: "check.completed" | "check.failed" | "client.created" | "client.updated" | "client.vigilance_level_changed" | "client.risk_level_changed" | "client.preliminary_screening_completed" | "classification.validated" | "case.created" | "case.updated" | "case.risk_level_changed" | "report.generated" | "alert.created" | "alert.resolved" | "decision.pending" | "quota.exhausted" | "subscription.inactive" | "access.revoked" | "member.enrolled" | "member.joined" | undefined;
after?: string | undefined;
}, options?: FriendlyClientOptions<...> | undefined) => ClientPromiseResult<...>
list
({
after?: string | undefined
after
:
const lastPosition: string
lastPosition
,
limit?: number | undefined
limit
: 100 });
// Webhooks: the secret is answered once.
const
const endpoint: {
id: string;
url: string;
description: string | null;
event_types: ("check.completed" | "check.failed" | "client.created" | "client.updated" | "client.vigilance_level_changed" | "client.risk_level_changed" | "client.preliminary_screening_completed" | "classification.validated" | "case.created" | "case.updated" | "case.risk_level_changed" | "report.generated" | "alert.created" | "alert.resolved" | "decision.pending" | "quota.exhausted" | "subscription.inactive" | "access.revoked" | "member.enrolled" | "member.joined")[];
status: "enabled" | "disabled";
disabled_reason: "member" | ... 2 more ... | null;
created_at: string;
updated_at: string;
secret: string;
}
endpoint
= await
const lexopti: LexOptiClient
lexopti
.
webhookEndpoints: {
create: Client<Record<never, never>, {
url: string;
event_types: ("check.completed" | "check.failed" | "client.created" | "client.updated" | "client.vigilance_level_changed" | "client.risk_level_changed" | "client.preliminary_screening_completed" | "classification.validated" | "case.created" | "case.updated" | "case.risk_level_changed" | "report.generated" | "alert.created" | "alert.resolved" | "decision.pending" | "quota.exhausted" | "subscription.inactive" | "access.revoked" | "member.enrolled" | "member.joined")[];
description?: string | undefined;
}, {
...;
}, Error>;
... 7 more ...;
replayDelivery: Client<...>;
}
webhookEndpoints
.
create: Client
(input: {
url: string;
event_types: ("check.completed" | "check.failed" | "client.created" | "client.updated" | "client.vigilance_level_changed" | "client.risk_level_changed" | "client.preliminary_screening_completed" | "classification.validated" | "case.created" | "case.updated" | "case.risk_level_changed" | "report.generated" | "alert.created" | "alert.resolved" | "decision.pending" | "quota.exhausted" | "subscription.inactive" | "access.revoked" | "member.enrolled" | "member.joined")[];
description?: string | undefined;
}, options?: FriendlyClientOptions<...> | undefined) => ClientPromiseResult<...>
create
({
url: string
url
: "https://crm.example.com/lexopti/webhooks",
event_types: ("check.completed" | "check.failed" | "client.created" | "client.updated" | "client.vigilance_level_changed" | "client.risk_level_changed" | "client.preliminary_screening_completed" | "classification.validated" | "case.created" | "case.updated" | "case.risk_level_changed" | "report.generated" | "alert.created" | "alert.resolved" | "decision.pending" | "quota.exhausted" | "subscription.inactive" | "access.revoked" | "member.enrolled" | "member.joined")[]
event_types
: ["check.completed", "alert.created"],
});
// Keep it in your secret manager (Vault, AWS Secrets Manager…), never in a log.
await
const secretManager: {
save(name: string, value: string): Promise<void>;
}
secretManager
.
function save(name: string, value: string): Promise<void>
save
("lexopti-webhook-secret",
const endpoint: {
id: string;
url: string;
description: string | null;
event_types: ("check.completed" | "check.failed" | "client.created" | "client.updated" | "client.vigilance_level_changed" | "client.risk_level_changed" | "client.preliminary_screening_completed" | "classification.validated" | "case.created" | "case.updated" | "case.risk_level_changed" | "report.generated" | "alert.created" | "alert.resolved" | "decision.pending" | "quota.exhausted" | "subscription.inactive" | "access.revoked" | "member.enrolled" | "member.joined")[];
status: "enabled" | "disabled";
disabled_reason: "member" | ... 2 more ... | null;
created_at: string;
updated_at: string;
secret: string;
}
endpoint
.
secret: string
secret
);
await
const lexopti: LexOptiClient
lexopti
.
webhookEndpoints: {
create: Client<Record<never, never>, {
url: string;
event_types: ("check.completed" | "check.failed" | "client.created" | "client.updated" | "client.vigilance_level_changed" | "client.risk_level_changed" | "client.preliminary_screening_completed" | "classification.validated" | "case.created" | "case.updated" | "case.risk_level_changed" | "report.generated" | "alert.created" | "alert.resolved" | "decision.pending" | "quota.exhausted" | "subscription.inactive" | "access.revoked" | "member.enrolled" | "member.joined")[];
description?: string | undefined;
}, {
...;
}, Error>;
... 7 more ...;
replayDelivery: Client<...>;
}
webhookEndpoints
.
test: Client
(input: {
id: string;
}, options?: FriendlyClientOptions<Record<never, never>> | undefined) => ClientPromiseResult<{
id: string;
event_id: string | null;
type: string;
status: "pending" | "failed" | "cancelled" | "succeeded";
attempts: number;
next_attempt_at: string | null;
last_attempt_at: string | null;
last_response_status: number | null;
last_error: string | null;
replay_of: string | null;
created_at: string;
completed_at: string | null;
}, Error>
test
({
id: string
id
:
const endpoint: {
id: string;
url: string;
description: string | null;
event_types: ("check.completed" | "check.failed" | "client.created" | "client.updated" | "client.vigilance_level_changed" | "client.risk_level_changed" | "client.preliminary_screening_completed" | "classification.validated" | "case.created" | "case.updated" | "case.risk_level_changed" | "report.generated" | "alert.created" | "alert.resolved" | "decision.pending" | "quota.exhausted" | "subscription.inactive" | "access.revoked" | "member.enrolled" | "member.joined")[];
status: "enabled" | "disabled";
disabled_reason: "member" | ... 2 more ... | null;
created_at: string;
updated_at: string;
secret: string;
}
endpoint
.
id: string
id
});
// A link opening the client in LexOpti, for the member.
const
const link: {
url: string;
expires_at: string;
}
link
= await
const lexopti: LexOptiClient
lexopti
.
deepLinks: {
create: Client<Record<never, never>, {
client_id?: string | undefined;
case_id?: string | undefined;
}, {
url: string;
expires_at: string;
}, Error>;
}
deepLinks
.
create: Client
(input: {
client_id?: string | undefined;
case_id?: string | undefined;
}, options?: FriendlyClientOptions<Record<never, never>> | undefined) => ClientPromiseResult<{
url: string;
expires_at: string;
}, Error>
create
({
client_id?: string | undefined
client_id
:
const client: {
id: string;
external_ref: string | null;
type: "person" | "company";
name: string;
person: {
first_name: string | null;
last_name: string | null;
usage_name: string | null;
birth_date: string | null;
birth_city: string | null;
birth_country: string | null;
nationalities: string[];
} | null;
company: {
name: string | null;
siren: string | null;
siret: string | null;
legal_form: string | null;
registration_country: string | null;
rcs: string | null;
} | null;
address: {
line: string | null;
postal_code: string | null;
city: string | null;
country: string | null;
};
... 10 more ...;
cases?: {
...;
} | undefined;
}
client
.
id: string
id
});
// The organization's credits.
const
const usage: {
unit: "credit";
credits: {
balance: number;
frozen: number;
low_balance_threshold: number;
};
dossiers: {
active: number;
paused: number;
renewals_due: number;
renewal_credits: number;
};
subscription_active: boolean;
read_only: boolean;
}
usage
= await
const lexopti: LexOptiClient
lexopti
.
usage: {
get: Client<Record<never, never>, unknown, {
unit: "credit";
credits: {
balance: number;
frozen: number;
low_balance_threshold: number;
};
dossiers: {
active: number;
paused: number;
renewals_due: number;
renewal_credits: number;
};
subscription_active: boolean;
read_only: boolean;
}, Error>;
}
usage
.
get: Client
(input?: unknown, options?: FriendlyClientOptions<Record<never, never>> | undefined) => ClientPromiseResult<{
unit: "credit";
credits: {
balance: number;
frozen: number;
low_balance_threshold: number;
};
dossiers: {
active: number;
paused: number;
renewals_due: number;
renewal_credits: number;
};
subscription_active: boolean;
read_only: boolean;
}, Error>
get
();
var console: Console

The console module provides a simple debugging console that is similar to the JavaScript console mechanism provided by web browsers.

The module exports two specific components:

  • A Console class with methods such as console.log(), console.error() and console.warn() that can be used to write to any Node.js stream.
  • A global console instance configured to write to process.stdout and process.stderr. The global console can be used without importing the node:console module.

Warning: The global console object's methods are neither consistently synchronous like the browser APIs they resemble, nor are they consistently asynchronous like all other Node.js streams. See the note on process I/O for more information.

Example using the global console:

console.log('hello world');
// Prints: hello world, to stdout
console.log('hello %s', 'world');
// Prints: hello world, to stdout
console.error(new Error('Whoops, something bad happened'));
// Prints error message and stack trace to stderr:
// Error: Whoops, something bad happened
// at [eval]:5:15
// at Script.runInThisContext (node:vm:132:18)
// at Object.runInThisContext (node:vm:309:38)
// at node:internal/process/execution:77:19
// at [eval]-wrapper:6:22
// at evalScript (node:internal/process/execution:76:60)
// at node:internal/main/eval_string:23:3
const name = 'Will Robinson';
console.warn(`Danger ${name}! Danger!`);
// Prints: Danger Will Robinson! Danger!, to stderr

Example using the Console class:

const out = getStreamSomehow();
const err = getStreamSomehow();
const myConsole = new console.Console(out, err);
myConsole.log('hello world');
// Prints: hello world, to out
myConsole.log('hello %s', 'world');
// Prints: hello world, to out
myConsole.error(new Error('Whoops, something bad happened'));
// Prints: [Error: Whoops, something bad happened], to err
const name = 'Will Robinson';
myConsole.warn(`Danger ${name}! Danger!`);
// Prints: Danger Will Robinson! Danger!, to err

@see ― source

console
.
Console.log(message?: any, ...optionalParams: any[]): void (+1 overload)

Prints to stdout with newline. Multiple arguments can be passed, with the first used as the primary message and all additional used as substitution values similar to printf(3) (the arguments are all passed to util.format()).

const count = 5;
console.log('count: %d', count);
// Prints: count: 5, to stdout
console.log('count:', count);
// Prints: count: 5, to stdout

See util.format() for more information.

@since ― v0.1.100

log
(
const events: {
data: {
id: string;
position: string;
type: "check.completed" | "check.failed" | "client.created" | "client.updated" | "client.vigilance_level_changed" | "client.risk_level_changed" | "client.preliminary_screening_completed" | "classification.validated" | "case.created" | "case.updated" | "case.risk_level_changed" | "report.generated" | "alert.created" | "alert.resolved" | "decision.pending" | "quota.exhausted" | "subscription.inactive" | "access.revoked" | "member.enrolled" | "member.joined";
timestamp: string;
livemode: boolean;
data: {
...;
};
}[];
has_more: boolean;
next_cursor: string | null;
}
events
.
data: {
id: string;
position: string;
type: "check.completed" | "check.failed" | "client.created" | "client.updated" | "client.vigilance_level_changed" | "client.risk_level_changed" | "client.preliminary_screening_completed" | "classification.validated" | "case.created" | "case.updated" | "case.risk_level_changed" | "report.generated" | "alert.created" | "alert.resolved" | "decision.pending" | "quota.exhausted" | "subscription.inactive" | "access.revoked" | "member.enrolled" | "member.joined";
timestamp: string;
livemode: boolean;
data: {
...;
};
}[]
data
.
Array<T>.length: number

Gets or sets the length of the array. This is a number one higher than the highest index in the array.

length
,
const link: {
url: string;
expires_at: string;
}
link
.
url: string
url
,
const usage: {
unit: "credit";
credits: {
balance: number;
frozen: number;
low_balance_threshold: number;
};
dossiers: {
active: number;
paused: number;
renewals_due: number;
renewal_credits: number;
};
subscription_active: boolean;
read_only: boolean;
}
usage
.
credits: {
balance: number;
frozen: number;
low_balance_threshold: number;
}
credits
.
balance: number
balance
);

The API reference details every field; every operation shows its TypeScript example first.

Lists answer one page at a time. paginate walks every page for you:

import {
function paginate<Input extends {
cursor?: string;
}, Item>(list: ListOperation<Input, Item>, input: Input): AsyncGenerator<Item, void, undefined>

Every item of a list, page after page: for await (const client of paginate(lexopti.clients.list, { limit: 100 })).

@yields ― {Item} Each item of each page, in the list's order.

paginate
} from "@lexopti/sdk";
for await (const
const alert: {
id: string;
client_id: string;
case_id: string | null;
entity_id: string;
source: "international_sanctions" | "eu_sanctions" | "french_asset_freezes" | "politically_exposed_persons" | "high_risk_countries" | "bodacc_announcements" | "bodacc_insolvency" | "company_register" | "adverse_media" | null;
status: "pending" | "reviewed" | "dismissed" | "confirmed";
level: "simplified" | "standard" | "enhanced";
change: string | null;
subject: string | null;
detail: string | null;
source_name: string;
url: string | null;
created_at: string;
reviewed_at: string | null;
review_notes: string | null;
}
alert
of
paginate<{
limit?: number | undefined;
cursor?: string | undefined;
client_id?: string | undefined;
client_ids?: string | undefined;
status?: "pending" | "reviewed" | "dismissed" | "confirmed" | undefined;
}, {
id: string;
client_id: string;
case_id: string | null;
entity_id: string;
source: "international_sanctions" | "eu_sanctions" | "french_asset_freezes" | "politically_exposed_persons" | "high_risk_countries" | "bodacc_announcements" | "bodacc_insolvency" | "company_register" | "adverse_media" | null;
status: "pending" | "reviewed" | "dismissed" | "confirmed";
... 8 more ...;
review_notes: string | null;
}>(list: ListOperation<...>, input: {
limit?: number | undefined;
cursor?: string | undefined;
client_id?: string | undefined;
client_ids?: string | undefined;
status?: "pending" | "reviewed" | "dismissed" | "confirmed" | undefined;
}): AsyncGenerator<...>

Every item of a list, page after page: for await (const client of paginate(lexopti.clients.list, { limit: 100 })).

@yields ― {Item} Each item of each page, in the list's order.

paginate
(
const lexopti: LexOptiClient
lexopti
.
alerts: {
list: Client<Record<never, never>, {
limit?: number | undefined;
cursor?: string | undefined;
client_id?: string | undefined;
client_ids?: string | undefined;
status?: "pending" | "reviewed" | "dismissed" | "confirmed" | undefined;
}, {
data: {
id: string;
client_id: string;
case_id: string | null;
entity_id: string;
source: "international_sanctions" | "eu_sanctions" | "french_asset_freezes" | "politically_exposed_persons" | "high_risk_countries" | "bodacc_announcements" | "bodacc_insolvency" | "company_register" | "adverse_media" | null;
... 9 more ...;
review_notes: string | null;
}[];
has_more: boolean;
next_cursor: string | null;
}, Error>;
get: Client<...>;
update: Client<...>;
}
alerts
.
list: Client<Record<never, never>, {
limit?: number | undefined;
cursor?: string | undefined;
client_id?: string | undefined;
client_ids?: string | undefined;
status?: "pending" | "reviewed" | "dismissed" | "confirmed" | undefined;
}, {
data: {
id: string;
client_id: string;
case_id: string | null;
entity_id: string;
source: "international_sanctions" | "eu_sanctions" | "french_asset_freezes" | "politically_exposed_persons" | "high_risk_countries" | "bodacc_announcements" | "bodacc_insolvency" | "company_register" | "adverse_media" | null;
... 9 more ...;
review_notes: string | null;
}[];
has_more: boolean;
next_cursor: string | null;
}, Error>
list
, {
status?: "pending" | "reviewed" | "dismissed" | "confirmed" | undefined
status
: "pending",
limit?: number | undefined
limit
: 100,
})) {
var console: Console

The console module provides a simple debugging console that is similar to the JavaScript console mechanism provided by web browsers.

The module exports two specific components:

  • A Console class with methods such as console.log(), console.error() and console.warn() that can be used to write to any Node.js stream.
  • A global console instance configured to write to process.stdout and process.stderr. The global console can be used without importing the node:console module.

Warning: The global console object's methods are neither consistently synchronous like the browser APIs they resemble, nor are they consistently asynchronous like all other Node.js streams. See the note on process I/O for more information.

Example using the global console:

console.log('hello world');
// Prints: hello world, to stdout
console.log('hello %s', 'world');
// Prints: hello world, to stdout
console.error(new Error('Whoops, something bad happened'));
// Prints error message and stack trace to stderr:
// Error: Whoops, something bad happened
// at [eval]:5:15
// at Script.runInThisContext (node:vm:132:18)
// at Object.runInThisContext (node:vm:309:38)
// at node:internal/process/execution:77:19
// at [eval]-wrapper:6:22
// at evalScript (node:internal/process/execution:76:60)
// at node:internal/main/eval_string:23:3
const name = 'Will Robinson';
console.warn(`Danger ${name}! Danger!`);
// Prints: Danger Will Robinson! Danger!, to stderr

Example using the Console class:

const out = getStreamSomehow();
const err = getStreamSomehow();
const myConsole = new console.Console(out, err);
myConsole.log('hello world');
// Prints: hello world, to out
myConsole.log('hello %s', 'world');
// Prints: hello world, to out
myConsole.error(new Error('Whoops, something bad happened'));
// Prints: [Error: Whoops, something bad happened], to err
const name = 'Will Robinson';
myConsole.warn(`Danger ${name}! Danger!`);
// Prints: Danger Will Robinson! Danger!, to err

@see ― source

console
.
Console.log(message?: any, ...optionalParams: any[]): void (+1 overload)

Prints to stdout with newline. Multiple arguments can be passed, with the first used as the primary message and all additional used as substitution values similar to printf(3) (the arguments are all passed to util.format()).

const count = 5;
console.log('count: %d', count);
// Prints: count: 5, to stdout
console.log('count:', count);
// Prints: count: 5, to stdout

See util.format() for more information.

@since ― v0.1.100

log
(
const alert: {
id: string;
client_id: string;
case_id: string | null;
entity_id: string;
source: "international_sanctions" | "eu_sanctions" | "french_asset_freezes" | "politically_exposed_persons" | "high_risk_countries" | "bodacc_announcements" | "bodacc_insolvency" | "company_register" | "adverse_media" | null;
status: "pending" | "reviewed" | "dismissed" | "confirmed";
level: "simplified" | "standard" | "enhanced";
change: string | null;
subject: string | null;
detail: string | null;
source_name: string;
url: string | null;
created_at: string;
reviewed_at: string | null;
review_notes: string | null;
}
alert
.
id: string
id
,
const alert: {
id: string;
client_id: string;
case_id: string | null;
entity_id: string;
source: "international_sanctions" | "eu_sanctions" | "french_asset_freezes" | "politically_exposed_persons" | "high_risk_countries" | "bodacc_announcements" | "bodacc_insolvency" | "company_register" | "adverse_media" | null;
status: "pending" | "reviewed" | "dismissed" | "confirmed";
level: "simplified" | "standard" | "enhanced";
change: string | null;
subject: string | null;
detail: string | null;
source_name: string;
url: string | null;
created_at: string;
reviewed_at: string | null;
review_notes: string | null;
}
alert
.
level: "simplified" | "standard" | "enhanced"
level
,
const alert: {
id: string;
client_id: string;
case_id: string | null;
entity_id: string;
source: "international_sanctions" | "eu_sanctions" | "french_asset_freezes" | "politically_exposed_persons" | "high_risk_countries" | "bodacc_announcements" | "bodacc_insolvency" | "company_register" | "adverse_media" | null;
status: "pending" | "reviewed" | "dismissed" | "confirmed";
level: "simplified" | "standard" | "enhanced";
change: string | null;
subject: string | null;
detail: string | null;
source_name: string;
url: string | null;
created_at: string;
reviewed_at: string | null;
review_notes: string | null;
}
alert
.
source: "international_sanctions" | "eu_sanctions" | "french_asset_freezes" | "politically_exposed_persons" | "high_risk_countries" | "bodacc_announcements" | "bodacc_insolvency" | "company_register" | "adverse_media" | null
source
);
}

A failed call throws. problemOf reads its problem details (RFC 9457); branch on code, which is stable, never on the message.

import {
function problemOf(error: unknown): ProblemDetails | null

The problem details (RFC 9457) of a failed call: code is stable, branch on it; request_id names the request for LexOpti support; null for an error that did not come from the API.

problemOf
} from "@lexopti/sdk";
try {
await
const lexopti: LexOptiClient
lexopti
.
checks: {
list: Client<Record<never, never>, {
limit?: number | undefined;
cursor?: string | undefined;
client_id?: string | undefined;
}, {
data: {
id: string;
client_id: string;
status: "running" | "completed" | "failed";
sources: {
source: "international_sanctions" | "eu_sanctions" | "french_asset_freezes" | "politically_exposed_persons" | "high_risk_countries" | "bodacc_announcements" | "bodacc_insolvency" | "company_register" | "adverse_media";
entity_id: string | null;
status: "pending" | "running" | "completed" | "failed" | "skipped";
completed_at: string | null;
}[];
created_at: string;
completed_at: string | null;
}[];
has_more: boolean;
next_cursor: string | null;
}, Error>;
get: Client<...>;
create: Client<...>;
}
checks
.
create: Client
(input: {
client_id: string;
case_id?: string | undefined;
}, options?: FriendlyClientOptions<Record<never, never>> | undefined) => ClientPromiseResult<{
id: string;
client_id: string;
status: "running" | "completed" | "failed";
sources: {
source: "international_sanctions" | "eu_sanctions" | "french_asset_freezes" | "politically_exposed_persons" | "high_risk_countries" | "bodacc_announcements" | "bodacc_insolvency" | "company_register" | "adverse_media";
entity_id: string | null;
status: "pending" | "running" | "completed" | "failed" | "skipped";
completed_at: string | null;
}[];
created_at: string;
completed_at: string | null;
}, Error>
create
({
client_id: string
client_id
: "9b2f4c1e-0d3a-4e5b-8c7d-6a1f2e3d4c5b",
});
} catch (
var error: unknown
error
) {
const
const problem: {
type: string;
title: string;
status: number;
code: string;
detail: string;
errors?: {
path: string;
message: string;
}[] | undefined;
missing?: {
entity_id: string;
name: string;
is_main_entity: boolean;
fields: string[];
}[] | undefined;
cases?: {
id: string;
name: string | null;
}[] | undefined;
request_id?: string | undefined;
} | null
problem
=
function problemOf(error: unknown): ProblemDetails | null

The problem details (RFC 9457) of a failed call: code is stable, branch on it; request_id names the request for LexOpti support; null for an error that did not come from the API.

problemOf
(
var error: unknown
error
);
if (
const problem: {
type: string;
title: string;
status: number;
code: string;
detail: string;
errors?: {
path: string;
message: string;
}[] | undefined;
missing?: {
entity_id: string;
name: string;
is_main_entity: boolean;
fields: string[];
}[] | undefined;
cases?: {
id: string;
name: string | null;
}[] | undefined;
request_id?: string | undefined;
} | null
problem
?.
code: string | undefined
code
=== "not_found") {
// The client is not in this organization.
} else if (
const problem: {
type: string;
title: string;
status: number;
code: string;
detail: string;
errors?: {
path: string;
message: string;
}[] | undefined;
missing?: {
entity_id: string;
name: string;
is_main_entity: boolean;
fields: string[];
}[] | undefined;
cases?: {
id: string;
name: string | null;
}[] | undefined;
request_id?: string | undefined;
} | null
problem
?.
code: string | undefined
code
=== "quota_exceeded") {
// The organization's credits cannot pay the client's dossier.
} else {
throw
var error: unknown
error
;
}
}

problemOf returns null for an error that did not come from the API (network, timeout). The errors page lists every code. Log the problem’s request_id: it names the request when you write to LexOpti support (request ids).

webhooks.verify checks the Standard Webhooks signature and timestamp, then returns the typed event: one of the event types, or webhook.test, the delivery webhookEndpoints.test sends. Give it the raw body, before any JSON parsing.

import {
const webhooks: {
verify: (payload: string, headers: Headers | Record<string, string>, secret: string) => WebhookEvent;
}
webhooks
} from "@lexopti/sdk";
const
const event: WebhookEvent
event
=
const webhooks: {
verify: (payload: string, headers: Headers | Record<string, string>, secret: string) => WebhookEvent;
}
webhooks
.
verify: (payload: string, headers: Headers | Record<string, string>, secret: string) => WebhookEvent

Verifies a LexOpti webhook (Standard Webhooks) and returns its event: pass the raw body, the request headers and the endpoint secret (whsec_…). Throws when the signature or the timestamp is wrong. The event's id is the webhook-id header: deduplicate on it.

verify
(
const rawBody: string
rawBody
,
const requestHeaders: Headers
requestHeaders
,
var process: NodeJS.Process
process
.
NodeJS.Process.env: NodeJS.ProcessEnv

The process.env property returns an object containing the user environment. See environ(7).

An example of this object looks like:

{
TERM: 'xterm-256color',
SHELL: '/usr/local/bin/bash',
USER: 'maciej',
PATH: '~/.bin/:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin',
PWD: '/Users/maciej',
EDITOR: 'vim',
SHLVL: '1',
HOME: '/Users/maciej',
LOGNAME: 'maciej',
_: '/usr/local/bin/node'
}

It is possible to modify this object, but such modifications will not be reflected outside the Node.js process, or (unless explicitly requested) to other Worker threads. In other words, the following example would not work:

Terminal window
node -e 'process.env.foo = "bar"' &#x26;&#x26; echo $foo

While the following will:

import { env } from 'node:process';
env.foo = 'bar';
console.log(env.foo);

Assigning a property on process.env will implicitly convert the value to a string. This behavior is deprecated. Future versions of Node.js may throw an error when the value is not a string, number, or boolean.

import { env } from 'node:process';
env.test = null;
console.log(env.test);
// => 'null'
env.test = undefined;
console.log(env.test);
// => 'undefined'

Use delete to delete a property from process.env.

import { env } from 'node:process';
env.TEST = 1;
delete env.TEST;
console.log(env.TEST);
// => undefined

On Windows operating systems, environment variables are case-insensitive.

import { env } from 'node:process';
env.TEST = 1;
console.log(env.test);
// => 1

Unless explicitly specified when creating a Worker instance, each Worker thread has its own copy of process.env, based on its parent thread's process.env, or whatever was specified as the env option to the Worker constructor. Changes to process.env will not be visible across Worker threads, and only the main thread can make changes that are visible to the operating system or to native add-ons. On Windows, a copy of process.env on a Worker instance operates in a case-sensitive manner unlike the main thread.

@since ― v0.1.27

env
.
string | undefined
LEXOPTI_WEBHOOK_SECRET
?? ""
);
if (
const event: WebhookEvent
event
.
type: WebhookEventType
type
=== "check.completed") {
var console: Console

The console module provides a simple debugging console that is similar to the JavaScript console mechanism provided by web browsers.

The module exports two specific components:

  • A Console class with methods such as console.log(), console.error() and console.warn() that can be used to write to any Node.js stream.
  • A global console instance configured to write to process.stdout and process.stderr. The global console can be used without importing the node:console module.

Warning: The global console object's methods are neither consistently synchronous like the browser APIs they resemble, nor are they consistently asynchronous like all other Node.js streams. See the note on process I/O for more information.

Example using the global console:

console.log('hello world');
// Prints: hello world, to stdout
console.log('hello %s', 'world');
// Prints: hello world, to stdout
console.error(new Error('Whoops, something bad happened'));
// Prints error message and stack trace to stderr:
// Error: Whoops, something bad happened
// at [eval]:5:15
// at Script.runInThisContext (node:vm:132:18)
// at Object.runInThisContext (node:vm:309:38)
// at node:internal/process/execution:77:19
// at [eval]-wrapper:6:22
// at evalScript (node:internal/process/execution:76:60)
// at node:internal/main/eval_string:23:3
const name = 'Will Robinson';
console.warn(`Danger ${name}! Danger!`);
// Prints: Danger Will Robinson! Danger!, to stderr

Example using the Console class:

const out = getStreamSomehow();
const err = getStreamSomehow();
const myConsole = new console.Console(out, err);
myConsole.log('hello world');
// Prints: hello world, to out
myConsole.log('hello %s', 'world');
// Prints: hello world, to out
myConsole.error(new Error('Whoops, something bad happened'));
// Prints: [Error: Whoops, something bad happened], to err
const name = 'Will Robinson';
myConsole.warn(`Danger ${name}! Danger!`);
// Prints: Danger Will Robinson! Danger!, to err

@see ― source

console
.
Console.log(message?: any, ...optionalParams: any[]): void (+1 overload)

Prints to stdout with newline. Multiple arguments can be passed, with the first used as the primary message and all additional used as substitution values similar to printf(3) (the arguments are all passed to util.format()).

const count = 5;
console.log('count: %d', count);
// Prints: count: 5, to stdout
console.log('count:', count);
// Prints: count: 5, to stdout

See util.format() for more information.

@since ― v0.1.100

log
(
const event: WebhookEvent
event
.
data: Record<string, string>
data
.
string
client_id
,
const event: WebhookEvent
event
.
livemode: boolean
livemode
);
}

It throws when the signature, the timestamp or the payload is wrong: answer 400. Deduplicate on event.id (the webhook-id header): a delivery may come twice.

@lexopti/sdk/contract exports the contract the API itself serves: its zod schemas and their types, to validate or store what you receive.

import type {
type ClientDto = {
id: string;
external_ref: string | null;
type: "person" | "company";
name: string;
person: {
first_name: string | null;
last_name: string | null;
usage_name: string | null;
birth_date: string | null;
birth_city: string | null;
birth_country: string | null;
nationalities: string[];
} | null;
company: {
name: string | null;
siren: string | null;
siret: string | null;
legal_form: string | null;
registration_country: string | null;
rcs: string | null;
} | null;
address: {
line: string | null;
postal_code: string | null;
city: string | null;
country: string | null;
};
... 10 more ...;
cases?: {
...;
} | undefined;
}
ClientDto
,
type EventDto = {
id: string;
position: string;
type: "check.completed" | "check.failed" | "client.created" | "client.updated" | "client.vigilance_level_changed" | "client.risk_level_changed" | "client.preliminary_screening_completed" | "classification.validated" | "case.created" | "case.updated" | "case.risk_level_changed" | "report.generated" | "alert.created" | "alert.resolved" | "decision.pending" | "quota.exhausted" | "subscription.inactive" | "access.revoked" | "member.enrolled" | "member.joined";
timestamp: string;
livemode: boolean;
data: Record<...>;
}
EventDto
,
type Problem = {
type: string;
title: string;
status: number;
code: string;
detail: string;
request_id: string;
errors?: {
path: string;
message: string;
}[] | undefined;
missing?: {
entity_id: string;
name: string;
is_main_entity: boolean;
fields: string[];
}[] | undefined;
cases?: {
id: string;
name: string | null;
}[] | undefined;
}
Problem
} from "@lexopti/sdk/contract";
import {
const eventSchema: ZodObject<{
id: ZodString;
position: ZodString;
type: ZodEnum<{
"check.completed": "check.completed";
"check.failed": "check.failed";
"client.created": "client.created";
"client.updated": "client.updated";
"client.vigilance_level_changed": "client.vigilance_level_changed";
"client.risk_level_changed": "client.risk_level_changed";
"client.preliminary_screening_completed": "client.preliminary_screening_completed";
"classification.validated": "classification.validated";
"case.created": "case.created";
"case.updated": "case.updated";
"case.risk_level_changed": "case.risk_level_changed";
... 8 more ...;
"member.joined": "member.joined";
}>;
timestamp: ZodISODateTime;
livemode: ZodBoolean;
data: ZodRecord<...>;
}, $strip>
eventSchema
} from "@lexopti/sdk/contract";
function
function store(client: ClientDto, event: EventDto, problem: Problem | null): void
store
(
client: {
id: string;
external_ref: string | null;
type: "person" | "company";
name: string;
person: {
first_name: string | null;
last_name: string | null;
usage_name: string | null;
birth_date: string | null;
birth_city: string | null;
birth_country: string | null;
nationalities: string[];
} | null;
company: {
name: string | null;
siren: string | null;
siret: string | null;
legal_form: string | null;
registration_country: string | null;
rcs: string | null;
} | null;
address: {
line: string | null;
postal_code: string | null;
city: string | null;
country: string | null;
};
... 10 more ...;
cases?: {
...;
} | undefined;
}
client
:
type ClientDto = {
id: string;
external_ref: string | null;
type: "person" | "company";
name: string;
person: {
first_name: string | null;
last_name: string | null;
usage_name: string | null;
birth_date: string | null;
birth_city: string | null;
birth_country: string | null;
nationalities: string[];
} | null;
company: {
name: string | null;
siren: string | null;
siret: string | null;
legal_form: string | null;
registration_country: string | null;
rcs: string | null;
} | null;
address: {
line: string | null;
postal_code: string | null;
city: string | null;
country: string | null;
};
... 10 more ...;
cases?: {
...;
} | undefined;
}
ClientDto
,
event: {
id: string;
position: string;
type: "check.completed" | "check.failed" | "client.created" | "client.updated" | "client.vigilance_level_changed" | "client.risk_level_changed" | "client.preliminary_screening_completed" | "classification.validated" | "case.created" | "case.updated" | "case.risk_level_changed" | "report.generated" | "alert.created" | "alert.resolved" | "decision.pending" | "quota.exhausted" | "subscription.inactive" | "access.revoked" | "member.enrolled" | "member.joined";
timestamp: string;
livemode: boolean;
data: Record<...>;
}
event
:
type EventDto = {
id: string;
position: string;
type: "check.completed" | "check.failed" | "client.created" | "client.updated" | "client.vigilance_level_changed" | "client.risk_level_changed" | "client.preliminary_screening_completed" | "classification.validated" | "case.created" | "case.updated" | "case.risk_level_changed" | "report.generated" | "alert.created" | "alert.resolved" | "decision.pending" | "quota.exhausted" | "subscription.inactive" | "access.revoked" | "member.enrolled" | "member.joined";
timestamp: string;
livemode: boolean;
data: Record<...>;
}
EventDto
,
problem: {
type: string;
title: string;
status: number;
code: string;
detail: string;
request_id: string;
errors?: {
path: string;
message: string;
}[] | undefined;
missing?: {
entity_id: string;
name: string;
is_main_entity: boolean;
fields: string[];
}[] | undefined;
cases?: {
id: string;
name: string | null;
}[] | undefined;
} | null
problem
:
type Problem = {
type: string;
title: string;
status: number;
code: string;
detail: string;
request_id: string;
errors?: {
path: string;
message: string;
}[] | undefined;
missing?: {
entity_id: string;
name: string;
is_main_entity: boolean;
fields: string[];
}[] | undefined;
cases?: {
id: string;
name: string | null;
}[] | undefined;
}
Problem
| null) {
var console: Console

The console module provides a simple debugging console that is similar to the JavaScript console mechanism provided by web browsers.

The module exports two specific components:

  • A Console class with methods such as console.log(), console.error() and console.warn() that can be used to write to any Node.js stream.
  • A global console instance configured to write to process.stdout and process.stderr. The global console can be used without importing the node:console module.

Warning: The global console object's methods are neither consistently synchronous like the browser APIs they resemble, nor are they consistently asynchronous like all other Node.js streams. See the note on process I/O for more information.

Example using the global console:

console.log('hello world');
// Prints: hello world, to stdout
console.log('hello %s', 'world');
// Prints: hello world, to stdout
console.error(new Error('Whoops, something bad happened'));
// Prints error message and stack trace to stderr:
// Error: Whoops, something bad happened
// at [eval]:5:15
// at Script.runInThisContext (node:vm:132:18)
// at Object.runInThisContext (node:vm:309:38)
// at node:internal/process/execution:77:19
// at [eval]-wrapper:6:22
// at evalScript (node:internal/process/execution:76:60)
// at node:internal/main/eval_string:23:3
const name = 'Will Robinson';
console.warn(`Danger ${name}! Danger!`);
// Prints: Danger Will Robinson! Danger!, to stderr

Example using the Console class:

const out = getStreamSomehow();
const err = getStreamSomehow();
const myConsole = new console.Console(out, err);
myConsole.log('hello world');
// Prints: hello world, to out
myConsole.log('hello %s', 'world');
// Prints: hello world, to out
myConsole.error(new Error('Whoops, something bad happened'));
// Prints: [Error: Whoops, something bad happened], to err
const name = 'Will Robinson';
myConsole.warn(`Danger ${name}! Danger!`);
// Prints: Danger Will Robinson! Danger!, to err

@see ― source

console
.
Console.log(message?: any, ...optionalParams: any[]): void (+1 overload)

Prints to stdout with newline. Multiple arguments can be passed, with the first used as the primary message and all additional used as substitution values similar to printf(3) (the arguments are all passed to util.format()).

const count = 5;
console.log('count: %d', count);
// Prints: count: 5, to stdout
console.log('count:', count);
// Prints: count: 5, to stdout

See util.format() for more information.

@since ― v0.1.100

log
(
client: {
id: string;
external_ref: string | null;
type: "person" | "company";
name: string;
person: {
first_name: string | null;
last_name: string | null;
usage_name: string | null;
birth_date: string | null;
birth_city: string | null;
birth_country: string | null;
nationalities: string[];
} | null;
company: {
name: string | null;
siren: string | null;
siret: string | null;
legal_form: string | null;
registration_country: string | null;
rcs: string | null;
} | null;
address: {
line: string | null;
postal_code: string | null;
city: string | null;
country: string | null;
};
... 10 more ...;
cases?: {
...;
} | undefined;
}
client
.
risk_level: "simplified" | "standard" | "enhanced" | null
risk_level
,
event: {
id: string;
position: string;
type: "check.completed" | "check.failed" | "client.created" | "client.updated" | "client.vigilance_level_changed" | "client.risk_level_changed" | "client.preliminary_screening_completed" | "classification.validated" | "case.created" | "case.updated" | "case.risk_level_changed" | "report.generated" | "alert.created" | "alert.resolved" | "decision.pending" | "quota.exhausted" | "subscription.inactive" | "access.revoked" | "member.enrolled" | "member.joined";
timestamp: string;
livemode: boolean;
data: Record<...>;
}
event
.
type: "check.completed" | "check.failed" | "client.created" | "client.updated" | "client.vigilance_level_changed" | "client.risk_level_changed" | "client.preliminary_screening_completed" | "classification.validated" | "case.created" | "case.updated" | "case.risk_level_changed" | "report.generated" | "alert.created" | "alert.resolved" | "decision.pending" | "quota.exhausted" | "subscription.inactive" | "access.revoked" | "member.enrolled" | "member.joined"
type
,
problem: {
type: string;
title: string;
status: number;
code: string;
detail: string;
request_id: string;
errors?: {
path: string;
message: string;
}[] | undefined;
missing?: {
entity_id: string;
name: string;
is_main_entity: boolean;
fields: string[];
}[] | undefined;
cases?: {
id: string;
name: string | null;
}[] | undefined;
} | null
problem
?.
code: string | undefined
code
);
}
const
const parsed: ZodSafeParseResult<{
id: string;
position: string;
type: "check.completed" | "check.failed" | "client.created" | "client.updated" | "client.vigilance_level_changed" | "client.risk_level_changed" | "client.preliminary_screening_completed" | "classification.validated" | "case.created" | "case.updated" | "case.risk_level_changed" | "report.generated" | "alert.created" | "alert.resolved" | "decision.pending" | "quota.exhausted" | "subscription.inactive" | "access.revoked" | "member.enrolled" | "member.joined";
timestamp: string;
livemode: boolean;
data: Record<...>;
}>
parsed
=
const eventSchema: ZodObject<{
id: ZodString;
position: ZodString;
type: ZodEnum<{
"check.completed": "check.completed";
"check.failed": "check.failed";
"client.created": "client.created";
"client.updated": "client.updated";
"client.vigilance_level_changed": "client.vigilance_level_changed";
"client.risk_level_changed": "client.risk_level_changed";
"client.preliminary_screening_completed": "client.preliminary_screening_completed";
"classification.validated": "classification.validated";
"case.created": "case.created";
"case.updated": "case.updated";
"case.risk_level_changed": "case.risk_level_changed";
... 8 more ...;
"member.joined": "member.joined";
}>;
timestamp: ZodISODateTime;
livemode: ZodBoolean;
data: ZodRecord<...>;
}, $strip>
eventSchema
.
ZodType<any, any, $ZodObjectInternals<{ id: ZodString; position: ZodString; type: ZodEnum<{ "check.completed": "check.completed"; "check.failed": "check.failed"; "client.created": "client.created"; ... 16 more ...; "member.joined": "member.joined"; }>; timestamp: ZodISODateTime; livemode: ZodBoolean; data: ZodRecord<...>; }, $strip>>.safeParse(data: unknown, params?: ParseContext<$ZodIssue>): ZodSafeParseResult<{
id: string;
position: string;
type: "check.completed" | "check.failed" | "client.created" | "client.updated" | "client.vigilance_level_changed" | "client.risk_level_changed" | "client.preliminary_screening_completed" | "classification.validated" | "case.created" | "case.updated" | "case.risk_level_changed" | "report.generated" | "alert.created" | "alert.resolved" | "decision.pending" | "quota.exhausted" | "subscription.inactive" | "access.revoked" | "member.enrolled" | "member.joined";
timestamp: string;
livemode: boolean;
data: Record<...>;
}>
safeParse
(
var JSON: JSON

An intrinsic object that provides functions to convert JavaScript values to and from the JavaScript Object Notation (JSON) format.

JSON
.
JSON.parse(text: string, reviver?: (this: any, key: string, value: any) => any): any

Converts a JavaScript Object Notation (JSON) string into an object.

@param ― text A valid JSON string.

@param ― reviver A function that transforms the results. This function is called for each member of the object. If a member contains nested objects, the nested objects are transformed before the parent object is.

@throws ― {SyntaxError} If text is not valid JSON.

parse
("{}"));
var console: Console

The console module provides a simple debugging console that is similar to the JavaScript console mechanism provided by web browsers.

The module exports two specific components:

  • A Console class with methods such as console.log(), console.error() and console.warn() that can be used to write to any Node.js stream.
  • A global console instance configured to write to process.stdout and process.stderr. The global console can be used without importing the node:console module.

Warning: The global console object's methods are neither consistently synchronous like the browser APIs they resemble, nor are they consistently asynchronous like all other Node.js streams. See the note on process I/O for more information.

Example using the global console:

console.log('hello world');
// Prints: hello world, to stdout
console.log('hello %s', 'world');
// Prints: hello world, to stdout
console.error(new Error('Whoops, something bad happened'));
// Prints error message and stack trace to stderr:
// Error: Whoops, something bad happened
// at [eval]:5:15
// at Script.runInThisContext (node:vm:132:18)
// at Object.runInThisContext (node:vm:309:38)
// at node:internal/process/execution:77:19
// at [eval]-wrapper:6:22
// at evalScript (node:internal/process/execution:76:60)
// at node:internal/main/eval_string:23:3
const name = 'Will Robinson';
console.warn(`Danger ${name}! Danger!`);
// Prints: Danger Will Robinson! Danger!, to stderr

Example using the Console class:

const out = getStreamSomehow();
const err = getStreamSomehow();
const myConsole = new console.Console(out, err);
myConsole.log('hello world');
// Prints: hello world, to out
myConsole.log('hello %s', 'world');
// Prints: hello world, to out
myConsole.error(new Error('Whoops, something bad happened'));
// Prints: [Error: Whoops, something bad happened], to err
const name = 'Will Robinson';
myConsole.warn(`Danger ${name}! Danger!`);
// Prints: Danger Will Robinson! Danger!, to err

@see ― source

console
.
Console.log(message?: any, ...optionalParams: any[]): void (+1 overload)

Prints to stdout with newline. Multiple arguments can be passed, with the first used as the primary message and all additional used as substitution values similar to printf(3) (the arguments are all passed to util.format()).

const count = 5;
console.log('count: %d', count);
// Prints: count: 5, to stdout
console.log('count:', count);
// Prints: count: 5, to stdout

See util.format() for more information.

@since ― v0.1.100

log
(
const parsed: ZodSafeParseResult<{
id: string;
position: string;
type: "check.completed" | "check.failed" | "client.created" | "client.updated" | "client.vigilance_level_changed" | "client.risk_level_changed" | "client.preliminary_screening_completed" | "classification.validated" | "case.created" | "case.updated" | "case.risk_level_changed" | "report.generated" | "alert.created" | "alert.resolved" | "decision.pending" | "quota.exhausted" | "subscription.inactive" | "access.revoked" | "member.enrolled" | "member.joined";
timestamp: string;
livemode: boolean;
data: Record<...>;
}>
parsed
.
success: boolean
success
,
function store(client: ClientDto, event: EventDto, problem: Problem | null): void
store
);

The client retries for you, and never in a way that could apply an operation twice.

A failed request runs again up to maxRetries times (2 by default), only when it cannot apply twice:

  • reads, deletions and the idempotent POSTs (cases.create, cases.launchChecks, checks.create, clients.create, clients.requestPreliminaryScreening, enrolments.create, firms.create, webhookEndpoints.create) are retried after a network error, a 429, or a 500, 502, 503 or 504;
  • every other operation (a PATCH, an embed session, a deep link, a secret rotation, a test delivery, a replay) is never sent twice once the server may have received it: it runs again only after a 429 carrying Retry-After, which the API answers before doing anything.

The client waits what Retry-After asks, in seconds or as an HTTP date, up to maxRetryWait (60 s by default): asked to wait longer, it hands the error back to you rather than retry early. Otherwise it backs off with full jitter: a random delay up to 0.5 s, then up to 1 s, 2 s… capped at 8 s.

Every idempotent POST gets an Idempotency-Key, kept across its retries: a check launched during a network failure is launched once, and the retry gets the first answer. A failed request that did nothing frees its key; one that failed after creating its resource answers 409 idempotency_response_unavailable with the resource’s id (requests).