@dx-do/client 7.7.2 → 7.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs.js CHANGED
@@ -267,6 +267,608 @@ exports.AlarmEnrichmentFilter = void 0;
267
267
  AlarmEnrichmentFilter.convertFilterToNode = convertFilterToNode;
268
268
  })(exports.AlarmEnrichmentFilter || (exports.AlarmEnrichmentFilter = {}));
269
269
 
270
+ /**
271
+ * Write bodies for notification policies (`dxinotify/notify/v1/filters`) and
272
+ * message templates (`dxinotify/notify/v1/templates`) — the key sets the UI
273
+ * sends, observed in HAR captures on the lab tenant. Both endpoints use one
274
+ * `PUT` for create and update: policies discriminate on `id` (0 creates),
275
+ * templates on `oldTemplateName` (null creates, the current name updates).
276
+ * The read shapes carry more (author, timestamps, contentVersion, …); the
277
+ * projections below drop them.
278
+ */
279
+ const PolicyLinkedEntitySchema = v4.z.looseObject({
280
+ channelName: v4.z.string().describe('Channel the policy delivers to'),
281
+ messageTemplateName: v4.z
282
+ .string()
283
+ .nullable()
284
+ .optional()
285
+ .describe('Template override for this channel; "" (write) / null (read) for the channel default'),
286
+ });
287
+ const PolicyWriteBodySchema = v4.z.looseObject({
288
+ id: v4.z.number().describe('Policy id; 0 creates, an existing id updates in place'),
289
+ orgId: v4.z.string().describe('Tenant common name; stamped by the service'),
290
+ keyLevel: v4.z.number().describe('1 for user policies (the built-in default policy reads -1)'),
291
+ name: v4.z.string().min(1).describe('Policy (filter) name; unique per tenant'),
292
+ filterType: v4.z.string().describe('"AUTOMATIC" or "MANUAL"'),
293
+ reminderTime: v4.z.number().describe('Reminder interval; 0 = none'),
294
+ reminderTimeUnit: v4.z.string().describe('Reminder unit, e.g. HOURS'),
295
+ channelNames: v4.z.array(v4.z.string()).describe('Channels the policy delivers to, by name'),
296
+ active: v4.z.boolean().describe('true = enabled'),
297
+ description: v4.z.string().describe('Free-text description'),
298
+ alarmCategory: v4.z.string().describe('rawAlarm, service, or SituationCluster'),
299
+ serviceAlarmAction: v4.z.boolean().describe('Service-alarm action flag'),
300
+ filterExpressionV1: v4.z.unknown().describe('Opaque alarm-match expression tree, round-tripped verbatim'),
301
+ isComplexFilter: v4.z.boolean().describe('Complex-filter flag'),
302
+ jobInfo: v4.z.unknown().nullable().optional().describe('null on UI writes'),
303
+ linkedEntities: v4.z.array(PolicyLinkedEntitySchema).describe('Channel ↔ template links'),
304
+ linkedMappings: v4.z.array(v4.z.unknown()).optional().describe('[] on UI writes'),
305
+ linkedActions: v4.z.array(v4.z.unknown()).optional().describe('Alarm actions; [] when none'),
306
+ });
307
+ const PolicyWriteResponseSchema = v4.z.looseObject({
308
+ newContentVersion: v4.z.number().describe('0 for a create, previous + 1 for an update'),
309
+ });
310
+ const TemplateWriteBodySchema = v4.z.looseObject({
311
+ orgId: v4.z.string().describe('Tenant common name; stamped by the service'),
312
+ keyLevel: v4.z.number().describe('Always 1'),
313
+ defaultTemplate: v4.z
314
+ .union([v4.z.boolean(), v4.z.string()])
315
+ .describe('Built-in platform template flag; false for user templates (the read shape carries "true"/"false" strings)'),
316
+ templateName: v4.z.string().min(1).describe('Template name; unique per tenant'),
317
+ oldTemplateName: v4.z
318
+ .string()
319
+ .nullable()
320
+ .describe('null creates; the current name updates in place (a different name renames)'),
321
+ contentVersion: v4.z.number().describe('0 on create; the current version on update'),
322
+ locale: v4.z.string().describe('Locale; "en_US" in practice'),
323
+ subjectTemplate: v4.z.string().describe('Subject line template'),
324
+ senderNameTemplate: v4.z.string().describe('Sender display name'),
325
+ imageUsage: v4.z.number().describe('0 in practice'),
326
+ channelNames: v4.z.array(v4.z.string()).describe('Channels using this template (reverse index); [] on create'),
327
+ useHtml: v4.z.boolean().describe('Render templateHtml instead of templateText'),
328
+ templateText: v4.z.string().describe('Body template, base64-encoded (stored and returned encoded)'),
329
+ templateHtml: v4.z.string().describe('HTML body; "" when unused'),
330
+ linkedEntities: v4.z.array(v4.z.unknown()).describe('Policy links (reverse index); [] on create'),
331
+ });
332
+ const TemplateWriteResponseSchema = v4.z.looseObject({
333
+ existingTemplateUpdated: v4.z.boolean().describe('true when an existing template was updated'),
334
+ newContentVersion: v4.z.number().describe('Content version after the save'),
335
+ });
336
+ /** Built-in / platform-managed policies read back with author SYSTEM (or none, for the default policy). */
337
+ function isBuiltInPolicy(policy) {
338
+ return policy.author === undefined || policy.author === null || policy.author === 'SYSTEM';
339
+ }
340
+ /** Built-in templates are flagged defaultTemplate; platform-provided ones without the flag have no author. */
341
+ function isBuiltInTemplate(template) {
342
+ return (template.defaultTemplate === true ||
343
+ template.defaultTemplate === 'true' ||
344
+ template.author === undefined ||
345
+ template.author === null);
346
+ }
347
+ /**
348
+ * Projects a policy as read from a tenant (or an export file) onto the write
349
+ * body the UI sends: read-only fields dropped, `id`/`orgId` replaced with the
350
+ * target's, `jobInfo` null, links reduced to channel + template names.
351
+ */
352
+ function toPolicyWriteBody(source, opts) {
353
+ const keyLevel = typeof source.keyLevel === 'number' && source.keyLevel >= 0 ? source.keyLevel : 1;
354
+ return {
355
+ id: opts.id,
356
+ orgId: opts.orgId,
357
+ keyLevel,
358
+ name: source.name,
359
+ filterType: source.filterType ?? 'AUTOMATIC',
360
+ reminderTime: source.reminderTime ?? 0,
361
+ reminderTimeUnit: source.reminderTimeUnit ?? 'HOURS',
362
+ channelNames: source.channelNames ?? [],
363
+ active: source.active ?? true,
364
+ description: source.description ?? '',
365
+ alarmCategory: source.alarmCategory ?? 'rawAlarm',
366
+ serviceAlarmAction: source.serviceAlarmAction ?? false,
367
+ filterExpressionV1: source.filterExpressionV1,
368
+ isComplexFilter: source.isComplexFilter ?? false,
369
+ jobInfo: null,
370
+ linkedEntities: (source.linkedEntities ?? []).map((link) => ({
371
+ channelName: link.channelName,
372
+ messageTemplateName: link.messageTemplateName ?? '',
373
+ })),
374
+ linkedMappings: [],
375
+ linkedActions: source.linkedActions ?? [],
376
+ };
377
+ }
378
+ /**
379
+ * Projects a template as read from a tenant (or an export file) onto the write
380
+ * body the UI sends. `oldTemplateName` null creates; pass the target's current
381
+ * name and contentVersion to update in place. templateText stays base64.
382
+ */
383
+ function toTemplateWriteBody(source, opts) {
384
+ return {
385
+ orgId: opts.orgId,
386
+ keyLevel: 1,
387
+ defaultTemplate: opts.defaultTemplate ?? false,
388
+ templateName: source.templateName,
389
+ oldTemplateName: opts.oldTemplateName,
390
+ contentVersion: opts.contentVersion,
391
+ locale: source.locale ?? 'en_US',
392
+ subjectTemplate: source.subjectTemplate ?? '',
393
+ senderNameTemplate: source.senderNameTemplate ?? '',
394
+ imageUsage: source.imageUsage ?? 0,
395
+ channelNames: opts.channelNames ?? [],
396
+ useHtml: source.useHtml ?? false,
397
+ templateText: source.templateText ?? '',
398
+ templateHtml: source.templateHtml ?? '',
399
+ linkedEntities: [],
400
+ };
401
+ }
402
+ // ---------------------------------------------------------------------------
403
+ // Policy filter expressions
404
+ // ---------------------------------------------------------------------------
405
+ const POLICY_ALARM_CATEGORIES = ['rawAlarm', 'service', 'SituationCluster'];
406
+ /**
407
+ * Conditions accepted in policy filter atoms. `equals`, `not_equals`,
408
+ * `greater_than`, `increases`, and `changed` are observed in UI-authored
409
+ * policies; the string matchers come from the platform's shared filter model.
410
+ */
411
+ const POLICY_FILTER_CONDITIONS = [
412
+ 'equals',
413
+ 'not_equals',
414
+ 'contains',
415
+ 'not_contains',
416
+ 'starts_with',
417
+ 'not_starts_with',
418
+ 'ends_with',
419
+ 'not_ends_with',
420
+ 'greater_than',
421
+ 'less_than',
422
+ 'increases',
423
+ 'decreases',
424
+ 'changed',
425
+ ];
426
+ const PolicyFilterAtomSchema = v4.z.looseObject({
427
+ field: v4.z.string().min(1).describe('Alarm field name (see the per-category field catalog)'),
428
+ fieldDescription: v4.z.string().optional().describe('Human label the UI stores next to the field'),
429
+ condition: v4.z.string().describe('One of the policy filter conditions, e.g. equals, not_equals, greater_than, changed'),
430
+ value: v4.z
431
+ .union([v4.z.string(), v4.z.boolean(), v4.z.number()])
432
+ .describe('Comparison value; "" for changed, the field name itself for increases/decreases'),
433
+ });
434
+ const PolicyFilterExpressionLazy = v4.z.lazy(() => v4.z.union([
435
+ PolicyFilterAtomSchema,
436
+ v4.z.looseObject({ and: v4.z.looseObject({ expressions: v4.z.array(PolicyFilterExpressionLazy) }) }),
437
+ v4.z.looseObject({ or: v4.z.looseObject({ expressions: v4.z.array(PolicyFilterExpressionLazy) }) }),
438
+ ]));
439
+ /** Recursive and/or tree of {@link PolicyFilterAtomSchema} atoms (`filterExpressionV1`). */
440
+ const PolicyFilterExpressionSchema = PolicyFilterExpressionLazy;
441
+ /**
442
+ * The atoms the UI prepends for a category so the policy only sees its own
443
+ * alarm kind: rawAlarm and SituationCluster are observed; service mirrors them.
444
+ */
445
+ function policyCategoryGuard(category) {
446
+ switch (category) {
447
+ case 'rawAlarm':
448
+ return [{ field: 'alarmType', fieldDescription: 'Alarm Type', condition: 'not_equals', value: 'Service' }];
449
+ case 'service':
450
+ return [{ field: 'alarmType', fieldDescription: 'Alarm Type', condition: 'equals', value: 'Service' }];
451
+ case 'SituationCluster':
452
+ return [
453
+ { field: 'alarmType', fieldDescription: 'Alarm Type', condition: 'equals', value: 'SituationCluster' },
454
+ { field: 'isOrphan', fieldDescription: 'Is Orphan', condition: 'equals', value: false },
455
+ ];
456
+ }
457
+ }
458
+ /**
459
+ * Builds `filterExpressionV1` the way the UI does: an outer AND of the
460
+ * category guard group and the user's atoms (AND-ed). No atoms → guard only.
461
+ */
462
+ function buildPolicyFilterExpression(category, atoms) {
463
+ const guard = { and: { expressions: policyCategoryGuard(category) } };
464
+ if (atoms.length === 0) {
465
+ return guard;
466
+ }
467
+ return { and: { expressions: [guard, { and: { expressions: atoms } }] } };
468
+ }
469
+ /** Flattens an expression into its atoms (for previews and field checks). */
470
+ function policyFilterAtoms(expression) {
471
+ if ('condition' in expression) {
472
+ return [expression];
473
+ }
474
+ if ('and' in expression) {
475
+ return expression.and.expressions.flatMap(policyFilterAtoms);
476
+ }
477
+ if ('or' in expression) {
478
+ return expression.or.expressions.flatMap(policyFilterAtoms);
479
+ }
480
+ return [];
481
+ }
482
+ /** One entry of the per-category alarm field catalog the policy editor offers. */
483
+ const AlarmFilterFieldSchema = v4.z.looseObject({
484
+ field: v4.z.string().describe('Field name to use in filter atoms'),
485
+ fieldDescription: v4.z.string().describe('Human label'),
486
+ values: v4.z.array(v4.z.string()).describe('Closed vocabulary when non-empty (e.g. severity levels)'),
487
+ fieldType: v4.z.string().describe('String, Number, …'),
488
+ });
489
+ const AlarmFilterFieldsResponseSchema = v4.z.array(AlarmFilterFieldSchema);
490
+ /** The catalog endpoint per alarm category (`GET`, bare array). */
491
+ const ALARM_FILTER_FIELD_PATHS = {
492
+ rawAlarm: 'oi/v2/api/normalizedalarms/fields',
493
+ service: 'oi/v2/api/dxservicealarms/fields',
494
+ SituationCluster: 'oi/v2/api/dxiclusteralarms/fields',
495
+ };
496
+ // ---------------------------------------------------------------------------
497
+ // Deletes (endpoints found by probing — absent from every UI HAR)
498
+ // ---------------------------------------------------------------------------
499
+ /** Response of `DELETE dxinotify/notify/v1/filters/{orgId}/{name}`. */
500
+ const PolicyDeleteResponseSchema = v4.z.looseObject({
501
+ deletedCount: v4.z.number().describe('1 when the policy was deleted'),
502
+ });
503
+ /** Response of `DELETE dxinotify/notify/v1/templates/{name}/{locale}/{orgId}`. */
504
+ const TemplateDeleteResponseSchema = v4.z.looseObject({
505
+ deletedCount: v4.z.number().describe('Rows removed (3 observed for one template: content plus its link rows)'),
506
+ });
507
+ const ITSM_TEMPLATE_KEYS = new Set([
508
+ 'ITSM_ALL_ALARM_TEMPLATE_NAME',
509
+ 'ITSM_SERVICE_ALARM_TEMPLATE_NAME',
510
+ 'ITSM_SITUATION_TEMPLATE_NAME',
511
+ ]);
512
+ /** Who uses a template, computed from the channel and policy lists (not the template's own reverse index, which can lag). */
513
+ function templateUsage(templateName, channels, policies) {
514
+ return {
515
+ channels: channels
516
+ .filter((channel) => (channel.smtpItsmConfigs?.templates ?? []).some((t) => t.templateName === templateName) ||
517
+ (channel.itsmConfig?.PropertyList ?? []).some((p) => ITSM_TEMPLATE_KEYS.has(p.propertyName) && p.propertyValue === templateName))
518
+ .map((channel) => channel.name),
519
+ policies: policies
520
+ .filter((policy) => (policy.linkedEntities ?? []).some((link) => link.messageTemplateName === templateName))
521
+ .map((policy) => policy.name),
522
+ };
523
+ }
524
+
525
+ /**
526
+ * Alarm enrichment rules: the priority-ordered rules of Settings → Alarm
527
+ * Enrichment Rules. Each rule matches alarms with an and/or filter tree and
528
+ * copies a TAS topology attribute (or a literal value) onto one of the
529
+ * alarm's `custom_N` fields.
530
+ *
531
+ * Store: `oi/v2/alarm/enrichment/rules` — `GET` lists, `PUT` saves one rule
532
+ * (no `rule_id` creates, an existing `rule_id` updates in place), `DELETE
533
+ * rules/{rule_id}` removes one, and `PUT rules/preview` runs the rule against
534
+ * recent alarms without persisting anything.
535
+ *
536
+ * Shapes observed in HARs of the demo and lab tenants
537
+ * (alarm-ticket-enrichment{,-2,-3}.har, 2026-09-08).
538
+ *
539
+ * @see {@link EnrichmentCustomFieldSchema} — the registry that binds an
540
+ * attribute name to its `custom_N` field and decides the TAS / CUSTOM arm.
541
+ */
542
+ /**
543
+ * Conditions the enrichment filter editor offers. Eight string matchers, a
544
+ * subset of the platform filter model's conditions — enrichment filters have
545
+ * no numeric or change-detection operators.
546
+ */
547
+ const ENRICHMENT_FILTER_CONDITIONS = [
548
+ 'equals',
549
+ 'not_equals',
550
+ 'contains',
551
+ 'not_contains',
552
+ 'starts_with',
553
+ 'not_starts_with',
554
+ 'ends_with',
555
+ 'not_ends_with',
556
+ ];
557
+ /** The two enrichment arms: a TAS topology attribute, or a literal CUSTOM value. */
558
+ const ENRICHMENT_SOURCES = ['TAS', 'CUSTOM'];
559
+ /** The preview windows the editor offers, in seconds. The query param is milliseconds. */
560
+ const ENRICHMENT_PREVIEW_WINDOWS = {
561
+ '1h': 3600,
562
+ '4h': 14400,
563
+ '8h': 28800,
564
+ '24h': 86400,
565
+ '3d': 259200,
566
+ '1w': 604800,
567
+ };
568
+ // ---------------------------------------------------------------------------
569
+ // Wire shapes
570
+ // ---------------------------------------------------------------------------
571
+ const EnrichmentMappingSchema = v4.z.looseObject({
572
+ alarmField: v4.z
573
+ .string()
574
+ .min(1)
575
+ .describe("Target alarm field, always a custom slot ('custom_16'); from the custom-field registry"),
576
+ enrichmentField: v4.z
577
+ .string()
578
+ .describe("Source: a TAS vertex attribute name ('networkInterfaces') or the CUSTOM entry's label"),
579
+ defaultValue: v4.z.string().describe("Value written when the source resolves to nothing; '' for none"),
580
+ });
581
+ const EnrichmentSchema = v4.z.looseObject({
582
+ type: v4.z.enum(ENRICHMENT_SOURCES).describe("'TAS' resolves from the topology graph; 'CUSTOM' writes a literal"),
583
+ filename: v4.z
584
+ .string()
585
+ .nullable()
586
+ .optional()
587
+ .describe('Reserved for CSV-backed CUSTOM enrichment; the UI sends null on save and the server drops it'),
588
+ mappings: v4.z.array(EnrichmentMappingSchema).describe('Mappings of this arm; [] when the arm is unused'),
589
+ });
590
+ const EnrichmentRuleSchema = v4.z.looseObject({
591
+ tenant_id: v4.z.string().describe('Cohort UUID the rule belongs to; server-assigned'),
592
+ rule_id: v4.z.string().describe('Rule UUID; the identifier for detail, update, reorder and delete'),
593
+ rule_name: v4.z.string().describe('Display name; unique per tenant, enforced by the server'),
594
+ priority: v4.z
595
+ .number()
596
+ .describe('Evaluation order, ascending — lower runs first. Seeded from the create timestamp; a reorder ' +
597
+ 'writes the midpoint of its new neighbours, hence fractional values'),
598
+ rule_version: v4.z.number().describe('Optimistic version; send the current value, the server increments it'),
599
+ created_by: v4.z.string().optional().describe('Email of the creator'),
600
+ updated_by: v4.z.string().optional().describe('Email of the last editor'),
601
+ created_time: v4.z.number().optional().describe('Epoch milliseconds'),
602
+ updated_time: v4.z.number().optional().describe('Epoch milliseconds'),
603
+ enabled: v4.z.boolean().describe('Whether the rule is evaluated'),
604
+ filter: PolicyFilterExpressionSchema.describe('and/or tree of match atoms over the enrichment field catalog'),
605
+ filterSearchFields: v4.z.array(v4.z.unknown()).optional().describe('UI search state; always [] in captures'),
606
+ enrichments: v4.z.array(EnrichmentSchema).describe('One entry per arm; the UI always sends both TAS and CUSTOM'),
607
+ isComplexFilter: v4.z.boolean().optional().describe('true when the filter was authored in the raw expression editor'),
608
+ });
609
+ const EnrichmentRulesResponseSchema = v4.z.array(EnrichmentRuleSchema);
610
+ /**
611
+ * The body of `PUT oi/v2/alarm/enrichment/rules`. Omitting `rule_id` creates a
612
+ * rule and lets the server seed `priority` from the create time; sending one
613
+ * updates in place, and is also how a reorder writes a new `priority`.
614
+ */
615
+ const EnrichmentRuleWriteBodySchema = v4.z.looseObject({
616
+ rule_id: v4.z.string().optional().describe('Rule UUID; absent creates, present updates in place'),
617
+ rule_name: v4.z
618
+ .string()
619
+ .min(1)
620
+ .describe('Display name; must be unique in the tenant — a clash is rejected with 400 "Duplicate rule name provided"'),
621
+ enabled: v4.z.boolean().describe('Whether the rule is evaluated'),
622
+ filter: PolicyFilterExpressionSchema.describe('and/or tree of match atoms'),
623
+ isComplexFilter: v4.z.boolean().describe('false for trees built from atoms'),
624
+ enrichments: v4.z.array(EnrichmentSchema).describe('Both arms, each with its mappings ([] when unused)'),
625
+ priority: v4.z.number().optional().describe('Update only: the new evaluation order. Absent on create'),
626
+ rule_version: v4.z.number().optional().describe('Update only: the rule\'s current version, echoed back'),
627
+ tenant_id: v4.z.string().optional().describe('Update only: echoed from the existing rule'),
628
+ created_by: v4.z.string().optional().describe('Update only: echoed from the existing rule'),
629
+ updated_by: v4.z.string().optional().describe('Update only: echoed from the existing rule'),
630
+ created_time: v4.z.number().optional().describe('Update only: echoed from the existing rule'),
631
+ updated_time: v4.z.number().optional().describe('Update only: echoed from the existing rule'),
632
+ filterSearchFields: v4.z.array(v4.z.unknown()).optional().describe('Update only: echoed from the existing rule'),
633
+ });
634
+ /**
635
+ * The response of `PUT oi/v2/alarm/enrichment/rules/preview`. A server-side dry
636
+ * run: it accepts a rule with no `rule_id` and persists nothing.
637
+ */
638
+ const EnrichmentPreviewResponseSchema = v4.z.looseObject({
639
+ alarmCount: v4.z
640
+ .union([v4.z.string(), v4.z.number()])
641
+ .describe('Matching alarms in the window, as a string in captures ("0")'),
642
+ alarms: v4.z.array(v4.z.looseObject({})).describe('The matched alarms, up to `size`, with the enrichment applied'),
643
+ pageNumber: v4.z.number().nullable().optional().describe('Null in captures'),
644
+ pageSize: v4.z.number().nullable().optional().describe('Null in captures'),
645
+ aggregatedData: v4.z.unknown().optional().describe('Null in captures'),
646
+ itsmEnabled: v4.z.boolean().optional().describe('Whether the tenant has an ITSM integration'),
647
+ });
648
+ /**
649
+ * One entry of the custom-field registry
650
+ * (`oi/v3/api/notifications/configAttributes?configKey=custom.field.description`).
651
+ * This is what binds a `custom_N` slot to an attribute name and decides which
652
+ * arm a mapping lands in. The `PUT` replaces the whole list.
653
+ */
654
+ const EnrichmentCustomFieldSchema = v4.z.looseObject({
655
+ field: v4.z.string().describe("The custom slot, 'custom_11' through 'custom_24' in captures"),
656
+ fieldDescription: v4.z
657
+ .string()
658
+ .describe("The attribute name a mapping references as its enrichmentField ('networkInterfaces')"),
659
+ fieldType: v4.z.string().describe("Value type; 'String' in every capture"),
660
+ fieldSource: v4.z.string().describe("'TAS' resolves from the topology graph, 'CUSTOM' holds a literal"),
661
+ });
662
+ const EnrichmentCustomFieldsResponseSchema = v4.z.array(EnrichmentCustomFieldSchema);
663
+ /** `custom_1` … `custom_N`; the only shape the registry and mappings accept. */
664
+ const CUSTOM_FIELD_PATTERN = /^custom_\d+$/;
665
+ /**
666
+ * Resolves attribute names into the two enrichment arms the way the editor
667
+ * does: look the name up as `fieldDescription` in the custom-field registry;
668
+ * found gives the `custom_N` slot and, when `fieldSource` is CUSTOM, the CUSTOM
669
+ * arm; anything else lands in TAS.
670
+ *
671
+ * @remarks Always returns both arms, an empty `mappings` where unused — the
672
+ * shape the UI sends.
673
+ */
674
+ function resolveEnrichmentMappings(input, registry) {
675
+ const blockers = [];
676
+ const warnings = [];
677
+ const tas = [];
678
+ const custom = [];
679
+ const claimed = new Map();
680
+ for (const attribute of input.attributes) {
681
+ const entry = registry.find((candidate) => candidate.fieldDescription === attribute);
682
+ const override = input.alarmFields?.[attribute];
683
+ if (override !== undefined && !CUSTOM_FIELD_PATTERN.test(override)) {
684
+ blockers.push(`alarmField.${attribute}='${override}' is not a custom slot (expected custom_<n>)`);
685
+ continue;
686
+ }
687
+ const alarmField = override ?? entry?.field;
688
+ if (!alarmField) {
689
+ blockers.push(`'${attribute}' is not in the custom-field registry and no alarmField.${attribute}=custom_<n> was given ` +
690
+ '(see `alarm list-enrichment-custom-fields`)');
691
+ continue;
692
+ }
693
+ const previous = claimed.get(alarmField);
694
+ if (previous !== undefined) {
695
+ blockers.push(`${alarmField} is mapped twice, by '${previous}' and '${attribute}'`);
696
+ continue;
697
+ }
698
+ claimed.set(alarmField, attribute);
699
+ if (!entry) {
700
+ warnings.push(`'${attribute}' is not in the custom-field registry; the alarm will carry ${alarmField} but nothing ` +
701
+ 'labels it — register it with `alarm register-enrichment-custom-field`');
702
+ }
703
+ else if (override !== undefined && override !== entry.field) {
704
+ warnings.push(`'${attribute}' is registered as ${entry.field}; alarmField.${attribute}=${override} overrides that`);
705
+ }
706
+ const mapping = {
707
+ alarmField,
708
+ enrichmentField: attribute,
709
+ defaultValue: input.defaults?.[attribute] ?? '',
710
+ };
711
+ if (entry && entry.fieldSource.toUpperCase() === 'CUSTOM') {
712
+ custom.push(mapping);
713
+ }
714
+ else {
715
+ tas.push(mapping);
716
+ }
717
+ }
718
+ return {
719
+ enrichments: [
720
+ { type: 'TAS', filename: null, mappings: tas },
721
+ { type: 'CUSTOM', filename: null, mappings: custom },
722
+ ],
723
+ blockers,
724
+ warnings,
725
+ };
726
+ }
727
+ /** The create body: no `rule_id`, so the server assigns one and seeds `priority`. */
728
+ function toEnrichmentRuleCreateBody(input) {
729
+ return {
730
+ rule_name: input.ruleName,
731
+ enabled: input.enabled ?? true,
732
+ filter: input.filter,
733
+ isComplexFilter: input.isComplexFilter ?? false,
734
+ enrichments: input.enrichments,
735
+ };
736
+ }
737
+ /**
738
+ * Read-modify-write body for an existing rule: every server-owned field is
739
+ * echoed back, `rule_version` included, and only the patched fields change.
740
+ *
741
+ * @returns `changes` is the human before→after list; `[]` means nothing to save.
742
+ */
743
+ function buildEnrichmentRuleUpdateBody(existing, patch) {
744
+ const changes = [];
745
+ const ruleName = patch.ruleName ?? existing.rule_name;
746
+ if (patch.ruleName !== undefined && patch.ruleName !== existing.rule_name) {
747
+ changes.push(`name: '${existing.rule_name}' -> '${patch.ruleName}'`);
748
+ }
749
+ const enabled = patch.enabled ?? existing.enabled;
750
+ if (patch.enabled !== undefined && patch.enabled !== existing.enabled) {
751
+ changes.push(`enabled: ${existing.enabled} -> ${patch.enabled}`);
752
+ }
753
+ const priority = patch.priority ?? existing.priority;
754
+ if (patch.priority !== undefined && patch.priority !== existing.priority) {
755
+ changes.push(`priority: ${existing.priority} -> ${patch.priority}`);
756
+ }
757
+ const filter = patch.filter ?? existing.filter;
758
+ if (patch.filter !== undefined) {
759
+ changes.push('filter: replaced');
760
+ }
761
+ const enrichments = patch.enrichments ?? existing.enrichments;
762
+ if (patch.enrichments !== undefined) {
763
+ changes.push('enrichments: replaced');
764
+ }
765
+ const body = {
766
+ ...existing,
767
+ rule_name: ruleName,
768
+ enabled,
769
+ priority,
770
+ filter,
771
+ enrichments,
772
+ isComplexFilter: existing.isComplexFilter ?? false,
773
+ };
774
+ return { body, changes };
775
+ }
776
+ // ---------------------------------------------------------------------------
777
+ // Ordering
778
+ // ---------------------------------------------------------------------------
779
+ /**
780
+ * Evaluation order: ascending `priority`, the way the editor sorts. The list
781
+ * endpoint returns rules unsorted, so every consumer must sort for itself.
782
+ */
783
+ function sortRulesByPriority(rules) {
784
+ return [...rules].sort((left, right) => left.priority - right.priority);
785
+ }
786
+ /**
787
+ * Works out the `priority` that moves `ruleId` to the requested destination:
788
+ * the midpoint of its new neighbours, one below the head, or one above the
789
+ * tail. Exactly one of `position` / `before` / `after` / `priority` must be set.
790
+ *
791
+ * @remarks A reorder writes only the moved rule — priorities of its neighbours
792
+ * are left alone, which is why they drift fractional over time.
793
+ */
794
+ function planEnrichmentReorder(rules, ruleId, target) {
795
+ const blockers = [];
796
+ const sorted = sortRulesByPriority(rules);
797
+ const fromIndex = sorted.findIndex((rule) => rule.rule_id === ruleId);
798
+ const current = sorted[fromIndex];
799
+ const fromPosition = fromIndex + 1;
800
+ if (!current) {
801
+ return { priority: 0, fromPosition: 0, toPosition: 0, blockers: [`no enrichment rule with id '${ruleId}'`] };
802
+ }
803
+ const given = ['position', 'before', 'after', 'priority'].filter((key) => target[key] !== undefined);
804
+ if (given.length === 0) {
805
+ blockers.push('pass exactly one of position=, before=, after= or priority=');
806
+ return { priority: current.priority, fromPosition, toPosition: fromPosition, blockers };
807
+ }
808
+ if (given.length > 1) {
809
+ blockers.push(`pass exactly one destination, not ${given.join(' + ')}`);
810
+ return { priority: current.priority, fromPosition, toPosition: fromPosition, blockers };
811
+ }
812
+ const others = sorted.filter((rule) => rule.rule_id !== ruleId);
813
+ if (target.priority !== undefined) {
814
+ const wanted = target.priority;
815
+ const collision = others.find((rule) => rule.priority === wanted);
816
+ if (collision) {
817
+ blockers.push(`priority ${wanted} is already held by '${collision.rule_name}' (${collision.rule_id})`);
818
+ }
819
+ const toPosition = others.filter((rule) => rule.priority < wanted).length + 1;
820
+ return { priority: wanted, fromPosition, toPosition, blockers };
821
+ }
822
+ if (others.length === 0) {
823
+ blockers.push('there is only one enrichment rule — nothing to reorder');
824
+ return { priority: current.priority, fromPosition, toPosition: fromPosition, blockers };
825
+ }
826
+ let targetIndex;
827
+ if (target.position !== undefined) {
828
+ if (!Number.isInteger(target.position) || target.position < 1 || target.position > sorted.length) {
829
+ blockers.push(`position ${target.position} is out of range (1..${sorted.length})`);
830
+ return { priority: current.priority, fromPosition, toPosition: fromPosition, blockers };
831
+ }
832
+ targetIndex = target.position - 1;
833
+ }
834
+ else {
835
+ const anchorId = target.before ?? target.after;
836
+ const anchorIndex = others.findIndex((rule) => rule.rule_id === anchorId);
837
+ if (anchorIndex < 0) {
838
+ const label = target.before !== undefined ? 'before' : 'after';
839
+ const reason = sorted.some((rule) => rule.rule_id === anchorId)
840
+ ? `${label}='${anchorId}' is the rule being moved`
841
+ : `no enrichment rule with id '${anchorId}' for ${label}=`;
842
+ blockers.push(reason);
843
+ return { priority: current.priority, fromPosition, toPosition: fromPosition, blockers };
844
+ }
845
+ targetIndex = target.before !== undefined ? anchorIndex : anchorIndex + 1;
846
+ }
847
+ const previous = others[targetIndex - 1];
848
+ const next = others[targetIndex];
849
+ let priority;
850
+ if (!previous && next) {
851
+ priority = next.priority - 1;
852
+ }
853
+ else if (previous && !next) {
854
+ priority = previous.priority + 1;
855
+ }
856
+ else if (previous && next) {
857
+ priority = (previous.priority + next.priority) / 2;
858
+ if (priority === previous.priority || priority === next.priority) {
859
+ blockers.push(`no room between priority ${previous.priority} and ${next.priority} — set priority= explicitly ` +
860
+ 'or renumber the rules in the UI');
861
+ }
862
+ }
863
+ else {
864
+ priority = current.priority;
865
+ }
866
+ if (others.some((rule) => rule.priority === priority)) {
867
+ blockers.push(`the computed priority ${priority} collides with an existing rule — set priority= explicitly`);
868
+ }
869
+ return { priority, fromPosition, toPosition: targetIndex + 1, blockers };
870
+ }
871
+
270
872
  exports.AlarmEnrichment = void 0;
