@powerhousedao/reactor-workflow 6.2.3-dev.20 → 6.2.3-dev.21
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 +67 -16
- package/dist/{descriptor-4o1rTJKe.js → descriptor-Doax7KPd.js} +19 -5
- package/dist/descriptor-Doax7KPd.js.map +1 -0
- package/dist/index.d.ts +15 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +377 -58
- package/dist/index.js.map +1 -1
- package/dist/{piece-registry-DWTQoft_.d.ts → piece-registry-BH39cD-k.d.ts} +30 -9
- package/dist/piece-registry-BH39cD-k.d.ts.map +1 -0
- package/dist/{piece-registry-BU168FQf.js → piece-registry-lsGsY9fT.js} +177 -35
- package/dist/piece-registry-lsGsY9fT.js.map +1 -0
- package/dist/{redact-DCEJ-Imb.js → redact-ChAU8USo.js} +14 -10
- package/dist/redact-ChAU8USo.js.map +1 -0
- package/dist/testing.d.ts +1 -1
- package/dist/testing.js +3 -3
- package/dist/worker-entry.js +6 -3
- package/dist/worker-entry.js.map +1 -1
- package/package.json +6 -6
- package/dist/descriptor-4o1rTJKe.js.map +0 -1
- package/dist/piece-registry-BU168FQf.js.map +0 -1
- package/dist/piece-registry-DWTQoft_.d.ts.map +0 -1
- package/dist/redact-DCEJ-Imb.js.map +0 -1
|
@@ -16,6 +16,8 @@ type ApProperty = Partial<Pick<BasePropertySchema, "displayName" | "description"
|
|
|
16
16
|
};
|
|
17
17
|
type ApAction = Partial<Pick<ActionBase, "name" | "displayName" | "description" | "requireAuth">> & {
|
|
18
18
|
props?: Record<string, ApProperty>;
|
|
19
|
+
outputSchema?: unknown;
|
|
20
|
+
audience?: string;
|
|
19
21
|
run: (ctx: unknown) => Promise<unknown>;
|
|
20
22
|
};
|
|
21
23
|
type ApTriggerStrategy = string;
|
|
@@ -26,6 +28,7 @@ type ApTrigger = Partial<Pick<TriggerBase, "name" | "displayName" | "description
|
|
|
26
28
|
type?: ApTriggerStrategy;
|
|
27
29
|
testStrategy?: string;
|
|
28
30
|
props?: Record<string, ApProperty>;
|
|
31
|
+
outputSchema?: unknown;
|
|
29
32
|
handshakeConfiguration?: ApHandshakeConfiguration;
|
|
30
33
|
onEnable?: (ctx: unknown) => Promise<void>;
|
|
31
34
|
onDisable?: (ctx: unknown) => Promise<void>;
|
|
@@ -51,12 +54,16 @@ interface FetchPieceBundleOptions {
|
|
|
51
54
|
version: string;
|
|
52
55
|
cacheDir: string;
|
|
53
56
|
timeoutMs?: number;
|
|
57
|
+
entryUrl?: string;
|
|
58
|
+
installTimeoutMs?: number;
|
|
54
59
|
}
|
|
55
60
|
/** Where a bundle came from, "cache" being a copy one of the others left. */
|
|
56
|
-
type BundleSource = "registry" | "cdn" | "npm";
|
|
61
|
+
type BundleSource = "package" | "registry" | "cdn" | "npm";
|
|
57
62
|
interface FetchedBundle {
|
|
58
63
|
dir: string;
|
|
59
64
|
source: BundleSource | "cache";
|
|
65
|
+
dependencies: Record<string, string>;
|
|
66
|
+
installed: boolean;
|
|
60
67
|
}
|
|
61
68
|
declare function fetchPieceBundle(options: FetchPieceBundleOptions): Promise<FetchedBundle>;
|
|
62
69
|
declare function ensurePieceBundle(options: FetchPieceBundleOptions): Promise<FetchedBundle>;
|
|
@@ -90,6 +97,8 @@ interface PieceActionDescriptor {
|
|
|
90
97
|
description?: string;
|
|
91
98
|
requireAuth: boolean;
|
|
92
99
|
props: PiecePropDescriptor[];
|
|
100
|
+
outputSchema?: unknown;
|
|
101
|
+
audience?: string;
|
|
93
102
|
}
|
|
94
103
|
interface PieceTriggerDescriptor {
|
|
95
104
|
name: string;
|
|
@@ -99,7 +108,9 @@ interface PieceTriggerDescriptor {
|
|
|
99
108
|
testStrategy?: string;
|
|
100
109
|
requireAuth: boolean;
|
|
101
110
|
props: PiecePropDescriptor[];
|
|
111
|
+
outputSchema?: unknown;
|
|
102
112
|
hasSampleData: boolean;
|
|
113
|
+
sampleData?: unknown;
|
|
103
114
|
handshake?: {
|
|
104
115
|
strategy: string;
|
|
105
116
|
paramName?: string;
|
|
@@ -171,14 +182,15 @@ interface EgressPolicy {
|
|
|
171
182
|
allowPrivateAddresses?: boolean;
|
|
172
183
|
allowPorts?: number[];
|
|
173
184
|
}
|
|
174
|
-
interface
|
|
185
|
+
interface HostScopedRequest {
|
|
175
186
|
egress?: EgressPolicy;
|
|
187
|
+
maxFileBytes?: number;
|
|
176
188
|
}
|
|
177
189
|
interface PieceModuleRef {
|
|
178
190
|
bundleDir?: string;
|
|
179
191
|
entryPath?: string;
|
|
180
192
|
}
|
|
181
|
-
interface RunActionRequest extends
|
|
193
|
+
interface RunActionRequest extends HostScopedRequest, PieceModuleRef {
|
|
182
194
|
actionName: string;
|
|
183
195
|
propsValue: Record<string, unknown>;
|
|
184
196
|
auth?: unknown;
|
|
@@ -194,7 +206,7 @@ interface RunActionRequest extends EgressScopedRequest, PieceModuleRef {
|
|
|
194
206
|
redactValues?: string[];
|
|
195
207
|
reactorAccess?: boolean;
|
|
196
208
|
}
|
|
197
|
-
interface ResolveOptionsRequest extends
|
|
209
|
+
interface ResolveOptionsRequest extends HostScopedRequest, PieceModuleRef {
|
|
198
210
|
actionName: string;
|
|
199
211
|
kind?: "action" | "trigger";
|
|
200
212
|
propName: string;
|
|
@@ -203,7 +215,7 @@ interface ResolveOptionsRequest extends EgressScopedRequest, PieceModuleRef {
|
|
|
203
215
|
searchValue?: string;
|
|
204
216
|
reactorAccess?: boolean;
|
|
205
217
|
}
|
|
206
|
-
interface TriggerHookRequest extends
|
|
218
|
+
interface TriggerHookRequest extends HostScopedRequest, PieceModuleRef {
|
|
207
219
|
triggerName: string;
|
|
208
220
|
hook: "onEnable" | "onDisable" | "run" | "test" | "onHandshake";
|
|
209
221
|
propsValue: Record<string, unknown>;
|
|
@@ -217,10 +229,10 @@ interface TriggerHookRequest extends EgressScopedRequest, PieceModuleRef {
|
|
|
217
229
|
server?: ServerContext;
|
|
218
230
|
redactValues?: string[];
|
|
219
231
|
}
|
|
220
|
-
interface CheckConnectionRequest extends
|
|
232
|
+
interface CheckConnectionRequest extends HostScopedRequest, PieceModuleRef {
|
|
221
233
|
auth?: unknown;
|
|
222
234
|
}
|
|
223
|
-
interface DescribePieceRequest extends
|
|
235
|
+
interface DescribePieceRequest extends HostScopedRequest, PieceModuleRef {
|
|
224
236
|
packageName: string;
|
|
225
237
|
version: string;
|
|
226
238
|
}
|
|
@@ -239,13 +251,14 @@ interface ResolvedPiece extends PieceModuleRef {
|
|
|
239
251
|
local: boolean;
|
|
240
252
|
}
|
|
241
253
|
interface PieceResolver {
|
|
242
|
-
resolve(name: string, version: string): Promise<ResolvedPiece>;
|
|
254
|
+
resolve(name: string, version: string, entryUrl?: string): Promise<ResolvedPiece>;
|
|
243
255
|
}
|
|
244
256
|
interface LocalPiece {
|
|
245
257
|
name: string;
|
|
246
258
|
version: string;
|
|
247
259
|
entryPath?: string;
|
|
248
260
|
bundleDir?: string;
|
|
261
|
+
entryUrl?: string;
|
|
249
262
|
}
|
|
250
263
|
type LocalPieceLookup = (name: string) => LocalPiece | undefined | Promise<LocalPiece | undefined>;
|
|
251
264
|
declare function localFirstResolver(lookup: LocalPieceLookup, fallback: PieceResolver): PieceResolver;
|
|
@@ -536,6 +549,7 @@ type ReactorPort = ReactorService;
|
|
|
536
549
|
interface ActivepiecesBlockExecutorOptions {
|
|
537
550
|
cacheDir: string;
|
|
538
551
|
packages?: Record<string, string> | (() => Record<string, string> | Promise<Record<string, string>>);
|
|
552
|
+
resolveBlockType?: (blockType: string) => Promise<ParsedBlockType | undefined>;
|
|
539
553
|
connections?: EngineConnectionResolver;
|
|
540
554
|
worker?: IPieceWorker | (() => IPieceWorker | undefined);
|
|
541
555
|
defaultTimeoutMs?: number;
|
|
@@ -548,6 +562,13 @@ interface ActivepiecesBlockExecutorOptions {
|
|
|
548
562
|
onPieceLog?: (entry: PieceLogEntry, execution: BlockExecution) => void;
|
|
549
563
|
onPartialOutput?: (output: unknown, execution: BlockExecution) => void;
|
|
550
564
|
}
|
|
565
|
+
type BlockKind = "action" | "trigger";
|
|
566
|
+
interface ParsedBlockType {
|
|
567
|
+
packageName: string;
|
|
568
|
+
version: string;
|
|
569
|
+
kind: BlockKind;
|
|
570
|
+
name: string;
|
|
571
|
+
}
|
|
551
572
|
declare class ActivepiecesBlockExecutor implements BlockExecutor {
|
|
552
573
|
private readonly options;
|
|
553
574
|
private own;
|
|
@@ -595,4 +616,4 @@ declare class PieceRegistry {
|
|
|
595
616
|
declare const packagePieces: PieceRegistry;
|
|
596
617
|
//#endregion
|
|
597
618
|
export { fetchPieceBundle as A, EgressPolicy as C, buildDescriptor as D, PieceDescriptor as E, loadPieceFromDir as O, localFirstResolver as S, extractDedupeKey as T, PieceWorker as _, AttachmentPort as a, PackagePiece as b, ConnectionRequest as c, SecretStore as d, BlockExecution as f, IPieceWorker as g, PieceWorkerPool as h, ActivepiecesBlockExecutor as i, ensurePieceBundle as k, StaticConnectionResolver as l, WorkflowRunResult as m, packagePieces as n, CompositeBlockExecutor as o, StepExecutionRecord as p, runWorkflow as r, ReactorPort as s, PieceRegistry as t, InMemorySecretProvider as u, PieceWorkerResult as v, RecordedSchedule as w, PieceResolver as x, LocalPiece as y };
|
|
598
|
-
//# sourceMappingURL=piece-registry-
|
|
619
|
+
//# sourceMappingURL=piece-registry-BH39cD-k.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"piece-registry-BH39cD-k.d.ts","names":[],"sources":["../src/pieces/activepieces/types.ts","../src/pieces/activepieces/fetch.ts","../src/pieces/activepieces/loader.ts","../src/pieces/activepieces/descriptor.ts","../src/pieces/activepieces/context/store-scope.ts","../src/pieces/activepieces/context/files.ts","../src/pieces/activepieces/context/action.ts","../src/pieces/activepieces/context/trigger.ts","../src/pieces/activepieces/worker/protocol.ts","../src/pieces/activepieces/resolver.ts","../src/pieces/activepieces/worker/transport.ts","../src/pieces/activepieces/worker/host.ts","../src/pieces/activepieces/worker/pool.ts","../src/pieces/engine/types.ts","../src/pieces/engine/secrets.ts","../src/pieces/engine/connections.ts","../src/pieces/engine/blocks.ts","../src/pieces/engine/coordinator.ts","../src/reactor/piece-registry.ts"],"mappings":";;;KAiBY,cAAA;AAAA,KAEA,gBAAA,GAAmB,IAAA,CAAK,cAAA;AAAA,KAGxB,qBAAA,GAAwB,IAAA,CAClC,aAAA;EAEI,OAAA,EAAS,gBAAA;AAAA;AAAA,KAIH,UAAA,GAAa,OAAA,CACvB,IAAA,CAAK,kBAAA,oDAEL,OAAA,CAAQ,IAAA,CAAK,gBAAA;EACX,IAAA,GAAO,cAAA;EACP,QAAA;EACA,YAAA;EACA,OAAA,GAAU,qBAAA,QAA6B,IAAA;EAEvC,KAAA,OAAY,IAAA;EAEZ,UAAA,GAAa,MAAA,SAAe,UAAA;AAAA;AAAA,KAIpB,QAAA,GAAW,OAAA,CACrB,IAAA,CAAK,UAAA;EAEL,KAAA,GAAQ,MAAA,SAAe,UAAA;EAGvB,YAAA;EAEA,QAAA;EACA,GAAA,GAAM,GAAA,cAAiB,OAAA;AAAA;AAAA,KAKb,iBAAA;AAAA,KAIA,wBAAA,GAA2B,OAAA,CACrC,IAAA,CAAK,6BAAA;EACD,QAAA;AAAA;AAAA,KAEM,SAAA,GAAY,OAAA,CACtB,IAAA,CACE,WAAA;EAIF,IAAA,GAAO,iBAAA;EAEP,YAAA;EACA,KAAA,GAAQ,MAAA,SAAe,UAAA;EACvB,YAAA;EACA,sBAAA,GAAyB,wBAAA;EACzB,QAAA,IAAY,GAAA,cAAiB,OAAA;EAC7B,SAAA,IAAa,GAAA,cAAiB,OAAA;EAC9B,OAAA,IAAW,GAAA,cAAiB,OAAA;EAC5B,GAAA,IAAO,GAAA,cAAiB,OAAA;EACxB,IAAA,IAAQ,GAAA,cAAiB,OAAA;EACzB,WAAA,IAAe,GAAA,cAAiB,OAAA;EAChC,OAAA,IAAW,GAAA,cAAiB,OAAA;AAAA;AAAA,KAKlB,OAAA,GAAU,IAAA,CAA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A;AAAA;AAAA,iBAgBQ,WAAA,CACpB,OAAA,EAAS,kBAAA,GACR,OAAA,CAAQ,iBAAA;;;cC1CE,aAAA;EAAA,QACH,MAAA;EAIR,SAAA,CAAU,MAAA,WAAiB,UAAA;EA8B3B,MAAA,GAAU,IAAA,aAAe,UAAA;EAEzB,OAAA,CAAA,GAAW,UAAA;EAMX,QAAA,CAAA,GAAY,MAAA;ElBnCY;EkB0CxB,KAAA,CAAA;AAAA;AAAA,cAMW,aAAA,EAAa,aAAA"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { A as
|
|
1
|
+
import { A as REACTOR_FIND, D as OUTPUT_UPDATE, E as LOG_WRITE, F as STORE_GET, I as STORE_PUT, M as REACTOR_MODEL, N as REACTOR_MODELS, O as REACTOR_CREATE, P as STORE_DELETE, T as jsonSafe, a as redactMessage, c as DEFAULT_EGRESS_POLICY, g as rewriteFileRefs, i as redactError, j as REACTOR_GET, k as REACTOR_EXECUTE, n as containsRedactedMarker, o as rememberSecrets, r as redact, s as secretsFor, t as collectSecretValues, y as configuredMaxFileBytes } from "./redact-ChAU8USo.js";
|
|
2
2
|
import { AppConnectionType } from "@powerhousedao/pieces-framework";
|
|
3
|
+
import { execFile, fork } from "node:child_process";
|
|
3
4
|
import { existsSync } from "node:fs";
|
|
4
5
|
import { mkdir, readFile, rename, rm, writeFile } from "node:fs/promises";
|
|
5
6
|
import path from "node:path";
|
|
@@ -8,7 +9,6 @@ import { gunzip } from "node:zlib";
|
|
|
8
9
|
import { childLogger } from "document-model";
|
|
9
10
|
import { fileURLToPath } from "node:url";
|
|
10
11
|
import { randomUUID } from "node:crypto";
|
|
11
|
-
import { fork } from "node:child_process";
|
|
12
12
|
//#region src/pieces/activepieces/registry-source.ts
|
|
13
13
|
const logger$2 = childLogger(["workflow", "piece-registry"]);
|
|
14
14
|
function source(baseUrl) {
|
|
@@ -140,25 +140,45 @@ async function downloadTarball(name, version, timeoutMs) {
|
|
|
140
140
|
}
|
|
141
141
|
throw new Error(`Failed to fetch piece bundle ${name}@${version}: ${String(lastError)}`);
|
|
142
142
|
}
|
|
143
|
+
async function extractDownloadedTarball(name, version, timeoutMs, staging) {
|
|
144
|
+
const { tgz, source } = await downloadTarball(name, version, timeoutMs);
|
|
145
|
+
await extractTarball(tgz, staging);
|
|
146
|
+
return source;
|
|
147
|
+
}
|
|
148
|
+
async function downloadPackagePiece(entryUrl, staging, timeoutMs) {
|
|
149
|
+
const base = entryUrl.slice(0, entryUrl.lastIndexOf("/") + 1);
|
|
150
|
+
const fetchInto = async (url, name) => {
|
|
151
|
+
const response = await fetch(url, { signal: AbortSignal.timeout(timeoutMs) });
|
|
152
|
+
if (!response.ok) throw new Error(`${url} responded ${response.status}`);
|
|
153
|
+
const body = await readBoundedBody(response, url);
|
|
154
|
+
await writeFile(path.join(staging, name), body);
|
|
155
|
+
return body;
|
|
156
|
+
};
|
|
157
|
+
await mkdir(staging, { recursive: true });
|
|
158
|
+
const manifest = await fetchInto(`${base}package.json`, "package.json");
|
|
159
|
+
const main = JSON.parse(manifest.toString("utf8")).main;
|
|
160
|
+
const entry = typeof main === "string" && main !== "" ? main : entryUrl.slice(base.length);
|
|
161
|
+
if (entry.includes("/") || entry.includes("\\") || entry.startsWith(".")) throw new Error(`Piece manifest at ${base} names an unusable main: ${entry}`);
|
|
162
|
+
await fetchInto(`${base}${entry}`, entry);
|
|
163
|
+
return "package";
|
|
164
|
+
}
|
|
143
165
|
async function fetchPieceBundle(options) {
|
|
144
166
|
const { name, version, cacheDir, timeoutMs = 3e4 } = options;
|
|
145
167
|
assertValidPackageCoordinate(name, version);
|
|
146
168
|
const dir = path.join(cacheDir, `${name.replace("/", "-")}-${version}`);
|
|
147
169
|
assertWithinCacheDir(dir, cacheDir);
|
|
148
|
-
if (existsSync(path.join(dir, "package.json"))) {
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
}
|
|
155
|
-
const { tgz, source } = await downloadTarball(name, version, timeoutMs);
|
|
170
|
+
if (existsSync(path.join(dir, "package.json"))) return {
|
|
171
|
+
dir,
|
|
172
|
+
source: "cache",
|
|
173
|
+
dependencies: await readDependencies(dir),
|
|
174
|
+
installed: false
|
|
175
|
+
};
|
|
156
176
|
const staging = `${dir}.tmp-${process.pid}`;
|
|
157
177
|
await rm(staging, {
|
|
158
178
|
recursive: true,
|
|
159
179
|
force: true
|
|
160
180
|
});
|
|
161
|
-
await
|
|
181
|
+
const source = options.entryUrl ? await downloadPackagePiece(options.entryUrl, staging, timeoutMs) : await extractDownloadedTarball(name, version, timeoutMs, staging);
|
|
162
182
|
await rm(dir, {
|
|
163
183
|
recursive: true,
|
|
164
184
|
force: true
|
|
@@ -172,10 +192,11 @@ async function fetchPieceBundle(options) {
|
|
|
172
192
|
});
|
|
173
193
|
if (!existsSync(path.join(dir, "package.json"))) throw error;
|
|
174
194
|
}
|
|
175
|
-
await assertSelfContained(dir, name, version);
|
|
176
195
|
return {
|
|
177
196
|
dir,
|
|
178
|
-
source
|
|
197
|
+
source,
|
|
198
|
+
dependencies: await readDependencies(dir),
|
|
199
|
+
installed: false
|
|
179
200
|
};
|
|
180
201
|
}
|
|
181
202
|
const inFlight = /* @__PURE__ */ new Map();
|
|
@@ -183,21 +204,113 @@ async function ensurePieceBundle(options) {
|
|
|
183
204
|
const key = `${options.cacheDir}\u0000${options.name}@${options.version}`;
|
|
184
205
|
const pending = inFlight.get(key);
|
|
185
206
|
if (pending) return pending;
|
|
186
|
-
const started =
|
|
207
|
+
const started = resolveBundle(options).finally(() => inFlight.delete(key));
|
|
187
208
|
inFlight.set(key, started);
|
|
188
209
|
return started;
|
|
189
210
|
}
|
|
190
|
-
|
|
211
|
+
async function resolveBundle(options) {
|
|
212
|
+
const fetched = await fetchPieceBundle(options);
|
|
213
|
+
if (Object.keys(fetched.dependencies).length === 0) return fetched;
|
|
214
|
+
return installPieceBundle(options, fetched);
|
|
215
|
+
}
|
|
216
|
+
async function installPieceBundle(options, fetched) {
|
|
217
|
+
const { name, version, cacheDir } = options;
|
|
218
|
+
const timeoutMs = options.installTimeoutMs ?? INSTALL_TIMEOUT_MS;
|
|
219
|
+
const workspace = path.join(cacheDir, `${name.replace("/", "-")}-${version}.install`);
|
|
220
|
+
assertWithinCacheDir(workspace, cacheDir);
|
|
221
|
+
const dir = path.join(workspace, "node_modules", name);
|
|
222
|
+
if (existsSync(path.join(workspace, INSTALL_READY_MARKER)) && existsSync(path.join(dir, "package.json"))) return {
|
|
223
|
+
dir,
|
|
224
|
+
source: "cache",
|
|
225
|
+
dependencies: fetched.dependencies,
|
|
226
|
+
installed: true
|
|
227
|
+
};
|
|
228
|
+
try {
|
|
229
|
+
await stageInstallWorkspace(workspace, options);
|
|
230
|
+
await runInstall(workspace, timeoutMs);
|
|
231
|
+
await writeFile(path.join(workspace, INSTALL_READY_MARKER), "true");
|
|
232
|
+
} catch (error) {
|
|
233
|
+
await rm(workspace, {
|
|
234
|
+
recursive: true,
|
|
235
|
+
force: true
|
|
236
|
+
}).catch(() => void 0);
|
|
237
|
+
throw notInstallable(name, version, fetched.dependencies, error);
|
|
238
|
+
}
|
|
239
|
+
return {
|
|
240
|
+
dir,
|
|
241
|
+
source: fetched.source,
|
|
242
|
+
dependencies: fetched.dependencies,
|
|
243
|
+
installed: true
|
|
244
|
+
};
|
|
245
|
+
}
|
|
246
|
+
async function stageInstallWorkspace(workspace, options) {
|
|
247
|
+
const { tgz } = await downloadTarball(options.name, options.version, options.timeoutMs ?? 3e4);
|
|
248
|
+
await rm(workspace, {
|
|
249
|
+
recursive: true,
|
|
250
|
+
force: true
|
|
251
|
+
});
|
|
252
|
+
await mkdir(workspace, { recursive: true });
|
|
253
|
+
await writeFile(path.join(workspace, "bundle.tgz"), tgz);
|
|
254
|
+
await writeFile(path.join(workspace, "package.json"), JSON.stringify({
|
|
255
|
+
name: "piece-workspace",
|
|
256
|
+
version: "1.0.0",
|
|
257
|
+
private: true,
|
|
258
|
+
dependencies: { [options.name]: "file:./bundle.tgz" }
|
|
259
|
+
}));
|
|
260
|
+
}
|
|
191
261
|
const MAX_LISTED_DEPENDENCIES = 5;
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
262
|
+
const INSTALL_READY_MARKER = "ready";
|
|
263
|
+
const INSTALL_TIMEOUT_MS = Number(process.env.PH_WORKFLOWS_PIECE_INSTALL_TIMEOUT_MS) || 12e4;
|
|
264
|
+
function installCommand() {
|
|
265
|
+
const windows = process.platform === "win32";
|
|
266
|
+
return {
|
|
267
|
+
file: windows ? "npm.cmd" : "npm",
|
|
268
|
+
args: [
|
|
269
|
+
"install",
|
|
270
|
+
"--ignore-scripts",
|
|
271
|
+
"--no-audit",
|
|
272
|
+
"--no-fund",
|
|
273
|
+
"--omit=dev",
|
|
274
|
+
"--loglevel=error"
|
|
275
|
+
],
|
|
276
|
+
shell: windows
|
|
277
|
+
};
|
|
278
|
+
}
|
|
279
|
+
async function runInstall(cwd, timeoutMs) {
|
|
280
|
+
const { file, args, shell } = installCommand();
|
|
281
|
+
await new Promise((resolve, reject) => {
|
|
282
|
+
execFile(file, args, {
|
|
283
|
+
cwd,
|
|
284
|
+
timeout: timeoutMs,
|
|
285
|
+
shell,
|
|
286
|
+
windowsHide: true
|
|
287
|
+
}, (error, _stdout, stderr) => {
|
|
288
|
+
if (!error) return resolve();
|
|
289
|
+
const killed = error.killed === true;
|
|
290
|
+
const reported = stderr.split("\n").filter((line) => !line.includes("A complete log of this run")).join("\n").trim();
|
|
291
|
+
reject(new Error(killed ? `timed out after ${timeoutMs}ms` : reported || error.message));
|
|
292
|
+
});
|
|
293
|
+
});
|
|
294
|
+
}
|
|
295
|
+
var PieceNotInstallableError = class extends Error {
|
|
296
|
+
constructor(packageName, version, dependencies, cause) {
|
|
297
|
+
const declared = Object.keys(dependencies);
|
|
298
|
+
const listed = declared.slice(0, MAX_LISTED_DEPENDENCIES).map((dep) => `${dep}@${dependencies[dep]}`);
|
|
299
|
+
const rest = declared.length - listed.length;
|
|
300
|
+
const count = declared.length === 1 ? "a dependency" : `${declared.length} dependencies`;
|
|
301
|
+
super(`Piece bundle ${packageName}@${version} carries ${count} it does not bundle (${listed.join(", ")}${rest > 0 ? `, and ${rest} more` : ""}), and installing them here failed: ${reasonOf(cause)}. The install runs once per version, with lifecycle scripts disabled, so a dependency that builds or downloads on install cannot be prepared this way. Check that this reactor can reach an npm registry, or run a piece whose bundle inlines what it needs.`);
|
|
302
|
+
this.packageName = packageName;
|
|
303
|
+
this.version = version;
|
|
304
|
+
this.dependencies = dependencies;
|
|
305
|
+
this.cause = cause;
|
|
306
|
+
this.name = "PieceNotInstallableError";
|
|
307
|
+
}
|
|
308
|
+
};
|
|
309
|
+
function reasonOf(cause) {
|
|
310
|
+
return cause instanceof Error ? cause.message : String(cause);
|
|
311
|
+
}
|
|
312
|
+
function notInstallable(name, version, dependencies, cause) {
|
|
313
|
+
return new PieceNotInstallableError(name, version, dependencies, cause);
|
|
201
314
|
}
|
|
202
315
|
async function readDependencies(dir) {
|
|
203
316
|
const raw = await readFile(path.join(dir, "package.json"), "utf8");
|
|
@@ -206,7 +319,7 @@ async function readDependencies(dir) {
|
|
|
206
319
|
//#endregion
|
|
207
320
|
//#region src/pieces/activepieces/resolver.ts
|
|
208
321
|
function bundleResolver(options) {
|
|
209
|
-
return { async resolve(name, version) {
|
|
322
|
+
return { async resolve(name, version, entryUrl) {
|
|
210
323
|
return {
|
|
211
324
|
name,
|
|
212
325
|
version,
|
|
@@ -214,6 +327,7 @@ function bundleResolver(options) {
|
|
|
214
327
|
name,
|
|
215
328
|
version,
|
|
216
329
|
cacheDir: options.cacheDir,
|
|
330
|
+
...entryUrl ? { entryUrl } : {},
|
|
217
331
|
...options.timeoutMs ? { timeoutMs: options.timeoutMs } : {}
|
|
218
332
|
})).dir,
|
|
219
333
|
local: false
|
|
@@ -224,6 +338,7 @@ function localFirstResolver(lookup, fallback) {
|
|
|
224
338
|
return { async resolve(name, version) {
|
|
225
339
|
const local = await lookup(name);
|
|
226
340
|
if (!local) return fallback.resolve(name, version);
|
|
341
|
+
if (!local.entryPath && !local.bundleDir && local.entryUrl) return fallback.resolve(name, local.version, local.entryUrl);
|
|
227
342
|
return {
|
|
228
343
|
name,
|
|
229
344
|
version: local.version,
|
|
@@ -422,7 +537,10 @@ var PieceWorker = class {
|
|
|
422
537
|
worker.send(jsonSafe({
|
|
423
538
|
id,
|
|
424
539
|
type,
|
|
425
|
-
request
|
|
540
|
+
request: {
|
|
541
|
+
maxFileBytes: configuredMaxFileBytes(),
|
|
542
|
+
...request
|
|
543
|
+
}
|
|
426
544
|
}));
|
|
427
545
|
});
|
|
428
546
|
}
|
|
@@ -976,8 +1094,12 @@ function redactThrown(error, values) {
|
|
|
976
1094
|
}
|
|
977
1095
|
return rememberSecrets(redactError(error, { values }), values);
|
|
978
1096
|
}
|
|
1097
|
+
const REACTOR_PORT_PIECE = "@powerhousedao/piece-reactor";
|
|
1098
|
+
function servesReactorPort(packageName) {
|
|
1099
|
+
return packageName === REACTOR_PORT_PIECE;
|
|
1100
|
+
}
|
|
979
1101
|
const TRIGGER_FRAGMENT = "trigger:";
|
|
980
|
-
function
|
|
1102
|
+
function blockTypeParts(blockType) {
|
|
981
1103
|
const separator = blockType.lastIndexOf("#");
|
|
982
1104
|
if (separator <= 0) return void 0;
|
|
983
1105
|
const packageSpec = blockType.slice(0, separator);
|
|
@@ -993,10 +1115,26 @@ function parseBlockType(blockType, packages = {}) {
|
|
|
993
1115
|
kind,
|
|
994
1116
|
name
|
|
995
1117
|
};
|
|
996
|
-
const version = packages[packageSpec];
|
|
997
|
-
if (!version) return void 0;
|
|
998
1118
|
return {
|
|
999
1119
|
packageName: packageSpec,
|
|
1120
|
+
kind,
|
|
1121
|
+
name
|
|
1122
|
+
};
|
|
1123
|
+
}
|
|
1124
|
+
function parseBlockType(blockType, packages = {}) {
|
|
1125
|
+
const parts = blockTypeParts(blockType);
|
|
1126
|
+
if (!parts) return void 0;
|
|
1127
|
+
const { packageName, kind, name } = parts;
|
|
1128
|
+
if (parts.version !== void 0) return {
|
|
1129
|
+
packageName,
|
|
1130
|
+
version: parts.version,
|
|
1131
|
+
kind,
|
|
1132
|
+
name
|
|
1133
|
+
};
|
|
1134
|
+
const version = packages[packageName];
|
|
1135
|
+
if (!version) return void 0;
|
|
1136
|
+
return {
|
|
1137
|
+
packageName,
|
|
1000
1138
|
version,
|
|
1001
1139
|
kind,
|
|
1002
1140
|
name
|
|
@@ -1022,7 +1160,7 @@ var ActivepiecesBlockExecutor = class {
|
|
|
1022
1160
|
return Promise.resolve(typeof supplied === "function" ? supplied() : supplied ?? {});
|
|
1023
1161
|
}
|
|
1024
1162
|
async execute(execution) {
|
|
1025
|
-
const parsed = parseBlockType(execution.blockType, await this.packages());
|
|
1163
|
+
const parsed = parseBlockType(execution.blockType, await this.packages()) ?? await this.options.resolveBlockType?.(execution.blockType);
|
|
1026
1164
|
if (!parsed) throw new UnknownBlockTypeError(execution.blockType);
|
|
1027
1165
|
if (parsed.kind !== "action") throw new TriggerBlockAsStepError(execution.blockType);
|
|
1028
1166
|
const stagingDir = this.options.stagingRoot ? path.join(this.options.stagingRoot, randomUUID()) : void 0;
|
|
@@ -1042,7 +1180,7 @@ var ActivepiecesBlockExecutor = class {
|
|
|
1042
1180
|
const pieceStore = this.options.pieceStore;
|
|
1043
1181
|
const notifications = stepTaps(this.options, execution, redactValues);
|
|
1044
1182
|
const egress = this.options.egress === void 0 ? DEFAULT_EGRESS_POLICY : this.options.egress;
|
|
1045
|
-
const reactor =
|
|
1183
|
+
const reactor = servesReactorPort(parsed.packageName) ? this.options.reactor : void 0;
|
|
1046
1184
|
const result = await this.worker().runAction({
|
|
1047
1185
|
...pieceModuleRef(piece),
|
|
1048
1186
|
actionName: parsed.name,
|
|
@@ -1302,8 +1440,12 @@ var PieceRegistry = class {
|
|
|
1302
1440
|
for (const piece of pieces) if (!found.has(piece.name)) found.set(piece.name, piece);
|
|
1303
1441
|
this.byName = found;
|
|
1304
1442
|
const names = [...found.keys()].join(", ");
|
|
1305
|
-
|
|
1306
|
-
|
|
1443
|
+
const held = [...found.values()].filter((piece) => piece.entryPath ?? piece.bundleDir).length;
|
|
1444
|
+
const served = found.size - held;
|
|
1445
|
+
if (found.size > 0) {
|
|
1446
|
+
const what = served === 0 ? `${held} package piece(s) on disk` : held === 0 ? `${served} package piece(s), fetched when first run` : `${held} on disk and ${served} fetched when first run`;
|
|
1447
|
+
logger.info(`Holding ${what}: @names`, names);
|
|
1448
|
+
} else logger.debug("Holding no package pieces");
|
|
1307
1449
|
}
|
|
1308
1450
|
lookup = (name) => this.byName.get(name);
|
|
1309
1451
|
entries() {
|
|
@@ -1319,6 +1461,6 @@ var PieceRegistry = class {
|
|
|
1319
1461
|
};
|
|
1320
1462
|
const packagePieces = new PieceRegistry();
|
|
1321
1463
|
//#endregion
|
|
1322
|
-
export {
|
|
1464
|
+
export { setPieceRegistryUrl as A, PieceWorkerError as C, ensurePieceBundle as D, pieceModuleRef as E, fetchPieceBundle as O, PieceWorker as S, localFirstResolver as T, SecretDeletedError as _, CompositeBlockExecutor as a, secretRefFromId as b, parseBlockType as c, storeHandlers as d, BoundConnectionResolver as f, InMemorySecretProvider as g, shapeConnection as h, ActivepiecesBlockExecutor as i, pieceRegistrySource as k, reactorHandlers as l, declaredConnectionIds as m, packagePieces as n, REACTOR_PORT_PIECE as o, StaticConnectionResolver as p, runWorkflow as r, blockTypeParts as s, PieceRegistry as t, servesReactorPort as u, SecretNotFoundError as v, PieceWorkerTimeoutError as w, PieceWorkerPool as x, parseSecretRef as y };
|
|
1323
1465
|
|
|
1324
|
-
//# sourceMappingURL=piece-registry-
|
|
1466
|
+
//# sourceMappingURL=piece-registry-lsGsY9fT.js.map
|