@powerhousedao/reactor-workflow 6.2.3-dev.23 → 6.2.3-dev.25
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 -0
- package/dist/{descriptor-Doax7KPd.js → descriptor-CtMB-wPx.js} +28 -13
- package/dist/descriptor-CtMB-wPx.js.map +1 -0
- package/dist/index.d.ts +61 -56
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +155 -110
- package/dist/index.js.map +1 -1
- package/dist/{piece-registry-lsGsY9fT.js → piece-registry-CAS4wiSA.js} +29 -7
- package/dist/piece-registry-CAS4wiSA.js.map +1 -0
- package/dist/{piece-registry-BH39cD-k.d.ts → piece-registry-D6dvy2OD.d.ts} +23 -38
- package/dist/piece-registry-D6dvy2OD.d.ts.map +1 -0
- package/dist/{redact-ChAU8USo.js → redact-DM3JhxdF.js} +50 -4
- package/dist/redact-DM3JhxdF.js.map +1 -0
- package/dist/testing.d.ts +37 -2
- package/dist/testing.d.ts.map +1 -0
- package/dist/testing.js +3 -3
- package/dist/worker-entry.d.ts +2 -1
- package/dist/worker-entry.js +142 -51
- package/dist/worker-entry.js.map +1 -1
- package/package.json +8 -8
- 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 { B as unsupportedTrigger, L as UnsupportedPieceFeatureError, _ 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 unsupportedAuth } from "./redact-DM3JhxdF.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-CAS4wiSA.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";
|
|
@@ -332,7 +332,7 @@ function documentEventTree(actionInputChildren) {
|
|
|
332
332
|
}
|
|
333
333
|
//#endregion
|
|
334
334
|
//#region src/reactor/unsupported-pieces.ts
|
|
335
|
-
const SERVER_ONLY_PIECES = new Set([
|
|
335
|
+
const SERVER_ONLY_PIECES = /* @__PURE__ */ new Set([
|
|
336
336
|
"@activepieces/piece-ai",
|
|
337
337
|
"@activepieces/piece-text-ai",
|
|
338
338
|
"@activepieces/piece-image-ai",
|
|
@@ -345,7 +345,7 @@ const SERVER_ONLY_PIECES = new Set([
|
|
|
345
345
|
//#endregion
|
|
346
346
|
//#region src/reactor/piece-catalog.ts
|
|
347
347
|
const CATALOG_URL = "https://cloud.activepieces.com/api/v1/pieces";
|
|
348
|
-
const CACHE_TTL_MS =
|
|
348
|
+
const CACHE_TTL_MS = 36e5;
|
|
349
349
|
const logger$4 = childLogger(["workflow", "piece-catalog"]);
|
|
350
350
|
function aiLast(audience) {
|
|
351
351
|
return audience === "ai" ? 1 : 0;
|
|
@@ -353,7 +353,19 @@ 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
|
+
}
|
|
359
|
+
function clientAuth(auth) {
|
|
360
|
+
if (!auth) return null;
|
|
361
|
+
const one = ({ unsupported, ...method }) => ({
|
|
362
|
+
...method,
|
|
363
|
+
...reasonOf(unsupported)
|
|
364
|
+
});
|
|
365
|
+
return Array.isArray(auth) ? auth.map(one) : one(auth);
|
|
366
|
+
}
|
|
356
367
|
var CatalogStatusError = class extends Error {
|
|
368
|
+
status;
|
|
357
369
|
constructor(url, status) {
|
|
358
370
|
super(`${url} responded ${status}`);
|
|
359
371
|
this.status = status;
|
|
@@ -409,7 +421,8 @@ function toSummaries(raw) {
|
|
|
409
421
|
actionCount: typeof entry.actions === "number" ? entry.actions : 0,
|
|
410
422
|
triggerCount: typeof entry.triggers === "number" ? entry.triggers : 0,
|
|
411
423
|
categories: entry.categories ?? [],
|
|
412
|
-
auth: entry.auth ?? null
|
|
424
|
+
auth: entry.auth ?? null,
|
|
425
|
+
...reasonOf(unsupportedAuth(entry.auth))
|
|
413
426
|
}));
|
|
414
427
|
}
|
|
415
428
|
async function fetchPieceCatalog() {
|
|
@@ -452,13 +465,15 @@ async function fetchPieceTriggers(packageName) {
|
|
|
452
465
|
if (cached && cached.expiresAt > Date.now()) return cached.value;
|
|
453
466
|
const detail = await fetchPieceJson(packageName);
|
|
454
467
|
const version = detail.version ?? "";
|
|
468
|
+
const pieceUnsupported = unsupportedAuth(detail.auth);
|
|
455
469
|
const triggersRecord = detail.triggers && typeof detail.triggers === "object" ? detail.triggers : {};
|
|
456
470
|
const triggers = Object.entries(triggersRecord).map(([name, trigger]) => ({
|
|
457
471
|
name,
|
|
458
472
|
displayName: trigger.displayName ?? name,
|
|
459
473
|
description: trigger.description ?? "",
|
|
460
474
|
strategy: trigger.type ?? "",
|
|
461
|
-
blockType: `${packageName}@${version}#trigger:${name}
|
|
475
|
+
blockType: `${packageName}@${version}#trigger:${name}`,
|
|
476
|
+
...reasonOf(pieceUnsupported ?? unsupportedTrigger(trigger))
|
|
462
477
|
}));
|
|
463
478
|
const value = {
|
|
464
479
|
name: packageName,
|
|
@@ -479,13 +494,15 @@ async function fetchPieceActions(packageName) {
|
|
|
479
494
|
if (cached && cached.expiresAt > Date.now()) return cached.value;
|
|
480
495
|
const detail = await fetchPieceJson(packageName);
|
|
481
496
|
const version = detail.version ?? "";
|
|
497
|
+
const unsupported = reasonOf(unsupportedAuth(detail.auth));
|
|
482
498
|
const actionsRecord = detail.actions && typeof detail.actions === "object" ? detail.actions : {};
|
|
483
499
|
const actions = Object.entries(actionsRecord).map(([name, action]) => ({
|
|
484
500
|
name,
|
|
485
501
|
displayName: action.displayName ?? name,
|
|
486
502
|
description: action.description ?? "",
|
|
487
503
|
blockType: `${packageName}@${version}#${name}`,
|
|
488
|
-
audience: action.audience ?? null
|
|
504
|
+
audience: action.audience ?? null,
|
|
505
|
+
...unsupported
|
|
489
506
|
})).sort((a, b) => aiLast(a.audience) - aiLast(b.audience));
|
|
490
507
|
const value = {
|
|
491
508
|
name: packageName,
|
|
@@ -515,7 +532,8 @@ function catalogEntry(descriptor, pieceName, version) {
|
|
|
515
532
|
actionCount: descriptor.actions.length,
|
|
516
533
|
triggerCount: descriptor.triggers.length,
|
|
517
534
|
categories: descriptor.categories ?? [],
|
|
518
|
-
auth: descriptor.auth
|
|
535
|
+
auth: clientAuth(descriptor.auth),
|
|
536
|
+
...reasonOf(descriptor.unsupported)
|
|
519
537
|
};
|
|
520
538
|
}
|
|
521
539
|
function actionsResult(descriptor, pieceName, version) {
|
|
@@ -528,9 +546,10 @@ function actionsResult(descriptor, pieceName, version) {
|
|
|
528
546
|
displayName: action.displayName,
|
|
529
547
|
description: action.description ?? "",
|
|
530
548
|
blockType: localBlockType(pieceName, action.name, "action"),
|
|
531
|
-
audience: action.audience ?? null
|
|
549
|
+
audience: action.audience ?? null,
|
|
550
|
+
...reasonOf(descriptor.unsupported)
|
|
532
551
|
})).sort((a, b) => aiLast(a.audience) - aiLast(b.audience)),
|
|
533
|
-
auth: descriptor.auth
|
|
552
|
+
auth: clientAuth(descriptor.auth)
|
|
534
553
|
};
|
|
535
554
|
}
|
|
536
555
|
function triggersResult(descriptor, pieceName, version) {
|
|
@@ -543,9 +562,10 @@ function triggersResult(descriptor, pieceName, version) {
|
|
|
543
562
|
displayName: trigger.displayName,
|
|
544
563
|
description: trigger.description ?? "",
|
|
545
564
|
strategy: trigger.strategy,
|
|
546
|
-
blockType: localBlockType(pieceName, trigger.name, "trigger")
|
|
565
|
+
blockType: localBlockType(pieceName, trigger.name, "trigger"),
|
|
566
|
+
...reasonOf(descriptor.unsupported ?? trigger.unsupported)
|
|
547
567
|
})),
|
|
548
|
-
auth: descriptor.auth
|
|
568
|
+
auth: clientAuth(descriptor.auth)
|
|
549
569
|
};
|
|
550
570
|
}
|
|
551
571
|
function localSearchHits(descriptor, pieceName) {
|
|
@@ -559,7 +579,8 @@ function localSearchHits(descriptor, pieceName) {
|
|
|
559
579
|
displayName: action.displayName,
|
|
560
580
|
description: action.description ?? "",
|
|
561
581
|
kind: "action",
|
|
562
|
-
strategy: null
|
|
582
|
+
strategy: null,
|
|
583
|
+
...reasonOf(descriptor.unsupported)
|
|
563
584
|
})), ...descriptor.triggers.map((trigger) => ({
|
|
564
585
|
blockType: localBlockType(pieceName, trigger.name, "trigger"),
|
|
565
586
|
pieceName,
|
|
@@ -568,7 +589,8 @@ function localSearchHits(descriptor, pieceName) {
|
|
|
568
589
|
displayName: trigger.displayName,
|
|
569
590
|
description: trigger.description ?? "",
|
|
570
591
|
kind: "trigger",
|
|
571
|
-
strategy: trigger.strategy
|
|
592
|
+
strategy: trigger.strategy,
|
|
593
|
+
...reasonOf(descriptor.unsupported ?? trigger.unsupported)
|
|
572
594
|
}))];
|
|
573
595
|
}
|
|
574
596
|
function detailResult(descriptor, pieceName, version) {
|
|
@@ -579,7 +601,7 @@ function detailResult(descriptor, pieceName, version) {
|
|
|
579
601
|
logoUrl: descriptor.logoUrl ?? "",
|
|
580
602
|
version,
|
|
581
603
|
categories: descriptor.categories ?? [],
|
|
582
|
-
auth: descriptor.auth
|
|
604
|
+
auth: clientAuth(descriptor.auth),
|
|
583
605
|
actions: Object.fromEntries(descriptor.actions.map((action) => [action.name, {
|
|
584
606
|
name: action.name,
|
|
585
607
|
displayName: action.displayName,
|
|
@@ -605,7 +627,7 @@ function detailResult(descriptor, pieceName, version) {
|
|
|
605
627
|
}
|
|
606
628
|
//#endregion
|
|
607
629
|
//#region src/reactor/block-search.ts
|
|
608
|
-
const INDEX_TTL_MS =
|
|
630
|
+
const INDEX_TTL_MS = 36e5;
|
|
609
631
|
const DEFAULT_LIMIT = 30;
|
|
610
632
|
const MAX_LIMIT = 100;
|
|
611
633
|
function buildSearchIndex(raw) {
|
|
@@ -616,6 +638,7 @@ function buildSearchIndex(raw) {
|
|
|
616
638
|
const pieceName = entry.name;
|
|
617
639
|
const pieceDisplayName = entry.displayName ?? pieceName;
|
|
618
640
|
const logoUrl = entry.logoUrl ?? "";
|
|
641
|
+
const pieceUnsupported = unsupportedAuth(entry.auth);
|
|
619
642
|
const push = (kind, item) => {
|
|
620
643
|
if (typeof item.name !== "string" || item.name === "") return;
|
|
621
644
|
const displayName = item.displayName ?? item.name;
|
|
@@ -629,7 +652,8 @@ function buildSearchIndex(raw) {
|
|
|
629
652
|
displayName,
|
|
630
653
|
description,
|
|
631
654
|
kind,
|
|
632
|
-
strategy: kind === "trigger" ? item.type ?? null : null
|
|
655
|
+
strategy: kind === "trigger" ? item.type ?? null : null,
|
|
656
|
+
...reasonOf(pieceUnsupported ?? (kind === "trigger" ? unsupportedTrigger(item) : void 0))
|
|
633
657
|
},
|
|
634
658
|
name: `${displayName} ${item.name}`.toLowerCase(),
|
|
635
659
|
description: description.toLowerCase(),
|
|
@@ -730,7 +754,7 @@ function searchBlocks(query, limit, local) {
|
|
|
730
754
|
}
|
|
731
755
|
//#endregion
|
|
732
756
|
//#region src/reactor/reactor-port.ts
|
|
733
|
-
const DRIVE_DOCUMENT_TYPES = new Set(["powerhouse/document-drive", "powerhouse/reactor-drive"]);
|
|
757
|
+
const DRIVE_DOCUMENT_TYPES = /* @__PURE__ */ new Set(["powerhouse/document-drive", "powerhouse/reactor-drive"]);
|
|
734
758
|
const FIND_PAGE_LIMIT = 100;
|
|
735
759
|
const DESIGN_TIME_WRITES_REFUSED = "Reactor writes are not available while resolving design-time options";
|
|
736
760
|
const DESIGN_TIME_CALLER_REQUIRED = "Design-time reactor access requires an authenticated request";
|
|
@@ -776,6 +800,7 @@ function assertOperationsApplied(document, dispatched) {
|
|
|
776
800
|
throw new Error(failed.map((operation) => `Action ${operation.action.type} failed: ${operation.error ?? "unknown error"}`).join("; "));
|
|
777
801
|
}
|
|
778
802
|
var SubgraphReactorPort = class {
|
|
803
|
+
host;
|
|
779
804
|
constructor(host) {
|
|
780
805
|
this.host = host;
|
|
781
806
|
}
|
|
@@ -834,7 +859,8 @@ var SubgraphReactorPort = class {
|
|
|
834
859
|
assertOperationsApplied(named, [naming]);
|
|
835
860
|
return documentSummary(named, true);
|
|
836
861
|
}
|
|
837
|
-
const
|
|
862
|
+
const module = await this.client.getDocumentModelModule(input.documentType);
|
|
863
|
+
const empty = withSignaturePolicy(module.utils.createDocument(), await this.client.getCreateSignaturePolicy());
|
|
838
864
|
if (input.name) empty.header.name = input.name;
|
|
839
865
|
return documentSummary(await this.client.drives.addFile(target.driveId, empty, target.parentFolder), true);
|
|
840
866
|
}
|
|
@@ -877,6 +903,8 @@ var SubgraphReactorPort = class {
|
|
|
877
903
|
}
|
|
878
904
|
};
|
|
879
905
|
var ScopedDesignTimeReactorPort = class {
|
|
906
|
+
host;
|
|
907
|
+
caller;
|
|
880
908
|
inner;
|
|
881
909
|
constructor(host, caller) {
|
|
882
910
|
this.host = host;
|
|
@@ -900,10 +928,10 @@ var ScopedDesignTimeReactorPort = class {
|
|
|
900
928
|
return found.filter((_, index) => allowed[index]);
|
|
901
929
|
}
|
|
902
930
|
create(_input) {
|
|
903
|
-
return Promise.reject(new Error(DESIGN_TIME_WRITES_REFUSED));
|
|
931
|
+
return Promise.reject(/* @__PURE__ */ new Error(DESIGN_TIME_WRITES_REFUSED));
|
|
904
932
|
}
|
|
905
933
|
execute(_input) {
|
|
906
|
-
return Promise.reject(new Error(DESIGN_TIME_WRITES_REFUSED));
|
|
934
|
+
return Promise.reject(/* @__PURE__ */ new Error(DESIGN_TIME_WRITES_REFUSED));
|
|
907
935
|
}
|
|
908
936
|
async canRead(documentId) {
|
|
909
937
|
if (!this.caller) return false;
|
|
@@ -919,6 +947,9 @@ function withRunScope(scope, fn) {
|
|
|
919
947
|
function currentWorkflowId() {
|
|
920
948
|
return storage.getStore()?.workflowId;
|
|
921
949
|
}
|
|
950
|
+
function currentRunId() {
|
|
951
|
+
return storage.getStore()?.runId ?? void 0;
|
|
952
|
+
}
|
|
922
953
|
function currentBoundConnections() {
|
|
923
954
|
return storage.getStore()?.connections;
|
|
924
955
|
}
|
|
@@ -926,6 +957,48 @@ function currentPieceWorker() {
|
|
|
926
957
|
return storage.getStore()?.pieceWorker;
|
|
927
958
|
}
|
|
928
959
|
//#endregion
|
|
960
|
+
//#region src/reactor/piece-store-port.ts
|
|
961
|
+
const logger$3 = childLogger(["workflow", "piece-store"]);
|
|
962
|
+
const PROJECT_SCOPE_KEY = "reactor";
|
|
963
|
+
const TEST_PARTITION_SUFFIX = "#test";
|
|
964
|
+
function testPartitionKey(scope, workflowId) {
|
|
965
|
+
return (scope === "PROJECT" ? `${PROJECT_SCOPE_KEY}#${workflowId}` : workflowId) + TEST_PARTITION_SUFFIX;
|
|
966
|
+
}
|
|
967
|
+
const CURSOR_KEY = "lastPoll";
|
|
968
|
+
const MAX_CURSOR_SKEW_MS = 864e5;
|
|
969
|
+
function isPlausibleCursor(value, now) {
|
|
970
|
+
return typeof value === "number" && Number.isFinite(value) && value > 0 && value <= now + MAX_CURSOR_SKEW_MS;
|
|
971
|
+
}
|
|
972
|
+
function isCursorShaped(value) {
|
|
973
|
+
return value === null || typeof value === "number";
|
|
974
|
+
}
|
|
975
|
+
function showCursor(value) {
|
|
976
|
+
return typeof value === "number" ? String(value) : JSON.stringify(value);
|
|
977
|
+
}
|
|
978
|
+
function isCursorRef(key) {
|
|
979
|
+
return key === CURSOR_KEY || key.endsWith(`/${CURSOR_KEY}`);
|
|
980
|
+
}
|
|
981
|
+
function createPieceStorePort(store, workflowIdFor, sample = false, clock = Date.now) {
|
|
982
|
+
const flowKey = () => {
|
|
983
|
+
const workflowId = workflowIdFor();
|
|
984
|
+
if (!workflowId) throw new Error("ctx.store is unavailable: no workflow is in scope");
|
|
985
|
+
return workflowId;
|
|
986
|
+
};
|
|
987
|
+
const partition = (scope) => sample ? testPartitionKey(scope, flowKey()) : scope === "PROJECT" ? PROJECT_SCOPE_KEY : flowKey();
|
|
988
|
+
return {
|
|
989
|
+
get: async (key, scope) => store.getPieceStoreValue(scope, partition(scope), key),
|
|
990
|
+
put: async (key, value, scope) => {
|
|
991
|
+
const now = clock();
|
|
992
|
+
if (!isCursorRef(key) || isPlausibleCursor(value, now)) return store.setPieceStoreValue(scope, partition(scope), key, value);
|
|
993
|
+
const kept = await store.getPieceStoreValue(scope, partition(scope), key);
|
|
994
|
+
if (!isCursorShaped(value) && !isPlausibleCursor(kept, now)) return store.setPieceStoreValue(scope, partition(scope), key, value);
|
|
995
|
+
logger$3.warn(`Rejected ${key}=${showCursor(value)} from workflow ${flowKey()}; keeping ${isPlausibleCursor(kept, now) ? String(kept) : "no cursor"}`);
|
|
996
|
+
if (!isPlausibleCursor(kept, now)) await store.deletePieceStoreValue(scope, partition(scope), key);
|
|
997
|
+
},
|
|
998
|
+
delete: async (key, scope) => store.deletePieceStoreValue(scope, partition(scope), key)
|
|
999
|
+
};
|
|
1000
|
+
}
|
|
1001
|
+
//#endregion
|
|
929
1002
|
//#region src/reactor/connector-id.ts
|
|
930
1003
|
function packageFromConnectorId(connectorId) {
|
|
931
1004
|
const separator = connectorId.lastIndexOf("#");
|
|
@@ -947,6 +1020,8 @@ var ConnectorMismatchError = class extends Error {
|
|
|
947
1020
|
}
|
|
948
1021
|
};
|
|
949
1022
|
var DocumentConnectionResolver = class {
|
|
1023
|
+
host;
|
|
1024
|
+
secrets;
|
|
950
1025
|
constructor(host, secrets) {
|
|
951
1026
|
this.host = host;
|
|
952
1027
|
this.secrets = secrets;
|
|
@@ -1015,6 +1090,11 @@ function createBlockExecutor(host, secrets, attachments, pieceStore, resolveBloc
|
|
|
1015
1090
|
cacheDir: BUNDLE_CACHE_DIR,
|
|
1016
1091
|
egress: configuredEgress(),
|
|
1017
1092
|
worker: currentPieceWorker,
|
|
1093
|
+
identity: () => ({
|
|
1094
|
+
runId: currentRunId(),
|
|
1095
|
+
flowId: currentWorkflowId(),
|
|
1096
|
+
projectId: PROJECT_SCOPE_KEY
|
|
1097
|
+
}),
|
|
1018
1098
|
resolver: pieceResolver(),
|
|
1019
1099
|
packages: () => Promise.resolve(packagePieces.versions()),
|
|
1020
1100
|
...resolveBlockType ? { resolveBlockType } : {},
|
|
@@ -1185,48 +1265,6 @@ function cronIntervalMs(cron, from = /* @__PURE__ */ new Date()) {
|
|
|
1185
1265
|
}
|
|
1186
1266
|
}
|
|
1187
1267
|
//#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
1268
|
//#region src/reactor/core-catalog.ts
|
|
1231
1269
|
const CORE_PIECE_NAME = "core";
|
|
1232
1270
|
function prop(name, displayName, description, options = {}) {
|
|
@@ -1328,7 +1366,6 @@ function coreBlockDescriptor(blockType) {
|
|
|
1328
1366
|
//#endregion
|
|
1329
1367
|
//#region src/reactor/secret-store.ts
|
|
1330
1368
|
const IV_BYTES = 12;
|
|
1331
|
-
const TAG_BYTES = 16;
|
|
1332
1369
|
const KEY_BYTES = 32;
|
|
1333
1370
|
async function up$1(db) {
|
|
1334
1371
|
await db.schema.createTable("secret").addColumn("id", "text", (col) => col.primaryKey()).addColumn("label", "text").addColumn("version", "integer", (col) => col.notNull()).addColumn("enc", "text").addColumn("status", "text", (col) => col.notNull()).addColumn("created_at", "text", (col) => col.notNull()).addColumn("updated_at", "text", (col) => col.notNull()).ifNotExists().execute();
|
|
@@ -1353,6 +1390,8 @@ function loadKey(options) {
|
|
|
1353
1390
|
return key;
|
|
1354
1391
|
}
|
|
1355
1392
|
var LocalEncryptedSecretStore = class LocalEncryptedSecretStore {
|
|
1393
|
+
db;
|
|
1394
|
+
key;
|
|
1356
1395
|
constructor(db, key) {
|
|
1357
1396
|
this.db = db;
|
|
1358
1397
|
this.key = key;
|
|
@@ -1375,10 +1414,10 @@ var LocalEncryptedSecretStore = class LocalEncryptedSecretStore {
|
|
|
1375
1414
|
decrypt(enc) {
|
|
1376
1415
|
const raw = Buffer.from(enc, "base64");
|
|
1377
1416
|
const iv = raw.subarray(0, IV_BYTES);
|
|
1378
|
-
const tag = raw.subarray(IV_BYTES,
|
|
1417
|
+
const tag = raw.subarray(IV_BYTES, 28);
|
|
1379
1418
|
const decipher = createDecipheriv("aes-256-gcm", this.key, iv);
|
|
1380
1419
|
decipher.setAuthTag(tag);
|
|
1381
|
-
return Buffer.concat([decipher.update(raw.subarray(
|
|
1420
|
+
return Buffer.concat([decipher.update(raw.subarray(28)), decipher.final()]).toString("utf8");
|
|
1382
1421
|
}
|
|
1383
1422
|
async row(ref) {
|
|
1384
1423
|
const id = parseSecretRef(ref);
|
|
@@ -1470,7 +1509,10 @@ async function up(db) {
|
|
|
1470
1509
|
} catch {}
|
|
1471
1510
|
await db.schema.createTable("trigger_state").addColumn("workflow_id", "text", (col) => col.primaryKey()).addColumn("block_type", "text", (col) => col.notNull()).addColumn("config_hash", "text", (col) => col.notNull()).addColumn("status", "text", (col) => col.notNull()).addColumn("store_state", "text", (col) => col.notNull()).addColumn("interval_ms", "integer", (col) => col.notNull()).addColumn("next_poll_at", "text").addColumn("last_poll_at", "text").addColumn("last_error", "text").addColumn("consecutive_failures", "integer", (col) => col.notNull()).addColumn("lease_owner", "text").addColumn("lease_expires_at", "text").addColumn("updated_at", "text", (col) => col.notNull()).ifNotExists().execute();
|
|
1472
1511
|
await db.schema.createTable("trigger_dedupe").addColumn("workflow_id", "text", (col) => col.notNull()).addColumn("dedupe_key", "text", (col) => col.notNull()).addColumn("run_id", "text").addColumn("created_at", "text", (col) => col.notNull()).addPrimaryKeyConstraint("trigger_dedupe_pk", ["workflow_id", "dedupe_key"]).ifNotExists().execute();
|
|
1473
|
-
await db.schema.createTable("step_execution").addColumn("id", "text", (col) => col.primaryKey()).addColumn("run_id", "text", (col) => col.notNull()).addColumn("ordinal", "integer", (col) => col.notNull()).addColumn("step_id", "text", (col) => col.notNull()).addColumn("step_key", "text", (col) => col.notNull()).addColumn("block_type", "text", (col) => col.notNull()).addColumn("status", "text", (col) => col.notNull()).addColumn("input", "text").addColumn("output", "text").addColumn("port", "text").addColumn("error", "text").addUniqueConstraint("step_execution_run_step", ["run_id", "step_id"]).ifNotExists().execute();
|
|
1512
|
+
await db.schema.createTable("step_execution").addColumn("id", "text", (col) => col.primaryKey()).addColumn("run_id", "text", (col) => col.notNull()).addColumn("ordinal", "integer", (col) => col.notNull()).addColumn("step_id", "text", (col) => col.notNull()).addColumn("step_key", "text", (col) => col.notNull()).addColumn("block_type", "text", (col) => col.notNull()).addColumn("status", "text", (col) => col.notNull()).addColumn("input", "text").addColumn("output", "text").addColumn("port", "text").addColumn("error", "text").addColumn("started_at", "text").addColumn("ended_at", "text").addUniqueConstraint("step_execution_run_step", ["run_id", "step_id"]).ifNotExists().execute();
|
|
1513
|
+
for (const column of ["started_at", "ended_at"]) try {
|
|
1514
|
+
await db.schema.alterTable("step_execution").addColumn(column, "text").execute();
|
|
1515
|
+
} catch {}
|
|
1474
1516
|
try {
|
|
1475
1517
|
await db.schema.alterTable("step_execution").addUniqueConstraint("step_execution_run_step", ["run_id", "step_id"]).execute();
|
|
1476
1518
|
} catch (error) {
|
|
@@ -1594,7 +1636,7 @@ function warnIfOverPieceStoreLimits(scope, scopeKey, key, encoded) {
|
|
|
1594
1636
|
const size = Buffer.byteLength(encoded, "utf8");
|
|
1595
1637
|
if (size > 524288) logger$2.warn(`Migrated store value ${at} is ${size} bytes, over the ${PIECE_STORE_MAX_VALUE_BYTES} limit; writes to it will fail`);
|
|
1596
1638
|
}
|
|
1597
|
-
const PIECE_STORE_MAX_VALUE_BYTES =
|
|
1639
|
+
const PIECE_STORE_MAX_VALUE_BYTES = 524288;
|
|
1598
1640
|
var PieceStoreLimitError = class extends Error {
|
|
1599
1641
|
constructor(message) {
|
|
1600
1642
|
super(message);
|
|
@@ -1619,7 +1661,9 @@ function stepValues(runId, ordinal, step) {
|
|
|
1619
1661
|
input: jsonOrNull(redact(step.input)),
|
|
1620
1662
|
output: jsonOrNull(redact(step.output)),
|
|
1621
1663
|
port: step.port ?? null,
|
|
1622
|
-
error: step.error ? redactMessage(step.error) : null
|
|
1664
|
+
error: step.error ? redactMessage(step.error) : null,
|
|
1665
|
+
started_at: step.startedAt ?? null,
|
|
1666
|
+
ended_at: step.endedAt ?? null
|
|
1623
1667
|
};
|
|
1624
1668
|
}
|
|
1625
1669
|
function jsonOrNull(value) {
|
|
@@ -1631,6 +1675,8 @@ function jsonOrNull(value) {
|
|
|
1631
1675
|
}
|
|
1632
1676
|
}
|
|
1633
1677
|
var WorkflowRunStore = class WorkflowRunStore {
|
|
1678
|
+
db;
|
|
1679
|
+
unmigrated;
|
|
1634
1680
|
runsInFlight = /* @__PURE__ */ new Set();
|
|
1635
1681
|
constructor(db, unmigrated) {
|
|
1636
1682
|
this.db = db;
|
|
@@ -1638,7 +1684,8 @@ var WorkflowRunStore = class WorkflowRunStore {
|
|
|
1638
1684
|
}
|
|
1639
1685
|
static async create(relationalDb) {
|
|
1640
1686
|
const db = await relationalDb.createNamespace("workflow_runtime");
|
|
1641
|
-
const
|
|
1687
|
+
const unmigrated = await up(db);
|
|
1688
|
+
const store = new WorkflowRunStore(db, unmigrated);
|
|
1642
1689
|
await store.recoverOrphanedRuns();
|
|
1643
1690
|
await store.recoverAbandonedRuns();
|
|
1644
1691
|
return store;
|
|
@@ -1761,7 +1808,9 @@ var WorkflowRunStore = class WorkflowRunStore {
|
|
|
1761
1808
|
input: eb.ref("excluded.input"),
|
|
1762
1809
|
output: eb.ref("excluded.output"),
|
|
1763
1810
|
port: eb.ref("excluded.port"),
|
|
1764
|
-
error: eb.ref("excluded.error")
|
|
1811
|
+
error: eb.ref("excluded.error"),
|
|
1812
|
+
started_at: eb.ref("excluded.started_at"),
|
|
1813
|
+
ended_at: eb.ref("excluded.ended_at")
|
|
1765
1814
|
}))).execute();
|
|
1766
1815
|
}
|
|
1767
1816
|
async failRun(runId, error) {
|
|
@@ -1891,9 +1940,9 @@ var WorkflowRunStore = class WorkflowRunStore {
|
|
|
1891
1940
|
const logger$1 = childLogger(["workflow", "trigger-supervisor"]);
|
|
1892
1941
|
const SCHEDULE_TRIGGER_KIND = "schedule";
|
|
1893
1942
|
const MIN_INTERVAL_MS = MIN_SCHEDULE_INTERVAL_MS;
|
|
1894
|
-
const MAX_BACKOFF_MS =
|
|
1943
|
+
const MAX_BACKOFF_MS = 18e5;
|
|
1895
1944
|
const DEDUPE_TTL_MS = 3e4;
|
|
1896
|
-
const DEFAULT_RECONCILE_INTERVAL_MS =
|
|
1945
|
+
const DEFAULT_RECONCILE_INTERVAL_MS = 9e5;
|
|
1897
1946
|
function isSchedule(binding) {
|
|
1898
1947
|
return binding.kind === "schedule";
|
|
1899
1948
|
}
|
|
@@ -1931,12 +1980,13 @@ var TriggerConfigError = class extends Error {
|
|
|
1931
1980
|
};
|
|
1932
1981
|
function isPermanentFailure(error) {
|
|
1933
1982
|
if (error instanceof TriggerConfigError) return true;
|
|
1934
|
-
return error instanceof PieceWorkerError && error.serialized.unsupportedMember !== void 0;
|
|
1983
|
+
return error instanceof PieceWorkerError && (error.serialized.unsupportedMember !== void 0 || error.serialized.unsupportedFeature !== void 0 || error.serialized.invalidProps !== void 0);
|
|
1935
1984
|
}
|
|
1936
1985
|
function backoffMs(intervalMs, failures) {
|
|
1937
1986
|
return Math.min(intervalMs * 2 ** failures, MAX_BACKOFF_MS);
|
|
1938
1987
|
}
|
|
1939
1988
|
var TriggerSupervisor = class {
|
|
1989
|
+
options;
|
|
1940
1990
|
bindings = /* @__PURE__ */ new Map();
|
|
1941
1991
|
worker;
|
|
1942
1992
|
tickMs;
|
|
@@ -2103,7 +2153,10 @@ var TriggerSupervisor = class {
|
|
|
2103
2153
|
auth,
|
|
2104
2154
|
...redactValues.length > 0 ? { redactValues } : {},
|
|
2105
2155
|
...pieceStore ? { durableStore: true } : {},
|
|
2106
|
-
identity: {
|
|
2156
|
+
identity: {
|
|
2157
|
+
flowId: binding.workflowId,
|
|
2158
|
+
projectId: PROJECT_SCOPE_KEY
|
|
2159
|
+
},
|
|
2107
2160
|
isRepublish: options.isRepublish,
|
|
2108
2161
|
payload: options.payload,
|
|
2109
2162
|
webhookUrl: options.webhookUrl ?? `http://localhost:0/v1/webhooks/${binding.workflowId}`,
|
|
@@ -2126,7 +2179,10 @@ var TriggerSupervisor = class {
|
|
|
2126
2179
|
}, { timeoutMs: this.hookTimeoutMs })).output;
|
|
2127
2180
|
this.descriptors.set(key, descriptor);
|
|
2128
2181
|
}
|
|
2129
|
-
|
|
2182
|
+
const trigger = descriptor.triggers.find((candidate) => candidate.name === binding.triggerName);
|
|
2183
|
+
const unsupported = descriptor.unsupported ?? trigger?.unsupported;
|
|
2184
|
+
if (unsupported) throw new TriggerConfigError(`Trigger "${binding.triggerName}" of "${binding.packageName}": ${unsupported.reason}`);
|
|
2185
|
+
return trigger?.strategy ?? "POLLING";
|
|
2130
2186
|
}
|
|
2131
2187
|
async enable(binding, superseded) {
|
|
2132
2188
|
const store = await this.options.store();
|
|
@@ -2395,19 +2451,19 @@ var TriggerSupervisor = class {
|
|
|
2395
2451
|
//#region src/reactor/webhook.ts
|
|
2396
2452
|
const WEBHOOK_BLOCK = "core#webhook";
|
|
2397
2453
|
const WEBHOOK_TRIGGER_KIND = "webhook";
|
|
2398
|
-
const ALGORITHMS = new Set([
|
|
2454
|
+
const ALGORITHMS = /* @__PURE__ */ new Set([
|
|
2399
2455
|
"sha1",
|
|
2400
2456
|
"sha256",
|
|
2401
2457
|
"sha512"
|
|
2402
2458
|
]);
|
|
2403
|
-
const ENCODINGS = new Set(["hex", "base64"]);
|
|
2404
|
-
const SIGNED_SCHEMES = new Set([
|
|
2459
|
+
const ENCODINGS = /* @__PURE__ */ new Set(["hex", "base64"]);
|
|
2460
|
+
const SIGNED_SCHEMES = /* @__PURE__ */ new Set([
|
|
2405
2461
|
"token",
|
|
2406
2462
|
"hmac",
|
|
2407
2463
|
"hmac-prefixed",
|
|
2408
2464
|
"hmac-timestamped"
|
|
2409
2465
|
]);
|
|
2410
|
-
const SCHEMES = new Set([
|
|
2466
|
+
const SCHEMES = /* @__PURE__ */ new Set([
|
|
2411
2467
|
"none",
|
|
2412
2468
|
"token",
|
|
2413
2469
|
"hmac",
|
|
@@ -2601,7 +2657,7 @@ const CHILD_RELATIONSHIP = "child";
|
|
|
2601
2657
|
function operationKey(op) {
|
|
2602
2658
|
return op.context.ordinal > 0 ? `o:${op.context.ordinal}` : `${op.context.documentId}:${op.context.scope}:${op.context.branch}:${op.operation.index}`;
|
|
2603
2659
|
}
|
|
2604
|
-
const OPERATION_DEDUPE_TTL_MS =
|
|
2660
|
+
const OPERATION_DEDUPE_TTL_MS = 864e5;
|
|
2605
2661
|
function stringField(record, key) {
|
|
2606
2662
|
const value = record[key];
|
|
2607
2663
|
return typeof value === "string" && value !== "" ? value : void 0;
|
|
@@ -2645,19 +2701,6 @@ function collectLifecycleParentHints(operations) {
|
|
|
2645
2701
|
}
|
|
2646
2702
|
return hints;
|
|
2647
2703
|
}
|
|
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
2704
|
function pieceFailureDetail(error, timeoutDetail) {
|
|
2662
2705
|
if (error instanceof PieceWorkerTimeoutError) return timeoutDetail;
|
|
2663
2706
|
if (error instanceof PieceWorkerError) return error.serialized.message;
|
|
@@ -2667,7 +2710,7 @@ function checkFailureDetail(error) {
|
|
|
2667
2710
|
return pieceFailureDetail(error, `Connection check timed out after ${Math.round(CHECK_TIMEOUT_MS / 1e3)}s`);
|
|
2668
2711
|
}
|
|
2669
2712
|
const PIECE_WEBHOOK_KIND = "piece-webhook";
|
|
2670
|
-
const SUPERVISED_KINDS = new Set([
|
|
2713
|
+
const SUPERVISED_KINDS = /* @__PURE__ */ new Set([
|
|
2671
2714
|
"piece",
|
|
2672
2715
|
"schedule",
|
|
2673
2716
|
PIECE_WEBHOOK_KIND
|
|
@@ -2681,10 +2724,10 @@ function hasCredentials(state) {
|
|
|
2681
2724
|
function isAbsentFromCatalog(error) {
|
|
2682
2725
|
return error instanceof CatalogStatusError && error.status === 404;
|
|
2683
2726
|
}
|
|
2684
|
-
const PIECE_VERSION_MISS_TTL_MS =
|
|
2727
|
+
const PIECE_VERSION_MISS_TTL_MS = 3e5;
|
|
2685
2728
|
const PIECE_VERSION_LOOKUP_TIMEOUT_MS = 2e3;
|
|
2686
2729
|
const UNREACHABLE_RETRY_MS = 3e4;
|
|
2687
|
-
const UNREACHABLE_RETRY_CAP_MS =
|
|
2730
|
+
const UNREACHABLE_RETRY_CAP_MS = 9e5;
|
|
2688
2731
|
const UNAUTHORIZED = { status: 401 };
|
|
2689
2732
|
const JSON_CONTENT_TYPE = "application/json; charset=utf-8";
|
|
2690
2733
|
const DELIVERY_TIMEOUT_MS = Number(process.env.PH_WORKFLOWS_WEBHOOK_TIMEOUT_MS) || 3e4;
|
|
@@ -3543,20 +3586,16 @@ var WorkflowRuntimeService = class {
|
|
|
3543
3586
|
accountLabel
|
|
3544
3587
|
});
|
|
3545
3588
|
}
|
|
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, {
|
|
3589
|
+
if (!outcome.valid) return this.recordCheckResult(document, {
|
|
3552
3590
|
ok: false,
|
|
3553
3591
|
detail: outcome.detail ?? "Connection check failed",
|
|
3554
3592
|
accountLabel
|
|
3555
3593
|
});
|
|
3594
|
+
if (outcome.identifierError) this.logger.warn("Connection @id kept its label: getConnectionIdentifier failed: @detail", connectionId, outcome.identifierError);
|
|
3556
3595
|
return this.recordCheckResult(document, {
|
|
3557
3596
|
ok: true,
|
|
3558
|
-
detail: null,
|
|
3559
|
-
accountLabel:
|
|
3597
|
+
detail: outcome.declared ? null : "piece declares no auth.validate; credentials resolved",
|
|
3598
|
+
accountLabel: outcome.accountLabel ?? accountLabel
|
|
3560
3599
|
});
|
|
3561
3600
|
}
|
|
3562
3601
|
versionMisses = /* @__PURE__ */ new Map();
|
|
@@ -3632,12 +3671,14 @@ var WorkflowRuntimeService = class {
|
|
|
3632
3671
|
}
|
|
3633
3672
|
}
|
|
3634
3673
|
async recordCheckResult(document, result) {
|
|
3635
|
-
const
|
|
3674
|
+
const actionList = [actions.recordCheckResult({
|
|
3636
3675
|
status: result.ok ? "OK" : "ERROR",
|
|
3637
3676
|
checkedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
3638
3677
|
error: result.ok ? void 0 : result.detail ?? void 0
|
|
3639
|
-
});
|
|
3640
|
-
|
|
3678
|
+
})];
|
|
3679
|
+
const label = result.accountLabel;
|
|
3680
|
+
if (label && label !== (document.state.global.accountLabel ?? null)) actionList.push(actions.setAccountLabel({ accountLabel: label }));
|
|
3681
|
+
await this.host.reactorClient.execute(document.header.id, "main", actionList);
|
|
3641
3682
|
return result;
|
|
3642
3683
|
}
|
|
3643
3684
|
async localPieces() {
|
|
@@ -3707,13 +3748,15 @@ var WorkflowRuntimeService = class {
|
|
|
3707
3748
|
const parsed = await this.resolvedBlock(blockType);
|
|
3708
3749
|
if (!parsed) return null;
|
|
3709
3750
|
const descriptor = await this.pieceDescriptor(parsed.packageName, parsed.version);
|
|
3751
|
+
if (descriptor.unsupported) throw new UnsupportedPieceFeatureError(`Piece "${parsed.packageName}"`, descriptor.unsupported);
|
|
3710
3752
|
const common = {
|
|
3711
3753
|
displayName: descriptor.displayName,
|
|
3712
3754
|
logoUrl: descriptor.logoUrl,
|
|
3713
|
-
auth: descriptor.auth
|
|
3755
|
+
auth: clientAuth(descriptor.auth)
|
|
3714
3756
|
};
|
|
3715
3757
|
if (parsed.kind === "trigger") {
|
|
3716
3758
|
const trigger = descriptor.triggers.find((entry) => entry.name === parsed.name);
|
|
3759
|
+
if (trigger?.unsupported) throw new UnsupportedPieceFeatureError(`Trigger "${parsed.name}" of "${parsed.packageName}"`, trigger.unsupported);
|
|
3717
3760
|
return trigger ? {
|
|
3718
3761
|
...common,
|
|
3719
3762
|
trigger
|
|
@@ -3767,6 +3810,7 @@ var WorkflowRuntimeService = class {
|
|
|
3767
3810
|
propName,
|
|
3768
3811
|
refresherValues: input ?? {},
|
|
3769
3812
|
auth,
|
|
3813
|
+
projectId: PROJECT_SCOPE_KEY,
|
|
3770
3814
|
...servesReactorPort(parsed.packageName) ? { reactorAccess: true } : {},
|
|
3771
3815
|
...this.designEgress ? { egress: this.designEgress } : {}
|
|
3772
3816
|
}, servesReactorPort(parsed.packageName) ? { hostCalls: reactorHandlers(new ScopedDesignTimeReactorPort(this.host, ctx)) } : {})).output;
|
|
@@ -4019,6 +4063,7 @@ function createWorkflowRuntime(deps) {
|
|
|
4019
4063
|
const WORKFLOW_TRIGGERS_READ_MODEL = "workflow-triggers";
|
|
4020
4064
|
const WORKFLOW_TRIGGERS_READ_MODEL_STAGE = "post_ready";
|
|
4021
4065
|
var WorkflowTriggersReadModel = class extends BaseReadModel {
|
|
4066
|
+
runtime;
|
|
4022
4067
|
freshRegistration = false;
|
|
4023
4068
|
constructor(db, operationIndex, writeCache, consistencyTracker, runtime) {
|
|
4024
4069
|
super(db, operationIndex, writeCache, consistencyTracker, {
|