271
873
  (function (AlarmEnrichment) {
272
874
  /** @internal */
@@ -545,261 +1147,6 @@ exports.AlarmEnrichment = void 0;
545
1147
  ];
546
1148
  })(exports.AlarmEnrichment || (exports.AlarmEnrichment = {}));
547
1149
 
548
- /**
549
- * Write bodies for notification policies (`dxinotify/notify/v1/filters`) and
550
- * message templates (`dxinotify/notify/v1/templates`) — the key sets the UI
551
- * sends, observed in HAR captures on the lab tenant. Both endpoints use one
552
- * `PUT` for create and update: policies discriminate on `id` (0 creates),
553
- * templates on `oldTemplateName` (null creates, the current name updates).
554
- * The read shapes carry more (author, timestamps, contentVersion, …); the
555
- * projections below drop them.
556
- */
557
- const PolicyLinkedEntitySchema = v4.z.looseObject({
558
- channelName: v4.z.string().describe('Channel the policy delivers to'),
559
- messageTemplateName: v4.z
560
- .string()
561
- .nullable()
562
- .optional()
563
- .describe('Template override for this channel; "" (write) / null (read) for the channel default'),
564
- });
565
- const PolicyWriteBodySchema = v4.z.looseObject({
566
- id: v4.z.number().describe('Policy id; 0 creates, an existing id updates in place'),
567
- orgId: v4.z.string().describe('Tenant common name; stamped by the service'),
568
- keyLevel: v4.z.number().describe('1 for user policies (the built-in default policy reads -1)'),
569
- name: v4.z.string().min(1).describe('Policy (filter) name; unique per tenant'),
570
- filterType: v4.z.string().describe('"AUTOMATIC" or "MANUAL"'),
571
- reminderTime: v4.z.number().describe('Reminder interval; 0 = none'),
572
- reminderTimeUnit: v4.z.string().describe('Reminder unit, e.g. HOURS'),
573
- channelNames: v4.z.array(v4.z.string()).describe('Channels the policy delivers to, by name'),
574
- active: v4.z.boolean().describe('true = enabled'),
575
- description: v4.z.string().describe('Free-text description'),
576
- alarmCategory: v4.z.string().describe('rawAlarm, service, or SituationCluster'),
577
- serviceAlarmAction: v4.z.boolean().describe('Service-alarm action flag'),
578
- filterExpressionV1: v4.z.unknown().describe('Opaque alarm-match expression tree, round-tripped verbatim'),
579
- isComplexFilter: v4.z.boolean().describe('Complex-filter flag'),
580
- jobInfo: v4.z.unknown().nullable().optional().describe('null on UI writes'),
581
- linkedEntities: v4.z.array(PolicyLinkedEntitySchema).describe('Channel ↔ template links'),
582
- linkedMappings: v4.z.array(v4.z.unknown()).optional().describe('[] on UI writes'),
583
- linkedActions: v4.z.array(v4.z.unknown()).optional().describe('Alarm actions; [] when none'),
584
- });
585
- const PolicyWriteResponseSchema = v4.z.looseObject({
586
- newContentVersion: v4.z.number().describe('0 for a create, previous + 1 for an update'),
587
- });
588
- const TemplateWriteBodySchema = v4.z.looseObject({
589
- orgId: v4.z.string().describe('Tenant common name; stamped by the service'),
590
- keyLevel: v4.z.number().describe('Always 1'),
591
- defaultTemplate: v4.z
592
- .union([v4.z.boolean(), v4.z.string()])
593
- .describe('Built-in platform template flag; false for user templates (the read shape carries "true"/"false" strings)'),
594
- templateName: v4.z.string().min(1).describe('Template name; unique per tenant'),
595
- oldTemplateName: v4.z
596
- .string()
597
- .nullable()
598
- .describe('null creates; the current name updates in place (a different name renames)'),
599
- contentVersion: v4.z.number().describe('0 on create; the current version on update'),
600
- locale: v4.z.string().describe('Locale; "en_US" in practice'),
601
- subjectTemplate: v4.z.string().describe('Subject line template'),
602
- senderNameTemplate: v4.z.string().describe('Sender display name'),
603
- imageUsage: v4.z.number().describe('0 in practice'),
604
- channelNames: v4.z.array(v4.z.string()).describe('Channels using this template (reverse index); [] on create'),
605
- useHtml: v4.z.boolean().describe('Render templateHtml instead of templateText'),
606
- templateText: v4.z.string().describe('Body template, base64-encoded (stored and returned encoded)'),
607
- templateHtml: v4.z.string().describe('HTML body; "" when unused'),
608
- linkedEntities: v4.z.array(v4.z.unknown()).describe('Policy links (reverse index); [] on create'),
609
- });
610
- const TemplateWriteResponseSchema = v4.z.looseObject({
611
- existingTemplateUpdated: v4.z.boolean().describe('true when an existing template was updated'),
612
- newContentVersion: v4.z.number().describe('Content version after the save'),
613
- });
614
- /** Built-in / platform-managed policies read back with author SYSTEM (or none, for the default policy). */
615
- function isBuiltInPolicy(policy) {
616
- return policy.author === undefined || policy.author === null || policy.author === 'SYSTEM';
617
- }
618
- /** Built-in templates are flagged defaultTemplate; platform-provided ones without the flag have no author. */
619
- function isBuiltInTemplate(template) {
620
- return (template.defaultTemplate === true ||
621
- template.defaultTemplate === 'true' ||
622
- template.author === undefined ||
623
- template.author === null);
624
- }
625
- /**
626
- * Projects a policy as read from a tenant (or an export file) onto the write
627
- * body the UI sends: read-only fields dropped, `id`/`orgId` replaced with the
628
- * target's, `jobInfo` null, links reduced to channel + template names.
629
- */
630
- function toPolicyWriteBody(source, opts) {
631
- const keyLevel = typeof source.keyLevel === 'number' && source.keyLevel >= 0 ? source.keyLevel : 1;
632
- return {
633
- id: opts.id,
634
- orgId: opts.orgId,
635
- keyLevel,
636
- name: source.name,
637
- filterType: source.filterType ?? 'AUTOMATIC',
638
- reminderTime: source.reminderTime ?? 0,
639
- reminderTimeUnit: source.reminderTimeUnit ?? 'HOURS',
640
- channelNames: source.channelNames ?? [],
641
- active: source.active ?? true,
642
- description: source.description ?? '',
643
- alarmCategory: source.alarmCategory ?? 'rawAlarm',
644
- serviceAlarmAction: source.serviceAlarmAction ?? false,
645
- filterExpressionV1: source.filterExpressionV1,
646
- isComplexFilter: source.isComplexFilter ?? false,
647
- jobInfo: null,
648
- linkedEntities: (source.linkedEntities ?? []).map((link) => ({
649
- channelName: link.channelName,
650
- messageTemplateName: link.messageTemplateName ?? '',
651
- })),
652
- linkedMappings: [],
653
- linkedActions: source.linkedActions ?? [],
654
- };
655
- }
656
- /**
657
- * Projects a template as read from a tenant (or an export file) onto the write
658
- * body the UI sends. `oldTemplateName` null creates; pass the target's current
659
- * name and contentVersion to update in place. templateText stays base64.
660
- */
661
- function toTemplateWriteBody(source, opts) {
662
- return {
663
- orgId: opts.orgId,
664
- keyLevel: 1,
665
- defaultTemplate: opts.defaultTemplate ?? false,
666
- templateName: source.templateName,
667
- oldTemplateName: opts.oldTemplateName,
668
- contentVersion: opts.contentVersion,
669
- locale: source.locale ?? 'en_US',
670
- subjectTemplate: source.subjectTemplate ?? '',
671
- senderNameTemplate: source.senderNameTemplate ?? '',
672
- imageUsage: source.imageUsage ?? 0,
673
- channelNames: opts.channelNames ?? [],
674
- useHtml: source.useHtml ?? false,
675
- templateText: source.templateText ?? '',
676
- templateHtml: source.templateHtml ?? '',
677
- linkedEntities: [],
678
- };
679
- }
680
- // ---------------------------------------------------------------------------
681
- // Policy filter expressions
682
- // ---------------------------------------------------------------------------
683
- const POLICY_ALARM_CATEGORIES = ['rawAlarm', 'service', 'SituationCluster'];
684
- /**
685
- * Conditions accepted in policy filter atoms. `equals`, `not_equals`,
686
- * `greater_than`, `increases`, and `changed` are observed in UI-authored
687
- * policies; the string matchers come from the platform's shared filter model.
688
- */
689
- const POLICY_FILTER_CONDITIONS = [
690
- 'equals',
691
- 'not_equals',
692
- 'contains',
693
- 'not_contains',
694
- 'starts_with',
695
- 'not_starts_with',
696
- 'ends_with',
697
- 'not_ends_with',
698
- 'greater_than',
699
- 'less_than',
700
- 'increases',
701
- 'decreases',
702
- 'changed',
703
- ];
704
- const PolicyFilterAtomSchema = v4.z.looseObject({
705
- field: v4.z.string().min(1).describe('Alarm field name (see the per-category field catalog)'),
706
- fieldDescription: v4.z.string().optional().describe('Human label the UI stores next to the field'),
707
- condition: v4.z.string().describe('One of the policy filter conditions, e.g. equals, not_equals, greater_than, changed'),
708
- value: v4.z
709
- .union([v4.z.string(), v4.z.boolean(), v4.z.number()])
710
- .describe('Comparison value; "" for changed, the field name itself for increases/decreases'),
711
- });
712
- const PolicyFilterExpressionLazy = v4.z.lazy(() => v4.z.union([
713
- PolicyFilterAtomSchema,
714
- v4.z.looseObject({ and: v4.z.looseObject({ expressions: v4.z.array(PolicyFilterExpressionLazy) }) }),
715
- v4.z.looseObject({ or: v4.z.looseObject({ expressions: v4.z.array(PolicyFilterExpressionLazy) }) }),
716
- ]));
717
- /** Recursive and/or tree of {@link PolicyFilterAtomSchema} atoms (`filterExpressionV1`). */
718
- const PolicyFilterExpressionSchema = PolicyFilterExpressionLazy;
719
- /**
720
- * The atoms the UI prepends for a category so the policy only sees its own
721
- * alarm kind: rawAlarm and SituationCluster are observed; service mirrors them.
722
- */
723
- function policyCategoryGuard(category) {
724
- switch (category) {
725
- case 'rawAlarm':
726
- return [{ field: 'alarmType', fieldDescription: 'Alarm Type', condition: 'not_equals', value: 'Service' }];
727
- case 'service':
728
- return [{ field: 'alarmType', fieldDescription: 'Alarm Type', condition: 'equals', value: 'Service' }];
729
- case 'SituationCluster':
730
- return [
731
- { field: 'alarmType', fieldDescription: 'Alarm Type', condition: 'equals', value: 'SituationCluster' },
732
- { field: 'isOrphan', fieldDescription: 'Is Orphan', condition: 'equals', value: false },
733
- ];
734
- }
735
- }
736
- /**
737
- * Builds `filterExpressionV1` the way the UI does: an outer AND of the
738
- * category guard group and the user's atoms (AND-ed). No atoms → guard only.
739
- */
740
- function buildPolicyFilterExpression(category, atoms) {
741
- const guard = { and: { expressions: policyCategoryGuard(category) } };
742
- if (atoms.length === 0) {
743
- return guard;
744
- }
745
- return { and: { expressions: [guard, { and: { expressions: atoms } }] } };
746
- }
747
- /** Flattens an expression into its atoms (for previews and field checks). */
748
- function policyFilterAtoms(expression) {
749
- if ('condition' in expression) {
750
- return [expression];
751
- }
752
- if ('and' in expression) {
753
- return expression.and.expressions.flatMap(policyFilterAtoms);
754
- }
755
- if ('or' in expression) {
756
- return expression.or.expressions.flatMap(policyFilterAtoms);
757
- }
758
- return [];
759
- }
760
- /** One entry of the per-category alarm field catalog the policy editor offers. */
761
- const AlarmFilterFieldSchema = v4.z.looseObject({
762
- field: v4.z.string().describe('Field name to use in filter atoms'),
763
- fieldDescription: v4.z.string().describe('Human label'),
764
- values: v4.z.array(v4.z.string()).describe('Closed vocabulary when non-empty (e.g. severity levels)'),
765
- fieldType: v4.z.string().describe('String, Number, …'),
766
- });
767
- const AlarmFilterFieldsResponseSchema = v4.z.array(AlarmFilterFieldSchema);
768
- /** The catalog endpoint per alarm category (`GET`, bare array). */
769
- const ALARM_FILTER_FIELD_PATHS = {
770
- rawAlarm: 'oi/v2/api/normalizedalarms/fields',
771
- service: 'oi/v2/api/dxservicealarms/fields',
772
- SituationCluster: 'oi/v2/api/dxiclusteralarms/fields',
773
- };
774
- // ---------------------------------------------------------------------------
775
- // Deletes (endpoints found by probing — absent from every UI HAR)
776
- // ---------------------------------------------------------------------------
777
- /** Response of `DELETE dxinotify/notify/v1/filters/{orgId}/{name}`. */
778
- const PolicyDeleteResponseSchema = v4.z.looseObject({
779
- deletedCount: v4.z.number().describe('1 when the policy was deleted'),
780
- });
781
- /** Response of `DELETE dxinotify/notify/v1/templates/{name}/{locale}/{orgId}`. */
782
- const TemplateDeleteResponseSchema = v4.z.looseObject({
783
- deletedCount: v4.z.number().describe('Rows removed (3 observed for one template: content plus its link rows)'),
784
- });
785
- const ITSM_TEMPLATE_KEYS = new Set([
786
- 'ITSM_ALL_ALARM_TEMPLATE_NAME',
787
- 'ITSM_SERVICE_ALARM_TEMPLATE_NAME',
788
- 'ITSM_SITUATION_TEMPLATE_NAME',
789
- ]);
790
- /** Who uses a template, computed from the channel and policy lists (not the template's own reverse index, which can lag). */
791
- function templateUsage(templateName, channels, policies) {
792
- return {
793
- channels: channels
794
- .filter((channel) => (channel.smtpItsmConfigs?.templates ?? []).some((t) => t.templateName === templateName) ||
795
- (channel.itsmConfig?.PropertyList ?? []).some((p) => ITSM_TEMPLATE_KEYS.has(p.propertyName) && p.propertyValue === templateName))
796
- .map((channel) => channel.name),
797
- policies: policies
798
- .filter((policy) => (policy.linkedEntities ?? []).some((link) => link.messageTemplateName === templateName))
799
- .map((policy) => policy.name),
800
- };
801
- }
802
-
803
1150
  exports.PlatformFilters = void 0;
