@postman-cse/onboarding-repo-sync 2.4.2 → 2.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/cli.cjs CHANGED
@@ -42722,14 +42722,14 @@ var require_description = __commonJS({
42722
42722
  var z = __importStar(require_mini());
42723
42723
  var metadata_1 = require_metadata();
42724
42724
  var MAX_CONTENT_LENGTH = 1e6;
42725
- function truncate2(value) {
42725
+ function truncate3(value) {
42726
42726
  return value.length > MAX_CONTENT_LENGTH ? value.slice(0, MAX_CONTENT_LENGTH) : value;
42727
42727
  }
42728
42728
  exports2.Description = (0, schemas_1.model)(z.union([
42729
- z.pipe(z.string(), z.transform(truncate2)),
42729
+ z.pipe(z.string(), z.transform(truncate3)),
42730
42730
  z.null(),
42731
42731
  z.object({
42732
- content: z.pipe(z.optional(z.string()), z.transform((value) => truncate2(value ?? ""))),
42732
+ content: z.pipe(z.optional(z.string()), z.transform((value) => truncate3(value ?? ""))),
42733
42733
  type: z.optional(z.string()),
42734
42734
  version: z.optional(z.unknown())
42735
42735
  })
@@ -57955,7 +57955,7 @@ var require_lodash = __commonJS({
57955
57955
  var strSymbols = stringToArray(string), start = charsStartIndex(strSymbols, stringToArray(chars));
57956
57956
  return castSlice(strSymbols, start).join("");
57957
57957
  }
57958
- function truncate2(string, options) {
57958
+ function truncate3(string, options) {
57959
57959
  var length = DEFAULT_TRUNC_LENGTH, omission = DEFAULT_TRUNC_OMISSION;
57960
57960
  if (isObject(options)) {
57961
57961
  var separator = "separator" in options ? options.separator : separator;
@@ -58515,7 +58515,7 @@ var require_lodash = __commonJS({
58515
58515
  lodash.trim = trim;
58516
58516
  lodash.trimEnd = trimEnd;
58517
58517
  lodash.trimStart = trimStart;
58518
- lodash.truncate = truncate2;
58518
+ lodash.truncate = truncate3;
58519
58519
  lodash.unescape = unescape2;
58520
58520
  lodash.uniqueId = uniqueId;
58521
58521
  lodash.upperCase = upperCase;
@@ -95746,10 +95746,10 @@ var require_unicode = __commonJS({
95746
95746
  module2.exports.isLineTerminatorJSON = function isLineTerminatorJSON(x) {
95747
95747
  return x === "\n" || x === "\r";
95748
95748
  };
95749
- module2.exports.isIdentifierStart = function isIdentifierStart(x) {
95749
+ module2.exports.isIdentifierStart = function isIdentifierStart2(x) {
95750
95750
  return x === "$" || x === "_" || x >= "A" && x <= "Z" || x >= "a" && x <= "z" || x >= "\x80" && Uni.NonAsciiIdentifierStart.test(x);
95751
95751
  };
95752
- module2.exports.isIdentifierPart = function isIdentifierPart(x) {
95752
+ module2.exports.isIdentifierPart = function isIdentifierPart2(x) {
95753
95753
  return x === "$" || x === "_" || x >= "A" && x <= "Z" || x >= "a" && x <= "z" || x >= "0" && x <= "9" || x >= "\x80" && Uni.NonAsciiIdentifierPart.test(x);
95754
95754
  };
95755
95755
  module2.exports.NonAsciiIdentifierStart = /[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u0527\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u08A0\u08A2-\u08AC\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0977\u0979-\u097F\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C33\u0C35-\u0C39\u0C3D\u0C58\u0C59\u0C60\u0C61\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D60\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F4\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F0\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191C\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19C1-\u19C7\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FCC\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA697\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA78E\uA790-\uA793\uA7A0-\uA7AA\uA7F8-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA80-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uABC0-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]/;
@@ -118663,7 +118663,7 @@ var require_truncate = __commonJS({
118663
118663
  function isLowSurrogate(codePoint) {
118664
118664
  return codePoint >= 56320 && codePoint <= 57343;
118665
118665
  }
118666
- module2.exports = function truncate2(getLength, string, byteLength) {
118666
+ module2.exports = function truncate3(getLength, string, byteLength) {
118667
118667
  if (typeof string !== "string") {
118668
118668
  throw new Error("Input must be string");
118669
118669
  }
@@ -118694,9 +118694,9 @@ var require_truncate = __commonJS({
118694
118694
  var require_truncate_utf8_bytes = __commonJS({
118695
118695
  "node_modules/truncate-utf8-bytes/index.js"(exports2, module2) {
118696
118696
  "use strict";
118697
- var truncate2 = require_truncate();
118697
+ var truncate3 = require_truncate();
118698
118698
  var getLength = Buffer.byteLength.bind(Buffer);
118699
- module2.exports = truncate2.bind(null, getLength);
118699
+ module2.exports = truncate3.bind(null, getLength);
118700
118700
  }
118701
118701
  });
118702
118702
 
@@ -132414,7 +132414,9 @@ function buildCiWorkflowLines(installUrl, postmanRegion, privateMockAuth) {
132414
132414
  ` POSTMAN_CLI_INSTALL_URL: ${installUrl}`,
132415
132415
  ' run: curl -fsSL "$POSTMAN_CLI_INSTALL_URL" | sh',
132416
132416
  " - name: Login to Postman CLI",
132417
- " run: postman login --with-api-key ${{ secrets.POSTMAN_API_KEY }}" + (postmanRegion === "eu" ? " --region eu" : ""),
132417
+ " env:",
132418
+ " POSTMAN_API_KEY: ${{ secrets.POSTMAN_API_KEY }}",
132419
+ ' run: postman login --with-api-key "$POSTMAN_API_KEY"' + (postmanRegion === "eu" ? " --region eu" : ""),
132418
132420
  " - name: Resolve Postman Resource IDs",
132419
132421
  " run: |",
132420
132422
  " ruby <<'RUBY'",
@@ -132453,12 +132455,13 @@ function buildCiWorkflowLines(installUrl, postmanRegion, privateMockAuth) {
132453
132455
  " - name: Run Smoke Tests",
132454
132456
  " env:",
132455
132457
  " POSTMAN_SSL_CLIENT_PASSPHRASE: ${{ secrets.POSTMAN_SSL_CLIENT_PASSPHRASE }}",
132458
+ ...privateMockAuth ? [" POSTMAN_API_KEY: ${{ secrets.POSTMAN_API_KEY }}"] : [],
132456
132459
  " run: |",
132457
132460
  ' CMD=(postman collection run "$POSTMAN_SMOKE_COLLECTION_UID"',
132458
132461
  ' -e "$POSTMAN_ENVIRONMENT_UID"',
132459
132462
  " --report-events",
132460
132463
  ` --env-var "CI_ENVIRONMENT=\${{ vars.CI_ENVIRONMENT || 'Production' }}")`,
132461
- ...privateMockAuth ? [' CMD+=(--env-var "' + PRIVATE_MOCK_AUTH_VARIABLE + '=${{ secrets.POSTMAN_API_KEY }}")'] : [],
132464
+ ...privateMockAuth ? [' CMD+=(--env-var "' + PRIVATE_MOCK_AUTH_VARIABLE + '=$POSTMAN_API_KEY")'] : [],
132462
132465
  ' if [ -f "$RUNNER_TEMP/postman-ssl/client.crt" ]; then',
132463
132466
  ' CMD+=(--ssl-client-cert "$RUNNER_TEMP/postman-ssl/client.crt"',
132464
132467
  ' --ssl-client-key "$RUNNER_TEMP/postman-ssl/client.key")',
@@ -132473,12 +132476,13 @@ function buildCiWorkflowLines(installUrl, postmanRegion, privateMockAuth) {
132473
132476
  " - name: Run Contract Tests",
132474
132477
  " env:",
132475
132478
  " POSTMAN_SSL_CLIENT_PASSPHRASE: ${{ secrets.POSTMAN_SSL_CLIENT_PASSPHRASE }}",
132479
+ ...privateMockAuth ? [" POSTMAN_API_KEY: ${{ secrets.POSTMAN_API_KEY }}"] : [],
132476
132480
  " run: |",
132477
132481
  ' CMD=(postman collection run "$POSTMAN_CONTRACT_COLLECTION_UID"',
132478
132482
  ' -e "$POSTMAN_ENVIRONMENT_UID"',
132479
132483
  " --report-events",
132480
132484
  ` --env-var "CI_ENVIRONMENT=\${{ vars.CI_ENVIRONMENT || 'Production' }}")`,
132481
- ...privateMockAuth ? [' CMD+=(--env-var "' + PRIVATE_MOCK_AUTH_VARIABLE + '=${{ secrets.POSTMAN_API_KEY }}")'] : [],
132485
+ ...privateMockAuth ? [' CMD+=(--env-var "' + PRIVATE_MOCK_AUTH_VARIABLE + '=$POSTMAN_API_KEY")'] : [],
132482
132486
  ' if [ -f "$RUNNER_TEMP/postman-ssl/client.crt" ]; then',
132483
132487
  ' CMD+=(--ssl-client-cert "$RUNNER_TEMP/postman-ssl/client.crt"',
132484
132488
  ' --ssl-client-key "$RUNNER_TEMP/postman-ssl/client.key")',
@@ -132505,7 +132509,9 @@ function buildAdoWindowsCollectionRunLines(displayName, collectionEnvironmentNam
132505
132509
  ` $collectionUid = $env:${collectionEnvironmentName}`,
132506
132510
  " $ciEnvironment = Resolve-AdoOptional $env:CI_ENVIRONMENT",
132507
132511
  " if ([string]::IsNullOrWhiteSpace($ciEnvironment)) { $ciEnvironment = 'Production' }",
132508
- ` $arguments = @('collection', 'run', $collectionUid, '-e', $env:POSTMAN_ENVIRONMENT_UID, '--report-events', '--env-var', "CI_ENVIRONMENT=$ciEnvironment")`,
132512
+ " $responseTimeThreshold = Resolve-AdoOptional $env:RESPONSE_TIME_THRESHOLD",
132513
+ " if ([string]::IsNullOrWhiteSpace($responseTimeThreshold)) { $responseTimeThreshold = '10000' }",
132514
+ ` $arguments = @('collection', 'run', $collectionUid, '-e', $env:POSTMAN_ENVIRONMENT_UID, '--report-events', '--env-var', "CI_ENVIRONMENT=$ciEnvironment", '--env-var', "RESPONSE_TIME_THRESHOLD=$responseTimeThreshold")`,
132509
132515
  ...privateMockAuth ? [` $arguments += @('--env-var', "${PRIVATE_MOCK_AUTH_VARIABLE}=$env:POSTMAN_API_KEY")`] : [],
132510
132516
  " $sslRoot = Join-Path $env:AGENT_TEMPDIRECTORY 'postman-ssl'",
132511
132517
  " $clientCert = Join-Path $sslRoot 'client.crt'",
@@ -132528,6 +132534,7 @@ function buildAdoWindowsCollectionRunLines(displayName, collectionEnvironmentNam
132528
132534
  ` ${collectionEnvironmentName}: $(${collectionEnvironmentName})`,
132529
132535
  " POSTMAN_ENVIRONMENT_UID: $(POSTMAN_ENVIRONMENT_UID)",
132530
132536
  " CI_ENVIRONMENT: $(CI_ENVIRONMENT)",
132537
+ " RESPONSE_TIME_THRESHOLD: $(RESPONSE_TIME_THRESHOLD)",
132531
132538
  " POSTMAN_SSL_CLIENT_PASSPHRASE: $(POSTMAN_SSL_CLIENT_PASSPHRASE)",
132532
132539
  ...privateMockAuth ? [" POSTMAN_API_KEY: $(POSTMAN_API_KEY)"] : []
132533
132540
  ];
@@ -133297,7 +133304,7 @@ function detectRepoContext(input, env = process.env) {
133297
133304
  };
133298
133305
  }
133299
133306
 
133300
- // node_modules/@postman-cse/automation-telemetry-core/dist/ci-context.js
133307
+ // node_modules/@postman-cse/automation-core/dist/ci-context.js
133301
133308
  function norm(value) {
133302
133309
  const trimmed = (value ?? "").trim();
133303
133310
  return trimmed.length > 0 ? trimmed : void 0;
@@ -133448,7 +133455,7 @@ function detectCiProviderContext(env = process.env) {
133448
133455
  return { ciProvider: "unknown", runnerKind: "unknown" };
133449
133456
  }
133450
133457
 
133451
- // node_modules/@postman-cse/automation-telemetry-core/dist/repo-context.js
133458
+ // node_modules/@postman-cse/automation-core/dist/repo-context.js
133452
133459
  function normalize2(value) {
133453
133460
  const trimmed = (value ?? "").trim();
133454
133461
  return trimmed.length > 0 ? trimmed : void 0;
@@ -133537,7 +133544,7 @@ function detectRepoContext2(input, env = process.env) {
133537
133544
  };
133538
133545
  }
133539
133546
 
133540
- // node_modules/@postman-cse/automation-telemetry-core/dist/telemetry.js
133547
+ // node_modules/@postman-cse/automation-core/dist/telemetry.js
133541
133548
  var import_node_crypto = require("node:crypto");
133542
133549
  var import_undici2 = __toESM(require_undici(), 1);
133543
133550
  var SCHEMA_VERSION = 3;
@@ -133547,10 +133554,14 @@ var proxyDispatcher;
133547
133554
  function getProxyDispatcher() {
133548
133555
  return proxyDispatcher ??= new import_undici2.EnvHttpProxyAgent();
133549
133556
  }
133550
- function resolveActionVersion(explicit) {
133557
+ function resolveActionVersion(explicit, env = process.env) {
133551
133558
  if (explicit) {
133552
133559
  return explicit;
133553
133560
  }
133561
+ const ref = env.GITHUB_ACTION_REF?.trim();
133562
+ if (ref) {
133563
+ return ref;
133564
+ }
133554
133565
  return typeof __ACTION_VERSION__ !== "undefined" && __ACTION_VERSION__ ? __ACTION_VERSION__ : "unknown";
133555
133566
  }
133556
133567
  function telemetryDisabled(env) {
@@ -133633,7 +133644,7 @@ async function send(event, options) {
133633
133644
  function createTelemetryContext(options) {
133634
133645
  const env = options.env ?? process.env;
133635
133646
  const now = options.now ?? Date.now;
133636
- const actionVersion = resolveActionVersion(options.actionVersion);
133647
+ const actionVersion = resolveActionVersion(options.actionVersion, env);
133637
133648
  let teamId = "";
133638
133649
  let accountType = "unknown";
133639
133650
  let emitted = false;
@@ -133673,6 +133684,229 @@ function createTelemetryContext(options) {
133673
133684
  };
133674
133685
  }
133675
133686
 
133687
+ // node_modules/@postman-cse/automation-core/dist/logger.js
133688
+ var LEVEL_ORDER = {
133689
+ debug: 10,
133690
+ info: 20,
133691
+ warning: 30,
133692
+ error: 40
133693
+ };
133694
+ function defaultCorrelationId() {
133695
+ return Math.random().toString(36).slice(2, 10);
133696
+ }
133697
+ function resolveLogLevel(env = process.env) {
133698
+ const explicit = String(env.POSTMAN_ACTIONS_LOG_LEVEL ?? "").trim().toLowerCase();
133699
+ if (explicit === "debug" || explicit === "trace" || explicit === "verbose")
133700
+ return "debug";
133701
+ if (explicit === "info")
133702
+ return "info";
133703
+ if (explicit === "warn" || explicit === "warning")
133704
+ return "warning";
133705
+ if (explicit === "error" || explicit === "quiet")
133706
+ return "error";
133707
+ if (isTruthyFlag(env.RUNNER_DEBUG) || isTruthyFlag(env.ACTIONS_STEP_DEBUG))
133708
+ return "debug";
133709
+ if (isTruthyFlag(env.POSTMAN_ACTIONS_DEBUG))
133710
+ return "debug";
133711
+ return "info";
133712
+ }
133713
+ function isTruthyFlag(value) {
133714
+ if (!value)
133715
+ return false;
133716
+ const flag = value.trim().toLowerCase();
133717
+ return flag === "1" || flag === "true" || flag === "yes" || flag === "on";
133718
+ }
133719
+ function actionSink(core) {
133720
+ return {
133721
+ debug: (message) => core.debug?.(message),
133722
+ info: (message) => core.info(message),
133723
+ warning: (message) => (core.warning ?? core.info)(message),
133724
+ error: (message) => (core.error ?? core.warning ?? core.info)(message),
133725
+ startGroup: core.startGroup ? (name) => core.startGroup?.(name) : void 0,
133726
+ endGroup: core.endGroup ? () => core.endGroup?.() : void 0,
133727
+ isDebug: core.isDebug ? () => core.isDebug?.() ?? false : void 0
133728
+ };
133729
+ }
133730
+ var MIN_SECRET_LENGTH = 4;
133731
+ function renderValue(value, maxLength = 512) {
133732
+ if (value === void 0)
133733
+ return "undefined";
133734
+ if (value === null)
133735
+ return "null";
133736
+ if (typeof value === "string")
133737
+ return truncate(value, maxLength);
133738
+ if (typeof value === "number" || typeof value === "boolean" || typeof value === "bigint") {
133739
+ return String(value);
133740
+ }
133741
+ if (value instanceof Error)
133742
+ return truncate(describeError(value), maxLength);
133743
+ if (Array.isArray(value)) {
133744
+ return truncate(`[${value.map((entry) => renderValue(entry, 120)).join(", ")}]`, maxLength);
133745
+ }
133746
+ try {
133747
+ return truncate(JSON.stringify(value) ?? String(value), maxLength);
133748
+ } catch {
133749
+ return "<unserializable>";
133750
+ }
133751
+ }
133752
+ function truncate(text, maxLength) {
133753
+ if (text.length <= maxLength)
133754
+ return text;
133755
+ return `${text.slice(0, maxLength)}\u2026 (+${text.length - maxLength} chars)`;
133756
+ }
133757
+ function describeError(error, maxDepth = 5) {
133758
+ const parts = [];
133759
+ let current = error;
133760
+ let depth = 0;
133761
+ while (current !== void 0 && current !== null && depth < maxDepth) {
133762
+ if (current instanceof Error) {
133763
+ const code = current.code;
133764
+ parts.push(code ? `${current.name}[${code}]: ${current.message}` : `${current.name}: ${current.message}`);
133765
+ current = current.cause;
133766
+ } else if (typeof current === "object") {
133767
+ try {
133768
+ parts.push(JSON.stringify(current) ?? String(current));
133769
+ } catch {
133770
+ parts.push(String(current));
133771
+ }
133772
+ current = void 0;
133773
+ } else {
133774
+ parts.push(String(current));
133775
+ current = void 0;
133776
+ }
133777
+ depth += 1;
133778
+ }
133779
+ if (parts.length === 0)
133780
+ return "unknown error";
133781
+ return parts.join(" <- caused by ");
133782
+ }
133783
+ function createLogger(options) {
133784
+ const env = options.env ?? process.env;
133785
+ const level = options.level ?? resolveLogLevel(env);
133786
+ const secrets = options.secrets ?? /* @__PURE__ */ new Set();
133787
+ const correlationId = options.correlationId ?? defaultCorrelationId();
133788
+ const now = options.now ?? (() => Date.now());
133789
+ const threshold = LEVEL_ORDER[level];
133790
+ function addSecret(value) {
133791
+ if (typeof value !== "string")
133792
+ return;
133793
+ const trimmed = value.trim();
133794
+ if (trimmed.length < MIN_SECRET_LENGTH)
133795
+ return;
133796
+ secrets.add(trimmed);
133797
+ }
133798
+ function redact(text) {
133799
+ let output = typeof text === "string" ? text : renderValue(text, 4096);
133800
+ for (const secret of secrets) {
133801
+ if (!secret)
133802
+ continue;
133803
+ output = output.split(secret).join("***");
133804
+ const encoded = encodeURIComponent(secret);
133805
+ if (encoded !== secret)
133806
+ output = output.split(encoded).join("***");
133807
+ }
133808
+ return output;
133809
+ }
133810
+ function build2(baseFields) {
133811
+ function emit(target, message, fields) {
133812
+ if (LEVEL_ORDER[target] < threshold)
133813
+ return;
133814
+ const merged = { ...baseFields, ...fields ?? {} };
133815
+ const rendered = Object.entries(merged).filter(([, value]) => value !== void 0).map(([key, value]) => `${key}=${redact(renderValue(value))}`).join(" ");
133816
+ const line = rendered ? `${redact(message)} | ${rendered}` : redact(message);
133817
+ switch (target) {
133818
+ case "debug":
133819
+ options.sink.debug(line);
133820
+ break;
133821
+ case "info":
133822
+ options.sink.info(line);
133823
+ break;
133824
+ case "warning":
133825
+ options.sink.warning(line);
133826
+ break;
133827
+ case "error":
133828
+ options.sink.error(line);
133829
+ break;
133830
+ }
133831
+ }
133832
+ const logger = {
133833
+ level,
133834
+ correlationId,
133835
+ addSecret,
133836
+ redact,
133837
+ isDebug: () => threshold <= LEVEL_ORDER.debug,
133838
+ debug: (message, fields) => emit("debug", message, fields),
133839
+ info: (message, fields) => emit("info", message, fields),
133840
+ warning: (message, fields) => emit("warning", message, fields),
133841
+ error: (message, fields) => emit("error", message, fields),
133842
+ failure: (message, error, fields) => emit("error", message, { ...fields ?? {}, error: describeError(error) }),
133843
+ child: (fields) => build2({ ...baseFields, ...fields }),
133844
+ async phase(name, fn, fields) {
133845
+ const scoped = build2({ ...baseFields, ...fields ?? {}, phase: name });
133846
+ const started = now();
133847
+ scoped.debug("phase start");
133848
+ options.sink.startGroup?.(name);
133849
+ try {
133850
+ const result = await fn();
133851
+ scoped.debug("phase ok", { duration_ms: Math.round(now() - started) });
133852
+ return result;
133853
+ } catch (error) {
133854
+ scoped.failure("phase failed", error, { duration_ms: Math.round(now() - started) });
133855
+ throw error;
133856
+ } finally {
133857
+ options.sink.endGroup?.();
133858
+ }
133859
+ }
133860
+ };
133861
+ return logger;
133862
+ }
133863
+ const root = build2({ run: correlationId, ...options.fields ?? {} });
133864
+ return root;
133865
+ }
133866
+
133867
+ // node_modules/@postman-cse/automation-core/dist/secrets-resolver.js
133868
+ var SECRETS_RESOLVER_PROVIDERS = ["none", "aws", "azure", "gcp"];
133869
+ var DEFAULT_SECRETS_RESOLVER_PROVIDER = "none";
133870
+ function parseSecretsResolverProvider(value, fallback = DEFAULT_SECRETS_RESOLVER_PROVIDER) {
133871
+ const raw = String(value ?? "").trim().toLowerCase();
133872
+ if (!raw)
133873
+ return fallback;
133874
+ if (raw === "true")
133875
+ return "aws";
133876
+ if (raw === "false" || raw === "off")
133877
+ return "none";
133878
+ if (SECRETS_RESOLVER_PROVIDERS.includes(raw)) {
133879
+ return raw;
133880
+ }
133881
+ throw new Error(`SECRETS_RESOLVER_PROVIDER_INVALID: expected one of ${SECRETS_RESOLVER_PROVIDERS.join(", ")} (or legacy true/false), received "${value}"`);
133882
+ }
133883
+ function secretsResolverEnvironmentKeys(provider) {
133884
+ switch (provider) {
133885
+ case "aws":
133886
+ return [
133887
+ { key: "AWS_ACCESS_KEY_ID", secret: true },
133888
+ { key: "AWS_SECRET_ACCESS_KEY", secret: true },
133889
+ { key: "AWS_REGION", secret: false },
133890
+ { key: "AWS_SECRET_NAME", secret: false }
133891
+ ];
133892
+ case "azure":
133893
+ return [
133894
+ { key: "AZURE_KEY_VAULT_NAME", secret: false },
133895
+ { key: "AZURE_SECRET_NAME", secret: false },
133896
+ { key: "AZURE_ACCESS_TOKEN", secret: true }
133897
+ ];
133898
+ case "gcp":
133899
+ return [
133900
+ { key: "GCP_PROJECT_ID", secret: false },
133901
+ { key: "GCP_SECRET_NAME", secret: false },
133902
+ { key: "GCP_ACCESS_TOKEN", secret: true }
133903
+ ];
133904
+ case "none":
133905
+ default:
133906
+ return [];
133907
+ }
133908
+ }
133909
+
133676
133910
  // src/action-version.ts
133677
133911
  var import_node_fs3 = require("node:fs");
133678
133912
  var import_node_path2 = require("node:path");
@@ -133689,7 +133923,7 @@ function resolveActionVersion2() {
133689
133923
  }
133690
133924
 
133691
133925
  // src/lib/http-error.ts
133692
- function truncate(value, limit) {
133926
+ function truncate2(value, limit) {
133693
133927
  if (value.length <= limit) {
133694
133928
  return value;
133695
133929
  }
@@ -133699,7 +133933,7 @@ function buildMessage(init) {
133699
133933
  const method = String(init.method || "GET").toUpperCase();
133700
133934
  const status = `${init.status}${init.statusText ? ` ${init.statusText}` : ""}`;
133701
133935
  const url = redactSecrets(init.url, init.secretValues);
133702
- const body = truncate(
133936
+ const body = truncate2(
133703
133937
  redactSecrets(init.responseBody || "", init.secretValues),
133704
133938
  Math.max(0, init.bodyLimit ?? 800)
133705
133939
  );
@@ -134876,6 +135110,12 @@ var postmanRepoSyncActionContract = {
134876
135110
  required: false,
134877
135111
  default: ""
134878
135112
  },
135113
+ "secrets-resolver": {
135114
+ description: "Cloud secret store the generated environments seed credential slots for (none, aws, azure, gcp). Must match the value passed to bootstrap and smoke-flow.",
135115
+ required: false,
135116
+ default: "none",
135117
+ allowedValues: ["none", "aws", "azure", "gcp"]
135118
+ },
134879
135119
  "credential-preflight": {
134880
135120
  description: "Credential identity preflight policy. warn (default) logs a note and continues when postman-api-key and postman-access-token resolve to different parent orgs; enforce fails the run on that condition before any workspace is created. Both modes warn when postman-access-token is not a service-account token.",
134881
135121
  required: false,
@@ -135078,31 +135318,13 @@ var PostmanAssetsClient = class {
135078
135318
  }
135079
135319
  };
135080
135320
 
135081
- // src/lib/postman/postman-gateway-assets-client.ts
135082
- var MockContractError = class extends Error {
135083
- constructor(message) {
135084
- super(message);
135085
- this.name = "MockContractError";
135086
- }
135087
- };
135088
- function requireMockVisibility(mock, requested) {
135089
- if (mock.visibility === "unknown") {
135090
- throw new MockContractError(
135091
- `MOCK_VISIBILITY_UNKNOWN: Mock ${mock.uid} did not expose a supported visibility field. Refusing to assume it is callable.`
135092
- );
135093
- }
135094
- if (mock.visibility !== requested) {
135095
- const code = requested === "public" ? "MOCK_NOT_PUBLIC" : "MOCK_NOT_PRIVATE";
135096
- throw new MockContractError(
135097
- `${code}: Mock ${mock.uid} is ${mock.visibility}, but mock-visibility requires ${requested}. Change the mock visibility in Postman or set mock-visibility to ${mock.visibility}.`
135098
- );
135099
- }
135100
- return mock;
135101
- }
135321
+ // src/lib/postman/private-mock-auth-script.ts
135102
135322
  var LEGACY_PRIVATE_MOCK_AUTH_MARKER = "postman-enterprise-automation: private-mock-auth";
135103
135323
  var PRIVATE_MOCK_AUTH_V2_MARKER = `${LEGACY_PRIVATE_MOCK_AUTH_MARKER}-v2`;
135104
- var PRIVATE_MOCK_AUTH_MARKER = `${LEGACY_PRIVATE_MOCK_AUTH_MARKER}-v3`;
135324
+ var PRIVATE_MOCK_AUTH_V3_MARKER = `${LEGACY_PRIVATE_MOCK_AUTH_MARKER}-v3`;
135105
135325
  var PRIVATE_MOCK_AUTH_VARIABLE2 = "postmanPrivateMockApiKey";
135326
+ var PRIVATE_MOCK_AUTH_ROOT_TYPE = "http:beforeRequest";
135327
+ var PRIVATE_MOCK_AUTH_ROOT_MARKER = `${LEGACY_PRIVATE_MOCK_AUTH_MARKER}-root`;
135106
135328
  var LEGACY_PRIVATE_MOCK_AUTH_SCRIPT = [
135107
135329
  `// ${LEGACY_PRIVATE_MOCK_AUTH_MARKER}`,
135108
135330
  `var privateMockApiKey = pm.variables.get('${PRIVATE_MOCK_AUTH_VARIABLE2}');`,
@@ -135123,8 +135345,8 @@ var PRIVATE_MOCK_AUTH_V2_SCRIPT = [
135123
135345
  ` console.warn('This mock server is private. Set the ${PRIVATE_MOCK_AUTH_VARIABLE2} variable to a Postman API key with access to it, or the request returns 401.');`,
135124
135346
  "}"
135125
135347
  ].join("\n");
135126
- var PRIVATE_MOCK_AUTH_SCRIPT = [
135127
- `// ${PRIVATE_MOCK_AUTH_MARKER}`,
135348
+ var PRIVATE_MOCK_AUTH_V3_SCRIPT = [
135349
+ `// ${PRIVATE_MOCK_AUTH_V3_MARKER}`,
135128
135350
  `var privateMockApiKey = pm.variables.get('${PRIVATE_MOCK_AUTH_VARIABLE2}');`,
135129
135351
  "var privateMockHost = '';",
135130
135352
  "try {",
@@ -135140,8 +135362,336 @@ var PRIVATE_MOCK_AUTH_SCRIPT = [
135140
135362
  ` console.warn('This mock server is private. Set the ${PRIVATE_MOCK_AUTH_VARIABLE2} variable to a Postman API key with access to it, or the request returns 401.');`,
135141
135363
  "}"
135142
135364
  ].join("\n");
135143
- function removeLegacyPrivateMockAuth(code) {
135144
- return [LEGACY_PRIVATE_MOCK_AUTH_SCRIPT, PRIVATE_MOCK_AUTH_V2_SCRIPT].reduce((next, script) => next.split(script).join(""), code).trim();
135365
+ var PRIVATE_MOCK_AUTH_ROOT_SCRIPT = [
135366
+ `// ${PRIVATE_MOCK_AUTH_ROOT_MARKER}`,
135367
+ `var privateMockApiKey = pm.variables.get('${PRIVATE_MOCK_AUTH_VARIABLE2}');`,
135368
+ "var privateMockHost = '';",
135369
+ "try {",
135370
+ " var privateMockUrl = pm.variables.replaceIn(pm.request.url.toString());",
135371
+ " privateMockHost = new URL(privateMockUrl).hostname;",
135372
+ "} catch (error) {",
135373
+ " console.warn('Could not resolve the request URL for private mock authentication; x-api-key was not added.');",
135374
+ "}",
135375
+ "var isPrivateMockHost = /(^|\\.)mock\\.pstmn\\.io$/i.test(privateMockHost);",
135376
+ "if (isPrivateMockHost && privateMockApiKey) {",
135377
+ " pm.request.headers.upsert({ key: 'x-api-key', value: privateMockApiKey });",
135378
+ "} else if (isPrivateMockHost) {",
135379
+ ` console.warn('This mock server is private. Set the ${PRIVATE_MOCK_AUTH_VARIABLE2} variable to a Postman API key with access to it, or the request returns 401.');`,
135380
+ "}"
135381
+ ].join("\n");
135382
+ var MANAGED_ITEM_AUTH_BLOCKS = [
135383
+ LEGACY_PRIVATE_MOCK_AUTH_SCRIPT,
135384
+ PRIVATE_MOCK_AUTH_V2_SCRIPT,
135385
+ PRIVATE_MOCK_AUTH_V3_SCRIPT
135386
+ ];
135387
+ function isManagedPrivateMockAuthRootHook(script) {
135388
+ return String(script.type ?? "") === PRIVATE_MOCK_AUTH_ROOT_TYPE && String(script.code ?? "") === PRIVATE_MOCK_AUTH_ROOT_SCRIPT;
135389
+ }
135390
+ var REGEX_PREFIX_KEYWORDS = /* @__PURE__ */ new Set([
135391
+ "await",
135392
+ "case",
135393
+ "delete",
135394
+ "do",
135395
+ "else",
135396
+ "in",
135397
+ "instanceof",
135398
+ "of",
135399
+ "return",
135400
+ "throw",
135401
+ "typeof",
135402
+ "void",
135403
+ "yield"
135404
+ ]);
135405
+ function isIdentifierStart(ch) {
135406
+ return ch !== void 0 && /[A-Za-z_$]/.test(ch);
135407
+ }
135408
+ function isIdentifierPart(ch) {
135409
+ return ch !== void 0 && /[A-Za-z0-9_$]/.test(ch);
135410
+ }
135411
+ function markTopLevelScriptBytes(source) {
135412
+ const topLevel = new Uint8Array(source.length);
135413
+ let state = "script";
135414
+ let canStartRegex = true;
135415
+ let regexCharacterClass = false;
135416
+ for (let i = 0; i < source.length; i++) {
135417
+ const ch = source[i];
135418
+ const next = source[i + 1];
135419
+ if (state === "script") {
135420
+ topLevel[i] = 1;
135421
+ if (ch === "/" && next === "*") {
135422
+ topLevel[i] = 0;
135423
+ state = "block_comment";
135424
+ i++;
135425
+ topLevel[i] = 0;
135426
+ continue;
135427
+ }
135428
+ if (ch === "/" && next === "/") {
135429
+ topLevel[i + 1] = 1;
135430
+ i++;
135431
+ while (i + 1 < source.length && source[i + 1] !== "\n") {
135432
+ i++;
135433
+ topLevel[i] = 1;
135434
+ }
135435
+ continue;
135436
+ }
135437
+ if (ch === "/") {
135438
+ if (canStartRegex) {
135439
+ topLevel[i] = 0;
135440
+ state = "regex";
135441
+ regexCharacterClass = false;
135442
+ continue;
135443
+ }
135444
+ canStartRegex = true;
135445
+ if (next === "=") {
135446
+ i++;
135447
+ topLevel[i] = 1;
135448
+ }
135449
+ continue;
135450
+ }
135451
+ if (ch === "'") {
135452
+ state = "single";
135453
+ topLevel[i] = 0;
135454
+ continue;
135455
+ }
135456
+ if (ch === '"') {
135457
+ state = "double";
135458
+ topLevel[i] = 0;
135459
+ continue;
135460
+ }
135461
+ if (ch === "`") {
135462
+ state = "template";
135463
+ topLevel[i] = 0;
135464
+ continue;
135465
+ }
135466
+ if (/\s/.test(ch)) {
135467
+ continue;
135468
+ }
135469
+ if (isIdentifierStart(ch)) {
135470
+ let end = i + 1;
135471
+ while (isIdentifierPart(source[end])) {
135472
+ topLevel[end] = 1;
135473
+ end++;
135474
+ }
135475
+ canStartRegex = REGEX_PREFIX_KEYWORDS.has(source.slice(i, end));
135476
+ i = end - 1;
135477
+ continue;
135478
+ }
135479
+ if (/[0-9]/.test(ch)) {
135480
+ let end = i + 1;
135481
+ while (/[A-Za-z0-9_.]/.test(source[end] ?? "")) {
135482
+ topLevel[end] = 1;
135483
+ end++;
135484
+ }
135485
+ canStartRegex = false;
135486
+ i = end - 1;
135487
+ continue;
135488
+ }
135489
+ if ((ch === "+" || ch === "-") && next === ch) {
135490
+ const wasPrefix = canStartRegex;
135491
+ i++;
135492
+ topLevel[i] = 1;
135493
+ canStartRegex = wasPrefix;
135494
+ continue;
135495
+ }
135496
+ if (ch === "?" && next === ".") {
135497
+ i++;
135498
+ topLevel[i] = 1;
135499
+ canStartRegex = false;
135500
+ continue;
135501
+ }
135502
+ if (")]}".includes(ch) || ch === ".") {
135503
+ canStartRegex = false;
135504
+ continue;
135505
+ }
135506
+ if ("([{,;:=!~*%&|^<>+-?".includes(ch)) {
135507
+ canStartRegex = true;
135508
+ continue;
135509
+ }
135510
+ canStartRegex = false;
135511
+ continue;
135512
+ }
135513
+ if (state === "block_comment") {
135514
+ topLevel[i] = 0;
135515
+ if (ch === "*" && next === "/") {
135516
+ topLevel[i] = 0;
135517
+ i++;
135518
+ topLevel[i] = 0;
135519
+ state = "script";
135520
+ }
135521
+ continue;
135522
+ }
135523
+ if (state === "single") {
135524
+ topLevel[i] = 0;
135525
+ if (ch === "\\" && i + 1 < source.length) {
135526
+ i++;
135527
+ topLevel[i] = 0;
135528
+ continue;
135529
+ }
135530
+ if (ch === "'") {
135531
+ state = "script";
135532
+ canStartRegex = false;
135533
+ }
135534
+ continue;
135535
+ }
135536
+ if (state === "double") {
135537
+ topLevel[i] = 0;
135538
+ if (ch === "\\" && i + 1 < source.length) {
135539
+ i++;
135540
+ topLevel[i] = 0;
135541
+ continue;
135542
+ }
135543
+ if (ch === '"') {
135544
+ state = "script";
135545
+ canStartRegex = false;
135546
+ }
135547
+ continue;
135548
+ }
135549
+ if (state === "regex") {
135550
+ topLevel[i] = 0;
135551
+ if (ch === "\\" && i + 1 < source.length) {
135552
+ i++;
135553
+ topLevel[i] = 0;
135554
+ continue;
135555
+ }
135556
+ if (ch === "\n" || ch === "\r") {
135557
+ state = "script";
135558
+ canStartRegex = true;
135559
+ regexCharacterClass = false;
135560
+ continue;
135561
+ }
135562
+ if (ch === "[") {
135563
+ regexCharacterClass = true;
135564
+ continue;
135565
+ }
135566
+ if (ch === "]" && regexCharacterClass) {
135567
+ regexCharacterClass = false;
135568
+ continue;
135569
+ }
135570
+ if (ch === "/" && !regexCharacterClass) {
135571
+ while (isIdentifierPart(source[i + 1])) {
135572
+ i++;
135573
+ topLevel[i] = 0;
135574
+ }
135575
+ state = "script";
135576
+ canStartRegex = false;
135577
+ }
135578
+ continue;
135579
+ }
135580
+ topLevel[i] = 0;
135581
+ if (ch === "\\" && i + 1 < source.length) {
135582
+ i++;
135583
+ topLevel[i] = 0;
135584
+ continue;
135585
+ }
135586
+ if (ch === "`") {
135587
+ state = "script";
135588
+ canStartRegex = false;
135589
+ }
135590
+ }
135591
+ return topLevel;
135592
+ }
135593
+ function isWholeLineTopLevelMatch(source, startIndex, block, topLevel) {
135594
+ if (!source.startsWith(block, startIndex)) {
135595
+ return false;
135596
+ }
135597
+ if (startIndex > 0 && source[startIndex - 1] !== "\n") {
135598
+ return false;
135599
+ }
135600
+ const endIndex = startIndex + block.length;
135601
+ for (let lineStart = startIndex; lineStart < endIndex; ) {
135602
+ if (!topLevel[lineStart]) {
135603
+ return false;
135604
+ }
135605
+ const nextNewline = source.indexOf("\n", lineStart);
135606
+ if (nextNewline === -1 || nextNewline >= endIndex - 1) {
135607
+ break;
135608
+ }
135609
+ lineStart = nextNewline + 1;
135610
+ }
135611
+ return true;
135612
+ }
135613
+ function findManagedBlockRanges(source) {
135614
+ const topLevel = markTopLevelScriptBytes(source);
135615
+ const ranges = [];
135616
+ for (let i = 0; i < source.length; i++) {
135617
+ if (i > 0 && source[i - 1] !== "\n") {
135618
+ continue;
135619
+ }
135620
+ for (const block of MANAGED_ITEM_AUTH_BLOCKS) {
135621
+ if (!isWholeLineTopLevelMatch(source, i, block, topLevel)) {
135622
+ continue;
135623
+ }
135624
+ ranges.push({ start: i, end: i + block.length });
135625
+ break;
135626
+ }
135627
+ }
135628
+ return ranges;
135629
+ }
135630
+ function countManagedItemAuthBlocks(code) {
135631
+ if (typeof code !== "string" || !code) {
135632
+ return 0;
135633
+ }
135634
+ return findManagedBlockRanges(code).length;
135635
+ }
135636
+ function deleteRangeWithSeam(source, start, end) {
135637
+ let before = source.slice(0, start);
135638
+ let after = source.slice(end);
135639
+ const beforeHadNl = before.endsWith("\n");
135640
+ const afterHadNl = after.startsWith("\n");
135641
+ if (beforeHadNl) {
135642
+ before = before.slice(0, -1);
135643
+ }
135644
+ if (afterHadNl) {
135645
+ after = after.slice(1);
135646
+ }
135647
+ if (beforeHadNl && afterHadNl && before.length > 0 && after.length > 0) {
135648
+ return `${before}
135649
+ ${after}`;
135650
+ }
135651
+ return `${before}${after}`;
135652
+ }
135653
+ function stripManagedItemAuthBlocks(code) {
135654
+ if (typeof code !== "string" || !code) {
135655
+ return "";
135656
+ }
135657
+ const ranges = findManagedBlockRanges(code);
135658
+ if (ranges.length === 0) {
135659
+ return code;
135660
+ }
135661
+ ranges.sort((left, right) => right.start - left.start);
135662
+ let next = code;
135663
+ for (const range of ranges) {
135664
+ next = deleteRangeWithSeam(next, range.start, range.end);
135665
+ }
135666
+ return next;
135667
+ }
135668
+
135669
+ // src/lib/postman/postman-gateway-assets-client.ts
135670
+ var MockContractError = class extends Error {
135671
+ constructor(message) {
135672
+ super(message);
135673
+ this.name = "MockContractError";
135674
+ }
135675
+ };
135676
+ var AmbiguousMonitorRebindError = class extends Error {
135677
+ constructor(message, options) {
135678
+ super(message, options);
135679
+ this.name = "AmbiguousMonitorRebindError";
135680
+ }
135681
+ };
135682
+ function requireMockVisibility(mock, requested) {
135683
+ if (mock.visibility === "unknown") {
135684
+ throw new MockContractError(
135685
+ `MOCK_VISIBILITY_UNKNOWN: Mock ${mock.uid} did not expose a supported visibility field. Refusing to assume it is callable.`
135686
+ );
135687
+ }
135688
+ if (mock.visibility !== requested) {
135689
+ const code = requested === "public" ? "MOCK_NOT_PUBLIC" : "MOCK_NOT_PRIVATE";
135690
+ throw new MockContractError(
135691
+ `${code}: Mock ${mock.uid} is ${mock.visibility}, but mock-visibility requires ${requested}. Change the mock visibility in Postman or set mock-visibility to ${mock.visibility}.`
135692
+ );
135693
+ }
135694
+ return mock;
135145
135695
  }
135146
135696
  var MAX_CREATE_FLIGHTS = 256;
135147
135697
  var createFlights = /* @__PURE__ */ new Map();
@@ -135712,51 +136262,83 @@ var PostmanGatewayAssetsClient = class {
135712
136262
  }
135713
136263
  });
135714
136264
  }
136265
+ isAmbiguousTransportError(error) {
136266
+ return this.isRetryableIdempotentWriteOutcome(error);
136267
+ }
136268
+ normalizeCollectionScripts(scripts) {
136269
+ if (!Array.isArray(scripts)) return [];
136270
+ return scripts.map((entry) => this.asRecord(entry)).filter((entry) => entry !== null);
136271
+ }
136272
+ rootScriptsIncludeManagedAuthHook(scripts) {
136273
+ return scripts.some((script) => isManagedPrivateMockAuthRootHook(script));
136274
+ }
136275
+ buildPrivateMockRootScripts(existingScripts) {
136276
+ const managedScript = {
136277
+ type: PRIVATE_MOCK_AUTH_ROOT_TYPE,
136278
+ code: PRIVATE_MOCK_AUTH_ROOT_SCRIPT,
136279
+ language: "text/javascript"
136280
+ };
136281
+ return [...existingScripts, managedScript];
136282
+ }
136283
+ async readCollectionRootScripts(collectionUid) {
136284
+ const id = this.toModelId(collectionUid);
136285
+ const response = await this.gateway.requestJson({
136286
+ service: "collection",
136287
+ method: "get",
136288
+ path: `/v3/collections/${id}/export`
136289
+ });
136290
+ const data = this.asRecord(response?.data);
136291
+ const collection = this.asRecord(data?.collection);
136292
+ if (!collection) {
136293
+ throw new Error(
136294
+ `PRIVATE_MOCK_AUTH_EXPORT_INVALID: Collection ${id} export did not return data.collection; refusing to configure private-mock root auth from an unexpected envelope.`
136295
+ );
136296
+ }
136297
+ return this.normalizeCollectionScripts(collection.scripts);
136298
+ }
136299
+ async patchCollectionRootScripts(collectionUid, scripts) {
136300
+ const id = this.toModelId(collectionUid);
136301
+ await this.gateway.requestJson(
136302
+ {
136303
+ service: "collection",
136304
+ method: "patch",
136305
+ path: `/v3/collections/${id}`,
136306
+ body: [{ op: "add", path: "/scripts", value: scripts }]
136307
+ },
136308
+ { retryTransient: false }
136309
+ );
136310
+ }
135715
136311
  /**
135716
- * Add a secret-free runtime hook to every HTTP request in a collection. The
135717
- * PMAK value is supplied only by the runner as a transient variable; this
135718
- * method persists the variable name and header wiring, never the credential.
136312
+ * Add a secret-free runtime hook at the collection root. The PMAK value is
136313
+ * supplied only by the runner as a transient variable; this method persists
136314
+ * the variable name and header wiring, never the credential.
135719
136315
  */
135720
136316
  async configurePrivateMockRuntimeAuth(collectionUid) {
135721
136317
  const cid = String(collectionUid ?? "").trim();
135722
136318
  if (!cid) return 0;
135723
- const listed = await this.gateway.requestJson({
135724
- service: "collection",
135725
- method: "get",
135726
- path: `/v3/collections/${cid}/items/`
135727
- });
135728
- const items = Array.isArray(listed?.data) ? listed.data : [];
135729
- let patched = 0;
135730
- for (const listedItem of items) {
135731
- if (String(listedItem.$kind ?? "") !== "http-request") continue;
135732
- const itemId = String(listedItem.id ?? "").trim();
135733
- if (!itemId) continue;
135734
- const response = await this.gateway.requestJson({
135735
- service: "collection",
135736
- method: "get",
135737
- path: `/v3/collections/${cid}/items/${itemId}`,
135738
- headers: { "X-Entity-Type": "http-request" }
135739
- });
135740
- const item = this.asRecord(response?.data) ?? listedItem;
135741
- const scripts = Array.isArray(item.scripts) ? item.scripts.filter((entry) => Boolean(this.asRecord(entry))) : [];
135742
- const before = scripts.find((script) => String(script.type ?? "") === "beforeRequest");
135743
- const existingCode = String(before?.code ?? "");
135744
- if (existingCode.includes(PRIVATE_MOCK_AUTH_MARKER)) continue;
135745
- const code = [removeLegacyPrivateMockAuth(existingCode), PRIVATE_MOCK_AUTH_SCRIPT].filter(Boolean).join("\n");
135746
- const nextScripts = [
135747
- ...scripts.filter((script) => String(script.type ?? "") !== "beforeRequest"),
135748
- { type: "beforeRequest", code, language: "text/javascript" }
135749
- ];
135750
- await this.gateway.requestJson({
135751
- service: "collection",
135752
- method: "patch",
135753
- path: `/v3/collections/${cid}/items/${itemId}`,
135754
- headers: { "X-Entity-Type": "http-request" },
135755
- body: [{ op: "add", path: "/scripts", value: nextScripts }]
135756
- });
135757
- patched += 1;
135758
- }
135759
- return patched;
136319
+ const installFromFreshRoot = async (existingScripts) => {
136320
+ if (this.rootScriptsIncludeManagedAuthHook(existingScripts)) {
136321
+ return 0;
136322
+ }
136323
+ const nextScripts = this.buildPrivateMockRootScripts(existingScripts);
136324
+ try {
136325
+ await this.patchCollectionRootScripts(cid, nextScripts);
136326
+ return 1;
136327
+ } catch (error) {
136328
+ if (!this.isAmbiguousTransportError(error)) {
136329
+ throw error;
136330
+ }
136331
+ const freshScripts = await this.readCollectionRootScripts(cid);
136332
+ if (this.rootScriptsIncludeManagedAuthHook(freshScripts)) {
136333
+ return 1;
136334
+ }
136335
+ const recomputed = this.buildPrivateMockRootScripts(freshScripts);
136336
+ await this.patchCollectionRootScripts(cid, recomputed);
136337
+ return 1;
136338
+ }
136339
+ };
136340
+ const scripts = await this.readCollectionRootScripts(cid);
136341
+ return installFromFreshRoot(scripts);
135760
136342
  }
135761
136343
  async listMocks() {
135762
136344
  const response = await this.gateway.requestJson({
@@ -135840,12 +136422,13 @@ var PostmanGatewayAssetsClient = class {
135840
136422
  }
135841
136423
  async createMonitor(workspaceId, name, collectionUid, environmentUid, cronSchedule) {
135842
136424
  const ws = workspaceId || this.workspaceId;
135843
- const effectiveCron = cronSchedule && cronSchedule.trim() ? cronSchedule.trim() : "0 0 * * 0";
136425
+ const cronTrimmed = String(cronSchedule ?? "").trim();
136426
+ const hasCron = cronTrimmed.length > 0;
135844
136427
  const monitorName = String(name ?? "").trim();
135845
136428
  const collection = String(collectionUid ?? "").trim();
135846
136429
  const environment = String(environmentUid ?? "").trim();
135847
136430
  const flightKey = `monitor:${ws}:${collection}:${environment}:${monitorName}`;
135848
- return this.singleFlight(flightKey, effectiveCron, "monitor", async () => {
136431
+ return this.singleFlight(flightKey, hasCron ? cronTrimmed : "inactive", "monitor", async () => {
135849
136432
  const existing = await this.findMonitorByCollection(collection, environment, monitorName);
135850
136433
  if (existing?.uid) {
135851
136434
  return existing.uid;
@@ -135853,11 +136436,12 @@ var PostmanGatewayAssetsClient = class {
135853
136436
  const body = {
135854
136437
  name: monitorName,
135855
136438
  collection,
136439
+ active: hasCron,
135856
136440
  options: { strictSSL: false, followRedirects: true, requestTimeout: null, requestDelay: 0 },
135857
136441
  notifications: { onFailure: [], onError: [] },
135858
136442
  retry: {},
135859
- schedule: { cronPattern: effectiveCron, timeZone: "UTC" },
135860
136443
  distribution: null,
136444
+ ...hasCron ? { schedule: { cronPattern: cronTrimmed, timeZone: "UTC" } } : {},
135861
136445
  ...environment ? { environment } : {}
135862
136446
  };
135863
136447
  const send2 = (fallback) => this.gateway.requestJson(
@@ -135931,6 +136515,73 @@ var PostmanGatewayAssetsClient = class {
135931
136515
  );
135932
136516
  return match?.uid ? { uid: match.uid, name: match.name } : null;
135933
136517
  }
136518
+ pickRebindMonitorCandidates(monitors, monitorName, environment) {
136519
+ const nameOnly = monitors.filter((monitor) => monitor.name === monitorName);
136520
+ const nameOnlyEnvironments = [
136521
+ ...new Set(nameOnly.map((monitor) => monitor.environmentUid || "(none)"))
136522
+ ];
136523
+ const candidates = nameOnly.filter((monitor) => monitor.environmentUid === environment);
136524
+ return { candidates, nameOnlyMatchCount: nameOnly.length, nameOnlyEnvironments };
136525
+ }
136526
+ /**
136527
+ * Rebind the sole same-name monitor in this workspace onto the current
136528
+ * collection UID.
136529
+ *
136530
+ * The canonical Smoke collection can legitimately change UID (a bootstrap
136531
+ * re-import after a marker/stranger miss, or an operator rebuild). The
136532
+ * monitor still points at the previous UID, so `findMonitorByCollection`
136533
+ * (which requires the full collection+environment+name triple) misses and a
136534
+ * second monitor with the same name would be created on every run, orphaning
136535
+ * the old one. Name plus environment is the stable identity across a
136536
+ * collection re-import, so recover it here instead.
136537
+ *
136538
+ * Returns null when nothing needs rebinding (no same-name monitor, or it is
136539
+ * already bound to this collection). Refuses to guess when several same-name
136540
+ * monitors match, matching `selectExactMatch` semantics elsewhere.
136541
+ */
136542
+ async rebindMonitorByName(name, collectionUid, environmentUid) {
136543
+ const monitorName = String(name ?? "").trim();
136544
+ const collection = String(collectionUid ?? "").trim();
136545
+ const environment = String(environmentUid ?? "").trim();
136546
+ if (!monitorName || !collection) {
136547
+ return null;
136548
+ }
136549
+ const monitors = await this.listMonitors();
136550
+ const { candidates, nameOnlyMatchCount, nameOnlyEnvironments } = this.pickRebindMonitorCandidates(
136551
+ monitors,
136552
+ monitorName,
136553
+ environment
136554
+ );
136555
+ let match;
136556
+ try {
136557
+ match = this.selectExactMatch(
136558
+ "monitor",
136559
+ `workspace ${this.workspaceId}, name "${monitorName}", and environment ${environment || "(none)"}`,
136560
+ candidates
136561
+ );
136562
+ } catch (error) {
136563
+ const message = error instanceof Error && nameOnlyMatchCount > 0 ? `${error.message} Same-name monitor(s) also exist on environment(s): ${nameOnlyEnvironments.join(", ")}.` : error instanceof Error ? error.message : String(error);
136564
+ throw new AmbiguousMonitorRebindError(message, { cause: error });
136565
+ }
136566
+ if (!match?.uid) {
136567
+ if (nameOnlyMatchCount > 0) {
136568
+ }
136569
+ return null;
136570
+ }
136571
+ if (match.collectionUid === collection) {
136572
+ return null;
136573
+ }
136574
+ await this.gateway.requestJson(
136575
+ {
136576
+ service: "monitors",
136577
+ method: "put",
136578
+ path: `/jobTemplates/${this.toModelId(match.uid)}?_etc=true`,
136579
+ body: { collection }
136580
+ },
136581
+ { retryTransient: false }
136582
+ );
136583
+ return { uid: match.uid, previousCollectionUid: match.collectionUid };
136584
+ }
135934
136585
  async runMonitor(uid) {
135935
136586
  await this.gateway.requestJson(
135936
136587
  {
@@ -135943,6 +136594,128 @@ var PostmanGatewayAssetsClient = class {
135943
136594
  }
135944
136595
  };
135945
136596
 
136597
+ // src/lib/postman/private-mock-export-cleanup.ts
136598
+ function asArray2(value) {
136599
+ return Array.isArray(value) ? value : [];
136600
+ }
136601
+ function cloneScriptRecord(script) {
136602
+ if (!script || typeof script !== "object" || Array.isArray(script)) {
136603
+ return script;
136604
+ }
136605
+ return { ...script };
136606
+ }
136607
+ function cloneCollectionNodeIterative(collection) {
136608
+ const cloned = { ...collection };
136609
+ if (Array.isArray(collection.scripts)) {
136610
+ cloned.scripts = collection.scripts.map((script) => cloneScriptRecord(script));
136611
+ }
136612
+ const stack = [];
136613
+ const attachNested = (source, target) => {
136614
+ if (Array.isArray(source.scripts)) {
136615
+ target.scripts = source.scripts.map((script) => cloneScriptRecord(script));
136616
+ }
136617
+ for (const key of ["items", "children"]) {
136618
+ const nested = asArray2(source[key]);
136619
+ if (nested.length === 0) {
136620
+ continue;
136621
+ }
136622
+ const clonedNested = nested.map((item) => ({ ...item }));
136623
+ target[key] = clonedNested;
136624
+ for (let i = 0; i < nested.length; i += 1) {
136625
+ stack.push({ source: nested[i], target: clonedNested[i] });
136626
+ }
136627
+ }
136628
+ };
136629
+ attachNested(collection, cloned);
136630
+ while (stack.length > 0) {
136631
+ const frame = stack.pop();
136632
+ attachNested(frame.source, frame.target);
136633
+ }
136634
+ return cloned;
136635
+ }
136636
+ function cloneCollection(collection) {
136637
+ if (typeof globalThis.structuredClone === "function") {
136638
+ try {
136639
+ return globalThis.structuredClone(collection);
136640
+ } catch {
136641
+ }
136642
+ }
136643
+ try {
136644
+ return JSON.parse(JSON.stringify(collection));
136645
+ } catch {
136646
+ return cloneCollectionNodeIterative(collection);
136647
+ }
136648
+ }
136649
+ function isPrivateMockLegacyExportCleanupEnabled() {
136650
+ const value = String(process.env.POSTMAN_PRIVATE_MOCK_LEGACY_EXPORT_CLEANUP ?? "").trim().toLowerCase();
136651
+ return value !== "off";
136652
+ }
136653
+ function verifyPrivateMockRootHook(collection) {
136654
+ const scripts = asArray2(collection.scripts);
136655
+ return scripts.some((script) => isManagedPrivateMockAuthRootHook(script));
136656
+ }
136657
+ function applyPrivateMockExportCleanup(collection, options = {}) {
136658
+ const stripManagedBlocks = options.stripManagedBlocks ?? isPrivateMockLegacyExportCleanupEnabled();
136659
+ const cloned = cloneCollection(collection);
136660
+ let strippedBlocks = 0;
136661
+ const visitItem = (item) => {
136662
+ if (!stripManagedBlocks) {
136663
+ return;
136664
+ }
136665
+ const scripts = item.scripts;
136666
+ if (!Array.isArray(scripts)) {
136667
+ return;
136668
+ }
136669
+ const nextScripts = [];
136670
+ for (const script of scripts) {
136671
+ if (!script || typeof script !== "object" || Array.isArray(script)) {
136672
+ nextScripts.push(script);
136673
+ continue;
136674
+ }
136675
+ const record = script;
136676
+ if (String(record.type ?? "") !== "beforeRequest") {
136677
+ nextScripts.push(record);
136678
+ continue;
136679
+ }
136680
+ const originalCode = String(record.code ?? "");
136681
+ const cleaned = stripManagedItemAuthBlocks(originalCode);
136682
+ if (cleaned === originalCode) {
136683
+ nextScripts.push(record);
136684
+ continue;
136685
+ }
136686
+ strippedBlocks += countManagedItemAuthBlocks(originalCode);
136687
+ if (!cleaned) {
136688
+ continue;
136689
+ }
136690
+ nextScripts.push({ ...record, code: cleaned });
136691
+ }
136692
+ if (nextScripts.length === 0) {
136693
+ delete item.scripts;
136694
+ } else {
136695
+ item.scripts = nextScripts;
136696
+ }
136697
+ };
136698
+ const walkItemsIteratively = (rootItems) => {
136699
+ const stack = [...rootItems].reverse();
136700
+ while (stack.length > 0) {
136701
+ const item = stack.pop();
136702
+ visitItem(item);
136703
+ for (const key of ["items", "children"]) {
136704
+ const nested = asArray2(item[key]);
136705
+ for (let i = nested.length - 1; i >= 0; i -= 1) {
136706
+ stack.push(nested[i]);
136707
+ }
136708
+ }
136709
+ }
136710
+ };
136711
+ walkItemsIteratively(asArray2(cloned.items));
136712
+ return {
136713
+ collection: cloned,
136714
+ strippedBlocks,
136715
+ rootVerified: verifyPrivateMockRootHook(cloned)
136716
+ };
136717
+ }
136718
+
135946
136719
  // src/lib/postman/token-provider.ts
135947
136720
  var MintError = class extends Error {
135948
136721
  permanent;
@@ -136700,6 +137473,15 @@ var identitySecretMasker = (input) => input;
136700
137473
  function resolveRepoSyncMasker(dependencies) {
136701
137474
  return dependencies.secretMasker ?? identitySecretMasker;
136702
137475
  }
137476
+ function resolveRepoSyncLogger(dependencies) {
137477
+ return dependencies.logger ?? createLogger({
137478
+ sink: actionSink(dependencies.core),
137479
+ fields: {
137480
+ action: "postman-repo-sync-action",
137481
+ action_version: resolveActionVersion2()
137482
+ }
137483
+ });
137484
+ }
136703
137485
  function causeText(cause) {
136704
137486
  return cause instanceof Error ? cause.message : String(cause);
136705
137487
  }
@@ -136917,6 +137699,7 @@ function resolveInputs(env = process.env) {
136917
137699
  env
136918
137700
  );
136919
137701
  const environments = parseJsonArray(getInput("environments-json", env) || '["prod"]');
137702
+ const secretsResolverProvider = parseSecretsResolverProvider(getInput("secrets-resolver", env));
136920
137703
  const systemEnvMap = parseJsonMap(getInput("system-env-map-json", env) || "{}");
136921
137704
  const environmentUids = parseJsonMap(getInput("environment-uids-json", env) || "{}");
136922
137705
  const envRuntimeUrls = parseJsonMap(getInput("env-runtime-urls-json", env) || "{}");
@@ -136934,6 +137717,7 @@ function resolveInputs(env = process.env) {
136934
137717
  specContentChanged: parseBooleanInput(getInput("spec-content-changed", env), true),
136935
137718
  specPath: getInput("spec-path", env),
136936
137719
  collectionSyncMode: normalizeCollectionSyncMode(getInput("collection-sync-mode", env) || "refresh"),
137720
+ secretsResolverProvider,
136937
137721
  specSyncMode: normalizeSpecSyncMode(getInput("spec-sync-mode", env) || "update"),
136938
137722
  releaseLabel: normalizeReleaseLabel(getInput("release-label", env)) || void 0,
136939
137723
  environments: environments.length > 0 ? environments : ["prod"],
@@ -137032,10 +137816,14 @@ function buildEnvironmentValues(envName, baseUrl, options = {}) {
137032
137816
  ...options.privateMockAuth ? [{ key: PRIVATE_MOCK_AUTH_VARIABLE2, value: "", type: "secret" }] : [],
137033
137817
  { key: "CI", value: "false", type: "default" },
137034
137818
  { key: "RESPONSE_TIME_THRESHOLD", value: "2000", type: "default" },
137035
- { key: "AWS_ACCESS_KEY_ID", value: "", type: "secret" },
137036
- { key: "AWS_SECRET_ACCESS_KEY", value: "", type: "secret" },
137037
- { key: "AWS_REGION", value: "eu-west-2", type: "default" },
137038
- { key: "AWS_SECRET_NAME", value: `api-credentials-${envName}`, type: "default" }
137819
+ // Provider-scoped credential slots. `none` (the default) seeds nothing, so a
137820
+ // consumer that does not use a cloud secret store gets a clean environment
137821
+ // instead of four dead AWS variables.
137822
+ ...secretsResolverEnvironmentKeys(options.secretsResolverProvider ?? "none").map((entry) => ({
137823
+ key: entry.key,
137824
+ value: entry.key.endsWith("_SECRET_NAME") && !entry.secret ? `api-credentials-${envName}` : entry.defaultValue ?? "",
137825
+ type: entry.secret ? "secret" : "default"
137826
+ }))
137039
137827
  ];
137040
137828
  }
137041
137829
  var LEGACY_BASELINE_COLLECTION_PREFIX = "[Baseline]";
@@ -137113,13 +137901,51 @@ function normalizeToPosix(filePath) {
137113
137901
  function canonicalizeRelativePath(value) {
137114
137902
  return normalizeToPosix(String(value ?? "").trim()).replace(/^\.\/+/, "").replace(/\/{2,}/g, "/").replace(/\/+$/g, "");
137115
137903
  }
137116
- function isOpenApiSpecFile(filePath) {
137117
- if (!(filePath.endsWith(".json") || filePath.endsWith(".yaml") || filePath.endsWith(".yml"))) {
137118
- return false;
137904
+ var LOCAL_SPEC_DISCOVERY_MAX_DEPTH = 6;
137905
+ var LOCAL_SPEC_DISCOVERY_MAX_TRAVERSAL_ENTRIES = 1e4;
137906
+ var LOCAL_SPEC_DISCOVERY_MAX_CANDIDATE_FILES = 200;
137907
+ var LOCAL_SPEC_DISCOVERY_MAX_CANDIDATE_FILE_BYTES = 512 * 1024;
137908
+ var LOCAL_SPEC_DISCOVERY_IGNORED_DIRS = /* @__PURE__ */ new Set([
137909
+ ".git",
137910
+ ".nyc_output",
137911
+ ".omc",
137912
+ ".omx",
137913
+ ".llm-plans",
137914
+ ".pulumi",
137915
+ ".terraform",
137916
+ ".venv",
137917
+ "__pycache__",
137918
+ "bin",
137919
+ "build",
137920
+ "coverage",
137921
+ "discovered-specs",
137922
+ "node_modules",
137923
+ "dist",
137924
+ "obj",
137925
+ "out",
137926
+ "target",
137927
+ "vendor",
137928
+ "venv"
137929
+ ]);
137930
+ var LocalSpecDiscoveryLimitError = class extends Error {
137931
+ code = "CONTRACT_LOCAL_SPEC_DISCOVERY_LIMIT";
137932
+ constructor(message) {
137933
+ super(`CONTRACT_LOCAL_SPEC_DISCOVERY_LIMIT: ${message}`);
137934
+ this.name = "LocalSpecDiscoveryLimitError";
137119
137935
  }
137936
+ };
137937
+ function failLocalSpecDiscoveryLimit(detail) {
137938
+ throw new LocalSpecDiscoveryLimitError(
137939
+ `${detail} Set spec-path to the OpenAPI file explicitly and keep generated trees (for example dist/, node_modules/) out of the repository layout.`
137940
+ );
137941
+ }
137942
+ function isSpecCandidateExtension(filePath) {
137943
+ return filePath.endsWith(".json") || filePath.endsWith(".yaml") || filePath.endsWith(".yml");
137944
+ }
137945
+ function readOpenApiSpecFile(fullPath) {
137120
137946
  try {
137121
- const raw = (0, import_node_fs5.readFileSync)(filePath, "utf8");
137122
- const parsed = filePath.endsWith(".json") ? JSON.parse(raw) : load(raw);
137947
+ const raw = (0, import_node_fs5.readFileSync)(fullPath, "utf8");
137948
+ const parsed = fullPath.endsWith(".json") ? JSON.parse(raw) : load(raw);
137123
137949
  if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) {
137124
137950
  return false;
137125
137951
  }
@@ -137135,28 +137961,75 @@ function isOpenApiSpecFile(filePath) {
137135
137961
  }
137136
137962
  return false;
137137
137963
  }
137138
- function scanLocalSpecReferences(baseDir = ".") {
137139
- const ignoredDirs = /* @__PURE__ */ new Set([
137140
- ".git",
137141
- ".omc",
137142
- ".omx",
137143
- ".llm-plans",
137144
- "node_modules",
137145
- "dist"
137146
- ]);
137964
+ function shouldIgnoreSpecDiscoveryEntry(entryName, currentDir, baseDir, ignoredPrefixes) {
137965
+ if (LOCAL_SPEC_DISCOVERY_IGNORED_DIRS.has(entryName)) {
137966
+ return true;
137967
+ }
137968
+ const relative3 = normalizeToPosix(path3.relative(baseDir, path3.join(currentDir, entryName)));
137969
+ return ignoredPrefixes.some(
137970
+ (prefix) => relative3 === prefix || relative3.startsWith(`${prefix}/`)
137971
+ );
137972
+ }
137973
+ function scanLocalSpecReferences(baseDir = ".", options = {}) {
137974
+ const ignoredPrefixes = (options.ignoredPrefixes ?? []).map((value) => canonicalizeRelativePath(value)).filter(Boolean);
137147
137975
  const found = /* @__PURE__ */ new Set();
137148
137976
  const refs = [];
137149
- const visit2 = (currentDir) => {
137150
- for (const entry of (0, import_node_fs5.readdirSync)(currentDir, { withFileTypes: true })) {
137151
- if (ignoredDirs.has(entry.name)) {
137977
+ let traversalEntries = 0;
137978
+ let candidateFiles = 0;
137979
+ const pendingDirs = [{ dir: baseDir, depth: 0 }];
137980
+ while (pendingDirs.length > 0) {
137981
+ const { dir: currentDir, depth: currentDepth } = pendingDirs.shift();
137982
+ let entries;
137983
+ try {
137984
+ entries = (0, import_node_fs5.readdirSync)(currentDir, { withFileTypes: true }).sort(
137985
+ (left, right) => left.name.localeCompare(right.name)
137986
+ );
137987
+ } catch {
137988
+ continue;
137989
+ }
137990
+ for (const entry of entries) {
137991
+ traversalEntries += 1;
137992
+ if (traversalEntries > LOCAL_SPEC_DISCOVERY_MAX_TRAVERSAL_ENTRIES) {
137993
+ failLocalSpecDiscoveryLimit(
137994
+ `local spec discovery exceeded the ${LOCAL_SPEC_DISCOVERY_MAX_TRAVERSAL_ENTRIES} traversal-entry liveness budget.`
137995
+ );
137996
+ }
137997
+ if (shouldIgnoreSpecDiscoveryEntry(entry.name, currentDir, baseDir, ignoredPrefixes)) {
137152
137998
  continue;
137153
137999
  }
137154
138000
  const fullPath = path3.join(currentDir, entry.name);
137155
138001
  if (entry.isDirectory()) {
137156
- visit2(fullPath);
138002
+ const nextDepth = currentDepth + 1;
138003
+ if (nextDepth > LOCAL_SPEC_DISCOVERY_MAX_DEPTH) {
138004
+ failLocalSpecDiscoveryLimit(
138005
+ `local spec discovery exceeded the ${LOCAL_SPEC_DISCOVERY_MAX_DEPTH} directory-depth budget.`
138006
+ );
138007
+ }
138008
+ pendingDirs.push({ dir: fullPath, depth: nextDepth });
137157
138009
  continue;
137158
138010
  }
137159
- if (!entry.isFile() || !isOpenApiSpecFile(fullPath)) {
138011
+ if (!entry.isFile() || !isSpecCandidateExtension(fullPath)) {
138012
+ continue;
138013
+ }
138014
+ candidateFiles += 1;
138015
+ if (candidateFiles > LOCAL_SPEC_DISCOVERY_MAX_CANDIDATE_FILES) {
138016
+ failLocalSpecDiscoveryLimit(
138017
+ `local spec discovery exceeded the ${LOCAL_SPEC_DISCOVERY_MAX_CANDIDATE_FILES} candidate-file budget.`
138018
+ );
138019
+ }
138020
+ let sizeBytes;
138021
+ try {
138022
+ sizeBytes = (0, import_node_fs5.statSync)(fullPath).size;
138023
+ } catch {
138024
+ continue;
138025
+ }
138026
+ if (sizeBytes > LOCAL_SPEC_DISCOVERY_MAX_CANDIDATE_FILE_BYTES) {
138027
+ const repoRelativePath2 = normalizeToPosix(path3.relative(baseDir, fullPath));
138028
+ failLocalSpecDiscoveryLimit(
138029
+ `local spec discovery candidate ${repoRelativePath2} exceeds ${LOCAL_SPEC_DISCOVERY_MAX_CANDIDATE_FILE_BYTES} bytes.`
138030
+ );
138031
+ }
138032
+ if (!readOpenApiSpecFile(fullPath)) {
137160
138033
  continue;
137161
138034
  }
137162
138035
  const repoRelativePath = normalizeToPosix(path3.relative(baseDir, fullPath));
@@ -137169,20 +138042,36 @@ function scanLocalSpecReferences(baseDir = ".") {
137169
138042
  configRelativePath: normalizeToPosix(path3.join("..", repoRelativePath))
137170
138043
  });
137171
138044
  }
137172
- };
137173
- visit2(baseDir);
138045
+ }
137174
138046
  return refs.sort((left, right) => left.repoRelativePath.localeCompare(right.repoRelativePath));
137175
138047
  }
137176
- function resolveMappedSpecReference(explicitSpecPath, discoveredSpecs) {
138048
+ function tryResolveExplicitSpecReference(explicitSpecPath) {
137177
138049
  const normalizedExplicitPath = normalizeToPosix(explicitSpecPath.trim());
137178
- if (normalizedExplicitPath) {
137179
- const explicitFullPath = path3.resolve(normalizedExplicitPath);
137180
- if ((0, import_node_fs5.existsSync)(explicitFullPath) && (0, import_node_fs5.statSync)(explicitFullPath).isFile()) {
137181
- return {
137182
- repoRelativePath: normalizedExplicitPath,
137183
- configRelativePath: normalizeToPosix(path3.join("..", normalizedExplicitPath))
137184
- };
137185
- }
138050
+ if (!normalizedExplicitPath) {
138051
+ return void 0;
138052
+ }
138053
+ const explicitFullPath = path3.resolve(normalizedExplicitPath);
138054
+ if ((0, import_node_fs5.existsSync)(explicitFullPath) && (0, import_node_fs5.statSync)(explicitFullPath).isFile()) {
138055
+ return {
138056
+ repoRelativePath: normalizedExplicitPath,
138057
+ configRelativePath: normalizeToPosix(path3.join("..", normalizedExplicitPath))
138058
+ };
138059
+ }
138060
+ return void 0;
138061
+ }
138062
+ function resolveLocalSpecReferences(explicitSpecPath, baseDir = ".", options = {}) {
138063
+ const explicit = tryResolveExplicitSpecReference(explicitSpecPath);
138064
+ if (explicit) {
138065
+ return { discoveredSpecs: [], mappedSpec: explicit };
138066
+ }
138067
+ const discoveredSpecs = scanLocalSpecReferences(baseDir, options);
138068
+ const mappedSpec = resolveMappedSpecReference(explicitSpecPath, discoveredSpecs);
138069
+ return { discoveredSpecs, mappedSpec };
138070
+ }
138071
+ function resolveMappedSpecReference(explicitSpecPath, discoveredSpecs) {
138072
+ const explicit = tryResolveExplicitSpecReference(explicitSpecPath);
138073
+ if (explicit) {
138074
+ return explicit;
137186
138075
  }
137187
138076
  if (discoveredSpecs.length === 1) {
137188
138077
  return discoveredSpecs[0];
@@ -137290,7 +138179,9 @@ async function upsertEnvironments(inputs, dependencies, resourcesState, assetMar
137290
138179
  } catch {
137291
138180
  }
137292
138181
  }
137293
- const values2 = buildEnvironmentValues(envName, runtimeUrl);
138182
+ const values2 = buildEnvironmentValues(envName, runtimeUrl, {
138183
+ secretsResolverProvider: inputs.secretsResolverProvider
138184
+ });
137294
138185
  if (marker) values2.push({ key: "x-pm-onboarding", value: JSON.stringify(marker), type: "default" });
137295
138186
  try {
137296
138187
  await dependencies.postman.updateEnvironment(existingUid, displayName, values2);
@@ -137310,7 +138201,9 @@ async function upsertEnvironments(inputs, dependencies, resourcesState, assetMar
137310
138201
  dependencies.core.setOutput("environment-uids-json", JSON.stringify(envUids));
137311
138202
  continue;
137312
138203
  }
137313
- const values = buildEnvironmentValues(envName, runtimeUrl);
138204
+ const values = buildEnvironmentValues(envName, runtimeUrl, {
138205
+ secretsResolverProvider: inputs.secretsResolverProvider
138206
+ });
137314
138207
  if (assetMarker) values.push({ key: "x-pm-onboarding", value: JSON.stringify(assetMarker), type: "default" });
137315
138208
  try {
137316
138209
  envUids[envName] = await dependencies.postman.createEnvironment(
@@ -137339,7 +138232,10 @@ async function upsertMockEnvironment(inputs, dependencies, assetProjectName, moc
137339
138232
  return "";
137340
138233
  }
137341
138234
  const displayName = `${assetProjectName} - Mock`;
137342
- const values = buildEnvironmentValues("mock", mockUrl, { privateMockAuth });
138235
+ const values = buildEnvironmentValues("mock", mockUrl, {
138236
+ privateMockAuth,
138237
+ secretsResolverProvider: inputs.secretsResolverProvider
138238
+ });
137343
138239
  const mask = resolveRepoSyncMasker(dependencies);
137344
138240
  try {
137345
138241
  const discovered = await dependencies.postman.findEnvironmentByName(
@@ -137861,6 +138757,18 @@ function tryReusePrebuiltCollection(options) {
137861
138757
  }
137862
138758
  return prepared.artifactDigest === entry.artifactDigest;
137863
138759
  }
138760
+ async function preparePrivateMockCloudCollection(role, collectionId, postman) {
138761
+ const col = await postman.getCollection(collectionId);
138762
+ const { collection } = applyPrivateMockExportCleanup(col, {
138763
+ stripManagedBlocks: isPrivateMockLegacyExportCleanupEnabled()
138764
+ });
138765
+ if (!verifyPrivateMockRootHook(collection)) {
138766
+ throw new Error(
138767
+ `PRIVATE_MOCK_AUTH_ROOT_UNVERIFIED: Managed root hook missing from exported ${role} collection ${collectionId}`
138768
+ );
138769
+ }
138770
+ return collection;
138771
+ }
137864
138772
  async function exportCollectionArtifact(options) {
137865
138773
  const {
137866
138774
  role,
@@ -137869,14 +138777,17 @@ async function exportCollectionArtifact(options) {
137869
138777
  collectionsDir,
137870
138778
  prebuiltByRole,
137871
138779
  postman,
137872
- core
138780
+ core,
138781
+ privateMockAuth = false,
138782
+ preparedCloudCollection
137873
138783
  } = options;
137874
138784
  if (!collectionId) {
137875
138785
  return void 0;
137876
138786
  }
137877
138787
  const expectedPath = `${collectionsDir}/${dirName}`;
138788
+ const forceCloudExport = privateMockAuth && (role === "smoke" || role === "contract");
137878
138789
  const entry = prebuiltByRole.get(role);
137879
- if (entry) {
138790
+ if (entry && !forceCloudExport) {
137880
138791
  const reused = tryReusePrebuiltCollection({
137881
138792
  prepared: entry,
137882
138793
  expectedPath,
@@ -137891,12 +138802,30 @@ async function exportCollectionArtifact(options) {
137891
138802
  core.info(
137892
138803
  `Prebuilt ${role} collection entry present but did not exactly match; exporting from cloud`
137893
138804
  );
138805
+ } else if (entry && forceCloudExport) {
138806
+ core.info(
138807
+ `Private mock requires cloud export for ${role} collection to reconcile managed root hook; exporting from cloud`
138808
+ );
137894
138809
  }
137895
- const col = await postman.getCollection(collectionId);
137896
- await convertAndSplitAnyCollection(
137897
- col,
137898
- expectedPath
137899
- );
138810
+ let collectionForExport;
138811
+ if (forceCloudExport && preparedCloudCollection) {
138812
+ collectionForExport = preparedCloudCollection;
138813
+ } else if (forceCloudExport) {
138814
+ const col = await postman.getCollection(collectionId);
138815
+ const { collection } = applyPrivateMockExportCleanup(col, {
138816
+ stripManagedBlocks: isPrivateMockLegacyExportCleanupEnabled()
138817
+ });
138818
+ if (!verifyPrivateMockRootHook(collection)) {
138819
+ throw new Error(
138820
+ `PRIVATE_MOCK_AUTH_ROOT_UNVERIFIED: Managed root hook missing from exported ${role} collection ${collectionId}`
138821
+ );
138822
+ }
138823
+ collectionForExport = collection;
138824
+ } else {
138825
+ const col = await postman.getCollection(collectionId);
138826
+ collectionForExport = col;
138827
+ }
138828
+ await convertAndSplitAnyCollection(collectionForExport, expectedPath);
137900
138829
  return `../${expectedPath}`;
137901
138830
  }
137902
138831
  function hasControlCharacter2(value) {
@@ -137949,32 +138878,37 @@ async function exportArtifacts(inputs, dependencies, envUids, assetProjectName,
137949
138878
  const globalsDir = `${inputs.artifactDir}/globals`;
137950
138879
  const mocksDir = `${inputs.artifactDir}/mocks`;
137951
138880
  const specsDir = `${inputs.artifactDir}/specs`;
137952
- ensureDir(collectionsDir);
137953
- ensureDir(environmentsDir);
137954
- ensureDir(flowsDir);
137955
- ensureDir(globalsDir);
137956
- ensureDir(mocksDir);
137957
- ensureDir(specsDir);
137958
- ensureDir(".postman");
137959
- const globalsFilePath = `${globalsDir}/workspace.globals.yaml`;
137960
- if (!(0, import_node_fs5.existsSync)(globalsFilePath)) {
137961
- (0, import_node_fs5.writeFileSync)(globalsFilePath, "name: Globals\nvalues: []\n");
137962
- }
137963
- if (inputs.generateCiWorkflow) {
137964
- const ciDir = inputs.ciWorkflowPath.split("/").slice(0, -1).join("/");
137965
- if (ciDir) {
137966
- ensureDir(ciDir);
137967
- }
137968
- }
137969
138881
  const manifestCollections = {};
137970
- const discoveredSpecs = scanLocalSpecReferences();
137971
- const mappedSpec = resolveMappedSpecReference(inputs.specPath, discoveredSpecs);
138882
+ const artifactDirPrefix = canonicalizeRelativePath(inputs.artifactDir);
138883
+ const { discoveredSpecs, mappedSpec } = resolveLocalSpecReferences(inputs.specPath, ".", {
138884
+ ignoredPrefixes: artifactDirPrefix ? [artifactDirPrefix, ".postman"] : [".postman"]
138885
+ });
137972
138886
  const mappedSpecCloudKey = mappedSpec && inputs.specId ? buildMappedSpecCloudKey(
137973
138887
  mappedSpec.configRelativePath,
137974
138888
  inputs.specSyncMode,
137975
138889
  options.releaseLabel
137976
138890
  ) : void 0;
137977
138891
  const prebuiltByRole = options.preparedPrebuiltCollections;
138892
+ const privateMockAuth = options.privateMockAuth === true;
138893
+ const preparedPrivateMockCollections = /* @__PURE__ */ new Map();
138894
+ if (privateMockAuth) {
138895
+ for (const spec of [
138896
+ { role: "smoke", collectionId: inputs.smokeCollectionId },
138897
+ { role: "contract", collectionId: inputs.contractCollectionId }
138898
+ ]) {
138899
+ if (!spec.collectionId) {
138900
+ continue;
138901
+ }
138902
+ preparedPrivateMockCollections.set(
138903
+ spec.role,
138904
+ await preparePrivateMockCloudCollection(
138905
+ spec.role,
138906
+ spec.collectionId,
138907
+ dependencies.postman
138908
+ )
138909
+ );
138910
+ }
138911
+ }
137978
138912
  const baselineRef = await exportCollectionArtifact({
137979
138913
  role: "baseline",
137980
138914
  collectionId: inputs.baselineCollectionId,
@@ -137982,7 +138916,8 @@ async function exportArtifacts(inputs, dependencies, envUids, assetProjectName,
137982
138916
  collectionsDir,
137983
138917
  prebuiltByRole,
137984
138918
  postman: dependencies.postman,
137985
- core: dependencies.core
138919
+ core: dependencies.core,
138920
+ privateMockAuth
137986
138921
  });
137987
138922
  if (baselineRef) {
137988
138923
  manifestCollections[baselineRef] = inputs.baselineCollectionId;
@@ -137994,7 +138929,9 @@ async function exportArtifacts(inputs, dependencies, envUids, assetProjectName,
137994
138929
  collectionsDir,
137995
138930
  prebuiltByRole,
137996
138931
  postman: dependencies.postman,
137997
- core: dependencies.core
138932
+ core: dependencies.core,
138933
+ privateMockAuth,
138934
+ preparedCloudCollection: preparedPrivateMockCollections.get("smoke")
137998
138935
  });
137999
138936
  if (smokeRef) {
138000
138937
  manifestCollections[smokeRef] = inputs.smokeCollectionId;
@@ -138006,11 +138943,30 @@ async function exportArtifacts(inputs, dependencies, envUids, assetProjectName,
138006
138943
  collectionsDir,
138007
138944
  prebuiltByRole,
138008
138945
  postman: dependencies.postman,
138009
- core: dependencies.core
138946
+ core: dependencies.core,
138947
+ privateMockAuth,
138948
+ preparedCloudCollection: preparedPrivateMockCollections.get("contract")
138010
138949
  });
138011
138950
  if (contractRef) {
138012
138951
  manifestCollections[contractRef] = inputs.contractCollectionId;
138013
138952
  }
138953
+ ensureDir(collectionsDir);
138954
+ ensureDir(environmentsDir);
138955
+ ensureDir(flowsDir);
138956
+ ensureDir(globalsDir);
138957
+ ensureDir(mocksDir);
138958
+ ensureDir(specsDir);
138959
+ ensureDir(".postman");
138960
+ const globalsFilePath = `${globalsDir}/workspace.globals.yaml`;
138961
+ if (!(0, import_node_fs5.existsSync)(globalsFilePath)) {
138962
+ (0, import_node_fs5.writeFileSync)(globalsFilePath, "name: Globals\nvalues: []\n");
138963
+ }
138964
+ if (inputs.generateCiWorkflow) {
138965
+ const ciDir = inputs.ciWorkflowPath.split("/").slice(0, -1).join("/");
138966
+ if (ciDir) {
138967
+ ensureDir(ciDir);
138968
+ }
138969
+ }
138014
138970
  for (const [envName, envUid] of Object.entries(envUids)) {
138015
138971
  writeJsonFile(
138016
138972
  `${environmentsDir}/${envName}.postman_environment.json`,
@@ -138163,19 +139119,41 @@ async function commitAndPushGeneratedFiles(inputs, dependencies) {
138163
139119
  async function runRepoSync(inputs, dependencies) {
138164
139120
  const telemetry = createTelemetryContext({ action: "postman-repo-sync-action", actionVersion: resolveActionVersion2(), logger: dependencies.core });
138165
139121
  telemetry.setTeamId(dependencies.teamId);
139122
+ const logger = resolveRepoSyncLogger(dependencies);
139123
+ for (const secret of [
139124
+ inputs.postmanApiKey,
139125
+ inputs.postmanAccessToken,
139126
+ inputs.adoToken,
139127
+ inputs.githubToken,
139128
+ inputs.ghFallbackToken,
139129
+ inputs.sslClientCert,
139130
+ inputs.sslClientKey,
139131
+ inputs.sslClientPassphrase,
139132
+ inputs.sslExtraCaCerts
139133
+ ]) {
139134
+ logger.addSecret(secret);
139135
+ }
139136
+ logger.debug("resolved inputs", {
139137
+ project: inputs.projectName,
139138
+ collection_sync_mode: inputs.collectionSyncMode,
139139
+ spec_sync_mode: inputs.specSyncMode,
139140
+ team_id: dependencies.teamId || void 0
139141
+ });
138166
139142
  try {
138167
- const result = await runRepoSyncInner(inputs, dependencies);
139143
+ const result = await runRepoSyncInner(inputs, { ...dependencies, logger });
138168
139144
  telemetry.setAccountType(getMemoizedSessionIdentity()?.consumerType);
138169
139145
  telemetry.emitCompletion("success");
138170
139146
  return result;
138171
139147
  } catch (error) {
138172
139148
  telemetry.setAccountType(getMemoizedSessionIdentity()?.consumerType);
138173
139149
  telemetry.emitCompletion("failure");
139150
+ logger.failure("repo sync failed", error);
138174
139151
  throw error;
138175
139152
  }
138176
139153
  }
138177
139154
  async function runRepoSyncInner(inputs, dependencies) {
138178
139155
  const mask = resolveRepoSyncMasker(dependencies);
139156
+ const logger = resolveRepoSyncLogger(dependencies);
138179
139157
  const branchDecision = decideBranchTier(inputs);
138180
139158
  assertBranchAssetIds(inputs, branchDecision);
138181
139159
  const isCanonicalWriter = branchDecision.tier === "legacy" || branchDecision.tier === "canonical";
@@ -138235,7 +139213,10 @@ async function runRepoSyncInner(inputs, dependencies) {
138235
139213
  }
138236
139214
  }
138237
139215
  }
138238
- const preparedPrebuiltCollections = await preparePrebuiltCollections(inputs);
139216
+ const preparedPrebuiltCollections = await logger.phase(
139217
+ "prepare-collections",
139218
+ async () => preparePrebuiltCollections(inputs)
139219
+ );
138239
139220
  let skipRepositoryLinkPost = false;
138240
139221
  let repositoryLinkPreflightWasFree = false;
138241
139222
  if (inputs.workspaceLinkEnabled && inputs.workspaceId && inputs.repoUrl && dependencies.internalIntegration?.findWorkspaceForRepo) {
@@ -138270,7 +139251,10 @@ async function runRepoSyncInner(inputs, dependencies) {
138270
139251
  }
138271
139252
  }
138272
139253
  const branchAssetMarker = buildBranchAssetMarker(branchDecision, inputs);
138273
- const envUids = await upsertEnvironments(inputs, dependencies, resourcesState, branchAssetMarker);
139254
+ const envUids = await logger.phase(
139255
+ "sync-environments",
139256
+ async () => upsertEnvironments(inputs, dependencies, resourcesState, branchAssetMarker)
139257
+ );
138274
139258
  outputs["environment-uids-json"] = JSON.stringify(envUids);
138275
139259
  dependencies.core.setOutput("environment-uids-json", outputs["environment-uids-json"]);
138276
139260
  if (inputs.environmentSyncEnabled && inputs.workspaceId && dependencies.internalIntegration) {
@@ -138433,10 +139417,21 @@ async function runRepoSyncInner(inputs, dependencies) {
138433
139417
  );
138434
139418
  }
138435
139419
  const configured = [];
138436
- for (const collectionUid of [inputs.smokeCollectionId, inputs.contractCollectionId]) {
138437
- if (collectionUid) {
139420
+ for (const { role, collectionUid } of [
139421
+ { role: "smoke", collectionUid: inputs.smokeCollectionId },
139422
+ { role: "contract", collectionUid: inputs.contractCollectionId }
139423
+ ]) {
139424
+ if (!collectionUid) {
139425
+ continue;
139426
+ }
139427
+ try {
138438
139428
  await dependencies.postman.configurePrivateMockRuntimeAuth(collectionUid);
138439
139429
  configured.push(collectionUid);
139430
+ } catch (error) {
139431
+ throw new Error(
139432
+ `PRIVATE_MOCK_AUTH_ROOT_PATCH: Failed to install managed root hook on ${role} collection ${collectionUid}: ${mask(causeText(error))}`,
139433
+ { cause: error }
139434
+ );
138440
139435
  }
138441
139436
  }
138442
139437
  if (configured.length > 0) {
@@ -138511,6 +139506,43 @@ async function runRepoSyncInner(inputs, dependencies) {
138511
139506
  );
138512
139507
  }
138513
139508
  }
139509
+ if (!resolvedMonitorId && inputs.smokeCollectionId && dependencies.postman.rebindMonitorByName) {
139510
+ try {
139511
+ const rebound = await dependencies.postman.rebindMonitorByName(
139512
+ monitorName,
139513
+ inputs.smokeCollectionId,
139514
+ monitorEnvUid
139515
+ );
139516
+ if (rebound) {
139517
+ resolvedMonitorId = rebound.uid;
139518
+ dependencies.core.info(
139519
+ `Rebound existing monitor ${rebound.uid} ("${monitorName}") from collection ${rebound.previousCollectionUid} to ${inputs.smokeCollectionId}`
139520
+ );
139521
+ }
139522
+ } catch (error) {
139523
+ if (error instanceof AmbiguousMonitorRebindError) {
139524
+ throw new Error(
139525
+ formatOrchestrationIssue({
139526
+ operation: "Monitor rebind",
139527
+ entity: `monitor "${monitorName}" workspace ${inputs.workspaceId} collection ${inputs.smokeCollectionId} environment ${monitorEnvUid}`,
139528
+ cause: error,
139529
+ remediation: monitorRemediation,
139530
+ mask
139531
+ }),
139532
+ { cause: error }
139533
+ );
139534
+ }
139535
+ dependencies.core.warning(
139536
+ formatOrchestrationIssue({
139537
+ operation: "Monitor rebind",
139538
+ entity: `monitor "${monitorName}" workspace ${inputs.workspaceId} collection ${inputs.smokeCollectionId} environment ${monitorEnvUid}`,
139539
+ cause: error,
139540
+ remediation: monitorRemediation,
139541
+ mask
139542
+ })
139543
+ );
139544
+ }
139545
+ }
138514
139546
  if (!resolvedMonitorId) {
138515
139547
  try {
138516
139548
  resolvedMonitorId = await dependencies.postman.createMonitor(
@@ -138588,16 +139620,23 @@ async function runRepoSyncInner(inputs, dependencies) {
138588
139620
  dependencies.core.warning(message);
138589
139621
  }
138590
139622
  }
138591
- await exportArtifacts(inputs, dependencies, envUids, assetProjectName, {
138592
- workspaceLinkStatus: outputs["workspace-link-status"],
138593
- priorWorkspaceId: resourcesState?.workspace?.id,
138594
- existingSpecs: resourcesState?.cloudResources?.specs,
138595
- mockEnvironmentUid: outputs["mock-environment-uid"] || void 0,
138596
- releaseLabel,
138597
- priorState: resourcesState,
138598
- preparedPrebuiltCollections
138599
- });
138600
- const commit = await commitAndPushGeneratedFiles(inputs, dependencies);
139623
+ await logger.phase(
139624
+ "export-artifacts",
139625
+ async () => exportArtifacts(inputs, dependencies, envUids, assetProjectName, {
139626
+ workspaceLinkStatus: outputs["workspace-link-status"],
139627
+ priorWorkspaceId: resourcesState?.workspace?.id,
139628
+ existingSpecs: resourcesState?.cloudResources?.specs,
139629
+ mockEnvironmentUid: outputs["mock-environment-uid"] || void 0,
139630
+ releaseLabel,
139631
+ priorState: resourcesState,
139632
+ preparedPrebuiltCollections,
139633
+ privateMockAuth: inputs.mockVisibility === "private"
139634
+ })
139635
+ );
139636
+ const commit = await logger.phase(
139637
+ "commit-and-push",
139638
+ async () => commitAndPushGeneratedFiles(inputs, dependencies)
139639
+ );
138601
139640
  outputs["commit-sha"] = commit.commitSha;
138602
139641
  if (commit.resolvedCurrentRef) {
138603
139642
  outputs["resolved-current-ref"] = commit.resolvedCurrentRef;
@@ -138925,6 +139964,7 @@ function createRepoSyncDependencies(inputs, resolved, factories, options = {}) {
138925
139964
  listMonitors: gatewayAssets.listMonitors.bind(gatewayAssets),
138926
139965
  monitorExists: gatewayAssets.monitorExists.bind(gatewayAssets),
138927
139966
  findMonitorByCollection: gatewayAssets.findMonitorByCollection.bind(gatewayAssets),
139967
+ rebindMonitorByName: gatewayAssets.rebindMonitorByName.bind(gatewayAssets),
138928
139968
  runMonitor: gatewayAssets.runMonitor.bind(gatewayAssets),
138929
139969
  listEnvironments: gatewayAssets.listEnvironments.bind(gatewayAssets),
138930
139970
  // GC path (preview/channel retention machine — lib/repo/preview-gc.ts).
@@ -139425,6 +140465,7 @@ var CLI_INPUT_NAMES = [
139425
140465
  "spec-content-changed",
139426
140466
  "spec-path",
139427
140467
  "team-id",
140468
+ "secrets-resolver",
139428
140469
  "postman-region",
139429
140470
  "postman-stack",
139430
140471
  "branch-strategy",