@artu-ai/compliance-sdk 0.4.1 → 0.4.2

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.
Files changed (110) hide show
  1. package/package.json +3 -4
  2. package/src/errors/api.ts +0 -305
  3. package/src/errors/base.ts +0 -127
  4. package/src/errors/index.ts +0 -63
  5. package/src/errors/upload.ts +0 -204
  6. package/src/errors/validation.ts +0 -163
  7. package/src/exports/base.ts +0 -139
  8. package/src/exports/index.ts +0 -187
  9. package/src/exports/mexico/actividad-vulnerable/avi.ts +0 -207
  10. package/src/exports/mexico/actividad-vulnerable/jys.ts +0 -214
  11. package/src/exports/mexico/actividad-vulnerable/tsc.ts +0 -202
  12. package/src/exports/mexico/index.ts +0 -215
  13. package/src/models/Address.ts +0 -235
  14. package/src/models/BankAccount.ts +0 -235
  15. package/src/models/Client.ts +0 -363
  16. package/src/models/ContactMethod.ts +0 -197
  17. package/src/models/Document.ts +0 -355
  18. package/src/models/LinkedClient.ts +0 -84
  19. package/src/models/Report.ts +0 -193
  20. package/src/models/ReportItem.ts +0 -211
  21. package/src/models/Transaction.ts +0 -219
  22. package/src/models/base.ts +0 -56
  23. package/src/models/index.ts +0 -148
  24. package/src/models/mex/MexAddress.ts +0 -184
  25. package/src/models/mex/MexBankAccount.ts +0 -121
  26. package/src/models/mex/MexClient.ts +0 -177
  27. package/src/models/mex/MexDocument.ts +0 -890
  28. package/src/models/mex/MexReport.ts +0 -99
  29. package/src/models/mex/MexReportItem.ts +0 -79
  30. package/src/models/mex/MexTransaction.ts +0 -105
  31. package/src/models/mex/actividad-vulnerable/MexActividadVulnerableClient.ts +0 -66
  32. package/src/models/mex/actividad-vulnerable/MexActividadVulnerableReport.ts +0 -73
  33. package/src/models/mex/actividad-vulnerable/MexActividadVulnerableReportItem.ts +0 -74
  34. package/src/models/mex/actividad-vulnerable/MexActividadVulnerableTransaction.ts +0 -50
  35. package/src/models/mex/actividad-vulnerable/avi/MexAVIClient.ts +0 -80
  36. package/src/models/mex/actividad-vulnerable/avi/MexAVIReport.ts +0 -114
  37. package/src/models/mex/actividad-vulnerable/avi/MexAVIReportItem.ts +0 -105
  38. package/src/models/mex/actividad-vulnerable/avi/MexAVITransaction.ts +0 -157
  39. package/src/models/mex/actividad-vulnerable/index.ts +0 -78
  40. package/src/models/mex/actividad-vulnerable/jys/MexJYSClient.ts +0 -73
  41. package/src/models/mex/actividad-vulnerable/jys/MexJYSReport.ts +0 -114
  42. package/src/models/mex/actividad-vulnerable/jys/MexJYSReportItem.ts +0 -105
  43. package/src/models/mex/actividad-vulnerable/jys/MexJYSTransaction.ts +0 -178
  44. package/src/models/mex/actividad-vulnerable/tsc/MexTSCClient.ts +0 -73
  45. package/src/models/mex/actividad-vulnerable/tsc/MexTSCReport.ts +0 -114
  46. package/src/models/mex/actividad-vulnerable/tsc/MexTSCReportItem.ts +0 -105
  47. package/src/models/mex/actividad-vulnerable/tsc/MexTSCTransaction.ts +0 -104
  48. package/src/models/mex/index.ts +0 -57
  49. package/src/models/types.ts +0 -196
  50. package/src/namespaces/index.ts +0 -29
  51. package/src/namespaces/mexico/actividad-vulnerable/avi/index.ts +0 -62
  52. package/src/namespaces/mexico/actividad-vulnerable/index.ts +0 -79
  53. package/src/namespaces/mexico/actividad-vulnerable/jys/index.ts +0 -72
  54. package/src/namespaces/mexico/actividad-vulnerable/tsc/index.ts +0 -60
  55. package/src/namespaces/mexico/index.ts +0 -325
  56. package/src/resources/addresses.ts +0 -391
  57. package/src/resources/bank-accounts.ts +0 -417
  58. package/src/resources/base.ts +0 -327
  59. package/src/resources/clients.ts +0 -808
  60. package/src/resources/contact-methods.ts +0 -412
  61. package/src/resources/documents.ts +0 -688
  62. package/src/resources/index.ts +0 -40
  63. package/src/resources/mex/actividad-vulnerable/avi/clients.ts +0 -559
  64. package/src/resources/mex/actividad-vulnerable/avi/index.ts +0 -7
  65. package/src/resources/mex/actividad-vulnerable/avi/reports.ts +0 -609
  66. package/src/resources/mex/actividad-vulnerable/avi/transactions.ts +0 -404
  67. package/src/resources/mex/actividad-vulnerable/index.ts +0 -12
  68. package/src/resources/mex/actividad-vulnerable/jys/clients.ts +0 -445
  69. package/src/resources/mex/actividad-vulnerable/jys/index.ts +0 -7
  70. package/src/resources/mex/actividad-vulnerable/jys/reports.ts +0 -591
  71. package/src/resources/mex/actividad-vulnerable/jys/transactions.ts +0 -395
  72. package/src/resources/mex/actividad-vulnerable/tsc/clients.ts +0 -445
  73. package/src/resources/mex/actividad-vulnerable/tsc/index.ts +0 -7
  74. package/src/resources/mex/actividad-vulnerable/tsc/reports.ts +0 -591
  75. package/src/resources/mex/actividad-vulnerable/tsc/transactions.ts +0 -404
  76. package/src/resources/mex/addresses.ts +0 -493
  77. package/src/resources/mex/bank-accounts.ts +0 -283
  78. package/src/resources/mex/clients.ts +0 -758
  79. package/src/resources/mex/ebr.ts +0 -621
  80. package/src/resources/mex/index.ts +0 -23
  81. package/src/resources/mex/reports.ts +0 -643
  82. package/src/resources/mex/transactions.ts +0 -422
  83. package/src/resources/reports.ts +0 -515
  84. package/src/resources/transactions.ts +0 -358
  85. package/src/sdk/ComplianceSDK.ts +0 -812
  86. package/src/sdk/base.ts +0 -43
  87. package/src/sdk/index.ts +0 -98
  88. package/src/sdk/mex/ComplianceSDK.ts +0 -147
  89. package/src/sdk/mex/actividad-vulnerable/avi/ComplianceSDK.ts +0 -55
  90. package/src/sdk/mex/actividad-vulnerable/avi/index.ts +0 -16
  91. package/src/sdk/mex/actividad-vulnerable/avi/types.ts +0 -86
  92. package/src/sdk/mex/actividad-vulnerable/index.ts +0 -58
  93. package/src/sdk/mex/actividad-vulnerable/jys/ComplianceSDK.ts +0 -54
  94. package/src/sdk/mex/actividad-vulnerable/jys/index.ts +0 -16
  95. package/src/sdk/mex/actividad-vulnerable/jys/types.ts +0 -86
  96. package/src/sdk/mex/actividad-vulnerable/tsc/ComplianceSDK.ts +0 -54
  97. package/src/sdk/mex/actividad-vulnerable/tsc/index.ts +0 -16
  98. package/src/sdk/mex/actividad-vulnerable/tsc/types.ts +0 -86
  99. package/src/sdk/mex/index.ts +0 -66
  100. package/src/sdk/mex/types.ts +0 -88
  101. package/src/sdk/resource-registry.ts +0 -204
  102. package/src/sdk/sdk-registry.ts +0 -99
  103. package/src/sdk/types.ts +0 -304
  104. package/src/utils/environment.ts +0 -187
  105. package/src/utils/filters.ts +0 -412
  106. package/src/utils/index.ts +0 -134
  107. package/src/utils/pagination.ts +0 -143
  108. package/src/utils/session.ts +0 -303
  109. package/src/utils/trpc-client.ts +0 -242
  110. package/src/utils/upload.ts +0 -388
