@powerhousedao/reactor-workflow 6.2.3-dev.23 → 6.2.3-dev.24
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 +106 -0
- package/dist/{descriptor-Doax7KPd.js → descriptor-E4swpRpd.js} +10 -4
- package/dist/descriptor-E4swpRpd.js.map +1 -0
- package/dist/index.d.ts +5 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +99 -82
- package/dist/index.js.map +1 -1
- package/dist/{piece-registry-lsGsY9fT.js → piece-registry-CYXV_aEv.js} +6 -2
- package/dist/piece-registry-CYXV_aEv.js.map +1 -0
- package/dist/{piece-registry-BH39cD-k.d.ts → piece-registry-q4bgYbXa.d.ts} +17 -2
- package/dist/piece-registry-q4bgYbXa.d.ts.map +1 -0
- package/dist/{redact-ChAU8USo.js → redact-C2y8tU--.js} +37 -2
- package/dist/redact-C2y8tU--.js.map +1 -0
- package/dist/testing.d.ts +1 -1
- package/dist/testing.js +3 -3
- package/dist/worker-entry.js +114 -31
- package/dist/worker-entry.js.map +1 -1
- package/package.json +7 -7
- package/dist/descriptor-Doax7KPd.js.map +0 -1
- package/dist/piece-registry-BH39cD-k.d.ts.map +0 -1
- package/dist/piece-registry-lsGsY9fT.js.map +0 -1
- package/dist/redact-ChAU8USo.js.map +0 -1
package/dist/index.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { _ as FileTooLargeError, a as redactMessage, b as maxFileBytes, c as DEFAULT_EGRESS_POLICY, f as extractDedupeKey, n as containsRedactedMarker, o as rememberSecrets, r as redact, s as secretsFor } from "./redact-
|
|
2
|
-
import { A as setPieceRegistryUrl, C as PieceWorkerError, D as ensurePieceBundle, E as pieceModuleRef, S as PieceWorker, T as localFirstResolver, _ as SecretDeletedError, a as CompositeBlockExecutor, b as secretRefFromId, c as parseBlockType, d as storeHandlers, f as BoundConnectionResolver, h as shapeConnection, i as ActivepiecesBlockExecutor, k as pieceRegistrySource, l as reactorHandlers, m as declaredConnectionIds, n as packagePieces, o as REACTOR_PORT_PIECE, r as runWorkflow, s as blockTypeParts, t as PieceRegistry, u as servesReactorPort, v as SecretNotFoundError, w as PieceWorkerTimeoutError, x as PieceWorkerPool, y as parseSecretRef } from "./piece-registry-
|
|
1
|
+
import { L as UnsupportedPieceFeatureError, R as unsupportedAuth, _ as FileTooLargeError, a as redactMessage, b as maxFileBytes, c as DEFAULT_EGRESS_POLICY, f as extractDedupeKey, n as containsRedactedMarker, o as rememberSecrets, r as redact, s as secretsFor, z as unsupportedTrigger } from "./redact-C2y8tU--.js";
|
|
2
|
+
import { A as setPieceRegistryUrl, C as PieceWorkerError, D as ensurePieceBundle, E as pieceModuleRef, S as PieceWorker, T as localFirstResolver, _ as SecretDeletedError, a as CompositeBlockExecutor, b as secretRefFromId, c as parseBlockType, d as storeHandlers, f as BoundConnectionResolver, h as shapeConnection, i as ActivepiecesBlockExecutor, k as pieceRegistrySource, l as reactorHandlers, m as declaredConnectionIds, n as packagePieces, o as REACTOR_PORT_PIECE, r as runWorkflow, s as blockTypeParts, t as PieceRegistry, u as servesReactorPort, v as SecretNotFoundError, w as PieceWorkerTimeoutError, x as PieceWorkerPool, y as parseSecretRef } from "./piece-registry-CYXV_aEv.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";
|
|
6
6
|
import { dirname, join } from "node:path";
|
|
7
|
-
import { childLogger, createAction } from "document-model";
|
|
7
|
+
import { childLogger, createAction, withSignaturePolicy } from "document-model";
|
|
8
8
|
import { createCipheriv, createDecipheriv, createHash, randomBytes, randomUUID } from "node:crypto";
|
|
9
9
|
import { Cron } from "croner";
|
|
10
10
|
import { AsyncLocalStorage } from "node:async_hooks";
|
|
@@ -353,6 +353,9 @@ function aiLast(audience) {
|
|
|
353
353
|
function pieceUrl(packageName) {
|
|
354
354
|
return `${CATALOG_URL}/${packageName}?audience=all`;
|
|
355
355
|
}
|
|
356
|
+
function reasonOf(feature) {
|
|
357
|
+
return feature ? { unsupported: feature.reason } : {};
|
|
358
|
+
}
|
|
356
359
|
var CatalogStatusError = class extends Error {
|
|
357
360
|
constructor(url, status) {
|
|
358
361
|
super(`${url} responded ${status}`);
|
|
@@ -409,7 +412,8 @@ function toSummaries(raw) {
|
|
|
409
412
|
actionCount: typeof entry.actions === "number" ? entry.actions : 0,
|
|
410
413
|
triggerCount: typeof entry.triggers === "number" ? entry.triggers : 0,
|
|
411
414
|
categories: entry.categories ?? [],
|
|
412
|
-
auth: entry.auth ?? null
|
|
415
|
+
auth: entry.auth ?? null,
|
|
416
|
+
...reasonOf(unsupportedAuth(entry.auth))
|
|
413
417
|
}));
|
|
414
418
|
}
|
|
415
419
|
async function fetchPieceCatalog() {
|
|
@@ -452,13 +456,15 @@ async function fetchPieceTriggers(packageName) {
|
|
|
452
456
|
if (cached && cached.expiresAt > Date.now()) return cached.value;
|
|
453
457
|
const detail = await fetchPieceJson(packageName);
|
|
454
458
|
const version = detail.version ?? "";
|
|
459
|
+
const pieceUnsupported = unsupportedAuth(detail.auth);
|
|
455
460
|
const triggersRecord = detail.triggers && typeof detail.triggers === "object" ? detail.triggers : {};
|
|
456
461
|
const triggers = Object.entries(triggersRecord).map(([name, trigger]) => ({
|
|
457
462
|
name,
|
|
458
463
|
displayName: trigger.displayName ?? name,
|
|
459
464
|
description: trigger.description ?? "",
|
|
460
465
|
strategy: trigger.type ?? "",
|
|
461
|
-
blockType: `${packageName}@${version}#trigger:${name}
|
|
466
|
+
blockType: `${packageName}@${version}#trigger:${name}`,
|
|
467
|
+
...reasonOf(pieceUnsupported ?? unsupportedTrigger(trigger))
|
|
462
468
|
}));
|
|
463
469
|
const value = {
|
|
464
470
|
name: packageName,
|
|
@@ -479,13 +485,15 @@ async function fetchPieceActions(packageName) {
|
|
|
479
485
|
if (cached && cached.expiresAt > Date.now()) return cached.value;
|
|
480
486
|
const detail = await fetchPieceJson(packageName);
|
|
481
487
|
const version = detail.version ?? "";
|
|
488
|
+
const unsupported = reasonOf(unsupportedAuth(detail.auth));
|
|
482
489
|
const actionsRecord = detail.actions && typeof detail.actions === "object" ? detail.actions : {};
|
|
483
490
|
const actions = Object.entries(actionsRecord).map(([name, action]) => ({
|
|
484
491
|
name,
|
|
485
492
|
displayName: action.displayName ?? name,
|
|
486
493
|
description: action.description ?? "",
|
|
487
494
|
blockType: `${packageName}@${version}#${name}`,
|
|
488
|
-
audience: action.audience ?? null
|
|
495
|
+
audience: action.audience ?? null,
|
|
496
|
+
...unsupported
|
|
489
497
|
})).sort((a, b) => aiLast(a.audience) - aiLast(b.audience));
|
|
490
498
|
const value = {
|
|
491
499
|
name: packageName,
|
|
@@ -515,7 +523,8 @@ function catalogEntry(descriptor, pieceName, version) {
|
|
|
515
523
|
actionCount: descriptor.actions.length,
|
|
516
524
|
triggerCount: descriptor.triggers.length,
|
|
517
525
|
categories: descriptor.categories ?? [],
|
|
518
|
-
auth: descriptor.auth ?? null
|
|
526
|
+
auth: descriptor.auth ?? null,
|
|
527
|
+
...reasonOf(descriptor.unsupported)
|
|
519
528
|
};
|
|
520
529
|
}
|
|
521
530
|
function actionsResult(descriptor, pieceName, version) {
|
|
@@ -528,7 +537,8 @@ function actionsResult(descriptor, pieceName, version) {
|
|
|
528
537
|
displayName: action.displayName,
|
|
529
538
|
description: action.description ?? "",
|
|
530
539
|
blockType: localBlockType(pieceName, action.name, "action"),
|
|
531
|
-
audience: action.audience ?? null
|
|
540
|
+
audience: action.audience ?? null,
|
|
541
|
+
...reasonOf(descriptor.unsupported)
|
|
532
542
|
})).sort((a, b) => aiLast(a.audience) - aiLast(b.audience)),
|
|
533
543
|
auth: descriptor.auth ?? null
|
|
534
544
|
};
|
|
@@ -543,7 +553,8 @@ function triggersResult(descriptor, pieceName, version) {
|
|
|
543
553
|
displayName: trigger.displayName,
|
|
544
554
|
description: trigger.description ?? "",
|
|
545
555
|
strategy: trigger.strategy,
|
|
546
|
-
blockType: localBlockType(pieceName, trigger.name, "trigger")
|
|
556
|
+
blockType: localBlockType(pieceName, trigger.name, "trigger"),
|
|
557
|
+
...reasonOf(descriptor.unsupported ?? trigger.unsupported)
|
|
547
558
|
})),
|
|
548
559
|
auth: descriptor.auth ?? null
|
|
549
560
|
};
|
|
@@ -559,7 +570,8 @@ function localSearchHits(descriptor, pieceName) {
|
|
|
559
570
|
displayName: action.displayName,
|
|
560
571
|
description: action.description ?? "",
|
|
561
572
|
kind: "action",
|
|
562
|
-
strategy: null
|
|
573
|
+
strategy: null,
|
|
574
|
+
...reasonOf(descriptor.unsupported)
|
|
563
575
|
})), ...descriptor.triggers.map((trigger) => ({
|
|
564
576
|
blockType: localBlockType(pieceName, trigger.name, "trigger"),
|
|
565
577
|
pieceName,
|
|
@@ -568,7 +580,8 @@ function localSearchHits(descriptor, pieceName) {
|
|
|
568
580
|
displayName: trigger.displayName,
|
|
569
581
|
description: trigger.description ?? "",
|
|
570
582
|
kind: "trigger",
|
|
571
|
-
strategy: trigger.strategy
|
|
583
|
+
strategy: trigger.strategy,
|
|
584
|
+
...reasonOf(descriptor.unsupported ?? trigger.unsupported)
|
|
572
585
|
}))];
|
|
573
586
|
}
|
|
574
587
|
function detailResult(descriptor, pieceName, version) {
|
|
@@ -616,6 +629,7 @@ function buildSearchIndex(raw) {
|
|
|
616
629
|
const pieceName = entry.name;
|
|
617
630
|
const pieceDisplayName = entry.displayName ?? pieceName;
|
|
618
631
|
const logoUrl = entry.logoUrl ?? "";
|
|
632
|
+
const pieceUnsupported = unsupportedAuth(entry.auth);
|
|
619
633
|
const push = (kind, item) => {
|
|
620
634
|
if (typeof item.name !== "string" || item.name === "") return;
|
|
621
635
|
const displayName = item.displayName ?? item.name;
|
|
@@ -629,7 +643,8 @@ function buildSearchIndex(raw) {
|
|
|
629
643
|
displayName,
|
|
630
644
|
description,
|
|
631
645
|
kind,
|
|
632
|
-
strategy: kind === "trigger" ? item.type ?? null : null
|
|
646
|
+
strategy: kind === "trigger" ? item.type ?? null : null,
|
|
647
|
+
...reasonOf(pieceUnsupported ?? (kind === "trigger" ? unsupportedTrigger(item) : void 0))
|
|
633
648
|
},
|
|
634
649
|
name: `${displayName} ${item.name}`.toLowerCase(),
|
|
635
650
|
description: description.toLowerCase(),
|
|
@@ -834,7 +849,7 @@ var SubgraphReactorPort = class {
|
|
|
834
849
|
assertOperationsApplied(named, [naming]);
|
|
835
850
|
return documentSummary(named, true);
|
|
836
851
|
}
|
|
837
|
-
const empty = (await this.client.getDocumentModelModule(input.documentType)).utils.createDocument();
|
|
852
|
+
const empty = withSignaturePolicy((await this.client.getDocumentModelModule(input.documentType)).utils.createDocument(), await this.client.getCreateSignaturePolicy());
|
|
838
853
|
if (input.name) empty.header.name = input.name;
|
|
839
854
|
return documentSummary(await this.client.drives.addFile(target.driveId, empty, target.parentFolder), true);
|
|
840
855
|
}
|
|
@@ -919,6 +934,9 @@ function withRunScope(scope, fn) {
|
|
|
919
934
|
function currentWorkflowId() {
|
|
920
935
|
return storage.getStore()?.workflowId;
|
|
921
936
|
}
|
|
937
|
+
function currentRunId() {
|
|
938
|
+
return storage.getStore()?.runId ?? void 0;
|
|
939
|
+
}
|
|
922
940
|
function currentBoundConnections() {
|
|
923
941
|
return storage.getStore()?.connections;
|
|
924
942
|
}
|
|
@@ -926,6 +944,48 @@ function currentPieceWorker() {
|
|
|
926
944
|
return storage.getStore()?.pieceWorker;
|
|
927
945
|
}
|
|
928
946
|
//#endregion
|
|
947
|
+
//#region src/reactor/piece-store-port.ts
|
|
948
|
+
const logger$3 = childLogger(["workflow", "piece-store"]);
|
|
949
|
+
const PROJECT_SCOPE_KEY = "reactor";
|
|
950
|
+
const TEST_PARTITION_SUFFIX = "#test";
|
|
951
|
+
function testPartitionKey(scope, workflowId) {
|
|
952
|
+
return (scope === "PROJECT" ? `${PROJECT_SCOPE_KEY}#${workflowId}` : workflowId) + TEST_PARTITION_SUFFIX;
|
|
953
|
+
}
|
|
954
|
+
const CURSOR_KEY = "lastPoll";
|
|
955
|
+
const MAX_CURSOR_SKEW_MS = 1440 * 6e4;
|
|
956
|
+
function isPlausibleCursor(value, now) {
|
|
957
|
+
return typeof value === "number" && Number.isFinite(value) && value > 0 && value <= now + MAX_CURSOR_SKEW_MS;
|
|
958
|
+
}
|
|
959
|
+
function isCursorShaped(value) {
|
|
960
|
+
return value === null || typeof value === "number";
|
|
961
|
+
}
|
|
962
|
+
function showCursor(value) {
|
|
963
|
+
return typeof value === "number" ? String(value) : JSON.stringify(value);
|
|
964
|
+
}
|
|
965
|
+
function isCursorRef(key) {
|
|
966
|
+
return key === CURSOR_KEY || key.endsWith(`/${CURSOR_KEY}`);
|
|
967
|
+
}
|
|
968
|
+
function createPieceStorePort(store, workflowIdFor, sample = false, clock = Date.now) {
|
|
969
|
+
const flowKey = () => {
|
|
970
|
+
const workflowId = workflowIdFor();
|
|
971
|
+
if (!workflowId) throw new Error("ctx.store is unavailable: no workflow is in scope");
|
|
972
|
+
return workflowId;
|
|
973
|
+
};
|
|
974
|
+
const partition = (scope) => sample ? testPartitionKey(scope, flowKey()) : scope === "PROJECT" ? PROJECT_SCOPE_KEY : flowKey();
|
|
975
|
+
return {
|
|
976
|
+
get: async (key, scope) => store.getPieceStoreValue(scope, partition(scope), key),
|
|
977
|
+
put: async (key, value, scope) => {
|
|
978
|
+
const now = clock();
|
|
979
|
+
if (!isCursorRef(key) || isPlausibleCursor(value, now)) return store.setPieceStoreValue(scope, partition(scope), key, value);
|
|
980
|
+
const kept = await store.getPieceStoreValue(scope, partition(scope), key);
|
|
981
|
+
if (!isCursorShaped(value) && !isPlausibleCursor(kept, now)) return store.setPieceStoreValue(scope, partition(scope), key, value);
|
|
982
|
+
logger$3.warn(`Rejected ${key}=${showCursor(value)} from workflow ${flowKey()}; keeping ${isPlausibleCursor(kept, now) ? String(kept) : "no cursor"}`);
|
|
983
|
+
if (!isPlausibleCursor(kept, now)) await store.deletePieceStoreValue(scope, partition(scope), key);
|
|
984
|
+
},
|
|
985
|
+
delete: async (key, scope) => store.deletePieceStoreValue(scope, partition(scope), key)
|
|
986
|
+
};
|
|
987
|
+
}
|
|
988
|
+
//#endregion
|
|
929
989
|
//#region src/reactor/connector-id.ts
|
|
930
990
|
function packageFromConnectorId(connectorId) {
|
|
931
991
|
const separator = connectorId.lastIndexOf("#");
|
|
@@ -1015,6 +1075,11 @@ function createBlockExecutor(host, secrets, attachments, pieceStore, resolveBloc
|
|
|
1015
1075
|
cacheDir: BUNDLE_CACHE_DIR,
|
|
1016
1076
|
egress: configuredEgress(),
|
|
1017
1077
|
worker: currentPieceWorker,
|
|
1078
|
+
identity: () => ({
|
|
1079
|
+
runId: currentRunId(),
|
|
1080
|
+
flowId: currentWorkflowId(),
|
|
1081
|
+
projectId: PROJECT_SCOPE_KEY
|
|
1082
|
+
}),
|
|
1018
1083
|
resolver: pieceResolver(),
|
|
1019
1084
|
packages: () => Promise.resolve(packagePieces.versions()),
|
|
1020
1085
|
...resolveBlockType ? { resolveBlockType } : {},
|
|
@@ -1185,48 +1250,6 @@ function cronIntervalMs(cron, from = /* @__PURE__ */ new Date()) {
|
|
|
1185
1250
|
}
|
|
1186
1251
|
}
|
|
1187
1252
|
//#endregion
|
|
1188
|
-
//#region src/reactor/piece-store-port.ts
|
|
1189
|
-
const logger$3 = childLogger(["workflow", "piece-store"]);
|
|
1190
|
-
const PROJECT_SCOPE_KEY = "reactor";
|
|
1191
|
-
const TEST_PARTITION_SUFFIX = "#test";
|
|
1192
|
-
function testPartitionKey(scope, workflowId) {
|
|
1193
|
-
return (scope === "PROJECT" ? `${PROJECT_SCOPE_KEY}#${workflowId}` : workflowId) + TEST_PARTITION_SUFFIX;
|
|
1194
|
-
}
|
|
1195
|
-
const CURSOR_KEY = "lastPoll";
|
|
1196
|
-
const MAX_CURSOR_SKEW_MS = 1440 * 6e4;
|
|
1197
|
-
function isPlausibleCursor(value, now) {
|
|
1198
|
-
return typeof value === "number" && Number.isFinite(value) && value > 0 && value <= now + MAX_CURSOR_SKEW_MS;
|
|
1199
|
-
}
|
|
1200
|
-
function isCursorShaped(value) {
|
|
1201
|
-
return value === null || typeof value === "number";
|
|
1202
|
-
}
|
|
1203
|
-
function showCursor(value) {
|
|
1204
|
-
return typeof value === "number" ? String(value) : JSON.stringify(value);
|
|
1205
|
-
}
|
|
1206
|
-
function isCursorRef(key) {
|
|
1207
|
-
return key === CURSOR_KEY || key.endsWith(`/${CURSOR_KEY}`);
|
|
1208
|
-
}
|
|
1209
|
-
function createPieceStorePort(store, workflowIdFor, sample = false, clock = Date.now) {
|
|
1210
|
-
const flowKey = () => {
|
|
1211
|
-
const workflowId = workflowIdFor();
|
|
1212
|
-
if (!workflowId) throw new Error("ctx.store is unavailable: no workflow is in scope");
|
|
1213
|
-
return workflowId;
|
|
1214
|
-
};
|
|
1215
|
-
const partition = (scope) => sample ? testPartitionKey(scope, flowKey()) : scope === "PROJECT" ? PROJECT_SCOPE_KEY : flowKey();
|
|
1216
|
-
return {
|
|
1217
|
-
get: async (key, scope) => store.getPieceStoreValue(scope, partition(scope), key),
|
|
1218
|
-
put: async (key, value, scope) => {
|
|
1219
|
-
const now = clock();
|
|
1220
|
-
if (!isCursorRef(key) || isPlausibleCursor(value, now)) return store.setPieceStoreValue(scope, partition(scope), key, value);
|
|
1221
|
-
const kept = await store.getPieceStoreValue(scope, partition(scope), key);
|
|
1222
|
-
if (!isCursorShaped(value) && !isPlausibleCursor(kept, now)) return store.setPieceStoreValue(scope, partition(scope), key, value);
|
|
1223
|
-
logger$3.warn(`Rejected ${key}=${showCursor(value)} from workflow ${flowKey()}; keeping ${isPlausibleCursor(kept, now) ? String(kept) : "no cursor"}`);
|
|
1224
|
-
if (!isPlausibleCursor(kept, now)) await store.deletePieceStoreValue(scope, partition(scope), key);
|
|
1225
|
-
},
|
|
1226
|
-
delete: async (key, scope) => store.deletePieceStoreValue(scope, partition(scope), key)
|
|
1227
|
-
};
|
|
1228
|
-
}
|
|
1229
|
-
//#endregion
|
|
1230
1253
|
//#region src/reactor/core-catalog.ts
|
|
1231
1254
|
const CORE_PIECE_NAME = "core";
|
|
1232
1255
|
function prop(name, displayName, description, options = {}) {
|
|
@@ -1931,7 +1954,7 @@ var TriggerConfigError = class extends Error {
|
|
|
1931
1954
|
};
|
|
1932
1955
|
function isPermanentFailure(error) {
|
|
1933
1956
|
if (error instanceof TriggerConfigError) return true;
|
|
1934
|
-
return error instanceof PieceWorkerError && error.serialized.unsupportedMember !== void 0;
|
|
1957
|
+
return error instanceof PieceWorkerError && (error.serialized.unsupportedMember !== void 0 || error.serialized.unsupportedFeature !== void 0 || error.serialized.invalidProps !== void 0);
|
|
1935
1958
|
}
|
|
1936
1959
|
function backoffMs(intervalMs, failures) {
|
|
1937
1960
|
return Math.min(intervalMs * 2 ** failures, MAX_BACKOFF_MS);
|
|
@@ -2103,7 +2126,10 @@ var TriggerSupervisor = class {
|
|
|
2103
2126
|
auth,
|
|
2104
2127
|
...redactValues.length > 0 ? { redactValues } : {},
|
|
2105
2128
|
...pieceStore ? { durableStore: true } : {},
|
|
2106
|
-
identity: {
|
|
2129
|
+
identity: {
|
|
2130
|
+
flowId: binding.workflowId,
|
|
2131
|
+
projectId: PROJECT_SCOPE_KEY
|
|
2132
|
+
},
|
|
2107
2133
|
isRepublish: options.isRepublish,
|
|
2108
2134
|
payload: options.payload,
|
|
2109
2135
|
webhookUrl: options.webhookUrl ?? `http://localhost:0/v1/webhooks/${binding.workflowId}`,
|
|
@@ -2126,7 +2152,10 @@ var TriggerSupervisor = class {
|
|
|
2126
2152
|
}, { timeoutMs: this.hookTimeoutMs })).output;
|
|
2127
2153
|
this.descriptors.set(key, descriptor);
|
|
2128
2154
|
}
|
|
2129
|
-
|
|
2155
|
+
const trigger = descriptor.triggers.find((candidate) => candidate.name === binding.triggerName);
|
|
2156
|
+
const unsupported = descriptor.unsupported ?? trigger?.unsupported;
|
|
2157
|
+
if (unsupported) throw new TriggerConfigError(`Trigger "${binding.triggerName}" of "${binding.packageName}": ${unsupported.reason}`);
|
|
2158
|
+
return trigger?.strategy ?? "POLLING";
|
|
2130
2159
|
}
|
|
2131
2160
|
async enable(binding, superseded) {
|
|
2132
2161
|
const store = await this.options.store();
|
|
@@ -2645,19 +2674,6 @@ function collectLifecycleParentHints(operations) {
|
|
|
2645
2674
|
}
|
|
2646
2675
|
return hints;
|
|
2647
2676
|
}
|
|
2648
|
-
function accountLabelFromCheckResult(result) {
|
|
2649
|
-
if (!result || typeof result !== "object") return void 0;
|
|
2650
|
-
const record = result;
|
|
2651
|
-
for (const key of [
|
|
2652
|
-
"name",
|
|
2653
|
-
"username",
|
|
2654
|
-
"email",
|
|
2655
|
-
"sub"
|
|
2656
|
-
]) {
|
|
2657
|
-
const value = record[key];
|
|
2658
|
-
if (typeof value === "string" && value !== "") return value;
|
|
2659
|
-
}
|
|
2660
|
-
}
|
|
2661
2677
|
function pieceFailureDetail(error, timeoutDetail) {
|
|
2662
2678
|
if (error instanceof PieceWorkerTimeoutError) return timeoutDetail;
|
|
2663
2679
|
if (error instanceof PieceWorkerError) return error.serialized.message;
|
|
@@ -3543,20 +3559,16 @@ var WorkflowRuntimeService = class {
|
|
|
3543
3559
|
accountLabel
|
|
3544
3560
|
});
|
|
3545
3561
|
}
|
|
3546
|
-
if (!outcome.
|
|
3547
|
-
ok: true,
|
|
3548
|
-
detail: "piece declares no connection check; credentials resolved",
|
|
3549
|
-
accountLabel
|
|
3550
|
-
});
|
|
3551
|
-
if (outcome.result === false) return this.recordCheckResult(document, {
|
|
3562
|
+
if (!outcome.valid) return this.recordCheckResult(document, {
|
|
3552
3563
|
ok: false,
|
|
3553
3564
|
detail: outcome.detail ?? "Connection check failed",
|
|
3554
3565
|
accountLabel
|
|
3555
3566
|
});
|
|
3567
|
+
if (outcome.identifierError) this.logger.warn("Connection @id kept its label: getConnectionIdentifier failed: @detail", connectionId, outcome.identifierError);
|
|
3556
3568
|
return this.recordCheckResult(document, {
|
|
3557
3569
|
ok: true,
|
|
3558
|
-
detail: null,
|
|
3559
|
-
accountLabel:
|
|
3570
|
+
detail: outcome.declared ? null : "piece declares no auth.validate; credentials resolved",
|
|
3571
|
+
accountLabel: outcome.accountLabel ?? accountLabel
|
|
3560
3572
|
});
|
|
3561
3573
|
}
|
|
3562
3574
|
versionMisses = /* @__PURE__ */ new Map();
|
|
@@ -3632,12 +3644,14 @@ var WorkflowRuntimeService = class {
|
|
|
3632
3644
|
}
|
|
3633
3645
|
}
|
|
3634
3646
|
async recordCheckResult(document, result) {
|
|
3635
|
-
const
|
|
3647
|
+
const actionList = [actions.recordCheckResult({
|
|
3636
3648
|
status: result.ok ? "OK" : "ERROR",
|
|
3637
3649
|
checkedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
3638
3650
|
error: result.ok ? void 0 : result.detail ?? void 0
|
|
3639
|
-
});
|
|
3640
|
-
|
|
3651
|
+
})];
|
|
3652
|
+
const label = result.accountLabel;
|
|
3653
|
+
if (label && label !== (document.state.global.accountLabel ?? null)) actionList.push(actions.setAccountLabel({ accountLabel: label }));
|
|
3654
|
+
await this.host.reactorClient.execute(document.header.id, "main", actionList);
|
|
3641
3655
|
return result;
|
|
3642
3656
|
}
|
|
3643
3657
|
async localPieces() {
|
|
@@ -3707,6 +3721,7 @@ var WorkflowRuntimeService = class {
|
|
|
3707
3721
|
const parsed = await this.resolvedBlock(blockType);
|
|
3708
3722
|
if (!parsed) return null;
|
|
3709
3723
|
const descriptor = await this.pieceDescriptor(parsed.packageName, parsed.version);
|
|
3724
|
+
if (descriptor.unsupported) throw new UnsupportedPieceFeatureError(`Piece "${parsed.packageName}"`, descriptor.unsupported);
|
|
3710
3725
|
const common = {
|
|
3711
3726
|
displayName: descriptor.displayName,
|
|
3712
3727
|
logoUrl: descriptor.logoUrl,
|
|
@@ -3714,6 +3729,7 @@ var WorkflowRuntimeService = class {
|
|
|
3714
3729
|
};
|
|
3715
3730
|
if (parsed.kind === "trigger") {
|
|
3716
3731
|
const trigger = descriptor.triggers.find((entry) => entry.name === parsed.name);
|
|
3732
|
+
if (trigger?.unsupported) throw new UnsupportedPieceFeatureError(`Trigger "${parsed.name}" of "${parsed.packageName}"`, trigger.unsupported);
|
|
3717
3733
|
return trigger ? {
|
|
3718
3734
|
...common,
|
|
3719
3735
|
trigger
|
|
@@ -3767,6 +3783,7 @@ var WorkflowRuntimeService = class {
|
|
|
3767
3783
|
propName,
|
|
3768
3784
|
refresherValues: input ?? {},
|
|
3769
3785
|
auth,
|
|
3786
|
+
projectId: PROJECT_SCOPE_KEY,
|
|
3770
3787
|
...servesReactorPort(parsed.packageName) ? { reactorAccess: true } : {},
|
|
3771
3788
|
...this.designEgress ? { egress: this.designEgress } : {}
|
|
3772
3789
|
}, servesReactorPort(parsed.packageName) ? { hostCalls: reactorHandlers(new ScopedDesignTimeReactorPort(this.host, ctx)) } : {})).output;
|