804
1151
  (function (PlatformFilters) {
805
1152
  PlatformFilters.ValidFieldConditions = [
@@ -28318,6 +28665,146 @@ function toItsmTestConnectionRequest(properties) {
28318
28665
  return request;
28319
28666
  }
28320
28667
 
28668
+ /**
28669
+ * Ticket enrichment rules: the per-ITSM-channel maps of Settings → Ticket
28670
+ * Enrichment Rules. Each rule sends alarm fields into service-desk fields
28671
+ * when a ticket is opened (e.g. the alarm's `startTime` into ServiceNow's
28672
+ * `opened_at`), or writes a literal.
28673
+ *
28674
+ * Store: `dxinotify/notify/v1/customMappings` — `GET /{orgId}` lists,
28675
+ * `PUT` saves one rule (`id: 0` creates, an existing id updates in place),
28676
+ * `DELETE /{orgId}/{id}` removes one. The list endpoint returns a bare `{}`
28677
+ * on a tenant with no rules, not `{ customMappings: [] }`.
28678
+ *
28679
+ * Shapes observed in HARs of the demo and lab tenants
28680
+ * (alarm-ticket-enrichment{,-2}.har, 2026-09-08), plus a live probe of the
28681
+ * alarm-type vocabulary against the lab tenant.
28682
+ */
28683
+ /** The three alarm kinds a rule can enrich tickets for. */
28684
+ const TICKET_ENRICHMENT_ALARM_TYPES = ['all_alarms', 'service_alarms', 'situations'];
28685
+ /**
28686
+ * The alarm-field catalog codes each alarm type maps to. An alarm field is
28687
+ * only usable in a rule when its own `alarmType` array carries the code for
28688
+ * the rule's type — the server answers 400 otherwise, with no explanation.
28689
+ * (Probed on the lab tenant: `startTime` is ALARMS_ALL + SITUATIONS, so a
28690
+ * `service_alarms` rule mapping it is rejected; `acknowledged`, which is
28691
+ * ALARMS_ALL + ALARMS_SERVICE, is accepted.)
28692
+ */
28693
+ const TICKET_ENRICHMENT_FIELD_CODES = {
28694
+ all_alarms: 'ALARMS_ALL',
28695
+ service_alarms: 'ALARMS_SERVICE',
28696
+ situations: 'SITUATIONS',
28697
+ };
28698
+ // ---------------------------------------------------------------------------
28699
+ // Wire shapes
28700
+ // ---------------------------------------------------------------------------
28701
+ const TicketEnrichmentMappingSchema = v4.z.looseObject({
28702
+ svcDeskField: v4.z
28703
+ .string()
28704
+ .min(1)
28705
+ .describe("Service-desk field to fill; the `mappedTo` of a channel's field catalog ('opened_at')"),
28706
+ alarmField: v4.z
28707
+ .looseObject({
28708
+ title: v4.z.string().describe("Human label of the alarm field ('StartTime')"),
28709
+ value: v4.z.string().describe("Alarm field name ('startTime'); '' when only a literal is sent"),
28710
+ })
28711
+ .describe('Alarm field the value comes from'),
28712
+ customization: v4.z.string().describe("Literal appended or sent instead of the alarm field; '' for none"),
28713
+ });
28714
+ const TicketEnrichmentRuleSchema = v4.z.looseObject({
28715
+ id: v4.z.number().describe('Rule id; the identifier for detail and delete'),
28716
+ orgId: v4.z.string().describe('Tenant common name (orgId); stamped by the service on write'),
28717
+ keyLevel: v4.z.number().describe('Tenant key level; 1 in every capture'),
28718
+ name: v4.z.string().describe('Display name; unique per tenant, enforced by the server'),
28719
+ description: v4.z.string().optional().describe('Free-text description'),
28720
+ contentVersion: v4.z.number().describe('Optimistic version; send the current value, the server increments it'),
28721
+ alarmType: v4.z.string().describe("Which alarms the rule applies to: all_alarms, service_alarms or situations"),
28722
+ author: v4.z.string().optional().describe('Display name of the last editor'),
28723
+ svcDeskType: v4.z.string().describe("The channel's service-desk product ('ServiceNow')"),
28724
+ created: v4.z.string().nullable().optional().describe('ISO-8601 creation timestamp'),
28725
+ lastUpdated: v4.z.string().nullable().optional().describe('ISO-8601 update timestamp'),
28726
+ mappings: v4.z.array(TicketEnrichmentMappingSchema).describe('Alarm field to service-desk field maps'),
28727
+ linkedPolicies: v4.z.array(v4.z.unknown()).optional().describe('Notification policies referencing the rule; [] in captures'),
28728
+ channelId: v4.z.number().describe('Id of the ITSM channel the rule belongs to'),
28729
+ cohortId: v4.z.string().optional().describe('Cohort UUID; server-assigned on write'),
28730
+ });
28731
+ /** `GET dxinotify/notify/v1/customMappings/{orgId}`. A tenant with no rules returns a bare `{}`. */
28732
+ const TicketEnrichmentListResponseSchema = v4.z.looseObject({
28733
+ customMappings: v4.z.array(TicketEnrichmentRuleSchema).optional().describe('The rules; absent when there are none'),
28734
+ });
28735
+ /** The body of `PUT dxinotify/notify/v1/customMappings`. `id: 0` creates. */
28736
+ const TicketEnrichmentWriteBodySchema = v4.z.looseObject({
28737
+ id: v4.z.number().describe('Rule id. 0 creates a new rule; an existing id updates it in place'),
28738
+ orgId: v4.z.string().describe('Tenant common name (orgId); stamped by the service on write'),
28739
+ keyLevel: v4.z.number().describe('Tenant key level; always 1'),
28740
+ name: v4.z
28741
+ .string()
28742
+ .min(1)
28743
+ .describe('Display name; must be unique in the tenant — a clash is rejected with a 500 naming the existing entity'),
28744
+ description: v4.z.string().describe("Free-text description; '' for none"),
28745
+ contentVersion: v4.z.number().describe('Current version on update, 1 on create; the server increments it'),
28746
+ alarmType: v4.z.enum(TICKET_ENRICHMENT_ALARM_TYPES).describe('Which alarms the rule applies to'),
28747
+ svcDeskType: v4.z.string().describe("The channel's service-desk product, echoed from the channel"),
28748
+ created: v4.z.string().nullable().describe('Echoed on update, null on create'),
28749
+ linkedPolicies: v4.z.array(v4.z.unknown()).describe('Notification policies referencing the rule; [] on create'),
28750
+ channelId: v4.z.number().describe('Id of the ITSM channel the rule belongs to'),
28751
+ mappings: v4.z.array(TicketEnrichmentMappingSchema).min(1).describe('At least one mapping is required'),
28752
+ });
28753
+ /** `PUT dxinotify/notify/v1/customMappings` — the persisted rule, including its new id on create. */
28754
+ const TicketEnrichmentWriteResponseSchema = v4.z.looseObject({
28755
+ returnValue: v4.z
28756
+ .looseObject({ message: v4.z.string().describe("'insert was successful' / 'update was successful'") })
28757
+ .optional()
28758
+ .describe('Server-side outcome message'),
28759
+ customMapping: TicketEnrichmentRuleSchema.optional().describe('The persisted rule, with its id'),
28760
+ });
28761
+ /**
28762
+ * One entry of `GET oi/v2/tenantmgmtservice/properties?channelId=<id>`: the
28763
+ * service-desk field catalog of one ITSM channel. `mappedTo` is the value a
28764
+ * mapping's `svcDeskField` takes.
28765
+ */
28766
+ const ServiceDeskFieldSchema = v4.z.looseObject({
28767
+ name: v4.z.string().describe("Internal name of the field ('assigneeGroup')"),
28768
+ mappedTo: v4.z.string().describe("The service-desk field a mapping targets ('assignment_group')"),
28769
+ description: v4.z.string().optional().describe('Human description of the field'),
28770
+ dataType: v4.z.string().optional().describe("Value type ('string', 'datetime')"),
28771
+ default: v4.z.string().optional().describe('Default value the service desk applies'),
28772
+ custom: v4.z.boolean().optional().describe('true for tenant-defined fields, false for product fields'),
28773
+ possibleValues: v4.z.array(v4.z.unknown()).optional().describe('Closed vocabulary when present'),
28774
+ });
28775
+ const ServiceDeskFieldsResponseSchema = v4.z.array(ServiceDeskFieldSchema);
28776
+ /**
28777
+ * One entry of
28778
+ * `GET oi/v2/api/alarm/messageTemplate/fields?usedInTicketEnrichment=true`:
28779
+ * the alarm fields a ticket enrichment rule can read.
28780
+ */
28781
+ const TicketEnrichmentAlarmFieldSchema = v4.z.looseObject({
28782
+ alarmFieldName: v4.z.string().describe("Alarm field name a mapping reads ('startTime')"),
28783
+ messageTemplateText: v4.z.string().describe("Human label stored as the mapping's alarmField.title"),
28784
+ alarmType: v4.z
28785
+ .array(v4.z.string())
28786
+ .describe('Catalog codes the field is valid for; must contain the rule type\'s code or the save is rejected'),
28787
+ description: v4.z.string().optional().describe('Free-text description; empty in captures'),
28788
+ });
28789
+ const TicketEnrichmentAlarmFieldsResponseSchema = v4.z.array(TicketEnrichmentAlarmFieldSchema);
28790
+ /** The create body: `id: 0`, `created: null`, `contentVersion: 1`. */
28791
+ function toTicketEnrichmentWriteBody(input) {
28792
+ return {
28793
+ id: 0,
28794
+ orgId: '',
28795
+ keyLevel: 1,
28796
+ name: input.name,
28797
+ description: input.description ?? '',
28798
+ contentVersion: 1,
28799
+ alarmType: input.alarmType ?? 'all_alarms',
28800
+ svcDeskType: input.svcDeskType,
28801
+ created: null,
28802
+ linkedPolicies: [],
28803
+ channelId: input.channelId,
28804
+ mappings: input.mappings,
28805
+ };
28806
+ }
28807
+
28321
28808
  // these aren't really private, but nor are they really useful to document
28322
28809
 
28323
28810
  /**
@@ -66865,9 +67352,126 @@ class AlarmService {
66865
67352
  mapAlarms(alarmAllPage.alarms);
66866
67353
  return alarmIdMap;
66867
67354
  }
66868
- /** Returns all alarm enrichment rules configured for the tenant. */
67355
+ /**
67356
+ * Lists every alarm enrichment rule of the tenant
67357
+ * (`GET oi/v2/alarm/enrichment/rules`).
67358
+ *
67359
+ * @remarks The server returns the rules **unsorted**. Evaluation order is
67360
+ * ascending `priority` — pass the result through `sortRulesByPriority`.
67361
+ * Response-validated, not thrown.
67362
+ */
66869
67363
  async getEnrichmentRules() {
66870
- return this.dxSaaSService.oiGet('oi/v2/alarm/enrichment/rules');
67364
+ const raw = await this.dxSaaSService.oiGet('oi/v2/alarm/enrichment/rules');
67365
+ const result = EnrichmentRulesResponseSchema.safeParse(raw);
67366
+ if (!result.success) {
67367
+ this.simpleLog.warn('EnrichmentRulesResponse validation warning:', result.error.message);
67368
+ }
67369
+ return raw;
67370
+ }
67371
+ /**
67372
+ * Saves one alarm enrichment rule (`PUT oi/v2/alarm/enrichment/rules`).
67373
+ * A body without `rule_id` creates and lets the server seed `priority`;
67374
+ * a body with one updates in place, which is also how a reorder writes a
67375
+ * new `priority`.
67376
+ *
67377
+ * @remarks Response-validated, not thrown.
67378
+ * @throws ZodError on a malformed body.
67379
+ */
67380
+ async saveEnrichmentRule(body) {
67381
+ EnrichmentRuleWriteBodySchema.parse(body);
67382
+ const raw = await this.dxSaaSService.oiPut('oi/v2/alarm/enrichment/rules', body);
67383
+ const result = EnrichmentRuleSchema.safeParse(raw);
67384
+ if (!result.success) {
67385
+ this.simpleLog.warn('EnrichmentRule validation warning:', result.error.message);
67386
+ }
67387
+ return raw;
67388
+ }
67389
+ /** Permanently deletes an alarm enrichment rule (`DELETE oi/v2/alarm/enrichment/rules/{ruleId}`). */
67390
+ async deleteEnrichmentRule(ruleId) {
67391
+ return this.dxSaaSService.oiDelete(`oi/v2/alarm/enrichment/rules/${encodeURIComponent(ruleId)}`);
67392
+ }
67393
+ /**
67394
+ * Runs a rule against recent alarms without persisting it
67395
+ * (`PUT oi/v2/alarm/enrichment/rules/preview`) — the server-side dry run
67396
+ * behind `alarm create-enrichment-rule`.
67397
+ *
67398
+ * @param body a full or partial rule; `rule_id` may be absent.
67399
+ * @param options `size` caps the returned alarms, `timeDurationInMillis`
67400
+ * is the lookback window (86400000 = 24 h in the UI's default).
67401
+ * @remarks Response-validated, not thrown.
67402
+ * @throws ZodError on a malformed body.
67403
+ */
67404
+ async previewEnrichmentRule(body, options = {}) {
67405
+ EnrichmentRuleWriteBodySchema.parse(body);
67406
+ const raw = await this.dxSaaSService.oiPut('oi/v2/alarm/enrichment/rules/preview', body, {
67407
+ size: options.size ?? 100,
67408
+ timeDurationInMillis: options.timeDurationInMillis ?? 86400000,
67409
+ });
67410
+ const result = EnrichmentPreviewResponseSchema.safeParse(raw);
67411
+ if (!result.success) {
67412
+ this.simpleLog.warn('EnrichmentPreviewResponse validation warning:', result.error.message);
67413
+ }
67414
+ return raw;
67415
+ }
67416
+ /**
67417
+ * The field catalog the enrichment filter editor offers
67418
+ * (`GET oi/v2/alarm/enrichment/fields`) — same shape as the queue and
67419
+ * filter catalogs, so `annotateAtoms` works against it unchanged.
67420
+ *
67421
+ * @remarks Response-validated, not thrown.
67422
+ */
67423
+ async listEnrichmentFilterFields() {
67424
+ const raw = await this.dxSaaSService.oiGet('oi/v2/alarm/enrichment/fields');
67425
+ const result = AlarmQueueFieldsResponseSchema.safeParse(raw);
67426
+ if (!result.success) {
67427
+ this.simpleLog.warn('Enrichment field catalog validation warning:', result.error.message);
67428
+ }
67429
+ return raw;
67430
+ }
67431
+ /** The topology vertex types enrichment can read attributes from (`GET oi/v2/alarm/enrichment/vertexTypes`). */
67432
+ async listEnrichmentVertexTypes() {
67433
+ return this.dxSaaSService.oiGet('oi/v2/alarm/enrichment/vertexTypes');
67434
+ }
67435
+ /** The attribute names of one vertex type (`GET oi/v2/alarm/enrichment/attributesByVertexType`). */
67436
+ async listEnrichmentVertexAttributes(vertexType) {
67437
+ return this.dxSaaSService.oiGet('oi/v2/alarm/enrichment/attributesByVertexType', { vertexType });
67438
+ }
67439
+ /**
67440
+ * The custom-field registry that binds each `custom_N` slot to an attribute
67441
+ * name and its TAS / CUSTOM source
67442
+ * (`GET oi/v3/api/notifications/configAttributes?configKey=custom.field.description`).
67443
+ *
67444
+ * @remarks Response-validated, not thrown.
67445
+ */
67446
+ async listEnrichmentCustomFields() {
67447
+ const raw = await this.dxSaaSService.oiGet('oi/v3/api/notifications/configAttributes', {
67448
+ configKey: 'custom.field.description',
67449
+ });
67450
+ const result = EnrichmentCustomFieldsResponseSchema.safeParse(raw);
67451
+ if (!result.success) {
67452
+ this.simpleLog.warn('EnrichmentCustomFields validation warning:', result.error.message);
67453
+ }
67454
+ return raw;
67455
+ }
67456
+ /**
67457
+ * Replaces the whole custom-field registry
67458
+ * (`PUT oi/v3/api/notifications/configAttributes?configKey=custom.field.description`).
67459
+ *
67460
+ * @remarks The PUT is a **whole-list replace**, not a merge — read the
67461
+ * current list, edit it, and send all of it back, or entries are lost.
67462
+ * Response-validated, not thrown.
67463
+ * @throws ZodError on a malformed list.
67464
+ */
67465
+ async saveEnrichmentCustomFields(fields) {
67466
+ EnrichmentCustomFieldsResponseSchema.parse(fields);
67467
+ const raw = await this.dxSaaSService.oiPut('oi/v3/api/notifications/configAttributes', fields, {
67468
+ configKey: 'custom.field.description',
67469
+ });
67470
+ const result = EnrichmentCustomFieldsResponseSchema.safeParse(raw);
67471
+ if (!result.success) {
67472
+ this.simpleLog.warn('EnrichmentCustomFields validation warning:', result.error.message);
67473
+ }
67474
+ return raw;
66871
67475
  }
66872
67476
  /**
66873
67477
  * Lists the alarm queues visible to the caller
@@ -69604,6 +70208,85 @@ class ChannelService {
69604
70208
  }
69605
70209
  return raw;
69606
70210
  }
70211
+ // -------------------------------------------------------------------------
70212
+ // Ticket enrichment rules (customMappings)
70213
+ // -------------------------------------------------------------------------
70214
+ /**
70215
+ * Lists the tenant's ticket enrichment rules
70216
+ * (`GET dxinotify/notify/v1/customMappings/{orgId}`).
70217
+ *
70218
+ * @remarks A tenant with no rules answers with a bare `{}`, not
70219
+ * `{ customMappings: [] }` — normalised to `[]` here.
70220
+ * Response-validated, not thrown.
70221
+ */
70222
+ async listTicketEnrichmentRules() {
70223
+ const raw = await this.notifyRequest('get', 'dxinotify/notify/v1/customMappings', true);
70224
+ const result = TicketEnrichmentListResponseSchema.safeParse(raw);
70225
+ if (!result.success) {
70226
+ this.log.warn('TicketEnrichmentListResponse validation warning:', result.error.message);
70227
+ }
70228
+ return raw.customMappings ?? [];
70229
+ }
70230
+ /**
70231
+ * Saves one ticket enrichment rule
70232
+ * (`PUT dxinotify/notify/v1/customMappings`). `id: 0` creates, an
70233
+ * existing id updates in place.
70234
+ *
70235
+ * @remarks `orgId` is stamped from the caller's token, so the body's value
70236
+ * is ignored. Unlike `saveChannel`, the response carries the persisted rule
70237
+ * including its new id. Response-validated, not thrown.
70238
+ * @throws ZodError on a malformed body.
70239
+ */
70240
+ async saveTicketEnrichmentRule(body) {
70241
+ const stamped = { ...body, orgId: await this.dxSaaSService.getTenantCN() };
70242
+ TicketEnrichmentWriteBodySchema.parse(stamped);
70243
+ const raw = await this.notifyRequest('put', 'dxinotify/notify/v1/customMappings', false, stamped);
70244
+ const result = TicketEnrichmentWriteResponseSchema.safeParse(raw);
70245
+ if (!result.success) {
70246
+ this.log.warn('TicketEnrichmentWriteResponse validation warning:', result.error.message);
70247
+ }
70248
+ return raw;
70249
+ }
70250
+ /** Permanently deletes a ticket enrichment rule (`DELETE .../customMappings/{orgId}/{id}`). */
70251
+ async deleteTicketEnrichmentRule(ruleId) {
70252
+ const orgId = await this.dxSaaSService.getTenantCN();
70253
+ return this.notifyRequest('delete', `dxinotify/notify/v1/customMappings/${encodeURIComponent(orgId)}/${ruleId}`, false);
70254
+ }
70255
+ /**
70256
+ * The service-desk field catalog of one ITSM channel
70257
+ * (`GET oi/v2/tenantmgmtservice/properties?channelId=<id>`). A mapping's
70258
+ * `svcDeskField` is an entry's `mappedTo`.
70259
+ *
70260
+ * @remarks Field definitions only — it carries no channel credentials.
70261
+ * Response-validated, not thrown.
70262
+ */
70263
+ async listServiceDeskFields(channelId) {
70264
+ const raw = await this.dxSaaSService.oiGet('oi/v2/tenantmgmtservice/properties', { channelId });
70265
+ const result = ServiceDeskFieldsResponseSchema.safeParse(raw);
70266
+ if (!result.success) {
70267
+ this.log.warn('ItsmProperties validation warning:', result.error.message);
70268
+ }
70269
+ return raw;
70270
+ }
70271
+ /**
70272
+ * The alarm fields a ticket enrichment rule can read
70273
+ * (`GET oi/v2/api/alarm/messageTemplate/fields?usedInTicketEnrichment=true`).
70274
+ *
70275
+ * @remarks Each entry's `alarmType` lists the catalog codes it is valid
70276
+ * for; a rule mapping a field outside its own type's code is rejected with
70277
+ * a bare 400. See `TICKET_ENRICHMENT_FIELD_CODES`.
70278
+ * Response-validated, not thrown.
70279
+ */
70280
+ async listTicketEnrichmentAlarmFields() {
70281
+ const raw = await this.dxSaaSService.oiGet('oi/v2/api/alarm/messageTemplate/fields', {
70282
+ usedInTicketEnrichment: true,
70283
+ });
70284
+ const result = TicketEnrichmentAlarmFieldsResponseSchema.safeParse(raw);
70285
+ if (!result.success) {
70286
+ this.log.warn('TicketEnrichmentAlarmFields validation warning:', result.error.message);
70287
+ }
70288
+ return raw;
70289
+ }
69607
70290
  /** Returns all notification channels using the new DXChannelConfiguration model. */
69608
70291
  retrieveAllChannelsNew() {
69609
70292
  return this.dxSaaSService
@@ -84788,6 +85471,7 @@ exports.BlobStoreResponseSchema = BlobStoreResponseSchema;
84788
85471
  exports.CURL_COHORT_VAR = CURL_COHORT_VAR;
84789
85472
  exports.CURL_HOST_VAR = CURL_HOST_VAR;
84790
85473
  exports.CURL_TOKEN_VAR = CURL_TOKEN_VAR;
85474
+ exports.CUSTOM_FIELD_PATTERN = CUSTOM_FIELD_PATTERN;
84791
85475
  exports.CalendarIntervalSchema = CalendarIntervalSchema;
84792
85476
  exports.CancelRevokeRequestSchema = CancelRevokeRequestSchema;
84793
85477
  exports.ChannelDeleteResponseSchema = ChannelDeleteResponseSchema;
@@ -84827,8 +85511,19 @@ exports.DeleteTokensResponseSchema = DeleteTokensResponseSchema;
84827
85511
  exports.DxO2SaasRegionSchema = DxO2SaasRegionSchema;
84828
85512
  exports.DxSaasService = DxSaasService;
84829
85513
  exports.DxoiService = DxoiService;
85514
+ exports.ENRICHMENT_FILTER_CONDITIONS = ENRICHMENT_FILTER_CONDITIONS;
85515
+ exports.ENRICHMENT_PREVIEW_WINDOWS = ENRICHMENT_PREVIEW_WINDOWS;
85516
+ exports.ENRICHMENT_SOURCES = ENRICHMENT_SOURCES;
84830
85517
  exports.EXPORT_INCLUDE_TOKEN_ENV = EXPORT_INCLUDE_TOKEN_ENV;
84831
85518
  exports.EdgeNumericIdSchema = EdgeNumericIdSchema;
85519
+ exports.EnrichmentCustomFieldSchema = EnrichmentCustomFieldSchema;
85520
+ exports.EnrichmentCustomFieldsResponseSchema = EnrichmentCustomFieldsResponseSchema;
85521
+ exports.EnrichmentMappingSchema = EnrichmentMappingSchema;
85522
+ exports.EnrichmentPreviewResponseSchema = EnrichmentPreviewResponseSchema;
85523
+ exports.EnrichmentRuleSchema = EnrichmentRuleSchema;
85524
+ exports.EnrichmentRuleWriteBodySchema = EnrichmentRuleWriteBodySchema;
85525
+ exports.EnrichmentRulesResponseSchema = EnrichmentRulesResponseSchema;
85526
+ exports.EnrichmentSchema = EnrichmentSchema;
84832
85527
  exports.EventService = EventService;
84833
85528
  exports.ExperienceService = ExperienceService;
84834
85529
  exports.FILTER_FIELDS = FILTER_FIELDS;
@@ -84996,6 +85691,8 @@ exports.SLIService = SLIService;
84996
85691
  exports.SLI_DERIVED_METRIC_SOURCE = SLI_DERIVED_METRIC_SOURCE;
84997
85692
  exports.SMTP_DEFAULT_TEMPLATES = SMTP_DEFAULT_TEMPLATES;
84998
85693
  exports.SQLService = SQLService;
85694
+ exports.ServiceDeskFieldSchema = ServiceDeskFieldSchema;
85695
+ exports.ServiceDeskFieldsResponseSchema = ServiceDeskFieldsResponseSchema;
84999
85696
  exports.ServiceFilterSpecifierSchema = ServiceFilterSpecifierSchema;
85000
85697
  exports.ServiceService = ServiceService;
85001
85698
  exports.ServiceUniverseAccessEntrySchema = ServiceUniverseAccessEntrySchema;
@@ -85067,6 +85764,8 @@ exports.StatusPageComponentsSchema = StatusPageComponentsSchema;
85067
85764
  exports.TAGS_ATTRIBUTE_KEY = TAGS_ATTRIBUTE_KEY;
85068
85765
  exports.TASService = TASService;
85069
85766
  exports.TC_METRIC_CAP = TC_METRIC_CAP;
85767
+ exports.TICKET_ENRICHMENT_ALARM_TYPES = TICKET_ENRICHMENT_ALARM_TYPES;
85768
+ exports.TICKET_ENRICHMENT_FIELD_CODES = TICKET_ENRICHMENT_FIELD_CODES;
85070
85769
  exports.TasAddFlowsFilterSchema = TasAddFlowsFilterSchema;
85071
85770
  exports.TasAddTransitioningEdgesFilterSchema = TasAddTransitioningEdgesFilterSchema;
85072
85771
  exports.TasAddWireContextFilterSchema = TasAddWireContextFilterSchema;
@@ -85138,6 +85837,13 @@ exports.TenantProductsResponseSchema = TenantProductsResponseSchema;
85138
85837
  exports.TenantRoleSchema = TenantRoleSchema;
85139
85838
  exports.TenantRolesResponseSchema = TenantRolesResponseSchema;
85140
85839
  exports.TenantService = TenantService;
85840
+ exports.TicketEnrichmentAlarmFieldSchema = TicketEnrichmentAlarmFieldSchema;
85841
+ exports.TicketEnrichmentAlarmFieldsResponseSchema = TicketEnrichmentAlarmFieldsResponseSchema;
85842
+ exports.TicketEnrichmentListResponseSchema = TicketEnrichmentListResponseSchema;
85843
+ exports.TicketEnrichmentMappingSchema = TicketEnrichmentMappingSchema;
85844
+ exports.TicketEnrichmentRuleSchema = TicketEnrichmentRuleSchema;
85845
+ exports.TicketEnrichmentWriteBodySchema = TicketEnrichmentWriteBodySchema;
85846
+ exports.TicketEnrichmentWriteResponseSchema = TicketEnrichmentWriteResponseSchema;
85141
85847
  exports.TokenCreateResponseSchema = TokenCreateResponseSchema;
85142
85848
  exports.TokenDetailsSchema = TokenDetailsSchema;
85143
85849
  exports.TokenGetAndVerifyRequestSchema = TokenGetAndVerifyRequestSchema;
@@ -85230,6 +85936,7 @@ exports.buildAlarmFilterUpdateBody = buildAlarmFilterUpdateBody;
85230
85936
  exports.buildAlarmQueueFilterExpression = buildAlarmQueueFilterExpression;
85231
85937
  exports.buildAlarmQueueUpdateBody = buildAlarmQueueUpdateBody;
85232
85938
  exports.buildAlertEntry = buildAlertEntry;
85939
+ exports.buildEnrichmentRuleUpdateBody = buildEnrichmentRuleUpdateBody;
85233
85940
  exports.buildInventoryCustomFilter = buildInventoryCustomFilter;
85234
85941
  exports.buildInventoryQueueUpdateBody = buildInventoryQueueUpdateBody;
85235
85942
  exports.buildPolicyFilterExpression = buildPolicyFilterExpression;
@@ -85373,6 +86080,7 @@ exports.parseExpression = parseExpression;
85373
86080
  exports.parseFilter = parseFilter;
85374
86081
  exports.parseSaasGateway = parseSaasGateway;
85375
86082
  exports.parseServiceNowUrl = parseServiceNowUrl;
86083
+ exports.planEnrichmentReorder = planEnrichmentReorder;
85376
86084
  exports.policyCategoryGuard = policyCategoryGuard;
85377
86085
  exports.policyFilterAtoms = policyFilterAtoms;
85378
86086
  exports.producedMetricName = producedMetricName;
@@ -85384,6 +86092,7 @@ exports.reencodeItsmForWrite = reencodeItsmForWrite;
85384
86092
  exports.removeAlert = removeAlert;
85385
86093
  exports.removeSli = removeSli;
85386
86094
  exports.removeSloTriplet = removeSloTriplet;
86095
+ exports.resolveEnrichmentMappings = resolveEnrichmentMappings;
85387
86096
  exports.resolveWebhookPayload = resolveWebhookPayload;
85388
86097
  exports.sampleServiceDetailRequestBody = sampleServiceDetailRequestBody;
85389
86098
  exports.searchUniverse = searchUniverse;
@@ -85394,6 +86103,7 @@ exports.settingsUpdate = settingsUpdate;
85394
86103
  exports.sharedRoleDelta = sharedRoleDelta;
85395
86104
  exports.sliHumanName = sliHumanName;
85396
86105
  exports.sloTripletFor = sloTripletFor;
86106
+ exports.sortRulesByPriority = sortRulesByPriority;
85397
86107
  exports.splitAttributePath = splitAttributePath;
85398
86108
  exports.splitTemplate = splitTemplate;
85399
86109
  exports.stationDelete = stationDelete;
@@ -85419,12 +86129,14 @@ exports.timezonesList = timezonesList;
85419
86129
  exports.toAlarmFilterWriteBody = toAlarmFilterWriteBody;
85420
86130
  exports.toAlarmQueueWriteBody = toAlarmQueueWriteBody;
85421
86131
  exports.toChannelWriteBody = toChannelWriteBody;
86132
+ exports.toEnrichmentRuleCreateBody = toEnrichmentRuleCreateBody;
85422
86133
  exports.toGroupMetricsRequest = toGroupMetricsRequest;
85423
86134
  exports.toInventoryQueueWriteBody = toInventoryQueueWriteBody;
85424
86135
  exports.toItsmTestConnectionRequest = toItsmTestConnectionRequest;
85425
86136
  exports.toPolicyWriteBody = toPolicyWriteBody;
85426
86137
  exports.toSliGroupSaveRequest = toSliGroupSaveRequest;
85427
86138
  exports.toTemplateWriteBody = toTemplateWriteBody;
86139
+ exports.toTicketEnrichmentWriteBody = toTicketEnrichmentWriteBody;
85428
86140
  exports.tokenize = tokenize;
85429
86141
  exports.translateRuleToMmQuery = translateRuleToMmQuery;
85430
86142
  exports.truthy = truthy;