@powerhousedao/reactor-workflow 6.2.3-dev.87 → 6.2.3-dev.89
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 +108 -5
- package/dist/index.d.ts +60 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +467 -60
- package/dist/index.js.map +1 -1
- package/dist/{piece-registry-C1Pc0hD6.d.ts → piece-registry-dvS95c3E.d.ts} +33 -3
- package/dist/piece-registry-dvS95c3E.d.ts.map +1 -0
- package/dist/{telemetry-B5nuWvdf.js → telemetry-Dg51lywn.js} +479 -65
- package/dist/telemetry-Dg51lywn.js.map +1 -0
- package/dist/testing.d.ts +1 -1
- package/dist/testing.js +1 -1
- package/dist/worker-entry.js +277 -27
- package/dist/worker-entry.js.map +1 -1
- package/package.json +7 -7
- package/dist/piece-registry-C1Pc0hD6.d.ts.map +0 -1
- package/dist/telemetry-B5nuWvdf.js.map +0 -1
package/dist/testing.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { A as
|
|
1
|
+
import { A as PieceResolver, B as buildDescriptor, E as WorkflowRunResult, F as extractDedupeKey, M as sourcedResolver, O as LocalPiece, P as RecordedSchedule, S as BlockExecution, V as loadPieceFromDir, _ as PieceWorker, a as runWorkflow, b as WorkflowTelemetry, c as CompositeBlockExecutor, d as InMemorySecretProvider, h as IPieceWorker, j as PieceTarget, k as PackagePiece, m as PieceWorkerPool, o as ActivepiecesBlockExecutor, s as AttachmentPort, t as PieceRegistry, u as StaticConnectionResolver, z as PieceDescriptor } from "./piece-registry-dvS95c3E.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 { $ as PieceWorkerPool, Et as fetchPieceBundle, L as StaticConnectionResolver, S as CompositeBlockExecutor, Tt as ensurePieceBundle, W as InMemorySecretProvider, a as PieceRegistry, bt as buildDescriptor, d as runWorkflow, et as PieceWorker, ft as extractDedupeKey, n as WorkflowTelemetry, x as ActivepiecesBlockExecutor, yt as sourcedResolver } from "./telemetry-Dg51lywn.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
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { createRequire, flushCompileCache } from "node:module";
|
|
2
2
|
import crypto from "crypto";
|
|
3
3
|
import path, { resolve } from "node:path";
|
|
4
|
-
import { mkdir, readFile, rm, stat, writeFile } from "node:fs/promises";
|
|
4
|
+
import fs, { mkdir, readFile, rm, stat, writeFile } from "node:fs/promises";
|
|
5
5
|
import { randomBytes, randomUUID } from "node:crypto";
|
|
6
6
|
import { format } from "node:util";
|
|
7
7
|
import { Readable, Transform } from "node:stream";
|
|
@@ -2163,7 +2163,7 @@ const Property$1 = {
|
|
|
2163
2163
|
}
|
|
2164
2164
|
};
|
|
2165
2165
|
//#endregion
|
|
2166
|
-
//#region ../pieces-framework/dist/authentication-
|
|
2166
|
+
//#region ../pieces-framework/dist/authentication-f4cep7Po.js
|
|
2167
2167
|
let OAuth2GrantType = /* @__PURE__ */ function(OAuth2GrantType) {
|
|
2168
2168
|
OAuth2GrantType["AUTHORIZATION_CODE"] = "authorization_code";
|
|
2169
2169
|
OAuth2GrantType["CLIENT_CREDENTIALS"] = "client_credentials";
|
|
@@ -2266,7 +2266,13 @@ const OAuth2ExtraProps = /* @__PURE__ */ object({
|
|
|
2266
2266
|
pkceMethod: /* @__PURE__ */ optional$1(/* @__PURE__ */ union([/* @__PURE__ */ literal("plain"), /* @__PURE__ */ literal("S256")])),
|
|
2267
2267
|
authorizationMethod: /* @__PURE__ */ optional$1(/* @__PURE__ */ _enum(OAuth2AuthorizationMethod)),
|
|
2268
2268
|
grantType: /* @__PURE__ */ optional$1(/* @__PURE__ */ union([/* @__PURE__ */ _enum(OAuth2GrantType), /* @__PURE__ */ literal(BOTH_CLIENT_CREDENTIALS_AND_AUTHORIZATION_CODE)])),
|
|
2269
|
-
extra: /* @__PURE__ */ optional$1(/* @__PURE__ */ record(/* @__PURE__ */ string(), /* @__PURE__ */ string()))
|
|
2269
|
+
extra: /* @__PURE__ */ optional$1(/* @__PURE__ */ record(/* @__PURE__ */ string(), /* @__PURE__ */ string())),
|
|
2270
|
+
discovery: /* @__PURE__ */ optional$1(/* @__PURE__ */ object({
|
|
2271
|
+
serverUrlProp: /* @__PURE__ */ string(),
|
|
2272
|
+
authUrlProp: /* @__PURE__ */ string(),
|
|
2273
|
+
tokenUrlProp: /* @__PURE__ */ string(),
|
|
2274
|
+
scopesProp: /* @__PURE__ */ optional$1(/* @__PURE__ */ string())
|
|
2275
|
+
}))
|
|
2270
2276
|
});
|
|
2271
2277
|
const OAuth2PropertyValue = /* @__PURE__ */ object({
|
|
2272
2278
|
access_token: /* @__PURE__ */ string(),
|
|
@@ -2371,6 +2377,19 @@ const BaseModelSchema = {
|
|
|
2371
2377
|
};
|
|
2372
2378
|
const Nullable = (schema) => /* @__PURE__ */ optional$1(/* @__PURE__ */ nullable(schema));
|
|
2373
2379
|
(/* @__PURE__ */ datetime({ offset: true })).check(/* @__PURE__ */ refine((val) => val.slice(0, 4) !== "0000"));
|
|
2380
|
+
let LocalesEnum = /* @__PURE__ */ function(LocalesEnum) {
|
|
2381
|
+
LocalesEnum["DUTCH"] = "nl";
|
|
2382
|
+
LocalesEnum["ENGLISH"] = "en";
|
|
2383
|
+
LocalesEnum["GERMAN"] = "de";
|
|
2384
|
+
LocalesEnum["FRENCH"] = "fr";
|
|
2385
|
+
LocalesEnum["SPANISH"] = "es";
|
|
2386
|
+
LocalesEnum["JAPANESE"] = "ja";
|
|
2387
|
+
LocalesEnum["CHINESE_SIMPLIFIED"] = "zh";
|
|
2388
|
+
LocalesEnum["PORTUGUESE"] = "pt";
|
|
2389
|
+
LocalesEnum["ARABIC"] = "ar";
|
|
2390
|
+
LocalesEnum["CHINESE_TRADITIONAL"] = "zh-TW";
|
|
2391
|
+
return LocalesEnum;
|
|
2392
|
+
}({});
|
|
2374
2393
|
let ToolCallStatus = /* @__PURE__ */ function(ToolCallStatus) {
|
|
2375
2394
|
ToolCallStatus["IN_PROGRESS"] = "in-progress";
|
|
2376
2395
|
ToolCallStatus["COMPLETED"] = "completed";
|
|
@@ -2397,15 +2416,18 @@ const toolCallBaseShape = {
|
|
|
2397
2416
|
(/* @__PURE__ */ string()).check(/* @__PURE__ */ _regex(/^[a-z0-9][a-z0-9-]{0,62}$/)), (/* @__PURE__ */ string()).check(/* @__PURE__ */ _regex(/^[a-z0-9][a-z0-9-]{0,62}$/));
|
|
2398
2417
|
const OPENAI_CHAT_MODELS = [
|
|
2399
2418
|
"gpt-5.5",
|
|
2419
|
+
"gpt-5.6-sol",
|
|
2420
|
+
"gpt-5.6-terra",
|
|
2421
|
+
"gpt-5.6-luna",
|
|
2400
2422
|
"gpt-5.4-mini",
|
|
2401
2423
|
"gpt-5.4-nano",
|
|
2402
2424
|
"gpt-4.1",
|
|
2403
2425
|
"gpt-4.1-mini"
|
|
2404
2426
|
];
|
|
2405
2427
|
const ANTHROPIC_CHAT_MODELS = [
|
|
2406
|
-
"claude-sonnet-
|
|
2407
|
-
"claude-opus-
|
|
2408
|
-
"claude-haiku-
|
|
2428
|
+
"claude-sonnet-5-5",
|
|
2429
|
+
"claude-opus-5-5",
|
|
2430
|
+
"claude-haiku-5-5"
|
|
2409
2431
|
];
|
|
2410
2432
|
const ANTHROPIC_OPENROUTER_CHAT_MODELS = [
|
|
2411
2433
|
"claude-sonnet-4.6",
|
|
@@ -2414,14 +2436,13 @@ const ANTHROPIC_OPENROUTER_CHAT_MODELS = [
|
|
|
2414
2436
|
"claude-haiku-4.5"
|
|
2415
2437
|
];
|
|
2416
2438
|
const GOOGLE_CHAT_MODELS = [
|
|
2417
|
-
"gemini-2.5-pro",
|
|
2418
|
-
"gemini-2.5-flash",
|
|
2419
2439
|
"gemini-3.7-flash",
|
|
2420
2440
|
"gemini-3.1-pro-preview",
|
|
2421
2441
|
"gemini-3-flash-preview"
|
|
2422
2442
|
];
|
|
2443
|
+
const DEPRECATED_GOOGLE_CHAT_MODELS = ["gemini-2.5-pro", "gemini-2.5-flash"];
|
|
2423
2444
|
const X_AI_OPENROUTER_CHAT_MODELS = ["grok-4.20"];
|
|
2424
|
-
ANTHROPIC_OPENROUTER_CHAT_MODELS.map((model) => `anthropic/${model}`);
|
|
2445
|
+
[...ANTHROPIC_OPENROUTER_CHAT_MODELS.map((model) => `anthropic/${model}`)];
|
|
2425
2446
|
const ALLOWED_CHAT_MODELS_BY_PROVIDER = {
|
|
2426
2447
|
["openai"]: OPENAI_CHAT_MODELS,
|
|
2427
2448
|
["anthropic"]: ANTHROPIC_CHAT_MODELS,
|
|
@@ -2430,7 +2451,7 @@ const ALLOWED_CHAT_MODELS_BY_PROVIDER = {
|
|
|
2430
2451
|
["activepieces"]: [
|
|
2431
2452
|
...ANTHROPIC_OPENROUTER_CHAT_MODELS.map((m) => `anthropic/${m}`),
|
|
2432
2453
|
...OPENAI_CHAT_MODELS.map((m) => `openai/${m}`),
|
|
2433
|
-
...GOOGLE_CHAT_MODELS.map((m) => `google/${m}`),
|
|
2454
|
+
...[...GOOGLE_CHAT_MODELS, ...DEPRECATED_GOOGLE_CHAT_MODELS].map((m) => `google/${m}`),
|
|
2434
2455
|
...X_AI_OPENROUTER_CHAT_MODELS.map((m) => `x-ai/${m}`)
|
|
2435
2456
|
]
|
|
2436
2457
|
};
|
|
@@ -2450,12 +2471,12 @@ function getMaxContextTokens({ provider }) {
|
|
|
2450
2471
|
if (!provider) return DEFAULT_MAX_CONTEXT_TOKENS;
|
|
2451
2472
|
return PROVIDER_MAX_CONTEXT_TOKENS[provider] ?? DEFAULT_MAX_CONTEXT_TOKENS;
|
|
2452
2473
|
}
|
|
2453
|
-
const
|
|
2454
|
-
["openai"]: "text-embedding-3-small",
|
|
2455
|
-
["google"]: "text-embedding-004",
|
|
2456
|
-
["azure"]: "text-embedding-3-small",
|
|
2457
|
-
["activepieces"]: "text-embedding-3-small",
|
|
2458
|
-
["openrouter"]: "openai/text-embedding-3-small"
|
|
2474
|
+
const EMBEDDING_MODELS = {
|
|
2475
|
+
["openai"]: ["text-embedding-3-small", "text-embedding-3-large"],
|
|
2476
|
+
["google"]: ["text-embedding-004", "gemini-embedding-001"],
|
|
2477
|
+
["azure"]: ["text-embedding-3-small", "text-embedding-3-large"],
|
|
2478
|
+
["activepieces"]: ["text-embedding-3-small"],
|
|
2479
|
+
["openrouter"]: ["openai/text-embedding-3-small", "openai/text-embedding-3-large"]
|
|
2459
2480
|
};
|
|
2460
2481
|
const WEB_SEARCH_MODE_BY_PROVIDER = {
|
|
2461
2482
|
["anthropic"]: "native",
|
|
@@ -2477,12 +2498,37 @@ function buildProviderCapabilities(provider) {
|
|
|
2477
2498
|
return {
|
|
2478
2499
|
chatModels: ALLOWED_CHAT_MODELS_BY_PROVIDER[provider],
|
|
2479
2500
|
maxContextTokens: getMaxContextTokens({ provider }),
|
|
2480
|
-
|
|
2481
|
-
|
|
2501
|
+
embeddingModels: EMBEDDING_MODELS[provider] ?? [],
|
|
2502
|
+
defaultEmbeddingModel: EMBEDDING_MODELS[provider]?.[0],
|
|
2503
|
+
supportsEmbedding: (EMBEDDING_MODELS[provider] ?? []).length > 0,
|
|
2482
2504
|
supportsImageGeneration: !NO_IMAGE_GENERATION_PROVIDERS.has(provider),
|
|
2505
|
+
defaultImageModel: DEFAULT_IMAGE_MODELS[provider],
|
|
2483
2506
|
webSearch: WEB_SEARCH_MODE_BY_PROVIDER[provider]
|
|
2484
2507
|
};
|
|
2485
2508
|
}
|
|
2509
|
+
const ACTIVEPIECES_IMAGE_TIERS = [
|
|
2510
|
+
{
|
|
2511
|
+
id: "fast",
|
|
2512
|
+
label: "Fast",
|
|
2513
|
+
modelId: "google/gemini-3.1-flash-lite-image"
|
|
2514
|
+
},
|
|
2515
|
+
{
|
|
2516
|
+
id: "smart",
|
|
2517
|
+
label: "Expert",
|
|
2518
|
+
modelId: "google/gemini-3.1-flash-image"
|
|
2519
|
+
},
|
|
2520
|
+
{
|
|
2521
|
+
id: "premium",
|
|
2522
|
+
label: "Heavy",
|
|
2523
|
+
modelId: "google/gemini-3-pro-image"
|
|
2524
|
+
}
|
|
2525
|
+
];
|
|
2526
|
+
const DEFAULT_IMAGE_MODELS = {
|
|
2527
|
+
["activepieces"]: ACTIVEPIECES_IMAGE_TIERS[0].modelId,
|
|
2528
|
+
["openrouter"]: "google/gemini-3.1-flash-lite-image",
|
|
2529
|
+
["openai"]: "gpt-image-1.5",
|
|
2530
|
+
["google"]: "gemini-3.1-flash-image"
|
|
2531
|
+
};
|
|
2486
2532
|
buildProviderCapabilities("openai"), buildProviderCapabilities("anthropic"), buildProviderCapabilities("openrouter"), buildProviderCapabilities("azure"), buildProviderCapabilities("google"), buildProviderCapabilities("cloudflare-gateway"), buildProviderCapabilities("custom"), buildProviderCapabilities("bedrock"), buildProviderCapabilities("vertex"), buildProviderCapabilities("mistral"), buildProviderCapabilities("activepieces"), buildProviderCapabilities("xai"), buildProviderCapabilities("deepseek"), buildProviderCapabilities("zai"), buildProviderCapabilities("qwen"), buildProviderCapabilities("minimax"), buildProviderCapabilities("moonshot");
|
|
2487
2533
|
({ ...BaseModelSchema }), { ...BaseModelSchema };
|
|
2488
2534
|
({ ...BaseModelSchema });
|
|
@@ -2600,6 +2646,129 @@ const PiecePackageMetadata = /* @__PURE__ */ object({
|
|
|
2600
2646
|
...PieceMetadataSummary.shape,
|
|
2601
2647
|
...PiecePackageMetadata.shape
|
|
2602
2648
|
});
|
|
2649
|
+
const pieceTranslation = {
|
|
2650
|
+
translatePiece: ({ piece, locale }) => {
|
|
2651
|
+
const translations = locale ? piece.i18n?.[locale] : void 0;
|
|
2652
|
+
if (!translations) return piece;
|
|
2653
|
+
return translateNode({
|
|
2654
|
+
node: piece,
|
|
2655
|
+
tree: isCorePiece(piece.categories) ? coreTranslationTree : translationTree,
|
|
2656
|
+
translations
|
|
2657
|
+
});
|
|
2658
|
+
},
|
|
2659
|
+
pathsToTranslate: (categories) => {
|
|
2660
|
+
return isCorePiece(categories) ? [...pieceTranslation.pathsToValuesToTranslate, "displayName"] : pieceTranslation.pathsToValuesToTranslate;
|
|
2661
|
+
},
|
|
2662
|
+
/**Gets the piece metadata regardles of piece location (node_modules or dist), wasn't included inside piece.metadata() for backwards compatibility issues (if an old ap version installs a new piece it would fail)*/
|
|
2663
|
+
initializeI18n: async (pieceOutputPath) => {
|
|
2664
|
+
try {
|
|
2665
|
+
const locales = Object.values(LocalesEnum);
|
|
2666
|
+
const i18n = {};
|
|
2667
|
+
for (const locale of locales) {
|
|
2668
|
+
const translations = await readLocaleFile(locale, pieceOutputPath);
|
|
2669
|
+
if (translations) i18n[locale] = translations;
|
|
2670
|
+
}
|
|
2671
|
+
return Object.keys(i18n).length > 0 ? i18n : void 0;
|
|
2672
|
+
} catch (err) {
|
|
2673
|
+
console.log(`Error initializing i18n for ${pieceOutputPath}:`, err);
|
|
2674
|
+
return;
|
|
2675
|
+
}
|
|
2676
|
+
},
|
|
2677
|
+
pathsToValuesToTranslate: [
|
|
2678
|
+
"description",
|
|
2679
|
+
"auth.username.displayName",
|
|
2680
|
+
"auth.username.description",
|
|
2681
|
+
"auth.password.displayName",
|
|
2682
|
+
"auth.password.description",
|
|
2683
|
+
"auth.props.*.displayName",
|
|
2684
|
+
"auth.props.*.description",
|
|
2685
|
+
"auth.props.*.options.options.*.label",
|
|
2686
|
+
"auth.description",
|
|
2687
|
+
"actions.*.displayName",
|
|
2688
|
+
"actions.*.description",
|
|
2689
|
+
"actions.*.props.*.displayName",
|
|
2690
|
+
"actions.*.props.*.description",
|
|
2691
|
+
"actions.*.props.*.options.options.*.label",
|
|
2692
|
+
"actions.*.propertyGroups.*.label",
|
|
2693
|
+
"actions.*.propertyGroups.*.description",
|
|
2694
|
+
"triggers.*.displayName",
|
|
2695
|
+
"triggers.*.description",
|
|
2696
|
+
"triggers.*.props.*.displayName",
|
|
2697
|
+
"triggers.*.props.*.description",
|
|
2698
|
+
"triggers.*.props.*.options.options.*.label",
|
|
2699
|
+
"triggers.*.propertyGroups.*.label",
|
|
2700
|
+
"triggers.*.propertyGroups.*.description"
|
|
2701
|
+
]
|
|
2702
|
+
};
|
|
2703
|
+
const translationTree = buildTree(pieceTranslation.pathsToTranslate());
|
|
2704
|
+
const coreTranslationTree = buildTree(pieceTranslation.pathsToTranslate(["CORE"]));
|
|
2705
|
+
function buildTree(paths) {
|
|
2706
|
+
return paths.reduce((tree, path) => addPath({
|
|
2707
|
+
tree,
|
|
2708
|
+
keys: path.split(".")
|
|
2709
|
+
}), {});
|
|
2710
|
+
}
|
|
2711
|
+
function isCorePiece(categories) {
|
|
2712
|
+
return categories?.includes("CORE") ?? false;
|
|
2713
|
+
}
|
|
2714
|
+
function addPath({ tree, keys: [key, ...rest] }) {
|
|
2715
|
+
return {
|
|
2716
|
+
...tree,
|
|
2717
|
+
[key]: rest.length === 0 ? null : addPath({
|
|
2718
|
+
tree: tree[key] ?? {},
|
|
2719
|
+
keys: rest
|
|
2720
|
+
})
|
|
2721
|
+
};
|
|
2722
|
+
}
|
|
2723
|
+
function translateNode({ node, tree, translations }) {
|
|
2724
|
+
if (!isRecord$3(node)) return node;
|
|
2725
|
+
const changes = {};
|
|
2726
|
+
let changed = false;
|
|
2727
|
+
for (const [key, subtree] of Object.entries(tree)) for (const childKey of key === "*" ? Object.keys(node) : [key]) {
|
|
2728
|
+
const child = node[childKey];
|
|
2729
|
+
const translated = subtree === null ? translateValue({
|
|
2730
|
+
value: child,
|
|
2731
|
+
translations
|
|
2732
|
+
}) : translateNode({
|
|
2733
|
+
node: child,
|
|
2734
|
+
tree: subtree,
|
|
2735
|
+
translations
|
|
2736
|
+
});
|
|
2737
|
+
if (translated !== child) {
|
|
2738
|
+
changes[childKey] = translated;
|
|
2739
|
+
changed = true;
|
|
2740
|
+
}
|
|
2741
|
+
}
|
|
2742
|
+
return changed ? Object.assign(Array.isArray(node) ? [] : {}, node, changes) : node;
|
|
2743
|
+
}
|
|
2744
|
+
function translateValue({ value, translations }) {
|
|
2745
|
+
if (typeof value !== "string") return value;
|
|
2746
|
+
return translations[value.slice(0, 512)] || value;
|
|
2747
|
+
}
|
|
2748
|
+
function isRecord$3(value) {
|
|
2749
|
+
return typeof value === "object" && value !== null;
|
|
2750
|
+
}
|
|
2751
|
+
async function fileExists(filePath) {
|
|
2752
|
+
try {
|
|
2753
|
+
await fs.access(filePath);
|
|
2754
|
+
return true;
|
|
2755
|
+
} catch {
|
|
2756
|
+
return false;
|
|
2757
|
+
}
|
|
2758
|
+
}
|
|
2759
|
+
const readLocaleFile = async (locale, pieceOutputPath) => {
|
|
2760
|
+
const filePath = path.join(pieceOutputPath, "src", "i18n", `${locale}.json`);
|
|
2761
|
+
if (!await fileExists(filePath)) return null;
|
|
2762
|
+
try {
|
|
2763
|
+
const fileContent = await fs.readFile(filePath, "utf8");
|
|
2764
|
+
const translations = JSON.parse(fileContent);
|
|
2765
|
+
if (typeof translations === "object" && translations !== null) return translations;
|
|
2766
|
+
throw new Error(`Invalid i18n file format for ${locale} in piece ${pieceOutputPath}`);
|
|
2767
|
+
} catch (error) {
|
|
2768
|
+
console.error(`Error reading i18n file for ${locale} in piece ${pieceOutputPath}:`, error);
|
|
2769
|
+
return null;
|
|
2770
|
+
}
|
|
2771
|
+
};
|
|
2603
2772
|
({ ...Property$1 });
|
|
2604
2773
|
const ReactorJobPendingError = "ReactorJobPendingError";
|
|
2605
2774
|
const ReactorJobFailedError = "ReactorJobFailedError";
|
|
@@ -2768,7 +2937,7 @@ function buildActionContext(options) {
|
|
|
2768
2937
|
},
|
|
2769
2938
|
connections: options.connections ?? throwingStub("connections"),
|
|
2770
2939
|
tags: throwingStub("tags"),
|
|
2771
|
-
server: throwingStub("server"),
|
|
2940
|
+
server: options.server ?? throwingStub("server"),
|
|
2772
2941
|
files: options.files ?? throwingStub("files"),
|
|
2773
2942
|
output: options.output ?? throwingStub("output"),
|
|
2774
2943
|
reactor: options.reactor ?? throwingStub("reactor"),
|
|
@@ -2788,7 +2957,7 @@ function buildActionContext(options) {
|
|
|
2788
2957
|
externalId: () => Promise.resolve(identity.projectId ?? "project")
|
|
2789
2958
|
},
|
|
2790
2959
|
flows: {
|
|
2791
|
-
list: throwingStub("flows.list"),
|
|
2960
|
+
list: options.flows ? options.flows.list.bind(options.flows) : throwingStub("flows.list"),
|
|
2792
2961
|
current: {
|
|
2793
2962
|
id: identity.flowId ?? "flow",
|
|
2794
2963
|
version: { id: identity.flowVersionId ?? "flow-version" }
|
|
@@ -2814,6 +2983,9 @@ const STORE_PUT = "store.put";
|
|
|
2814
2983
|
const STORE_DELETE = "store.delete";
|
|
2815
2984
|
const FILES_UPLOAD = "files.upload";
|
|
2816
2985
|
const WAITPOINT_CREATE = "waitpoint.create";
|
|
2986
|
+
const FLOWS_LIST = "flows.list";
|
|
2987
|
+
const HOST_HTTP = "host.http";
|
|
2988
|
+
const HOST_ORIGIN = "http://reactor.invalid";
|
|
2817
2989
|
//#endregion
|
|
2818
2990
|
//#region src/pieces/activepieces/indeterminate.ts
|
|
2819
2991
|
/** The property name, so both sides spell it once. */
|
|
@@ -4556,9 +4728,10 @@ const extractResponseHttpDetails = (error) => {
|
|
|
4556
4728
|
};
|
|
4557
4729
|
};
|
|
4558
4730
|
const extractClientHttpDetails = (error) => {
|
|
4559
|
-
const
|
|
4731
|
+
const thrownAsPlainValue = !(error instanceof Error);
|
|
4732
|
+
const status = toHttpStatus(error["status"]) ?? (thrownAsPlainValue ? toHttpStatus(error["statusCode"]) : void 0);
|
|
4560
4733
|
if (isNil(status)) return null;
|
|
4561
|
-
const responseBody = error["error"] ?? error["body"];
|
|
4734
|
+
const responseBody = error["error"] ?? error["body"] ?? (thrownAsPlainValue ? error["responseBody"] : void 0);
|
|
4562
4735
|
const headersValue = error["headers"];
|
|
4563
4736
|
return {
|
|
4564
4737
|
status,
|
|
@@ -4621,6 +4794,8 @@ const readErrorMessage = (error) => {
|
|
|
4621
4794
|
if (!isNil(messageString)) return messageString;
|
|
4622
4795
|
const stringified = String(error);
|
|
4623
4796
|
if (stringified.length > 0 && stringified !== "[object Object]") return stringified;
|
|
4797
|
+
const nested = extractApiMessage(error["error"]);
|
|
4798
|
+
if (!isNil(nested)) return nested;
|
|
4624
4799
|
return "Unknown error";
|
|
4625
4800
|
};
|
|
4626
4801
|
const pickPlainMessage = ({ httpDetails, rawMessage }) => {
|
|
@@ -5701,6 +5876,7 @@ function buildTriggerContext(options) {
|
|
|
5701
5876
|
}
|
|
5702
5877
|
},
|
|
5703
5878
|
step: { name: identity.stepName ?? "trigger" },
|
|
5879
|
+
run: identity.runId ? { id: identity.runId } : throwingStub("run"),
|
|
5704
5880
|
project: {
|
|
5705
5881
|
id: identity.projectId ?? "project",
|
|
5706
5882
|
externalId: () => Promise.resolve(identity.projectId ?? "project")
|
|
@@ -5853,6 +6029,18 @@ function describeOAuth2(raw) {
|
|
|
5853
6029
|
...extra && Object.keys(extra).length > 0 ? { extra } : {}
|
|
5854
6030
|
};
|
|
5855
6031
|
}
|
|
6032
|
+
const NOOP_HEAD = /^(?:async)?(?:function[\w$]*)?\(\)(?:=>)?/;
|
|
6033
|
+
const DOWNLEVELED = /^\{?(?:return)?(?:__awaiter|__async)\(this,[^{]*function\*\(\)(\{.*\})\);?\}?$/;
|
|
6034
|
+
const NOOP_BODY = /^\{?(?:return)?(?:await|yield)?(?:Promise\.resolve\(\))?;?\}?$/;
|
|
6035
|
+
function declaresOnStart(onStart) {
|
|
6036
|
+
if (typeof onStart !== "function") return false;
|
|
6037
|
+
if (onStart.length > 0) return true;
|
|
6038
|
+
const source = Function.prototype.toString.call(onStart).replace(/\s+/g, "");
|
|
6039
|
+
const head = NOOP_HEAD.exec(source);
|
|
6040
|
+
if (!head) return true;
|
|
6041
|
+
const body = source.slice(head[0].length);
|
|
6042
|
+
return !NOOP_BODY.test(DOWNLEVELED.exec(body)?.[1] ?? body);
|
|
6043
|
+
}
|
|
5856
6044
|
function describeHandshake(trigger) {
|
|
5857
6045
|
const strategy = trigger.handshakeConfiguration?.strategy;
|
|
5858
6046
|
if (!strategy || strategy === "NONE") return void 0;
|
|
@@ -6036,6 +6224,7 @@ function buildDescriptor(piece, source, options = {}) {
|
|
|
6036
6224
|
...trigger.sampleData !== void 0 && trigger.sampleData !== null ? { sampleData: trigger.sampleData } : {},
|
|
6037
6225
|
handshake: describeHandshake(trigger),
|
|
6038
6226
|
...optional("renew", triggerRenew(trigger)),
|
|
6227
|
+
...declaresOnStart(trigger.onStart) ? { onStart: true } : {},
|
|
6039
6228
|
...optional("propertyGroups", describeGroups(trigger.propertyGroups)),
|
|
6040
6229
|
...options.hostFed ? {} : withUnsupported(unsupportedTrigger(trigger))
|
|
6041
6230
|
}));
|
|
@@ -6362,10 +6551,10 @@ function seal(target, name, value) {
|
|
|
6362
6551
|
enumerable: false
|
|
6363
6552
|
});
|
|
6364
6553
|
}
|
|
6365
|
-
let installed$
|
|
6554
|
+
let installed$2 = false;
|
|
6366
6555
|
function installEgressGuard() {
|
|
6367
|
-
if (installed$
|
|
6368
|
-
installed$
|
|
6556
|
+
if (installed$2) return;
|
|
6557
|
+
installed$2 = true;
|
|
6369
6558
|
const connect = originalOf(net.Socket.prototype, "connect");
|
|
6370
6559
|
function patchedConnect(...args) {
|
|
6371
6560
|
const policies = policiesInForce();
|
|
@@ -6412,6 +6601,59 @@ function installEgressGuard() {
|
|
|
6412
6601
|
refuseResolvers(dns.promises.Resolver.prototype, true);
|
|
6413
6602
|
}
|
|
6414
6603
|
//#endregion
|
|
6604
|
+
//#region src/pieces/activepieces/worker/host-origin.ts
|
|
6605
|
+
const NULL_BODY_STATUSES = /* @__PURE__ */ new Set([
|
|
6606
|
+
101,
|
|
6607
|
+
204,
|
|
6608
|
+
205,
|
|
6609
|
+
304
|
|
6610
|
+
]);
|
|
6611
|
+
function urlOf(input) {
|
|
6612
|
+
if (typeof input === "string") return input;
|
|
6613
|
+
if (input instanceof URL) return input.href;
|
|
6614
|
+
if (input instanceof Request) return input.url;
|
|
6615
|
+
}
|
|
6616
|
+
function isHostUrl(url) {
|
|
6617
|
+
if (!url) return false;
|
|
6618
|
+
try {
|
|
6619
|
+
return new URL(url).origin === HOST_ORIGIN;
|
|
6620
|
+
} catch {
|
|
6621
|
+
return false;
|
|
6622
|
+
}
|
|
6623
|
+
}
|
|
6624
|
+
async function hostFetch(request) {
|
|
6625
|
+
const url = new URL(request.url);
|
|
6626
|
+
const body = request.body ? await request.text() : void 0;
|
|
6627
|
+
const call = {
|
|
6628
|
+
method: request.method,
|
|
6629
|
+
path: `${url.pathname}${url.search}`,
|
|
6630
|
+
headers: Object.fromEntries(request.headers),
|
|
6631
|
+
...body !== void 0 ? { body } : {}
|
|
6632
|
+
};
|
|
6633
|
+
const reply = await callHost(HOST_HTTP, call);
|
|
6634
|
+
return new Response(NULL_BODY_STATUSES.has(reply.status) ? null : reply.body ?? null, {
|
|
6635
|
+
status: reply.status,
|
|
6636
|
+
headers: reply.headers
|
|
6637
|
+
});
|
|
6638
|
+
}
|
|
6639
|
+
let installed$1 = false;
|
|
6640
|
+
function installHostFetch() {
|
|
6641
|
+
if (installed$1) return;
|
|
6642
|
+
installed$1 = true;
|
|
6643
|
+
const native = globalThis.fetch.bind(globalThis);
|
|
6644
|
+
globalThis.fetch = (input, init) => isHostUrl(urlOf(input)) ? hostFetch(new Request(input, init)) : native(input, init);
|
|
6645
|
+
}
|
|
6646
|
+
function hostServerContext(context) {
|
|
6647
|
+
return {
|
|
6648
|
+
apiUrl: HOST_ORIGIN,
|
|
6649
|
+
publicUrl: context.publicUrl ?? "http://reactor.invalid",
|
|
6650
|
+
get token() {
|
|
6651
|
+
throw new UnsupportedContextMemberError("server.token");
|
|
6652
|
+
}
|
|
6653
|
+
};
|
|
6654
|
+
}
|
|
6655
|
+
const hostFlows = { list: (params) => callHost(FLOWS_LIST, params ?? {}) };
|
|
6656
|
+
//#endregion
|
|
6415
6657
|
//#region src/pieces/activepieces/worker/tls-guard.ts
|
|
6416
6658
|
/** Defaults rejectUnauthorized to true on every tls.connect; returns the undo. */
|
|
6417
6659
|
function installTlsGuard() {
|
|
@@ -6596,7 +6838,7 @@ async function resolveOptions(message, piece, session) {
|
|
|
6596
6838
|
const { context, touched } = buildPropertyContext({
|
|
6597
6839
|
searchValue: request.searchValue,
|
|
6598
6840
|
projectId: request.projectId,
|
|
6599
|
-
flows: { list: () => Promise.resolve({ data: [] }) },
|
|
6841
|
+
flows: request.flows ? hostFlows : { list: () => Promise.resolve({ data: [] }) },
|
|
6600
6842
|
...session ? { reactor: session.client } : {}
|
|
6601
6843
|
});
|
|
6602
6844
|
const refresherValues = {
|
|
@@ -6697,6 +6939,10 @@ async function runAction(message, action, services) {
|
|
|
6697
6939
|
canPause: request.canPause,
|
|
6698
6940
|
...request.canPause ? { waitpoints: { create: (call) => callHost(WAITPOINT_CREATE, call) } } : {},
|
|
6699
6941
|
...request.resumeBaseUrl ? { resumeBaseUrl: request.resumeBaseUrl } : {},
|
|
6942
|
+
...request.flows ? {
|
|
6943
|
+
flows: hostFlows,
|
|
6944
|
+
server: hostServerContext(request.flows)
|
|
6945
|
+
} : {},
|
|
6700
6946
|
identity: request.identity
|
|
6701
6947
|
});
|
|
6702
6948
|
let output;
|
|
@@ -6742,7 +6988,10 @@ async function handleTriggerHook(message) {
|
|
|
6742
6988
|
isRepublish: request.isRepublish,
|
|
6743
6989
|
payload: request.payload,
|
|
6744
6990
|
webhookUrl: request.webhookUrl,
|
|
6745
|
-
|
|
6991
|
+
...request.flows ? {
|
|
6992
|
+
flows: hostFlows,
|
|
6993
|
+
server: hostServerContext(request.flows)
|
|
6994
|
+
} : { server: request.server },
|
|
6746
6995
|
files: runsPiece ? new DataUriFilesService() : void 0,
|
|
6747
6996
|
...reactorOption(session)
|
|
6748
6997
|
});
|
|
@@ -6852,6 +7101,7 @@ function dispatch(message) {
|
|
|
6852
7101
|
function startPieceWorker() {
|
|
6853
7102
|
installEgressGuard();
|
|
6854
7103
|
installTlsGuard();
|
|
7104
|
+
installHostFetch();
|
|
6855
7105
|
process.on("message", onMessage);
|
|
6856
7106
|
markWorkerReady();
|
|
6857
7107
|
}
|