@dx-do/client 8.0.0 → 9.0.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.
Files changed (57) hide show
  1. package/dist/index.cjs.js +2283 -174
  2. package/dist/index.cjs.js.map +1 -1
  3. package/dist/index.esm.js +2204 -175
  4. package/dist/index.esm.js.map +1 -1
  5. package/dist/src/index.d.ts +14 -0
  6. package/dist/src/index.d.ts.map +1 -1
  7. package/dist/src/lib/model/alarm/alarm-queue.d.ts +2 -0
  8. package/dist/src/lib/model/alarm/alarm-queue.d.ts.map +1 -1
  9. package/dist/src/lib/model/channel/notify-channel.d.ts +5 -4
  10. package/dist/src/lib/model/channel/notify-channel.d.ts.map +1 -1
  11. package/dist/src/lib/model/dashboard/DashboardResponse.d.ts +12 -3
  12. package/dist/src/lib/model/dashboard/DashboardResponse.d.ts.map +1 -1
  13. package/dist/src/lib/model/oi/alarms.d.ts +14 -0
  14. package/dist/src/lib/model/oi/alarms.d.ts.map +1 -1
  15. package/dist/src/lib/model/oi/custom-properties.d.ts +184 -0
  16. package/dist/src/lib/model/oi/custom-properties.d.ts.map +1 -0
  17. package/dist/src/lib/model/oi/custom-property-grid.d.ts +121 -0
  18. package/dist/src/lib/model/oi/custom-property-grid.d.ts.map +1 -0
  19. package/dist/src/lib/model/oi/custom-property-routing.d.ts +60 -0
  20. package/dist/src/lib/model/oi/custom-property-routing.d.ts.map +1 -0
  21. package/dist/src/lib/model/oi/services.create.d.ts +6 -1
  22. package/dist/src/lib/model/oi/services.create.d.ts.map +1 -1
  23. package/dist/src/lib/model/security/access-references.d.ts +23 -0
  24. package/dist/src/lib/model/security/access-references.d.ts.map +1 -0
  25. package/dist/src/lib/model/security/roles.d.ts +75 -0
  26. package/dist/src/lib/model/security/roles.d.ts.map +1 -0
  27. package/dist/src/lib/model/security/user-groups.d.ts +69 -0
  28. package/dist/src/lib/model/security/user-groups.d.ts.map +1 -0
  29. package/dist/src/lib/model/service/availability-kpi.d.ts +86 -0
  30. package/dist/src/lib/model/service/availability-kpi.d.ts.map +1 -0
  31. package/dist/src/lib/model/situations/SituationLifecycle.d.ts +2 -0
  32. package/dist/src/lib/model/situations/SituationLifecycle.d.ts.map +1 -1
  33. package/dist/src/lib/model/situations/naming-template.d.ts +73 -0
  34. package/dist/src/lib/model/situations/naming-template.d.ts.map +1 -0
  35. package/dist/src/lib/model/situations/situation-explain.d.ts +365 -0
  36. package/dist/src/lib/model/situations/situation-explain.d.ts.map +1 -0
  37. package/dist/src/lib/model/synthetics/access-policy.d.ts +115 -0
  38. package/dist/src/lib/model/synthetics/access-policy.d.ts.map +1 -0
  39. package/dist/src/lib/services/alarm.service.d.ts +4 -2
  40. package/dist/src/lib/services/alarm.service.d.ts.map +1 -1
  41. package/dist/src/lib/services/custom-property.service.d.ts +53 -0
  42. package/dist/src/lib/services/custom-property.service.d.ts.map +1 -0
  43. package/dist/src/lib/services/dashboard.service.d.ts +11 -0
  44. package/dist/src/lib/services/dashboard.service.d.ts.map +1 -1
  45. package/dist/src/lib/services/role.service.d.ts +46 -0
  46. package/dist/src/lib/services/role.service.d.ts.map +1 -0
  47. package/dist/src/lib/services/service-monolith.d.ts +8 -0
  48. package/dist/src/lib/services/service-monolith.d.ts.map +1 -1
  49. package/dist/src/lib/services/service.service.d.ts +40 -0
  50. package/dist/src/lib/services/service.service.d.ts.map +1 -1
  51. package/dist/src/lib/services/situation.service.d.ts +13 -2
  52. package/dist/src/lib/services/situation.service.d.ts.map +1 -1
  53. package/dist/src/lib/services/synthetic-access.service.d.ts +35 -0
  54. package/dist/src/lib/services/synthetic-access.service.d.ts.map +1 -0
  55. package/dist/src/lib/services/user-group.service.d.ts +52 -0
  56. package/dist/src/lib/services/user-group.service.d.ts.map +1 -0
  57. package/package.json +2 -1
package/dist/index.cjs.js CHANGED
@@ -3879,7 +3879,7 @@ var EXP_LIMIT = 9e15, // 0 to 9e15
3879
3879
  isOctal = /^0o([0-7]+(\.[0-7]*)?|\.[0-7]+)(p[+-]?\d+)?$/i,
3880
3880
  isDecimal = /^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,
3881
3881
 
3882
- BASE$2 = 1e7,
3882
+ BASE$5 = 1e7,
3883
3883
  LOG_BASE = 7,
3884
3884
  MAX_SAFE_INTEGER$2 = 9007199254740991,
3885
3885
 
