@postman-cse/onboarding-repo-sync 2.0.0 → 2.0.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
@@ -125519,7 +125519,7 @@ function resolveActionVersion(explicit) {
125519
125519
  if (explicit) {
125520
125520
  return explicit;
125521
125521
  }
125522
- return "2.0.0" ? "2.0.0" : "unknown";
125522
+ return "2.0.1" ? "2.0.1" : "unknown";
125523
125523
  }
125524
125524
  function telemetryDisabled(env) {
125525
125525
  const flag = String(env.POSTMAN_ACTIONS_TELEMETRY ?? "").trim().toLowerCase();
@@ -127026,6 +127026,16 @@ var AccessTokenProvider = class {
127026
127026
  function isExpiredAuthError(status, body) {
127027
127027
  return status === 401 || body.includes("UNAUTHENTICATED") || body.includes("authenticationError");
127028
127028
  }
127029
+ function isTransientGatewayError(status, body) {
127030
+ if (status === 502 || status === 503 || status === 504) return true;
127031
+ if (status >= 500 && (body.includes("ESOCKETTIMEDOUT") || body.includes("ETIMEDOUT") || body.includes("ECONNRESET") || body.includes("serverError") || body.includes("downstream"))) {
127032
+ return true;
127033
+ }
127034
+ return false;
127035
+ }
127036
+ function defaultSleep(ms) {
127037
+ return new Promise((resolve3) => setTimeout(resolve3, ms));
127038
+ }
127029
127039
  var AccessTokenGatewayClient = class {
127030
127040
  tokenProvider;
127031
127041
  bifrostBaseUrl;
@@ -127033,6 +127043,9 @@ var AccessTokenGatewayClient = class {
127033
127043
  orgMode;
127034
127044
  fetchImpl;
127035
127045
  secretMasker;
127046
+ maxRetries;
127047
+ retryBaseDelayMs;
127048
+ sleepImpl;
127036
127049
  constructor(options) {
127037
127050
  this.tokenProvider = options.tokenProvider;
127038
127051
  this.bifrostBaseUrl = String(
@@ -127042,6 +127055,9 @@ var AccessTokenGatewayClient = class {
127042
127055
  this.orgMode = options.orgMode ?? false;
127043
127056
  this.fetchImpl = options.fetchImpl ?? fetch;
127044
127057
  this.secretMasker = options.secretMasker ?? createSecretMasker([this.tokenProvider.current()]);
127058
+ this.maxRetries = options.maxRetries ?? 3;
127059
+ this.retryBaseDelayMs = options.retryBaseDelayMs ?? 400;
127060
+ this.sleepImpl = options.sleepImpl ?? defaultSleep;
127045
127061
  }
127046
127062
  configureTeamContext(teamId, orgMode) {
127047
127063
  this.teamId = String(teamId || "").trim();
@@ -127072,23 +127088,37 @@ var AccessTokenGatewayClient = class {
127072
127088
  })
127073
127089
  });
127074
127090
  }
127075
- /** Send a gateway request, refreshing the token once on an auth failure. */
127091
+ /**
127092
+ * Send a gateway request, refreshing the token once on an auth failure and
127093
+ * retrying transient downstream failures (5xx / Bifrost read timeouts) with
127094
+ * exponential backoff. The auth-refresh-once path is independent of the
127095
+ * transient-retry budget.
127096
+ */
127076
127097
  async request(request) {
127077
- let response = await this.send(request);
127078
- if (response.ok) {
127079
- return response;
127080
- }
127081
- const body = await response.text().catch(() => "");
127082
- if (isExpiredAuthError(response.status, body) && this.tokenProvider.canRefresh()) {
127083
- await this.tokenProvider.refresh();
127084
- response = await this.send(request);
127098
+ let attempt = 0;
127099
+ for (; ; ) {
127100
+ let response = await this.send(request);
127085
127101
  if (response.ok) {
127086
127102
  return response;
127087
127103
  }
127088
- const retryBody = await response.text().catch(() => "");
127089
- throw this.toHttpError(request, response, retryBody);
127104
+ const body = await response.text().catch(() => "");
127105
+ if (isExpiredAuthError(response.status, body) && this.tokenProvider.canRefresh()) {
127106
+ await this.tokenProvider.refresh();
127107
+ response = await this.send(request);
127108
+ if (response.ok) {
127109
+ return response;
127110
+ }
127111
+ const retryBody = await response.text().catch(() => "");
127112
+ throw this.toHttpError(request, response, retryBody);
127113
+ }
127114
+ if (isTransientGatewayError(response.status, body) && attempt < this.maxRetries) {
127115
+ const delay = this.retryBaseDelayMs * 2 ** attempt;
127116
+ attempt += 1;
127117
+ await this.sleepImpl(delay);
127118
+ continue;
127119
+ }
127120
+ throw this.toHttpError(request, response, body);
127090
127121
  }
127091
- throw this.toHttpError(request, response, body);
127092
127122
  }
127093
127123
  /** Send a gateway request and parse the JSON body, or null when empty. */
127094
127124
  async requestJson(request) {
package/dist/cli.cjs CHANGED
@@ -123621,7 +123621,7 @@ function resolveActionVersion(explicit) {
123621
123621
  if (explicit) {
123622
123622
  return explicit;
123623
123623
  }
123624
- return "2.0.0" ? "2.0.0" : "unknown";
123624
+ return "2.0.1" ? "2.0.1" : "unknown";
123625
123625
  }
123626
123626
  function telemetryDisabled(env) {
123627
123627
  const flag = String(env.POSTMAN_ACTIONS_TELEMETRY ?? "").trim().toLowerCase();
@@ -125128,6 +125128,16 @@ var AccessTokenProvider = class {
125128
125128
  function isExpiredAuthError(status, body) {
125129
125129
  return status === 401 || body.includes("UNAUTHENTICATED") || body.includes("authenticationError");
125130
125130
  }
125131
+ function isTransientGatewayError(status, body) {
125132
+ if (status === 502 || status === 503 || status === 504) return true;
125133
+ if (status >= 500 && (body.includes("ESOCKETTIMEDOUT") || body.includes("ETIMEDOUT") || body.includes("ECONNRESET") || body.includes("serverError") || body.includes("downstream"))) {
125134
+ return true;
125135
+ }
125136
+ return false;
125137
+ }
125138
+ function defaultSleep(ms) {
125139
+ return new Promise((resolve2) => setTimeout(resolve2, ms));
125140
+ }
125131
125141
  var AccessTokenGatewayClient = class {
125132
125142
  tokenProvider;
125133
125143
  bifrostBaseUrl;
@@ -125135,6 +125145,9 @@ var AccessTokenGatewayClient = class {
125135
125145
  orgMode;
125136
125146
  fetchImpl;
125137
125147
  secretMasker;
125148
+ maxRetries;
125149
+ retryBaseDelayMs;
125150
+ sleepImpl;
125138
125151
  constructor(options) {
125139
125152
  this.tokenProvider = options.tokenProvider;
125140
125153
  this.bifrostBaseUrl = String(
@@ -125144,6 +125157,9 @@ var AccessTokenGatewayClient = class {
125144
125157
  this.orgMode = options.orgMode ?? false;
125145
125158
  this.fetchImpl = options.fetchImpl ?? fetch;
125146
125159
  this.secretMasker = options.secretMasker ?? createSecretMasker([this.tokenProvider.current()]);
125160
+ this.maxRetries = options.maxRetries ?? 3;
125161
+ this.retryBaseDelayMs = options.retryBaseDelayMs ?? 400;
125162
+ this.sleepImpl = options.sleepImpl ?? defaultSleep;
125147
125163
  }
125148
125164
  configureTeamContext(teamId, orgMode) {
125149
125165
  this.teamId = String(teamId || "").trim();
@@ -125174,23 +125190,37 @@ var AccessTokenGatewayClient = class {
125174
125190
  })
125175
125191
  });
125176
125192
  }
125177
- /** Send a gateway request, refreshing the token once on an auth failure. */
125193
+ /**
125194
+ * Send a gateway request, refreshing the token once on an auth failure and
125195
+ * retrying transient downstream failures (5xx / Bifrost read timeouts) with
125196
+ * exponential backoff. The auth-refresh-once path is independent of the
125197
+ * transient-retry budget.
125198
+ */
125178
125199
  async request(request) {
125179
- let response = await this.send(request);
125180
- if (response.ok) {
125181
- return response;
125182
- }
125183
- const body = await response.text().catch(() => "");
125184
- if (isExpiredAuthError(response.status, body) && this.tokenProvider.canRefresh()) {
125185
- await this.tokenProvider.refresh();
125186
- response = await this.send(request);
125200
+ let attempt = 0;
125201
+ for (; ; ) {
125202
+ let response = await this.send(request);
125187
125203
  if (response.ok) {
125188
125204
  return response;
125189
125205
  }
125190
- const retryBody = await response.text().catch(() => "");
125191
- throw this.toHttpError(request, response, retryBody);
125206
+ const body = await response.text().catch(() => "");
125207
+ if (isExpiredAuthError(response.status, body) && this.tokenProvider.canRefresh()) {
125208
+ await this.tokenProvider.refresh();
125209
+ response = await this.send(request);
125210
+ if (response.ok) {
125211
+ return response;
125212
+ }
125213
+ const retryBody = await response.text().catch(() => "");
125214
+ throw this.toHttpError(request, response, retryBody);
125215
+ }
125216
+ if (isTransientGatewayError(response.status, body) && attempt < this.maxRetries) {
125217
+ const delay = this.retryBaseDelayMs * 2 ** attempt;
125218
+ attempt += 1;
125219
+ await this.sleepImpl(delay);
125220
+ continue;
125221
+ }
125222
+ throw this.toHttpError(request, response, body);
125192
125223
  }
125193
- throw this.toHttpError(request, response, body);
125194
125224
  }
125195
125225
  /** Send a gateway request and parse the JSON body, or null when empty. */
125196
125226
  async requestJson(request) {
package/dist/index.cjs CHANGED
@@ -125533,7 +125533,7 @@ function resolveActionVersion(explicit) {
125533
125533
  if (explicit) {
125534
125534
  return explicit;
125535
125535
  }
125536
- return "2.0.0" ? "2.0.0" : "unknown";
125536
+ return "2.0.1" ? "2.0.1" : "unknown";
125537
125537
  }
125538
125538
  function telemetryDisabled(env) {
125539
125539
  const flag = String(env.POSTMAN_ACTIONS_TELEMETRY ?? "").trim().toLowerCase();
@@ -127040,6 +127040,16 @@ var AccessTokenProvider = class {
127040
127040
  function isExpiredAuthError(status, body) {
127041
127041
  return status === 401 || body.includes("UNAUTHENTICATED") || body.includes("authenticationError");
127042
127042
  }
127043
+ function isTransientGatewayError(status, body) {
127044
+ if (status === 502 || status === 503 || status === 504) return true;
127045
+ if (status >= 500 && (body.includes("ESOCKETTIMEDOUT") || body.includes("ETIMEDOUT") || body.includes("ECONNRESET") || body.includes("serverError") || body.includes("downstream"))) {
127046
+ return true;
127047
+ }
127048
+ return false;
127049
+ }
127050
+ function defaultSleep(ms) {
127051
+ return new Promise((resolve3) => setTimeout(resolve3, ms));
127052
+ }
127043
127053
  var AccessTokenGatewayClient = class {
127044
127054
  tokenProvider;
127045
127055
  bifrostBaseUrl;
@@ -127047,6 +127057,9 @@ var AccessTokenGatewayClient = class {
127047
127057
  orgMode;
127048
127058
  fetchImpl;
127049
127059
  secretMasker;
127060
+ maxRetries;
127061
+ retryBaseDelayMs;
127062
+ sleepImpl;
127050
127063
  constructor(options) {
127051
127064
  this.tokenProvider = options.tokenProvider;
127052
127065
  this.bifrostBaseUrl = String(
@@ -127056,6 +127069,9 @@ var AccessTokenGatewayClient = class {
127056
127069
  this.orgMode = options.orgMode ?? false;
127057
127070
  this.fetchImpl = options.fetchImpl ?? fetch;
127058
127071
  this.secretMasker = options.secretMasker ?? createSecretMasker([this.tokenProvider.current()]);
127072
+ this.maxRetries = options.maxRetries ?? 3;
127073
+ this.retryBaseDelayMs = options.retryBaseDelayMs ?? 400;
127074
+ this.sleepImpl = options.sleepImpl ?? defaultSleep;
127059
127075
  }
127060
127076
  configureTeamContext(teamId, orgMode) {
127061
127077
  this.teamId = String(teamId || "").trim();
@@ -127086,23 +127102,37 @@ var AccessTokenGatewayClient = class {
127086
127102
  })
127087
127103
  });
127088
127104
  }
127089
- /** Send a gateway request, refreshing the token once on an auth failure. */
127105
+ /**
127106
+ * Send a gateway request, refreshing the token once on an auth failure and
127107
+ * retrying transient downstream failures (5xx / Bifrost read timeouts) with
127108
+ * exponential backoff. The auth-refresh-once path is independent of the
127109
+ * transient-retry budget.
127110
+ */
127090
127111
  async request(request) {
127091
- let response = await this.send(request);
127092
- if (response.ok) {
127093
- return response;
127094
- }
127095
- const body = await response.text().catch(() => "");
127096
- if (isExpiredAuthError(response.status, body) && this.tokenProvider.canRefresh()) {
127097
- await this.tokenProvider.refresh();
127098
- response = await this.send(request);
127112
+ let attempt = 0;
127113
+ for (; ; ) {
127114
+ let response = await this.send(request);
127099
127115
  if (response.ok) {
127100
127116
  return response;
127101
127117
  }
127102
- const retryBody = await response.text().catch(() => "");
127103
- throw this.toHttpError(request, response, retryBody);
127118
+ const body = await response.text().catch(() => "");
127119
+ if (isExpiredAuthError(response.status, body) && this.tokenProvider.canRefresh()) {
127120
+ await this.tokenProvider.refresh();
127121
+ response = await this.send(request);
127122
+ if (response.ok) {
127123
+ return response;
127124
+ }
127125
+ const retryBody = await response.text().catch(() => "");
127126
+ throw this.toHttpError(request, response, retryBody);
127127
+ }
127128
+ if (isTransientGatewayError(response.status, body) && attempt < this.maxRetries) {
127129
+ const delay = this.retryBaseDelayMs * 2 ** attempt;
127130
+ attempt += 1;
127131
+ await this.sleepImpl(delay);
127132
+ continue;
127133
+ }
127134
+ throw this.toHttpError(request, response, body);
127104
127135
  }
127105
- throw this.toHttpError(request, response, body);
127106
127136
  }
127107
127137
  /** Send a gateway request and parse the JSON body, or null when empty. */
127108
127138
  async requestJson(request) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@postman-cse/onboarding-repo-sync",
3
- "version": "2.0.0",
3
+ "version": "2.0.1",
4
4
  "description": "Postman repo sync GitHub Action.",
5
5
  "type": "module",
6
6
  "main": "dist/index.cjs",