services-as-software 0.1.0 → 2.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (78) hide show
  1. package/.turbo/turbo-build.log +5 -0
  2. package/CHANGELOG.md +10 -0
  3. package/README.md +235 -225
  4. package/dist/client.d.ts +25 -0
  5. package/dist/client.d.ts.map +1 -0
  6. package/dist/client.js +103 -0
  7. package/dist/client.js.map +1 -0
  8. package/dist/endpoint.d.ts +102 -0
  9. package/dist/endpoint.d.ts.map +1 -0
  10. package/dist/endpoint.js +96 -0
  11. package/dist/endpoint.js.map +1 -0
  12. package/dist/entities/billing.d.ts +60 -0
  13. package/dist/entities/billing.d.ts.map +1 -0
  14. package/dist/entities/billing.js +954 -0
  15. package/dist/entities/billing.js.map +1 -0
  16. package/dist/entities/customers.d.ts +45 -0
  17. package/dist/entities/customers.d.ts.map +1 -0
  18. package/dist/entities/customers.js +679 -0
  19. package/dist/entities/customers.js.map +1 -0
  20. package/dist/entities/delivery.d.ts +59 -0
  21. package/dist/entities/delivery.d.ts.map +1 -0
  22. package/dist/entities/delivery.js +890 -0
  23. package/dist/entities/delivery.js.map +1 -0
  24. package/dist/entities/index.d.ts +114 -0
  25. package/dist/entities/index.d.ts.map +1 -0
  26. package/dist/entities/index.js +89 -0
  27. package/dist/entities/index.js.map +1 -0
  28. package/dist/entities/operations.d.ts +59 -0
  29. package/dist/entities/operations.d.ts.map +1 -0
  30. package/dist/entities/operations.js +1010 -0
  31. package/dist/entities/operations.js.map +1 -0
  32. package/dist/entities/orchestration.d.ts +52 -0
  33. package/dist/entities/orchestration.d.ts.map +1 -0
  34. package/dist/entities/orchestration.js +883 -0
  35. package/dist/entities/orchestration.js.map +1 -0
  36. package/dist/entities/services.d.ts +50 -0
  37. package/dist/entities/services.d.ts.map +1 -0
  38. package/dist/entities/services.js +805 -0
  39. package/dist/entities/services.js.map +1 -0
  40. package/dist/helpers.d.ts +362 -0
  41. package/dist/helpers.d.ts.map +1 -0
  42. package/dist/helpers.js +400 -0
  43. package/dist/helpers.js.map +1 -0
  44. package/dist/index.d.ts +17 -215
  45. package/dist/index.d.ts.map +1 -0
  46. package/dist/index.js +18 -172
  47. package/dist/index.js.map +1 -0
  48. package/dist/provider.d.ts +85 -0
  49. package/dist/provider.d.ts.map +1 -0
  50. package/dist/provider.js +158 -0
  51. package/dist/provider.js.map +1 -0
  52. package/dist/service.d.ts +43 -0
  53. package/dist/service.d.ts.map +1 -0
  54. package/dist/service.js +206 -0
  55. package/dist/service.js.map +1 -0
  56. package/dist/types.d.ts +469 -0
  57. package/dist/types.d.ts.map +1 -0
  58. package/dist/types.js +5 -0
  59. package/dist/types.js.map +1 -0
  60. package/examples/client-usage.ts +82 -0
  61. package/examples/translation-service.ts +227 -0
  62. package/package.json +24 -38
  63. package/src/client.ts +132 -0
  64. package/src/endpoint.ts +144 -0
  65. package/src/entities/billing.ts +1037 -0
  66. package/src/entities/customers.ts +740 -0
  67. package/src/entities/delivery.ts +974 -0
  68. package/src/entities/index.ts +157 -0
  69. package/src/entities/operations.ts +1099 -0
  70. package/src/entities/orchestration.ts +956 -0
  71. package/src/entities/services.ts +872 -0
  72. package/src/helpers.ts +474 -0
  73. package/src/index.ts +97 -0
  74. package/src/provider.ts +183 -0
  75. package/src/service.test.ts +195 -0
  76. package/src/service.ts +266 -0
  77. package/src/types.ts +543 -0
  78. package/tsconfig.json +9 -0
