@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/index.cjs CHANGED
@@ -42721,14 +42721,14 @@ var require_description = __commonJS({
42721
42721
  var z = __importStar(require_mini());
42722
42722
  var metadata_1 = require_metadata();
42723
42723
  var MAX_CONTENT_LENGTH = 1e6;
42724
- function truncate2(value) {
42724
+ function truncate3(value) {
42725
42725
  return value.length > MAX_CONTENT_LENGTH ? value.slice(0, MAX_CONTENT_LENGTH) : value;
42726
42726
  }
42727
42727
  exports2.Description = (0, schemas_1.model)(z.union([
42728
- z.pipe(z.string(), z.transform(truncate2)),
42728
+ z.pipe(z.string(), z.transform(truncate3)),
42729
42729
  z.null(),
42730
42730
  z.object({
42731
- content: z.pipe(z.optional(z.string()), z.transform((value) => truncate2(value ?? ""))),
42731
+ content: z.pipe(z.optional(z.string()), z.transform((value) => truncate3(value ?? ""))),
42732
42732
  type: z.optional(z.string()),
42733
42733
  version: z.optional(z.unknown())
42734
42734
  })
@@ -57954,7 +57954,7 @@ var require_lodash = __commonJS({
57954
57954
  var strSymbols = stringToArray(string), start = charsStartIndex(strSymbols, stringToArray(chars));
57955
57955
  return castSlice(strSymbols, start).join("");
57956
57956
  }
57957
- function truncate2(string, options) {
57957
+ function truncate3(string, options) {
57958
57958
  var length = DEFAULT_TRUNC_LENGTH, omission = DEFAULT_TRUNC_OMISSION;
57959
57959
  if (isObject(options)) {
57960
57960
  var separator = "separator" in options ? options.separator : separator;
@@ -58514,7 +58514,7 @@ var require_lodash = __commonJS({
58514
58514
  lodash.trim = trim;
58515
58515
  lodash.trimEnd = trimEnd;
58516
58516
  lodash.trimStart = trimStart;
58517
- lodash.truncate = truncate2;
58517
+ lodash.truncate = truncate3;
58518
58518
  lodash.unescape = unescape2;
58519
58519
  lodash.uniqueId = uniqueId;
58520
58520
  lodash.upperCase = upperCase;
@@ -95745,10 +95745,10 @@ var require_unicode = __commonJS({
95745
95745
  module2.exports.isLineTerminatorJSON = function isLineTerminatorJSON(x) {
95746
95746
  return x === "\n" || x === "\r";
95747
95747
  };
95748
- module2.exports.isIdentifierStart = function isIdentifierStart(x) {
95748
+ module2.exports.isIdentifierStart = function isIdentifierStart2(x) {
95749
95749
  return x === "$" || x === "_" || x >= "A" && x <= "Z" || x >= "a" && x <= "z" || x >= "\x80" && Uni.NonAsciiIdentifierStart.test(x);
95750
95750
  };
95751
- module2.exports.isIdentifierPart = function isIdentifierPart(x) {
95751
+ module2.exports.isIdentifierPart = function isIdentifierPart2(x) {
95752
95752
  return x === "$" || x === "_" || x >= "A" && x <= "Z" || x >= "a" && x <= "z" || x >= "0" && x <= "9" || x >= "\x80" && Uni.NonAsciiIdentifierPart.test(x);
95753
95753
  };
95754
95754
  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]/;
@@ -118662,7 +118662,7 @@ var require_truncate = __commonJS({
118662
118662
  function isLowSurrogate(codePoint) {
118663
118663
  return codePoint >= 56320 && codePoint <= 57343;
118664
118664
  }
118665
- module2.exports = function truncate2(getLength, string, byteLength) {
118665
+ module2.exports = function truncate3(getLength, string, byteLength) {
118666
118666
  if (typeof string !== "string") {
118667
118667
  throw new Error("Input must be string");
118668
118668
  }
@@ -118693,9 +118693,9 @@ var require_truncate = __commonJS({
118693
118693
  var require_truncate_utf8_bytes = __commonJS({
118694
118694
  "node_modules/truncate-utf8-bytes/index.js"(exports2, module2) {
118695
118695
  "use strict";
118696
- var truncate2 = require_truncate();
118696
+ var truncate3 = require_truncate();
118697
118697
  var getLength = Buffer.byteLength.bind(Buffer);
118698
- module2.exports = truncate2.bind(null, getLength);
118698
+ module2.exports = truncate3.bind(null, getLength);
118699
118699
  }
118700
118700
  });
118701
118701
 
@@ -128807,6 +128807,7 @@ var require_node2 = __commonJS({
128807
128807
  // src/index.ts
128808
128808
  var index_exports = {};
128809
128809
  __export(index_exports, {
128810
+ LocalSpecDiscoveryLimitError: () => LocalSpecDiscoveryLimitError,
128810
128811
  StateUnreadableError: () => StateUnreadableError,
128811
128812
  assertBranchAssetIds: () => assertBranchAssetIds,
128812
128813
  assertPathWithinCwd: () => assertPathWithinCwd,
@@ -134331,7 +134332,9 @@ function buildCiWorkflowLines(installUrl, postmanRegion, privateMockAuth) {
134331
134332
  ` POSTMAN_CLI_INSTALL_URL: ${installUrl}`,
134332
134333
  ' run: curl -fsSL "$POSTMAN_CLI_INSTALL_URL" | sh',
134333
134334
  " - name: Login to Postman CLI",
134334
- " run: postman login --with-api-key ${{ secrets.POSTMAN_API_KEY }}" + (postmanRegion === "eu" ? " --region eu" : ""),
134335
+ " env:",
134336
+ " POSTMAN_API_KEY: ${{ secrets.POSTMAN_API_KEY }}",
134337
+ ' run: postman login --with-api-key "$POSTMAN_API_KEY"' + (postmanRegion === "eu" ? " --region eu" : ""),
134335
134338
  " - name: Resolve Postman Resource IDs",
134336
134339
  " run: |",
134337
134340
  " ruby <<'RUBY'",
@@ -134370,12 +134373,13 @@ function buildCiWorkflowLines(installUrl, postmanRegion, privateMockAuth) {
134370
134373
  " - name: Run Smoke Tests",
134371
134374
  " env:",
134372
134375
  " POSTMAN_SSL_CLIENT_PASSPHRASE: ${{ secrets.POSTMAN_SSL_CLIENT_PASSPHRASE }}",
134376
+ ...privateMockAuth ? [" POSTMAN_API_KEY: ${{ secrets.POSTMAN_API_KEY }}"] : [],
134373
134377
  " run: |",
134374
134378
  ' CMD=(postman collection run "$POSTMAN_SMOKE_COLLECTION_UID"',
134375
134379
  ' -e "$POSTMAN_ENVIRONMENT_UID"',
134376
134380
  " --report-events",
134377
134381
  ` --env-var "CI_ENVIRONMENT=\${{ vars.CI_ENVIRONMENT || 'Production' }}")`,
134378
- ...privateMockAuth ? [' CMD+=(--env-var "' + PRIVATE_MOCK_AUTH_VARIABLE + '=${{ secrets.POSTMAN_API_KEY }}")'] : [],
134382
+ ...privateMockAuth ? [' CMD+=(--env-var "' + PRIVATE_MOCK_AUTH_VARIABLE + '=$POSTMAN_API_KEY")'] : [],
134379
134383
  ' if [ -f "$RUNNER_TEMP/postman-ssl/client.crt" ]; then',
134380
134384
  ' CMD+=(--ssl-client-cert "$RUNNER_TEMP/postman-ssl/client.crt"',
134381
134385
  ' --ssl-client-key "$RUNNER_TEMP/postman-ssl/client.key")',
@@ -134390,12 +134394,13 @@ function buildCiWorkflowLines(installUrl, postmanRegion, privateMockAuth) {
134390
134394
  " - name: Run Contract Tests",
134391
134395
  " env:",
134392
134396
  " POSTMAN_SSL_CLIENT_PASSPHRASE: ${{ secrets.POSTMAN_SSL_CLIENT_PASSPHRASE }}",
134397
+ ...privateMockAuth ? [" POSTMAN_API_KEY: ${{ secrets.POSTMAN_API_KEY }}"] : [],
134393
134398
  " run: |",
134394
134399
  ' CMD=(postman collection run "$POSTMAN_CONTRACT_COLLECTION_UID"',
134395
134400
  ' -e "$POSTMAN_ENVIRONMENT_UID"',
134396
134401
  " --report-events",
134397
134402
  ` --env-var "CI_ENVIRONMENT=\${{ vars.CI_ENVIRONMENT || 'Production' }}")`,
134398
- ...privateMockAuth ? [' CMD+=(--env-var "' + PRIVATE_MOCK_AUTH_VARIABLE + '=${{ secrets.POSTMAN_API_KEY }}")'] : [],
134403
+ ...privateMockAuth ? [' CMD+=(--env-var "' + PRIVATE_MOCK_AUTH_VARIABLE + '=$POSTMAN_API_KEY")'] : [],
134399
134404
  ' if [ -f "$RUNNER_TEMP/postman-ssl/client.crt" ]; then',
134400
134405
  ' CMD+=(--ssl-client-cert "$RUNNER_TEMP/postman-ssl/client.crt"',
134401
134406
  ' --ssl-client-key "$RUNNER_TEMP/postman-ssl/client.key")',
@@ -134422,7 +134427,9 @@ function buildAdoWindowsCollectionRunLines(displayName, collectionEnvironmentNam
134422
134427
  ` $collectionUid = $env:${collectionEnvironmentName}`,
134423
134428
  " $ciEnvironment = Resolve-AdoOptional $env:CI_ENVIRONMENT",
134424
134429
  " if ([string]::IsNullOrWhiteSpace($ciEnvironment)) { $ciEnvironment = 'Production' }",
134425
- ` $arguments = @('collection', 'run', $collectionUid, '-e', $env:POSTMAN_ENVIRONMENT_UID, '--report-events', '--env-var', "CI_ENVIRONMENT=$ciEnvironment")`,
134430
+ " $responseTimeThreshold = Resolve-AdoOptional $env:RESPONSE_TIME_THRESHOLD",
134431
+ " if ([string]::IsNullOrWhiteSpace($responseTimeThreshold)) { $responseTimeThreshold = '10000' }",
134432
+ ` $arguments = @('collection', 'run', $collectionUid, '-e', $env:POSTMAN_ENVIRONMENT_UID, '--report-events', '--env-var', "CI_ENVIRONMENT=$ciEnvironment", '--env-var', "RESPONSE_TIME_THRESHOLD=$responseTimeThreshold")`,
134426
134433
  ...privateMockAuth ? [` $arguments += @('--env-var', "${PRIVATE_MOCK_AUTH_VARIABLE}=$env:POSTMAN_API_KEY")`] : [],
134427
134434
  " $sslRoot = Join-Path $env:AGENT_TEMPDIRECTORY 'postman-ssl'",
134428
134435
  " $clientCert = Join-Path $sslRoot 'client.crt'",
@@ -134445,6 +134452,7 @@ function buildAdoWindowsCollectionRunLines(displayName, collectionEnvironmentNam
134445
134452
  ` ${collectionEnvironmentName}: $(${collectionEnvironmentName})`,
134446
134453
  " POSTMAN_ENVIRONMENT_UID: $(POSTMAN_ENVIRONMENT_UID)",
134447
134454
  " CI_ENVIRONMENT: $(CI_ENVIRONMENT)",
134455
+ " RESPONSE_TIME_THRESHOLD: $(RESPONSE_TIME_THRESHOLD)",
134448
134456
  " POSTMAN_SSL_CLIENT_PASSPHRASE: $(POSTMAN_SSL_CLIENT_PASSPHRASE)",
134449
134457
  ...privateMockAuth ? [" POSTMAN_API_KEY: $(POSTMAN_API_KEY)"] : []
134450
134458
  ];
@@ -135214,7 +135222,7 @@ function detectRepoContext(input, env = process.env) {
135214
135222
  };
135215
135223
  }
135216
135224
 
135217
- // node_modules/@postman-cse/automation-telemetry-core/dist/ci-context.js
135225
+ // node_modules/@postman-cse/automation-core/dist/ci-context.js
135218
135226
  function norm(value) {
135219
135227
  const trimmed = (value ?? "").trim();
135220
135228
  return trimmed.length > 0 ? trimmed : void 0;
@@ -135365,7 +135373,7 @@ function detectCiProviderContext(env = process.env) {
135365
135373
  return { ciProvider: "unknown", runnerKind: "unknown" };
135366
135374
  }
135367
135375
 
135368
- // node_modules/@postman-cse/automation-telemetry-core/dist/repo-context.js
135376
+ // node_modules/@postman-cse/automation-core/dist/repo-context.js
135369
135377
  function normalize2(value) {
135370
135378
  const trimmed = (value ?? "").trim();
135371
135379
  return trimmed.length > 0 ? trimmed : void 0;
@@ -135454,7 +135462,7 @@ function detectRepoContext2(input, env = process.env) {
135454
135462
  };
135455
135463
  }
135456
135464
 
135457
- // node_modules/@postman-cse/automation-telemetry-core/dist/telemetry.js
135465
+ // node_modules/@postman-cse/automation-core/dist/telemetry.js
135458
135466
  var import_node_crypto = require("node:crypto");
135459
135467
  var import_undici2 = __toESM(require_undici(), 1);
135460
135468
  var SCHEMA_VERSION = 3;
@@ -135464,10 +135472,14 @@ var proxyDispatcher;
135464
135472
  function getProxyDispatcher() {
135465
135473
  return proxyDispatcher ??= new import_undici2.EnvHttpProxyAgent();
135466
135474
  }
135467
- function resolveActionVersion(explicit) {
135475
+ function resolveActionVersion(explicit, env = process.env) {
135468
135476
  if (explicit) {
135469
135477
  return explicit;
135470
135478
  }
135479
+ const ref = env.GITHUB_ACTION_REF?.trim();
135480
+ if (ref) {
135481
+ return ref;
135482
+ }
135471
135483
  return typeof __ACTION_VERSION__ !== "undefined" && __ACTION_VERSION__ ? __ACTION_VERSION__ : "unknown";
135472
135484
  }
135473
135485
  function telemetryDisabled(env) {
@@ -135550,7 +135562,7 @@ async function send(event, options) {
135550
135562
  function createTelemetryContext(options) {
135551
135563
  const env = options.env ?? process.env;
135552
135564
  const now = options.now ?? Date.now;
135553
- const actionVersion = resolveActionVersion(options.actionVersion);
135565
+ const actionVersion = resolveActionVersion(options.actionVersion, env);
135554
135566
  let teamId = "";
135555
135567
  let accountType = "unknown";
135556
135568
  let emitted = false;
@@ -135590,6 +135602,229 @@ function createTelemetryContext(options) {
135590
135602
  };
135591
135603
  }
135592
135604
 
135605
+ // node_modules/@postman-cse/automation-core/dist/logger.js
135606
+ var LEVEL_ORDER = {
135607
+ debug: 10,
135608
+ info: 20,
135609
+ warning: 30,
135610
+ error: 40
135611
+ };
135612
+ function defaultCorrelationId() {
135613
+ return Math.random().toString(36).slice(2, 10);
135614
+ }
135615
+ function resolveLogLevel(env = process.env) {
135616
+ const explicit = String(env.POSTMAN_ACTIONS_LOG_LEVEL ?? "").trim().toLowerCase();
135617
+ if (explicit === "debug" || explicit === "trace" || explicit === "verbose")
135618
+ return "debug";
135619
+ if (explicit === "info")
135620
+ return "info";
135621
+ if (explicit === "warn" || explicit === "warning")
135622
+ return "warning";
135623
+ if (explicit === "error" || explicit === "quiet")
135624
+ return "error";
135625
+ if (isTruthyFlag(env.RUNNER_DEBUG) || isTruthyFlag(env.ACTIONS_STEP_DEBUG))
135626
+ return "debug";
135627
+ if (isTruthyFlag(env.POSTMAN_ACTIONS_DEBUG))
135628
+ return "debug";
135629
+ return "info";
135630
+ }
135631
+ function isTruthyFlag(value) {
135632
+ if (!value)
135633
+ return false;
135634
+ const flag = value.trim().toLowerCase();
135635
+ return flag === "1" || flag === "true" || flag === "yes" || flag === "on";
135636
+ }
135637
+ function actionSink(core) {
135638
+ return {
135639
+ debug: (message) => core.debug?.(message),
135640
+ info: (message) => core.info(message),
135641
+ warning: (message) => (core.warning ?? core.info)(message),
135642
+ error: (message) => (core.error ?? core.warning ?? core.info)(message),
135643
+ startGroup: core.startGroup ? (name) => core.startGroup?.(name) : void 0,
135644
+ endGroup: core.endGroup ? () => core.endGroup?.() : void 0,
135645
+ isDebug: core.isDebug ? () => core.isDebug?.() ?? false : void 0
135646
+ };
135647
+ }
135648
+ var MIN_SECRET_LENGTH = 4;
135649
+ function renderValue(value, maxLength = 512) {
135650
+ if (value === void 0)
135651
+ return "undefined";
135652
+ if (value === null)
135653
+ return "null";
135654
+ if (typeof value === "string")
135655
+ return truncate(value, maxLength);
135656
+ if (typeof value === "number" || typeof value === "boolean" || typeof value === "bigint") {
135657
+ return String(value);
135658
+ }
135659
+ if (value instanceof Error)
135660
+ return truncate(describeError(value), maxLength);
135661
+ if (Array.isArray(value)) {
135662
+ return truncate(`[${value.map((entry) => renderValue(entry, 120)).join(", ")}]`, maxLength);
135663
+ }
135664
+ try {
135665
+ return truncate(JSON.stringify(value) ?? String(value), maxLength);
135666
+ } catch {
135667
+ return "<unserializable>";
135668
+ }
135669
+ }
135670
+ function truncate(text, maxLength) {
135671
+ if (text.length <= maxLength)
135672
+ return text;
135673
+ return `${text.slice(0, maxLength)}\u2026 (+${text.length - maxLength} chars)`;
135674
+ }
135675
+ function describeError(error2, maxDepth = 5) {
135676
+ const parts = [];
135677
+ let current = error2;
135678
+ let depth = 0;
135679
+ while (current !== void 0 && current !== null && depth < maxDepth) {
135680
+ if (current instanceof Error) {
135681
+ const code = current.code;
135682
+ parts.push(code ? `${current.name}[${code}]: ${current.message}` : `${current.name}: ${current.message}`);
135683
+ current = current.cause;
135684
+ } else if (typeof current === "object") {
135685
+ try {
135686
+ parts.push(JSON.stringify(current) ?? String(current));
135687
+ } catch {
135688
+ parts.push(String(current));
135689
+ }
135690
+ current = void 0;
135691
+ } else {
135692
+ parts.push(String(current));
135693
+ current = void 0;
135694
+ }
135695
+ depth += 1;
135696
+ }
135697
+ if (parts.length === 0)
135698
+ return "unknown error";
135699
+ return parts.join(" <- caused by ");
135700
+ }
135701
+ function createLogger(options) {
135702
+ const env = options.env ?? process.env;
135703
+ const level = options.level ?? resolveLogLevel(env);
135704
+ const secrets = options.secrets ?? /* @__PURE__ */ new Set();
135705
+ const correlationId = options.correlationId ?? defaultCorrelationId();
135706
+ const now = options.now ?? (() => Date.now());
135707
+ const threshold = LEVEL_ORDER[level];
135708
+ function addSecret(value) {
135709
+ if (typeof value !== "string")
135710
+ return;
135711
+ const trimmed = value.trim();
135712
+ if (trimmed.length < MIN_SECRET_LENGTH)
135713
+ return;
135714
+ secrets.add(trimmed);
135715
+ }
135716
+ function redact(text) {
135717
+ let output = typeof text === "string" ? text : renderValue(text, 4096);
135718
+ for (const secret of secrets) {
135719
+ if (!secret)
135720
+ continue;
135721
+ output = output.split(secret).join("***");
135722
+ const encoded = encodeURIComponent(secret);
135723
+ if (encoded !== secret)
135724
+ output = output.split(encoded).join("***");
135725
+ }
135726
+ return output;
135727
+ }
135728
+ function build2(baseFields) {
135729
+ function emit(target, message, fields) {
135730
+ if (LEVEL_ORDER[target] < threshold)
135731
+ return;
135732
+ const merged = { ...baseFields, ...fields ?? {} };
135733
+ const rendered = Object.entries(merged).filter(([, value]) => value !== void 0).map(([key, value]) => `${key}=${redact(renderValue(value))}`).join(" ");
135734
+ const line = rendered ? `${redact(message)} | ${rendered}` : redact(message);
135735
+ switch (target) {
135736
+ case "debug":
135737
+ options.sink.debug(line);
135738
+ break;
135739
+ case "info":
135740
+ options.sink.info(line);
135741
+ break;
135742
+ case "warning":
135743
+ options.sink.warning(line);
135744
+ break;
135745
+ case "error":
135746
+ options.sink.error(line);
135747
+ break;
135748
+ }
135749
+ }
135750
+ const logger = {
135751
+ level,
135752
+ correlationId,
135753
+ addSecret,
135754
+ redact,
135755
+ isDebug: () => threshold <= LEVEL_ORDER.debug,
135756
+ debug: (message, fields) => emit("debug", message, fields),
135757
+ info: (message, fields) => emit("info", message, fields),
135758
+ warning: (message, fields) => emit("warning", message, fields),
135759
+ error: (message, fields) => emit("error", message, fields),
135760
+ failure: (message, error2, fields) => emit("error", message, { ...fields ?? {}, error: describeError(error2) }),
135761
+ child: (fields) => build2({ ...baseFields, ...fields }),
135762
+ async phase(name, fn, fields) {
135763
+ const scoped = build2({ ...baseFields, ...fields ?? {}, phase: name });
135764
+ const started = now();
135765
+ scoped.debug("phase start");
135766
+ options.sink.startGroup?.(name);
135767
+ try {
135768
+ const result = await fn();
135769
+ scoped.debug("phase ok", { duration_ms: Math.round(now() - started) });
135770
+ return result;
135771
+ } catch (error2) {
135772
+ scoped.failure("phase failed", error2, { duration_ms: Math.round(now() - started) });
135773
+ throw error2;
135774
+ } finally {
135775
+ options.sink.endGroup?.();
135776
+ }
135777
+ }
135778
+ };
135779
+ return logger;
135780
+ }
135781
+ const root = build2({ run: correlationId, ...options.fields ?? {} });
135782
+ return root;
135783
+ }
135784
+
135785
+ // node_modules/@postman-cse/automation-core/dist/secrets-resolver.js
135786
+ var SECRETS_RESOLVER_PROVIDERS = ["none", "aws", "azure", "gcp"];
135787
+ var DEFAULT_SECRETS_RESOLVER_PROVIDER = "none";
135788
+ function parseSecretsResolverProvider(value, fallback = DEFAULT_SECRETS_RESOLVER_PROVIDER) {
135789
+ const raw = String(value ?? "").trim().toLowerCase();
135790
+ if (!raw)
135791
+ return fallback;
135792
+ if (raw === "true")
135793
+ return "aws";
135794
+ if (raw === "false" || raw === "off")
135795
+ return "none";
135796
+ if (SECRETS_RESOLVER_PROVIDERS.includes(raw)) {
135797
+ return raw;
135798
+ }
135799
+ throw new Error(`SECRETS_RESOLVER_PROVIDER_INVALID: expected one of ${SECRETS_RESOLVER_PROVIDERS.join(", ")} (or legacy true/false), received "${value}"`);
135800
+ }
135801
+ function secretsResolverEnvironmentKeys(provider) {
135802
+ switch (provider) {
135803
+ case "aws":
135804
+ return [
135805
+ { key: "AWS_ACCESS_KEY_ID", secret: true },
135806
+ { key: "AWS_SECRET_ACCESS_KEY", secret: true },
135807
+ { key: "AWS_REGION", secret: false },
135808
+ { key: "AWS_SECRET_NAME", secret: false }
135809
+ ];
135810
+ case "azure":
135811
+ return [
135812
+ { key: "AZURE_KEY_VAULT_NAME", secret: false },
135813
+ { key: "AZURE_SECRET_NAME", secret: false },
135814
+ { key: "AZURE_ACCESS_TOKEN", secret: true }
135815
+ ];
135816
+ case "gcp":
135817
+ return [
135818
+ { key: "GCP_PROJECT_ID", secret: false },
135819
+ { key: "GCP_SECRET_NAME", secret: false },
135820
+ { key: "GCP_ACCESS_TOKEN", secret: true }
135821
+ ];
135822
+ case "none":
135823
+ default:
135824
+ return [];
135825
+ }
135826
+ }
135827
+
135593
135828
  // src/action-version.ts
135594
135829
  var import_node_fs3 = require("node:fs");
135595
135830
  var import_node_path2 = require("node:path");
@@ -135606,7 +135841,7 @@ function resolveActionVersion2() {
135606
135841
  }
135607
135842
 
135608
135843
  // src/lib/http-error.ts
135609
- function truncate(value, limit) {
135844
+ function truncate2(value, limit) {
135610
135845
  if (value.length <= limit) {
135611
135846
  return value;
135612
135847
  }
@@ -135616,7 +135851,7 @@ function buildMessage(init) {
135616
135851
  const method = String(init.method || "GET").toUpperCase();
135617
135852
  const status = `${init.status}${init.statusText ? ` ${init.statusText}` : ""}`;
135618
135853
  const url = redactSecrets(init.url, init.secretValues);
135619
- const body = truncate(
135854
+ const body = truncate2(
135620
135855
  redactSecrets(init.responseBody || "", init.secretValues),
135621
135856
  Math.max(0, init.bodyLimit ?? 800)
135622
135857
  );
@@ -136793,6 +137028,12 @@ var postmanRepoSyncActionContract = {
136793
137028
  required: false,
136794
137029
  default: ""
136795
137030
  },
137031
+ "secrets-resolver": {
137032
+ 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.",
137033
+ required: false,
137034
+ default: "none",
137035
+ allowedValues: ["none", "aws", "azure", "gcp"]
137036
+ },
136796
137037
  "credential-preflight": {
136797
137038
  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.",
136798
137039
  required: false,
@@ -136995,31 +137236,13 @@ var PostmanAssetsClient = class {
136995
137236
  }
136996
137237
  };
136997
137238
 
136998
- // src/lib/postman/postman-gateway-assets-client.ts
136999
- var MockContractError = class extends Error {
137000
- constructor(message) {
137001
- super(message);
137002
- this.name = "MockContractError";
137003
- }
137004
- };
137005
- function requireMockVisibility(mock, requested) {
137006
- if (mock.visibility === "unknown") {
137007
- throw new MockContractError(
137008
- `MOCK_VISIBILITY_UNKNOWN: Mock ${mock.uid} did not expose a supported visibility field. Refusing to assume it is callable.`
137009
- );
137010
- }
137011
- if (mock.visibility !== requested) {
137012
- const code = requested === "public" ? "MOCK_NOT_PUBLIC" : "MOCK_NOT_PRIVATE";
137013
- throw new MockContractError(
137014
- `${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}.`
137015
- );
137016
- }
137017
- return mock;
137018
- }
137239
+ // src/lib/postman/private-mock-auth-script.ts
137019
137240
  var LEGACY_PRIVATE_MOCK_AUTH_MARKER = "postman-enterprise-automation: private-mock-auth";
137020
137241
  var PRIVATE_MOCK_AUTH_V2_MARKER = `${LEGACY_PRIVATE_MOCK_AUTH_MARKER}-v2`;
137021
- var PRIVATE_MOCK_AUTH_MARKER = `${LEGACY_PRIVATE_MOCK_AUTH_MARKER}-v3`;
137242
+ var PRIVATE_MOCK_AUTH_V3_MARKER = `${LEGACY_PRIVATE_MOCK_AUTH_MARKER}-v3`;
137022
137243
  var PRIVATE_MOCK_AUTH_VARIABLE2 = "postmanPrivateMockApiKey";
137244
+ var PRIVATE_MOCK_AUTH_ROOT_TYPE = "http:beforeRequest";
137245
+ var PRIVATE_MOCK_AUTH_ROOT_MARKER = `${LEGACY_PRIVATE_MOCK_AUTH_MARKER}-root`;
137023
137246
  var LEGACY_PRIVATE_MOCK_AUTH_SCRIPT = [
137024
137247
  `// ${LEGACY_PRIVATE_MOCK_AUTH_MARKER}`,
137025
137248
  `var privateMockApiKey = pm.variables.get('${PRIVATE_MOCK_AUTH_VARIABLE2}');`,
@@ -137040,8 +137263,8 @@ var PRIVATE_MOCK_AUTH_V2_SCRIPT = [
137040
137263
  ` 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.');`,
137041
137264
  "}"
137042
137265
  ].join("\n");
137043
- var PRIVATE_MOCK_AUTH_SCRIPT = [
137044
- `// ${PRIVATE_MOCK_AUTH_MARKER}`,
137266
+ var PRIVATE_MOCK_AUTH_V3_SCRIPT = [
137267
+ `// ${PRIVATE_MOCK_AUTH_V3_MARKER}`,
137045
137268
  `var privateMockApiKey = pm.variables.get('${PRIVATE_MOCK_AUTH_VARIABLE2}');`,
137046
137269
  "var privateMockHost = '';",
137047
137270
  "try {",
@@ -137057,8 +137280,336 @@ var PRIVATE_MOCK_AUTH_SCRIPT = [
137057
137280
  ` 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.');`,
137058
137281
  "}"
137059
137282
  ].join("\n");
137060
- function removeLegacyPrivateMockAuth(code) {
137061
- return [LEGACY_PRIVATE_MOCK_AUTH_SCRIPT, PRIVATE_MOCK_AUTH_V2_SCRIPT].reduce((next, script) => next.split(script).join(""), code).trim();
137283
+ var PRIVATE_MOCK_AUTH_ROOT_SCRIPT = [
137284
+ `// ${PRIVATE_MOCK_AUTH_ROOT_MARKER}`,
137285
+ `var privateMockApiKey = pm.variables.get('${PRIVATE_MOCK_AUTH_VARIABLE2}');`,
137286
+ "var privateMockHost = '';",
137287
+ "try {",
137288
+ " var privateMockUrl = pm.variables.replaceIn(pm.request.url.toString());",
137289
+ " privateMockHost = new URL(privateMockUrl).hostname;",
137290
+ "} catch (error) {",
137291
+ " console.warn('Could not resolve the request URL for private mock authentication; x-api-key was not added.');",
137292
+ "}",
137293
+ "var isPrivateMockHost = /(^|\\.)mock\\.pstmn\\.io$/i.test(privateMockHost);",
137294
+ "if (isPrivateMockHost && privateMockApiKey) {",
137295
+ " pm.request.headers.upsert({ key: 'x-api-key', value: privateMockApiKey });",
137296
+ "} else if (isPrivateMockHost) {",
137297
+ ` 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.');`,
137298
+ "}"
137299
+ ].join("\n");
137300
+ var MANAGED_ITEM_AUTH_BLOCKS = [
137301
+ LEGACY_PRIVATE_MOCK_AUTH_SCRIPT,
137302
+ PRIVATE_MOCK_AUTH_V2_SCRIPT,
137303
+ PRIVATE_MOCK_AUTH_V3_SCRIPT
137304
+ ];
137305
+ function isManagedPrivateMockAuthRootHook(script) {
137306
+ return String(script.type ?? "") === PRIVATE_MOCK_AUTH_ROOT_TYPE && String(script.code ?? "") === PRIVATE_MOCK_AUTH_ROOT_SCRIPT;
137307
+ }
137308
+ var REGEX_PREFIX_KEYWORDS = /* @__PURE__ */ new Set([
137309
+ "await",
137310
+ "case",
137311
+ "delete",
137312
+ "do",
137313
+ "else",
137314
+ "in",
137315
+ "instanceof",
137316
+ "of",
137317
+ "return",
137318
+ "throw",
137319
+ "typeof",
137320
+ "void",
137321
+ "yield"
137322
+ ]);
137323
+ function isIdentifierStart(ch) {
137324
+ return ch !== void 0 && /[A-Za-z_$]/.test(ch);
137325
+ }
137326
+ function isIdentifierPart(ch) {
137327
+ return ch !== void 0 && /[A-Za-z0-9_$]/.test(ch);
137328
+ }
137329
+ function markTopLevelScriptBytes(source) {
137330
+ const topLevel = new Uint8Array(source.length);
137331
+ let state = "script";
137332
+ let canStartRegex = true;
137333
+ let regexCharacterClass = false;
137334
+ for (let i = 0; i < source.length; i++) {
137335
+ const ch = source[i];
137336
+ const next = source[i + 1];
137337
+ if (state === "script") {
137338
+ topLevel[i] = 1;
137339
+ if (ch === "/" && next === "*") {
137340
+ topLevel[i] = 0;
137341
+ state = "block_comment";
137342
+ i++;
137343
+ topLevel[i] = 0;
137344
+ continue;
137345
+ }
137346
+ if (ch === "/" && next === "/") {
137347
+ topLevel[i + 1] = 1;
137348
+ i++;
137349
+ while (i + 1 < source.length && source[i + 1] !== "\n") {
137350
+ i++;
137351
+ topLevel[i] = 1;
137352
+ }
137353
+ continue;
137354
+ }
137355
+ if (ch === "/") {
137356
+ if (canStartRegex) {
137357
+ topLevel[i] = 0;
137358
+ state = "regex";
137359
+ regexCharacterClass = false;
137360
+ continue;
137361
+ }
137362
+ canStartRegex = true;
137363
+ if (next === "=") {
137364
+ i++;
137365
+ topLevel[i] = 1;
137366
+ }
137367
+ continue;
137368
+ }
137369
+ if (ch === "'") {
137370
+ state = "single";
137371
+ topLevel[i] = 0;
137372
+ continue;
137373
+ }
137374
+ if (ch === '"') {
137375
+ state = "double";
137376
+ topLevel[i] = 0;
137377
+ continue;
137378
+ }
137379
+ if (ch === "`") {
137380
+ state = "template";
137381
+ topLevel[i] = 0;
137382
+ continue;
137383
+ }
137384
+ if (/\s/.test(ch)) {
137385
+ continue;
137386
+ }
137387
+ if (isIdentifierStart(ch)) {
137388
+ let end = i + 1;
137389
+ while (isIdentifierPart(source[end])) {
137390
+ topLevel[end] = 1;
137391
+ end++;
137392
+ }
137393
+ canStartRegex = REGEX_PREFIX_KEYWORDS.has(source.slice(i, end));
137394
+ i = end - 1;
137395
+ continue;
137396
+ }
137397
+ if (/[0-9]/.test(ch)) {
137398
+ let end = i + 1;
137399
+ while (/[A-Za-z0-9_.]/.test(source[end] ?? "")) {
137400
+ topLevel[end] = 1;
137401
+ end++;
137402
+ }
137403
+ canStartRegex = false;
137404
+ i = end - 1;
137405
+ continue;
137406
+ }
137407
+ if ((ch === "+" || ch === "-") && next === ch) {
137408
+ const wasPrefix = canStartRegex;
137409
+ i++;
137410
+ topLevel[i] = 1;
137411
+ canStartRegex = wasPrefix;
137412
+ continue;
137413
+ }
137414
+ if (ch === "?" && next === ".") {
137415
+ i++;
137416
+ topLevel[i] = 1;
137417
+ canStartRegex = false;
137418
+ continue;
137419
+ }
137420
+ if (")]}".includes(ch) || ch === ".") {
137421
+ canStartRegex = false;
137422
+ continue;
137423
+ }
137424
+ if ("([{,;:=!~*%&|^<>+-?".includes(ch)) {
137425
+ canStartRegex = true;
137426
+ continue;
137427
+ }
137428
+ canStartRegex = false;
137429
+ continue;
137430
+ }
137431
+ if (state === "block_comment") {
137432
+ topLevel[i] = 0;
137433
+ if (ch === "*" && next === "/") {
137434
+ topLevel[i] = 0;
137435
+ i++;
137436
+ topLevel[i] = 0;
137437
+ state = "script";
137438
+ }
137439
+ continue;
137440
+ }
137441
+ if (state === "single") {
137442
+ topLevel[i] = 0;
137443
+ if (ch === "\\" && i + 1 < source.length) {
137444
+ i++;
137445
+ topLevel[i] = 0;
137446
+ continue;
137447
+ }
137448
+ if (ch === "'") {
137449
+ state = "script";
137450
+ canStartRegex = false;
137451
+ }
137452
+ continue;
137453
+ }
137454
+ if (state === "double") {
137455
+ topLevel[i] = 0;
137456
+ if (ch === "\\" && i + 1 < source.length) {
137457
+ i++;
137458
+ topLevel[i] = 0;
137459
+ continue;
137460
+ }
137461
+ if (ch === '"') {
137462
+ state = "script";
137463
+ canStartRegex = false;
137464
+ }
137465
+ continue;
137466
+ }
137467
+ if (state === "regex") {
137468
+ topLevel[i] = 0;
137469
+ if (ch === "\\" && i + 1 < source.length) {
137470
+ i++;
137471
+ topLevel[i] = 0;
137472
+ continue;
137473
+ }
137474
+ if (ch === "\n" || ch === "\r") {
137475
+ state = "script";
137476
+ canStartRegex = true;
137477
+ regexCharacterClass = false;
137478
+ continue;
137479
+ }
137480
+ if (ch === "[") {
137481
+ regexCharacterClass = true;
137482
+ continue;
137483
+ }
137484
+ if (ch === "]" && regexCharacterClass) {
137485
+ regexCharacterClass = false;
137486
+ continue;
137487
+ }
137488
+ if (ch === "/" && !regexCharacterClass) {
137489
+ while (isIdentifierPart(source[i + 1])) {
137490
+ i++;
137491
+ topLevel[i] = 0;
137492
+ }
137493
+ state = "script";
137494
+ canStartRegex = false;
137495
+ }
137496
+ continue;
137497
+ }
137498
+ topLevel[i] = 0;
137499
+ if (ch === "\\" && i + 1 < source.length) {
137500
+ i++;
137501
+ topLevel[i] = 0;
137502
+ continue;
137503
+ }
137504
+ if (ch === "`") {
137505
+ state = "script";
137506
+ canStartRegex = false;
137507
+ }
137508
+ }
137509
+ return topLevel;
137510
+ }
137511
+ function isWholeLineTopLevelMatch(source, startIndex, block, topLevel) {
137512
+ if (!source.startsWith(block, startIndex)) {
137513
+ return false;
137514
+ }
137515
+ if (startIndex > 0 && source[startIndex - 1] !== "\n") {
137516
+ return false;
137517
+ }
137518
+ const endIndex = startIndex + block.length;
137519
+ for (let lineStart = startIndex; lineStart < endIndex; ) {
137520
+ if (!topLevel[lineStart]) {
137521
+ return false;
137522
+ }
137523
+ const nextNewline = source.indexOf("\n", lineStart);
137524
+ if (nextNewline === -1 || nextNewline >= endIndex - 1) {
137525
+ break;
137526
+ }
137527
+ lineStart = nextNewline + 1;
137528
+ }
137529
+ return true;
137530
+ }
137531
+ function findManagedBlockRanges(source) {
137532
+ const topLevel = markTopLevelScriptBytes(source);
137533
+ const ranges = [];
137534
+ for (let i = 0; i < source.length; i++) {
137535
+ if (i > 0 && source[i - 1] !== "\n") {
137536
+ continue;
137537
+ }
137538
+ for (const block of MANAGED_ITEM_AUTH_BLOCKS) {
137539
+ if (!isWholeLineTopLevelMatch(source, i, block, topLevel)) {
137540
+ continue;
137541
+ }
137542
+ ranges.push({ start: i, end: i + block.length });
137543
+ break;
137544
+ }
137545
+ }
137546
+ return ranges;
137547
+ }
137548
+ function countManagedItemAuthBlocks(code) {
137549
+ if (typeof code !== "string" || !code) {
137550
+ return 0;
137551
+ }
137552
+ return findManagedBlockRanges(code).length;
137553
+ }
137554
+ function deleteRangeWithSeam(source, start, end) {
137555
+ let before = source.slice(0, start);
137556
+ let after = source.slice(end);
137557
+ const beforeHadNl = before.endsWith("\n");
137558
+ const afterHadNl = after.startsWith("\n");
137559
+ if (beforeHadNl) {
137560
+ before = before.slice(0, -1);
137561
+ }
137562
+ if (afterHadNl) {
137563
+ after = after.slice(1);
137564
+ }
137565
+ if (beforeHadNl && afterHadNl && before.length > 0 && after.length > 0) {
137566
+ return `${before}
137567
+ ${after}`;
137568
+ }
137569
+ return `${before}${after}`;
137570
+ }
137571
+ function stripManagedItemAuthBlocks(code) {
137572
+ if (typeof code !== "string" || !code) {
137573
+ return "";
137574
+ }
137575
+ const ranges = findManagedBlockRanges(code);
137576
+ if (ranges.length === 0) {
137577
+ return code;
137578
+ }
137579
+ ranges.sort((left, right) => right.start - left.start);
137580
+ let next = code;
137581
+ for (const range of ranges) {
137582
+ next = deleteRangeWithSeam(next, range.start, range.end);
137583
+ }
137584
+ return next;
137585
+ }
137586
+
137587
+ // src/lib/postman/postman-gateway-assets-client.ts
137588
+ var MockContractError = class extends Error {
137589
+ constructor(message) {
137590
+ super(message);
137591
+ this.name = "MockContractError";
137592
+ }
137593
+ };
137594
+ var AmbiguousMonitorRebindError = class extends Error {
137595
+ constructor(message, options) {
137596
+ super(message, options);
137597
+ this.name = "AmbiguousMonitorRebindError";
137598
+ }
137599
+ };
137600
+ function requireMockVisibility(mock, requested) {
137601
+ if (mock.visibility === "unknown") {
137602
+ throw new MockContractError(
137603
+ `MOCK_VISIBILITY_UNKNOWN: Mock ${mock.uid} did not expose a supported visibility field. Refusing to assume it is callable.`
137604
+ );
137605
+ }
137606
+ if (mock.visibility !== requested) {
137607
+ const code = requested === "public" ? "MOCK_NOT_PUBLIC" : "MOCK_NOT_PRIVATE";
137608
+ throw new MockContractError(
137609
+ `${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}.`
137610
+ );
137611
+ }
137612
+ return mock;
137062
137613
  }
137063
137614
  var MAX_CREATE_FLIGHTS = 256;
137064
137615
  var createFlights = /* @__PURE__ */ new Map();
@@ -137629,51 +138180,83 @@ var PostmanGatewayAssetsClient = class {
137629
138180
  }
137630
138181
  });
137631
138182
  }
138183
+ isAmbiguousTransportError(error2) {
138184
+ return this.isRetryableIdempotentWriteOutcome(error2);
138185
+ }
138186
+ normalizeCollectionScripts(scripts) {
138187
+ if (!Array.isArray(scripts)) return [];
138188
+ return scripts.map((entry) => this.asRecord(entry)).filter((entry) => entry !== null);
138189
+ }
138190
+ rootScriptsIncludeManagedAuthHook(scripts) {
138191
+ return scripts.some((script) => isManagedPrivateMockAuthRootHook(script));
138192
+ }
138193
+ buildPrivateMockRootScripts(existingScripts) {
138194
+ const managedScript = {
138195
+ type: PRIVATE_MOCK_AUTH_ROOT_TYPE,
138196
+ code: PRIVATE_MOCK_AUTH_ROOT_SCRIPT,
138197
+ language: "text/javascript"
138198
+ };
138199
+ return [...existingScripts, managedScript];
138200
+ }
138201
+ async readCollectionRootScripts(collectionUid) {
138202
+ const id = this.toModelId(collectionUid);
138203
+ const response = await this.gateway.requestJson({
138204
+ service: "collection",
138205
+ method: "get",
138206
+ path: `/v3/collections/${id}/export`
138207
+ });
138208
+ const data = this.asRecord(response?.data);
138209
+ const collection = this.asRecord(data?.collection);
138210
+ if (!collection) {
138211
+ throw new Error(
138212
+ `PRIVATE_MOCK_AUTH_EXPORT_INVALID: Collection ${id} export did not return data.collection; refusing to configure private-mock root auth from an unexpected envelope.`
138213
+ );
138214
+ }
138215
+ return this.normalizeCollectionScripts(collection.scripts);
138216
+ }
138217
+ async patchCollectionRootScripts(collectionUid, scripts) {
138218
+ const id = this.toModelId(collectionUid);
138219
+ await this.gateway.requestJson(
138220
+ {
138221
+ service: "collection",
138222
+ method: "patch",
138223
+ path: `/v3/collections/${id}`,
138224
+ body: [{ op: "add", path: "/scripts", value: scripts }]
138225
+ },
138226
+ { retryTransient: false }
138227
+ );
138228
+ }
137632
138229
  /**
137633
- * Add a secret-free runtime hook to every HTTP request in a collection. The
137634
- * PMAK value is supplied only by the runner as a transient variable; this
137635
- * method persists the variable name and header wiring, never the credential.
138230
+ * Add a secret-free runtime hook at the collection root. The PMAK value is
138231
+ * supplied only by the runner as a transient variable; this method persists
138232
+ * the variable name and header wiring, never the credential.
137636
138233
  */
137637
138234
  async configurePrivateMockRuntimeAuth(collectionUid) {
137638
138235
  const cid = String(collectionUid ?? "").trim();
137639
138236
  if (!cid) return 0;
137640
- const listed = await this.gateway.requestJson({
137641
- service: "collection",
137642
- method: "get",
137643
- path: `/v3/collections/${cid}/items/`
137644
- });
137645
- const items = Array.isArray(listed?.data) ? listed.data : [];
137646
- let patched = 0;
137647
- for (const listedItem of items) {
137648
- if (String(listedItem.$kind ?? "") !== "http-request") continue;
137649
- const itemId = String(listedItem.id ?? "").trim();
137650
- if (!itemId) continue;
137651
- const response = await this.gateway.requestJson({
137652
- service: "collection",
137653
- method: "get",
137654
- path: `/v3/collections/${cid}/items/${itemId}`,
137655
- headers: { "X-Entity-Type": "http-request" }
137656
- });
137657
- const item = this.asRecord(response?.data) ?? listedItem;
137658
- const scripts = Array.isArray(item.scripts) ? item.scripts.filter((entry) => Boolean(this.asRecord(entry))) : [];
137659
- const before = scripts.find((script) => String(script.type ?? "") === "beforeRequest");
137660
- const existingCode = String(before?.code ?? "");
137661
- if (existingCode.includes(PRIVATE_MOCK_AUTH_MARKER)) continue;
137662
- const code = [removeLegacyPrivateMockAuth(existingCode), PRIVATE_MOCK_AUTH_SCRIPT].filter(Boolean).join("\n");
137663
- const nextScripts = [
137664
- ...scripts.filter((script) => String(script.type ?? "") !== "beforeRequest"),
137665
- { type: "beforeRequest", code, language: "text/javascript" }
137666
- ];
137667
- await this.gateway.requestJson({
137668
- service: "collection",
137669
- method: "patch",
137670
- path: `/v3/collections/${cid}/items/${itemId}`,
137671
- headers: { "X-Entity-Type": "http-request" },
137672
- body: [{ op: "add", path: "/scripts", value: nextScripts }]
137673
- });
137674
- patched += 1;
137675
- }
137676
- return patched;
138237
+ const installFromFreshRoot = async (existingScripts) => {
138238
+ if (this.rootScriptsIncludeManagedAuthHook(existingScripts)) {
138239
+ return 0;
138240
+ }
138241
+ const nextScripts = this.buildPrivateMockRootScripts(existingScripts);
138242
+ try {
138243
+ await this.patchCollectionRootScripts(cid, nextScripts);
138244
+ return 1;
138245
+ } catch (error2) {
138246
+ if (!this.isAmbiguousTransportError(error2)) {
138247
+ throw error2;
138248
+ }
138249
+ const freshScripts = await this.readCollectionRootScripts(cid);
138250
+ if (this.rootScriptsIncludeManagedAuthHook(freshScripts)) {
138251
+ return 1;
138252
+ }
138253
+ const recomputed = this.buildPrivateMockRootScripts(freshScripts);
138254
+ await this.patchCollectionRootScripts(cid, recomputed);
138255
+ return 1;
138256
+ }
138257
+ };
138258
+ const scripts = await this.readCollectionRootScripts(cid);
138259
+ return installFromFreshRoot(scripts);
137677
138260
  }
137678
138261
  async listMocks() {
137679
138262
  const response = await this.gateway.requestJson({
@@ -137757,12 +138340,13 @@ var PostmanGatewayAssetsClient = class {
137757
138340
  }
137758
138341
  async createMonitor(workspaceId, name, collectionUid, environmentUid, cronSchedule) {
137759
138342
  const ws = workspaceId || this.workspaceId;
137760
- const effectiveCron = cronSchedule && cronSchedule.trim() ? cronSchedule.trim() : "0 0 * * 0";
138343
+ const cronTrimmed = String(cronSchedule ?? "").trim();
138344
+ const hasCron = cronTrimmed.length > 0;
137761
138345
  const monitorName = String(name ?? "").trim();
137762
138346
  const collection = String(collectionUid ?? "").trim();
137763
138347
  const environment = String(environmentUid ?? "").trim();
137764
138348
  const flightKey = `monitor:${ws}:${collection}:${environment}:${monitorName}`;
137765
- return this.singleFlight(flightKey, effectiveCron, "monitor", async () => {
138349
+ return this.singleFlight(flightKey, hasCron ? cronTrimmed : "inactive", "monitor", async () => {
137766
138350
  const existing = await this.findMonitorByCollection(collection, environment, monitorName);
137767
138351
  if (existing?.uid) {
137768
138352
  return existing.uid;
@@ -137770,11 +138354,12 @@ var PostmanGatewayAssetsClient = class {
137770
138354
  const body = {
137771
138355
  name: monitorName,
137772
138356
  collection,
138357
+ active: hasCron,
137773
138358
  options: { strictSSL: false, followRedirects: true, requestTimeout: null, requestDelay: 0 },
137774
138359
  notifications: { onFailure: [], onError: [] },
137775
138360
  retry: {},
137776
- schedule: { cronPattern: effectiveCron, timeZone: "UTC" },
137777
138361
  distribution: null,
138362
+ ...hasCron ? { schedule: { cronPattern: cronTrimmed, timeZone: "UTC" } } : {},
137778
138363
  ...environment ? { environment } : {}
137779
138364
  };
137780
138365
  const send2 = (fallback) => this.gateway.requestJson(
@@ -137848,6 +138433,73 @@ var PostmanGatewayAssetsClient = class {
137848
138433
  );
137849
138434
  return match?.uid ? { uid: match.uid, name: match.name } : null;
137850
138435
  }
138436
+ pickRebindMonitorCandidates(monitors, monitorName, environment) {
138437
+ const nameOnly = monitors.filter((monitor) => monitor.name === monitorName);
138438
+ const nameOnlyEnvironments = [
138439
+ ...new Set(nameOnly.map((monitor) => monitor.environmentUid || "(none)"))
138440
+ ];
138441
+ const candidates = nameOnly.filter((monitor) => monitor.environmentUid === environment);
138442
+ return { candidates, nameOnlyMatchCount: nameOnly.length, nameOnlyEnvironments };
138443
+ }
138444
+ /**
138445
+ * Rebind the sole same-name monitor in this workspace onto the current
138446
+ * collection UID.
138447
+ *
138448
+ * The canonical Smoke collection can legitimately change UID (a bootstrap
138449
+ * re-import after a marker/stranger miss, or an operator rebuild). The
138450
+ * monitor still points at the previous UID, so `findMonitorByCollection`
138451
+ * (which requires the full collection+environment+name triple) misses and a
138452
+ * second monitor with the same name would be created on every run, orphaning
138453
+ * the old one. Name plus environment is the stable identity across a
138454
+ * collection re-import, so recover it here instead.
138455
+ *
138456
+ * Returns null when nothing needs rebinding (no same-name monitor, or it is
138457
+ * already bound to this collection). Refuses to guess when several same-name
138458
+ * monitors match, matching `selectExactMatch` semantics elsewhere.
138459
+ */
138460
+ async rebindMonitorByName(name, collectionUid, environmentUid) {
138461
+ const monitorName = String(name ?? "").trim();
138462
+ const collection = String(collectionUid ?? "").trim();
138463
+ const environment = String(environmentUid ?? "").trim();
138464
+ if (!monitorName || !collection) {
138465
+ return null;
138466
+ }
138467
+ const monitors = await this.listMonitors();
138468
+ const { candidates, nameOnlyMatchCount, nameOnlyEnvironments } = this.pickRebindMonitorCandidates(
138469
+ monitors,
138470
+ monitorName,
138471
+ environment
138472
+ );
138473
+ let match;
138474
+ try {
138475
+ match = this.selectExactMatch(
138476
+ "monitor",
138477
+ `workspace ${this.workspaceId}, name "${monitorName}", and environment ${environment || "(none)"}`,
138478
+ candidates
138479
+ );
138480
+ } catch (error2) {
138481
+ const message = error2 instanceof Error && nameOnlyMatchCount > 0 ? `${error2.message} Same-name monitor(s) also exist on environment(s): ${nameOnlyEnvironments.join(", ")}.` : error2 instanceof Error ? error2.message : String(error2);
138482
+ throw new AmbiguousMonitorRebindError(message, { cause: error2 });
138483
+ }
138484
+ if (!match?.uid) {
138485
+ if (nameOnlyMatchCount > 0) {
138486
+ }
138487
+ return null;
138488
+ }
138489
+ if (match.collectionUid === collection) {
138490
+ return null;
138491
+ }
138492
+ await this.gateway.requestJson(
138493
+ {
138494
+ service: "monitors",
138495
+ method: "put",
138496
+ path: `/jobTemplates/${this.toModelId(match.uid)}?_etc=true`,
138497
+ body: { collection }
138498
+ },
138499
+ { retryTransient: false }
138500
+ );
138501
+ return { uid: match.uid, previousCollectionUid: match.collectionUid };
138502
+ }
137851
138503
  async runMonitor(uid) {
137852
138504
  await this.gateway.requestJson(
137853
138505
  {
@@ -137860,6 +138512,128 @@ var PostmanGatewayAssetsClient = class {
137860
138512
  }
137861
138513
  };
137862
138514
 
138515
+ // src/lib/postman/private-mock-export-cleanup.ts
138516
+ function asArray2(value) {
138517
+ return Array.isArray(value) ? value : [];
138518
+ }
138519
+ function cloneScriptRecord(script) {
138520
+ if (!script || typeof script !== "object" || Array.isArray(script)) {
138521
+ return script;
138522
+ }
138523
+ return { ...script };
138524
+ }
138525
+ function cloneCollectionNodeIterative(collection) {
138526
+ const cloned = { ...collection };
138527
+ if (Array.isArray(collection.scripts)) {
138528
+ cloned.scripts = collection.scripts.map((script) => cloneScriptRecord(script));
138529
+ }
138530
+ const stack = [];
138531
+ const attachNested = (source, target) => {
138532
+ if (Array.isArray(source.scripts)) {
138533
+ target.scripts = source.scripts.map((script) => cloneScriptRecord(script));
138534
+ }
138535
+ for (const key of ["items", "children"]) {
138536
+ const nested = asArray2(source[key]);
138537
+ if (nested.length === 0) {
138538
+ continue;
138539
+ }
138540
+ const clonedNested = nested.map((item) => ({ ...item }));
138541
+ target[key] = clonedNested;
138542
+ for (let i = 0; i < nested.length; i += 1) {
138543
+ stack.push({ source: nested[i], target: clonedNested[i] });
138544
+ }
138545
+ }
138546
+ };
138547
+ attachNested(collection, cloned);
138548
+ while (stack.length > 0) {
138549
+ const frame = stack.pop();
138550
+ attachNested(frame.source, frame.target);
138551
+ }
138552
+ return cloned;
138553
+ }
138554
+ function cloneCollection(collection) {
138555
+ if (typeof globalThis.structuredClone === "function") {
138556
+ try {
138557
+ return globalThis.structuredClone(collection);
138558
+ } catch {
138559
+ }
138560
+ }
138561
+ try {
138562
+ return JSON.parse(JSON.stringify(collection));
138563
+ } catch {
138564
+ return cloneCollectionNodeIterative(collection);
138565
+ }
138566
+ }
138567
+ function isPrivateMockLegacyExportCleanupEnabled() {
138568
+ const value = String(process.env.POSTMAN_PRIVATE_MOCK_LEGACY_EXPORT_CLEANUP ?? "").trim().toLowerCase();
138569
+ return value !== "off";
138570
+ }
138571
+ function verifyPrivateMockRootHook(collection) {
138572
+ const scripts = asArray2(collection.scripts);
138573
+ return scripts.some((script) => isManagedPrivateMockAuthRootHook(script));
138574
+ }
138575
+ function applyPrivateMockExportCleanup(collection, options = {}) {
138576
+ const stripManagedBlocks = options.stripManagedBlocks ?? isPrivateMockLegacyExportCleanupEnabled();
138577
+ const cloned = cloneCollection(collection);
138578
+ let strippedBlocks = 0;
138579
+ const visitItem = (item) => {
138580
+ if (!stripManagedBlocks) {
138581
+ return;
138582
+ }
138583
+ const scripts = item.scripts;
138584
+ if (!Array.isArray(scripts)) {
138585
+ return;
138586
+ }
138587
+ const nextScripts = [];
138588
+ for (const script of scripts) {
138589
+ if (!script || typeof script !== "object" || Array.isArray(script)) {
138590
+ nextScripts.push(script);
138591
+ continue;
138592
+ }
138593
+ const record = script;
138594
+ if (String(record.type ?? "") !== "beforeRequest") {
138595
+ nextScripts.push(record);
138596
+ continue;
138597
+ }
138598
+ const originalCode = String(record.code ?? "");
138599
+ const cleaned = stripManagedItemAuthBlocks(originalCode);
138600
+ if (cleaned === originalCode) {
138601
+ nextScripts.push(record);
138602
+ continue;
138603
+ }
138604
+ strippedBlocks += countManagedItemAuthBlocks(originalCode);
138605
+ if (!cleaned) {
138606
+ continue;
138607
+ }
138608
+ nextScripts.push({ ...record, code: cleaned });
138609
+ }
138610
+ if (nextScripts.length === 0) {
138611
+ delete item.scripts;
138612
+ } else {
138613
+ item.scripts = nextScripts;
138614
+ }
138615
+ };
138616
+ const walkItemsIteratively = (rootItems) => {
138617
+ const stack = [...rootItems].reverse();
138618
+ while (stack.length > 0) {
138619
+ const item = stack.pop();
138620
+ visitItem(item);
138621
+ for (const key of ["items", "children"]) {
138622
+ const nested = asArray2(item[key]);
138623
+ for (let i = nested.length - 1; i >= 0; i -= 1) {
138624
+ stack.push(nested[i]);
138625
+ }
138626
+ }
138627
+ }
138628
+ };
138629
+ walkItemsIteratively(asArray2(cloned.items));
138630
+ return {
138631
+ collection: cloned,
138632
+ strippedBlocks,
138633
+ rootVerified: verifyPrivateMockRootHook(cloned)
138634
+ };
138635
+ }
138636
+
137863
138637
  // src/lib/postman/token-provider.ts
137864
138638
  var MintError = class extends Error {
137865
138639
  permanent;
@@ -138669,6 +139443,15 @@ var identitySecretMasker = (input) => input;
138669
139443
  function resolveRepoSyncMasker(dependencies) {
138670
139444
  return dependencies.secretMasker ?? identitySecretMasker;
138671
139445
  }
139446
+ function resolveRepoSyncLogger(dependencies) {
139447
+ return dependencies.logger ?? createLogger({
139448
+ sink: actionSink(dependencies.core),
139449
+ fields: {
139450
+ action: "postman-repo-sync-action",
139451
+ action_version: resolveActionVersion2()
139452
+ }
139453
+ });
139454
+ }
138672
139455
  function causeText(cause) {
138673
139456
  return cause instanceof Error ? cause.message : String(cause);
138674
139457
  }
@@ -138889,6 +139672,7 @@ function resolveInputs(env = process.env) {
138889
139672
  env
138890
139673
  );
138891
139674
  const environments = parseJsonArray(getInput2("environments-json", env) || '["prod"]');
139675
+ const secretsResolverProvider = parseSecretsResolverProvider(getInput2("secrets-resolver", env));
138892
139676
  const systemEnvMap = parseJsonMap(getInput2("system-env-map-json", env) || "{}");
138893
139677
  const environmentUids = parseJsonMap(getInput2("environment-uids-json", env) || "{}");
138894
139678
  const envRuntimeUrls = parseJsonMap(getInput2("env-runtime-urls-json", env) || "{}");
@@ -138906,6 +139690,7 @@ function resolveInputs(env = process.env) {
138906
139690
  specContentChanged: parseBooleanInput(getInput2("spec-content-changed", env), true),
138907
139691
  specPath: getInput2("spec-path", env),
138908
139692
  collectionSyncMode: normalizeCollectionSyncMode(getInput2("collection-sync-mode", env) || "refresh"),
139693
+ secretsResolverProvider,
138909
139694
  specSyncMode: normalizeSpecSyncMode(getInput2("spec-sync-mode", env) || "update"),
138910
139695
  releaseLabel: normalizeReleaseLabel(getInput2("release-label", env)) || void 0,
138911
139696
  environments: environments.length > 0 ? environments : ["prod"],
@@ -139004,10 +139789,14 @@ function buildEnvironmentValues(envName, baseUrl, options = {}) {
139004
139789
  ...options.privateMockAuth ? [{ key: PRIVATE_MOCK_AUTH_VARIABLE2, value: "", type: "secret" }] : [],
139005
139790
  { key: "CI", value: "false", type: "default" },
139006
139791
  { key: "RESPONSE_TIME_THRESHOLD", value: "2000", type: "default" },
139007
- { key: "AWS_ACCESS_KEY_ID", value: "", type: "secret" },
139008
- { key: "AWS_SECRET_ACCESS_KEY", value: "", type: "secret" },
139009
- { key: "AWS_REGION", value: "eu-west-2", type: "default" },
139010
- { key: "AWS_SECRET_NAME", value: `api-credentials-${envName}`, type: "default" }
139792
+ // Provider-scoped credential slots. `none` (the default) seeds nothing, so a
139793
+ // consumer that does not use a cloud secret store gets a clean environment
139794
+ // instead of four dead AWS variables.
139795
+ ...secretsResolverEnvironmentKeys(options.secretsResolverProvider ?? "none").map((entry) => ({
139796
+ key: entry.key,
139797
+ value: entry.key.endsWith("_SECRET_NAME") && !entry.secret ? `api-credentials-${envName}` : entry.defaultValue ?? "",
139798
+ type: entry.secret ? "secret" : "default"
139799
+ }))
139011
139800
  ];
139012
139801
  }
139013
139802
  var LEGACY_BASELINE_COLLECTION_PREFIX = "[Baseline]";
@@ -139085,13 +139874,51 @@ function normalizeToPosix(filePath) {
139085
139874
  function canonicalizeRelativePath(value) {
139086
139875
  return normalizeToPosix(String(value ?? "").trim()).replace(/^\.\/+/, "").replace(/\/{2,}/g, "/").replace(/\/+$/g, "");
139087
139876
  }
139088
- function isOpenApiSpecFile(filePath) {
139089
- if (!(filePath.endsWith(".json") || filePath.endsWith(".yaml") || filePath.endsWith(".yml"))) {
139090
- return false;
139877
+ var LOCAL_SPEC_DISCOVERY_MAX_DEPTH = 6;
139878
+ var LOCAL_SPEC_DISCOVERY_MAX_TRAVERSAL_ENTRIES = 1e4;
139879
+ var LOCAL_SPEC_DISCOVERY_MAX_CANDIDATE_FILES = 200;
139880
+ var LOCAL_SPEC_DISCOVERY_MAX_CANDIDATE_FILE_BYTES = 512 * 1024;
139881
+ var LOCAL_SPEC_DISCOVERY_IGNORED_DIRS = /* @__PURE__ */ new Set([
139882
+ ".git",
139883
+ ".nyc_output",
139884
+ ".omc",
139885
+ ".omx",
139886
+ ".llm-plans",
139887
+ ".pulumi",
139888
+ ".terraform",
139889
+ ".venv",
139890
+ "__pycache__",
139891
+ "bin",
139892
+ "build",
139893
+ "coverage",
139894
+ "discovered-specs",
139895
+ "node_modules",
139896
+ "dist",
139897
+ "obj",
139898
+ "out",
139899
+ "target",
139900
+ "vendor",
139901
+ "venv"
139902
+ ]);
139903
+ var LocalSpecDiscoveryLimitError = class extends Error {
139904
+ code = "CONTRACT_LOCAL_SPEC_DISCOVERY_LIMIT";
139905
+ constructor(message) {
139906
+ super(`CONTRACT_LOCAL_SPEC_DISCOVERY_LIMIT: ${message}`);
139907
+ this.name = "LocalSpecDiscoveryLimitError";
139091
139908
  }
139909
+ };
139910
+ function failLocalSpecDiscoveryLimit(detail) {
139911
+ throw new LocalSpecDiscoveryLimitError(
139912
+ `${detail} Set spec-path to the OpenAPI file explicitly and keep generated trees (for example dist/, node_modules/) out of the repository layout.`
139913
+ );
139914
+ }
139915
+ function isSpecCandidateExtension(filePath) {
139916
+ return filePath.endsWith(".json") || filePath.endsWith(".yaml") || filePath.endsWith(".yml");
139917
+ }
139918
+ function readOpenApiSpecFile(fullPath) {
139092
139919
  try {
139093
- const raw = (0, import_node_fs5.readFileSync)(filePath, "utf8");
139094
- const parsed = filePath.endsWith(".json") ? JSON.parse(raw) : load(raw);
139920
+ const raw = (0, import_node_fs5.readFileSync)(fullPath, "utf8");
139921
+ const parsed = fullPath.endsWith(".json") ? JSON.parse(raw) : load(raw);
139095
139922
  if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) {
139096
139923
  return false;
139097
139924
  }
@@ -139107,28 +139934,75 @@ function isOpenApiSpecFile(filePath) {
139107
139934
  }
139108
139935
  return false;
139109
139936
  }
139110
- function scanLocalSpecReferences(baseDir = ".") {
139111
- const ignoredDirs = /* @__PURE__ */ new Set([
139112
- ".git",
139113
- ".omc",
139114
- ".omx",
139115
- ".llm-plans",
139116
- "node_modules",
139117
- "dist"
139118
- ]);
139937
+ function shouldIgnoreSpecDiscoveryEntry(entryName, currentDir, baseDir, ignoredPrefixes) {
139938
+ if (LOCAL_SPEC_DISCOVERY_IGNORED_DIRS.has(entryName)) {
139939
+ return true;
139940
+ }
139941
+ const relative4 = normalizeToPosix(path8.relative(baseDir, path8.join(currentDir, entryName)));
139942
+ return ignoredPrefixes.some(
139943
+ (prefix) => relative4 === prefix || relative4.startsWith(`${prefix}/`)
139944
+ );
139945
+ }
139946
+ function scanLocalSpecReferences(baseDir = ".", options = {}) {
139947
+ const ignoredPrefixes = (options.ignoredPrefixes ?? []).map((value) => canonicalizeRelativePath(value)).filter(Boolean);
139119
139948
  const found = /* @__PURE__ */ new Set();
139120
139949
  const refs = [];
139121
- const visit2 = (currentDir) => {
139122
- for (const entry of (0, import_node_fs5.readdirSync)(currentDir, { withFileTypes: true })) {
139123
- if (ignoredDirs.has(entry.name)) {
139950
+ let traversalEntries = 0;
139951
+ let candidateFiles = 0;
139952
+ const pendingDirs = [{ dir: baseDir, depth: 0 }];
139953
+ while (pendingDirs.length > 0) {
139954
+ const { dir: currentDir, depth: currentDepth } = pendingDirs.shift();
139955
+ let entries;
139956
+ try {
139957
+ entries = (0, import_node_fs5.readdirSync)(currentDir, { withFileTypes: true }).sort(
139958
+ (left, right) => left.name.localeCompare(right.name)
139959
+ );
139960
+ } catch {
139961
+ continue;
139962
+ }
139963
+ for (const entry of entries) {
139964
+ traversalEntries += 1;
139965
+ if (traversalEntries > LOCAL_SPEC_DISCOVERY_MAX_TRAVERSAL_ENTRIES) {
139966
+ failLocalSpecDiscoveryLimit(
139967
+ `local spec discovery exceeded the ${LOCAL_SPEC_DISCOVERY_MAX_TRAVERSAL_ENTRIES} traversal-entry liveness budget.`
139968
+ );
139969
+ }
139970
+ if (shouldIgnoreSpecDiscoveryEntry(entry.name, currentDir, baseDir, ignoredPrefixes)) {
139124
139971
  continue;
139125
139972
  }
139126
139973
  const fullPath = path8.join(currentDir, entry.name);
139127
139974
  if (entry.isDirectory()) {
139128
- visit2(fullPath);
139975
+ const nextDepth = currentDepth + 1;
139976
+ if (nextDepth > LOCAL_SPEC_DISCOVERY_MAX_DEPTH) {
139977
+ failLocalSpecDiscoveryLimit(
139978
+ `local spec discovery exceeded the ${LOCAL_SPEC_DISCOVERY_MAX_DEPTH} directory-depth budget.`
139979
+ );
139980
+ }
139981
+ pendingDirs.push({ dir: fullPath, depth: nextDepth });
139129
139982
  continue;
139130
139983
  }
139131
- if (!entry.isFile() || !isOpenApiSpecFile(fullPath)) {
139984
+ if (!entry.isFile() || !isSpecCandidateExtension(fullPath)) {
139985
+ continue;
139986
+ }
139987
+ candidateFiles += 1;
139988
+ if (candidateFiles > LOCAL_SPEC_DISCOVERY_MAX_CANDIDATE_FILES) {
139989
+ failLocalSpecDiscoveryLimit(
139990
+ `local spec discovery exceeded the ${LOCAL_SPEC_DISCOVERY_MAX_CANDIDATE_FILES} candidate-file budget.`
139991
+ );
139992
+ }
139993
+ let sizeBytes;
139994
+ try {
139995
+ sizeBytes = (0, import_node_fs5.statSync)(fullPath).size;
139996
+ } catch {
139997
+ continue;
139998
+ }
139999
+ if (sizeBytes > LOCAL_SPEC_DISCOVERY_MAX_CANDIDATE_FILE_BYTES) {
140000
+ const repoRelativePath2 = normalizeToPosix(path8.relative(baseDir, fullPath));
140001
+ failLocalSpecDiscoveryLimit(
140002
+ `local spec discovery candidate ${repoRelativePath2} exceeds ${LOCAL_SPEC_DISCOVERY_MAX_CANDIDATE_FILE_BYTES} bytes.`
140003
+ );
140004
+ }
140005
+ if (!readOpenApiSpecFile(fullPath)) {
139132
140006
  continue;
139133
140007
  }
139134
140008
  const repoRelativePath = normalizeToPosix(path8.relative(baseDir, fullPath));
@@ -139141,20 +140015,36 @@ function scanLocalSpecReferences(baseDir = ".") {
139141
140015
  configRelativePath: normalizeToPosix(path8.join("..", repoRelativePath))
139142
140016
  });
139143
140017
  }
139144
- };
139145
- visit2(baseDir);
140018
+ }
139146
140019
  return refs.sort((left, right) => left.repoRelativePath.localeCompare(right.repoRelativePath));
139147
140020
  }
139148
- function resolveMappedSpecReference(explicitSpecPath, discoveredSpecs) {
140021
+ function tryResolveExplicitSpecReference(explicitSpecPath) {
139149
140022
  const normalizedExplicitPath = normalizeToPosix(explicitSpecPath.trim());
139150
- if (normalizedExplicitPath) {
139151
- const explicitFullPath = path8.resolve(normalizedExplicitPath);
139152
- if ((0, import_node_fs5.existsSync)(explicitFullPath) && (0, import_node_fs5.statSync)(explicitFullPath).isFile()) {
139153
- return {
139154
- repoRelativePath: normalizedExplicitPath,
139155
- configRelativePath: normalizeToPosix(path8.join("..", normalizedExplicitPath))
139156
- };
139157
- }
140023
+ if (!normalizedExplicitPath) {
140024
+ return void 0;
140025
+ }
140026
+ const explicitFullPath = path8.resolve(normalizedExplicitPath);
140027
+ if ((0, import_node_fs5.existsSync)(explicitFullPath) && (0, import_node_fs5.statSync)(explicitFullPath).isFile()) {
140028
+ return {
140029
+ repoRelativePath: normalizedExplicitPath,
140030
+ configRelativePath: normalizeToPosix(path8.join("..", normalizedExplicitPath))
140031
+ };
140032
+ }
140033
+ return void 0;
140034
+ }
140035
+ function resolveLocalSpecReferences(explicitSpecPath, baseDir = ".", options = {}) {
140036
+ const explicit = tryResolveExplicitSpecReference(explicitSpecPath);
140037
+ if (explicit) {
140038
+ return { discoveredSpecs: [], mappedSpec: explicit };
140039
+ }
140040
+ const discoveredSpecs = scanLocalSpecReferences(baseDir, options);
140041
+ const mappedSpec = resolveMappedSpecReference(explicitSpecPath, discoveredSpecs);
140042
+ return { discoveredSpecs, mappedSpec };
140043
+ }
140044
+ function resolveMappedSpecReference(explicitSpecPath, discoveredSpecs) {
140045
+ const explicit = tryResolveExplicitSpecReference(explicitSpecPath);
140046
+ if (explicit) {
140047
+ return explicit;
139158
140048
  }
139159
140049
  if (discoveredSpecs.length === 1) {
139160
140050
  return discoveredSpecs[0];
@@ -139404,7 +140294,9 @@ async function upsertEnvironments(inputs, dependencies, resourcesState, assetMar
139404
140294
  } catch {
139405
140295
  }
139406
140296
  }
139407
- const values2 = buildEnvironmentValues(envName, runtimeUrl);
140297
+ const values2 = buildEnvironmentValues(envName, runtimeUrl, {
140298
+ secretsResolverProvider: inputs.secretsResolverProvider
140299
+ });
139408
140300
  if (marker) values2.push({ key: "x-pm-onboarding", value: JSON.stringify(marker), type: "default" });
139409
140301
  try {
139410
140302
  await dependencies.postman.updateEnvironment(existingUid, displayName, values2);
@@ -139424,7 +140316,9 @@ async function upsertEnvironments(inputs, dependencies, resourcesState, assetMar
139424
140316
  dependencies.core.setOutput("environment-uids-json", JSON.stringify(envUids));
139425
140317
  continue;
139426
140318
  }
139427
- const values = buildEnvironmentValues(envName, runtimeUrl);
140319
+ const values = buildEnvironmentValues(envName, runtimeUrl, {
140320
+ secretsResolverProvider: inputs.secretsResolverProvider
140321
+ });
139428
140322
  if (assetMarker) values.push({ key: "x-pm-onboarding", value: JSON.stringify(assetMarker), type: "default" });
139429
140323
  try {
139430
140324
  envUids[envName] = await dependencies.postman.createEnvironment(
@@ -139453,7 +140347,10 @@ async function upsertMockEnvironment(inputs, dependencies, assetProjectName, moc
139453
140347
  return "";
139454
140348
  }
139455
140349
  const displayName = `${assetProjectName} - Mock`;
139456
- const values = buildEnvironmentValues("mock", mockUrl, { privateMockAuth });
140350
+ const values = buildEnvironmentValues("mock", mockUrl, {
140351
+ privateMockAuth,
140352
+ secretsResolverProvider: inputs.secretsResolverProvider
140353
+ });
139457
140354
  const mask = resolveRepoSyncMasker(dependencies);
139458
140355
  try {
139459
140356
  const discovered = await dependencies.postman.findEnvironmentByName(
@@ -139975,6 +140872,18 @@ function tryReusePrebuiltCollection(options) {
139975
140872
  }
139976
140873
  return prepared.artifactDigest === entry.artifactDigest;
139977
140874
  }
140875
+ async function preparePrivateMockCloudCollection(role, collectionId, postman) {
140876
+ const col = await postman.getCollection(collectionId);
140877
+ const { collection } = applyPrivateMockExportCleanup(col, {
140878
+ stripManagedBlocks: isPrivateMockLegacyExportCleanupEnabled()
140879
+ });
140880
+ if (!verifyPrivateMockRootHook(collection)) {
140881
+ throw new Error(
140882
+ `PRIVATE_MOCK_AUTH_ROOT_UNVERIFIED: Managed root hook missing from exported ${role} collection ${collectionId}`
140883
+ );
140884
+ }
140885
+ return collection;
140886
+ }
139978
140887
  async function exportCollectionArtifact(options) {
139979
140888
  const {
139980
140889
  role,
@@ -139983,14 +140892,17 @@ async function exportCollectionArtifact(options) {
139983
140892
  collectionsDir,
139984
140893
  prebuiltByRole,
139985
140894
  postman,
139986
- core
140895
+ core,
140896
+ privateMockAuth = false,
140897
+ preparedCloudCollection
139987
140898
  } = options;
139988
140899
  if (!collectionId) {
139989
140900
  return void 0;
139990
140901
  }
139991
140902
  const expectedPath = `${collectionsDir}/${dirName}`;
140903
+ const forceCloudExport = privateMockAuth && (role === "smoke" || role === "contract");
139992
140904
  const entry = prebuiltByRole.get(role);
139993
- if (entry) {
140905
+ if (entry && !forceCloudExport) {
139994
140906
  const reused = tryReusePrebuiltCollection({
139995
140907
  prepared: entry,
139996
140908
  expectedPath,
@@ -140005,12 +140917,30 @@ async function exportCollectionArtifact(options) {
140005
140917
  core.info(
140006
140918
  `Prebuilt ${role} collection entry present but did not exactly match; exporting from cloud`
140007
140919
  );
140920
+ } else if (entry && forceCloudExport) {
140921
+ core.info(
140922
+ `Private mock requires cloud export for ${role} collection to reconcile managed root hook; exporting from cloud`
140923
+ );
140008
140924
  }
140009
- const col = await postman.getCollection(collectionId);
140010
- await convertAndSplitAnyCollection(
140011
- col,
140012
- expectedPath
140013
- );
140925
+ let collectionForExport;
140926
+ if (forceCloudExport && preparedCloudCollection) {
140927
+ collectionForExport = preparedCloudCollection;
140928
+ } else if (forceCloudExport) {
140929
+ const col = await postman.getCollection(collectionId);
140930
+ const { collection } = applyPrivateMockExportCleanup(col, {
140931
+ stripManagedBlocks: isPrivateMockLegacyExportCleanupEnabled()
140932
+ });
140933
+ if (!verifyPrivateMockRootHook(collection)) {
140934
+ throw new Error(
140935
+ `PRIVATE_MOCK_AUTH_ROOT_UNVERIFIED: Managed root hook missing from exported ${role} collection ${collectionId}`
140936
+ );
140937
+ }
140938
+ collectionForExport = collection;
140939
+ } else {
140940
+ const col = await postman.getCollection(collectionId);
140941
+ collectionForExport = col;
140942
+ }
140943
+ await convertAndSplitAnyCollection(collectionForExport, expectedPath);
140014
140944
  return `../${expectedPath}`;
140015
140945
  }
140016
140946
  function hasControlCharacter2(value) {
@@ -140063,32 +140993,37 @@ async function exportArtifacts(inputs, dependencies, envUids, assetProjectName,
140063
140993
  const globalsDir = `${inputs.artifactDir}/globals`;
140064
140994
  const mocksDir = `${inputs.artifactDir}/mocks`;
140065
140995
  const specsDir = `${inputs.artifactDir}/specs`;
140066
- ensureDir(collectionsDir);
140067
- ensureDir(environmentsDir);
140068
- ensureDir(flowsDir);
140069
- ensureDir(globalsDir);
140070
- ensureDir(mocksDir);
140071
- ensureDir(specsDir);
140072
- ensureDir(".postman");
140073
- const globalsFilePath = `${globalsDir}/workspace.globals.yaml`;
140074
- if (!(0, import_node_fs5.existsSync)(globalsFilePath)) {
140075
- (0, import_node_fs5.writeFileSync)(globalsFilePath, "name: Globals\nvalues: []\n");
140076
- }
140077
- if (inputs.generateCiWorkflow) {
140078
- const ciDir = inputs.ciWorkflowPath.split("/").slice(0, -1).join("/");
140079
- if (ciDir) {
140080
- ensureDir(ciDir);
140081
- }
140082
- }
140083
140996
  const manifestCollections = {};
140084
- const discoveredSpecs = scanLocalSpecReferences();
140085
- const mappedSpec = resolveMappedSpecReference(inputs.specPath, discoveredSpecs);
140997
+ const artifactDirPrefix = canonicalizeRelativePath(inputs.artifactDir);
140998
+ const { discoveredSpecs, mappedSpec } = resolveLocalSpecReferences(inputs.specPath, ".", {
140999
+ ignoredPrefixes: artifactDirPrefix ? [artifactDirPrefix, ".postman"] : [".postman"]
141000
+ });
140086
141001
  const mappedSpecCloudKey = mappedSpec && inputs.specId ? buildMappedSpecCloudKey(
140087
141002
  mappedSpec.configRelativePath,
140088
141003
  inputs.specSyncMode,
140089
141004
  options.releaseLabel
140090
141005
  ) : void 0;
140091
141006
  const prebuiltByRole = options.preparedPrebuiltCollections;
141007
+ const privateMockAuth = options.privateMockAuth === true;
141008
+ const preparedPrivateMockCollections = /* @__PURE__ */ new Map();
141009
+ if (privateMockAuth) {
141010
+ for (const spec of [
141011
+ { role: "smoke", collectionId: inputs.smokeCollectionId },
141012
+ { role: "contract", collectionId: inputs.contractCollectionId }
141013
+ ]) {
141014
+ if (!spec.collectionId) {
141015
+ continue;
141016
+ }
141017
+ preparedPrivateMockCollections.set(
141018
+ spec.role,
141019
+ await preparePrivateMockCloudCollection(
141020
+ spec.role,
141021
+ spec.collectionId,
141022
+ dependencies.postman
141023
+ )
141024
+ );
141025
+ }
141026
+ }
140092
141027
  const baselineRef = await exportCollectionArtifact({
140093
141028
  role: "baseline",
140094
141029
  collectionId: inputs.baselineCollectionId,
@@ -140096,7 +141031,8 @@ async function exportArtifacts(inputs, dependencies, envUids, assetProjectName,
140096
141031
  collectionsDir,
140097
141032
  prebuiltByRole,
140098
141033
  postman: dependencies.postman,
140099
- core: dependencies.core
141034
+ core: dependencies.core,
141035
+ privateMockAuth
140100
141036
  });
140101
141037
  if (baselineRef) {
140102
141038
  manifestCollections[baselineRef] = inputs.baselineCollectionId;
@@ -140108,7 +141044,9 @@ async function exportArtifacts(inputs, dependencies, envUids, assetProjectName,
140108
141044
  collectionsDir,
140109
141045
  prebuiltByRole,
140110
141046
  postman: dependencies.postman,
140111
- core: dependencies.core
141047
+ core: dependencies.core,
141048
+ privateMockAuth,
141049
+ preparedCloudCollection: preparedPrivateMockCollections.get("smoke")
140112
141050
  });
140113
141051
  if (smokeRef) {
140114
141052
  manifestCollections[smokeRef] = inputs.smokeCollectionId;
@@ -140120,11 +141058,30 @@ async function exportArtifacts(inputs, dependencies, envUids, assetProjectName,
140120
141058
  collectionsDir,
140121
141059
  prebuiltByRole,
140122
141060
  postman: dependencies.postman,
140123
- core: dependencies.core
141061
+ core: dependencies.core,
141062
+ privateMockAuth,
141063
+ preparedCloudCollection: preparedPrivateMockCollections.get("contract")
140124
141064
  });
140125
141065
  if (contractRef) {
140126
141066
  manifestCollections[contractRef] = inputs.contractCollectionId;
140127
141067
  }
141068
+ ensureDir(collectionsDir);
141069
+ ensureDir(environmentsDir);
141070
+ ensureDir(flowsDir);
141071
+ ensureDir(globalsDir);
141072
+ ensureDir(mocksDir);
141073
+ ensureDir(specsDir);
141074
+ ensureDir(".postman");
141075
+ const globalsFilePath = `${globalsDir}/workspace.globals.yaml`;
141076
+ if (!(0, import_node_fs5.existsSync)(globalsFilePath)) {
141077
+ (0, import_node_fs5.writeFileSync)(globalsFilePath, "name: Globals\nvalues: []\n");
141078
+ }
141079
+ if (inputs.generateCiWorkflow) {
141080
+ const ciDir = inputs.ciWorkflowPath.split("/").slice(0, -1).join("/");
141081
+ if (ciDir) {
141082
+ ensureDir(ciDir);
141083
+ }
141084
+ }
140128
141085
  for (const [envName, envUid] of Object.entries(envUids)) {
140129
141086
  writeJsonFile(
140130
141087
  `${environmentsDir}/${envName}.postman_environment.json`,
@@ -140277,19 +141234,41 @@ async function commitAndPushGeneratedFiles(inputs, dependencies) {
140277
141234
  async function runRepoSync(inputs, dependencies) {
140278
141235
  const telemetry = createTelemetryContext({ action: "postman-repo-sync-action", actionVersion: resolveActionVersion2(), logger: dependencies.core });
140279
141236
  telemetry.setTeamId(dependencies.teamId);
141237
+ const logger = resolveRepoSyncLogger(dependencies);
141238
+ for (const secret of [
141239
+ inputs.postmanApiKey,
141240
+ inputs.postmanAccessToken,
141241
+ inputs.adoToken,
141242
+ inputs.githubToken,
141243
+ inputs.ghFallbackToken,
141244
+ inputs.sslClientCert,
141245
+ inputs.sslClientKey,
141246
+ inputs.sslClientPassphrase,
141247
+ inputs.sslExtraCaCerts
141248
+ ]) {
141249
+ logger.addSecret(secret);
141250
+ }
141251
+ logger.debug("resolved inputs", {
141252
+ project: inputs.projectName,
141253
+ collection_sync_mode: inputs.collectionSyncMode,
141254
+ spec_sync_mode: inputs.specSyncMode,
141255
+ team_id: dependencies.teamId || void 0
141256
+ });
140280
141257
  try {
140281
- const result = await runRepoSyncInner(inputs, dependencies);
141258
+ const result = await runRepoSyncInner(inputs, { ...dependencies, logger });
140282
141259
  telemetry.setAccountType(getMemoizedSessionIdentity()?.consumerType);
140283
141260
  telemetry.emitCompletion("success");
140284
141261
  return result;
140285
141262
  } catch (error2) {
140286
141263
  telemetry.setAccountType(getMemoizedSessionIdentity()?.consumerType);
140287
141264
  telemetry.emitCompletion("failure");
141265
+ logger.failure("repo sync failed", error2);
140288
141266
  throw error2;
140289
141267
  }
140290
141268
  }
140291
141269
  async function runRepoSyncInner(inputs, dependencies) {
140292
141270
  const mask = resolveRepoSyncMasker(dependencies);
141271
+ const logger = resolveRepoSyncLogger(dependencies);
140293
141272
  const branchDecision = decideBranchTier(inputs);
140294
141273
  assertBranchAssetIds(inputs, branchDecision);
140295
141274
  const isCanonicalWriter = branchDecision.tier === "legacy" || branchDecision.tier === "canonical";
@@ -140349,7 +141328,10 @@ async function runRepoSyncInner(inputs, dependencies) {
140349
141328
  }
140350
141329
  }
140351
141330
  }
140352
- const preparedPrebuiltCollections = await preparePrebuiltCollections(inputs);
141331
+ const preparedPrebuiltCollections = await logger.phase(
141332
+ "prepare-collections",
141333
+ async () => preparePrebuiltCollections(inputs)
141334
+ );
140353
141335
  let skipRepositoryLinkPost = false;
140354
141336
  let repositoryLinkPreflightWasFree = false;
140355
141337
  if (inputs.workspaceLinkEnabled && inputs.workspaceId && inputs.repoUrl && dependencies.internalIntegration?.findWorkspaceForRepo) {
@@ -140384,7 +141366,10 @@ async function runRepoSyncInner(inputs, dependencies) {
140384
141366
  }
140385
141367
  }
140386
141368
  const branchAssetMarker = buildBranchAssetMarker(branchDecision, inputs);
140387
- const envUids = await upsertEnvironments(inputs, dependencies, resourcesState, branchAssetMarker);
141369
+ const envUids = await logger.phase(
141370
+ "sync-environments",
141371
+ async () => upsertEnvironments(inputs, dependencies, resourcesState, branchAssetMarker)
141372
+ );
140388
141373
  outputs["environment-uids-json"] = JSON.stringify(envUids);
140389
141374
  dependencies.core.setOutput("environment-uids-json", outputs["environment-uids-json"]);
140390
141375
  if (inputs.environmentSyncEnabled && inputs.workspaceId && dependencies.internalIntegration) {
@@ -140547,10 +141532,21 @@ async function runRepoSyncInner(inputs, dependencies) {
140547
141532
  );
140548
141533
  }
140549
141534
  const configured = [];
140550
- for (const collectionUid of [inputs.smokeCollectionId, inputs.contractCollectionId]) {
140551
- if (collectionUid) {
141535
+ for (const { role, collectionUid } of [
141536
+ { role: "smoke", collectionUid: inputs.smokeCollectionId },
141537
+ { role: "contract", collectionUid: inputs.contractCollectionId }
141538
+ ]) {
141539
+ if (!collectionUid) {
141540
+ continue;
141541
+ }
141542
+ try {
140552
141543
  await dependencies.postman.configurePrivateMockRuntimeAuth(collectionUid);
140553
141544
  configured.push(collectionUid);
141545
+ } catch (error2) {
141546
+ throw new Error(
141547
+ `PRIVATE_MOCK_AUTH_ROOT_PATCH: Failed to install managed root hook on ${role} collection ${collectionUid}: ${mask(causeText(error2))}`,
141548
+ { cause: error2 }
141549
+ );
140554
141550
  }
140555
141551
  }
140556
141552
  if (configured.length > 0) {
@@ -140625,6 +141621,43 @@ async function runRepoSyncInner(inputs, dependencies) {
140625
141621
  );
140626
141622
  }
140627
141623
  }
141624
+ if (!resolvedMonitorId && inputs.smokeCollectionId && dependencies.postman.rebindMonitorByName) {
141625
+ try {
141626
+ const rebound = await dependencies.postman.rebindMonitorByName(
141627
+ monitorName,
141628
+ inputs.smokeCollectionId,
141629
+ monitorEnvUid
141630
+ );
141631
+ if (rebound) {
141632
+ resolvedMonitorId = rebound.uid;
141633
+ dependencies.core.info(
141634
+ `Rebound existing monitor ${rebound.uid} ("${monitorName}") from collection ${rebound.previousCollectionUid} to ${inputs.smokeCollectionId}`
141635
+ );
141636
+ }
141637
+ } catch (error2) {
141638
+ if (error2 instanceof AmbiguousMonitorRebindError) {
141639
+ throw new Error(
141640
+ formatOrchestrationIssue({
141641
+ operation: "Monitor rebind",
141642
+ entity: `monitor "${monitorName}" workspace ${inputs.workspaceId} collection ${inputs.smokeCollectionId} environment ${monitorEnvUid}`,
141643
+ cause: error2,
141644
+ remediation: monitorRemediation,
141645
+ mask
141646
+ }),
141647
+ { cause: error2 }
141648
+ );
141649
+ }
141650
+ dependencies.core.warning(
141651
+ formatOrchestrationIssue({
141652
+ operation: "Monitor rebind",
141653
+ entity: `monitor "${monitorName}" workspace ${inputs.workspaceId} collection ${inputs.smokeCollectionId} environment ${monitorEnvUid}`,
141654
+ cause: error2,
141655
+ remediation: monitorRemediation,
141656
+ mask
141657
+ })
141658
+ );
141659
+ }
141660
+ }
140628
141661
  if (!resolvedMonitorId) {
140629
141662
  try {
140630
141663
  resolvedMonitorId = await dependencies.postman.createMonitor(
@@ -140702,16 +141735,23 @@ async function runRepoSyncInner(inputs, dependencies) {
140702
141735
  dependencies.core.warning(message);
140703
141736
  }
140704
141737
  }
140705
- await exportArtifacts(inputs, dependencies, envUids, assetProjectName, {
140706
- workspaceLinkStatus: outputs["workspace-link-status"],
140707
- priorWorkspaceId: resourcesState?.workspace?.id,
140708
- existingSpecs: resourcesState?.cloudResources?.specs,
140709
- mockEnvironmentUid: outputs["mock-environment-uid"] || void 0,
140710
- releaseLabel,
140711
- priorState: resourcesState,
140712
- preparedPrebuiltCollections
140713
- });
140714
- const commit = await commitAndPushGeneratedFiles(inputs, dependencies);
141738
+ await logger.phase(
141739
+ "export-artifacts",
141740
+ async () => exportArtifacts(inputs, dependencies, envUids, assetProjectName, {
141741
+ workspaceLinkStatus: outputs["workspace-link-status"],
141742
+ priorWorkspaceId: resourcesState?.workspace?.id,
141743
+ existingSpecs: resourcesState?.cloudResources?.specs,
141744
+ mockEnvironmentUid: outputs["mock-environment-uid"] || void 0,
141745
+ releaseLabel,
141746
+ priorState: resourcesState,
141747
+ preparedPrebuiltCollections,
141748
+ privateMockAuth: inputs.mockVisibility === "private"
141749
+ })
141750
+ );
141751
+ const commit = await logger.phase(
141752
+ "commit-and-push",
141753
+ async () => commitAndPushGeneratedFiles(inputs, dependencies)
141754
+ );
140715
141755
  outputs["commit-sha"] = commit.commitSha;
140716
141756
  if (commit.resolvedCurrentRef) {
140717
141757
  outputs["resolved-current-ref"] = commit.resolvedCurrentRef;
@@ -141039,6 +142079,7 @@ function createRepoSyncDependencies(inputs, resolved, factories, options = {}) {
141039
142079
  listMonitors: gatewayAssets.listMonitors.bind(gatewayAssets),
141040
142080
  monitorExists: gatewayAssets.monitorExists.bind(gatewayAssets),
141041
142081
  findMonitorByCollection: gatewayAssets.findMonitorByCollection.bind(gatewayAssets),
142082
+ rebindMonitorByName: gatewayAssets.rebindMonitorByName.bind(gatewayAssets),
141042
142083
  runMonitor: gatewayAssets.runMonitor.bind(gatewayAssets),
141043
142084
  listEnvironments: gatewayAssets.listEnvironments.bind(gatewayAssets),
141044
142085
  // GC path (preview/channel retention machine — lib/repo/preview-gc.ts).
@@ -141191,6 +142232,7 @@ async function runAction(actionCore = core_exports, actionExec = exec_exports) {
141191
142232
  }
141192
142233
  // Annotate the CommonJS export names for ESM import in node:
141193
142234
  0 && (module.exports = {
142235
+ LocalSpecDiscoveryLimitError,
141194
142236
  StateUnreadableError,
141195
142237
  assertBranchAssetIds,
141196
142238
  assertPathWithinCwd,