@valerypopoff/rivet2-core 2.10.0 → 2.11.0
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/cjs/bundle.cjs
CHANGED
|
@@ -28795,7 +28795,7 @@ var MatchNodeImpl = class extends NodeImpl {
|
|
|
28795
28795
|
return outputs;
|
|
28796
28796
|
}
|
|
28797
28797
|
getBody() {
|
|
28798
|
-
return this.data.exclusive ? "Trigger
|
|
28798
|
+
return this.data.exclusive ? "Trigger: First matching case only" : "Trigger: All matching cases";
|
|
28799
28799
|
}
|
|
28800
28800
|
getEditors() {
|
|
28801
28801
|
return [
|
|
@@ -32370,16 +32370,12 @@ var GetGlobalNodeImpl = class extends NodeImpl {
|
|
|
32370
32370
|
return [
|
|
32371
32371
|
{
|
|
32372
32372
|
type: "custom",
|
|
32373
|
-
label: "Search Global Variables",
|
|
32374
|
-
customEditorId: "GetGlobalVariableSelector",
|
|
32375
|
-
autoFocus: true
|
|
32376
|
-
},
|
|
32377
|
-
{
|
|
32378
|
-
type: "string",
|
|
32379
32373
|
label: "Variable ID",
|
|
32374
|
+
customEditorId: "GetGlobalVariableSelector",
|
|
32380
32375
|
dataKey: "id",
|
|
32381
32376
|
useInputToggleDataKey: "useIdInput",
|
|
32382
|
-
includeInGraphSearch: true
|
|
32377
|
+
includeInGraphSearch: true,
|
|
32378
|
+
autoFocus: true
|
|
32383
32379
|
},
|
|
32384
32380
|
{
|
|
32385
32381
|
type: "dataTypeSelector",
|
|
@@ -35976,6 +35972,7 @@ var import_non_secure80 = require("nanoid/non-secure");
|
|
|
35976
35972
|
var REQUEST_FAILED_OUTPUT_ID = "requestFailed";
|
|
35977
35973
|
var REQUEST_ERROR_OUTPUT_ID = "requestError";
|
|
35978
35974
|
var STATUS_CODE_OUTPUT_ID = "statusCode";
|
|
35975
|
+
var RESPONSE_HEADERS_OUTPUT_ID = "res_headers";
|
|
35979
35976
|
var DEFAULT_RETRY_ON_NON_200_REPEAT_TIMES = 1;
|
|
35980
35977
|
var DEFAULT_RETRY_ON_NON_200_COOLDOWN_MS = 0;
|
|
35981
35978
|
function isAbortError(error, signal) {
|
|
@@ -36023,13 +36020,18 @@ Caused by: ${formatCaughtRequestFailureError(cause, seen)}`;
|
|
|
36023
36020
|
function createHttpCallRequestAttempts() {
|
|
36024
36021
|
return {
|
|
36025
36022
|
statusCodeValues: [],
|
|
36023
|
+
responseHeaderValues: [],
|
|
36026
36024
|
requestFailedValues: [],
|
|
36027
36025
|
requestErrorMessages: []
|
|
36028
36026
|
};
|
|
36029
36027
|
}
|
|
36028
|
+
function getHttpCallResponseHeaders(response) {
|
|
36029
|
+
return Object.fromEntries(response.headers.entries());
|
|
36030
|
+
}
|
|
36030
36031
|
function recordHttpCallResponseAttempt(attempts, response) {
|
|
36031
36032
|
const requestFailed = response.status !== 200;
|
|
36032
36033
|
attempts.statusCodeValues.push(response.status);
|
|
36034
|
+
attempts.responseHeaderValues.push(getHttpCallResponseHeaders(response));
|
|
36033
36035
|
attempts.requestFailedValues.push(requestFailed);
|
|
36034
36036
|
if (requestFailed) {
|
|
36035
36037
|
attempts.requestErrorMessages.push(formatCaughtRequestFailureError(buildNon2xxStatusCodeError(response.status)));
|
|
@@ -36051,6 +36053,18 @@ function buildRetryAttemptOutput(type, values2) {
|
|
|
36051
36053
|
value: void 0
|
|
36052
36054
|
};
|
|
36053
36055
|
}
|
|
36056
|
+
function buildHttpCallResponseMetadataOutputs(response, requestAttempts) {
|
|
36057
|
+
return {
|
|
36058
|
+
[STATUS_CODE_OUTPUT_ID]: requestAttempts ? buildRetryAttemptOutput("number[]", requestAttempts.statusCodeValues) : {
|
|
36059
|
+
type: "number",
|
|
36060
|
+
value: response.status
|
|
36061
|
+
},
|
|
36062
|
+
[RESPONSE_HEADERS_OUTPUT_ID]: requestAttempts ? buildRetryAttemptOutput("object[]", requestAttempts.responseHeaderValues) : {
|
|
36063
|
+
type: "object",
|
|
36064
|
+
value: getHttpCallResponseHeaders(response)
|
|
36065
|
+
}
|
|
36066
|
+
};
|
|
36067
|
+
}
|
|
36054
36068
|
function isCaughtFailureAlreadyRecorded(attempts, error) {
|
|
36055
36069
|
var _a;
|
|
36056
36070
|
const formattedError = formatCaughtRequestFailureError(error);
|
|
@@ -36071,7 +36085,7 @@ function withCaughtFailureAttemptFallback(attempts, error) {
|
|
|
36071
36085
|
const requestFailedValues = attempts.requestFailedValues.length > 0 ? [...attempts.requestFailedValues] : [true];
|
|
36072
36086
|
requestFailedValues[requestFailedValues.length - 1] = true;
|
|
36073
36087
|
return {
|
|
36074
|
-
|
|
36088
|
+
...attempts,
|
|
36075
36089
|
requestFailedValues,
|
|
36076
36090
|
requestErrorMessages: [...attempts.requestErrorMessages, formatCaughtRequestFailureError(error)]
|
|
36077
36091
|
};
|
|
@@ -36121,7 +36135,7 @@ function buildRequestFailedOutputs(params) {
|
|
|
36121
36135
|
type: "control-flow-excluded",
|
|
36122
36136
|
value: void 0
|
|
36123
36137
|
},
|
|
36124
|
-
[
|
|
36138
|
+
[RESPONSE_HEADERS_OUTPUT_ID]: {
|
|
36125
36139
|
type: "control-flow-excluded",
|
|
36126
36140
|
value: void 0
|
|
36127
36141
|
}
|
|
@@ -36282,8 +36296,8 @@ var HttpCallNodeImpl = class extends NodeImpl {
|
|
|
36282
36296
|
title: "Status Code"
|
|
36283
36297
|
},
|
|
36284
36298
|
{
|
|
36285
|
-
dataType: "object",
|
|
36286
|
-
id:
|
|
36299
|
+
dataType: this.data.retryOnNon200 ? "object[]" : "object",
|
|
36300
|
+
id: RESPONSE_HEADERS_OUTPUT_ID,
|
|
36287
36301
|
title: "Headers"
|
|
36288
36302
|
}
|
|
36289
36303
|
);
|
|
@@ -36375,7 +36389,8 @@ var HttpCallNodeImpl = class extends NodeImpl {
|
|
|
36375
36389
|
{
|
|
36376
36390
|
type: "toggle",
|
|
36377
36391
|
label: "Fail on non-2XX status code",
|
|
36378
|
-
dataKey: "errorOnNon200"
|
|
36392
|
+
dataKey: "errorOnNon200",
|
|
36393
|
+
helperMessage: (data) => data.retryOnNon200 ? "With Retry on non-200 enabled, only the final response after all retries is checked." : void 0
|
|
36379
36394
|
},
|
|
36380
36395
|
{
|
|
36381
36396
|
type: "toggle",
|
|
@@ -36398,7 +36413,7 @@ var HttpCallNodeImpl = class extends NodeImpl {
|
|
|
36398
36413
|
};
|
|
36399
36414
|
}
|
|
36400
36415
|
async process(inputs, context) {
|
|
36401
|
-
var _a;
|
|
36416
|
+
var _a, _b;
|
|
36402
36417
|
const requestAttempts = this.data.retryOnNon200 ? createHttpCallRequestAttempts() : void 0;
|
|
36403
36418
|
try {
|
|
36404
36419
|
const method = getInputOrData(this.data, inputs, "method", "string");
|
|
@@ -36476,19 +36491,18 @@ var HttpCallNodeImpl = class extends NodeImpl {
|
|
|
36476
36491
|
response = await performTrackedRequest();
|
|
36477
36492
|
}
|
|
36478
36493
|
}
|
|
36494
|
+
const responseMetadataOutputs = buildHttpCallResponseMetadataOutputs(response, requestAttempts);
|
|
36479
36495
|
if (this.data.errorOnNon200 && !response.ok) {
|
|
36496
|
+
if (!this.data.catchRequestFailed) {
|
|
36497
|
+
if (context.setFailureOutputs) {
|
|
36498
|
+
context.setFailureOutputs(responseMetadataOutputs);
|
|
36499
|
+
} else {
|
|
36500
|
+
(_a = context.onPartialOutputs) == null ? void 0 : _a.call(context, responseMetadataOutputs);
|
|
36501
|
+
}
|
|
36502
|
+
}
|
|
36480
36503
|
throw buildNon2xxStatusCodeError(response.status);
|
|
36481
36504
|
}
|
|
36482
|
-
const output =
|
|
36483
|
-
[STATUS_CODE_OUTPUT_ID]: requestAttempts ? buildRetryAttemptOutput("number[]", requestAttempts.statusCodeValues) : {
|
|
36484
|
-
type: "number",
|
|
36485
|
-
value: response.status
|
|
36486
|
-
},
|
|
36487
|
-
["res_headers"]: {
|
|
36488
|
-
type: "object",
|
|
36489
|
-
value: Object.fromEntries(response.headers.entries())
|
|
36490
|
-
}
|
|
36491
|
-
};
|
|
36505
|
+
const output = responseMetadataOutputs;
|
|
36492
36506
|
if (this.data.isBinaryOutput) {
|
|
36493
36507
|
const responseBlob = await response.blob();
|
|
36494
36508
|
output["binary"] = {
|
|
@@ -36501,7 +36515,7 @@ var HttpCallNodeImpl = class extends NodeImpl {
|
|
|
36501
36515
|
type: "string",
|
|
36502
36516
|
value: responseText
|
|
36503
36517
|
};
|
|
36504
|
-
if ((
|
|
36518
|
+
if ((_b = response.headers.get("content-type")) == null ? void 0 : _b.includes("application/json")) {
|
|
36505
36519
|
const jsonData = JSON.parse(responseText);
|
|
36506
36520
|
output["json"] = {
|
|
36507
36521
|
type: "object",
|