@postman-cse/onboarding-repo-sync 0.13.1 → 0.13.3
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 +58 -0
- package/dist/cli.cjs +58 -0
- package/dist/index.cjs +58 -0
- package/package.json +1 -1
package/dist/action.cjs
CHANGED
|
@@ -24512,6 +24512,15 @@ var HttpError = class _HttpError extends Error {
|
|
|
24512
24512
|
};
|
|
24513
24513
|
|
|
24514
24514
|
// src/lib/postman/internal-integration-adapter.ts
|
|
24515
|
+
function extractDuplicateWorkspaceId(body) {
|
|
24516
|
+
try {
|
|
24517
|
+
const parsed = JSON.parse(body);
|
|
24518
|
+
const candidate = parsed?.error?.meta?.workspaceId ?? parsed?.meta?.workspaceId;
|
|
24519
|
+
return typeof candidate === "string" && candidate.trim() ? candidate.trim() : void 0;
|
|
24520
|
+
} catch {
|
|
24521
|
+
return void 0;
|
|
24522
|
+
}
|
|
24523
|
+
}
|
|
24515
24524
|
var BifrostInternalIntegrationAdapter = class {
|
|
24516
24525
|
accessToken;
|
|
24517
24526
|
bifrostBaseUrl;
|
|
@@ -24599,6 +24608,12 @@ var BifrostInternalIntegrationAdapter = class {
|
|
|
24599
24608
|
const body = await response.text();
|
|
24600
24609
|
const isDuplicate = body.includes("invalidParamError") && body.includes("already exists") || body.includes("projectAlreadyConnected");
|
|
24601
24610
|
if (isDuplicate) {
|
|
24611
|
+
const existingWorkspaceId = extractDuplicateWorkspaceId(body);
|
|
24612
|
+
if (existingWorkspaceId && existingWorkspaceId !== workspaceId) {
|
|
24613
|
+
throw new Error(
|
|
24614
|
+
await this.describeWorkspaceLinkConflict(existingWorkspaceId, workspaceId, repoUrl)
|
|
24615
|
+
);
|
|
24616
|
+
}
|
|
24602
24617
|
return;
|
|
24603
24618
|
}
|
|
24604
24619
|
}
|
|
@@ -24610,6 +24625,49 @@ var BifrostInternalIntegrationAdapter = class {
|
|
|
24610
24625
|
});
|
|
24611
24626
|
}
|
|
24612
24627
|
}
|
|
24628
|
+
/**
|
|
24629
|
+
* Build the failure message for a duplicate-link conflict. Looks the owning
|
|
24630
|
+
* workspace up through the same Bifrost proxy credentials as the connect
|
|
24631
|
+
* attempt, so the outcome doubles as a visibility probe: a 403 means the
|
|
24632
|
+
* workspace exists for someone else (personal visibility or another
|
|
24633
|
+
* sub-team), which is the common org-mode failure shape.
|
|
24634
|
+
*/
|
|
24635
|
+
async describeWorkspaceLinkConflict(existingWorkspaceId, targetWorkspaceId, repoUrl) {
|
|
24636
|
+
const base = `Repository ${repoUrl} is already linked to workspace ${existingWorkspaceId}, so Bifrost refused the link to workspace ${targetWorkspaceId}.`;
|
|
24637
|
+
let lookupStatus = 0;
|
|
24638
|
+
let workspaceName = "";
|
|
24639
|
+
try {
|
|
24640
|
+
const response = await this.fetchImpl(`${this.bifrostBaseUrl}/ws/proxy`, {
|
|
24641
|
+
method: "POST",
|
|
24642
|
+
headers: this.bifrostHeaders(),
|
|
24643
|
+
body: JSON.stringify({
|
|
24644
|
+
service: "workspaces",
|
|
24645
|
+
method: "GET",
|
|
24646
|
+
path: `/workspaces/${existingWorkspaceId}`
|
|
24647
|
+
})
|
|
24648
|
+
});
|
|
24649
|
+
lookupStatus = response.status;
|
|
24650
|
+
if (response.ok) {
|
|
24651
|
+
const parsed = await response.json();
|
|
24652
|
+
if (typeof parsed?.data?.name === "string" && parsed.data.name) {
|
|
24653
|
+
workspaceName = parsed.data.name;
|
|
24654
|
+
} else if (parsed?.error) {
|
|
24655
|
+
lookupStatus = 403;
|
|
24656
|
+
}
|
|
24657
|
+
}
|
|
24658
|
+
} catch {
|
|
24659
|
+
}
|
|
24660
|
+
if (workspaceName) {
|
|
24661
|
+
return `${base} That workspace is "${workspaceName}" (https://go.postman.co/workspace/${existingWorkspaceId}). To reuse it, pass workspace-id: ${existingWorkspaceId} or set the POSTMAN_WORKSPACE_ID repository variable to it. To link this workspace instead, disconnect the repository from "${workspaceName}" in Workspace Settings or delete that workspace (deleting a workspace also removes its repository link record), then re-run.`;
|
|
24662
|
+
}
|
|
24663
|
+
if (lookupStatus === 401 || lookupStatus === 403) {
|
|
24664
|
+
return `${base} That workspace exists but is invisible to the credentials this action runs with. This usually means an org-mode onboarding run created it without workspace-team-id, leaving it with personal visibility that hides it from teammates, other API keys, and the API Catalog; it may also belong to another sub-team. Ask whoever created it (or a team admin) to disconnect the repository from that workspace or delete it (deleting a workspace also removes its repository link record), then re-run.`;
|
|
24665
|
+
}
|
|
24666
|
+
if (lookupStatus === 404) {
|
|
24667
|
+
return `${base} That workspace looks recently deleted; its repository link record is removed with it. Re-run, and contact Postman support if the conflict persists.`;
|
|
24668
|
+
}
|
|
24669
|
+
return `${base} Details for that workspace could not be resolved with these credentials. Disconnect the repository from it or delete that workspace (deleting a workspace also removes its repository link record) and re-run; if it is invisible to you, ask its creator or a team admin.`;
|
|
24670
|
+
}
|
|
24613
24671
|
async createApiKey(name) {
|
|
24614
24672
|
const url = `${this.bifrostBaseUrl}/ws/proxy`;
|
|
24615
24673
|
const headers = this.bifrostHeaders();
|
package/dist/cli.cjs
CHANGED
|
@@ -22615,6 +22615,15 @@ var HttpError = class _HttpError extends Error {
|
|
|
22615
22615
|
};
|
|
22616
22616
|
|
|
22617
22617
|
// src/lib/postman/internal-integration-adapter.ts
|
|
22618
|
+
function extractDuplicateWorkspaceId(body) {
|
|
22619
|
+
try {
|
|
22620
|
+
const parsed = JSON.parse(body);
|
|
22621
|
+
const candidate = parsed?.error?.meta?.workspaceId ?? parsed?.meta?.workspaceId;
|
|
22622
|
+
return typeof candidate === "string" && candidate.trim() ? candidate.trim() : void 0;
|
|
22623
|
+
} catch {
|
|
22624
|
+
return void 0;
|
|
22625
|
+
}
|
|
22626
|
+
}
|
|
22618
22627
|
var BifrostInternalIntegrationAdapter = class {
|
|
22619
22628
|
accessToken;
|
|
22620
22629
|
bifrostBaseUrl;
|
|
@@ -22702,6 +22711,12 @@ var BifrostInternalIntegrationAdapter = class {
|
|
|
22702
22711
|
const body = await response.text();
|
|
22703
22712
|
const isDuplicate = body.includes("invalidParamError") && body.includes("already exists") || body.includes("projectAlreadyConnected");
|
|
22704
22713
|
if (isDuplicate) {
|
|
22714
|
+
const existingWorkspaceId = extractDuplicateWorkspaceId(body);
|
|
22715
|
+
if (existingWorkspaceId && existingWorkspaceId !== workspaceId) {
|
|
22716
|
+
throw new Error(
|
|
22717
|
+
await this.describeWorkspaceLinkConflict(existingWorkspaceId, workspaceId, repoUrl)
|
|
22718
|
+
);
|
|
22719
|
+
}
|
|
22705
22720
|
return;
|
|
22706
22721
|
}
|
|
22707
22722
|
}
|
|
@@ -22713,6 +22728,49 @@ var BifrostInternalIntegrationAdapter = class {
|
|
|
22713
22728
|
});
|
|
22714
22729
|
}
|
|
22715
22730
|
}
|
|
22731
|
+
/**
|
|
22732
|
+
* Build the failure message for a duplicate-link conflict. Looks the owning
|
|
22733
|
+
* workspace up through the same Bifrost proxy credentials as the connect
|
|
22734
|
+
* attempt, so the outcome doubles as a visibility probe: a 403 means the
|
|
22735
|
+
* workspace exists for someone else (personal visibility or another
|
|
22736
|
+
* sub-team), which is the common org-mode failure shape.
|
|
22737
|
+
*/
|
|
22738
|
+
async describeWorkspaceLinkConflict(existingWorkspaceId, targetWorkspaceId, repoUrl) {
|
|
22739
|
+
const base = `Repository ${repoUrl} is already linked to workspace ${existingWorkspaceId}, so Bifrost refused the link to workspace ${targetWorkspaceId}.`;
|
|
22740
|
+
let lookupStatus = 0;
|
|
22741
|
+
let workspaceName = "";
|
|
22742
|
+
try {
|
|
22743
|
+
const response = await this.fetchImpl(`${this.bifrostBaseUrl}/ws/proxy`, {
|
|
22744
|
+
method: "POST",
|
|
22745
|
+
headers: this.bifrostHeaders(),
|
|
22746
|
+
body: JSON.stringify({
|
|
22747
|
+
service: "workspaces",
|
|
22748
|
+
method: "GET",
|
|
22749
|
+
path: `/workspaces/${existingWorkspaceId}`
|
|
22750
|
+
})
|
|
22751
|
+
});
|
|
22752
|
+
lookupStatus = response.status;
|
|
22753
|
+
if (response.ok) {
|
|
22754
|
+
const parsed = await response.json();
|
|
22755
|
+
if (typeof parsed?.data?.name === "string" && parsed.data.name) {
|
|
22756
|
+
workspaceName = parsed.data.name;
|
|
22757
|
+
} else if (parsed?.error) {
|
|
22758
|
+
lookupStatus = 403;
|
|
22759
|
+
}
|
|
22760
|
+
}
|
|
22761
|
+
} catch {
|
|
22762
|
+
}
|
|
22763
|
+
if (workspaceName) {
|
|
22764
|
+
return `${base} That workspace is "${workspaceName}" (https://go.postman.co/workspace/${existingWorkspaceId}). To reuse it, pass workspace-id: ${existingWorkspaceId} or set the POSTMAN_WORKSPACE_ID repository variable to it. To link this workspace instead, disconnect the repository from "${workspaceName}" in Workspace Settings or delete that workspace (deleting a workspace also removes its repository link record), then re-run.`;
|
|
22765
|
+
}
|
|
22766
|
+
if (lookupStatus === 401 || lookupStatus === 403) {
|
|
22767
|
+
return `${base} That workspace exists but is invisible to the credentials this action runs with. This usually means an org-mode onboarding run created it without workspace-team-id, leaving it with personal visibility that hides it from teammates, other API keys, and the API Catalog; it may also belong to another sub-team. Ask whoever created it (or a team admin) to disconnect the repository from that workspace or delete it (deleting a workspace also removes its repository link record), then re-run.`;
|
|
22768
|
+
}
|
|
22769
|
+
if (lookupStatus === 404) {
|
|
22770
|
+
return `${base} That workspace looks recently deleted; its repository link record is removed with it. Re-run, and contact Postman support if the conflict persists.`;
|
|
22771
|
+
}
|
|
22772
|
+
return `${base} Details for that workspace could not be resolved with these credentials. Disconnect the repository from it or delete that workspace (deleting a workspace also removes its repository link record) and re-run; if it is invisible to you, ask its creator or a team admin.`;
|
|
22773
|
+
}
|
|
22716
22774
|
async createApiKey(name) {
|
|
22717
22775
|
const url = `${this.bifrostBaseUrl}/ws/proxy`;
|
|
22718
22776
|
const headers = this.bifrostHeaders();
|
package/dist/index.cjs
CHANGED
|
@@ -24527,6 +24527,15 @@ var HttpError = class _HttpError extends Error {
|
|
|
24527
24527
|
};
|
|
24528
24528
|
|
|
24529
24529
|
// src/lib/postman/internal-integration-adapter.ts
|
|
24530
|
+
function extractDuplicateWorkspaceId(body) {
|
|
24531
|
+
try {
|
|
24532
|
+
const parsed = JSON.parse(body);
|
|
24533
|
+
const candidate = parsed?.error?.meta?.workspaceId ?? parsed?.meta?.workspaceId;
|
|
24534
|
+
return typeof candidate === "string" && candidate.trim() ? candidate.trim() : void 0;
|
|
24535
|
+
} catch {
|
|
24536
|
+
return void 0;
|
|
24537
|
+
}
|
|
24538
|
+
}
|
|
24530
24539
|
var BifrostInternalIntegrationAdapter = class {
|
|
24531
24540
|
accessToken;
|
|
24532
24541
|
bifrostBaseUrl;
|
|
@@ -24614,6 +24623,12 @@ var BifrostInternalIntegrationAdapter = class {
|
|
|
24614
24623
|
const body = await response.text();
|
|
24615
24624
|
const isDuplicate = body.includes("invalidParamError") && body.includes("already exists") || body.includes("projectAlreadyConnected");
|
|
24616
24625
|
if (isDuplicate) {
|
|
24626
|
+
const existingWorkspaceId = extractDuplicateWorkspaceId(body);
|
|
24627
|
+
if (existingWorkspaceId && existingWorkspaceId !== workspaceId) {
|
|
24628
|
+
throw new Error(
|
|
24629
|
+
await this.describeWorkspaceLinkConflict(existingWorkspaceId, workspaceId, repoUrl)
|
|
24630
|
+
);
|
|
24631
|
+
}
|
|
24617
24632
|
return;
|
|
24618
24633
|
}
|
|
24619
24634
|
}
|
|
@@ -24625,6 +24640,49 @@ var BifrostInternalIntegrationAdapter = class {
|
|
|
24625
24640
|
});
|
|
24626
24641
|
}
|
|
24627
24642
|
}
|
|
24643
|
+
/**
|
|
24644
|
+
* Build the failure message for a duplicate-link conflict. Looks the owning
|
|
24645
|
+
* workspace up through the same Bifrost proxy credentials as the connect
|
|
24646
|
+
* attempt, so the outcome doubles as a visibility probe: a 403 means the
|
|
24647
|
+
* workspace exists for someone else (personal visibility or another
|
|
24648
|
+
* sub-team), which is the common org-mode failure shape.
|
|
24649
|
+
*/
|
|
24650
|
+
async describeWorkspaceLinkConflict(existingWorkspaceId, targetWorkspaceId, repoUrl) {
|
|
24651
|
+
const base = `Repository ${repoUrl} is already linked to workspace ${existingWorkspaceId}, so Bifrost refused the link to workspace ${targetWorkspaceId}.`;
|
|
24652
|
+
let lookupStatus = 0;
|
|
24653
|
+
let workspaceName = "";
|
|
24654
|
+
try {
|
|
24655
|
+
const response = await this.fetchImpl(`${this.bifrostBaseUrl}/ws/proxy`, {
|
|
24656
|
+
method: "POST",
|
|
24657
|
+
headers: this.bifrostHeaders(),
|
|
24658
|
+
body: JSON.stringify({
|
|
24659
|
+
service: "workspaces",
|
|
24660
|
+
method: "GET",
|
|
24661
|
+
path: `/workspaces/${existingWorkspaceId}`
|
|
24662
|
+
})
|
|
24663
|
+
});
|
|
24664
|
+
lookupStatus = response.status;
|
|
24665
|
+
if (response.ok) {
|
|
24666
|
+
const parsed = await response.json();
|
|
24667
|
+
if (typeof parsed?.data?.name === "string" && parsed.data.name) {
|
|
24668
|
+
workspaceName = parsed.data.name;
|
|
24669
|
+
} else if (parsed?.error) {
|
|
24670
|
+
lookupStatus = 403;
|
|
24671
|
+
}
|
|
24672
|
+
}
|
|
24673
|
+
} catch {
|
|
24674
|
+
}
|
|
24675
|
+
if (workspaceName) {
|
|
24676
|
+
return `${base} That workspace is "${workspaceName}" (https://go.postman.co/workspace/${existingWorkspaceId}). To reuse it, pass workspace-id: ${existingWorkspaceId} or set the POSTMAN_WORKSPACE_ID repository variable to it. To link this workspace instead, disconnect the repository from "${workspaceName}" in Workspace Settings or delete that workspace (deleting a workspace also removes its repository link record), then re-run.`;
|
|
24677
|
+
}
|
|
24678
|
+
if (lookupStatus === 401 || lookupStatus === 403) {
|
|
24679
|
+
return `${base} That workspace exists but is invisible to the credentials this action runs with. This usually means an org-mode onboarding run created it without workspace-team-id, leaving it with personal visibility that hides it from teammates, other API keys, and the API Catalog; it may also belong to another sub-team. Ask whoever created it (or a team admin) to disconnect the repository from that workspace or delete it (deleting a workspace also removes its repository link record), then re-run.`;
|
|
24680
|
+
}
|
|
24681
|
+
if (lookupStatus === 404) {
|
|
24682
|
+
return `${base} That workspace looks recently deleted; its repository link record is removed with it. Re-run, and contact Postman support if the conflict persists.`;
|
|
24683
|
+
}
|
|
24684
|
+
return `${base} Details for that workspace could not be resolved with these credentials. Disconnect the repository from it or delete that workspace (deleting a workspace also removes its repository link record) and re-run; if it is invisible to you, ask its creator or a team admin.`;
|
|
24685
|
+
}
|
|
24628
24686
|
async createApiKey(name) {
|
|
24629
24687
|
const url = `${this.bifrostBaseUrl}/ws/proxy`;
|
|
24630
24688
|
const headers = this.bifrostHeaders();
|