@powerhousedao/reactor-workflow 6.2.3-dev.80 → 6.2.3-dev.82
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 +6 -1
- package/dist/index.d.ts +15 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +343 -115
- package/dist/index.js.map +1 -1
- package/dist/{piece-registry-BbeuE8TB.d.ts → piece-registry-ByALLpvA.d.ts} +23 -4
- package/dist/piece-registry-ByALLpvA.d.ts.map +1 -0
- package/dist/{telemetry-BCXPCbfB.js → telemetry-B_CWKtzb.js} +82 -12
- package/dist/telemetry-B_CWKtzb.js.map +1 -0
- package/dist/testing.d.ts +1 -1
- package/dist/testing.js +1 -1
- package/dist/worker-entry.js +163 -11
- package/dist/worker-entry.js.map +1 -1
- package/package.json +7 -7
- package/dist/piece-registry-BbeuE8TB.d.ts.map +0 -1
- package/dist/telemetry-BCXPCbfB.js.map +0 -1
package/dist/testing.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { A as
|
|
1
|
+
import { A as PieceTarget, B as loadPieceFromDir, D as LocalPiece, N as RecordedSchedule, O as PackagePiece, P as extractDedupeKey, R as PieceDescriptor, S as BlockExecution, T as WorkflowRunResult, _ as PieceWorker, a as runWorkflow, b as WorkflowTelemetry, c as CompositeBlockExecutor, d as InMemorySecretProvider, h as IPieceWorker, j as sourcedResolver, k as PieceResolver, m as PieceWorkerPool, o as ActivepiecesBlockExecutor, s as AttachmentPort, t as PieceRegistry, u as StaticConnectionResolver, z as buildDescriptor } from "./piece-registry-ByALLpvA.js";
|
|
2
2
|
//#region src/pieces/activepieces/fetch.d.ts
|
|
3
3
|
interface FetchPieceBundleOptions {
|
|
4
4
|
name: string;
|
package/dist/testing.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { J as PieceWorker, M as StaticConnectionResolver, R as InMemorySecretProvider, _t as ensurePieceBundle, a as PieceRegistry, d as runWorkflow, dt as sourcedResolver, ft as buildDescriptor, n as WorkflowTelemetry, ot as extractDedupeKey, q as PieceWorkerPool, v as ActivepiecesBlockExecutor, vt as fetchPieceBundle, y as CompositeBlockExecutor } from "./telemetry-B_CWKtzb.js";
|
|
2
2
|
import { createRequire } from "node:module";
|
|
3
3
|
import { readFileSync, realpathSync } from "node:fs";
|
|
4
4
|
import path from "node:path";
|
package/dist/worker-entry.js
CHANGED
|
@@ -619,6 +619,21 @@ const _safeParseAsync = (_Err) => async (schema, value, _ctx) => {
|
|
|
619
619
|
};
|
|
620
620
|
};
|
|
621
621
|
const safeParseAsync = /* @__PURE__*/ _safeParseAsync($ZodRealError);
|
|
622
|
+
const dateSource = `(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))`;
|
|
623
|
+
function timeSource(args) {
|
|
624
|
+
const hhmm = `(?:[01]\\d|2[0-3]):[0-5]\\d`;
|
|
625
|
+
return typeof args.precision === "number" ? args.precision === -1 ? `${hhmm}` : args.precision === 0 ? `${hhmm}:[0-5]\\d` : `${hhmm}:[0-5]\\d\\.\\d{${args.precision}}` : args.seconds ? `${hhmm}:[0-5]\\d(?:\\.\\d+)?` : `${hhmm}(?::[0-5]\\d(?:\\.\\d+)?)?`;
|
|
626
|
+
}
|
|
627
|
+
function datetime$1(args) {
|
|
628
|
+
const opts = ["Z"];
|
|
629
|
+
if (args.offset) opts.push(`([+-](?:[01]\\d|2[0-3]):[0-5]\\d)`);
|
|
630
|
+
const qualified = `${timeSource({
|
|
631
|
+
precision: args.precision,
|
|
632
|
+
seconds: true
|
|
633
|
+
})}(?:${opts.join("|")})`;
|
|
634
|
+
const timeRegex = args.local ? `${qualified}|${timeSource({ precision: args.precision })}` : qualified;
|
|
635
|
+
return new RegExp(`^${dateSource}T(?:${timeRegex})$`);
|
|
636
|
+
}
|
|
622
637
|
const anyString = /^[\s\S]{0,}$/;
|
|
623
638
|
const number$2 = /^-?\d+(?:\.\d+)?$/;
|
|
624
639
|
const boolean$1 = /^(?:true|false)$/i;
|
|
@@ -828,6 +843,14 @@ const $ZodString = /*@__PURE__*/ $constructor("$ZodString", (inst, def) => {
|
|
|
828
843
|
return payload;
|
|
829
844
|
};
|
|
830
845
|
});
|
|
846
|
+
const $ZodStringFormat = /*@__PURE__*/ $constructor("$ZodStringFormat", (inst, def) => {
|
|
847
|
+
$ZodCheckStringFormat.init(inst, def);
|
|
848
|
+
$ZodString.init(inst, def);
|
|
849
|
+
});
|
|
850
|
+
const $ZodISODateTime = /*@__PURE__*/ $constructor("$ZodISODateTime", (inst, def) => {
|
|
851
|
+
def.pattern ?? (def.pattern = datetime$1(def));
|
|
852
|
+
$ZodStringFormat.init(inst, def);
|
|
853
|
+
});
|
|
831
854
|
const $ZodNumber = /*@__PURE__*/ $constructor("$ZodNumber", (inst, def) => {
|
|
832
855
|
$ZodType.init(inst, def);
|
|
833
856
|
inst._zod.pattern = number$2;
|
|
@@ -1431,6 +1454,18 @@ function _string(Class, params) {
|
|
|
1431
1454
|
}));
|
|
1432
1455
|
}
|
|
1433
1456
|
// @__NO_SIDE_EFFECTS__
|
|
1457
|
+
function _isoDateTime(Class, params) {
|
|
1458
|
+
return new Class({
|
|
1459
|
+
type: "string",
|
|
1460
|
+
format: "datetime",
|
|
1461
|
+
check: "string_format",
|
|
1462
|
+
offset: false,
|
|
1463
|
+
local: false,
|
|
1464
|
+
precision: null,
|
|
1465
|
+
...normalizeParams(params)
|
|
1466
|
+
});
|
|
1467
|
+
}
|
|
1468
|
+
// @__NO_SIDE_EFFECTS__
|
|
1434
1469
|
function _number(Class, params) {
|
|
1435
1470
|
return new Class(snapshotChecks({
|
|
1436
1471
|
type: "number",
|
|
@@ -1488,6 +1523,15 @@ function _custom(Class, fn, _params) {
|
|
|
1488
1523
|
...norm
|
|
1489
1524
|
});
|
|
1490
1525
|
}
|
|
1526
|
+
// @__NO_SIDE_EFFECTS__
|
|
1527
|
+
function _refine(Class, fn, _params) {
|
|
1528
|
+
return new Class({
|
|
1529
|
+
type: "custom",
|
|
1530
|
+
check: "custom",
|
|
1531
|
+
fn,
|
|
1532
|
+
...normalizeParams(_params)
|
|
1533
|
+
});
|
|
1534
|
+
}
|
|
1491
1535
|
//#endregion
|
|
1492
1536
|
//#region ../../node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/mini/schemas.js
|
|
1493
1537
|
const ZodMiniType = /*@__PURE__*/ $constructor("ZodMiniType", (inst, def) => {
|
|
@@ -1547,6 +1591,10 @@ const ZodMiniString = /*@__PURE__*/ $constructor("ZodMiniString", (inst, def) =>
|
|
|
1547
1591
|
function string(params) {
|
|
1548
1592
|
return /* @__PURE__ */ _string(ZodMiniString, params);
|
|
1549
1593
|
}
|
|
1594
|
+
const ZodMiniStringFormat = /*@__PURE__*/ $constructor("ZodMiniStringFormat", (inst, def) => {
|
|
1595
|
+
$ZodStringFormat.init(inst, def);
|
|
1596
|
+
ZodMiniString.init(inst, def);
|
|
1597
|
+
});
|
|
1550
1598
|
const ZodMiniNumber = /*@__PURE__*/ $constructor("ZodMiniNumber", (inst, def) => {
|
|
1551
1599
|
$ZodNumber.init(inst, def);
|
|
1552
1600
|
ZodMiniType.init(inst, def);
|
|
@@ -1723,6 +1771,20 @@ const ZodMiniCustom = /*@__PURE__*/ $constructor("ZodMiniCustom", (inst, def) =>
|
|
|
1723
1771
|
function custom(fn, _params) {
|
|
1724
1772
|
return /* @__PURE__ */ _custom(ZodMiniCustom, fn ?? (() => true), _params);
|
|
1725
1773
|
}
|
|
1774
|
+
// @__NO_SIDE_EFFECTS__
|
|
1775
|
+
function refine(fn, _params = {}) {
|
|
1776
|
+
return /* @__PURE__ */ _refine(ZodMiniCustom, fn, _params);
|
|
1777
|
+
}
|
|
1778
|
+
//#endregion
|
|
1779
|
+
//#region ../../node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/mini/iso.js
|
|
1780
|
+
const ZodMiniISODateTime = /*@__PURE__*/ $constructor("ZodMiniISODateTime", (inst, def) => {
|
|
1781
|
+
$ZodISODateTime.init(inst, def);
|
|
1782
|
+
ZodMiniStringFormat.init(inst, def);
|
|
1783
|
+
});
|
|
1784
|
+
// @__NO_SIDE_EFFECTS__
|
|
1785
|
+
function datetime(params) {
|
|
1786
|
+
return /* @__PURE__ */ _isoDateTime(ZodMiniISODateTime, params);
|
|
1787
|
+
}
|
|
1726
1788
|
//#endregion
|
|
1727
1789
|
//#region ../pieces-framework/dist/markdown-property-DMfHjEiL.js
|
|
1728
1790
|
const BasePropertySchema = /* @__PURE__ */ object({
|
|
@@ -2308,6 +2370,7 @@ const BaseModelSchema = {
|
|
|
2308
2370
|
updated: DateOrString
|
|
2309
2371
|
};
|
|
2310
2372
|
const Nullable = (schema) => /* @__PURE__ */ optional$1(/* @__PURE__ */ nullable(schema));
|
|
2373
|
+
(/* @__PURE__ */ datetime({ offset: true })).check(/* @__PURE__ */ refine((val) => val.slice(0, 4) !== "0000"));
|
|
2311
2374
|
let ToolCallStatus = /* @__PURE__ */ function(ToolCallStatus) {
|
|
2312
2375
|
ToolCallStatus["IN_PROGRESS"] = "in-progress";
|
|
2313
2376
|
ToolCallStatus["COMPLETED"] = "completed";
|
|
@@ -5780,6 +5843,27 @@ function declaredPorts(ports) {
|
|
|
5780
5843
|
function declaredReactor(value) {
|
|
5781
5844
|
return value === "read" || value === "write" ? value : void 0;
|
|
5782
5845
|
}
|
|
5846
|
+
function declaredTimeout(value) {
|
|
5847
|
+
return typeof value === "number" && Number.isFinite(value) && value > 0 ? value : void 0;
|
|
5848
|
+
}
|
|
5849
|
+
function declaredRetry(value) {
|
|
5850
|
+
if (typeof value !== "object" || value === null) return void 0;
|
|
5851
|
+
const record = value;
|
|
5852
|
+
const attempts = record.maxAttempts;
|
|
5853
|
+
if (typeof attempts !== "number" || !Number.isInteger(attempts)) return;
|
|
5854
|
+
if (attempts < 1) return void 0;
|
|
5855
|
+
const seconds = (key) => typeof record[key] === "number" && Number.isFinite(record[key]) ? { [key]: record[key] } : {};
|
|
5856
|
+
return {
|
|
5857
|
+
maxAttempts: attempts,
|
|
5858
|
+
...record.backoff === "FIXED" || record.backoff === "EXPONENTIAL" ? { backoff: record.backoff } : {},
|
|
5859
|
+
...seconds("initialDelaySeconds"),
|
|
5860
|
+
...seconds("maxDelaySeconds"),
|
|
5861
|
+
...Array.isArray(record.retryOn) ? { retryOn: record.retryOn.filter((entry) => typeof entry === "string") } : {}
|
|
5862
|
+
};
|
|
5863
|
+
}
|
|
5864
|
+
function suggestedRetry(options) {
|
|
5865
|
+
return options?.retryOnFailure?.defaultValue === true ? { maxAttempts: 3 } : void 0;
|
|
5866
|
+
}
|
|
5783
5867
|
function buildDescriptor(piece, source, options = {}) {
|
|
5784
5868
|
const actions = Object.entries(getActions(piece)).map(([actionName, action]) => ({
|
|
5785
5869
|
name: action.name ?? actionName,
|
|
@@ -5787,6 +5871,8 @@ function buildDescriptor(piece, source, options = {}) {
|
|
|
5787
5871
|
description: action.description,
|
|
5788
5872
|
requireAuth: action.requireAuth ?? false,
|
|
5789
5873
|
...optional("requireReactor", declaredReactor(action.requireReactor)),
|
|
5874
|
+
...optional("defaultTimeoutSeconds", declaredTimeout(action.defaultTimeoutSeconds)),
|
|
5875
|
+
...optional("defaultRetry", declaredRetry(action.defaultRetry) ?? suggestedRetry(action.errorHandlingOptions)),
|
|
5790
5876
|
ports: (options.routed ? declaredPorts(action.ports) : void 0) ?? PIECE_ACTION_PORTS,
|
|
5791
5877
|
props: describeProperties(action.props, (propName) => `activepieces:${source.packageName}#${actionName}.${propName}`),
|
|
5792
5878
|
...action.outputSchema !== void 0 ? { outputSchema: action.outputSchema } : {},
|
|
@@ -6321,6 +6407,7 @@ function errorName(error, fallback) {
|
|
|
6321
6407
|
if (typeof error !== "object" || error === null) return fallback || "Error";
|
|
6322
6408
|
const named = error.name;
|
|
6323
6409
|
if (typeof named === "string" && REACTOR_ERROR_NAMES.has(named)) return named;
|
|
6410
|
+
if (typeof named === "string" && named && named !== "Error") return named;
|
|
6324
6411
|
return error.constructor.name || fallback || "Error";
|
|
6325
6412
|
}
|
|
6326
6413
|
function serializeError(error, values = []) {
|
|
@@ -6789,14 +6876,15 @@ var RequestGuard = class {
|
|
|
6789
6876
|
} catch (error) {
|
|
6790
6877
|
return Promise.reject(error);
|
|
6791
6878
|
}
|
|
6792
|
-
return Promise.race([result.then((value) => this.
|
|
6879
|
+
return Promise.race([result.then((value) => this.wrap(value)), this.whenClosed]);
|
|
6793
6880
|
}
|
|
6794
6881
|
close() {
|
|
6795
6882
|
this.closed = true;
|
|
6796
6883
|
this.rejectClosed(requestClosed());
|
|
6797
6884
|
}
|
|
6798
|
-
|
|
6885
|
+
wrap(value) {
|
|
6799
6886
|
if (typeof value !== "object" || value === null) return value;
|
|
6887
|
+
if (isWriteHandle(value)) return this.handle(value);
|
|
6800
6888
|
const next = value.next;
|
|
6801
6889
|
if (typeof next !== "function") return value;
|
|
6802
6890
|
return {
|
|
@@ -6804,7 +6892,17 @@ var RequestGuard = class {
|
|
|
6804
6892
|
next: () => this.call(() => next.call(value))
|
|
6805
6893
|
};
|
|
6806
6894
|
}
|
|
6895
|
+
handle(handle) {
|
|
6896
|
+
return new Proxy(handle, { get: (target, prop) => {
|
|
6897
|
+
if (prop === "readable" || prop === "written") return this.call(() => target[prop]);
|
|
6898
|
+
if (prop === "document") return (...args) => this.call(() => target.document(...args));
|
|
6899
|
+
return Reflect.get(target, prop, target);
|
|
6900
|
+
} });
|
|
6901
|
+
}
|
|
6807
6902
|
};
|
|
6903
|
+
function isWriteHandle(value) {
|
|
6904
|
+
return typeof value.document === "function" && "readable" in value && "written" in value;
|
|
6905
|
+
}
|
|
6808
6906
|
const SERVED_DRIVES = {
|
|
6809
6907
|
getNode: true,
|
|
6810
6908
|
listNodes: true,
|
|
@@ -6819,16 +6917,67 @@ const REFUSED_DRIVES = {
|
|
|
6819
6917
|
copyNode: true,
|
|
6820
6918
|
setPreferredEditorOnNode: true
|
|
6821
6919
|
};
|
|
6822
|
-
|
|
6823
|
-
|
|
6824
|
-
|
|
6825
|
-
|
|
6826
|
-
|
|
6827
|
-
|
|
6920
|
+
const SERVED_WRITE = {
|
|
6921
|
+
create: true,
|
|
6922
|
+
createEmpty: true,
|
|
6923
|
+
execute: true,
|
|
6924
|
+
deleteDocument: true
|
|
6925
|
+
};
|
|
6926
|
+
const SERVED_DRIVE_WRITES = {
|
|
6927
|
+
addFile: true,
|
|
6928
|
+
addFolder: true
|
|
6929
|
+
};
|
|
6930
|
+
const REFUSED_WRITE = {
|
|
6931
|
+
isDocumentIdTaken: true,
|
|
6932
|
+
describe: true,
|
|
6933
|
+
evaluateActions: true,
|
|
6934
|
+
upgradeDocument: true,
|
|
6935
|
+
executeBatch: true,
|
|
6936
|
+
rename: true,
|
|
6937
|
+
setPreferredEditor: true,
|
|
6938
|
+
addRelationship: true,
|
|
6939
|
+
updateRelationship: true,
|
|
6940
|
+
removeRelationship: true,
|
|
6941
|
+
moveRelationship: true,
|
|
6942
|
+
deleteDocuments: true,
|
|
6943
|
+
loadBatch: true
|
|
6944
|
+
};
|
|
6945
|
+
function guarded(remote, guard, serve, refuse, prefix) {
|
|
6946
|
+
const methods = Object.create(null);
|
|
6947
|
+
for (const name of Object.keys(serve)) methods[name] = (...args) => guard.call(() => remote[name](...args));
|
|
6948
|
+
refuseAll(methods, refuse, (name) => `${prefix}${name} is not available to workflow pieces`);
|
|
6949
|
+
return methods;
|
|
6950
|
+
}
|
|
6951
|
+
function refuseAll(methods, names, message) {
|
|
6952
|
+
for (const name of Object.keys(names)) methods[name] = () => {
|
|
6953
|
+
throw named(ReactorAccessDeniedError, message(name));
|
|
6828
6954
|
};
|
|
6829
|
-
return drives;
|
|
6830
6955
|
}
|
|
6831
|
-
function
|
|
6956
|
+
function sessionDrives(proxy, guard) {
|
|
6957
|
+
return guarded(proxy.drives, guard, SERVED_DRIVES, REFUSED_DRIVES, "drives.");
|
|
6958
|
+
}
|
|
6959
|
+
function sessionWrite(proxy, guard) {
|
|
6960
|
+
const remote = proxy.write;
|
|
6961
|
+
const write = guarded(remote, guard, SERVED_WRITE, REFUSED_WRITE, "write.");
|
|
6962
|
+
write.drives = guarded(remote.drives, guard, SERVED_DRIVE_WRITES, REFUSED_DRIVES, "write.drives.");
|
|
6963
|
+
return write;
|
|
6964
|
+
}
|
|
6965
|
+
function readOnlyWrite() {
|
|
6966
|
+
const readOnly = (prefix) => (name) => `${prefix}${name} writes, and this step declares read access only`;
|
|
6967
|
+
const write = Object.create(null);
|
|
6968
|
+
refuseAll(write, {
|
|
6969
|
+
...SERVED_WRITE,
|
|
6970
|
+
...REFUSED_WRITE
|
|
6971
|
+
}, readOnly("write."));
|
|
6972
|
+
const drives = Object.create(null);
|
|
6973
|
+
refuseAll(drives, {
|
|
6974
|
+
...SERVED_DRIVE_WRITES,
|
|
6975
|
+
...REFUSED_DRIVES
|
|
6976
|
+
}, readOnly("write.drives."));
|
|
6977
|
+
write.drives = drives;
|
|
6978
|
+
return write;
|
|
6979
|
+
}
|
|
6980
|
+
function sessionClient(rt, proxy, guard, requireReactor = "read") {
|
|
6832
6981
|
const local = {
|
|
6833
6982
|
getDocumentModelModule: (documentType) => guard.call(async () => {
|
|
6834
6983
|
const type = String(documentType);
|
|
@@ -6852,9 +7001,12 @@ function sessionClient(rt, proxy, guard) {
|
|
|
6852
7001
|
}
|
|
6853
7002
|
};
|
|
6854
7003
|
const drives = sessionDrives(proxy, guard);
|
|
7004
|
+
const write = requireReactor === "write" ? sessionWrite(proxy, guard) : readOnlyWrite();
|
|
6855
7005
|
return new Proxy({}, { get: (_target, prop) => {
|
|
6856
7006
|
if (typeof prop !== "string" || prop === "then") return void 0;
|
|
6857
7007
|
if (prop === "drives") return drives;
|
|
7008
|
+
if (prop === "write") return write;
|
|
7009
|
+
if (prop === "read") return void 0;
|
|
6858
7010
|
if (prop in local) return local[prop];
|
|
6859
7011
|
return (...args) => guard.call(() => proxy[prop](...args));
|
|
6860
7012
|
} });
|
|
@@ -6866,7 +7018,7 @@ async function openSession(binding, requireReactor) {
|
|
|
6866
7018
|
router.attach(transport);
|
|
6867
7019
|
const proxy = rt.rpc.createReactorClientProxy(router, { registry: rt.registry });
|
|
6868
7020
|
const guard = new RequestGuard();
|
|
6869
|
-
const client = sessionClient(rt, proxy, guard);
|
|
7021
|
+
const client = sessionClient(rt, proxy, guard, requireReactor);
|
|
6870
7022
|
const close = () => {
|
|
6871
7023
|
guard.close();
|
|
6872
7024
|
router.detach();
|