@postman-cse/onboarding-repo-sync 2.1.19 → 2.3.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/README.md +16 -1
- package/action.yml +16 -0
- package/dist/action.cjs +216 -22
- package/dist/cli.cjs +216 -22
- package/dist/index.cjs +216 -22
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -136682,6 +136682,17 @@ var postmanRepoSyncActionContract = {
|
|
|
136682
136682
|
description: "Existing mock server URL. When set, the action validates and reuses this mock instead of creating a new one.",
|
|
136683
136683
|
required: false
|
|
136684
136684
|
},
|
|
136685
|
+
"mock-visibility": {
|
|
136686
|
+
description: "Required mock access policy. Public is anonymous; private requires a runtime x-api-key supplied by the caller and is never persisted by repo-sync.",
|
|
136687
|
+
required: false,
|
|
136688
|
+
default: "public",
|
|
136689
|
+
allowedValues: ["public", "private"]
|
|
136690
|
+
},
|
|
136691
|
+
"mock-environment-enabled": {
|
|
136692
|
+
description: "Create or update a dedicated manual-validation environment whose baseUrl is the validated mock URL. This environment is excluded from runtime CI selection and never contains a mock credential.",
|
|
136693
|
+
required: false,
|
|
136694
|
+
default: "false"
|
|
136695
|
+
},
|
|
136685
136696
|
"monitor-cron": {
|
|
136686
136697
|
description: "Cron expression for monitor scheduling (e.g. '0 */6 * * *'). When empty, the monitor is created disabled and triggered to run once per workflow invocation (and once on every subsequent run).",
|
|
136687
136698
|
required: false,
|
|
@@ -136875,6 +136886,18 @@ var postmanRepoSyncActionContract = {
|
|
|
136875
136886
|
"mock-url": {
|
|
136876
136887
|
description: "Created or reused mock server URL."
|
|
136877
136888
|
},
|
|
136889
|
+
"mock-visibility": {
|
|
136890
|
+
description: "Authoritatively observed mock visibility: public or private."
|
|
136891
|
+
},
|
|
136892
|
+
"mock-auth-required": {
|
|
136893
|
+
description: "Whether the collection runner must supply postmanPrivateMockApiKey at runtime."
|
|
136894
|
+
},
|
|
136895
|
+
"mock-environment-uid": {
|
|
136896
|
+
description: "Dedicated manual-validation environment UID when mock-environment-enabled succeeds."
|
|
136897
|
+
},
|
|
136898
|
+
"mock-environment-status": {
|
|
136899
|
+
description: "Whether the optional manual-validation mock environment succeeded, was skipped, or failed."
|
|
136900
|
+
},
|
|
136878
136901
|
"monitor-id": {
|
|
136879
136902
|
description: "Created or reused smoke monitor ID."
|
|
136880
136903
|
},
|
|
@@ -136969,19 +136992,30 @@ var MockContractError = class extends Error {
|
|
|
136969
136992
|
this.name = "MockContractError";
|
|
136970
136993
|
}
|
|
136971
136994
|
};
|
|
136972
|
-
function
|
|
136973
|
-
if (mock.visibility === "
|
|
136995
|
+
function requireMockVisibility(mock, requested) {
|
|
136996
|
+
if (mock.visibility === "unknown") {
|
|
136974
136997
|
throw new MockContractError(
|
|
136975
|
-
`
|
|
136998
|
+
`MOCK_VISIBILITY_UNKNOWN: Mock ${mock.uid} did not expose a supported visibility field. Refusing to assume it is callable.`
|
|
136976
136999
|
);
|
|
136977
137000
|
}
|
|
136978
|
-
if (mock.visibility !==
|
|
137001
|
+
if (mock.visibility !== requested) {
|
|
137002
|
+
const code = requested === "public" ? "MOCK_NOT_PUBLIC" : "MOCK_NOT_PRIVATE";
|
|
136979
137003
|
throw new MockContractError(
|
|
136980
|
-
|
|
137004
|
+
`${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}.`
|
|
136981
137005
|
);
|
|
136982
137006
|
}
|
|
136983
137007
|
return mock;
|
|
136984
137008
|
}
|
|
137009
|
+
var PRIVATE_MOCK_AUTH_MARKER = "postman-enterprise-automation: private-mock-auth";
|
|
137010
|
+
var PRIVATE_MOCK_AUTH_VARIABLE = "postmanPrivateMockApiKey";
|
|
137011
|
+
var PRIVATE_MOCK_AUTH_SCRIPT = [
|
|
137012
|
+
`// ${PRIVATE_MOCK_AUTH_MARKER}`,
|
|
137013
|
+
`var privateMockApiKey = pm.variables.get('${PRIVATE_MOCK_AUTH_VARIABLE}');`,
|
|
137014
|
+
"var privateMockHost = String(pm.request.url && pm.request.url.getHost ? pm.request.url.getHost() : '');",
|
|
137015
|
+
"if (privateMockApiKey && /(^|\\.)mock\\.pstmn\\.io$/i.test(privateMockHost)) {",
|
|
137016
|
+
" pm.request.headers.upsert({ key: 'x-api-key', value: privateMockApiKey });",
|
|
137017
|
+
"}"
|
|
137018
|
+
].join("\n");
|
|
136985
137019
|
var MAX_CREATE_FLIGHTS = 256;
|
|
136986
137020
|
var createFlights = /* @__PURE__ */ new Map();
|
|
136987
137021
|
var PostmanGatewayAssetsClient = class {
|
|
@@ -137489,22 +137523,22 @@ var PostmanGatewayAssetsClient = class {
|
|
|
137489
137523
|
return data?.collection ?? null;
|
|
137490
137524
|
}
|
|
137491
137525
|
// --- mocks (service: mock) ---
|
|
137492
|
-
async createMock(workspaceId, name, collectionUid, environmentUid) {
|
|
137526
|
+
async createMock(workspaceId, name, collectionUid, environmentUid, requestedVisibility = "public") {
|
|
137493
137527
|
const ws = workspaceId || this.workspaceId;
|
|
137494
137528
|
const mockName = String(name ?? "").trim();
|
|
137495
137529
|
const collection = String(collectionUid ?? "").trim();
|
|
137496
137530
|
const environment = String(environmentUid ?? "").trim();
|
|
137497
|
-
const flightKey = `mock:${ws}:${collection}:${environment}:${mockName}`;
|
|
137531
|
+
const flightKey = `mock:${ws}:${collection}:${environment}:${requestedVisibility}:${mockName}`;
|
|
137498
137532
|
return this.singleFlight(flightKey, flightKey, "mock", async () => {
|
|
137499
137533
|
const existing = await this.findMockByCollection(collection, environment, mockName);
|
|
137500
137534
|
if (existing) {
|
|
137501
|
-
const reusable =
|
|
137502
|
-
return { uid: reusable.uid, url: reusable.mockUrl };
|
|
137535
|
+
const reusable = requireMockVisibility(existing, requestedVisibility);
|
|
137536
|
+
return { uid: reusable.uid, url: reusable.mockUrl, visibility: requestedVisibility };
|
|
137503
137537
|
}
|
|
137504
137538
|
const body = {
|
|
137505
137539
|
name: mockName,
|
|
137506
137540
|
collection,
|
|
137507
|
-
private:
|
|
137541
|
+
private: requestedVisibility === "private",
|
|
137508
137542
|
...environment ? { environment } : {}
|
|
137509
137543
|
};
|
|
137510
137544
|
const send2 = (fallback) => this.gateway.requestJson(
|
|
@@ -137522,12 +137556,14 @@ var PostmanGatewayAssetsClient = class {
|
|
|
137522
137556
|
);
|
|
137523
137557
|
const parseMock = (response) => {
|
|
137524
137558
|
const record = this.dataOf(response);
|
|
137525
|
-
const created =
|
|
137526
|
-
this.decodeMockRecord(record, "Mock create")
|
|
137559
|
+
const created = requireMockVisibility(
|
|
137560
|
+
this.decodeMockRecord(record, "Mock create"),
|
|
137561
|
+
requestedVisibility
|
|
137527
137562
|
);
|
|
137528
137563
|
return {
|
|
137529
137564
|
uid: created.uid,
|
|
137530
|
-
url: created.mockUrl
|
|
137565
|
+
url: created.mockUrl,
|
|
137566
|
+
visibility: requestedVisibility
|
|
137531
137567
|
};
|
|
137532
137568
|
};
|
|
137533
137569
|
try {
|
|
@@ -137538,8 +137574,8 @@ var PostmanGatewayAssetsClient = class {
|
|
|
137538
137574
|
error2
|
|
137539
137575
|
);
|
|
137540
137576
|
if (adopted) {
|
|
137541
|
-
const reusable =
|
|
137542
|
-
return { uid: reusable.uid, url: reusable.mockUrl };
|
|
137577
|
+
const reusable = requireMockVisibility(adopted, requestedVisibility);
|
|
137578
|
+
return { uid: reusable.uid, url: reusable.mockUrl, visibility: requestedVisibility };
|
|
137543
137579
|
}
|
|
137544
137580
|
if (adopted === void 0) {
|
|
137545
137581
|
const retried = await this.resendAbsentCreate(async () => parseMock(await send2("auto")));
|
|
@@ -137549,6 +137585,51 @@ var PostmanGatewayAssetsClient = class {
|
|
|
137549
137585
|
}
|
|
137550
137586
|
});
|
|
137551
137587
|
}
|
|
137588
|
+
/**
|
|
137589
|
+
* Add a secret-free runtime hook to every HTTP request in a collection. The
|
|
137590
|
+
* PMAK value is supplied only by the runner as a transient variable; this
|
|
137591
|
+
* method persists the variable name and header wiring, never the credential.
|
|
137592
|
+
*/
|
|
137593
|
+
async configurePrivateMockRuntimeAuth(collectionUid) {
|
|
137594
|
+
const cid = String(collectionUid ?? "").trim();
|
|
137595
|
+
if (!cid) return 0;
|
|
137596
|
+
const listed = await this.gateway.requestJson({
|
|
137597
|
+
service: "collection",
|
|
137598
|
+
method: "get",
|
|
137599
|
+
path: `/v3/collections/${cid}/items/`
|
|
137600
|
+
});
|
|
137601
|
+
const items = Array.isArray(listed?.data) ? listed.data : [];
|
|
137602
|
+
let patched = 0;
|
|
137603
|
+
for (const listedItem of items) {
|
|
137604
|
+
if (String(listedItem.$kind ?? "") !== "http-request") continue;
|
|
137605
|
+
const itemId = String(listedItem.id ?? "").trim();
|
|
137606
|
+
if (!itemId) continue;
|
|
137607
|
+
const response = await this.gateway.requestJson({
|
|
137608
|
+
service: "collection",
|
|
137609
|
+
method: "get",
|
|
137610
|
+
path: `/v3/collections/${cid}/items/${itemId}`,
|
|
137611
|
+
headers: { "X-Entity-Type": "http-request" }
|
|
137612
|
+
});
|
|
137613
|
+
const item = this.asRecord(response?.data) ?? listedItem;
|
|
137614
|
+
const scripts = Array.isArray(item.scripts) ? item.scripts.filter((entry) => Boolean(this.asRecord(entry))) : [];
|
|
137615
|
+
const before = scripts.find((script) => String(script.type ?? "") === "beforeRequest");
|
|
137616
|
+
if (String(before?.code ?? "").includes(PRIVATE_MOCK_AUTH_MARKER)) continue;
|
|
137617
|
+
const code = [String(before?.code ?? "").trim(), PRIVATE_MOCK_AUTH_SCRIPT].filter(Boolean).join("\n");
|
|
137618
|
+
const nextScripts = [
|
|
137619
|
+
...scripts.filter((script) => String(script.type ?? "") !== "beforeRequest"),
|
|
137620
|
+
{ type: "beforeRequest", code, language: "text/javascript" }
|
|
137621
|
+
];
|
|
137622
|
+
await this.gateway.requestJson({
|
|
137623
|
+
service: "collection",
|
|
137624
|
+
method: "patch",
|
|
137625
|
+
path: `/v3/collections/${cid}/items/${itemId}`,
|
|
137626
|
+
headers: { "X-Entity-Type": "http-request" },
|
|
137627
|
+
body: [{ op: "add", path: "/scripts", value: nextScripts }]
|
|
137628
|
+
});
|
|
137629
|
+
patched += 1;
|
|
137630
|
+
}
|
|
137631
|
+
return patched;
|
|
137632
|
+
}
|
|
137552
137633
|
async listMocks() {
|
|
137553
137634
|
const response = await this.gateway.requestJson({
|
|
137554
137635
|
service: "mock",
|
|
@@ -138563,7 +138644,7 @@ function normalizeMockUrl(value, source) {
|
|
|
138563
138644
|
url.pathname = url.pathname.replace(/\/+$/g, "") || "/";
|
|
138564
138645
|
return url.toString();
|
|
138565
138646
|
}
|
|
138566
|
-
function
|
|
138647
|
+
function resolveExplicitMock(mocks, explicitUrl, collectionUid, environmentUid, requestedVisibility) {
|
|
138567
138648
|
const normalized = normalizeMockUrl(explicitUrl, "mock-url");
|
|
138568
138649
|
const matches = mocks.filter(
|
|
138569
138650
|
(mock) => normalizeMockUrl(mock.mockUrl, `mock ${mock.uid} URL`) === normalized
|
|
@@ -138589,7 +138670,7 @@ function resolveExplicitPublicMock(mocks, explicitUrl, collectionUid, environmen
|
|
|
138589
138670
|
`EXPLICIT_MOCK_IDENTITY_MISMATCH: Mock ${match.uid} references environment ${match.environment || "(none)"}, expected ${environmentUid}`
|
|
138590
138671
|
);
|
|
138591
138672
|
}
|
|
138592
|
-
return
|
|
138673
|
+
return requireMockVisibility(match, requestedVisibility);
|
|
138593
138674
|
}
|
|
138594
138675
|
function shouldRetryMockCreate(error2) {
|
|
138595
138676
|
if (error2 instanceof MockContractError) return false;
|
|
@@ -138701,6 +138782,15 @@ function parseCredentialPreflight(value) {
|
|
|
138701
138782
|
`Unsupported credential-preflight "${normalized}". Supported values: ${allowed.join(", ")}`
|
|
138702
138783
|
);
|
|
138703
138784
|
}
|
|
138785
|
+
function parseMockVisibility(value) {
|
|
138786
|
+
const definition = postmanRepoSyncActionContract.inputs["mock-visibility"];
|
|
138787
|
+
const allowed = definition.allowedValues ?? [];
|
|
138788
|
+
const normalized = String(value || "").trim() || (definition.default ?? "public");
|
|
138789
|
+
if (allowed.includes(normalized)) return normalized;
|
|
138790
|
+
throw new Error(
|
|
138791
|
+
`Unsupported mock-visibility "${normalized}". Supported values: ${allowed.join(", ")}`
|
|
138792
|
+
);
|
|
138793
|
+
}
|
|
138704
138794
|
function parseBranchStrategy(value) {
|
|
138705
138795
|
const definition = postmanRepoSyncActionContract.inputs["branch-strategy"];
|
|
138706
138796
|
const allowed = definition.allowedValues ?? [];
|
|
@@ -138807,6 +138897,8 @@ function resolveInputs(env = process.env) {
|
|
|
138807
138897
|
orgMode: parseBooleanInput(getInput2("org-mode", env), false),
|
|
138808
138898
|
monitorId: getInput2("monitor-id", env),
|
|
138809
138899
|
mockUrl: getInput2("mock-url", env),
|
|
138900
|
+
mockVisibility: parseMockVisibility(getInput2("mock-visibility", env)),
|
|
138901
|
+
mockEnvironmentEnabled: parseBooleanInput(getInput2("mock-environment-enabled", env), false),
|
|
138810
138902
|
monitorCron: getInput2("monitor-cron", env),
|
|
138811
138903
|
sslClientCert: getInput2("ssl-client-cert", env),
|
|
138812
138904
|
sslClientKey: getInput2("ssl-client-key", env),
|
|
@@ -139033,6 +139125,10 @@ function createOutputs(inputs) {
|
|
|
139033
139125
|
"environment-sync-status": "skipped",
|
|
139034
139126
|
"environment-uids-json": JSON.stringify(inputs.environmentUids),
|
|
139035
139127
|
"mock-url": "",
|
|
139128
|
+
"mock-visibility": "",
|
|
139129
|
+
"mock-auth-required": "false",
|
|
139130
|
+
"mock-environment-uid": "",
|
|
139131
|
+
"mock-environment-status": "skipped",
|
|
139036
139132
|
"monitor-id": "",
|
|
139037
139133
|
"repo-sync-summary-json": "{}",
|
|
139038
139134
|
"commit-sha": "",
|
|
@@ -139100,6 +139196,8 @@ function readActionInputs(actionCore) {
|
|
|
139100
139196
|
INPUT_ORG_MODE: readInput(actionCore, "org-mode"),
|
|
139101
139197
|
INPUT_MONITOR_ID: readInput(actionCore, "monitor-id"),
|
|
139102
139198
|
INPUT_MOCK_URL: readInput(actionCore, "mock-url"),
|
|
139199
|
+
INPUT_MOCK_VISIBILITY: readInput(actionCore, "mock-visibility"),
|
|
139200
|
+
INPUT_MOCK_ENVIRONMENT_ENABLED: readInput(actionCore, "mock-environment-enabled"),
|
|
139103
139201
|
INPUT_MONITOR_CRON: readInput(actionCore, "monitor-cron"),
|
|
139104
139202
|
INPUT_SSL_CLIENT_CERT: sslClientCert,
|
|
139105
139203
|
INPUT_SSL_CLIENT_KEY: sslClientKey,
|
|
@@ -139301,6 +139399,52 @@ async function upsertEnvironments(inputs, dependencies, resourcesState, assetMar
|
|
|
139301
139399
|
}
|
|
139302
139400
|
return envUids;
|
|
139303
139401
|
}
|
|
139402
|
+
async function upsertMockEnvironment(inputs, dependencies, assetProjectName, mockUrl) {
|
|
139403
|
+
if (!inputs.mockEnvironmentEnabled || !inputs.workspaceId || !mockUrl) {
|
|
139404
|
+
return "";
|
|
139405
|
+
}
|
|
139406
|
+
const displayName = `${assetProjectName} - Mock`;
|
|
139407
|
+
const values = buildEnvironmentValues("mock", mockUrl);
|
|
139408
|
+
const mask = resolveRepoSyncMasker(dependencies);
|
|
139409
|
+
try {
|
|
139410
|
+
const discovered = await dependencies.postman.findEnvironmentByName(
|
|
139411
|
+
inputs.workspaceId,
|
|
139412
|
+
displayName
|
|
139413
|
+
);
|
|
139414
|
+
if (discovered?.uid) {
|
|
139415
|
+
try {
|
|
139416
|
+
const existing = await dependencies.postman.getEnvironment(discovered.uid);
|
|
139417
|
+
const currentValues = existing.data?.values ?? existing.values ?? [];
|
|
139418
|
+
if (currentValues.some((value) => value.key === "baseUrl" && value.value === mockUrl)) {
|
|
139419
|
+
dependencies.core.info(`Mock environment already points to ${mockUrl}: ${discovered.uid}`);
|
|
139420
|
+
return discovered.uid;
|
|
139421
|
+
}
|
|
139422
|
+
} catch {
|
|
139423
|
+
}
|
|
139424
|
+
await dependencies.postman.updateEnvironment(discovered.uid, displayName, values);
|
|
139425
|
+
dependencies.core.info(`Updated mock environment ${displayName}: ${discovered.uid}`);
|
|
139426
|
+
return discovered.uid;
|
|
139427
|
+
}
|
|
139428
|
+
const uid = await dependencies.postman.createEnvironment(
|
|
139429
|
+
inputs.workspaceId,
|
|
139430
|
+
displayName,
|
|
139431
|
+
values
|
|
139432
|
+
);
|
|
139433
|
+
dependencies.core.info(`Created mock environment ${displayName}: ${uid}`);
|
|
139434
|
+
return uid;
|
|
139435
|
+
} catch (error2) {
|
|
139436
|
+
dependencies.core.warning(
|
|
139437
|
+
formatOrchestrationIssue({
|
|
139438
|
+
operation: "Mock environment upsert",
|
|
139439
|
+
entity: `workspace ${inputs.workspaceId} environment "${displayName}"`,
|
|
139440
|
+
cause: error2,
|
|
139441
|
+
remediation: "verify environment access or disable mock-environment-enabled then rerun",
|
|
139442
|
+
mask
|
|
139443
|
+
})
|
|
139444
|
+
);
|
|
139445
|
+
return "";
|
|
139446
|
+
}
|
|
139447
|
+
}
|
|
139304
139448
|
function ensureDir(path9) {
|
|
139305
139449
|
(0, import_node_fs5.mkdirSync)(path9, { recursive: true });
|
|
139306
139450
|
}
|
|
@@ -139939,6 +140083,13 @@ async function exportArtifacts(inputs, dependencies, envUids, assetProjectName,
|
|
|
139939
140083
|
true
|
|
139940
140084
|
);
|
|
139941
140085
|
}
|
|
140086
|
+
if (options.mockEnvironmentUid) {
|
|
140087
|
+
writeJsonFile(
|
|
140088
|
+
`${mocksDir}/manual-validation.postman_environment.json`,
|
|
140089
|
+
await dependencies.postman.getEnvironment(options.mockEnvironmentUid),
|
|
140090
|
+
true
|
|
140091
|
+
);
|
|
140092
|
+
}
|
|
139942
140093
|
const durableWorkspaceId = resolveDurableWorkspaceId({
|
|
139943
140094
|
candidateId: inputs.workspaceId,
|
|
139944
140095
|
priorId: options.priorWorkspaceId,
|
|
@@ -139997,7 +140148,11 @@ function createRepoSummary(outputs, envUids, pushed) {
|
|
|
139997
140148
|
commitSha: outputs["commit-sha"],
|
|
139998
140149
|
environmentCount: Object.keys(envUids).length,
|
|
139999
140150
|
environmentSyncStatus: outputs["environment-sync-status"],
|
|
140151
|
+
mockEnvironmentStatus: outputs["mock-environment-status"],
|
|
140152
|
+
mockEnvironmentUid: outputs["mock-environment-uid"],
|
|
140153
|
+
mockAuthRequired: outputs["mock-auth-required"] === "true",
|
|
140000
140154
|
mockUrl: outputs["mock-url"],
|
|
140155
|
+
mockVisibility: outputs["mock-visibility"],
|
|
140001
140156
|
monitorId: outputs["monitor-id"],
|
|
140002
140157
|
pushed,
|
|
140003
140158
|
resolvedCurrentRef: outputs["resolved-current-ref"],
|
|
@@ -140225,6 +140380,7 @@ async function runRepoSyncInner(inputs, dependencies) {
|
|
|
140225
140380
|
const mockEnvUid = envUids.dev || envUids.prod || Object.values(envUids)[0];
|
|
140226
140381
|
if (mockEnvUid) {
|
|
140227
140382
|
let resolvedMockUrl = "";
|
|
140383
|
+
let resolvedMockVisibility = "";
|
|
140228
140384
|
const mockName = `${assetProjectName} Mock`;
|
|
140229
140385
|
if (inputs.mockUrl) {
|
|
140230
140386
|
let mocks;
|
|
@@ -140242,12 +140398,15 @@ async function runRepoSyncInner(inputs, dependencies) {
|
|
|
140242
140398
|
{ cause: error2 }
|
|
140243
140399
|
);
|
|
140244
140400
|
}
|
|
140245
|
-
|
|
140401
|
+
const resolved = resolveExplicitMock(
|
|
140246
140402
|
mocks,
|
|
140247
140403
|
inputs.mockUrl,
|
|
140248
140404
|
inputs.baselineCollectionId,
|
|
140249
|
-
mockEnvUid
|
|
140250
|
-
|
|
140405
|
+
mockEnvUid,
|
|
140406
|
+
inputs.mockVisibility
|
|
140407
|
+
);
|
|
140408
|
+
resolvedMockUrl = resolved.mockUrl;
|
|
140409
|
+
resolvedMockVisibility = resolved.visibility;
|
|
140251
140410
|
dependencies.core.info(`Reusing mock from explicit input: ${resolvedMockUrl}`);
|
|
140252
140411
|
}
|
|
140253
140412
|
if (!resolvedMockUrl && inputs.baselineCollectionId) {
|
|
@@ -140271,7 +140430,9 @@ async function runRepoSyncInner(inputs, dependencies) {
|
|
|
140271
140430
|
);
|
|
140272
140431
|
}
|
|
140273
140432
|
if (discovered) {
|
|
140274
|
-
|
|
140433
|
+
const resolved = requireMockVisibility(discovered, inputs.mockVisibility);
|
|
140434
|
+
resolvedMockUrl = resolved.mockUrl;
|
|
140435
|
+
resolvedMockVisibility = resolved.visibility;
|
|
140275
140436
|
dependencies.core.info(`Discovered existing mock for collection ${inputs.baselineCollectionId}: ${resolvedMockUrl}`);
|
|
140276
140437
|
}
|
|
140277
140438
|
}
|
|
@@ -140284,7 +140445,8 @@ async function runRepoSyncInner(inputs, dependencies) {
|
|
|
140284
140445
|
inputs.workspaceId,
|
|
140285
140446
|
mockName,
|
|
140286
140447
|
inputs.baselineCollectionId,
|
|
140287
|
-
mockEnvUid
|
|
140448
|
+
mockEnvUid,
|
|
140449
|
+
inputs.mockVisibility
|
|
140288
140450
|
),
|
|
140289
140451
|
{
|
|
140290
140452
|
maxAttempts: 3,
|
|
@@ -140306,6 +140468,7 @@ async function runRepoSyncInner(inputs, dependencies) {
|
|
|
140306
140468
|
}
|
|
140307
140469
|
);
|
|
140308
140470
|
resolvedMockUrl = mock.url;
|
|
140471
|
+
resolvedMockVisibility = mock.visibility ?? inputs.mockVisibility;
|
|
140309
140472
|
dependencies.core.info(`Created new mock: ${resolvedMockUrl}`);
|
|
140310
140473
|
} catch (error2) {
|
|
140311
140474
|
throw new Error(
|
|
@@ -140321,7 +140484,37 @@ async function runRepoSyncInner(inputs, dependencies) {
|
|
|
140321
140484
|
}
|
|
140322
140485
|
}
|
|
140323
140486
|
outputs["mock-url"] = resolvedMockUrl;
|
|
140487
|
+
outputs["mock-visibility"] = resolvedMockVisibility;
|
|
140488
|
+
outputs["mock-auth-required"] = String(resolvedMockVisibility === "private");
|
|
140324
140489
|
dependencies.core.setOutput("mock-url", resolvedMockUrl);
|
|
140490
|
+
dependencies.core.setOutput("mock-visibility", resolvedMockVisibility);
|
|
140491
|
+
dependencies.core.setOutput("mock-auth-required", outputs["mock-auth-required"]);
|
|
140492
|
+
if (resolvedMockVisibility === "private") {
|
|
140493
|
+
if (!dependencies.postman.configurePrivateMockRuntimeAuth) {
|
|
140494
|
+
throw new Error(
|
|
140495
|
+
"PRIVATE_MOCK_RUNTIME_AUTH_UNAVAILABLE: The Postman client cannot configure runtime x-api-key injection."
|
|
140496
|
+
);
|
|
140497
|
+
}
|
|
140498
|
+
for (const collectionUid of [inputs.smokeCollectionId, inputs.contractCollectionId]) {
|
|
140499
|
+
if (collectionUid) {
|
|
140500
|
+
await dependencies.postman.configurePrivateMockRuntimeAuth(collectionUid);
|
|
140501
|
+
}
|
|
140502
|
+
}
|
|
140503
|
+
}
|
|
140504
|
+
if (inputs.mockEnvironmentEnabled && isCanonicalWriter) {
|
|
140505
|
+
const mockEnvironmentUid = await upsertMockEnvironment(
|
|
140506
|
+
inputs,
|
|
140507
|
+
dependencies,
|
|
140508
|
+
assetProjectName,
|
|
140509
|
+
resolvedMockUrl
|
|
140510
|
+
);
|
|
140511
|
+
outputs["mock-environment-uid"] = mockEnvironmentUid;
|
|
140512
|
+
outputs["mock-environment-status"] = mockEnvironmentUid ? "success" : "failed";
|
|
140513
|
+
} else if (inputs.mockEnvironmentEnabled) {
|
|
140514
|
+
dependencies.core.warning(
|
|
140515
|
+
"mock-environment-enabled is skipped for preview and channel runs so manual-validation environments cannot escape branch retention cleanup."
|
|
140516
|
+
);
|
|
140517
|
+
}
|
|
140325
140518
|
}
|
|
140326
140519
|
}
|
|
140327
140520
|
if (inputs.workspaceId && inputs.smokeCollectionId && Object.keys(envUids).length > 0) {
|
|
@@ -140454,6 +140647,7 @@ async function runRepoSyncInner(inputs, dependencies) {
|
|
|
140454
140647
|
workspaceLinkStatus: outputs["workspace-link-status"],
|
|
140455
140648
|
priorWorkspaceId: resourcesState?.workspace?.id,
|
|
140456
140649
|
existingSpecs: resourcesState?.cloudResources?.specs,
|
|
140650
|
+
mockEnvironmentUid: outputs["mock-environment-uid"] || void 0,
|
|
140457
140651
|
releaseLabel,
|
|
140458
140652
|
priorState: resourcesState,
|
|
140459
140653
|
preparedPrebuiltCollections
|