@postman-cse/onboarding-bootstrap 0.14.0 → 0.14.2

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
@@ -48026,6 +48026,12 @@ var PostmanAssetsClient = class {
48026
48026
  { cause: err }
48027
48027
  );
48028
48028
  }
48029
+ if (targetTeamId != null && err instanceof Error && err.message.includes("You are not authorized to perform this action")) {
48030
+ throw new Error(
48031
+ `The workspace-team-id input (${targetTeamId}) was rejected as unauthorized by the Postman API. In org-mode accounts it must be the numeric id of a sub-team this API key can access; GET https://api.getpostman.com/teams lists the available sub-teams. Fix the workspace-team-id value and re-run.`,
48032
+ { cause: err }
48033
+ );
48034
+ }
48029
48035
  throw err;
48030
48036
  }
48031
48037
  const createdWorkspace = asRecord(created?.workspace);
@@ -48034,12 +48040,25 @@ var PostmanAssetsClient = class {
48034
48040
  throw new Error("Workspace create did not return an id");
48035
48041
  }
48036
48042
  const workspace = await this.request(`/workspaces/${workspaceId}`);
48037
- const workspaceDetails = asRecord(workspace?.workspace);
48038
- if (workspaceDetails?.visibility !== "team") {
48043
+ let visibility = asRecord(workspace?.workspace)?.visibility;
48044
+ if (visibility !== "team") {
48039
48045
  await this.request(`/workspaces/${workspaceId}`, {
48040
48046
  method: "PUT",
48041
48047
  body: JSON.stringify(payload)
48042
48048
  });
48049
+ const reread = await this.request(`/workspaces/${workspaceId}`);
48050
+ visibility = asRecord(reread?.workspace)?.visibility;
48051
+ }
48052
+ if (typeof visibility === "string" && visibility !== "team") {
48053
+ let cleanedUp = false;
48054
+ try {
48055
+ await this.request(`/workspaces/${workspaceId}`, { method: "DELETE" });
48056
+ cleanedUp = true;
48057
+ } catch {
48058
+ }
48059
+ throw new Error(
48060
+ `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.`)
48061
+ );
48043
48062
  }
48044
48063
  return {
48045
48064
  id: workspaceId
@@ -48050,6 +48069,19 @@ var PostmanAssetsClient = class {
48050
48069
  shouldRetry: (err) => !(err instanceof Error && err.message.includes("workspace-team-id"))
48051
48070
  });
48052
48071
  }
48072
+ /**
48073
+ * Visibility of a workspace as seen by this API key, or null when the
48074
+ * workspace cannot be read (deleted, or invisible to these credentials).
48075
+ */
48076
+ async getWorkspaceVisibility(workspaceId) {
48077
+ try {
48078
+ const workspace = await this.request(`/workspaces/${workspaceId}`);
48079
+ const visibility = asRecord(workspace?.workspace)?.visibility;
48080
+ return typeof visibility === "string" ? visibility : null;
48081
+ } catch {
48082
+ return null;
48083
+ }
48084
+ }
48053
48085
  async listWorkspaces() {
48054
48086
  const allWorkspaces = [];
48055
48087
  const seenCursors = /* @__PURE__ */ new Set();
@@ -63404,6 +63436,13 @@ For CLI usage, pass --workspace-team-id <id> or export POSTMAN_WORKSPACE_TEAM_ID
63404
63436
  async () => dependencies.postman.createWorkspace(workspaceName, aboutText, workspaceTeamId)
63405
63437
  );
63406
63438
  workspaceId = workspace.id;
63439
+ } else {
63440
+ const visibility = await dependencies.postman.getWorkspaceVisibility(workspaceId);
63441
+ if (visibility && visibility !== "team") {
63442
+ dependencies.core.warning(
63443
+ `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.`
63444
+ );
63445
+ }
63407
63446
  }
63408
63447
  outputs["workspace-id"] = workspaceId || "";
63409
63448
  outputs["workspace-url"] = `https://go.postman.co/workspace/${workspaceId}`;
