@postman-cse/onboarding-bootstrap 0.14.0 → 0.14.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
@@ -48034,12 +48034,25 @@ var PostmanAssetsClient = class {
48034
48034
  throw new Error("Workspace create did not return an id");
48035
48035
  }
48036
48036
  const workspace = await this.request(`/workspaces/${workspaceId}`);
48037
- const workspaceDetails = asRecord(workspace?.workspace);
48038
- if (workspaceDetails?.visibility !== "team") {
48037
+ let visibility = asRecord(workspace?.workspace)?.visibility;
48038
+ if (visibility !== "team") {
48039
48039
  await this.request(`/workspaces/${workspaceId}`, {
48040
48040
  method: "PUT",
48041
48041
  body: JSON.stringify(payload)
48042
48042
  });
48043
+ const reread = await this.request(`/workspaces/${workspaceId}`);
48044
+ visibility = asRecord(reread?.workspace)?.visibility;
48045
+ }
48046
+ if (typeof visibility === "string" && visibility !== "team") {
48047
+ let cleanedUp = false;
48048
+ try {
48049
+ await this.request(`/workspaces/${workspaceId}`, { method: "DELETE" });
48050
+ cleanedUp = true;
48051
+ } catch {
48052
+ }
48053
+ throw new Error(
48054
+ `Workspace ${workspaceId} was created with visibility '${visibility}' and could not be promoted to team visibility. On org-mode accounts this happens when the workspace-team-id input is missing or wrong: the workspace is created at the organization level with personal visibility, so teammates, other API keys, and the API Catalog cannot see it. Set workspace-team-id to the sub-team that should own this workspace and re-run. ` + (cleanedUp ? "The just-created workspace has been deleted so it does not hold the repository link invisibly." : `Cleanup of the just-created workspace failed; delete workspace ${workspaceId} manually before re-running.`)
48055
+ );
48043
48056
  }
48044
48057
  return {
48045
48058
  id: workspaceId
@@ -48050,6 +48063,19 @@ var PostmanAssetsClient = class {
48050
48063
  shouldRetry: (err) => !(err instanceof Error && err.message.includes("workspace-team-id"))
48051
48064
  });
48052
48065
  }
48066
+ /**
48067
+ * Visibility of a workspace as seen by this API key, or null when the
48068
+ * workspace cannot be read (deleted, or invisible to these credentials).
48069
+ */
48070
+ async getWorkspaceVisibility(workspaceId) {
48071
+ try {
48072
+ const workspace = await this.request(`/workspaces/${workspaceId}`);
48073
+ const visibility = asRecord(workspace?.workspace)?.visibility;
48074
+ return typeof visibility === "string" ? visibility : null;
48075
+ } catch {
48076
+ return null;
48077
+ }
48078
+ }
48053
48079
  async listWorkspaces() {
48054
48080
  const allWorkspaces = [];
48055
48081
  const seenCursors = /* @__PURE__ */ new Set();
@@ -63404,6 +63430,13 @@ For CLI usage, pass --workspace-team-id <id> or export POSTMAN_WORKSPACE_TEAM_ID
63404
63430
  async () => dependencies.postman.createWorkspace(workspaceName, aboutText, workspaceTeamId)
63405
63431
  );
63406
63432
  workspaceId = workspace.id;
63433
+ } else {
63434
+ const visibility = await dependencies.postman.getWorkspaceVisibility(workspaceId);
63435
+ if (visibility && visibility !== "team") {
63436
+ dependencies.core.warning(
63437
+ `Workspace ${workspaceId} has visibility '${visibility}', so it does not appear in the API Catalog and teammates or other API keys cannot see it. This usually means an org-mode run created it without workspace-team-id. Recreate it with workspace-team-id set (delete the workspace and clear the POSTMAN_WORKSPACE_ID repository variable), or share it to the team from Workspace Settings.`
63438
+ );
63439
+ }
63407
63440
  }
63408
63441
  outputs["workspace-id"] = workspaceId || "";
63409
63442
  outputs["workspace-url"] = `https://go.postman.co/workspace/${workspaceId}`;
