@camunda8/orchestration-cluster-api 1.1.4 → 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-7HDBRIEN.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",
@@ -8846,6 +8846,7 @@ function hydrateConfig(options = {}) {
8846
8846
  provided[k] = baseEnv[k].trim();
8847
8847
  }
8848
8848
  }
8849
+ const userSetStrategy = provided["CAMUNDA_AUTH_STRATEGY"] !== void 0 && provided["CAMUNDA_AUTH_STRATEGY"].trim() !== "";
8849
8850
  const parseErrors = [];
8850
8851
  function boolParserFactory(key) {
8851
8852
  return (v) => {
@@ -8910,6 +8911,12 @@ function hydrateConfig(options = {}) {
8910
8911
  if (envInput["CAMUNDA_SUPPORT_LOG_ENABLED"] === void 0 && envInput["CAMUNDA_SUPPORT_LOGGER"] !== void 0) {
8911
8912
  envInput["CAMUNDA_SUPPORT_LOG_ENABLED"] = envInput["CAMUNDA_SUPPORT_LOGGER"];
8912
8913
  }
8914
+ if (envInput["CAMUNDA_REST_ADDRESS"] === void 0 && baseEnv["ZEEBE_REST_ADDRESS"] !== void 0 && baseEnv["ZEEBE_REST_ADDRESS"].trim() !== "") {
8915
+ envInput["CAMUNDA_REST_ADDRESS"] = baseEnv["ZEEBE_REST_ADDRESS"].trim();
8916
+ }
8917
+ if ((envInput["CAMUNDA_AUTH_STRATEGY"] === void 0 || envInput["CAMUNDA_AUTH_STRATEGY"].trim() === "") && envInput["CAMUNDA_OAUTH_URL"] !== void 0 && envInput["CAMUNDA_OAUTH_URL"].trim() !== "" && envInput["CAMUNDA_CLIENT_ID"] !== void 0 && envInput["CAMUNDA_CLIENT_ID"].trim() !== "" && envInput["CAMUNDA_CLIENT_SECRET"] !== void 0 && envInput["CAMUNDA_CLIENT_SECRET"].trim() !== "") {
8918
+ envInput["CAMUNDA_AUTH_STRATEGY"] = "OAUTH";
8919
+ }
8913
8920
  let envTyped = {};
8914
8921
  envTyped = (0, import_typed_env.createEnv)(typedEnvSchema, { env: envInput });
8915
8922
  for (const k of allKeys()) {
@@ -8923,6 +8930,9 @@ function hydrateConfig(options = {}) {
8923
8930
  rawMap[k] = String(entry.default);
8924
8931
  }
8925
8932
  }
8933
+ if (!userSetStrategy && rawMap["CAMUNDA_AUTH_STRATEGY"] === "NONE" && rawMap["CAMUNDA_OAUTH_URL"] && rawMap["CAMUNDA_OAUTH_URL"].trim() !== "" && rawMap["CAMUNDA_CLIENT_ID"] && rawMap["CAMUNDA_CLIENT_ID"].trim() !== "" && rawMap["CAMUNDA_CLIENT_SECRET"] && rawMap["CAMUNDA_CLIENT_SECRET"].trim() !== "") {
8934
+ rawMap["CAMUNDA_AUTH_STRATEGY"] = "OAUTH";
8935
+ }
8926
8936
  const authStrategyRaw = (rawMap["CAMUNDA_AUTH_STRATEGY"] || "NONE").toString();
8927
8937
  const authStrategy = authStrategyRaw.trim().toUpperCase();
8928
8938
  if (!["NONE", "OAUTH", "BASIC"].includes(authStrategy)) {
@@ -9478,7 +9488,8 @@ var ORDER = {
9478
9488
  warn: 2,
9479
9489
  info: 3,
9480
9490
  debug: 4,
9481
- trace: 5
9491
+ trace: 5,
9492
+ silly: 6
9482
9493
  };
9483
9494
  function createLogger(opts = {}) {
9484
9495
  let currentLevel = opts.level || "error";
@@ -9532,6 +9543,7 @@ function createLogger(opts = {}) {
9532
9543
  info: (...a) => emit("info", scope, a),
9533
9544
  debug: (...a) => emit("debug", scope, a),
9534
9545
  trace: (...a) => emit("trace", scope, a),
9546
+ silly: (...a) => emit("silly", scope, a),
9535
9547
  scope(child) {
9536
9548
  return make(scope ? `${scope}:${child}` : child);
9537
9549
  },
@@ -9543,7 +9555,7 @@ function createLogger(opts = {}) {
9543
9555
  }
9544
9556
 
9545
9557
  // src/runtime/version.ts
9546
- var packageVersion = "1.1.4";
9558
+ var packageVersion = "1.2.0";
9547
9559
 
9548
9560
  // src/runtime/supportLogger.ts
9549
9561
  var NoopSupportLogger = class {
@@ -9744,6 +9756,46 @@ function wrapFetch(orig, opts) {
9744
9756
  const requestId = "r" + (++globalRequestCounter).toString(36);
9745
9757
  const correlationId = opts.correlation ? opts.correlation() : void 0;
9746
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
+ }
9747
9799
  const startEvt = {
9748
9800
  type: "http.start",
9749
9801
  ts: start,
@@ -9756,6 +9808,11 @@ function wrapFetch(orig, opts) {
9756
9808
  try {
9757
9809
  hooks?.beforeRequest?.(startEvt);
9758
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
+ }
9759
9816
  } catch {
9760
9817
  }
9761
9818
  try {
@@ -9777,6 +9834,44 @@ function wrapFetch(orig, opts) {
9777
9834
  mirrorLog(endEvt);
9778
9835
  } catch {
9779
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
+ }
9780
9875
  try {
9781
9876
  const opName = `${endEvt.method} ${endEvt.url}`;
9782
9877
  opts.supportLogger?.log(
@@ -10795,7 +10890,7 @@ var CamundaClient = class {
10795
10890
  });
10796
10891
  } else if (
10797
10892
  // Auto-enable mirror telemetry when trace level and user did not explicitly set CAMUNDA_SDK_TELEMETRY_LOG to a disabling value.
10798
- 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
10799
10894
  this._overrides["CAMUNDA_SDK_TELEMETRY_LOG"] === void 0 && // And env var either absent or truthy enabling value
10800
10895
  (typeof process === "undefined" || process.env["CAMUNDA_SDK_TELEMETRY_LOG"] === void 0 || /^(1|true|yes|on)$/i.test(process.env["CAMUNDA_SDK_TELEMETRY_LOG"] || ""))
10801
10896
  ) {
@@ -10812,6 +10907,12 @@ var CamundaClient = class {
10812
10907
  fetch: this._fetch,
10813
10908
  throwOnError: opts.throwOnError !== false
10814
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
+ }
10815
10916
  installAuthInterceptor(
10816
10917
  this._client,
10817
10918
  () => this._config.auth.strategy,
@@ -10890,7 +10991,7 @@ var CamundaClient = class {
10890
10991
  supportLogger: this._supportLogger,
10891
10992
  mirrorToLog: true
10892
10993
  });
10893
- } 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"] || ""))) {
10894
10995
  this._fetch = wrapFetch(this._fetch || fetch, {
10895
10996
  hooks: void 0,
10896
10997
  correlation: this._config.telemetry?.correlation ? () => getCorrelation() : void 0,