@dx-do/client 7.5.0 → 7.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.esm.js CHANGED
@@ -35577,6 +35577,29 @@ function urlExpression(entry) {
35577
35577
  }
35578
35578
  return shellQuote(url);
35579
35579
  }
35580
+ /**
35581
+ * Path for a request's comment line. When the URL was built from host+cohort
35582
+ * the cohort segment is dropped, so the tenant appears exactly once in the
35583
+ * file — the `$DXDO_COHORT` assignment — and retargeting never leaves a
35584
+ * stale id behind in a comment.
35585
+ */
35586
+ function commentPath(entry) {
35587
+ const url = entry.requestConfig.url ?? '';
35588
+ let pathname;
35589
+ try {
35590
+ pathname = new URL(url).pathname;
35591
+ }
35592
+ catch {
35593
+ return url;
35594
+ }
35595
+ const { gatewayHost, cohortId } = entry;
35596
+ if (gatewayHost && cohortId && url.startsWith(`${gatewayHost}${cohortId}`)) {
35597
+ const prefix = `/${cohortId}`;
35598
+ if (pathname.startsWith(prefix))
35599
+ return pathname.slice(prefix.length) || '/';
35600
+ }
35601
+ return pathname;
35602
+ }
35580
35603
  function urlWithParams(entry) {
35581
35604
  const url = entry.requestConfig.url ?? '';
35582
35605
  const params = entry.requestConfig.params;
@@ -35608,8 +35631,10 @@ function bodyOf(entry) {
35608
35631
  *
35609
35632
  * The tenant is real, not a placeholder — that is what makes the output
35610
35633
  * runnable without a dx-do config — but it reaches the URL through
35611
- * `$DXDO_HOST`/`$DXDO_COHORT`, assigned once at the top of the script. The
35612
- * bearer token is referenced through `$DXDO_TOKEN` unless `includeToken` is set.
35634
+ * `$DXDO_HOST`/`$DXDO_COHORT`, assigned once at the top of the script, where
35635
+ * `$DXDO_COHORT` accepts either spelling of the cohort id and normalizes to
35636
+ * the lowercase, dash-free form URLs use. The bearer token is referenced
35637
+ * through `$DXDO_TOKEN` unless `includeToken` is set.
35613
35638
  */
35614
35639
  function createCurlCommand(entry, options = {}) {
35615
35640
  const method = (entry.requestConfig.method ?? 'get').toUpperCase();
@@ -35682,7 +35707,8 @@ function createCurlScript(entries, options = {}) {
35682
35707
  // not placeholders — the script runs as-is.
35683
35708
  const target = entries.find((e) => e.gatewayHost && e.cohortId);
35684
35709
  if (target) {
35685
- header.push(`${CURL_HOST_VAR}=${shellQuote(target.gatewayHost)}`, `${CURL_COHORT_VAR}=${shellQuote(target.cohortId)}`, '');
35710
+ const V = CURL_COHORT_VAR;
35711
+ header.push(`${CURL_HOST_VAR}=${shellQuote(target.gatewayHost)}`, `# ${V} takes the cohort id in either form — dashed uppercase as the`, `# DXO2 UI shows it, or the 32-character lowercase form URLs use; it is`, `# normalized and checked below, so paste whichever you have.`, `${V}=${shellQuote(target.cohortId)}`, `${V}=$(printf '%s' "$${V}" | tr -d '-' | tr '[:upper:]' '[:lower:]')`, `case "$${V}" in *[!0-9a-f]*|'') echo "${V} is not a cohort id: '$${V}'" >&2; exit 2;; esac`, '[ "${#' + V + '}" -eq 32 ] || { echo "' + V + ' must be 32 hex characters after normalization, got ${#' + V + '}" >&2; exit 2; }', '');
35686
35712
  const mixed = entries.some((e) => e.gatewayHost && e.cohortId &&
35687
35713
  (e.gatewayHost !== target.gatewayHost || e.cohortId !== target.cohortId));
35688
35714
  if (mixed) {
@@ -35690,16 +35716,8 @@ function createCurlScript(entries, options = {}) {
35690
35716
  }
35691
35717
  }
35692
35718
  const body = entries.map((entry, i) => {
35693
- const path = (() => {
35694
- try {
35695
- return new URL(entry.requestConfig.url ?? '').pathname;
35696
- }
35697
- catch {
35698
- return entry.requestConfig.url ?? '';
35699
- }
35700
- })();
35701
35719
  return [
35702
- `# --- ${i + 1}/${entries.length} ${entry.command} ${path}`,
35720
+ `# --- ${i + 1}/${entries.length} ${entry.command} ${commentPath(entry)}`,
35703
35721
  createCurlCommand(entry, options),
35704
35722
  '',
35705
35723
  ].join('\n');
@@ -70675,46 +70693,55 @@ const coerce$1 = (version, options) => {
70675
70693
  };
70676
70694
  var coerce_1 = coerce$1;
70677
70695
 
70678
- class LRUCache {
70679
- constructor () {
70680
- this.max = 1000;
70681
- this.map = new Map();
70682
- }
70696
+ var lrucache;
70697
+ var hasRequiredLrucache;
70683
70698
 
70684
- get (key) {
70685
- const value = this.map.get(key);
70686
- if (value === undefined) {
70687
- return undefined
70688
- } else {
70689
- // Remove the key from the map and add it to the end
70690
- this.map.delete(key);
70691
- this.map.set(key, value);
70692
- return value
70693
- }
70694
- }
70699
+ function requireLrucache () {
70700
+ if (hasRequiredLrucache) return lrucache;
70701
+ hasRequiredLrucache = 1;
70695
70702
 
70696
- delete (key) {
70697
- return this.map.delete(key)
70698
- }
70703
+ class LRUCache {
70704
+ constructor () {
70705
+ this.max = 1000;
70706
+ this.map = new Map();
70707
+ }
70699
70708
 
70700
- set (key, value) {
70701
- const deleted = this.delete(key);
70709
+ get (key) {
70710
+ const value = this.map.get(key);
70711
+ if (value === undefined) {
70712
+ return undefined
70713
+ } else {
70714
+ // Remove the key from the map and add it to the end
70715
+ this.map.delete(key);
70716
+ this.map.set(key, value);
70717
+ return value
70718
+ }
70719
+ }
70702
70720
 
70703
- if (!deleted && value !== undefined) {
70704
- // If cache is full, delete the least recently used item
70705
- if (this.map.size >= this.max) {
70706
- const firstKey = this.map.keys().next().value;
70707
- this.delete(firstKey);
70708
- }
70721
+ delete (key) {
70722
+ return this.map.delete(key)
70723
+ }
70709
70724
 
70710
- this.map.set(key, value);
70711
- }
70725
+ set (key, value) {
70726
+ const deleted = this.delete(key);
70712
70727
 
70713
- return this
70714
- }
70715
- }
70728
+ if (!deleted && value !== undefined) {
70729
+ // If cache is full, delete the least recently used item
70730
+ if (this.map.size >= this.max) {
70731
+ const firstKey = this.map.keys().next().value;
70732
+ this.delete(firstKey);
70733
+ }
70734
+
70735
+ this.map.set(key, value);
70736
+ }
70716
70737
 
70717
- var lrucache = LRUCache;
70738
+ return this
70739
+ }
70740
+ }
70741
+
70742
+ lrucache = LRUCache;
70743
+ return lrucache;
70744
+ }
70718
70745
 
70719
70746
  var range;
70720
70747
  var hasRequiredRange;
@@ -70937,7 +70964,7 @@ function requireRange () {
70937
70964
 
70938
70965
  range = Range;
70939
70966
 
70940
- const LRU = lrucache;
70967
+ const LRU = requireLrucache();
70941
70968
  const cache = new LRU();
70942
70969
 
70943
70970
  const parseOptions = parseOptions_1;