@powerhousedao/reactor-workflow 6.2.3-dev.29 → 6.2.3-dev.31
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 +183 -9
- package/dist/index.d.ts +214 -40
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6880 -660
- package/dist/index.js.map +1 -1
- package/dist/loader-Gkx6I_Bo.js +91 -0
- package/dist/loader-Gkx6I_Bo.js.map +1 -0
- package/dist/{piece-registry-CAS4wiSA.js → piece-registry-Du1_VVIg.js} +1126 -167
- package/dist/piece-registry-Du1_VVIg.js.map +1 -0
- package/dist/{piece-registry-DbYbKifY.d.ts → piece-registry-iXg2XQxp.d.ts} +124 -23
- package/dist/piece-registry-iXg2XQxp.d.ts.map +1 -0
- package/dist/{redact-DM3JhxdF.js → redact-LRWHJGW9.js} +245 -5
- package/dist/redact-LRWHJGW9.js.map +1 -0
- package/dist/testing.d.ts +4 -15
- package/dist/testing.d.ts.map +1 -1
- package/dist/testing.js +4 -4
- package/dist/worker-entry.js +18 -8
- package/dist/worker-entry.js.map +1 -1
- package/package.json +9 -7
- package/dist/descriptor-BImUIBMP.js +0 -256
- package/dist/descriptor-BImUIBMP.js.map +0 -1
- package/dist/piece-registry-CAS4wiSA.js.map +0 -1
- package/dist/piece-registry-DbYbKifY.d.ts.map +0 -1
- package/dist/redact-DM3JhxdF.js.map +0 -1
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { ActionBase, AppConnectionType, BasePropertySchema, DropdownOption, DropdownProperty, DropdownState, ExecutionType, InputPropertyMap, PackagePiece, PieceBase, ReactorService, ServerContext, SetScheduleRequest, StoreScope, TestOrRunHookContext, TriggerBase, TriggerStrategy, WebhookHandshakeConfiguration } from "@powerhousedao/pieces-framework";
|
|
2
|
+
import { CORE_PIECE_NAME } from "@powerhousedao/pieces-framework/workflow";
|
|
3
|
+
import { BlockIdentity, BlockRef } from "@powerhousedao/pieces-framework/block-type";
|
|
2
4
|
//#region src/pieces/activepieces/types.d.ts
|
|
3
5
|
type ApPropertyType = string;
|
|
4
6
|
type ApDropdownOption = Pick<DropdownOption<unknown>, "label" | "value"> & Partial<Pick<DropdownOption<unknown>, "description" | "icon">>;
|
|
@@ -22,6 +24,8 @@ type ApProperty = Partial<Pick<BasePropertySchema, "displayName" | "description"
|
|
|
22
24
|
step?: number;
|
|
23
25
|
refreshOnSearch?: boolean;
|
|
24
26
|
formatProperty?: string;
|
|
27
|
+
showWhen?: unknown;
|
|
28
|
+
emptyChoice?: unknown;
|
|
25
29
|
};
|
|
26
30
|
interface ApPropertyGroup {
|
|
27
31
|
key?: string;
|
|
@@ -45,7 +49,9 @@ type ApAction = Partial<Pick<ActionBase, "name" | "displayName" | "description"
|
|
|
45
49
|
retryOnFailure?: ApErrorHandlingOption;
|
|
46
50
|
continueOnFailure?: ApErrorHandlingOption;
|
|
47
51
|
};
|
|
52
|
+
ports?: unknown;
|
|
48
53
|
run: (ctx: unknown) => Promise<unknown>;
|
|
54
|
+
test?: (ctx: unknown) => Promise<unknown>;
|
|
49
55
|
};
|
|
50
56
|
type ApTriggerStrategy = string;
|
|
51
57
|
type ApHandshakeConfiguration = Partial<Omit<WebhookHandshakeConfiguration, "strategy">> & {
|
|
@@ -54,6 +60,7 @@ type ApHandshakeConfiguration = Partial<Omit<WebhookHandshakeConfiguration, "str
|
|
|
54
60
|
type ApTrigger = Partial<Pick<TriggerBase, "name" | "displayName" | "description" | "requireAuth" | "sampleData">> & {
|
|
55
61
|
type?: ApTriggerStrategy;
|
|
56
62
|
testStrategy?: string;
|
|
63
|
+
display?: unknown;
|
|
57
64
|
props?: Record<string, ApProperty>;
|
|
58
65
|
propertyGroups?: ApPropertyGroup[];
|
|
59
66
|
outputSchema?: unknown;
|
|
@@ -95,6 +102,10 @@ interface UnsupportedFeature {
|
|
|
95
102
|
issue: number;
|
|
96
103
|
reason: string;
|
|
97
104
|
}
|
|
105
|
+
interface TriggerRenew {
|
|
106
|
+
strategy: "CRON";
|
|
107
|
+
cronExpression: string;
|
|
108
|
+
}
|
|
98
109
|
//#endregion
|
|
99
110
|
//#region src/pieces/activepieces/descriptor.d.ts
|
|
100
111
|
interface PiecePropDescriptor {
|
|
@@ -123,6 +134,11 @@ interface PiecePropDescriptor {
|
|
|
123
134
|
formatProperty?: string;
|
|
124
135
|
staticDisabled?: boolean;
|
|
125
136
|
staticPlaceholder?: string;
|
|
137
|
+
showWhen?: {
|
|
138
|
+
prop: string;
|
|
139
|
+
oneOf: unknown[];
|
|
140
|
+
};
|
|
141
|
+
emptyChoice?: string;
|
|
126
142
|
}
|
|
127
143
|
interface PiecePropertyGroupDescriptor {
|
|
128
144
|
key: string;
|
|
@@ -148,6 +164,7 @@ interface PieceActionDescriptor {
|
|
|
148
164
|
description?: string;
|
|
149
165
|
requireAuth: boolean;
|
|
150
166
|
props: PiecePropDescriptor[];
|
|
167
|
+
ports: readonly string[];
|
|
151
168
|
outputSchema?: unknown;
|
|
152
169
|
audience?: string;
|
|
153
170
|
propertyGroups?: PiecePropertyGroupDescriptor[];
|
|
@@ -160,8 +177,10 @@ interface PieceTriggerDescriptor {
|
|
|
160
177
|
description?: string;
|
|
161
178
|
strategy: ApTriggerStrategy;
|
|
162
179
|
testStrategy?: string;
|
|
180
|
+
display?: string;
|
|
163
181
|
requireAuth: boolean;
|
|
164
182
|
props: PiecePropDescriptor[];
|
|
183
|
+
ports: readonly string[];
|
|
165
184
|
propertyGroups?: PiecePropertyGroupDescriptor[];
|
|
166
185
|
outputSchema?: unknown;
|
|
167
186
|
hasSampleData: boolean;
|
|
@@ -170,6 +189,7 @@ interface PieceTriggerDescriptor {
|
|
|
170
189
|
strategy: string;
|
|
171
190
|
paramName?: string;
|
|
172
191
|
};
|
|
192
|
+
renew?: TriggerRenew;
|
|
173
193
|
unsupported?: UnsupportedFeature;
|
|
174
194
|
}
|
|
175
195
|
interface PieceAuthDescriptor {
|
|
@@ -178,8 +198,20 @@ interface PieceAuthDescriptor {
|
|
|
178
198
|
description?: string;
|
|
179
199
|
required?: boolean;
|
|
180
200
|
props?: PiecePropDescriptor[];
|
|
201
|
+
oauth2?: OAuth2MethodDescriptor;
|
|
181
202
|
unsupported?: UnsupportedFeature;
|
|
182
203
|
}
|
|
204
|
+
interface OAuth2MethodDescriptor {
|
|
205
|
+
authUrl: string;
|
|
206
|
+
tokenUrl: string;
|
|
207
|
+
scope: string[];
|
|
208
|
+
prompt?: "none" | "consent" | "login" | "omit";
|
|
209
|
+
pkce?: boolean;
|
|
210
|
+
pkceMethod?: "plain" | "S256";
|
|
211
|
+
authorizationMethod?: "HEADER" | "BODY";
|
|
212
|
+
grantType?: string;
|
|
213
|
+
extra?: Record<string, string>;
|
|
214
|
+
}
|
|
183
215
|
interface PieceSource {
|
|
184
216
|
packageName: string;
|
|
185
217
|
version: string;
|
|
@@ -199,7 +231,32 @@ interface PieceDescriptor {
|
|
|
199
231
|
triggers: PieceTriggerDescriptor[];
|
|
200
232
|
unsupported?: UnsupportedFeature;
|
|
201
233
|
}
|
|
202
|
-
|
|
234
|
+
interface BuildDescriptorOptions {
|
|
235
|
+
routed?: boolean;
|
|
236
|
+
hostFed?: boolean;
|
|
237
|
+
}
|
|
238
|
+
declare function buildDescriptor(piece: ApPiece, source: PieceSource, options?: BuildDescriptorOptions): PieceDescriptor;
|
|
239
|
+
//#endregion
|
|
240
|
+
//#region src/pieces/engine/resolution.d.ts
|
|
241
|
+
type PieceOrigin = "local" | "registry" | "activepieces" | "npm";
|
|
242
|
+
type BlockMatch = "exact" | "compatible" | "fallback" | "installed" | "missing";
|
|
243
|
+
interface BlockResolution {
|
|
244
|
+
requested: BlockRef;
|
|
245
|
+
resolved?: {
|
|
246
|
+
version: string;
|
|
247
|
+
source?: PieceOrigin;
|
|
248
|
+
};
|
|
249
|
+
match: BlockMatch;
|
|
250
|
+
note?: string;
|
|
251
|
+
latestVersion?: string;
|
|
252
|
+
unreachable?: string;
|
|
253
|
+
}
|
|
254
|
+
interface StepPieceRecord {
|
|
255
|
+
version: string;
|
|
256
|
+
source?: PieceOrigin;
|
|
257
|
+
match: BlockMatch;
|
|
258
|
+
note?: string;
|
|
259
|
+
}
|
|
203
260
|
//#endregion
|
|
204
261
|
//#region src/pieces/activepieces/context/store-scope.d.ts
|
|
205
262
|
type StoreScopeName = keyof typeof StoreScope;
|
|
@@ -261,6 +318,7 @@ interface RunActionRequest extends HostScopedRequest, PieceModuleRef {
|
|
|
261
318
|
captureLogs?: boolean;
|
|
262
319
|
liveOutput?: boolean;
|
|
263
320
|
executionType?: `${ExecutionType}`;
|
|
321
|
+
stepTest?: boolean;
|
|
264
322
|
identity?: ActionContextIdentity;
|
|
265
323
|
redactValues?: string[];
|
|
266
324
|
reactorAccess?: boolean;
|
|
@@ -277,7 +335,7 @@ interface ResolveOptionsRequest extends HostScopedRequest, PieceModuleRef {
|
|
|
277
335
|
}
|
|
278
336
|
interface TriggerHookRequest extends HostScopedRequest, PieceModuleRef {
|
|
279
337
|
triggerName: string;
|
|
280
|
-
hook: "onEnable" | "onDisable" | "run" | "test" | "onHandshake";
|
|
338
|
+
hook: "onEnable" | "onDisable" | "run" | "test" | "onHandshake" | "onRenew";
|
|
281
339
|
propsValue: Record<string, unknown>;
|
|
282
340
|
auth?: unknown;
|
|
283
341
|
storeState?: Record<string, unknown>;
|
|
@@ -310,8 +368,13 @@ interface ResolvedPiece extends PieceModuleRef {
|
|
|
310
368
|
version: string;
|
|
311
369
|
local: boolean;
|
|
312
370
|
}
|
|
371
|
+
interface PieceTarget {
|
|
372
|
+
name: string;
|
|
373
|
+
version: string;
|
|
374
|
+
source?: PieceOrigin;
|
|
375
|
+
}
|
|
313
376
|
interface PieceResolver {
|
|
314
|
-
resolve(
|
|
377
|
+
resolve(target: PieceTarget): Promise<ResolvedPiece>;
|
|
315
378
|
}
|
|
316
379
|
interface LocalPiece {
|
|
317
380
|
name: string;
|
|
@@ -321,7 +384,11 @@ interface LocalPiece {
|
|
|
321
384
|
entryUrl?: string;
|
|
322
385
|
}
|
|
323
386
|
type LocalPieceLookup = (name: string) => LocalPiece | undefined | Promise<LocalPiece | undefined>;
|
|
324
|
-
declare function
|
|
387
|
+
declare function sourcedResolver(options: {
|
|
388
|
+
cacheDir: string;
|
|
389
|
+
lookup?: LocalPieceLookup;
|
|
390
|
+
timeoutMs?: number;
|
|
391
|
+
}): PieceResolver;
|
|
325
392
|
//#endregion
|
|
326
393
|
//#region src/pieces/activepieces/worker/transport.d.ts
|
|
327
394
|
interface TransportExit {
|
|
@@ -461,21 +528,32 @@ declare class PieceWorkerPool {
|
|
|
461
528
|
}
|
|
462
529
|
//#endregion
|
|
463
530
|
//#region src/pieces/engine/types.d.ts
|
|
531
|
+
interface PropertySettingDef {
|
|
532
|
+
prop: string;
|
|
533
|
+
mode?: string;
|
|
534
|
+
schema?: unknown;
|
|
535
|
+
}
|
|
464
536
|
interface WorkflowTriggerDef {
|
|
465
537
|
id: string;
|
|
466
|
-
|
|
538
|
+
pieceName: string;
|
|
539
|
+
pieceVersion: string;
|
|
540
|
+
triggerName: string;
|
|
467
541
|
connectionId?: string | null;
|
|
468
542
|
config?: unknown;
|
|
469
|
-
|
|
543
|
+
propertySettings?: PropertySettingDef[] | null;
|
|
470
544
|
}
|
|
471
545
|
interface WorkflowStepDef {
|
|
472
546
|
id: string;
|
|
473
547
|
key: string;
|
|
474
548
|
name?: string;
|
|
475
|
-
|
|
549
|
+
pieceName: string;
|
|
550
|
+
pieceVersion: string;
|
|
551
|
+
actionName: string;
|
|
476
552
|
connectionId?: string | null;
|
|
477
553
|
config: unknown;
|
|
478
554
|
timeoutSeconds?: number | null;
|
|
555
|
+
propertySettings?: PropertySettingDef[] | null;
|
|
556
|
+
skip?: boolean | null;
|
|
479
557
|
}
|
|
480
558
|
interface WorkflowEdgeDef {
|
|
481
559
|
id: string;
|
|
@@ -496,15 +574,17 @@ interface WorkflowDefinition {
|
|
|
496
574
|
variables?: WorkflowVariableDef[];
|
|
497
575
|
}
|
|
498
576
|
interface BlockExecution {
|
|
499
|
-
|
|
577
|
+
block: BlockRef;
|
|
500
578
|
config: unknown;
|
|
501
579
|
connectionId?: string | null;
|
|
502
580
|
step: WorkflowStepDef;
|
|
581
|
+
redactValues?: string[];
|
|
503
582
|
}
|
|
504
583
|
interface BlockResult {
|
|
505
584
|
output: unknown;
|
|
506
585
|
port?: string;
|
|
507
586
|
redactValues?: string[];
|
|
587
|
+
resolution?: BlockResolution;
|
|
508
588
|
}
|
|
509
589
|
interface BlockExecutor {
|
|
510
590
|
execute(execution: BlockExecution): Promise<BlockResult>;
|
|
@@ -513,7 +593,8 @@ type StepExecutionStatus = "SUCCEEDED" | "FAILED" | "SKIPPED" | "REPLAYED";
|
|
|
513
593
|
interface StepExecutionRecord {
|
|
514
594
|
stepId: string;
|
|
515
595
|
key: string;
|
|
516
|
-
|
|
596
|
+
pieceName: string;
|
|
597
|
+
blockName: string;
|
|
517
598
|
status: StepExecutionStatus;
|
|
518
599
|
input?: unknown;
|
|
519
600
|
output?: unknown;
|
|
@@ -521,12 +602,15 @@ interface StepExecutionRecord {
|
|
|
521
602
|
error?: string;
|
|
522
603
|
startedAt?: string;
|
|
523
604
|
endedAt?: string;
|
|
605
|
+
piece?: StepPieceRecord;
|
|
606
|
+
configHash?: string;
|
|
524
607
|
}
|
|
525
608
|
type WorkflowRunStatus = "SUCCEEDED" | "FAILED";
|
|
526
609
|
interface WorkflowRunResult {
|
|
527
610
|
status: WorkflowRunStatus;
|
|
528
611
|
steps: StepExecutionRecord[];
|
|
529
612
|
error?: string;
|
|
613
|
+
warnings?: string[];
|
|
530
614
|
}
|
|
531
615
|
//#endregion
|
|
532
616
|
//#region src/pieces/engine/secrets.d.ts
|
|
@@ -557,6 +641,16 @@ declare class InMemorySecretProvider implements SecretProvider {
|
|
|
557
641
|
get(ref: string): Promise<string>;
|
|
558
642
|
}
|
|
559
643
|
//#endregion
|
|
644
|
+
//#region src/pieces/engine/expressions.d.ts
|
|
645
|
+
interface ExpressionScope {
|
|
646
|
+
trigger?: unknown;
|
|
647
|
+
steps: Record<string, {
|
|
648
|
+
output?: unknown;
|
|
649
|
+
error?: string;
|
|
650
|
+
}>;
|
|
651
|
+
variables: Record<string, unknown>;
|
|
652
|
+
}
|
|
653
|
+
//#endregion
|
|
560
654
|
//#region src/pieces/engine/connections.d.ts
|
|
561
655
|
type ConnectionAuthType = `${AppConnectionType.SECRET_TEXT}` | `${AppConnectionType.BASIC_AUTH}` | `${AppConnectionType.CUSTOM_AUTH}` | `${AppConnectionType.OAUTH2}` | `${AppConnectionType.OIDC}` | "NONE";
|
|
562
656
|
interface ConnectionSource {
|
|
@@ -568,7 +662,6 @@ interface ConnectionSource {
|
|
|
568
662
|
}[];
|
|
569
663
|
}
|
|
570
664
|
interface ConnectionRequest {
|
|
571
|
-
blockType: string;
|
|
572
665
|
piecePackage?: string;
|
|
573
666
|
stepId?: string;
|
|
574
667
|
stepKey?: string;
|
|
@@ -610,8 +703,7 @@ interface PieceStorePort {
|
|
|
610
703
|
type ReactorPort = ReactorService;
|
|
611
704
|
interface ActivepiecesBlockExecutorOptions {
|
|
612
705
|
cacheDir: string;
|
|
613
|
-
|
|
614
|
-
resolveBlockType?: (blockType: string) => Promise<ParsedBlockType | undefined>;
|
|
706
|
+
resolveBlock?: (block: BlockRef) => Promise<BlockResolution>;
|
|
615
707
|
connections?: EngineConnectionResolver;
|
|
616
708
|
worker?: IPieceWorker | (() => IPieceWorker | undefined);
|
|
617
709
|
defaultTimeoutMs?: number;
|
|
@@ -624,13 +716,7 @@ interface ActivepiecesBlockExecutorOptions {
|
|
|
624
716
|
onPieceLog?: (entry: PieceLogEntry, execution: BlockExecution) => void;
|
|
625
717
|
onPartialOutput?: (output: unknown, execution: BlockExecution) => void;
|
|
626
718
|
identity?: () => Omit<ActionContextIdentity, "stepName"> | undefined;
|
|
627
|
-
|
|
628
|
-
type BlockKind = "action" | "trigger";
|
|
629
|
-
interface ParsedBlockType {
|
|
630
|
-
packageName: string;
|
|
631
|
-
version: string;
|
|
632
|
-
kind: BlockKind;
|
|
633
|
-
name: string;
|
|
719
|
+
stepTest?: () => boolean;
|
|
634
720
|
}
|
|
635
721
|
declare class ActivepiecesBlockExecutor implements BlockExecutor {
|
|
636
722
|
private readonly options;
|
|
@@ -638,8 +724,8 @@ declare class ActivepiecesBlockExecutor implements BlockExecutor {
|
|
|
638
724
|
private readonly resolver;
|
|
639
725
|
constructor(options: ActivepiecesBlockExecutorOptions);
|
|
640
726
|
private worker;
|
|
641
|
-
private packages;
|
|
642
727
|
execute(execution: BlockExecution): Promise<BlockResult>;
|
|
728
|
+
private run;
|
|
643
729
|
private resolveConnection;
|
|
644
730
|
private stageInputs;
|
|
645
731
|
private ingestFiles;
|
|
@@ -648,11 +734,26 @@ declare class ActivepiecesBlockExecutor implements BlockExecutor {
|
|
|
648
734
|
declare class CompositeBlockExecutor implements BlockExecutor {
|
|
649
735
|
private readonly pieces;
|
|
650
736
|
private readonly handlers;
|
|
651
|
-
private readonly core;
|
|
652
737
|
constructor(pieces: BlockExecutor, handlers?: Record<string, BlockExecutor>);
|
|
653
738
|
execute(execution: BlockExecution): Promise<BlockResult>;
|
|
654
739
|
}
|
|
655
740
|
//#endregion
|
|
741
|
+
//#region src/pieces/engine/coordinator.d.ts
|
|
742
|
+
interface RunWorkflowOptions {
|
|
743
|
+
definition: WorkflowDefinition;
|
|
744
|
+
executor: BlockExecutor;
|
|
745
|
+
triggerPayload?: unknown;
|
|
746
|
+
completedSteps?: Map<string, {
|
|
747
|
+
output?: unknown;
|
|
748
|
+
port?: string | null;
|
|
749
|
+
}>;
|
|
750
|
+
onStep?: (record: StepExecutionRecord, ordinal: number) => void | Promise<void>;
|
|
751
|
+
redactValues?: string[];
|
|
752
|
+
priorSteps?: ExpressionScope["steps"];
|
|
753
|
+
declaredPorts?: (block: BlockRef) => readonly string[] | undefined;
|
|
754
|
+
}
|
|
755
|
+
declare function runWorkflow(options: RunWorkflowOptions): Promise<WorkflowRunResult>;
|
|
756
|
+
//#endregion
|
|
656
757
|
//#region src/reactor/piece-registry.d.ts
|
|
657
758
|
declare class PieceRegistry {
|
|
658
759
|
private byName;
|
|
@@ -665,6 +766,6 @@ declare class PieceRegistry {
|
|
|
665
766
|
}
|
|
666
767
|
declare const packagePieces: PieceRegistry;
|
|
667
768
|
//#endregion
|
|
668
|
-
export {
|
|
769
|
+
export { BlockResolution as A, PieceResolver as C, RecordedSchedule as D, EgressPolicy as E, PieceDescriptor as M, buildDescriptor as N, extractDedupeKey as O, loadPieceFromDir as P, PackagePiece as S, sourcedResolver as T, PieceWorkerPool as _, ActivepiecesBlockExecutor as a, PieceWorkerResult as b, ReactorPort as c, InMemorySecretProvider as d, SecretStore as f, WorkflowRunResult as g, StepExecutionRecord as h, runWorkflow as i, PieceOrigin as j, BlockMatch as k, ConnectionRequest as l, PropertySettingDef as m, packagePieces as n, AttachmentPort as o, BlockExecution as p, CORE_PIECE_NAME as r, CompositeBlockExecutor as s, PieceRegistry as t, StaticConnectionResolver as u, IPieceWorker as v, PieceTarget as w, LocalPiece as x, PieceWorker as y };
|
|
669
770
|
export {};
|
|
670
|
-
//# sourceMappingURL=piece-registry-
|
|
771
|
+
//# sourceMappingURL=piece-registry-iXg2XQxp.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"piece-registry-iXg2XQxp.d.ts","names":[],"sources":["../src/pieces/activepieces/types.ts","../src/pieces/activepieces/loader.ts","../src/pieces/activepieces/unsupported.ts","../src/pieces/activepieces/descriptor.ts","../src/pieces/engine/resolution.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/expressions.ts","../src/pieces/engine/connections.ts","../src/pieces/engine/blocks.ts","../src/pieces/engine/coordinator.ts","../src/reactor/piece-registry.ts"],"mappings":";;;;KAiBY;KAEA,mBAAmB,KAC7B,8CAGA,QAAQ,KAAK;KAGH,wBAAwB,KAClC;EAEI,SAAS;;KAIH,aAAa,QACvB,KACE,mFAIF,QAAQ,KAAK;EACX,OAAO;EACP;EACA;EACA,UAAU,6BAA6B;EAEvC,YAAY;EAEZ,aAAa,eAAe;EAE5B;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EAEA;EACA;;UAIa;EACf;EACA;EACA;EACA;EACA;EACA;;UAGe;EACf;EACA;;KAIU,WAAW,QACrB,KAAK;EAEL,QAAQ,eAAe;EAGvB;EAEA;EACA,iBAAiB;EAEjB;EACA;IACE,iBAAiB;IACjB,oBAAoB;;EAGtB;EACA,MAAM,iBAAiB;EAEvB,QAAQ,iBAAiB;;KAKf;KAIA,2BAA2B,QACrC,KAAK;EACD;;KAEM,YAAY,QACtB,KACE;EAIF,OAAO;EAEP;EAEA;EACA,QAAQ,eAAe;EACvB,iBAAiB;EACjB;EACA,yBAAyB;EAEzB;IAAuB;IAAmB;;EAC1C,YAAY,iBAAiB;EAC7B,aAAa,iBAAiB;EAC9B,WAAW,iBAAiB;EAC5B,OAAO,iBAAiB;EACxB,QAAQ,iBAAiB;EACzB,eAAe,iBAAiB;EAChC,WAAW,iBAAiB;;KAKlB,UAAU,KAAK,4BACzB,QACE,KACE;EAQF;EACA;EAEA,OAAO,aAAa;EAGpB,UAAU,eAAe,mBAAmB,eAAe;EAC3D,WAAW,eAAe,oBAAoB,eAAe;EAC7D,aAAa,iBAAiB;EAC9B,cAAc,iBAAiB;EAC/B,iBAAiB;;;;UC5JJ;EACf,OAAO;EACP;EAEA;;iBA+HoB,iBAAiB,mBAAmB,QAAQ;;;UClIjD;EACf;EACA;EAEA;;UA2Ee;EACf;EACA;;;;UCjEe;EACf;EACA;EACA;EACA;EACA,MAAM;EACN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C,cAAc;EAGd,SAAS,sBAAsB;EAC/B;EAIA;EACA,cAAc;EAGd,aAAa;EAGb,WAAW;EAGX,UAAU;EAGV,SAAS;EAGT,cAAc,OAAO,eAAe,WAAW;EAC/C,mBAAmB,iBAAiB,WAAW;EAG/C,iBAAiB,KAAK;EAEtB;;cAsGW,qCAAqC;mBAOnB;UAJrB;mBAES;EAEjB,YAA6B,SAAS;UAK9B;EAWF,QAAQ,WAAW,iBAAiB,QAAQ;UAwBpC;UA0FA;UAeA;UAoCA;EA0Bd;;cAQW,kCAAkC;mBAE1B;mBACA;EAFnB,YACmB,QAAQ,eACR,WAAU,eAAe;EAG5C,QAAQ,WAAW,iBAAiB,QAAQ;;;;UCnoB7B;EACf,YAAY;EACZ,UAAU;EAEV;EAGA,iBAAiB;IAAc;IAAkB;;EAIjD,UACE,QAAQ,qBACR,2BACU;EAEZ;EAGA,aAAa;EAEb,iBAAiB,OAAO;;iBAiDJ,YACpB,SAAS,qBACR,QAAQ;;;cCjFE;UACH;EAIR,UAAU,iBAAiB;EAuC3B,SAAM,iBAAmB;EAEzB,WAAW;EAKX,YAAY;;EAOZ;;cAMW,eAAa"}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { DEDUPE_KEY_PROPERTY, StoreScope } from "@powerhousedao/pieces-framework";
|
|
2
2
|
import { mkdir, writeFile } from "node:fs/promises";
|
|
3
3
|
import path from "node:path";
|
|
4
|
+
import { PIECE_ACTION_PORTS, TRIGGER_PORTS, checkTriggerStrategy } from "@powerhousedao/pieces-framework/workflow";
|
|
5
|
+
import { Cron } from "croner";
|
|
4
6
|
import { randomUUID } from "node:crypto";
|
|
5
7
|
import { ssrfIpClassifier } from "@powerhousedao/pieces-framework/host";
|
|
6
|
-
import { Cron } from "croner";
|
|
7
8
|
import dgram from "node:dgram";
|
|
8
9
|
import dns from "node:dns";
|
|
9
10
|
import net, { isIP } from "node:net";
|
|
@@ -72,14 +73,54 @@ function authMethodFor(auth, type) {
|
|
|
72
73
|
}
|
|
73
74
|
function unsupportedMethod(auth) {
|
|
74
75
|
if (!isRecord(auth)) return void 0;
|
|
75
|
-
if (auth.type === "OAUTH2") return unsupported("OAuth2
|
|
76
|
+
if (auth.type === "OAUTH2" && auth.grantType === "client_credentials") return unsupported("OAuth2 client credentials", 3091);
|
|
76
77
|
if (auth.type === "OIDC") return unsupported("OIDC auth", 3091);
|
|
77
78
|
if (auth.type === "CUSTOM_AUTH" && auth.refresh != null) return unsupported("CustomAuth refresh", 3091);
|
|
78
79
|
}
|
|
79
80
|
function unsupportedTrigger(trigger) {
|
|
80
81
|
if (trigger.type === "MANUAL") return unsupported("TriggerStrategy.MANUAL", 3091);
|
|
82
|
+
const strategy = checkTriggerStrategy(trigger.type);
|
|
83
|
+
if ("issue" in strategy) {
|
|
84
|
+
const issue = trigger.type === "APP_WEBHOOK" ? 3081 : 3091;
|
|
85
|
+
return {
|
|
86
|
+
feature: `TriggerStrategy ${String(trigger.type)}`,
|
|
87
|
+
issue,
|
|
88
|
+
reason: `${strategy.issue} (${ISSUES_URL}${issue})`
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
const problem = renewProblem(trigger.renewConfiguration);
|
|
92
|
+
if (problem) return {
|
|
93
|
+
feature: "renewConfiguration",
|
|
94
|
+
issue: 3090,
|
|
95
|
+
reason: `renewConfiguration ${problem} (${ISSUES_URL}3090)`
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
function cronFires(cron) {
|
|
99
|
+
try {
|
|
100
|
+
return new Cron(cron, {
|
|
101
|
+
timezone: "UTC",
|
|
102
|
+
legacyMode: false
|
|
103
|
+
}).nextRun() !== null;
|
|
104
|
+
} catch {
|
|
105
|
+
return false;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
function renewProblem(renew) {
|
|
109
|
+
if (renew === void 0 || renew === null) return void 0;
|
|
110
|
+
if (!isRecord(renew)) return "is not an object";
|
|
111
|
+
if (renew.strategy === "NONE") return void 0;
|
|
112
|
+
if (renew.strategy !== "CRON") return `strategy ${String(renew.strategy)} is not supported`;
|
|
113
|
+
const cron = renew.cronExpression;
|
|
114
|
+
if (typeof cron !== "string" || !cronFires(cron)) return `cron ${JSON.stringify(cron)} is invalid`;
|
|
115
|
+
}
|
|
116
|
+
function triggerRenew(trigger) {
|
|
81
117
|
const renew = trigger.renewConfiguration;
|
|
82
|
-
if (isRecord(renew)
|
|
118
|
+
if (!isRecord(renew) || renew.strategy !== "CRON") return void 0;
|
|
119
|
+
if (renewProblem(renew)) return void 0;
|
|
120
|
+
return {
|
|
121
|
+
strategy: "CRON",
|
|
122
|
+
cronExpression: renew.cronExpression
|
|
123
|
+
};
|
|
83
124
|
}
|
|
84
125
|
var UnsupportedPieceFeatureError = class extends Error {
|
|
85
126
|
feature;
|
|
@@ -92,6 +133,205 @@ var UnsupportedPieceFeatureError = class extends Error {
|
|
|
92
133
|
}
|
|
93
134
|
};
|
|
94
135
|
//#endregion
|
|
136
|
+
//#region src/pieces/activepieces/descriptor.ts
|
|
137
|
+
function describeOAuth2(raw) {
|
|
138
|
+
if (typeof raw.authUrl !== "string" || typeof raw.tokenUrl !== "string") return;
|
|
139
|
+
const strings = (value) => Array.isArray(value) ? value.filter((entry) => typeof entry === "string") : [];
|
|
140
|
+
const extra = raw.extra && typeof raw.extra === "object" ? Object.fromEntries(Object.entries(raw.extra).filter((entry) => typeof entry[1] === "string")) : void 0;
|
|
141
|
+
return {
|
|
142
|
+
authUrl: raw.authUrl,
|
|
143
|
+
tokenUrl: raw.tokenUrl,
|
|
144
|
+
scope: strings(raw.scope),
|
|
145
|
+
...typeof raw.prompt === "string" ? { prompt: raw.prompt } : {},
|
|
146
|
+
...typeof raw.pkce === "boolean" ? { pkce: raw.pkce } : {},
|
|
147
|
+
...raw.pkceMethod === "plain" || raw.pkceMethod === "S256" ? { pkceMethod: raw.pkceMethod } : {},
|
|
148
|
+
...raw.authorizationMethod === "HEADER" || raw.authorizationMethod === "BODY" ? { authorizationMethod: raw.authorizationMethod } : {},
|
|
149
|
+
...typeof raw.grantType === "string" ? { grantType: raw.grantType } : {},
|
|
150
|
+
...extra && Object.keys(extra).length > 0 ? { extra } : {}
|
|
151
|
+
};
|
|
152
|
+
}
|
|
153
|
+
function describeHandshake(trigger) {
|
|
154
|
+
const strategy = trigger.handshakeConfiguration?.strategy;
|
|
155
|
+
if (!strategy || strategy === "NONE") return void 0;
|
|
156
|
+
return {
|
|
157
|
+
strategy,
|
|
158
|
+
paramName: trigger.handshakeConfiguration?.paramName
|
|
159
|
+
};
|
|
160
|
+
}
|
|
161
|
+
function optional(key, value) {
|
|
162
|
+
return value === void 0 ? {} : { [key]: value };
|
|
163
|
+
}
|
|
164
|
+
function describeOption(option) {
|
|
165
|
+
return {
|
|
166
|
+
label: option.label,
|
|
167
|
+
value: option.value,
|
|
168
|
+
...typeof option.description === "string" && option.description ? { description: option.description } : {},
|
|
169
|
+
...typeof option.icon === "string" && option.icon ? { icon: option.icon } : {}
|
|
170
|
+
};
|
|
171
|
+
}
|
|
172
|
+
function describeHints(prop) {
|
|
173
|
+
const hints = {};
|
|
174
|
+
if (prop.width === "half" || prop.width === "full") hints.width = prop.width;
|
|
175
|
+
for (const key of [
|
|
176
|
+
"icon",
|
|
177
|
+
"variant",
|
|
178
|
+
"display",
|
|
179
|
+
"formatProperty"
|
|
180
|
+
]) {
|
|
181
|
+
const value = prop[key];
|
|
182
|
+
if (typeof value === "string" && value !== "") hints[key] = value;
|
|
183
|
+
}
|
|
184
|
+
for (const key of [
|
|
185
|
+
"min",
|
|
186
|
+
"max",
|
|
187
|
+
"step"
|
|
188
|
+
]) {
|
|
189
|
+
const value = prop[key];
|
|
190
|
+
if (typeof value === "number" && Number.isFinite(value)) hints[key] = value;
|
|
191
|
+
}
|
|
192
|
+
if (Array.isArray(prop.reveals)) {
|
|
193
|
+
const reveals = prop.reveals.filter((name) => typeof name === "string");
|
|
194
|
+
if (reveals.length > 0) hints.reveals = reveals;
|
|
195
|
+
}
|
|
196
|
+
if (prop.refreshOnSearch === true) hints.refreshOnSearch = true;
|
|
197
|
+
const showWhen = prop.showWhen;
|
|
198
|
+
if (typeof showWhen?.prop === "string" && Array.isArray(showWhen.oneOf)) {
|
|
199
|
+
const oneOf = showWhen.oneOf;
|
|
200
|
+
hints.showWhen = {
|
|
201
|
+
prop: showWhen.prop,
|
|
202
|
+
oneOf: [...oneOf]
|
|
203
|
+
};
|
|
204
|
+
}
|
|
205
|
+
if (typeof prop.emptyChoice === "string" && prop.emptyChoice !== "") hints.emptyChoice = prop.emptyChoice;
|
|
206
|
+
return hints;
|
|
207
|
+
}
|
|
208
|
+
function describeGroups(groups) {
|
|
209
|
+
if (!Array.isArray(groups)) return void 0;
|
|
210
|
+
const described = groups.filter((group) => typeof group.key === "string" && typeof group.display === "string" && Array.isArray(group.props)).map((group) => ({
|
|
211
|
+
key: group.key,
|
|
212
|
+
display: group.display,
|
|
213
|
+
...group.label ? { label: group.label } : {},
|
|
214
|
+
...group.description ? { description: group.description } : {},
|
|
215
|
+
...group.icon ? { icon: group.icon } : {},
|
|
216
|
+
props: group.props.filter((name) => typeof name === "string")
|
|
217
|
+
}));
|
|
218
|
+
return described.length > 0 ? described : void 0;
|
|
219
|
+
}
|
|
220
|
+
function hasResolver(prop) {
|
|
221
|
+
return typeof prop.options === "function" || typeof prop.props === "function";
|
|
222
|
+
}
|
|
223
|
+
function toPropDescriptor(name, prop, resolverId) {
|
|
224
|
+
const dynamic = hasResolver(prop);
|
|
225
|
+
const descriptor = {
|
|
226
|
+
name,
|
|
227
|
+
displayName: prop.displayName ?? name,
|
|
228
|
+
type: prop.type ?? "UNKNOWN",
|
|
229
|
+
required: prop.required ?? false,
|
|
230
|
+
hasDynamicResolver: dynamic
|
|
231
|
+
};
|
|
232
|
+
if (typeof prop.description === "string" && prop.description !== "") descriptor.description = prop.description;
|
|
233
|
+
if (typeof prop.placeholder === "string" && prop.placeholder !== "") descriptor.placeholder = prop.placeholder;
|
|
234
|
+
if (prop.defaultValue !== void 0) descriptor.defaultValue = prop.defaultValue;
|
|
235
|
+
if (prop.advanced === true) descriptor.advanced = true;
|
|
236
|
+
if (dynamic && resolverId) descriptor.dynamicResolverId = resolverId;
|
|
237
|
+
if (dynamic && Array.isArray(prop.refreshers)) descriptor.refreshers = prop.refreshers.filter((entry) => typeof entry === "string");
|
|
238
|
+
if (typeof prop.options === "object" && Array.isArray(prop.options.options)) {
|
|
239
|
+
descriptor.staticOptions = prop.options.options.map(describeOption);
|
|
240
|
+
if (prop.options.disabled === true) descriptor.staticDisabled = true;
|
|
241
|
+
if (typeof prop.options.placeholder === "string") descriptor.staticPlaceholder = prop.options.placeholder;
|
|
242
|
+
}
|
|
243
|
+
Object.assign(descriptor, describeHints(prop));
|
|
244
|
+
if (prop.properties && typeof prop.properties === "object") {
|
|
245
|
+
const nested = describeProperties(prop.properties);
|
|
246
|
+
if (nested.length > 0) descriptor.properties = nested;
|
|
247
|
+
}
|
|
248
|
+
return descriptor;
|
|
249
|
+
}
|
|
250
|
+
function describeProperties(props, resolverIdFor) {
|
|
251
|
+
if (!props || typeof props !== "object") return [];
|
|
252
|
+
return Object.entries(props).filter((entry) => isPropertyObject(entry[1])).map(([propName, prop]) => toPropDescriptor(propName, prop, resolverIdFor?.(propName)));
|
|
253
|
+
}
|
|
254
|
+
function isPropertyObject(value) {
|
|
255
|
+
return value !== null && typeof value === "object";
|
|
256
|
+
}
|
|
257
|
+
function withUnsupported(feature) {
|
|
258
|
+
return feature ? { unsupported: feature } : {};
|
|
259
|
+
}
|
|
260
|
+
function describeAuthMethod(auth) {
|
|
261
|
+
if (!auth || typeof auth !== "object") return void 0;
|
|
262
|
+
const method = auth;
|
|
263
|
+
const props = method.props && typeof method.props === "object" ? describeProperties(method.props) : [];
|
|
264
|
+
const oauth2 = method.type === "OAUTH2" ? describeOAuth2(auth) : void 0;
|
|
265
|
+
return {
|
|
266
|
+
type: method.type ?? "UNKNOWN",
|
|
267
|
+
displayName: method.displayName,
|
|
268
|
+
description: method.description,
|
|
269
|
+
required: method.required,
|
|
270
|
+
...props.length > 0 ? { props } : {},
|
|
271
|
+
...oauth2 ? { oauth2 } : {},
|
|
272
|
+
...withUnsupported(unsupportedAuth(method))
|
|
273
|
+
};
|
|
274
|
+
}
|
|
275
|
+
function declaredPorts(ports) {
|
|
276
|
+
if (!Array.isArray(ports) || ports.length === 0) return void 0;
|
|
277
|
+
return ports.every((port) => typeof port === "string") ? ports : void 0;
|
|
278
|
+
}
|
|
279
|
+
function buildDescriptor(piece, source, options = {}) {
|
|
280
|
+
const actions = Object.entries(getActions(piece)).map(([actionName, action]) => ({
|
|
281
|
+
name: action.name ?? actionName,
|
|
282
|
+
displayName: action.displayName ?? actionName,
|
|
283
|
+
description: action.description,
|
|
284
|
+
requireAuth: action.requireAuth ?? false,
|
|
285
|
+
ports: (options.routed ? declaredPorts(action.ports) : void 0) ?? PIECE_ACTION_PORTS,
|
|
286
|
+
props: describeProperties(action.props, (propName) => `activepieces:${source.packageName}#${actionName}.${propName}`),
|
|
287
|
+
...action.outputSchema !== void 0 ? { outputSchema: action.outputSchema } : {},
|
|
288
|
+
...action.audience !== void 0 ? { audience: action.audience } : {},
|
|
289
|
+
...optional("propertyGroups", describeGroups(action.propertyGroups)),
|
|
290
|
+
...optional("classification", typeof action.classification === "string" ? action.classification : void 0),
|
|
291
|
+
...optional("errorHandlingOptions", action.errorHandlingOptions)
|
|
292
|
+
}));
|
|
293
|
+
const triggers = Object.entries(getTriggers(piece)).map(([triggerName, trigger]) => ({
|
|
294
|
+
name: trigger.name ?? triggerName,
|
|
295
|
+
displayName: trigger.displayName ?? triggerName,
|
|
296
|
+
description: trigger.description,
|
|
297
|
+
strategy: trigger.type ?? "UNKNOWN",
|
|
298
|
+
testStrategy: trigger.testStrategy,
|
|
299
|
+
...typeof trigger.display === "string" && trigger.display !== "" ? { display: trigger.display } : {},
|
|
300
|
+
requireAuth: trigger.requireAuth ?? false,
|
|
301
|
+
ports: TRIGGER_PORTS,
|
|
302
|
+
props: describeProperties(trigger.props, (propName) => `activepieces:${source.packageName}#${triggerName}.${propName}`),
|
|
303
|
+
...trigger.outputSchema !== void 0 ? { outputSchema: trigger.outputSchema } : {},
|
|
304
|
+
hasSampleData: trigger.sampleData !== void 0 && trigger.sampleData !== null,
|
|
305
|
+
...trigger.sampleData !== void 0 && trigger.sampleData !== null ? { sampleData: trigger.sampleData } : {},
|
|
306
|
+
handshake: describeHandshake(trigger),
|
|
307
|
+
...optional("renew", triggerRenew(trigger)),
|
|
308
|
+
...optional("propertyGroups", describeGroups(trigger.propertyGroups)),
|
|
309
|
+
...options.hostFed ? {} : withUnsupported(unsupportedTrigger(trigger))
|
|
310
|
+
}));
|
|
311
|
+
const descriptor = {
|
|
312
|
+
id: `activepieces:${source.packageName}`,
|
|
313
|
+
source,
|
|
314
|
+
displayName: piece.displayName,
|
|
315
|
+
description: piece.description,
|
|
316
|
+
logoUrl: piece.logoUrl,
|
|
317
|
+
categories: piece.categories,
|
|
318
|
+
...piece.deprecated === true ? { deprecated: true } : {},
|
|
319
|
+
minimumSupportedRelease: piece.minimumSupportedRelease,
|
|
320
|
+
maximumSupportedRelease: piece.maximumSupportedRelease,
|
|
321
|
+
actions,
|
|
322
|
+
triggers,
|
|
323
|
+
...withUnsupported(unsupportedAuth(piece.auth))
|
|
324
|
+
};
|
|
325
|
+
if (Array.isArray(piece.auth)) {
|
|
326
|
+
const methods = piece.auth.map(describeAuthMethod).filter((method) => method !== void 0);
|
|
327
|
+
if (methods.length > 0) descriptor.auth = methods;
|
|
328
|
+
} else {
|
|
329
|
+
const method = describeAuthMethod(piece.auth);
|
|
330
|
+
if (method) descriptor.auth = method;
|
|
331
|
+
}
|
|
332
|
+
return descriptor;
|
|
333
|
+
}
|
|
334
|
+
//#endregion
|
|
95
335
|
//#region src/pieces/activepieces/worker/protocol.ts
|
|
96
336
|
const LOG_WRITE = "log.write";
|
|
97
337
|
const OUTPUT_UPDATE = "output.update";
|
|
@@ -842,6 +1082,6 @@ function redactMessage(text, options) {
|
|
|
842
1082
|
return redactText(text, preparePass(options));
|
|
843
1083
|
}
|
|
844
1084
|
//#endregion
|
|
845
|
-
export {
|
|
1085
|
+
export { REACTOR_CREATE as A, describeProperties as B, setMaxFileBytes as C, jsonSafe as D, buildActionContext as E, REACTOR_MODELS as F, UnsupportedContextMemberError as G, authMethodFor as H, STORE_DELETE as I, getActions as J, throwingStub as K, STORE_GET as L, REACTOR_FIND as M, REACTOR_GET as N, LOG_WRITE as O, REACTOR_MODEL as P, STORE_PUT as R, maxFileBytes as S, InMemoryKeyValueStore as T, unsupportedAuth as U, UnsupportedPieceFeatureError as V, unsupportedTrigger as W, getTriggers as Y, StagedFilesService as _, redactMessage as a, assertWithinLimit as b, DEFAULT_EGRESS_POLICY as c, parseAddress as d, runWithEgressPolicy as f, DataUriFilesService as g, runTriggerHook as h, redactError as i, REACTOR_EXECUTE as j, OUTPUT_UPDATE as k, installEgressGuard as l, extractDedupeKey as m, containsRedactedMarker as n, rememberSecrets as o, buildTriggerContext as p, withTouchTracking as q, redact as r, secretsFor as s, collectSecretValues as t, isPrivateAddress as u, rewriteFileRefs as v, InMemoryConnectionsProvider as w, configuredMaxFileBytes as x, FileTooLargeError as y, buildDescriptor as z };
|
|
846
1086
|
|
|
847
|
-
//# sourceMappingURL=redact-
|
|
1087
|
+
//# sourceMappingURL=redact-LRWHJGW9.js.map
|