@@ -1,363 +0,0 @@
1
- /**
2
- * Base Client Model
3
- *
4
- * Pure data model with no API calls.
5
- * Provides type-safe access to common client properties.
6
- */
7
-
8
- import { BaseModel } from "./base";
9
- import { ClientType } from "@artu-ai/shared";
10
- import type {
11
- BaseClient,
12
- Jurisdiction,
13
- AddressResponse,
14
- ContactMethodResponse,
15
- BankAccountResponse,
16
- DocumentResponse,
17
- LinkedClientResponse,
18
- ClientRelationshipType,
19
- } from "@artu-ai/shared";
20
- import { Address } from "./Address";
21
- import { ContactMethod } from "./ContactMethod";
22
- import { BankAccount } from "./BankAccount";
23
- import { Document } from "./Document";
24
-
25
- // ===========================
26
- // Utilities
27
- // ===========================
28
-
29
- /**
30
- * Parse a date string, handling date-only strings (YYYY-MM-DD) as local time
31
- * to avoid timezone conversion issues.
32
- */
33
- function parseDateString(value: string): Date {
34
- // For date-only strings (yyyy-MM-dd), parse as local time to avoid timezone issues
35
- if (/^\d{4}-\d{2}-\d{2}$/.test(value)) {
36
- const parts = value.split("-").map(Number);
37
- const year = parts[0] ?? 0;
38
- const month = parts[1] ?? 1;
39
- const day = parts[2] ?? 1;
40
- return new Date(year, month - 1, day);
41
- }
42
- return new Date(value);
43
- }
44
-
45
- // ===========================
46
- // Types
47
- // ===========================
48
-
49
- export type ClientData = BaseClient & {
50
- // Server-generated fields (added by API)
51
- id: string;
52
- createdAt: string;
53
- updatedAt: string;
54
- // Optional enriched fields
55
- email?: string | null;
56
- phone?: string | null;
57
- addresses?: AddressResponse[];
58
- contactMethods?: ContactMethodResponse[];
59
- bankAccounts?: BankAccountResponse[];
60
- documents?: DocumentResponse[];
61
- linkedClients?: LinkedClientResponse[];
62
- };
63
-
64
- // ===========================
65
- // Client Model
66
- // ===========================
67
-
68
- /**
69
- * Base Client Model.
70
- *
71
- * Pure data model with no API calls.
72
- * Extended by jurisdiction-specific models (MexClient, etc.).
73
- *
74
- * @example
75
- * ```typescript
76
- * const client = await sdk.clients.retrieve("client_123");
77
- * console.log(client.name);
78
- * console.log(client.email);
79
- * ```
80
- */
81
- export class Client extends BaseModel<ClientData> {
82
- // ─────────────────────────────────────────────────────────────────
83
- // Identity
84
- // ─────────────────────────────────────────────────────────────────
85
-
86
- /**
87
- * Unique identifier
88
- */
89
- get id(): string {
90
- return this._data.id;
91
- }
92
-
93
- /**
94
- * Client type: "individual" or "company"
95
- */
96
- get type(): ClientType {
97
- return this._data.type;
98
- }
99
-
100
- /**
101
- * Whether this is an individual (individual)
102
- */
103
- get isIndividual(): boolean {
104
- return this._data.type === ClientType.Individual;
105
- }
106
-
107
- /**
108
- * Whether this is a company (legal entity)
109
- */
110
- get isCompany(): boolean {
111
- return this._data.type === ClientType.Company;
112
- }
113
-
114
- /**
115
- * Whether this is a trust
116
- */
117
- get isTrust(): boolean {
118
- return this._data.type === ClientType.Trust;
119
- }
120
-
121
- // ─────────────────────────────────────────────────────────────────
122
- // Common Fields
123
- // ─────────────────────────────────────────────────────────────────
124
-
125
- /**
126
- * Full name (individual) or legal name (company)
127
- */
128
- get name(): string {
129
- return this._data.name;
130
- }
131
-
132
- /**
133
- * Nationalities as ISO2 country codes
134
- */
135
- get nationalities(): string[] {
136
- return this._data.nationalities ?? [];
137
- }
138
-
139
- // ─────────────────────────────────────────────────────────────────
140
- // Individual-specific fields
141
- // ─────────────────────────────────────────────────────────────────
142
-
143
- /**
144
- * Birth date (individuals only)
145
- * Returns undefined for companies and trusts
146
- */
147
- get birthDate(): Date | undefined {
148
- // Access via record since BaseClient is a discriminated union
149
- const raw = (this._data as Record<string, unknown>).birthDate as
150
- | string
151
- | undefined;
152
- return raw ? parseDateString(raw) : undefined;
153
- }
154
-
155
- /**
156
- * Middle name (individuals only)
157
- */
158
- get middleName(): string | undefined {
159
- return (this._data as Record<string, unknown>).middleName as
160
- | string
161
- | undefined;
162
- }
163
-
164
- /**
165
- * Last name(s) (individuals only)
166
- * Returns as array to support multiple surnames (e.g., Spanish naming)
167
- */
168
- get lastName(): string[] | undefined {
169
- return (this._data as Record<string, unknown>).lastName as
170
- | string[]
171
- | undefined;
172
- }
173
-
174
- // ─────────────────────────────────────────────────────────────────
175
- // Company-specific fields
176
- // ─────────────────────────────────────────────────────────────────
177
-
178
- /**
179
- * Incorporation date (companies only)
180
- * Returns undefined for individuals and trusts
181
- */
182
- get incorporationDate(): Date | undefined {
183
- const raw = (this._data as Record<string, unknown>).incorporationDate as
184
- | string
185
- | undefined;
186
- return raw ? parseDateString(raw) : undefined;
187
- }
188
-
189
- // ─────────────────────────────────────────────────────────────────
190
- // Trust-specific fields
191
- // ─────────────────────────────────────────────────────────────────
192
-
193
- /**
194
- * Formation date (trusts only)
195
- * Returns undefined for individuals and companies
196
- */
197
- get formationDate(): Date | undefined {
198
- const raw = (this._data as Record<string, unknown>).formationDate as
199
- | string
200
- | undefined;
201
- return raw ? parseDateString(raw) : undefined;
202
- }
203
-
204
- // ─────────────────────────────────────────────────────────────────
205
- // Jurisdiction
206
- // ─────────────────────────────────────────────────────────────────
207
-
208
- /**
209
- * Primary jurisdiction for compliance purposes.
210
- * May be undefined if not set (can be inferred from SDK scope).
211
- */
212
- get primaryJurisdiction(): Jurisdiction | undefined {
213
- return this._data.primaryJurisdiction;
214
- }
215
-
216
- /**
217
- * Checks if client has data for a specific jurisdiction
218
- */
219
- hasJurisdiction(jurisdiction: Jurisdiction): boolean {
220
- if (!this._data.jurisdictions) return false;
221
- return jurisdiction in this._data.jurisdictions;
222
- }
223
-
224
- /**
225
- * Raw jurisdiction data object
226
- */
227
- get jurisdictions(): BaseClient["jurisdictions"] {
228
- return this._data.jurisdictions ?? {};
229
- }
230
-
231
- // ─────────────────────────────────────────────────────────────────
232
- // Metadata
233
- // ─────────────────────────────────────────────────────────────────
234
-
235
- /**
236
- * External ID for integration with other systems
237
- */
238
- get externalId(): string | undefined {
239
- return this._data.externalId;
240
- }
241
-
242
- /**
243
- * Custom metadata
244
- */
245
- get metadata(): Record<string, unknown> | undefined {
246
- return this._data.metadata;
247
- }
248
-
249
- /**
250
- * Primary email (if included)
251
- */
252
- get email(): string | null | undefined {
253
- return this._data.email;
254
- }
255
-
256
- /**
257
- * Primary phone (if included)
258
- */
259
- get phone(): string | null | undefined {
260
- return this._data.phone;
261
- }
262
-
263
- /**
264
- * Addresses (if included)
265
- */
266
- get addresses(): Address[] | undefined {
267
- return this._data.addresses?.map((a) => new Address(a));
268
- }
269
-
270
- /**
271
- * Contact methods (if included)
272
- */
273
- get contactMethods(): ContactMethod[] | undefined {
274
- return this._data.contactMethods?.map((c) => new ContactMethod(c));
275
- }
276
-
277
- /**
278
- * Bank accounts (if included)
279
- */
280
- get bankAccounts(): BankAccount[] | undefined {
281
- return this._data.bankAccounts?.map((b) => new BankAccount(b));
282
- }
283
-
284
- /**
285
- * Documents (if included)
286
- */
287
- get documents(): Document[] | undefined {
288
- return this._data.documents?.map((d) => new Document(d));
289
- }
290
-
291
- /**
292
- * Linked clients (if included)
293
- */
294
- get linkedClients():
295
- | {
296
- relationshipType: ClientRelationshipType;
297
- client: Client;
298
- }[]
299
- | undefined {
300
- return this._data.linkedClients?.map((l) => ({
301
- relationshipType: l.relationshipType,
302
- client: new Client(l.client),
303
- }));
304
- }
305
-
306
- // ─────────────────────────────────────────────────────────────────
307
- // Timestamps
308
- // ─────────────────────────────────────────────────────────────────
309
-
310
- /**
311
- * When the client was created
312
- */
313
- get createdAt(): Date {
314
- return new Date(this._data.createdAt);
315
- }
316
-
317
- /**
318
- * When the client was last updated
319
- */
320
- get updatedAt(): Date {
321
- return new Date(this._data.updatedAt);
322
- }
323
-
324
- // ─────────────────────────────────────────────────────────────────
325
- // String Representation
326
- // ─────────────────────────────────────────────────────────────────
327
-
328
- override toString(): string {
329
- return `Client(${this.id}, ${this.name})`;
330
- }
331
- }
332
-
333
- // ===========================
334
- // Type Guards
335
- // ===========================
336
-
337
- /**
338
- * Check if value is any type of Client model
339
- */
340
- export function isClient(value: unknown): value is Client {
341
- return value instanceof Client;
342
- }
343
-
344
- /**
345
- * Check if client is an individual (individual)
346
- */
347
- export function isIndividual(client: Client): boolean {
348
- return client.isIndividual;
349
- }
350
-
351
- /**
352
- * Check if client is a company (legal entity)
353
- */
354
- export function isCompany(client: Client): boolean {
355
- return client.isCompany;
356
- }
357
-
358
- /**
359
- * Check if client is a trust
360
- */
361
- export function isTrust(client: Client): boolean {
362
- return client.isTrust;
363
- }
@@ -1,197 +0,0 @@
1
- /**
2
- * ContactMethod Model
3
- *
4
- * Communication channel for a client (email, phone, etc.).
5
- */
6
-
7
- import {
8
- ContactMethodType,
9
- type ContactMethod as ContactMethodSchema,
10
- } from "@artu-ai/shared";
11
- import { BaseModel } from "./base";
12
-
13
- // ===========================
14
- // Types
15
- // ===========================
16
-
17
- /**
18
- * Contact method data structure from the API
19
- */
20
- export interface ContactMethodData
21
- extends Omit<ContactMethodSchema, "verifiedAt"> {
22
- id: string;
23
- verifiedAt: string | null; // API returns ISO string or null (JSON serialization)
24
- createdAt: string;
25
- updatedAt: string;
26
- }
27
-
28
- // ===========================
29
- // ContactMethod Model
30
- // ===========================
31
-
32
- /**
33
- * ContactMethod Model.
34
- *
35
- * Provides typed accessors for contact method data with formatting helpers.
36
- *
37
- * @example
38
- * ```typescript
39
- * const contacts = await sdk.contactMethods.listByClient("client_123");
40
- * for (const contact of contacts) {
41
- * console.log(contact.display);
42
- * console.log(`Verified: ${contact.isVerified}`);
43
- * }
44
- * ```
45
- */
46
- export class ContactMethod extends BaseModel<ContactMethodData> {
47
- // ─────────────────────────────────────────────────────────────────
48
- // Core Properties
49
- // ─────────────────────────────────────────────────────────────────
50
-
51
- /**
52
- * Unique contact method identifier
53
- */
54
- get id(): string {
55
- return this._data.id;
56
- }
57
-
58
- /**
59
- * ID of the client this contact method belongs to
60
- */
61
- get clientId(): string {
62
- return this._data.clientId;
63
- }
64
-
65
- /**
66
- * Contact method type (email, phone, mobile, fax, other)
67
- */
68
- get type(): ContactMethodType {
69
- return this._data.type;
70
- }
71
-
72
- /**
73
- * Whether this is the primary contact method for its type
74
- */
75
- get isPrimary(): boolean {
76
- return this._data.isPrimary;
77
- }
78
-
79
- // ─────────────────────────────────────────────────────────────────
80
- // Value Fields
81
- // ─────────────────────────────────────────────────────────────────
82
-
83
- /**
84
- * The contact value (email address, phone number, etc.)
85
- */
86
- get value(): string {
87
- return this._data.value;
88
- }
89
-
90
- /**
91
- * Optional label (e.g., "Work", "Personal")
92
- */
93
- get label(): string | undefined {
94
- return this._data.label;
95
- }
96
-
97
- // ─────────────────────────────────────────────────────────────────
98
- // Verification
99
- // ─────────────────────────────────────────────────────────────────
100
-
101
- /**
102
- * Whether this contact method has been verified
103
- */
104
- get isVerified(): boolean {
105
- return this._data.isVerified;
106
- }
107
-
108
- /**
109
- * When this contact method was verified
110
- */
111
- get verifiedAt(): Date | null {
112
- return this._data.verifiedAt ? new Date(this._data.verifiedAt) : null;
113
- }
114
-
115
- // ─────────────────────────────────────────────────────────────────
116
- // Metadata
117
- // ─────────────────────────────────────────────────────────────────
118
-
119
- /**
120
- * External ID
121
- */
122
- get externalId(): string | undefined {
123
- return this._data.externalId;
124
- }
125
-
126
- /**
127
- * Additional metadata
128
- */
129
- get metadata(): Record<string, unknown> | undefined {
130
- return this._data.metadata;
131
- }
132
-
133
- /**
134
- * When the contact method was created
135
- */
136
- get createdAt(): Date {
137
- return new Date(this._data.createdAt);
138
- }
139
-
140
- /**
141
- * When the contact method was last updated
142
- */
143
- get updatedAt(): Date {
144
- return new Date(this._data.updatedAt);
145
- }
146
-
147
- // ─────────────────────────────────────────────────────────────────
148
- // Type Helpers
149
- // ─────────────────────────────────────────────────────────────────
150
-
151
- /**
152
- * Whether this is an email contact
153
- */
154
- get isEmail(): boolean {
155
- return this.type === ContactMethodType.Email;
156
- }
157
-
158
- /**
159
- * Whether this is a phone contact
160
- */
161
- get isPhone(): boolean {
162
- return this.type === ContactMethodType.Phone;
163
- }
164
-
165
- /**
166
- * Whether this is a mobile contact
167
- */
168
- get isMobile(): boolean {
169
- return this.type === ContactMethodType.Mobile;
170
- }
171
-
172
- /**
173
- * Whether this is a fax contact
174
- */
175
- get isFax(): boolean {
176
- return this.type === ContactMethodType.Fax;
177
- }
178
-
179
- // ─────────────────────────────────────────────────────────────────
180
- // Formatting
181
- // ─────────────────────────────────────────────────────────────────
182
-
183
- /**
184
- * Returns a display string with optional label
185
- */
186
- get display(): string {
187
- return this.label ? `${this.label}: ${this.value}` : this.value;
188
- }
189
-
190
- // ─────────────────────────────────────────────────────────────────
191
- // String Representation
192
- // ─────────────────────────────────────────────────────────────────
193
-
194
- override toString(): string {
195
- return `ContactMethod(${this.id}, ${this.type}, ${this.value})`;
196
- }
197
- }