package/dist/cli.cjs CHANGED
@@ -46353,12 +46353,25 @@ var PostmanAssetsClient = class {
46353
46353
  throw new Error("Workspace create did not return an id");
46354
46354
  }
46355
46355
  const workspace = await this.request(`/workspaces/${workspaceId}`);
46356
- const workspaceDetails = asRecord(workspace?.workspace);
46357
- if (workspaceDetails?.visibility !== "team") {
46356
+ let visibility = asRecord(workspace?.workspace)?.visibility;
46357
+ if (visibility !== "team") {
46358
46358
  await this.request(`/workspaces/${workspaceId}`, {
46359
46359
  method: "PUT",
46360
46360
  body: JSON.stringify(payload)
46361
46361
  });
46362
+ const reread = await this.request(`/workspaces/${workspaceId}`);
46363
+ visibility = asRecord(reread?.workspace)?.visibility;
46364
+ }
46365
+ if (typeof visibility === "string" && visibility !== "team") {
46366
+ let cleanedUp = false;
46367
+ try {
46368
+ await this.request(`/workspaces/${workspaceId}`, { method: "DELETE" });
46369
+ cleanedUp = true;
46370
+ } catch {
46371
+ }
46372
+ throw new Error(
46373
+ `Workspace ${workspaceId} was created with visibility '${visibility}' and could not be promoted to team visibility. On org-mode accounts this happens when the workspace-team-id input is missing or wrong: the workspace is created at the organization level with personal visibility, so teammates, other API keys, and the API Catalog cannot see it. Set workspace-team-id to the sub-team that should own this workspace and re-run. ` + (cleanedUp ? "The just-created workspace has been deleted so it does not hold the repository link invisibly." : `Cleanup of the just-created workspace failed; delete workspace ${workspaceId} manually before re-running.`)
46374
+ );
46362
46375
  }
46363
46376
  return {
46364
46377
  id: workspaceId
@@ -46369,6 +46382,19 @@ var PostmanAssetsClient = class {
46369
46382
  shouldRetry: (err) => !(err instanceof Error && err.message.includes("workspace-team-id"))
46370
46383
  });
46371
46384
  }
46385
+ /**
46386
+ * Visibility of a workspace as seen by this API key, or null when the
46387
+ * workspace cannot be read (deleted, or invisible to these credentials).
46388
+ */
46389
+ async getWorkspaceVisibility(workspaceId) {
46390
+ try {
46391
+ const workspace = await this.request(`/workspaces/${workspaceId}`);
46392
+ const visibility = asRecord(workspace?.workspace)?.visibility;
46393
+ return typeof visibility === "string" ? visibility : null;
46394
+ } catch {
46395
+ return null;
46396
+ }
46397
+ }
46372
46398
  async listWorkspaces() {
46373
46399
  const allWorkspaces = [];
46374
46400
  const seenCursors = /* @__PURE__ */ new Set();
@@ -61654,6 +61680,13 @@ For CLI usage, pass --workspace-team-id <id> or export POSTMAN_WORKSPACE_TEAM_ID
61654
61680
  async () => dependencies.postman.createWorkspace(workspaceName, aboutText, workspaceTeamId)
61655
61681
  );
61656
61682
  workspaceId = workspace.id;
61683
+ } else {
61684
+ const visibility = await dependencies.postman.getWorkspaceVisibility(workspaceId);
61685
+ if (visibility && visibility !== "team") {
61686
+ dependencies.core.warning(
61687
+ `Workspace ${workspaceId} has visibility '${visibility}', so it does not appear in the API Catalog and teammates or other API keys cannot see it. This usually means an org-mode run created it without workspace-team-id. Recreate it with workspace-team-id set (delete the workspace and clear the POSTMAN_WORKSPACE_ID repository variable), or share it to the team from Workspace Settings.`
61688
+ );
61689
+ }
61657
61690
  }
61658
61691
  outputs["workspace-id"] = workspaceId || "";
61659
61692
  outputs["workspace-url"] = `https://go.postman.co/workspace/${workspaceId}`;
package/dist/index.cjs CHANGED
@@ -48050,12 +48050,25 @@ var PostmanAssetsClient = class {
48050
48050
  throw new Error("Workspace create did not return an id");
48051
48051
  }
