@artu-ai/compliance-sdk 0.2.0 → 0.3.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/models/Client.d.ts.map +1 -1
- package/dist/models/Client.js +21 -3
- package/dist/models/ReportItem.d.ts +2 -2
- package/dist/models/ReportItem.d.ts.map +1 -1
- package/dist/models/ReportItem.js +4 -4
- package/dist/models/mex/MexReportItem.js +1 -1
- package/dist/models/mex/actividad-vulnerable/MexActividadVulnerableReportItem.js +1 -1
- package/dist/models/mex/actividad-vulnerable/avi/MexAVIReportItem.js +1 -1
- package/dist/models/mex/actividad-vulnerable/jys/MexJYSReportItem.js +1 -1
- package/dist/models/mex/actividad-vulnerable/tsc/MexTSCReportItem.js +1 -1
- package/dist/resources/addresses.d.ts +3 -3
- package/dist/resources/addresses.d.ts.map +1 -1
- package/dist/resources/bank-accounts.d.ts +3 -3
- package/dist/resources/bank-accounts.d.ts.map +1 -1
- package/dist/resources/base.d.ts +7 -6
- package/dist/resources/base.d.ts.map +1 -1
- package/dist/resources/base.js +3 -0
- package/dist/resources/clients.d.ts +3 -3
- package/dist/resources/clients.d.ts.map +1 -1
- package/dist/resources/contact-methods.d.ts +3 -3
- package/dist/resources/contact-methods.d.ts.map +1 -1
- package/dist/resources/documents.d.ts +94 -7
- package/dist/resources/documents.d.ts.map +1 -1
- package/dist/resources/documents.js +107 -0
- package/dist/resources/index.d.ts +1 -1
- package/dist/resources/index.d.ts.map +1 -1
- package/dist/resources/index.js +1 -1
- package/dist/resources/mex/actividad-vulnerable/avi/clients.d.ts +9 -3
- package/dist/resources/mex/actividad-vulnerable/avi/clients.d.ts.map +1 -1
- package/dist/resources/mex/actividad-vulnerable/avi/clients.js +14 -1
- package/dist/resources/mex/actividad-vulnerable/avi/reports.d.ts +39 -21
- package/dist/resources/mex/actividad-vulnerable/avi/reports.d.ts.map +1 -1
- package/dist/resources/mex/actividad-vulnerable/avi/reports.js +88 -20
- package/dist/resources/mex/actividad-vulnerable/avi/transactions.d.ts +9 -3
- package/dist/resources/mex/actividad-vulnerable/avi/transactions.d.ts.map +1 -1
- package/dist/resources/mex/actividad-vulnerable/avi/transactions.js +14 -1
- package/dist/resources/mex/actividad-vulnerable/jys/clients.d.ts +10 -3
- package/dist/resources/mex/actividad-vulnerable/jys/clients.d.ts.map +1 -1
- package/dist/resources/mex/actividad-vulnerable/jys/clients.js +14 -1
- package/dist/resources/mex/actividad-vulnerable/jys/reports.d.ts +33 -11
- package/dist/resources/mex/actividad-vulnerable/jys/reports.d.ts.map +1 -1
- package/dist/resources/mex/actividad-vulnerable/jys/reports.js +82 -10
- package/dist/resources/mex/actividad-vulnerable/jys/transactions.d.ts +10 -3
- package/dist/resources/mex/actividad-vulnerable/jys/transactions.d.ts.map +1 -1
- package/dist/resources/mex/actividad-vulnerable/jys/transactions.js +14 -1
- package/dist/resources/mex/actividad-vulnerable/tsc/clients.d.ts +10 -3
- package/dist/resources/mex/actividad-vulnerable/tsc/clients.d.ts.map +1 -1
- package/dist/resources/mex/actividad-vulnerable/tsc/clients.js +14 -1
- package/dist/resources/mex/actividad-vulnerable/tsc/reports.d.ts +33 -11
- package/dist/resources/mex/actividad-vulnerable/tsc/reports.d.ts.map +1 -1
- package/dist/resources/mex/actividad-vulnerable/tsc/reports.js +82 -10
- package/dist/resources/mex/actividad-vulnerable/tsc/transactions.d.ts +10 -3
- package/dist/resources/mex/actividad-vulnerable/tsc/transactions.d.ts.map +1 -1
- package/dist/resources/mex/actividad-vulnerable/tsc/transactions.js +14 -1
- package/dist/resources/mex/addresses.d.ts +11 -3
- package/dist/resources/mex/addresses.d.ts.map +1 -1
- package/dist/resources/mex/addresses.js +16 -1
- package/dist/resources/mex/bank-accounts.d.ts +11 -3
- package/dist/resources/mex/bank-accounts.d.ts.map +1 -1
- package/dist/resources/mex/bank-accounts.js +16 -0
- package/dist/resources/mex/clients.d.ts +12 -3
- package/dist/resources/mex/clients.d.ts.map +1 -1
- package/dist/resources/mex/clients.js +17 -1
- package/dist/resources/mex/reports.d.ts +41 -19
- package/dist/resources/mex/reports.d.ts.map +1 -1
- package/dist/resources/mex/reports.js +55 -19
- package/dist/resources/mex/transactions.d.ts +11 -3
- package/dist/resources/mex/transactions.d.ts.map +1 -1
- package/dist/resources/mex/transactions.js +16 -1
- package/dist/resources/reports.d.ts +33 -39
- package/dist/resources/reports.d.ts.map +1 -1
- package/dist/resources/reports.js +34 -36
- package/dist/resources/transactions.d.ts +3 -3
- package/dist/resources/transactions.d.ts.map +1 -1
- package/dist/sdk/ComplianceSDK.d.ts +2 -0
- package/dist/sdk/ComplianceSDK.d.ts.map +1 -1
- package/dist/sdk/ComplianceSDK.js +17 -9
- package/dist/sdk/mex/ComplianceSDK.d.ts.map +1 -1
- package/dist/sdk/mex/actividad-vulnerable/avi/ComplianceSDK.d.ts.map +1 -1
- package/dist/sdk/mex/actividad-vulnerable/avi/types.d.ts +2 -2
- package/dist/sdk/mex/actividad-vulnerable/avi/types.d.ts.map +1 -1
- package/dist/sdk/mex/actividad-vulnerable/avi/types.js +1 -0
- package/dist/sdk/mex/actividad-vulnerable/jys/ComplianceSDK.d.ts.map +1 -1
- package/dist/sdk/mex/actividad-vulnerable/jys/types.d.ts +2 -2
- package/dist/sdk/mex/actividad-vulnerable/jys/types.d.ts.map +1 -1
- package/dist/sdk/mex/actividad-vulnerable/jys/types.js +1 -0
- package/dist/sdk/mex/actividad-vulnerable/tsc/ComplianceSDK.d.ts.map +1 -1
- package/dist/sdk/mex/actividad-vulnerable/tsc/types.d.ts +2 -2
- package/dist/sdk/mex/actividad-vulnerable/tsc/types.d.ts.map +1 -1
- package/dist/sdk/mex/actividad-vulnerable/tsc/types.js +1 -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 +24 -1
- package/dist/sdk/types.d.ts.map +1 -1
- package/dist/utils/environment.d.ts +24 -0
- package/dist/utils/environment.d.ts.map +1 -1
- package/dist/utils/environment.js +38 -0
- package/dist/utils/index.d.ts +2 -0
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/index.js +4 -0
- package/dist/utils/session.d.ts +20 -2
- package/dist/utils/session.d.ts.map +1 -1
- package/dist/utils/session.js +9 -1
- package/dist/utils/trpc-client.d.ts +370 -200
- package/dist/utils/trpc-client.d.ts.map +1 -1
- package/dist/utils/trpc-client.js +2 -1
- package/dist/utils/upload.d.ts +81 -0
- package/dist/utils/upload.d.ts.map +1 -0
- package/dist/utils/upload.js +261 -0
- package/package.json +9 -8
- package/src/models/Client.ts +23 -3
- package/src/models/ReportItem.ts +4 -4
- package/src/models/mex/MexReportItem.ts +1 -1
- package/src/models/mex/actividad-vulnerable/MexActividadVulnerableReportItem.ts +1 -1
- package/src/models/mex/actividad-vulnerable/avi/MexAVIReportItem.ts +1 -1
- package/src/models/mex/actividad-vulnerable/jys/MexJYSReportItem.ts +1 -1
- package/src/models/mex/actividad-vulnerable/tsc/MexTSCReportItem.ts +1 -1
- package/src/resources/addresses.ts +8 -4
- package/src/resources/bank-accounts.ts +8 -4
- package/src/resources/base.ts +9 -4
- package/src/resources/clients.ts +10 -4
- package/src/resources/contact-methods.ts +4 -2
- package/src/resources/documents.ts +185 -5
- package/src/resources/index.ts +6 -1
- package/src/resources/mex/actividad-vulnerable/avi/clients.ts +30 -8
- package/src/resources/mex/actividad-vulnerable/avi/reports.ts +122 -26
- package/src/resources/mex/actividad-vulnerable/avi/transactions.ts +20 -2
- package/src/resources/mex/actividad-vulnerable/jys/clients.ts +20 -2
- package/src/resources/mex/actividad-vulnerable/jys/reports.ts +118 -16
- package/src/resources/mex/actividad-vulnerable/jys/transactions.ts +20 -2
- package/src/resources/mex/actividad-vulnerable/tsc/clients.ts +20 -2
- package/src/resources/mex/actividad-vulnerable/tsc/reports.ts +118 -16
- package/src/resources/mex/actividad-vulnerable/tsc/transactions.ts +20 -2
- package/src/resources/mex/addresses.ts +24 -2
- package/src/resources/mex/bank-accounts.ts +26 -2
- package/src/resources/mex/clients.ts +25 -2
- package/src/resources/mex/reports.ts +94 -26
- package/src/resources/mex/transactions.ts +24 -2
- package/src/resources/reports.ts +65 -43
- package/src/resources/transactions.ts +8 -4
- package/src/sdk/ComplianceSDK.ts +23 -8
- package/src/sdk/mex/ComplianceSDK.ts +7 -0
- package/src/sdk/mex/actividad-vulnerable/avi/ComplianceSDK.ts +4 -0
- package/src/sdk/mex/actividad-vulnerable/avi/types.ts +22 -8
- package/src/sdk/mex/actividad-vulnerable/jys/ComplianceSDK.ts +3 -0
- package/src/sdk/mex/actividad-vulnerable/jys/types.ts +22 -8
- package/src/sdk/mex/actividad-vulnerable/tsc/ComplianceSDK.ts +3 -0
- package/src/sdk/mex/actividad-vulnerable/tsc/types.ts +22 -8
- package/src/sdk/mex/types.ts +6 -2
- package/src/sdk/types.ts +31 -2
- package/src/utils/environment.ts +42 -0
- package/src/utils/index.ts +19 -0
- package/src/utils/session.ts +33 -3
- package/src/utils/trpc-client.ts +10 -1
- package/src/utils/upload.ts +388 -0
|
@@ -5,7 +5,10 @@
|
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
import { Jurisdiction, CodigoActividad } from "@artu-ai/shared";
|
|
8
|
-
import type {
|
|
8
|
+
import type {
|
|
9
|
+
ComplianceSDKOptionsBase,
|
|
10
|
+
DistributiveOmit,
|
|
11
|
+
} from "../../../types";
|
|
9
12
|
import type { MexicoComplianceSDK } from "../../types";
|
|
10
13
|
import {
|
|
11
14
|
AVIClientsResource,
|
|
@@ -15,7 +18,11 @@ import {
|
|
|
15
18
|
MexAddressesResource,
|
|
16
19
|
} from "../../../../resources";
|
|
17
20
|
import { registerScope } from "../../../resource-registry";
|
|
21
|
+
import type { ClientsResource } from "../../../../resources/clients";
|
|
22
|
+
import type { TransactionsResource } from "../../../../resources/transactions";
|
|
18
23
|
import type { ReportsResource } from "../../../../resources/reports";
|
|
24
|
+
import type { BankAccountsResource } from "../../../../resources/bank-accounts";
|
|
25
|
+
import type { AddressesResource } from "../../../../resources/addresses";
|
|
19
26
|
import type { EBRResource } from "../../../../resources/mex/ebr";
|
|
20
27
|
|
|
21
28
|
// ===========================
|
|
@@ -33,7 +40,7 @@ export type AVISDKOptions = ComplianceSDKOptionsBase & {
|
|
|
33
40
|
/**
|
|
34
41
|
* Options for AVI-scoped SDK (without jurisdiction/activity - pre-configured)
|
|
35
42
|
*/
|
|
36
|
-
export type AVIScopedSDKOptions =
|
|
43
|
+
export type AVIScopedSDKOptions = DistributiveOmit<
|
|
37
44
|
ComplianceSDKOptionsBase,
|
|
38
45
|
"jurisdiction" | "actividadVulnerable"
|
|
39
46
|
>;
|
|
@@ -46,8 +53,10 @@ export type AVIScopedSDKOptions = Omit<
|
|
|
46
53
|
* Mexico AVI-scoped SDK - uses AVI resource types
|
|
47
54
|
* Extends MexicoComplianceSDK with AVI-specific overrides
|
|
48
55
|
*/
|
|
49
|
-
export interface AVIComplianceSDK
|
|
50
|
-
|
|
56
|
+
export interface AVIComplianceSDK extends Omit<
|
|
57
|
+
MexicoComplianceSDK,
|
|
58
|
+
"clients" | "transactions" | "reports"
|
|
59
|
+
> {
|
|
51
60
|
readonly clients: AVIClientsResource;
|
|
52
61
|
readonly transactions: AVITransactionsResource;
|
|
53
62
|
readonly reports: AVIReportsResource;
|
|
@@ -61,12 +70,17 @@ export interface AVIComplianceSDK
|
|
|
61
70
|
// ===========================
|
|
62
71
|
|
|
63
72
|
export function registerAVIScope(): void {
|
|
73
|
+
// Note: Casts needed due to sort type parameter variance between scoped and base resources
|
|
64
74
|
registerScope("MX:AVI", {
|
|
65
|
-
clients: (config) =>
|
|
66
|
-
|
|
75
|
+
clients: (config) =>
|
|
76
|
+
new AVIClientsResource(config) as unknown as ClientsResource,
|
|
77
|
+
transactions: (config) =>
|
|
78
|
+
new AVITransactionsResource(config) as unknown as TransactionsResource,
|
|
67
79
|
reports: (config) =>
|
|
68
80
|
new AVIReportsResource(config) as unknown as ReportsResource,
|
|
69
|
-
bankAccounts: (config) =>
|
|
70
|
-
|
|
81
|
+
bankAccounts: (config) =>
|
|
82
|
+
new MexBankAccountsResource(config) as unknown as BankAccountsResource,
|
|
83
|
+
addresses: (config) =>
|
|
84
|
+
new MexAddressesResource(config) as unknown as AddressesResource,
|
|
71
85
|
});
|
|
72
86
|
}
|
|
@@ -40,8 +40,11 @@ import type { JYSReportsResource } from "../../../../resources/mex/actividad-vul
|
|
|
40
40
|
export class JYSComplianceSDKScoped extends MexicoComplianceSDKScoped {
|
|
41
41
|
// Override resource types with JYS-specific types
|
|
42
42
|
// The registry creates these at runtime, we just need correct types
|
|
43
|
+
// Note: @ts-expect-error is needed for some overrides due to sort type parameter variance
|
|
43
44
|
declare public readonly clients: JYSClientsResource;
|
|
45
|
+
// @ts-expect-error - Runtime type is correct, variance issue with sort types
|
|
44
46
|
declare public readonly transactions: JYSTransactionsResource;
|
|
47
|
+
// @ts-expect-error - Runtime type is correct, variance issue with sort types
|
|
45
48
|
declare public readonly reports: JYSReportsResource;
|
|
46
49
|
// addresses and bankAccounts inherited from MexicoComplianceSDKImpl (MexAddressesResource, MexBankAccountsResource)
|
|
47
50
|
|
|
@@ -5,7 +5,10 @@
|
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
import { Jurisdiction, CodigoActividad } from "@artu-ai/shared";
|
|
8
|
-
import type {
|
|
8
|
+
import type {
|
|
9
|
+
ComplianceSDKOptionsBase,
|
|
10
|
+
DistributiveOmit,
|
|
11
|
+
} from "../../../types";
|
|
9
12
|
import type { MexicoComplianceSDK } from "../../types";
|
|
10
13
|
import {
|
|
11
14
|
JYSClientsResource,
|
|
@@ -15,7 +18,11 @@ import {
|
|
|
15
18
|
MexAddressesResource,
|
|
16
19
|
} from "../../../../resources";
|
|
17
20
|
import { registerScope } from "../../../resource-registry";
|
|
21
|
+
import type { ClientsResource } from "../../../../resources/clients";
|
|
22
|
+
import type { TransactionsResource } from "../../../../resources/transactions";
|
|
18
23
|
import type { ReportsResource } from "../../../../resources/reports";
|
|
24
|
+
import type { BankAccountsResource } from "../../../../resources/bank-accounts";
|
|
25
|
+
import type { AddressesResource } from "../../../../resources/addresses";
|
|
19
26
|
import type { EBRResource } from "../../../../resources/mex/ebr";
|
|
20
27
|
|
|
21
28
|
// ===========================
|
|
@@ -33,7 +40,7 @@ export type JYSSDKOptions = ComplianceSDKOptionsBase & {
|
|
|
33
40
|
/**
|
|
34
41
|
* Options for JYS-scoped SDK (without jurisdiction/activity - pre-configured)
|
|
35
42
|
*/
|
|
36
|
-
export type JYSScopedSDKOptions =
|
|
43
|
+
export type JYSScopedSDKOptions = DistributiveOmit<
|
|
37
44
|
ComplianceSDKOptionsBase,
|
|
38
45
|
"jurisdiction" | "actividadVulnerable"
|
|
39
46
|
>;
|
|
@@ -46,8 +53,10 @@ export type JYSScopedSDKOptions = Omit<
|
|
|
46
53
|
* Mexico JYS-scoped SDK - uses JYS resource types
|
|
47
54
|
* Extends MexicoComplianceSDK with JYS-specific overrides
|
|
48
55
|
*/
|
|
49
|
-
export interface JYSComplianceSDK
|
|
50
|
-
|
|
56
|
+
export interface JYSComplianceSDK extends Omit<
|
|
57
|
+
MexicoComplianceSDK,
|
|
58
|
+
"clients" | "transactions" | "reports"
|
|
59
|
+
> {
|
|
51
60
|
readonly clients: JYSClientsResource;
|
|
52
61
|
readonly transactions: JYSTransactionsResource;
|
|
53
62
|
readonly reports: JYSReportsResource;
|
|
@@ -61,12 +70,17 @@ export interface JYSComplianceSDK
|
|
|
61
70
|
// ===========================
|
|
62
71
|
|
|
63
72
|
export function registerJYSScope(): void {
|
|
73
|
+
// Note: Casts needed due to sort type parameter variance between scoped and base resources
|
|
64
74
|
registerScope("MX:JYS", {
|
|
65
|
-
clients: (config) =>
|
|
66
|
-
|
|
75
|
+
clients: (config) =>
|
|
76
|
+
new JYSClientsResource(config) as unknown as ClientsResource,
|
|
77
|
+
transactions: (config) =>
|
|
78
|
+
new JYSTransactionsResource(config) as unknown as TransactionsResource,
|
|
67
79
|
reports: (config) =>
|
|
68
80
|
new JYSReportsResource(config) as unknown as ReportsResource,
|
|
69
|
-
bankAccounts: (config) =>
|
|
70
|
-
|
|
81
|
+
bankAccounts: (config) =>
|
|
82
|
+
new MexBankAccountsResource(config) as unknown as BankAccountsResource,
|
|
83
|
+
addresses: (config) =>
|
|
84
|
+
new MexAddressesResource(config) as unknown as AddressesResource,
|
|
71
85
|
});
|
|
72
86
|
}
|
|
@@ -40,8 +40,11 @@ import type { TSCReportsResource } from "../../../../resources/mex/actividad-vul
|
|
|
40
40
|
export class TSCComplianceSDKScoped extends MexicoComplianceSDKScoped {
|
|
41
41
|
// Override resource types with TSC-specific types
|
|
42
42
|
// The registry creates these at runtime, we just need correct types
|
|
43
|
+
// Note: @ts-expect-error is needed for some overrides due to sort type parameter variance
|
|
43
44
|
declare public readonly clients: TSCClientsResource;
|
|
45
|
+
// @ts-expect-error - Runtime type is correct, variance issue with sort types
|
|
44
46
|
declare public readonly transactions: TSCTransactionsResource;
|
|
47
|
+
// @ts-expect-error - Runtime type is correct, variance issue with sort types
|
|
45
48
|
declare public readonly reports: TSCReportsResource;
|
|
46
49
|
// addresses and bankAccounts inherited from MexicoComplianceSDKImpl (MexAddressesResource, MexBankAccountsResource)
|
|
47
50
|
|
|
@@ -5,7 +5,10 @@
|
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
import { Jurisdiction, CodigoActividad } from "@artu-ai/shared";
|
|
8
|
-
import type {
|
|
8
|
+
import type {
|
|
9
|
+
ComplianceSDKOptionsBase,
|
|
10
|
+
DistributiveOmit,
|
|
11
|
+
} from "../../../types";
|
|
9
12
|
import type { MexicoComplianceSDK } from "../../types";
|
|
10
13
|
import {
|
|
11
14
|
TSCClientsResource,
|
|
@@ -15,7 +18,11 @@ import {
|
|
|
15
18
|
MexAddressesResource,
|
|
16
19
|
} from "../../../../resources";
|
|
17
20
|
import { registerScope } from "../../../resource-registry";
|
|
21
|
+
import type { ClientsResource } from "../../../../resources/clients";
|
|
22
|
+
import type { TransactionsResource } from "../../../../resources/transactions";
|
|
18
23
|
import type { ReportsResource } from "../../../../resources/reports";
|
|
24
|
+
import type { BankAccountsResource } from "../../../../resources/bank-accounts";
|
|
25
|
+
import type { AddressesResource } from "../../../../resources/addresses";
|
|
19
26
|
import type { EBRResource } from "../../../../resources/mex/ebr";
|
|
20
27
|
|
|
21
28
|
// ===========================
|
|
@@ -33,7 +40,7 @@ export type TSCSDKOptions = ComplianceSDKOptionsBase & {
|
|
|
33
40
|
/**
|
|
34
41
|
* Options for TSC-scoped SDK (without jurisdiction/activity - pre-configured)
|
|
35
42
|
*/
|
|
36
|
-
export type TSCScopedSDKOptions =
|
|
43
|
+
export type TSCScopedSDKOptions = DistributiveOmit<
|
|
37
44
|
ComplianceSDKOptionsBase,
|
|
38
45
|
"jurisdiction" | "actividadVulnerable"
|
|
39
46
|
>;
|
|
@@ -46,8 +53,10 @@ export type TSCScopedSDKOptions = Omit<
|
|
|
46
53
|
* Mexico TSC-scoped SDK - uses TSC resource types
|
|
47
54
|
* Extends MexicoComplianceSDK with TSC-specific overrides
|
|
48
55
|
*/
|
|
49
|
-
export interface TSCComplianceSDK
|
|
50
|
-
|
|
56
|
+
export interface TSCComplianceSDK extends Omit<
|
|
57
|
+
MexicoComplianceSDK,
|
|
58
|
+
"clients" | "transactions" | "reports"
|
|
59
|
+
> {
|
|
51
60
|
readonly clients: TSCClientsResource;
|
|
52
61
|
readonly transactions: TSCTransactionsResource;
|
|
53
62
|
readonly reports: TSCReportsResource;
|
|
@@ -61,12 +70,17 @@ export interface TSCComplianceSDK
|
|
|
61
70
|
// ===========================
|
|
62
71
|
|
|
63
72
|
export function registerTSCScope(): void {
|
|
73
|
+
// Note: Casts needed due to sort type parameter variance between scoped and base resources
|
|
64
74
|
registerScope("MX:TSC", {
|
|
65
|
-
clients: (config) =>
|
|
66
|
-
|
|
75
|
+
clients: (config) =>
|
|
76
|
+
new TSCClientsResource(config) as unknown as ClientsResource,
|
|
77
|
+
transactions: (config) =>
|
|
78
|
+
new TSCTransactionsResource(config) as unknown as TransactionsResource,
|
|
67
79
|
reports: (config) =>
|
|
68
80
|
new TSCReportsResource(config) as unknown as ReportsResource,
|
|
69
|
-
bankAccounts: (config) =>
|
|
70
|
-
|
|
81
|
+
bankAccounts: (config) =>
|
|
82
|
+
new MexBankAccountsResource(config) as unknown as BankAccountsResource,
|
|
83
|
+
addresses: (config) =>
|
|
84
|
+
new MexAddressesResource(config) as unknown as AddressesResource,
|
|
71
85
|
});
|
|
72
86
|
}
|
package/src/sdk/mex/types.ts
CHANGED
|
@@ -6,7 +6,11 @@
|
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
8
|
import { Jurisdiction, type CodigoActividad } from "@artu-ai/shared";
|
|
9
|
-
import type {
|
|
9
|
+
import type {
|
|
10
|
+
ComplianceSDKOptionsBase,
|
|
11
|
+
BaseComplianceSDK,
|
|
12
|
+
DistributiveOmit,
|
|
13
|
+
} from "../types";
|
|
10
14
|
import type {
|
|
11
15
|
MexClientsResource,
|
|
12
16
|
MexTransactionsResource,
|
|
@@ -49,7 +53,7 @@ export type MexicoSDKOptions = ComplianceSDKOptionsBase & {
|
|
|
49
53
|
/**
|
|
50
54
|
* Options for Mexico-scoped SDK (without jurisdiction - pre-configured)
|
|
51
55
|
*/
|
|
52
|
-
export type MexicoScopedSDKOptions =
|
|
56
|
+
export type MexicoScopedSDKOptions = DistributiveOmit<
|
|
53
57
|
ComplianceSDKOptionsBase,
|
|
54
58
|
"jurisdiction"
|
|
55
59
|
> & {
|
package/src/sdk/types.ts
CHANGED
|
@@ -99,9 +99,14 @@ export type ComplianceSDKOptionsBase = ComplianceAuthOptions & {
|
|
|
99
99
|
* - "test": Uses test data, no real regulatory submissions
|
|
100
100
|
* - "live": Uses production data, real regulatory submissions
|
|
101
101
|
*
|
|
102
|
+
* Priority order:
|
|
103
|
+
* 1. Explicit environment option
|
|
104
|
+
* 2. `ARTU_ENVIRONMENT` environment variable
|
|
105
|
+
* 3. Default: "test"
|
|
106
|
+
*
|
|
102
107
|
* The API key must have permissions for the requested environment.
|
|
103
108
|
*/
|
|
104
|
-
environment
|
|
109
|
+
environment?: Environment;
|
|
105
110
|
|
|
106
111
|
/**
|
|
107
112
|
* Base URL for the API.
|
|
@@ -117,6 +122,18 @@ export type ComplianceSDKOptionsBase = ComplianceAuthOptions & {
|
|
|
117
122
|
*/
|
|
118
123
|
baseUrl?: string;
|
|
119
124
|
|
|
125
|
+
/**
|
|
126
|
+
* Organization ID for cookie authentication.
|
|
127
|
+
*
|
|
128
|
+
* When using cookie auth mode, this restricts login to a specific organization.
|
|
129
|
+
* Useful for custom apps to prevent users from logging into the wrong organization.
|
|
130
|
+
*
|
|
131
|
+
* Priority order:
|
|
132
|
+
* 1. Explicit organizationId option
|
|
133
|
+
* 2. `ARTU_ORGANIZATION_ID` environment variable
|
|
134
|
+
*/
|
|
135
|
+
organizationId?: string;
|
|
136
|
+
|
|
120
137
|
/**
|
|
121
138
|
* API version to use.
|
|
122
139
|
* Defaults to latest stable version.
|
|
@@ -133,6 +150,16 @@ export type ComplianceSDKOptionsBase = ComplianceAuthOptions & {
|
|
|
133
150
|
timeout?: number;
|
|
134
151
|
};
|
|
135
152
|
|
|
153
|
+
/**
|
|
154
|
+
* Distributive version of Omit that preserves union members.
|
|
155
|
+
*
|
|
156
|
+
* Important when omitting keys from option types that include unions (like auth modes),
|
|
157
|
+
* otherwise `Omit` can erase mode-specific keys (e.g. `apiKey`) due to `keyof` behavior on unions.
|
|
158
|
+
*/
|
|
159
|
+
export type DistributiveOmit<T, K extends PropertyKey> = T extends unknown
|
|
160
|
+
? Omit<T, K>
|
|
161
|
+
: never;
|
|
162
|
+
|
|
136
163
|
// ===========================
|
|
137
164
|
// Scope Types
|
|
138
165
|
// ===========================
|
|
@@ -270,6 +297,8 @@ export interface BaseComplianceSDK {
|
|
|
270
297
|
* console.log("User:", result.session.userId);
|
|
271
298
|
* ```
|
|
272
299
|
*/
|
|
273
|
-
session(
|
|
300
|
+
session(
|
|
301
|
+
options: SDKSessionOptionsWithReturnTo
|
|
302
|
+
): Promise<SessionResultWithRedirect>;
|
|
274
303
|
session(options?: SDKSessionOptions): Promise<SessionResultWithoutRedirect>;
|
|
275
304
|
}
|
package/src/utils/environment.ts
CHANGED
|
@@ -143,3 +143,45 @@ export function resolveBaseUrl(config: SDKEnvironmentConfig): string {
|
|
|
143
143
|
// 3. Default to production URL
|
|
144
144
|
return getDefaultBaseUrl();
|
|
145
145
|
}
|
|
146
|
+
|
|
147
|
+
/**
|
|
148
|
+
* Resolves the environment - uses explicit value if provided, falls back to env var
|
|
149
|
+
*
|
|
150
|
+
* Priority order:
|
|
151
|
+
* 1. Explicit environment option
|
|
152
|
+
* 2. ARTU_ENVIRONMENT environment variable
|
|
153
|
+
* 3. Default to "test"
|
|
154
|
+
*
|
|
155
|
+
* @param environment - Optional explicit environment
|
|
156
|
+
* @returns Resolved environment
|
|
157
|
+
*
|
|
158
|
+
* @example
|
|
159
|
+
* ```typescript
|
|
160
|
+
* resolveEnvironment("live"); // "live"
|
|
161
|
+
* resolveEnvironment(); // ARTU_ENVIRONMENT or "test"
|
|
162
|
+
* ```
|
|
163
|
+
*/
|
|
164
|
+
export function resolveEnvironment(environment?: string): Environment {
|
|
165
|
+
// 1. Explicit environment takes priority
|
|
166
|
+
if (environment) {
|
|
167
|
+
return validateEnvironment(environment);
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
// 2. Fall back to ARTU_ENVIRONMENT environment variable
|
|
171
|
+
const envEnvironment = process.env.ARTU_ENVIRONMENT;
|
|
172
|
+
if (envEnvironment) {
|
|
173
|
+
return validateEnvironment(envEnvironment);
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
// 3. Default to test
|
|
177
|
+
return "test";
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
/**
|
|
181
|
+
* Resolves the organization ID from environment variable
|
|
182
|
+
*
|
|
183
|
+
* @returns Organization ID from ARTU_ORGANIZATION_ID or undefined
|
|
184
|
+
*/
|
|
185
|
+
export function resolveOrganizationId(): string | undefined {
|
|
186
|
+
return process.env.ARTU_ORGANIZATION_ID;
|
|
187
|
+
}
|
package/src/utils/index.ts
CHANGED
|
@@ -113,3 +113,22 @@ export {
|
|
|
113
113
|
isNull,
|
|
114
114
|
isNotNull,
|
|
115
115
|
} from "./filters";
|
|
116
|
+
|
|
117
|
+
// ===========================
|
|
118
|
+
// Upload Utilities
|
|
119
|
+
// ===========================
|
|
120
|
+
|
|
121
|
+
export {
|
|
122
|
+
uploadToS3,
|
|
123
|
+
normalizeFile,
|
|
124
|
+
validateFileSize,
|
|
125
|
+
MAX_FILE_SIZE_BYTES,
|
|
126
|
+
DEFAULT_UPLOAD_TIMEOUT_MS,
|
|
127
|
+
} from "./upload";
|
|
128
|
+
|
|
129
|
+
export type {
|
|
130
|
+
UploadableFile,
|
|
131
|
+
ProgressCallback,
|
|
132
|
+
UploadToS3Options,
|
|
133
|
+
UploadToS3Result,
|
|
134
|
+
} from "./upload";
|
package/src/utils/session.ts
CHANGED
|
@@ -43,6 +43,13 @@ interface SessionOptionsBase {
|
|
|
43
43
|
* Custom fetch implementation (optional).
|
|
44
44
|
*/
|
|
45
45
|
fetchImpl?: typeof fetch;
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Optional organization ID to lock the login to a specific organization.
|
|
49
|
+
* When provided, users will only be able to log in to this organization.
|
|
50
|
+
* Useful for custom apps to prevent users from logging into the wrong organization.
|
|
51
|
+
*/
|
|
52
|
+
organizationId?: string;
|
|
46
53
|
}
|
|
47
54
|
|
|
48
55
|
/**
|
|
@@ -75,11 +82,23 @@ export type SessionOptions =
|
|
|
75
82
|
// (Used by sdk.session() - doesn't require baseUrl/environment)
|
|
76
83
|
// ===========================
|
|
77
84
|
|
|
85
|
+
/**
|
|
86
|
+
* Base SDK session options shared across all variants.
|
|
87
|
+
*/
|
|
88
|
+
interface SDKSessionOptionsBase {
|
|
89
|
+
/**
|
|
90
|
+
* Optional organization ID to lock the login to a specific organization.
|
|
91
|
+
* When provided, users will only be able to log in to this organization.
|
|
92
|
+
* Useful for custom apps to prevent users from logging into the wrong organization.
|
|
93
|
+
*/
|
|
94
|
+
organizationId?: string;
|
|
95
|
+
}
|
|
96
|
+
|
|
78
97
|
/**
|
|
79
98
|
* Options for sdk.session() when returnTo is provided.
|
|
80
99
|
* Result will include redirectUrl when not authenticated.
|
|
81
100
|
*/
|
|
82
|
-
export interface SDKSessionOptionsWithReturnTo {
|
|
101
|
+
export interface SDKSessionOptionsWithReturnTo extends SDKSessionOptionsBase {
|
|
83
102
|
/**
|
|
84
103
|
* Full URL to return to after authentication.
|
|
85
104
|
* When provided, redirectUrl will be included in the result when not authenticated.
|
|
@@ -90,7 +109,7 @@ export interface SDKSessionOptionsWithReturnTo {
|
|
|
90
109
|
/**
|
|
91
110
|
* Options for sdk.session() when returnTo is not provided.
|
|
92
111
|
*/
|
|
93
|
-
export interface SDKSessionOptionsWithoutReturnTo {
|
|
112
|
+
export interface SDKSessionOptionsWithoutReturnTo extends SDKSessionOptionsBase {
|
|
94
113
|
returnTo?: never;
|
|
95
114
|
}
|
|
96
115
|
|
|
@@ -163,10 +182,14 @@ export type SessionResult =
|
|
|
163
182
|
export function createAuthLoginUrl(options: {
|
|
164
183
|
apiBaseUrl: string;
|
|
165
184
|
returnTo: string;
|
|
185
|
+
organizationId?: string;
|
|
166
186
|
}): string {
|
|
167
|
-
const { apiBaseUrl, returnTo } = options;
|
|
187
|
+
const { apiBaseUrl, returnTo, organizationId } = options;
|
|
168
188
|
const loginUrl = new URL("/auth/login", apiBaseUrl);
|
|
169
189
|
loginUrl.searchParams.set("return_to", returnTo);
|
|
190
|
+
if (organizationId) {
|
|
191
|
+
loginUrl.searchParams.set("organization_id", organizationId);
|
|
192
|
+
}
|
|
170
193
|
return loginUrl.toString();
|
|
171
194
|
}
|
|
172
195
|
|
|
@@ -225,6 +248,12 @@ export async function fetchSession(
|
|
|
225
248
|
returnTo,
|
|
226
249
|
} = options;
|
|
227
250
|
|
|
251
|
+
// Extract organizationId only when returnTo is provided
|
|
252
|
+
const organizationId =
|
|
253
|
+
"organizationId" in options
|
|
254
|
+
? (options as SessionOptionsWithReturnTo).organizationId
|
|
255
|
+
: undefined;
|
|
256
|
+
|
|
228
257
|
const normalizedBaseUrl = baseUrl.replace(/\/$/, "");
|
|
229
258
|
|
|
230
259
|
const handleUnauthenticated = ():
|
|
@@ -237,6 +266,7 @@ export async function fetchSession(
|
|
|
237
266
|
redirectUrl: createAuthLoginUrl({
|
|
238
267
|
apiBaseUrl: normalizedBaseUrl,
|
|
239
268
|
returnTo,
|
|
269
|
+
organizationId,
|
|
240
270
|
}),
|
|
241
271
|
};
|
|
242
272
|
}
|
package/src/utils/trpc-client.ts
CHANGED
|
@@ -79,6 +79,13 @@ export type TRPCClientConfig = TRPCAuthConfig & {
|
|
|
79
79
|
* @default 30000
|
|
80
80
|
*/
|
|
81
81
|
timeout?: number;
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* Organization ID for request validation.
|
|
85
|
+
* When provided, the API validates that the authenticated
|
|
86
|
+
* user/API key belongs to this organization.
|
|
87
|
+
*/
|
|
88
|
+
organizationId?: string;
|
|
82
89
|
};
|
|
83
90
|
|
|
84
91
|
/**
|
|
@@ -129,6 +136,7 @@ export function createAPIClient(config: TRPCClientConfig) {
|
|
|
129
136
|
environment,
|
|
130
137
|
apiVersion = LATEST_API_VERSION,
|
|
131
138
|
timeout = DEFAULT_TIMEOUT,
|
|
139
|
+
organizationId,
|
|
132
140
|
} = config;
|
|
133
141
|
|
|
134
142
|
const mode: TRPCAuthMode = rawMode ?? "apiKey";
|
|
@@ -150,11 +158,12 @@ export function createAPIClient(config: TRPCClientConfig) {
|
|
|
150
158
|
customHeaders = cookieConfig.headers ?? {};
|
|
151
159
|
}
|
|
152
160
|
|
|
153
|
-
const baseHeaders = {
|
|
161
|
+
const baseHeaders: Record<string, string> = {
|
|
154
162
|
...customHeaders,
|
|
155
163
|
...authHeaders,
|
|
156
164
|
"X-Environment": environment,
|
|
157
165
|
"X-Request-ID": generateRequestId(),
|
|
166
|
+
...(organizationId ? { "X-Organization-ID": organizationId } : {}),
|
|
158
167
|
};
|
|
159
168
|
|
|
160
169
|
// Normalize baseUrl (remove trailing slash)
|