@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.
- package/package.json +4 -5
- package/src/errors/api.ts +0 -305
- package/src/errors/base.ts +0 -127
- package/src/errors/index.ts +0 -63
- package/src/errors/upload.ts +0 -204
- package/src/errors/validation.ts +0 -163
- package/src/exports/base.ts +0 -139
- package/src/exports/index.ts +0 -187
- package/src/exports/mexico/actividad-vulnerable/avi.ts +0 -207
- package/src/exports/mexico/actividad-vulnerable/jys.ts +0 -214
- package/src/exports/mexico/actividad-vulnerable/tsc.ts +0 -202
- package/src/exports/mexico/index.ts +0 -215
- package/src/models/Address.ts +0 -235
- package/src/models/BankAccount.ts +0 -235
- package/src/models/Client.ts +0 -363
- package/src/models/ContactMethod.ts +0 -197
- package/src/models/Document.ts +0 -355
- package/src/models/LinkedClient.ts +0 -84
- package/src/models/Report.ts +0 -193
- package/src/models/ReportItem.ts +0 -211
- package/src/models/Transaction.ts +0 -219
- package/src/models/base.ts +0 -56
- package/src/models/index.ts +0 -148
- package/src/models/mex/MexAddress.ts +0 -184
- package/src/models/mex/MexBankAccount.ts +0 -121
- package/src/models/mex/MexClient.ts +0 -177
- package/src/models/mex/MexDocument.ts +0 -890
- package/src/models/mex/MexReport.ts +0 -99
- package/src/models/mex/MexReportItem.ts +0 -79
- package/src/models/mex/MexTransaction.ts +0 -105
- package/src/models/mex/actividad-vulnerable/MexActividadVulnerableClient.ts +0 -66
- package/src/models/mex/actividad-vulnerable/MexActividadVulnerableReport.ts +0 -73
- package/src/models/mex/actividad-vulnerable/MexActividadVulnerableReportItem.ts +0 -74
- package/src/models/mex/actividad-vulnerable/MexActividadVulnerableTransaction.ts +0 -50
- package/src/models/mex/actividad-vulnerable/avi/MexAVIClient.ts +0 -80
- package/src/models/mex/actividad-vulnerable/avi/MexAVIReport.ts +0 -114
- package/src/models/mex/actividad-vulnerable/avi/MexAVIReportItem.ts +0 -105
- package/src/models/mex/actividad-vulnerable/avi/MexAVITransaction.ts +0 -157
- package/src/models/mex/actividad-vulnerable/index.ts +0 -78
- package/src/models/mex/actividad-vulnerable/jys/MexJYSClient.ts +0 -73
- package/src/models/mex/actividad-vulnerable/jys/MexJYSReport.ts +0 -114
- package/src/models/mex/actividad-vulnerable/jys/MexJYSReportItem.ts +0 -105
- package/src/models/mex/actividad-vulnerable/jys/MexJYSTransaction.ts +0 -178
- package/src/models/mex/actividad-vulnerable/tsc/MexTSCClient.ts +0 -73
- package/src/models/mex/actividad-vulnerable/tsc/MexTSCReport.ts +0 -114
- package/src/models/mex/actividad-vulnerable/tsc/MexTSCReportItem.ts +0 -105
- package/src/models/mex/actividad-vulnerable/tsc/MexTSCTransaction.ts +0 -104
- package/src/models/mex/index.ts +0 -57
- package/src/models/types.ts +0 -196
- package/src/namespaces/index.ts +0 -29
- package/src/namespaces/mexico/actividad-vulnerable/avi/index.ts +0 -62
- package/src/namespaces/mexico/actividad-vulnerable/index.ts +0 -79
- package/src/namespaces/mexico/actividad-vulnerable/jys/index.ts +0 -72
- package/src/namespaces/mexico/actividad-vulnerable/tsc/index.ts +0 -60
- package/src/namespaces/mexico/index.ts +0 -325
- package/src/resources/addresses.ts +0 -391
- package/src/resources/bank-accounts.ts +0 -417
- package/src/resources/base.ts +0 -327
- package/src/resources/clients.ts +0 -808
- package/src/resources/contact-methods.ts +0 -412
- package/src/resources/documents.ts +0 -688
- package/src/resources/index.ts +0 -40
- package/src/resources/mex/actividad-vulnerable/avi/clients.ts +0 -559
- package/src/resources/mex/actividad-vulnerable/avi/index.ts +0 -7
- package/src/resources/mex/actividad-vulnerable/avi/reports.ts +0 -609
- package/src/resources/mex/actividad-vulnerable/avi/transactions.ts +0 -404
- package/src/resources/mex/actividad-vulnerable/index.ts +0 -12
- package/src/resources/mex/actividad-vulnerable/jys/clients.ts +0 -445
- package/src/resources/mex/actividad-vulnerable/jys/index.ts +0 -7
- package/src/resources/mex/actividad-vulnerable/jys/reports.ts +0 -591
- package/src/resources/mex/actividad-vulnerable/jys/transactions.ts +0 -395
- package/src/resources/mex/actividad-vulnerable/tsc/clients.ts +0 -445
- package/src/resources/mex/actividad-vulnerable/tsc/index.ts +0 -7
- package/src/resources/mex/actividad-vulnerable/tsc/reports.ts +0 -591
- package/src/resources/mex/actividad-vulnerable/tsc/transactions.ts +0 -404
- package/src/resources/mex/addresses.ts +0 -493
- package/src/resources/mex/bank-accounts.ts +0 -283
- package/src/resources/mex/clients.ts +0 -758
- package/src/resources/mex/ebr.ts +0 -621
- package/src/resources/mex/index.ts +0 -23
- package/src/resources/mex/reports.ts +0 -643
- package/src/resources/mex/transactions.ts +0 -422
- package/src/resources/reports.ts +0 -515
- package/src/resources/transactions.ts +0 -358
- package/src/sdk/ComplianceSDK.ts +0 -812
- package/src/sdk/base.ts +0 -43
- package/src/sdk/index.ts +0 -98
- package/src/sdk/mex/ComplianceSDK.ts +0 -147
- package/src/sdk/mex/actividad-vulnerable/avi/ComplianceSDK.ts +0 -55
- package/src/sdk/mex/actividad-vulnerable/avi/index.ts +0 -16
- package/src/sdk/mex/actividad-vulnerable/avi/types.ts +0 -86
- package/src/sdk/mex/actividad-vulnerable/index.ts +0 -58
- package/src/sdk/mex/actividad-vulnerable/jys/ComplianceSDK.ts +0 -54
- package/src/sdk/mex/actividad-vulnerable/jys/index.ts +0 -16
- package/src/sdk/mex/actividad-vulnerable/jys/types.ts +0 -86
- package/src/sdk/mex/actividad-vulnerable/tsc/ComplianceSDK.ts +0 -54
- package/src/sdk/mex/actividad-vulnerable/tsc/index.ts +0 -16
- package/src/sdk/mex/actividad-vulnerable/tsc/types.ts +0 -86
- package/src/sdk/mex/index.ts +0 -66
- package/src/sdk/mex/types.ts +0 -88
- package/src/sdk/resource-registry.ts +0 -204
- package/src/sdk/sdk-registry.ts +0 -99
- package/src/sdk/types.ts +0 -304
- package/src/utils/environment.ts +0 -187
- package/src/utils/filters.ts +0 -412
- package/src/utils/index.ts +0 -134
- package/src/utils/pagination.ts +0 -143
- package/src/utils/session.ts +0 -303
- package/src/utils/trpc-client.ts +0 -242
- package/src/utils/upload.ts +0 -388
package/src/errors/upload.ts
DELETED
|
@@ -1,204 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Upload error classes
|
|
3
|
-
*
|
|
4
|
-
* Errors thrown during file upload operations.
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
import { ComplianceError, type ComplianceErrorOptions } from "./base";
|
|
8
|
-
|
|
9
|
-
// ===========================
|
|
10
|
-
// Types
|
|
11
|
-
// ===========================
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* Stage of upload where the error occurred
|
|
15
|
-
*/
|
|
16
|
-
export type UploadStage = "request" | "upload" | "confirm";
|
|
17
|
-
|
|
18
|
-
// ===========================
|
|
19
|
-
// Upload Error Classes
|
|
20
|
-
// ===========================
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* Error thrown during file upload operations.
|
|
24
|
-
*
|
|
25
|
-
* @example
|
|
26
|
-
* ```typescript
|
|
27
|
-
* try {
|
|
28
|
-
* await sdk.documents.upload(file, { clientId: "..." });
|
|
29
|
-
* } catch (error) {
|
|
30
|
-
* if (error instanceof UploadError) {
|
|
31
|
-
* console.log(`Upload failed at stage: ${error.stage}`);
|
|
32
|
-
* }
|
|
33
|
-
* }
|
|
34
|
-
* ```
|
|
35
|
-
*/
|
|
36
|
-
export class UploadError extends ComplianceError {
|
|
37
|
-
/**
|
|
38
|
-
* Stage of the upload process where the error occurred:
|
|
39
|
-
* - "request": Failed to request upload URL
|
|
40
|
-
* - "upload": Failed to upload file to storage
|
|
41
|
-
* - "confirm": Failed to confirm upload with API
|
|
42
|
-
*/
|
|
43
|
-
public readonly stage: UploadStage;
|
|
44
|
-
|
|
45
|
-
constructor(
|
|
46
|
-
message: string,
|
|
47
|
-
stage: UploadStage,
|
|
48
|
-
options?: ComplianceErrorOptions
|
|
49
|
-
) {
|
|
50
|
-
super(message, "UPLOAD_ERROR", options);
|
|
51
|
-
this.name = "UploadError";
|
|
52
|
-
this.stage = stage;
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
/**
|
|
57
|
-
* File exceeds maximum allowed size.
|
|
58
|
-
*
|
|
59
|
-
* @example
|
|
60
|
-
* ```typescript
|
|
61
|
-
* try {
|
|
62
|
-
* await sdk.documents.upload(largeFile, { clientId: "..." });
|
|
63
|
-
* } catch (error) {
|
|
64
|
-
* if (error instanceof FileTooLargeError) {
|
|
65
|
-
* console.log(`Max size: ${error.maxSizeFormatted}`);
|
|
66
|
-
* console.log(`Your file: ${error.actualSizeFormatted}`);
|
|
67
|
-
* }
|
|
68
|
-
* }
|
|
69
|
-
* ```
|
|
70
|
-
*/
|
|
71
|
-
export class FileTooLargeError extends UploadError {
|
|
72
|
-
/**
|
|
73
|
-
* Maximum allowed file size in bytes
|
|
74
|
-
*/
|
|
75
|
-
public readonly maxSize: number;
|
|
76
|
-
|
|
77
|
-
/**
|
|
78
|
-
* Actual file size in bytes
|
|
79
|
-
*/
|
|
80
|
-
public readonly actualSize: number;
|
|
81
|
-
|
|
82
|
-
constructor(actualSize: number, maxSize: number) {
|
|
83
|
-
super(
|
|
84
|
-
`File size (${formatBytes(actualSize)}) exceeds maximum allowed size (${formatBytes(maxSize)})`,
|
|
85
|
-
"request",
|
|
86
|
-
{ details: { actualSize, maxSize } }
|
|
87
|
-
);
|
|
88
|
-
this.name = "FileTooLargeError";
|
|
89
|
-
this.maxSize = maxSize;
|
|
90
|
-
this.actualSize = actualSize;
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
/**
|
|
94
|
-
* Maximum size formatted for display (e.g., "10 MB")
|
|
95
|
-
*/
|
|
96
|
-
get maxSizeFormatted(): string {
|
|
97
|
-
return formatBytes(this.maxSize);
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
/**
|
|
101
|
-
* Actual size formatted for display (e.g., "15.2 MB")
|
|
102
|
-
*/
|
|
103
|
-
get actualSizeFormatted(): string {
|
|
104
|
-
return formatBytes(this.actualSize);
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
/**
|
|
109
|
-
* Upload timed out.
|
|
110
|
-
*/
|
|
111
|
-
export class UploadTimeoutError extends UploadError {
|
|
112
|
-
/**
|
|
113
|
-
* Timeout duration in milliseconds
|
|
114
|
-
*/
|
|
115
|
-
public readonly timeout: number;
|
|
116
|
-
|
|
117
|
-
constructor(timeout: number, requestId?: string) {
|
|
118
|
-
super(`Upload timed out after ${timeout}ms`, "upload", {
|
|
119
|
-
requestId,
|
|
120
|
-
details: { timeout },
|
|
121
|
-
});
|
|
122
|
-
this.name = "UploadTimeoutError";
|
|
123
|
-
this.timeout = timeout;
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
/**
|
|
128
|
-
* Invalid file type.
|
|
129
|
-
*/
|
|
130
|
-
export class InvalidFileTypeError extends UploadError {
|
|
131
|
-
/**
|
|
132
|
-
* Allowed MIME types
|
|
133
|
-
*/
|
|
134
|
-
public readonly allowedTypes: string[];
|
|
135
|
-
|
|
136
|
-
/**
|
|
137
|
-
* Actual MIME type of the file
|
|
138
|
-
*/
|
|
139
|
-
public readonly actualType: string;
|
|
140
|
-
|
|
141
|
-
constructor(actualType: string, allowedTypes: string[]) {
|
|
142
|
-
super(
|
|
143
|
-
`File type '${actualType}' is not allowed. Allowed types: ${allowedTypes.join(", ")}`,
|
|
144
|
-
"request",
|
|
145
|
-
{ details: { actualType, allowedTypes } }
|
|
146
|
-
);
|
|
147
|
-
this.name = "InvalidFileTypeError";
|
|
148
|
-
this.actualType = actualType;
|
|
149
|
-
this.allowedTypes = allowedTypes;
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
/**
|
|
154
|
-
* Upload was aborted.
|
|
155
|
-
*/
|
|
156
|
-
export class UploadAbortedError extends UploadError {
|
|
157
|
-
constructor(requestId?: string) {
|
|
158
|
-
super("Upload was aborted", "upload", { requestId });
|
|
159
|
-
this.name = "UploadAbortedError";
|
|
160
|
-
}
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
/**
|
|
164
|
-
* Upload URL expired before upload completed.
|
|
165
|
-
*/
|
|
166
|
-
export class UploadUrlExpiredError extends UploadError {
|
|
167
|
-
constructor(requestId?: string) {
|
|
168
|
-
super(
|
|
169
|
-
"Upload URL has expired. Please request a new upload URL.",
|
|
170
|
-
"upload",
|
|
171
|
-
{
|
|
172
|
-
requestId,
|
|
173
|
-
}
|
|
174
|
-
);
|
|
175
|
-
this.name = "UploadUrlExpiredError";
|
|
176
|
-
}
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
// ===========================
|
|
180
|
-
// Helpers
|
|
181
|
-
// ===========================
|
|
182
|
-
|
|
183
|
-
/**
|
|
184
|
-
* Formats bytes into a human-readable string.
|
|
185
|
-
*
|
|
186
|
-
* @param bytes - Number of bytes
|
|
187
|
-
* @returns Formatted string (e.g., "1.5 MB")
|
|
188
|
-
*/
|
|
189
|
-
function formatBytes(bytes: number): string {
|
|
190
|
-
if (bytes === 0) return "0 bytes";
|
|
191
|
-
if (bytes < 1024) return `${bytes} bytes`;
|
|
192
|
-
if (bytes < 1024 * 1024) return `${(bytes / 1024).toFixed(1)} KB`;
|
|
193
|
-
if (bytes < 1024 * 1024 * 1024) {
|
|
194
|
-
return `${(bytes / (1024 * 1024)).toFixed(1)} MB`;
|
|
195
|
-
}
|
|
196
|
-
return `${(bytes / (1024 * 1024 * 1024)).toFixed(1)} GB`;
|
|
197
|
-
}
|
|
198
|
-
|
|
199
|
-
/**
|
|
200
|
-
* Type guard to check if an error is an upload error.
|
|
201
|
-
*/
|
|
202
|
-
export function isUploadError(error: unknown): error is UploadError {
|
|
203
|
-
return error instanceof UploadError;
|
|
204
|
-
}
|
package/src/errors/validation.ts
DELETED
|
@@ -1,163 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Validation error class
|
|
3
|
-
*
|
|
4
|
-
* Thrown when input validation fails, either client-side (Zod)
|
|
5
|
-
* or server-side (API validation).
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
import type { ZodError } from "zod";
|
|
9
|
-
import { ComplianceError } from "./base";
|
|
10
|
-
|
|
11
|
-
// ===========================
|
|
12
|
-
// Types
|
|
13
|
-
// ===========================
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* A single validation issue
|
|
17
|
-
*/
|
|
18
|
-
export interface ValidationIssue {
|
|
19
|
-
/**
|
|
20
|
-
* Path to the field that failed validation.
|
|
21
|
-
* Example: ["addresses", "0", "postalCode"]
|
|
22
|
-
*/
|
|
23
|
-
path: PropertyKey[];
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
* Human-readable error message
|
|
27
|
-
*/
|
|
28
|
-
message: string;
|
|
29
|
-
|
|
30
|
-
/**
|
|
31
|
-
* Validation rule that failed (optional)
|
|
32
|
-
*/
|
|
33
|
-
code?: string;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
// ===========================
|
|
37
|
-
// Validation Error Class
|
|
38
|
-
// ===========================
|
|
39
|
-
|
|
40
|
-
/**
|
|
41
|
-
* Error thrown when input validation fails.
|
|
42
|
-
*
|
|
43
|
-
* Contains structured information about which fields failed
|
|
44
|
-
* and why, making it easy to display errors in forms.
|
|
45
|
-
*
|
|
46
|
-
* @example
|
|
47
|
-
* ```typescript
|
|
48
|
-
* try {
|
|
49
|
-
* await sdk.clients.create({ name: "" });
|
|
50
|
-
* } catch (error) {
|
|
51
|
-
* if (error instanceof ValidationError) {
|
|
52
|
-
* error.issues.forEach((issue) => {
|
|
53
|
-
* console.log(`${issue.path.join(".")}: ${issue.message}`);
|
|
54
|
-
* });
|
|
55
|
-
* }
|
|
56
|
-
* }
|
|
57
|
-
* ```
|
|
58
|
-
*/
|
|
59
|
-
export class ValidationError extends ComplianceError {
|
|
60
|
-
/**
|
|
61
|
-
* List of validation issues
|
|
62
|
-
*/
|
|
63
|
-
public readonly issues: ValidationIssue[];
|
|
64
|
-
|
|
65
|
-
constructor(issues: ValidationIssue[], requestId?: string) {
|
|
66
|
-
const message = ValidationError.formatMessage(issues);
|
|
67
|
-
super(message, "VALIDATION_ERROR", {
|
|
68
|
-
requestId,
|
|
69
|
-
details: { issues },
|
|
70
|
-
});
|
|
71
|
-
this.name = "ValidationError";
|
|
72
|
-
this.issues = issues;
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
/**
|
|
76
|
-
* Creates a ValidationError from a Zod error.
|
|
77
|
-
*
|
|
78
|
-
* @param error - Zod validation error
|
|
79
|
-
* @param requestId - Optional request ID for tracing
|
|
80
|
-
* @returns ValidationError with formatted issues
|
|
81
|
-
*/
|
|
82
|
-
static fromZodError(error: ZodError, requestId?: string): ValidationError {
|
|
83
|
-
const issues: ValidationIssue[] = error.issues.map((issue) => ({
|
|
84
|
-
path: issue.path,
|
|
85
|
-
message: issue.message,
|
|
86
|
-
code: issue.code,
|
|
87
|
-
}));
|
|
88
|
-
return new ValidationError(issues, requestId);
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
/**
|
|
92
|
-
* Gets validation errors for a specific field path.
|
|
93
|
-
*
|
|
94
|
-
* @param path - Field path (e.g., "name" or "addresses.0.city")
|
|
95
|
-
* @returns Array of error messages for the field
|
|
96
|
-
*
|
|
97
|
-
* @example
|
|
98
|
-
* ```typescript
|
|
99
|
-
* const nameErrors = error.getFieldErrors("name");
|
|
100
|
-
* // ["Name is required", "Name must be at least 2 characters"]
|
|
101
|
-
* ```
|
|
102
|
-
*/
|
|
103
|
-
getFieldErrors(path: string): string[] {
|
|
104
|
-
const pathParts = path.split(".");
|
|
105
|
-
return this.issues
|
|
106
|
-
.filter((issue) => {
|
|
107
|
-
if (issue.path.length !== pathParts.length) return false;
|
|
108
|
-
return pathParts.every((part, i) => String(issue.path[i]) === part);
|
|
109
|
-
})
|
|
110
|
-
.map((issue) => issue.message);
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
/**
|
|
114
|
-
* Checks if a specific field has validation errors.
|
|
115
|
-
*
|
|
116
|
-
* @param path - Field path to check
|
|
117
|
-
* @returns True if the field has errors
|
|
118
|
-
*/
|
|
119
|
-
hasFieldError(path: string): boolean {
|
|
120
|
-
return this.getFieldErrors(path).length > 0;
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
/**
|
|
124
|
-
* Gets a flat object of field paths to error messages.
|
|
125
|
-
* Useful for form libraries.
|
|
126
|
-
*
|
|
127
|
-
* @returns Object mapping field paths to error messages
|
|
128
|
-
*
|
|
129
|
-
* @example
|
|
130
|
-
* ```typescript
|
|
131
|
-
* const fieldErrors = error.toFieldErrors();
|
|
132
|
-
* // { "name": "Name is required", "email": "Invalid email" }
|
|
133
|
-
* ```
|
|
134
|
-
*/
|
|
135
|
-
toFieldErrors(): Record<string, string> {
|
|
136
|
-
const errors: Record<string, string> = {};
|
|
137
|
-
for (const issue of this.issues) {
|
|
138
|
-
const path = issue.path.join(".");
|
|
139
|
-
// Only keep first error per field
|
|
140
|
-
if (!errors[path]) {
|
|
141
|
-
errors[path] = issue.message;
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
return errors;
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
/**
|
|
148
|
-
* Formats the validation issues into a human-readable message.
|
|
149
|
-
*/
|
|
150
|
-
private static formatMessage(issues: ValidationIssue[]): string {
|
|
151
|
-
if (issues.length === 0) {
|
|
152
|
-
return "Validation failed";
|
|
153
|
-
}
|
|
154
|
-
if (issues.length === 1) {
|
|
155
|
-
const [issue] = issues;
|
|
156
|
-
if (issue) {
|
|
157
|
-
const path = issue.path.length > 0 ? `${issue.path.join(".")}: ` : "";
|
|
158
|
-
return `Validation failed: ${path}${issue.message}`;
|
|
159
|
-
}
|
|
160
|
-
}
|
|
161
|
-
return `Validation failed with ${issues.length} errors`;
|
|
162
|
-
}
|
|
163
|
-
}
|
package/src/exports/base.ts
DELETED
|
@@ -1,139 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Base exports shared across all entry points
|
|
3
|
-
*
|
|
4
|
-
* @internal - Not meant for direct import by users
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
// ===========================
|
|
8
|
-
// Errors
|
|
9
|
-
// ===========================
|
|
10
|
-
|
|
11
|
-
export {
|
|
12
|
-
ComplianceError,
|
|
13
|
-
type ComplianceErrorOptions,
|
|
14
|
-
type ComplianceErrorJSON,
|
|
15
|
-
ValidationError,
|
|
16
|
-
type ValidationIssue,
|
|
17
|
-
APIError,
|
|
18
|
-
NotFoundError,
|
|
19
|
-
UnauthorizedError,
|
|
20
|
-
ForbiddenError,
|
|
21
|
-
RateLimitError,
|
|
22
|
-
ServerError,
|
|
23
|
-
NetworkError,
|
|
24
|
-
TimeoutError,
|
|
25
|
-
UploadError,
|
|
26
|
-
FileTooLargeError,
|
|
27
|
-
UploadTimeoutError,
|
|
28
|
-
InvalidFileTypeError,
|
|
29
|
-
UploadAbortedError,
|
|
30
|
-
UploadUrlExpiredError,
|
|
31
|
-
mapTRPCError,
|
|
32
|
-
isAPIError,
|
|
33
|
-
isUploadError,
|
|
34
|
-
type UploadStage,
|
|
35
|
-
} from "../errors";
|
|
36
|
-
|
|
37
|
-
// ===========================
|
|
38
|
-
// Utilities
|
|
39
|
-
// ===========================
|
|
40
|
-
|
|
41
|
-
export {
|
|
42
|
-
collectAll,
|
|
43
|
-
collectUpTo,
|
|
44
|
-
getFirst,
|
|
45
|
-
DEFAULT_PAGE_SIZE,
|
|
46
|
-
MAX_PAGE_SIZE,
|
|
47
|
-
contains,
|
|
48
|
-
startsWith,
|
|
49
|
-
endsWith,
|
|
50
|
-
equals,
|
|
51
|
-
notEquals,
|
|
52
|
-
oneOf,
|
|
53
|
-
notOneOf,
|
|
54
|
-
dateRange,
|
|
55
|
-
after,
|
|
56
|
-
before,
|
|
57
|
-
onOrAfter,
|
|
58
|
-
onOrBefore,
|
|
59
|
-
numberRange,
|
|
60
|
-
greaterThan,
|
|
61
|
-
lessThan,
|
|
62
|
-
atLeast,
|
|
63
|
-
atMost,
|
|
64
|
-
isTrue,
|
|
65
|
-
isFalse,
|
|
66
|
-
isNull,
|
|
67
|
-
isNotNull,
|
|
68
|
-
type Environment,
|
|
69
|
-
} from "../utils";
|
|
70
|
-
|
|
71
|
-
// ===========================
|
|
72
|
-
// Session Types (for SDK.session() method)
|
|
73
|
-
// ===========================
|
|
74
|
-
|
|
75
|
-
export type {
|
|
76
|
-
SDKSessionOptions,
|
|
77
|
-
SDKSessionOptionsWithReturnTo,
|
|
78
|
-
SessionResult,
|
|
79
|
-
SessionResultWithRedirect,
|
|
80
|
-
SessionResultWithoutRedirect,
|
|
81
|
-
SessionResultAuthenticated,
|
|
82
|
-
SessionResultUnauthenticatedWithRedirect,
|
|
83
|
-
SessionResultUnauthenticatedNoRedirect,
|
|
84
|
-
SessionInfo,
|
|
85
|
-
} from "../utils";
|
|
86
|
-
|
|
87
|
-
// ===========================
|
|
88
|
-
// Base Models (non-scoped entities)
|
|
89
|
-
// ===========================
|
|
90
|
-
|
|
91
|
-
export {
|
|
92
|
-
Address,
|
|
93
|
-
type AddressData,
|
|
94
|
-
ContactMethod,
|
|
95
|
-
type ContactMethodData,
|
|
96
|
-
Document,
|
|
97
|
-
type DocumentData,
|
|
98
|
-
} from "../models";
|
|
99
|
-
|
|
100
|
-
// ===========================
|
|
101
|
-
// Base Resources (non-scoped entities)
|
|
102
|
-
// ===========================
|
|
103
|
-
|
|
104
|
-
export {
|
|
105
|
-
AddressesResource,
|
|
106
|
-
ContactMethodsResource,
|
|
107
|
-
DocumentsResource,
|
|
108
|
-
} from "../resources";
|
|
109
|
-
|
|
110
|
-
// ===========================
|
|
111
|
-
// Shared Types from Shared Package
|
|
112
|
-
// ===========================
|
|
113
|
-
|
|
114
|
-
export type {
|
|
115
|
-
// Address types (non-scoped)
|
|
116
|
-
CreateAddressInput,
|
|
117
|
-
UpdateAddressInput,
|
|
118
|
-
// Contact method types (non-scoped)
|
|
119
|
-
CreateContactMethodInput,
|
|
120
|
-
UpdateContactMethodInput,
|
|
121
|
-
// Document types (non-scoped)
|
|
122
|
-
CreateDocumentInput,
|
|
123
|
-
UpdateDocumentInput,
|
|
124
|
-
// Pagination
|
|
125
|
-
PaginationInput,
|
|
126
|
-
PaginatedResponse,
|
|
127
|
-
PaginationMeta,
|
|
128
|
-
ListOptions,
|
|
129
|
-
IterateOptions,
|
|
130
|
-
// Filters
|
|
131
|
-
ClientFilter,
|
|
132
|
-
TransactionFilter,
|
|
133
|
-
DocumentFilter,
|
|
134
|
-
BankAccountFilter,
|
|
135
|
-
// API error responses
|
|
136
|
-
APIError as APIErrorResponse,
|
|
137
|
-
APIValidationError as APIValidationErrorResponse,
|
|
138
|
-
BatchResult,
|
|
139
|
-
} from "@artu-ai/shared";
|
package/src/exports/index.ts
DELETED
|
@@ -1,187 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @artu/compliance-sdk
|
|
3
|
-
*
|
|
4
|
-
* TypeScript SDK for the Global Compliance API
|
|
5
|
-
*
|
|
6
|
-
* @example
|
|
7
|
-
* ```typescript
|
|
8
|
-
* import { ComplianceSDK, ClientType, Jurisdiction, Mexico } from "@artu/compliance-sdk";
|
|
9
|
-
*
|
|
10
|
-
* const sdk = new ComplianceSDK({
|
|
11
|
-
* apiKey: process.env.COMPLIANCE_API_KEY!,
|
|
12
|
-
* environment: "test",
|
|
13
|
-
* });
|
|
14
|
-
*
|
|
15
|
-
* // Create a client
|
|
16
|
-
* const client = await sdk.clients.create({
|
|
17
|
-
* type: ClientType.Person,
|
|
18
|
-
* name: "Juan García",
|
|
19
|
-
* primaryJurisdiction: Jurisdiction.Mexico,
|
|
20
|
-
* });
|
|
21
|
-
*
|
|
22
|
-
* // List transactions
|
|
23
|
-
* for await (const txn of sdk.transactions.iterate()) {
|
|
24
|
-
* console.log(txn.id, txn.amount);
|
|
25
|
-
* }
|
|
26
|
-
*
|
|
27
|
-
* // Access Mexico-specific functionality via namespace
|
|
28
|
-
* Mexico.Enums.ActividadEconomica
|
|
29
|
-
* Mexico.Validators.Rfc.validate("...")
|
|
30
|
-
* ```
|
|
31
|
-
*/
|
|
32
|
-
|
|
33
|
-
// ===========================
|
|
34
|
-
// SDK
|
|
35
|
-
// ===========================
|
|
36
|
-
|
|
37
|
-
export {
|
|
38
|
-
ComplianceSDK,
|
|
39
|
-
type ComplianceSDKOptions,
|
|
40
|
-
type ComplianceSDKConstructor,
|
|
41
|
-
type SDKScope,
|
|
42
|
-
type UnscopedComplianceSDK,
|
|
43
|
-
type SessionInfo,
|
|
44
|
-
} from "../sdk";
|
|
45
|
-
|
|
46
|
-
// ===========================
|
|
47
|
-
// Enums
|
|
48
|
-
// ===========================
|
|
49
|
-
|
|
50
|
-
export {
|
|
51
|
-
// Enum values
|
|
52
|
-
ClientType,
|
|
53
|
-
Jurisdiction,
|
|
54
|
-
AddressType,
|
|
55
|
-
ContactMethodType,
|
|
56
|
-
TransactionStatus,
|
|
57
|
-
DocumentStatus,
|
|
58
|
-
DocumentCategory,
|
|
59
|
-
ReportStatus,
|
|
60
|
-
BankAccountType,
|
|
61
|
-
ClientRole,
|
|
62
|
-
ClientRelationshipType,
|
|
63
|
-
Country,
|
|
64
|
-
Currency,
|
|
65
|
-
// Enum utilities (with .enum, .map, .codes, .options, .schema())
|
|
66
|
-
ClientTypes,
|
|
67
|
-
Jurisdictions,
|
|
68
|
-
AddressTypes,
|
|
69
|
-
ContactMethodTypes,
|
|
70
|
-
TransactionStatuses,
|
|
71
|
-
DocumentStatuses,
|
|
72
|
-
DocumentCategories,
|
|
73
|
-
ReportStatuses,
|
|
74
|
-
BankAccountTypes,
|
|
75
|
-
ClientRoles,
|
|
76
|
-
ClientRelationshipTypes,
|
|
77
|
-
} from "@artu-ai/shared";
|
|
78
|
-
|
|
79
|
-
// ===========================
|
|
80
|
-
// Jurisdiction Namespaces
|
|
81
|
-
// ===========================
|
|
82
|
-
|
|
83
|
-
export { Mexico } from "../namespaces/mexico";
|
|
84
|
-
|
|
85
|
-
// ===========================
|
|
86
|
-
// Base Resources
|
|
87
|
-
// ===========================
|
|
88
|
-
|
|
89
|
-
export {
|
|
90
|
-
BaseResource,
|
|
91
|
-
ReadOnlyResource,
|
|
92
|
-
type ResourceConfig,
|
|
93
|
-
ClientsResource,
|
|
94
|
-
TransactionsResource,
|
|
95
|
-
type RelatedClient,
|
|
96
|
-
BankAccountsResource,
|
|
97
|
-
ReportsResource,
|
|
98
|
-
type ReportFilter,
|
|
99
|
-
type ReportItemFilter,
|
|
100
|
-
type AddItemsResult,
|
|
101
|
-
DocumentsResource,
|
|
102
|
-
type CreateDocumentResult,
|
|
103
|
-
} from "../resources";
|
|
104
|
-
|
|
105
|
-
// ===========================
|
|
106
|
-
// Base Models
|
|
107
|
-
// ===========================
|
|
108
|
-
|
|
109
|
-
export {
|
|
110
|
-
BaseModel,
|
|
111
|
-
Client,
|
|
112
|
-
type ClientData,
|
|
113
|
-
Transaction,
|
|
114
|
-
type TransactionData,
|
|
115
|
-
Report,
|
|
116
|
-
type ReportData,
|
|
117
|
-
ReportItem,
|
|
118
|
-
type ReportItemData,
|
|
119
|
-
BankAccount,
|
|
120
|
-
type BankAccountData,
|
|
121
|
-
LinkedClient,
|
|
122
|
-
type LinkedClientData,
|
|
123
|
-
type ClientModel,
|
|
124
|
-
type TransactionModel,
|
|
125
|
-
type BankAccountModel,
|
|
126
|
-
type ReportModel,
|
|
127
|
-
type ReportItemModel,
|
|
128
|
-
isClient,
|
|
129
|
-
isIndividual,
|
|
130
|
-
isCompany,
|
|
131
|
-
isTrust,
|
|
132
|
-
isTransaction,
|
|
133
|
-
isBankAccount,
|
|
134
|
-
isReport,
|
|
135
|
-
isReportItem,
|
|
136
|
-
isLinkedClient,
|
|
137
|
-
} from "../models";
|
|
138
|
-
|
|
139
|
-
// ===========================
|
|
140
|
-
// Schema Types (raw API types)
|
|
141
|
-
// ===========================
|
|
142
|
-
|
|
143
|
-
export type {
|
|
144
|
-
BaseClient,
|
|
145
|
-
Address as AddressSchema,
|
|
146
|
-
BaseTransaction,
|
|
147
|
-
Document as DocumentSchema,
|
|
148
|
-
ContactMethod as ContactMethodSchema,
|
|
149
|
-
Report as ReportSchema,
|
|
150
|
-
ReportItem as ReportItemSchema,
|
|
151
|
-
BankAccount as BankAccountSchema,
|
|
152
|
-
// Value types
|
|
153
|
-
CountryIso2,
|
|
154
|
-
CountryIso3,
|
|
155
|
-
CurrencyCode,
|
|
156
|
-
} from "@artu-ai/shared";
|
|
157
|
-
|
|
158
|
-
// ===========================
|
|
159
|
-
// Scoped Types (base scope)
|
|
160
|
-
// ===========================
|
|
161
|
-
|
|
162
|
-
export type {
|
|
163
|
-
// Client types
|
|
164
|
-
CreateClientInput,
|
|
165
|
-
UpdateClientInput,
|
|
166
|
-
// Transaction types
|
|
167
|
-
CreateTransactionInput,
|
|
168
|
-
UpdateTransactionInput,
|
|
169
|
-
// Report types
|
|
170
|
-
CreateReportInput,
|
|
171
|
-
UpdateReportInput,
|
|
172
|
-
CreateReportItemInput,
|
|
173
|
-
ReportValidationError,
|
|
174
|
-
ValidationSummary,
|
|
175
|
-
ValidationResult,
|
|
176
|
-
GenerateResult,
|
|
177
|
-
SubmissionResult,
|
|
178
|
-
// Bank account types
|
|
179
|
-
CreateBankAccountInput,
|
|
180
|
-
UpdateBankAccountInput,
|
|
181
|
-
} from "@artu-ai/shared";
|
|
182
|
-
|
|
183
|
-
// ===========================
|
|
184
|
-
// Base Exports (errors, utilities, etc.)
|
|
185
|
-
// ===========================
|
|
186
|
-
|
|
187
|
-
export * from "./base";
|