@camunda8/orchestration-cluster-api 1.1.5 → 1.2.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.
@@ -1,3 +1,3 @@
1
- export { h as CamundaFpClient, qn as DomainError, E as Either, qm as Fpify, qo as Left, qp as Right, qv as TaskEither, qu as classifyDomainError, g as createCamundaFpClient, qs as eventuallyTE, qt as foldDomainError, i as isLeft, j as isRight, qq as retryTE, qr as withTimeoutTE } from '../index-BnjuGPVo.cjs';
1
+ export { h as CamundaFpClient, qn as DomainError, E as Either, qm as Fpify, qo as Left, qp as Right, qv as TaskEither, qu as classifyDomainError, g as createCamundaFpClient, qs as eventuallyTE, qt as foldDomainError, i as isLeft, j as isRight, qq as retryTE, qr as withTimeoutTE } from '../index-BuqEi2vm.cjs';
2
2
  import 'zod';
3
3
  import '../logger.cjs';
@@ -1,3 +1,3 @@
1
- export { h as CamundaFpClient, qn as DomainError, E as Either, qm as Fpify, qo as Left, qp as Right, qv as TaskEither, qu as classifyDomainError, g as createCamundaFpClient, qs as eventuallyTE, qt as foldDomainError, i as isLeft, j as isRight, qq as retryTE, qr as withTimeoutTE } from '../index-D8wWCwUU.js';
1
+ export { h as CamundaFpClient, qn as DomainError, E as Either, qm as Fpify, qo as Left, qp as Right, qv as TaskEither, qu as classifyDomainError, g as createCamundaFpClient, qs as eventuallyTE, qt as foldDomainError, i as isLeft, j as isRight, qq as retryTE, qr as withTimeoutTE } from '../index-CICj2gu5.js';
2
2
  import 'zod';
3
3
  import '../logger.js';
