@api-client/core 0.18.56 → 0.18.57

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