@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,1289 +0,0 @@
1
- /**
2
- * IoT/Smart Home Domain Template
3
- *
4
- * A comprehensive IoT/Smart Home data domain following domain-driven design principles.
5
- * This template covers the complete IoT ecosystem lifecycle including:
6
- *
7
- * - Device Management: Devices, sensors, connectivity, firmware
8
- * - Data Collection: Sensor data, telemetry, analytics
9
- * - Automation: Rules, triggers, actions, schedules
10
- * - User Management: Users, permissions, device access
11
- * - Monitoring: Alerts, notifications, health status
12
- * - Integration: Third-party services, APIs, protocols
13
- *
14
- * Key Features:
15
- * - Complete device lifecycle management
16
- * - Real-time data collection and analytics
17
- * - Smart automation and rules engine
18
- * - User access and permission management
19
- * - System monitoring and alerting
20
- * - Third-party service integration
21
- * - IoT ecosystem management
22
- *
23
- * Use Cases:
24
- * - Smart home systems
25
- * - IoT device management
26
- * - Home automation
27
- * - Sensor data analytics
28
- * - Device monitoring and maintenance
29
- * - User access control
30
- * - Third-party integrations
31
- */
32
-
33
- import { DataDomain } from '../../../DataDomain.js'
34
- import {
35
- addIdField,
36
- addNameField,
37
- addDescriptionField,
38
- addEmailField,
39
- addPhoneField,
40
- addCustomStatusField,
41
- addCreatedAtField,
42
- addUpdatedAtField,
43
- } from '../../../helpers/Intelisense.js'
44
- import { SemanticType } from '../../../Semantics.js'
45
- import type { CreateTemplateOptions } from '../../types.js'
46
-
47
- function createDomain(): DataDomain {
48
- return new DataDomain({
49
- info: {
50
- name: 'IoT Smart Home Platform',
51
- displayName: 'IoT Smart Home Platform',
52
- description:
53
- 'A comprehensive IoT/Smart Home platform with device management, data collection, ' +
54
- 'automation, user management, monitoring, and integration',
55
- },
56
- })
57
- }
58
-
59
- /**
60
- * Creates a comprehensive IoT/Smart Home data domain following domain-driven design principles.
61
- *
62
- * This function demonstrates the proper hierarchy and organization for an IoT/Smart Home platform:
63
- * 1. Creates the root DataDomain for the IoT/Smart Home platform
64
- * 2. Organizes functionality into logical namespaces (Device Management, Data Collection, etc.)
65
- * 3. Groups related entities into models within each namespace
66
- * 4. Defines entities with proper semantic annotations for IoT workflows
67
- * 5. Establishes associations with appropriate cardinality for IoT relationships
68
- *
69
- * @returns A fully configured DataDomain with all IoT/Smart Home entities and relationships
70
- */
71
- export default function createIoTSmartHomeDomain(options: CreateTemplateOptions = {}): DataDomain {
72
- // Ensure the root data domain
73
- const domain = options.domain ?? createDomain()
74
-
75
- //
76
- // 1. DEVICE MANAGEMENT NAMESPACE
77
- //
78
- const deviceManagement = domain.addNamespace({
79
- info: {
80
- name: 'DeviceManagement',
81
- displayName: 'Device Management',
82
- description: 'Devices, sensors, connectivity, and firmware',
83
- },
84
- })
85
-
86
- // Device Model
87
- const deviceModel = deviceManagement.addModel({
88
- info: {
89
- name: 'Devices',
90
- displayName: 'Device Management',
91
- description: 'IoT devices and sensors',
92
- },
93
- })
94
-
95
- // Device Entity
96
- const deviceEntity = deviceModel.addEntity({
97
- info: {
98
- name: 'device',
99
- displayName: 'Device',
100
- description: 'IoT device with sensors and capabilities',
101
- },
102
- })
103
-
104
- addIdField(deviceEntity, { displayName: 'Device ID', description: 'Unique identifier for the device' })
105
-
106
- addNameField(deviceEntity, { description: 'Device name and model' })
107
-
108
- addDescriptionField(deviceEntity, { description: 'Device description and capabilities' })
109
-
110
- deviceEntity.addProperty({
111
- info: { name: 'device_type', displayName: 'Device Type', description: 'Type of IoT device' },
112
- type: 'string',
113
- required: true,
114
- schema: {
115
- enum: [
116
- 'sensor',
117
- 'actuator',
118
- 'controller',
119
- 'gateway',
120
- 'camera',
121
- 'thermostat',
122
- 'light',
123
- 'lock',
124
- 'appliance',
125
- 'speaker',
126
- ],
127
- },
128
- })
129
-
130
- deviceEntity.addProperty({
131
- info: { name: 'manufacturer', displayName: 'Manufacturer', description: 'Device manufacturer' },
132
- type: 'string',
133
- required: true,
134
- })
135
-
136
- deviceEntity.addProperty({
137
- info: { name: 'model', displayName: 'Model', description: 'Device model' },
138
- type: 'string',
139
- required: true,
140
- })
141
-
142
- deviceEntity.addProperty({
143
- info: { name: 'serial_number', displayName: 'Serial Number', description: 'Device serial number' },
144
- type: 'string',
145
- required: true,
146
- unique: true,
147
- })
148
-
149
- deviceEntity.addProperty({
150
- info: { name: 'mac_address', displayName: 'MAC Address', description: 'Device MAC address' },
151
- type: 'string',
152
- required: true,
153
- unique: true,
154
- })
155
-
156
- deviceEntity.addProperty({
157
- info: { name: 'ip_address', displayName: 'IP Address', description: 'Device IP address' },
158
- type: 'string',
159
- required: false,
160
- semantics: [{ id: SemanticType.ClientIPAddress }],
161
- })
162
-
163
- deviceEntity.addProperty({
164
- info: { name: 'location', displayName: 'Location', description: 'Device location in home' },
165
- type: 'string',
166
- required: false,
167
- })
168
-
169
- deviceEntity.addProperty({
170
- info: { name: 'firmware_version', displayName: 'Firmware Version', description: 'Current firmware version' },
171
- type: 'string',
172
- required: true,
173
- })
174
-
175
- addCustomStatusField(deviceEntity, ['online', 'offline', 'maintenance', 'error', 'updating'], {
176
- displayName: 'Device Status',
177
- description: 'Current status of the device',
178
- })
179
-
180
- addCreatedAtField(deviceEntity, { description: 'When the device was created' })
181
- addUpdatedAtField(deviceEntity, { description: 'When the device was last updated' })
182
-
183
- // Sensor Entity
184
- const sensorEntity = deviceModel.addEntity({
185
- info: {
186
- name: 'sensor',
187
- displayName: 'Sensor',
188
- description: 'IoT sensor with measurement capabilities',
189
- },
190
- })
191
-
192
- addIdField(sensorEntity, { displayName: 'Sensor ID', description: 'Unique identifier for the sensor' })
193
-
194
- addNameField(sensorEntity, { description: 'Sensor name and type' })
195
-
196
- addDescriptionField(sensorEntity, { description: 'Sensor description and capabilities' })
197
-
198
- sensorEntity.addProperty({
199
- info: { name: 'sensor_type', displayName: 'Sensor Type', description: 'Type of sensor' },
200
- type: 'string',
201
- required: true,
202
- schema: {
203
- enum: [
204
- 'temperature',
205
- 'humidity',
206
- 'pressure',
207
- 'motion',
208
- 'light',
209
- 'sound',
210
- 'air_quality',
211
- 'water_level',
212
- 'smoke',
213
- 'carbon_monoxide',
214
- ],
215
- },
216
- })
217
-
218
- sensorEntity.addProperty({
219
- info: { name: 'measurement_unit', displayName: 'Measurement Unit', description: 'Unit of measurement' },
220
- type: 'string',
221
- required: true,
222
- })
223
-
224
- sensorEntity.addProperty({
225
- info: { name: 'min_value', displayName: 'Minimum Value', description: 'Minimum measurement value' },
226
- type: 'number',
227
- required: false,
228
- })
229
-
230
- sensorEntity.addProperty({
231
- info: { name: 'max_value', displayName: 'Maximum Value', description: 'Maximum measurement value' },
232
- type: 'number',
233
- required: false,
234
- })
235
-
236
- addCustomStatusField(sensorEntity, ['active', 'inactive', 'calibrating', 'error'], {
237
- displayName: 'Sensor Status',
238
- description: 'Current status of the sensor',
239
- })
240
-
241
- addCreatedAtField(sensorEntity, { description: 'When the sensor was created' })
242
-
243
- // Sensor-Device Association (Many-to-One)
244
- sensorEntity.addAssociation(
245
- { key: deviceEntity.key },
246
- {
247
- info: { name: 'device', displayName: 'Device', description: 'Device for this sensor' },
248
- required: true,
249
- multiple: false,
250
- }
251
- )
252
-
253
- // Firmware Entity
254
- const firmwareEntity = deviceModel.addEntity({
255
- info: {
256
- name: 'firmware',
257
- displayName: 'Firmware',
258
- description: 'Device firmware versions and updates',
259
- },
260
- })
261
-
262
- addIdField(firmwareEntity, { displayName: 'Firmware ID', description: 'Unique identifier for the firmware' })
263
-
264
- addNameField(firmwareEntity, { description: 'Firmware name and version' })
265
-
266
- addDescriptionField(firmwareEntity, { description: 'Firmware description and changes' })
267
-
268
- firmwareEntity.addProperty({
269
- info: { name: 'version', displayName: 'Version', description: 'Firmware version number' },
270
- type: 'string',
271
- required: true,
272
- })
273
-
274
- firmwareEntity.addProperty({
275
- info: { name: 'release_date', displayName: 'Release Date', description: 'Firmware release date' },
276
- type: 'date',
277
- required: true,
278
- })
279
-
280
- firmwareEntity.addProperty({
281
- info: { name: 'file_size', displayName: 'File Size', description: 'Firmware file size in bytes' },
282
- type: 'number',
283
- required: true,
284
- schema: {
285
- minimum: 0,
286
- },
287
- })
288
-
289
- firmwareEntity.addProperty({
290
- info: { name: 'compatibility', displayName: 'Compatibility', description: 'Compatible device models' },
291
- type: 'string',
292
- required: true,
293
- })
294
-
295
- addCustomStatusField(firmwareEntity, ['available', 'installing', 'installed', 'failed'], {
296
- displayName: 'Firmware Status',
297
- description: 'Current status of the firmware',
298
- })
299
-
300
- addCreatedAtField(firmwareEntity, { description: 'When the firmware was created' })
301
-
302
- // Firmware-Device Association (Many-to-One)
303
- firmwareEntity.addAssociation(
304
- { key: deviceEntity.key },
305
- {
306
- info: { name: 'device', displayName: 'Device', description: 'Device for this firmware' },
307
- required: true,
308
- multiple: false,
309
- }
310
- )
311
-
312
- //
313
- // 2. DATA COLLECTION NAMESPACE
314
- //
315
- const dataCollection = domain.addNamespace({
316
- info: {
317
- name: 'DataCollection',
318
- displayName: 'Data Collection',
319
- description: 'Sensor data, telemetry, and analytics',
320
- },
321
- })
322
-
323
- // Data Model
324
- const dataModel = dataCollection.addModel({
325
- info: {
326
- name: 'Data',
327
- displayName: 'Data Collection',
328
- description: 'Sensor data and telemetry',
329
- },
330
- })
331
-
332
- // Sensor Data Entity
333
- const sensorDataEntity = dataModel.addEntity({
334
- info: {
335
- name: 'sensor_data',
336
- displayName: 'Sensor Data',
337
- description: 'Sensor measurement data',
338
- },
339
- })
340
-
341
- addIdField(sensorDataEntity, { displayName: 'Data ID', description: 'Unique identifier for the sensor data' })
342
-
343
- addNameField(sensorDataEntity, { description: 'Data name and description' })
344
-
345
- sensorDataEntity.addProperty({
346
- info: { name: 'timestamp', displayName: 'Timestamp', description: 'Data timestamp' },
347
- type: 'datetime',
348
- required: true,
349
- })
350
-
351
- sensorDataEntity.addProperty({
352
- info: { name: 'value', displayName: 'Value', description: 'Sensor measurement value' },
353
- type: 'number',
354
- required: true,
355
- })
356
-
357
- sensorDataEntity.addProperty({
358
- info: { name: 'unit', displayName: 'Unit', description: 'Measurement unit' },
359
- type: 'string',
360
- required: true,
361
- })
362
-
363
- sensorDataEntity.addProperty({
364
- info: { name: 'quality', displayName: 'Quality', description: 'Data quality indicator' },
365
- type: 'string',
366
- required: true,
367
- schema: {
368
- enum: ['excellent', 'good', 'fair', 'poor'],
369
- },
370
- })
371
-
372
- addCustomStatusField(sensorDataEntity, ['raw', 'processed', 'archived'], {
373
- displayName: 'Data Status',
374
- description: 'Current status of the sensor data',
375
- })
376
-
377
- addCreatedAtField(sensorDataEntity, { description: 'When the data was created' })
378
-
379
- // SensorData-Sensor Association (Many-to-One)
380
- sensorDataEntity.addAssociation(
381
- { key: sensorEntity.key },
382
- {
383
- info: { name: 'sensor', displayName: 'Sensor', description: 'Sensor for this data' },
384
- required: true,
385
- multiple: false,
386
- }
387
- )
388
-
389
- // Telemetry Entity
390
- const telemetryEntity = dataModel.addEntity({
391
- info: {
392
- name: 'telemetry',
393
- displayName: 'Telemetry',
394
- description: 'Device telemetry and system metrics',
395
- },
396
- })
397
-
398
- addIdField(telemetryEntity, { displayName: 'Telemetry ID', description: 'Unique identifier for the telemetry' })
399
-
400
- addNameField(telemetryEntity, { description: 'Telemetry name and description' })
401
-
402
- telemetryEntity.addProperty({
403
- info: { name: 'timestamp', displayName: 'Timestamp', description: 'Telemetry timestamp' },
404
- type: 'datetime',
405
- required: true,
406
- })
407
-
408
- telemetryEntity.addProperty({
409
- info: { name: 'metric_type', displayName: 'Metric Type', description: 'Type of telemetry metric' },
410
- type: 'string',
411
- required: true,
412
- schema: {
413
- enum: ['cpu_usage', 'memory_usage', 'network_traffic', 'battery_level', 'signal_strength', 'temperature'],
414
- },
415
- })
416
-
417
- telemetryEntity.addProperty({
418
- info: { name: 'value', displayName: 'Value', description: 'Telemetry value' },
419
- type: 'number',
420
- required: true,
421
- })
422
-
423
- telemetryEntity.addProperty({
424
- info: { name: 'unit', displayName: 'Unit', description: 'Measurement unit' },
425
- type: 'string',
426
- required: true,
427
- })
428
-
429
- addCustomStatusField(telemetryEntity, ['normal', 'warning', 'critical'], {
430
- displayName: 'Telemetry Status',
431
- description: 'Current status of the telemetry',
432
- })
433
-
434
- addCreatedAtField(telemetryEntity, { description: 'When the telemetry was created' })
435
-
436
- // Telemetry-Device Association (Many-to-One)
437
- telemetryEntity.addAssociation(
438
- { key: deviceEntity.key },
439
- {
440
- info: { name: 'device', displayName: 'Device', description: 'Device for this telemetry' },
441
- required: true,
442
- multiple: false,
443
- }
444
- )
445
-
446
- // Analytics Entity
447
- const analyticsEntity = dataModel.addEntity({
448
- info: {
449
- name: 'analytics',
450
- displayName: 'Analytics',
451
- description: 'Data analytics and insights',
452
- },
453
- })
454
-
455
- addIdField(analyticsEntity, { displayName: 'Analytics ID', description: 'Unique identifier for the analytics' })
456
-
457
- addNameField(analyticsEntity, { description: 'Analytics name and description' })
458
-
459
- addDescriptionField(analyticsEntity, { description: 'Analytics description and insights' })
460
-
461
- analyticsEntity.addProperty({
462
- info: { name: 'analytics_type', displayName: 'Analytics Type', description: 'Type of analytics' },
463
- type: 'string',
464
- required: true,
465
- schema: {
466
- enum: ['trend_analysis', 'pattern_recognition', 'anomaly_detection', 'predictive_modeling', 'usage_statistics'],
467
- },
468
- })
469
-
470
- analyticsEntity.addProperty({
471
- info: { name: 'time_period', displayName: 'Time Period', description: 'Analytics time period' },
472
- type: 'string',
473
- required: true,
474
- schema: {
475
- enum: ['hourly', 'daily', 'weekly', 'monthly', 'yearly'],
476
- },
477
- })
478
-
479
- analyticsEntity.addProperty({
480
- info: { name: 'start_date', displayName: 'Start Date', description: 'Analytics start date' },
481
- type: 'date',
482
- required: true,
483
- })
484
-
485
- analyticsEntity.addProperty({
486
- info: { name: 'end_date', displayName: 'End Date', description: 'Analytics end date' },
487
- type: 'date',
488
- required: true,
489
- })
490
-
491
- addCustomStatusField(analyticsEntity, ['processing', 'completed', 'failed'], {
492
- displayName: 'Analytics Status',
493
- description: 'Current status of the analytics',
494
- })
495
-
496
- addCreatedAtField(analyticsEntity, { description: 'When the analytics was created' })
497
-
498
- //
499
- // 3. AUTOMATION NAMESPACE
500
- //
501
- const automation = domain.addNamespace({
502
- info: {
503
- name: 'Automation',
504
- displayName: 'Automation',
505
- description: 'Rules, triggers, actions, and schedules',
506
- },
507
- })
508
-
509
- // Automation Model
510
- const automationModel = automation.addModel({
511
- info: {
512
- name: 'Automation',
513
- displayName: 'Automation Management',
514
- description: 'Automation rules and schedules',
515
- },
516
- })
517
-
518
- // Rule Entity
519
- const ruleEntity = automationModel.addEntity({
520
- info: {
521
- name: 'rule',
522
- displayName: 'Rule',
523
- description: 'Automation rule with conditions and actions',
524
- },
525
- })
526
-
527
- addIdField(ruleEntity, { displayName: 'Rule ID', description: 'Unique identifier for the rule' })
528
-
529
- addNameField(ruleEntity, { description: 'Rule name and description' })
530
-
531
- addDescriptionField(ruleEntity, { description: 'Rule description and logic' })
532
-
533
- ruleEntity.addProperty({
534
- info: { name: 'rule_type', displayName: 'Rule Type', description: 'Type of automation rule' },
535
- type: 'string',
536
- required: true,
537
- schema: {
538
- enum: ['if_then', 'schedule', 'location_based', 'time_based', 'condition_based'],
539
- },
540
- })
541
-
542
- ruleEntity.addProperty({
543
- info: { name: 'condition', displayName: 'Condition', description: 'Rule condition logic' },
544
- type: 'string',
545
- required: true,
546
- })
547
-
548
- ruleEntity.addProperty({
549
- info: { name: 'action', displayName: 'Action', description: 'Rule action to execute' },
550
- type: 'string',
551
- required: true,
552
- })
553
-
554
- ruleEntity.addProperty({
555
- info: { name: 'priority', displayName: 'Priority', description: 'Rule priority level' },
556
- type: 'string',
557
- required: true,
558
- schema: {
559
- enum: ['low', 'medium', 'high', 'critical'],
560
- },
561
- })
562
-
563
- addCustomStatusField(ruleEntity, ['active', 'inactive', 'testing', 'error'], {
564
- displayName: 'Rule Status',
565
- description: 'Current status of the rule',
566
- })
567
-
568
- addCreatedAtField(ruleEntity, { description: 'When the rule was created' })
569
-
570
- // Trigger Entity
571
- const triggerEntity = automationModel.addEntity({
572
- info: {
573
- name: 'trigger',
574
- displayName: 'Trigger',
575
- description: 'Automation trigger event',
576
- },
577
- })
578
-
579
- addIdField(triggerEntity, { displayName: 'Trigger ID', description: 'Unique identifier for the trigger' })
580
-
581
- addNameField(triggerEntity, { description: 'Trigger name and description' })
582
-
583
- addDescriptionField(triggerEntity, { description: 'Trigger description and conditions' })
584
-
585
- triggerEntity.addProperty({
586
- info: { name: 'trigger_type', displayName: 'Trigger Type', description: 'Type of trigger' },
587
- type: 'string',
588
- required: true,
589
- schema: {
590
- enum: ['sensor_threshold', 'time_schedule', 'location_change', 'device_state', 'user_action'],
591
- },
592
- })
593
-
594
- triggerEntity.addProperty({
595
- info: { name: 'condition', displayName: 'Condition', description: 'Trigger condition' },
596
- type: 'string',
597
- required: true,
598
- })
599
-
600
- triggerEntity.addProperty({
601
- info: { name: 'frequency', displayName: 'Frequency', description: 'Trigger frequency' },
602
- type: 'string',
603
- required: false,
604
- schema: {
605
- enum: ['once', 'recurring', 'continuous'],
606
- },
607
- })
608
-
609
- addCustomStatusField(triggerEntity, ['active', 'inactive', 'paused'], {
610
- displayName: 'Trigger Status',
611
- description: 'Current status of the trigger',
612
- })
613
-
614
- addCreatedAtField(triggerEntity, { description: 'When the trigger was created' })
615
-
616
- // Trigger-Rule Association (Many-to-One)
617
- triggerEntity.addAssociation(
618
- { key: ruleEntity.key },
619
- {
620
- info: { name: 'rule', displayName: 'Rule', description: 'Rule for this trigger' },
621
- required: true,
622
- multiple: false,
623
- }
624
- )
625
-
626
- // Action Entity
627
- const actionEntity = automationModel.addEntity({
628
- info: {
629
- name: 'action',
630
- displayName: 'Action',
631
- description: 'Automation action to execute',
632
- },
633
- })
634
-
635
- addIdField(actionEntity, { displayName: 'Action ID', description: 'Unique identifier for the action' })
636
-
637
- addNameField(actionEntity, { description: 'Action name and description' })
638
-
639
- addDescriptionField(actionEntity, { description: 'Action description and parameters' })
640
-
641
- actionEntity.addProperty({
642
- info: { name: 'action_type', displayName: 'Action Type', description: 'Type of action' },
643
- type: 'string',
644
- required: true,
645
- schema: {
646
- enum: ['device_control', 'notification', 'data_logging', 'api_call', 'script_execution'],
647
- },
648
- })
649
-
650
- actionEntity.addProperty({
651
- info: { name: 'parameters', displayName: 'Parameters', description: 'Action parameters' },
652
- type: 'string',
653
- required: false,
654
- })
655
-
656
- actionEntity.addProperty({
657
- info: { name: 'delay', displayName: 'Delay', description: 'Action delay in seconds' },
658
- type: 'number',
659
- required: false,
660
- schema: {
661
- minimum: 0,
662
- },
663
- })
664
-
665
- addCustomStatusField(actionEntity, ['pending', 'executing', 'completed', 'failed'], {
666
- displayName: 'Action Status',
667
- description: 'Current status of the action',
668
- })
669
-
670
- addCreatedAtField(actionEntity, { description: 'When the action was created' })
671
-
672
- // Action-Rule Association (Many-to-One)
673
- actionEntity.addAssociation(
674
- { key: ruleEntity.key },
675
- {
676
- info: { name: 'rule', displayName: 'Rule', description: 'Rule for this action' },
677
- required: true,
678
- multiple: false,
679
- }
680
- )
681
-
682
- // Schedule Entity
683
- const scheduleEntity = automationModel.addEntity({
684
- info: {
685
- name: 'schedule',
686
- displayName: 'Schedule',
687
- description: 'Automation schedule',
688
- },
689
- })
690
-
691
- addIdField(scheduleEntity, { displayName: 'Schedule ID', description: 'Unique identifier for the schedule' })
692
-
693
- addNameField(scheduleEntity, { description: 'Schedule name and description' })
694
-
695
- addDescriptionField(scheduleEntity, { description: 'Schedule description and timing' })
696
-
697
- scheduleEntity.addProperty({
698
- info: { name: 'schedule_type', displayName: 'Schedule Type', description: 'Type of schedule' },
699
- type: 'string',
700
- required: true,
701
- schema: {
702
- enum: ['daily', 'weekly', 'monthly', 'custom', 'sunrise_sunset'],
703
- },
704
- })
705
-
706
- scheduleEntity.addProperty({
707
- info: { name: 'start_time', displayName: 'Start Time', description: 'Schedule start time' },
708
- type: 'time',
709
- required: true,
710
- })
711
-
712
- scheduleEntity.addProperty({
713
- info: { name: 'end_time', displayName: 'End Time', description: 'Schedule end time' },
714
- type: 'time',
715
- required: false,
716
- })
717
-
718
- scheduleEntity.addProperty({
719
- info: { name: 'days_of_week', displayName: 'Days of Week', description: 'Days of week for schedule' },
720
- type: 'string',
721
- required: false,
722
- })
723
-
724
- addCustomStatusField(scheduleEntity, ['active', 'inactive', 'paused'], {
725
- displayName: 'Schedule Status',
726
- description: 'Current status of the schedule',
727
- })
728
-
729
- addCreatedAtField(scheduleEntity, { description: 'When the schedule was created' })
730
-
731
- // Schedule-Rule Association (Many-to-One)
732
- scheduleEntity.addAssociation(
733
- { key: ruleEntity.key },
734
- {
735
- info: { name: 'rule', displayName: 'Rule', description: 'Rule for this schedule' },
736
- required: true,
737
- multiple: false,
738
- }
739
- )
740
-
741
- //
742
- // 4. USER MANAGEMENT NAMESPACE
743
- //
744
- const userManagement = domain.addNamespace({
745
- info: {
746
- name: 'UserManagement',
747
- displayName: 'User Management',
748
- description: 'Users, permissions, and device access',
749
- },
750
- })
751
-
752
- // User Model
753
- const userModel = userManagement.addModel({
754
- info: {
755
- name: 'Users',
756
- displayName: 'User Management',
757
- description: 'User accounts and permissions',
758
- },
759
- })
760
-
761
- // User Entity
762
- const userEntity = userModel.addEntity({
763
- info: {
764
- name: 'user',
765
- displayName: 'User',
766
- description: 'System user with access permissions',
767
- },
768
- })
769
-
770
- addIdField(userEntity, { displayName: 'User ID', description: 'Unique identifier for the user' })
771
-
772
- addNameField(userEntity, { description: 'User name and title' })
773
-
774
- addDescriptionField(userEntity, { description: 'User description and notes' })
775
-
776
- addEmailField(userEntity, { description: 'User email address' })
777
-
778
- addPhoneField(userEntity, { description: 'User phone number' })
779
-
780
- userEntity.addProperty({
781
- info: { name: 'user_type', displayName: 'User Type', description: 'Type of user' },
782
- type: 'string',
783
- required: true,
784
- schema: {
785
- enum: ['owner', 'admin', 'family_member', 'guest', 'service_account'],
786
- },
787
- })
788
-
789
- userEntity.addProperty({
790
- info: { name: 'username', displayName: 'Username', description: 'User login username' },
791
- type: 'string',
792
- required: true,
793
- unique: true,
794
- })
795
-
796
- userEntity.addProperty({
797
- info: { name: 'last_login', displayName: 'Last Login', description: 'User last login date' },
798
- type: 'datetime',
799
- required: false,
800
- })
801
-
802
- addCustomStatusField(userEntity, ['active', 'inactive', 'suspended', 'pending'], {
803
- displayName: 'User Status',
804
- description: 'Current status of the user',
805
- })
806
-
807
- addCreatedAtField(userEntity, { description: 'When the user was created' })
808
- addUpdatedAtField(userEntity, { description: 'When the user was last updated' })
809
-
810
- // Permission Entity
811
- const permissionEntity = userModel.addEntity({
812
- info: {
813
- name: 'permission',
814
- displayName: 'Permission',
815
- description: 'User permissions and access rights',
816
- },
817
- })
818
-
819
- addIdField(permissionEntity, {
820
- displayName: 'Permission ID',
821
- description: 'Unique identifier for the permission',
822
- })
823
-
824
- addNameField(permissionEntity, { description: 'Permission name and description' })
825
-
826
- addDescriptionField(permissionEntity, { description: 'Permission description and scope' })
827
-
828
- permissionEntity.addProperty({
829
- info: { name: 'permission_type', displayName: 'Permission Type', description: 'Type of permission' },
830
- type: 'string',
831
- required: true,
832
- schema: {
833
- enum: ['read', 'write', 'admin', 'control', 'view', 'configure'],
834
- },
835
- })
836
-
837
- permissionEntity.addProperty({
838
- info: { name: 'resource', displayName: 'Resource', description: 'Resource for permission' },
839
- type: 'string',
840
- required: true,
841
- })
842
-
843
- permissionEntity.addProperty({
844
- info: { name: 'scope', displayName: 'Scope', description: 'Permission scope' },
845
- type: 'string',
846
- required: true,
847
- schema: {
848
- enum: ['all', 'specific', 'room', 'device', 'system'],
849
- },
850
- })
851
-
852
- addCustomStatusField(permissionEntity, ['active', 'inactive', 'temporary'], {
853
- displayName: 'Permission Status',
854
- description: 'Current status of the permission',
855
- })
856
-
857
- addCreatedAtField(permissionEntity, { description: 'When the permission was created' })
858
-
859
- // Permission-User Association (Many-to-One)
860
- permissionEntity.addAssociation(
861
- { key: userEntity.key },
862
- {
863
- info: { name: 'user', displayName: 'User', description: 'User for this permission' },
864
- required: true,
865
- multiple: false,
866
- }
867
- )
868
-
869
- // Device Access Entity
870
- const deviceAccessEntity = userModel.addEntity({
871
- info: {
872
- name: 'device_access',
873
- displayName: 'Device Access',
874
- description: 'User access to specific devices',
875
- },
876
- })
877
-
878
- addIdField(deviceAccessEntity, {
879
- displayName: 'Access ID',
880
- description: 'Unique identifier for the device access',
881
- })
882
-
883
- addNameField(deviceAccessEntity, { description: 'Access name and description' })
884
-
885
- deviceAccessEntity.addProperty({
886
- info: { name: 'access_type', displayName: 'Access Type', description: 'Type of device access' },
887
- type: 'string',
888
- required: true,
889
- schema: {
890
- enum: ['full_control', 'read_only', 'limited_control', 'monitor_only'],
891
- },
892
- })
893
-
894
- deviceAccessEntity.addProperty({
895
- info: { name: 'granted_date', displayName: 'Granted Date', description: 'Access granted date' },
896
- type: 'date',
897
- required: true,
898
- })
899
-
900
- deviceAccessEntity.addProperty({
901
- info: { name: 'expiry_date', displayName: 'Expiry Date', description: 'Access expiry date' },
902
- type: 'date',
903
- required: false,
904
- })
905
-
906
- addCustomStatusField(deviceAccessEntity, ['active', 'expired', 'revoked'], {
907
- displayName: 'Access Status',
908
- description: 'Current status of the device access',
909
- })
910
-
911
- addCreatedAtField(deviceAccessEntity, { description: 'When the access was created' })
912
-
913
- // DeviceAccess-User Association (Many-to-One)
914
- deviceAccessEntity.addAssociation(
915
- { key: userEntity.key },
916
- {
917
- info: { name: 'user', displayName: 'User', description: 'User for this device access' },
918
- required: true,
919
- multiple: false,
920
- }
921
- )
922
-
923
- // DeviceAccess-Device Association (Many-to-One)
924
- deviceAccessEntity.addAssociation(
925
- { key: deviceEntity.key },
926
- {
927
- info: { name: 'device', displayName: 'Device', description: 'Device for this access' },
928
- required: true,
929
- multiple: false,
930
- }
931
- )
932
-
933
- //
934
- // 5. MONITORING NAMESPACE
935
- //
936
- const monitoring = domain.addNamespace({
937
- info: {
938
- name: 'Monitoring',
939
- displayName: 'Monitoring',
940
- description: 'Alerts, notifications, and health status',
941
- },
942
- })
943
-
944
- // Monitoring Model
945
- const monitoringModel = monitoring.addModel({
946
- info: {
947
- name: 'Monitoring',
948
- displayName: 'Monitoring Management',
949
- description: 'System monitoring and alerting',
950
- },
951
- })
952
-
953
- // Alert Entity
954
- const alertEntity = monitoringModel.addEntity({
955
- info: {
956
- name: 'alert',
957
- displayName: 'Alert',
958
- description: 'System alert or notification',
959
- },
960
- })
961
-
962
- addIdField(alertEntity, { displayName: 'Alert ID', description: 'Unique identifier for the alert' })
963
-
964
- addNameField(alertEntity, { description: 'Alert name and title' })
965
-
966
- addDescriptionField(alertEntity, { description: 'Alert description and details' })
967
-
968
- alertEntity.addProperty({
969
- info: { name: 'alert_type', displayName: 'Alert Type', description: 'Type of alert' },
970
- type: 'string',
971
- required: true,
972
- schema: {
973
- enum: ['error', 'warning', 'info', 'critical', 'maintenance'],
974
- },
975
- })
976
-
977
- alertEntity.addProperty({
978
- info: { name: 'severity', displayName: 'Severity', description: 'Alert severity level' },
979
- type: 'string',
980
- required: true,
981
- schema: {
982
- enum: ['low', 'medium', 'high', 'critical'],
983
- },
984
- })
985
-
986
- alertEntity.addProperty({
987
- info: { name: 'triggered_at', displayName: 'Triggered At', description: 'Alert trigger time' },
988
- type: 'datetime',
989
- required: true,
990
- })
991
-
992
- alertEntity.addProperty({
993
- info: { name: 'resolved_at', displayName: 'Resolved At', description: 'Alert resolution time' },
994
- type: 'datetime',
995
- required: false,
996
- })
997
-
998
- addCustomStatusField(alertEntity, ['active', 'acknowledged', 'resolved', 'dismissed'], {
999
- displayName: 'Alert Status',
1000
- description: 'Current status of the alert',
1001
- })
1002
-
1003
- addCreatedAtField(alertEntity, { description: 'When the alert was created' })
1004
-
1005
- // Alert-Device Association (Many-to-One)
1006
- alertEntity.addAssociation(
1007
- { key: deviceEntity.key },
1008
- {
1009
- info: { name: 'device', displayName: 'Device', description: 'Device for this alert' },
1010
- required: false,
1011
- multiple: false,
1012
- }
1013
- )
1014
-
1015
- // Notification Entity
1016
- const notificationEntity = monitoringModel.addEntity({
1017
- info: {
1018
- name: 'notification',
1019
- displayName: 'Notification',
1020
- description: 'User notification message',
1021
- },
1022
- })
1023
-
1024
- addIdField(notificationEntity, {
1025
- displayName: 'Notification ID',
1026
- description: 'Unique identifier for the notification',
1027
- })
1028
-
1029
- addNameField(notificationEntity, { description: 'Notification name and title' })
1030
-
1031
- addDescriptionField(notificationEntity, { description: 'Notification message content' })
1032
-
1033
- notificationEntity.addProperty({
1034
- info: { name: 'notification_type', displayName: 'Notification Type', description: 'Type of notification' },
1035
- type: 'string',
1036
- required: true,
1037
- schema: {
1038
- enum: ['email', 'sms', 'push', 'in_app', 'webhook'],
1039
- },
1040
- })
1041
-
1042
- notificationEntity.addProperty({
1043
- info: { name: 'recipient', displayName: 'Recipient', description: 'Notification recipient' },
1044
- type: 'string',
1045
- required: true,
1046
- })
1047
-
1048
- notificationEntity.addProperty({
1049
- info: { name: 'sent_at', displayName: 'Sent At', description: 'Notification sent time' },
1050
- type: 'datetime',
1051
- required: true,
1052
- })
1053
-
1054
- notificationEntity.addProperty({
1055
- info: { name: 'read_at', displayName: 'Read At', description: 'Notification read time' },
1056
- type: 'datetime',
1057
- required: false,
1058
- })
1059
-
1060
- addCustomStatusField(notificationEntity, ['pending', 'sent', 'delivered', 'read', 'failed'], {
1061
- displayName: 'Notification Status',
1062
- description: 'Current status of the notification',
1063
- })
1064
-
1065
- addCreatedAtField(notificationEntity, { description: 'When the notification was created' })
1066
-
1067
- // Notification-User Association (Many-to-One)
1068
- notificationEntity.addAssociation(
1069
- { key: userEntity.key },
1070
- {
1071
- info: { name: 'user', displayName: 'User', description: 'User for this notification' },
1072
- required: true,
1073
- multiple: false,
1074
- }
1075
- )
1076
-
1077
- // Health Status Entity
1078
- const healthStatusEntity = monitoringModel.addEntity({
1079
- info: {
1080
- name: 'health_status',
1081
- displayName: 'Health Status',
1082
- description: 'System and device health status',
1083
- },
1084
- })
1085
-
1086
- addIdField(healthStatusEntity, {
1087
- displayName: 'Health ID',
1088
- description: 'Unique identifier for the health status',
1089
- })
1090
-
1091
- addNameField(healthStatusEntity, { description: 'Health status name and description' })
1092
-
1093
- healthStatusEntity.addProperty({
1094
- info: { name: 'health_type', displayName: 'Health Type', description: 'Type of health status' },
1095
- type: 'string',
1096
- required: true,
1097
- schema: {
1098
- enum: ['system', 'device', 'network', 'battery', 'connectivity'],
1099
- },
1100
- })
1101
-
1102
- healthStatusEntity.addProperty({
1103
- info: { name: 'check_time', displayName: 'Check Time', description: 'Health check time' },
1104
- type: 'datetime',
1105
- required: true,
1106
- })
1107
-
1108
- healthStatusEntity.addProperty({
1109
- info: { name: 'score', displayName: 'Score', description: 'Health score (0-100)' },
1110
- type: 'number',
1111
- required: true,
1112
- schema: {
1113
- minimum: 0,
1114
- maximum: 100,
1115
- },
1116
- })
1117
-
1118
- addCustomStatusField(healthStatusEntity, ['excellent', 'good', 'fair', 'poor', 'critical'], {
1119
- displayName: 'Health Status',
1120
- description: 'Current health status',
1121
- })
1122
-
1123
- addCreatedAtField(healthStatusEntity, { description: 'When the health status was created' })
1124
-
1125
- // HealthStatus-Device Association (Many-to-One)
1126
- healthStatusEntity.addAssociation(
1127
- { key: deviceEntity.key },
1128
- {
1129
- info: { name: 'device', displayName: 'Device', description: 'Device for this health status' },
1130
- required: false,
1131
- multiple: false,
1132
- }
1133
- )
1134
-
1135
- //
1136
- // 6. INTEGRATION NAMESPACE
1137
- //
1138
- const integration = domain.addNamespace({
1139
- info: {
1140
- name: 'Integration',
1141
- displayName: 'Integration',
1142
- description: 'Third-party services, APIs, and protocols',
1143
- },
1144
- })
1145
-
1146
- // Integration Model
1147
- const integrationModel = integration.addModel({
1148
- info: {
1149
- name: 'Integrations',
1150
- displayName: 'Integration Management',
1151
- description: 'Third-party integrations and APIs',
1152
- },
1153
- })
1154
-
1155
- // Integration Entity
1156
- const integrationEntity = integrationModel.addEntity({
1157
- info: {
1158
- name: 'integration',
1159
- displayName: 'Integration',
1160
- description: 'Third-party service integration',
1161
- },
1162
- })
1163
-
1164
- addIdField(integrationEntity, {
1165
- displayName: 'Integration ID',
1166
- description: 'Unique identifier for the integration',
1167
- })
1168
-
1169
- addNameField(integrationEntity, { description: 'Integration name and description' })
1170
-
1171
- addDescriptionField(integrationEntity, { description: 'Integration description and capabilities' })
1172
-
1173
- integrationEntity.addProperty({
1174
- info: { name: 'integration_type', displayName: 'Integration Type', description: 'Type of integration' },
1175
- type: 'string',
1176
- required: true,
1177
- schema: {
1178
- enum: ['api', 'webhook', 'protocol', 'service', 'platform'],
1179
- },
1180
- })
1181
-
1182
- integrationEntity.addProperty({
1183
- info: { name: 'provider', displayName: 'Provider', description: 'Integration provider' },
1184
- type: 'string',
1185
- required: true,
1186
- })
1187
-
1188
- integrationEntity.addProperty({
1189
- info: { name: 'endpoint_url', displayName: 'Endpoint URL', description: 'Integration endpoint URL' },
1190
- type: 'string',
1191
- required: false,
1192
- })
1193
-
1194
- integrationEntity.addProperty({
1195
- info: { name: 'api_key', displayName: 'API Key', description: 'Integration API key' },
1196
- type: 'string',
1197
- required: false,
1198
- })
1199
-
1200
- integrationEntity.addProperty({
1201
- info: { name: 'protocol', displayName: 'Protocol', description: 'Integration protocol' },
1202
- type: 'string',
1203
- required: false,
1204
- schema: {
1205
- enum: ['http', 'https', 'mqtt', 'coap', 'websocket', 'tcp'],
1206
- },
1207
- })
1208
-
1209
- addCustomStatusField(integrationEntity, ['active', 'inactive', 'testing', 'error'], {
1210
- displayName: 'Integration Status',
1211
- description: 'Current status of the integration',
1212
- })
1213
-
1214
- addCreatedAtField(integrationEntity, { description: 'When the integration was created' })
1215
-
1216
- // API Call Entity
1217
- const apiCallEntity = integrationModel.addEntity({
1218
- info: {
1219
- name: 'api_call',
1220
- displayName: 'API Call',
1221
- description: 'API call to third-party service',
1222
- },
1223
- })
1224
-
1225
- addIdField(apiCallEntity, { displayName: 'Call ID', description: 'Unique identifier for the API call' })
1226
-
1227
- addNameField(apiCallEntity, { description: 'API call name and description' })
1228
-
1229
- apiCallEntity.addProperty({
1230
- info: { name: 'endpoint', displayName: 'Endpoint', description: 'API endpoint' },
1231
- type: 'string',
1232
- required: true,
1233
- })
1234
-
1235
- apiCallEntity.addProperty({
1236
- info: { name: 'method', displayName: 'Method', description: 'HTTP method' },
1237
- type: 'string',
1238
- required: true,
1239
- schema: {
1240
- enum: ['GET', 'POST', 'PUT', 'DELETE', 'PATCH'],
1241
- },
1242
- })
1243
-
1244
- apiCallEntity.addProperty({
1245
- info: { name: 'request_data', displayName: 'Request Data', description: 'API request data' },
1246
- type: 'string',
1247
- required: false,
1248
- })
1249
-
1250
- apiCallEntity.addProperty({
1251
- info: { name: 'response_data', displayName: 'Response Data', description: 'API response data' },
1252
- type: 'string',
1253
- required: false,
1254
- })
1255
-
1256
- apiCallEntity.addProperty({
1257
- info: { name: 'response_code', displayName: 'Response Code', description: 'HTTP response code' },
1258
- type: 'number',
1259
- required: false,
1260
- })
1261
-
1262
- apiCallEntity.addProperty({
1263
- info: { name: 'duration', displayName: 'Duration', description: 'API call duration in milliseconds' },
1264
- type: 'number',
1265
- required: false,
1266
- schema: {
1267
- minimum: 0,
1268
- },
1269
- })
1270
-
1271
- addCustomStatusField(apiCallEntity, ['pending', 'in_progress', 'completed', 'failed', 'timeout'], {
1272
- displayName: 'Call Status',
1273
- description: 'Current status of the API call',
1274
- })
1275
-
1276
- addCreatedAtField(apiCallEntity, { description: 'When the API call was created' })
1277
-
1278
- // ApiCall-Integration Association (Many-to-One)
1279
- apiCallEntity.addAssociation(
1280
- { key: integrationEntity.key },
1281
- {
1282
- info: { name: 'integration', displayName: 'Integration', description: 'Integration for this API call' },
1283
- required: true,
1284
- multiple: false,
1285
- }
1286
- )
1287
-
1288
- return domain
1289
- }