48052
48052
  const workspace = await this.request(`/workspaces/${workspaceId}`);
48053
- const workspaceDetails = asRecord(workspace?.workspace);
48054
- if (workspaceDetails?.visibility !== "team") {
48053
+ let visibility = asRecord(workspace?.workspace)?.visibility;
48054
+ if (visibility !== "team") {
48055
48055
  await this.request(`/workspaces/${workspaceId}`, {
48056
48056
  method: "PUT",
48057
48057
  body: JSON.stringify(payload)
48058
48058
  });
48059
+ const reread = await this.request(`/workspaces/${workspaceId}`);
48060
+ visibility = asRecord(reread?.workspace)?.visibility;
48061
+ }
48062
+ if (typeof visibility === "string" && visibility !== "team") {
48063
+ let cleanedUp = false;
48064
+ try {
48065
+ await this.request(`/workspaces/${workspaceId}`, { method: "DELETE" });
48066
+ cleanedUp = true;
48067
+ } catch {
48068
+ }
48069
+ throw new Error(
48070
+ `Workspace ${workspaceId} was created with visibility '${visibility}' and could not be promoted to team visibility. On org-mode accounts this happens when the workspace-team-id input is missing or wrong: the workspace is created at the organization level with personal visibility, so teammates, other API keys, and the API Catalog cannot see it. Set workspace-team-id to the sub-team that should own this workspace and re-run. ` + (cleanedUp ? "The just-created workspace has been deleted so it does not hold the repository link invisibly." : `Cleanup of the just-created workspace failed; delete workspace ${workspaceId} manually before re-running.`)
48071
+ );
48059
48072
  }
48060
48073
  return {
48061
48074
  id: workspaceId
@@ -48066,6 +48079,19 @@ var PostmanAssetsClient = class {
48066
48079
  shouldRetry: (err) => !(err instanceof Error && err.message.includes("workspace-team-id"))
48067
48080
  });
48068
48081
  }
48082
+ /**
48083
+ * Visibility of a workspace as seen by this API key, or null when the
48084
+ * workspace cannot be read (deleted, or invisible to these credentials).
48085
+ */
48086
+ async getWorkspaceVisibility(workspaceId) {
48087
+ try {
48088
+ const workspace = await this.request(`/workspaces/${workspaceId}`);
48089
+ const visibility = asRecord(workspace?.workspace)?.visibility;
48090
+ return typeof visibility === "string" ? visibility : null;
48091
+ } catch {
48092
+ return null;
48093
+ }
48094
+ }
48069
48095
  async listWorkspaces() {
48070
48096
  const allWorkspaces = [];
48071
48097
  const seenCursors = /* @__PURE__ */ new Set();
@@ -63420,6 +63446,13 @@ For CLI usage, pass --workspace-team-id <id> or export POSTMAN_WORKSPACE_TEAM_ID
63420
63446
  async () => dependencies.postman.createWorkspace(workspaceName, aboutText, workspaceTeamId)
63421
63447
  );
63422
63448
  workspaceId = workspace.id;
63449
+ } else {
63450
+ const visibility = await dependencies.postman.getWorkspaceVisibility(workspaceId);
63451
+ if (visibility && visibility !== "team") {
63452
+ dependencies.core.warning(
63453
+ `Workspace ${workspaceId} has visibility '${visibility}', so it does not appear in the API Catalog and teammates or other API keys cannot see it. This usually means an org-mode run created it without workspace-team-id. Recreate it with workspace-team-id set (delete the workspace and clear the POSTMAN_WORKSPACE_ID repository variable), or share it to the team from Workspace Settings.`
63454
+ );
63455
+ }
63423
63456
  }
63424
63457
  outputs["workspace-id"] = workspaceId || "";
63425
63458
  outputs["workspace-url"] = `https://go.postman.co/workspace/${workspaceId}`;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@postman-cse/onboarding-bootstrap",
3
- "version": "0.14.0",
3
+ "version": "0.14.1",
4
4
  "description": "Public customer preview Postman bootstrap GitHub Action.",
5
5
  "type": "module",
6
6
  "main": "dist/index.cjs",