@dossier-wiki/os-sdk 1.7.1-staging.844 → 1.8.0-staging.849

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/types.d.ts CHANGED
@@ -2592,6 +2592,13 @@ export interface UpdateRiskRatingDto {
2592
2592
  riskRating: 'LOW' | 'MEDIUM' | 'HIGH' | 'CRITICAL';
2593
2593
  /** Why the rating is set by hand (required, at most 2,000 characters). Kept on the customer's risk history. */
2594
2594
  justification: string;
2595
+ /**
2596
+ * Set one named rating (a key of the customer's template `ratingMatrices`,
2597
+ * e.g. `CALS`) instead of the overall rating. It becomes that rating's
2598
+ * sticky override; the overall rating then follows the template's
2599
+ * `overallRatingRule`. 409 when that rating does not apply to the customer.
2600
+ */
2601
+ ratingKey?: string | null;
2595
2602
  }
2596
2603
  /** Response of `PUT /customers/{customerId}/risk-rating`. */
2597
2604
  export interface UpdateRiskRatingResponseDto {
@@ -3064,6 +3071,12 @@ export interface CustomerRiskAssessmentResponseDto {
3064
3071
  requiredDueDiligence?: DueDiligenceTier | null;
3065
3072
  /** When the next periodic review is due (YYYY-MM-DD). */
3066
3073
  nextReviewAt?: string | null;
3074
+ /**
3075
+ * The named rating this run or override belongs to (a key of the
3076
+ * template's `ratingMatrices`, e.g. `CALS`). Null for the template's own
3077
+ * matrix and the overall rating.
3078
+ */
3079
+ ratingKey?: string | null;
3067
3080
  [key: string]: unknown;
3068
3081
  }
3069
3082
  export type RiskAssessmentResponseDto = OpaqueResponse;
@@ -4923,6 +4936,11 @@ export interface RiskCriterion {
4923
4936
  *
4924
4937
  * - `customer.nationality` — ISO-3 codes: an individual's nationalities, an
4925
4938
  * entity's country of incorporation (a list);
4939
+ * - `customer.countryOfResidence` — ISO-3 codes: an individual's countries
4940
+ * of residence; empty for an entity (a list);
4941
+ * - `customer.age` — an individual's age in whole years on the day they are
4942
+ * scored, from `dateOfBirth` (UTC); null for an entity or without a date of
4943
+ * birth (a number). A birthday alone does not re-score the customer;
4926
4944
  * - `customer.productKeys` — the product key (`syncKey`, else `externalId`)
4927
4945
  * of every account the customer owns that is not closed (a list);
4928
4946
  * - `customer.expectedMonthlyVolume` — from the expected activity profile
@@ -4930,7 +4948,7 @@ export interface RiskCriterion {
4930
4948
  *
4931
4949
  * Conditions (criteria, escalations) can read them too.
4932
4950
  */
4933
- export type RiskMatrixDerivedInput = 'customer.nationality' | 'customer.productKeys' | 'customer.expectedMonthlyVolume';
4951
+ export type RiskMatrixDerivedInput = 'customer.nationality' | 'customer.countryOfResidence' | 'customer.age' | 'customer.productKeys' | 'customer.expectedMonthlyVolume';
4934
4952
  /**
4935
4953
  * One weighted dimension of a risk matrix. Exactly one form per factor:
4936
4954
  *
@@ -5043,6 +5061,46 @@ export interface RiskMatrixBreakdown {
5043
5061
  /** The bands the run placed the composite in. Null on older runs. */
5044
5062
  bands?: RiskBand[] | null;
5045
5063
  }
5064
+ /**
5065
+ * How a template sets a customer's overall risk rating when it has named
5066
+ * ratings: `TEMPLATE_MATRIX` (its own matrix; the default), `HIGHEST` (the
5067
+ * highest named rating that applies) or `NAMED` (the named rating
5068
+ * `overallRatingKey`). When no named rating applies, the template's own
5069
+ * matrix decides.
5070
+ */
5071
+ export type OverallRatingRule = 'TEMPLATE_MATRIX' | 'HIGHEST' | 'NAMED';
5072
+ /**
5073
+ * A named rating: a further risk matrix the template scores a customer
5074
+ * against while `appliesWhen` holds, for example one per company of a group.
5075
+ */
5076
+ export interface NamedRiskMatrix {
5077
+ /** Stable key used by the API and webhooks, e.g. `CALS`. Starts with a letter; up to 32 letters, digits, `-` or `_`. */
5078
+ key: string;
5079
+ /** Shown to officers, e.g. `Equities` (max 100). */
5080
+ name: string;
5081
+ /** Condition tree in the risk matrix grammar. Without one the rating always applies. */
5082
+ appliesWhen?: Record<string, unknown> | null;
5083
+ matrix: RiskMatrix;
5084
+ }
5085
+ /** One of a customer's named ratings that applies to it. `GET /v1/customers/{customerId}/risk-ratings`. */
5086
+ export interface CustomerRiskRating {
5087
+ /** The named rating, e.g. `CALS`. */
5088
+ ratingKey: string;
5089
+ /** The name the template gives it. */
5090
+ name: string;
5091
+ /** The rating in force: an officer override, else what the matrix computed. */
5092
+ riskRating: RiskLevel;
5093
+ /** `MANUAL` when an officer set it by hand, `MATRIX` when the matrix did. */
5094
+ ratingSource: RiskRatingSource;
5095
+ /** What the matrix last computed, also while an override is in force. */
5096
+ computedRiskRating: RiskLevel | null;
5097
+ /** The matrix's weighted composite score. */
5098
+ compositeScore: number | null;
5099
+ /** The risk assessment behind the rating in force (a matrix run or an override). */
5100
+ riskAssessmentId: string | null;
5101
+ /** When the matrix last scored it. */
5102
+ evaluatedAt: string;
5103
+ }
5046
5104
  /** A Profile Template as returned by `/v1/config/profile-templates`. */
5047
5105
  export interface ProfileTemplate {
5048
5106
  id: string;
@@ -5060,6 +5118,12 @@ export interface ProfileTemplate {
5060
5118
  fieldConfig: TypedFieldDefinition[];
5061
5119
  riskMatrix?: RiskMatrix | null;
5062
5120
  kycWorkflows: KycWorkflowBinding[];
5121
+ /** Named ratings: further matrices, each scoring a customer while its condition holds. Empty when none. */
5122
+ ratingMatrices: NamedRiskMatrix[];
5123
+ /** How a customer's overall risk rating is set. */
5124
+ overallRatingRule: OverallRatingRule;
5125
+ /** With `overallRatingRule: 'NAMED'`, the named rating that sets the overall rating. */
5126
+ overallRatingKey?: string | null;
5063
5127
  /**
5064
5128
  * How the Add Individual form creates customers of this template.
5065
5129
  * Set on `INDIVIDUAL` templates only (null on entity templates). Null on
@@ -5081,6 +5145,12 @@ export interface ProfileTemplateVersion {
5081
5145
  fieldConfig: TypedFieldDefinition[];
5082
5146
  riskMatrix?: RiskMatrix | null;
5083
5147
  kycWorkflows: KycWorkflowBinding[];
5148
+ /** Named ratings: further matrices, each scoring a customer while its condition holds. Empty when none. */
5149
+ ratingMatrices: NamedRiskMatrix[];
5150
+ /** How a customer's overall risk rating is set. */
5151
+ overallRatingRule: OverallRatingRule;
5152
+ /** With `overallRatingRule: 'NAMED'`, the named rating that sets the overall rating. */
5153
+ overallRatingKey?: string | null;
5084
5154
  /** The version's Add Individual setup (individual templates). Null = the org-wide preference applied. */
5085
5155
  individualCreation: SimpleCustomerCreationPreferences | null;
5086
5156
  /** The version's Add Entity setup (entity templates). Null = the org-wide preference applied. */
@@ -5136,6 +5206,12 @@ export interface CreateProfileTemplateInput {
5136
5206
  fieldConfig?: TypedFieldDefinition[];
5137
5207
  riskMatrix?: RiskMatrix | null;
5138
5208
  kycWorkflows?: KycWorkflowBinding[];
5209
+ /** Named ratings (at most 10). On update, the list replaces the current one; omit to keep it. */
5210
+ ratingMatrices?: NamedRiskMatrix[];
5211
+ /** Default `TEMPLATE_MATRIX`. `HIGHEST` and `NAMED` need at least one named rating. */
5212
+ overallRatingRule?: OverallRatingRule;
5213
+ /** Required with `NAMED`; only allowed with `NAMED`. */
5214
+ overallRatingKey?: string | null;
5139
5215
  /**
5140
5216
  * Creation setup for the Add Individual form. `INDIVIDUAL` templates only
5141
5217
  * — sending it on an entity template is a 400. Omit (or null) to copy the
@@ -5169,6 +5245,12 @@ export interface UpdateProfileTemplateInput {
5169
5245
  fieldConfig?: TypedFieldDefinition[];
5170
5246
  riskMatrix?: RiskMatrix | null;
5171
5247
  kycWorkflows?: KycWorkflowBinding[];
5248
+ /** Named ratings (at most 10). On update, the list replaces the current one; omit to keep it. */
5249
+ ratingMatrices?: NamedRiskMatrix[];
5250
+ /** Default `TEMPLATE_MATRIX`. `HIGHEST` and `NAMED` need at least one named rating. */
5251
+ overallRatingRule?: OverallRatingRule;
5252
+ /** Required with `NAMED`; only allowed with `NAMED`. */
5253
+ overallRatingKey?: string | null;
5172
5254
  /**
5173
5255
  * Replace the Add Individual creation setup (`INDIVIDUAL` templates
5174
5256
  * only; 400 on an entity template). `null` clears it, so the org-wide
@@ -5186,6 +5268,14 @@ export interface RiskMatrixImpactInput {
5186
5268
  /** The draft's profile fields; factors may only read these. */
5187
5269
  fieldConfig?: TypedFieldDefinition[];
5188
5270
  riskMatrix: RiskMatrix;
5271
+ /**
5272
+ * Dry-run a named rating instead of the template's own matrix: its key.
5273
+ * `riskMatrix` is then that named rating's draft matrix, compared with the
5274
+ * saved named rating of this key.
5275
+ */
5276
+ ratingKey?: string | null;
5277
+ /** With `ratingKey`: the draft named rating's condition. Omitted or null: it always applies. */
5278
+ appliesWhen?: Record<string, unknown> | null;
5189
5279
  }
5190
5280
  /** Body for `POST /v1/config/profile-templates/preview-risk-matrix`. */
5191
5281
  export interface PreviewRiskMatrixInput extends RiskMatrixImpactInput {
@@ -5204,6 +5294,12 @@ export interface RiskMatrixPreview {
5204
5294
  /** The customer's own template's saved matrix, evaluated now; null when it has none. */
5205
5295
  published?: RiskMatrixBreakdown | null;
5206
5296
  draft: RiskMatrixBreakdown;
5297
+ /** The named rating previewed; null for the template's own matrix. */
5298
+ ratingKey?: string | null;
5299
+ /** Named ratings: whether the draft applies to this customer. Null for the template's own matrix. */
5300
+ draftApplies?: boolean | null;
5301
+ /** Named ratings: whether the saved named rating applies. Null when it isn't saved yet, and for the template's own matrix. */
5302
+ publishedApplies?: boolean | null;
5207
5303
  }
5208
5304
  /** How many evaluated customers hold a rating before and after the draft. */
5209
5305
  export interface RiskRatingDistribution {
@@ -5244,6 +5340,10 @@ export interface RiskMatrixImpact {
5244
5340
  /** Customers with a factor scored at its fallback level under the draft. */
5245
5341
  incomplete: number;
5246
5342
  failed: number;
5343
+ /** Named ratings: customers the draft doesn't apply to, so it doesn't rate them. Zero for the template's own matrix. */
5344
+ notApplying: number;
5345
+ /** Named ratings: of those, customers the saved named rating rates today, who would lose that rating. */
5346
+ losingRating: number;
5247
5347
  distribution: RiskRatingDistribution[];
5248
5348
  movements: RiskRatingMovement[];
5249
5349
  /** Customers whose rating moves, rises before falls, biggest change first (at most 100). */