@artu-ai/compliance-sdk 0.4.0 → 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 +4 -5
  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,184 +0,0 @@
1
- /**
2
- * Mexico Address Model
3
- *
4
- * Extends Address with Mexico-specific accessors for the standard
5
- * Mexican address format: street, exteriorNumber, interiorNumber, neighborhood.
6
- */
7
-
8
- import type { MexAddressData } from "@artu-ai/shared";
9
- import { Address } from "../Address";
10
-
11
- // ===========================
12
- // Types
13
- // ===========================
14
-
15
- /**
16
- * Mexico-specific address data
17
- */
18
- export type { MexAddressData };
19
-
20
- // ===========================
21
- // MexAddress Model
22
- // ===========================
23
-
24
- /**
25
- * Mexico Address Model.
26
- *
27
- * Extends `Address` with Mexico-specific accessors for the standard
28
- * Mexican address format.
29
- *
30
- * @example
31
- * ```typescript
32
- * if (address instanceof MexAddress) {
33
- * console.log(`Street: ${address.street}`);
34
- * console.log(`Number: ${address.exteriorNumber}`);
35
- * console.log(`Neighborhood: ${address.neighborhood}`);
36
- * console.log(`Formatted: ${address.formattedMexican}`);
37
- * }
38
- * ```
39
- */
40
- export class MexAddress extends Address {
41
- // ─────────────────────────────────────────────────────────────────
42
- // Mexico-Specific Data
43
- // ─────────────────────────────────────────────────────────────────
44
-
45
- /**
46
- * Mexico-specific address data
47
- */
48
- protected get mexicoData(): MexAddressData | undefined {
49
- return this._data.jurisdictions?.MX as MexAddressData | undefined;
50
- }
51
-
52
- // ─────────────────────────────────────────────────────────────────
53
- // Mexico Address Fields
54
- // ─────────────────────────────────────────────────────────────────
55
-
56
- /**
57
- * Exterior number (número exterior)
58
- * @example "222", "S/N"
59
- */
60
- get exteriorNumber(): string | undefined {
61
- return this.mexicoData?.exteriorNumber;
62
- }
63
-
64
- /**
65
- * Interior number (número interior)
66
- * @example "Piso 5", "Depto. 301", "Local A"
67
- */
68
- get interiorNumber(): string | undefined {
69
- return this.mexicoData?.interiorNumber;
70
- }
71
-
72
- /**
73
- * Neighborhood/Colony (colonia)
74
- * @example "Juárez", "Roma Norte", "Polanco"
75
- */
76
- get neighborhood(): string | undefined {
77
- return this.mexicoData?.neighborhood;
78
- }
79
-
80
- /**
81
- * Municipality or delegation (municipio/alcaldía)
82
- * @example "Cuauhtémoc", "Miguel Hidalgo"
83
- */
84
- get municipality(): string | undefined {
85
- return this.mexicoData?.municipality;
86
- }
87
-
88
- /**
89
- * Between streets reference (entre calles)
90
- * @example "Between Varsovia and Praga"
91
- */
92
- get betweenStreets(): string | undefined {
93
- return this.mexicoData?.betweenStreets;
94
- }
95
-
96
- /**
97
- * Additional reference (referencia)
98
- * @example "Blue building in front of the park"
99
- */
100
- get reference(): string | undefined {
101
- return this.mexicoData?.reference;
102
- }
103
-
104
- // ─────────────────────────────────────────────────────────────────
105
- // Formatting
106
- // ─────────────────────────────────────────────────────────────────
107
-
108
- /**
109
- * Street address line with number (Mexican format)
110
- * @example "Paseo de la Reforma 222 Int. Piso 5"
111
- */
112
- get streetLine(): string {
113
- const parts = [this.street, this.exteriorNumber];
114
- if (this.interiorNumber) {
115
- parts.push(`Int. ${this.interiorNumber}`);
116
- }
117
- return parts.filter(Boolean).join(" ");
118
- }
119
-
120
- /**
121
- * Returns a formatted single-line address in Mexican format
122
- * @example "Paseo de la Reforma 222, Col. Juárez, 06600 Ciudad de México, CDMX"
123
- */
124
- get formattedMexican(): string {
125
- const parts = [
126
- this.streetLine,
127
- this.neighborhood ? `Col. ${this.neighborhood}` : undefined,
128
- `${this.postalCode} ${this.city}`,
129
- this.state,
130
- ].filter(Boolean);
131
- return parts.join(", ");
132
- }
133
-
134
- /**
135
- * Returns a formatted multi-line address in Mexican format
136
- */
137
- get formattedMexicanMultiLine(): string {
138
- const lines = [
139
- this.streetLine,
140
- this.neighborhood ? `Col. ${this.neighborhood}` : undefined,
141
- this.municipality ? `${this.municipality}` : undefined,
142
- `${this.postalCode} ${this.city}, ${this.state}`,
143
- this.betweenStreets,
144
- this.reference,
145
- ].filter(Boolean);
146
- return lines.join("\n");
147
- }
148
-
149
- /**
150
- * Override the base formatted to use Mexican format
151
- */
152
- override get formatted(): string {
153
- return this.formattedMexican;
154
- }
155
-
156
- /**
157
- * Override the base formattedMultiLine to use Mexican format
158
- */
159
- override get formattedMultiLine(): string {
160
- return this.formattedMexicanMultiLine;
161
- }
162
-
163
- // ─────────────────────────────────────────────────────────────────
164
- // String Representation
165
- // ─────────────────────────────────────────────────────────────────
166
-
167
- override toString(): string {
168
- const location = this.neighborhood || this.city;
169
- return `MexAddress(${this.id}, ${this.type}, ${location})`;
170
- }
171
- }
172
-
173
- // ===========================
174
- // Type Guards
175
- // ===========================
176
-
177
- import type { AddressModel } from "../types";
178
-
179
- /**
180
- * Check if address is a Mexico address
181
- */
182
- export function isMexAddress(address: AddressModel): address is MexAddress {
183
- return address instanceof MexAddress;
184
- }
@@ -1,121 +0,0 @@
1
- /**
2
- * Mexico Bank Account Model
3
- *
4
- * Extends BankAccount with Mexico-specific accessors.
5
- * Data is flattened at root level (clabe, codigoBanco, codigoPlaza).
6
- */
7
-
8
- import type { MexBankAccount as MexBankAccountSchema } from "@artu-ai/shared";
9
- import { BankAccount } from "../BankAccount";
10
-
11
- // ===========================
12
- // Types
13
- // ===========================
14
-
15
- /**
16
- * Mexico bank account data (with MX-specific fields at root)
17
- */
18
- export type MexBankAccountData = MexBankAccountSchema;
19
-
20
- // ===========================
21
- // MexBankAccount Model
22
- // ===========================
23
-
24
- /**
25
- * Mexico Bank Account Model.
26
- *
27
- * Provides typed accessors for Mexico-specific fields like CLABE.
28
- *
29
- * @example
30
- * ```typescript
31
- * const account = await sdk.bankAccounts.retrieve(id);
32
- *
33
- * if (account.country === "MX") {
34
- * // account is MexBankAccount
35
- * console.log(`CLABE: ${account.clabe}`);
36
- * console.log(`Bank Code: ${account.codigoBanco}`);
37
- * }
38
- * ```
39
- */
40
- export class MexBankAccount extends BankAccount {
41
- // Narrow the data type for Mexico-specific fields
42
- declare protected _data: MexBankAccountData;
43
-
44
- // ─────────────────────────────────────────────────────────────────
45
- // CLABE (Clave Bancaria Estandarizada)
46
- // ─────────────────────────────────────────────────────────────────
47
-
48
- /**
49
- * CLABE (18-digit Mexican interbank code)
50
- *
51
- * The CLABE is structured as:
52
- * - Digits 1-3: Bank code
53
- * - Digits 4-6: Plaza (branch location) code
54
- * - Digits 7-17: Account number
55
- * - Digit 18: Check digit
56
- */
57
- get clabe(): string | undefined {
58
- return this._data.clabe;
59
- }
60
-
61
- /**
62
- * Bank code from CLABE (first 3 digits)
63
- */
64
- get codigoBanco(): string | undefined {
65
- return this._data.codigoBanco;
66
- }
67
-
68
- /**
69
- * Plaza (branch location) code from CLABE (digits 4-6)
70
- */
71
- get codigoPlaza(): string | undefined {
72
- return this._data.codigoPlaza;
73
- }
74
-
75
- // ─────────────────────────────────────────────────────────────────
76
- // Formatting
77
- // ─────────────────────────────────────────────────────────────────
78
-
79
- /**
80
- * Returns a masked CLABE (shows last 4 digits)
81
- */
82
- get maskedClabe(): string | undefined {
83
- const clabe = this.clabe;
84
- if (!clabe) return undefined;
85
- const lastFour = clabe.slice(-4);
86
- return `**************${lastFour}`;
87
- }
88
-
89
- /**
90
- * Returns a formatted CLABE with spaces for readability
91
- * Format: XXX XXX XXXXXXXXXXX X
92
- */
93
- get formattedClabe(): string | undefined {
94
- const clabe = this.clabe;
95
- if (!clabe || clabe.length !== 18) return clabe;
96
- return `${clabe.slice(0, 3)} ${clabe.slice(3, 6)} ${clabe.slice(6, 17)} ${clabe.slice(17)}`;
97
- }
98
-
99
- // ─────────────────────────────────────────────────────────────────
100
- // String Representation
101
- // ─────────────────────────────────────────────────────────────────
102
-
103
- override toString(): string {
104
- return `MexBankAccount(${this.id}, ${this.bankName}, ${this.maskedClabe ?? this.maskedAccountNumber})`;
105
- }
106
- }
107
-
108
- // ===========================
109
- // Type Guards
110
- // ===========================
111
-
112
- import type { BankAccountModel } from "../types";
113
-
114
- /**
115
- * Check if bank account is a Mexico bank account
116
- */
117
- export function isMexBankAccount(
118
- account: BankAccountModel
119
- ): account is MexBankAccount {
120
- return account instanceof MexBankAccount;
121
- }
@@ -1,177 +0,0 @@
1
- /**
2
- * Mexico Client Model
3
- *
4
- * Extends base Client with Mexico-specific accessors.
5
- * Provides type-safe access to RFC, CURP, and jurisdiction data.
6
- */
7
-
8
- import { Client, type ClientData } from "../Client";
9
- import type {
10
- ClientRelationshipType,
11
- MexJurisdictionData,
12
- } from "@artu-ai/shared";
13
- import { MexBankAccount } from "./MexBankAccount";
14
-
15
- // ===========================
16
- // Types
17
- // ===========================
18
-
19
- /**
20
- * Client data with Mexico jurisdiction
21
- */
22
- export type MexClientData = ClientData & {
23
- jurisdictions?: {
24
- MX?: MexJurisdictionData;
25
- [key: string]: unknown;
26
- };
27
- };
28
-
29
- // ===========================
30
- // MexClient Model
31
- // ===========================
32
-
33
- /**
34
- * Mexico Client Model.
35
- *
36
- * Provides typed accessors for Mexico-specific data:
37
- * - RFC (Registro Federal de Contribuyentes)
38
- * - CURP (Clave Única de Registro de Población)
39
- * - Actividad Económica
40
- * - Giro Mercantil
41
- *
42
- * @example
43
- * ```typescript
44
- * if (client instanceof MexClient) {
45
- * console.log(`RFC: ${client.rfc}`);
46
- * console.log(`CURP: ${client.curp}`);
47
- * }
48
- * ```
49
- */
50
- export class MexClient extends Client {
51
- // ─────────────────────────────────────────────────────────────────
52
- // Mexico Jurisdiction Data
53
- // ─────────────────────────────────────────────────────────────────
54
-
55
- /**
56
- * Mexico-specific jurisdiction data
57
- */
58
- protected get mexicoData(): MexJurisdictionData | undefined {
59
- return (this._data as MexClientData).jurisdictions?.MX;
60
- }
61
-
62
- // ─────────────────────────────────────────────────────────────────
63
- // Tax Identifiers
64
- // ─────────────────────────────────────────────────────────────────
65
-
66
- /**
67
- * RFC (Registro Federal de Contribuyentes)
68
- * Tax identification number
69
- */
70
- get rfc(): string | undefined {
71
- return this.mexicoData?.rfc;
72
- }
73
-
74
- /**
75
- * CURP (Clave Única de Registro de Población)
76
- * Only applicable for personas físicas
77
- */
78
- get curp(): string | undefined {
79
- return this.mexicoData?.curp;
80
- }
81
-
82
- // ─────────────────────────────────────────────────────────────────
83
- // Economic Activity
84
- // ─────────────────────────────────────────────────────────────────
85
-
86
- /**
87
- * Economic activity classification code
88
- */
89
- get actividadEconomica(): string | undefined {
90
- return this.mexicoData?.actividadEconomica;
91
- }
92
-
93
- /**
94
- * Business sector (giro mercantil)
95
- */
96
- get giroMercantil(): string | undefined {
97
- return this.mexicoData?.giroMercantil;
98
- }
99
-
100
- // ─────────────────────────────────────────────────────────────────
101
- // Actividades Vulnerables
102
- // ─────────────────────────────────────────────────────────────────
103
-
104
- /**
105
- * Whether client is registered for any Actividad Vulnerable
106
- */
107
- get isActividadVulnerable(): boolean {
108
- const av = this.mexicoData?.actividadVulnerable;
109
- if (!av) return false;
110
- return !!(av.AVI || av.JYS || av.TSC);
111
- }
112
-
113
- /**
114
- * Activity codes the client is registered for
115
- */
116
- get activityCodes(): string[] {
117
- const av = this.mexicoData?.actividadVulnerable;
118
- if (!av) return [];
119
- const codes: string[] = [];
120
- if (av.AVI) codes.push("AVI");
121
- if (av.JYS) codes.push("JYS");
122
- if (av.TSC) codes.push("TSC");
123
- return codes;
124
- }
125
-
126
- /**
127
- * Checks if registered for a specific activity
128
- */
129
- hasActivity(code: "AVI" | "JYS" | "TSC"): boolean {
130
- return this.activityCodes.includes(code);
131
- }
132
-
133
- // ─────────────────────────────────────────────────────────────────
134
- // String Representation
135
- // ─────────────────────────────────────────────────────────────────
136
-
137
- override toString(): string {
138
- return `MexClient(${this.id}, ${this.name}, RFC: ${this.rfc ?? "N/A"})`;
139
- }
140
-
141
- /**
142
- * Linked clients (if included) instantiated as MexClient
143
- */
144
- override get linkedClients():
145
- | {
146
- relationshipType: ClientRelationshipType;
147
- client: MexClient;
148
- }[]
149
- | undefined {
150
- return (this._data.linkedClients ?? []).map((l) => ({
151
- relationshipType: l.relationshipType,
152
- client: new MexClient(l.client),
153
- }));
154
- }
155
-
156
- override get addresses(): MexAddress[] | undefined {
157
- return this._data.addresses?.map((a) => new MexAddress(a));
158
- }
159
-
160
- override get bankAccounts(): MexBankAccount[] | undefined {
161
- return this._data.bankAccounts?.map((b) => new MexBankAccount(b));
162
- }
163
- }
164
-
165
- // ===========================
166
- // Type Guards
167
- // ===========================
168
-
169
- import type { ClientModel } from "../types";
170
- import { MexAddress } from "./MexAddress";
171
-
172
- /**
173
- * Check if client is a Mexico client
174
- */
175
- export function isMexClient(client: ClientModel): client is MexClient {
176
- return client instanceof MexClient;
177
- }