@postman-cse/onboarding-bootstrap 2.9.7 → 2.9.8
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 +65 -2
- package/dist/cli.cjs +64 -2
- package/dist/index.cjs +65 -2
- package/package.json +1 -1
package/dist/action.cjs
CHANGED
|
@@ -258195,6 +258195,7 @@ var POSTMAN_ENDPOINT_PROFILES = {
|
|
|
258195
258195
|
prod: {
|
|
258196
258196
|
apiBaseUrl: "https://api.getpostman.com",
|
|
258197
258197
|
bifrostBaseUrl: "https://bifrost-premium-https-v4.gw.postman.com",
|
|
258198
|
+
fallbackBaseUrl: "https://go.postman.co/_api",
|
|
258198
258199
|
cliInstallUrl: "https://dl-cli.pstmn.io/install/unix.sh",
|
|
258199
258200
|
gatewayBaseUrl: "https://gateway.postman.com",
|
|
258200
258201
|
iapubBaseUrl: "https://iapub.postman.co"
|
|
@@ -258202,6 +258203,7 @@ var POSTMAN_ENDPOINT_PROFILES = {
|
|
|
258202
258203
|
beta: {
|
|
258203
258204
|
apiBaseUrl: "https://api.getpostman-beta.com",
|
|
258204
258205
|
bifrostBaseUrl: "https://bifrost-https-v4.gw.postman-beta.com",
|
|
258206
|
+
fallbackBaseUrl: "https://go.postman-beta.co/_api",
|
|
258205
258207
|
cliInstallUrl: "https://dl-cli.pstmn-beta.io/install/unix.sh",
|
|
258206
258208
|
gatewayBaseUrl: "https://gateway.postman-beta.com",
|
|
258207
258209
|
iapubBaseUrl: "https://iapub.postman.co"
|
|
@@ -265363,6 +265365,11 @@ ${error2.responseBody ?? ""}`
|
|
|
265363
265365
|
method: "post",
|
|
265364
265366
|
path: `/v3/collections/${cid}/items/`,
|
|
265365
265367
|
retry: "none",
|
|
265368
|
+
// The transport's cold /_api fallback only fires after the primary
|
|
265369
|
+
// budget is exhausted; by then this loop has reconciled the item as
|
|
265370
|
+
// absent (match == null), so a fallback resend cannot duplicate a
|
|
265371
|
+
// committed create.
|
|
265372
|
+
fallback: "auto",
|
|
265366
265373
|
headers: { "X-Entity-Type": kind },
|
|
265367
265374
|
body: this.buildItemCreateBody(item, parentId)
|
|
265368
265375
|
});
|
|
@@ -265740,6 +265747,7 @@ var AccessTokenGatewayClient = class {
|
|
|
265740
265747
|
orgMode;
|
|
265741
265748
|
fetchImpl;
|
|
265742
265749
|
secretMasker;
|
|
265750
|
+
fallbackBaseUrl;
|
|
265743
265751
|
maxRetries;
|
|
265744
265752
|
retryBaseDelayMs;
|
|
265745
265753
|
retryMaxDelayMs;
|
|
@@ -265755,6 +265763,8 @@ var AccessTokenGatewayClient = class {
|
|
|
265755
265763
|
this.orgMode = options.orgMode ?? false;
|
|
265756
265764
|
this.fetchImpl = options.fetchImpl ?? fetch;
|
|
265757
265765
|
this.secretMasker = options.secretMasker ?? createSecretMasker([this.tokenProvider.current()]);
|
|
265766
|
+
const fallbackEnv = typeof process !== "undefined" ? process.env?.POSTMAN_ITEM_CREATE_FALLBACK : void 0;
|
|
265767
|
+
this.fallbackBaseUrl = fallbackEnv === "off" ? void 0 : options.fallbackBaseUrl?.replace(/\/+$/, "");
|
|
265758
265768
|
this.maxRetries = options.maxRetries ?? 3;
|
|
265759
265769
|
this.retryBaseDelayMs = options.retryBaseDelayMs ?? 400;
|
|
265760
265770
|
this.retryMaxDelayMs = options.retryMaxDelayMs ?? 5e3;
|
|
@@ -265777,8 +265787,8 @@ var AccessTokenGatewayClient = class {
|
|
|
265777
265787
|
}
|
|
265778
265788
|
return headers;
|
|
265779
265789
|
}
|
|
265780
|
-
async send(request) {
|
|
265781
|
-
const url = `${this.bifrostBaseUrl}/ws/proxy`;
|
|
265790
|
+
async send(request, baseUrl) {
|
|
265791
|
+
const url = `${baseUrl ?? this.bifrostBaseUrl}/ws/proxy`;
|
|
265782
265792
|
const controller = new AbortController();
|
|
265783
265793
|
const timer = setTimeout(() => controller.abort(), this.requestTimeoutMs);
|
|
265784
265794
|
try {
|
|
@@ -265808,6 +265818,50 @@ var AccessTokenGatewayClient = class {
|
|
|
265808
265818
|
* 200 envelope carrying an inner collection-service error is treated as that
|
|
265809
265819
|
* inner status. The auth-refresh-once path is independent of the retry budget.
|
|
265810
265820
|
*/
|
|
265821
|
+
/**
|
|
265822
|
+
* One cold, serial attempt against the fallback base URL after the primary
|
|
265823
|
+
* budget is exhausted on a transient failure. Never hedged in parallel with
|
|
265824
|
+
* the primary; only fires when the request would otherwise throw. Callers
|
|
265825
|
+
* with `retry: 'none'` still reconcile first — the fallback attempt here is
|
|
265826
|
+
* the resend, so it is only used for requests whose mutation is known
|
|
265827
|
+
* idempotent or already reconciled by the caller's adopt-on-ambiguous loop.
|
|
265828
|
+
*/
|
|
265829
|
+
async tryFallback(request) {
|
|
265830
|
+
if (!this.fallbackBaseUrl) return null;
|
|
265831
|
+
try {
|
|
265832
|
+
return await this.send(request, this.fallbackBaseUrl);
|
|
265833
|
+
} catch {
|
|
265834
|
+
return null;
|
|
265835
|
+
}
|
|
265836
|
+
}
|
|
265837
|
+
/**
|
|
265838
|
+
* Run the fallback attempt and classify its response the same way the
|
|
265839
|
+
* primary path would. Returns the rebuilt success response, or null when the
|
|
265840
|
+
* fallback also failed transiently (caller then throws the original error).
|
|
265841
|
+
* Non-transient fallback failures (4xx, inner errors) surface as their own
|
|
265842
|
+
* HttpError since they are the freshest authoritative answer.
|
|
265843
|
+
*/
|
|
265844
|
+
fallbackEligible(request) {
|
|
265845
|
+
if (!this.fallbackBaseUrl) return false;
|
|
265846
|
+
const retryMode = request.retry ?? (request.method === "get" ? "safe" : "none");
|
|
265847
|
+
return retryMode === "safe" || request.fallback === "auto";
|
|
265848
|
+
}
|
|
265849
|
+
async attemptFallback(request) {
|
|
265850
|
+
if (!this.fallbackEligible(request)) return null;
|
|
265851
|
+
const response = await this.tryFallback(request);
|
|
265852
|
+
if (!response) return null;
|
|
265853
|
+
const body2 = await response.text().catch(() => "");
|
|
265854
|
+
if (response.ok) {
|
|
265855
|
+
const innerStatus = detectInnerError(body2);
|
|
265856
|
+
if (innerStatus !== null) {
|
|
265857
|
+
if (isTransientGatewayError(innerStatus, body2)) return null;
|
|
265858
|
+
throw this.toInnerHttpError(request, innerStatus, body2);
|
|
265859
|
+
}
|
|
265860
|
+
return this.rebuildResponse(response, body2);
|
|
265861
|
+
}
|
|
265862
|
+
if (isTransientGatewayError(response.status, body2)) return null;
|
|
265863
|
+
throw this.toHttpError(request, response, body2);
|
|
265864
|
+
}
|
|
265811
265865
|
async request(request) {
|
|
265812
265866
|
if (!this.tokenProvider.current() && this.tokenProvider.canRefresh()) {
|
|
265813
265867
|
await this.tokenProvider.refresh();
|
|
@@ -265825,6 +265879,8 @@ var AccessTokenGatewayClient = class {
|
|
|
265825
265879
|
await this.sleepImpl(delay);
|
|
265826
265880
|
continue;
|
|
265827
265881
|
}
|
|
265882
|
+
const fallbackResponse2 = await this.attemptFallback(request);
|
|
265883
|
+
if (fallbackResponse2) return fallbackResponse2;
|
|
265828
265884
|
throw error2;
|
|
265829
265885
|
}
|
|
265830
265886
|
if (response.ok) {
|
|
@@ -265837,6 +265893,8 @@ var AccessTokenGatewayClient = class {
|
|
|
265837
265893
|
await this.sleepImpl(delay);
|
|
265838
265894
|
continue;
|
|
265839
265895
|
}
|
|
265896
|
+
const fallbackResponse2 = await this.attemptFallback(request);
|
|
265897
|
+
if (fallbackResponse2) return fallbackResponse2;
|
|
265840
265898
|
throw this.toInnerHttpError(request, innerStatus, okBody);
|
|
265841
265899
|
}
|
|
265842
265900
|
return this.rebuildResponse(response, okBody);
|
|
@@ -265865,6 +265923,8 @@ var AccessTokenGatewayClient = class {
|
|
|
265865
265923
|
await this.sleepImpl(delay);
|
|
265866
265924
|
continue;
|
|
265867
265925
|
}
|
|
265926
|
+
const fallbackResponse = await this.attemptFallback(request);
|
|
265927
|
+
if (fallbackResponse) return fallbackResponse;
|
|
265868
265928
|
throw this.toHttpError(request, response, body2);
|
|
265869
265929
|
}
|
|
265870
265930
|
}
|
|
@@ -311990,6 +312050,7 @@ function resolveInputs(env = process.env) {
|
|
|
311990
312050
|
postmanStack,
|
|
311991
312051
|
postmanApiBase: endpointProfile.apiBaseUrl,
|
|
311992
312052
|
postmanBifrostBase: endpointProfile.bifrostBaseUrl,
|
|
312053
|
+
postmanFallbackBase: endpointProfile.fallbackBaseUrl,
|
|
311993
312054
|
postmanGatewayBase: endpointProfile.gatewayBaseUrl,
|
|
311994
312055
|
postmanCliInstallUrl: endpointProfile.cliInstallUrl,
|
|
311995
312056
|
postmanIapubBase: endpointProfile.iapubBaseUrl,
|
|
@@ -313744,6 +313805,7 @@ async function runAction(actionCore = core_exports, actionExec = exec_exports, a
|
|
|
313744
313805
|
gateway: new AccessTokenGatewayClient({
|
|
313745
313806
|
tokenProvider: probeProvider,
|
|
313746
313807
|
bifrostBaseUrl: inputs.postmanBifrostBase,
|
|
313808
|
+
fallbackBaseUrl: inputs.postmanFallbackBase,
|
|
313747
313809
|
teamId: inputs.teamId || "",
|
|
313748
313810
|
orgMode: false,
|
|
313749
313811
|
secretMasker: createSecretMasker([inputs.postmanApiKey, inputs.postmanAccessToken])
|
|
@@ -313866,6 +313928,7 @@ function createBootstrapDependencies(inputs, factories, orgMode = false) {
|
|
|
313866
313928
|
const gatewayClient = inputs.postmanAccessToken || inputs.postmanApiKey ? new AccessTokenGatewayClient({
|
|
313867
313929
|
tokenProvider,
|
|
313868
313930
|
bifrostBaseUrl: inputs.postmanBifrostBase,
|
|
313931
|
+
fallbackBaseUrl: inputs.postmanFallbackBase,
|
|
313869
313932
|
teamId: inputs.teamId || "",
|
|
313870
313933
|
orgMode,
|
|
313871
313934
|
secretMasker
|
package/dist/cli.cjs
CHANGED
|
@@ -256513,6 +256513,7 @@ var POSTMAN_ENDPOINT_PROFILES = {
|
|
|
256513
256513
|
prod: {
|
|
256514
256514
|
apiBaseUrl: "https://api.getpostman.com",
|
|
256515
256515
|
bifrostBaseUrl: "https://bifrost-premium-https-v4.gw.postman.com",
|
|
256516
|
+
fallbackBaseUrl: "https://go.postman.co/_api",
|
|
256516
256517
|
cliInstallUrl: "https://dl-cli.pstmn.io/install/unix.sh",
|
|
256517
256518
|
gatewayBaseUrl: "https://gateway.postman.com",
|
|
256518
256519
|
iapubBaseUrl: "https://iapub.postman.co"
|
|
@@ -256520,6 +256521,7 @@ var POSTMAN_ENDPOINT_PROFILES = {
|
|
|
256520
256521
|
beta: {
|
|
256521
256522
|
apiBaseUrl: "https://api.getpostman-beta.com",
|
|
256522
256523
|
bifrostBaseUrl: "https://bifrost-https-v4.gw.postman-beta.com",
|
|
256524
|
+
fallbackBaseUrl: "https://go.postman-beta.co/_api",
|
|
256523
256525
|
cliInstallUrl: "https://dl-cli.pstmn-beta.io/install/unix.sh",
|
|
256524
256526
|
gatewayBaseUrl: "https://gateway.postman-beta.com",
|
|
256525
256527
|
iapubBaseUrl: "https://iapub.postman.co"
|
|
@@ -263681,6 +263683,11 @@ ${error.responseBody ?? ""}`
|
|
|
263681
263683
|
method: "post",
|
|
263682
263684
|
path: `/v3/collections/${cid}/items/`,
|
|
263683
263685
|
retry: "none",
|
|
263686
|
+
// The transport's cold /_api fallback only fires after the primary
|
|
263687
|
+
// budget is exhausted; by then this loop has reconciled the item as
|
|
263688
|
+
// absent (match == null), so a fallback resend cannot duplicate a
|
|
263689
|
+
// committed create.
|
|
263690
|
+
fallback: "auto",
|
|
263684
263691
|
headers: { "X-Entity-Type": kind },
|
|
263685
263692
|
body: this.buildItemCreateBody(item, parentId)
|
|
263686
263693
|
});
|
|
@@ -264058,6 +264065,7 @@ var AccessTokenGatewayClient = class {
|
|
|
264058
264065
|
orgMode;
|
|
264059
264066
|
fetchImpl;
|
|
264060
264067
|
secretMasker;
|
|
264068
|
+
fallbackBaseUrl;
|
|
264061
264069
|
maxRetries;
|
|
264062
264070
|
retryBaseDelayMs;
|
|
264063
264071
|
retryMaxDelayMs;
|
|
@@ -264073,6 +264081,8 @@ var AccessTokenGatewayClient = class {
|
|
|
264073
264081
|
this.orgMode = options.orgMode ?? false;
|
|
264074
264082
|
this.fetchImpl = options.fetchImpl ?? fetch;
|
|
264075
264083
|
this.secretMasker = options.secretMasker ?? createSecretMasker([this.tokenProvider.current()]);
|
|
264084
|
+
const fallbackEnv = typeof process !== "undefined" ? process.env?.POSTMAN_ITEM_CREATE_FALLBACK : void 0;
|
|
264085
|
+
this.fallbackBaseUrl = fallbackEnv === "off" ? void 0 : options.fallbackBaseUrl?.replace(/\/+$/, "");
|
|
264076
264086
|
this.maxRetries = options.maxRetries ?? 3;
|
|
264077
264087
|
this.retryBaseDelayMs = options.retryBaseDelayMs ?? 400;
|
|
264078
264088
|
this.retryMaxDelayMs = options.retryMaxDelayMs ?? 5e3;
|
|
@@ -264095,8 +264105,8 @@ var AccessTokenGatewayClient = class {
|
|
|
264095
264105
|
}
|
|
264096
264106
|
return headers;
|
|
264097
264107
|
}
|
|
264098
|
-
async send(request) {
|
|
264099
|
-
const url = `${this.bifrostBaseUrl}/ws/proxy`;
|
|
264108
|
+
async send(request, baseUrl) {
|
|
264109
|
+
const url = `${baseUrl ?? this.bifrostBaseUrl}/ws/proxy`;
|
|
264100
264110
|
const controller = new AbortController();
|
|
264101
264111
|
const timer = setTimeout(() => controller.abort(), this.requestTimeoutMs);
|
|
264102
264112
|
try {
|
|
@@ -264126,6 +264136,50 @@ var AccessTokenGatewayClient = class {
|
|
|
264126
264136
|
* 200 envelope carrying an inner collection-service error is treated as that
|
|
264127
264137
|
* inner status. The auth-refresh-once path is independent of the retry budget.
|
|
264128
264138
|
*/
|
|
264139
|
+
/**
|
|
264140
|
+
* One cold, serial attempt against the fallback base URL after the primary
|
|
264141
|
+
* budget is exhausted on a transient failure. Never hedged in parallel with
|
|
264142
|
+
* the primary; only fires when the request would otherwise throw. Callers
|
|
264143
|
+
* with `retry: 'none'` still reconcile first — the fallback attempt here is
|
|
264144
|
+
* the resend, so it is only used for requests whose mutation is known
|
|
264145
|
+
* idempotent or already reconciled by the caller's adopt-on-ambiguous loop.
|
|
264146
|
+
*/
|
|
264147
|
+
async tryFallback(request) {
|
|
264148
|
+
if (!this.fallbackBaseUrl) return null;
|
|
264149
|
+
try {
|
|
264150
|
+
return await this.send(request, this.fallbackBaseUrl);
|
|
264151
|
+
} catch {
|
|
264152
|
+
return null;
|
|
264153
|
+
}
|
|
264154
|
+
}
|
|
264155
|
+
/**
|
|
264156
|
+
* Run the fallback attempt and classify its response the same way the
|
|
264157
|
+
* primary path would. Returns the rebuilt success response, or null when the
|
|
264158
|
+
* fallback also failed transiently (caller then throws the original error).
|
|
264159
|
+
* Non-transient fallback failures (4xx, inner errors) surface as their own
|
|
264160
|
+
* HttpError since they are the freshest authoritative answer.
|
|
264161
|
+
*/
|
|
264162
|
+
fallbackEligible(request) {
|
|
264163
|
+
if (!this.fallbackBaseUrl) return false;
|
|
264164
|
+
const retryMode = request.retry ?? (request.method === "get" ? "safe" : "none");
|
|
264165
|
+
return retryMode === "safe" || request.fallback === "auto";
|
|
264166
|
+
}
|
|
264167
|
+
async attemptFallback(request) {
|
|
264168
|
+
if (!this.fallbackEligible(request)) return null;
|
|
264169
|
+
const response = await this.tryFallback(request);
|
|
264170
|
+
if (!response) return null;
|
|
264171
|
+
const body2 = await response.text().catch(() => "");
|
|
264172
|
+
if (response.ok) {
|
|
264173
|
+
const innerStatus = detectInnerError(body2);
|
|
264174
|
+
if (innerStatus !== null) {
|
|
264175
|
+
if (isTransientGatewayError(innerStatus, body2)) return null;
|
|
264176
|
+
throw this.toInnerHttpError(request, innerStatus, body2);
|
|
264177
|
+
}
|
|
264178
|
+
return this.rebuildResponse(response, body2);
|
|
264179
|
+
}
|
|
264180
|
+
if (isTransientGatewayError(response.status, body2)) return null;
|
|
264181
|
+
throw this.toHttpError(request, response, body2);
|
|
264182
|
+
}
|
|
264129
264183
|
async request(request) {
|
|
264130
264184
|
if (!this.tokenProvider.current() && this.tokenProvider.canRefresh()) {
|
|
264131
264185
|
await this.tokenProvider.refresh();
|
|
@@ -264143,6 +264197,8 @@ var AccessTokenGatewayClient = class {
|
|
|
264143
264197
|
await this.sleepImpl(delay);
|
|
264144
264198
|
continue;
|
|
264145
264199
|
}
|
|
264200
|
+
const fallbackResponse2 = await this.attemptFallback(request);
|
|
264201
|
+
if (fallbackResponse2) return fallbackResponse2;
|
|
264146
264202
|
throw error;
|
|
264147
264203
|
}
|
|
264148
264204
|
if (response.ok) {
|
|
@@ -264155,6 +264211,8 @@ var AccessTokenGatewayClient = class {
|
|
|
264155
264211
|
await this.sleepImpl(delay);
|
|
264156
264212
|
continue;
|
|
264157
264213
|
}
|
|
264214
|
+
const fallbackResponse2 = await this.attemptFallback(request);
|
|
264215
|
+
if (fallbackResponse2) return fallbackResponse2;
|
|
264158
264216
|
throw this.toInnerHttpError(request, innerStatus, okBody);
|
|
264159
264217
|
}
|
|
264160
264218
|
return this.rebuildResponse(response, okBody);
|
|
@@ -264183,6 +264241,8 @@ var AccessTokenGatewayClient = class {
|
|
|
264183
264241
|
await this.sleepImpl(delay);
|
|
264184
264242
|
continue;
|
|
264185
264243
|
}
|
|
264244
|
+
const fallbackResponse = await this.attemptFallback(request);
|
|
264245
|
+
if (fallbackResponse) return fallbackResponse;
|
|
264186
264246
|
throw this.toHttpError(request, response, body2);
|
|
264187
264247
|
}
|
|
264188
264248
|
}
|
|
@@ -310302,6 +310362,7 @@ function resolveInputs(env = process.env) {
|
|
|
310302
310362
|
postmanStack,
|
|
310303
310363
|
postmanApiBase: endpointProfile.apiBaseUrl,
|
|
310304
310364
|
postmanBifrostBase: endpointProfile.bifrostBaseUrl,
|
|
310365
|
+
postmanFallbackBase: endpointProfile.fallbackBaseUrl,
|
|
310305
310366
|
postmanGatewayBase: endpointProfile.gatewayBaseUrl,
|
|
310306
310367
|
postmanCliInstallUrl: endpointProfile.cliInstallUrl,
|
|
310307
310368
|
postmanIapubBase: endpointProfile.iapubBaseUrl,
|
|
@@ -312020,6 +312081,7 @@ function createBootstrapDependencies(inputs, factories, orgMode = false) {
|
|
|
312020
312081
|
const gatewayClient = inputs.postmanAccessToken || inputs.postmanApiKey ? new AccessTokenGatewayClient({
|
|
312021
312082
|
tokenProvider,
|
|
312022
312083
|
bifrostBaseUrl: inputs.postmanBifrostBase,
|
|
312084
|
+
fallbackBaseUrl: inputs.postmanFallbackBase,
|
|
312023
312085
|
teamId: inputs.teamId || "",
|
|
312024
312086
|
orgMode,
|
|
312025
312087
|
secretMasker
|
package/dist/index.cjs
CHANGED
|
@@ -258220,6 +258220,7 @@ var POSTMAN_ENDPOINT_PROFILES = {
|
|
|
258220
258220
|
prod: {
|
|
258221
258221
|
apiBaseUrl: "https://api.getpostman.com",
|
|
258222
258222
|
bifrostBaseUrl: "https://bifrost-premium-https-v4.gw.postman.com",
|
|
258223
|
+
fallbackBaseUrl: "https://go.postman.co/_api",
|
|
258223
258224
|
cliInstallUrl: "https://dl-cli.pstmn.io/install/unix.sh",
|
|
258224
258225
|
gatewayBaseUrl: "https://gateway.postman.com",
|
|
258225
258226
|
iapubBaseUrl: "https://iapub.postman.co"
|
|
@@ -258227,6 +258228,7 @@ var POSTMAN_ENDPOINT_PROFILES = {
|
|
|
258227
258228
|
beta: {
|
|
258228
258229
|
apiBaseUrl: "https://api.getpostman-beta.com",
|
|
258229
258230
|
bifrostBaseUrl: "https://bifrost-https-v4.gw.postman-beta.com",
|
|
258231
|
+
fallbackBaseUrl: "https://go.postman-beta.co/_api",
|
|
258230
258232
|
cliInstallUrl: "https://dl-cli.pstmn-beta.io/install/unix.sh",
|
|
258231
258233
|
gatewayBaseUrl: "https://gateway.postman-beta.com",
|
|
258232
258234
|
iapubBaseUrl: "https://iapub.postman.co"
|
|
@@ -265388,6 +265390,11 @@ ${error2.responseBody ?? ""}`
|
|
|
265388
265390
|
method: "post",
|
|
265389
265391
|
path: `/v3/collections/${cid}/items/`,
|
|
265390
265392
|
retry: "none",
|
|
265393
|
+
// The transport's cold /_api fallback only fires after the primary
|
|
265394
|
+
// budget is exhausted; by then this loop has reconciled the item as
|
|
265395
|
+
// absent (match == null), so a fallback resend cannot duplicate a
|
|
265396
|
+
// committed create.
|
|
265397
|
+
fallback: "auto",
|
|
265391
265398
|
headers: { "X-Entity-Type": kind },
|
|
265392
265399
|
body: this.buildItemCreateBody(item, parentId)
|
|
265393
265400
|
});
|
|
@@ -265765,6 +265772,7 @@ var AccessTokenGatewayClient = class {
|
|
|
265765
265772
|
orgMode;
|
|
265766
265773
|
fetchImpl;
|
|
265767
265774
|
secretMasker;
|
|
265775
|
+
fallbackBaseUrl;
|
|
265768
265776
|
maxRetries;
|
|
265769
265777
|
retryBaseDelayMs;
|
|
265770
265778
|
retryMaxDelayMs;
|
|
@@ -265780,6 +265788,8 @@ var AccessTokenGatewayClient = class {
|
|
|
265780
265788
|
this.orgMode = options.orgMode ?? false;
|
|
265781
265789
|
this.fetchImpl = options.fetchImpl ?? fetch;
|
|
265782
265790
|
this.secretMasker = options.secretMasker ?? createSecretMasker([this.tokenProvider.current()]);
|
|
265791
|
+
const fallbackEnv = typeof process !== "undefined" ? process.env?.POSTMAN_ITEM_CREATE_FALLBACK : void 0;
|
|
265792
|
+
this.fallbackBaseUrl = fallbackEnv === "off" ? void 0 : options.fallbackBaseUrl?.replace(/\/+$/, "");
|
|
265783
265793
|
this.maxRetries = options.maxRetries ?? 3;
|
|
265784
265794
|
this.retryBaseDelayMs = options.retryBaseDelayMs ?? 400;
|
|
265785
265795
|
this.retryMaxDelayMs = options.retryMaxDelayMs ?? 5e3;
|
|
@@ -265802,8 +265812,8 @@ var AccessTokenGatewayClient = class {
|
|
|
265802
265812
|
}
|
|
265803
265813
|
return headers;
|
|
265804
265814
|
}
|
|
265805
|
-
async send(request) {
|
|
265806
|
-
const url = `${this.bifrostBaseUrl}/ws/proxy`;
|
|
265815
|
+
async send(request, baseUrl) {
|
|
265816
|
+
const url = `${baseUrl ?? this.bifrostBaseUrl}/ws/proxy`;
|
|
265807
265817
|
const controller = new AbortController();
|
|
265808
265818
|
const timer = setTimeout(() => controller.abort(), this.requestTimeoutMs);
|
|
265809
265819
|
try {
|
|
@@ -265833,6 +265843,50 @@ var AccessTokenGatewayClient = class {
|
|
|
265833
265843
|
* 200 envelope carrying an inner collection-service error is treated as that
|
|
265834
265844
|
* inner status. The auth-refresh-once path is independent of the retry budget.
|
|
265835
265845
|
*/
|
|
265846
|
+
/**
|
|
265847
|
+
* One cold, serial attempt against the fallback base URL after the primary
|
|
265848
|
+
* budget is exhausted on a transient failure. Never hedged in parallel with
|
|
265849
|
+
* the primary; only fires when the request would otherwise throw. Callers
|
|
265850
|
+
* with `retry: 'none'` still reconcile first — the fallback attempt here is
|
|
265851
|
+
* the resend, so it is only used for requests whose mutation is known
|
|
265852
|
+
* idempotent or already reconciled by the caller's adopt-on-ambiguous loop.
|
|
265853
|
+
*/
|
|
265854
|
+
async tryFallback(request) {
|
|
265855
|
+
if (!this.fallbackBaseUrl) return null;
|
|
265856
|
+
try {
|
|
265857
|
+
return await this.send(request, this.fallbackBaseUrl);
|
|
265858
|
+
} catch {
|
|
265859
|
+
return null;
|
|
265860
|
+
}
|
|
265861
|
+
}
|
|
265862
|
+
/**
|
|
265863
|
+
* Run the fallback attempt and classify its response the same way the
|
|
265864
|
+
* primary path would. Returns the rebuilt success response, or null when the
|
|
265865
|
+
* fallback also failed transiently (caller then throws the original error).
|
|
265866
|
+
* Non-transient fallback failures (4xx, inner errors) surface as their own
|
|
265867
|
+
* HttpError since they are the freshest authoritative answer.
|
|
265868
|
+
*/
|
|
265869
|
+
fallbackEligible(request) {
|
|
265870
|
+
if (!this.fallbackBaseUrl) return false;
|
|
265871
|
+
const retryMode = request.retry ?? (request.method === "get" ? "safe" : "none");
|
|
265872
|
+
return retryMode === "safe" || request.fallback === "auto";
|
|
265873
|
+
}
|
|
265874
|
+
async attemptFallback(request) {
|
|
265875
|
+
if (!this.fallbackEligible(request)) return null;
|
|
265876
|
+
const response = await this.tryFallback(request);
|
|
265877
|
+
if (!response) return null;
|
|
265878
|
+
const body2 = await response.text().catch(() => "");
|
|
265879
|
+
if (response.ok) {
|
|
265880
|
+
const innerStatus = detectInnerError(body2);
|
|
265881
|
+
if (innerStatus !== null) {
|
|
265882
|
+
if (isTransientGatewayError(innerStatus, body2)) return null;
|
|
265883
|
+
throw this.toInnerHttpError(request, innerStatus, body2);
|
|
265884
|
+
}
|
|
265885
|
+
return this.rebuildResponse(response, body2);
|
|
265886
|
+
}
|
|
265887
|
+
if (isTransientGatewayError(response.status, body2)) return null;
|
|
265888
|
+
throw this.toHttpError(request, response, body2);
|
|
265889
|
+
}
|
|
265836
265890
|
async request(request) {
|
|
265837
265891
|
if (!this.tokenProvider.current() && this.tokenProvider.canRefresh()) {
|
|
265838
265892
|
await this.tokenProvider.refresh();
|
|
@@ -265850,6 +265904,8 @@ var AccessTokenGatewayClient = class {
|
|
|
265850
265904
|
await this.sleepImpl(delay);
|
|
265851
265905
|
continue;
|
|
265852
265906
|
}
|
|
265907
|
+
const fallbackResponse2 = await this.attemptFallback(request);
|
|
265908
|
+
if (fallbackResponse2) return fallbackResponse2;
|
|
265853
265909
|
throw error2;
|
|
265854
265910
|
}
|
|
265855
265911
|
if (response.ok) {
|
|
@@ -265862,6 +265918,8 @@ var AccessTokenGatewayClient = class {
|
|
|
265862
265918
|
await this.sleepImpl(delay);
|
|
265863
265919
|
continue;
|
|
265864
265920
|
}
|
|
265921
|
+
const fallbackResponse2 = await this.attemptFallback(request);
|
|
265922
|
+
if (fallbackResponse2) return fallbackResponse2;
|
|
265865
265923
|
throw this.toInnerHttpError(request, innerStatus, okBody);
|
|
265866
265924
|
}
|
|
265867
265925
|
return this.rebuildResponse(response, okBody);
|
|
@@ -265890,6 +265948,8 @@ var AccessTokenGatewayClient = class {
|
|
|
265890
265948
|
await this.sleepImpl(delay);
|
|
265891
265949
|
continue;
|
|
265892
265950
|
}
|
|
265951
|
+
const fallbackResponse = await this.attemptFallback(request);
|
|
265952
|
+
if (fallbackResponse) return fallbackResponse;
|
|
265893
265953
|
throw this.toHttpError(request, response, body2);
|
|
265894
265954
|
}
|
|
265895
265955
|
}
|
|
@@ -312015,6 +312075,7 @@ function resolveInputs(env = process.env) {
|
|
|
312015
312075
|
postmanStack,
|
|
312016
312076
|
postmanApiBase: endpointProfile.apiBaseUrl,
|
|
312017
312077
|
postmanBifrostBase: endpointProfile.bifrostBaseUrl,
|
|
312078
|
+
postmanFallbackBase: endpointProfile.fallbackBaseUrl,
|
|
312018
312079
|
postmanGatewayBase: endpointProfile.gatewayBaseUrl,
|
|
312019
312080
|
postmanCliInstallUrl: endpointProfile.cliInstallUrl,
|
|
312020
312081
|
postmanIapubBase: endpointProfile.iapubBaseUrl,
|
|
@@ -313772,6 +313833,7 @@ async function runAction(actionCore = core_exports, actionExec = exec_exports, a
|
|
|
313772
313833
|
gateway: new AccessTokenGatewayClient({
|
|
313773
313834
|
tokenProvider: probeProvider,
|
|
313774
313835
|
bifrostBaseUrl: inputs.postmanBifrostBase,
|
|
313836
|
+
fallbackBaseUrl: inputs.postmanFallbackBase,
|
|
313775
313837
|
teamId: inputs.teamId || "",
|
|
313776
313838
|
orgMode: false,
|
|
313777
313839
|
secretMasker: createSecretMasker([inputs.postmanApiKey, inputs.postmanAccessToken])
|
|
@@ -313894,6 +313956,7 @@ function createBootstrapDependencies(inputs, factories, orgMode = false) {
|
|
|
313894
313956
|
const gatewayClient = inputs.postmanAccessToken || inputs.postmanApiKey ? new AccessTokenGatewayClient({
|
|
313895
313957
|
tokenProvider,
|
|
313896
313958
|
bifrostBaseUrl: inputs.postmanBifrostBase,
|
|
313959
|
+
fallbackBaseUrl: inputs.postmanFallbackBase,
|
|
313897
313960
|
teamId: inputs.teamId || "",
|
|
313898
313961
|
orgMode,
|
|
313899
313962
|
secretMasker
|