@artu-ai/compliance-sdk 0.6.8 → 0.7.0
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/exports/mexico/actividad-vulnerable/avi.d.ts +2 -1
- package/dist/exports/mexico/actividad-vulnerable/avi.d.ts.map +1 -1
- package/dist/exports/mexico/actividad-vulnerable/jys.d.ts +2 -1
- package/dist/exports/mexico/actividad-vulnerable/jys.d.ts.map +1 -1
- package/dist/exports/mexico/actividad-vulnerable/mjr.d.ts +677 -0
- package/dist/exports/mexico/actividad-vulnerable/mjr.d.ts.map +1 -0
- package/dist/exports/mexico/actividad-vulnerable/mjr.js +110 -0
- package/dist/exports/mexico/actividad-vulnerable/tsc.d.ts +2 -1
- package/dist/exports/mexico/actividad-vulnerable/tsc.d.ts.map +1 -1
- package/dist/models/Client.d.ts +7 -1
- package/dist/models/Client.d.ts.map +1 -1
- package/dist/models/Client.js +19 -1
- package/dist/models/index.d.ts +1 -1
- package/dist/models/index.d.ts.map +1 -1
- package/dist/models/index.js +3 -3
- package/dist/models/mex/MexClient.d.ts +1 -1
- package/dist/models/mex/MexClient.d.ts.map +1 -1
- package/dist/models/mex/MexClient.js +2 -9
- package/dist/models/mex/MexReport.d.ts.map +1 -1
- package/dist/models/mex/MexReport.js +2 -9
- package/dist/models/mex/MexTransaction.d.ts +1 -1
- package/dist/models/mex/MexTransaction.d.ts.map +1 -1
- package/dist/models/mex/MexTransaction.js +2 -9
- package/dist/models/mex/actividad-vulnerable/index.d.ts +4 -0
- package/dist/models/mex/actividad-vulnerable/index.d.ts.map +1 -1
- package/dist/models/mex/actividad-vulnerable/index.js +4 -0
- package/dist/models/mex/actividad-vulnerable/mjr/MexMJRClient.d.ts +40 -0
- package/dist/models/mex/actividad-vulnerable/mjr/MexMJRClient.d.ts.map +1 -0
- package/dist/models/mex/actividad-vulnerable/mjr/MexMJRClient.js +54 -0
- package/dist/models/mex/actividad-vulnerable/mjr/MexMJRReport.d.ts +53 -0
- package/dist/models/mex/actividad-vulnerable/mjr/MexMJRReport.d.ts.map +1 -0
- package/dist/models/mex/actividad-vulnerable/mjr/MexMJRReport.js +75 -0
- package/dist/models/mex/actividad-vulnerable/mjr/MexMJRReportItem.d.ts +56 -0
- package/dist/models/mex/actividad-vulnerable/mjr/MexMJRReportItem.d.ts.map +1 -0
- package/dist/models/mex/actividad-vulnerable/mjr/MexMJRReportItem.js +63 -0
- package/dist/models/mex/actividad-vulnerable/mjr/MexMJRTransaction.d.ts +79 -0
- package/dist/models/mex/actividad-vulnerable/mjr/MexMJRTransaction.d.ts.map +1 -0
- package/dist/models/mex/actividad-vulnerable/mjr/MexMJRTransaction.js +126 -0
- package/dist/namespaces/mexico/actividad-vulnerable/index.d.ts +4 -2
- package/dist/namespaces/mexico/actividad-vulnerable/index.d.ts.map +1 -1
- package/dist/namespaces/mexico/index.d.ts +2 -1
- package/dist/namespaces/mexico/index.d.ts.map +1 -1
- package/dist/resources/mex/actividad-vulnerable/index.d.ts +1 -0
- package/dist/resources/mex/actividad-vulnerable/index.d.ts.map +1 -1
- package/dist/resources/mex/actividad-vulnerable/index.js +2 -0
- package/dist/resources/mex/actividad-vulnerable/mjr/clients.d.ts +177 -0
- package/dist/resources/mex/actividad-vulnerable/mjr/clients.d.ts.map +1 -0
- package/dist/resources/mex/actividad-vulnerable/mjr/clients.js +320 -0
- package/dist/resources/mex/actividad-vulnerable/mjr/index.d.ts +7 -0
- package/dist/resources/mex/actividad-vulnerable/mjr/index.d.ts.map +1 -0
- package/dist/resources/mex/actividad-vulnerable/mjr/index.js +6 -0
- package/dist/resources/mex/actividad-vulnerable/mjr/reports.d.ts +170 -0
- package/dist/resources/mex/actividad-vulnerable/mjr/reports.d.ts.map +1 -0
- package/dist/resources/mex/actividad-vulnerable/mjr/reports.js +463 -0
- package/dist/resources/mex/actividad-vulnerable/mjr/transactions.d.ts +128 -0
- package/dist/resources/mex/actividad-vulnerable/mjr/transactions.d.ts.map +1 -0
- package/dist/resources/mex/actividad-vulnerable/mjr/transactions.js +343 -0
- package/dist/sdk/mex/actividad-vulnerable/index.d.ts +1 -0
- package/dist/sdk/mex/actividad-vulnerable/index.d.ts.map +1 -1
- package/dist/sdk/mex/actividad-vulnerable/index.js +6 -0
- package/dist/sdk/mex/actividad-vulnerable/mjr/ComplianceSDK.d.ts +56 -0
- package/dist/sdk/mex/actividad-vulnerable/mjr/ComplianceSDK.d.ts.map +1 -0
- package/dist/sdk/mex/actividad-vulnerable/mjr/ComplianceSDK.js +51 -0
- package/dist/sdk/mex/actividad-vulnerable/mjr/index.d.ts +8 -0
- package/dist/sdk/mex/actividad-vulnerable/mjr/index.d.ts.map +1 -0
- package/dist/sdk/mex/actividad-vulnerable/mjr/index.js +9 -0
- package/dist/sdk/mex/actividad-vulnerable/mjr/types.d.ts +35 -0
- package/dist/sdk/mex/actividad-vulnerable/mjr/types.d.ts.map +1 -0
- package/dist/sdk/mex/actividad-vulnerable/mjr/types.js +20 -0
- package/dist/sdk/mex/types.d.ts +2 -2
- package/dist/sdk/mex/types.d.ts.map +1 -1
- package/dist/sdk/types.d.ts +1 -1
- package/dist/sdk/types.d.ts.map +1 -1
- package/package.json +6 -2
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MJR (Metales y Joyas - Precious Metals and Jewelry) Clients Resource
|
|
3
|
+
*
|
|
4
|
+
* Extends MexClientsResource with MJR-specific behavior.
|
|
5
|
+
* MJR clients have the same fields as Mexico clients (no additional activity fields).
|
|
6
|
+
* Returns MexMJRClient models.
|
|
7
|
+
*/
|
|
8
|
+
import type { CreateClientInput, UpdateClientInput, ListOptions, PaginatedResponse, CreateMJRClientInput, UpdateMJRClientInput, UpsertMJRClientInput, AtomicBatchResult, PartialBatchResult, ClientRelationshipType, LinkedClient as LinkedClientInput, CreateMexAddressInput, UpdateMexAddressInput, CreateContactMethodInput, UpdateContactMethodInput, CreateBankAccountInput, UpdateBankAccountInput, SyncCreateDocumentInput, SyncUpdateDocumentInput, SyncItem, SyncResult, MJRClientFilter, MJRClientSort, UpsertResult } from "@artu-ai/shared";
|
|
9
|
+
import type { ClientSort } from "@artu-ai/shared";
|
|
10
|
+
import { MexClientsResource } from "../../clients";
|
|
11
|
+
import { type ClientIncludeMap } from "../../../clients";
|
|
12
|
+
import { MexMJRClient, MexAddress, MexBankAccount, ContactMethod, LinkedClient, Document, type ClientData } from "../../../../models";
|
|
13
|
+
/**
|
|
14
|
+
* MJR (Metales y Joyas) scoped clients resource.
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* ```typescript
|
|
18
|
+
* const mjrSdk = new ComplianceSDK({
|
|
19
|
+
* apiKey,
|
|
20
|
+
* environment: "test",
|
|
21
|
+
* jurisdiction: Jurisdiction.Mexico,
|
|
22
|
+
* actividadVulnerable: CodigoActividad.MJR,
|
|
23
|
+
* });
|
|
24
|
+
*
|
|
25
|
+
* const client = await mjrSdk.clients.create({
|
|
26
|
+
* type: ClientType.Person,
|
|
27
|
+
* name: "Juan García",
|
|
28
|
+
* rfc: "GAJL850101ABC",
|
|
29
|
+
* });
|
|
30
|
+
*
|
|
31
|
+
* // Returns MexMJRClient
|
|
32
|
+
* ```
|
|
33
|
+
*/
|
|
34
|
+
export declare class MJRClientsResource extends MexClientsResource<MJRClientSort> {
|
|
35
|
+
create(data: CreateMJRClientInput): Promise<MexMJRClient>;
|
|
36
|
+
retrieve(id: string, include?: ClientIncludeMap): Promise<MexMJRClient>;
|
|
37
|
+
retrieveByExternalId(externalId: string): Promise<MexMJRClient>;
|
|
38
|
+
update(id: string, data: UpdateMJRClientInput): Promise<MexMJRClient>;
|
|
39
|
+
/**
|
|
40
|
+
* Lists MJR clients with optional filtering.
|
|
41
|
+
*
|
|
42
|
+
* Accepts flattened MJR filter (MX fields at root level) and automatically
|
|
43
|
+
* transforms to nested format before calling the API.
|
|
44
|
+
*/
|
|
45
|
+
list(options?: ListOptions<MJRClientFilter, MJRClientSort> & {
|
|
46
|
+
includePrimaryContacts?: boolean;
|
|
47
|
+
}): Promise<PaginatedResponse<MexMJRClient>>;
|
|
48
|
+
/**
|
|
49
|
+
* Iterates over MJR clients.
|
|
50
|
+
*
|
|
51
|
+
* Accepts flattened MJR filter (MX fields at root level) and automatically
|
|
52
|
+
* transforms to nested format before calling the API.
|
|
53
|
+
*/
|
|
54
|
+
iterate(options?: {
|
|
55
|
+
filter?: MJRClientFilter;
|
|
56
|
+
sort?: MJRClientSort;
|
|
57
|
+
pageSize?: number;
|
|
58
|
+
}): AsyncGenerator<MexMJRClient, void, undefined>;
|
|
59
|
+
/**
|
|
60
|
+
* Counts MJR clients matching the given filter.
|
|
61
|
+
*
|
|
62
|
+
* @param filter - Optional filter criteria (with MJR fields at root level)
|
|
63
|
+
* @returns The count of matching clients
|
|
64
|
+
*/
|
|
65
|
+
count(filter?: MJRClientFilter): Promise<number>;
|
|
66
|
+
createMany(clients: CreateMJRClientInput[], options?: {
|
|
67
|
+
atomic?: true;
|
|
68
|
+
}): Promise<AtomicBatchResult<MexMJRClient>>;
|
|
69
|
+
createMany(clients: CreateMJRClientInput[], options: {
|
|
70
|
+
atomic: false;
|
|
71
|
+
}): Promise<PartialBatchResult<MexMJRClient>>;
|
|
72
|
+
updateMany(updates: {
|
|
73
|
+
id: string;
|
|
74
|
+
data: UpdateMJRClientInput;
|
|
75
|
+
}[], options?: {
|
|
76
|
+
atomic?: true;
|
|
77
|
+
}): Promise<AtomicBatchResult<MexMJRClient>>;
|
|
78
|
+
updateMany(updates: {
|
|
79
|
+
id: string;
|
|
80
|
+
data: UpdateMJRClientInput;
|
|
81
|
+
}[], options: {
|
|
82
|
+
atomic: false;
|
|
83
|
+
}): Promise<PartialBatchResult<MexMJRClient>>;
|
|
84
|
+
/**
|
|
85
|
+
* Creates or updates a MJR client by externalId.
|
|
86
|
+
*
|
|
87
|
+
* @param data - Client upsert data with MJR fields at root level (must include externalId)
|
|
88
|
+
* @returns The created or updated client with action indicator
|
|
89
|
+
*/
|
|
90
|
+
upsertByExternalId(data: UpsertMJRClientInput): Promise<UpsertResult<MexMJRClient>>;
|
|
91
|
+
/**
|
|
92
|
+
* Creates or updates multiple MJR clients by externalId.
|
|
93
|
+
*
|
|
94
|
+
* @param clients - Array of client upsert data (each must include externalId)
|
|
95
|
+
* @param options - Batch options (atomic: true by default)
|
|
96
|
+
* @returns Atomic result with data array, or partial result with succeeded/failed
|
|
97
|
+
*/
|
|
98
|
+
upsertManyByExternalId(clients: UpsertMJRClientInput[], options?: {
|
|
99
|
+
atomic?: true;
|
|
100
|
+
}): Promise<AtomicBatchResult<UpsertResult<MexMJRClient>>>;
|
|
101
|
+
upsertManyByExternalId(clients: UpsertMJRClientInput[], options: {
|
|
102
|
+
atomic: false;
|
|
103
|
+
}): Promise<PartialBatchResult<UpsertResult<MexMJRClient>>>;
|
|
104
|
+
linkClient(parentClientId: string, childClientId: string, relationshipType: ClientRelationshipType, metadata?: Record<string, unknown>): Promise<MexMJRClient>;
|
|
105
|
+
unlinkClient(parentClientId: string, childClientId: string, relationshipType: ClientRelationshipType): Promise<MexMJRClient>;
|
|
106
|
+
listLinkedClients(parentClientId: string, relationshipType?: ClientRelationshipType): Promise<LinkedClient[]>;
|
|
107
|
+
setLinkedClients(parentClientId: string, linkedClients: LinkedClientInput[]): Promise<MexMJRClient>;
|
|
108
|
+
syncAll(clientId: undefined, data: {
|
|
109
|
+
client: CreateMJRClientInput;
|
|
110
|
+
addresses?: SyncItem<CreateMexAddressInput>[];
|
|
111
|
+
contactMethods?: SyncItem<CreateContactMethodInput>[];
|
|
112
|
+
bankAccounts?: SyncItem<CreateBankAccountInput>[];
|
|
113
|
+
documents?: SyncItem<SyncCreateDocumentInput>[];
|
|
114
|
+
linkedClients?: LinkedClientInput[];
|
|
115
|
+
}, options?: {
|
|
116
|
+
replaceMode?: boolean;
|
|
117
|
+
}): Promise<{
|
|
118
|
+
client: MexMJRClient;
|
|
119
|
+
addresses: SyncResult<MexAddress>;
|
|
120
|
+
contactMethods: SyncResult<ContactMethod>;
|
|
121
|
+
bankAccounts: SyncResult<MexBankAccount>;
|
|
122
|
+
documents: SyncResult<Document>;
|
|
123
|
+
}>;
|
|
124
|
+
syncAll(clientId: string, data: {
|
|
125
|
+
client?: UpdateMJRClientInput;
|
|
126
|
+
addresses?: SyncItem<CreateMexAddressInput>[];
|
|
127
|
+
contactMethods?: SyncItem<CreateContactMethodInput>[];
|
|
128
|
+
bankAccounts?: SyncItem<CreateBankAccountInput>[];
|
|
129
|
+
documents?: SyncItem<SyncCreateDocumentInput>[];
|
|
130
|
+
linkedClients?: LinkedClientInput[];
|
|
131
|
+
}, options: {
|
|
132
|
+
replaceMode: true;
|
|
133
|
+
}): Promise<{
|
|
134
|
+
client: MexMJRClient;
|
|
135
|
+
addresses: SyncResult<MexAddress>;
|
|
136
|
+
contactMethods: SyncResult<ContactMethod>;
|
|
137
|
+
bankAccounts: SyncResult<MexBankAccount>;
|
|
138
|
+
documents: SyncResult<Document>;
|
|
139
|
+
}>;
|
|
140
|
+
syncAll(clientId: string, data: {
|
|
141
|
+
client?: UpdateMJRClientInput;
|
|
142
|
+
addresses?: SyncItem<UpdateMexAddressInput>[];
|
|
143
|
+
contactMethods?: SyncItem<UpdateContactMethodInput>[];
|
|
144
|
+
bankAccounts?: SyncItem<UpdateBankAccountInput>[];
|
|
145
|
+
documents?: SyncItem<SyncUpdateDocumentInput>[];
|
|
146
|
+
linkedClients?: LinkedClientInput[];
|
|
147
|
+
}, options?: {
|
|
148
|
+
replaceMode?: boolean;
|
|
149
|
+
}): Promise<{
|
|
150
|
+
client: MexMJRClient;
|
|
151
|
+
addresses: SyncResult<MexAddress>;
|
|
152
|
+
contactMethods: SyncResult<ContactMethod>;
|
|
153
|
+
bankAccounts: SyncResult<MexBankAccount>;
|
|
154
|
+
documents: SyncResult<Document>;
|
|
155
|
+
}>;
|
|
156
|
+
/**
|
|
157
|
+
* Transforms MJR input to nested API format.
|
|
158
|
+
* MJR has no additional fields, but we add the MJR activity marker.
|
|
159
|
+
*/
|
|
160
|
+
protected transformToNested(data: CreateMJRClientInput): CreateClientInput;
|
|
161
|
+
/**
|
|
162
|
+
* Transforms flattened MJR update input to nested API format.
|
|
163
|
+
*
|
|
164
|
+
* NOTE: Always includes `actividadVulnerable: { MJR: {} }` even if no
|
|
165
|
+
* MJR-specific fields are provided. This ensures that records touched via
|
|
166
|
+
* the MJR SDK can be filtered by `activityCodes: { in: ["MJR"] }`.
|
|
167
|
+
*/
|
|
168
|
+
protected transformUpdateToNested(data: UpdateMJRClientInput): UpdateClientInput;
|
|
169
|
+
protected instantiate(data: ClientData): MexMJRClient;
|
|
170
|
+
/**
|
|
171
|
+
* Transforms a flattened MJRClientSort to nested ClientSort format.
|
|
172
|
+
*
|
|
173
|
+
* Maps flattened field names to their full API paths using MJR-specific field mapping.
|
|
174
|
+
*/
|
|
175
|
+
protected applyScopeToSort(sort?: MJRClientSort): ClientSort | undefined;
|
|
176
|
+
}
|
|
177
|
+
//# sourceMappingURL=clients.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"clients.d.ts","sourceRoot":"","sources":["../../../../../src/resources/mex/actividad-vulnerable/mjr/clients.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,KAAK,EACV,iBAAiB,EACjB,iBAAiB,EAEjB,WAAW,EACX,iBAAiB,EACjB,oBAAoB,EACpB,oBAAoB,EACpB,oBAAoB,EAGpB,iBAAiB,EACjB,kBAAkB,EAClB,sBAAsB,EACtB,YAAY,IAAI,iBAAiB,EACjC,qBAAqB,EACrB,qBAAqB,EACrB,wBAAwB,EACxB,wBAAwB,EACxB,sBAAsB,EACtB,sBAAsB,EACtB,uBAAuB,EACvB,uBAAuB,EACvB,QAAQ,EACR,UAAU,EACV,eAAe,EACf,aAAa,EACb,YAAY,EACb,MAAM,iBAAiB,CAAC;AAUzB,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,EAA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AY,EAAE,UAAU,CAAC,cAAc,CAAC,CAAC;QACzC,SAAS,EAAE,UAAU,CAAC,QAAQ,CAAC,CAAC;KACjC,CAAC;IAwDF;;;OAGG;cACgB,iBAAiB,CAClC,IAAI,EAAE,oBAAoB,GACzB,iBAAiB;IAsBpB;;;;;;OAMG;cACgB,uBAAuB,CACxC,IAAI,EAAE,oBAAoB,GACzB,iBAAiB;cAqBD,WAAW,CAAC,IAAI,EAAE,UAAU,GAAG,YAAY;IAI9D;;;;OAIG;cACgB,gBAAgB,CACjC,IAAI,CAAC,EAAE,aAAa,GACnB,UAAU,GAAG,SAAS;CAM1B"}
|
|
@@ -0,0 +1,320 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MJR (Metales y Joyas - Precious Metals and Jewelry) Clients Resource
|
|
3
|
+
*
|
|
4
|
+
* Extends MexClientsResource with MJR-specific behavior.
|
|
5
|
+
* MJR clients have the same fields as Mexico clients (no additional activity fields).
|
|
6
|
+
* Returns MexMJRClient models.
|
|
7
|
+
*/
|
|
8
|
+
import { z } from "zod";
|
|
9
|
+
import { CodigoActividad, createMJRClientInputSchema, updateMJRClientInputSchema, upsertMJRClientInputSchema, linkedClientSchema, transformSort, mjrClientFieldMapping, } from "@artu-ai/shared";
|
|
10
|
+
import { MexClientsResource } from "../../clients";
|
|
11
|
+
import { MexMJRClient, } from "../../../../models";
|
|
12
|
+
// ===========================
|
|
13
|
+
// MJRClientsResource
|
|
14
|
+
// ===========================
|
|
15
|
+
/**
|
|
16
|
+
* MJR (Metales y Joyas) scoped clients resource.
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* ```typescript
|
|
20
|
+
* const mjrSdk = new ComplianceSDK({
|
|
21
|
+
* apiKey,
|
|
22
|
+
* environment: "test",
|
|
23
|
+
* jurisdiction: Jurisdiction.Mexico,
|
|
24
|
+
* actividadVulnerable: CodigoActividad.MJR,
|
|
25
|
+
* });
|
|
26
|
+
*
|
|
27
|
+
* const client = await mjrSdk.clients.create({
|
|
28
|
+
* type: ClientType.Person,
|
|
29
|
+
* name: "Juan García",
|
|
30
|
+
* rfc: "GAJL850101ABC",
|
|
31
|
+
* });
|
|
32
|
+
*
|
|
33
|
+
* // Returns MexMJRClient
|
|
34
|
+
* ```
|
|
35
|
+
*/
|
|
36
|
+
export class MJRClientsResource extends MexClientsResource {
|
|
37
|
+
// ─────────────────────────────────────────────────────────────────
|
|
38
|
+
// CRUD Operations
|
|
39
|
+
// ─────────────────────────────────────────────────────────────────
|
|
40
|
+
async create(data) {
|
|
41
|
+
const validated = this.validate(createMJRClientInputSchema, data);
|
|
42
|
+
const nestedData = this.transformToNested(validated);
|
|
43
|
+
const response = await this.execute(() => this.trpc.clients.create.mutate(nestedData));
|
|
44
|
+
return this.instantiate(response);
|
|
45
|
+
}
|
|
46
|
+
async retrieve(id, include) {
|
|
47
|
+
const response = await this.execute(() => this.trpc.clients.retrieve.query({ id, include }));
|
|
48
|
+
return this.instantiate(response);
|
|
49
|
+
}
|
|
50
|
+
async retrieveByExternalId(externalId) {
|
|
51
|
+
const response = await this.execute(() => this.trpc.clients.retrieveByExternalId.query({ externalId }));
|
|
52
|
+
return this.instantiate(response);
|
|
53
|
+
}
|
|
54
|
+
async update(id, data) {
|
|
55
|
+
const validated = this.validate(updateMJRClientInputSchema, data);
|
|
56
|
+
const nestedData = this.transformUpdateToNested(validated);
|
|
57
|
+
const response = await this.execute(() => this.trpc.clients.update.mutate({ id, data: nestedData }));
|
|
58
|
+
return this.instantiate(response);
|
|
59
|
+
}
|
|
60
|
+
// ─────────────────────────────────────────────────────────────────
|
|
61
|
+
// List & Pagination
|
|
62
|
+
// ─────────────────────────────────────────────────────────────────
|
|
63
|
+
/**
|
|
64
|
+
* Lists MJR clients with optional filtering.
|
|
65
|
+
*
|
|
66
|
+
* Accepts flattened MJR filter (MX fields at root level) and automatically
|
|
67
|
+
* transforms to nested format before calling the API.
|
|
68
|
+
*/
|
|
69
|
+
async list(options) {
|
|
70
|
+
const scopedFilter = this.applyScopeToFilter(options?.filter);
|
|
71
|
+
const scopedSort = this.applyScopeToSort(options?.sort);
|
|
72
|
+
const response = await this.execute(() => this.trpc.clients.list.query({
|
|
73
|
+
...options,
|
|
74
|
+
filter: scopedFilter,
|
|
75
|
+
sort: scopedSort,
|
|
76
|
+
}));
|
|
77
|
+
return {
|
|
78
|
+
data: response.data.map((c) => this.instantiate(c)),
|
|
79
|
+
pagination: response.pagination,
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Iterates over MJR clients.
|
|
84
|
+
*
|
|
85
|
+
* Accepts flattened MJR filter (MX fields at root level) and automatically
|
|
86
|
+
* transforms to nested format before calling the API.
|
|
87
|
+
*/
|
|
88
|
+
iterate(options) {
|
|
89
|
+
const scopedFilter = this.applyScopeToFilter(options?.filter);
|
|
90
|
+
// Note: sort is passed through - createIterator calls list() which handles transformation
|
|
91
|
+
return this.createIterator({
|
|
92
|
+
filter: scopedFilter,
|
|
93
|
+
sort: options?.sort,
|
|
94
|
+
pageSize: options?.pageSize,
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Counts MJR clients matching the given filter.
|
|
99
|
+
*
|
|
100
|
+
* @param filter - Optional filter criteria (with MJR fields at root level)
|
|
101
|
+
* @returns The count of matching clients
|
|
102
|
+
*/
|
|
103
|
+
async count(filter) {
|
|
104
|
+
const scopedFilter = this.applyScopeToFilter(filter);
|
|
105
|
+
const response = await this.execute(() => this.trpc.clients.count.query({ filter: scopedFilter }));
|
|
106
|
+
return response.count;
|
|
107
|
+
}
|
|
108
|
+
async createMany(clients, options = {}) {
|
|
109
|
+
const atomic = options.atomic ?? true;
|
|
110
|
+
const validated = this.validate(z.array(createMJRClientInputSchema), clients);
|
|
111
|
+
const nestedClients = validated.map((c) => this.transformToNested(c));
|
|
112
|
+
const response = await this.execute(() => this.trpc.clients.createMany.mutate({ items: nestedClients, atomic }));
|
|
113
|
+
if (response.atomic) {
|
|
114
|
+
return {
|
|
115
|
+
atomic: true,
|
|
116
|
+
data: response.data.map((c) => this.instantiate(c)),
|
|
117
|
+
};
|
|
118
|
+
}
|
|
119
|
+
else {
|
|
120
|
+
return {
|
|
121
|
+
atomic: false,
|
|
122
|
+
succeeded: response.succeeded.map((item) => ({
|
|
123
|
+
index: item.index,
|
|
124
|
+
data: this.instantiate(item.data),
|
|
125
|
+
})),
|
|
126
|
+
failed: response.failed,
|
|
127
|
+
};
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
async updateMany(updates, options = {}) {
|
|
131
|
+
const atomic = options.atomic ?? true;
|
|
132
|
+
const updateItemSchema = z.object({
|
|
133
|
+
id: z.uuid(),
|
|
134
|
+
data: updateMJRClientInputSchema,
|
|
135
|
+
});
|
|
136
|
+
const validated = this.validate(z.array(updateItemSchema), updates);
|
|
137
|
+
const nestedUpdates = validated.map((u) => ({
|
|
138
|
+
id: u.id,
|
|
139
|
+
data: this.transformUpdateToNested(u.data),
|
|
140
|
+
}));
|
|
141
|
+
const response = await this.execute(() => this.trpc.clients.updateMany.mutate({ items: nestedUpdates, atomic }));
|
|
142
|
+
if (response.atomic) {
|
|
143
|
+
return {
|
|
144
|
+
atomic: true,
|
|
145
|
+
data: response.data.map((c) => this.instantiate(c)),
|
|
146
|
+
};
|
|
147
|
+
}
|
|
148
|
+
else {
|
|
149
|
+
return {
|
|
150
|
+
atomic: false,
|
|
151
|
+
succeeded: response.succeeded.map((item) => ({
|
|
152
|
+
index: item.index,
|
|
153
|
+
data: this.instantiate(item.data),
|
|
154
|
+
})),
|
|
155
|
+
failed: response.failed,
|
|
156
|
+
};
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
// ─────────────────────────────────────────────────────────────────
|
|
160
|
+
// Upsert Operations
|
|
161
|
+
// ─────────────────────────────────────────────────────────────────
|
|
162
|
+
/**
|
|
163
|
+
* Creates or updates a MJR client by externalId.
|
|
164
|
+
*
|
|
165
|
+
* @param data - Client upsert data with MJR fields at root level (must include externalId)
|
|
166
|
+
* @returns The created or updated client with action indicator
|
|
167
|
+
*/
|
|
168
|
+
async upsertByExternalId(data) {
|
|
169
|
+
const validated = this.validate(upsertMJRClientInputSchema, data);
|
|
170
|
+
const nestedData = this.transformToNested(validated);
|
|
171
|
+
const response = await this.execute(() => this.trpc.clients.upsertByExternalId.mutate(nestedData));
|
|
172
|
+
return {
|
|
173
|
+
data: this.instantiate(response.data),
|
|
174
|
+
action: response.action,
|
|
175
|
+
};
|
|
176
|
+
}
|
|
177
|
+
async upsertManyByExternalId(clients, options = {}) {
|
|
178
|
+
const atomic = options.atomic ?? true;
|
|
179
|
+
const validated = this.validate(z.array(upsertMJRClientInputSchema), clients);
|
|
180
|
+
const nestedItems = validated.map((c) => this.transformToNested(c));
|
|
181
|
+
const response = await this.execute(() => this.trpc.clients.upsertManyByExternalId.mutate({
|
|
182
|
+
items: nestedItems,
|
|
183
|
+
atomic,
|
|
184
|
+
}));
|
|
185
|
+
if (response.atomic) {
|
|
186
|
+
return {
|
|
187
|
+
atomic: true,
|
|
188
|
+
data: response.data.map((item) => ({
|
|
189
|
+
data: this.instantiate(item.data),
|
|
190
|
+
action: item.action,
|
|
191
|
+
})),
|
|
192
|
+
};
|
|
193
|
+
}
|
|
194
|
+
else {
|
|
195
|
+
return {
|
|
196
|
+
atomic: false,
|
|
197
|
+
succeeded: response.succeeded.map((item) => ({
|
|
198
|
+
index: item.index,
|
|
199
|
+
data: {
|
|
200
|
+
data: this.instantiate(item.data.data),
|
|
201
|
+
action: item.data.action,
|
|
202
|
+
},
|
|
203
|
+
})),
|
|
204
|
+
failed: response.failed,
|
|
205
|
+
};
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
// ─────────────────────────────────────────────────────────────────
|
|
209
|
+
// Client-to-Client Relationship Management (scoped returns)
|
|
210
|
+
// ─────────────────────────────────────────────────────────────────
|
|
211
|
+
async linkClient(parentClientId, childClientId, relationshipType, metadata) {
|
|
212
|
+
const response = await this.execute(() => this.trpc.clients.linkClient.mutate({
|
|
213
|
+
parentClientId,
|
|
214
|
+
childClientId,
|
|
215
|
+
relationshipType,
|
|
216
|
+
metadata,
|
|
217
|
+
}));
|
|
218
|
+
return this.instantiate(response);
|
|
219
|
+
}
|
|
220
|
+
async unlinkClient(parentClientId, childClientId, relationshipType) {
|
|
221
|
+
const response = await this.execute(() => this.trpc.clients.unlinkClient.mutate({
|
|
222
|
+
parentClientId,
|
|
223
|
+
childClientId,
|
|
224
|
+
relationshipType,
|
|
225
|
+
}));
|
|
226
|
+
return this.instantiate(response);
|
|
227
|
+
}
|
|
228
|
+
async listLinkedClients(parentClientId, relationshipType) {
|
|
229
|
+
return super.listLinkedClients(parentClientId, relationshipType);
|
|
230
|
+
}
|
|
231
|
+
async setLinkedClients(parentClientId, linkedClients) {
|
|
232
|
+
const validated = this.validate(z.array(linkedClientSchema), linkedClients);
|
|
233
|
+
const response = await this.execute(() => this.trpc.clients.setLinkedClients.mutate({
|
|
234
|
+
parentClientId,
|
|
235
|
+
linkedClients: validated,
|
|
236
|
+
}));
|
|
237
|
+
return this.instantiate(response);
|
|
238
|
+
}
|
|
239
|
+
// Implementation signature
|
|
240
|
+
async syncAll(clientId, data, options) {
|
|
241
|
+
// Transform client input using appropriate MJR-specific transform
|
|
242
|
+
const transformedClient = data.client
|
|
243
|
+
? clientId
|
|
244
|
+
? this.transformUpdateToNested(data.client)
|
|
245
|
+
: this.transformToNested(data.client)
|
|
246
|
+
: undefined;
|
|
247
|
+
// Call parent syncAll with transformed client data
|
|
248
|
+
// Use type assertion to bypass overload resolution since implementation accepts string | undefined
|
|
249
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
250
|
+
const result = await super.syncAll(clientId, {
|
|
251
|
+
...data,
|
|
252
|
+
client: transformedClient,
|
|
253
|
+
}, options);
|
|
254
|
+
// Re-instantiate client with MJR-specific model
|
|
255
|
+
return {
|
|
256
|
+
...result,
|
|
257
|
+
client: this.instantiate(result.client),
|
|
258
|
+
};
|
|
259
|
+
}
|
|
260
|
+
// ─────────────────────────────────────────────────────────────────
|
|
261
|
+
// Protected Helpers
|
|
262
|
+
// ─────────────────────────────────────────────────────────────────
|
|
263
|
+
/**
|
|
264
|
+
* Transforms MJR input to nested API format.
|
|
265
|
+
* MJR has no additional fields, but we add the MJR activity marker.
|
|
266
|
+
*/
|
|
267
|
+
transformToNested(data) {
|
|
268
|
+
// Use parent transform for base + MX fields (cast needed for discriminated union)
|
|
269
|
+
const nested = super.transformToNested(data);
|
|
270
|
+
// Add MJR activity marker
|
|
271
|
+
const mexData = nested.jurisdictions?.MX;
|
|
272
|
+
return {
|
|
273
|
+
...nested,
|
|
274
|
+
jurisdictions: {
|
|
275
|
+
MX: {
|
|
276
|
+
...mexData,
|
|
277
|
+
actividadVulnerable: {
|
|
278
|
+
[CodigoActividad.MJR]: {},
|
|
279
|
+
},
|
|
280
|
+
},
|
|
281
|
+
},
|
|
282
|
+
};
|
|
283
|
+
}
|
|
284
|
+
/**
|
|
285
|
+
* Transforms flattened MJR update input to nested API format.
|
|
286
|
+
*
|
|
287
|
+
* NOTE: Always includes `actividadVulnerable: { MJR: {} }` even if no
|
|
288
|
+
* MJR-specific fields are provided. This ensures that records touched via
|
|
289
|
+
* the MJR SDK can be filtered by `activityCodes: { in: ["MJR"] }`.
|
|
290
|
+
*/
|
|
291
|
+
transformUpdateToNested(data) {
|
|
292
|
+
// Use parent for base + MX fields
|
|
293
|
+
const nested = super.transformUpdateToNested(data);
|
|
294
|
+
// Always add MJR activity data to ensure filterability
|
|
295
|
+
const mexData = (nested.jurisdictions?.MX ??
|
|
296
|
+
{});
|
|
297
|
+
mexData.actividadVulnerable = {
|
|
298
|
+
...mexData.actividadVulnerable,
|
|
299
|
+
[CodigoActividad.MJR]: {},
|
|
300
|
+
};
|
|
301
|
+
return {
|
|
302
|
+
...nested,
|
|
303
|
+
jurisdictions: { MX: mexData },
|
|
304
|
+
};
|
|
305
|
+
}
|
|
306
|
+
instantiate(data) {
|
|
307
|
+
return new MexMJRClient(data);
|
|
308
|
+
}
|
|
309
|
+
/**
|
|
310
|
+
* Transforms a flattened MJRClientSort to nested ClientSort format.
|
|
311
|
+
*
|
|
312
|
+
* Maps flattened field names to their full API paths using MJR-specific field mapping.
|
|
313
|
+
*/
|
|
314
|
+
applyScopeToSort(sort) {
|
|
315
|
+
if (!sort || sort.length === 0) {
|
|
316
|
+
return undefined;
|
|
317
|
+
}
|
|
318
|
+
return transformSort(sort, mjrClientFieldMapping);
|
|
319
|
+
}
|
|
320
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MJR (Metales y Joyas - Precious Metals and Jewelry) Scoped Resources
|
|
3
|
+
*/
|
|
4
|
+
export { MJRClientsResource } from "./clients";
|
|
5
|
+
export { MJRTransactionsResource } from "./transactions";
|
|
6
|
+
export { MJRReportsResource } from "./reports";
|
|
7
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/resources/mex/actividad-vulnerable/mjr/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAC;AAC/C,OAAO,EAAE,uBAAuB,EAAE,MAAM,gBAAgB,CAAC;AACzD,OAAO,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAC"}
|