package/dist/cli.cjs CHANGED
@@ -46345,6 +46345,12 @@ var PostmanAssetsClient = class {
46345
46345
  { cause: err }
46346
46346
  );
46347
46347
  }
46348
+ if (targetTeamId != null && err instanceof Error && err.message.includes("You are not authorized to perform this action")) {
46349
+ throw new Error(
46350
+ `The workspace-team-id input (${targetTeamId}) was rejected as unauthorized by the Postman API. In org-mode accounts it must be the numeric id of a sub-team this API key can access; GET https://api.getpostman.com/teams lists the available sub-teams. Fix the workspace-team-id value and re-run.`,
46351
+ { cause: err }
46352
+ );
46353
+ }
46348
46354
  throw err;
46349
46355
  }
46350
46356
  const createdWorkspace = asRecord(created?.workspace);
@@ -46353,12 +46359,25 @@ var PostmanAssetsClient = class {
46353
46359
  throw new Error("Workspace create did not return an id");
46354
46360
  }
46355
46361
  const workspace = await this.request(`/workspaces/${workspaceId}`);
46356
- const workspaceDetails = asRecord(workspace?.workspace);
46357
- if (workspaceDetails?.visibility !== "team") {
46362
+ let visibility = asRecord(workspace?.workspace)?.visibility;
46363
+ if (visibility !== "team") {
46358
46364
  await this.request(`/workspaces/${workspaceId}`, {
46359
46365
  method: "PUT",
46360
46366
  body: JSON.stringify(payload)
46361
46367
  });
46368
+ const reread = await this.request(`/workspaces/${workspaceId}`);
46369
+ visibility = asRecord(reread?.workspace)?.visibility;
46370
+ }
46371
+ if (typeof visibility === "string" && visibility !== "team") {
46372
+ let cleanedUp = false;
46373
+ try {
46374
+ await this.request(`/workspaces/${workspaceId}`, { method: "DELETE" });
46375
+ cleanedUp = true;
46376
+ } catch {
46377
+ }
46378
+ throw new Error(
46379
+ `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.`)
46380
+ );
46362
46381
  }
46363
46382
  return {
46364
46383
  id: workspaceId
@@ -46369,6 +46388,19 @@ var PostmanAssetsClient = class {
46369
46388
  shouldRetry: (err) => !(err instanceof Error && err.message.includes("workspace-team-id"))
46370
46389
  });
46371
46390
  }
46391
+ /**
46392
+ * Visibility of a workspace as seen by this API key, or null when the
46393
+ * workspace cannot be read (deleted, or invisible to these credentials).
46394
+ */
46395
+ async getWorkspaceVisibility(workspaceId) {
46396
+ try {
46397
+ const workspace = await this.request(`/workspaces/${workspaceId}`);
46398
+ const visibility = asRecord(workspace?.workspace)?.visibility;
46399
+ return typeof visibility === "string" ? visibility : null;
46400
+ } catch {
46401
+ return null;
46402
+ }
46403
+ }
46372
46404
  async listWorkspaces() {
46373
46405
  const allWorkspaces = [];
46374
46406
  const seenCursors = /* @__PURE__ */ new Set();
@@ -61654,6 +61686,13 @@ For CLI usage, pass --workspace-team-id <id> or export POSTMAN_WORKSPACE_TEAM_ID
61654
61686
  async () => dependencies.postman.createWorkspace(workspaceName, aboutText, workspaceTeamId)
61655
61687
  );
61656
61688
  workspaceId = workspace.id;
61689
+ } else {
61690
+ const visibility = await dependencies.postman.getWorkspaceVisibility(workspaceId);
61691
+ if (visibility && visibility !== "team") {
61692
+ dependencies.core.warning(
61693
+ `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.`
61694
+ );
61695
+ }
61657
61696
  }
61658
61697
  outputs["workspace-id"] = workspaceId || "";
61659
61698
  outputs["workspace-url"] = `https://go.postman.co/workspace/${workspaceId}`;
