@powerhousedao/reactor-workflow 6.2.3-dev.39 → 6.2.3-dev.41
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/dist/index.d.ts.map +1 -1
- package/dist/index.js +24 -24
- package/dist/index.js.map +1 -1
- package/dist/{piece-registry-7bP8Hkhn.js → piece-registry-BhFf-Q2_.js} +3 -3
- package/dist/{piece-registry-7bP8Hkhn.js.map → piece-registry-BhFf-Q2_.js.map} +1 -1
- package/dist/piece-registry-Bt1Cd3ly.d.ts.map +1 -1
- package/dist/testing.js +1 -1
- package/package.json +6 -6
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { G as unsupportedTrigger, H as UnsupportedPieceFeatureError, S as maxFileBytes, U as authMethodFor, W as unsupportedAuth, a as redactMessage, c as DEFAULT_EGRESS_POLICY, d as parseAddress, m as extractDedupeKey, n as containsRedactedMarker, o as rememberSecrets, r as redact, s as secretsFor, u as isPrivateAddress, y as FileTooLargeError } from "./redact-DW7W5rrV.js";
|
|
2
|
-
import { A as resolveStepInput, B as PieceWorker, C as describeBuiltinPiece, E as BoundConnectionResolver, F as parseSecretRef, G as sourcedResolver, H as PieceWorkerTimeoutError, I as secretRefFromId, J as npmRegistryBaseUrl, L as stepBlock, N as SecretDeletedError, O as declaredConnectionIds, P as SecretNotFoundError, R as triggerBlock, S as builtinPiece, T as CORE_PIECE_VERSION, U as bundleResolver, V as PieceWorkerError, W as pieceModuleRef, X as setPieceRegistryUrl, Y as pieceRegistrySource, _ as servesReactorPort, a as runWorkflow, b as unpinnedNote, c as stepConfigHash, d as ActivepiecesBlockExecutor, f as CompositeBlockExecutor, g as resolvedBlock, h as reactorHandlers, i as packagePieces, j as expressionsIn, k as shapeConnection, l as DynamicPropertiesError, m as isHostBound, n as installedPiece, o as canonicalJson, p as REACTOR_PORT_PIECE, r as installedPieces, s as hashOf, t as PieceRegistry, u as checkDynamicProperties, v as storeHandlers, w as CORE_PIECE_NAME, x as blockPorts, y as blockLabel, z as PieceWorkerPool } from "./piece-registry-
|
|
2
|
+
import { A as resolveStepInput, B as PieceWorker, C as describeBuiltinPiece, E as BoundConnectionResolver, F as parseSecretRef, G as sourcedResolver, H as PieceWorkerTimeoutError, I as secretRefFromId, J as npmRegistryBaseUrl, L as stepBlock, N as SecretDeletedError, O as declaredConnectionIds, P as SecretNotFoundError, R as triggerBlock, S as builtinPiece, T as CORE_PIECE_VERSION, U as bundleResolver, V as PieceWorkerError, W as pieceModuleRef, X as setPieceRegistryUrl, Y as pieceRegistrySource, _ as servesReactorPort, a as runWorkflow, b as unpinnedNote, c as stepConfigHash, d as ActivepiecesBlockExecutor, f as CompositeBlockExecutor, g as resolvedBlock, h as reactorHandlers, i as packagePieces, j as expressionsIn, k as shapeConnection, l as DynamicPropertiesError, m as isHostBound, n as installedPiece, o as canonicalJson, p as REACTOR_PORT_PIECE, r as installedPieces, s as hashOf, t as PieceRegistry, u as checkDynamicProperties, v as storeHandlers, w as CORE_PIECE_NAME, x as blockPorts, y as blockLabel, z as PieceWorkerPool } from "./piece-registry-BhFf-Q2_.js";
|
|
3
3
|
import { WebhookHandshakeStrategy } from "@powerhousedao/pieces-framework";
|
|
4
4
|
import { mkdirSync, readFileSync, writeFileSync } from "node:fs";
|
|
5
5
|
import { open, readFile, rm } from "node:fs/promises";
|
|
@@ -819,10 +819,10 @@ async function publishedLists(suggestions, timeoutMs) {
|
|
|
819
819
|
const cloudUrl = suggestions ? `${CATALOG_URL}?suggestionType=ACTION_AND_TRIGGER` : CATALOG_URL;
|
|
820
820
|
const [fromRegistry, fromCloud] = await Promise.allSettled([source ? fetchRegistryCatalog(source.catalogUrl(suggestions), timeoutMs) : Promise.resolve([]), fetchJson(cloudUrl, timeoutMs)]);
|
|
821
821
|
const registry = fromRegistry.status === "fulfilled" ? asList(fromRegistry.value).filter((entry) => typeof entry.name === "string") : [];
|
|
822
|
-
if (fromRegistry.status === "rejected") logger$5.warn(
|
|
822
|
+
if (fromRegistry.status === "rejected") logger$5.warn("Piece registry @url did not answer: @error", source?.baseUrl ?? "?", String(fromRegistry.reason));
|
|
823
823
|
if (fromCloud.status === "rejected") {
|
|
824
824
|
if (registry.length === 0) throw asError(fromCloud.reason);
|
|
825
|
-
logger$5.warn(
|
|
825
|
+
logger$5.warn("Serving registry pieces only: @error", String(fromCloud.reason));
|
|
826
826
|
return {
|
|
827
827
|
registry,
|
|
828
828
|
cloud: []
|
|
@@ -1632,7 +1632,7 @@ function createPieceStorePort(store, workflowIdFor, sample = false, clock = Date
|
|
|
1632
1632
|
if (!isCursorRef(key) || isPlausibleCursor(value, now)) return store.setPieceStoreValue(scope, partition(scope), key, value);
|
|
1633
1633
|
const kept = await store.getPieceStoreValue(scope, partition(scope), key);
|
|
1634
1634
|
if (!isCursorShaped(value) && !isPlausibleCursor(kept, now)) return store.setPieceStoreValue(scope, partition(scope), key, value);
|
|
1635
|
-
logger$4.warn(`Rejected
|
|
1635
|
+
logger$4.warn(`Rejected @key=@value from workflow ${flowKey()}; keeping @kept`, key, showCursor(value), isPlausibleCursor(kept, now) ? String(kept) : "no cursor");
|
|
1636
1636
|
if (!isPlausibleCursor(kept, now)) await store.deletePieceStoreValue(scope, partition(scope), key);
|
|
1637
1637
|
},
|
|
1638
1638
|
delete: async (key, scope) => store.deletePieceStoreValue(scope, partition(scope), key)
|
|
@@ -7049,7 +7049,7 @@ function resolveProjectCollisions(pending) {
|
|
|
7049
7049
|
}
|
|
7050
7050
|
winner.set(entry.key, row.workflowId);
|
|
7051
7051
|
}
|
|
7052
|
-
for (const [key, workflows] of contested) logger$3.warn(`Project store key "
|
|
7052
|
+
for (const [key, workflows] of contested) logger$3.warn(`Project store key "@key" was written by ${workflows.join(", ")}; keeping the value last updated, from ${winner.get(key)}, and discarding the rest`, key);
|
|
7053
7053
|
return winner;
|
|
7054
7054
|
}
|
|
7055
7055
|
async function migrateOneRow(db, row, projectWinner) {
|
|
@@ -7678,7 +7678,7 @@ function intervalFromSchedules(schedules, defaultMs) {
|
|
|
7678
7678
|
const cron = schedule.cronExpression;
|
|
7679
7679
|
const intervalMs = cronIntervalMs(cron);
|
|
7680
7680
|
if (intervalMs === void 0) {
|
|
7681
|
-
logger$1.warn(
|
|
7681
|
+
logger$1.warn("Unsupported setSchedule cron \"@cron\"; using the default", cron);
|
|
7682
7682
|
return Math.max(defaultMs, MIN_INTERVAL_MS);
|
|
7683
7683
|
}
|
|
7684
7684
|
return intervalMs;
|
|
@@ -7801,7 +7801,7 @@ var TriggerSupervisor = class {
|
|
|
7801
7801
|
const hash = configHash(block, config);
|
|
7802
7802
|
const existing = await store.getTriggerState(workflowId);
|
|
7803
7803
|
if (existing?.status === "ENABLED" && existing.config_hash === hash) {
|
|
7804
|
-
logger$1.warn(`Workflow ${workflowId} could not be resolved, and its trigger row is left as it stands: a registration from before this reactor started is presumed live, and releasing it needs the binding that would not resolve.
|
|
7804
|
+
logger$1.warn(`Workflow ${workflowId} could not be resolved, and its trigger row is left as it stands: a registration from before this reactor started is presumed live, and releasing it needs the binding that would not resolve. @error`, message);
|
|
7805
7805
|
return;
|
|
7806
7806
|
}
|
|
7807
7807
|
await store.upsertTriggerState({
|
|
@@ -7985,7 +7985,7 @@ var TriggerSupervisor = class {
|
|
|
7985
7985
|
this.enabledOk.add(binding.workflowId);
|
|
7986
7986
|
this.enableRetries.delete(binding.workflowId);
|
|
7987
7987
|
store.clearUnmigratedTriggerState(binding.workflowId);
|
|
7988
|
-
logger$1.info(`Enabled
|
|
7988
|
+
logger$1.info(`Enabled @block for workflow ${binding.workflowId} (every ${intervalMs}ms)`, blockLabel(binding.block));
|
|
7989
7989
|
} catch (error) {
|
|
7990
7990
|
this.enabledOk.delete(binding.workflowId);
|
|
7991
7991
|
const message = error instanceof Error ? error.message : String(error);
|
|
@@ -8014,7 +8014,7 @@ var TriggerSupervisor = class {
|
|
|
8014
8014
|
updated_at: now.toISOString(),
|
|
8015
8015
|
...pieceColumns(binding)
|
|
8016
8016
|
});
|
|
8017
|
-
logger$1.error(`onEnable failed for workflow ${binding.workflowId} (${failures}x):
|
|
8017
|
+
logger$1.error(`onEnable failed for workflow ${binding.workflowId} (${failures}x): @error` + (retryAt ? `; retrying at ${retryAt.toISOString()}` : "; not retrying"), message);
|
|
8018
8018
|
}
|
|
8019
8019
|
}
|
|
8020
8020
|
renewAtAfterEnable(renew, existing, isRepublish, now) {
|
|
@@ -8090,7 +8090,7 @@ var TriggerSupervisor = class {
|
|
|
8090
8090
|
last_error: message,
|
|
8091
8091
|
consecutive_failures: (existing?.consecutive_failures ?? 0) + 1
|
|
8092
8092
|
});
|
|
8093
|
-
logger$1.error(`Invalid schedule for workflow ${binding.workflowId}:
|
|
8093
|
+
logger$1.error(`Invalid schedule for workflow ${binding.workflowId}: @error`, message);
|
|
8094
8094
|
}
|
|
8095
8095
|
}
|
|
8096
8096
|
async disable(workflowId, binding) {
|
|
@@ -8204,7 +8204,7 @@ var TriggerSupervisor = class {
|
|
|
8204
8204
|
const slot = renew ? nextRenewAt(renew, now).getTime() : backoff;
|
|
8205
8205
|
const retryAt = new Date(Math.min(backoff, slot));
|
|
8206
8206
|
await store.recordRenewFailure(row.workflow_id, message, now.toISOString(), retryAt.toISOString(), failures);
|
|
8207
|
-
logger$1.warn(`onRenew failed for workflow ${row.workflow_id} (${failures}x):
|
|
8207
|
+
logger$1.warn(`onRenew failed for workflow ${row.workflow_id} (${failures}x): @error; retrying at ${retryAt.toISOString()}`, message);
|
|
8208
8208
|
}
|
|
8209
8209
|
}
|
|
8210
8210
|
async fireSchedule(store, row, binding) {
|
|
@@ -8219,7 +8219,7 @@ var TriggerSupervisor = class {
|
|
|
8219
8219
|
const message = error instanceof Error ? error.message : String(error);
|
|
8220
8220
|
this.enabledOk.delete(binding.workflowId);
|
|
8221
8221
|
await store.setTriggerStatus(row.workflow_id, "ERROR", message);
|
|
8222
|
-
logger$1.error(`Schedule fire failed for workflow ${row.workflow_id}:
|
|
8222
|
+
logger$1.error(`Schedule fire failed for workflow ${row.workflow_id}: @error`, message);
|
|
8223
8223
|
}
|
|
8224
8224
|
}
|
|
8225
8225
|
async poll(store, row, binding) {
|
|
@@ -8236,7 +8236,7 @@ var TriggerSupervisor = class {
|
|
|
8236
8236
|
const failures = row.consecutive_failures + 1;
|
|
8237
8237
|
const backoff = backoffMs(row.interval_ms, failures);
|
|
8238
8238
|
await store.recordPollFailure(row.workflow_id, message, now.toISOString(), new Date(now.getTime() + backoff).toISOString(), failures);
|
|
8239
|
-
logger$1.warn(`Poll failed for workflow ${row.workflow_id} (${failures}x):
|
|
8239
|
+
logger$1.warn(`Poll failed for workflow ${row.workflow_id} (${failures}x): @error`, message);
|
|
8240
8240
|
}
|
|
8241
8241
|
}
|
|
8242
8242
|
async fireItem(store, binding, item, now) {
|
|
@@ -8898,7 +8898,7 @@ var WorkflowRuntimeService = class {
|
|
|
8898
8898
|
} catch (error) {
|
|
8899
8899
|
this.registry.delete(workflowId);
|
|
8900
8900
|
const message = error instanceof Error ? error.message : String(error);
|
|
8901
|
-
this.logger.error(`Webhook trigger rejected for ${workflowId}:
|
|
8901
|
+
this.logger.error(`Webhook trigger rejected for ${workflowId}: @error`, message);
|
|
8902
8902
|
this.unarmed.add(workflowId);
|
|
8903
8903
|
this.supervisor().reject(workflowId, block, configRecord(rawConfig), message).catch((recordError) => {
|
|
8904
8904
|
this.logger.error(`Could not record the rejected webhook trigger for workflow ${workflowId}`, recordError);
|
|
@@ -9451,7 +9451,7 @@ var WorkflowRuntimeService = class {
|
|
|
9451
9451
|
}
|
|
9452
9452
|
if (!run.ok) {
|
|
9453
9453
|
const message = run.error instanceof Error ? run.error.message : String(run.error);
|
|
9454
|
-
this.logger.error(`Webhook run failed for ${workflowId}:
|
|
9454
|
+
this.logger.error(`Webhook run failed for ${workflowId}: @error`, message);
|
|
9455
9455
|
return {
|
|
9456
9456
|
status: 500,
|
|
9457
9457
|
contentType: JSON_CONTENT_TYPE,
|
|
@@ -9503,7 +9503,7 @@ var WorkflowRuntimeService = class {
|
|
|
9503
9503
|
return await (await this.secrets()).get(config.secretRef);
|
|
9504
9504
|
} catch (error) {
|
|
9505
9505
|
const message = error instanceof Error ? error.message : String(error);
|
|
9506
|
-
this.logger.error(`Webhook secret unavailable for ${workflowId}:
|
|
9506
|
+
this.logger.error(`Webhook secret unavailable for ${workflowId}: @error`, message);
|
|
9507
9507
|
return;
|
|
9508
9508
|
}
|
|
9509
9509
|
}
|
|
@@ -9844,7 +9844,7 @@ var WorkflowRuntimeService = class {
|
|
|
9844
9844
|
descriptor: await this.pieceDescriptor(localTarget(piece))
|
|
9845
9845
|
};
|
|
9846
9846
|
} catch (error) {
|
|
9847
|
-
this.logger.warn(
|
|
9847
|
+
this.logger.warn("Could not describe the package piece \"@piece\": @error", piece.name, String(error));
|
|
9848
9848
|
return;
|
|
9849
9849
|
}
|
|
9850
9850
|
}))).filter((entry) => entry !== void 0);
|
|
@@ -9865,7 +9865,7 @@ var WorkflowRuntimeService = class {
|
|
|
9865
9865
|
published = await fetchPieceCatalog();
|
|
9866
9866
|
} catch (error) {
|
|
9867
9867
|
if (entries.length === 0) throw error;
|
|
9868
|
-
this.logger.warn(
|
|
9868
|
+
this.logger.warn("Serving package pieces only: @error", String(error));
|
|
9869
9869
|
published = [];
|
|
9870
9870
|
}
|
|
9871
9871
|
const publishedVersions = new Map(published.map((entry) => [entry.name, entry.version]));
|
|
@@ -9890,7 +9890,7 @@ var WorkflowRuntimeService = class {
|
|
|
9890
9890
|
try {
|
|
9891
9891
|
local = indexFromHits((await this.localPieces()).flatMap(({ piece, descriptor }) => localSearchHits(descriptor, piece.name, piece.version)));
|
|
9892
9892
|
} catch (error) {
|
|
9893
|
-
this.logger.warn(
|
|
9893
|
+
this.logger.warn("Could not index the package pieces: @error", String(error));
|
|
9894
9894
|
}
|
|
9895
9895
|
return searchBlocks(query, limit, local);
|
|
9896
9896
|
}
|
|
@@ -10264,7 +10264,7 @@ var WorkflowRuntimeService = class {
|
|
|
10264
10264
|
...record.error ? { error: record.error } : {}
|
|
10265
10265
|
});
|
|
10266
10266
|
} catch (error) {
|
|
10267
|
-
this.logger.warn(`Could not journal the test of "
|
|
10267
|
+
this.logger.warn(`Could not journal the test of "@step" on workflow ${workflowId}: @error`, record.key, error);
|
|
10268
10268
|
return;
|
|
10269
10269
|
}
|
|
10270
10270
|
await this.noteLastTest(workflowId, record, runId, record.endedAt ?? (/* @__PURE__ */ new Date()).toISOString());
|
|
@@ -10277,7 +10277,7 @@ var WorkflowRuntimeService = class {
|
|
|
10277
10277
|
testedAt
|
|
10278
10278
|
})]);
|
|
10279
10279
|
} catch (error) {
|
|
10280
|
-
this.logger.warn(`Could not record the last test of "
|
|
10280
|
+
this.logger.warn(`Could not record the last test of "@step" on workflow ${workflowId}: @error`, record.key, error);
|
|
10281
10281
|
}
|
|
10282
10282
|
}
|
|
10283
10283
|
blockExecutor(store) {
|
|
@@ -10357,7 +10357,7 @@ var WorkflowRuntimeService = class {
|
|
|
10357
10357
|
} catch (error) {
|
|
10358
10358
|
if (journalFailed) return;
|
|
10359
10359
|
journalFailed = true;
|
|
10360
|
-
this.logger.warn(`Run ${runId}: journaling step "
|
|
10360
|
+
this.logger.warn(`Run ${runId}: journaling step "@step" failed; the run continues without per-step durability: @error`, record.key, error);
|
|
10361
10361
|
}
|
|
10362
10362
|
} : void 0
|
|
10363
10363
|
}));
|
|
@@ -10465,7 +10465,7 @@ var WorkflowRuntimeService = class {
|
|
|
10465
10465
|
triggerKind: "test"
|
|
10466
10466
|
}) ?? null;
|
|
10467
10467
|
} catch (error) {
|
|
10468
|
-
this.logger.warn(`Could not journal the test of "
|
|
10468
|
+
this.logger.warn(`Could not journal the test of "@step" on workflow ${workflowId}: @error`, step.key, error);
|
|
10469
10469
|
}
|
|
10470
10470
|
const executor = this.blockExecutor(store);
|
|
10471
10471
|
const handed = /* @__PURE__ */ new Set();
|
|
@@ -10512,7 +10512,7 @@ var WorkflowRuntimeService = class {
|
|
|
10512
10512
|
try {
|
|
10513
10513
|
await store.finishRun(runId, result);
|
|
10514
10514
|
} catch (error) {
|
|
10515
|
-
this.logger.warn(`Run ${runId}: closing the test of "
|
|
10515
|
+
this.logger.warn(`Run ${runId}: closing the test of "@step" out failed: @error`, step.key, error);
|
|
10516
10516
|
}
|
|
10517
10517
|
await this.noteLastTest(workflowId, record, runId, record.endedAt ?? (/* @__PURE__ */ new Date()).toISOString());
|
|
10518
10518
|
}
|