@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.cjs.js
CHANGED
|
@@ -35599,6 +35599,29 @@ function urlExpression(entry) {
|
|
|
35599
35599
|
}
|
|
35600
35600
|
return shellQuote(url);
|
|
35601
35601
|
}
|
|
35602
|
+
/**
|
|
35603
|
+
* Path for a request's comment line. When the URL was built from host+cohort
|
|
35604
|
+
* the cohort segment is dropped, so the tenant appears exactly once in the
|
|
35605
|
+
* file — the `$DXDO_COHORT` assignment — and retargeting never leaves a
|
|
35606
|
+
* stale id behind in a comment.
|
|
35607
|
+
*/
|
|
35608
|
+
function commentPath(entry) {
|
|
35609
|
+
const url = entry.requestConfig.url ?? '';
|
|
35610
|
+
let pathname;
|
|
35611
|
+
try {
|
|
35612
|
+
pathname = new URL(url).pathname;
|
|
35613
|
+
}
|
|
35614
|
+
catch {
|
|
35615
|
+
return url;
|
|
35616
|
+
}
|
|
35617
|
+
const { gatewayHost, cohortId } = entry;
|
|
35618
|
+
if (gatewayHost && cohortId && url.startsWith(`${gatewayHost}${cohortId}`)) {
|
|
35619
|
+
const prefix = `/${cohortId}`;
|
|
35620
|
+
if (pathname.startsWith(prefix))
|
|
35621
|
+
return pathname.slice(prefix.length) || '/';
|
|
35622
|
+
}
|
|
35623
|
+
return pathname;
|
|
35624
|
+
}
|
|
35602
35625
|
function urlWithParams(entry) {
|
|
35603
35626
|
const url = entry.requestConfig.url ?? '';
|
|
35604
35627
|
const params = entry.requestConfig.params;
|
|
@@ -35630,8 +35653,10 @@ function bodyOf(entry) {
|
|
|
35630
35653
|
*
|
|
35631
35654
|
* The tenant is real, not a placeholder — that is what makes the output
|
|
35632
35655
|
* runnable without a dx-do config — but it reaches the URL through
|
|
35633
|
-
* `$DXDO_HOST`/`$DXDO_COHORT`, assigned once at the top of the script
|
|
35634
|
-
*
|
|
35656
|
+
* `$DXDO_HOST`/`$DXDO_COHORT`, assigned once at the top of the script, where
|
|
35657
|
+
* `$DXDO_COHORT` accepts either spelling of the cohort id and normalizes to
|
|
35658
|
+
* the lowercase, dash-free form URLs use. The bearer token is referenced
|
|
35659
|
+
* through `$DXDO_TOKEN` unless `includeToken` is set.
|
|
35635
35660
|
*/
|
|
35636
35661
|
function createCurlCommand(entry, options = {}) {
|
|
35637
35662
|
const method = (entry.requestConfig.method ?? 'get').toUpperCase();
|
|
@@ -35704,7 +35729,8 @@ function createCurlScript(entries, options = {}) {
|
|
|
35704
35729
|
// not placeholders — the script runs as-is.
|
|
35705
35730
|
const target = entries.find((e) => e.gatewayHost && e.cohortId);
|
|
35706
35731
|
if (target) {
|
|
35707
|
-
|
|
35732
|
+
const V = CURL_COHORT_VAR;
|
|
35733
|
+
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; }', '');
|
|
35708
35734
|
const mixed = entries.some((e) => e.gatewayHost && e.cohortId &&
|
|
35709
35735
|
(e.gatewayHost !== target.gatewayHost || e.cohortId !== target.cohortId));
|
|
35710
35736
|
if (mixed) {
|
|
@@ -35712,16 +35738,8 @@ function createCurlScript(entries, options = {}) {
|
|
|
35712
35738
|
}
|
|
35713
35739
|
}
|
|
35714
35740
|
const body = entries.map((entry, i) => {
|
|
35715
|
-
const path = (() => {
|
|
35716
|
-
try {
|
|
35717
|
-
return new URL(entry.requestConfig.url ?? '').pathname;
|
|
35718
|
-
}
|
|
35719
|
-
catch {
|
|
35720
|
-
return entry.requestConfig.url ?? '';
|
|
35721
|
-
}
|
|
35722
|
-
})();
|
|
35723
35741
|
return [
|
|
35724
|
-
`# --- ${i + 1}/${entries.length} ${entry.command} ${
|
|
35742
|
+
`# --- ${i + 1}/${entries.length} ${entry.command} ${commentPath(entry)}`,
|
|
35725
35743
|
createCurlCommand(entry, options),
|
|
35726
35744
|
'',
|
|
35727
35745
|
].join('\n');
|
|
@@ -70697,46 +70715,55 @@ const coerce$1 = (version, options) => {
|
|
|
70697
70715
|
};
|
|
70698
70716
|
var coerce_1 = coerce$1;
|
|
70699
70717
|
|
|
70700
|
-
|
|
70701
|
-
|
|
70702
|
-
this.max = 1000;
|
|
70703
|
-
this.map = new Map();
|
|
70704
|
-
}
|
|
70718
|
+
var lrucache;
|
|
70719
|
+
var hasRequiredLrucache;
|
|
70705
70720
|
|
|
70706
|
-
|
|
70707
|
-
|
|
70708
|
-
|
|
70709
|
-
return undefined
|
|
70710
|
-
} else {
|
|
70711
|
-
// Remove the key from the map and add it to the end
|
|
70712
|
-
this.map.delete(key);
|
|
70713
|
-
this.map.set(key, value);
|
|
70714
|
-
return value
|
|
70715
|
-
}
|
|
70716
|
-
}
|
|
70721
|
+
function requireLrucache () {
|
|
70722
|
+
if (hasRequiredLrucache) return lrucache;
|
|
70723
|
+
hasRequiredLrucache = 1;
|
|
70717
70724
|
|
|
70718
|
-
|
|
70719
|
-
|
|
70720
|
-
|
|
70725
|
+
class LRUCache {
|
|
70726
|
+
constructor () {
|
|
70727
|
+
this.max = 1000;
|
|
70728
|
+
this.map = new Map();
|
|
70729
|
+
}
|
|
70721
70730
|
|
|
70722
|
-
|
|
70723
|
-
|
|
70731
|
+
get (key) {
|
|
70732
|
+
const value = this.map.get(key);
|
|
70733
|
+
if (value === undefined) {
|
|
70734
|
+
return undefined
|
|
70735
|
+
} else {
|
|
70736
|
+
// Remove the key from the map and add it to the end
|
|
70737
|
+
this.map.delete(key);
|
|
70738
|
+
this.map.set(key, value);
|
|
70739
|
+
return value
|
|
70740
|
+
}
|
|
70741
|
+
}
|
|
70724
70742
|
|
|
70725
|
-
|
|
70726
|
-
|
|
70727
|
-
|
|
70728
|
-
const firstKey = this.map.keys().next().value;
|
|
70729
|
-
this.delete(firstKey);
|
|
70730
|
-
}
|
|
70743
|
+
delete (key) {
|
|
70744
|
+
return this.map.delete(key)
|
|
70745
|
+
}
|
|
70731
70746
|
|
|
70732
|
-
|
|
70733
|
-
|
|
70747
|
+
set (key, value) {
|
|
70748
|
+
const deleted = this.delete(key);
|
|
70734
70749
|
|
|
70735
|
-
|
|
70736
|
-
|
|
70737
|
-
|
|
70750
|
+
if (!deleted && value !== undefined) {
|
|
70751
|
+
// If cache is full, delete the least recently used item
|
|
70752
|
+
if (this.map.size >= this.max) {
|
|
70753
|
+
const firstKey = this.map.keys().next().value;
|
|
70754
|
+
this.delete(firstKey);
|
|
70755
|
+
}
|
|
70756
|
+
|
|
70757
|
+
this.map.set(key, value);
|
|
70758
|
+
}
|
|
70738
70759
|
|
|
70739
|
-
|
|
70760
|
+
return this
|
|
70761
|
+
}
|
|
70762
|
+
}
|
|
70763
|
+
|
|
70764
|
+
lrucache = LRUCache;
|
|
70765
|
+
return lrucache;
|
|
70766
|
+
}
|
|
70740
70767
|
|
|
70741
70768
|
var range;
|
|
70742
70769
|
var hasRequiredRange;
|
|
@@ -70959,7 +70986,7 @@ function requireRange () {
|
|
|
70959
70986
|
|
|
70960
70987
|
range = Range;
|
|
70961
70988
|
|
|
70962
|
-
const LRU =
|
|
70989
|
+
const LRU = requireLrucache();
|
|
70963
70990
|
const cache = new LRU();
|
|
70964
70991
|
|
|
70965
70992
|
const parseOptions = parseOptions_1;
|