@@ -5150,9 +5150,9 @@ P$2.minus = P$2.sub = function (y) {
5150
5150
  for (i = yd.length; i > k;) {
5151
5151
 
5152
5152
  if (xd[--i] < yd[i]) {
5153
- for (j = i; j && xd[--j] === 0;) xd[j] = BASE$2 - 1;
5153
+ for (j = i; j && xd[--j] === 0;) xd[j] = BASE$5 - 1;
5154
5154
  --xd[j];
5155
- xd[i] += BASE$2;
5155
+ xd[i] += BASE$5;
5156
5156
  }
5157
5157
 
5158
5158
  xd[i] -= yd[i];
@@ -5381,8 +5381,8 @@ P$2.plus = P$2.add = function (y) {
5381
5381
 
5382
5382
  // Only start adding at yd.length - 1 as the further digits of xd can be left as they are.
5383
5383
  for (carry = 0; i;) {
5384
- carry = (xd[--i] = xd[i] + yd[i] + carry) / BASE$2 | 0;
5385
- xd[i] %= BASE$2;
5384
+ carry = (xd[--i] = xd[i] + yd[i] + carry) / BASE$5 | 0;
5385
+ xd[i] %= BASE$5;
5386
5386
  }
5387
5387
 
5388
5388
  if (carry) {
@@ -5680,11 +5680,11 @@ P$2.times = P$2.mul = function (y) {
5680
5680
  carry = 0;
5681
5681
  for (k = xdL + i; k > i;) {
5682
5682
  t = r[k] + yd[i] * xd[k - i - 1] + carry;
5683
- r[k--] = t % BASE$2 | 0;
5684
- carry = t / BASE$2 | 0;
5683
+ r[k--] = t % BASE$5 | 0;
5684
+ carry = t / BASE$5 | 0;
5685
5685
  }
5686
5686
 
5687
- r[k] = (r[k] + carry) % BASE$2 | 0;
5687
+ r[k] = (r[k] + carry) % BASE$5 | 0;
5688
5688
  }
5689
5689
 
5690
5690
  // Remove trailing zeros.
@@ -6510,7 +6510,7 @@ var divide$1 = (function () {
6510
6510
  logBase = 1;
6511
6511
  e = x.e - y.e;
6512
6512
  } else {
6513
- base = BASE$2;
6513
+ base = BASE$5;
6514
6514
  logBase = LOG_BASE;
6515
6515
  e = mathfloor(x.e / logBase) - mathfloor(y.e / logBase);
6516
6516
  }
@@ -6833,13 +6833,13 @@ var divide$1 = (function () {
6833
6833
  // if i != k the length has increased.
6834
6834
  if (i != k) {
6835
6835
  x.e++;
6836
- if (xd[0] == BASE$2) xd[0] = 1;
6836
+ if (xd[0] == BASE$5) xd[0] = 1;
6837
6837
  }
6838
6838
 
6839
6839
  break;
6840
6840
  } else {
6841
6841
  xd[xdi] += k;
6842
- if (xd[xdi] != BASE$2) break;
6842
+ if (xd[xdi] != BASE$5) break;
6843
6843
  xd[xdi--] = 0;
6844
6844
  k = 1;
6845
6845
  }
@@ -7415,7 +7415,7 @@ function parseOther(x, str) {
7415
7415
  divisor = intPow(Ctor, new Ctor(base), i, i * 2);
7416
7416
  }
7417
7417
 
7418
- xd = convertBase(str, base, BASE$2);
7418
+ xd = convertBase(str, base, BASE$5);
7419
7419
  xe = xd.length - 1;
7420
7420
 
7421
7421
  // Remove trailing zeros.
@@ -12679,6 +12679,10 @@ const AlarmQueueFieldSchema = v4.z.looseObject({
12679
12679
  fieldDescription: v4.z.string().describe('Human label the UI stores next to the field'),
12680
12680
  values: v4.z.array(v4.z.string()).describe('Closed vocabulary when non-empty (e.g. severity levels)'),
12681
12681
  hideMoreOptions: v4.z.boolean().optional().describe('UI hint: no free-text option for this field'),
12682
+ fieldType: v4.z
12683
+ .string()
12684
+ .optional()
12685
+ .describe("'nested' for service_custom_properties: a condition names one property as field `service_custom_properties.<property>`"),
12682
12686
  });
12683
12687
  const AlarmQueueFieldsResponseSchema = v4.z.array(AlarmQueueFieldSchema);
12684
12688
  /** One entry of `GET oi/v2/api/getUserRoles`, the tenant's role catalog. */
@@ -13955,9 +13959,10 @@ function resolveWebhookPayload(fieldNames, catalog) {
13955
13959
  // Template / payload variables (the message-template field catalog)
13956
13960
  // ---------------------------------------------------------------------------
13957
13961
  /**
13958
- * Alarm-type tags on the field catalog. `ALL` = every kind;
13959
- * `SITUATIONS.ALARMS_ALL` = a situation's source-alarm fields
13960
- * (`situation.allAlarm.*`), usable in situation templates.
13962
+ * Alarm-type tags on the field catalog. `ALL` = every kind. Situation templates can also use
13963
+ * `SITUATIONS.ALARMS_ALL` (a situation's source-alarm fields, `situation.allAlarm.*`),
13964
+ * `SITUATIONS.ROOT_CAUSE` (`rc_alarm.*`) and `SITUATIONS.MOST_IMPACTED` (`mostImpacted_alarm.*`):
13965
+ * 170 fields each on the lab (2026-11), including the service attributes.
13961
13966
  */
13962
13967
  const MESSAGE_TEMPLATE_ALARM_TYPES = [
13963
13968
  'ALL',
@@ -13965,11 +13970,13 @@ const MESSAGE_TEMPLATE_ALARM_TYPES = [
13965
13970
  'ALARMS_SERVICE',
13966
13971
  'SITUATIONS',
13967
13972
  'SITUATIONS.ALARMS_ALL',
13973
+ 'SITUATIONS.ROOT_CAUSE',
13974
+ 'SITUATIONS.MOST_IMPACTED',
13968
13975
  ];
13969
13976
  const ALARM_TYPES_BY_CATEGORY = {
13970
13977
  rawAlarm: ['ALL', 'ALARMS_ALL'],
13971
13978
  service: ['ALL', 'ALARMS_SERVICE'],
13972
- situation: ['ALL', 'SITUATIONS', 'SITUATIONS.ALARMS_ALL'],
13979
+ situation: ['ALL', 'SITUATIONS', 'SITUATIONS.ALARMS_ALL', 'SITUATIONS.ROOT_CAUSE', 'SITUATIONS.MOST_IMPACTED'],
13973
13980
  };
13974
13981
  /**
13975
13982
  * The `${field}` placeholders a message template or webhook payload can use,
@@ -38817,6 +38824,733 @@ exports.OIAlarm = void 0;
38817
38824
  OIAlarm.withAlarmTypes = withAlarmTypes;
38818
38825
  })(exports.OIAlarm || (exports.OIAlarm = {}));
38819
38826
 
38827
+ /**
38828
+ * Managed custom service properties (2026-11 release): tenant-level definitions of the
38829
+ * `customProperties` keys services carry, at `oi/v2/sa/customproperties`. Rules measured on
38830
+ * THE_LABORATORY (#1583): the server validates definitions (name pattern, unique name, enum
38831
+ * options, default value), but NOT the values services store: `sa/save` accepts a missing
38832
+ * required key, an enum value outside the list and a non-numeric number. Service values stay
38833
+ * `{name, value}` pairs; keys with no definition ("unmanaged") keep working beside managed ones.
38834
+ */
38835
+ const CUSTOM_PROPERTY_VALUE_TYPES = ['text', 'number', 'url', 'email', 'enum'];
38836
+ const CustomPropertyValueTypeSchema = v4.z
38837
+ .enum(CUSTOM_PROPERTY_VALUE_TYPES)
38838
+ .describe('Value type; the server rejects any other');
38839
+ /** The server's name rule (400 "must start with a letter and contain only letters, digits, and underscores"). */
38840
+ const CUSTOM_PROPERTY_NAME_PATTERN = /^[A-Za-z][A-Za-z0-9_]*$/;
38841
+ const CustomPropertyAllowedValueSchema = v4.z.looseObject({
38842
+ value: v4.z.string().describe('One allowed value of an enum property'),
38843
+ usage: v4.z.number().describe('Services holding this value'),
38844
+ });
38845
+ /** One definition as `GET oi/v2/sa/customproperties` lists it. */
38846
+ const CustomPropertyDefinitionSchema = v4.z.looseObject({
38847
+ id: v4.z.string().optional().describe('Equal to name'),
38848
+ name: v4.z.string().describe('Property key, as services store it in customProperties[].name'),
38849
+ description: v4.z.string().optional().describe('Free text'),
38850
+ valueType: v4.z.string().describe("text | number | url | email | enum (read as a string so a new type does not break a read)"),
38851
+ multiValued: v4.z.boolean().optional().describe('Always false so far'),
38852
+ allowedValues: v4.z
38853
+ .array(CustomPropertyAllowedValueSchema)
38854
+ .nullable()
38855
+ .optional()
38856
+ .describe('enum only: the options with per-value usage (written as `options`)'),
38857
+ defaultValue: v4.z.string().optional().describe('Pre-filled on new services; "" for none'),
38858
+ required: v4.z.boolean().describe('New services must carry it (the UI enforces this; sa/save does not)'),
38859
+ usageCount: v4.z.number().optional().describe('Services holding the key'),
38860
+ totalServicesCount: v4.z.number().optional().describe('All services in the tenant'),
38861
+ createdBy: v4.z.string().optional(),
38862
+ createdOn: v4.z.string().optional().describe('ISO time'),
38863
+ updatedBy: v4.z.string().optional(),
38864
+ updatedOn: v4.z.string().optional().describe('ISO time'),
38865
+ });
38866
+ const CustomPropertyDefinitionListSchema = v4.z.array(CustomPropertyDefinitionSchema);
38867
+ /**
38868
+ * Create / update body (`POST oi/v2/sa/customproperties`, `PUT …/{name}` takes the full body).
38869
+ * Mirrors the server's checks so a dry run catches what the server would reject.
38870
+ */
38871
+ const CustomPropertyWriteSchema = v4.z
38872
+ .object({
38873
+ name: v4.z
38874
+ .string()
38875
+ .regex(CUSTOM_PROPERTY_NAME_PATTERN, 'name must start with a letter and contain only letters, digits and underscores')
38876
+ .describe('Property key; immutable after create'),
38877
+ description: v4.z.string().describe('Free text; "" allowed'),
38878
+ valueType: CustomPropertyValueTypeSchema,
38879
+ options: v4.z.array(v4.z.string().min(1)).nullable().describe('enum: the allowed values (non-empty); null otherwise'),
38880
+ defaultValue: v4.z.string().describe('"" for none; must be valid for the type'),
38881
+ required: v4.z.boolean().describe('Whether new services must carry it'),
38882
+ })
38883
+ .superRefine((body, ctx) => {
38884
+ if (body.valueType === 'enum' && (!body.options || body.options.length === 0)) {
38885
+ ctx.addIssue({ code: 'custom', path: ['options'], message: "options is required and cannot be empty when valueType is 'enum'" });
38886
+ }
38887
+ if (body.valueType !== 'enum' && body.options && body.options.length > 0) {
38888
+ ctx.addIssue({ code: 'custom', path: ['options'], message: `options only apply to enum properties, not '${body.valueType}'` });
38889
+ }
38890
+ if (body.defaultValue !== '') {
38891
+ const problem = checkPropertyValue({ valueType: body.valueType, allowedValues: (body.options ?? []).map((value) => ({ value, usage: 0 })) }, body.defaultValue);
38892
+ if (problem)
38893
+ ctx.addIssue({ code: 'custom', path: ['defaultValue'], message: `defaultValue ${problem}` });
38894
+ }
38895
+ });
38896
+ /** `POST` / `PUT` response: the definition as written (times in epoch seconds). */
38897
+ const CustomPropertyWriteResponseSchema = v4.z.looseObject({
38898
+ name: v4.z.string(),
38899
+ valueType: v4.z.string(),
38900
+ options: v4.z.array(v4.z.string()).nullable().optional(),
38901
+ required: v4.z.boolean(),
38902
+ defaultValue: v4.z.string().optional(),
38903
+ CreationTime: v4.z.number().optional().describe('Epoch seconds'),
38904
+ UpdateTime: v4.z.number().optional().describe('Epoch seconds'),
38905
+ });
38906
+ /** `GET …/{name}/usage`: which services hold the key, with their values. An unknown name gives count 0. */
38907
+ const CustomPropertyUsageSchema = v4.z.looseObject({
38908
+ count: v4.z.number().describe('Services holding the key'),
38909
+ name: v4.z.string(),
38910
+ Services: v4.z.record(v4.z.string(), v4.z.string()).describe('service name → stored value'),
38911
+ });
38912
+ const NUMERIC$1 = /^-?(\d+(\.\d*)?|\.\d+)([eE][-+]?\d+)?$/;
38913
+ const EMAIL = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
38914
+ /**
38915
+ * Why `value` is not valid for the definition, or undefined when it is. The server never
38916
+ * checks stored values, so this is the only check there is. `url` must parse with a scheme.
38917
+ */
38918
+ function checkPropertyValue(definition, value) {
38919
+ switch (definition.valueType) {
38920
+ case 'number':
38921
+ return NUMERIC$1.test(value.trim()) ? undefined : `'${value}' is not a number`;
38922
+ case 'email':
38923
+ return EMAIL.test(value) ? undefined : `'${value}' is not an email address`;
38924
+ case 'url':
38925
+ try {
38926
+ const url = new URL(value);
38927
+ return url.protocol ? undefined : `'${value}' is not a URL`;
38928
+ }
38929
+ catch {
38930
+ return `'${value}' is not a URL`;
38931
+ }
38932
+ case 'enum': {
38933
+ const allowed = (definition.allowedValues ?? []).map((a) => a.value);
38934
+ return allowed.includes(value) ? undefined : `'${value}' is not one of ${allowed.join(', ')}`;
38935
+ }
38936
+ default:
38937
+ return undefined;
38938
+ }
38939
+ }
38940
+ /** The write body that reproduces a listed definition (`allowedValues` → `options`). */
38941
+ function toDefinitionWrite(definition) {
38942
+ return {
38943
+ name: definition.name,
38944
+ description: definition.description ?? '',
38945
+ valueType: definition.valueType,
38946
+ options: definition.valueType === 'enum' ? (definition.allowedValues ?? []).map((a) => a.value) : null,
38947
+ defaultValue: definition.defaultValue ?? '',
38948
+ required: definition.required,
38949
+ };
38950
+ }
38951
+ /** What `propertyCoverage` checks and does not, for scoped negatives. */
38952
+ const PROPERTY_COVERAGE_SCOPE = {
38953
+ checked: [
38954
+ 'every managed definition against every service in scope: key present or missing',
38955
+ "stored values against the definition's type and enum options (the server never checks them)",
38956
+ 'value spellings that differ only in case or whitespace',
38957
+ 'enum options no service holds',
38958
+ 'keys services carry without a definition, with a suggested type and likely misspellings of managed keys',
38959
+ ],
38960
+ notChecked: [
38961
+ 'which notification policies and alarm queues filter on a property (view=routing checks them)',
38962
+ 'inheritance between parent and child services',
38963
+ 'services outside the scope given',
38964
+ ],
38965
+ };
38966
+ const servicePropertyMap = (s) => {
38967
+ const cp = s.customProperties;
38968
+ if (!cp)
38969
+ return new Map();
38970
+ if (Array.isArray(cp))
38971
+ return new Map(cp.map((p) => [p.name, p.value ?? '']));
38972
+ return new Map(Object.entries(cp).map(([k, v]) => [k, v ?? '']));
38973
+ };
38974
+ const normalizeValue$1 = (v) => v.trim().replace(/\s+/g, ' ').toLowerCase();
38975
+ const normalizeKey = (k) => k.toLowerCase().replace(/[\s_-]/g, '');
38976
+ const count = (values) => {
38977
+ const out = {};
38978
+ for (const v of [...values].sort())
38979
+ out[v] = (out[v] ?? 0) + 1;
38980
+ return out;
38981
+ };
38982
+ function valueVariants(values) {
38983
+ const groups = new Map();
38984
+ for (const [value, holders] of Object.entries(values)) {
38985
+ const key = normalizeValue$1(value);
38986
+ groups.set(key, { ...(groups.get(key) ?? {}), [value]: holders });
38987
+ }
38988
+ return [...groups.entries()]
38989
+ .filter(([, spellings]) => Object.keys(spellings).length > 1)
38990
+ .map(([normalized, spellings]) => ({ normalized, spellings }));
38991
+ }
38992
+ function editDistance(a, b) {
38993
+ const row = Array.from({ length: b.length + 1 }, (_, j) => j);
38994
+ for (let i = 1; i <= a.length; i++) {
38995
+ let diagonal = row[0];
38996
+ row[0] = i;
38997
+ for (let j = 1; j <= b.length; j++) {
38998
+ const above = row[j];
38999
+ row[j] = Math.min(above + 1, row[j - 1] + 1, diagonal + (a[i - 1] === b[j - 1] ? 0 : 1));
39000
+ diagonal = above;
39001
+ }
39002
+ }
39003
+ return row[b.length];
39004
+ }
39005
+ function resembles(key, managed) {
39006
+ const k = normalizeKey(key);
39007
+ for (const name of managed) {
39008
+ const m = normalizeKey(name);
39009
+ if (k === m || (k.length >= 5 && m.length >= 5 && editDistance(k, m) <= 2))
39010
+ return name;
39011
+ }
39012
+ return null;
39013
+ }
39014
+ const ENUM_MAX_OPTIONS = 10;
39015
+ function suggestType(values) {
39016
+ const nonEmpty = values.filter((v) => v.trim() !== '');
39017
+ const fits = (valueType) => nonEmpty.length > 0 && nonEmpty.every((v) => checkPropertyValue({ valueType }, v) === undefined);
39018
+ for (const type of ['number', 'email', 'url'])
39019
+ if (fits(type))
39020
+ return { type, options: null };
39021
+ const distinct = [...new Set(nonEmpty)].sort();
39022
+ if (distinct.length >= 2 && distinct.length <= ENUM_MAX_OPTIONS && distinct.length < nonEmpty.length) {
39023
+ return { type: 'enum', options: distinct };
39024
+ }
39025
+ return { type: 'text', options: null };
39026
+ }
39027
+ /**
39028
+ * Coverage of the managed properties over `services`: per definition, who lacks the key, whose
39029
+ * value is invalid, the value distribution and its case/whitespace variants; per service, its
39030
+ * gaps; and the keys services carry without a definition. Pure: the caller reads the definitions
39031
+ * and the service list (the ungrouped service list returns `customProperties` on every service).
39032
+ */
39033
+ function propertyCoverage(definitions, services) {
39034
+ const stored = services.map((s) => ({ name: s.name, props: servicePropertyMap(s) }));
39035
+ const managed = new Set(definitions.map((d) => d.name));
39036
+ const sortedDefinitions = [...definitions].sort((a, b) => a.name.localeCompare(b.name));
39037
+ const perService = new Map(stored.map((s) => [s.name, { service: s.name, missing: [], missingRequired: [], invalid: [], unmanaged: [] }]));
39038
+ const definitionCoverage = sortedDefinitions.map((d) => {
39039
+ const missing = [];
39040
+ const invalid = [];
39041
+ const held = [];
39042
+ for (const s of stored) {
39043
+ const row = perService.get(s.name);
39044
+ const value = s.props.get(d.name);
39045
+ if (value === undefined) {
39046
+ missing.push(s.name);
39047
+ row.missing.push(d.name);
39048
+ if (d.required)
39049
+ row.missingRequired.push(d.name);
39050
+ continue;
39051
+ }
39052
+ held.push(value);
39053
+ const problem = checkPropertyValue(d, value);
39054
+ if (problem) {
39055
+ invalid.push({ service: s.name, property: d.name, value, problem });
39056
+ row.invalid.push({ property: d.name, value, problem });
39057
+ }
39058
+ }
39059
+ const values = count(held);
39060
+ return {
39061
+ name: d.name,
39062
+ valueType: d.valueType,
39063
+ required: d.required,
39064
+ defaultValue: d.defaultValue ?? '',
39065
+ holders: held.length,
39066
+ missing,
39067
+ invalid,
39068
+ values,
39069
+ variants: valueVariants(values),
39070
+ unusedOptions: d.valueType === 'enum' ? (d.allowedValues ?? []).map((a) => a.value).filter((o) => !(o in values)) : [],
39071
+ };
39072
+ });
39073
+ const unmanagedHolders = new Map();
39074
+ for (const s of stored) {
39075
+ for (const [key, value] of s.props) {
39076
+ if (managed.has(key))
39077
+ continue;
39078
+ const entry = unmanagedHolders.get(key) ?? { services: [], values: [] };
39079
+ entry.services.push(s.name);
39080
+ entry.values.push(value);
39081
+ unmanagedHolders.set(key, entry);
39082
+ perService.get(s.name).unmanaged.push(key);
39083
+ }
39084
+ }
39085
+ const managedNames = sortedDefinitions.map((d) => d.name);
39086
+ const unmanaged = [...unmanagedHolders.entries()]
39087
+ .map(([name, { services: holders, values }]) => {
39088
+ const suggestion = suggestType(values);
39089
+ return {
39090
+ name,
39091
+ holders: holders.length,
39092
+ services: holders,
39093
+ values: count(values),
39094
+ suggestedType: suggestion.type,
39095
+ suggestedOptions: suggestion.options,
39096
+ resembles: resembles(name, managedNames),
39097
+ };
39098
+ })
39099
+ .sort((a, b) => b.holders - a.holders || a.name.localeCompare(b.name));
39100
+ return {
39101
+ totalServices: services.length,
39102
+ definitions: definitionCoverage,
39103
+ services: [...perService.values()],
39104
+ unmanaged,
39105
+ };
39106
+ }
39107
+
39108
+ /**
39109
+ * The service-property grid (#1629): one row per service, one column per property, edited in a
39110
+ * spreadsheet (CSV) or by a script (JSON) and imported back. Each row carries the values it was
39111
+ * exported with (`baseline`), so an import changes only what was edited and refuses a cell
39112
+ * someone else changed since the export. Trailing machine columns start with `_`; a property
39113
+ * name must start with a letter, so they never collide with one.
39114
+ */
39115
+ const PROPERTY_GRID_FORMAT = 'dxdo.service-properties/1';
39116
+ const GRID_SERVICE_COLUMN = 'service';
39117
+ const GRID_MACHINE_COLUMNS = ['_issues', '_id', '_tenant', '_baseline'];
39118
+ const propertiesOf = (s) => {
39119
+ const cp = s.customProperties;
39120
+ if (!cp)
39121
+ return new Map();
39122
+ if (Array.isArray(cp))
39123
+ return new Map(cp.map((p) => [p.name, p.value ?? '']));
39124
+ return new Map(Object.entries(cp).map(([k, v]) => [k, v ?? '']));
39125
+ };
39126
+ /**
39127
+ * The grid for `services`, plus how many unmanaged keys it left out (they are opt-in).
39128
+ */
39129
+ function buildPropertyGrid(definitions, services, opts) {
39130
+ const coverage = propertyCoverage(definitions, services);
39131
+ const byName = (a, b) => a.localeCompare(b);
39132
+ const required = definitions.filter((d) => d.required).map((d) => d.name).sort(byName);
39133
+ const optional = opts.requiredOnly ? [] : definitions.filter((d) => !d.required).map((d) => d.name).sort(byName);
39134
+ const unmanaged = coverage.unmanaged.map((u) => u.name);
39135
+ const columns = [...required, ...optional, ...(opts.unmanaged ? unmanaged : [])];
39136
+ const gaps = new Map(coverage.services.map((s) => [s.service, s]));
39137
+ const rows = services.map((s) => {
39138
+ const props = propertiesOf(s);
39139
+ const baseline = Object.fromEntries(columns.map((c) => [c, props.get(c) ?? '']));
39140
+ const gap = gaps.get(s.name);
39141
+ const issues = [
39142
+ ...(gap?.missingRequired.length ? [`missing required: ${gap.missingRequired.join(', ')}`] : []),
39143
+ ...(gap?.invalid ?? []).map((v) => `${v.property}: ${v.problem}`),
39144
+ ];
39145
+ return { service: s.name, id: s.id ?? '', values: { ...baseline }, issues, baseline };
39146
+ });
39147
+ return {
39148
+ grid: { format: PROPERTY_GRID_FORMAT, tenant: opts.tenant, exportedAt: opts.exportedAt, columns, rows },
39149
+ omittedUnmanaged: opts.unmanaged ? [] : unmanaged,
39150
+ };
39151
+ }
39152
+ const FORMULA_START = /^[=+\-@]/;
39153
+ const NUMERIC = /^-?(\d+(\.\d*)?|\.\d+)([eE][-+]?\d+)?$/;
39154
+ /** Cells a spreadsheet would evaluate as a formula when the file is opened by double-click. */
39155
+ function formulaLikeCells(grid) {
39156
+ return grid.rows.flatMap((r) => grid.columns
39157
+ .map((c) => ({ service: r.service, property: c, value: r.values[c] ?? '' }))
39158
+ .filter((v) => FORMULA_START.test(v.value) && !NUMERIC.test(v.value)));
39159
+ }
39160
+ // ---------------------------------------------------------------------------- CSV / JSON codec
39161
+ const BOM = '\uFEFF';
39162
+ const encodeBaseline = (b) => Buffer.from(JSON.stringify(b), 'utf8').toString('base64url');
39163
+ const decodeBaseline = (s) => {
39164
+ const parsed = JSON.parse(Buffer.from(s, 'base64url').toString('utf8'));
39165
+ if (!parsed || typeof parsed !== 'object' || Array.isArray(parsed))
39166
+ throw new Error('not an object');
39167
+ return Object.fromEntries(Object.entries(parsed).map(([k, v]) => [k, String(v ?? '')]));
39168
+ };
39169
+ const csvCell = (v) => (/[",\r\n;\t]|^\s|\s$/.test(v) ? `"${v.replace(/"/g, '""')}"` : v);
39170
+ /**
39171
+ * The grid as a header row plus one row of strings per service: the shape every tabular format
39172
+ * (CSV, XLSX) writes and {@link parseGridRows} reads back.
39173
+ */
39174
+ function gridToRows(grid) {
39175
+ const header = [GRID_SERVICE_COLUMN, ...grid.columns, ...GRID_MACHINE_COLUMNS];
39176
+ return [
39177
+ header,
39178
+ ...grid.rows.map((r) => [
39179
+ r.service,
39180
+ ...grid.columns.map((c) => r.values[c] ?? ''),
39181
+ r.issues.join('; '),
39182
+ r.id,
39183
+ grid.tenant ?? '',
39184
+ encodeBaseline(r.baseline),
39185
+ ]),
39186
+ ];
39187
+ }
39188
+ /** RFC 4180 CSV with a UTF-8 BOM (so Excel reads non-ASCII names) and CRLF line ends. */
39189
+ function gridToCsv(grid) {
39190
+ return BOM + gridToRows(grid).map((l) => l.map(csvCell).join(',')).join('\r\n') + '\r\n';
39191
+ }
39192
+ /** The delimiter a spreadsheet saved with: ',' normally, ';' in comma-decimal locales, tab for TSV. */
39193
+ function detectDelimiter(text) {
39194
+ const firstLine = text.slice(0, text.search(/\r?\n|$/));
39195
+ const counts = [',', ';', '\t'].map((d) => [d, firstLine.split(d).length - 1]);
39196
+ return [...counts].sort((a, b) => b[1] - a[1])[0]?.[0] ?? ',';
39197
+ }
39198
+ /** Parses RFC 4180 CSV (quoted fields, doubled quotes, newlines inside quotes). */
39199
+ function parseCsv(input) {
39200
+ const text = input.startsWith(BOM) ? input.slice(1) : input;
39201
+ const delimiter = detectDelimiter(text);
39202
+ const rows = [];
39203
+ let row = [];
39204
+ let field = '';
39205
+ let quoted = false;
39206
+ for (let i = 0; i < text.length; i++) {
39207
+ const ch = text[i];
39208
+ if (quoted) {
39209
+ if (ch === '"' && text[i + 1] === '"') {
39210
+ field += '"';
39211
+ i++;
39212
+ }
39213
+ else if (ch === '"') {
39214
+ quoted = false;
39215
+ }
39216
+ else {
39217
+ field += ch;
39218
+ }
39219
+ }
39220
+ else if (ch === '"' && field === '') {
39221
+ quoted = true;
39222
+ }
39223
+ else if (ch === delimiter) {
39224
+ row.push(field);
39225
+ field = '';
39226
+ }
39227
+ else if (ch === '\n' || ch === '\r') {
39228
+ if (ch === '\r' && text[i + 1] === '\n')
39229
+ i++;
39230
+ row.push(field);
39231
+ rows.push(row);
39232
+ row = [];
39233
+ field = '';
39234
+ }
39235
+ else {
39236
+ field += ch;
39237
+ }
39238
+ }
39239
+ if (field !== '' || row.length > 0) {
39240
+ row.push(field);
39241
+ rows.push(row);
39242
+ }
39243
+ return rows.filter((r) => r.some((c) => c.trim() !== ''));
39244
+ }
39245
+ function gridToJson(grid) {
39246
+ return JSON.stringify(grid, null, 2) + '\n';
39247
+ }
39248
+ /** Reads an exported grid back (CSV or JSON, decided by content). */
39249
+ function parsePropertyGrid(text) {
39250
+ const trimmed = (text.startsWith(BOM) ? text.slice(1) : text).trimStart();
39251
+ return trimmed.startsWith('{') ? parseJsonGrid(trimmed) : parseCsvGrid(text);
39252
+ }
39253
+ function parseJsonGrid(text) {
39254
+ const raw = JSON.parse(text);
39255
+ if (raw.format !== PROPERTY_GRID_FORMAT) {
39256
+ return { tenant: null, columns: [], rows: [], problems: [`not a ${PROPERTY_GRID_FORMAT} file (format: ${String(raw.format)})`] };
39257
+ }
39258
+ const problems = [];
39259
+ const rows = (raw.rows ?? []).map((r, i) => {
39260
+ if (!r.baseline || typeof r.baseline !== 'object')
39261
+ problems.push(`row ${i + 1} (${r.service}): no baseline; only exported rows can be imported`);
39262
+ return { ...r, values: r.values ?? {}, issues: r.issues ?? [], baseline: r.baseline ?? {}, id: r.id ?? '' };
39263
+ });
39264
+ return { tenant: raw.tenant ?? null, columns: raw.columns ?? [], rows, problems };
39265
+ }
39266
+ function parseCsvGrid(text) {
39267
+ return parseGridRows(parseCsv(text));
39268
+ }
39269
+ /** Reads a grid back from its rows of strings (header first), whatever file they came from. */
39270
+ function parseGridRows(input) {
39271
+ const [header, ...body] = input.filter((r) => r.some((c) => c.trim() !== ''));
39272
+ if (!header)
39273
+ return { tenant: null, columns: [], rows: [], problems: ['the file is empty'] };
39274
+ const index = (name) => header.findIndex((h) => h.trim().toLowerCase() === name);
39275
+ const serviceAt = index(GRID_SERVICE_COLUMN);
39276
+ const baselineAt = index('_baseline');
39277
+ const problems = [];
39278
+ if (serviceAt < 0)
39279
+ problems.push(`no '${GRID_SERVICE_COLUMN}' column`);
39280
+ if (baselineAt < 0)
39281
+ problems.push("no '_baseline' column; import a file made by service export-properties");
39282
+ if (problems.length)
39283
+ return { tenant: null, columns: [], rows: [], problems };
39284
+ const idAt = index('_id');
39285
+ const tenantAt = index('_tenant');
39286
+ const columnAt = header
39287
+ .map((h, i) => ({ name: h.trim(), i }))
39288
+ .filter((c) => c.i !== serviceAt && c.name !== '' && !c.name.startsWith('_'));
39289
+ const tenants = new Set();
39290
+ const rows = body.map((cells, n) => {
39291
+ const service = (cells[serviceAt] ?? '').trim();
39292
+ let baseline = {};
39293
+ try {
39294
+ baseline = decodeBaseline((cells[baselineAt] ?? '').trim());
39295
+ }
39296
+ catch {
39297
+ problems.push(`row ${n + 2} (${service}): unreadable _baseline; only exported rows can be imported`);
39298
+ }
39299
+ if (tenantAt >= 0 && cells[tenantAt])
39300
+ tenants.add(cells[tenantAt].trim());
39301
+ return {
39302
+ service,
39303
+ id: idAt >= 0 ? (cells[idAt] ?? '').trim() : '',
39304
+ values: Object.fromEntries(columnAt.map((c) => [c.name, cells[c.i] ?? ''])),
39305
+ issues: [],
39306
+ baseline,
39307
+ };
39308
+ });
39309
+ if (tenants.size > 1)
39310
+ problems.push(`rows from more than one tenant: ${[...tenants].join(', ')}`);
39311
+ return { tenant: [...tenants][0] ?? null, columns: columnAt.map((c) => c.name), rows, problems };
39312
+ }
39313
+ // ---------------------------------------------------------------------------- import planning
39314
+ /**
39315
+ * Why `edited` looks like a spreadsheet's automatic conversion of `original` rather than an edit,
39316
+ * or undefined. Such a cell is reported and left alone.
39317
+ */
39318
+ function spreadsheetMangling(original, edited) {
39319
+ if (original === '' || original === edited)
39320
+ return undefined;
39321
+ if (/^0\d+$/.test(original) && edited === original.replace(/^0+(?=\d)/, ''))
39322
+ return 'leading zeros stripped';
39323
+ if (/^\d{12,}$/.test(original) && /^\d(\.\d+)?e\+?\d+$/i.test(edited))
39324
+ return 'long number shown in scientific notation';
39325
+ if (NUMERIC.test(original) && NUMERIC.test(edited) && Number(original) === Number(edited))
39326
+ return 'number reformatted';
39327
+ if (/^\d{4}-\d{2}-\d{2}/.test(original) && !/^\d{4}-\d{2}-\d{2}/.test(edited) && !Number.isNaN(Date.parse(edited))) {
39328
+ return 'date reformatted';
39329
+ }
39330
+ if (/^\d{1,2}[-/]\d{1,2}$/.test(original) && /^\d{1,2}-[A-Za-z]{3}$|^[A-Za-z]{3}-\d{1,2}$|^\d{4}-\d{2}-\d{2}/.test(edited)) {
39331
+ return 'converted to a date';
39332
+ }
39333
+ if (/^(true|false)$/i.test(original) && original.toLowerCase() === edited.toLowerCase())
39334
+ return 'converted to a boolean';
39335
+ return undefined;
39336
+ }
39337
+ /** Services whose row has a cell that differs from its baseline: the only ones an import reads again. */
39338
+ function editedServices(grid) {
39339
+ return grid.rows
39340
+ .filter((r) => grid.columns.some((c) => ((r.values[c] ?? '').trim() === '' ? '' : r.values[c]) !== (r.baseline[c] ?? '')))
39341
+ .map((r) => r.service);
39342
+ }
39343
+ /**
39344
+ * `services` with each one's properties taken from a hierarchy read where it has them, plus the
39345
+ * services the read found that the list lacks. The services list can lag a save by up to a minute
39346
+ * (and miss a just-created service); the hierarchy read is what a save is built from, so existence
39347
+ * and conflicts are judged against it.
39348
+ */
39349
+ function withGraphProperties(services, graph) {
39350
+ const listed = new Set(services.map((s) => s.name));
39351
+ const overlaid = services.map((s) => {
39352
+ const vertex = graph.vertices[s.name];
39353
+ return vertex ? { ...s, customProperties: vertex.attributes.customProperties ?? [] } : s;
39354
+ });
39355
+ const unlisted = Object.entries(graph.vertices)
39356
+ .filter(([name]) => !listed.has(name))
39357
+ .map(([name, vertex]) => ({ name, customProperties: vertex.attributes.customProperties ?? [] }));
39358
+ return [...overlaid, ...unlisted];
39359
+ }
39360
+ /**
39361
+ * The changes an edited grid asks for, checked against the tenant as it is now:
39362
+ * - a cell equal to its baseline is untouched;
39363
+ * - a cell that looks like a spreadsheet conversion of its baseline is a warning, not a write;
39364
+ * - an edited cell whose current value differs from its baseline is a conflict (blocker);
39365
+ * - a cleared cell removes the key only with `force`;
39366
+ * - a managed value its type or options reject, a column that is not a managed property or a key
39367
+ * any service holds, an unknown or renamed service, a duplicate row and a tenant mismatch block.
39368
+ */
39369
+ function planPropertyGridImport(grid, ctx) {
39370
+ const blockers = [...grid.problems];
39371
+ const warnings = [];
39372
+ const edits = [];
39373
+ if (grid.tenant && ctx.tenant && grid.tenant !== ctx.tenant) {
39374
+ blockers.push(`the file was exported from tenant ${grid.tenant}, not ${ctx.tenant}`);
39375
+ }
39376
+ const definitions = new Map(ctx.definitions.map((d) => [d.name, d]));
39377
+ const current = new Map(ctx.services.map((s) => [s.name, s]));
39378
+ const byId = new Map(ctx.services.filter((s) => s.id).map((s) => [s.id, s.name]));
39379
+ const heldKeys = new Set(ctx.services.flatMap((s) => [...propertiesOf(s).keys()]));
39380
+ const unknown = grid.columns.filter((c) => !definitions.has(c) && !heldKeys.has(c));
39381
+ for (const c of unknown)
39382
+ blockers.push(`column '${c}' is not a managed property or a key any service holds (a header typo?)`);
39383
+ const known = grid.columns.filter((c) => !unknown.includes(c));
39384
+ const seen = new Set();
39385
+ let unchanged = 0;
39386
+ for (const row of grid.rows) {
39387
+ if (seen.has(row.service)) {
39388
+ blockers.push(`service '${row.service}' appears in more than one row`);
39389
+ continue;
39390
+ }
39391
+ seen.add(row.service);
39392
+ const cellOf = (column) => ((row.values[column] ?? '').trim() === '' ? '' : row.values[column]);
39393
+ if (known.every((column) => cellOf(column) === (row.baseline[column] ?? ''))) {
39394
+ unchanged++;
39395
+ continue;
39396
+ }
39397
+ const now = current.get(row.service);
39398
+ if (!now) {
39399
+ const renamed = row.id ? byId.get(row.id) : undefined;
39400
+ blockers.push(renamed
39401
+ ? `service '${row.service}' was renamed to '${renamed}' since the export; re-export`
39402
+ : `service '${row.service}' no longer exists`);
39403
+ continue;
39404
+ }
39405
+ const props = propertiesOf(now);
39406
+ let rowEdited = false;
39407
+ for (const column of known) {
39408
+ const cell = cellOf(column);
39409
+ const base = row.baseline[column] ?? '';
39410
+ if (cell === base)
39411
+ continue;
39412
+ const mangled = spreadsheetMangling(base, cell);
39413
+ if (mangled) {
39414
+ warnings.push(`${row.service}.${column}: '${base}' → '${cell}' looks like ${mangled} by the spreadsheet; left unchanged`);
39415
+ continue;
39416
+ }
39417
+ rowEdited = true;
39418
+ const value = props.get(column) ?? '';
39419
+ if (value !== base) {
39420
+ blockers.push(`${row.service}.${column} changed since the export ('${base}' → now '${value}'); re-export and edit again`);
39421
+ continue;
39422
+ }
39423
+ if (cell === '') {
39424
+ if (ctx.force)
39425
+ edits.push({ service: row.service, property: column, before: base, after: '', kind: 'remove' });
39426
+ else
39427
+ blockers.push(`${row.service}.${column}: clearing the cell removes '${base}'; pass force=true to remove it`);
39428
+ continue;
39429
+ }
39430
+ const definition = definitions.get(column);
39431
+ const problem = definition ? checkPropertyValue(definition, cell) : undefined;
39432
+ if (problem) {
39433
+ blockers.push(`${row.service}.${column}: ${problem}`);
39434
+ continue;
39435
+ }
39436
+ edits.push({ service: row.service, property: column, before: base, after: cell, kind: 'set' });
39437
+ }
39438
+ if (!rowEdited)
39439
+ unchanged++;
39440
+ }
39441
+ const changes = edits.map((e) => e.kind === 'set'
39442
+ ? { op: 'setProperty', service: e.service, name: e.property, value: e.after }
39443
+ : { op: 'removeProperty', service: e.service, name: e.property });
39444
+ return { changes, edits, blockers, warnings, unchanged };
39445
+ }
39446
+
39447
+ /**
39448
+ * Routing exposure of custom properties (#1628): which notification policies and alarm queues
39449
+ * filter on `service_custom_properties.<key>`, and what a service without the key does to them.
39450
+ *
39451
+ * Measured on THE_LABORATORY (#1628): a policy links a queue through `alarmViews: [<queue id>]`,
39452
+ * and the UI also copies the queue's atoms into the policy's own `filterExpressionV1`. An alarm
39453
+ * whose services lack the key never matches `equals` / `contains`, and always matches
39454
+ * `not_equals` / `not_contains` (even for a key nobody holds). That was measured through the
39455
+ * alarm query a queue uses; the notification engine is assumed to evaluate the same way.
39456
+ */
39457
+ const SERVICE_PROPERTY_FIELD_PREFIX = 'service_custom_properties.';
39458
+ const MISSING_KEY_EFFECT = {
39459
+ equals: 'never matches',
39460
+ contains: 'never matches',
39461
+ not_equals: 'always matches',
39462
+ not_contains: 'always matches',
39463
+ };
39464
+ /** What an alarm from a service without the key does to an atom with `condition`. */
39465
+ const missingKeyEffect = (condition) => MISSING_KEY_EFFECT[condition] ?? 'not measured';
39466
+ function propertyAtoms(expression) {
39467
+ if (!expression || typeof expression !== 'object')
39468
+ return [];
39469
+ return policyFilterAtoms(expression)
39470
+ .filter((a) => typeof a.field === 'string' && a.field.startsWith(SERVICE_PROPERTY_FIELD_PREFIX))
39471
+ .map((a) => ({ property: a.field.slice(SERVICE_PROPERTY_FIELD_PREFIX.length), condition: a.condition, value: String(a.value) }));
39472
+ }
39473
+ const atomKey = (a) => `${a.property}\u0000${a.condition}\u0000${a.value}`;
39474
+ const POSITIVE = new Set(['equals']);
39475
+ /**
39476
+ * Every atom on a service custom property in `policies` (their own filters plus the queues they
39477
+ * link) and in `queues`, with the services in `coverage` that lack the key and what that does.
39478
+ */
39479
+ function propertyRoutingExposure(policies, queues, coverage) {
39480
+ const allServices = coverage.services.map((s) => s.service);
39481
+ const keyFacts = (property) => {
39482
+ const managed = coverage.definitions.find((d) => d.name === property);
39483
+ if (managed)
39484
+ return { managed: true, missing: managed.missing, heldValues: managed.values, holders: managed.holders };
39485
+ const unmanaged = coverage.unmanaged.find((u) => u.name === property);
39486
+ const holders = new Set(unmanaged?.services ?? []);
39487
+ return {
39488
+ managed: false,
39489
+ missing: allServices.filter((s) => !holders.has(s)),
39490
+ heldValues: unmanaged?.values ?? {},
39491
+ holders: holders.size,
39492
+ };
39493
+ };
39494
+ const queueById = new Map(queues.map((q) => [q.id, q]));
39495
+ const usedBy = new Map();
39496
+ for (const p of policies) {
39497
+ for (const id of p.alarmViews ?? [])
39498
+ usedBy.set(String(id), [...(usedBy.get(String(id)) ?? []), p.name]);
39499
+ }
39500
+ const rows = (kind, item, sourced) => [...sourced.values()].map(({ atom, source }) => {
39501
+ const facts = keyFacts(atom.property);
39502
+ const notes = [];
39503
+ if (facts.holders === 0 && !facts.managed)
39504
+ notes.push('no service holds this key and it has no definition (a typo?)');
39505
+ if (POSITIVE.has(atom.condition) && facts.holders > 0 && !(atom.value in facts.heldValues)) {
39506
+ notes.push(`no service holds '${atom.value}'`);
39507
+ }
39508
+ return {
39509
+ kind,
39510
+ name: item.name,
39511
+ alarmCategory: item.alarmCategory ?? '',
39512
+ active: item.active ?? null,
39513
+ source,
39514
+ property: atom.property,
39515
+ condition: atom.condition,
39516
+ value: atom.value,
39517
+ managed: facts.managed,
39518
+ totalServices: coverage.totalServices,
39519
+ holders: facts.holders,
39520
+ missing: facts.missing,
39521
+ missingEffect: missingKeyEffect(atom.condition),
39522
+ heldValues: facts.heldValues,
39523
+ notes,
39524
+ usedBy: item.usedBy,
39525
+ channels: item.channels,
39526
+ };
39527
+ });
39528
+ const collect = (into, atoms, source) => {
39529
+ for (const atom of atoms) {
39530
+ const entry = into.get(atomKey(atom)) ?? { atom, source: [] };
39531
+ if (!entry.source.includes(source))
39532
+ entry.source.push(source);
39533
+ into.set(atomKey(atom), entry);
39534
+ }
39535
+ };
39536
+ const policyRows = policies.flatMap((p) => {
39537
+ const sourced = new Map();
39538
+ collect(sourced, propertyAtoms(p.filterExpressionV1), 'own filter');
39539
+ for (const id of p.alarmViews ?? []) {
39540
+ const q = queueById.get(String(id));
39541
+ if (q)
39542
+ collect(sourced, propertyAtoms(q.filterExpressions), `queue ${q.filterName}`);
39543
+ }
39544
+ return rows('policy', { name: p.name, alarmCategory: p.alarmCategory, active: p.active, channels: p.channelNames ?? [], usedBy: [] }, sourced);
39545
+ });
39546
+ const queueRows = queues.flatMap((q) => {
39547
+ const sourced = new Map();
39548
+ collect(sourced, propertyAtoms(q.filterExpressions), 'own filter');
39549
+ return rows('queue', { name: q.filterName, alarmCategory: q.alarmCategory, channels: [], usedBy: usedBy.get(q.id) ?? [] }, sourced);
39550
+ });
39551
+ return [...policyRows, ...queueRows];
39552
+ }
39553
+
38820
39554
  exports.CreateServices = void 0;
38821
39555
  (function (CreateServices) {
38822
39556
  /** The service kinds the platform recognises, in wire casing (`servicerepo/filters` catalog). */
@@ -40650,6 +41384,391 @@ class SimpleHTTPError extends Error {
40650
41384
  }
40651
41385
  }
40652
41386
 
41387
+ /**
41388
+ * Synthetics access policies (2026-11 release): `synthetics/permission-service/api/v1/policies`.
41389
+ * A policy grants READ or WRITE on the monitors of one monitor group (a RESOURCE rule) — or on all
41390
+ * monitors (no RESOURCE rule) — to user groups or users named in a SUBJECT rule. Measured on
41391
+ * THE_LABORATORY (#1599, #1584): names are unique (a duplicate create is a 400); `PUT …/{id}`
41392
+ * updates a policy in place (the UI instead deletes and recreates, leaving a window with no
41393
+ * access); `DELETE …/{id}` is a 204; subject names are NEVER checked against existing groups, and
41394
+ * a renamed or deleted group stays named here.
41395
+ */
41396
+ const SYNTHETIC_ACCESS_ACTIONS = ['READ', 'WRITE'];
41397
+ const SYNTHETIC_ACCESS_SUBJECTS = ['userGroup', 'user'];
41398
+ const SyntheticAccessRuleSchema = v4.z.looseObject({
41399
+ attributeType: v4.z.string().describe('SUBJECT (who) or RESOURCE (which monitors)'),
41400
+ attributeName: v4.z.string().describe('SUBJECT: userGroup | user; RESOURCE: group'),
41401
+ operator: v4.z.string().describe('SUBJECT: IN; RESOURCE: EQUALS'),
41402
+ attributeValue: v4.z.union([v4.z.string(), v4.z.array(v4.z.string())]).describe('SUBJECT: names; RESOURCE: the monitor group'),
41403
+ });
41404
+ const SyntheticAccessPolicySchema = v4.z.looseObject({
41405
+ id: v4.z.number().describe('Path key for update and delete'),
41406
+ tenantId: v4.z.string().optional(),
41407
+ name: v4.z.string().describe('Unique; the UI names them <usergroups|users>_<ACTION>_<monitor group|all>'),
41408
+ description: v4.z.string().nullable().optional(),
41409
+ resourceType: v4.z.string().describe("'monitor'"),
41410
+ action: v4.z.string().describe('READ | WRITE'),
41411
+ effect: v4.z.string().describe("'ALLOW'"),
41412
+ active: v4.z.boolean(),
41413
+ rules: v4.z.array(SyntheticAccessRuleSchema),
41414
+ });
41415
+ const SyntheticAccessPolicyListSchema = v4.z.array(SyntheticAccessPolicySchema);
41416
+ const SyntheticAccessPolicyWriteSchema = v4.z.looseObject({
41417
+ name: v4.z.string().min(1),
41418
+ description: v4.z.string(),
41419
+ resourceType: v4.z.literal('monitor'),
41420
+ action: v4.z.enum(SYNTHETIC_ACCESS_ACTIONS),
41421
+ effect: v4.z.literal('ALLOW'),
41422
+ active: v4.z.boolean(),
41423
+ rules: v4.z.array(SyntheticAccessRuleSchema).min(1),
41424
+ });
41425
+ const asList = (v) => (Array.isArray(v) ? v : [v]);
41426
+ /** Reads what a policy grants, or undefined when it is not the shape the UI writes. */
41427
+ function policyGrant(policy) {
41428
+ const subject = policy.rules.find((r) => r.attributeType === 'SUBJECT');
41429
+ const resource = policy.rules.find((r) => r.attributeType === 'RESOURCE' && r.attributeName === 'group');
41430
+ const kind = subject?.attributeName;
41431
+ if (!subject || !kind || !SYNTHETIC_ACCESS_SUBJECTS.includes(kind))
41432
+ return undefined;
41433
+ if (!SYNTHETIC_ACCESS_ACTIONS.includes(policy.action))
41434
+ return undefined;
41435
+ return {
41436
+ subject: kind,
41437
+ names: asList(subject.attributeValue),
41438
+ action: policy.action,
41439
+ monitorGroup: resource ? String(asList(resource.attributeValue)[0] ?? '') : null,
41440
+ };
41441
+ }
41442
+ /** The UI's policy name: `usergroups_READ_payments`, `users_WRITE_all`. */
41443
+ function accessPolicyName(subject, action, monitorGroup) {
41444
+ return `${subject === 'userGroup' ? 'usergroups' : 'users'}_${action}_${monitorGroup ?? 'all'}`;
41445
+ }
41446
+ /** The body for a policy granting `action` on `monitorGroup` (null = all monitors) to `names`. */
41447
+ function accessPolicyBody(grant, name = accessPolicyName(grant.subject, grant.action, grant.monitorGroup)) {
41448
+ return {
41449
+ name,
41450
+ description: '',
41451
+ resourceType: 'monitor',
41452
+ action: grant.action,
41453
+ effect: 'ALLOW',
41454
+ active: true,
41455
+ rules: [
41456
+ { attributeType: 'SUBJECT', attributeName: grant.subject, operator: 'IN', attributeValue: grant.names },
41457
+ ...(grant.monitorGroup === null
41458
+ ? []
41459
+ : [{ attributeType: 'RESOURCE', attributeName: 'group', operator: 'EQUALS', attributeValue: grant.monitorGroup }]),
41460
+ ],
41461
+ };
41462
+ }
41463
+ /**
41464
+ * The one write that grants (`add`) or revokes (`remove`) `name`'s `action` on `monitorGroup`:
41465
+ * the policy for that (subject kind, action, monitor group) is updated in place, created when there
41466
+ * is none, and deleted when its last subject is revoked. Policies are matched by what they grant,
41467
+ * not by name.
41468
+ */
41469
+ function planAccessChange(policies, change) {
41470
+ const match = policies.find((p) => {
41471
+ const g = policyGrant(p);
41472
+ return g && g.subject === change.subject && g.action === change.action && g.monitorGroup === change.monitorGroup;
41473
+ });
41474
+ const current = match ? policyGrant(match) : undefined;
41475
+ const scope = change.monitorGroup === null ? 'all monitors' : `monitor group '${change.monitorGroup}'`;
41476
+ if (change.op === 'add') {
41477
+ if (current?.names.includes(change.name))
41478
+ return { kind: 'none', reason: `'${change.name}' already has ${change.action} on ${scope}` };
41479
+ if (!match || !current) {
41480
+ return { kind: 'create', body: accessPolicyBody({ subject: change.subject, names: [change.name], action: change.action, monitorGroup: change.monitorGroup }) };
41481
+ }
41482
+ return {
41483
+ kind: 'update',
41484
+ id: match.id,
41485
+ before: current.names,
41486
+ body: accessPolicyBody({ ...current, names: [...current.names, change.name] }, match.name),
41487
+ };
41488
+ }
41489
+ if (!match || !current || !current.names.includes(change.name)) {
41490
+ return { kind: 'none', reason: `'${change.name}' has no ${change.action} grant on ${scope}` };
41491
+ }
41492
+ const remaining = current.names.filter((n) => n !== change.name);
41493
+ if (remaining.length === 0)
41494
+ return { kind: 'delete', id: match.id, before: current.names };
41495
+ return { kind: 'update', id: match.id, before: current.names, body: accessPolicyBody({ ...current, names: remaining }, match.name) };
41496
+ }
41497
+
41498
+ /**
41499
+ * Roles (2026-11 release). Measured on THE_LABORATORY (#1584, #1597):
41500
+ * - `GET ess/roles/v1?cohort=<GUID>` is the catalog: built-in PU, SA, TA, UZ and custom `VIEW####`
41501
+ * roles, each with a level, a permission tree (`taskMap`) and a description.
41502
+ * - The same roles are DataStore views with `attributes.owner: 'DP'` (`views/view/{id}`). WHO HOLDS
41503
+ * a role is the view's `access.users` and `access.groups` (groups by NAME). A grant or revoke is a
41504
+ * full `PUT` of the view carrying `lastModificationTimestamp`; a stale timestamp is refused (409,
41505
+ * "View … was updated meanwhile") and nothing changes.
41506
+ * - Built-in roles' features cannot be edited; their holders can.
41507
+ * These views do not fit the generic DataStore view schema (`views` is a list of feature filters and
41508
+ * grants carry `permissions`), so they have their own.
41509
+ */
41510
+ const BUILT_IN_ROLE_IDS = ['PU', 'SA', 'TA', 'UZ'];
41511
+ /** The tenant admin role: revoking its last holder would lock admins out. */
41512
+ const TENANT_ADMIN_ROLE_ID = 'TA';
41513
+ const RoleCatalogEntrySchema = v4.z.looseObject({
41514
+ name: v4.z.string().describe('Role id: PU, SA, TA, UZ, or VIEW#### for a custom role'),
41515
+ displayName: v4.z.string().optional().describe('e.g. Tenant Admin'),
41516
+ level: v4.z.number().optional().describe('Privilege level: TA 800, SA 750, PU 500, UZ 100, custom 0'),
41517
+ roleDescription: v4.z.string().optional(),
41518
+ customRoles: v4.z.unknown().optional(),
41519
+ privileges: v4.z.unknown().optional(),
41520
+ taskMap: v4.z.unknown().optional().describe('The permission tree'),
41521
+ });
41522
+ const RoleCatalogSchema = v4.z.array(RoleCatalogEntrySchema);
41523
+ /** A group or user holding a role. `permissions` is what the UI writes: READ, WRITE, DELETE. */
41524
+ const RoleGrantSchema = v4.z.looseObject({
41525
+ name: v4.z.string().describe('Group name or user login'),
41526
+ permissions: v4.z.array(v4.z.string()).optional().describe('The UI grants READ, WRITE and DELETE'),
41527
+ });
41528
+ const RoleViewSchema = v4.z.looseObject({
41529
+ viewId: v4.z.string().describe('Role id (PU, SA, TA, UZ, VIEW####)'),
41530
+ access: v4.z
41531
+ .looseObject({
41532
+ groups: v4.z.array(RoleGrantSchema).optional().describe('Groups holding the role, by name'),
41533
+ users: v4.z.array(RoleGrantSchema).optional().describe('Users holding the role directly'),
41534
+ })
41535
+ .describe('Who holds the role'),
41536
+ lastModificationTimestamp: v4.z.number().describe('Concurrency token; send it back on PUT'),
41537
+ views: v4.z.array(v4.z.unknown()).optional().describe('Feature filters (the permission tree)'),
41538
+ attributes: v4.z
41539
+ .looseObject({ owner: v4.z.string().optional(), label: v4.z.string().optional(), description: v4.z.string().optional() })
41540
+ .optional(),
41541
+ inactive: v4.z.boolean().optional(),
41542
+ });
41543
+ /** The permissions the UI writes when a role is granted. */
41544
+ const ROLE_GRANT_PERMISSIONS = ['READ', 'WRITE', 'DELETE'];
41545
+ const grants = (view, kind) => view.access[kind] ?? [];
41546
+ /** The view with `name` added to its group or user holders (unchanged when already there). */
41547
+ function withRoleGrant(view, kind, name) {
41548
+ if (grants(view, kind).some((g) => g.name === name))
41549
+ return view;
41550
+ return { ...view, access: { ...view.access, [kind]: [...grants(view, kind), { name, permissions: [...ROLE_GRANT_PERMISSIONS] }] } };
41551
+ }
41552
+ /** The view with `name` removed from its group or user holders. */
41553
+ function withoutRoleGrant(view, kind, name) {
41554
+ return { ...view, access: { ...view.access, [kind]: grants(view, kind).filter((g) => g.name !== name) } };
41555
+ }
41556
+ /** Group and user names holding the role. */
41557
+ function roleHolders(view) {
41558
+ return { groups: grants(view, 'groups').map((g) => g.name), users: grants(view, 'users').map((g) => g.name) };
41559
+ }
41560
+
41561
+ function allGroupReferences(roleViews, policies) {
41562
+ const fromRoles = roleViews.flatMap((v) => roleHolders(v).groups.map((group) => ({
41563
+ group,
41564
+ kind: 'role',
41565
+ id: v.viewId,
41566
+ label: v.attributes?.label ?? v.viewId,
41567
+ grants: `role ${v.attributes?.label ?? v.viewId}`,
41568
+ })));
41569
+ const fromPolicies = policies.flatMap((p) => {
41570
+ const grant = policyGrant(p);
41571
+ if (!grant || grant.subject !== 'userGroup')
41572
+ return [];
41573
+ return grant.names.map((group) => ({
41574
+ group,
41575
+ kind: 'synthetics-access',
41576
+ id: String(p.id),
41577
+ label: p.name,
41578
+ grants: `${grant.action} on ${grant.monitorGroup === null ? 'all monitors' : `monitor group '${grant.monitorGroup}'`}`,
41579
+ }));
41580
+ });
41581
+ return [...fromRoles, ...fromPolicies];
41582
+ }
41583
+ /** The roles and access policies that name `group`. */
41584
+ function groupReferences(group, roleViews, policies) {
41585
+ return allGroupReferences(roleViews, policies).filter((r) => r.group === group);
41586
+ }
41587
+ /** References to group names no existing group has: access that silently grants nobody. */
41588
+ function danglingGroupReferences(existingGroups, roleViews, policies) {
41589
+ const existing = new Set(existingGroups);
41590
+ return allGroupReferences(roleViews, policies).filter((r) => !existing.has(r.group));
41591
+ }
41592
+
41593
+ /**
41594
+ * User groups (2026-11 release): `ess/usergroups/v1`. Measured on THE_LABORATORY (#1584, #1597):
41595
+ * names are unique (a duplicate create is a 400, code 1251341); `PUT …/{id}` replaces the whole
41596
+ * member list and can rename; `DELETE …/{id}` is a 204. Roles and synthetics access policies name a
41597
+ * group by its NAME, so a rename or a delete leaves those references dangling — the platform does
41598
+ * not follow or check them.
41599
+ */
41600
+ const UserGroupUserInfoSchema = v4.z.looseObject({
41601
+ userId: v4.z.string().describe('Login id'),
41602
+ firstName: v4.z.string().optional(),
41603
+ lastName: v4.z.string().optional(),
41604
+ statusEnum: v4.z.string().optional().describe('e.g. ACTIVE'),
41605
+ userType: v4.z.string().optional(),
41606
+ userRefID: v4.z.union([v4.z.number(), v4.z.string()]).optional().describe('Id used by the ess/users endpoints (a number on the lab)'),
41607
+ dateCreated: v4.z.string().optional(),
41608
+ dateModified: v4.z.string().optional(),
41609
+ });
41610
+ /** One group as listed (`GET …/list`, no members) or read (`GET …/{id}`, members on request). */
41611
+ const UserGroupSchema = v4.z.looseObject({
41612
+ groupId: v4.z.number().describe('Numeric id; the path key for read, update and delete'),
41613
+ groupName: v4.z.string().describe('Unique; what roles and access policies reference'),
41614
+ description: v4.z.string().optional(),
41615
+ created: v4.z.string().optional().describe('ISO time'),
41616
+ lastUpdated: v4.z.string().optional().describe('ISO time'),
41617
+ lastUpdatedBy: v4.z.string().optional(),
41618
+ tenantId: v4.z.string().optional(),
41619
+ userIds: v4.z.array(v4.z.string()).optional().describe('Members; only with include_userids=true'),
41620
+ userInfos: v4.z.array(UserGroupUserInfoSchema).optional().describe('Member details; only with include_userinfos=true'),
41621
+ });
41622
+ const UserGroupListSchema = v4.z.array(UserGroupSchema);
41623
+ /** Create body (`POST ess/usergroups/v1`); update (`PUT …/{id}`) adds `groupId` and replaces members. */
41624
+ const UserGroupWriteSchema = v4.z.object({
41625
+ groupName: v4.z.string().trim().min(1).describe('Unique group name'),
41626
+ description: v4.z.string().describe('"" for none'),
41627
+ userIds: v4.z.array(v4.z.string().min(1)).describe('The complete member list (login ids)'),
41628
+ });
41629
+
41630
+ /**
41631
+ * A service's Availability KPI, set from one of its SLIs (#1564; UI HAR, 2026-11-15).
41632
+ *
41633
+ * The KPI is one entry of `type: 'availability'` in the service's `attributes.metrics`, saved with the rest of the
41634
+ * service (`oi/v2/sa/save?replace=true`); clearing it removes the entry. Set from an SLI, the entry points at the SLI's
41635
+ * SLO Threshold metric (`<service uuid>:<SLI name> Threshold` on `OI|SA|SERVICES|ALL`), which emits 1 for an interval
41636
+ * that meets the objective (`threshold_emit_value`) and 0 otherwise; the UI saves threshold 0.5, so the service counts
41637
+ * as available while the objective is met. Only an Availability SLI with an SLO qualifies, and only once its Threshold
41638
+ * metric is published: a few minutes after the SLI or its SLO is created or changed. Renaming the SLI renames the
41639
+ * metric, and a KPI set before the rename keeps pointing at the old one.
41640
+ */
41641
+ exports.AvailabilityKpi = void 0;
41642
+ (function (AvailabilityKpi) {
41643
+ AvailabilityKpi.SOURCE = 'OI|SA|SERVICES|ALL';
41644
+ AvailabilityKpi.THRESHOLD = 0.5;
41645
+ /** How far back a Threshold metric must have reported to count as published (the UI asks for 24 h). */
41646
+ AvailabilityKpi.PUBLISHED_WINDOW_MS = 86_400_000;
41647
+ AvailabilityKpi.NOT_PUBLISHED = 'its SLO Threshold metric is not published yet: it appears a few minutes after the SLI or its SLO is created or changed; list again shortly';
41648
+ /** The service's KPI entry, if it has one. */
41649
+ function currentEntry(metrics) {
41650
+ return (metrics ?? []).find((m) => m.type === 'availability');
41651
+ }
41652
+ AvailabilityKpi.currentEntry = currentEntry;
41653
+ function isAvailability(sli) {
41654
+ return (sli.sli_type ?? '').toLowerCase() === 'availability';
41655
+ }
41656
+ /** The metric names to look up: every SLI's SLO Threshold metric, and the current KPI's metric. */
41657
+ function metricNames(slis, current) {
41658
+ const names = slis.flatMap((s) => (s.metricsConfig?.slo_threshold?.attributeName ? [s.metricsConfig.slo_threshold.attributeName] : []));
41659
+ if (current)
41660
+ names.push(current.attributeName);
41661
+ return [...new Set(names)];
41662
+ }
41663
+ AvailabilityKpi.metricNames = metricNames;
41664
+ /** Each SLI, whether it can be the KPI now, and why not. */
41665
+ function candidates(slis, published, current) {
41666
+ return slis.map((s) => {
41667
+ const thresholdMetric = s.metricsConfig?.slo_threshold?.attributeName;
41668
+ const found = thresholdMetric ? published.get(thresholdMetric) : undefined;
41669
+ const reason = !isAvailability(s)
41670
+ ? `an SLI of type ${s.sli_type || 'unknown'}: the KPI takes an Availability SLI`
41671
+ : !s.hasSLO || !thresholdMetric
41672
+ ? 'it has no SLO: add one (sli add-slo), then wait a few minutes for its Threshold metric'
41673
+ : !found
41674
+ ? AvailabilityKpi.NOT_PUBLISHED
41675
+ : undefined;
41676
+ return {
41677
+ sli: s.name,
41678
+ sliGroupId: s.id,
41679
+ sliType: s.sli_type,
41680
+ hasSLO: s.hasSLO,
41681
+ ...(s.hasSLO ? { targetPercent: s.target_percent } : {}),
41682
+ ...(thresholdMetric ? { thresholdMetric } : {}),
41683
+ ...(found ? { metricId: found.id, ...(found.firstSeen ? { firstSeen: found.firstSeen } : {}) } : {}),
41684
+ eligible: reason === undefined,
41685
+ ...(reason ? { reason } : {}),
41686
+ current: current !== undefined && thresholdMetric === current.attributeName,
41687
+ };
41688
+ });
41689
+ }
41690
+ AvailabilityKpi.candidates = candidates;
41691
+ /** The current KPI, what it comes from, and whether its metric still reports. */
41692
+ function describeCurrent(entry, slis, published) {
41693
+ if (!entry)
41694
+ return undefined;
41695
+ const sli = slis.find((s) => s.metricsConfig?.slo_threshold?.attributeName === entry.attributeName);
41696
+ const isPublished = published.has(entry.attributeName);
41697
+ const note = !sli
41698
+ ? `not one of this service's SLIs${entry.configSource && entry.configSource !== 'metric' ? ` (configSource ${entry.configSource})` : ''}: it may come from a renamed or deleted SLI, or another source`
41699
+ : !isPublished
41700
+ ? 'its metric has not reported in the last 24 hours, so the service has no availability'
41701
+ : undefined;
41702
+ return {
41703
+ attributeName: entry.attributeName,
41704
+ metricId: entry.id,
41705
+ ...(entry.configSource ? { configSource: entry.configSource } : {}),
41706
+ ...(entry.threshold !== undefined ? { threshold: entry.threshold } : {}),
41707
+ ...(sli ? { sli: sli.name } : {}),
41708
+ published: isPublished,
41709
+ ...(note ? { note } : {}),
41710
+ };
41711
+ }
41712
+ AvailabilityKpi.describeCurrent = describeCurrent;
41713
+ /**
41714
+ * Finds an SLI by exact name, then by name ignoring case. Never by id: the only id the SLI list carries is the SLI
41715
+ * group's, shared by every SLI in the group (#1570).
41716
+ */
41717
+ function findCandidate(list, sli) {
41718
+ return list.find((c) => c.sli === sli) ?? list.find((c) => c.sli.toLowerCase() === sli.toLowerCase());
41719
+ }
41720
+ AvailabilityKpi.findCandidate = findCandidate;
41721
+ /** Why `sli` names none of the service's SLIs, and what it could name instead. */
41722
+ function notFound(list, sli, serviceName) {
41723
+ const group = list.filter((c) => c.sliGroupId === sli);
41724
+ if (group.length > 0) {
41725
+ return `'${sli}' is an SLI group id, not an SLI: pass the SLI's name; that group's SLIs: ${group.map((c) => `'${c.sli}'`).join(', ')}`;
41726
+ }
41727
+ const known = list.map((c) => `'${c.sli}'`).join(', ');
41728
+ return `no SLI '${sli}' on service '${serviceName}'${known ? `; its SLIs: ${known}` : ': it has no SLIs'}`;
41729
+ }
41730
+ AvailabilityKpi.notFound = notFound;
41731
+ /** The KPI entry for an eligible candidate, as the UI saves it. */
41732
+ function entryFor(candidate) {
41733
+ if (!candidate.eligible || !candidate.metricId || !candidate.thresholdMetric) {
41734
+ throw new Error(`SLI '${candidate.sli}' cannot be the availability KPI: ${candidate.reason ?? 'no published Threshold metric'}`);
41735
+ }
41736
+ return {
41737
+ type: 'availability',
41738
+ configSource: 'metric',
41739
+ threshold: AvailabilityKpi.THRESHOLD,
41740
+ id: candidate.metricId,
41741
+ sourceName: AvailabilityKpi.SOURCE,
41742
+ attributeName: candidate.thresholdMetric,
41743
+ };
41744
+ }
41745
+ AvailabilityKpi.entryFor = entryFor;
41746
+ function label(entry, sli) {
41747
+ if (!entry)
41748
+ return 'none';
41749
+ return sli ? `SLI '${sli}' (${entry.attributeName})` : entry.attributeName;
41750
+ }
41751
+ /**
41752
+ * Sets (`entry`) or clears (`null`) the KPI on `serviceName` in a store body, replacing any existing KPI entry.
41753
+ *
41754
+ * @returns change lines; empty when nothing changes.
41755
+ * @throws Error if the service is not in the body.
41756
+ */
41757
+ function apply(body, serviceName, entry, names = {}) {
41758
+ const target = body.vertices.find((v) => v.attributes.name === serviceName);
41759
+ if (!target)
41760
+ throw new Error(`No service with name '${serviceName}' found`);
41761
+ const metrics = target.attributes.metrics ?? [];
41762
+ const before = currentEntry(metrics);
41763
+ if ((before?.attributeName ?? null) === (entry?.attributeName ?? null) && (before?.id ?? null) === (entry?.id ?? null)) {
41764
+ return [];
41765
+ }
41766
+ target.attributes.metrics = [...metrics.filter((m) => m.type !== 'availability'), ...(entry ? [entry] : [])];
41767
+ return [`availability KPI: ${label(before, names.before)} -> ${label(entry ?? undefined, names.after)}`];
41768
+ }
41769
+ AvailabilityKpi.apply = apply;
41770
+ })(exports.AvailabilityKpi || (exports.AvailabilityKpi = {}));
41771
+
40653
41772
  /** @internal */
40654
41773
  const sampleServiceDetailRequestBody = {
40655
41774
  timeFrom: 1772843076673,
@@ -42996,6 +44115,451 @@ function toClusteringPolicyPreviewBody(body) {
42996
44115
  };
42997
44116
  }
42998
44117
 
44118
+ const OPERATION_NAME = /^[A-Za-z_]\w*$/;
44119
+ function classifyArgument(raw) {
44120
+ const trimmed = raw.trim();
44121
+ const quote = trimmed[0];
44122
+ if ((quote === "'" || quote === '"') && trimmed.length >= 2 && trimmed.endsWith(quote)) {
44123
+ return { kind: 'quoted', raw, value: trimmed.slice(1, -1) };
44124
+ }
44125
+ if (trimmed.startsWith('[') && trimmed.endsWith(']')) {
44126
+ const inner = trimmed.slice(1, -1).trim();
44127
+ return { kind: 'list', raw, items: inner === '' ? [] : inner.split(',').map((item) => item.trim()) };
44128
+ }
44129
+ return { kind: 'bare', raw, value: raw };
44130
+ }
44131
+ /**
44132
+ * Splits a template into literal text and `{operation(args)}` calls. Quotes and
44133
+ * `[…]` lists may contain commas, parentheses and braces. Parsing is purely
44134
+ * syntactic; {@link namingTemplateProblems} checks calls against the catalog.
44135
+ */
44136
+ function parseNamingTemplate(template) {
44137
+ const parts = [];
44138
+ const errors = [];
44139
+ let text = '';
44140
+ let index = 0;
44141
+ const flushText = () => {
44142
+ if (text) {
44143
+ parts.push({ kind: 'text', text });
44144
+ text = '';
44145
+ }
44146
+ };
44147
+ while (index < template.length) {
44148
+ const char = template[index];
44149
+ if (char === '}') {
44150
+ errors.push(`unmatched '}' at position ${index}`);
44151
+ return { parts, errors };
44152
+ }
44153
+ if (char !== '{') {
44154
+ text += char;
44155
+ index++;
44156
+ continue;
44157
+ }
44158
+ const start = index;
44159
+ const open = template.indexOf('(', start);
44160
+ const close = template.indexOf('}', start);
44161
+ if (open === -1 || (close !== -1 && close < open)) {
44162
+ errors.push(`'{' at position ${start} is not followed by operation(args) — expected e.g. {split(host,'.',0)}`);
44163
+ return { parts, errors };
44164
+ }
44165
+ const operation = template.slice(start + 1, open).trim();
44166
+ if (!OPERATION_NAME.test(operation)) {
44167
+ errors.push(`'${template.slice(start + 1, open)}' at position ${start + 1} is not an operation name`);
44168
+ return { parts, errors };
44169
+ }
44170
+ const args = [];
44171
+ let current = '';
44172
+ let quote;
44173
+ let depth = 0;
44174
+ let cursor = open + 1;
44175
+ let closedParen = false;
44176
+ for (; cursor < template.length; cursor++) {
44177
+ const c = template[cursor];
44178
+ if (quote) {
44179
+ current += c;
44180
+ if (c === quote)
44181
+ quote = undefined;
44182
+ continue;
44183
+ }
44184
+ if (c === "'" || c === '"') {
44185
+ quote = c;
44186
+ current += c;
44187
+ }
44188
+ else if (c === '[') {
44189
+ depth++;
44190
+ current += c;
44191
+ }
44192
+ else if (c === ']') {
44193
+ depth--;
44194
+ current += c;
44195
+ }
44196
+ else if (c === ',' && depth === 0) {
44197
+ args.push(current);
44198
+ current = '';
44199
+ }
44200
+ else if (c === ')' && depth === 0) {
44201
+ closedParen = true;
44202
+ break;
44203
+ }
44204
+ else {
44205
+ current += c;
44206
+ }
44207
+ }
44208
+ if (quote) {
44209
+ errors.push(`unterminated ${quote} quote in {${operation}(…)} starting at position ${start}`);
44210
+ return { parts, errors };
44211
+ }
44212
+ if (!closedParen) {
44213
+ errors.push(`{${operation}( at position ${start} has no closing ')'`);
44214
+ return { parts, errors };
44215
+ }
44216
+ if (current.trim() !== '' || args.length > 0) {
44217
+ args.push(current);
44218
+ }
44219
+ let after = cursor + 1;
44220
+ while (template[after] === ' ')
44221
+ after++;
44222
+ if (template[after] !== '}') {
44223
+ errors.push(`{${operation}(…) at position ${start} must close with '}' right after ')'`);
44224
+ return { parts, errors };
44225
+ }
44226
+ flushText();
44227
+ parts.push({ kind: 'call', raw: template.slice(start, after + 1), operation, args: args.map(classifyArgument) });
44228
+ index = after + 1;
44229
+ }
44230
+ flushText();
44231
+ return { parts, errors };
44232
+ }
44233
+ const NON_NEGATIVE_INTEGER = /^\d+$/;
44234
+ /** The catalog's parameters for an operation, in positional order. */
44235
+ function orderedParameters(operation) {
44236
+ return [...(operation.parameters ?? [])].sort((a, b) => a.paramNumber - b.paramNumber);
44237
+ }
44238
+ /**
44239
+ * A usable example call built from the catalog's parameter defaults, e.g.
44240
+ * `{split(field,'|',0)}` or `{mostimpacted(field[,3])}` (optional arguments in
44241
+ * brackets).
44242
+ */
44243
+ function namingOperationSignature(operation) {
44244
+ const args = orderedParameters(operation).map((parameter, position) => {
44245
+ const fallback = parameter.defaultValue ?? '';
44246
+ let shown;
44247
+ if (position === 0 && (operation.supportedFields ?? []).length > 0) {
44248
+ shown = 'field';
44249
+ }
44250
+ else if (parameter.type === 'Integer' || fallback.trim().startsWith('[')) {
44251
+ shown = fallback || (parameter.type === 'Integer' ? '0' : '[0]');
44252
+ }
44253
+ else {
44254
+ shown = `'${fallback}'`;
44255
+ }
44256
+ return { shown, optional: !parameter.isMandatory };
44257
+ });
44258
+ let rendered = '';
44259
+ args.forEach((arg, position) => {
44260
+ const separator = position === 0 ? '' : ',';
44261
+ rendered += arg.optional ? `[${separator}${arg.shown}]` : `${separator}${arg.shown}`;
44262
+ });
44263
+ return `{${operation.opName}(${rendered})}`;
44264
+ }
44265
+ /**
44266
+ * Problems that would make the platform reject a template (400) or render a
44267
+ * call as `N/A` for every situation: syntax errors, operations the tenant does
44268
+ * not define, unsupported or space-padded fields, wrong argument counts or
44269
+ * types, and inverted `slice` ranges. With an empty catalog only syntax is
44270
+ * checked. Returns human-readable lines, empty when the template is usable.
44271
+ */
44272
+ function namingTemplateProblems(template, operations) {
44273
+ if (!template) {
44274
+ return [];
44275
+ }
44276
+ const parsed = parseNamingTemplate(template);
44277
+ const problems = parsed.errors.map((error) => `naming template: ${error}`);
44278
+ if (operations.length === 0) {
44279
+ return problems;
44280
+ }
44281
+ const byName = new Map(operations.map((operation) => [operation.opName.toLowerCase(), operation]));
44282
+ for (const part of parsed.parts) {
44283
+ if (part.kind !== 'call')
44284
+ continue;
44285
+ const call = part.raw;
44286
+ const operation = byName.get(part.operation.toLowerCase());
44287
+ if (!operation) {
44288
+ problems.push(`naming template ${call}: this tenant has no '${part.operation}' operation — expected one of ` +
44289
+ operations.map((candidate) => candidate.opName).join(', '));
44290
+ continue;
44291
+ }
44292
+ const declared = operation.parameters !== undefined;
44293
+ const parameters = declared
44294
+ ? orderedParameters(operation)
44295
+ : part.args.map((_, position) => ({ paramNumber: position + 1, isMandatory: true, type: 'String', defaultValue: '' }));
44296
+ const mandatory = parameters.filter((parameter) => parameter.isMandatory).length;
44297
+ if (declared && (part.args.length < mandatory || part.args.length > parameters.length)) {
44298
+ const expected = mandatory === parameters.length ? `${mandatory}` : `${mandatory}-${parameters.length}`;
44299
+ problems.push(`naming template ${call}: ${operation.opName} takes ${expected} argument(s), got ${part.args.length}`);
44300
+ continue;
44301
+ }
44302
+ const supported = (operation.supportedFields ?? []).map((field) => field.field);
44303
+ part.args.forEach((arg, position) => {
44304
+ const parameter = parameters[position];
44305
+ if (!parameter)
44306
+ return;
44307
+ const label = `${operation.opName} argument ${position + 1}`;
44308
+ if (position === 0 && supported.length > 0) {
44309
+ if (arg.kind !== 'bare') {
44310
+ problems.push(`naming template ${call}: ${label} is the alarm field — write it bare, e.g. ${supported[0]}`);
44311
+ }
44312
+ else if (arg.raw !== arg.raw.trim()) {
44313
+ problems.push(`naming template ${call}: field '${arg.raw}' has surrounding spaces — the platform reads them as part of ` +
44314
+ `the field name and renders N/A; write ${arg.raw.trim()}`);
44315
+ }
44316
+ else if (!supported.includes(arg.value)) {
44317
+ problems.push(`naming template ${call}: ${operation.opName} supports ${supported.join(', ')} — not '${arg.value}'`);
44318
+ }
44319
+ return;
44320
+ }
44321
+ if (!declared) {
44322
+ return;
44323
+ }
44324
+ if (parameter.type === 'Integer') {
44325
+ if (arg.kind !== 'bare' || !NON_NEGATIVE_INTEGER.test(arg.value.trim())) {
44326
+ problems.push(`naming template ${call}: ${label} must be a non-negative integer, got ${arg.raw.trim()}`);
44327
+ }
44328
+ return;
44329
+ }
44330
+ if ((parameter.defaultValue ?? '').trim().startsWith('[')) {
44331
+ if (arg.kind !== 'list' || arg.items.length === 0 || arg.items.some((item) => !NON_NEGATIVE_INTEGER.test(item))) {
44332
+ problems.push(`naming template ${call}: ${label} must be a list of segment indices such as [0,2], got ${arg.raw.trim()}`);
44333
+ }
44334
+ return;
44335
+ }
44336
+ if (arg.kind !== 'quoted') {
44337
+ problems.push(`naming template ${call}: ${label} must be a quoted string such as '|', got ${arg.raw.trim()}`);
44338
+ }
44339
+ else if (arg.value === '') {
44340
+ problems.push(`naming template ${call}: ${label} is an empty string — the platform rejects an empty delimiter`);
44341
+ }
44342
+ });
44343
+ if (operation.opName.toLowerCase() === 'slice' && part.args.length >= 4) {
44344
+ const [from, to] = [part.args[2], part.args[3]].map((arg) => Number(arg?.raw.trim()));
44345
+ if (Number.isInteger(from) && Number.isInteger(to) && from > to) {
44346
+ problems.push(`naming template ${call}: slice start ${from} is after its end ${to} — the range is inclusive a..b`);
44347
+ }
44348
+ }
44349
+ }
44350
+ return problems;
44351
+ }
44352
+
44353
+ /**
44354
+ * The server's own explanation of a situation (2026-11, the situation Details tab):
44355
+ * `POST oi/v2/api/clusteralarms/explain/{clusterId}` with body `{}`. Shapes from the owner's
44356
+ * capture and from reading open, closed, force-closed and 24-alarm situations (#1614): all 16
44357
+ * sections were present every time; every one is optional and loose anyway.
44358
+ * It answers "why is this situation like this" directly: why it opened (policy, seed alarm,
44359
+ * criteria), why it has this name, which alarms it holds, when and why it stabilises or closes,
44360
+ * and a plain-language narration.
44361
+ *
44362
+ * Measured: an unknown id is a 200 with no `identity`, the headline "Situation #… not found." and
44363
+ * a data-quality note — see {@link situationExplanationFound}. `alarmBreakdown.alarms` lists at
44364
+ * most 20 alarms; the counts cover all of them.
44365
+ */
44366
+ const str$1 = (d) => v4.z.string().optional().describe(d);
44367
+ const num = (d) => v4.z.number().optional().describe(d);
44368
+ const bool$1 = (d) => v4.z.boolean().optional().describe(d);
44369
+ const strs = (d) => v4.z.array(v4.z.string()).optional().describe(d);
44370
+ const counts = (d) => v4.z.record(v4.z.string(), v4.z.number()).optional().describe(d);
44371
+ const SituationExplainIdentitySchema = v4.z.looseObject({
44372
+ clusterId: str$1('Situation id'),
44373
+ clusterName: str$1('Situation name'),
44374
+ status: str$1('Status code'),
44375
+ statusTranslated: str$1('Status, as shown'),
44376
+ severity: str$1('Severity code'),
44377
+ severityTranslated: str$1('Severity, as shown'),
44378
+ stableState: str$1('Stability state'),
44379
+ clusteringType: str$1('Situation type, e.g. Custom'),
44380
+ hosts: strs('Hosts of its alarms'),
44381
+ mostImpactedHost: str$1('The host with the most alarms'),
44382
+ startTime: str$1('When the situation started'),
44383
+ firstAlarmStartTime: str$1('When its first alarm started'),
44384
+ timestamp: str$1('Last change'),
44385
+ policyId: str$1('Situation policy id'),
44386
+ policyName: str$1('Situation policy name'),
44387
+ noiseFlag: bool$1('Marked as noise'),
44388
+ stable: bool$1('Stable'),
44389
+ closed: bool$1('Closed'),
44390
+ clusterPrevName: str$1('The name before a rename'),
44391
+ stableTime: str$1('When it became stable'),
44392
+ endTime: str$1('When it closed (epoch ms, as a string)'),
44393
+ });
44394
+ const SituationExplainNameSchema = v4.z.looseObject({
44395
+ strategy: str$1('How the name was formed'),
44396
+ currentName: str$1('The current name'),
44397
+ pattern: str$1('The naming pattern'),
44398
+ representativeAlarmId: str$1('The alarm the name was taken from'),
44399
+ renamed: bool$1('Whether it was renamed since it opened'),
44400
+ previousName: str$1('The name before the rename'),
44401
+ plainDescription: str$1('Why it has this name, in words'),
44402
+ });
44403
+ const SituationExplainCreationSchema = v4.z.looseObject({
44404
+ policyId: str$1('Policy that opened it'),
44405
+ policyName: str$1('Policy that opened it'),
44406
+ clusteringType: str$1('Situation type'),
44407
+ triggeredAt: str$1('When it opened'),
44408
+ seedAlarmId: str$1('The alarm that opened it'),
44409
+ seedAlarmSummary: str$1('That alarm’s message'),
44410
+ seedAlarmSource: str$1('That alarm’s source'),
44411
+ carryOverMinutes: num('Carry-over window, minutes'),
44412
+ groupingCriteriaApplied: strs('Grouping criteria the policy applied'),
44413
+ filterCriteriaApplied: strs('Filter criteria the policy applied'),
44414
+ plainDescription: str$1('Why it opened, in words'),
44415
+ });
44416
+ const SituationExplainMembershipSchema = v4.z.looseObject({
44417
+ totalAlarms: num('Alarms in it'),
44418
+ subClustersCount: num('Sub-clusters'),
44419
+ distinctHostsCount: num('Distinct hosts'),
44420
+ hosts: strs('Hosts'),
44421
+ impactedServices: strs('Impacted services'),
44422
+ subClusters: v4.z
44423
+ .array(v4.z.looseObject({
44424
+ message: str$1('Sub-cluster message'),
44425
+ severity: str$1('Severity'),
44426
+ alarmCount: num('Alarms'),
44427
+ rootCause: bool$1('Marked root cause'),
44428
+ rcaScore: num('Root-cause score'),
44429
+ }))
44430
+ .optional()
44431
+ .describe('Sub-clusters (alarms grouped by message)'),
44432
+ matchCriteria: strs('What its alarms have in common'),
44433
+ correlationRationale: str$1('Why these alarms belong together, in words'),
44434
+ });
44435
+ const SituationExplainAlarmSchema = v4.z.looseObject({
44436
+ alarmId: str$1('Alarm id'),
44437
+ message: str$1('Message'),
44438
+ severity: str$1('Severity'),
44439
+ status: str$1('Status'),
44440
+ host: str$1('Host'),
44441
+ metric: str$1('Metric'),
44442
+ metricValue: str$1('Metric value'),
44443
+ threshold: str$1('Threshold'),
44444
+ product: str$1('Product'),
44445
+ startTime: str$1('Start'),
44446
+ timestamp: str$1('Last change'),
44447
+ });
44448
+ const SituationExplainBreakdownSchema = v4.z.looseObject({
44449
+ totalAlarms: num('Alarms ever in it'),
44450
+ currentMembers: num('Alarms in it now'),
44451
+ activeAlarms: num('Active alarms'),
44452
+ clearedAlarms: num('Cleared alarms'),
44453
+ disassociatedAlarms: num('Alarms that left it'),
44454
+ aggregated: bool$1('Whether alarms are aggregated'),
44455
+ bySeverity: counts('Alarms per severity'),
44456
+ byStatus: counts('Alarms per status'),
44457
+ byHost: counts('Alarms per host'),
44458
+ byProduct: counts('Alarms per product'),
44459
+ byMessage: counts('Alarms per message'),
44460
+ alarms: v4.z.array(SituationExplainAlarmSchema).optional().describe('Its alarms'),
44461
+ });
44462
+ const SituationExplainTimelineEntrySchema = v4.z.looseObject({
44463
+ timestamp: str$1('When'),
44464
+ propName: str$1('What changed (lifecycle property)'),
44465
+ oldValue: v4.z.unknown().optional(),
44466
+ newValue: v4.z.unknown().optional(),
44467
+ updatedBy: str$1('Who changed it'),
44468
+ userType: str$1('User or system'),
44469
+ lifeEvent: bool$1('A lifecycle milestone'),
44470
+ what: str$1('What happened, in words'),
44471
+ why: str$1('Why, in words'),
44472
+ trigger: v4.z.looseObject({ evidenceType: str$1('Evidence type'), actor: str$1('Actor') }).optional(),
44473
+ });
44474
+ const SituationExplainStabilizationSchema = v4.z.looseObject({
44475
+ reasonCode: str$1('Why it is (not yet) stable'),
44476
+ confidence: str$1('Confidence of the projection'),
44477
+ stableWindowMinutes: num('Stable window, minutes'),
44478
+ toleranceMinutes: num('Tolerance, minutes'),
44479
+ policyWindows: v4.z
44480
+ .looseObject({
44481
+ stableWindow: num('Stable window'),
44482
+ extensionWindow: num('Extension window'),
44483
+ maxStableWindow: num('Maximum stable window'),
44484
+ autoExtendEnabled: bool$1('Auto-extend on'),
44485
+ mode: str$1('Mode'),
44486
+ source: str$1('Where the windows come from'),
44487
+ policyLastUpdated: str$1('Policy last updated'),
44488
+ })
44489
+ .optional()
44490
+ .describe('The policy’s stabilisation windows'),
44491
+ expectedWindowMinutes: v4.z.looseObject({ earliest: num('Earliest'), latest: num('Latest') }).optional(),
44492
+ projection: v4.z
44493
+ .looseObject({
44494
+ currentAgeMinutes: num('Age now, minutes'),
44495
+ earliestStableAt: str$1('Earliest time it can become stable'),
44496
+ latestStableAt: str$1('Latest time'),
44497
+ plainDescription: str$1('The projection, in words'),
44498
+ })
44499
+ .optional(),
44500
+ evidence: strs('Evidence'),
44501
+ plainDescription: str$1('Stabilisation, in words'),
44502
+ forceStable: bool$1('Forced stable'),
44503
+ stable: bool$1('Stable'),
44504
+ stableTime: str$1('When it became stable'),
44505
+ ageAtStabilizationMinutes: num('Age when it became stable, minutes'),
44506
+ arithmeticProof: str$1('The window arithmetic behind the stable time, in words'),
44507
+ });
44508
+ const SituationExplainClosureSchema = v4.z.looseObject({
44509
+ closureType: str$1('How it closed or will close'),
44510
+ reasonCode: str$1('Why it is (not) closed'),
44511
+ confidence: str$1('Confidence'),
44512
+ openAlarmsRemaining: num('Open alarms left'),
44513
+ plainDescription: str$1('Closure, in words'),
44514
+ closed: bool$1('Closed'),
44515
+ forceClosed: bool$1('Force-closed'),
44516
+ closedAt: str$1('When it closed'),
44517
+ closureProcess: str$1('The process that closed it, e.g. StableClusterClosureJob'),
44518
+ closedBy: str$1('Who closed it'),
44519
+ daysSinceLastUpdateAtClosure: num('Days since its last update when it closed'),
44520
+ evidence: strs('Evidence'),
44521
+ });
44522
+ const SituationExplainNarrationSchema = v4.z.looseObject({
44523
+ headline: str$1('One-line summary'),
44524
+ currentState: str$1('Where it stands now'),
44525
+ story: strs('The story so far, as sentences'),
44526
+ storyItems: v4.z
44527
+ .array(v4.z.looseObject({
44528
+ at: str$1('When'),
44529
+ what: str$1('What happened'),
44530
+ why: str$1('Why'),
44531
+ trigger: v4.z.looseObject({ type: str$1('Trigger type'), actor: str$1('Actor'), evidence: strs('Evidence') }).optional(),
44532
+ }))
44533
+ .optional()
44534
+ .describe('The story as events'),
44535
+ insights: strs('Observations'),
44536
+ whatNext: str$1('What to expect or do next'),
44537
+ });
44538
+ const SituationExplanationSchema = v4.z.looseObject({
44539
+ clusterId: str$1('Situation id'),
44540
+ tenantId: str$1('Tenant'),
44541
+ generatedAt: str$1('When the explanation was generated'),
44542
+ identity: SituationExplainIdentitySchema.optional(),
44543
+ nameFormation: SituationExplainNameSchema.optional(),
44544
+ creationReason: SituationExplainCreationSchema.optional(),
44545
+ membershipExplanation: SituationExplainMembershipSchema.optional(),
44546
+ alarmBreakdown: SituationExplainBreakdownSchema.optional(),
44547
+ lifecycleTimeline: v4.z.array(SituationExplainTimelineEntrySchema).optional(),
44548
+ stabilizationExplanation: SituationExplainStabilizationSchema.optional(),
44549
+ closureExplanation: SituationExplainClosureSchema.optional(),
44550
+ rootCause: v4.z.looseObject({ applicable: bool$1('Root cause applies'), plainDescription: str$1('Root cause, in words') }).optional(),
44551
+ incident: v4.z.looseObject({ hasTicket: bool$1('A ticket exists'), plainDescription: str$1('Incident, in words') }).optional(),
44552
+ workNotes: v4.z.array(v4.z.unknown()).optional().describe('Work notes'),
44553
+ narration: SituationExplainNarrationSchema.optional(),
44554
+ dataQualityNotes: v4.z.array(v4.z.unknown()).optional().describe('Gaps in the data behind the explanation'),
44555
+ });
44556
+ /** The most alarms `alarmBreakdown.alarms` lists (measured: 20 of a 24-alarm situation). */
44557
+ const SITUATION_EXPLAIN_ALARM_LIST_MAX = 20;
44558
+ /** False for the server's not-found answer (a 200 with no `identity`). */
44559
+ function situationExplanationFound(explanation) {
44560
+ return explanation.identity !== undefined;
44561
+ }
44562
+
42999
44563
  /**
43000
44564
  * One row of an SLI group's match criteria. SLI groups select the metrics they
43001
44565
  * watch by a list of these filters (e.g. "Source contains bd605" AND
@@ -49378,9 +50942,11 @@ class AlarmService {
49378
50942
  * (it used to ask for 20 and stop, dropping the oldest events, "Alarm
49379
50943
  * Opened" first). `totalCount` is returned as the server reported it; if a
49380
50944
  * page comes back empty early, the result holds fewer events and a warning
49381
- * is logged.
50945
+ * is logged. With `propertySearch`, the server keeps only events whose
50946
+ * `propName` contains the text (case-insensitive) and `totalCount` counts
50947
+ * those.
49382
50948
  */
49383
- async getAlarmLifeCycle(alarmId) {
50949
+ async getAlarmLifeCycle(alarmId, options = {}) {
49384
50950
  return readLifecyclePages((pageNumber, pageSize) => this.dxSaaSService.oiPost('oi/v2/api/alarms/lifecycle/_search', {
49385
50951
  alarmId,
49386
50952
  pageSize: String(pageSize),
@@ -49389,9 +50955,11 @@ class AlarmService {
49389
50955
  excludeFields: [
49390
50956
  'isolation_view_link',
49391
50957
  'metric_view_link',
50958
+ 'metric_group_link',
49392
50959
  'alert_definition_link',
49393
50960
  'occurrence',
49394
50961
  ],
50962
+ ...(options.propertySearch ? { searchText: options.propertySearch } : {}),
49395
50963
  }), `alarm ${alarmId}`, this.simpleLog);
49396
50964
  }
49397
50965
  /**
@@ -53418,8 +54986,8 @@ class ChannelService {
53418
54986
  }
53419
54987
 
53420
54988
  var NullSimpleLog$7 = Logging.NullSimpleLog;
53421
- const BASE$1 = 'oi/v2/api/clusteralarms';
53422
- const POLICY = `${BASE$1}/clusteringpolicy`;
54989
+ const BASE$4 = 'oi/v2/api/clusteralarms';
54990
+ const POLICY = `${BASE$4}/clusteringpolicy`;
53423
54991
  /**
53424
54992
  * Custom situation policies (the product's "custom situation definitions";
53425
54993
  * the API's clustering policies). Backs the `situation *-custom-situation-policy`
@@ -53552,7 +55120,7 @@ class ClusteringPolicyService {
53552
55120
  * `[min, max]`.
53553
55121
  */
53554
55122
  async listPolicyFields() {
53555
- const raw = await this.dxSaasService.oiGet(`${BASE$1}/policyfields`);
55123
+ const raw = await this.dxSaasService.oiGet(`${BASE$4}/policyfields`);
53556
55124
  const result = PolicyFieldsResponseSchema.safeParse(raw);
53557
55125
  if (!result.success) {
53558
55126
  this.log.warn('PolicyFieldsResponse validation warning:', result.error.message);
@@ -53566,7 +55134,7 @@ class ClusteringPolicyService {
53566
55134
  * `GET oi/v2/api/clusteralarms/tenantConfigAttributes`
53567
55135
  */
53568
55136
  async getTenantConfigAttributes() {
53569
- const raw = await this.dxSaasService.oiGet(`${BASE$1}/tenantConfigAttributes`);
55137
+ const raw = await this.dxSaasService.oiGet(`${BASE$4}/tenantConfigAttributes`);
53570
55138
  const result = TenantConfigAttributesResponseSchema.safeParse(raw);
53571
55139
  if (!result.success) {
53572
55140
  this.log.warn('TenantConfigAttributesResponse validation warning:', result.error.message);
@@ -53634,7 +55202,7 @@ class ClusteringPolicyService {
53634
55202
  async setTenantConfigAttributes(tenantId, attributes) {
53635
55203
  const body = { tenantId, configAttrList: attributes };
53636
55204
  TenantConfigAttributesWriteBodySchema.parse(body);
53637
- const raw = await this.dxSaasService.oiPut(`${BASE$1}/tenantConfigAttributes`, body);
55205
+ const raw = await this.dxSaasService.oiPut(`${BASE$4}/tenantConfigAttributes`, body);
53638
55206
  const result = TenantConfigAttributesWriteResponseSchema.safeParse(raw);
53639
55207
  if (!result.success) {
53640
55208
  this.log.warn('TenantConfigAttributesWriteResponse validation warning:', result.error.message);
@@ -53643,6 +55211,95 @@ class ClusteringPolicyService {
53643
55211
  }
53644
55212
  }
53645
55213
 
55214
+ const BASE$3 = 'oi/v2/sa/customproperties';
55215
+ /**
55216
+ * Managed custom service property definitions (`oi/v2/sa/customproperties`, 2026-11).
55217
+ * Semantics measured on THE_LABORATORY (#1583) are on each method.
55218
+ */
55219
+ class CustomPropertyService {
55220
+ dxSaaSService;
55221
+ log;
55222
+ constructor(dxSaaSService, log = new Logging.NullSimpleLog()) {
55223
+ this.dxSaaSService = dxSaaSService;
55224
+ this.log = log;
55225
+ }
55226
+ /**
55227
+ * Every definition, with `usageCount` and (enum) per-value usage.
55228
+ *
55229
+ * @remarks Response-validated, not thrown.
55230
+ */
55231
+ async listDefinitions() {
55232
+ const raw = await this.dxSaaSService.oiGet(BASE$3);
55233
+ const result = CustomPropertyDefinitionListSchema.safeParse(raw);
55234
+ if (!result.success)
55235
+ this.log.warn('CustomPropertyDefinition list validation warning:', result.error.message);
55236
+ return (raw ?? []);
55237
+ }
55238
+ /** One definition by name, or undefined. */
55239
+ async findDefinition(name) {
55240
+ return (await this.listDefinitions()).find((d) => d.name === name);
55241
+ }
55242
+ /**
55243
+ * Which services hold the key, and their values. An unknown name answers `count: 0`, not 404.
55244
+ *
55245
+ * @remarks Response-validated, not thrown.
55246
+ */
55247
+ async getUsage(name) {
55248
+ const raw = await this.dxSaaSService.oiGet(`${BASE$3}/${encodeURIComponent(name)}/usage`);
55249
+ const result = CustomPropertyUsageSchema.safeParse(raw);
55250
+ if (!result.success)
55251
+ this.log.warn('CustomPropertyUsage validation warning:', result.error.message);
55252
+ return raw;
55253
+ }
55254
+ /**
55255
+ * Creates a definition. The server answers 409 for an existing name and 400 for an invalid
55256
+ * name, empty enum options, or a default the type does not allow.
55257
+ *
55258
+ * @throws ZodError when `body` breaks the same rules (checked before sending).
55259
+ */
55260
+ async createDefinition(body) {
55261
+ CustomPropertyWriteSchema.parse(body);
55262
+ const raw = await this.dxSaaSService.oiPost(BASE$3, body);
55263
+ const result = CustomPropertyWriteResponseSchema.safeParse(raw);
55264
+ if (!result.success)
55265
+ this.log.warn('CustomPropertyWriteResponse validation warning:', result.error.message);
55266
+ return raw;
55267
+ }
55268
+ /**
55269
+ * Replaces a definition (full body). The name cannot change (400). The value type and enum
55270
+ * options CAN change while services hold values; the server leaves those values as they are,
55271
+ * so check usage first. 404 when the definition does not exist.
55272
+ *
55273
+ * @throws ZodError when `body` is invalid, or Error when `body.name` differs from `name`.
55274
+ */
55275
+ async updateDefinition(name, body) {
55276
+ CustomPropertyWriteSchema.parse(body);
55277
+ if (body.name !== name) {
55278
+ throw new Error(`a custom property definition cannot be renamed ('${name}' → '${body.name}'); delete and recreate it`);
55279
+ }
55280
+ const raw = await this.dxSaaSService.oiPut(`${BASE$3}/${encodeURIComponent(name)}`, body);
55281
+ const result = CustomPropertyWriteResponseSchema.safeParse(raw);
55282
+ if (!result.success)
55283
+ this.log.warn('CustomPropertyWriteResponse validation warning:', result.error.message);
55284
+ return raw;
55285
+ }
55286
+ /**
55287
+ * Coverage of the managed properties over `services` (pass `ServiceService.getAllServices()`,
55288
+ * or a scoped subset of it; the ungrouped list carries `customProperties` on every service).
55289
+ * Reads the definitions; everything else is the pure `propertyCoverage`.
55290
+ */
55291
+ async coverage(services) {
55292
+ return propertyCoverage(await this.listDefinitions(), services);
55293
+ }
55294
+ /**
55295
+ * Deletes a definition (204). The server deletes it even while services hold the key; those
55296
+ * values stay on the services as unmanaged keys. 404 when it does not exist.
55297
+ */
55298
+ async deleteDefinition(name) {
55299
+ await this.dxSaaSService.oiDelete(`${BASE$3}/${encodeURIComponent(name)}`);
55300
+ }
55301
+ }
55302
+
53646
55303
  var PermissionType = exports.DashboardPermissionsUpdateRequest.PermissionType;
53647
55304
  /**
53648
55305
  * Service for Grafana-style dashboard API: themes, API keys, dashboards,
@@ -53719,6 +55376,18 @@ class DashboardService {
53719
55376
  getDashboard(uid) {
53720
55377
  return this.dxSaaSService.dashboardGet(`api/dashboards/uid/${uid}`);
53721
55378
  }
55379
+ /** Deletes a dashboard by UID. */
55380
+ deleteDashboard(uid) {
55381
+ return this.dxSaaSService.dashboardDelete(`api/dashboards/uid/${uid}`);
55382
+ }
55383
+ /** Deletes a folder by UID, with every dashboard in it. */
55384
+ deleteFolder(folderUid) {
55385
+ return this.dxSaaSService.dashboardDelete(`api/folders/${folderUid}`);
55386
+ }
55387
+ /** Returns the org's datasources (name, uid, plugin type) — what a panel's `{ type, uid }` datasource points at. */
55388
+ getDatasources() {
55389
+ return this.dxSaaSService.dashboardGet('api/datasources');
55390
+ }
53722
55391
  /** Returns all dashboards within a specific folder. */
53723
55392
  getDashboardsInFolder(folderId) {
53724
55393
  return this.dxSaaSService.dashboardGet('api/search', {
@@ -87810,7 +89479,7 @@ async function sendWithRetry(post, batches, options = {}) {
87810
89479
  return result;
87811
89480
  }
87812
89481
 
87813
- const BASE = exports.LogMetric.BASE_PATH;
89482
+ const BASE$2 = exports.LogMetric.BASE_PATH;
87814
89483
  /**
87815
89484
  * Log-based metric definitions (Log Analytics "define metrics from logs"). Callers pass and
87816
89485
  * receive plain Lucene; the service escapes it for the wire and unescapes what it reads. It
@@ -87836,7 +89505,7 @@ class LogMetricService {
87836
89505
  * @throws LogMetricError when the body code is not 200
87837
89506
  */
87838
89507
  async list() {
87839
- const response = await this.call(this.dxSaasService.oiGet(BASE), 'list log metric definitions');
89508
+ const response = await this.call(this.dxSaasService.oiGet(BASE$2), 'list log metric definitions');
87840
89509
  return (Array.isArray(response) ? response : []).map((raw) => exports.LogMetric.fromWire(this.checked(raw)));
87841
89510
  }
87842
89511
  /**
@@ -87845,7 +89514,7 @@ class LogMetricService {
87845
89514
  * @throws LogMetricError when the body code is not 200
87846
89515
  */
87847
89516
  async count() {
87848
- const response = await this.call(this.dxSaasService.oiGet(`${BASE}/count`), 'count log metric definitions');
89517
+ const response = await this.call(this.dxSaasService.oiGet(`${BASE$2}/count`), 'count log metric definitions');
87849
89518
  const result = exports.LogMetric.CountSchema.safeParse(response);
87850
89519
  if (!result.success)
87851
89520
  this.log.warn('LogMetric count validation warning:', result.error.message);
@@ -87858,7 +89527,7 @@ class LogMetricService {
87858
89527
  */
87859
89528
  async get(name) {
87860
89529
  try {
87861
- const response = await this.call(this.dxSaasService.oiGet(`${BASE}/${this.pathName(name)}`, { mode: 'edit' }), `get log metric '${name}'`);
89530
+ const response = await this.call(this.dxSaasService.oiGet(`${BASE$2}/${this.pathName(name)}`, { mode: 'edit' }), `get log metric '${name}'`);
87862
89531
  return exports.LogMetric.fromWire(this.checked(response));
87863
89532
  }
87864
89533
  catch (e) {
@@ -87875,7 +89544,7 @@ class LogMetricService {
87875
89544
  */
87876
89545
  async validateName(name) {
87877
89546
  try {
87878
- await this.call(this.dxSaasService.oiPost(`${BASE}/${this.pathName(name)}/_validate`), `validate name '${name}'`);
89547
+ await this.call(this.dxSaasService.oiPost(`${BASE$2}/${this.pathName(name)}/_validate`), `validate name '${name}'`);
87879
89548
  return 'free';
87880
89549
  }
87881
89550
  catch (e) {
@@ -87889,7 +89558,7 @@ class LogMetricService {
87889
89558
  * accepted on save; the list is reported verbatim.
87890
89559
  */
87891
89560
  async functions() {
87892
- const raw = await this.dxSaasService.oiGet(`${BASE}/functions`);
89561
+ const raw = await this.dxSaasService.oiGet(`${BASE$2}/functions`);
87893
89562
  if (!Array.isArray(raw)) {
87894
89563
  this.log.warn('LogMetric functions validation warning: expected an array');
87895
89564
  return [];
@@ -87911,7 +89580,7 @@ class LogMetricService {
87911
89580
  throw new exports.LogMetric.LogMetricError('invalid', `range must be a whole number of minutes from 1 to ${exports.LogMetric.PREVIEW_MAX_MINUTES}, got ${rangeMinutes}`);
87912
89581
  }
87913
89582
  await this.refuseSilentInputs(parsed);
87914
- const response = await this.call(this.dxSaasService.oiPost(`${BASE}/${this.pathName(parsed.name)}/execute`, exports.LogMetric.toWireBody(parsed, 1), { range: rangeMinutes }), `preview '${parsed.name}'`);
89583
+ const response = await this.call(this.dxSaasService.oiPost(`${BASE$2}/${this.pathName(parsed.name)}/execute`, exports.LogMetric.toWireBody(parsed, 1), { range: rangeMinutes }), `preview '${parsed.name}'`);
87915
89584
  const result = exports.LogMetric.PreviewResponseSchema.safeParse(response);
87916
89585
  if (!result.success)
87917
89586
  this.log.warn('LogMetric preview validation warning:', result.error.message);
@@ -87933,7 +89602,7 @@ class LogMetricService {
87933
89602
  if ((await this.validateName(parsed.name)) === 'taken') {
87934
89603
  throw new exports.LogMetric.LogMetricError('name-taken', `a log metric named '${parsed.name}' already exists`);
87935
89604
  }
87936
- await this.call(this.dxSaasService.oiPost(`${BASE}/${this.pathName(parsed.name)}`, exports.LogMetric.toWireBody(parsed, 1)), `create '${parsed.name}'`);
89605
+ await this.call(this.dxSaasService.oiPost(`${BASE$2}/${this.pathName(parsed.name)}`, exports.LogMetric.toWireBody(parsed, 1)), `create '${parsed.name}'`);
87937
89606
  return this.readBack(parsed.name);
87938
89607
  }
87939
89608
  /**
@@ -87954,7 +89623,7 @@ class LogMetricService {
87954
89623
  }
87955
89624
  const merged = exports.LogMetric.DefinitionInputSchema.parse({ ...exports.LogMetric.toInput(current), ...patch, name });
87956
89625
  await this.refuseSilentInputs(merged);
87957
- await this.call(this.dxSaasService.oiPut(`${BASE}/${this.pathName(name)}`, exports.LogMetric.toWireBody(merged, current.version)), `update '${name}'`);
89626
+ await this.call(this.dxSaasService.oiPut(`${BASE$2}/${this.pathName(name)}`, exports.LogMetric.toWireBody(merged, current.version)), `update '${name}'`);
87958
89627
  return this.readBack(name);
87959
89628
  }
87960
89629
  /**
@@ -87963,7 +89632,7 @@ class LogMetricService {
87963
89632
  * @throws LogMetricError `not-found` when there is no such definition
87964
89633
  */
87965
89634
  async setEnabled(name, enabled) {
87966
- await this.call(this.dxSaasService.oiPut(`${BASE}/${this.pathName(name)}/setProperty`, undefined, { enable: enabled }), `${enabled ? 'enable' : 'disable'} '${name}'`);
89635
+ await this.call(this.dxSaasService.oiPut(`${BASE$2}/${this.pathName(name)}/setProperty`, undefined, { enable: enabled }), `${enabled ? 'enable' : 'disable'} '${name}'`);
87967
89636
  }
87968
89637
  /**
87969
89638
  * Deletes a definition. Series already written stay in the metric store.
@@ -87971,7 +89640,7 @@ class LogMetricService {
87971
89640
  * @throws LogMetricError `not-found` when there is no such definition
87972
89641
  */
87973
89642
  async delete(name) {
87974
- await this.call(this.dxSaasService.oiDelete(`${BASE}/${this.pathName(name)}`), `delete '${name}'`);
89643
+ await this.call(this.dxSaasService.oiDelete(`${BASE$2}/${this.pathName(name)}`), `delete '${name}'`);
87975
89644
  }
87976
89645
  /**
87977
89646
  * The per-minute counts a definition wrote, one entry per series (Total Count and one per
@@ -89723,6 +91392,249 @@ class PlatformManagementModuleService {
89723
91392
  }
89724
91393
  }
89725
91394
 
91395
+ /** A role write refused because the role changed since it was read (HTTP 409). Nothing was saved. */
91396
+ class RoleChangedError extends Error {
91397
+ roleId;
91398
+ constructor(roleId) {
91399
+ super(`Role ${roleId} was changed by someone else since it was read; nothing was saved. Re-run to read it again.`);
91400
+ this.roleId = roleId;
91401
+ }
91402
+ }
91403
+ /**
91404
+ * Roles (2026-11): the catalog (`ess/roles/v1`) and who holds each role (`views/view/{id}`, the
91405
+ * role's DataStore view). Semantics measured on THE_LABORATORY are on the model
91406
+ * (`model/security/roles.ts`).
91407
+ */
91408
+ class RoleService {
91409
+ dxSaaSService;
91410
+ log;
91411
+ constructor(dxSaaSService, log = new Logging.NullSimpleLog()) {
91412
+ this.dxSaaSService = dxSaaSService;
91413
+ this.log = log;
91414
+ }
91415
+ /**
91416
+ * The role catalog: built-in and custom roles with level, description and permission tree.
91417
+ *
91418
+ * @remarks Response-validated, not thrown.
91419
+ */
91420
+ async listRoles() {
91421
+ const raw = await this.dxSaaSService.oiGet('ess/roles/v1', { cohort: cohortGuid(this.dxSaaSService.getCohortIDForURL()) });
91422
+ const result = RoleCatalogSchema.safeParse(raw);
91423
+ if (!result.success)
91424
+ this.log.warn('Role catalog validation warning:', result.error.message);
91425
+ return (raw ?? []);
91426
+ }
91427
+ /**
91428
+ * Every role's view (`attributes.owner: 'DP'`), with its holders.
91429
+ *
91430
+ * @remarks Response-validated, not thrown.
91431
+ */
91432
+ async listRoleViews() {
91433
+ const raw = await this.dxSaaSService.tenantGet('views/view');
91434
+ const views = (raw?.items ?? []).filter((v) => v.attributes?.owner === 'DP');
91435
+ for (const v of views) {
91436
+ const result = RoleViewSchema.safeParse(v);
91437
+ if (!result.success)
91438
+ this.log.warn('RoleView validation warning:', result.error.message);
91439
+ }
91440
+ return views;
91441
+ }
91442
+ /**
91443
+ * One role's view, with its holders and its concurrency token.
91444
+ *
91445
+ * @remarks Response-validated, not thrown.
91446
+ */
91447
+ async getRoleView(roleId) {
91448
+ const raw = await this.dxSaaSService.tenantGet(`views/view/${encodeURIComponent(roleId)}`);
91449
+ const result = RoleViewSchema.safeParse(raw);
91450
+ if (!result.success)
91451
+ this.log.warn('RoleView validation warning:', result.error.message);
91452
+ return raw;
91453
+ }
91454
+ /**
91455
+ * Saves a role's view — in practice its holders (`access`). `view` must carry the
91456
+ * `lastModificationTimestamp` it was read with: a role changed since is refused by the server.
91457
+ *
91458
+ * @throws ZodError for a malformed view; RoleChangedError when the role changed since it was read.
91459
+ */
91460
+ async saveRoleView(view) {
91461
+ RoleViewSchema.parse(view);
91462
+ try {
91463
+ const raw = await this.dxSaaSService.tenantPut(`views/view/${encodeURIComponent(view.viewId)}`, view);
91464
+ const result = RoleViewSchema.safeParse(raw);
91465
+ if (!result.success)
91466
+ this.log.warn('RoleView save validation warning:', result.error.message);
91467
+ return raw;
91468
+ }
91469
+ catch (e) {
91470
+ if (e.httpCode === 409)
91471
+ throw new RoleChangedError(view.viewId);
91472
+ throw e;
91473
+ }
91474
+ }
91475
+ }
91476
+ /** The cohort id in upper-cased, dashed GUID form (`8-4-4-4-12`) the ess endpoints take. */
91477
+ function cohortGuid(cohortId) {
91478
+ const hex = cohortId.replace(/-/g, '').toUpperCase();
91479
+ return [hex.slice(0, 8), hex.slice(8, 12), hex.slice(12, 16), hex.slice(16, 20), hex.slice(20, 32)].join('-');
91480
+ }
91481
+
91482
+ const BASE$1 = 'synthetics/permission-service/api/v1/policies';
91483
+ /**
91484
+ * Synthetics access policies (2026-11): who may READ or WRITE the monitors of a monitor group.
91485
+ * Semantics measured on THE_LABORATORY are on the model (`model/synthetics/access-policy.ts`);
91486
+ * plan a grant or revoke with `planAccessChange` and apply it with one of these calls.
91487
+ */
91488
+ class SyntheticAccessService {
91489
+ dxSaaSService;
91490
+ log;
91491
+ constructor(dxSaaSService, log = new Logging.NullSimpleLog()) {
91492
+ this.dxSaaSService = dxSaaSService;
91493
+ this.log = log;
91494
+ }
91495
+ /**
91496
+ * Every access policy.
91497
+ *
91498
+ * @remarks Response-validated, not thrown.
91499
+ */
91500
+ async listPolicies() {
91501
+ const raw = await this.dxSaaSService.tenantGet(BASE$1);
91502
+ const result = SyntheticAccessPolicyListSchema.safeParse(raw);
91503
+ if (!result.success)
91504
+ this.log.warn('SyntheticAccessPolicy list validation warning:', result.error.message);
91505
+ return (raw ?? []);
91506
+ }
91507
+ /**
91508
+ * Creates a policy. The server answers 400 when the name is taken; it does not check that the
91509
+ * named groups or users exist.
91510
+ *
91511
+ * @throws ZodError for a malformed body.
91512
+ */
91513
+ async createPolicy(body) {
91514
+ SyntheticAccessPolicyWriteSchema.parse(body);
91515
+ const raw = await this.dxSaaSService.tenantPost(BASE$1, body);
91516
+ const result = SyntheticAccessPolicySchema.safeParse(raw);
91517
+ if (!result.success)
91518
+ this.log.warn('SyntheticAccessPolicy create validation warning:', result.error.message);
91519
+ return raw;
91520
+ }
91521
+ /**
91522
+ * Replaces a policy in place (same id) — atomic, unlike the UI's delete-and-recreate.
91523
+ *
91524
+ * @throws ZodError for a malformed body.
91525
+ */
91526
+ async updatePolicy(id, body) {
91527
+ SyntheticAccessPolicyWriteSchema.parse(body);
91528
+ const raw = await this.dxSaaSService.tenantPut(`${BASE$1}/${id}`, { ...body, id });
91529
+ const result = SyntheticAccessPolicySchema.safeParse(raw);
91530
+ if (!result.success)
91531
+ this.log.warn('SyntheticAccessPolicy update validation warning:', result.error.message);
91532
+ return raw;
91533
+ }
91534
+ /** Deletes a policy (204). */
91535
+ async deletePolicy(id) {
91536
+ await this.dxSaaSService.tenantDelete(`${BASE$1}/${id}`);
91537
+ }
91538
+ }
91539
+
91540
+ const BASE = 'ess/usergroups/v1';
91541
+ /**
91542
+ * User groups (`ess/usergroups/v1`, 2026-11). Semantics measured on THE_LABORATORY are on the model
91543
+ * (`model/security/user-groups.ts`); the one to remember: roles and synthetics access name a group
91544
+ * by its name, and nothing follows a rename or a delete.
91545
+ */
91546
+ class UserGroupService {
91547
+ dxSaaSService;
91548
+ log;
91549
+ constructor(dxSaaSService, log = new Logging.NullSimpleLog()) {
91550
+ this.dxSaaSService = dxSaaSService;
91551
+ this.log = log;
91552
+ }
91553
+ /**
91554
+ * Every group, without members.
91555
+ *
91556
+ * @remarks Response-validated, not thrown.
91557
+ */
91558
+ async listGroups() {
91559
+ const raw = await this.dxSaaSService.oiGet(`${BASE}/list`);
91560
+ const result = UserGroupListSchema.safeParse(raw);
91561
+ if (!result.success)
91562
+ this.log.warn('UserGroup list validation warning:', result.error.message);
91563
+ return (raw ?? []);
91564
+ }
91565
+ /**
91566
+ * One group with its member ids and member details.
91567
+ *
91568
+ * @remarks Response-validated, not thrown.
91569
+ */
91570
+ async getGroup(groupId) {
91571
+ const raw = await this.dxSaaSService.oiGet(`${BASE}/${groupId}`, {
91572
+ include_userids: true,
91573
+ include_userinfos: true,
91574
+ });
91575
+ const result = UserGroupSchema.safeParse(raw);
91576
+ if (!result.success)
91577
+ this.log.warn('UserGroup validation warning:', result.error.message);
91578
+ return raw;
91579
+ }
91580
+ /**
91581
+ * Every group name a role or an access policy can legitimately reference: the user groups plus
91582
+ * the legacy APM/ACA groups (`/apm/atc/api/private/aca/group`, whose ids are their names; built-in
91583
+ * roles still list some of them). A reference to a name in neither grants nobody.
91584
+ */
91585
+ async knownGroupNames() {
91586
+ const [groups, legacy] = await Promise.all([
91587
+ this.listGroups(),
91588
+ this.dxSaaSService
91589
+ .tenantGet('/apm/atc/api/private/aca/group', { size: 999, groupId: '*' })
91590
+ .catch((e) => {
91591
+ this.log.warn('Legacy group list unavailable:', String(e));
91592
+ return {};
91593
+ }),
91594
+ ]);
91595
+ return {
91596
+ userGroups: groups.map((g) => g.groupName),
91597
+ legacyGroups: (legacy._embedded?.group ?? []).map((g) => g.id ?? '').filter((id) => id !== ''),
91598
+ };
91599
+ }
91600
+ /** A group by exact name, with members; undefined when there is none. */
91601
+ async findGroup(groupName) {
91602
+ const listed = (await this.listGroups()).find((g) => g.groupName === groupName);
91603
+ return listed ? this.getGroup(listed.groupId) : undefined;
91604
+ }
91605
+ /**
91606
+ * Creates a group. The server answers 400 when the name is taken.
91607
+ *
91608
+ * @throws ZodError for an empty name or member id.
91609
+ */
91610
+ async createGroup(body) {
91611
+ UserGroupWriteSchema.parse(body);
91612
+ const raw = await this.dxSaaSService.oiPost(BASE, body);
91613
+ const result = UserGroupSchema.safeParse(raw);
91614
+ if (!result.success)
91615
+ this.log.warn('UserGroup create validation warning:', result.error.message);
91616
+ return raw;
91617
+ }
91618
+ /**
91619
+ * Replaces a group's name, description and COMPLETE member list (a member left out is removed).
91620
+ * A rename does not update the roles or access policies that name the group.
91621
+ *
91622
+ * @throws ZodError for an empty name or member id.
91623
+ */
91624
+ async updateGroup(groupId, body) {
91625
+ UserGroupWriteSchema.parse(body);
91626
+ const raw = await this.dxSaaSService.oiPut(`${BASE}/${groupId}`, { ...body, groupId });
91627
+ const result = UserGroupSchema.safeParse(raw);
91628
+ if (!result.success)
91629
+ this.log.warn('UserGroup update validation warning:', result.error.message);
91630
+ return raw;
91631
+ }
91632
+ /** Deletes a group (204). Roles and access policies that name it keep the name. */
91633
+ async deleteGroup(groupId) {
91634
+ await this.dxSaaSService.oiDelete(`${BASE}/${groupId}`);
91635
+ }
91636
+ }
91637
+
89726
91638
  exports.FilterOperation = void 0;
89727
91639
  (function (FilterOperation) {
89728
91640
  FilterOperation["EQUALS"] = "eq";
@@ -91045,6 +92957,144 @@ class TASService {
91045
92957
  }
91046
92958
  }
91047
92959
 
92960
+ /**
92961
+ * A metric registered with `attributes["@tags"]` must carry the TYPE_TAGS
92962
+ * flag — without it the server treats "@tags" as an ordinary attribute and
92963
+ * registers a metric with the wrong identity. Added here (not in the caller)
92964
+ * so every registration path gets it; idempotent when the flag is already set.
92965
+ * When the metric has no type at all the flag is not invented — schema
92966
+ * validation rejects that case with an explicit message.
92967
+ */
92968
+ function ensureTypeTagsFlag(metric) {
92969
+ if (metric.attributes?.[TAGS_ATTRIBUTE_KEY] === undefined) {
92970
+ return metric;
92971
+ }
92972
+ const normalized = { ...metric };
92973
+ if (normalized.typeEnum !== undefined &&
92974
+ !normalized.typeEnum.includes('TYPE_TAGS')) {
92975
+ normalized.typeEnum = [...normalized.typeEnum, 'TYPE_TAGS'];
92976
+ }
92977
+ if (normalized.type !== undefined &&
92978
+ (normalized.type & METRIC_TYPE_ENUM.TYPE_TAGS) === 0) {
92979
+ normalized.type = normalized.type | METRIC_TYPE_ENUM.TYPE_TAGS;
92980
+ }
92981
+ return normalized;
92982
+ }
92983
+ /**
92984
+ * The server rejects some real typeEnum names (MONITOR_DOUBLE_DURATION,
92985
+ * MONITOR_DOUBLE_PERCENTAGE) but accepts their numeric `type`. A typeEnum
92986
+ * naming one is sent as the composed `type`, ORed into any `type` given.
92987
+ */
92988
+ function typeEnumToNumericWhereNeeded(metric) {
92989
+ const names = metric.typeEnum;
92990
+ if (!names?.some((n) => NUMERIC_ONLY_TYPE_ENUM_NAMES.includes(n))) {
92991
+ return metric;
92992
+ }
92993
+ const known = names.filter((n) => METRIC_TYPE_ENUM_NAMES.includes(n));
92994
+ if (known.length !== names.length) {
92995
+ return metric;
92996
+ }
92997
+ const normalized = {
92998
+ ...metric,
92999
+ type: (metric.type ?? 0) | composeMetricTypeBits(known),
93000
+ };
93001
+ delete normalized.typeEnum;
93002
+ return normalized;
93003
+ }
93004
+ /**
93005
+ * Service for issuing metric metadata queries against the DX SaaS DataStore
93006
+ * API (`/metadata/queryMetric`).
93007
+ *
93008
+ * Requests are validated against {@link MetadataMetricQuerySchema}; responses
93009
+ * are validated against {@link MetadataMetricQueryResponseV2Schema}.
93010
+ * Validation failures on the response side are logged as warnings, not thrown.
93011
+ *
93012
+ * @example
93013
+ * ```ts
93014
+ * const service = new DataStoreMetricsMetadataService(dxSaasService, log);
93015
+ * const response = await service.queryMetric({
93016
+ * specifier: { op: 'ALL' },
93017
+ * clamp: 500,
93018
+ * time: Date.now(),
93019
+ * range: 480000,
93020
+ * includeLive: true,
93021
+ * includeProfile: false,
93022
+ * });
93023
+ * // response.metrics — matching metric descriptors
93024
+ * // response.folders — matching folder descriptors
93025
+ * ```
93026
+ */
93027
+ class DataStoreMetricsMetadataService {
93028
+ dxSaasService;
93029
+ log;
93030
+ /**
93031
+ * @param dxSaasService - An authenticated {@link DxSaasService} instance
93032
+ * configured for the target tenant (provides gateway host and credentials).
93033
+ * @param log - Logger conforming to {@link SimpleLog} from `@dx-do/util`.
93034
+ * Must implement `info`, `warn`, `error`, and `debug` methods.
93035
+ */
93036
+ constructor(dxSaasService, log) {
93037
+ this.dxSaasService = dxSaasService;
93038
+ this.log = log;
93039
+ }
93040
+ /**
93041
+ * Registers one or more metrics via `POST /metadata/registerMetric`.
93042
+ *
93043
+ * @remarks The request is validated against {@link MetricRegisterRequestSchema}.
93044
+ * Metrics carrying an `attributes["@tags"]` array get the TYPE_TAGS flag
93045
+ * added to their type automatically (idempotent). A `typeEnum` naming
93046
+ * MONITOR_DOUBLE_DURATION or MONITOR_DOUBLE_PERCENTAGE, which the server
93047
+ * rejects by name, is sent as the numeric `type`. If the response fails
93048
+ * schema validation, a warning is logged but the raw API response is
93049
+ * still returned.
93050
+ *
93051
+ * @param requestOverrides - Per-call `timeout` / `signal`; registration is
93052
+ * an idempotent upsert, so a caller may safely retry after a timeout.
93053
+ *
93054
+ * @throws ZodError if the request fails schema validation — including the
93055
+ * tag-registration restrictions ("@tags" non-empty, every listed tag
93056
+ * present with a non-empty string value, TYPE_TAGS never set without tags).
93057
+ */
93058
+ async registerMetrics(metrics, sync, requestOverrides = {}) {
93059
+ const body = {
93060
+ metrics: metrics.map((m) => ensureTypeTagsFlag(typeEnumToNumericWhereNeeded(m))),
93061
+ ...(sync !== undefined ? { sync } : {}),
93062
+ };
93063
+ MetricRegisterRequestSchema.parse(body);
93064
+ const raw = await this.dxSaasService.tenantPost('metadata/registerMetric', body, undefined, {}, requestOverrides);
93065
+ const result = MetricRegisterResponseSchema.safeParse(raw);
93066
+ if (!result.success) {
93067
+ this.log.warn('MetricRegisterResponse validation warning:', result.error.message);
93068
+ }
93069
+ return raw;
93070
+ }
93071
+ /** Registers a single metric. Convenience wrapper around {@link registerMetrics}. */
93072
+ async registerMetric(metric, sync, requestOverrides = {}) {
93073
+ return this.registerMetrics([metric], sync, requestOverrides);
93074
+ }
93075
+ /**
93076
+ * POSTs a metadata query to `/metadata/queryMetric` and returns the matching
93077
+ * metric / folder records.
93078
+ *
93079
+ * @remarks The response is **not** guaranteed to match the schema exactly.
93080
+ * If response validation fails, a warning is logged but the raw API
93081
+ * response is still returned (cast to `MetadataMetricQueryResponseV2`).
93082
+ * Callers should handle potentially incomplete or unexpected fields
93083
+ * defensively.
93084
+ *
93085
+ * @throws ZodError if the request fails schema validation.
93086
+ */
93087
+ async queryMetric(query) {
93088
+ MetadataMetricQuerySchema.parse(query);
93089
+ const raw = await this.dxSaasService.tenantPost('metadata/queryMetric', query);
93090
+ const result = MetadataMetricQueryResponseV2Schema.safeParse(raw);
93091
+ if (!result.success) {
93092
+ this.log.warn('MetadataMetricQueryResponseV2 validation warning:', result.error.message);
93093
+ }
93094
+ return raw;
93095
+ }
93096
+ }
93097
+
91048
93098
  var DEFAULT_SERVICE_INVENTORY_REQUEST_BODY = exports.OIService.DEFAULT_SERVICE_INVENTORY_REQUEST_BODY;
91049
93099
  /**
91050
93100
  * Service for OI services: dependency graph, top-level/all services, inventory,
@@ -91210,6 +93260,24 @@ class ServiceService {
91210
93260
  const graph = await this.readServiceGraph(targets);
91211
93261
  return exports.ServiceBulk.planChanges(graph, targets, parsed);
91212
93262
  }
93263
+ /**
93264
+ * Plans `changes` like {@link planServiceChanges}, adding the save set's before-state (a
93265
+ * re-postable body, the undo) and the confirm token a preview prints and an apply checks.
93266
+ * Saves nothing.
93267
+ *
93268
+ * @throws ZodError for malformed changes; Error for an invalid change.
93269
+ */
93270
+ async previewServiceChanges(changes) {
93271
+ const parsed = exports.ServiceBulk.parseChanges(changes);
93272
+ const targets = exports.ServiceBulk.targetsOf(parsed);
93273
+ const graph = await this.readServiceGraph(targets);
93274
+ const { plan } = exports.ServiceBulk.planChanges(graph, targets, parsed);
93275
+ return {
93276
+ plan,
93277
+ before: plan.save.length ? exports.ServiceBulk.bodyFor(graph, plan.save) : { vertices: [], edges: [] },
93278
+ confirm: exports.ServiceBulkSelect.planToken(plan),
93279
+ };
93280
+ }
91213
93281
  /**
91214
93282
  * Previews one set of edits applied to every service a selector picks, saving
91215
93283
  * nothing. Candidates come from `services` / `root` when given, otherwise from
@@ -91601,6 +93669,85 @@ class ServiceService {
91601
93669
  const { body } = await this.buildServiceUpdateBody(serviceName, patch);
91602
93670
  return this.createService(body, { replace: true });
91603
93671
  }
93672
+ /**
93673
+ * Reads a service's Availability KPI and which of its SLIs could be it (see {@link AvailabilityKpi}).
93674
+ *
93675
+ * @remarks An SLI qualifies once its SLO Threshold metric is in the metadata store within the last 24 h, the
93676
+ * check the UI makes; the metric id the KPI points at comes from there.
93677
+ * @throws Error if the service does not exist.
93678
+ */
93679
+ async getAvailabilityKpi(serviceName) {
93680
+ const overview = await this.getServiceOverview(serviceName);
93681
+ const now = DateTime.now();
93682
+ const slis = await this.getServiceSLIs(overview.externalId, serviceName, now.minus({ hours: 1 }), now);
93683
+ const entry = exports.AvailabilityKpi.currentEntry(overview.attributes.metrics);
93684
+ const names = exports.AvailabilityKpi.metricNames(slis, entry);
93685
+ const published = new Map();
93686
+ if (names.length > 0) {
93687
+ const response = await new DataStoreMetricsMetadataService(this.dxSaaSService, this.log).queryMetric({
93688
+ specifier: {
93689
+ op: 'SPEC',
93690
+ sourceNameSpecifier: { op: 'EXACT', names: [exports.AvailabilityKpi.SOURCE], ignoreCase: true },
93691
+ attributeNameSpecifier: { op: 'EXACT', names },
93692
+ },
93693
+ clamp: names.length,
93694
+ time: now.toMillis(),
93695
+ range: exports.AvailabilityKpi.PUBLISHED_WINDOW_MS,
93696
+ });
93697
+ for (const m of response.metrics ?? []) {
93698
+ if (m.attributeName && m.id) {
93699
+ published.set(m.attributeName, {
93700
+ id: m.id,
93701
+ ...(m.firstSeen ? { firstSeen: m.firstSeen } : {}),
93702
+ ...(m.lastSeen ? { lastSeen: m.lastSeen } : {}),
93703
+ });
93704
+ }
93705
+ }
93706
+ }
93707
+ const current = exports.AvailabilityKpi.describeCurrent(entry, slis, published);
93708
+ return {
93709
+ serviceName,
93710
+ ...(current ? { current } : {}),
93711
+ candidates: exports.AvailabilityKpi.candidates(slis, published, entry),
93712
+ };
93713
+ }
93714
+ /**
93715
+ * Builds the store body that sets the service's Availability KPI to one of its SLIs (`sli`: id or name), or clears
93716
+ * it (`sli` null), WITHOUT saving. Re-saves the full subtree like {@link buildServiceUpdateBody}.
93717
+ *
93718
+ * @returns the body, change lines (empty = nothing to change) and blockers (an SLI that cannot be the KPI, an
93719
+ * unknown SLI, nothing to clear); saving with blockers is the caller's error.
93720
+ * @throws Error if the service does not exist.
93721
+ */
93722
+ async buildAvailabilityKpiBody(serviceName, sli) {
93723
+ const kpi = await this.getAvailabilityKpi(serviceName);
93724
+ const blockers = [];
93725
+ const candidate = sli === null ? undefined : exports.AvailabilityKpi.findCandidate(kpi.candidates, sli);
93726
+ if (sli !== null && !candidate) {
93727
+ blockers.push(exports.AvailabilityKpi.notFound(kpi.candidates, sli, serviceName));
93728
+ }
93729
+ else if (candidate && !candidate.eligible) {
93730
+ blockers.push(`SLI '${candidate.sli}' cannot be the availability KPI: ${candidate.reason}`);
93731
+ }
93732
+ const body = await this.buildHierarchyBody(serviceName);
93733
+ const entry = candidate?.eligible ? exports.AvailabilityKpi.entryFor(candidate) : null;
93734
+ const changes = blockers.length > 0
93735
+ ? []
93736
+ : exports.AvailabilityKpi.apply(body, serviceName, entry, {
93737
+ ...(kpi.current?.sli ? { before: kpi.current.sli } : {}),
93738
+ ...(candidate ? { after: candidate.sli } : {}),
93739
+ });
93740
+ if (blockers.length === 0 && changes.length === 0) {
93741
+ blockers.push(sli === null ? 'the service has no availability KPI to clear' : `SLI '${candidate?.sli}' is already the availability KPI`);
93742
+ }
93743
+ return {
93744
+ body,
93745
+ changes,
93746
+ blockers,
93747
+ ...(kpi.current ? { current: kpi.current } : {}),
93748
+ ...(candidate ? { candidate } : {}),
93749
+ };
93750
+ }
91604
93751
  /** Deletes a service by name; optionally deletes child services recursively. */
91605
93752
  async deleteService(serviceName, recursive = false) {
91606
93753
  return this.dxSaaSService.tenantPost('/oi/v2/sa/service/status', { name: serviceName, action: 'delete' }, { recursive });
@@ -91852,17 +93999,33 @@ class SituationService {
91852
93999
  *
91853
94000
  * @remarks Reads every page until the server's `totalCount` (it used to
91854
94001
  * stop at 50; a demo-dev situation had 69). A short read keeps the server's
91855
- * `totalCount` and logs a warning.
94002
+ * `totalCount` and logs a warning. With `propertySearch`, the server keeps
94003
+ * only events whose `propName` contains the text (case-insensitive).
91856
94004
  */
91857
- async getSituationLifecycleEvents(situationId) {
94005
+ async getSituationLifecycleEvents(situationId, options = {}) {
91858
94006
  return readLifecyclePages((pageNumber, pageSize) => this.dxSaaSService.oiPost('oi/v2/api/alarms/lifecycle/_search', {
91859
94007
  alarmId: situationId,
91860
94008
  pageSize,
91861
94009
  pageNumber,
91862
94010
  sortCol: 'timestamp:desc',
91863
94011
  lifeCycleType: 'SITUATION',
94012
+ ...(options.propertySearch ? { searchText: options.propertySearch } : {}),
91864
94013
  }), `situation ${situationId}`, this.log);
91865
94014
  }
94015
+ /**
94016
+ * The server's explanation of a situation (the 2026-11 Details tab): why it opened, its name,
94017
+ * membership and alarm breakdown, timeline, stabilisation and closure reasoning, and a narration.
94018
+ * An unknown id is not an error: check `situationExplanationFound` (model/situations/situation-explain).
94019
+ *
94020
+ * @remarks Response-validated, not thrown.
94021
+ */
94022
+ async explainSituation(situationId) {
94023
+ const raw = await this.dxSaaSService.oiPost(`oi/v2/api/clusteralarms/explain/${encodeURIComponent(situationId)}`, {});
94024
+ const result = SituationExplanationSchema.safeParse(raw);
94025
+ if (!result.success)
94026
+ this.log.warn('SituationExplanation validation warning:', result.error.message);
94027
+ return raw;
94028
+ }
91866
94029
  /** Returns the inspector inspection result for a situation (related alarms, topology). */
91867
94030
  async getSituationInspection(situationId) {
91868
94031
  return this.dxSaaSService.oiPost('oi/v2/api/inspect/situation', {
@@ -92416,144 +94579,6 @@ class DataStoreFeaturesService {
92416
94579
  }
92417
94580
  }
92418
94581
 
92419
- /**
92420
- * A metric registered with `attributes["@tags"]` must carry the TYPE_TAGS
92421
- * flag — without it the server treats "@tags" as an ordinary attribute and
92422
- * registers a metric with the wrong identity. Added here (not in the caller)
92423
- * so every registration path gets it; idempotent when the flag is already set.
92424
- * When the metric has no type at all the flag is not invented — schema
92425
- * validation rejects that case with an explicit message.
92426
- */
92427
- function ensureTypeTagsFlag(metric) {
92428
- if (metric.attributes?.[TAGS_ATTRIBUTE_KEY] === undefined) {
92429
- return metric;
92430
- }
92431
- const normalized = { ...metric };
92432
- if (normalized.typeEnum !== undefined &&
92433
- !normalized.typeEnum.includes('TYPE_TAGS')) {
92434
- normalized.typeEnum = [...normalized.typeEnum, 'TYPE_TAGS'];
92435
- }
92436
- if (normalized.type !== undefined &&
92437
- (normalized.type & METRIC_TYPE_ENUM.TYPE_TAGS) === 0) {
92438
- normalized.type = normalized.type | METRIC_TYPE_ENUM.TYPE_TAGS;
92439
- }
92440
- return normalized;
92441
- }
92442
- /**
92443
- * The server rejects some real typeEnum names (MONITOR_DOUBLE_DURATION,
92444
- * MONITOR_DOUBLE_PERCENTAGE) but accepts their numeric `type`. A typeEnum
92445
- * naming one is sent as the composed `type`, ORed into any `type` given.
92446
- */
92447
- function typeEnumToNumericWhereNeeded(metric) {
92448
- const names = metric.typeEnum;
92449
- if (!names?.some((n) => NUMERIC_ONLY_TYPE_ENUM_NAMES.includes(n))) {
92450
- return metric;
92451
- }
92452
- const known = names.filter((n) => METRIC_TYPE_ENUM_NAMES.includes(n));
92453
- if (known.length !== names.length) {
92454
- return metric;
92455
- }
92456
- const normalized = {
92457
- ...metric,
92458
- type: (metric.type ?? 0) | composeMetricTypeBits(known),
92459
- };
92460
- delete normalized.typeEnum;
92461
- return normalized;
92462
- }
92463
- /**
92464
- * Service for issuing metric metadata queries against the DX SaaS DataStore
92465
- * API (`/metadata/queryMetric`).
92466
- *
92467
- * Requests are validated against {@link MetadataMetricQuerySchema}; responses
92468
- * are validated against {@link MetadataMetricQueryResponseV2Schema}.
92469
- * Validation failures on the response side are logged as warnings, not thrown.
92470
- *
92471
- * @example
92472
- * ```ts
92473
- * const service = new DataStoreMetricsMetadataService(dxSaasService, log);
92474
- * const response = await service.queryMetric({
92475
- * specifier: { op: 'ALL' },
92476
- * clamp: 500,
92477
- * time: Date.now(),
92478
- * range: 480000,
92479
- * includeLive: true,
92480
- * includeProfile: false,
92481
- * });
92482
- * // response.metrics — matching metric descriptors
92483
- * // response.folders — matching folder descriptors
92484
- * ```
92485
- */
92486
- class DataStoreMetricsMetadataService {
92487
- dxSaasService;
92488
- log;
92489
- /**
92490
- * @param dxSaasService - An authenticated {@link DxSaasService} instance
92491
- * configured for the target tenant (provides gateway host and credentials).
92492
- * @param log - Logger conforming to {@link SimpleLog} from `@dx-do/util`.
92493
- * Must implement `info`, `warn`, `error`, and `debug` methods.
92494
- */
92495
- constructor(dxSaasService, log) {
92496
- this.dxSaasService = dxSaasService;
92497
- this.log = log;
92498
- }
92499
- /**
92500
- * Registers one or more metrics via `POST /metadata/registerMetric`.
92501
- *
92502
- * @remarks The request is validated against {@link MetricRegisterRequestSchema}.
92503
- * Metrics carrying an `attributes["@tags"]` array get the TYPE_TAGS flag
92504
- * added to their type automatically (idempotent). A `typeEnum` naming
92505
- * MONITOR_DOUBLE_DURATION or MONITOR_DOUBLE_PERCENTAGE, which the server
92506
- * rejects by name, is sent as the numeric `type`. If the response fails
92507
- * schema validation, a warning is logged but the raw API response is
92508
- * still returned.
92509
- *
92510
- * @param requestOverrides - Per-call `timeout` / `signal`; registration is
92511
- * an idempotent upsert, so a caller may safely retry after a timeout.
92512
- *
92513
- * @throws ZodError if the request fails schema validation — including the
92514
- * tag-registration restrictions ("@tags" non-empty, every listed tag
92515
- * present with a non-empty string value, TYPE_TAGS never set without tags).
92516
- */
92517
- async registerMetrics(metrics, sync, requestOverrides = {}) {
92518
- const body = {
92519
- metrics: metrics.map((m) => ensureTypeTagsFlag(typeEnumToNumericWhereNeeded(m))),
92520
- ...(sync !== undefined ? { sync } : {}),
92521
- };
92522
- MetricRegisterRequestSchema.parse(body);
92523
- const raw = await this.dxSaasService.tenantPost('metadata/registerMetric', body, undefined, {}, requestOverrides);
92524
- const result = MetricRegisterResponseSchema.safeParse(raw);
92525
- if (!result.success) {
92526
- this.log.warn('MetricRegisterResponse validation warning:', result.error.message);
92527
- }
92528
- return raw;
92529
- }
92530
- /** Registers a single metric. Convenience wrapper around {@link registerMetrics}. */
92531
- async registerMetric(metric, sync, requestOverrides = {}) {
92532
- return this.registerMetrics([metric], sync, requestOverrides);
92533
- }
92534
- /**
92535
- * POSTs a metadata query to `/metadata/queryMetric` and returns the matching
92536
- * metric / folder records.
92537
- *
92538
- * @remarks The response is **not** guaranteed to match the schema exactly.
92539
- * If response validation fails, a warning is logged but the raw API
92540
- * response is still returned (cast to `MetadataMetricQueryResponseV2`).
92541
- * Callers should handle potentially incomplete or unexpected fields
92542
- * defensively.
92543
- *
92544
- * @throws ZodError if the request fails schema validation.
92545
- */
92546
- async queryMetric(query) {
92547
- MetadataMetricQuerySchema.parse(query);
92548
- const raw = await this.dxSaasService.tenantPost('metadata/queryMetric', query);
92549
- const result = MetadataMetricQueryResponseV2Schema.safeParse(raw);
92550
- if (!result.success) {
92551
- this.log.warn('MetadataMetricQueryResponseV2 validation warning:', result.error.message);
92552
- }
92553
- return raw;
92554
- }
92555
- }
92556
-
92557
94582
  /** Raw metric series (`metrics/queryMetric`), Zod-validated. */
92558
94583
  class DataStoreMetricDataService {
92559
94584
  dxSaasService;
@@ -93700,6 +95725,10 @@ function createServiceMonolith(dxDoConfiguration, log = new NullSimpleLog()) {
93700
95725
  dxLogsService,
93701
95726
  dxLogMetricService: new LogMetricService(dxSaaSService, dxLogsService, dxNASSService, log),
93702
95727
  dxMaintenanceService: new MaintenanceService(dxSaaSService, log),
95728
+ dxCustomPropertyService: new CustomPropertyService(dxSaaSService, log),
95729
+ dxRoleService: new RoleService(dxSaaSService, log),
95730
+ dxSyntheticAccessService: new SyntheticAccessService(dxSaaSService, log),
95731
+ dxUserGroupService: new UserGroupService(dxSaaSService, log),
93703
95732
  dxManagementModuleService: dxManagementModuleService,
93704
95733
  dxMetricBatchService: new MetricBatchService(dxSaaSService),
93705
95734
  dxMetricGroupingService: new MetricGroupingService(dxSaaSService, dxManagementModuleService),
@@ -93816,6 +95845,7 @@ exports.AuditRecordSchema = AuditRecordSchema;
93816
95845
  exports.AuditStoreResponseSchema = AuditStoreResponseSchema;
93817
95846
  exports.AuthorizationService = AuthorizationService;
93818
95847
  exports.AxaService = AxaService;
95848
+ exports.BUILT_IN_ROLE_IDS = BUILT_IN_ROLE_IDS;
93819
95849
  exports.BlobAllFilterSchema = BlobAllFilterSchema;
93820
95850
  exports.BlobAsyncCommandSchema = BlobAsyncCommandSchema;
93821
95851
  exports.BlobAsyncDeleteSchemaCommandSchema = BlobAsyncDeleteSchemaCommandSchema;
@@ -93858,6 +95888,8 @@ exports.CURL_COHORT_VAR = CURL_COHORT_VAR;
93858
95888
  exports.CURL_HOST_VAR = CURL_HOST_VAR;
93859
95889
  exports.CURL_TOKEN_VAR = CURL_TOKEN_VAR;
93860
95890
  exports.CUSTOM_FIELD_PATTERN = CUSTOM_FIELD_PATTERN;
95891
+ exports.CUSTOM_PROPERTY_NAME_PATTERN = CUSTOM_PROPERTY_NAME_PATTERN;
95892
+ exports.CUSTOM_PROPERTY_VALUE_TYPES = CUSTOM_PROPERTY_VALUE_TYPES;
93861
95893
  exports.CalendarIntervalSchema = CalendarIntervalSchema;
93862
95894
  exports.CancelRevokeRequestSchema = CancelRevokeRequestSchema;
93863
95895
  exports.ChannelDeleteResponseSchema = ChannelDeleteResponseSchema;
@@ -93884,6 +95916,14 @@ exports.CreateAgentTokenRequestSchema = CreateAgentTokenRequestSchema;
93884
95916
  exports.CreateInternalTokenRequestSchema = CreateInternalTokenRequestSchema;
93885
95917
  exports.CreateTenantTokenRequestSchema = CreateTenantTokenRequestSchema;
93886
95918
  exports.CreateUserTokenRequestSchema = CreateUserTokenRequestSchema;
95919
+ exports.CustomPropertyAllowedValueSchema = CustomPropertyAllowedValueSchema;
95920
+ exports.CustomPropertyDefinitionListSchema = CustomPropertyDefinitionListSchema;
95921
+ exports.CustomPropertyDefinitionSchema = CustomPropertyDefinitionSchema;
95922
+ exports.CustomPropertyService = CustomPropertyService;
95923
+ exports.CustomPropertyUsageSchema = CustomPropertyUsageSchema;
95924
+ exports.CustomPropertyValueTypeSchema = CustomPropertyValueTypeSchema;
95925
+ exports.CustomPropertyWriteResponseSchema = CustomPropertyWriteResponseSchema;
95926
+ exports.CustomPropertyWriteSchema = CustomPropertyWriteSchema;
93887
95927
  exports.DEFAULT_EXPERIENCE_REQUEST_BODY = DEFAULT_EXPERIENCE_REQUEST_BODY;
93888
95928
  exports.DEFAULT_EXTERNAL_ID_FORMAT = DEFAULT_EXTERNAL_ID_FORMAT;
93889
95929
  exports.DEFAULT_WEBHOOK_AUTH_DETAILS = DEFAULT_WEBHOOK_AUTH_DETAILS;
@@ -93953,6 +95993,8 @@ exports.FolderNameNotSpecifierSchema = FolderNameNotSpecifierSchema;
93953
95993
  exports.FolderNameOrSpecifierSchema = FolderNameOrSpecifierSchema;
93954
95994
  exports.FolderNameRegExSpecifierSchema = FolderNameRegExSpecifierSchema;
93955
95995
  exports.FolderNameSpecifierSchema = FolderNameSpecifierSchema;
95996
+ exports.GRID_MACHINE_COLUMNS = GRID_MACHINE_COLUMNS;
95997
+ exports.GRID_SERVICE_COLUMN = GRID_SERVICE_COLUMN;
93956
95998
  exports.GenericChannelSchema = GenericChannelSchema;
93957
95999
  exports.GraphService = GraphService;
93958
96000
  exports.INVENTORY_QUEUE_CATEGORY = INVENTORY_QUEUE_CATEGORY;
@@ -94080,6 +96122,8 @@ exports.POLICY_ALARM_CATEGORIES = POLICY_ALARM_CATEGORIES;
94080
96122
  exports.POLICY_FILTER_CONDITIONS = POLICY_FILTER_CONDITIONS;
94081
96123
  exports.POSTMAN_TOKEN_VAR = POSTMAN_TOKEN_VAR;
94082
96124
  exports.PRODUCT_STATUS_PROVISIONED = PRODUCT_STATUS_PROVISIONED;
96125
+ exports.PROPERTY_COVERAGE_SCOPE = PROPERTY_COVERAGE_SCOPE;
96126
+ exports.PROPERTY_GRID_FORMAT = PROPERTY_GRID_FORMAT;
94083
96127
  exports.PerspectiveService = PerspectiveService;
94084
96128
  exports.PlatformAlertService = PlatformAlertService;
94085
96129
  exports.PlatformManagementModuleService = PlatformManagementModuleService;
@@ -94118,15 +96162,26 @@ exports.QueryResultTableSchema = QueryResultTableSchema;
94118
96162
  exports.QuerySpecSpecifierSchema = QuerySpecSpecifierSchema;
94119
96163
  exports.QuerySpecifierSchema = QuerySpecifierSchema;
94120
96164
  exports.REDACTED_SECRET = REDACTED_SECRET;
96165
+ exports.ROLE_GRANT_PERMISSIONS = ROLE_GRANT_PERMISSIONS;
94121
96166
  exports.RecurrencePattern = RecurrencePattern;
94122
96167
  exports.RevokeTokenRequestSchema = RevokeTokenRequestSchema;
94123
96168
  exports.RevokeTokensResponseSchema = RevokeTokensResponseSchema;
96169
+ exports.RoleCatalogEntrySchema = RoleCatalogEntrySchema;
96170
+ exports.RoleCatalogSchema = RoleCatalogSchema;
96171
+ exports.RoleChangedError = RoleChangedError;
96172
+ exports.RoleGrantSchema = RoleGrantSchema;
96173
+ exports.RoleService = RoleService;
96174
+ exports.RoleViewSchema = RoleViewSchema;
94124
96175
  exports.SERVICE_METRIC_PRESENCE_WINDOW_MS = SERVICE_METRIC_PRESENCE_WINDOW_MS;
96176
+ exports.SERVICE_PROPERTY_FIELD_PREFIX = SERVICE_PROPERTY_FIELD_PREFIX;
96177
+ exports.SITUATION_EXPLAIN_ALARM_LIST_MAX = SITUATION_EXPLAIN_ALARM_LIST_MAX;
94125
96178
  exports.SLIService = SLIService;
94126
96179
  exports.SLI_DERIVED_METRIC_SOURCE = SLI_DERIVED_METRIC_SOURCE;
94127
96180
  exports.SMTP_DEFAULT_TEMPLATES = SMTP_DEFAULT_TEMPLATES;
94128
96181
  exports.SOURCENAME_DIALECT_CATALOG = SOURCENAME_DIALECT_CATALOG;
94129
96182
  exports.SQLService = SQLService;
96183
+ exports.SYNTHETIC_ACCESS_ACTIONS = SYNTHETIC_ACCESS_ACTIONS;
96184
+ exports.SYNTHETIC_ACCESS_SUBJECTS = SYNTHETIC_ACCESS_SUBJECTS;
94130
96185
  exports.SYNTHETIC_CHECK_API_PATH = SYNTHETIC_CHECK_API_PATH;
94131
96186
  exports.SYNTHETIC_MONITOR_API_PATH = SYNTHETIC_MONITOR_API_PATH;
94132
96187
  exports.SYNTHETIC_MONITOR_CREATE_EXAMPLES = SYNTHETIC_MONITOR_CREATE_EXAMPLES;
@@ -94168,6 +96223,17 @@ exports.SessionValidateRequestSchema = SessionValidateRequestSchema;
94168
96223
  exports.SessionValidateResponseSchema = SessionValidateResponseSchema;
94169
96224
  exports.SetDefaultViewRequestSchema = SetDefaultViewRequestSchema;
94170
96225
  exports.SimpleHTTPError = SimpleHTTPError;
96226
+ exports.SituationExplainAlarmSchema = SituationExplainAlarmSchema;
96227
+ exports.SituationExplainBreakdownSchema = SituationExplainBreakdownSchema;
96228
+ exports.SituationExplainClosureSchema = SituationExplainClosureSchema;
96229
+ exports.SituationExplainCreationSchema = SituationExplainCreationSchema;
96230
+ exports.SituationExplainIdentitySchema = SituationExplainIdentitySchema;
96231
+ exports.SituationExplainMembershipSchema = SituationExplainMembershipSchema;
96232
+ exports.SituationExplainNameSchema = SituationExplainNameSchema;
96233
+ exports.SituationExplainNarrationSchema = SituationExplainNarrationSchema;
96234
+ exports.SituationExplainStabilizationSchema = SituationExplainStabilizationSchema;
96235
+ exports.SituationExplainTimelineEntrySchema = SituationExplainTimelineEntrySchema;
96236
+ exports.SituationExplanationSchema = SituationExplanationSchema;
94171
96237
  exports.SituationService = SituationService;
94172
96238
  exports.SliAggregationIntervalSchema = SliAggregationIntervalSchema;
94173
96239
  exports.SliAlertEntrySchema = SliAlertEntrySchema;
@@ -94216,6 +96282,11 @@ exports.SourceNameSpecifierSchema = SourceNameSpecifierSchema;
94216
96282
  exports.StatusPageComponentSchema = StatusPageComponentSchema;
94217
96283
  exports.StatusPageComponentsSchema = StatusPageComponentsSchema;
94218
96284
  exports.StoredCriteriaSchema = StoredCriteriaSchema;
96285
+ exports.SyntheticAccessPolicyListSchema = SyntheticAccessPolicyListSchema;
96286
+ exports.SyntheticAccessPolicySchema = SyntheticAccessPolicySchema;
96287
+ exports.SyntheticAccessPolicyWriteSchema = SyntheticAccessPolicyWriteSchema;
96288
+ exports.SyntheticAccessRuleSchema = SyntheticAccessRuleSchema;
96289
+ exports.SyntheticAccessService = SyntheticAccessService;
94219
96290
  exports.SyntheticCheckAssetSchema = SyntheticCheckAssetSchema;
94220
96291
  exports.SyntheticCheckProbeSchema = SyntheticCheckProbeSchema;
94221
96292
  exports.SyntheticCheckResultSchema = SyntheticCheckResultSchema;
@@ -94338,6 +96409,7 @@ exports.TASService = TASService;
94338
96409
  exports.TC_METRIC_CAP = TC_METRIC_CAP;
94339
96410
  exports.TC_RESERVED_CUSTOM_ATTRIBUTE_KEYS = TC_RESERVED_CUSTOM_ATTRIBUTE_KEYS;
94340
96411
  exports.TC_STANDARD_ATTRIBUTE_KEYS = TC_STANDARD_ATTRIBUTE_KEYS;
96412
+ exports.TENANT_ADMIN_ROLE_ID = TENANT_ADMIN_ROLE_ID;
94341
96413
  exports.TICKET_ENRICHMENT_ALARM_TYPES = TICKET_ENRICHMENT_ALARM_TYPES;
94342
96414
  exports.TICKET_ENRICHMENT_FIELD_CODES = TICKET_ENRICHMENT_FIELD_CODES;
94343
96415
  exports.TasAddFlowsFilterSchema = TasAddFlowsFilterSchema;
@@ -94443,6 +96515,11 @@ exports.UTC_EQUIVALENT_TIMEZONES = UTC_EQUIVALENT_TIMEZONES;
94443
96515
  exports.UpdateAgentTokenRequestSchema = UpdateAgentTokenRequestSchema;
94444
96516
  exports.UpdateTenantTokenRequestSchema = UpdateTenantTokenRequestSchema;
94445
96517
  exports.UpdateUserTokenRequestSchema = UpdateUserTokenRequestSchema;
96518
+ exports.UserGroupListSchema = UserGroupListSchema;
96519
+ exports.UserGroupSchema = UserGroupSchema;
96520
+ exports.UserGroupService = UserGroupService;
96521
+ exports.UserGroupUserInfoSchema = UserGroupUserInfoSchema;
96522
+ exports.UserGroupWriteSchema = UserGroupWriteSchema;
94446
96523
  exports.VertexGroupSchema = VertexGroupSchema;
94447
96524
  exports.VertexService = VertexService;
94448
96525
  exports.VertexStateAlertFilterSchema = VertexStateAlertFilterSchema;
@@ -94503,6 +96580,8 @@ exports.WebhookSpecSchema = WebhookSpecSchema;
94503
96580
  exports.WebhookTestInputSchema = WebhookTestInputSchema;
94504
96581
  exports.WebhookTestRequestSchema = WebhookTestRequestSchema;
94505
96582
  exports.WebhookTestResponseSchema = WebhookTestResponseSchema;
96583
+ exports.accessPolicyBody = accessPolicyBody;
96584
+ exports.accessPolicyName = accessPolicyName;
94506
96585
  exports.ags = ags;
94507
96586
  exports.agsresponse = agsresponse;
94508
96587
  exports.alarmFilterDisplayColumnsFor = alarmFilterDisplayColumnsFor;
@@ -94510,6 +96589,7 @@ exports.alarmRecordTime = alarmRecordTime;
94510
96589
  exports.alertsForSliIndex = alertsForSliIndex;
94511
96590
  exports.algorithmicSituationsEnabled = algorithmicSituationsEnabled;
94512
96591
  exports.allAlarmQueues = allAlarmQueues;
96592
+ exports.allGroupReferences = allGroupReferences;
94513
96593
  exports.appendSli = appendSli;
94514
96594
  exports.appendSloTriplet = appendSloTriplet;
94515
96595
  exports.attributeFilterTargets = attributeFilterTargets;
@@ -94524,14 +96604,17 @@ exports.buildEnrichmentRuleUpdateBody = buildEnrichmentRuleUpdateBody;
94524
96604
  exports.buildInventoryCustomFilter = buildInventoryCustomFilter;
94525
96605
  exports.buildInventoryQueueUpdateBody = buildInventoryQueueUpdateBody;
94526
96606
  exports.buildPolicyFilterExpression = buildPolicyFilterExpression;
96607
+ exports.buildPropertyGrid = buildPropertyGrid;
94527
96608
  exports.buildSliFunction = buildSliFunction;
94528
96609
  exports.buildSloTriplet = buildSloTriplet;
94529
96610
  exports.buildTemplateRefs = buildTemplateRefs;
94530
96611
  exports.buildUimLogPayload = buildUimLogPayload;
94531
96612
  exports.canonicalTimeZone = canonicalTimeZone;
94532
96613
  exports.capVertexDetail = capVertexDetail;
96614
+ exports.checkPropertyValue = checkPropertyValue;
94533
96615
  exports.chunkPayloads = chunkPayloads;
94534
96616
  exports.classifyIngestionError = classifyIngestionError;
96617
+ exports.cohortGuid = cohortGuid;
94535
96618
  exports.compileTcSourceName = compileTcSourceName;
94536
96619
  exports.composeMetricTypeBits = composeMetricTypeBits;
94537
96620
  exports.convertLegacyConfiguration = convertLegacyConfiguration;
@@ -94540,6 +96623,7 @@ exports.createCurlScript = createCurlScript;
94540
96623
  exports.createPostmanRequest = createPostmanRequest;
94541
96624
  exports.createServiceMonolith = createServiceMonolith;
94542
96625
  exports.customAttributeKeyIssues = customAttributeKeyIssues;
96626
+ exports.danglingGroupReferences = danglingGroupReferences;
94543
96627
  exports.decodeMetricTypeBits = decodeMetricTypeBits;
94544
96628
  exports.defaultItsmPropertyList = defaultItsmPropertyList;
94545
96629
  exports.defaultRuleName = defaultRuleName;
@@ -94550,6 +96634,7 @@ exports.describeSyntheticMonitorApiError = describeSyntheticMonitorApiError;
94550
96634
  exports.displayColumnsFor = displayColumnsFor;
94551
96635
  exports.dottedFileSlot = dottedFileSlot;
94552
96636
  exports.draftKey = draftKey;
96637
+ exports.editedServices = editedServices;
94553
96638
  exports.encodeItsmSecret = encodeItsmSecret;
94554
96639
  exports.ensureParallelAlerts = ensureParallelAlerts;
94555
96640
  exports.escapeRegExp = escapeRegExp;
@@ -94569,11 +96654,16 @@ exports.findRedactedSecretPaths = findRedactedSecretPaths;
94569
96654
  exports.findSliByName = findSliByName;
94570
96655
  exports.flattenAxiosHeaders = flattenAxiosHeaders;
94571
96656
  exports.formExternalId = formExternalId;
96657
+ exports.formulaLikeCells = formulaLikeCells;
94572
96658
  exports.getDataStoreSchema = getDataStoreSchema;
94573
96659
  exports.getUserTokenSub = getUserTokenSub;
94574
96660
  exports.getUserTokenTid = getUserTokenTid;
94575
96661
  exports.getVertexAttributeValue = getVertexAttributeValue;
94576
96662
  exports.getVertexAttributeValueOrNull = getVertexAttributeValueOrNull;
96663
+ exports.gridToCsv = gridToCsv;
96664
+ exports.gridToJson = gridToJson;
96665
+ exports.gridToRows = gridToRows;
96666
+ exports.groupReferences = groupReferences;
94577
96667
  exports.hasTypeTagsFlag = hasTypeTagsFlag;
94578
96668
  exports.hasVertexAttribute = hasVertexAttribute;
94579
96669
  exports.hiddenAuthObjectName = hiddenAuthObjectName;
@@ -94624,23 +96714,35 @@ exports.measureBytes = measureBytes;
94624
96714
  exports.messageTemplateVariables = messageTemplateVariables;
94625
96715
  exports.metricGroupingCustomFilter = metricGroupingCustomFilter;
94626
96716
  exports.metricGroupingFilter = metricGroupingFilter;
96717
+ exports.missingKeyEffect = missingKeyEffect;
96718
+ exports.namingOperationSignature = namingOperationSignature;
96719
+ exports.namingTemplateProblems = namingTemplateProblems;
94627
96720
  exports.normalizeAlarmQueueSharing = normalizeAlarmQueueSharing;
94628
96721
  exports.orBlocksByField = orBlocksByField;
94629
96722
  exports.parseAlarmRecordTime = parseAlarmRecordTime;
96723
+ exports.parseCsv = parseCsv;
94630
96724
  exports.parseExpression = parseExpression;
94631
96725
  exports.parseExternalIdFormat = parseExternalIdFormat;
94632
96726
  exports.parseFilter = parseFilter;
96727
+ exports.parseGridRows = parseGridRows;
96728
+ exports.parseNamingTemplate = parseNamingTemplate;
96729
+ exports.parsePropertyGrid = parsePropertyGrid;
94633
96730
  exports.parseSaasGateway = parseSaasGateway;
94634
96731
  exports.parseServiceNowUrl = parseServiceNowUrl;
94635
96732
  exports.parseSyntheticMonitorNdjson = parseSyntheticMonitorNdjson;
94636
96733
  exports.pipeGroupRanges = pipeGroupRanges;
96734
+ exports.planAccessChange = planAccessChange;
94637
96735
  exports.planEnrichmentReorder = planEnrichmentReorder;
96736
+ exports.planPropertyGridImport = planPropertyGridImport;
94638
96737
  exports.policyCategoryGuard = policyCategoryGuard;
94639
96738
  exports.policyFieldBounds = policyFieldBounds;
94640
96739
  exports.policyFilterAtoms = policyFilterAtoms;
96740
+ exports.policyGrant = policyGrant;
94641
96741
  exports.producedMetricName = producedMetricName;
94642
96742
  exports.projectCustomAttributes = projectCustomAttributes;
94643
96743
  exports.projectRule = projectRule;
96744
+ exports.propertyCoverage = propertyCoverage;
96745
+ exports.propertyRoutingExposure = propertyRoutingExposure;
94644
96746
  exports.pruneOrphanSloFunctions = pruneOrphanSloFunctions;
94645
96747
  exports.readLifecyclePages = readLifecyclePages;
94646
96748
  exports.redactChannelSecrets = redactChannelSecrets;
@@ -94653,12 +96755,14 @@ exports.reportingIntervalSeconds = reportingIntervalSeconds;
94653
96755
  exports.resolveAnomalyDetectionProduct = resolveAnomalyDetectionProduct;
94654
96756
  exports.resolveEnrichmentMappings = resolveEnrichmentMappings;
94655
96757
  exports.resolveWebhookPayload = resolveWebhookPayload;
96758
+ exports.roleHolders = roleHolders;
94656
96759
  exports.sampleServiceDetailRequestBody = sampleServiceDetailRequestBody;
94657
96760
  exports.searchAlarmWindows = searchAlarmWindows;
94658
96761
  exports.searchUniverse = searchUniverse;
94659
96762
  exports.sendWithRetry = sendWithRetry;
94660
96763
  exports.serviceDetailResponseBody = serviceDetailResponseBody;
94661
96764
  exports.sharedRoleDelta = sharedRoleDelta;
96765
+ exports.situationExplanationFound = situationExplanationFound;
94662
96766
  exports.sleep = sleep;
94663
96767
  exports.sliHumanName = sliHumanName;
94664
96768
  exports.sloTripletFor = sloTripletFor;
@@ -94668,6 +96772,7 @@ exports.sourceNameBattery = sourceNameBattery;
94668
96772
  exports.sourceNameMatrix = sourceNameMatrix;
94669
96773
  exports.splitAttributePath = splitAttributePath;
94670
96774
  exports.splitTemplate = splitTemplate;
96775
+ exports.spreadsheetMangling = spreadsheetMangling;
94671
96776
  exports.standardVertexAttributes = standardVertexAttributes;
94672
96777
  exports.summarizeDataStoreSchema = summarizeDataStoreSchema;
94673
96778
  exports.syntheticMonitorQueryString = syntheticMonitorQueryString;
@@ -94684,6 +96789,7 @@ exports.toAnomalyGroupMetricsRequest = toAnomalyGroupMetricsRequest;
94684
96789
  exports.toChannelWriteBody = toChannelWriteBody;
94685
96790
  exports.toClusteringPolicyPreviewBody = toClusteringPolicyPreviewBody;
94686
96791
  exports.toClusteringPolicyWriteBody = toClusteringPolicyWriteBody;
96792
+ exports.toDefinitionWrite = toDefinitionWrite;
94687
96793
  exports.toEnrichmentRuleCreateBody = toEnrichmentRuleCreateBody;
94688
96794
  exports.toGroupMetricsRequest = toGroupMetricsRequest;
94689
96795
  exports.toInventoryQueueWriteBody = toInventoryQueueWriteBody;
@@ -94704,4 +96810,7 @@ exports.verifyAndDumpVersion4Configuration = verifyAndDumpVersion4Configuration;
94704
96810
  exports.vertexMatchesFilters = vertexMatchesFilters;
94705
96811
  exports.visibleAlarmQueueColumns = visibleAlarmQueueColumns;
94706
96812
  exports.visibleInventoryColumns = visibleInventoryColumns;
96813
+ exports.withGraphProperties = withGraphProperties;
96814
+ exports.withRoleGrant = withRoleGrant;
96815
+ exports.withoutRoleGrant = withoutRoleGrant;
94707
96816
  //# sourceMappingURL=index.cjs.js.map