@powerhousedao/reactor-workflow 6.2.3-dev.33 → 6.2.3-dev.35
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/README.md +23 -1
- package/dist/index.d.ts +22 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +331 -77
- package/dist/index.js.map +1 -1
- package/dist/{piece-registry-Cy1a1UIa.js → piece-registry-BBLaiiwi.js} +189 -152
- package/dist/piece-registry-BBLaiiwi.js.map +1 -0
- package/dist/{piece-registry-iXg2XQxp.d.ts → piece-registry-Bt1Cd3ly.d.ts} +41 -5
- package/dist/piece-registry-Bt1Cd3ly.d.ts.map +1 -0
- package/dist/{redact-LRWHJGW9.js → redact-DW7W5rrV.js} +5 -4
- package/dist/{redact-LRWHJGW9.js.map → redact-DW7W5rrV.js.map} +1 -1
- package/dist/testing.d.ts +1 -1
- package/dist/testing.js +2 -2
- package/dist/worker-entry.js +172 -10
- package/dist/worker-entry.js.map +1 -1
- package/package.json +8 -6
- package/dist/piece-registry-Cy1a1UIa.js.map +0 -1
- package/dist/piece-registry-iXg2XQxp.d.ts.map +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { A as
|
|
1
|
+
import { A as REACTOR_FIND, B as buildDescriptor, D as jsonSafe, F as REACTOR_SUBMIT_CREATE, I as REACTOR_WAIT, L as STORE_DELETE, M as REACTOR_MODEL, N as REACTOR_MODELS, O as LOG_WRITE, P as REACTOR_SUBMIT, R as STORE_GET, Y as getActions, a as redactMessage, c as DEFAULT_EGRESS_POLICY, i as redactError, j as REACTOR_GET, k as OUTPUT_UPDATE, n as containsRedactedMarker, o as rememberSecrets, r as redact, s as secretsFor, t as collectSecretValues, v as rewriteFileRefs, x as configuredMaxFileBytes, z as STORE_PUT } from "./redact-DW7W5rrV.js";
|
|
2
2
|
import { AppConnectionType, PieceCategory, Property, TriggerStrategy, createAction, createPiece, createTrigger } from "@powerhousedao/pieces-framework";
|
|
3
3
|
import { execFile, fork } from "node:child_process";
|
|
4
4
|
import { existsSync } from "node:fs";
|
|
@@ -8,7 +8,7 @@ import { promisify } from "node:util";
|
|
|
8
8
|
import { gunzip } from "node:zlib";
|
|
9
9
|
import { childLogger } from "document-model";
|
|
10
10
|
import { fileURLToPath } from "node:url";
|
|
11
|
-
import { BRANCH_PORTS, CORE_PIECE_NAME, NEXT_PORT, PIECE_ACTION_PORTS, SCHEDULE_MODES, SCHEDULE_UNIT_MS, TRIGGER_PORTS, undeclaredPortEdges } from "@powerhousedao/pieces-framework/workflow";
|
|
11
|
+
import { BRANCH_PORTS, CORE_PIECE_NAME, CORE_PIECE_NAME as CORE_PIECE_NAME$1, NEXT_PORT, PIECE_ACTION_PORTS, SCHEDULE_MODES, SCHEDULE_UNIT_MS, TRIGGER_PORTS, undeclaredPortEdges } from "@powerhousedao/pieces-framework/workflow";
|
|
12
12
|
import { createHash, randomUUID } from "node:crypto";
|
|
13
13
|
import { blockKey, isExactVersion } from "@powerhousedao/pieces-framework/block-type";
|
|
14
14
|
//#region src/pieces/activepieces/registry-source.ts
|
|
@@ -18,7 +18,7 @@ function source(baseUrl) {
|
|
|
18
18
|
baseUrl,
|
|
19
19
|
catalogUrl: (suggestions) => suggestions ? `${baseUrl}/pieces?suggestionType=ACTION_AND_TRIGGER` : `${baseUrl}/pieces`,
|
|
20
20
|
pieceUrl: (name) => `${baseUrl}/pieces/${encodeURIComponent(name)}`,
|
|
21
|
-
tarballUrl: (name, version) => `${baseUrl}/-/pieces/bundled/${name
|
|
21
|
+
tarballUrl: (name, version) => `${baseUrl}/-/pieces/bundled/${name}/${version}.tgz`
|
|
22
22
|
};
|
|
23
23
|
}
|
|
24
24
|
let configured;
|
|
@@ -492,6 +492,7 @@ function serveNotify(message, handlers) {
|
|
|
492
492
|
var PieceWorker = class {
|
|
493
493
|
connect;
|
|
494
494
|
defaultTimeoutMs;
|
|
495
|
+
hostCallTimeoutMs;
|
|
495
496
|
worker;
|
|
496
497
|
queue = Promise.resolve();
|
|
497
498
|
nextId = 1;
|
|
@@ -499,6 +500,7 @@ var PieceWorker = class {
|
|
|
499
500
|
const entryPath = options.entryPath;
|
|
500
501
|
this.connect = options.transport ?? (() => createForkTransport(entryPath ?? defaultEntryPath()));
|
|
501
502
|
this.defaultTimeoutMs = options.defaultTimeoutMs ?? 3e4;
|
|
503
|
+
this.hostCallTimeoutMs = options.hostCallTimeoutMs;
|
|
502
504
|
}
|
|
503
505
|
runAction(request, options = {}) {
|
|
504
506
|
return this.enqueue("run", request, options.timeoutMs, options);
|
|
@@ -539,6 +541,7 @@ var PieceWorker = class {
|
|
|
539
541
|
const worker = this.spawn();
|
|
540
542
|
const id = this.nextId++;
|
|
541
543
|
return new Promise((resolve, reject) => {
|
|
544
|
+
const deadline = Date.now() + timeoutMs;
|
|
542
545
|
const timer = setTimeout(() => {
|
|
543
546
|
cleanup();
|
|
544
547
|
worker.kill();
|
|
@@ -587,6 +590,8 @@ var PieceWorker = class {
|
|
|
587
590
|
type,
|
|
588
591
|
request: {
|
|
589
592
|
maxFileBytes: configuredMaxFileBytes(),
|
|
593
|
+
deadline,
|
|
594
|
+
...this.hostCallTimeoutMs ? { hostCallTimeoutMs: this.hostCallTimeoutMs } : {},
|
|
590
595
|
...request
|
|
591
596
|
}
|
|
592
597
|
}));
|
|
@@ -1036,6 +1041,162 @@ function evaluateCondition(condition, scope) {
|
|
|
1036
1041
|
return Boolean(resolved);
|
|
1037
1042
|
}
|
|
1038
1043
|
//#endregion
|
|
1044
|
+
//#region src/pieces/core/branch-operators.ts
|
|
1045
|
+
var BranchConfigError = class extends Error {
|
|
1046
|
+
constructor(message) {
|
|
1047
|
+
super(`Branch: ${message}`);
|
|
1048
|
+
this.name = "BranchConfigError";
|
|
1049
|
+
}
|
|
1050
|
+
};
|
|
1051
|
+
function describe(value) {
|
|
1052
|
+
if (value === void 0) return "nothing";
|
|
1053
|
+
const text = JSON.stringify(value);
|
|
1054
|
+
return text.length > 60 ? `${text.slice(0, 57)}...` : text;
|
|
1055
|
+
}
|
|
1056
|
+
function asText(value, side, caseSensitive) {
|
|
1057
|
+
if (typeof value !== "string" && typeof value !== "number" && typeof value !== "boolean") throw new BranchConfigError(`${side} must be text, got ${describe(value)}`);
|
|
1058
|
+
const text = String(value);
|
|
1059
|
+
return caseSensitive ? text : text.toLowerCase();
|
|
1060
|
+
}
|
|
1061
|
+
const DECIMAL = /^[-+]?(?:\d+\.?\d*|\.\d+)(?:[eE][-+]?\d+)?$/;
|
|
1062
|
+
function asNumber(value, side) {
|
|
1063
|
+
if (typeof value === "number" && Number.isFinite(value)) return value;
|
|
1064
|
+
if (typeof value === "string" && DECIMAL.test(value.trim())) return Number(value.trim());
|
|
1065
|
+
throw new BranchConfigError(`${side} must be a number, got ${describe(value)}`);
|
|
1066
|
+
}
|
|
1067
|
+
function asBoolean(value, side) {
|
|
1068
|
+
if (typeof value === "boolean") return value;
|
|
1069
|
+
if (value === "true") return true;
|
|
1070
|
+
if (value === "false") return false;
|
|
1071
|
+
throw new BranchConfigError(`${side} must be true or false, got ${describe(value)}`);
|
|
1072
|
+
}
|
|
1073
|
+
function asDate(value, side) {
|
|
1074
|
+
const time = typeof value === "number" ? value : typeof value === "string" && value.trim() !== "" ? Date.parse(value) : NaN;
|
|
1075
|
+
if (!Number.isFinite(time)) throw new BranchConfigError(`${side} must be a date, got ${describe(value)}`);
|
|
1076
|
+
return time;
|
|
1077
|
+
}
|
|
1078
|
+
function asList(value, side) {
|
|
1079
|
+
if (Array.isArray(value)) return value;
|
|
1080
|
+
throw new BranchConfigError(`${side} must be a list, got ${describe(value)}`);
|
|
1081
|
+
}
|
|
1082
|
+
const blank = (value) => value === void 0 || value === null || value === "";
|
|
1083
|
+
function textOp(label, test) {
|
|
1084
|
+
return {
|
|
1085
|
+
label,
|
|
1086
|
+
left: "text",
|
|
1087
|
+
binary: true,
|
|
1088
|
+
text: true,
|
|
1089
|
+
test: (left, right, caseSensitive) => test(asText(left, "left", caseSensitive), asText(right, "right", caseSensitive))
|
|
1090
|
+
};
|
|
1091
|
+
}
|
|
1092
|
+
function numberOp(label, test) {
|
|
1093
|
+
return {
|
|
1094
|
+
label,
|
|
1095
|
+
left: "number",
|
|
1096
|
+
binary: true,
|
|
1097
|
+
text: false,
|
|
1098
|
+
test: (left, right) => test(asNumber(left, "left"), asNumber(right, "right"))
|
|
1099
|
+
};
|
|
1100
|
+
}
|
|
1101
|
+
function dateOp(label, test) {
|
|
1102
|
+
return {
|
|
1103
|
+
label,
|
|
1104
|
+
left: "date",
|
|
1105
|
+
binary: true,
|
|
1106
|
+
text: false,
|
|
1107
|
+
test: (left, right) => test(asDate(left, "left"), asDate(right, "right"))
|
|
1108
|
+
};
|
|
1109
|
+
}
|
|
1110
|
+
function unary(label, left, test) {
|
|
1111
|
+
return {
|
|
1112
|
+
label,
|
|
1113
|
+
left,
|
|
1114
|
+
binary: false,
|
|
1115
|
+
text: false,
|
|
1116
|
+
test
|
|
1117
|
+
};
|
|
1118
|
+
}
|
|
1119
|
+
function listHas(left, right, caseSensitive) {
|
|
1120
|
+
const wanted = asText(right, "right", caseSensitive);
|
|
1121
|
+
return asList(left, "left").some((item) => {
|
|
1122
|
+
if (typeof item === "object" && item !== null) return false;
|
|
1123
|
+
const text = String(item);
|
|
1124
|
+
return (caseSensitive ? text : text.toLowerCase()) === wanted;
|
|
1125
|
+
});
|
|
1126
|
+
}
|
|
1127
|
+
const BRANCH_OPERATORS = {
|
|
1128
|
+
TEXT_EXACTLY_MATCHES: textOp("Text is exactly", (a, b) => a === b),
|
|
1129
|
+
TEXT_DOES_NOT_EXACTLY_MATCH: textOp("Text is not exactly", (a, b) => a !== b),
|
|
1130
|
+
TEXT_CONTAINS: textOp("Text contains", (a, b) => a.includes(b)),
|
|
1131
|
+
TEXT_DOES_NOT_CONTAIN: textOp("Text does not contain", (a, b) => !a.includes(b)),
|
|
1132
|
+
TEXT_STARTS_WITH: textOp("Text starts with", (a, b) => a.startsWith(b)),
|
|
1133
|
+
TEXT_DOES_NOT_START_WITH: textOp("Text does not start with", (a, b) => !a.startsWith(b)),
|
|
1134
|
+
TEXT_ENDS_WITH: textOp("Text ends with", (a, b) => a.endsWith(b)),
|
|
1135
|
+
TEXT_DOES_NOT_END_WITH: textOp("Text does not end with", (a, b) => !a.endsWith(b)),
|
|
1136
|
+
NUMBER_IS_EQUAL_TO: numberOp("Number equals", (a, b) => a === b),
|
|
1137
|
+
NUMBER_IS_GREATER_THAN: numberOp("Number is greater than", (a, b) => a > b),
|
|
1138
|
+
NUMBER_IS_LESS_THAN: numberOp("Number is less than", (a, b) => a < b),
|
|
1139
|
+
DATE_IS_EQUAL: dateOp("Date is", (a, b) => a === b),
|
|
1140
|
+
DATE_IS_BEFORE: dateOp("Date is before", (a, b) => a < b),
|
|
1141
|
+
DATE_IS_AFTER: dateOp("Date is after", (a, b) => a > b),
|
|
1142
|
+
BOOLEAN_IS_TRUE: unary("Is true", "boolean", (v) => asBoolean(v, "left")),
|
|
1143
|
+
BOOLEAN_IS_FALSE: unary("Is false", "boolean", (v) => !asBoolean(v, "left")),
|
|
1144
|
+
LIST_CONTAINS: {
|
|
1145
|
+
label: "List contains",
|
|
1146
|
+
left: "list",
|
|
1147
|
+
binary: true,
|
|
1148
|
+
text: true,
|
|
1149
|
+
test: listHas
|
|
1150
|
+
},
|
|
1151
|
+
LIST_DOES_NOT_CONTAIN: {
|
|
1152
|
+
label: "List does not contain",
|
|
1153
|
+
left: "list",
|
|
1154
|
+
binary: true,
|
|
1155
|
+
text: true,
|
|
1156
|
+
test: (left, right, caseSensitive) => !listHas(left, right, caseSensitive)
|
|
1157
|
+
},
|
|
1158
|
+
LIST_IS_EMPTY: unary("List is empty", "list", (v) => asList(v, "left").length === 0),
|
|
1159
|
+
LIST_IS_NOT_EMPTY: unary("List is not empty", "list", (v) => asList(v, "left").length > 0),
|
|
1160
|
+
EXISTS: unary("Exists", "any", (v) => !blank(v)),
|
|
1161
|
+
DOES_NOT_EXIST: unary("Does not exist", "any", blank)
|
|
1162
|
+
};
|
|
1163
|
+
const EXISTENCE_OPERATORS = /* @__PURE__ */ new Set(["EXISTS", "DOES_NOT_EXIST"]);
|
|
1164
|
+
const OPERATORS = BRANCH_OPERATORS;
|
|
1165
|
+
const DEFAULT_BRANCH_OPERATOR = "TEXT_EXACTLY_MATCHES";
|
|
1166
|
+
function evaluateBranch(config) {
|
|
1167
|
+
if (config === null || typeof config !== "object" || Array.isArray(config)) throw new BranchConfigError("the config must be an object");
|
|
1168
|
+
const { operator, left, right, caseSensitive } = config;
|
|
1169
|
+
if (operator === void 0 || operator === null || operator === "") throw new BranchConfigError("an operator is required");
|
|
1170
|
+
if (typeof operator !== "string" || !Object.hasOwn(OPERATORS, operator)) throw new BranchConfigError(`unknown operator ${describe(operator)}`);
|
|
1171
|
+
if (caseSensitive !== void 0 && typeof caseSensitive !== "boolean") throw new BranchConfigError("caseSensitive must be true or false");
|
|
1172
|
+
const spec = OPERATORS[operator];
|
|
1173
|
+
const result = spec.test(left, right, caseSensitive === true);
|
|
1174
|
+
return {
|
|
1175
|
+
operator,
|
|
1176
|
+
left,
|
|
1177
|
+
...spec.binary ? { right } : {},
|
|
1178
|
+
result
|
|
1179
|
+
};
|
|
1180
|
+
}
|
|
1181
|
+
//#endregion
|
|
1182
|
+
//#region src/pieces/engine/step-input.ts
|
|
1183
|
+
function resolveStepInput(step, scope) {
|
|
1184
|
+
const { config } = step;
|
|
1185
|
+
if (step.pieceName !== CORE_PIECE_NAME || step.actionName !== "branch" || config === null || typeof config !== "object" || Array.isArray(config) || !Object.hasOwn(config, "left")) return resolveExpressions(config, scope);
|
|
1186
|
+
const record = config;
|
|
1187
|
+
const operator = resolveExpressions(record.operator, scope);
|
|
1188
|
+
if (typeof operator !== "string" || !EXISTENCE_OPERATORS.has(operator)) return resolveExpressions(config, scope);
|
|
1189
|
+
return Object.fromEntries(Object.entries(record).map(([key, value]) => [key, key === "left" ? resolveOrMissing(value, scope) : resolveExpressions(value, scope)]));
|
|
1190
|
+
}
|
|
1191
|
+
function resolveOrMissing(value, scope) {
|
|
1192
|
+
try {
|
|
1193
|
+
return resolveExpressions(value, scope);
|
|
1194
|
+
} catch (error) {
|
|
1195
|
+
if (error instanceof UnresolvedReferenceError) return void 0;
|
|
1196
|
+
throw error;
|
|
1197
|
+
}
|
|
1198
|
+
}
|
|
1199
|
+
//#endregion
|
|
1039
1200
|
//#region src/pieces/engine/connections.ts
|
|
1040
1201
|
var ConnectionNotFoundError = class extends Error {
|
|
1041
1202
|
constructor(connectionId) {
|
|
@@ -1196,143 +1357,6 @@ var BoundConnectionResolver = class {
|
|
|
1196
1357
|
}
|
|
1197
1358
|
};
|
|
1198
1359
|
//#endregion
|
|
1199
|
-
//#region src/pieces/core/branch-operators.ts
|
|
1200
|
-
var BranchConfigError = class extends Error {
|
|
1201
|
-
constructor(message) {
|
|
1202
|
-
super(`Branch: ${message}`);
|
|
1203
|
-
this.name = "BranchConfigError";
|
|
1204
|
-
}
|
|
1205
|
-
};
|
|
1206
|
-
function describe(value) {
|
|
1207
|
-
if (value === void 0) return "nothing";
|
|
1208
|
-
const text = JSON.stringify(value);
|
|
1209
|
-
return text.length > 60 ? `${text.slice(0, 57)}...` : text;
|
|
1210
|
-
}
|
|
1211
|
-
function asText(value, side, caseSensitive) {
|
|
1212
|
-
if (typeof value !== "string" && typeof value !== "number" && typeof value !== "boolean") throw new BranchConfigError(`${side} must be text, got ${describe(value)}`);
|
|
1213
|
-
const text = String(value);
|
|
1214
|
-
return caseSensitive ? text : text.toLowerCase();
|
|
1215
|
-
}
|
|
1216
|
-
const DECIMAL = /^[-+]?(?:\d+\.?\d*|\.\d+)(?:[eE][-+]?\d+)?$/;
|
|
1217
|
-
function asNumber(value, side) {
|
|
1218
|
-
if (typeof value === "number" && Number.isFinite(value)) return value;
|
|
1219
|
-
if (typeof value === "string" && DECIMAL.test(value.trim())) return Number(value.trim());
|
|
1220
|
-
throw new BranchConfigError(`${side} must be a number, got ${describe(value)}`);
|
|
1221
|
-
}
|
|
1222
|
-
function asBoolean(value, side) {
|
|
1223
|
-
if (typeof value === "boolean") return value;
|
|
1224
|
-
if (value === "true") return true;
|
|
1225
|
-
if (value === "false") return false;
|
|
1226
|
-
throw new BranchConfigError(`${side} must be true or false, got ${describe(value)}`);
|
|
1227
|
-
}
|
|
1228
|
-
function asDate(value, side) {
|
|
1229
|
-
const time = typeof value === "number" ? value : typeof value === "string" && value.trim() !== "" ? Date.parse(value) : NaN;
|
|
1230
|
-
if (!Number.isFinite(time)) throw new BranchConfigError(`${side} must be a date, got ${describe(value)}`);
|
|
1231
|
-
return time;
|
|
1232
|
-
}
|
|
1233
|
-
function asList(value, side) {
|
|
1234
|
-
if (Array.isArray(value)) return value;
|
|
1235
|
-
throw new BranchConfigError(`${side} must be a list, got ${describe(value)}`);
|
|
1236
|
-
}
|
|
1237
|
-
const blank = (value) => value === void 0 || value === null || value === "";
|
|
1238
|
-
function textOp(label, test) {
|
|
1239
|
-
return {
|
|
1240
|
-
label,
|
|
1241
|
-
left: "text",
|
|
1242
|
-
binary: true,
|
|
1243
|
-
text: true,
|
|
1244
|
-
test: (left, right, caseSensitive) => test(asText(left, "left", caseSensitive), asText(right, "right", caseSensitive))
|
|
1245
|
-
};
|
|
1246
|
-
}
|
|
1247
|
-
function numberOp(label, test) {
|
|
1248
|
-
return {
|
|
1249
|
-
label,
|
|
1250
|
-
left: "number",
|
|
1251
|
-
binary: true,
|
|
1252
|
-
text: false,
|
|
1253
|
-
test: (left, right) => test(asNumber(left, "left"), asNumber(right, "right"))
|
|
1254
|
-
};
|
|
1255
|
-
}
|
|
1256
|
-
function dateOp(label, test) {
|
|
1257
|
-
return {
|
|
1258
|
-
label,
|
|
1259
|
-
left: "date",
|
|
1260
|
-
binary: true,
|
|
1261
|
-
text: false,
|
|
1262
|
-
test: (left, right) => test(asDate(left, "left"), asDate(right, "right"))
|
|
1263
|
-
};
|
|
1264
|
-
}
|
|
1265
|
-
function unary(label, left, test) {
|
|
1266
|
-
return {
|
|
1267
|
-
label,
|
|
1268
|
-
left,
|
|
1269
|
-
binary: false,
|
|
1270
|
-
text: false,
|
|
1271
|
-
test
|
|
1272
|
-
};
|
|
1273
|
-
}
|
|
1274
|
-
function listHas(left, right, caseSensitive) {
|
|
1275
|
-
const wanted = asText(right, "right", caseSensitive);
|
|
1276
|
-
return asList(left, "left").some((item) => {
|
|
1277
|
-
if (typeof item === "object" && item !== null) return false;
|
|
1278
|
-
const text = String(item);
|
|
1279
|
-
return (caseSensitive ? text : text.toLowerCase()) === wanted;
|
|
1280
|
-
});
|
|
1281
|
-
}
|
|
1282
|
-
const BRANCH_OPERATORS = {
|
|
1283
|
-
TEXT_EXACTLY_MATCHES: textOp("Text is exactly", (a, b) => a === b),
|
|
1284
|
-
TEXT_DOES_NOT_EXACTLY_MATCH: textOp("Text is not exactly", (a, b) => a !== b),
|
|
1285
|
-
TEXT_CONTAINS: textOp("Text contains", (a, b) => a.includes(b)),
|
|
1286
|
-
TEXT_DOES_NOT_CONTAIN: textOp("Text does not contain", (a, b) => !a.includes(b)),
|
|
1287
|
-
TEXT_STARTS_WITH: textOp("Text starts with", (a, b) => a.startsWith(b)),
|
|
1288
|
-
TEXT_DOES_NOT_START_WITH: textOp("Text does not start with", (a, b) => !a.startsWith(b)),
|
|
1289
|
-
TEXT_ENDS_WITH: textOp("Text ends with", (a, b) => a.endsWith(b)),
|
|
1290
|
-
TEXT_DOES_NOT_END_WITH: textOp("Text does not end with", (a, b) => !a.endsWith(b)),
|
|
1291
|
-
NUMBER_IS_EQUAL_TO: numberOp("Number equals", (a, b) => a === b),
|
|
1292
|
-
NUMBER_IS_GREATER_THAN: numberOp("Number is greater than", (a, b) => a > b),
|
|
1293
|
-
NUMBER_IS_LESS_THAN: numberOp("Number is less than", (a, b) => a < b),
|
|
1294
|
-
DATE_IS_EQUAL: dateOp("Date is", (a, b) => a === b),
|
|
1295
|
-
DATE_IS_BEFORE: dateOp("Date is before", (a, b) => a < b),
|
|
1296
|
-
DATE_IS_AFTER: dateOp("Date is after", (a, b) => a > b),
|
|
1297
|
-
BOOLEAN_IS_TRUE: unary("Is true", "boolean", (v) => asBoolean(v, "left")),
|
|
1298
|
-
BOOLEAN_IS_FALSE: unary("Is false", "boolean", (v) => !asBoolean(v, "left")),
|
|
1299
|
-
LIST_CONTAINS: {
|
|
1300
|
-
label: "List contains",
|
|
1301
|
-
left: "list",
|
|
1302
|
-
binary: true,
|
|
1303
|
-
text: true,
|
|
1304
|
-
test: listHas
|
|
1305
|
-
},
|
|
1306
|
-
LIST_DOES_NOT_CONTAIN: {
|
|
1307
|
-
label: "List does not contain",
|
|
1308
|
-
left: "list",
|
|
1309
|
-
binary: true,
|
|
1310
|
-
text: true,
|
|
1311
|
-
test: (left, right, caseSensitive) => !listHas(left, right, caseSensitive)
|
|
1312
|
-
},
|
|
1313
|
-
LIST_IS_EMPTY: unary("List is empty", "list", (v) => asList(v, "left").length === 0),
|
|
1314
|
-
LIST_IS_NOT_EMPTY: unary("List is not empty", "list", (v) => asList(v, "left").length > 0),
|
|
1315
|
-
EXISTS: unary("Exists", "any", (v) => !blank(v)),
|
|
1316
|
-
DOES_NOT_EXIST: unary("Does not exist", "any", blank)
|
|
1317
|
-
};
|
|
1318
|
-
const OPERATORS = BRANCH_OPERATORS;
|
|
1319
|
-
const DEFAULT_BRANCH_OPERATOR = "TEXT_EXACTLY_MATCHES";
|
|
1320
|
-
function evaluateBranch(config) {
|
|
1321
|
-
if (config === null || typeof config !== "object" || Array.isArray(config)) throw new BranchConfigError("the config must be an object");
|
|
1322
|
-
const { operator, left, right, caseSensitive } = config;
|
|
1323
|
-
if (operator === void 0 || operator === null || operator === "") throw new BranchConfigError("an operator is required");
|
|
1324
|
-
if (typeof operator !== "string" || !Object.hasOwn(OPERATORS, operator)) throw new BranchConfigError(`unknown operator ${describe(operator)}`);
|
|
1325
|
-
if (caseSensitive !== void 0 && typeof caseSensitive !== "boolean") throw new BranchConfigError("caseSensitive must be true or false");
|
|
1326
|
-
const spec = OPERATORS[operator];
|
|
1327
|
-
const result = spec.test(left, right, caseSensitive === true);
|
|
1328
|
-
return {
|
|
1329
|
-
operator,
|
|
1330
|
-
left,
|
|
1331
|
-
...spec.binary ? { right } : {},
|
|
1332
|
-
result
|
|
1333
|
-
};
|
|
1334
|
-
}
|
|
1335
|
-
//#endregion
|
|
1336
1360
|
//#region src/pieces/core/hints.ts
|
|
1337
1361
|
function withHints(property, hints) {
|
|
1338
1362
|
return {
|
|
@@ -1663,7 +1687,7 @@ const manualTrigger = createTrigger({
|
|
|
1663
1687
|
});
|
|
1664
1688
|
//#endregion
|
|
1665
1689
|
//#region src/pieces/core/version.ts
|
|
1666
|
-
const CORE_PIECE_VERSION = "6.2.3-dev.
|
|
1690
|
+
const CORE_PIECE_VERSION = "6.2.3-dev.35";
|
|
1667
1691
|
//#endregion
|
|
1668
1692
|
//#region src/pieces/core/index.ts
|
|
1669
1693
|
const corePiece = createPiece({
|
|
@@ -1683,7 +1707,7 @@ const corePiece = createPiece({
|
|
|
1683
1707
|
//#endregion
|
|
1684
1708
|
//#region src/pieces/builtin.ts
|
|
1685
1709
|
const BUILTIN_PIECES = [{
|
|
1686
|
-
name: CORE_PIECE_NAME,
|
|
1710
|
+
name: CORE_PIECE_NAME$1,
|
|
1687
1711
|
version: CORE_PIECE_VERSION,
|
|
1688
1712
|
piece: corePiece
|
|
1689
1713
|
}];
|
|
@@ -1801,6 +1825,11 @@ function storeKeyOf(payload) {
|
|
|
1801
1825
|
if (typeof key !== "string" || key === "") throw new Error("Store call carried no key");
|
|
1802
1826
|
return key;
|
|
1803
1827
|
}
|
|
1828
|
+
const MAX_REACTOR_WAIT_MS = 5e3;
|
|
1829
|
+
function waitMs(value) {
|
|
1830
|
+
if (typeof value !== "number" || !Number.isFinite(value)) return 0;
|
|
1831
|
+
return Math.min(Math.max(Math.floor(value), 0), MAX_REACTOR_WAIT_MS);
|
|
1832
|
+
}
|
|
1804
1833
|
function reactorInput(payload) {
|
|
1805
1834
|
if (typeof payload !== "object" || payload === null || Array.isArray(payload)) throw new Error("Reactor call carried no input object");
|
|
1806
1835
|
return payload;
|
|
@@ -1844,6 +1873,14 @@ function findMatch(value) {
|
|
|
1844
1873
|
value: wanted
|
|
1845
1874
|
};
|
|
1846
1875
|
}
|
|
1876
|
+
function executeInput(payload) {
|
|
1877
|
+
const input = reactorInput(payload);
|
|
1878
|
+
return {
|
|
1879
|
+
documentId: requiredString(input, "documentId"),
|
|
1880
|
+
...optionalString(input, "branch") ? { branch: optionalString(input, "branch") } : {},
|
|
1881
|
+
actions: reactorActions(input)
|
|
1882
|
+
};
|
|
1883
|
+
}
|
|
1847
1884
|
function reactorHandlers(port) {
|
|
1848
1885
|
return {
|
|
1849
1886
|
[REACTOR_MODELS]: () => port.models(),
|
|
@@ -1865,20 +1902,20 @@ function reactorHandlers(port) {
|
|
|
1865
1902
|
...input.withState === true ? { withState: true } : {}
|
|
1866
1903
|
});
|
|
1867
1904
|
},
|
|
1868
|
-
[
|
|
1905
|
+
[REACTOR_SUBMIT_CREATE]: (payload) => {
|
|
1869
1906
|
const input = reactorInput(payload);
|
|
1870
|
-
return port.
|
|
1907
|
+
return port.submitCreate({
|
|
1871
1908
|
documentType: requiredString(input, "documentType"),
|
|
1872
1909
|
...optionalString(input, "name") ? { name: optionalString(input, "name") } : {},
|
|
1873
1910
|
...optionalString(input, "parentId") ? { parentId: optionalString(input, "parentId") } : {}
|
|
1874
1911
|
});
|
|
1875
1912
|
},
|
|
1876
|
-
[
|
|
1913
|
+
[REACTOR_SUBMIT]: (payload) => port.submit(executeInput(payload)),
|
|
1914
|
+
[REACTOR_WAIT]: (payload) => {
|
|
1877
1915
|
const input = reactorInput(payload);
|
|
1878
|
-
return port.
|
|
1879
|
-
|
|
1880
|
-
|
|
1881
|
-
actions: reactorActions(input)
|
|
1916
|
+
return port.wait({
|
|
1917
|
+
jobId: requiredString(input, "jobId"),
|
|
1918
|
+
maxWaitMs: waitMs(input.maxWaitMs)
|
|
1882
1919
|
});
|
|
1883
1920
|
}
|
|
1884
1921
|
};
|
|
@@ -2308,7 +2345,7 @@ async function runWorkflow(options) {
|
|
|
2308
2345
|
const startedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
2309
2346
|
let input;
|
|
2310
2347
|
try {
|
|
2311
|
-
input =
|
|
2348
|
+
input = resolveStepInput(step, scope);
|
|
2312
2349
|
checkDynamicProperties(input, step.propertySettings);
|
|
2313
2350
|
const result = await executor.execute({
|
|
2314
2351
|
block: stepBlock(step),
|
|
@@ -2442,6 +2479,6 @@ function installedPieces() {
|
|
|
2442
2479
|
return [...builtinLocalPieces(), ...packagePieces.entries().filter((piece) => !isBuiltinPiece(piece.name))];
|
|
2443
2480
|
}
|
|
2444
2481
|
//#endregion
|
|
2445
|
-
export {
|
|
2482
|
+
export { resolveStepInput as A, PieceWorker as B, describeBuiltinPiece as C, StaticConnectionResolver as D, BoundConnectionResolver as E, parseSecretRef as F, sourcedResolver as G, PieceWorkerTimeoutError as H, secretRefFromId as I, npmRegistryBaseUrl as J, ensurePieceBundle as K, stepBlock as L, InMemorySecretProvider as M, SecretDeletedError as N, declaredConnectionIds as O, SecretNotFoundError as P, triggerBlock as R, builtinPiece as S, CORE_PIECE_VERSION as T, bundleResolver as U, PieceWorkerError as V, pieceModuleRef as W, setPieceRegistryUrl as X, pieceRegistrySource as Y, servesReactorPort as _, runWorkflow as a, unpinnedNote as b, stepConfigHash as c, ActivepiecesBlockExecutor as d, CompositeBlockExecutor as f, resolvedBlock as g, reactorHandlers as h, packagePieces as i, expressionsIn as j, shapeConnection as k, DynamicPropertiesError as l, isHostBound as m, installedPiece as n, canonicalJson as o, REACTOR_PORT_PIECE as p, fetchPieceBundle as q, installedPieces as r, hashOf as s, PieceRegistry as t, checkDynamicProperties as u, storeHandlers as v, CORE_PIECE_NAME$1 as w, blockPorts as x, blockLabel as y, PieceWorkerPool as z };
|
|
2446
2483
|
|
|
2447
|
-
//# sourceMappingURL=piece-registry-
|
|
2484
|
+
//# sourceMappingURL=piece-registry-BBLaiiwi.js.map
|