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