@artu-ai/compliance-sdk 0.8.2 → 0.9.1
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/README.md +2 -2
- package/dist/errors/base.d.ts +1 -1
- package/dist/errors/base.js +1 -1
- package/dist/exports/index.d.ts +4 -4
- package/dist/exports/index.d.ts.map +1 -1
- package/dist/exports/index.js +2 -2
- package/dist/exports/mexico/actividad-vulnerable/avi.d.ts +11 -11
- package/dist/exports/mexico/actividad-vulnerable/avi.d.ts.map +1 -1
- package/dist/exports/mexico/actividad-vulnerable/avi.js +10 -10
- package/dist/exports/mexico/actividad-vulnerable/jys.d.ts +11 -11
- package/dist/exports/mexico/actividad-vulnerable/jys.d.ts.map +1 -1
- package/dist/exports/mexico/actividad-vulnerable/jys.js +10 -10
- package/dist/exports/mexico/actividad-vulnerable/mjr.d.ts +11 -11
- package/dist/exports/mexico/actividad-vulnerable/mjr.d.ts.map +1 -1
- package/dist/exports/mexico/actividad-vulnerable/mjr.js +10 -10
- package/dist/exports/mexico/actividad-vulnerable/tsc.d.ts +11 -11
- package/dist/exports/mexico/actividad-vulnerable/tsc.d.ts.map +1 -1
- package/dist/exports/mexico/actividad-vulnerable/tsc.js +10 -10
- package/dist/exports/mexico/index.d.ts +4 -4
- package/dist/exports/mexico/index.d.ts.map +1 -1
- package/dist/exports/mexico/index.js +3 -3
- package/dist/models/Alert.d.ts +106 -0
- package/dist/models/Alert.d.ts.map +1 -0
- package/dist/models/{Report.js → Alert.js} +44 -31
- package/dist/models/{ReportItem.d.ts → AlertItem.d.ts} +15 -15
- package/dist/models/AlertItem.d.ts.map +1 -0
- package/dist/models/{ReportItem.js → AlertItem.js} +13 -13
- package/dist/models/index.d.ts +5 -5
- package/dist/models/index.d.ts.map +1 -1
- package/dist/models/index.js +7 -7
- package/dist/models/mex/MexAlert.d.ts +50 -0
- package/dist/models/mex/MexAlert.d.ts.map +1 -0
- package/dist/models/mex/{MexReport.js → MexAlert.js} +15 -15
- package/dist/models/mex/MexAlertItem.d.ts +39 -0
- package/dist/models/mex/MexAlertItem.d.ts.map +1 -0
- package/dist/models/mex/{MexReportItem.js → MexAlertItem.js} +11 -11
- package/dist/models/mex/actividad-vulnerable/MexActividadVulnerableAlert.d.ts +38 -0
- package/dist/models/mex/actividad-vulnerable/MexActividadVulnerableAlert.d.ts.map +1 -0
- package/dist/models/mex/actividad-vulnerable/{MexActividadVulnerableReport.js → MexActividadVulnerableAlert.js} +11 -11
- package/dist/models/mex/actividad-vulnerable/MexActividadVulnerableAlertItem.d.ts +38 -0
- package/dist/models/mex/actividad-vulnerable/MexActividadVulnerableAlertItem.d.ts.map +1 -0
- package/dist/models/mex/actividad-vulnerable/{MexActividadVulnerableReportItem.js → MexActividadVulnerableAlertItem.js} +11 -11
- package/dist/models/mex/actividad-vulnerable/avi/MexAVIAlert.d.ts +53 -0
- package/dist/models/mex/actividad-vulnerable/avi/MexAVIAlert.d.ts.map +1 -0
- package/dist/models/mex/actividad-vulnerable/avi/{MexAVIReport.js → MexAVIAlert.js} +14 -14
- package/dist/models/mex/actividad-vulnerable/avi/MexAVIAlertItem.d.ts +56 -0
- package/dist/models/mex/actividad-vulnerable/avi/MexAVIAlertItem.d.ts.map +1 -0
- package/dist/models/mex/actividad-vulnerable/avi/{MexAVIReportItem.js → MexAVIAlertItem.js} +13 -13
- package/dist/models/mex/actividad-vulnerable/index.d.ts +10 -10
- package/dist/models/mex/actividad-vulnerable/index.d.ts.map +1 -1
- package/dist/models/mex/actividad-vulnerable/index.js +12 -12
- package/dist/models/mex/actividad-vulnerable/jys/MexJYSAlert.d.ts +53 -0
- package/dist/models/mex/actividad-vulnerable/jys/MexJYSAlert.d.ts.map +1 -0
- package/dist/models/mex/actividad-vulnerable/jys/{MexJYSReport.js → MexJYSAlert.js} +14 -14
- package/dist/models/mex/actividad-vulnerable/jys/MexJYSAlertItem.d.ts +56 -0
- package/dist/models/mex/actividad-vulnerable/jys/MexJYSAlertItem.d.ts.map +1 -0
- package/dist/models/mex/actividad-vulnerable/jys/{MexJYSReportItem.js → MexJYSAlertItem.js} +13 -13
- package/dist/models/mex/actividad-vulnerable/mjr/MexMJRAlert.d.ts +53 -0
- package/dist/models/mex/actividad-vulnerable/mjr/MexMJRAlert.d.ts.map +1 -0
- package/dist/models/mex/actividad-vulnerable/mjr/{MexMJRReport.js → MexMJRAlert.js} +14 -14
- package/dist/models/mex/actividad-vulnerable/mjr/MexMJRAlertItem.d.ts +56 -0
- package/dist/models/mex/actividad-vulnerable/mjr/MexMJRAlertItem.d.ts.map +1 -0
- package/dist/models/mex/actividad-vulnerable/mjr/{MexMJRReportItem.js → MexMJRAlertItem.js} +13 -13
- package/dist/models/mex/actividad-vulnerable/tsc/MexTSCAlert.d.ts +53 -0
- package/dist/models/mex/actividad-vulnerable/tsc/MexTSCAlert.d.ts.map +1 -0
- package/dist/models/mex/actividad-vulnerable/tsc/{MexTSCReport.js → MexTSCAlert.js} +14 -14
- package/dist/models/mex/actividad-vulnerable/tsc/MexTSCAlertItem.d.ts +56 -0
- package/dist/models/mex/actividad-vulnerable/tsc/MexTSCAlertItem.d.ts.map +1 -0
- package/dist/models/mex/actividad-vulnerable/tsc/{MexTSCReportItem.js → MexTSCAlertItem.js} +13 -13
- package/dist/models/mex/index.d.ts +2 -2
- package/dist/models/mex/index.d.ts.map +1 -1
- package/dist/models/mex/index.js +3 -3
- package/dist/models/types.d.ts +17 -17
- package/dist/models/types.d.ts.map +1 -1
- package/dist/namespaces/mexico/actividad-vulnerable/avi/index.d.ts +12 -12
- package/dist/namespaces/mexico/actividad-vulnerable/avi/index.d.ts.map +1 -1
- package/dist/namespaces/mexico/actividad-vulnerable/avi/index.js +7 -7
- package/dist/namespaces/mexico/actividad-vulnerable/index.d.ts +24 -24
- package/dist/namespaces/mexico/actividad-vulnerable/index.d.ts.map +1 -1
- package/dist/namespaces/mexico/actividad-vulnerable/index.js +5 -5
- package/dist/namespaces/mexico/actividad-vulnerable/jys/index.d.ts +12 -12
- package/dist/namespaces/mexico/actividad-vulnerable/jys/index.d.ts.map +1 -1
- package/dist/namespaces/mexico/actividad-vulnerable/jys/index.js +7 -7
- package/dist/namespaces/mexico/actividad-vulnerable/tsc/index.d.ts +12 -12
- package/dist/namespaces/mexico/actividad-vulnerable/tsc/index.d.ts.map +1 -1
- package/dist/namespaces/mexico/actividad-vulnerable/tsc/index.js +7 -7
- package/dist/namespaces/mexico/index.d.ts +48 -48
- package/dist/namespaces/mexico/index.d.ts.map +1 -1
- package/dist/namespaces/mexico/index.js +8 -8
- package/dist/resources/alerts.d.ts +245 -0
- package/dist/resources/alerts.d.ts.map +1 -0
- package/dist/resources/{reports.js → alerts.js} +107 -107
- 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/alerts.d.ts +190 -0
- package/dist/resources/mex/actividad-vulnerable/avi/alerts.d.ts.map +1 -0
- package/dist/resources/mex/actividad-vulnerable/avi/{reports.js → alerts.js} +86 -86
- package/dist/resources/mex/actividad-vulnerable/avi/index.d.ts +1 -1
- package/dist/resources/mex/actividad-vulnerable/avi/index.d.ts.map +1 -1
- package/dist/resources/mex/actividad-vulnerable/avi/index.js +1 -1
- package/dist/resources/mex/actividad-vulnerable/jys/alerts.d.ts +170 -0
- package/dist/resources/mex/actividad-vulnerable/jys/alerts.d.ts.map +1 -0
- package/dist/resources/mex/actividad-vulnerable/jys/{reports.js → alerts.js} +82 -82
- package/dist/resources/mex/actividad-vulnerable/jys/index.d.ts +1 -1
- package/dist/resources/mex/actividad-vulnerable/jys/index.d.ts.map +1 -1
- package/dist/resources/mex/actividad-vulnerable/jys/index.js +1 -1
- package/dist/resources/mex/actividad-vulnerable/mjr/alerts.d.ts +170 -0
- package/dist/resources/mex/actividad-vulnerable/mjr/alerts.d.ts.map +1 -0
- package/dist/resources/mex/actividad-vulnerable/mjr/{reports.js → alerts.js} +83 -83
- package/dist/resources/mex/actividad-vulnerable/mjr/index.d.ts +1 -1
- package/dist/resources/mex/actividad-vulnerable/mjr/index.d.ts.map +1 -1
- package/dist/resources/mex/actividad-vulnerable/mjr/index.js +1 -1
- package/dist/resources/mex/actividad-vulnerable/tsc/alerts.d.ts +170 -0
- package/dist/resources/mex/actividad-vulnerable/tsc/alerts.d.ts.map +1 -0
- package/dist/resources/mex/actividad-vulnerable/tsc/{reports.js → alerts.js} +82 -82
- package/dist/resources/mex/actividad-vulnerable/tsc/index.d.ts +1 -1
- package/dist/resources/mex/actividad-vulnerable/tsc/index.d.ts.map +1 -1
- package/dist/resources/mex/actividad-vulnerable/tsc/index.js +1 -1
- package/dist/resources/mex/alerts.d.ts +266 -0
- package/dist/resources/mex/alerts.d.ts.map +1 -0
- package/dist/resources/mex/{reports.js → alerts.js} +109 -109
- package/dist/resources/mex/ebr.d.ts +1 -1
- package/dist/resources/mex/ebr.js +1 -1
- package/dist/resources/mex/index.d.ts +1 -1
- package/dist/resources/mex/index.d.ts.map +1 -1
- package/dist/resources/mex/index.js +1 -1
- package/dist/sdk/ComplianceSDK.d.ts +10 -10
- package/dist/sdk/ComplianceSDK.d.ts.map +1 -1
- package/dist/sdk/ComplianceSDK.js +9 -9
- package/dist/sdk/base.js +2 -2
- package/dist/sdk/mex/ComplianceSDK.d.ts +3 -3
- package/dist/sdk/mex/ComplianceSDK.d.ts.map +1 -1
- package/dist/sdk/mex/ComplianceSDK.js +1 -1
- package/dist/sdk/mex/actividad-vulnerable/avi/ComplianceSDK.d.ts +2 -2
- package/dist/sdk/mex/actividad-vulnerable/avi/ComplianceSDK.d.ts.map +1 -1
- package/dist/sdk/mex/actividad-vulnerable/avi/types.d.ts +3 -3
- package/dist/sdk/mex/actividad-vulnerable/avi/types.d.ts.map +1 -1
- package/dist/sdk/mex/actividad-vulnerable/avi/types.js +2 -2
- package/dist/sdk/mex/actividad-vulnerable/jys/ComplianceSDK.d.ts +2 -2
- package/dist/sdk/mex/actividad-vulnerable/jys/ComplianceSDK.d.ts.map +1 -1
- package/dist/sdk/mex/actividad-vulnerable/jys/types.d.ts +3 -3
- package/dist/sdk/mex/actividad-vulnerable/jys/types.d.ts.map +1 -1
- package/dist/sdk/mex/actividad-vulnerable/jys/types.js +2 -2
- package/dist/sdk/mex/actividad-vulnerable/mjr/ComplianceSDK.d.ts +2 -2
- package/dist/sdk/mex/actividad-vulnerable/mjr/ComplianceSDK.d.ts.map +1 -1
- package/dist/sdk/mex/actividad-vulnerable/mjr/types.d.ts +3 -3
- package/dist/sdk/mex/actividad-vulnerable/mjr/types.d.ts.map +1 -1
- package/dist/sdk/mex/actividad-vulnerable/mjr/types.js +2 -2
- package/dist/sdk/mex/actividad-vulnerable/tsc/ComplianceSDK.d.ts +2 -2
- package/dist/sdk/mex/actividad-vulnerable/tsc/ComplianceSDK.d.ts.map +1 -1
- package/dist/sdk/mex/actividad-vulnerable/tsc/types.d.ts +3 -3
- package/dist/sdk/mex/actividad-vulnerable/tsc/types.d.ts.map +1 -1
- package/dist/sdk/mex/actividad-vulnerable/tsc/types.js +2 -2
- package/dist/sdk/mex/index.js +2 -2
- package/dist/sdk/mex/types.d.ts +2 -2
- package/dist/sdk/mex/types.d.ts.map +1 -1
- package/dist/sdk/resource-registry.d.ts +4 -4
- package/dist/sdk/resource-registry.d.ts.map +1 -1
- package/dist/sdk/resource-registry.js +1 -1
- package/dist/utils/upload.js +1 -1
- package/package.json +2 -2
- package/dist/models/Report.d.ts +0 -98
- package/dist/models/Report.d.ts.map +0 -1
- package/dist/models/ReportItem.d.ts.map +0 -1
- package/dist/models/mex/MexReport.d.ts +0 -50
- package/dist/models/mex/MexReport.d.ts.map +0 -1
- package/dist/models/mex/MexReportItem.d.ts +0 -39
- package/dist/models/mex/MexReportItem.d.ts.map +0 -1
- package/dist/models/mex/actividad-vulnerable/MexActividadVulnerableReport.d.ts +0 -38
- package/dist/models/mex/actividad-vulnerable/MexActividadVulnerableReport.d.ts.map +0 -1
- package/dist/models/mex/actividad-vulnerable/MexActividadVulnerableReportItem.d.ts +0 -38
- package/dist/models/mex/actividad-vulnerable/MexActividadVulnerableReportItem.d.ts.map +0 -1
- package/dist/models/mex/actividad-vulnerable/avi/MexAVIReport.d.ts +0 -53
- package/dist/models/mex/actividad-vulnerable/avi/MexAVIReport.d.ts.map +0 -1
- package/dist/models/mex/actividad-vulnerable/avi/MexAVIReportItem.d.ts +0 -56
- package/dist/models/mex/actividad-vulnerable/avi/MexAVIReportItem.d.ts.map +0 -1
- package/dist/models/mex/actividad-vulnerable/jys/MexJYSReport.d.ts +0 -53
- package/dist/models/mex/actividad-vulnerable/jys/MexJYSReport.d.ts.map +0 -1
- package/dist/models/mex/actividad-vulnerable/jys/MexJYSReportItem.d.ts +0 -56
- package/dist/models/mex/actividad-vulnerable/jys/MexJYSReportItem.d.ts.map +0 -1
- package/dist/models/mex/actividad-vulnerable/mjr/MexMJRReport.d.ts +0 -53
- package/dist/models/mex/actividad-vulnerable/mjr/MexMJRReport.d.ts.map +0 -1
- package/dist/models/mex/actividad-vulnerable/mjr/MexMJRReportItem.d.ts +0 -56
- package/dist/models/mex/actividad-vulnerable/mjr/MexMJRReportItem.d.ts.map +0 -1
- package/dist/models/mex/actividad-vulnerable/tsc/MexTSCReport.d.ts +0 -53
- package/dist/models/mex/actividad-vulnerable/tsc/MexTSCReport.d.ts.map +0 -1
- package/dist/models/mex/actividad-vulnerable/tsc/MexTSCReportItem.d.ts +0 -56
- package/dist/models/mex/actividad-vulnerable/tsc/MexTSCReportItem.d.ts.map +0 -1
- package/dist/resources/mex/actividad-vulnerable/avi/reports.d.ts +0 -190
- package/dist/resources/mex/actividad-vulnerable/avi/reports.d.ts.map +0 -1
- package/dist/resources/mex/actividad-vulnerable/jys/reports.d.ts +0 -170
- package/dist/resources/mex/actividad-vulnerable/jys/reports.d.ts.map +0 -1
- package/dist/resources/mex/actividad-vulnerable/mjr/reports.d.ts +0 -170
- package/dist/resources/mex/actividad-vulnerable/mjr/reports.d.ts.map +0 -1
- package/dist/resources/mex/actividad-vulnerable/tsc/reports.d.ts +0 -170
- package/dist/resources/mex/actividad-vulnerable/tsc/reports.d.ts.map +0 -1
- package/dist/resources/mex/reports.d.ts +0 -266
- package/dist/resources/mex/reports.d.ts.map +0 -1
- package/dist/resources/reports.d.ts +0 -245
- package/dist/resources/reports.d.ts.map +0 -1
|
@@ -1,33 +1,33 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* Alerts Resource
|
|
3
3
|
*
|
|
4
|
-
* CRUD operations,
|
|
4
|
+
* CRUD operations, alert items management, validation, and generation.
|
|
5
5
|
*
|
|
6
6
|
* This is the base (unscoped) resource. For jurisdiction-scoped SDKs, use:
|
|
7
|
-
* -
|
|
8
|
-
* -
|
|
9
|
-
* -
|
|
10
|
-
* -
|
|
7
|
+
* - MexAlertsResource - Mexico-scoped with flattened MX fields
|
|
8
|
+
* - AVIAlertsResource - Mexico AVI-scoped with flattened AVI fields
|
|
9
|
+
* - JYSAlertsResource - Mexico JYS-scoped with flattened JYS fields
|
|
10
|
+
* - TSCAlertsResource - Mexico TSC-scoped with flattened TSC fields
|
|
11
11
|
*/
|
|
12
12
|
import { z } from "zod";
|
|
13
|
-
import {
|
|
13
|
+
import { createAlertInputSchema, updateAlertInputSchema, upsertAlertInputSchema, updateReportStatusInputSchema, createAlertItemInputSchema, updateAlertItemInputSchema, alertDefaultsInputSchema, submitAlertInputSchema, } from "@artu-ai/shared";
|
|
14
14
|
import { BaseResource } from "./base";
|
|
15
|
-
import {
|
|
15
|
+
import { Alert, AlertItem, } from "../models";
|
|
16
16
|
// ===========================
|
|
17
|
-
//
|
|
17
|
+
// AlertsResource
|
|
18
18
|
// ===========================
|
|
19
19
|
/**
|
|
20
|
-
* Base resource manager for
|
|
20
|
+
* Base resource manager for alert operations.
|
|
21
21
|
*
|
|
22
22
|
* Provides:
|
|
23
23
|
* - CRUD operations (create, retrieve, update, delete)
|
|
24
|
-
* -
|
|
24
|
+
* - Alert items management (add, update, remove items)
|
|
25
25
|
* - Validation and generation
|
|
26
26
|
*
|
|
27
27
|
* @example
|
|
28
28
|
* ```typescript
|
|
29
|
-
* // Create a
|
|
30
|
-
* const
|
|
29
|
+
* // Create a alert with full nested format
|
|
30
|
+
* const alert = await sdk.alerts.create({
|
|
31
31
|
* jurisdictions: {
|
|
32
32
|
* MX: {
|
|
33
33
|
* actividadVulnerable: {
|
|
@@ -37,105 +37,105 @@ import { Report, ReportItem, } from "../models";
|
|
|
37
37
|
* }
|
|
38
38
|
* });
|
|
39
39
|
*
|
|
40
|
-
* // Add items to the
|
|
41
|
-
* await sdk.
|
|
40
|
+
* // Add items to the alert
|
|
41
|
+
* await sdk.alerts.addItem(alert.id, {
|
|
42
42
|
* transactionId: "txn_123",
|
|
43
43
|
* });
|
|
44
44
|
*
|
|
45
|
-
* // Validate the
|
|
46
|
-
* const result = await sdk.
|
|
45
|
+
* // Validate the alert
|
|
46
|
+
* const result = await sdk.alerts.validate(alert.id);
|
|
47
47
|
* if (result.valid) {
|
|
48
48
|
* // Generate XML
|
|
49
|
-
* const xml = await sdk.
|
|
49
|
+
* const xml = await sdk.alerts.generate(alert.id);
|
|
50
50
|
* }
|
|
51
51
|
* ```
|
|
52
52
|
*/
|
|
53
|
-
export class
|
|
53
|
+
export class AlertsResource extends BaseResource {
|
|
54
54
|
// ─────────────────────────────────────────────────────────────────
|
|
55
|
-
//
|
|
55
|
+
// Alert CRUD
|
|
56
56
|
// ─────────────────────────────────────────────────────────────────
|
|
57
57
|
/**
|
|
58
|
-
* Creates a new
|
|
58
|
+
* Creates a new alert.
|
|
59
59
|
*
|
|
60
|
-
* @param data -
|
|
61
|
-
* @returns The created
|
|
60
|
+
* @param data - Alert creation data in nested format
|
|
61
|
+
* @returns The created alert model
|
|
62
62
|
*/
|
|
63
63
|
async create(data) {
|
|
64
|
-
const validated = this.validate(
|
|
65
|
-
const response = await this.execute(() => this.trpc.
|
|
64
|
+
const validated = this.validate(createAlertInputSchema, data);
|
|
65
|
+
const response = await this.execute(() => this.trpc.alerts.create.mutate(validated));
|
|
66
66
|
return this.instantiate(response);
|
|
67
67
|
}
|
|
68
68
|
/**
|
|
69
|
-
* Retrieves a
|
|
69
|
+
* Retrieves a alert by ID.
|
|
70
70
|
*/
|
|
71
71
|
async retrieve(id) {
|
|
72
|
-
const response = await this.execute(() => this.trpc.
|
|
72
|
+
const response = await this.execute(() => this.trpc.alerts.retrieve.query({ id }));
|
|
73
73
|
return this.instantiate(response);
|
|
74
74
|
}
|
|
75
75
|
/**
|
|
76
|
-
* Retrieves a
|
|
76
|
+
* Retrieves a alert by metadata key/value.
|
|
77
77
|
*/
|
|
78
78
|
async retrieveByMetadata(key, value) {
|
|
79
|
-
const response = await this.execute(() => this.trpc.
|
|
79
|
+
const response = await this.execute(() => this.trpc.alerts.retrieveByMetadata.query({ key, value }));
|
|
80
80
|
return this.instantiate(response);
|
|
81
81
|
}
|
|
82
82
|
/**
|
|
83
|
-
* Retrieves a
|
|
83
|
+
* Retrieves a alert by externalId.
|
|
84
84
|
*/
|
|
85
85
|
async retrieveByExternalId(externalId) {
|
|
86
|
-
const response = await this.execute(() => this.trpc.
|
|
86
|
+
const response = await this.execute(() => this.trpc.alerts.retrieveByExternalId.query({ externalId }));
|
|
87
87
|
return this.instantiate(response);
|
|
88
88
|
}
|
|
89
89
|
/**
|
|
90
|
-
* Updates a
|
|
90
|
+
* Updates a alert.
|
|
91
91
|
*/
|
|
92
92
|
async update(id, data) {
|
|
93
|
-
const validated = this.validate(
|
|
94
|
-
const response = await this.execute(() => this.trpc.
|
|
93
|
+
const validated = this.validate(updateAlertInputSchema, data);
|
|
94
|
+
const response = await this.execute(() => this.trpc.alerts.update.mutate({ id, data: validated }));
|
|
95
95
|
return this.instantiate(response);
|
|
96
96
|
}
|
|
97
97
|
/**
|
|
98
|
-
* Updates a
|
|
98
|
+
* Updates a alert's status.
|
|
99
99
|
*
|
|
100
100
|
* Restrictions:
|
|
101
101
|
* - Can only manually set to: Draft
|
|
102
102
|
* - Cannot change from: Accepted (terminal), Submitted (awaiting response)
|
|
103
103
|
*
|
|
104
|
-
* Use this to reset a
|
|
104
|
+
* Use this to reset a alert back to Draft status for re-editing.
|
|
105
105
|
*/
|
|
106
106
|
async updateStatus(id, data) {
|
|
107
107
|
const validated = this.validate(updateReportStatusInputSchema, data);
|
|
108
|
-
const response = await this.execute(() => this.trpc.
|
|
108
|
+
const response = await this.execute(() => this.trpc.alerts.updateStatus.mutate({ id, data: validated }));
|
|
109
109
|
return this.instantiate(response);
|
|
110
110
|
}
|
|
111
111
|
/**
|
|
112
|
-
* Deletes a
|
|
112
|
+
* Deletes a alert.
|
|
113
113
|
*/
|
|
114
114
|
async delete(id) {
|
|
115
|
-
await this.execute(() => this.trpc.
|
|
115
|
+
await this.execute(() => this.trpc.alerts.delete.mutate({ id }));
|
|
116
116
|
}
|
|
117
117
|
/**
|
|
118
|
-
* Lists
|
|
118
|
+
* Lists alerts with optional filtering and pagination.
|
|
119
119
|
*/
|
|
120
120
|
async list(options) {
|
|
121
|
-
const response = await this.execute(() => this.trpc.
|
|
121
|
+
const response = await this.execute(() => this.trpc.alerts.list.query(options));
|
|
122
122
|
return {
|
|
123
123
|
data: response.data.map((r) => this.instantiate(r)),
|
|
124
124
|
pagination: response.pagination,
|
|
125
125
|
};
|
|
126
126
|
}
|
|
127
127
|
/**
|
|
128
|
-
* Counts
|
|
128
|
+
* Counts alerts matching the given filter.
|
|
129
129
|
*
|
|
130
130
|
* @param filter - Optional filter criteria
|
|
131
|
-
* @returns The count of matching
|
|
131
|
+
* @returns The count of matching alerts
|
|
132
132
|
*/
|
|
133
133
|
async count(filter) {
|
|
134
|
-
const response = await this.execute(() => this.trpc.
|
|
134
|
+
const response = await this.execute(() => this.trpc.alerts.count.query({ filter }));
|
|
135
135
|
return response.count;
|
|
136
136
|
}
|
|
137
137
|
/**
|
|
138
|
-
* Returns an async iterator over all
|
|
138
|
+
* Returns an async iterator over all alerts matching the filter.
|
|
139
139
|
*/
|
|
140
140
|
iterate(options) {
|
|
141
141
|
return this.createIterator({
|
|
@@ -145,47 +145,47 @@ export class ReportsResource extends BaseResource {
|
|
|
145
145
|
});
|
|
146
146
|
}
|
|
147
147
|
// ─────────────────────────────────────────────────────────────────
|
|
148
|
-
//
|
|
148
|
+
// Alert Items
|
|
149
149
|
// ─────────────────────────────────────────────────────────────────
|
|
150
150
|
/**
|
|
151
|
-
* Adds an item to a
|
|
151
|
+
* Adds an item to a alert.
|
|
152
152
|
*/
|
|
153
|
-
async addItem(
|
|
154
|
-
const validated = this.validate(
|
|
155
|
-
const response = await this.execute(() => this.trpc.
|
|
153
|
+
async addItem(alertId, data) {
|
|
154
|
+
const validated = this.validate(createAlertItemInputSchema, data);
|
|
155
|
+
const response = await this.execute(() => this.trpc.alerts.addItem.mutate({ alertId, data: validated }));
|
|
156
156
|
return this.instantiateItem(response);
|
|
157
157
|
}
|
|
158
158
|
/**
|
|
159
|
-
* Gets a specific
|
|
159
|
+
* Gets a specific alert item.
|
|
160
160
|
*/
|
|
161
|
-
async getItem(
|
|
162
|
-
const response = await this.execute(() => this.trpc.
|
|
161
|
+
async getItem(alertId, itemId) {
|
|
162
|
+
const response = await this.execute(() => this.trpc.alerts.getItem.query({ alertId, itemId }));
|
|
163
163
|
return this.instantiateItem(response);
|
|
164
164
|
}
|
|
165
165
|
/**
|
|
166
|
-
* Updates a
|
|
166
|
+
* Updates a alert item.
|
|
167
167
|
*/
|
|
168
|
-
async updateItem(
|
|
169
|
-
const validated = this.validate(
|
|
170
|
-
const response = await this.execute(() => this.trpc.
|
|
171
|
-
|
|
168
|
+
async updateItem(alertId, itemId, data) {
|
|
169
|
+
const validated = this.validate(updateAlertItemInputSchema, data);
|
|
170
|
+
const response = await this.execute(() => this.trpc.alerts.updateItem.mutate({
|
|
171
|
+
alertId,
|
|
172
172
|
itemId,
|
|
173
173
|
data: validated,
|
|
174
174
|
}));
|
|
175
175
|
return this.instantiateItem(response);
|
|
176
176
|
}
|
|
177
177
|
/**
|
|
178
|
-
* Removes an item from a
|
|
178
|
+
* Removes an item from a alert.
|
|
179
179
|
*/
|
|
180
|
-
async removeItem(
|
|
181
|
-
await this.execute(() => this.trpc.
|
|
180
|
+
async removeItem(alertId, itemId) {
|
|
181
|
+
await this.execute(() => this.trpc.alerts.removeItem.mutate({ alertId, itemId }));
|
|
182
182
|
}
|
|
183
183
|
/**
|
|
184
|
-
* Lists items in a
|
|
184
|
+
* Lists items in a alert with filtering, sorting, and pagination.
|
|
185
185
|
*/
|
|
186
|
-
async listItems(
|
|
187
|
-
const response = await this.execute(() => this.trpc.
|
|
188
|
-
|
|
186
|
+
async listItems(alertId, options) {
|
|
187
|
+
const response = await this.execute(() => this.trpc.alerts.listItems.query({
|
|
188
|
+
alertId,
|
|
189
189
|
...options,
|
|
190
190
|
}));
|
|
191
191
|
return {
|
|
@@ -194,96 +194,96 @@ export class ReportsResource extends BaseResource {
|
|
|
194
194
|
};
|
|
195
195
|
}
|
|
196
196
|
/**
|
|
197
|
-
* Adds multiple items to a
|
|
197
|
+
* Adds multiple items to a alert.
|
|
198
198
|
* Validates all items upfront - fails fast if any item is invalid.
|
|
199
199
|
*/
|
|
200
|
-
async addItems(
|
|
201
|
-
const validated = this.validate(z.array(
|
|
202
|
-
const response = await this.execute(() => this.trpc.
|
|
200
|
+
async addItems(alertId, items) {
|
|
201
|
+
const validated = this.validate(z.array(createAlertItemInputSchema), items);
|
|
202
|
+
const response = await this.execute(() => this.trpc.alerts.addItems.mutate({ alertId, items: validated }));
|
|
203
203
|
return {
|
|
204
204
|
added: response.added,
|
|
205
205
|
items: response.items.map((i) => this.instantiateItem(i)),
|
|
206
206
|
};
|
|
207
207
|
}
|
|
208
208
|
/**
|
|
209
|
-
* Removes multiple items from a
|
|
209
|
+
* Removes multiple items from a alert.
|
|
210
210
|
*/
|
|
211
|
-
async removeItems(
|
|
212
|
-
return this.execute(() => this.trpc.
|
|
211
|
+
async removeItems(alertId, itemIds) {
|
|
212
|
+
return this.execute(() => this.trpc.alerts.removeItems.mutate({ alertId, itemIds }));
|
|
213
213
|
}
|
|
214
214
|
// ─────────────────────────────────────────────────────────────────
|
|
215
215
|
// Validation & Generation
|
|
216
216
|
// ─────────────────────────────────────────────────────────────────
|
|
217
217
|
/**
|
|
218
|
-
* Validates a
|
|
218
|
+
* Validates a alert and its items.
|
|
219
219
|
*
|
|
220
220
|
* Requires jurisdiction-specific defaults.
|
|
221
221
|
* For scoped SDKs, use the scoped resource which provides a simpler API.
|
|
222
222
|
*
|
|
223
|
-
* @param
|
|
223
|
+
* @param alertId - The alert ID to validate
|
|
224
224
|
* @param defaults - Jurisdiction-specific defaults for validation
|
|
225
225
|
*/
|
|
226
|
-
async
|
|
227
|
-
const validated = this.validate(
|
|
228
|
-
return this.execute(() => this.trpc.
|
|
226
|
+
async validateAlert(alertId, defaults) {
|
|
227
|
+
const validated = this.validate(alertDefaultsInputSchema, defaults);
|
|
228
|
+
return this.execute(() => this.trpc.alerts.validate.mutate({ alertId, ...validated }));
|
|
229
229
|
}
|
|
230
230
|
/**
|
|
231
|
-
* Validates and generates the
|
|
231
|
+
* Validates and generates the alert output (e.g., XML for Mexico alerts).
|
|
232
232
|
*
|
|
233
233
|
* Performs validation first:
|
|
234
234
|
* - If validation fails, returns `{ status: "validation_failed", validation: {...} }`
|
|
235
235
|
* - If validation passes, returns `{ status: "success", xml: "...", ... }`
|
|
236
236
|
*
|
|
237
|
-
* Use `
|
|
237
|
+
* Use `validateAlert` for dry-run/preview validation without generating XML.
|
|
238
238
|
*
|
|
239
|
-
* @param
|
|
239
|
+
* @param alertId - The alert ID to generate
|
|
240
240
|
* @param defaults - Jurisdiction-specific defaults for generation
|
|
241
241
|
* @returns GenerateResult with status "success" or "validation_failed"
|
|
242
242
|
*/
|
|
243
|
-
async
|
|
244
|
-
const validated = this.validate(
|
|
245
|
-
return this.execute(() => this.trpc.
|
|
243
|
+
async generateAlert(alertId, defaults) {
|
|
244
|
+
const validated = this.validate(alertDefaultsInputSchema, defaults);
|
|
245
|
+
return this.execute(() => this.trpc.alerts.generate.mutate({ alertId, ...validated }));
|
|
246
246
|
}
|
|
247
247
|
// ─────────────────────────────────────────────────────────────────
|
|
248
248
|
// Submission
|
|
249
249
|
// ─────────────────────────────────────────────────────────────────
|
|
250
250
|
/**
|
|
251
|
-
* Submits a validated
|
|
251
|
+
* Submits a validated alert.
|
|
252
252
|
*
|
|
253
|
-
* The
|
|
253
|
+
* The alert must be in "valid" status. After submission, the alert
|
|
254
254
|
* is locked and cannot be edited.
|
|
255
255
|
*
|
|
256
|
-
* @param
|
|
256
|
+
* @param alertId - The alert ID
|
|
257
257
|
* @param input - Submission data with jurisdiction-specific structure
|
|
258
258
|
*/
|
|
259
259
|
async submit(input) {
|
|
260
|
-
const validated = this.validate(
|
|
261
|
-
return this.execute(() => this.trpc.
|
|
260
|
+
const validated = this.validate(submitAlertInputSchema, input);
|
|
261
|
+
return this.execute(() => this.trpc.alerts.submit.mutate(validated));
|
|
262
262
|
}
|
|
263
263
|
// ─────────────────────────────────────────────────────────────────
|
|
264
264
|
// Upsert Operations
|
|
265
265
|
// ─────────────────────────────────────────────────────────────────
|
|
266
266
|
/**
|
|
267
|
-
* Creates or updates a
|
|
267
|
+
* Creates or updates a alert by externalId.
|
|
268
268
|
*
|
|
269
|
-
* If a
|
|
270
|
-
* Otherwise, a new
|
|
269
|
+
* If a alert with the given externalId exists, it will be updated.
|
|
270
|
+
* Otherwise, a new alert will be created.
|
|
271
271
|
*
|
|
272
|
-
* @param data -
|
|
273
|
-
* @returns The created or updated
|
|
272
|
+
* @param data - Alert upsert data (must include externalId)
|
|
273
|
+
* @returns The created or updated alert with action indicator
|
|
274
274
|
*/
|
|
275
275
|
async upsertByExternalId(data) {
|
|
276
|
-
const validated = this.validate(
|
|
277
|
-
const response = await this.execute(() => this.trpc.
|
|
276
|
+
const validated = this.validate(upsertAlertInputSchema, data);
|
|
277
|
+
const response = await this.execute(() => this.trpc.alerts.upsertByExternalId.mutate(validated));
|
|
278
278
|
return {
|
|
279
279
|
data: this.instantiate(response.data),
|
|
280
280
|
action: response.action,
|
|
281
281
|
};
|
|
282
282
|
}
|
|
283
|
-
async upsertManyByExternalId(
|
|
283
|
+
async upsertManyByExternalId(alerts, options = {}) {
|
|
284
284
|
const atomic = options.atomic ?? true;
|
|
285
|
-
const validated = this.validate(z.array(
|
|
286
|
-
const response = await this.execute(() => this.trpc.
|
|
285
|
+
const validated = this.validate(z.array(upsertAlertInputSchema), alerts);
|
|
286
|
+
const response = await this.execute(() => this.trpc.alerts.upsertManyByExternalId.mutate({
|
|
287
287
|
items: validated,
|
|
288
288
|
atomic,
|
|
289
289
|
}));
|
|
@@ -310,10 +310,10 @@ export class ReportsResource extends BaseResource {
|
|
|
310
310
|
};
|
|
311
311
|
}
|
|
312
312
|
}
|
|
313
|
-
async createMany(
|
|
313
|
+
async createMany(alerts, options = {}) {
|
|
314
314
|
const atomic = options.atomic ?? true;
|
|
315
|
-
const validated = this.validate(z.array(
|
|
316
|
-
const response = await this.execute(() => this.trpc.
|
|
315
|
+
const validated = this.validate(z.array(createAlertInputSchema), alerts);
|
|
316
|
+
const response = await this.execute(() => this.trpc.alerts.createMany.mutate({ items: validated, atomic }));
|
|
317
317
|
if (response.atomic) {
|
|
318
318
|
return {
|
|
319
319
|
atomic: true,
|
|
@@ -335,10 +335,10 @@ export class ReportsResource extends BaseResource {
|
|
|
335
335
|
const atomic = options.atomic ?? true;
|
|
336
336
|
const updateItemSchema = z.object({
|
|
337
337
|
id: z.uuid(),
|
|
338
|
-
data:
|
|
338
|
+
data: updateAlertInputSchema,
|
|
339
339
|
});
|
|
340
340
|
const validated = this.validate(z.array(updateItemSchema), updates);
|
|
341
|
-
const response = await this.execute(() => this.trpc.
|
|
341
|
+
const response = await this.execute(() => this.trpc.alerts.updateMany.mutate({ items: validated, atomic }));
|
|
342
342
|
if (response.atomic) {
|
|
343
343
|
return {
|
|
344
344
|
atomic: true,
|
|
@@ -360,17 +360,17 @@ export class ReportsResource extends BaseResource {
|
|
|
360
360
|
// Instantiation (protected for subclasses to override)
|
|
361
361
|
// ─────────────────────────────────────────────────────────────────
|
|
362
362
|
/**
|
|
363
|
-
* Instantiates a
|
|
363
|
+
* Instantiates a Alert model from API response data.
|
|
364
364
|
* Subclasses override this to return their specific model type.
|
|
365
365
|
*/
|
|
366
366
|
instantiate(data) {
|
|
367
|
-
return new
|
|
367
|
+
return new Alert(data);
|
|
368
368
|
}
|
|
369
369
|
/**
|
|
370
|
-
* Instantiates a
|
|
370
|
+
* Instantiates a AlertItem model from API response data.
|
|
371
371
|
* Subclasses override this to return their specific model type.
|
|
372
372
|
*/
|
|
373
373
|
instantiateItem(data) {
|
|
374
|
-
return new
|
|
374
|
+
return new AlertItem(data);
|
|
375
375
|
}
|
|
376
376
|
}
|
|
@@ -14,7 +14,7 @@ export { BaseResource, ReadOnlyResource, type ResourceConfig } from "./base";
|
|
|
14
14
|
export { ClientsResource, type BatchOptions } from "./clients";
|
|
15
15
|
export { TransactionsResource } from "./transactions";
|
|
16
16
|
export type { RelatedClient, LinkedClient } from "@artu-ai/shared";
|
|
17
|
-
export {
|
|
17
|
+
export { AlertsResource, type AlertFilter, type AlertItemFilter, type AddItemsResult, } from "./alerts";
|
|
18
18
|
export { AddressesResource } from "./addresses";
|
|
19
19
|
export { ContactMethodsResource } from "./contact-methods";
|
|
20
20
|
export { BankAccountsResource } from "./bank-accounts";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/resources/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAGH,OAAO,EAAE,YAAY,EAAE,gBAAgB,EAAE,KAAK,cAAc,EAAE,MAAM,QAAQ,CAAC;AAG7E,OAAO,EAAE,eAAe,EAAE,KAAK,YAAY,EAAE,MAAM,WAAW,CAAC;AAC/D,OAAO,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AACtD,YAAY,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AACnE,OAAO,EACL,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/resources/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAGH,OAAO,EAAE,YAAY,EAAE,gBAAgB,EAAE,KAAK,cAAc,EAAE,MAAM,QAAQ,CAAC;AAG7E,OAAO,EAAE,eAAe,EAAE,KAAK,YAAY,EAAE,MAAM,WAAW,CAAC;AAC/D,OAAO,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AACtD,YAAY,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AACnE,OAAO,EACL,cAAc,EACd,KAAK,WAAW,EAChB,KAAK,eAAe,EACpB,KAAK,cAAc,GACpB,MAAM,UAAU,CAAC;AAGlB,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAChD,OAAO,EAAE,sBAAsB,EAAE,MAAM,mBAAmB,CAAC;AAC3D,OAAO,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AACvD,OAAO,EACL,iBAAiB,EACjB,KAAK,oBAAoB,EACzB,KAAK,mBAAmB,EACxB,KAAK,aAAa,GACnB,MAAM,aAAa,CAAC;AAGrB,OAAO,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AAGzD,cAAc,OAAO,CAAC"}
|
package/dist/resources/index.js
CHANGED
|
@@ -15,7 +15,7 @@ export { BaseResource, ReadOnlyResource } from "./base";
|
|
|
15
15
|
// Base resource implementations (unscoped)
|
|
16
16
|
export { ClientsResource } from "./clients";
|
|
17
17
|
export { TransactionsResource } from "./transactions";
|
|
18
|
-
export {
|
|
18
|
+
export { AlertsResource, } from "./alerts";
|
|
19
19
|
// Supporting resources
|
|
20
20
|
export { AddressesResource } from "./addresses";
|
|
21
21
|
export { ContactMethodsResource } from "./contact-methods";
|
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AVI (Activos Virtuales) Alerts Resource
|
|
3
|
+
*
|
|
4
|
+
* Extends MexAlertsResource with AVI-specific behavior:
|
|
5
|
+
* - Accepts flattened CreateAVIAlertInput (AVI fields at root level)
|
|
6
|
+
* - Returns MexAVIAlert models
|
|
7
|
+
*/
|
|
8
|
+
import type { CreateAlertInput, UpdateAlertInput, CreateAlertItemInput, UpdateAlertItemInput, CreateAVIAlertInput, UpdateAVIAlertInput, UpsertAVIAlertInput, CreateAVIAlertItemInput, UpdateAVIAlertItemInput, ListOptions, PaginatedResponse, AtomicBatchResult, PartialBatchResult, ValidationResult, GenerateResult, SubmissionResult, AviAlertDefaultsInput, SubmitAVIAlertInput, UpsertResult } from "@artu-ai/shared";
|
|
9
|
+
import type { AVIAlertFilter, AVIAlertSort, AVIAlertItemFilter, AlertSort, AlertItemFilter, AlertItemSort } from "@artu-ai/shared";
|
|
10
|
+
import { MexAlertsResource } from "../../alerts";
|
|
11
|
+
import { MexAVIAlert, MexAVIAlertItem, type AlertData, type AlertItemData } from "../../../../models";
|
|
12
|
+
/**
|
|
13
|
+
* AVI (Activos Virtuales) scoped alerts resource.
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* ```typescript
|
|
17
|
+
* const aviSdk = new ComplianceSDK({
|
|
18
|
+
* apiKey,
|
|
19
|
+
* jurisdiction: Jurisdiction.Mexico,
|
|
20
|
+
* actividadVulnerable: CodigoActividad.AVI,
|
|
21
|
+
* });
|
|
22
|
+
*
|
|
23
|
+
* // Create with fully flattened input
|
|
24
|
+
* const alert = await aviSdk.alerts.create({
|
|
25
|
+
* mesReportado: "202401",
|
|
26
|
+
* });
|
|
27
|
+
*
|
|
28
|
+
* // Returns MexAVIAlert
|
|
29
|
+
* console.log(alert.mesReportado);
|
|
30
|
+
* ```
|
|
31
|
+
*/
|
|
32
|
+
export declare class AVIAlertsResource extends MexAlertsResource<AVIAlertSort, AviAlertDefaultsInput> {
|
|
33
|
+
create(data: CreateAVIAlertInput): Promise<MexAVIAlert>;
|
|
34
|
+
retrieve(id: string): Promise<MexAVIAlert>;
|
|
35
|
+
retrieveByMetadata(key: string, value: string): Promise<MexAVIAlert>;
|
|
36
|
+
retrieveByExternalId(externalId: string): Promise<MexAVIAlert>;
|
|
37
|
+
update(id: string, data: UpdateAVIAlertInput): Promise<MexAVIAlert>;
|
|
38
|
+
/**
|
|
39
|
+
* Lists AVI alerts with optional filtering.
|
|
40
|
+
*
|
|
41
|
+
* Accepts flattened AVI filter (future AVI-specific alert fields at root level).
|
|
42
|
+
*/
|
|
43
|
+
list(options?: ListOptions<AVIAlertFilter, AVIAlertSort>): Promise<PaginatedResponse<MexAVIAlert>>;
|
|
44
|
+
/**
|
|
45
|
+
* Iterates over AVI alerts.
|
|
46
|
+
*
|
|
47
|
+
* Accepts flattened AVI filter (future AVI-specific alert fields at root level).
|
|
48
|
+
*/
|
|
49
|
+
iterate(options?: {
|
|
50
|
+
filter?: AVIAlertFilter;
|
|
51
|
+
sort?: AVIAlertSort;
|
|
52
|
+
pageSize?: number;
|
|
53
|
+
}): AsyncGenerator<MexAVIAlert, void, undefined>;
|
|
54
|
+
/**
|
|
55
|
+
* Counts AVI alerts matching the given filter.
|
|
56
|
+
*
|
|
57
|
+
* @param filter - Optional filter criteria (with AVI fields at root level)
|
|
58
|
+
* @returns The count of matching alerts
|
|
59
|
+
*/
|
|
60
|
+
count(filter?: AVIAlertFilter): Promise<number>;
|
|
61
|
+
createMany(alerts: CreateAVIAlertInput[], options?: {
|
|
62
|
+
atomic?: true;
|
|
63
|
+
}): Promise<AtomicBatchResult<MexAVIAlert>>;
|
|
64
|
+
createMany(alerts: CreateAVIAlertInput[], options: {
|
|
65
|
+
atomic: false;
|
|
66
|
+
}): Promise<PartialBatchResult<MexAVIAlert>>;
|
|
67
|
+
updateMany(updates: {
|
|
68
|
+
id: string;
|
|
69
|
+
data: UpdateAVIAlertInput;
|
|
70
|
+
}[], options?: {
|
|
71
|
+
atomic?: true;
|
|
72
|
+
}): Promise<AtomicBatchResult<MexAVIAlert>>;
|
|
73
|
+
updateMany(updates: {
|
|
74
|
+
id: string;
|
|
75
|
+
data: UpdateAVIAlertInput;
|
|
76
|
+
}[], options: {
|
|
77
|
+
atomic: false;
|
|
78
|
+
}): Promise<PartialBatchResult<MexAVIAlert>>;
|
|
79
|
+
/**
|
|
80
|
+
* Creates or updates an AVI alert by externalId.
|
|
81
|
+
*
|
|
82
|
+
* @param data - Alert upsert data with AVI fields at root level (must include externalId)
|
|
83
|
+
* @returns The created or updated alert with action indicator
|
|
84
|
+
*/
|
|
85
|
+
upsertByExternalId(data: UpsertAVIAlertInput): Promise<UpsertResult<MexAVIAlert>>;
|
|
86
|
+
/**
|
|
87
|
+
* Creates or updates multiple AVI alerts by externalId.
|
|
88
|
+
*
|
|
89
|
+
* @param alerts - Array of alert upsert data (each must include externalId)
|
|
90
|
+
* @param options - Batch options (atomic: true by default)
|
|
91
|
+
* @returns Atomic result with data array, or partial result with succeeded/failed
|
|
92
|
+
*/
|
|
93
|
+
upsertManyByExternalId(alerts: UpsertAVIAlertInput[], options?: {
|
|
94
|
+
atomic?: true;
|
|
95
|
+
}): Promise<AtomicBatchResult<UpsertResult<MexAVIAlert>>>;
|
|
96
|
+
upsertManyByExternalId(alerts: UpsertAVIAlertInput[], options: {
|
|
97
|
+
atomic: false;
|
|
98
|
+
}): Promise<PartialBatchResult<UpsertResult<MexAVIAlert>>>;
|
|
99
|
+
addItem(alertId: string, data: CreateAVIAlertItemInput): Promise<MexAVIAlertItem>;
|
|
100
|
+
getItem(alertId: string, itemId: string): Promise<MexAVIAlertItem>;
|
|
101
|
+
updateItem(alertId: string, itemId: string, data: UpdateAVIAlertItemInput): Promise<MexAVIAlertItem>;
|
|
102
|
+
listItems(alertId: string, options?: ListOptions<AVIAlertItemFilter, AlertItemSort>): Promise<PaginatedResponse<MexAVIAlertItem>>;
|
|
103
|
+
/**
|
|
104
|
+
* Transforms a flattened AVIAlertItemFilter to nested AlertItemFilter format.
|
|
105
|
+
*/
|
|
106
|
+
protected applyScopeToItemFilter(filter?: AVIAlertItemFilter): AlertItemFilter | undefined;
|
|
107
|
+
addItems(alertId: string, items: CreateAVIAlertItemInput[]): Promise<{
|
|
108
|
+
added: number;
|
|
109
|
+
items: MexAVIAlertItem[];
|
|
110
|
+
}>;
|
|
111
|
+
/**
|
|
112
|
+
* Validates an AVI alert.
|
|
113
|
+
*
|
|
114
|
+
* Uses AVI-scoped validation input (jurisdiction and activity are implicit).
|
|
115
|
+
*
|
|
116
|
+
* @param alertId - The alert ID to validate
|
|
117
|
+
* @param defaults - AVI alert defaults including rfc, platformDomain, alertType, etc.
|
|
118
|
+
*
|
|
119
|
+
* @example
|
|
120
|
+
* ```typescript
|
|
121
|
+
* const result = await aviSdk.alerts.validateAlert(alert.id, {
|
|
122
|
+
* rfc: "ABC200101XXX",
|
|
123
|
+
* platformDomain: "https://example.com",
|
|
124
|
+
* alertType: "100",
|
|
125
|
+
* });
|
|
126
|
+
* ```
|
|
127
|
+
*/
|
|
128
|
+
validateAlert(alertId: string, defaults: AviAlertDefaultsInput): Promise<ValidationResult>;
|
|
129
|
+
/**
|
|
130
|
+
* Generates XML for an AVI alert.
|
|
131
|
+
*
|
|
132
|
+
* Uses the same input as validateAlert.
|
|
133
|
+
*
|
|
134
|
+
* @param alertId - The alert ID to generate XML for
|
|
135
|
+
* @param defaults - AVI alert defaults including rfc, platformDomain, alertType, etc.
|
|
136
|
+
*
|
|
137
|
+
* @example
|
|
138
|
+
* ```typescript
|
|
139
|
+
* const result = await aviSdk.alerts.generateAlert(alert.id, {
|
|
140
|
+
* rfc: "ABC200101XXX",
|
|
141
|
+
* platformDomain: "https://example.com",
|
|
142
|
+
* alertType: "100",
|
|
143
|
+
* });
|
|
144
|
+
* console.log(result.xml);
|
|
145
|
+
* ```
|
|
146
|
+
*/
|
|
147
|
+
generateAlert(alertId: string, defaults: AviAlertDefaultsInput): Promise<GenerateResult>;
|
|
148
|
+
/**
|
|
149
|
+
* Submits a validated AVI alert.
|
|
150
|
+
*
|
|
151
|
+
* Uses AVI-scoped submission input (activity is implicit).
|
|
152
|
+
*
|
|
153
|
+
* @example
|
|
154
|
+
* ```typescript
|
|
155
|
+
* const result = await aviSdk.alerts.submit({
|
|
156
|
+
* alertId: alert.id,
|
|
157
|
+
* acuseRecibo: "SAT-12345",
|
|
158
|
+
* notes: "Submitted via portal",
|
|
159
|
+
* });
|
|
160
|
+
* ```
|
|
161
|
+
*/
|
|
162
|
+
submit(input: SubmitAVIAlertInput): Promise<SubmissionResult>;
|
|
163
|
+
/**
|
|
164
|
+
* Transforms a flattened AVIAlertSort to nested AlertSort format.
|
|
165
|
+
*
|
|
166
|
+
* Maps flattened field names to their full API paths.
|
|
167
|
+
*/
|
|
168
|
+
protected applyScopeToSort(sort?: AVIAlertSort): AlertSort | undefined;
|
|
169
|
+
protected transformToNested(data: CreateAVIAlertInput): CreateAlertInput;
|
|
170
|
+
/**
|
|
171
|
+
* Transforms AVI update input to nested API format.
|
|
172
|
+
*
|
|
173
|
+
* NOTE: Always includes `actividadVulnerable: { AVI: {} }` even if no
|
|
174
|
+
* AVI-specific fields are provided. This ensures that records touched via
|
|
175
|
+
* the AVI SDK can be filtered by `activityCodes: { in: ["AVI"] }`.
|
|
176
|
+
*/
|
|
177
|
+
protected transformUpdateToNested(data: UpdateAVIAlertInput): UpdateAlertInput;
|
|
178
|
+
protected instantiate(data: AlertData): MexAVIAlert;
|
|
179
|
+
protected instantiateItem(data: AlertItemData): MexAVIAlertItem;
|
|
180
|
+
protected transformItemToNested(data: CreateAVIAlertItemInput): CreateAlertItemInput;
|
|
181
|
+
protected transformItemUpdateToNested(data: UpdateAVIAlertItemInput): UpdateAlertItemInput;
|
|
182
|
+
/**
|
|
183
|
+
* Transforms AVI defaults to nested API format for validate/generate.
|
|
184
|
+
*/
|
|
185
|
+
protected transformAviDefaultsToNested(alertId: string, defaults: AviAlertDefaultsInput): {
|
|
186
|
+
alertId: string;
|
|
187
|
+
jurisdictions: unknown;
|
|
188
|
+
};
|
|
189
|
+
}
|
|
190
|
+
//# sourceMappingURL=alerts.d.ts.map
|