@powerhousedao/reactor-workflow 6.2.3-dev.100
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/LICENSE +661 -0
- package/README.md +1211 -0
- package/dist/index.d.ts +20252 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +15971 -0
- package/dist/index.js.map +1 -0
- package/dist/piece-registry-dvS95c3E.d.ts +1140 -0
- package/dist/piece-registry-dvS95c3E.d.ts.map +1 -0
- package/dist/telemetry-gVd4Fpe6.js +5284 -0
- package/dist/telemetry-gVd4Fpe6.js.map +1 -0
- package/dist/testing.d.ts +26 -0
- package/dist/testing.d.ts.map +1 -0
- package/dist/testing.js +92 -0
- package/dist/testing.js.map +1 -0
- package/dist/worker-entry.js +7454 -0
- package/dist/worker-entry.js.map +1 -0
- package/package.json +77 -0
|
@@ -0,0 +1,26 @@
|
|
|
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
|
+
//#region src/pieces/activepieces/fetch.d.ts
|
|
3
|
+
interface FetchPieceBundleOptions {
|
|
4
|
+
name: string;
|
|
5
|
+
version: string;
|
|
6
|
+
cacheDir: string;
|
|
7
|
+
timeoutMs?: number;
|
|
8
|
+
entryUrl?: string;
|
|
9
|
+
installTimeoutMs?: number;
|
|
10
|
+
sources?: readonly BundleSource[];
|
|
11
|
+
cacheScope?: string;
|
|
12
|
+
}
|
|
13
|
+
/** Where a bundle came from, "cache" being a copy one of the others left. */
|
|
14
|
+
type BundleSource = "package" | "registry" | "cdn" | "npm";
|
|
15
|
+
interface FetchedBundle {
|
|
16
|
+
dir: string;
|
|
17
|
+
source: BundleSource | "cache";
|
|
18
|
+
dependencies: Record<string, string>;
|
|
19
|
+
installed: boolean;
|
|
20
|
+
}
|
|
21
|
+
export declare function fetchPieceBundle(options: FetchPieceBundleOptions): Promise<FetchedBundle>;
|
|
22
|
+
export declare function ensurePieceBundle(options: FetchPieceBundleOptions): Promise<FetchedBundle>;
|
|
23
|
+
//#endregion
|
|
24
|
+
export { ActivepiecesBlockExecutor, type AttachmentPort, type BlockExecution, CompositeBlockExecutor, type IPieceWorker, InMemorySecretProvider, type LocalPiece, type PackagePiece, type PieceDescriptor, PieceRegistry, type PieceResolver, type PieceTarget, PieceWorker, PieceWorkerPool, type RecordedSchedule, StaticConnectionResolver, type WorkflowRunResult, WorkflowTelemetry, buildDescriptor, extractDedupeKey, loadPieceFromDir, runWorkflow, sourcedResolver };
|
|
25
|
+
export {};
|
|
26
|
+
//# sourceMappingURL=testing.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"testing.d.ts","names":[],"sources":["../src/pieces/activepieces/fetch.ts"],"mappings":";;UAqHiB;EACf;EACA;EACA;EACA;EAGA;EAGA;EAEA,mBAAmB;EAEnB;;;KAIU;UAEK;EACf;EACA,QAAQ;EAGR,cAAc;EAGd;;wBA2JoB,iBACpB,SAAS,0BACR,QAAQ;wBAiDW,kBACpB,SAAS,0BACR,QAAQ"}
|
package/dist/testing.js
ADDED
|
@@ -0,0 +1,92 @@
|
|
|
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-gVd4Fpe6.js";
|
|
2
|
+
import { createRequire } from "node:module";
|
|
3
|
+
import { readFileSync, realpathSync } from "node:fs";
|
|
4
|
+
import path from "node:path";
|
|
5
|
+
import { pathToFileURL } from "node:url";
|
|
6
|
+
//#region src/pieces/activepieces/loader.ts
|
|
7
|
+
function resolveEntry(pieceDir) {
|
|
8
|
+
const raw = readFileSync(path.join(pieceDir, "package.json"), "utf8");
|
|
9
|
+
const pkg = JSON.parse(raw);
|
|
10
|
+
const dotExport = pkg.exports?.["."];
|
|
11
|
+
const candidates = [];
|
|
12
|
+
if (typeof dotExport === "string") candidates.push(dotExport);
|
|
13
|
+
if (dotExport && typeof dotExport === "object") {
|
|
14
|
+
const cond = dotExport;
|
|
15
|
+
for (const key of [
|
|
16
|
+
"import",
|
|
17
|
+
"require",
|
|
18
|
+
"default"
|
|
19
|
+
]) {
|
|
20
|
+
const value = cond[key];
|
|
21
|
+
if (typeof value === "string") candidates.push(value);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
candidates.push(pkg.main, pkg.module, "src/index.js", "index.js", "main.js");
|
|
25
|
+
const root = realpathSync(pieceDir);
|
|
26
|
+
const rootWithSep = root + path.sep;
|
|
27
|
+
for (const candidate of candidates) {
|
|
28
|
+
if (!candidate) continue;
|
|
29
|
+
const abs = path.resolve(pieceDir, candidate);
|
|
30
|
+
let real;
|
|
31
|
+
try {
|
|
32
|
+
real = realpathSync(abs);
|
|
33
|
+
} catch {
|
|
34
|
+
continue;
|
|
35
|
+
}
|
|
36
|
+
if (real !== root && !real.startsWith(rootWithSep)) continue;
|
|
37
|
+
return abs;
|
|
38
|
+
}
|
|
39
|
+
throw new Error(`No entry file found for piece bundle at ${pieceDir}`);
|
|
40
|
+
}
|
|
41
|
+
function isRecord(value) {
|
|
42
|
+
return typeof value === "object" && value !== null;
|
|
43
|
+
}
|
|
44
|
+
function findPiece(mod) {
|
|
45
|
+
const candidates = [
|
|
46
|
+
...Object.values(mod),
|
|
47
|
+
...isRecord(mod.default) ? Object.values(mod.default) : [],
|
|
48
|
+
mod.default
|
|
49
|
+
];
|
|
50
|
+
for (const candidate of candidates) if (isRecord(candidate) && candidate.constructor?.name === "Piece") return {
|
|
51
|
+
piece: candidate,
|
|
52
|
+
check: "constructor-name"
|
|
53
|
+
};
|
|
54
|
+
for (const candidate of candidates) if (isRecord(candidate) && typeof candidate.displayName === "string" && (isRecord(candidate.actions) || typeof candidate.actions === "function" || typeof candidate.getAction === "function")) return {
|
|
55
|
+
piece: candidate,
|
|
56
|
+
check: "structural"
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
function missingModule(entryPath, error) {
|
|
60
|
+
const code = error?.code;
|
|
61
|
+
if (code !== "ERR_MODULE_NOT_FOUND" && code !== "MODULE_NOT_FOUND") return;
|
|
62
|
+
const detail = error instanceof Error ? error.message : String(error);
|
|
63
|
+
return /* @__PURE__ */ new Error(`Piece at ${entryPath} could not be loaded: it imports a module that is not there. Its dependencies are installed with lifecycle scripts disabled, so one that compiles or downloads on install -- a native addon, a browser download -- cannot be prepared here. ${detail}`);
|
|
64
|
+
}
|
|
65
|
+
async function loadPiece(entryPath) {
|
|
66
|
+
let mod;
|
|
67
|
+
try {
|
|
68
|
+
mod = await import(
|
|
69
|
+
/* @vite-ignore */
|
|
70
|
+
pathToFileURL(entryPath).href
|
|
71
|
+
);
|
|
72
|
+
} catch (imported) {
|
|
73
|
+
try {
|
|
74
|
+
mod = createRequire(import.meta.url)(entryPath);
|
|
75
|
+
} catch (required) {
|
|
76
|
+
throw missingModule(entryPath, imported) ?? missingModule(entryPath, required) ?? required;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
const found = findPiece(mod);
|
|
80
|
+
if (!found) throw new Error(`No Piece export found in ${entryPath}. Export keys: ${Object.keys(mod).join(", ")}`);
|
|
81
|
+
return {
|
|
82
|
+
...found,
|
|
83
|
+
entryPath
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
async function loadPieceFromDir(pieceDir) {
|
|
87
|
+
return loadPiece(resolveEntry(pieceDir));
|
|
88
|
+
}
|
|
89
|
+
//#endregion
|
|
90
|
+
export { ActivepiecesBlockExecutor, CompositeBlockExecutor, InMemorySecretProvider, PieceRegistry, PieceWorker, PieceWorkerPool, StaticConnectionResolver, WorkflowTelemetry, buildDescriptor, ensurePieceBundle, extractDedupeKey, fetchPieceBundle, loadPieceFromDir, runWorkflow, sourcedResolver };
|
|
91
|
+
|
|
92
|
+
//# sourceMappingURL=testing.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"testing.js","names":[],"sources":["../src/pieces/activepieces/loader.ts"],"sourcesContent":["import { readFileSync, realpathSync } from \"node:fs\";\nimport { createRequire } from \"node:module\";\nimport path from \"node:path\";\nimport { pathToFileURL } from \"node:url\";\nimport type { ApPiece } from \"./types.js\";\n\nexport interface LoadedPiece {\n piece: ApPiece;\n entryPath: string;\n // Which duck-type check identified the export.\n check: \"constructor-name\" | \"structural\";\n}\n\n// Resolves a bundle's entry file. Published bundles typically carry only\n// `main` (no `exports`, no `type` — they are CJS).\nexport function resolveEntry(pieceDir: string): string {\n const raw = readFileSync(path.join(pieceDir, \"package.json\"), \"utf8\");\n const pkg = JSON.parse(raw) as {\n main?: string;\n module?: string;\n exports?: Record<string, unknown>;\n };\n const dotExport = pkg.exports?.[\".\"];\n const candidates: (string | undefined)[] = [];\n if (typeof dotExport === \"string\") candidates.push(dotExport);\n if (dotExport && typeof dotExport === \"object\") {\n const cond = dotExport as Record<string, unknown>;\n for (const key of [\"import\", \"require\", \"default\"]) {\n const value = cond[key];\n if (typeof value === \"string\") candidates.push(value);\n }\n }\n candidates.push(pkg.main, pkg.module, \"src/index.js\", \"index.js\", \"main.js\");\n // A bundle's manifest (or a symlink inside it) must not point the entry\n // outside pieceDir; realpath so a symlink can't launder the escape.\n const root = realpathSync(pieceDir);\n const rootWithSep = root + path.sep;\n for (const candidate of candidates) {\n if (!candidate) continue;\n const abs = path.resolve(pieceDir, candidate);\n let real: string;\n try {\n real = realpathSync(abs);\n } catch {\n continue; // candidate doesn't exist; try the next one\n }\n if (real !== root && !real.startsWith(rootWithSep)) continue;\n return abs;\n }\n throw new Error(`No entry file found for piece bundle at ${pieceDir}`);\n}\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return typeof value === \"object\" && value !== null;\n}\n\n// Identify the piece by constructor name (their own loader's check), falling\n// back to structure for bundles minified without keepNames. No `instanceof`.\nfunction findPiece(\n mod: Record<string, unknown>,\n): Pick<LoadedPiece, \"piece\" | \"check\"> | undefined {\n const candidates: unknown[] = [\n ...Object.values(mod),\n ...(isRecord(mod.default) ? Object.values(mod.default) : []),\n mod.default,\n ];\n for (const candidate of candidates) {\n // `constructor?.name`: a bundle may export an Object.create(null), and the\n // real piece is usually beside it in the same module.\n if (isRecord(candidate) && candidate.constructor?.name === \"Piece\") {\n return {\n piece: candidate as unknown as ApPiece,\n check: \"constructor-name\",\n };\n }\n }\n for (const candidate of candidates) {\n if (\n isRecord(candidate) &&\n typeof candidate.displayName === \"string\" &&\n (isRecord(candidate.actions) ||\n typeof candidate.actions === \"function\" ||\n typeof candidate.getAction === \"function\")\n ) {\n return { piece: candidate as unknown as ApPiece, check: \"structural\" };\n }\n }\n return undefined;\n}\n\n// A module the piece names and node cannot find. Dependencies are installed\n// with scripts disabled, so a native or downloaded one looks like this.\nfunction missingModule(entryPath: string, error: unknown): Error | undefined {\n const code = (error as { code?: unknown } | null)?.code;\n if (code !== \"ERR_MODULE_NOT_FOUND\" && code !== \"MODULE_NOT_FOUND\") {\n return undefined;\n }\n const detail = error instanceof Error ? error.message : String(error);\n return new Error(\n `Piece at ${entryPath} could not be loaded: it imports a module that is ` +\n `not there. Its dependencies are installed with lifecycle scripts ` +\n `disabled, so one that compiles or downloads on install -- a native ` +\n `addon, a browser download -- cannot be prepared here. ${detail}`,\n );\n}\n\n// ESM-first `import()` — Node's CJS interop handles the typical CJS bundle —\n// with a `require` fallback.\nexport async function loadPiece(entryPath: string): Promise<LoadedPiece> {\n let mod: Record<string, unknown>;\n try {\n mod = (await import(\n /* @vite-ignore */ pathToFileURL(entryPath).href\n )) as Record<string, unknown>;\n } catch (imported) {\n try {\n const require = createRequire(import.meta.url);\n mod = require(entryPath) as Record<string, unknown>;\n } catch (required) {\n // The import's error names the missing module; require's often names\n // only the entry it was handed.\n throw (\n missingModule(entryPath, imported) ??\n missingModule(entryPath, required) ??\n required\n );\n }\n }\n const found = findPiece(mod);\n if (!found) {\n throw new Error(\n `No Piece export found in ${entryPath}. Export keys: ${Object.keys(mod).join(\", \")}`,\n );\n }\n return { ...found, entryPath };\n}\n\nexport async function loadPieceFromDir(pieceDir: string): Promise<LoadedPiece> {\n return loadPiece(resolveEntry(pieceDir));\n}\n"],"mappings":";;;;;;AAeA,SAAgB,aAAa,UAA0B;CACrD,MAAM,MAAM,aAAa,KAAK,KAAK,UAAU,cAAc,GAAG,MAAM;CACpE,MAAM,MAAM,KAAK,MAAM,GAAG;CAK1B,MAAM,YAAY,IAAI,UAAU;CAChC,MAAM,aAAqC,CAAC;CAC5C,IAAI,OAAO,cAAc,UAAU,WAAW,KAAK,SAAS;CAC5D,IAAI,aAAa,OAAO,cAAc,UAAU;EAC9C,MAAM,OAAO;EACb,KAAK,MAAM,OAAO;GAAC;GAAU;GAAW;EAAS,GAAG;GAClD,MAAM,QAAQ,KAAK;GACnB,IAAI,OAAO,UAAU,UAAU,WAAW,KAAK,KAAK;EACtD;CACF;CACA,WAAW,KAAK,IAAI,MAAM,IAAI,QAAQ,gBAAgB,YAAY,SAAS;CAG3E,MAAM,OAAO,aAAa,QAAQ;CAClC,MAAM,cAAc,OAAO,KAAK;CAChC,KAAK,MAAM,aAAa,YAAY;EAClC,IAAI,CAAC,WAAW;EAChB,MAAM,MAAM,KAAK,QAAQ,UAAU,SAAS;EAC5C,IAAI;EACJ,IAAI;GACF,OAAO,aAAa,GAAG;EACzB,QAAQ;GACN;EACF;EACA,IAAI,SAAS,QAAQ,CAAC,KAAK,WAAW,WAAW,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