@postman-cse/onboarding-repo-sync 2.4.0 → 2.4.1

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/action.cjs CHANGED
@@ -136994,9 +136994,17 @@ function requireMockVisibility(mock, requested) {
136994
136994
  }
136995
136995
  return mock;
136996
136996
  }
136997
- var PRIVATE_MOCK_AUTH_MARKER_PREFIX = "postman-enterprise-automation: private-mock-auth";
136998
- var PRIVATE_MOCK_AUTH_MARKER = `${PRIVATE_MOCK_AUTH_MARKER_PREFIX}-v2`;
136997
+ var LEGACY_PRIVATE_MOCK_AUTH_MARKER = "postman-enterprise-automation: private-mock-auth";
136998
+ var PRIVATE_MOCK_AUTH_MARKER = `${LEGACY_PRIVATE_MOCK_AUTH_MARKER}-v2`;
136999
136999
  var PRIVATE_MOCK_AUTH_VARIABLE2 = "postmanPrivateMockApiKey";
137000
+ var LEGACY_PRIVATE_MOCK_AUTH_SCRIPT = [
137001
+ `// ${LEGACY_PRIVATE_MOCK_AUTH_MARKER}`,
137002
+ `var privateMockApiKey = pm.variables.get('${PRIVATE_MOCK_AUTH_VARIABLE2}');`,
137003
+ "var privateMockHost = String(pm.request.url && pm.request.url.getHost ? pm.request.url.getHost() : '');",
137004
+ "if (privateMockApiKey && /(^|\\.)mock\\.pstmn\\.io$/i.test(privateMockHost)) {",
137005
+ " pm.request.headers.upsert({ key: 'x-api-key', value: privateMockApiKey });",
137006
+ "}"
137007
+ ].join("\n");
137000
137008
  var PRIVATE_MOCK_AUTH_SCRIPT = [
137001
137009
  `// ${PRIVATE_MOCK_AUTH_MARKER}`,
137002
137010
  `var privateMockApiKey = pm.variables.get('${PRIVATE_MOCK_AUTH_VARIABLE2}');`,
@@ -137009,23 +137017,8 @@ var PRIVATE_MOCK_AUTH_SCRIPT = [
137009
137017
  ` 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.');`,
137010
137018
  "}"
137011
137019
  ].join("\n");
137012
- function stripPrivateMockAuthBlocks(code) {
137013
- if (!code.includes(PRIVATE_MOCK_AUTH_MARKER_PREFIX)) return code.trim();
137014
- const lines = code.split("\n");
137015
- const kept = [];
137016
- let skipping = false;
137017
- for (const line of lines) {
137018
- if (line.includes(PRIVATE_MOCK_AUTH_MARKER_PREFIX)) {
137019
- skipping = true;
137020
- continue;
137021
- }
137022
- if (skipping) {
137023
- if (/^\s*(?:(?:var|if)\s|\}\selse\sif\s|\}|pm\.request|console\.warn)/.test(line)) continue;
137024
- skipping = false;
137025
- }
137026
- kept.push(line);
137027
- }
137028
- return kept.join("\n").trim();
137020
+ function removeLegacyPrivateMockAuth(code) {
137021
+ return code.split(LEGACY_PRIVATE_MOCK_AUTH_SCRIPT).join("").trim();
137029
137022
  }
137030
137023
  var MAX_CREATE_FLIGHTS = 256;
137031
137024
  var createFlights = /* @__PURE__ */ new Map();