@@ -0,0 +1,1010 @@
1
+ /**
2
+ * Operations Entity Types (Nouns)
3
+ *
4
+ * Service operations: SLA, SLO, ServiceIncident, SupportTicket, ServiceFeedback, ServiceMetric
5
+ *
6
+ * @packageDocumentation
7
+ */
8
+ // =============================================================================
9
+ // SLA
10
+ // =============================================================================
11
+ /**
12
+ * SLA entity
13
+ *
14
+ * Service Level Agreement.
15
+ */
16
+ export const SLA = {
17
+ singular: 'sla',
18
+ plural: 'slas',
19
+ description: 'A Service Level Agreement defining commitments',
20
+ properties: {
21
+ // Identity
22
+ name: {
23
+ type: 'string',
24
+ description: 'SLA name',
25
+ },
26
+ description: {
27
+ type: 'string',
28
+ optional: true,
29
+ description: 'SLA description',
30
+ },
31
+ version: {
32
+ type: 'string',
33
+ optional: true,
34
+ description: 'SLA version',
35
+ },
36
+ // Tier
37
+ tier: {
38
+ type: 'string',
39
+ optional: true,
40
+ description: 'SLA tier',
41
+ examples: ['basic', 'standard', 'premium', 'enterprise'],
42
+ },
43
+ // Availability
44
+ uptimeTarget: {
45
+ type: 'number',
46
+ optional: true,
47
+ description: 'Uptime target percentage (e.g., 99.9)',
48
+ },
49
+ uptimeCalculation: {
50
+ type: 'string',
51
+ optional: true,
52
+ description: 'How uptime is calculated',
53
+ examples: ['monthly', 'quarterly', 'yearly'],
54
+ },
55
+ // Response Times
56
+ responseTimeTarget: {
57
+ type: 'number',
58
+ optional: true,
59
+ description: 'Target response time (ms)',
60
+ },
61
+ responseTimeP50: {
62
+ type: 'number',
63
+ optional: true,
64
+ description: 'P50 response time target (ms)',
65
+ },
66
+ responseTimeP99: {
67
+ type: 'number',
68
+ optional: true,
69
+ description: 'P99 response time target (ms)',
70
+ },
71
+ // Support
72
+ supportResponseTime: {
73
+ type: 'string',
74
+ optional: true,
75
+ description: 'Support response time target',
76
+ },
77
+ supportHours: {
78
+ type: 'string',
79
+ optional: true,
80
+ description: 'Support hours',
81
+ examples: ['24/7', 'business-hours', '9-5'],
82
+ },
83
+ supportChannels: {
84
+ type: 'string',
85
+ array: true,
86
+ optional: true,
87
+ description: 'Support channels',
88
+ examples: ['email', 'chat', 'phone', 'slack'],
89
+ },
90
+ // Credits
91
+ creditPolicy: {
92
+ type: 'json',
93
+ optional: true,
94
+ description: 'Credit policy for SLA breaches',
95
+ },
96
+ maxCredit: {
97
+ type: 'number',
98
+ optional: true,
99
+ description: 'Maximum credit percentage',
100
+ },
101
+ // Exclusions
102
+ exclusions: {
103
+ type: 'string',
104
+ array: true,
105
+ optional: true,
106
+ description: 'SLA exclusions',
107
+ },
108
+ maintenanceWindows: {
109
+ type: 'json',
110
+ optional: true,
111
+ description: 'Scheduled maintenance windows',
112
+ },
113
+ // Dates
114
+ effectiveFrom: {
115
+ type: 'date',
116
+ optional: true,
117
+ description: 'Effective from date',
118
+ },
119
+ effectiveUntil: {
120
+ type: 'date',
121
+ optional: true,
122
+ description: 'Effective until date',
123
+ },
124
+ // Status
125
+ status: {
126
+ type: 'string',
127
+ description: 'SLA status',
128
+ examples: ['draft', 'active', 'superseded', 'expired'],
129
+ },
130
+ },
131
+ relationships: {
132
+ service: {
133
+ type: 'ProductizedService',
134
+ description: 'Service this SLA covers',
135
+ },
136
+ objectives: {
137
+ type: 'SLO[]',
138
+ description: 'Service level objectives',
139
+ },
140
+ incidents: {
141
+ type: 'ServiceIncident[]',
142
+ description: 'Related incidents',
143
+ },
144
+ },
145
+ actions: [
146
+ 'create',
147
+ 'update',
148
+ 'activate',
149
+ 'supersede',
150
+ 'expire',
151
+ ],
152
+ events: [
153
+ 'created',
154
+ 'updated',
155
+ 'activated',
156
+ 'superseded',
157
+ 'expired',
158
+ 'breached',
159
+ ],
160
+ };
161
+ // =============================================================================
162
+ // SLO
163
+ // =============================================================================
164
+ /**
165
+ * SLO entity
166
+ *
167
+ * Service Level Objective.
168
+ */
169
+ export const SLO = {
170
+ singular: 'slo',
171
+ plural: 'slos',
172
+ description: 'A Service Level Objective defining a specific target',
173
+ properties: {
174
+ // Identity
175
+ name: {
176
+ type: 'string',
177
+ description: 'SLO name',
178
+ },
179
+ description: {
180
+ type: 'string',
181
+ optional: true,
182
+ description: 'SLO description',
183
+ },
184
+ // Metric
185
+ metric: {
186
+ type: 'string',
187
+ description: 'Metric being measured',
188
+ examples: ['availability', 'latency', 'throughput', 'error-rate', 'success-rate'],
189
+ },
190
+ metricQuery: {
191
+ type: 'string',
192
+ optional: true,
193
+ description: 'Query to calculate metric',
194
+ },
195
+ // Target
196
+ target: {
197
+ type: 'number',
198
+ description: 'Target value',
199
+ },
200
+ comparison: {
201
+ type: 'string',
202
+ description: 'Comparison operator',
203
+ examples: ['>=', '<=', '>', '<', '='],
204
+ },
205
+ unit: {
206
+ type: 'string',
207
+ optional: true,
208
+ description: 'Unit of measure',
209
+ },
210
+ // Window
211
+ windowType: {
212
+ type: 'string',
213
+ description: 'Window type',
214
+ examples: ['rolling', 'calendar'],
215
+ },
216
+ windowDuration: {
217
+ type: 'string',
218
+ optional: true,
219
+ description: 'Window duration',
220
+ examples: ['30d', '7d', '1h', '1m'],
221
+ },
222
+ // Error Budget
223
+ errorBudget: {
224
+ type: 'number',
225
+ optional: true,
226
+ description: 'Error budget (as percentage)',
227
+ },
228
+ errorBudgetRemaining: {
229
+ type: 'number',
230
+ optional: true,
231
+ description: 'Remaining error budget',
232
+ },
233
+ burnRate: {
234
+ type: 'number',
235
+ optional: true,
236
+ description: 'Current burn rate',
237
+ },
238
+ // Current State
239
+ currentValue: {
240
+ type: 'number',
241
+ optional: true,
242
+ description: 'Current metric value',
243
+ },
244
+ lastCalculatedAt: {
245
+ type: 'date',
246
+ optional: true,
247
+ description: 'Last calculation time',
248
+ },
249
+ // Alerting
250
+ alertThreshold: {
251
+ type: 'number',
252
+ optional: true,
253
+ description: 'Alert threshold',
254
+ },
255
+ alertOnBreach: {
256
+ type: 'boolean',
257
+ optional: true,
258
+ description: 'Alert on breach',
259
+ },
260
+ // Status
261
+ status: {
262
+ type: 'string',
263
+ description: 'SLO status',
264
+ examples: ['healthy', 'at-risk', 'breached', 'disabled'],
265
+ },
266
+ isMet: {
267
+ type: 'boolean',
268
+ optional: true,
269
+ description: 'Currently meeting target',
270
+ },
271
+ },
272
+ relationships: {
273
+ sla: {
274
+ type: 'SLA',
275
+ required: false,
276
+ description: 'Parent SLA',
277
+ },
278
+ service: {
279
+ type: 'ProductizedService',
280
+ description: 'Service measured',
281
+ },
282
+ alerts: {
283
+ type: 'Alert[]',
284
+ description: 'Related alerts',
285
+ },
286
+ },
287
+ actions: [
288
+ 'create',
289
+ 'update',
290
+ 'enable',
291
+ 'disable',
292
+ 'recalculate',
293
+ 'alert',
294
+ ],
295
+ events: [
296
+ 'created',
297
+ 'updated',
298
+ 'enabled',
299
+ 'disabled',
300
+ 'breached',
301
+ 'recovered',
302
+ 'alertTriggered',
303
+ ],
304
+ };
305
+ // =============================================================================
306
+ // ServiceIncident
307
+ // =============================================================================
308
+ /**
309
+ * ServiceIncident entity
310
+ *
311
+ * Service incident or outage.
312
+ */
313
+ export const ServiceIncident = {
314
+ singular: 'service-incident',
315
+ plural: 'service-incidents',
316
+ description: 'A service incident or outage',
317
+ properties: {
318
+ // Identity
319
+ id: {
320
+ type: 'string',
321
+ description: 'Incident ID',
322
+ },
323
+ title: {
324
+ type: 'string',
325
+ description: 'Incident title',
326
+ },
327
+ description: {
328
+ type: 'string',
329
+ optional: true,
330
+ description: 'Incident description',
331
+ },
332
+ // Classification
333
+ severity: {
334
+ type: 'string',
335
+ description: 'Incident severity',
336
+ examples: ['critical', 'major', 'minor', 'warning'],
337
+ },
338
+ type: {
339
+ type: 'string',
340
+ optional: true,
341
+ description: 'Incident type',
342
+ examples: ['outage', 'degradation', 'maintenance', 'security', 'data'],
343
+ },
344
+ category: {
345
+ type: 'string',
346
+ optional: true,
347
+ description: 'Incident category',
348
+ },
349
+ // Impact
350
+ impactLevel: {
351
+ type: 'string',
352
+ optional: true,
353
+ description: 'Impact level',
354
+ examples: ['none', 'partial', 'major', 'complete'],
355
+ },
356
+ affectedServices: {
357
+ type: 'string',
358
+ array: true,
359
+ optional: true,
360
+ description: 'Affected services',
361
+ },
362
+ affectedCustomers: {
363
+ type: 'number',
364
+ optional: true,
365
+ description: 'Number of affected customers',
366
+ },
367
+ affectedRegions: {
368
+ type: 'string',
369
+ array: true,
370
+ optional: true,
371
+ description: 'Affected regions',
372
+ },
373
+ // Root Cause
374
+ rootCause: {
375
+ type: 'string',
376
+ optional: true,
377
+ description: 'Root cause',
378
+ },
379
+ rootCauseCategory: {
380
+ type: 'string',
381
+ optional: true,
382
+ description: 'Root cause category',
383
+ examples: ['infrastructure', 'code', 'config', 'dependency', 'external', 'unknown'],
384
+ },
385
+ // Resolution
386
+ resolution: {
387
+ type: 'string',
388
+ optional: true,
389
+ description: 'Resolution description',
390
+ },
391
+ resolutionSteps: {
392
+ type: 'string',
393
+ array: true,
394
+ optional: true,
395
+ description: 'Resolution steps taken',
396
+ },
397
+ preventionPlan: {
398
+ type: 'string',
399
+ optional: true,
400
+ description: 'Prevention plan',
401
+ },
402
+ // Timeline
403
+ detectedAt: {
404
+ type: 'date',
405
+ optional: true,
406
+ description: 'Detection time',
407
+ },
408
+ startedAt: {
409
+ type: 'date',
410
+ optional: true,
411
+ description: 'Incident start time',
412
+ },
413
+ acknowledgedAt: {
414
+ type: 'date',
415
+ optional: true,
416
+ description: 'Acknowledgement time',
417
+ },
418
+ mitigatedAt: {
419
+ type: 'date',
420
+ optional: true,
421
+ description: 'Mitigation time',
422
+ },
423
+ resolvedAt: {
424
+ type: 'date',
425
+ optional: true,
426
+ description: 'Resolution time',
427
+ },
428
+ closedAt: {
429
+ type: 'date',
430
+ optional: true,
431
+ description: 'Closure time',
432
+ },
433
+ // Duration
434
+ durationMinutes: {
435
+ type: 'number',
436
+ optional: true,
437
+ description: 'Total duration in minutes',
438
+ },
439
+ timeToDetect: {
440
+ type: 'number',
441
+ optional: true,
442
+ description: 'Time to detect (minutes)',
443
+ },
444
+ timeToMitigate: {
445
+ type: 'number',
446
+ optional: true,
447
+ description: 'Time to mitigate (minutes)',
448
+ },
449
+ timeToResolve: {
450
+ type: 'number',
451
+ optional: true,
452
+ description: 'Time to resolve (minutes)',
453
+ },
454
+ // Status
455
+ status: {
456
+ type: 'string',
457
+ description: 'Incident status',
458
+ examples: ['detected', 'investigating', 'identified', 'mitigating', 'monitoring', 'resolved', 'closed'],
459
+ },
460
+ isPublic: {
461
+ type: 'boolean',
462
+ optional: true,
463
+ description: 'Visible on status page',
464
+ },
465
+ },
466
+ relationships: {
467
+ service: {
468
+ type: 'ProductizedService',
469
+ description: 'Affected service',
470
+ },
471
+ sla: {
472
+ type: 'SLA',
473
+ required: false,
474
+ description: 'Related SLA',
475
+ },
476
+ assignee: {
477
+ type: 'Worker',
478
+ required: false,
479
+ description: 'Assigned responder',
480
+ },
481
+ tickets: {
482
+ type: 'SupportTicket[]',
483
+ description: 'Related tickets',
484
+ },
485
+ },
486
+ actions: [
487
+ 'create',
488
+ 'acknowledge',
489
+ 'investigate',
490
+ 'mitigate',
491
+ 'resolve',
492
+ 'close',
493
+ 'reopen',
494
+ 'escalate',
495
+ ],
496
+ events: [
497
+ 'created',
498
+ 'acknowledged',
499
+ 'investigating',
500
+ 'identified',
501
+ 'mitigating',
502
+ 'resolved',
503
+ 'closed',
504
+ 'reopened',
505
+ 'escalated',
506
+ ],
507
+ };
508
+ // =============================================================================
509
+ // SupportTicket
510
+ // =============================================================================
511
+ /**
512
+ * SupportTicket entity
513
+ *
514
+ * Customer support ticket.
515
+ */
516
+ export const SupportTicket = {
517
+ singular: 'support-ticket',
518
+ plural: 'support-tickets',
519
+ description: 'A customer support ticket',
520
+ properties: {
521
+ // Identity
522
+ id: {
523
+ type: 'string',
524
+ description: 'Ticket ID',
525
+ },
526
+ number: {
527
+ type: 'string',
528
+ optional: true,
529
+ description: 'Ticket number',
530
+ },
531
+ // Content
532
+ subject: {
533
+ type: 'string',
534
+ description: 'Ticket subject',
535
+ },
536
+ description: {
537
+ type: 'string',
538
+ optional: true,
539
+ description: 'Ticket description',
540
+ },
541
+ tags: {
542
+ type: 'string',
543
+ array: true,
544
+ optional: true,
545
+ description: 'Ticket tags',
546
+ },
547
+ // Classification
548
+ type: {
549
+ type: 'string',
550
+ description: 'Ticket type',
551
+ examples: ['question', 'problem', 'feature-request', 'bug', 'task'],
552
+ },
553
+ category: {
554
+ type: 'string',
555
+ optional: true,
556
+ description: 'Ticket category',
557
+ },
558
+ // Priority
559
+ priority: {
560
+ type: 'string',
561
+ description: 'Ticket priority',
562
+ examples: ['low', 'normal', 'high', 'urgent'],
563
+ },
564
+ severity: {
565
+ type: 'string',
566
+ optional: true,
567
+ description: 'Issue severity',
568
+ examples: ['cosmetic', 'minor', 'major', 'critical'],
569
+ },
570
+ // Channel
571
+ channel: {
572
+ type: 'string',
573
+ optional: true,
574
+ description: 'Ticket channel',
575
+ examples: ['email', 'chat', 'phone', 'web', 'api', 'social'],
576
+ },
577
+ // Assignment
578
+ assignedTo: {
579
+ type: 'string',
580
+ optional: true,
581
+ description: 'Assigned agent',
582
+ },
583
+ assignedTeam: {
584
+ type: 'string',
585
+ optional: true,
586
+ description: 'Assigned team',
587
+ },
588
+ // SLA
589
+ slaTarget: {
590
+ type: 'date',
591
+ optional: true,
592
+ description: 'SLA target time',
593
+ },
594
+ slaBreached: {
595
+ type: 'boolean',
596
+ optional: true,
597
+ description: 'SLA was breached',
598
+ },
599
+ firstResponseAt: {
600
+ type: 'date',
601
+ optional: true,
602
+ description: 'First response time',
603
+ },
604
+ // Resolution
605
+ resolution: {
606
+ type: 'string',
607
+ optional: true,
608
+ description: 'Resolution description',
609
+ },
610
+ resolutionCode: {
611
+ type: 'string',
612
+ optional: true,
613
+ description: 'Resolution code',
614
+ examples: ['solved', 'not-a-bug', 'duplicate', 'wont-fix', 'by-design'],
615
+ },
616
+ // Timeline
617
+ createdAt: {
618
+ type: 'date',
619
+ optional: true,
620
+ description: 'Creation time',
621
+ },
622
+ updatedAt: {
623
+ type: 'date',
624
+ optional: true,
625
+ description: 'Last update time',
626
+ },
627
+ resolvedAt: {
628
+ type: 'date',
629
+ optional: true,
630
+ description: 'Resolution time',
631
+ },
632
+ closedAt: {
633
+ type: 'date',
634
+ optional: true,
635
+ description: 'Closure time',
636
+ },
637
+ // AI
638
+ aiHandled: {
639
+ type: 'boolean',
640
+ optional: true,
641
+ description: 'Handled by AI',
642
+ },
643
+ aiSuggestedResolution: {
644
+ type: 'string',
645
+ optional: true,
646
+ description: 'AI suggested resolution',
647
+ },
648
+ aiConfidence: {
649
+ type: 'number',
650
+ optional: true,
651
+ description: 'AI confidence score',
652
+ },
653
+ // Satisfaction
654
+ satisfactionScore: {
655
+ type: 'number',
656
+ optional: true,
657
+ description: 'Customer satisfaction score',
658
+ },
659
+ satisfactionComment: {
660
+ type: 'string',
661
+ optional: true,
662
+ description: 'Satisfaction comment',
663
+ },
664
+ // Status
665
+ status: {
666
+ type: 'string',
667
+ description: 'Ticket status',
668
+ examples: ['new', 'open', 'pending', 'on-hold', 'escalated', 'solved', 'closed'],
669
+ },
670
+ },
671
+ relationships: {
672
+ customer: {
673
+ type: 'ServiceCustomer',
674
+ description: 'Customer',
675
+ },
676
+ service: {
677
+ type: 'ProductizedService',
678
+ required: false,
679
+ description: 'Related service',
680
+ },
681
+ incident: {
682
+ type: 'ServiceIncident',
683
+ required: false,
684
+ description: 'Related incident',
685
+ },
686
+ messages: {
687
+ type: 'TicketMessage[]',
688
+ description: 'Ticket messages',
689
+ },
690
+ },
691
+ actions: [
692
+ 'create',
693
+ 'assign',
694
+ 'respond',
695
+ 'escalate',
696
+ 'solve',
697
+ 'close',
698
+ 'reopen',
699
+ ],
700
+ events: [
701
+ 'created',
702
+ 'assigned',
703
+ 'responded',
704
+ 'escalated',
705
+ 'solved',
706
+ 'closed',
707
+ 'reopened',
708
+ 'ratedByCustomer',
709
+ ],
710
+ };
711
+ // =============================================================================
712
+ // ServiceFeedback
713
+ // =============================================================================
714
+ /**
715
+ * ServiceFeedback entity
716
+ *
717
+ * Customer feedback on service.
718
+ */
719
+ export const ServiceFeedback = {
720
+ singular: 'service-feedback',
721
+ plural: 'service-feedbacks',
722
+ description: 'Customer feedback on a service',
723
+ properties: {
724
+ // Identity
725
+ id: {
726
+ type: 'string',
727
+ description: 'Feedback ID',
728
+ },
729
+ // Rating
730
+ rating: {
731
+ type: 'number',
732
+ optional: true,
733
+ description: 'Rating score (1-5)',
734
+ },
735
+ npsScore: {
736
+ type: 'number',
737
+ optional: true,
738
+ description: 'NPS score (0-10)',
739
+ },
740
+ satisfactionScore: {
741
+ type: 'number',
742
+ optional: true,
743
+ description: 'Satisfaction score (1-5)',
744
+ },
745
+ // Content
746
+ comment: {
747
+ type: 'string',
748
+ optional: true,
749
+ description: 'Feedback comment',
750
+ },
751
+ highlights: {
752
+ type: 'string',
753
+ array: true,
754
+ optional: true,
755
+ description: 'Positive highlights',
756
+ },
757
+ improvements: {
758
+ type: 'string',
759
+ array: true,
760
+ optional: true,
761
+ description: 'Suggested improvements',
762
+ },
763
+ // Type
764
+ type: {
765
+ type: 'string',
766
+ description: 'Feedback type',
767
+ examples: ['post-execution', 'periodic', 'exit', 'support', 'spontaneous'],
768
+ },
769
+ trigger: {
770
+ type: 'string',
771
+ optional: true,
772
+ description: 'What triggered feedback request',
773
+ },
774
+ // Context
775
+ context: {
776
+ type: 'json',
777
+ optional: true,
778
+ description: 'Feedback context',
779
+ },
780
+ // Sentiment
781
+ sentiment: {
782
+ type: 'string',
783
+ optional: true,
784
+ description: 'Detected sentiment',
785
+ examples: ['positive', 'neutral', 'negative', 'mixed'],
786
+ },
787
+ sentimentScore: {
788
+ type: 'number',
789
+ optional: true,
790
+ description: 'Sentiment score (-1 to 1)',
791
+ },
792
+ // Follow-up
793
+ requiresFollowUp: {
794
+ type: 'boolean',
795
+ optional: true,
796
+ description: 'Requires follow-up',
797
+ },
798
+ followedUpAt: {
799
+ type: 'date',
800
+ optional: true,
801
+ description: 'Follow-up date',
802
+ },
803
+ // Dates
804
+ submittedAt: {
805
+ type: 'date',
806
+ optional: true,
807
+ description: 'Submission time',
808
+ },
809
+ // Status
810
+ status: {
811
+ type: 'string',
812
+ description: 'Feedback status',
813
+ examples: ['submitted', 'reviewed', 'actioned', 'archived'],
814
+ },
815
+ },
816
+ relationships: {
817
+ customer: {
818
+ type: 'ServiceCustomer',
819
+ description: 'Customer',
820
+ },
821
+ service: {
822
+ type: 'ProductizedService',
823
+ description: 'Service',
824
+ },
825
+ execution: {
826
+ type: 'ServiceExecution',
827
+ required: false,
828
+ description: 'Related execution',
829
+ },
830
+ ticket: {
831
+ type: 'SupportTicket',
832
+ required: false,
833
+ description: 'Related ticket',
834
+ },
835
+ },
836
+ actions: [
837
+ 'submit',
838
+ 'review',
839
+ 'action',
840
+ 'followUp',
841
+ 'archive',
842
+ ],
843
+ events: [
844
+ 'submitted',
845
+ 'reviewed',
846
+ 'actioned',
847
+ 'followedUp',
848
+ 'archived',
849
+ ],
850
+ };
851
+ // =============================================================================
852
+ // ServiceMetric
853
+ // =============================================================================
854
+ /**
855
+ * ServiceMetric entity
856
+ *
857
+ * Service performance metric.
858
+ */
859
+ export const ServiceMetric = {
860
+ singular: 'service-metric',
861
+ plural: 'service-metrics',
862
+ description: 'A service performance metric',
863
+ properties: {
864
+ // Identity
865
+ name: {
866
+ type: 'string',
867
+ description: 'Metric name',
868
+ },
869
+ description: {
870
+ type: 'string',
871
+ optional: true,
872
+ description: 'Metric description',
873
+ },
874
+ // Classification
875
+ type: {
876
+ type: 'string',
877
+ description: 'Metric type',
878
+ examples: ['counter', 'gauge', 'histogram', 'summary'],
879
+ },
880
+ category: {
881
+ type: 'string',
882
+ optional: true,
883
+ description: 'Metric category',
884
+ examples: ['performance', 'reliability', 'usage', 'cost', 'quality'],
885
+ },
886
+ // Value
887
+ value: {
888
+ type: 'number',
889
+ optional: true,
890
+ description: 'Current value',
891
+ },
892
+ unit: {
893
+ type: 'string',
894
+ optional: true,
895
+ description: 'Unit of measure',
896
+ },
897
+ // Aggregation
898
+ aggregation: {
899
+ type: 'string',
900
+ optional: true,
901
+ description: 'Aggregation method',
902
+ examples: ['sum', 'avg', 'min', 'max', 'p50', 'p95', 'p99', 'count'],
903
+ },
904
+ windowDuration: {
905
+ type: 'string',
906
+ optional: true,
907
+ description: 'Aggregation window',
908
+ },
909
+ // Dimensions
910
+ dimensions: {
911
+ type: 'json',
912
+ optional: true,
913
+ description: 'Metric dimensions/labels',
914
+ },
915
+ // Targets
916
+ targetValue: {
917
+ type: 'number',
918
+ optional: true,
919
+ description: 'Target value',
920
+ },
921
+ warningThreshold: {
922
+ type: 'number',
923
+ optional: true,
924
+ description: 'Warning threshold',
925
+ },
926
+ criticalThreshold: {
927
+ type: 'number',
928
+ optional: true,
929
+ description: 'Critical threshold',
930
+ },
931
+ // Trends
932
+ trend: {
933
+ type: 'string',
934
+ optional: true,
935
+ description: 'Value trend',
936
+ examples: ['improving', 'stable', 'degrading'],
937
+ },
938
+ changePercent: {
939
+ type: 'number',
940
+ optional: true,
941
+ description: 'Change percentage from previous period',
942
+ },
943
+ // Timestamps
944
+ lastUpdatedAt: {
945
+ type: 'date',
946
+ optional: true,
947
+ description: 'Last update time',
948
+ },
949
+ periodStart: {
950
+ type: 'date',
951
+ optional: true,
952
+ description: 'Period start',
953
+ },
954
+ periodEnd: {
955
+ type: 'date',
956
+ optional: true,
957
+ description: 'Period end',
958
+ },
959
+ // Status
960
+ status: {
961
+ type: 'string',
962
+ description: 'Metric status',
963
+ examples: ['healthy', 'warning', 'critical', 'unknown'],
964
+ },
965
+ },
966
+ relationships: {
967
+ service: {
968
+ type: 'ProductizedService',
969
+ description: 'Service measured',
970
+ },
971
+ slo: {
972
+ type: 'SLO',
973
+ required: false,
974
+ description: 'Related SLO',
975
+ },
976
+ },
977
+ actions: [
978
+ 'create',
979
+ 'update',
980
+ 'record',
981
+ 'aggregate',
982
+ 'alert',
983
+ ],
984
+ events: [
985
+ 'created',
986
+ 'updated',
987
+ 'recorded',
988
+ 'aggregated',
989
+ 'thresholdExceeded',
990
+ 'recovered',
991
+ ],
992
+ };
993
+ // =============================================================================
994
+ // Exports
995
+ // =============================================================================
996
+ export const OperationsEntities = {
997
+ SLA,
998
+ SLO,
999
+ ServiceIncident,
1000
+ SupportTicket,
1001
+ ServiceFeedback,
1002
+ ServiceMetric,
1003
+ };
1004
+ export const OperationsCategories = {
1005
+ agreements: ['SLA', 'SLO'],
1006
+ incidents: ['ServiceIncident'],
1007
+ support: ['SupportTicket', 'ServiceFeedback'],
1008
+ metrics: ['ServiceMetric'],
1009
+ };
1010
+ //# sourceMappingURL=operations.js.map