@dx-do/client 7.12.0 → 7.12.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs.js CHANGED
@@ -2333,7 +2333,7 @@ const isNumber$2 = typeOfTest('number');
2333
2333
  *
2334
2334
  * @returns {boolean} True if value is an Object, otherwise false
2335
2335
  */
2336
- const isObject = (thing) => thing !== null && typeof thing === 'object';
2336
+ const isObject$1 = (thing) => thing !== null && typeof thing === 'object';
2337
2337
 
2338
2338
  /**
2339
2339
  * Determine if a value is a Boolean
@@ -2351,7 +2351,7 @@ const isBoolean$1 = (thing) => thing === true || thing === false;
2351
2351
  * @returns {boolean} True if value is a plain Object, otherwise false
2352
2352
  */
2353
2353
  const isPlainObject = (val) => {
2354
- if (!isObject(val)) {
2354
+ if (!isObject$1(val)) {
2355
2355
  return false;
2356
2356
  }
2357
2357
 
@@ -2377,7 +2377,7 @@ const isPlainObject = (val) => {
2377
2377
  */
2378
2378
  const isEmptyObject = (val) => {
2379
2379
  // Early return for non-objects or Buffers to prevent RangeError
2380
- if (!isObject(val) || isBuffer$2(val)) {
2380
+ if (!isObject$1(val) || isBuffer$2(val)) {
2381
2381
  return false;
2382
2382
  }
2383
2383
 
@@ -2457,7 +2457,7 @@ const isFileList = kindOfTest('FileList');
2457
2457
  *
2458
2458
  * @returns {boolean} True if value is a Stream, otherwise false
2459
2459
  */
2460
- const isStream = (val) => isObject(val) && isFunction$4(val.pipe);
2460
+ const isStream = (val) => isObject$1(val) && isFunction$4(val.pipe);
2461
2461
 
2462
2462
  /**
2463
2463
  * Determine if a value is a FormData
@@ -3001,7 +3001,7 @@ const toJSONObject = (obj) => {
3001
3001
  const visited = new WeakSet();
3002
3002
 
3003
3003
  const visit = (source) => {
3004
- if (isObject(source)) {
3004
+ if (isObject$1(source)) {
3005
3005
  if (visited.has(source)) {
3006
3006
  return;
3007
3007
  }
@@ -3049,7 +3049,7 @@ const isAsyncFn = kindOfTest('AsyncFunction');
3049
3049
  */
3050
3050
  const isThenable = (thing) =>
3051
3051
  thing &&
3052
- (isObject(thing) || isFunction$4(thing)) &&
3052
+ (isObject$1(thing) || isFunction$4(thing)) &&
3053
3053
  isFunction$4(thing.then) &&
3054
3054
  isFunction$4(thing.catch);
3055
3055
 
@@ -3127,7 +3127,7 @@ var utils$3 = {
3127
3127
  isString: isString$3,
3128
3128
  isNumber: isNumber$2,
3129
3129
  isBoolean: isBoolean$1,
3130
- isObject,
3130
+ isObject: isObject$1,
3131
3131
  isPlainObject,
3132
3132
  isEmptyObject,
3133
3133
  isReadableStream,
@@ -39857,7 +39857,7 @@ var EXP_LIMIT = 9e15, // 0 to 9e15
39857
39857
 
39858
39858
 
39859
39859
  // The initial configuration properties of the Decimal constructor.
39860
- DEFAULTS = {
39860
+ DEFAULTS$1 = {
39861
39861
 
39862
39862
  // These values must be integers within the stated ranges (inclusive).
39863
39863
  // Most of these values can be changed at run-time using the `Decimal.config` method.
@@ -44042,14 +44042,14 @@ function config$2(obj) {
44042
44042
  ];
44043
44043
 
44044
44044
  for (i = 0; i < ps.length; i += 3) {
44045
- if (p = ps[i], useDefaults) this[p] = DEFAULTS[p];
44045
+ if (p = ps[i], useDefaults) this[p] = DEFAULTS$1[p];
44046
44046
  if ((v = obj[p]) !== void 0) {
44047
44047
  if (mathfloor(v) === v && v >= ps[i + 1] && v <= ps[i + 2]) this[p] = v;
44048
44048
  else throw Error(invalidArgument + p + ': ' + v);
44049
44049
  }
44050
44050
  }
44051
44051
 
44052
- if (p = 'crypto', useDefaults) this[p] = DEFAULTS[p];
44052
+ if (p = 'crypto', useDefaults) this[p] = DEFAULTS$1[p];
44053
44053
  if ((v = obj[p]) !== void 0) {
44054
44054
  if (v === true || v === false || v === 0 || v === 1) {
44055
44055
  if (v) {
@@ -44731,7 +44731,7 @@ P$2[Symbol.for('nodejs.util.inspect.custom')] = P$2.toString;
44731
44731
  P$2[Symbol.toStringTag] = 'Decimal';
44732
44732
 
44733
44733
  // Create and configure initial Decimal constructor.
44734
- var Decimal = P$2.constructor = clone$1(DEFAULTS);
44734
+ var Decimal = P$2.constructor = clone$1(DEFAULTS$1);
44735
44735
 
44736
44736
  // Create the internal constants from their string values.
44737
44737
  LN10 = new Decimal(LN10);
@@ -60191,6 +60191,60 @@ exports.LogIngest = void 0;
60191
60191
  return LogIngest.RESERVED_ADDITIONAL_FIELDS.includes(name.toLowerCase());
60192
60192
  }
60193
60193
  LogIngest.isReservedLogField = isReservedLogField;
60194
+ /**
60195
+ * Keys the uim_logs document owns (exact case). A caller's custom field with
60196
+ * one of these names would replace the platform's own value, and the platform
60197
+ * then does worse than override — a custom `file` comes back merged into an
60198
+ * array, custom `tags` and `origin` values are dropped (THE_LABORATORY,
60199
+ * 2026-09-16). Refused as custom fields by every producer.
60200
+ */
60201
+ LogIngest.PLATFORM_OWNED_FIELDS = [
60202
+ '@timestamp',
60203
+ 'logtype',
60204
+ 'logseverity',
60205
+ 'message',
60206
+ 'host',
60207
+ 'tenant_id',
60208
+ 'temp_fields',
60209
+ 'tags',
60210
+ 'file',
60211
+ 'origin',
60212
+ '__agent_name',
60213
+ '__agent_instance',
60214
+ 'container_id',
60215
+ 'container_name',
60216
+ ];
60217
+ /** True when `name` is one of {@link PLATFORM_OWNED_FIELDS} (exact case). */
60218
+ function isPlatformOwnedLogField(name) {
60219
+ return LogIngest.PLATFORM_OWNED_FIELDS.includes(name);
60220
+ }
60221
+ LogIngest.isPlatformOwnedLogField = isPlatformOwnedLogField;
60222
+ /**
60223
+ * How a log entry reaches the tenant.
60224
+ *
60225
+ * - `custom`: the Log Analytics custom JSON ingestion API,
60226
+ * `POST {dxGatewayHost}/la/v2/api/ingestion/logs` — flat documents,
60227
+ * epoch-ms timestamps, no positional parse. The platform indexes a document
60228
+ * only when its logtype is a Support-enabled custom type (listed by
60229
+ * `LogsService.listLogtypes()` as `cust_<logtype>`); anything else is
60230
+ * accepted with `200 ok` and dropped silently.
60231
+ * - `legacy`: the uim_logs pipeline on the separate logs-gateway host — the
60232
+ * only path to the `generic` index on a tenant without `cust_generic`.
60233
+ * - `auto`: `custom` when the entry's logtype passes the gate above,
60234
+ * otherwise `legacy`.
60235
+ *
60236
+ * Measured on THE_LABORATORY, 2026-09-23 —
60237
+ * `docs/internal/custom-log-ingestion-probe-2026-09.md`.
60238
+ */
60239
+ LogIngest.LOG_INGESTION_TRANSPORTS = ['auto', 'custom', 'legacy'];
60240
+ LogIngest.LogIngestionTransportSchema = v4.z
60241
+ .enum(LogIngest.LOG_INGESTION_TRANSPORTS)
60242
+ .describe("Log ingestion transport: 'custom' (Log Analytics custom JSON API on the gateway host; only for logtypes the tenant lists as cust_<logtype>), 'legacy' (uim_logs pipeline on the logs-gateway host; the path to the generic index), or 'auto' (custom when the logtype is enabled for it, else legacy).");
60243
+ /**
60244
+ * Precedence when nothing else says: a command's `transport=` argument, then
60245
+ * the profile's `dxLogIngestionTransport`, then this.
60246
+ */
60247
+ LogIngest.DEFAULT_LOG_INGESTION_TRANSPORT = 'auto';
60194
60248
  /**
60195
60249
  * Thrown by `DxSaasService.resolveLogIngestionURL` when no log gateway can
60196
60250
  * be determined. `definitive` is true when the profile itself rules an
@@ -60251,6 +60305,171 @@ exports.LogIngest = void 0;
60251
60305
  });
60252
60306
  })(exports.LogIngest || (exports.LogIngest = {}));
60253
60307
 
60308
+ /**
60309
+ * The Log Analytics **custom JSON ingestion API** —
60310
+ * `POST {dxGatewayHost}/la/v2/api/ingestion/logs` (techdocs "Set Up Custom Log
60311
+ * Ingestion", 2026-09-01). One flat document per log entry, sent as a JSON
60312
+ * array, authenticated with the same bearer user token as every other tenant
60313
+ * call.
60314
+ *
60315
+ * What the docs do not say, measured on THE_LABORATORY 2026-09-23
60316
+ * (`docs/internal/custom-log-ingestion-probe-2026-09.md`):
60317
+ *
60318
+ * - The gateway answers `200 ok` (text/plain) to everything. A document is
60319
+ * indexed only when its `logtype` is a Support-enabled custom type spelled
60320
+ * without the `cust_` prefix — `opentelemetry` lands in
60321
+ * `*_logs_cust_opentelemetry_*`. `generic`, the parsed-pipeline names,
60322
+ * `cust_`-prefixed spellings and unknown names are dropped silently.
60323
+ * - `tenant_id` must be the dashed upper-case cohort id; the lower-case
60324
+ * dashless form is dropped.
60325
+ * - Send `logseverity` only. `severity` alone derives a lower-case
60326
+ * `logseverity`; both together produce an array.
60327
+ * - `timestamp` must be an epoch-millisecond number; strings are stored as
60328
+ * strings.
60329
+ * - `__`-prefixed fields are stripped; `tag` (not `tags`) is the tag list.
60330
+ * - Documents over 250 KB are dropped silently (no 413).
60331
+ */
60332
+ exports.LogCustomIngest = void 0;
60333
+ (function (LogCustomIngest) {
60334
+ /** Path under `dxGatewayHost`; no cohort segment. */
60335
+ LogCustomIngest.INGESTION_PATH = 'la/v2/api/ingestion/logs';
60336
+ /** Documented ceilings; the platform enforces the first silently. */
60337
+ LogCustomIngest.LIMITS = {
60338
+ maxDocumentBytes: 250_000,
60339
+ maxRequestBytes: 10_000_000,
60340
+ maxUniqueFieldsPerLogtype: 150,
60341
+ };
60342
+ /** Field-name prefixes that pin the index type on first ingestion. */
60343
+ LogCustomIngest.TYPED_FIELD_PREFIXES = ['c_long_', 'c_double_', 'c_timestamp_', 'c_text_'];
60344
+ LogCustomIngest.CustomLogDocumentSchema = v4.z.looseObject({
60345
+ tenant_id: v4.z
60346
+ .string()
60347
+ .min(1)
60348
+ .describe('Cohort id, dashed and upper-case exactly as the profile spells it; other spellings are dropped.'),
60349
+ logtype: v4.z
60350
+ .string()
60351
+ .min(1)
60352
+ .describe('Logtype without the cust_ prefix; the document lands in *_logs_cust_<logtype>_* and only if the tenant has that custom logtype enabled.'),
60353
+ logformat: v4.z.literal('custom').describe('Always "custom".'),
60354
+ timestamp: v4.z
60355
+ .number()
60356
+ .int()
60357
+ .nonnegative()
60358
+ .describe('Event time as epoch milliseconds (a number; strings are stored as strings).'),
60359
+ message: v4.z.string().min(1).describe('The log line.'),
60360
+ logseverity: exports.LogIngest.LogSeveritySchema.describe('Severity, upper-case. The only severity field to send; the field log query filters on.'),
60361
+ host: v4.z.string().optional().describe('Host name the log came from.'),
60362
+ ip: v4.z.string().optional().describe('IP address of that host.'),
60363
+ container_id: v4.z.string().optional().describe('Container or pod id.'),
60364
+ container_name: v4.z.string().optional().describe('Container or service name.'),
60365
+ file: v4.z.string().optional().describe('Source file or logger name; no dot rule on this path.'),
60366
+ tag: v4.z.array(v4.z.string()).optional().describe('Tag list (the API spells it tag, not tags).'),
60367
+ });
60368
+ /**
60369
+ * Names a caller may not use as custom fields on this transport: the
60370
+ * document's own keys, `severity` (derives a second, lower-case
60371
+ * `logseverity`), `tags` (the API spells it `tag`), and anything starting
60372
+ * with `@` (platform meta) or `__` (stripped by the platform).
60373
+ */
60374
+ LogCustomIngest.RESERVED_FIELDS = [
60375
+ ...Object.keys(LogCustomIngest.CustomLogDocumentSchema.shape),
60376
+ 'severity',
60377
+ 'tags',
60378
+ ];
60379
+ function isReservedCustomLogField(name) {
60380
+ const lower = name.toLowerCase();
60381
+ return (LogCustomIngest.RESERVED_FIELDS.some((reserved) => reserved.toLowerCase() === lower) ||
60382
+ name.startsWith('@') ||
60383
+ name.startsWith('__'));
60384
+ }
60385
+ LogCustomIngest.isReservedCustomLogField = isReservedCustomLogField;
60386
+ /**
60387
+ * Thrown when the custom transport is asked to send a logtype the tenant has
60388
+ * not enabled for it. Definitive: the platform would answer `200 ok` and drop
60389
+ * the document, so no retry can help.
60390
+ */
60391
+ class LogtypeNotEnabledError extends Error {
60392
+ logtype;
60393
+ enabled;
60394
+ definitive = true;
60395
+ constructor(logtype, enabled) {
60396
+ super(`logtype '${logtype}' is not enabled for the custom log ingestion API on this tenant ` +
60397
+ `(the platform would accept the document and drop it silently). Enabled custom logtypes: ` +
60398
+ `${enabled.length > 0 ? enabled.join(', ') : 'none'} — see 'dx-do log list-logtypes'. ` +
60399
+ `Use transport=legacy for the uim_logs pipeline, or ask Broadcom Support to enable the logtype.`);
60400
+ this.logtype = logtype;
60401
+ this.enabled = enabled;
60402
+ this.name = 'LogtypeNotEnabledError';
60403
+ }
60404
+ }
60405
+ LogCustomIngest.LogtypeNotEnabledError = LogtypeNotEnabledError;
60406
+ })(exports.LogCustomIngest || (exports.LogCustomIngest = {}));
60407
+
60408
+ /**
60409
+ * Models for the Log Analytics logtype catalog — the two gateway calls the
60410
+ * product's Settings → Log Analytics page makes:
60411
+ *
60412
+ * - `GET oi/loganalytics/v1/api/metric/logtypes` lists every logtype the tenant
60413
+ * has an index for. Each logtype is one index family, `*_logs_<logtype>_*`
60414
+ * (the same list OpenSearch Dashboards keeps as index-pattern saved objects,
60415
+ * which is browser-session only and therefore not reachable from the CLI).
60416
+ * - `GET oi/loganalytics/v1/api/metric/fields/<logtype>` lists the indexed
60417
+ * fields of one logtype with their index type.
60418
+ *
60419
+ * Logtypes ingested through the custom JSON ingestion API are stored under a
60420
+ * `cust_` prefix (`logtype: opentelemetry` lands in `*_logs_cust_opentelemetry_*`);
60421
+ * the parsed pipelines (syslog, log4j, apache_access, …) and the uim_logs
60422
+ * `generic` type keep their bare names. Measured on THE_LABORATORY and
60423
+ * demo-dev, 2026-09-23.
60424
+ */
60425
+ exports.LogTypes = void 0;
60426
+ (function (LogTypes) {
60427
+ /** Prefix the platform gives logtypes created by the custom JSON ingestion API. */
60428
+ LogTypes.CUSTOM_LOGTYPE_PREFIX = 'cust_';
60429
+ LogTypes.LogtypesResponseSchema = v4.z.looseObject({
60430
+ code: v4.z.number().describe('Gateway status code; 200 on success.'),
60431
+ message: v4.z.string().describe("Gateway status text, e.g. 'OK'."),
60432
+ response: v4.z
60433
+ .array(v4.z.string())
60434
+ .describe('Logtype names the tenant has an index for, unordered. Each is one index family `*_logs_<logtype>_*`; names starting with `cust_` were created by the custom JSON ingestion API.'),
60435
+ });
60436
+ LogTypes.LogtypeFieldsResponseSchema = v4.z.looseObject({
60437
+ code: v4.z.number().describe('Gateway status code; 200 on success.'),
60438
+ message: v4.z.string().describe("Gateway status text, e.g. 'OK'."),
60439
+ response: v4.z
60440
+ .record(v4.z.string(), v4.z.string())
60441
+ .describe("Indexed field name → index type for one logtype. Only 'Keyword' has been observed so far; the vocabulary is undocumented and reported verbatim."),
60442
+ });
60443
+ function isCustomLogtype(logtype) {
60444
+ return logtype.startsWith(LogTypes.CUSTOM_LOGTYPE_PREFIX);
60445
+ }
60446
+ LogTypes.isCustomLogtype = isCustomLogtype;
60447
+ /** The `cust_`-prefixed name the platform stores a custom-ingested logtype under. */
60448
+ function customLogtypeName(logtype) {
60449
+ return isCustomLogtype(logtype) ? logtype : `${LogTypes.CUSTOM_LOGTYPE_PREFIX}${logtype}`;
60450
+ }
60451
+ LogTypes.customLogtypeName = customLogtypeName;
60452
+ /** The name without the platform's `cust_` prefix — what a producer passes as `logtype`. */
60453
+ function bareLogtypeName(logtype) {
60454
+ return isCustomLogtype(logtype) ? logtype.slice(LogTypes.CUSTOM_LOGTYPE_PREFIX.length) : logtype;
60455
+ }
60456
+ LogTypes.bareLogtypeName = bareLogtypeName;
60457
+ function indexPatternFor(logtype) {
60458
+ return `*_logs_${logtype}_*`;
60459
+ }
60460
+ LogTypes.indexPatternFor = indexPatternFor;
60461
+ function toRows(logtypes) {
60462
+ return [...new Set(logtypes)]
60463
+ .sort((a, b) => a.localeCompare(b))
60464
+ .map((logtype) => ({
60465
+ logtype,
60466
+ custom: isCustomLogtype(logtype),
60467
+ indexPattern: indexPatternFor(logtype),
60468
+ }));
60469
+ }
60470
+ LogTypes.toRows = toRows;
60471
+ })(exports.LogTypes || (exports.LogTypes = {}));
60472
+
60254
60473
  exports.LogQuery = void 0;
60255
60474
  (function (LogQuery) {
60256
60475
  LogQuery.ValidFieldConditions = [
@@ -60280,7 +60499,8 @@ exports.LogQuery = void 0;
60280
60499
  };
60281
60500
  }
60282
60501
  LogQuery.createOr = createOr;
60283
- function createLogQueryRequestBody(range, ors, severities = [], includes = [
60502
+ /** Fields the filter API returns unless a caller projects more; custom fields need an explicit include. */
60503
+ LogQuery.DEFAULT_INCLUDES = [
60284
60504
  '_id',
60285
60505
  'host',
60286
60506
  'logseverity',
@@ -60288,7 +60508,8 @@ exports.LogQuery = void 0;
60288
60508
  'timestamp',
60289
60509
  'file',
60290
60510
  'message',
60291
- ], size = 1000, sort = [{ sortKey: 'timestamp', sortOrder: 'Asc' }]) {
60511
+ ];
60512
+ function createLogQueryRequestBody(range, ors, severities = [], includes = [...LogQuery.DEFAULT_INCLUDES], size = 1000, sort = [{ sortKey: 'timestamp', sortOrder: 'Asc' }]) {
60292
60513
  const nonEmptySeverities = severities.filter((s) => s.length > 0);
60293
60514
  const severityClause = nonEmptySeverities.length > 0
60294
60515
  ? [
@@ -77280,6 +77501,59 @@ class DxSaasService {
77280
77501
  this.logIngestionURL = derived;
77281
77502
  return derived;
77282
77503
  }
77504
+ /**
77505
+ * Base URL of the host serving the Log Analytics custom JSON ingestion API
77506
+ * (`la/v2/api/ingestion/logs`), without a trailing slash. An explicit
77507
+ * `dxCustomLogIngestionURL` wins; otherwise it is `dxGatewayHost` itself — on
77508
+ * DXO2 SaaS the normal gateway serves the API with the bearer user token, no
77509
+ * separate logs-gateway host and no products lookup (measured on
77510
+ * THE_LABORATORY, 2026-09-23). `dxLogIngestionURL` is deliberately not
77511
+ * consulted: existing profiles set it to the uim_logs logs-gateway. Costs no
77512
+ * network call.
77513
+ *
77514
+ * @throws {@link LogIngest.LogIngestionEndpointError} (definitive) when
77515
+ * neither value parses as a URL.
77516
+ */
77517
+ resolveCustomLogIngestionURL() {
77518
+ const config = this.dxdoConfiguration.dxConfiguration;
77519
+ const candidate = (config.dxCustomLogIngestionURL?.trim() || config.dxGatewayHost || '').replace(/\/+$/, '');
77520
+ try {
77521
+ new URL(candidate);
77522
+ }
77523
+ catch {
77524
+ const profile = this.dxdoConfiguration.configurationFilePath ?? '~/.dxdo/<profile>.dxo2.config.json';
77525
+ throw new exports.LogIngest.LogIngestionEndpointError(`Cannot determine the custom log ingestion endpoint: '${candidate}' is not a parseable URL. ` +
77526
+ `Set "dxGatewayHost" (or "dxCustomLogIngestionURL", no trailing slash) in ${profile}.`, true);
77527
+ }
77528
+ return candidate;
77529
+ }
77530
+ /**
77531
+ * POST to an absolute URL with only `Authorization: Bearer {userToken}` —
77532
+ * the transport for the Log Analytics custom JSON ingestion API, which lives
77533
+ * on the gateway host but outside the cohort-prefixed OI paths. Errors are
77534
+ * mapped like every other call (a {@link SimpleHTTPError} carrying the HTTP
77535
+ * status when the server answered).
77536
+ * @param requestOverrides - Per-call axios settings, see {@link RequestOverrides}.
77537
+ */
77538
+ async bearerPost(url, body, extraHeaders = {}, requestOverrides = {}) {
77539
+ this.log.debug(`bearer posting to: ${url}`);
77540
+ const requestConfig = {
77541
+ ...this.createSimpleUserAuthorizedRequestConfig(undefined),
77542
+ ...requestOverrides,
77543
+ };
77544
+ requestConfig.headers = { ...requestConfig.headers, ...extraHeaders };
77545
+ return this._httpClient
77546
+ .post(url, body, requestConfig)
77547
+ .then((response) => response.data)
77548
+ .catch((reason) => {
77549
+ if (reason.response || reason.request) {
77550
+ throw DxSaasService.handleAxiosError(reason);
77551
+ }
77552
+ else {
77553
+ throw new Error(reason);
77554
+ }
77555
+ });
77556
+ }
77283
77557
  /**
77284
77558
  * POST to the log ingestion gateway without a cohort path segment. The
77285
77559
  * gateway base comes from {@link resolveLogIngestionURL}: an explicit
@@ -82165,6 +82439,160 @@ class JsExtensionService {
82165
82439
  }
82166
82440
  }
82167
82441
 
82442
+ /**
82443
+ * Chunking and retry for log ingestion batches, shared by both transports.
82444
+ * Pure over an injected `post`, so it is unit-testable without a gateway and
82445
+ * independent of `LogsService` (which imports this file, not the reverse).
82446
+ */
82447
+ /** Bytes a value occupies once serialised, as the gateway will count them. */
82448
+ function measureBytes(value) {
82449
+ return Buffer.byteLength(JSON.stringify(value), 'utf8');
82450
+ }
82451
+ /** Greedy chunking by count and bytes, preserving order. */
82452
+ function chunkPayloads(payloads, limits) {
82453
+ const batches = [];
82454
+ const oversized = [];
82455
+ let current = [];
82456
+ let currentBytes = 2; // "[" and "]"
82457
+ payloads.forEach((payload, index) => {
82458
+ const bytes = measureBytes(payload);
82459
+ if (limits.maxDocumentBytes !== undefined && bytes > limits.maxDocumentBytes) {
82460
+ oversized.push(index);
82461
+ return;
82462
+ }
82463
+ const separator = current.length > 0 ? 1 : 0;
82464
+ const wouldBe = currentBytes + separator + bytes;
82465
+ const overCount = current.length >= limits.maxCount;
82466
+ const overBytes = limits.maxRequestBytes !== undefined && current.length > 0 && wouldBe > limits.maxRequestBytes;
82467
+ if (overCount || overBytes) {
82468
+ batches.push(current);
82469
+ current = [];
82470
+ currentBytes = 2;
82471
+ }
82472
+ currentBytes += (current.length > 0 ? 1 : 0) + bytes;
82473
+ current.push(payload);
82474
+ });
82475
+ if (current.length > 0)
82476
+ batches.push(current);
82477
+ return { batches, oversized };
82478
+ }
82479
+ /**
82480
+ * What a failed POST means for the batch: 429 and 5xx are retried, 401/403
82481
+ * stop the run, 413 splits the batch, any other 4xx is a rejection of that
82482
+ * batch, and a failure with no HTTP status (timeout, DNS, reset) is retried.
82483
+ */
82484
+ function classifyIngestionError(error) {
82485
+ const message = error instanceof Error ? error.message : String(error);
82486
+ if (error instanceof SimpleHTTPError || (isObject(error) && error['isHTTPError'] === true)) {
82487
+ const status = Number(error.httpCode);
82488
+ const responseData = error.responseData;
82489
+ if (status === 429 || status >= 500)
82490
+ return { kind: 'retry', status, message, responseData };
82491
+ if (status === 401 || status === 403)
82492
+ return { kind: 'auth', status, message, responseData };
82493
+ if (status === 413)
82494
+ return { kind: 'too-large', status, message, responseData };
82495
+ return { kind: 'rejected', status, message, responseData };
82496
+ }
82497
+ return { kind: 'network', message };
82498
+ }
82499
+ function isObject(value) {
82500
+ return typeof value === 'object' && value !== null;
82501
+ }
82502
+ const DEFAULTS = { attempts: 8, baseMs: 1_000, capMs: 60_000 };
82503
+ /** A cancellable delay: resolves early (without throwing) when the signal aborts. */
82504
+ function sleep(ms, signal) {
82505
+ return new Promise((resolve) => {
82506
+ if (signal?.aborted) {
82507
+ resolve();
82508
+ return;
82509
+ }
82510
+ const timer = setTimeout(done, Math.max(0, ms));
82511
+ function done() {
82512
+ clearTimeout(timer);
82513
+ signal?.removeEventListener('abort', done);
82514
+ resolve();
82515
+ }
82516
+ signal?.addEventListener('abort', done, { once: true });
82517
+ });
82518
+ }
82519
+ /**
82520
+ * Sends batches in order with exponential backoff and jitter on transient
82521
+ * failures. A `too-large` batch of more than one document is split in half
82522
+ * and both halves re-queued in place without consuming an attempt; a single
82523
+ * oversized document is recorded as failed. `auth` stops the run; `rejected`
82524
+ * records the batch and continues.
82525
+ */
82526
+ async function sendWithRetry(post, batches, options = {}) {
82527
+ const attempts = options.attempts ?? DEFAULTS.attempts;
82528
+ const baseMs = options.baseMs ?? DEFAULTS.baseMs;
82529
+ const capMs = options.capMs ?? DEFAULTS.capMs;
82530
+ const random = options.random ?? Math.random;
82531
+ const sleeper = options.sleeper ?? sleep;
82532
+ const queue = batches.map((batch) => [...batch]);
82533
+ const result = { batches: 0, sent: 0, failed: [] };
82534
+ let batchIndex = 0;
82535
+ while (queue.length > 0) {
82536
+ if (options.signal?.aborted) {
82537
+ result.aborted = 'signal';
82538
+ break;
82539
+ }
82540
+ const batch = queue.shift();
82541
+ const index = batchIndex;
82542
+ batchIndex += 1;
82543
+ result.batches += 1;
82544
+ let attempt = 0;
82545
+ let settled = false;
82546
+ while (!settled) {
82547
+ attempt += 1;
82548
+ try {
82549
+ await post(batch);
82550
+ result.sent += batch.length;
82551
+ options.onBatch?.({ batchIndex: index, batches: result.batches + queue.length, count: batch.length, outcome: 'sent', attempt });
82552
+ settled = true;
82553
+ break;
82554
+ }
82555
+ catch (error) {
82556
+ const failure = classifyIngestionError(error);
82557
+ if (failure.kind === 'too-large' && batch.length > 1) {
82558
+ const half = Math.ceil(batch.length / 2);
82559
+ queue.unshift(batch.slice(0, half), batch.slice(half));
82560
+ result.batches -= 1;
82561
+ batchIndex -= 1;
82562
+ options.onBatch?.({ batchIndex: index, batches: result.batches + queue.length, count: batch.length, outcome: 'split', attempt, failure });
82563
+ settled = true;
82564
+ break;
82565
+ }
82566
+ const transient = failure.kind === 'retry' || failure.kind === 'network';
82567
+ const exhausted = attempt >= attempts || options.signal?.aborted === true;
82568
+ if (transient && !exhausted) {
82569
+ const delay = Math.min(capMs, baseMs * 2 ** (attempt - 1));
82570
+ const jitter = Math.floor(random() * (delay / 2));
82571
+ options.onBatch?.({ batchIndex: index, batches: result.batches + queue.length, count: batch.length, outcome: 'retrying', attempt, failure });
82572
+ await sleeper(delay + jitter, options.signal);
82573
+ continue;
82574
+ }
82575
+ result.failed.push({
82576
+ batchIndex: index,
82577
+ count: batch.length,
82578
+ kind: failure.kind,
82579
+ ...(failure.status !== undefined ? { status: failure.status } : {}),
82580
+ message: failure.message,
82581
+ ...(failure.responseData !== undefined ? { responseData: failure.responseData } : {}),
82582
+ attempts: attempt,
82583
+ });
82584
+ options.onBatch?.({ batchIndex: index, batches: result.batches + queue.length, count: batch.length, outcome: 'failed', attempt, failure });
82585
+ settled = true;
82586
+ if (failure.kind === 'auth') {
82587
+ result.aborted = 'auth';
82588
+ queue.length = 0;
82589
+ }
82590
+ }
82591
+ }
82592
+ }
82593
+ return result;
82594
+ }
82595
+
82168
82596
  function detectIPv4() {
82169
82597
  const nets = require$$0$3.networkInterfaces();
82170
82598
  for (const iface of Object.values(nets)) {
@@ -82277,25 +82705,207 @@ function buildUimLogPayload(cohortId, options, additionalFields) {
82277
82705
  ...additionalFields,
82278
82706
  };
82279
82707
  }
82708
+ /** Drops fields the custom API should not see: `""`, `null`, `undefined`, `[]`. `0` and `false` stay. */
82709
+ function dropEmptyFields(fields) {
82710
+ const kept = {};
82711
+ for (const [key, value] of Object.entries(fields)) {
82712
+ if (value === '' || value === null || value === undefined)
82713
+ continue;
82714
+ if (Array.isArray(value) && value.length === 0)
82715
+ continue;
82716
+ kept[key] = value;
82717
+ }
82718
+ return kept;
82719
+ }
82720
+ /**
82721
+ * Builds the flat document the Log Analytics **custom JSON ingestion API**
82722
+ * takes — the `custom` transport's counterpart of {@link buildUimLogPayload},
82723
+ * sharing the option schema and every default so a producer can switch
82724
+ * transports without changing what it passes.
82725
+ *
82726
+ * Differences from the uim_logs document, all measured on THE_LABORATORY
82727
+ * (`docs/internal/custom-log-ingestion-probe-2026-09.md`): `timestamp` is an
82728
+ * epoch-millisecond number; `tenant_id` is the dashed upper-case cohort id;
82729
+ * only `logseverity` is sent (a `severity` field would derive a second,
82730
+ * lower-case copy); the tag list is `tag`; there is no positional parse, so
82731
+ * `file` needs no dot; `agentName`/`agentInstance` travel as `agent_name` /
82732
+ * `agent_instance` only when set (the `__`-prefixed uim names are stripped by
82733
+ * this API); empty-valued custom fields are dropped. The logtype is sent
82734
+ * without the platform's `cust_` prefix, which is how this API spells it.
82735
+ *
82736
+ * @throws ZodError if `options` fails schema validation.
82737
+ * @throws Error if `additionalFields` names a reserved field
82738
+ * ({@link LogIngest.isReservedLogField} or
82739
+ * {@link LogCustomIngest.isReservedCustomLogField}) or `timestamp` is not
82740
+ * ISO 8601.
82741
+ */
82742
+ function buildCustomLogPayload(cohortId, options, additionalFields) {
82743
+ exports.LogIngest.LogIngestOptionsSchema.parse(options);
82744
+ for (const key of Object.keys(additionalFields ?? {})) {
82745
+ if (exports.LogIngest.isReservedLogField(key)) {
82746
+ throw new Error(`additional field '${key}' is reserved: pass severity through the 'severity' option — it is sent as 'logseverity'`);
82747
+ }
82748
+ if (exports.LogCustomIngest.isReservedCustomLogField(key)) {
82749
+ throw new Error(`additional field '${key}' belongs to the custom log document, or is stripped by the platform, and cannot be sent as a custom field`);
82750
+ }
82751
+ }
82752
+ const logtype = exports.LogTypes.bareLogtypeName(orDefault(options.logtype, 'generic'));
82753
+ const host = orDefault(options.host, require$$0$3.hostname());
82754
+ const ip = orDefault(options.ip, detectIPv4());
82755
+ const agentInstance = orDefault(options.agentInstance, 'dx-do');
82756
+ const containerId = orDefault(options.containerId, host);
82757
+ const containerName = orDefault(options.containerName, agentInstance);
82758
+ const file = orDefault(options.file, 'dx-do.cli');
82759
+ const timestamp = options.timestamp ? Date.parse(options.timestamp) : Date.now();
82760
+ if (Number.isNaN(timestamp)) {
82761
+ throw new Error(`timestamp '${options.timestamp}' is not an ISO 8601 date-time`);
82762
+ }
82763
+ const document = {
82764
+ tenant_id: cohortId.toUpperCase(),
82765
+ logtype,
82766
+ logformat: 'custom',
82767
+ timestamp,
82768
+ message: options.message,
82769
+ logseverity: options.severity ?? exports.LogIngest.DEFAULT_LOG_SEVERITY,
82770
+ host,
82771
+ ip,
82772
+ container_id: containerId,
82773
+ container_name: containerName,
82774
+ file,
82775
+ tag: [`${logtype} logs`],
82776
+ ...(options.agentName ? { agent_name: options.agentName } : {}),
82777
+ ...(options.agentInstance ? { agent_instance: options.agentInstance } : {}),
82778
+ ...dropEmptyFields(additionalFields ?? {}),
82779
+ };
82780
+ return exports.LogCustomIngest.CustomLogDocumentSchema.parse(document);
82781
+ }
82782
+ const DEFAULT_BATCH_SIZE = 200;
82280
82783
  /**
82281
82784
  * Service for querying and ingesting log analytics data.
82282
82785
  */
82283
82786
  class LogsService {
82284
82787
  dxSaasService;
82285
- /** @param dxSaasService - DX SaaS HTTP client */
82286
- constructor(dxSaasService) {
82788
+ log;
82789
+ /**
82790
+ * @param dxSaasService - DX SaaS HTTP client
82791
+ * @param log - Logger for response-validation warnings; silent when omitted,
82792
+ * so producers that construct the service themselves keep working.
82793
+ */
82794
+ constructor(dxSaasService, log = new Logging.NullSimpleLog()) {
82287
82795
  this.dxSaasService = dxSaasService;
82796
+ this.log = log;
82288
82797
  }
82289
82798
  /**
82290
- * The full URL log entries are POSTed to: the log gateway resolved by
82291
- * {@link DxSaasService.resolveLogIngestionURL} (an explicit
82292
- * `dxLogIngestionURL`, or the SaaS logs-gateway derived from the region and
82293
- * Log Analytics provisioning) plus the uim_logs ingestion path.
82799
+ * Lists the logtypes the tenant has a log index for — one name per index
82800
+ * family `*_logs_<logtype>_*`. Names starting with `cust_` were created by
82801
+ * the custom JSON ingestion API.
82294
82802
  *
82295
- * @throws Error from `resolveLogIngestionURL` naming why no endpoint could be
82296
- * determined and how to set `dxLogIngestionURL`.
82803
+ * @remarks Response-validated with `safeParse`: a mismatch is logged as a
82804
+ * warning and the raw list is still returned.
82297
82805
  */
82298
- async resolveIngestionEndpoint() {
82806
+ async listLogtypes() {
82807
+ const raw = await this.dxSaasService.oiGet('oi/loganalytics/v1/api/metric/logtypes');
82808
+ const result = exports.LogTypes.LogtypesResponseSchema.safeParse(raw);
82809
+ if (!result.success) {
82810
+ this.log.warn('LogtypesResponse validation warning:', result.error.message);
82811
+ }
82812
+ return raw.response ?? [];
82813
+ }
82814
+ /**
82815
+ * Lists the indexed fields of one logtype with their index type
82816
+ * (`{ host: 'Keyword', logseverity: 'Keyword', … }`).
82817
+ *
82818
+ * @param logtype - A name from {@link listLogtypes}; an unknown logtype is
82819
+ * answered by the gateway, typically with an empty map.
82820
+ * @remarks Response-validated with `safeParse`: a mismatch is logged as a
82821
+ * warning and the raw map is still returned.
82822
+ */
82823
+ async listLogtypeFields(logtype) {
82824
+ const raw = await this.dxSaasService.oiGet(`oi/loganalytics/v1/api/metric/fields/${encodeURIComponent(logtype)}`);
82825
+ const result = exports.LogTypes.LogtypeFieldsResponseSchema.safeParse(raw);
82826
+ if (!result.success) {
82827
+ this.log.warn('LogtypeFieldsResponse validation warning:', result.error.message);
82828
+ }
82829
+ return raw.response ?? {};
82830
+ }
82831
+ enabledCustomLogtypes;
82832
+ /**
82833
+ * The custom logtypes the tenant has enabled for the custom JSON ingestion
82834
+ * API, as `cust_<logtype>` names from {@link listLogtypes}. Memoized per
82835
+ * instance; a failed lookup is not memoized.
82836
+ */
82837
+ customLogtypes() {
82838
+ if (!this.enabledCustomLogtypes) {
82839
+ this.enabledCustomLogtypes = this.listLogtypes()
82840
+ .then((names) => new Set(names.filter((name) => exports.LogTypes.isCustomLogtype(name))))
82841
+ .catch((error) => {
82842
+ this.enabledCustomLogtypes = undefined;
82843
+ throw error;
82844
+ });
82845
+ }
82846
+ return this.enabledCustomLogtypes;
82847
+ }
82848
+ /**
82849
+ * Decides the transport for one logtype.
82850
+ *
82851
+ * Precedence: `requested` (a command's `transport=`), then the profile's
82852
+ * `dxLogIngestionTransport`, then {@link LogIngest.DEFAULT_LOG_INGESTION_TRANSPORT}
82853
+ * (`auto`). `auto` becomes `custom` when the tenant lists `cust_<logtype>`
82854
+ * and `legacy` otherwise; an explicit `custom` for a logtype the tenant has
82855
+ * not enabled is refused, because the platform would accept the document
82856
+ * and drop it silently. If the logtype lookup itself fails, `auto` falls
82857
+ * back to `legacy` with a warning and an explicit `custom` proceeds unchecked.
82858
+ *
82859
+ * @throws Error when `requested` or the profile value is not `auto`,
82860
+ * `custom` or `legacy`.
82861
+ * @throws {@link LogCustomIngest.LogtypeNotEnabledError} for an explicit
82862
+ * `custom` with a logtype the tenant has not enabled.
82863
+ */
82864
+ async resolveTransport(requested, logtype) {
82865
+ const profile = this.dxSaasService.dxdoConfiguration.dxConfiguration.dxLogIngestionTransport;
82866
+ const source = requested ? 'transport argument' : profile ? 'profile dxLogIngestionTransport' : 'default';
82867
+ const candidate = requested ?? profile ?? exports.LogIngest.DEFAULT_LOG_INGESTION_TRANSPORT;
82868
+ const parsed = exports.LogIngest.LogIngestionTransportSchema.safeParse(candidate);
82869
+ if (!parsed.success) {
82870
+ throw new Error(`log ingestion transport '${candidate}' (${source}) is not one of ${exports.LogIngest.LOG_INGESTION_TRANSPORTS.join(', ')}`);
82871
+ }
82872
+ const bare = exports.LogTypes.bareLogtypeName(orDefault(logtype, 'generic'));
82873
+ const wanted = exports.LogTypes.customLogtypeName(bare);
82874
+ if (parsed.data === 'legacy')
82875
+ return 'legacy';
82876
+ let enabled;
82877
+ try {
82878
+ enabled = await this.customLogtypes();
82879
+ }
82880
+ catch (error) {
82881
+ const reason = error instanceof Error ? error.message : String(error);
82882
+ if (parsed.data === 'auto') {
82883
+ this.log.warn(`custom logtype lookup failed (${reason}); using the legacy transport for '${bare}'`);
82884
+ return 'legacy';
82885
+ }
82886
+ this.log.warn(`custom logtype lookup failed (${reason}); sending '${bare}' on the custom transport unchecked`);
82887
+ return 'custom';
82888
+ }
82889
+ if (enabled.has(wanted))
82890
+ return 'custom';
82891
+ if (parsed.data === 'auto')
82892
+ return 'legacy';
82893
+ throw new exports.LogCustomIngest.LogtypeNotEnabledError(bare, [...enabled].map((name) => exports.LogTypes.bareLogtypeName(name)).sort());
82894
+ }
82895
+ /**
82896
+ * The full URL log entries are POSTed to. For `legacy` (the default, so
82897
+ * every existing caller keeps the uim_logs pipeline): the log gateway
82898
+ * resolved by {@link DxSaasService.resolveLogIngestionURL} plus the uim_logs
82899
+ * path. For `custom`: {@link DxSaasService.resolveCustomLogIngestionURL}
82900
+ * plus `la/v2/api/ingestion/logs`.
82901
+ *
82902
+ * @throws {@link LogIngest.LogIngestionEndpointError} naming why no endpoint
82903
+ * could be determined and how to set `dxLogIngestionURL`.
82904
+ */
82905
+ async resolveIngestionEndpoint(transport = 'legacy') {
82906
+ if (transport === 'custom') {
82907
+ return `${this.dxSaasService.resolveCustomLogIngestionURL()}/${exports.LogCustomIngest.INGESTION_PATH}`;
82908
+ }
82299
82909
  return `${await this.dxSaasService.resolveLogIngestionURL()}/${UIM_LOGS_INGESTION_PATH}`;
82300
82910
  }
82301
82911
  /** Executes a log query against the OI log analytics filter API. */
@@ -82312,32 +82922,117 @@ class LogsService {
82312
82922
  * @param additionalFields - Arbitrary extra fields to include in the indexed
82313
82923
  * document. `severity` and `logseverity` (any letter case) are refused:
82314
82924
  * severity travels through `options.severity` and is emitted as `logseverity`.
82315
- * @returns The payload object ready to POST to the uim_logs ingestion endpoint.
82925
+ * @param transport - `legacy` (default) builds the uim_logs document via
82926
+ * {@link buildUimLogPayload}; `custom` builds the flat document via
82927
+ * {@link buildCustomLogPayload}.
82928
+ * @returns The payload object ready to POST to that transport's endpoint.
82316
82929
  * @throws ZodError if `options` fails schema validation.
82317
82930
  * @throws Error if `additionalFields` names a reserved field.
82318
82931
  */
82319
- buildLogPayload(options, additionalFields) {
82320
- return buildUimLogPayload(this.dxSaasService.dxdoConfiguration.dxConfiguration.cohortId, options, additionalFields);
82932
+ buildLogPayload(options, additionalFields, transport = 'legacy') {
82933
+ const cohortId = this.dxSaasService.dxdoConfiguration.dxConfiguration.cohortId;
82934
+ return transport === 'custom'
82935
+ ? buildCustomLogPayload(cohortId, options, additionalFields)
82936
+ : buildUimLogPayload(cohortId, options, additionalFields);
82321
82937
  }
82322
82938
  /**
82323
- * Ingests a single log entry into the log gateway.
82939
+ * Ingests a single log entry.
82324
82940
  *
82325
- * @remarks The gateway returns an opaque ingestion acknowledgement with no
82326
- * stable schema, so the response is intentionally typed `unknown` and not
82327
- * validated. `options` is validated by {@link buildLogPayload}.
82941
+ * @remarks Both gateways return an opaque acknowledgement with no stable
82942
+ * schema (the custom API answers a plain-text `ok`), so the response is
82943
+ * intentionally typed `unknown` and not validated. `options` is validated
82944
+ * by {@link buildLogPayload}. No logtype gate is applied here — use
82945
+ * {@link resolveTransport} first, or {@link ingestLogBatch}, which does.
82946
+ * @param transport - `legacy` (default) posts to the uim_logs pipeline;
82947
+ * `custom` to the custom JSON ingestion API.
82328
82948
  */
82329
- ingestLog(options, additionalFields) {
82330
- return this.dxSaasService.logPost(UIM_LOGS_INGESTION_PATH, [this.buildLogPayload(options, additionalFields)]);
82949
+ ingestLog(options, additionalFields, transport = 'legacy') {
82950
+ return this.post(transport, [this.buildLogPayload(options, additionalFields, transport)]);
82331
82951
  }
82332
82952
  /**
82333
- * Ingests a batch of log entries into the log gateway.
82953
+ * Ingests a batch of log entries into the uim_logs log gateway in one POST —
82954
+ * no chunking, no retry.
82334
82955
  *
82956
+ * @deprecated Use {@link ingestLogBatch}, which chunks, retries and reports
82957
+ * per batch on either transport.
82335
82958
  * @remarks Each entry's `options` is validated by {@link buildLogPayload}.
82336
82959
  * The gateway response is an opaque ack (typed `unknown`, not validated).
82337
82960
  */
82338
82961
  ingestLogs(entries) {
82339
82962
  return this.dxSaasService.logPost(UIM_LOGS_INGESTION_PATH, entries.map((e) => this.buildLogPayload(e.options, e.additionalFields)));
82340
82963
  }
82964
+ /**
82965
+ * Ingests many log entries: decides the transport (see
82966
+ * {@link resolveTransport}), builds every document first so a bad entry
82967
+ * fails before anything is sent, chunks by count (and, on the custom
82968
+ * transport, by the 10 MB request and 250 KB document ceilings), and sends
82969
+ * the batches in order with exponential backoff on 429/5xx/network
82970
+ * failures. A 4xx rejection records the batch and continues; a 401/403
82971
+ * stops the run.
82972
+ *
82973
+ * @throws Error naming the entry index when a document cannot be built.
82974
+ * @throws {@link LogCustomIngest.LogtypeNotEnabledError} for an explicit
82975
+ * `custom` transport with a logtype the tenant has not enabled.
82976
+ * @throws Error when entries carry logtypes that `auto` would route to
82977
+ * different transports — pass `transport` explicitly then.
82978
+ */
82979
+ async ingestLogBatch(entries, options = {}) {
82980
+ const logtypes = [...new Set(entries.map((e) => orDefault(e.options.logtype, 'generic')))];
82981
+ const decided = new Set();
82982
+ for (const logtype of logtypes.length > 0 ? logtypes : ['generic']) {
82983
+ decided.add(await this.resolveTransport(options.transport, logtype));
82984
+ }
82985
+ if (decided.size > 1) {
82986
+ throw new Error(`entries mix logtypes that route to different transports (${logtypes.join(', ')}); pass transport=custom or transport=legacy explicitly`);
82987
+ }
82988
+ const transport = [...decided][0] ?? 'legacy';
82989
+ const endpoint = await this.resolveIngestionEndpoint(transport);
82990
+ const payloads = entries.map((entry, index) => {
82991
+ try {
82992
+ return this.buildLogPayload(entry.options, entry.additionalFields, transport);
82993
+ }
82994
+ catch (error) {
82995
+ const reason = error instanceof Error ? error.message : String(error);
82996
+ throw new Error(`entry ${index}: ${reason}`);
82997
+ }
82998
+ });
82999
+ const batchSize = options.batchSize ?? DEFAULT_BATCH_SIZE;
83000
+ const { batches, oversized } = chunkPayloads(payloads, {
83001
+ maxCount: batchSize,
83002
+ ...(transport === 'custom'
83003
+ ? {
83004
+ maxRequestBytes: exports.LogCustomIngest.LIMITS.maxRequestBytes,
83005
+ maxDocumentBytes: exports.LogCustomIngest.LIMITS.maxDocumentBytes,
83006
+ }
83007
+ : {}),
83008
+ });
83009
+ const overrides = {
83010
+ ...(options.timeoutMs !== undefined ? { timeout: options.timeoutMs } : {}),
83011
+ ...(options.signal !== undefined ? { signal: options.signal } : {}),
83012
+ };
83013
+ const sent = await sendWithRetry((batch) => this.post(transport, batch, overrides), batches, {
83014
+ ...(options.retry ?? {}),
83015
+ ...(options.signal !== undefined ? { signal: options.signal } : {}),
83016
+ ...(options.onBatch !== undefined ? { onBatch: options.onBatch } : {}),
83017
+ });
83018
+ return {
83019
+ transport,
83020
+ endpoint,
83021
+ entries: entries.length,
83022
+ batches: sent.batches,
83023
+ sent: sent.sent,
83024
+ failed: sent.failed,
83025
+ oversized,
83026
+ ...(sent.aborted !== undefined ? { aborted: sent.aborted } : {}),
83027
+ };
83028
+ }
83029
+ async post(transport, payloads, overrides = {}) {
83030
+ if (transport === 'custom') {
83031
+ const endpoint = await this.resolveIngestionEndpoint('custom');
83032
+ return this.dxSaasService.bearerPost(endpoint, payloads, {}, overrides);
83033
+ }
83034
+ return this.dxSaasService.logPost(UIM_LOGS_INGESTION_PATH, payloads, overrides);
83035
+ }
82341
83036
  }
82342
83037
 
82343
83038
  /**
@@ -86392,7 +87087,7 @@ function createServiceMonolith(dxDoConfiguration, log = new NullSimpleLog()) {
86392
87087
  dxGraphService: new GraphService(dxSaaSService),
86393
87088
  dxInventoryService: new InventoryService(dxSaaSService, dxNASSService, dxTASService, log),
86394
87089
  dxJSExtensionService: new JsExtensionService(dxSaaSService),
86395
- dxLogsService: new LogsService(dxSaaSService),
87090
+ dxLogsService: new LogsService(dxSaaSService, log),
86396
87091
  dxMaintenanceService: new MaintenanceService(dxSaaSService, log),
86397
87092
  dxManagementModuleService: dxManagementModuleService,
86398
87093
  dxMetricBatchService: new MetricBatchService(dxSaaSService),
@@ -87025,6 +87720,7 @@ exports.buildAlarmQueueFilterExpression = buildAlarmQueueFilterExpression;
87025
87720
  exports.buildAlarmQueueUpdateBody = buildAlarmQueueUpdateBody;
87026
87721
  exports.buildAlertEntry = buildAlertEntry;
87027
87722
  exports.buildClusteringPolicyUpdateBody = buildClusteringPolicyUpdateBody;
87723
+ exports.buildCustomLogPayload = buildCustomLogPayload;
87028
87724
  exports.buildEnrichmentRuleUpdateBody = buildEnrichmentRuleUpdateBody;
87029
87725
  exports.buildInventoryCustomFilter = buildInventoryCustomFilter;
87030
87726
  exports.buildInventoryQueueUpdateBody = buildInventoryQueueUpdateBody;
@@ -87035,6 +87731,8 @@ exports.buildTemplateRefs = buildTemplateRefs;
87035
87731
  exports.buildUimLogPayload = buildUimLogPayload;
87036
87732
  exports.capVertexDetail = capVertexDetail;
87037
87733
  exports.checkGet = checkGet;
87734
+ exports.chunkPayloads = chunkPayloads;
87735
+ exports.classifyIngestionError = classifyIngestionError;
87038
87736
  exports.composeMetricTypeBits = composeMetricTypeBits;
87039
87737
  exports.contactActivate = contactActivate;
87040
87738
  exports.contactDelete = contactDelete;
@@ -87146,6 +87844,7 @@ exports.maintenancesImmediateDelete = maintenancesImmediateDelete;
87146
87844
  exports.maintenancesImmediatePut = maintenancesImmediatePut;
87147
87845
  exports.maintenancesPostWindows = maintenancesPostWindows;
87148
87846
  exports.maintenancesUpdate = maintenancesUpdate;
87847
+ exports.measureBytes = measureBytes;
87149
87848
  exports.messageGet = messageGet;
87150
87849
  exports.messageTemplateVariables = messageTemplateVariables;
87151
87850
  exports.messagesList = messagesList;
@@ -87191,11 +87890,13 @@ exports.resolveEnrichmentMappings = resolveEnrichmentMappings;
87191
87890
  exports.resolveWebhookPayload = resolveWebhookPayload;
87192
87891
  exports.sampleServiceDetailRequestBody = sampleServiceDetailRequestBody;
87193
87892
  exports.searchUniverse = searchUniverse;
87893
+ exports.sendWithRetry = sendWithRetry;
87194
87894
  exports.serviceDetailResponseBody = serviceDetailResponseBody;
87195
87895
  exports.settingsGet = settingsGet;
87196
87896
  exports.settingsGetDetail = settingsGetDetail;
87197
87897
  exports.settingsUpdate = settingsUpdate;
87198
87898
  exports.sharedRoleDelta = sharedRoleDelta;
87899
+ exports.sleep = sleep;
87199
87900
  exports.sliHumanName = sliHumanName;
87200
87901
  exports.sloTripletFor = sloTripletFor;
87201
87902
  exports.sortRulesByPriority = sortRulesByPriority;