package/dist/fp/index.js CHANGED
@@ -7,8 +7,8 @@ import {
7
7
  isRight,
8
8
  retryTE,
9
9
  withTimeoutTE
10
- } from "../chunk-IXOWDFIB.js";
11
- import "../chunk-IEZVLX66.js";
10
+ } from "../chunk-7RIALC7K.js";
11
+ import "../chunk-W6JB7JZH.js";
12
12
  export {
13
13
  classifyDomainError,
14
14
  createCamundaFpClient,
@@ -110,9 +110,9 @@ declare const SCHEMA: {
110
110
  };
111
111
  readonly CAMUNDA_SDK_LOG_LEVEL: {
112
112
  readonly type: "enum";
113
- readonly choices: readonly ["silent", "error", "warn", "info", "debug", "trace"];
113
+ readonly choices: readonly ["silent", "error", "warn", "info", "debug", "trace", "silly"];
114
114
  readonly default: "error";
115
- readonly doc: "SDK log level.";
115
+ readonly doc: "SDK log level. \"silly\" adds unsafe deep diagnostics including HTTP request and response bodies.";
116
116
  };
117
117
  readonly CAMUNDA_SDK_TELEMETRY_LOG: {
118
118
  readonly type: "boolean";
@@ -110,9 +110,9 @@ declare const SCHEMA: {
110
110
  };
111
111
  readonly CAMUNDA_SDK_LOG_LEVEL: {
112
112
  readonly type: "enum";
113
- readonly choices: readonly ["silent", "error", "warn", "info", "debug", "trace"];
113
+ readonly choices: readonly ["silent", "error", "warn", "info", "debug", "trace", "silly"];
114
114
  readonly default: "error";
115
- readonly doc: "SDK log level.";
115
+ readonly doc: "SDK log level. \"silly\" adds unsafe deep diagnostics including HTTP request and response bodies.";
116
116
  };
117
117
  readonly CAMUNDA_SDK_TELEMETRY_LOG: {
118
118
  readonly type: "boolean";
package/dist/index.cjs CHANGED
@@ -8616,9 +8616,9 @@ var SCHEMA = {
8616
8616
  },
8617
8617
  CAMUNDA_SDK_LOG_LEVEL: {
8618
8618
  type: "enum",
8619
- choices: ["silent", "error", "warn", "info", "debug", "trace"],
8619
+ choices: ["silent", "error", "warn", "info", "debug", "trace", "silly"],
8620
8620
  default: "error",
8621
- doc: "SDK log level."
8621
+ doc: 'SDK log level. "silly" adds unsafe deep diagnostics including HTTP request and response bodies.'
8622
8622
  },
8623
8623
  CAMUNDA_SDK_TELEMETRY_LOG: {
8624
8624
  type: "boolean",
@@ -9488,7 +9488,8 @@ var ORDER = {
9488
9488
  warn: 2,
9489
9489
  info: 3,
9490
9490
  debug: 4,
9491
- trace: 5
9491
+ trace: 5,
9492
+ silly: 6
9492
9493
  };
9493
9494
  function createLogger(opts = {}) {
9494
9495
  let currentLevel = opts.level || "error";
@@ -9542,6 +9543,7 @@ function createLogger(opts = {}) {
9542
9543
  info: (...a) => emit("info", scope, a),
9543
9544
  debug: (...a) => emit("debug", scope, a),
9544
9545
  trace: (...a) => emit("trace", scope, a),
9546
+ silly: (...a) => emit("silly", scope, a),
9545
9547
  scope(child) {
9546
9548
  return make(scope ? `${scope}:${child}` : child);
9547
9549
  },
@@ -9553,7 +9555,7 @@ function createLogger(opts = {}) {
9553
9555
  }
9554
9556
 
9555
9557
  // src/runtime/version.ts
9556
- var packageVersion = "1.1.5";
9558
+ var packageVersion = "1.2.0";
9557
9559
 
9558
9560
  // src/runtime/supportLogger.ts
9559
9561
  var NoopSupportLogger = class {
@@ -9754,6 +9756,46 @@ function wrapFetch(orig, opts) {
9754
9756
  const requestId = "r" + (++globalRequestCounter).toString(36);
9755
9757
  const correlationId = opts.correlation ? opts.correlation() : void 0;
9756
9758
  const start = Date.now();
9759
+ let bodyPreview;
9760
+ try {
9761
+ const lvl = logger?.level?.();
9762
+ if (lvl === "silly" && (method === "POST" || method === "PUT" || method === "PATCH")) {
9763
+ let body = init?.body;
9764
+ if (body === void 0 && typeof Request !== "undefined" && input instanceof Request) {
9765
+ try {
9766
+ body = await input.clone().text();
9767
+ } catch {
9768
+ body = void 0;
9769
+ }
9770
+ }
9771
+ if (body !== void 0 && body !== null) {
9772
+ if (typeof body === "string") bodyPreview = body;
9773
+ else if (body instanceof URLSearchParams) bodyPreview = body.toString();
9774
+ else if (typeof FormData !== "undefined" && body instanceof FormData) {
9775
+ const entries = [];
9776
+ for (const [k, v] of body.entries()) {
9777
+ entries.push(`${k}=${typeof v === "string" ? v.slice(0, 200) : "[File]"}`);
9778
+ }
9779
+ bodyPreview = entries.join("&");
9780
+ } else if (body instanceof Blob) {
9781
+ bodyPreview = `[Blob size=${body.size}]`;
9782
+ } else if (body instanceof ArrayBuffer) {
9783
+ bodyPreview = `[ArrayBuffer byteLength=${body.byteLength}]`;
9784
+ } else if (body instanceof Uint8Array) {
9785
+ bodyPreview = `[Uint8Array length=${body.length}]`;
9786
+ } else if (typeof body === "object") {
9787
+ try {
9788
+ bodyPreview = JSON.stringify(body).slice(0, 4e3);
9789
+ } catch {
9790
+ bodyPreview = "[Unstringifiable object body]";
9791
+ }
9792
+ }
9793
+ if (bodyPreview && bodyPreview.length > 4e3)
9794
+ bodyPreview = bodyPreview.slice(0, 4e3) + "\u2026";
9795
+ }
9796
+ }
9797
+ } catch {
9798
+ }
9757
9799
  const startEvt = {
9758
9800
  type: "http.start",
9759
9801
  ts: start,
@@ -9766,6 +9808,11 @@ function wrapFetch(orig, opts) {
9766
9808
  try {
9767
9809
  hooks?.beforeRequest?.(startEvt);
9768
9810
  mirrorLog(startEvt);
9811
+ if (bodyPreview && logger?.level?.() === "silly") {
9812
+ logger.silly(() => [
9813
+ `op=${method} ${redactedUrl} http.body requestId=${requestId} size=${bodyPreview.length} preview=${bodyPreview}`
9814
+ ]);
9815
+ }
9769
9816
  } catch {
9770
9817
  }
9771
9818
  try {
@@ -9787,6 +9834,44 @@ function wrapFetch(orig, opts) {
9787
9834
  mirrorLog(endEvt);
9788
9835
  } catch {
9789
9836
  }
9837
+ try {
9838
+ if (logger?.level?.() === "silly") {
9839
+ let respPreview;
9840
+ const cloned = res.clone();
9841
+ const ctype = cloned.headers.get("Content-Type") || "";
9842
+ let originalSize;
9843
+ if (/^(application\/json|text\/)/i.test(ctype)) {
9844
+ try {
9845
+ const text = await cloned.text();
9846
+ originalSize = text.length;
9847
+ respPreview = text.slice(0, 4e3);
9848
+ if (text.length > 4e3) respPreview += "\u2026";
9849
+ } catch {
9850
+ respPreview = void 0;
9851
+ }
9852
+ } else if (/multipart\//i.test(ctype)) {
9853
+ respPreview = "[multipart body omitted]";
9854
+ } else if (/octet-stream|binary/i.test(ctype)) {
9855
+ respPreview = "[binary body omitted]";
9856
+ } else {
9857
+ try {
9858
+ const text = await cloned.text();
9859
+ if (text) {
9860
+ originalSize = text.length;
9861
+ respPreview = text.slice(0, 200);
9862
+ if (text.length > 200) respPreview += "\u2026";
9863
+ }
9864
+ } catch {
9865
+ }
9866
+ }
9867
+ if (respPreview) {
9868
+ logger.silly(() => [
9869
+ `op=${method} ${redactedUrl} http.response requestId=${requestId} status=${res.status} size=${originalSize} preview=${respPreview}`
9870
+ ]);
9871
+ }
9872
+ }
9873
+ } catch {
9874
+ }
9790
9875
  try {
9791
9876
  const opName = `${endEvt.method} ${endEvt.url}`;
9792
9877
  opts.supportLogger?.log(
@@ -10805,7 +10890,7 @@ var CamundaClient = class {
10805
10890
  });
10806
10891
  } else if (
10807
10892
  // Auto-enable mirror telemetry when trace level and user did not explicitly set CAMUNDA_SDK_TELEMETRY_LOG to a disabling value.
10808
- this._log.level() === "trace" && !this._config.telemetry?.log && // No explicit override provided
10893
+ /^(trace|silly)$/.test(this._log.level()) && !this._config.telemetry?.log && // No explicit override provided
10809
10894
  this._overrides["CAMUNDA_SDK_TELEMETRY_LOG"] === void 0 && // And env var either absent or truthy enabling value
10810
10895
  (typeof process === "undefined" || process.env["CAMUNDA_SDK_TELEMETRY_LOG"] === void 0 || /^(1|true|yes|on)$/i.test(process.env["CAMUNDA_SDK_TELEMETRY_LOG"] || ""))
10811
10896
  ) {
@@ -10822,6 +10907,12 @@ var CamundaClient = class {
10822
10907
  fetch: this._fetch,
10823
10908
  throwOnError: opts.throwOnError !== false
10824
10909
  });
10910
+ if (this._log.level() === "silly") {
10911
+ this._log.warn(
10912
+ "log.level.silly.enabled",
10913
+ "HTTP request and response bodies will be logged; this may leak sensitive information. Use only for local debugging."
10914
+ );
10915
+ }
10825
10916
  installAuthInterceptor(
10826
10917
  this._client,
10827
10918
  () => this._config.auth.strategy,
@@ -10900,7 +10991,7 @@ var CamundaClient = class {
10900
10991
  supportLogger: this._supportLogger,
10901
10992
  mirrorToLog: true
10902
10993
  });
10903
- } else if (this._log.level() === "trace" && !this._config.telemetry?.log && this._overrides["CAMUNDA_SDK_TELEMETRY_LOG"] === void 0 && (typeof process === "undefined" || process.env["CAMUNDA_SDK_TELEMETRY_LOG"] === void 0 || /^(1|true|yes|on)$/i.test(process.env["CAMUNDA_SDK_TELEMETRY_LOG"] || ""))) {
10994
+ } else if (/^(trace|silly)$/.test(this._log.level()) && !this._config.telemetry?.log && this._overrides["CAMUNDA_SDK_TELEMETRY_LOG"] === void 0 && (typeof process === "undefined" || process.env["CAMUNDA_SDK_TELEMETRY_LOG"] === void 0 || /^(1|true|yes|on)$/i.test(process.env["CAMUNDA_SDK_TELEMETRY_LOG"] || ""))) {
10904
10995
  this._fetch = wrapFetch(this._fetch || fetch, {
10905
10996
  hooks: void 0,
10906
10997
  correlation: this._config.telemetry?.correlation ? () => getCorrelation() : void 0,