package/dist/index.cjs CHANGED
@@ -48042,6 +48042,12 @@ var PostmanAssetsClient = class {
48042
48042
  { cause: err }
48043
48043
  );
48044
48044
  }
48045
+ if (targetTeamId != null && err instanceof Error && err.message.includes("You are not authorized to perform this action")) {
48046
+ throw new Error(
48047
+ `The workspace-team-id input (${targetTeamId}) was rejected as unauthorized by the Postman API. In org-mode accounts it must be the numeric id of a sub-team this API key can access; GET https://api.getpostman.com/teams lists the available sub-teams. Fix the workspace-team-id value and re-run.`,
48048
+ { cause: err }
48049
+ );
48050
+ }
48045
48051
  throw err;
48046
48052
  }
48047
48053
  const createdWorkspace = asRecord(created?.workspace);
@@ -48050,12 +48056,25 @@ var PostmanAssetsClient = class {
48050
48056
  throw new Error("Workspace create did not return an id");
48051
48057
  }
48052
48058
  const workspace = await this.request(`/workspaces/${workspaceId}`);
48053
- const workspaceDetails = asRecord(workspace?.workspace);
48054
- if (workspaceDetails?.visibility !== "team") {
48059
+ let visibility = asRecord(workspace?.workspace)?.visibility;
48060
+ if (visibility !== "team") {
48055
48061
  await this.request(`/workspaces/${workspaceId}`, {
48056
48062
  method: "PUT",
48057
48063
  body: JSON.stringify(payload)
48058
48064
  });
48065
+ const reread = await this.request(`/workspaces/${workspaceId}`);
48066
+ visibility = asRecord(reread?.workspace)?.visibility;
48067
+ }
48068
+ if (typeof visibility === "string" && visibility !== "team") {
48069
+ let cleanedUp = false;
48070
+ try {
48071
+ await this.request(`/workspaces/${workspaceId}`, { method: "DELETE" });
48072
+ cleanedUp = true;
48073
+ } catch {
48074
+ }
48075
+ throw new Error(
48076
+ `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.`)
48077
+ );
48059
48078
  }
48060
48079
  return {
48061
48080
  id: workspaceId
@@ -48066,6 +48085,19 @@ var PostmanAssetsClient = class {
48066
48085
  shouldRetry: (err) => !(err instanceof Error && err.message.includes("workspace-team-id"))
48067
48086
  });
48068
48087
  }
48088
+ /**
48089
+ * Visibility of a workspace as seen by this API key, or null when the
48090
+ * workspace cannot be read (deleted, or invisible to these credentials).
48091
+ */
48092
+ async getWorkspaceVisibility(workspaceId) {
48093
+ try {
48094
+ const workspace = await this.request(`/workspaces/${workspaceId}`);
48095
+ const visibility = asRecord(workspace?.workspace)?.visibility;
48096
+ return typeof visibility === "string" ? visibility : null;
48097
+ } catch {
48098
+ return null;
48099
+ }
48100
+ }
48069
48101
  async listWorkspaces() {
48070
48102
  const allWorkspaces = [];
48071
48103
  const seenCursors = /* @__PURE__ */ new Set();
@@ -63420,6 +63452,13 @@ For CLI usage, pass --workspace-team-id <id> or export POSTMAN_WORKSPACE_TEAM_ID
63420
63452
  async () => dependencies.postman.createWorkspace(workspaceName, aboutText, workspaceTeamId)
63421
63453
  );
63422
63454
  workspaceId = workspace.id;
63455
+ } else {
63456
+ const visibility = await dependencies.postman.getWorkspaceVisibility(workspaceId);
63457
+ if (visibility && visibility !== "team") {
63458
+ dependencies.core.warning(
63459
+ `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.`
63460
+ );
63461
+ }
63423
63462
  }
63424
63463
  outputs["workspace-id"] = workspaceId || "";
63425
63464
  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.2",
4
4
  "description": "Public customer preview Postman bootstrap GitHub Action.",
5
5
  "type": "module",
6
6
  "main": "dist/index.cjs",