@@ -137626,7 +137619,7 @@ var PostmanGatewayAssetsClient = class {
137626
137619
  const before = scripts.find((script) => String(script.type ?? "") === "beforeRequest");
137627
137620
  const existingCode = String(before?.code ?? "");
137628
137621
  if (existingCode.includes(PRIVATE_MOCK_AUTH_MARKER)) continue;
137629
- const code = [stripPrivateMockAuthBlocks(existingCode), PRIVATE_MOCK_AUTH_SCRIPT].filter(Boolean).join("\n");
137622
+ const code = [removeLegacyPrivateMockAuth(existingCode), PRIVATE_MOCK_AUTH_SCRIPT].filter(Boolean).join("\n");
137630
137623
  const nextScripts = [
137631
137624
  ...scripts.filter((script) => String(script.type ?? "") !== "beforeRequest"),
137632
137625
  { type: "beforeRequest", code, language: "text/javascript" }
package/dist/cli.cjs CHANGED
@@ -135099,9 +135099,17 @@ function requireMockVisibility(mock, requested) {
135099
135099
  }
135100
135100
  return mock;
135101
135101
  }
135102
- var PRIVATE_MOCK_AUTH_MARKER_PREFIX = "postman-enterprise-automation: private-mock-auth";
135103
- var PRIVATE_MOCK_AUTH_MARKER = `${PRIVATE_MOCK_AUTH_MARKER_PREFIX}-v2`;
135102
+ var LEGACY_PRIVATE_MOCK_AUTH_MARKER = "postman-enterprise-automation: private-mock-auth";
135103
+ var PRIVATE_MOCK_AUTH_MARKER = `${LEGACY_PRIVATE_MOCK_AUTH_MARKER}-v2`;
135104
135104
  var PRIVATE_MOCK_AUTH_VARIABLE2 = "postmanPrivateMockApiKey";
135105
+ var LEGACY_PRIVATE_MOCK_AUTH_SCRIPT = [
135106
+ `// ${LEGACY_PRIVATE_MOCK_AUTH_MARKER}`,
135107
+ `var privateMockApiKey = pm.variables.get('${PRIVATE_MOCK_AUTH_VARIABLE2}');`,
135108
+ "var privateMockHost = String(pm.request.url && pm.request.url.getHost ? pm.request.url.getHost() : '');",
135109
+ "if (privateMockApiKey && /(^|\\.)mock\\.pstmn\\.io$/i.test(privateMockHost)) {",
135110
+ " pm.request.headers.upsert({ key: 'x-api-key', value: privateMockApiKey });",
135111
+ "}"
135112
+ ].join("\n");
135105
135113
  var PRIVATE_MOCK_AUTH_SCRIPT = [
135106
135114
  `// ${PRIVATE_MOCK_AUTH_MARKER}`,
135107
135115
  `var privateMockApiKey = pm.variables.get('${PRIVATE_MOCK_AUTH_VARIABLE2}');`,
@@ -135114,23 +135122,8 @@ var PRIVATE_MOCK_AUTH_SCRIPT = [
135114
135122
  ` 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.');`,
135115
135123
  "}"
135116
135124
  ].join("\n");
135117
- function stripPrivateMockAuthBlocks(code) {
135118
- if (!code.includes(PRIVATE_MOCK_AUTH_MARKER_PREFIX)) return code.trim();
135119
- const lines = code.split("\n");
135120
- const kept = [];
135121
- let skipping = false;
135122
- for (const line of lines) {
135123
- if (line.includes(PRIVATE_MOCK_AUTH_MARKER_PREFIX)) {
135124
- skipping = true;
135125
- continue;
135126
- }
135127
- if (skipping) {
135128
- if (/^\s*(?:(?:var|if)\s|\}\selse\sif\s|\}|pm\.request|console\.warn)/.test(line)) continue;
135129
- skipping = false;
135130
- }
135131
- kept.push(line);
135132
- }
135133
- return kept.join("\n").trim();
135125
+ function removeLegacyPrivateMockAuth(code) {
135126
+ return code.split(LEGACY_PRIVATE_MOCK_AUTH_SCRIPT).join("").trim();
135134
135127
  }
135135
135128
  var MAX_CREATE_FLIGHTS = 256;
135136
135129
  var createFlights = /* @__PURE__ */ new Map();
@@ -135731,7 +135724,7 @@ var PostmanGatewayAssetsClient = class {
135731
135724
  const before = scripts.find((script) => String(script.type ?? "") === "beforeRequest");
135732
135725
  const existingCode = String(before?.code ?? "");
135733
135726
  if (existingCode.includes(PRIVATE_MOCK_AUTH_MARKER)) continue;
135734
- const code = [stripPrivateMockAuthBlocks(existingCode), PRIVATE_MOCK_AUTH_SCRIPT].filter(Boolean).join("\n");
135727
+ const code = [removeLegacyPrivateMockAuth(existingCode), PRIVATE_MOCK_AUTH_SCRIPT].filter(Boolean).join("\n");
135735
135728
  const nextScripts = [
135736
135729
  ...scripts.filter((script) => String(script.type ?? "") !== "beforeRequest"),
135737
135730
  { type: "beforeRequest", code, language: "text/javascript" }
package/dist/index.cjs CHANGED
@@ -137016,9 +137016,17 @@ function requireMockVisibility(mock, requested) {
137016
137016
  }
137017
137017
  return mock;
137018
137018
  }
137019
- var PRIVATE_MOCK_AUTH_MARKER_PREFIX = "postman-enterprise-automation: private-mock-auth";
137020
- var PRIVATE_MOCK_AUTH_MARKER = `${PRIVATE_MOCK_AUTH_MARKER_PREFIX}-v2`;
137019
+ var LEGACY_PRIVATE_MOCK_AUTH_MARKER = "postman-enterprise-automation: private-mock-auth";
137020
+ var PRIVATE_MOCK_AUTH_MARKER = `${LEGACY_PRIVATE_MOCK_AUTH_MARKER}-v2`;
137021
137021
  var PRIVATE_MOCK_AUTH_VARIABLE2 = "postmanPrivateMockApiKey";
137022
+ var LEGACY_PRIVATE_MOCK_AUTH_SCRIPT = [
137023
+ `// ${LEGACY_PRIVATE_MOCK_AUTH_MARKER}`,
137024
+ `var privateMockApiKey = pm.variables.get('${PRIVATE_MOCK_AUTH_VARIABLE2}');`,
137025
+ "var privateMockHost = String(pm.request.url && pm.request.url.getHost ? pm.request.url.getHost() : '');",
137026
+ "if (privateMockApiKey && /(^|\\.)mock\\.pstmn\\.io$/i.test(privateMockHost)) {",
137027
+ " pm.request.headers.upsert({ key: 'x-api-key', value: privateMockApiKey });",
137028
+ "}"
137029
+ ].join("\n");
137022
137030
  var PRIVATE_MOCK_AUTH_SCRIPT = [
137023
137031
  `// ${PRIVATE_MOCK_AUTH_MARKER}`,
137024
137032
  `var privateMockApiKey = pm.variables.get('${PRIVATE_MOCK_AUTH_VARIABLE2}');`,
@@ -137031,23 +137039,8 @@ var PRIVATE_MOCK_AUTH_SCRIPT = [
137031
137039
  ` 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.');`,
137032
137040
  "}"
137033
137041
  ].join("\n");
137034
- function stripPrivateMockAuthBlocks(code) {
137035
- if (!code.includes(PRIVATE_MOCK_AUTH_MARKER_PREFIX)) return code.trim();
137036
- const lines = code.split("\n");
137037
- const kept = [];
137038
- let skipping = false;
137039
- for (const line of lines) {
137040
- if (line.includes(PRIVATE_MOCK_AUTH_MARKER_PREFIX)) {
137041
- skipping = true;
137042
- continue;
137043
- }
137044
- if (skipping) {
137045
- if (/^\s*(?:(?:var|if)\s|\}\selse\sif\s|\}|pm\.request|console\.warn)/.test(line)) continue;
137046
- skipping = false;
137047
- }
137048
- kept.push(line);
137049
- }
137050
- return kept.join("\n").trim();
137042
+ function removeLegacyPrivateMockAuth(code) {
137043
+ return code.split(LEGACY_PRIVATE_MOCK_AUTH_SCRIPT).join("").trim();
137051
137044
  }
137052
137045
  var MAX_CREATE_FLIGHTS = 256;
137053
137046
  var createFlights = /* @__PURE__ */ new Map();
@@ -137648,7 +137641,7 @@ var PostmanGatewayAssetsClient = class {
137648
137641
  const before = scripts.find((script) => String(script.type ?? "") === "beforeRequest");
137649
137642
  const existingCode = String(before?.code ?? "");
137650
137643
  if (existingCode.includes(PRIVATE_MOCK_AUTH_MARKER)) continue;
137651
- const code = [stripPrivateMockAuthBlocks(existingCode), PRIVATE_MOCK_AUTH_SCRIPT].filter(Boolean).join("\n");
137644
+ const code = [removeLegacyPrivateMockAuth(existingCode), PRIVATE_MOCK_AUTH_SCRIPT].filter(Boolean).join("\n");
137652
137645
  const nextScripts = [
137653
137646
  ...scripts.filter((script) => String(script.type ?? "") !== "beforeRequest"),
137654
137647
  { type: "beforeRequest", code, language: "text/javascript" }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@postman-cse/onboarding-repo-sync",
3
- "version": "2.4.0",
3
+ "version": "2.4.1",
4
4
  "description": "Postman repo sync GitHub Action.",
5
5
  "type": "module",
6
6
  "main": "dist/index.cjs",