@codemation/host 0.0.16 → 0.0.18
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/CHANGELOG.md +11 -0
- package/LICENSE +37 -0
- package/dist/{AppConfigFactory-D_ReOKfV.d.ts → AppConfigFactory-Co4STjwt.d.ts} +3 -3
- package/dist/{AppConfigFactory-JjNqYnGg.js → AppConfigFactory-DxoZ4v8r.js} +2 -3
- package/dist/AppConfigFactory-DxoZ4v8r.js.map +1 -0
- package/dist/{AppContainerFactory-_dnF0VOf.js → AppContainerFactory-z9aUDFiJ.js} +5 -2
- package/dist/AppContainerFactory-z9aUDFiJ.js.map +1 -0
- package/dist/{CodemationConfig-u80ZoIrc.d.ts → CodemationConfig-COs4GcOE.d.ts} +4 -4
- package/dist/{CodemationConfigNormalizer-DCt0mPPz.d.ts → CodemationConfigNormalizer-B7w1JA_2.d.ts} +2 -2
- package/dist/{CodemationConsumerConfigLoader-LGrCspIx.js → CodemationConsumerConfigLoader-C_ISRrpI.js} +11 -4
- package/dist/CodemationConsumerConfigLoader-C_ISRrpI.js.map +1 -0
- package/dist/{CodemationConsumerConfigLoader-C8iscLBJ.d.ts → CodemationConsumerConfigLoader-OlXKw-us.d.ts} +4 -2
- package/dist/{CodemationPluginListMerger-ZY3R_kTo.d.ts → CodemationPluginListMerger-_ZIiOQxB.d.ts} +5 -5
- package/dist/{CredentialServices-Uo1jxSYB.d.ts → CredentialServices-D3VTczpC.d.ts} +3 -3
- package/dist/{PublicFrontendBootstrapFactory-BA65IXL4.d.ts → PublicFrontendBootstrapFactory-CE4oGogq.d.ts} +2 -2
- package/dist/consumer.d.ts +4 -4
- package/dist/consumer.js +1 -1
- package/dist/credentials.d.ts +3 -3
- package/dist/devServerSidecar.d.ts +1 -1
- package/dist/{index-CkiptHb-.d.ts → index-DbYzycTC.d.ts} +215 -71
- package/dist/index.d.ts +116 -11
- package/dist/index.js +92 -6
- package/dist/index.js.map +1 -0
- package/dist/nextServer.d.ts +7 -7
- package/dist/nextServer.js +2 -2
- package/dist/{persistenceServer-J2teHIIg.js → persistenceServer-C4L1uMKn.js} +2 -2
- package/dist/{persistenceServer-J2teHIIg.js.map → persistenceServer-C4L1uMKn.js.map} +1 -1
- package/dist/{persistenceServer-BKbOs-TQ.d.ts → persistenceServer-Cr-zCuEr.d.ts} +2 -2
- package/dist/persistenceServer.d.ts +5 -5
- package/dist/persistenceServer.js +2 -2
- package/dist/{server-CbcnGZHm.d.ts → server-B6k53aZj.d.ts} +5 -5
- package/dist/{server-CVC7QBwT.js → server-DDVXr7BN.js} +4 -4
- package/dist/{server-CVC7QBwT.js.map → server-DDVXr7BN.js.map} +1 -1
- package/dist/server.d.ts +8 -8
- package/dist/server.js +5 -5
- package/package.json +9 -6
- package/playwright.scaffolded-dev.config.ts +46 -0
- package/src/index.ts +9 -1
- package/src/presentation/config/CodemationAuthoring.types.ts +169 -0
- package/src/presentation/config/CodemationPlugin.ts +1 -0
- package/src/presentation/frontend/CodemationFrontendAuthSnapshotFactory.ts +7 -0
- package/src/presentation/server/CodemationConsumerConfigLoader.ts +12 -3
- package/dist/AppConfigFactory-JjNqYnGg.js.map +0 -1
- package/dist/AppContainerFactory-_dnF0VOf.js.map +0 -1
- package/dist/CodemationConsumerConfigLoader-LGrCspIx.js.map +0 -1
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import "reflect-metadata";
|
|
2
2
|
import { ReadableStream } from "node:stream/web";
|
|
3
3
|
import { DependencyContainer as Container, InjectionToken as TypeToken } from "tsyringe";
|
|
4
|
+
import { z } from "zod";
|
|
4
5
|
|
|
5
6
|
//#region ../core/src/contracts/Clock.d.ts
|
|
6
7
|
/** Port for time; inject `SystemClock` in production and a fake/test clock in tests. */
|
|
@@ -285,15 +286,6 @@ interface PersistedWorkflowTokenRegistryLike {
|
|
|
285
286
|
registerFromWorkflows?(workflows: ReadonlyArray<WorkflowDefinition>): void;
|
|
286
287
|
}
|
|
287
288
|
//#endregion
|
|
288
|
-
//#region ../core/src/contracts/workflowActivationPolicy.d.ts
|
|
289
|
-
/**
|
|
290
|
-
* Host-controlled policy: when false, trigger {@link TriggerNode} setup is skipped and webhook routes
|
|
291
|
-
* for that workflow are not registered (see engine trigger runtime + webhook matcher).
|
|
292
|
-
*/
|
|
293
|
-
interface WorkflowActivationPolicy {
|
|
294
|
-
isActive(workflowId: WorkflowId): boolean;
|
|
295
|
-
}
|
|
296
|
-
//#endregion
|
|
297
289
|
//#region ../core/src/contracts/webhookTypes.d.ts
|
|
298
290
|
type HttpMethod = "GET" | "POST" | "PUT" | "PATCH" | "DELETE";
|
|
299
291
|
/** Match for an incoming HTTP request: user-defined URL segment + workflow trigger node. */
|
|
@@ -330,6 +322,137 @@ interface WebhookTriggerMatcher {
|
|
|
330
322
|
reloadWebhookRoutes?(): void;
|
|
331
323
|
}
|
|
332
324
|
//#endregion
|
|
325
|
+
//#region ../core/src/contracts/workflowActivationPolicy.d.ts
|
|
326
|
+
/**
|
|
327
|
+
* Host-controlled policy: when false, trigger {@link TriggerNode} setup is skipped and webhook routes
|
|
328
|
+
* for that workflow are not registered (see engine trigger runtime + webhook matcher).
|
|
329
|
+
*/
|
|
330
|
+
interface WorkflowActivationPolicy {
|
|
331
|
+
isActive(workflowId: WorkflowId): boolean;
|
|
332
|
+
}
|
|
333
|
+
//#endregion
|
|
334
|
+
//#region ../core/src/workflow/dsl/workflowBuilderTypes.d.ts
|
|
335
|
+
type AnyRunnableNodeConfig = RunnableNodeConfig<any, any>;
|
|
336
|
+
type AnyTriggerNodeConfig = TriggerNodeConfig<any>;
|
|
337
|
+
type ValidStepSequence<TCurrentJson, TSteps extends ReadonlyArray<AnyRunnableNodeConfig>> = TSteps extends readonly [] ? readonly [] : TSteps extends readonly [infer TFirst, ...infer TRest] ? TFirst extends RunnableNodeConfig<TCurrentJson, infer TNextJson> ? TRest extends ReadonlyArray<AnyRunnableNodeConfig> ? readonly [TFirst, ...ValidStepSequence<TNextJson, TRest>] : never : never : TSteps;
|
|
338
|
+
type StepSequenceOutput<TCurrentJson, TSteps extends ReadonlyArray<AnyRunnableNodeConfig> | undefined> = TSteps extends ReadonlyArray<AnyRunnableNodeConfig> ? TSteps extends readonly [] ? TCurrentJson : TSteps extends readonly [infer TFirst, ...infer TRest] ? TFirst extends RunnableNodeConfig<TCurrentJson, infer TNextJson> ? TRest extends ReadonlyArray<AnyRunnableNodeConfig> ? StepSequenceOutput<TNextJson, TRest> : never : never : TCurrentJson : TCurrentJson;
|
|
339
|
+
type TypesMatch<TLeft, TRight> = [TLeft] extends [TRight] ? ([TRight] extends [TLeft] ? true : false) : false;
|
|
340
|
+
type BranchOutputGuard<TCurrentJson, TTrueSteps extends ReadonlyArray<AnyRunnableNodeConfig> | undefined, TFalseSteps extends ReadonlyArray<AnyRunnableNodeConfig> | undefined> = TypesMatch<StepSequenceOutput<TCurrentJson, TTrueSteps>, StepSequenceOutput<TCurrentJson, TFalseSteps>> extends true ? unknown : never;
|
|
341
|
+
type BranchStepsArg<TCurrentJson, TSteps extends ReadonlyArray<AnyRunnableNodeConfig>> = TSteps & ValidStepSequence<TCurrentJson, TSteps>;
|
|
342
|
+
type BranchMoreArgs<TCurrentJson, TFirstStep extends RunnableNodeConfig<TCurrentJson, any>, TRestSteps extends ReadonlyArray<AnyRunnableNodeConfig>> = TRestSteps & ValidStepSequence<RunnableNodeOutputJson<TFirstStep>, TRestSteps>;
|
|
343
|
+
type BooleanWhenOverloads<TCurrentJson, TReturn> = {
|
|
344
|
+
<TSteps extends ReadonlyArray<AnyRunnableNodeConfig>>(branch: boolean, steps: BranchStepsArg<TCurrentJson, TSteps>): TReturn;
|
|
345
|
+
<TFirstStep extends RunnableNodeConfig<TCurrentJson, any>, TRestSteps extends ReadonlyArray<AnyRunnableNodeConfig>>(branch: boolean, step: TFirstStep, ...more: BranchMoreArgs<TCurrentJson, TFirstStep, TRestSteps>): TReturn;
|
|
346
|
+
};
|
|
347
|
+
//#endregion
|
|
348
|
+
//#region ../core/src/workflow/dsl/WhenBuilder.d.ts
|
|
349
|
+
declare class WhenBuilder<TCurrentJson> {
|
|
350
|
+
private readonly wf;
|
|
351
|
+
private readonly from;
|
|
352
|
+
private readonly branchPort;
|
|
353
|
+
constructor(wf: WorkflowBuilder, from: NodeRef, branchPort: OutputPortKey);
|
|
354
|
+
addBranch<TSteps extends ReadonlyArray<AnyRunnableNodeConfig>>(steps: TSteps & ValidStepSequence<TCurrentJson, TSteps>): this;
|
|
355
|
+
readonly when: BooleanWhenOverloads<TCurrentJson, WhenBuilder<TCurrentJson>>;
|
|
356
|
+
build(): WorkflowDefinition;
|
|
357
|
+
}
|
|
358
|
+
//#endregion
|
|
359
|
+
//#region ../core/src/workflow/dsl/ChainCursorResolver.d.ts
|
|
360
|
+
type ChainCursorWhenOverloads<TCurrentJson> = BooleanWhenOverloads<TCurrentJson, WhenBuilder<TCurrentJson>> & {
|
|
361
|
+
<TTrueSteps extends ReadonlyArray<AnyRunnableNodeConfig> | undefined, TFalseSteps extends ReadonlyArray<AnyRunnableNodeConfig> | undefined>(branches: Readonly<{
|
|
362
|
+
true?: TTrueSteps extends ReadonlyArray<AnyRunnableNodeConfig> ? BranchStepsArg<TCurrentJson, TTrueSteps> : never;
|
|
363
|
+
false?: TFalseSteps extends ReadonlyArray<AnyRunnableNodeConfig> ? BranchStepsArg<TCurrentJson, TFalseSteps> : never;
|
|
364
|
+
}> & BranchOutputGuard<TCurrentJson, TTrueSteps, TFalseSteps>): ChainCursor<StepSequenceOutput<TCurrentJson, TTrueSteps>>;
|
|
365
|
+
};
|
|
366
|
+
declare class ChainCursor<TCurrentJson> {
|
|
367
|
+
private readonly wf;
|
|
368
|
+
private readonly cursor;
|
|
369
|
+
private readonly cursorOutput;
|
|
370
|
+
constructor(wf: WorkflowBuilder, cursor: NodeRef, cursorOutput: OutputPortKey);
|
|
371
|
+
then<TConfig$1 extends RunnableNodeConfig<TCurrentJson, any>>(config: TConfig$1): ChainCursor<RunnableNodeOutputJson<TConfig$1>>;
|
|
372
|
+
readonly when: ChainCursorWhenOverloads<TCurrentJson>;
|
|
373
|
+
build(): WorkflowDefinition;
|
|
374
|
+
}
|
|
375
|
+
//#endregion
|
|
376
|
+
//#region ../core/src/workflow/dsl/WorkflowBuilder.d.ts
|
|
377
|
+
declare class WorkflowBuilder {
|
|
378
|
+
private readonly meta;
|
|
379
|
+
private readonly options?;
|
|
380
|
+
private readonly nodes;
|
|
381
|
+
private readonly edges;
|
|
382
|
+
private seq;
|
|
383
|
+
constructor(meta: {
|
|
384
|
+
id: WorkflowId;
|
|
385
|
+
name: string;
|
|
386
|
+
}, options?: Readonly<{
|
|
387
|
+
makeMergeNode?: (name: string) => AnyRunnableNodeConfig;
|
|
388
|
+
}> | undefined);
|
|
389
|
+
private add;
|
|
390
|
+
private connect;
|
|
391
|
+
trigger<TConfig$1 extends AnyTriggerNodeConfig>(config: TConfig$1): ChainCursor<TriggerNodeOutputJson<TConfig$1>>;
|
|
392
|
+
start<TConfig$1 extends AnyRunnableNodeConfig>(config: TConfig$1): ChainCursor<RunnableNodeOutputJson<TConfig$1>>;
|
|
393
|
+
build(): WorkflowDefinition;
|
|
394
|
+
}
|
|
395
|
+
//#endregion
|
|
396
|
+
//#region ../core/src/events/runEvents.d.ts
|
|
397
|
+
type RunEvent = Readonly<{
|
|
398
|
+
kind: "runCreated";
|
|
399
|
+
runId: RunId;
|
|
400
|
+
workflowId: WorkflowId;
|
|
401
|
+
parent?: ParentExecutionRef;
|
|
402
|
+
at: string;
|
|
403
|
+
}> | Readonly<{
|
|
404
|
+
kind: "runSaved";
|
|
405
|
+
runId: RunId;
|
|
406
|
+
workflowId: WorkflowId;
|
|
407
|
+
parent?: ParentExecutionRef;
|
|
408
|
+
at: string;
|
|
409
|
+
state: PersistedRunState;
|
|
410
|
+
}> | Readonly<{
|
|
411
|
+
kind: "nodeQueued";
|
|
412
|
+
runId: RunId;
|
|
413
|
+
workflowId: WorkflowId;
|
|
414
|
+
parent?: ParentExecutionRef;
|
|
415
|
+
at: string;
|
|
416
|
+
snapshot: NodeExecutionSnapshot;
|
|
417
|
+
}> | Readonly<{
|
|
418
|
+
kind: "nodeStarted";
|
|
419
|
+
runId: RunId;
|
|
420
|
+
workflowId: WorkflowId;
|
|
421
|
+
parent?: ParentExecutionRef;
|
|
422
|
+
at: string;
|
|
423
|
+
snapshot: NodeExecutionSnapshot;
|
|
424
|
+
}> | Readonly<{
|
|
425
|
+
kind: "nodeCompleted";
|
|
426
|
+
runId: RunId;
|
|
427
|
+
workflowId: WorkflowId;
|
|
428
|
+
parent?: ParentExecutionRef;
|
|
429
|
+
at: string;
|
|
430
|
+
snapshot: NodeExecutionSnapshot;
|
|
431
|
+
}> | Readonly<{
|
|
432
|
+
kind: "nodeFailed";
|
|
433
|
+
runId: RunId;
|
|
434
|
+
workflowId: WorkflowId;
|
|
435
|
+
parent?: ParentExecutionRef;
|
|
436
|
+
at: string;
|
|
437
|
+
snapshot: NodeExecutionSnapshot;
|
|
438
|
+
}>;
|
|
439
|
+
interface RunEventSubscription {
|
|
440
|
+
close(): Promise<void>;
|
|
441
|
+
}
|
|
442
|
+
interface RunEventBus {
|
|
443
|
+
publish(event: RunEvent): Promise<void>;
|
|
444
|
+
subscribe(onEvent: (event: RunEvent) => void): Promise<RunEventSubscription>;
|
|
445
|
+
subscribeToWorkflow(workflowId: WorkflowId, onEvent: (event: RunEvent) => void): Promise<RunEventSubscription>;
|
|
446
|
+
}
|
|
447
|
+
//#endregion
|
|
448
|
+
//#region ../core/src/policies/executionLimits/EngineExecutionLimitsPolicy.d.ts
|
|
449
|
+
interface EngineExecutionLimitsPolicyConfig {
|
|
450
|
+
readonly defaultMaxNodeActivations: number;
|
|
451
|
+
readonly hardMaxNodeActivations: number;
|
|
452
|
+
readonly defaultMaxSubworkflowDepth: number;
|
|
453
|
+
readonly hardMaxSubworkflowDepth: number;
|
|
454
|
+
}
|
|
455
|
+
//#endregion
|
|
333
456
|
//#region ../core/src/contracts/runtimeTypes.d.ts
|
|
334
457
|
interface WorkflowRepository {
|
|
335
458
|
list(): ReadonlyArray<WorkflowDefinition>;
|
|
@@ -422,10 +545,10 @@ interface ExecutionContext {
|
|
|
422
545
|
binary: ExecutionBinaryService;
|
|
423
546
|
getCredential<TSession = unknown>(slotKey: string): Promise<TSession>;
|
|
424
547
|
}
|
|
425
|
-
interface NodeExecutionContext<TConfig extends NodeConfigBase = NodeConfigBase> extends ExecutionContext {
|
|
548
|
+
interface NodeExecutionContext<TConfig$1 extends NodeConfigBase = NodeConfigBase> extends ExecutionContext {
|
|
426
549
|
nodeId: NodeId;
|
|
427
550
|
activationId: NodeActivationId;
|
|
428
|
-
config: TConfig;
|
|
551
|
+
config: TConfig$1;
|
|
429
552
|
binary: NodeBinaryAttachmentService;
|
|
430
553
|
}
|
|
431
554
|
interface NodeExecutionRequest {
|
|
@@ -548,6 +671,22 @@ interface NodeConfigBase {
|
|
|
548
671
|
readonly continueWhenEmptyOutput?: boolean;
|
|
549
672
|
getCredentialRequirements?(): ReadonlyArray<CredentialRequirement>;
|
|
550
673
|
}
|
|
674
|
+
declare const runnableNodeInputType: unique symbol;
|
|
675
|
+
declare const runnableNodeOutputType: unique symbol;
|
|
676
|
+
declare const triggerNodeOutputType: unique symbol;
|
|
677
|
+
interface RunnableNodeConfig<TInputJson$1 = unknown, TOutputJson$1 = unknown> extends NodeConfigBase {
|
|
678
|
+
readonly kind: "node";
|
|
679
|
+
readonly [runnableNodeInputType]?: TInputJson$1;
|
|
680
|
+
readonly [runnableNodeOutputType]?: TOutputJson$1;
|
|
681
|
+
}
|
|
682
|
+
declare const triggerNodeSetupStateType: unique symbol;
|
|
683
|
+
interface TriggerNodeConfig<TOutputJson$1 = unknown, TSetupState$1 extends JsonValue | undefined = undefined> extends NodeConfigBase {
|
|
684
|
+
readonly kind: "trigger";
|
|
685
|
+
readonly [triggerNodeOutputType]?: TOutputJson$1;
|
|
686
|
+
readonly [triggerNodeSetupStateType]?: TSetupState$1;
|
|
687
|
+
}
|
|
688
|
+
type RunnableNodeOutputJson<TConfig$1 extends RunnableNodeConfig<any, any>> = TConfig$1 extends RunnableNodeConfig<any, infer TOutputJson> ? TOutputJson : never;
|
|
689
|
+
type TriggerNodeOutputJson<TConfig$1 extends TriggerNodeConfig<any, any>> = TConfig$1 extends TriggerNodeConfig<infer TOutputJson, any> ? TOutputJson : never;
|
|
551
690
|
interface NodeDefinition {
|
|
552
691
|
id: NodeId;
|
|
553
692
|
kind: NodeKind;
|
|
@@ -555,6 +694,11 @@ interface NodeDefinition {
|
|
|
555
694
|
name?: string;
|
|
556
695
|
config: NodeConfigBase;
|
|
557
696
|
}
|
|
697
|
+
interface NodeRef {
|
|
698
|
+
id: NodeId;
|
|
699
|
+
kind: NodeKind;
|
|
700
|
+
name?: string;
|
|
701
|
+
}
|
|
558
702
|
type PairedItemRef = Readonly<{
|
|
559
703
|
nodeId: NodeId;
|
|
560
704
|
output: OutputPortKey;
|
|
@@ -645,15 +789,15 @@ interface WorkflowErrorContext {
|
|
|
645
789
|
readonly finishedAt: string;
|
|
646
790
|
}
|
|
647
791
|
type WorkflowErrorHandlerSpec = TypeToken<WorkflowErrorHandler> | WorkflowErrorHandler;
|
|
648
|
-
interface NodeErrorHandlerArgs<TConfig extends NodeConfigBase = NodeConfigBase> {
|
|
792
|
+
interface NodeErrorHandlerArgs<TConfig$1 extends NodeConfigBase = NodeConfigBase> {
|
|
649
793
|
readonly kind: "single" | "multi";
|
|
650
794
|
readonly items: Items;
|
|
651
795
|
readonly inputsByPort: Readonly<Record<InputPortKey, Items>> | undefined;
|
|
652
|
-
readonly ctx: NodeExecutionContext<TConfig>;
|
|
796
|
+
readonly ctx: NodeExecutionContext<TConfig$1>;
|
|
653
797
|
readonly error: Error;
|
|
654
798
|
}
|
|
655
799
|
interface NodeErrorHandler {
|
|
656
|
-
handle<TConfig extends NodeConfigBase>(args: NodeErrorHandlerArgs<TConfig>): Promise<NodeOutputs>;
|
|
800
|
+
handle<TConfig$1 extends NodeConfigBase>(args: NodeErrorHandlerArgs<TConfig$1>): Promise<NodeOutputs>;
|
|
657
801
|
}
|
|
658
802
|
type NodeErrorHandlerSpec = TypeToken<NodeErrorHandler> | NodeErrorHandler;
|
|
659
803
|
//#endregion
|
|
@@ -794,64 +938,64 @@ interface CredentialTypeRegistry {
|
|
|
794
938
|
getType(typeId: CredentialTypeId): CredentialTypeDefinition | undefined;
|
|
795
939
|
}
|
|
796
940
|
//#endregion
|
|
797
|
-
//#region ../core/src/
|
|
798
|
-
type
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
kind: "runSaved";
|
|
806
|
-
runId: RunId;
|
|
807
|
-
workflowId: WorkflowId;
|
|
808
|
-
parent?: ParentExecutionRef;
|
|
809
|
-
at: string;
|
|
810
|
-
state: PersistedRunState;
|
|
811
|
-
}> | Readonly<{
|
|
812
|
-
kind: "nodeQueued";
|
|
813
|
-
runId: RunId;
|
|
814
|
-
workflowId: WorkflowId;
|
|
815
|
-
parent?: ParentExecutionRef;
|
|
816
|
-
at: string;
|
|
817
|
-
snapshot: NodeExecutionSnapshot;
|
|
818
|
-
}> | Readonly<{
|
|
819
|
-
kind: "nodeStarted";
|
|
820
|
-
runId: RunId;
|
|
821
|
-
workflowId: WorkflowId;
|
|
822
|
-
parent?: ParentExecutionRef;
|
|
823
|
-
at: string;
|
|
824
|
-
snapshot: NodeExecutionSnapshot;
|
|
825
|
-
}> | Readonly<{
|
|
826
|
-
kind: "nodeCompleted";
|
|
827
|
-
runId: RunId;
|
|
828
|
-
workflowId: WorkflowId;
|
|
829
|
-
parent?: ParentExecutionRef;
|
|
830
|
-
at: string;
|
|
831
|
-
snapshot: NodeExecutionSnapshot;
|
|
832
|
-
}> | Readonly<{
|
|
833
|
-
kind: "nodeFailed";
|
|
834
|
-
runId: RunId;
|
|
835
|
-
workflowId: WorkflowId;
|
|
836
|
-
parent?: ParentExecutionRef;
|
|
837
|
-
at: string;
|
|
838
|
-
snapshot: NodeExecutionSnapshot;
|
|
941
|
+
//#region ../core/src/authoring/defineNode.types.d.ts
|
|
942
|
+
type ResolvableCredentialType = AnyCredentialType | CredentialTypeId;
|
|
943
|
+
type DefinedNodeCredentialBinding = ResolvableCredentialType | Readonly<{
|
|
944
|
+
readonly type: ResolvableCredentialType | ReadonlyArray<ResolvableCredentialType>;
|
|
945
|
+
readonly label?: string;
|
|
946
|
+
readonly optional?: true;
|
|
947
|
+
readonly helpText?: string;
|
|
948
|
+
readonly helpUrl?: string;
|
|
839
949
|
}>;
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
950
|
+
type DefinedNodeCredentialBindings = Readonly<Record<string, DefinedNodeCredentialBinding>>;
|
|
951
|
+
interface DefinedNode<TKey$1 extends string, TConfig$1 extends CredentialJsonRecord, TInputJson$1, TOutputJson$1, _TBindings extends DefinedNodeCredentialBindings | undefined = undefined> {
|
|
952
|
+
readonly kind: "defined-node";
|
|
953
|
+
readonly key: TKey$1;
|
|
954
|
+
readonly title: string;
|
|
955
|
+
readonly description?: string;
|
|
956
|
+
create(config: TConfig$1, name?: string, id?: string): RunnableNodeConfig<TInputJson$1, TOutputJson$1>;
|
|
957
|
+
register(context: {
|
|
958
|
+
registerNode<TValue>(token: TypeToken<TValue>, implementation?: TypeToken<TValue>): void;
|
|
959
|
+
}): void;
|
|
847
960
|
}
|
|
848
961
|
//#endregion
|
|
849
|
-
//#region ../core/src/
|
|
850
|
-
interface
|
|
851
|
-
readonly
|
|
852
|
-
readonly
|
|
853
|
-
|
|
854
|
-
|
|
962
|
+
//#region ../core/src/ai/AiHost.d.ts
|
|
963
|
+
interface AgentCanvasPresentation<TIcon extends string = string> {
|
|
964
|
+
readonly label?: string;
|
|
965
|
+
readonly icon?: TIcon;
|
|
966
|
+
}
|
|
967
|
+
interface ToolConfig {
|
|
968
|
+
readonly type: TypeToken<unknown>;
|
|
969
|
+
readonly name: string;
|
|
970
|
+
readonly description?: string;
|
|
971
|
+
readonly presentation?: AgentCanvasPresentation;
|
|
972
|
+
getCredentialRequirements?(): ReadonlyArray<CredentialRequirement>;
|
|
973
|
+
}
|
|
974
|
+
type AgentTurnLimitBehavior = "error" | "respondWithLastMessage";
|
|
975
|
+
interface AgentModelInvocationOptions {
|
|
976
|
+
readonly maxTokens?: number;
|
|
977
|
+
readonly providerOptions?: Readonly<Record<string, JsonValue>>;
|
|
978
|
+
}
|
|
979
|
+
interface AgentGuardrailConfig {
|
|
980
|
+
readonly maxTurns?: number;
|
|
981
|
+
readonly onTurnLimitReached?: AgentTurnLimitBehavior;
|
|
982
|
+
readonly modelInvocationOptions?: AgentModelInvocationOptions;
|
|
983
|
+
}
|
|
984
|
+
interface ChatModelConfig {
|
|
985
|
+
readonly type: TypeToken<ChatModelFactory<ChatModelConfig>>;
|
|
986
|
+
readonly name: string;
|
|
987
|
+
readonly presentation?: AgentCanvasPresentation;
|
|
988
|
+
getCredentialRequirements?(): ReadonlyArray<CredentialRequirement>;
|
|
989
|
+
}
|
|
990
|
+
interface LangChainChatModelLike {
|
|
991
|
+
invoke(input: unknown, options?: unknown): Promise<unknown>;
|
|
992
|
+
bindTools?(tools: ReadonlyArray<unknown>): LangChainChatModelLike;
|
|
993
|
+
}
|
|
994
|
+
interface ChatModelFactory<TConfig$1 extends ChatModelConfig = ChatModelConfig> {
|
|
995
|
+
create(args: Readonly<{
|
|
996
|
+
config: TConfig$1;
|
|
997
|
+
ctx: NodeExecutionContext<any>;
|
|
998
|
+
}>): Promise<LangChainChatModelLike> | LangChainChatModelLike;
|
|
855
999
|
}
|
|
856
1000
|
//#endregion
|
|
857
1001
|
//#region ../core/src/orchestration/Engine.d.ts
|
|
@@ -1039,5 +1183,5 @@ declare class RunIntentService {
|
|
|
1039
1183
|
private createWebhookExecutionOptions;
|
|
1040
1184
|
}
|
|
1041
1185
|
//#endregion
|
|
1042
|
-
export {
|
|
1043
|
-
//# sourceMappingURL=index-
|
|
1186
|
+
export { RunIdFactory as A, TypeToken as B, CredentialTypeId as C, Item as D, BinaryAttachment as E, BinaryStorage as F, AnyRunnableNodeConfig as G, RunEvent as H, NodeExecutionRequestHandler as I, PersistedRunState as J, WorkflowActivationPolicy as K, NodeExecutionScheduler as L, RunnableNodeOutputJson as M, WorkflowDefinition as N, NodeDefinition as O, WorkflowId as P, WorkflowRepository as R, CredentialTypeDefinition as S, ActivationIdFactory as T, RunEventBus as U, EngineExecutionLimitsPolicyConfig as V, ChainCursor as W, RunSummary as X, RunCurrentState as Y, Clock as Z, CredentialRequirement as _, ToolConfig as a, CredentialSetupStatus as b, CredentialBinding as c, CredentialHealth as d, CredentialInstanceId as f, CredentialOAuth2AuthDefinition as g, CredentialMaterialSourceKind as h, ChatModelConfig as i, RunnableNodeConfig as j, RunId as k, CredentialBindingKey as l, CredentialJsonRecord as m, Engine as n, DefinedNode as o, CredentialInstanceRecord as p, WebhookInvocationMatch as q, AgentGuardrailConfig as r, AnyCredentialType as s, RunIntentService as t, CredentialFieldSchema as u, CredentialSessionFactoryArgs as v, CredentialTypeRegistry as w, CredentialType as x, CredentialSessionService as y, Container as z };
|
|
1187
|
+
//# sourceMappingURL=index-DbYzycTC.d.ts.map
|
package/dist/index.d.ts
CHANGED
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
import { a as CodemationWhitelabelConfig, c as CodemationLogRule, i as CodemationAuthOidcProviderConfig, n as CodemationAuthKind, o as CodemationLogConfig, r as CodemationAuthOAuthProviderConfig, s as CodemationLogLevelName, t as CodemationAuthConfig } from "./CodemationAuthConfig-Bh2cCNCI.js";
|
|
2
2
|
import { a as CodemationFrontendAuthSnapshot, i as CodemationFrontendAuthProviderSnapshot, n as InternalAuthBootstrap, r as FrontendAppConfig, t as PublicFrontendBootstrap } from "./PublicFrontendBootstrap-p7mS8aWG.js";
|
|
3
3
|
import { i as CodemationFrontendAuthSnapshotJsonCodec, n as InternalAuthBootstrapJsonCodec, r as FrontendAppConfigJsonCodec, t as PublicFrontendBootstrapJsonCodec } from "./PublicFrontendBootstrapJsonCodec-DjkkKXcq.js";
|
|
4
|
-
import "./index-
|
|
5
|
-
import {
|
|
6
|
-
import "./CodemationConfigNormalizer-
|
|
7
|
-
import { t as CodemationConsumerConfigLoader } from "./CodemationConsumerConfigLoader-
|
|
8
|
-
import "./CredentialServices-
|
|
9
|
-
import { _ as Command, c as WorkerRuntime, d as AppContainerLifecycle, f as AppContainerFactory, g as CommandBus, h as Query, l as FrontendRuntime, m as QueryBus, n as CodemationBootstrapRequest, r as ApplicationTokens, t as CodemationPluginListMerger, u as DatabaseMigrations } from "./CodemationPluginListMerger-
|
|
10
|
-
import { r as PrismaClient, t as AppConfigFactory } from "./AppConfigFactory-
|
|
11
|
-
import { t as CodemationPostgresPrismaClientFactory } from "./persistenceServer-
|
|
12
|
-
import { c as CodemationServerGateway, l as ApiPaths } from "./server-
|
|
13
|
-
import { i as CodemationFrontendAuthSnapshotFactory, n as InternalAuthBootstrapFactory, r as FrontendAppConfigFactory, t as PublicFrontendBootstrapFactory } from "./PublicFrontendBootstrapFactory-
|
|
4
|
+
import { G as AnyRunnableNodeConfig, M as RunnableNodeOutputJson, N as WorkflowDefinition, W as ChainCursor, a as ToolConfig, i as ChatModelConfig, j as RunnableNodeConfig, o as DefinedNode, r as AgentGuardrailConfig, s as AnyCredentialType } from "./index-DbYzycTC.js";
|
|
5
|
+
import { S as CodemationPluginPackageMetadata, a as CodemationConfig, b as CodemationPluginConfig, c as CodemationEngineExecutionLimitsConfig, d as CodemationSchedulerConfig, f as CodemationSchedulerKind, g as AppConfig, h as CodemationRegistrationContextBase, i as CodemationApplicationRuntimeConfig, l as CodemationEventBusConfig, m as CodemationAppContext, n as CodemationAppSchedulerConfig, o as CodemationDatabaseConfig, p as CodemationWorkflowDiscovery, r as CodemationAppSchedulerKind, s as CodemationDatabaseKind, t as CodemationAppDefinition, u as CodemationEventBusKind, v as AppPluginLoadSummary, w as CodemationClassToken, x as CodemationPluginContext, y as CodemationPlugin } from "./CodemationConfig-COs4GcOE.js";
|
|
6
|
+
import "./CodemationConfigNormalizer-B7w1JA_2.js";
|
|
7
|
+
import { t as CodemationConsumerConfigLoader } from "./CodemationConsumerConfigLoader-OlXKw-us.js";
|
|
8
|
+
import "./CredentialServices-D3VTczpC.js";
|
|
9
|
+
import { _ as Command, c as WorkerRuntime, d as AppContainerLifecycle, f as AppContainerFactory, g as CommandBus, h as Query, l as FrontendRuntime, m as QueryBus, n as CodemationBootstrapRequest, r as ApplicationTokens, t as CodemationPluginListMerger, u as DatabaseMigrations } from "./CodemationPluginListMerger-_ZIiOQxB.js";
|
|
10
|
+
import { r as PrismaClient, t as AppConfigFactory } from "./AppConfigFactory-Co4STjwt.js";
|
|
11
|
+
import { t as CodemationPostgresPrismaClientFactory } from "./persistenceServer-Cr-zCuEr.js";
|
|
12
|
+
import { c as CodemationServerGateway, l as ApiPaths } from "./server-B6k53aZj.js";
|
|
13
|
+
import { i as CodemationFrontendAuthSnapshotFactory, n as InternalAuthBootstrapFactory, r as FrontendAppConfigFactory, t as PublicFrontendBootstrapFactory } from "./PublicFrontendBootstrapFactory-CE4oGogq.js";
|
|
14
|
+
import { z } from "zod";
|
|
14
15
|
|
|
15
16
|
//#region src/application/contracts/userDirectoryContracts.types.d.ts
|
|
16
17
|
type UserAccountStatus = "invited" | "active" | "inactive";
|
|
@@ -37,10 +38,114 @@ declare class UpsertLocalBootstrapUserCommand extends Command<UpsertLocalBootstr
|
|
|
37
38
|
constructor(email: string, password: string);
|
|
38
39
|
}
|
|
39
40
|
//#endregion
|
|
41
|
+
//#region ../core-nodes/src/workflowAuthoring/WorkflowAuthoringOptions.types.d.ts
|
|
42
|
+
type WorkflowAgentPrompt<TCurrentJson> = string | ((item: TCurrentJson) => string);
|
|
43
|
+
interface WorkflowAgentOptions<TCurrentJson, TOutputSchema extends z.ZodTypeAny | undefined = undefined> {
|
|
44
|
+
readonly prompt: WorkflowAgentPrompt<TCurrentJson>;
|
|
45
|
+
readonly model: string | ChatModelConfig;
|
|
46
|
+
readonly tools?: ReadonlyArray<ToolConfig>;
|
|
47
|
+
readonly outputSchema?: TOutputSchema;
|
|
48
|
+
readonly retryPolicy?: RunnableNodeConfig["retryPolicy"];
|
|
49
|
+
readonly guardrails?: AgentGuardrailConfig;
|
|
50
|
+
readonly id?: string;
|
|
51
|
+
}
|
|
52
|
+
//#endregion
|
|
53
|
+
//#region ../core-nodes/src/workflowAuthoring/WorkflowBranchBuilder.types.d.ts
|
|
54
|
+
declare class WorkflowBranchBuilder<TCurrentJson> {
|
|
55
|
+
private readonly steps;
|
|
56
|
+
constructor(steps?: ReadonlyArray<AnyRunnableNodeConfig>);
|
|
57
|
+
then<TConfig extends RunnableNodeConfig<TCurrentJson, any>>(config: TConfig): WorkflowBranchBuilder<RunnableNodeOutputJson<TConfig>>;
|
|
58
|
+
map<TNextJson>(mapper: (item: TCurrentJson) => TNextJson): WorkflowBranchBuilder<TNextJson>;
|
|
59
|
+
map<TNextJson>(name: string, mapper: (item: TCurrentJson) => TNextJson, id?: string): WorkflowBranchBuilder<TNextJson>;
|
|
60
|
+
wait(duration: number | string): WorkflowBranchBuilder<TCurrentJson>;
|
|
61
|
+
wait(name: string, duration: number | string, id?: string): WorkflowBranchBuilder<TCurrentJson>;
|
|
62
|
+
agent<TOutputSchema extends z.ZodTypeAny>(options: WorkflowAgentOptions<TCurrentJson, TOutputSchema>): WorkflowBranchBuilder<z.output<TOutputSchema>>;
|
|
63
|
+
agent(options: WorkflowAgentOptions<TCurrentJson, undefined>): WorkflowBranchBuilder<Record<string, unknown>>;
|
|
64
|
+
agent<TOutputSchema extends z.ZodTypeAny>(name: string, options: WorkflowAgentOptions<TCurrentJson, TOutputSchema | undefined>): WorkflowBranchBuilder<TOutputSchema extends z.ZodTypeAny ? z.output<TOutputSchema> : Record<string, unknown>>;
|
|
65
|
+
node<TConfig extends Record<string, unknown>, TOutputJson>(definitionOrKey: DefinedNode<string, TConfig, TCurrentJson, TOutputJson> | string, config: TConfig, name?: string, id?: string): WorkflowBranchBuilder<TOutputJson>;
|
|
66
|
+
getSteps(): ReadonlyArray<AnyRunnableNodeConfig>;
|
|
67
|
+
}
|
|
68
|
+
//#endregion
|
|
69
|
+
//#region ../core-nodes/src/workflowAuthoring/WorkflowChain.types.d.ts
|
|
70
|
+
type BranchCallback<TCurrentJson, TNextJson> = (branch: WorkflowBranchBuilder<TCurrentJson>) => WorkflowBranchBuilder<TNextJson>;
|
|
71
|
+
declare class WorkflowChain<TCurrentJson> {
|
|
72
|
+
private readonly chain;
|
|
73
|
+
constructor(chain: ChainCursor<TCurrentJson>);
|
|
74
|
+
then<TConfig extends RunnableNodeConfig<TCurrentJson, any>>(config: TConfig): WorkflowChain<RunnableNodeOutputJson<TConfig>>;
|
|
75
|
+
map<TNextJson>(mapper: (item: TCurrentJson) => TNextJson): WorkflowChain<TNextJson>;
|
|
76
|
+
map<TNextJson>(name: string, mapper: (item: TCurrentJson) => TNextJson, id?: string): WorkflowChain<TNextJson>;
|
|
77
|
+
wait(duration: number | string): WorkflowChain<TCurrentJson>;
|
|
78
|
+
wait(name: string, duration: number | string, id?: string): WorkflowChain<TCurrentJson>;
|
|
79
|
+
if<TBranchJson>(predicate: (item: TCurrentJson) => boolean, branches: Readonly<{
|
|
80
|
+
true?: BranchCallback<TCurrentJson, TBranchJson>;
|
|
81
|
+
false?: BranchCallback<TCurrentJson, TBranchJson>;
|
|
82
|
+
}>): WorkflowChain<TBranchJson>;
|
|
83
|
+
if<TBranchJson>(name: string, predicate: (item: TCurrentJson) => boolean, branches: Readonly<{
|
|
84
|
+
true?: BranchCallback<TCurrentJson, TBranchJson>;
|
|
85
|
+
false?: BranchCallback<TCurrentJson, TBranchJson>;
|
|
86
|
+
}>): WorkflowChain<TBranchJson>;
|
|
87
|
+
agent<TOutputSchema extends z.ZodTypeAny>(options: WorkflowAgentOptions<TCurrentJson, TOutputSchema>): WorkflowChain<z.output<TOutputSchema>>;
|
|
88
|
+
agent(options: WorkflowAgentOptions<TCurrentJson, undefined>): WorkflowChain<Record<string, unknown>>;
|
|
89
|
+
agent<TOutputSchema extends z.ZodTypeAny>(name: string, options: WorkflowAgentOptions<TCurrentJson, TOutputSchema | undefined>): WorkflowChain<TOutputSchema extends z.ZodTypeAny ? z.output<TOutputSchema> : Record<string, unknown>>;
|
|
90
|
+
node<TConfig extends Record<string, unknown>, TOutputJson>(definitionOrKey: DefinedNode<string, TConfig, TCurrentJson, TOutputJson> | string, config: TConfig, name?: string, id?: string): WorkflowChain<TOutputJson>;
|
|
91
|
+
build(): WorkflowDefinition;
|
|
92
|
+
}
|
|
93
|
+
//#endregion
|
|
94
|
+
//#region ../core-nodes/src/workflowAuthoring/WorkflowAuthoringBuilder.types.d.ts
|
|
95
|
+
declare class WorkflowAuthoringBuilder {
|
|
96
|
+
private readonly id;
|
|
97
|
+
private readonly workflowName;
|
|
98
|
+
constructor(id: string, workflowName?: string);
|
|
99
|
+
name(name: string): WorkflowAuthoringBuilder;
|
|
100
|
+
manualTrigger<TOutputJson>(defaultItems: TOutputJson | ReadonlyArray<TOutputJson>): WorkflowChain<TOutputJson>;
|
|
101
|
+
manualTrigger<TOutputJson>(name: string, defaultItems?: TOutputJson | ReadonlyArray<TOutputJson>, id?: string): WorkflowChain<TOutputJson>;
|
|
102
|
+
}
|
|
103
|
+
//#endregion
|
|
104
|
+
//#region ../core-nodes/src/workflowAuthoring.types.d.ts
|
|
105
|
+
declare function workflow(id: string): WorkflowAuthoringBuilder;
|
|
106
|
+
//#endregion
|
|
107
|
+
//#region src/presentation/config/CodemationAuthoring.types.d.ts
|
|
108
|
+
interface FriendlyCodemationDatabaseConfig {
|
|
109
|
+
readonly kind: "postgresql" | "pglite";
|
|
110
|
+
readonly url?: string;
|
|
111
|
+
readonly dataDir?: string;
|
|
112
|
+
}
|
|
113
|
+
interface FriendlyCodemationExecutionConfig {
|
|
114
|
+
readonly mode?: "inline" | "queue";
|
|
115
|
+
readonly queuePrefix?: string;
|
|
116
|
+
readonly workerQueues?: ReadonlyArray<string>;
|
|
117
|
+
readonly redisUrl?: string;
|
|
118
|
+
}
|
|
119
|
+
interface DefineCodemationAppOptions extends Omit<CodemationConfig, "app" | "credentialTypes" | "register" | "whitelabel" | "auth"> {
|
|
120
|
+
readonly name?: string;
|
|
121
|
+
readonly auth?: CodemationConfig["auth"];
|
|
122
|
+
readonly database?: FriendlyCodemationDatabaseConfig;
|
|
123
|
+
readonly execution?: FriendlyCodemationExecutionConfig;
|
|
124
|
+
readonly nodes?: ReadonlyArray<DefinedNode<string, Record<string, unknown>, unknown, unknown>>;
|
|
125
|
+
readonly credentialTypes?: ReadonlyArray<AnyCredentialType>;
|
|
126
|
+
readonly credentials?: ReadonlyArray<AnyCredentialType>;
|
|
127
|
+
readonly register?: (context: CodemationAppContext) => void;
|
|
128
|
+
readonly whitelabel?: CodemationWhitelabelConfig;
|
|
129
|
+
}
|
|
130
|
+
interface DefinePluginOptions {
|
|
131
|
+
readonly name?: string;
|
|
132
|
+
readonly pluginPackageId?: string;
|
|
133
|
+
readonly nodes?: ReadonlyArray<DefinedNode<string, Record<string, unknown>, unknown, unknown>>;
|
|
134
|
+
readonly credentials?: ReadonlyArray<AnyCredentialType>;
|
|
135
|
+
readonly register?: (context: CodemationPluginContext) => void | Promise<void>;
|
|
136
|
+
readonly sandbox?: DefineCodemationAppOptions & Readonly<{
|
|
137
|
+
workflows?: ReadonlyArray<WorkflowDefinition>;
|
|
138
|
+
}>;
|
|
139
|
+
}
|
|
140
|
+
declare function defineCodemationApp(options: DefineCodemationAppOptions): CodemationConfig;
|
|
141
|
+
declare function definePlugin(options: DefinePluginOptions): CodemationPlugin & Readonly<{
|
|
142
|
+
sandbox?: DefinePluginOptions["sandbox"];
|
|
143
|
+
}>;
|
|
144
|
+
//#endregion
|
|
40
145
|
//#region src/presentation/config/CodemationPackageManifest.d.ts
|
|
41
146
|
interface CodemationPackageManifest {
|
|
42
147
|
readonly plugin?: string;
|
|
43
148
|
}
|
|
44
149
|
//#endregion
|
|
45
|
-
export { ApiPaths, type AppConfig, AppConfigFactory, AppContainerFactory, AppContainerLifecycle, type AppPluginLoadSummary, ApplicationTokens, type CodemationAppContext, type CodemationAppDefinition, type CodemationAppSchedulerConfig, type CodemationAppSchedulerKind, type CodemationApplicationRuntimeConfig, type CodemationAuthConfig, type CodemationAuthKind, type CodemationAuthOAuthProviderConfig, type CodemationAuthOidcProviderConfig, CodemationBootstrapRequest, type CodemationClassToken, type CodemationConfig, CodemationConsumerConfigLoader, type CodemationDatabaseConfig, type CodemationDatabaseKind, type CodemationEngineExecutionLimitsConfig, type CodemationEventBusConfig, type CodemationEventBusKind, type CodemationFrontendAuthProviderSnapshot, type CodemationFrontendAuthSnapshot, CodemationFrontendAuthSnapshotFactory, CodemationFrontendAuthSnapshotJsonCodec, type CodemationLogConfig, type CodemationLogLevelName, type CodemationLogRule, type CodemationPackageManifest, type CodemationPlugin, type CodemationPluginConfig, type CodemationPluginContext, CodemationPluginListMerger, CodemationPluginPackageMetadata, CodemationPostgresPrismaClientFactory, type CodemationRegistrationContextBase, type CodemationSchedulerConfig, type CodemationSchedulerKind, CodemationServerGateway, type CodemationWhitelabelConfig, type CodemationWorkflowDiscovery, type CommandBus, DatabaseMigrations, type FrontendAppConfig, FrontendAppConfigFactory, FrontendAppConfigJsonCodec, FrontendRuntime, type InternalAuthBootstrap, InternalAuthBootstrapFactory, InternalAuthBootstrapJsonCodec, ListUserAccountsQuery, PrismaClient, type PublicFrontendBootstrap, PublicFrontendBootstrapFactory, PublicFrontendBootstrapJsonCodec, type QueryBus, UpsertLocalBootstrapUserCommand, type UpsertLocalBootstrapUserResultDto, WorkerRuntime, definePlugin };
|
|
150
|
+
export { ApiPaths, type AppConfig, AppConfigFactory, AppContainerFactory, AppContainerLifecycle, type AppPluginLoadSummary, ApplicationTokens, type CodemationAppContext, type CodemationAppDefinition, type CodemationAppSchedulerConfig, type CodemationAppSchedulerKind, type CodemationApplicationRuntimeConfig, type CodemationAuthConfig, type CodemationAuthKind, type CodemationAuthOAuthProviderConfig, type CodemationAuthOidcProviderConfig, CodemationBootstrapRequest, type CodemationClassToken, type CodemationConfig, CodemationConsumerConfigLoader, type CodemationDatabaseConfig, type CodemationDatabaseKind, type CodemationEngineExecutionLimitsConfig, type CodemationEventBusConfig, type CodemationEventBusKind, type CodemationFrontendAuthProviderSnapshot, type CodemationFrontendAuthSnapshot, CodemationFrontendAuthSnapshotFactory, CodemationFrontendAuthSnapshotJsonCodec, type CodemationLogConfig, type CodemationLogLevelName, type CodemationLogRule, type CodemationPackageManifest, type CodemationPlugin, type CodemationPluginConfig, type CodemationPluginContext, CodemationPluginListMerger, CodemationPluginPackageMetadata, CodemationPostgresPrismaClientFactory, type CodemationRegistrationContextBase, type CodemationSchedulerConfig, type CodemationSchedulerKind, CodemationServerGateway, type CodemationWhitelabelConfig, type CodemationWorkflowDiscovery, type CommandBus, DatabaseMigrations, type DefineCodemationAppOptions, type DefinePluginOptions, type FriendlyCodemationDatabaseConfig, type FriendlyCodemationExecutionConfig, type FrontendAppConfig, FrontendAppConfigFactory, FrontendAppConfigJsonCodec, FrontendRuntime, type InternalAuthBootstrap, InternalAuthBootstrapFactory, InternalAuthBootstrapJsonCodec, ListUserAccountsQuery, PrismaClient, type PublicFrontendBootstrap, PublicFrontendBootstrapFactory, PublicFrontendBootstrapJsonCodec, type QueryBus, UpsertLocalBootstrapUserCommand, type UpsertLocalBootstrapUserResultDto, WorkerRuntime, defineCodemationApp, definePlugin, workflow };
|
|
46
151
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.js
CHANGED
|
@@ -1,15 +1,101 @@
|
|
|
1
1
|
import "./ConsoleLogger-ClPU7jtc.js";
|
|
2
2
|
import { i as CodemationFrontendAuthSnapshotJsonCodec, n as InternalAuthBootstrapJsonCodec, r as FrontendAppConfigJsonCodec, t as PublicFrontendBootstrapJsonCodec } from "./PublicFrontendBootstrapJsonCodec-BdiVGG5R.js";
|
|
3
|
-
import { t as CodemationConsumerConfigLoader } from "./CodemationConsumerConfigLoader-
|
|
3
|
+
import { t as CodemationConsumerConfigLoader } from "./CodemationConsumerConfigLoader-C_ISRrpI.js";
|
|
4
4
|
import "./ServerLoggerFactory-BltIIDfQ.js";
|
|
5
5
|
import "./decorateParam-DrsXNPuw.js";
|
|
6
6
|
import "./decorate-B0PP651O.js";
|
|
7
7
|
import { u as ApplicationTokens } from "./CredentialServices-DNb3CZwW.js";
|
|
8
|
-
import { E as ListUserAccountsQuery, T as UpsertLocalBootstrapUserCommand, _ as CodemationFrontendAuthSnapshotFactory, a as AppContainerLifecycle, g as FrontendAppConfigFactory, h as InternalAuthBootstrapFactory, i as DatabaseMigrations, m as PublicFrontendBootstrapFactory, n as WorkerRuntime, r as FrontendRuntime, t as AppContainerFactory, y as ApiPaths } from "./AppContainerFactory-
|
|
9
|
-
import { n as CodemationPluginPackageMetadata,
|
|
8
|
+
import { E as ListUserAccountsQuery, T as UpsertLocalBootstrapUserCommand, _ as CodemationFrontendAuthSnapshotFactory, a as AppContainerLifecycle, g as FrontendAppConfigFactory, h as InternalAuthBootstrapFactory, i as DatabaseMigrations, m as PublicFrontendBootstrapFactory, n as WorkerRuntime, r as FrontendRuntime, t as AppContainerFactory, y as ApiPaths } from "./AppContainerFactory-z9aUDFiJ.js";
|
|
9
|
+
import { n as CodemationPluginPackageMetadata, t as AppConfigFactory } from "./AppConfigFactory-DxoZ4v8r.js";
|
|
10
10
|
import { n as CodemationBootstrapRequest, t as CodemationPluginListMerger } from "./CodemationPluginListMerger-CGwOTdZ7.js";
|
|
11
|
-
import { n as CodemationPostgresPrismaClientFactory, t as import_client } from "./persistenceServer-
|
|
12
|
-
import { r as CodemationServerGateway } from "./server-
|
|
11
|
+
import { n as CodemationPostgresPrismaClientFactory, t as import_client } from "./persistenceServer-C4L1uMKn.js";
|
|
12
|
+
import { r as CodemationServerGateway } from "./server-DDVXr7BN.js";
|
|
13
|
+
import { workflow } from "@codemation/core-nodes";
|
|
13
14
|
|
|
15
|
+
//#region src/presentation/config/CodemationAuthoring.types.ts
|
|
16
|
+
var CodemationAuthoringConfigFactory = class {
|
|
17
|
+
static createApp(options) {
|
|
18
|
+
const appDefinition = this.createAppDefinition(options);
|
|
19
|
+
const credentialTypes = [...options.credentialTypes ?? [], ...options.credentials ?? []];
|
|
20
|
+
const register = this.composeAppRegister(options.register, options.nodes);
|
|
21
|
+
const { workflows, workflowDiscovery, plugins, runtime, log } = options;
|
|
22
|
+
return {
|
|
23
|
+
workflows,
|
|
24
|
+
workflowDiscovery,
|
|
25
|
+
plugins,
|
|
26
|
+
runtime,
|
|
27
|
+
log,
|
|
28
|
+
app: appDefinition,
|
|
29
|
+
credentialTypes,
|
|
30
|
+
register
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
static createPlugin(options) {
|
|
34
|
+
return {
|
|
35
|
+
pluginPackageId: options.pluginPackageId,
|
|
36
|
+
sandbox: options.sandbox,
|
|
37
|
+
async register(context) {
|
|
38
|
+
for (const nodeDefinition of options.nodes ?? []) nodeDefinition.register(context);
|
|
39
|
+
for (const credential of options.credentials ?? []) context.registerCredentialType(credential);
|
|
40
|
+
await options.register?.(context);
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
static createAppDefinition(options) {
|
|
45
|
+
const scheduler = this.createSchedulerConfig(options.execution);
|
|
46
|
+
const database = this.createDatabaseConfig(options.database);
|
|
47
|
+
const whitelabel = this.createWhitelabel(options.name, options.whitelabel);
|
|
48
|
+
if (!options.auth && !database && !scheduler && !whitelabel) return;
|
|
49
|
+
return {
|
|
50
|
+
auth: options.auth,
|
|
51
|
+
database,
|
|
52
|
+
scheduler,
|
|
53
|
+
whitelabel
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
static createDatabaseConfig(database) {
|
|
57
|
+
if (!database) return;
|
|
58
|
+
if (database.kind === "pglite") return {
|
|
59
|
+
kind: "pglite",
|
|
60
|
+
pgliteDataDir: database.dataDir
|
|
61
|
+
};
|
|
62
|
+
return {
|
|
63
|
+
kind: "postgresql",
|
|
64
|
+
url: database.url
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
static createSchedulerConfig(execution) {
|
|
68
|
+
if (!execution) return;
|
|
69
|
+
return {
|
|
70
|
+
kind: execution.mode,
|
|
71
|
+
queuePrefix: execution.queuePrefix,
|
|
72
|
+
workerQueues: execution.workerQueues,
|
|
73
|
+
redisUrl: execution.redisUrl
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
static createWhitelabel(name, whitelabel) {
|
|
77
|
+
if (!name && !whitelabel) return;
|
|
78
|
+
return {
|
|
79
|
+
productName: name ?? whitelabel?.productName,
|
|
80
|
+
logoPath: whitelabel?.logoPath
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
static composeAppRegister(register, nodes) {
|
|
84
|
+
if (!register && (!nodes || nodes.length === 0)) return;
|
|
85
|
+
return (context) => {
|
|
86
|
+
for (const nodeDefinition of nodes ?? []) nodeDefinition.register(context);
|
|
87
|
+
register?.(context);
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
};
|
|
91
|
+
function defineCodemationApp(options) {
|
|
92
|
+
return CodemationAuthoringConfigFactory.createApp(options);
|
|
93
|
+
}
|
|
94
|
+
function definePlugin(options) {
|
|
95
|
+
return CodemationAuthoringConfigFactory.createPlugin(options);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
//#endregion
|
|
14
99
|
var PrismaClient = import_client.PrismaClient;
|
|
15
|
-
export { ApiPaths, AppConfigFactory, AppContainerFactory, AppContainerLifecycle, ApplicationTokens, CodemationBootstrapRequest, CodemationConsumerConfigLoader, CodemationFrontendAuthSnapshotFactory, CodemationFrontendAuthSnapshotJsonCodec, CodemationPluginListMerger, CodemationPluginPackageMetadata, CodemationPostgresPrismaClientFactory, CodemationServerGateway, DatabaseMigrations, FrontendAppConfigFactory, FrontendAppConfigJsonCodec, FrontendRuntime, InternalAuthBootstrapFactory, InternalAuthBootstrapJsonCodec, ListUserAccountsQuery, PrismaClient, PublicFrontendBootstrapFactory, PublicFrontendBootstrapJsonCodec, UpsertLocalBootstrapUserCommand, WorkerRuntime, definePlugin };
|
|
100
|
+
export { ApiPaths, AppConfigFactory, AppContainerFactory, AppContainerLifecycle, ApplicationTokens, CodemationBootstrapRequest, CodemationConsumerConfigLoader, CodemationFrontendAuthSnapshotFactory, CodemationFrontendAuthSnapshotJsonCodec, CodemationPluginListMerger, CodemationPluginPackageMetadata, CodemationPostgresPrismaClientFactory, CodemationServerGateway, DatabaseMigrations, FrontendAppConfigFactory, FrontendAppConfigJsonCodec, FrontendRuntime, InternalAuthBootstrapFactory, InternalAuthBootstrapJsonCodec, ListUserAccountsQuery, PrismaClient, PublicFrontendBootstrapFactory, PublicFrontendBootstrapJsonCodec, UpsertLocalBootstrapUserCommand, WorkerRuntime, defineCodemationApp, definePlugin, workflow };
|
|
101
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../src/presentation/config/CodemationAuthoring.types.ts"],"sourcesContent":["import type { AnyCredentialType, DefinedNode, WorkflowDefinition } from \"@codemation/core\";\nimport type { CodemationAppContext } from \"./CodemationAppContext\";\nimport type {\n CodemationAppDefinition,\n CodemationAppSchedulerConfig,\n CodemationConfig,\n CodemationDatabaseConfig,\n} from \"./CodemationConfig\";\nimport type { CodemationPlugin, CodemationPluginContext } from \"./CodemationPlugin\";\nimport type { CodemationWhitelabelConfig } from \"./CodemationWhitelabelConfig\";\n\nexport interface FriendlyCodemationDatabaseConfig {\n readonly kind: \"postgresql\" | \"pglite\";\n readonly url?: string;\n readonly dataDir?: string;\n}\n\nexport interface FriendlyCodemationExecutionConfig {\n readonly mode?: \"inline\" | \"queue\";\n readonly queuePrefix?: string;\n readonly workerQueues?: ReadonlyArray<string>;\n readonly redisUrl?: string;\n}\n\nexport interface DefineCodemationAppOptions extends Omit<\n CodemationConfig,\n \"app\" | \"credentialTypes\" | \"register\" | \"whitelabel\" | \"auth\"\n> {\n readonly name?: string;\n readonly auth?: CodemationConfig[\"auth\"];\n readonly database?: FriendlyCodemationDatabaseConfig;\n readonly execution?: FriendlyCodemationExecutionConfig;\n readonly nodes?: ReadonlyArray<DefinedNode<string, Record<string, unknown>, unknown, unknown>>;\n readonly credentialTypes?: ReadonlyArray<AnyCredentialType>;\n readonly credentials?: ReadonlyArray<AnyCredentialType>;\n readonly register?: (context: CodemationAppContext) => void;\n readonly whitelabel?: CodemationWhitelabelConfig;\n}\n\nexport interface DefinePluginOptions {\n readonly name?: string;\n readonly pluginPackageId?: string;\n readonly nodes?: ReadonlyArray<DefinedNode<string, Record<string, unknown>, unknown, unknown>>;\n readonly credentials?: ReadonlyArray<AnyCredentialType>;\n readonly register?: (context: CodemationPluginContext) => void | Promise<void>;\n readonly sandbox?: DefineCodemationAppOptions & Readonly<{ workflows?: ReadonlyArray<WorkflowDefinition> }>;\n}\n\nclass CodemationAuthoringConfigFactory {\n static createApp(options: DefineCodemationAppOptions): CodemationConfig {\n const appDefinition = this.createAppDefinition(options);\n const credentialTypes = [...(options.credentialTypes ?? []), ...(options.credentials ?? [])];\n const register = this.composeAppRegister(options.register, options.nodes);\n const { workflows, workflowDiscovery, plugins, runtime, log } = options;\n return {\n workflows,\n workflowDiscovery,\n plugins,\n runtime,\n log,\n app: appDefinition,\n credentialTypes,\n register,\n };\n }\n\n static createPlugin(\n options: DefinePluginOptions,\n ): CodemationPlugin & Readonly<{ sandbox?: DefinePluginOptions[\"sandbox\"] }> {\n return {\n pluginPackageId: options.pluginPackageId,\n sandbox: options.sandbox,\n async register(context: CodemationPluginContext): Promise<void> {\n for (const nodeDefinition of options.nodes ?? []) {\n nodeDefinition.register(context);\n }\n for (const credential of options.credentials ?? []) {\n context.registerCredentialType(credential);\n }\n await options.register?.(context);\n },\n };\n }\n\n private static createAppDefinition(options: DefineCodemationAppOptions): CodemationAppDefinition | undefined {\n const scheduler = this.createSchedulerConfig(options.execution);\n const database = this.createDatabaseConfig(options.database);\n const whitelabel = this.createWhitelabel(options.name, options.whitelabel);\n if (!options.auth && !database && !scheduler && !whitelabel) {\n return undefined;\n }\n return {\n auth: options.auth,\n database,\n scheduler,\n whitelabel,\n };\n }\n\n private static createDatabaseConfig(\n database: FriendlyCodemationDatabaseConfig | undefined,\n ): CodemationDatabaseConfig | undefined {\n if (!database) {\n return undefined;\n }\n if (database.kind === \"pglite\") {\n return {\n kind: \"pglite\",\n pgliteDataDir: database.dataDir,\n };\n }\n return {\n kind: \"postgresql\",\n url: database.url,\n };\n }\n\n private static createSchedulerConfig(\n execution: FriendlyCodemationExecutionConfig | undefined,\n ): CodemationAppSchedulerConfig | undefined {\n if (!execution) {\n return undefined;\n }\n return {\n kind: execution.mode,\n queuePrefix: execution.queuePrefix,\n workerQueues: execution.workerQueues,\n redisUrl: execution.redisUrl,\n };\n }\n\n private static createWhitelabel(\n name: string | undefined,\n whitelabel: CodemationWhitelabelConfig | undefined,\n ): CodemationWhitelabelConfig | undefined {\n if (!name && !whitelabel) {\n return undefined;\n }\n return {\n productName: name ?? whitelabel?.productName,\n logoPath: whitelabel?.logoPath,\n };\n }\n\n private static composeAppRegister(\n register: ((context: CodemationAppContext) => void) | undefined,\n nodes: ReadonlyArray<DefinedNode<string, Record<string, unknown>, unknown, unknown>> | undefined,\n ): ((context: CodemationAppContext) => void) | undefined {\n if (!register && (!nodes || nodes.length === 0)) {\n return undefined;\n }\n return (context: CodemationAppContext) => {\n for (const nodeDefinition of nodes ?? []) {\n nodeDefinition.register(context);\n }\n register?.(context);\n };\n }\n}\n\nexport function defineCodemationApp(options: DefineCodemationAppOptions): CodemationConfig {\n return CodemationAuthoringConfigFactory.createApp(options);\n}\n\nexport function definePlugin(\n options: DefinePluginOptions,\n): CodemationPlugin & Readonly<{ sandbox?: DefinePluginOptions[\"sandbox\"] }> {\n return CodemationAuthoringConfigFactory.createPlugin(options);\n}\n"],"mappings":";;;;;;;;;;;;;;;AAgDA,IAAM,mCAAN,MAAuC;CACrC,OAAO,UAAU,SAAuD;EACtE,MAAM,gBAAgB,KAAK,oBAAoB,QAAQ;EACvD,MAAM,kBAAkB,CAAC,GAAI,QAAQ,mBAAmB,EAAE,EAAG,GAAI,QAAQ,eAAe,EAAE,CAAE;EAC5F,MAAM,WAAW,KAAK,mBAAmB,QAAQ,UAAU,QAAQ,MAAM;EACzE,MAAM,EAAE,WAAW,mBAAmB,SAAS,SAAS,QAAQ;AAChE,SAAO;GACL;GACA;GACA;GACA;GACA;GACA,KAAK;GACL;GACA;GACD;;CAGH,OAAO,aACL,SAC2E;AAC3E,SAAO;GACL,iBAAiB,QAAQ;GACzB,SAAS,QAAQ;GACjB,MAAM,SAAS,SAAiD;AAC9D,SAAK,MAAM,kBAAkB,QAAQ,SAAS,EAAE,CAC9C,gBAAe,SAAS,QAAQ;AAElC,SAAK,MAAM,cAAc,QAAQ,eAAe,EAAE,CAChD,SAAQ,uBAAuB,WAAW;AAE5C,UAAM,QAAQ,WAAW,QAAQ;;GAEpC;;CAGH,OAAe,oBAAoB,SAA0E;EAC3G,MAAM,YAAY,KAAK,sBAAsB,QAAQ,UAAU;EAC/D,MAAM,WAAW,KAAK,qBAAqB,QAAQ,SAAS;EAC5D,MAAM,aAAa,KAAK,iBAAiB,QAAQ,MAAM,QAAQ,WAAW;AAC1E,MAAI,CAAC,QAAQ,QAAQ,CAAC,YAAY,CAAC,aAAa,CAAC,WAC/C;AAEF,SAAO;GACL,MAAM,QAAQ;GACd;GACA;GACA;GACD;;CAGH,OAAe,qBACb,UACsC;AACtC,MAAI,CAAC,SACH;AAEF,MAAI,SAAS,SAAS,SACpB,QAAO;GACL,MAAM;GACN,eAAe,SAAS;GACzB;AAEH,SAAO;GACL,MAAM;GACN,KAAK,SAAS;GACf;;CAGH,OAAe,sBACb,WAC0C;AAC1C,MAAI,CAAC,UACH;AAEF,SAAO;GACL,MAAM,UAAU;GAChB,aAAa,UAAU;GACvB,cAAc,UAAU;GACxB,UAAU,UAAU;GACrB;;CAGH,OAAe,iBACb,MACA,YACwC;AACxC,MAAI,CAAC,QAAQ,CAAC,WACZ;AAEF,SAAO;GACL,aAAa,QAAQ,YAAY;GACjC,UAAU,YAAY;GACvB;;CAGH,OAAe,mBACb,UACA,OACuD;AACvD,MAAI,CAAC,aAAa,CAAC,SAAS,MAAM,WAAW,GAC3C;AAEF,UAAQ,YAAkC;AACxC,QAAK,MAAM,kBAAkB,SAAS,EAAE,CACtC,gBAAe,SAAS,QAAQ;AAElC,cAAW,QAAQ;;;;AAKzB,SAAgB,oBAAoB,SAAuD;AACzF,QAAO,iCAAiC,UAAU,QAAQ;;AAG5D,SAAgB,aACd,SAC2E;AAC3E,QAAO,iCAAiC,aAAa,QAAQ"}
|