@api-client/core 0.18.21 → 0.18.22
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/build/src/modeling/helpers/Intelisense.d.ts +1 -0
- package/build/src/modeling/helpers/Intelisense.d.ts.map +1 -1
- package/build/src/modeling/helpers/Intelisense.js +1 -0
- package/build/src/modeling/helpers/Intelisense.js.map +1 -1
- package/build/src/modeling/templates/index.d.ts +1 -0
- package/build/src/modeling/templates/index.d.ts.map +1 -1
- package/build/src/modeling/templates/index.js +2 -0
- package/build/src/modeling/templates/index.js.map +1 -1
- package/build/src/modeling/templates/meta/education-management-platform.json +1 -0
- package/build/src/modeling/templates/meta/financial-services-platform.json +1 -0
- package/build/src/modeling/templates/meta/gaming-platform.json +1 -0
- package/build/src/modeling/templates/meta/healthcare-management-platform.json +1 -0
- package/build/src/modeling/templates/meta/hospitality-platform.json +1 -0
- package/build/src/modeling/templates/meta/index.d.ts +2 -2
- package/build/src/modeling/templates/meta/index.d.ts.map +1 -1
- package/build/src/modeling/templates/meta/index.js +31 -1
- package/build/src/modeling/templates/meta/index.js.map +1 -1
- package/build/src/modeling/templates/meta/iot-smart-home-platform.json +1 -0
- package/build/src/modeling/templates/meta/legal-services-platform.json +1 -0
- package/build/src/modeling/templates/meta/manufacturing-platform.json +1 -0
- package/build/src/modeling/templates/meta/non-profit-platform.json +1 -0
- package/build/src/modeling/templates/meta/real-estate-management-platform.json +1 -0
- package/build/src/modeling/templates/template-registry.d.ts +14 -0
- package/build/src/modeling/templates/template-registry.d.ts.map +1 -1
- package/build/src/modeling/templates/template-registry.js +63 -0
- package/build/src/modeling/templates/template-registry.js.map +1 -1
- package/build/src/modeling/templates/{ecommerce-domain.d.ts → verticals/business-services/ecommerce-domain.d.ts} +2 -2
- package/build/src/modeling/templates/verticals/business-services/ecommerce-domain.d.ts.map +1 -0
- package/build/src/modeling/templates/{ecommerce-domain.js → verticals/business-services/ecommerce-domain.js} +6 -6
- package/build/src/modeling/templates/verticals/business-services/ecommerce-domain.js.map +1 -0
- package/build/src/modeling/templates/verticals/business-services/financial-services-domain.d.ts +40 -0
- package/build/src/modeling/templates/verticals/business-services/financial-services-domain.d.ts.map +1 -0
- package/build/src/modeling/templates/verticals/business-services/financial-services-domain.js +744 -0
- package/build/src/modeling/templates/verticals/business-services/financial-services-domain.js.map +1 -0
- package/build/src/modeling/templates/verticals/business-services/hospitality-domain.d.ts +45 -0
- package/build/src/modeling/templates/verticals/business-services/hospitality-domain.d.ts.map +1 -0
- package/build/src/modeling/templates/verticals/business-services/hospitality-domain.js +797 -0
- package/build/src/modeling/templates/verticals/business-services/hospitality-domain.js.map +1 -0
- package/build/src/modeling/templates/verticals/business-services/index.d.ts +21 -0
- package/build/src/modeling/templates/verticals/business-services/index.d.ts.map +1 -0
- package/build/src/modeling/templates/verticals/business-services/index.js +50 -0
- package/build/src/modeling/templates/verticals/business-services/index.js.map +1 -0
- package/build/src/modeling/templates/verticals/business-services/legal-services-domain.d.ts +46 -0
- package/build/src/modeling/templates/verticals/business-services/legal-services-domain.d.ts.map +1 -0
- package/build/src/modeling/templates/verticals/business-services/legal-services-domain.js +837 -0
- package/build/src/modeling/templates/verticals/business-services/legal-services-domain.js.map +1 -0
- package/build/src/modeling/templates/verticals/education-training/education-domain.d.ts +40 -0
- package/build/src/modeling/templates/verticals/education-training/education-domain.d.ts.map +1 -0
- package/build/src/modeling/templates/verticals/education-training/education-domain.js +725 -0
- package/build/src/modeling/templates/verticals/education-training/education-domain.js.map +1 -0
- package/build/src/modeling/templates/verticals/education-training/index.d.ts +18 -0
- package/build/src/modeling/templates/verticals/education-training/index.d.ts.map +1 -0
- package/build/src/modeling/templates/verticals/education-training/index.js +21 -0
- package/build/src/modeling/templates/verticals/education-training/index.js.map +1 -0
- package/build/src/modeling/templates/verticals/healthcare-life-sciences/healthcare-domain.d.ts +40 -0
- package/build/src/modeling/templates/verticals/healthcare-life-sciences/healthcare-domain.d.ts.map +1 -0
- package/build/src/modeling/templates/verticals/healthcare-life-sciences/healthcare-domain.js +859 -0
- package/build/src/modeling/templates/verticals/healthcare-life-sciences/healthcare-domain.js.map +1 -0
- package/build/src/modeling/templates/verticals/healthcare-life-sciences/index.d.ts +18 -0
- package/build/src/modeling/templates/verticals/healthcare-life-sciences/index.d.ts.map +1 -0
- package/build/src/modeling/templates/verticals/healthcare-life-sciences/index.js +21 -0
- package/build/src/modeling/templates/verticals/healthcare-life-sciences/index.js.map +1 -0
- package/build/src/modeling/templates/verticals/index.d.ts +79 -0
- package/build/src/modeling/templates/verticals/index.d.ts.map +1 -0
- package/build/src/modeling/templates/verticals/index.js +186 -0
- package/build/src/modeling/templates/verticals/index.js.map +1 -0
- package/build/src/modeling/templates/verticals/manufacturing-logistics/index.d.ts +18 -0
- package/build/src/modeling/templates/verticals/manufacturing-logistics/index.d.ts.map +1 -0
- package/build/src/modeling/templates/verticals/manufacturing-logistics/index.js +22 -0
- package/build/src/modeling/templates/verticals/manufacturing-logistics/index.js.map +1 -0
- package/build/src/modeling/templates/verticals/manufacturing-logistics/manufacturing-domain.d.ts +45 -0
- package/build/src/modeling/templates/verticals/manufacturing-logistics/manufacturing-domain.d.ts.map +1 -0
- package/build/src/modeling/templates/verticals/manufacturing-logistics/manufacturing-domain.js +710 -0
- package/build/src/modeling/templates/verticals/manufacturing-logistics/manufacturing-domain.js.map +1 -0
- package/build/src/modeling/templates/verticals/public-sector/index.d.ts +18 -0
- package/build/src/modeling/templates/verticals/public-sector/index.d.ts.map +1 -0
- package/build/src/modeling/templates/verticals/public-sector/index.js +22 -0
- package/build/src/modeling/templates/verticals/public-sector/index.js.map +1 -0
- package/build/src/modeling/templates/verticals/public-sector/non-profit-domain.d.ts +47 -0
- package/build/src/modeling/templates/verticals/public-sector/non-profit-domain.d.ts.map +1 -0
- package/build/src/modeling/templates/verticals/public-sector/non-profit-domain.js +864 -0
- package/build/src/modeling/templates/verticals/public-sector/non-profit-domain.js.map +1 -0
- package/build/src/modeling/templates/verticals/real-estate-construction/index.d.ts +18 -0
- package/build/src/modeling/templates/verticals/real-estate-construction/index.d.ts.map +1 -0
- package/build/src/modeling/templates/verticals/real-estate-construction/index.js +21 -0
- package/build/src/modeling/templates/verticals/real-estate-construction/index.js.map +1 -0
- package/build/src/modeling/templates/verticals/real-estate-construction/real-estate-domain.d.ts +40 -0
- package/build/src/modeling/templates/verticals/real-estate-construction/real-estate-domain.d.ts.map +1 -0
- package/build/src/modeling/templates/verticals/real-estate-construction/real-estate-domain.js +727 -0
- package/build/src/modeling/templates/verticals/real-estate-construction/real-estate-domain.js.map +1 -0
- package/build/src/modeling/templates/{blog-domain.d.ts → verticals/technology-media/blog-domain.d.ts} +2 -2
- package/build/src/modeling/templates/verticals/technology-media/blog-domain.d.ts.map +1 -0
- package/build/src/modeling/templates/{blog-domain.js → verticals/technology-media/blog-domain.js} +5 -5
- package/build/src/modeling/templates/verticals/technology-media/blog-domain.js.map +1 -0
- package/build/src/modeling/templates/verticals/technology-media/gaming-domain.d.ts +46 -0
- package/build/src/modeling/templates/verticals/technology-media/gaming-domain.d.ts.map +1 -0
- package/build/src/modeling/templates/verticals/technology-media/gaming-domain.js +1033 -0
- package/build/src/modeling/templates/verticals/technology-media/gaming-domain.js.map +1 -0
- package/build/src/modeling/templates/verticals/technology-media/index.d.ts +21 -0
- package/build/src/modeling/templates/verticals/technology-media/index.d.ts.map +1 -0
- package/build/src/modeling/templates/verticals/technology-media/index.js +42 -0
- package/build/src/modeling/templates/verticals/technology-media/index.js.map +1 -0
- package/build/src/modeling/templates/verticals/technology-media/iot-smart-home-domain.d.ts +47 -0
- package/build/src/modeling/templates/verticals/technology-media/iot-smart-home-domain.d.ts.map +1 -0
- package/build/src/modeling/templates/verticals/technology-media/iot-smart-home-domain.js +1027 -0
- package/build/src/modeling/templates/verticals/technology-media/iot-smart-home-domain.js.map +1 -0
- package/build/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/modeling/helpers/Intelisense.ts +1 -0
- package/src/modeling/templates/meta/education-management-platform.json +1 -0
- package/src/modeling/templates/meta/financial-services-platform.json +1 -0
- package/src/modeling/templates/meta/gaming-platform.json +1 -0
- package/src/modeling/templates/meta/healthcare-management-platform.json +1 -0
- package/src/modeling/templates/meta/hospitality-platform.json +1 -0
- package/src/modeling/templates/meta/iot-smart-home-platform.json +1 -0
- package/src/modeling/templates/meta/legal-services-platform.json +1 -0
- package/src/modeling/templates/meta/manufacturing-platform.json +1 -0
- package/src/modeling/templates/meta/non-profit-platform.json +1 -0
- package/src/modeling/templates/meta/real-estate-management-platform.json +1 -0
- package/src/modeling/templates/readme.md +14 -0
- package/src/modeling/templates/template-registry.ts +73 -0
- package/src/modeling/templates/verticals/README.md +122 -0
- package/src/modeling/templates/{ecommerce-domain.ts → verticals/business-services/ecommerce-domain.ts} +7 -7
- package/src/modeling/templates/verticals/business-services/financial-services-domain.ts +943 -0
- package/src/modeling/templates/verticals/business-services/hospitality-domain.ts +994 -0
- package/src/modeling/templates/verticals/business-services/legal-services-domain.ts +1059 -0
- package/src/modeling/templates/verticals/education-training/education-domain.ts +922 -0
- package/src/modeling/templates/verticals/healthcare-life-sciences/healthcare-domain.ts +1111 -0
- package/src/modeling/templates/verticals/manufacturing-logistics/manufacturing-domain.ts +895 -0
- package/src/modeling/templates/verticals/public-sector/non-profit-domain.ts +1109 -0
- package/src/modeling/templates/verticals/real-estate-construction/real-estate-domain.ts +944 -0
- package/src/modeling/templates/{blog-domain.ts → verticals/technology-media/blog-domain.ts} +6 -6
- package/src/modeling/templates/verticals/technology-media/gaming-domain.ts +1290 -0
- package/src/modeling/templates/verticals/technology-media/iot-smart-home-domain.ts +1287 -0
- package/build/src/modeling/templates/blog-domain.d.ts.map +0 -1
- package/build/src/modeling/templates/blog-domain.js.map +0 -1
- package/build/src/modeling/templates/ecommerce-domain.d.ts.map +0 -1
- package/build/src/modeling/templates/ecommerce-domain.js.map +0 -1
|
@@ -0,0 +1,943 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Financial Services Data Domain Example
|
|
3
|
+
*
|
|
4
|
+
* This file demonstrates how to create a comprehensive financial services data domain
|
|
5
|
+
* using the API Client Core modeling system. It follows the business-first approach
|
|
6
|
+
* and demonstrates proper use of namespaces, models, entities, properties,
|
|
7
|
+
* associations, and semantic annotations.
|
|
8
|
+
*
|
|
9
|
+
* The example includes:
|
|
10
|
+
* - Account Management with bank accounts, investment accounts, and credit cards
|
|
11
|
+
* - Transaction Processing with payments, transfers, deposits, and withdrawals
|
|
12
|
+
* - Customer Management with KYC, risk profiles, and customer segments
|
|
13
|
+
* - Investment Portfolio with assets, positions, and performance tracking
|
|
14
|
+
* - Compliance & Reporting with regulatory reporting and audit trails
|
|
15
|
+
* - Fraud Detection with transaction monitoring and risk scoring
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* ```typescript
|
|
19
|
+
* import { createFinancialServicesDomain } from './financial-services-domain.js'
|
|
20
|
+
*
|
|
21
|
+
* const domain = createFinancialServicesDomain()
|
|
22
|
+
* console.log('Financial Services domain created with', domain.graph.nodeCount(), 'nodes')
|
|
23
|
+
* ```
|
|
24
|
+
*/
|
|
25
|
+
|
|
26
|
+
import { DataDomain } from '../../../DataDomain.js'
|
|
27
|
+
import {
|
|
28
|
+
addIdField,
|
|
29
|
+
addNameField,
|
|
30
|
+
addDescriptionField,
|
|
31
|
+
addEmailField,
|
|
32
|
+
addFirstNameField,
|
|
33
|
+
addLastNameField,
|
|
34
|
+
addPhoneField,
|
|
35
|
+
addCustomStatusField,
|
|
36
|
+
addCreatedAtField,
|
|
37
|
+
addUpdatedAtField,
|
|
38
|
+
addCurrencyAmountField,
|
|
39
|
+
} from '../../../helpers/Intelisense.js'
|
|
40
|
+
import type { CreateTemplateOptions } from '../../types.js'
|
|
41
|
+
|
|
42
|
+
function createDomain(): DataDomain {
|
|
43
|
+
return new DataDomain({
|
|
44
|
+
info: {
|
|
45
|
+
name: 'Financial Services Platform',
|
|
46
|
+
displayName: 'Financial Services Platform',
|
|
47
|
+
description:
|
|
48
|
+
'A comprehensive financial services platform with account management, transaction processing, ' +
|
|
49
|
+
'customer management, investment portfolios, and compliance features',
|
|
50
|
+
},
|
|
51
|
+
})
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Creates a comprehensive financial services data domain following domain-driven design principles.
|
|
56
|
+
*
|
|
57
|
+
* This function demonstrates the proper hierarchy and organization for a financial services platform:
|
|
58
|
+
* 1. Creates the root DataDomain for the financial services platform
|
|
59
|
+
* 2. Organizes functionality into logical namespaces (Customer Management, Account Management, etc.)
|
|
60
|
+
* 3. Groups related entities into models within each namespace
|
|
61
|
+
* 4. Defines entities with proper semantic annotations for financial workflows
|
|
62
|
+
* 5. Establishes associations with appropriate cardinality for customer-account relationships
|
|
63
|
+
*
|
|
64
|
+
* @returns A fully configured DataDomain with all financial services entities and relationships
|
|
65
|
+
*/
|
|
66
|
+
export default function createFinancialServicesDomain(options: CreateTemplateOptions = {}): DataDomain {
|
|
67
|
+
// Ensure the root data domain
|
|
68
|
+
const domain = options.domain ?? createDomain()
|
|
69
|
+
|
|
70
|
+
//
|
|
71
|
+
// 1. CUSTOMER MANAGEMENT NAMESPACE
|
|
72
|
+
//
|
|
73
|
+
const customerManagement = domain.addNamespace({
|
|
74
|
+
info: {
|
|
75
|
+
name: 'CustomerManagement',
|
|
76
|
+
displayName: 'Customer Management',
|
|
77
|
+
description: 'Customer profiles, KYC, risk assessment, and segmentation',
|
|
78
|
+
},
|
|
79
|
+
})
|
|
80
|
+
|
|
81
|
+
// Customer Model
|
|
82
|
+
const customerModel = customerManagement.addModel({
|
|
83
|
+
info: {
|
|
84
|
+
name: 'Customers',
|
|
85
|
+
displayName: 'Customer Management',
|
|
86
|
+
description: 'Customer profiles and information',
|
|
87
|
+
},
|
|
88
|
+
})
|
|
89
|
+
|
|
90
|
+
// Customer Entity
|
|
91
|
+
const customerEntity = customerModel.addEntity({
|
|
92
|
+
info: {
|
|
93
|
+
name: 'customer',
|
|
94
|
+
displayName: 'Customer',
|
|
95
|
+
description: 'Financial services customer with KYC and risk profile',
|
|
96
|
+
},
|
|
97
|
+
})
|
|
98
|
+
|
|
99
|
+
addIdField(customerEntity, { displayName: 'Customer ID', description: 'Unique identifier for the customer' })
|
|
100
|
+
|
|
101
|
+
addFirstNameField(customerEntity, { description: 'Customer first name' })
|
|
102
|
+
addLastNameField(customerEntity, { description: 'Customer last name' })
|
|
103
|
+
|
|
104
|
+
customerEntity.addProperty({
|
|
105
|
+
info: { name: 'date_of_birth', displayName: 'Date of Birth', description: 'Customer date of birth' },
|
|
106
|
+
type: 'date',
|
|
107
|
+
required: true,
|
|
108
|
+
})
|
|
109
|
+
|
|
110
|
+
customerEntity.addProperty({
|
|
111
|
+
info: { name: 'ssn', displayName: 'Social Security Number', description: 'Customer SSN for identification' },
|
|
112
|
+
type: 'string',
|
|
113
|
+
required: true,
|
|
114
|
+
writeOnly: true, // Sensitive data - write only
|
|
115
|
+
})
|
|
116
|
+
|
|
117
|
+
addEmailField(customerEntity, { description: 'Customer email address' })
|
|
118
|
+
addPhoneField(customerEntity, { description: 'Customer phone number' })
|
|
119
|
+
|
|
120
|
+
customerEntity.addProperty({
|
|
121
|
+
info: { name: 'address', displayName: 'Address', description: 'Customer residential address' },
|
|
122
|
+
type: 'string',
|
|
123
|
+
required: true,
|
|
124
|
+
})
|
|
125
|
+
|
|
126
|
+
customerEntity.addProperty({
|
|
127
|
+
info: { name: 'city', displayName: 'City', description: 'Customer city' },
|
|
128
|
+
type: 'string',
|
|
129
|
+
required: true,
|
|
130
|
+
})
|
|
131
|
+
|
|
132
|
+
customerEntity.addProperty({
|
|
133
|
+
info: { name: 'state', displayName: 'State', description: 'Customer state' },
|
|
134
|
+
type: 'string',
|
|
135
|
+
required: true,
|
|
136
|
+
})
|
|
137
|
+
|
|
138
|
+
customerEntity.addProperty({
|
|
139
|
+
info: { name: 'zip_code', displayName: 'ZIP Code', description: 'Customer ZIP code' },
|
|
140
|
+
type: 'string',
|
|
141
|
+
required: true,
|
|
142
|
+
})
|
|
143
|
+
|
|
144
|
+
addCustomStatusField(customerEntity, ['active', 'inactive', 'suspended', 'pending_verification'], {
|
|
145
|
+
displayName: 'Customer Status',
|
|
146
|
+
description: 'Current status of the customer account',
|
|
147
|
+
})
|
|
148
|
+
|
|
149
|
+
customerEntity.addProperty({
|
|
150
|
+
info: { name: 'customer_type', displayName: 'Customer Type', description: 'Type of customer account' },
|
|
151
|
+
type: 'string',
|
|
152
|
+
required: true,
|
|
153
|
+
schema: {
|
|
154
|
+
enum: ['individual', 'business', 'trust', 'partnership'],
|
|
155
|
+
},
|
|
156
|
+
})
|
|
157
|
+
|
|
158
|
+
addCreatedAtField(customerEntity, { description: 'When the customer account was created' })
|
|
159
|
+
addUpdatedAtField(customerEntity, { description: 'When the customer account was last updated' })
|
|
160
|
+
|
|
161
|
+
// KYC Entity
|
|
162
|
+
const kycEntity = customerModel.addEntity({
|
|
163
|
+
info: {
|
|
164
|
+
name: 'kyc',
|
|
165
|
+
displayName: 'KYC Record',
|
|
166
|
+
description: 'Know Your Customer verification and documentation',
|
|
167
|
+
},
|
|
168
|
+
})
|
|
169
|
+
|
|
170
|
+
addIdField(kycEntity, { displayName: 'KYC ID', description: 'Unique identifier for the KYC record' })
|
|
171
|
+
|
|
172
|
+
addCustomStatusField(kycEntity, ['pending', 'verified', 'rejected', 'expired'], {
|
|
173
|
+
displayName: 'KYC Status',
|
|
174
|
+
description: 'Current status of KYC verification',
|
|
175
|
+
})
|
|
176
|
+
|
|
177
|
+
kycEntity.addProperty({
|
|
178
|
+
info: { name: 'verification_date', displayName: 'Verification Date', description: 'Date when KYC was verified' },
|
|
179
|
+
type: 'date',
|
|
180
|
+
})
|
|
181
|
+
|
|
182
|
+
kycEntity.addProperty({
|
|
183
|
+
info: { name: 'document_type', displayName: 'Document Type', description: 'Type of identification document' },
|
|
184
|
+
type: 'string',
|
|
185
|
+
required: true,
|
|
186
|
+
schema: {
|
|
187
|
+
enum: ['passport', 'drivers_license', 'national_id', 'utility_bill', 'bank_statement'],
|
|
188
|
+
},
|
|
189
|
+
})
|
|
190
|
+
|
|
191
|
+
kycEntity.addProperty({
|
|
192
|
+
info: { name: 'document_number', displayName: 'Document Number', description: 'Document identification number' },
|
|
193
|
+
type: 'string',
|
|
194
|
+
required: true,
|
|
195
|
+
})
|
|
196
|
+
|
|
197
|
+
addCreatedAtField(kycEntity, { description: 'When the KYC record was created' })
|
|
198
|
+
|
|
199
|
+
// KYC-Customer Association (One-to-One)
|
|
200
|
+
kycEntity.addAssociation(
|
|
201
|
+
{ key: customerEntity.key },
|
|
202
|
+
{
|
|
203
|
+
info: { name: 'customer', displayName: 'Customer', description: 'Customer for this KYC record' },
|
|
204
|
+
required: true,
|
|
205
|
+
multiple: false,
|
|
206
|
+
}
|
|
207
|
+
)
|
|
208
|
+
|
|
209
|
+
// Risk Profile Entity
|
|
210
|
+
const riskProfileEntity = customerModel.addEntity({
|
|
211
|
+
info: {
|
|
212
|
+
name: 'risk_profile',
|
|
213
|
+
displayName: 'Risk Profile',
|
|
214
|
+
description: 'Customer risk assessment and scoring',
|
|
215
|
+
},
|
|
216
|
+
})
|
|
217
|
+
|
|
218
|
+
addIdField(riskProfileEntity, {
|
|
219
|
+
displayName: 'Risk Profile ID',
|
|
220
|
+
description: 'Unique identifier for the risk profile',
|
|
221
|
+
})
|
|
222
|
+
|
|
223
|
+
riskProfileEntity.addProperty({
|
|
224
|
+
info: { name: 'risk_score', displayName: 'Risk Score', description: 'Numerical risk score (1-100)' },
|
|
225
|
+
type: 'number',
|
|
226
|
+
required: true,
|
|
227
|
+
schema: {
|
|
228
|
+
minimum: 1,
|
|
229
|
+
maximum: 100,
|
|
230
|
+
},
|
|
231
|
+
})
|
|
232
|
+
|
|
233
|
+
addCustomStatusField(riskProfileEntity, ['low', 'medium', 'high', 'very_high'], {
|
|
234
|
+
displayName: 'Risk Level',
|
|
235
|
+
description: 'Risk level classification',
|
|
236
|
+
})
|
|
237
|
+
|
|
238
|
+
riskProfileEntity.addProperty({
|
|
239
|
+
info: { name: 'assessment_date', displayName: 'Assessment Date', description: 'Date when risk was assessed' },
|
|
240
|
+
type: 'date',
|
|
241
|
+
required: true,
|
|
242
|
+
})
|
|
243
|
+
|
|
244
|
+
addDescriptionField(riskProfileEntity, { description: 'Risk assessment notes and factors' })
|
|
245
|
+
|
|
246
|
+
addCreatedAtField(riskProfileEntity, { description: 'When the risk profile was created' })
|
|
247
|
+
|
|
248
|
+
// RiskProfile-Customer Association (One-to-One)
|
|
249
|
+
riskProfileEntity.addAssociation(
|
|
250
|
+
{ key: customerEntity.key },
|
|
251
|
+
{
|
|
252
|
+
info: { name: 'customer', displayName: 'Customer', description: 'Customer for this risk profile' },
|
|
253
|
+
required: true,
|
|
254
|
+
multiple: false,
|
|
255
|
+
}
|
|
256
|
+
)
|
|
257
|
+
|
|
258
|
+
//
|
|
259
|
+
// 2. ACCOUNT MANAGEMENT NAMESPACE
|
|
260
|
+
//
|
|
261
|
+
const accountManagement = domain.addNamespace({
|
|
262
|
+
info: {
|
|
263
|
+
name: 'AccountManagement',
|
|
264
|
+
displayName: 'Account Management',
|
|
265
|
+
description: 'Bank accounts, investment accounts, and credit cards',
|
|
266
|
+
},
|
|
267
|
+
})
|
|
268
|
+
|
|
269
|
+
// Account Model
|
|
270
|
+
const accountModel = accountManagement.addModel({
|
|
271
|
+
info: {
|
|
272
|
+
name: 'Accounts',
|
|
273
|
+
displayName: 'Account Management',
|
|
274
|
+
description: 'Financial accounts and products',
|
|
275
|
+
},
|
|
276
|
+
})
|
|
277
|
+
|
|
278
|
+
// Bank Account Entity
|
|
279
|
+
const bankAccountEntity = accountModel.addEntity({
|
|
280
|
+
info: {
|
|
281
|
+
name: 'bank_account',
|
|
282
|
+
displayName: 'Bank Account',
|
|
283
|
+
description: 'Checking and savings accounts',
|
|
284
|
+
},
|
|
285
|
+
})
|
|
286
|
+
|
|
287
|
+
addIdField(bankAccountEntity, { displayName: 'Account ID', description: 'Unique identifier for the account' })
|
|
288
|
+
|
|
289
|
+
bankAccountEntity.addProperty({
|
|
290
|
+
info: { name: 'account_number', displayName: 'Account Number', description: 'Bank account number' },
|
|
291
|
+
type: 'string',
|
|
292
|
+
required: true,
|
|
293
|
+
unique: true,
|
|
294
|
+
})
|
|
295
|
+
|
|
296
|
+
bankAccountEntity.addProperty({
|
|
297
|
+
info: { name: 'routing_number', displayName: 'Routing Number', description: 'Bank routing number' },
|
|
298
|
+
type: 'string',
|
|
299
|
+
required: true,
|
|
300
|
+
})
|
|
301
|
+
|
|
302
|
+
bankAccountEntity.addProperty({
|
|
303
|
+
info: { name: 'account_type', displayName: 'Account Type', description: 'Type of bank account' },
|
|
304
|
+
type: 'string',
|
|
305
|
+
required: true,
|
|
306
|
+
schema: {
|
|
307
|
+
enum: ['checking', 'savings', 'money_market', 'cd'],
|
|
308
|
+
},
|
|
309
|
+
})
|
|
310
|
+
|
|
311
|
+
addCurrencyAmountField(bankAccountEntity, 'balance', 'Account Balance', {
|
|
312
|
+
description: 'Current account balance',
|
|
313
|
+
})
|
|
314
|
+
|
|
315
|
+
addCurrencyAmountField(bankAccountEntity, 'available_balance', 'Available Balance', {
|
|
316
|
+
description: 'Available balance for transactions',
|
|
317
|
+
})
|
|
318
|
+
|
|
319
|
+
addCustomStatusField(bankAccountEntity, ['active', 'inactive', 'frozen', 'closed'], {
|
|
320
|
+
displayName: 'Account Status',
|
|
321
|
+
description: 'Current status of the account',
|
|
322
|
+
})
|
|
323
|
+
|
|
324
|
+
addCreatedAtField(bankAccountEntity, { description: 'When the account was created' })
|
|
325
|
+
addUpdatedAtField(bankAccountEntity, { description: 'When the account was last updated' })
|
|
326
|
+
|
|
327
|
+
// BankAccount-Customer Association (Many-to-One)
|
|
328
|
+
bankAccountEntity.addAssociation(
|
|
329
|
+
{ key: customerEntity.key },
|
|
330
|
+
{
|
|
331
|
+
info: { name: 'customer', displayName: 'Account Holder', description: 'Customer who owns this account' },
|
|
332
|
+
required: true,
|
|
333
|
+
multiple: false,
|
|
334
|
+
}
|
|
335
|
+
)
|
|
336
|
+
|
|
337
|
+
// Investment Account Entity
|
|
338
|
+
const investmentAccountEntity = accountModel.addEntity({
|
|
339
|
+
info: {
|
|
340
|
+
name: 'investment_account',
|
|
341
|
+
displayName: 'Investment Account',
|
|
342
|
+
description: 'Investment and brokerage accounts',
|
|
343
|
+
},
|
|
344
|
+
})
|
|
345
|
+
|
|
346
|
+
addIdField(investmentAccountEntity, {
|
|
347
|
+
displayName: 'Investment Account ID',
|
|
348
|
+
description: 'Unique identifier for the investment account',
|
|
349
|
+
})
|
|
350
|
+
|
|
351
|
+
investmentAccountEntity.addProperty({
|
|
352
|
+
info: { name: 'account_number', displayName: 'Account Number', description: 'Investment account number' },
|
|
353
|
+
type: 'string',
|
|
354
|
+
required: true,
|
|
355
|
+
unique: true,
|
|
356
|
+
})
|
|
357
|
+
|
|
358
|
+
investmentAccountEntity.addProperty({
|
|
359
|
+
info: { name: 'account_type', displayName: 'Account Type', description: 'Type of investment account' },
|
|
360
|
+
type: 'string',
|
|
361
|
+
required: true,
|
|
362
|
+
schema: {
|
|
363
|
+
enum: ['individual', 'joint', 'ira', '401k', 'roth_ira'],
|
|
364
|
+
},
|
|
365
|
+
})
|
|
366
|
+
|
|
367
|
+
addCurrencyAmountField(investmentAccountEntity, 'total_value', 'Total Portfolio Value', {
|
|
368
|
+
description: 'Total value of all investments',
|
|
369
|
+
})
|
|
370
|
+
|
|
371
|
+
addCurrencyAmountField(investmentAccountEntity, 'cash_balance', 'Cash Balance', {
|
|
372
|
+
description: 'Available cash balance',
|
|
373
|
+
})
|
|
374
|
+
|
|
375
|
+
addCustomStatusField(investmentAccountEntity, ['active', 'inactive', 'suspended', 'closed'], {
|
|
376
|
+
displayName: 'Account Status',
|
|
377
|
+
description: 'Current status of the investment account',
|
|
378
|
+
})
|
|
379
|
+
|
|
380
|
+
addCreatedAtField(investmentAccountEntity, { description: 'When the investment account was created' })
|
|
381
|
+
|
|
382
|
+
// InvestmentAccount-Customer Association (Many-to-One)
|
|
383
|
+
investmentAccountEntity.addAssociation(
|
|
384
|
+
{ key: customerEntity.key },
|
|
385
|
+
{
|
|
386
|
+
info: {
|
|
387
|
+
name: 'customer',
|
|
388
|
+
displayName: 'Account Holder',
|
|
389
|
+
description: 'Customer who owns this investment account',
|
|
390
|
+
},
|
|
391
|
+
required: true,
|
|
392
|
+
multiple: false,
|
|
393
|
+
}
|
|
394
|
+
)
|
|
395
|
+
|
|
396
|
+
// Credit Card Entity
|
|
397
|
+
const creditCardEntity = accountModel.addEntity({
|
|
398
|
+
info: {
|
|
399
|
+
name: 'credit_card',
|
|
400
|
+
displayName: 'Credit Card',
|
|
401
|
+
description: 'Credit card accounts and lines of credit',
|
|
402
|
+
},
|
|
403
|
+
})
|
|
404
|
+
|
|
405
|
+
addIdField(creditCardEntity, { displayName: 'Credit Card ID', description: 'Unique identifier for the credit card' })
|
|
406
|
+
|
|
407
|
+
creditCardEntity.addProperty({
|
|
408
|
+
info: { name: 'card_number', displayName: 'Card Number', description: 'Credit card number (masked)' },
|
|
409
|
+
type: 'string',
|
|
410
|
+
required: true,
|
|
411
|
+
writeOnly: true, // Sensitive data - write only
|
|
412
|
+
})
|
|
413
|
+
|
|
414
|
+
addCurrencyAmountField(creditCardEntity, 'credit_limit', 'Credit Limit', {
|
|
415
|
+
description: 'Total credit limit',
|
|
416
|
+
})
|
|
417
|
+
|
|
418
|
+
addCurrencyAmountField(creditCardEntity, 'available_credit', 'Available Credit', {
|
|
419
|
+
description: 'Available credit remaining',
|
|
420
|
+
})
|
|
421
|
+
|
|
422
|
+
addCurrencyAmountField(creditCardEntity, 'current_balance', 'Current Balance', {
|
|
423
|
+
description: 'Current outstanding balance',
|
|
424
|
+
})
|
|
425
|
+
|
|
426
|
+
creditCardEntity.addProperty({
|
|
427
|
+
info: { name: 'apr', displayName: 'APR', description: 'Annual Percentage Rate' },
|
|
428
|
+
type: 'number',
|
|
429
|
+
required: true,
|
|
430
|
+
schema: {
|
|
431
|
+
minimum: 0,
|
|
432
|
+
maximum: 100,
|
|
433
|
+
},
|
|
434
|
+
})
|
|
435
|
+
|
|
436
|
+
addCustomStatusField(creditCardEntity, ['active', 'inactive', 'suspended', 'closed'], {
|
|
437
|
+
displayName: 'Card Status',
|
|
438
|
+
description: 'Current status of the credit card',
|
|
439
|
+
})
|
|
440
|
+
|
|
441
|
+
addCreatedAtField(creditCardEntity, { description: 'When the credit card was created' })
|
|
442
|
+
|
|
443
|
+
// CreditCard-Customer Association (Many-to-One)
|
|
444
|
+
creditCardEntity.addAssociation(
|
|
445
|
+
{ key: customerEntity.key },
|
|
446
|
+
{
|
|
447
|
+
info: { name: 'customer', displayName: 'Cardholder', description: 'Customer who owns this credit card' },
|
|
448
|
+
required: true,
|
|
449
|
+
multiple: false,
|
|
450
|
+
}
|
|
451
|
+
)
|
|
452
|
+
|
|
453
|
+
//
|
|
454
|
+
// 3. TRANSACTION PROCESSING NAMESPACE
|
|
455
|
+
//
|
|
456
|
+
const transactionProcessing = domain.addNamespace({
|
|
457
|
+
info: {
|
|
458
|
+
name: 'TransactionProcessing',
|
|
459
|
+
displayName: 'Transaction Processing',
|
|
460
|
+
description: 'Payments, transfers, deposits, and withdrawals',
|
|
461
|
+
},
|
|
462
|
+
})
|
|
463
|
+
|
|
464
|
+
// Transaction Model
|
|
465
|
+
const transactionModel = transactionProcessing.addModel({
|
|
466
|
+
info: {
|
|
467
|
+
name: 'Transactions',
|
|
468
|
+
displayName: 'Transaction Management',
|
|
469
|
+
description: 'Financial transactions and transfers',
|
|
470
|
+
},
|
|
471
|
+
})
|
|
472
|
+
|
|
473
|
+
// Transaction Entity
|
|
474
|
+
const transactionEntity = transactionModel.addEntity({
|
|
475
|
+
info: {
|
|
476
|
+
name: 'transaction',
|
|
477
|
+
displayName: 'Transaction',
|
|
478
|
+
description: 'Financial transaction record',
|
|
479
|
+
},
|
|
480
|
+
})
|
|
481
|
+
|
|
482
|
+
addIdField(transactionEntity, { displayName: 'Transaction ID', description: 'Unique identifier for the transaction' })
|
|
483
|
+
|
|
484
|
+
transactionEntity.addProperty({
|
|
485
|
+
info: {
|
|
486
|
+
name: 'transaction_number',
|
|
487
|
+
displayName: 'Transaction Number',
|
|
488
|
+
description: 'Human-readable transaction number',
|
|
489
|
+
},
|
|
490
|
+
type: 'string',
|
|
491
|
+
required: true,
|
|
492
|
+
unique: true,
|
|
493
|
+
})
|
|
494
|
+
|
|
495
|
+
addCustomStatusField(transactionEntity, ['pending', 'processing', 'completed', 'failed', 'cancelled'], {
|
|
496
|
+
displayName: 'Transaction Status',
|
|
497
|
+
description: 'Current status of the transaction',
|
|
498
|
+
})
|
|
499
|
+
|
|
500
|
+
transactionEntity.addProperty({
|
|
501
|
+
info: { name: 'transaction_type', displayName: 'Transaction Type', description: 'Type of financial transaction' },
|
|
502
|
+
type: 'string',
|
|
503
|
+
required: true,
|
|
504
|
+
schema: {
|
|
505
|
+
enum: ['deposit', 'withdrawal', 'transfer', 'payment', 'fee'],
|
|
506
|
+
},
|
|
507
|
+
})
|
|
508
|
+
|
|
509
|
+
addCurrencyAmountField(transactionEntity, 'amount', 'Transaction Amount', {
|
|
510
|
+
description: 'Amount of the transaction',
|
|
511
|
+
})
|
|
512
|
+
|
|
513
|
+
transactionEntity.addProperty({
|
|
514
|
+
info: { name: 'description', displayName: 'Description', description: 'Transaction description' },
|
|
515
|
+
type: 'string',
|
|
516
|
+
})
|
|
517
|
+
|
|
518
|
+
transactionEntity.addProperty({
|
|
519
|
+
info: { name: 'transaction_date', displayName: 'Transaction Date', description: 'Date when transaction occurred' },
|
|
520
|
+
type: 'date',
|
|
521
|
+
required: true,
|
|
522
|
+
})
|
|
523
|
+
|
|
524
|
+
transactionEntity.addProperty({
|
|
525
|
+
info: { name: 'reference_number', displayName: 'Reference Number', description: 'External reference number' },
|
|
526
|
+
type: 'string',
|
|
527
|
+
})
|
|
528
|
+
|
|
529
|
+
addCreatedAtField(transactionEntity, { description: 'When the transaction was created' })
|
|
530
|
+
|
|
531
|
+
// Transaction-Customer Association (Many-to-One)
|
|
532
|
+
transactionEntity.addAssociation(
|
|
533
|
+
{ key: customerEntity.key },
|
|
534
|
+
{
|
|
535
|
+
info: { name: 'customer', displayName: 'Customer', description: 'Customer who initiated the transaction' },
|
|
536
|
+
required: true,
|
|
537
|
+
multiple: false,
|
|
538
|
+
}
|
|
539
|
+
)
|
|
540
|
+
|
|
541
|
+
// Transaction-Account Association (Many-to-One)
|
|
542
|
+
transactionEntity.addAssociation(
|
|
543
|
+
{ key: bankAccountEntity.key },
|
|
544
|
+
{
|
|
545
|
+
info: { name: 'account', displayName: 'Account', description: 'Account involved in the transaction' },
|
|
546
|
+
required: true,
|
|
547
|
+
multiple: false,
|
|
548
|
+
}
|
|
549
|
+
)
|
|
550
|
+
|
|
551
|
+
// Transfer Entity
|
|
552
|
+
const transferEntity = transactionModel.addEntity({
|
|
553
|
+
info: {
|
|
554
|
+
name: 'transfer',
|
|
555
|
+
displayName: 'Transfer',
|
|
556
|
+
description: 'Money transfers between accounts',
|
|
557
|
+
},
|
|
558
|
+
})
|
|
559
|
+
|
|
560
|
+
addIdField(transferEntity, { displayName: 'Transfer ID', description: 'Unique identifier for the transfer' })
|
|
561
|
+
|
|
562
|
+
addCustomStatusField(transferEntity, ['pending', 'processing', 'completed', 'failed', 'cancelled'], {
|
|
563
|
+
displayName: 'Transfer Status',
|
|
564
|
+
description: 'Current status of the transfer',
|
|
565
|
+
})
|
|
566
|
+
|
|
567
|
+
addCurrencyAmountField(transferEntity, 'amount', 'Transfer Amount', {
|
|
568
|
+
description: 'Amount being transferred',
|
|
569
|
+
})
|
|
570
|
+
|
|
571
|
+
transferEntity.addProperty({
|
|
572
|
+
info: { name: 'transfer_date', displayName: 'Transfer Date', description: 'Date when transfer was initiated' },
|
|
573
|
+
type: 'date',
|
|
574
|
+
required: true,
|
|
575
|
+
})
|
|
576
|
+
|
|
577
|
+
addCreatedAtField(transferEntity, { description: 'When the transfer was created' })
|
|
578
|
+
|
|
579
|
+
// Transfer-From Account Association (Many-to-One)
|
|
580
|
+
transferEntity.addAssociation(
|
|
581
|
+
{ key: bankAccountEntity.key },
|
|
582
|
+
{
|
|
583
|
+
info: { name: 'from_account', displayName: 'From Account', description: 'Source account for the transfer' },
|
|
584
|
+
required: true,
|
|
585
|
+
multiple: false,
|
|
586
|
+
}
|
|
587
|
+
)
|
|
588
|
+
|
|
589
|
+
// Transfer-To Account Association (Many-to-One)
|
|
590
|
+
transferEntity.addAssociation(
|
|
591
|
+
{ key: bankAccountEntity.key },
|
|
592
|
+
{
|
|
593
|
+
info: { name: 'to_account', displayName: 'To Account', description: 'Destination account for the transfer' },
|
|
594
|
+
required: true,
|
|
595
|
+
multiple: false,
|
|
596
|
+
}
|
|
597
|
+
)
|
|
598
|
+
|
|
599
|
+
//
|
|
600
|
+
// 4. INVESTMENT PORTFOLIO NAMESPACE
|
|
601
|
+
//
|
|
602
|
+
const investmentPortfolio = domain.addNamespace({
|
|
603
|
+
info: {
|
|
604
|
+
name: 'InvestmentPortfolio',
|
|
605
|
+
displayName: 'Investment Portfolio',
|
|
606
|
+
description: 'Assets, positions, and performance tracking',
|
|
607
|
+
},
|
|
608
|
+
})
|
|
609
|
+
|
|
610
|
+
// Portfolio Model
|
|
611
|
+
const portfolioModel = investmentPortfolio.addModel({
|
|
612
|
+
info: {
|
|
613
|
+
name: 'Portfolios',
|
|
614
|
+
displayName: 'Portfolio Management',
|
|
615
|
+
description: 'Investment portfolios and assets',
|
|
616
|
+
},
|
|
617
|
+
})
|
|
618
|
+
|
|
619
|
+
// Asset Entity
|
|
620
|
+
const assetEntity = portfolioModel.addEntity({
|
|
621
|
+
info: {
|
|
622
|
+
name: 'asset',
|
|
623
|
+
displayName: 'Asset',
|
|
624
|
+
description: 'Investment asset (stocks, bonds, etc.)',
|
|
625
|
+
},
|
|
626
|
+
})
|
|
627
|
+
|
|
628
|
+
addIdField(assetEntity, { displayName: 'Asset ID', description: 'Unique identifier for the asset' })
|
|
629
|
+
|
|
630
|
+
assetEntity.addProperty({
|
|
631
|
+
info: { name: 'symbol', displayName: 'Symbol', description: 'Asset symbol/ticker' },
|
|
632
|
+
type: 'string',
|
|
633
|
+
required: true,
|
|
634
|
+
unique: true,
|
|
635
|
+
})
|
|
636
|
+
|
|
637
|
+
addNameField(assetEntity, { displayName: 'Asset Name', description: 'Name of the asset' })
|
|
638
|
+
|
|
639
|
+
assetEntity.addProperty({
|
|
640
|
+
info: { name: 'asset_type', displayName: 'Asset Type', description: 'Type of investment asset' },
|
|
641
|
+
type: 'string',
|
|
642
|
+
required: true,
|
|
643
|
+
schema: {
|
|
644
|
+
enum: ['stock', 'bond', 'etf', 'mutual_fund', 'commodity', 'crypto'],
|
|
645
|
+
},
|
|
646
|
+
})
|
|
647
|
+
|
|
648
|
+
addCurrencyAmountField(assetEntity, 'current_price', 'Current Price', {
|
|
649
|
+
description: 'Current market price of the asset',
|
|
650
|
+
})
|
|
651
|
+
|
|
652
|
+
addCurrencyAmountField(assetEntity, 'market_cap', 'Market Cap', {
|
|
653
|
+
description: 'Market capitalization',
|
|
654
|
+
})
|
|
655
|
+
|
|
656
|
+
addCreatedAtField(assetEntity, { description: 'When the asset was created' })
|
|
657
|
+
|
|
658
|
+
// Position Entity
|
|
659
|
+
const positionEntity = portfolioModel.addEntity({
|
|
660
|
+
info: {
|
|
661
|
+
name: 'position',
|
|
662
|
+
displayName: 'Position',
|
|
663
|
+
description: 'Investment position in a portfolio',
|
|
664
|
+
},
|
|
665
|
+
})
|
|
666
|
+
|
|
667
|
+
addIdField(positionEntity, { displayName: 'Position ID', description: 'Unique identifier for the position' })
|
|
668
|
+
|
|
669
|
+
positionEntity.addProperty({
|
|
670
|
+
info: { name: 'quantity', displayName: 'Quantity', description: 'Number of shares/units held' },
|
|
671
|
+
type: 'number',
|
|
672
|
+
required: true,
|
|
673
|
+
schema: {
|
|
674
|
+
minimum: 0,
|
|
675
|
+
},
|
|
676
|
+
})
|
|
677
|
+
|
|
678
|
+
addCurrencyAmountField(positionEntity, 'average_cost', 'Average Cost', {
|
|
679
|
+
description: 'Average cost per share/unit',
|
|
680
|
+
})
|
|
681
|
+
|
|
682
|
+
addCurrencyAmountField(positionEntity, 'current_value', 'Current Value', {
|
|
683
|
+
description: 'Current market value of the position',
|
|
684
|
+
})
|
|
685
|
+
|
|
686
|
+
addCurrencyAmountField(positionEntity, 'unrealized_gain_loss', 'Unrealized Gain/Loss', {
|
|
687
|
+
description: 'Unrealized profit or loss',
|
|
688
|
+
})
|
|
689
|
+
|
|
690
|
+
addCreatedAtField(positionEntity, { description: 'When the position was created' })
|
|
691
|
+
|
|
692
|
+
// Position-InvestmentAccount Association (Many-to-One)
|
|
693
|
+
positionEntity.addAssociation(
|
|
694
|
+
{ key: investmentAccountEntity.key },
|
|
695
|
+
{
|
|
696
|
+
info: { name: 'account', displayName: 'Investment Account', description: 'Account holding this position' },
|
|
697
|
+
required: true,
|
|
698
|
+
multiple: false,
|
|
699
|
+
}
|
|
700
|
+
)
|
|
701
|
+
|
|
702
|
+
// Position-Asset Association (Many-to-One)
|
|
703
|
+
positionEntity.addAssociation(
|
|
704
|
+
{ key: assetEntity.key },
|
|
705
|
+
{
|
|
706
|
+
info: { name: 'asset', displayName: 'Asset', description: 'Asset for this position' },
|
|
707
|
+
required: true,
|
|
708
|
+
multiple: false,
|
|
709
|
+
}
|
|
710
|
+
)
|
|
711
|
+
|
|
712
|
+
// Performance Entity
|
|
713
|
+
const performanceEntity = portfolioModel.addEntity({
|
|
714
|
+
info: {
|
|
715
|
+
name: 'performance',
|
|
716
|
+
displayName: 'Performance',
|
|
717
|
+
description: 'Portfolio performance tracking',
|
|
718
|
+
},
|
|
719
|
+
})
|
|
720
|
+
|
|
721
|
+
addIdField(performanceEntity, {
|
|
722
|
+
displayName: 'Performance ID',
|
|
723
|
+
description: 'Unique identifier for the performance record',
|
|
724
|
+
})
|
|
725
|
+
|
|
726
|
+
performanceEntity.addProperty({
|
|
727
|
+
info: { name: 'date', displayName: 'Date', description: 'Date of performance measurement' },
|
|
728
|
+
type: 'date',
|
|
729
|
+
required: true,
|
|
730
|
+
})
|
|
731
|
+
|
|
732
|
+
addCurrencyAmountField(performanceEntity, 'total_value', 'Total Value', {
|
|
733
|
+
description: 'Total portfolio value on this date',
|
|
734
|
+
})
|
|
735
|
+
|
|
736
|
+
performanceEntity.addProperty({
|
|
737
|
+
info: { name: 'return_percentage', displayName: 'Return Percentage', description: 'Percentage return' },
|
|
738
|
+
type: 'number',
|
|
739
|
+
required: true,
|
|
740
|
+
schema: {
|
|
741
|
+
minimum: -100,
|
|
742
|
+
maximum: 1000,
|
|
743
|
+
},
|
|
744
|
+
})
|
|
745
|
+
|
|
746
|
+
addCreatedAtField(performanceEntity, { description: 'When the performance record was created' })
|
|
747
|
+
|
|
748
|
+
// Performance-InvestmentAccount Association (Many-to-One)
|
|
749
|
+
performanceEntity.addAssociation(
|
|
750
|
+
{ key: investmentAccountEntity.key },
|
|
751
|
+
{
|
|
752
|
+
info: { name: 'account', displayName: 'Investment Account', description: 'Account for this performance record' },
|
|
753
|
+
required: true,
|
|
754
|
+
multiple: false,
|
|
755
|
+
}
|
|
756
|
+
)
|
|
757
|
+
|
|
758
|
+
//
|
|
759
|
+
// 5. COMPLIANCE & REPORTING NAMESPACE
|
|
760
|
+
//
|
|
761
|
+
const complianceReporting = domain.addNamespace({
|
|
762
|
+
info: {
|
|
763
|
+
name: 'ComplianceReporting',
|
|
764
|
+
displayName: 'Compliance & Reporting',
|
|
765
|
+
description: 'Regulatory reporting and audit trails',
|
|
766
|
+
},
|
|
767
|
+
})
|
|
768
|
+
|
|
769
|
+
// Compliance Model
|
|
770
|
+
const complianceModel = complianceReporting.addModel({
|
|
771
|
+
info: {
|
|
772
|
+
name: 'Compliance',
|
|
773
|
+
displayName: 'Compliance Management',
|
|
774
|
+
description: 'Regulatory compliance and reporting',
|
|
775
|
+
},
|
|
776
|
+
})
|
|
777
|
+
|
|
778
|
+
// Audit Trail Entity
|
|
779
|
+
const auditTrailEntity = complianceModel.addEntity({
|
|
780
|
+
info: {
|
|
781
|
+
name: 'audit_trail',
|
|
782
|
+
displayName: 'Audit Trail',
|
|
783
|
+
description: 'System audit trail for compliance',
|
|
784
|
+
},
|
|
785
|
+
})
|
|
786
|
+
|
|
787
|
+
addIdField(auditTrailEntity, { displayName: 'Audit ID', description: 'Unique identifier for the audit record' })
|
|
788
|
+
|
|
789
|
+
auditTrailEntity.addProperty({
|
|
790
|
+
info: { name: 'action', displayName: 'Action', description: 'Action performed' },
|
|
791
|
+
type: 'string',
|
|
792
|
+
required: true,
|
|
793
|
+
})
|
|
794
|
+
|
|
795
|
+
auditTrailEntity.addProperty({
|
|
796
|
+
info: { name: 'entity_type', displayName: 'Entity Type', description: 'Type of entity affected' },
|
|
797
|
+
type: 'string',
|
|
798
|
+
required: true,
|
|
799
|
+
})
|
|
800
|
+
|
|
801
|
+
auditTrailEntity.addProperty({
|
|
802
|
+
info: { name: 'entity_id', displayName: 'Entity ID', description: 'ID of the affected entity' },
|
|
803
|
+
type: 'string',
|
|
804
|
+
required: true,
|
|
805
|
+
})
|
|
806
|
+
|
|
807
|
+
auditTrailEntity.addProperty({
|
|
808
|
+
info: { name: 'user_id', displayName: 'User ID', description: 'User who performed the action' },
|
|
809
|
+
type: 'string',
|
|
810
|
+
required: true,
|
|
811
|
+
})
|
|
812
|
+
|
|
813
|
+
auditTrailEntity.addProperty({
|
|
814
|
+
info: { name: 'ip_address', displayName: 'IP Address', description: 'IP address of the user' },
|
|
815
|
+
type: 'string',
|
|
816
|
+
})
|
|
817
|
+
|
|
818
|
+
addDescriptionField(auditTrailEntity, { description: 'Additional details about the action' })
|
|
819
|
+
|
|
820
|
+
addCreatedAtField(auditTrailEntity, {
|
|
821
|
+
name: 'timestamp',
|
|
822
|
+
displayName: 'Timestamp',
|
|
823
|
+
description: 'When the action occurred',
|
|
824
|
+
})
|
|
825
|
+
|
|
826
|
+
// Regulatory Report Entity
|
|
827
|
+
const regulatoryReportEntity = complianceModel.addEntity({
|
|
828
|
+
info: {
|
|
829
|
+
name: 'regulatory_report',
|
|
830
|
+
displayName: 'Regulatory Report',
|
|
831
|
+
description: 'Regulatory reporting requirements',
|
|
832
|
+
},
|
|
833
|
+
})
|
|
834
|
+
|
|
835
|
+
addIdField(regulatoryReportEntity, { displayName: 'Report ID', description: 'Unique identifier for the report' })
|
|
836
|
+
|
|
837
|
+
addNameField(regulatoryReportEntity, { displayName: 'Report Name', description: 'Name of the regulatory report' })
|
|
838
|
+
|
|
839
|
+
addCustomStatusField(regulatoryReportEntity, ['draft', 'submitted', 'approved', 'rejected'], {
|
|
840
|
+
displayName: 'Report Status',
|
|
841
|
+
description: 'Current status of the report',
|
|
842
|
+
})
|
|
843
|
+
|
|
844
|
+
regulatoryReportEntity.addProperty({
|
|
845
|
+
info: { name: 'report_type', displayName: 'Report Type', description: 'Type of regulatory report' },
|
|
846
|
+
type: 'string',
|
|
847
|
+
required: true,
|
|
848
|
+
schema: {
|
|
849
|
+
enum: ['suspicious_activity', 'large_transaction', 'annual_report', 'quarterly_report'],
|
|
850
|
+
},
|
|
851
|
+
})
|
|
852
|
+
|
|
853
|
+
regulatoryReportEntity.addProperty({
|
|
854
|
+
info: { name: 'reporting_period', displayName: 'Reporting Period', description: 'Period covered by the report' },
|
|
855
|
+
type: 'string',
|
|
856
|
+
required: true,
|
|
857
|
+
})
|
|
858
|
+
|
|
859
|
+
addDescriptionField(regulatoryReportEntity, { description: 'Report content and details' })
|
|
860
|
+
|
|
861
|
+
addCreatedAtField(regulatoryReportEntity, { description: 'When the report was created' })
|
|
862
|
+
|
|
863
|
+
//
|
|
864
|
+
// 6. FRAUD DETECTION NAMESPACE
|
|
865
|
+
//
|
|
866
|
+
const fraudDetection = domain.addNamespace({
|
|
867
|
+
info: {
|
|
868
|
+
name: 'FraudDetection',
|
|
869
|
+
displayName: 'Fraud Detection',
|
|
870
|
+
description: 'Transaction monitoring and risk scoring',
|
|
871
|
+
},
|
|
872
|
+
})
|
|
873
|
+
|
|
874
|
+
// Fraud Detection Model
|
|
875
|
+
const fraudDetectionModel = fraudDetection.addModel({
|
|
876
|
+
info: {
|
|
877
|
+
name: 'FraudDetection',
|
|
878
|
+
displayName: 'Fraud Detection Management',
|
|
879
|
+
description: 'Fraud detection and monitoring',
|
|
880
|
+
},
|
|
881
|
+
})
|
|
882
|
+
|
|
883
|
+
// Fraud Alert Entity
|
|
884
|
+
const fraudAlertEntity = fraudDetectionModel.addEntity({
|
|
885
|
+
info: {
|
|
886
|
+
name: 'fraud_alert',
|
|
887
|
+
displayName: 'Fraud Alert',
|
|
888
|
+
description: 'Fraud detection alerts and flags',
|
|
889
|
+
},
|
|
890
|
+
})
|
|
891
|
+
|
|
892
|
+
addIdField(fraudAlertEntity, { displayName: 'Alert ID', description: 'Unique identifier for the fraud alert' })
|
|
893
|
+
|
|
894
|
+
addCustomStatusField(fraudAlertEntity, ['pending', 'investigating', 'resolved', 'false_positive'], {
|
|
895
|
+
displayName: 'Alert Status',
|
|
896
|
+
description: 'Current status of the fraud alert',
|
|
897
|
+
})
|
|
898
|
+
|
|
899
|
+
fraudAlertEntity.addProperty({
|
|
900
|
+
info: { name: 'alert_type', displayName: 'Alert Type', description: 'Type of fraud alert' },
|
|
901
|
+
type: 'string',
|
|
902
|
+
required: true,
|
|
903
|
+
schema: {
|
|
904
|
+
enum: ['suspicious_transaction', 'unusual_pattern', 'identity_theft', 'account_takeover'],
|
|
905
|
+
},
|
|
906
|
+
})
|
|
907
|
+
|
|
908
|
+
fraudAlertEntity.addProperty({
|
|
909
|
+
info: { name: 'risk_score', displayName: 'Risk Score', description: 'Risk score (1-100)' },
|
|
910
|
+
type: 'number',
|
|
911
|
+
required: true,
|
|
912
|
+
schema: {
|
|
913
|
+
minimum: 1,
|
|
914
|
+
maximum: 100,
|
|
915
|
+
},
|
|
916
|
+
})
|
|
917
|
+
|
|
918
|
+
addDescriptionField(fraudAlertEntity, { description: 'Details about the fraud alert' })
|
|
919
|
+
|
|
920
|
+
addCreatedAtField(fraudAlertEntity, { description: 'When the fraud alert was created' })
|
|
921
|
+
|
|
922
|
+
// FraudAlert-Transaction Association (Many-to-One)
|
|
923
|
+
fraudAlertEntity.addAssociation(
|
|
924
|
+
{ key: transactionEntity.key },
|
|
925
|
+
{
|
|
926
|
+
info: { name: 'transaction', displayName: 'Transaction', description: 'Transaction that triggered the alert' },
|
|
927
|
+
required: false,
|
|
928
|
+
multiple: false,
|
|
929
|
+
}
|
|
930
|
+
)
|
|
931
|
+
|
|
932
|
+
// FraudAlert-Customer Association (Many-to-One)
|
|
933
|
+
fraudAlertEntity.addAssociation(
|
|
934
|
+
{ key: customerEntity.key },
|
|
935
|
+
{
|
|
936
|
+
info: { name: 'customer', displayName: 'Customer', description: 'Customer associated with the alert' },
|
|
937
|
+
required: true,
|
|
938
|
+
multiple: false,
|
|
939
|
+
}
|
|
940
|
+
)
|
|
941
|
+
|
|
942
|
+
return domain
|
|
943
|
+
}
|