@codemation/host 0.2.2 → 0.2.3

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 CHANGED
@@ -1,5 +1,12 @@
1
1
  # @codemation/host
2
2
 
3
+ ## 0.2.3
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [[`f451b1b`](https://github.com/MadeRelevant/codemation/commit/f451b1b4657b59406e15ce5f50b243e487ff99ed)]:
8
+ - @codemation/core-nodes@0.3.0
9
+
3
10
  ## 0.2.2
4
11
 
5
12
  ### Patch Changes
@@ -31,6 +31,45 @@ declare class Filter<TIn = unknown> implements RunnableNodeConfig<TIn, TIn> {
31
31
  constructor(name: string, predicate: (item: Item<TIn>, index: number, items: Items<TIn>, ctx: NodeExecutionContext<Filter<TIn>>) => boolean, id?: string | undefined);
32
32
  }
33
33
  //#endregion
34
+ //#region ../core-nodes/src/nodes/if.d.ts
35
+ declare class If<TInputJson = unknown> implements RunnableNodeConfig<TInputJson, TInputJson> {
36
+ readonly name: string;
37
+ readonly predicate: (item: Item<TInputJson>, index: number, items: Items<TInputJson>, ctx: NodeExecutionContext<If<TInputJson>>) => boolean;
38
+ readonly id?: string | undefined;
39
+ readonly kind: "node";
40
+ readonly type: TypeToken<unknown>;
41
+ readonly execution: {
42
+ readonly hint: "local";
43
+ };
44
+ readonly icon: "lucide:split";
45
+ readonly declaredOutputPorts: readonly ["true", "false"];
46
+ constructor(name: string, predicate: (item: Item<TInputJson>, index: number, items: Items<TInputJson>, ctx: NodeExecutionContext<If<TInputJson>>) => boolean, id?: string | undefined);
47
+ }
48
+ //#endregion
49
+ //#region ../core-nodes/src/nodes/switch.d.ts
50
+ type SwitchCaseKeyResolver<TInputJson = unknown> = (item: Item<TInputJson>, index: number, items: Items<TInputJson>, ctx: NodeExecutionContext<Switch<TInputJson>>) => string | Promise<string>;
51
+ declare class Switch<TInputJson = unknown> implements RunnableNodeConfig<TInputJson, TInputJson> {
52
+ readonly name: string;
53
+ readonly cfg: Readonly<{
54
+ cases: readonly string[];
55
+ defaultCase: string;
56
+ resolveCaseKey: SwitchCaseKeyResolver<TInputJson>;
57
+ }>;
58
+ readonly id?: string | undefined;
59
+ readonly kind: "node";
60
+ readonly type: TypeToken<unknown>;
61
+ readonly execution: {
62
+ readonly hint: "local";
63
+ };
64
+ readonly icon: "lucide:git-branch-plus";
65
+ readonly declaredOutputPorts: ReadonlyArray<string>;
66
+ constructor(name: string, cfg: Readonly<{
67
+ cases: readonly string[];
68
+ defaultCase: string;
69
+ resolveCaseKey: SwitchCaseKeyResolver<TInputJson>;
70
+ }>, id?: string | undefined);
71
+ }
72
+ //#endregion
34
73
  //#region ../core-nodes/src/nodes/split.d.ts
35
74
  declare class Split<TIn = unknown, TElem = unknown> implements RunnableNodeConfig<TIn, TElem> {
36
75
  readonly name: string;
@@ -55,6 +94,21 @@ interface MapDataOptions {
55
94
  readonly id?: string;
56
95
  readonly keepBinaries?: boolean;
57
96
  }
97
+ declare class MapData<TInputJson = unknown, TOutputJson = unknown> implements RunnableNodeConfig<TInputJson, TOutputJson> {
98
+ readonly name: string;
99
+ readonly map: (item: Item<TInputJson>, ctx: NodeExecutionContext<MapData<TInputJson, TOutputJson>>) => TOutputJson;
100
+ private readonly options;
101
+ readonly kind: "node";
102
+ readonly type: TypeToken<unknown>;
103
+ readonly execution: {
104
+ readonly hint: "local";
105
+ };
106
+ /** Zero mapped items should still allow downstream nodes to run. */
107
+ readonly continueWhenEmptyOutput: true;
108
+ readonly keepBinaries: boolean;
109
+ constructor(name: string, map: (item: Item<TInputJson>, ctx: NodeExecutionContext<MapData<TInputJson, TOutputJson>>) => TOutputJson, options?: MapDataOptions);
110
+ get id(): string | undefined;
111
+ }
58
112
  //#endregion
59
113
  //#region ../core-nodes/src/nodes/merge.d.ts
60
114
  type MergeMode = "passThrough" | "append" | "mergeByPosition";
@@ -72,12 +126,13 @@ interface WorkflowAgentOptions<TCurrentJson, TOutputSchema extends z.ZodTypeAny
72
126
  }
73
127
  //#endregion
74
128
  //#region ../core-nodes/src/workflowAuthoring/WorkflowBranchBuilder.types.d.ts
129
+ type WorkflowMapCallback$1<TCurrentJson, TNextJson> = (item: Item<TCurrentJson>, ctx: NodeExecutionContext<MapData<TCurrentJson, TNextJson>>) => TNextJson;
75
130
  declare class WorkflowBranchBuilder<TCurrentJson> {
76
131
  private readonly steps;
77
132
  constructor(steps?: ReadonlyArray<AnyRunnableNodeConfig>);
78
133
  then<TOutputJson, TConfig extends RunnableNodeConfig<TCurrentJson, TOutputJson>>(config: TConfig): WorkflowBranchBuilder<RunnableNodeOutputJson<TConfig>>;
79
- map<TNextJson>(mapper: (item: TCurrentJson) => TNextJson): WorkflowBranchBuilder<TNextJson>;
80
- map<TNextJson>(name: string, mapper: (item: TCurrentJson) => TNextJson, options?: MapDataOptions): WorkflowBranchBuilder<TNextJson>;
134
+ map<TNextJson>(mapper: WorkflowMapCallback$1<TCurrentJson, TNextJson>): WorkflowBranchBuilder<TNextJson>;
135
+ map<TNextJson>(name: string, mapper: WorkflowMapCallback$1<TCurrentJson, TNextJson>, options?: MapDataOptions): WorkflowBranchBuilder<TNextJson>;
81
136
  wait(duration: number | string): WorkflowBranchBuilder<TCurrentJson>;
82
137
  wait(name: string, duration: number | string, id?: string): WorkflowBranchBuilder<TCurrentJson>;
83
138
  split<TElem>(getElements: (item: Item<TCurrentJson>, ctx: NodeExecutionContext<Split<TCurrentJson, TElem>>) => readonly TElem[]): WorkflowBranchBuilder<TElem>;
@@ -96,12 +151,15 @@ declare class WorkflowBranchBuilder<TCurrentJson> {
96
151
  //#region ../core-nodes/src/workflowAuthoring/WorkflowChain.types.d.ts
97
152
  type BranchCallback<TCurrentJson, TNextJson> = (branch: WorkflowBranchBuilder<TCurrentJson>) => WorkflowBranchBuilder<TNextJson>;
98
153
  type RouteBranchCallback<TCurrentJson, TNextJson> = (branch: WorkflowChain<TCurrentJson>) => WorkflowChain<TNextJson>;
154
+ type WorkflowMapCallback<TCurrentJson, TNextJson> = (item: Item<TCurrentJson>, ctx: NodeExecutionContext<MapData<TCurrentJson, TNextJson>>) => TNextJson;
155
+ type WorkflowIfPredicate<TCurrentJson> = (item: Item<TCurrentJson>, ctx: NodeExecutionContext<If<TCurrentJson>>) => boolean;
156
+ type WorkflowSwitchCaseKeyResolver<TCurrentJson> = (item: Item<TCurrentJson>, ctx: NodeExecutionContext<Switch<TCurrentJson>>) => string | Promise<string>;
99
157
  declare class WorkflowChain<TCurrentJson> {
100
158
  private readonly chain;
101
159
  constructor(chain: ChainCursor<TCurrentJson>);
102
160
  then<TOutputJson, TConfig extends RunnableNodeConfig<TCurrentJson, TOutputJson>>(config: TConfig): WorkflowChain<RunnableNodeOutputJson<TConfig>>;
103
- map<TNextJson>(mapper: (item: TCurrentJson) => TNextJson): WorkflowChain<TNextJson>;
104
- map<TNextJson>(name: string, mapper: (item: TCurrentJson) => TNextJson, options?: MapDataOptions): WorkflowChain<TNextJson>;
161
+ map<TNextJson>(mapper: WorkflowMapCallback<TCurrentJson, TNextJson>): WorkflowChain<TNextJson>;
162
+ map<TNextJson>(name: string, mapper: WorkflowMapCallback<TCurrentJson, TNextJson>, options?: MapDataOptions): WorkflowChain<TNextJson>;
105
163
  wait(duration: number | string): WorkflowChain<TCurrentJson>;
106
164
  wait(name: string, duration: number | string, id?: string): WorkflowChain<TCurrentJson>;
107
165
  split<TElem>(getElements: (item: Item<TCurrentJson>, ctx: NodeExecutionContext<Split<TCurrentJson, TElem>>) => readonly TElem[]): WorkflowChain<TElem>;
@@ -119,11 +177,11 @@ declare class WorkflowChain<TCurrentJson> {
119
177
  mode: MergeMode;
120
178
  prefer?: ReadonlyArray<string>;
121
179
  }>, id?: string): WorkflowChain<TCurrentJson>;
122
- if<TBranchJson>(predicate: (item: TCurrentJson) => boolean, branches: Readonly<{
180
+ if<TBranchJson>(predicate: WorkflowIfPredicate<TCurrentJson>, branches: Readonly<{
123
181
  true?: BranchCallback<TCurrentJson, TBranchJson>;
124
182
  false?: BranchCallback<TCurrentJson, TBranchJson>;
125
183
  }>): WorkflowChain<TBranchJson>;
126
- if<TBranchJson>(name: string, predicate: (item: TCurrentJson) => boolean, branches: Readonly<{
184
+ if<TBranchJson>(name: string, predicate: WorkflowIfPredicate<TCurrentJson>, branches: Readonly<{
127
185
  true?: BranchCallback<TCurrentJson, TBranchJson>;
128
186
  false?: BranchCallback<TCurrentJson, TBranchJson>;
129
187
  }>): WorkflowChain<TBranchJson>;
@@ -131,13 +189,13 @@ declare class WorkflowChain<TCurrentJson> {
131
189
  switch<TBranchJson>(cfg: Readonly<{
132
190
  cases: readonly string[];
133
191
  defaultCase: string;
134
- resolveCaseKey: (item: TCurrentJson) => string | Promise<string>;
192
+ resolveCaseKey: WorkflowSwitchCaseKeyResolver<TCurrentJson>;
135
193
  branches: Readonly<Record<string, RouteBranchCallback<TCurrentJson, TBranchJson> | undefined>>;
136
194
  }>): WorkflowChain<TBranchJson>;
137
195
  switch<TBranchJson>(name: string, cfg: Readonly<{
138
196
  cases: readonly string[];
139
197
  defaultCase: string;
140
- resolveCaseKey: (item: TCurrentJson) => string | Promise<string>;
198
+ resolveCaseKey: WorkflowSwitchCaseKeyResolver<TCurrentJson>;
141
199
  branches: Readonly<Record<string, RouteBranchCallback<TCurrentJson, TBranchJson> | undefined>>;
142
200
  }>, id?: string): WorkflowChain<TBranchJson>;
143
201
  agent<TOutputSchema extends z.ZodTypeAny>(options: WorkflowAgentOptions<TCurrentJson, TOutputSchema>): WorkflowChain<z.output<TOutputSchema>>;
@@ -199,4 +257,4 @@ declare function definePlugin(options: DefinePluginOptions): CodemationPlugin &
199
257
  }>;
200
258
  //#endregion
201
259
  export { defineCodemationApp as a, FriendlyCodemationExecutionConfig as i, DefinePluginOptions as n, definePlugin as o, FriendlyCodemationDatabaseConfig as r, workflow as s, DefineCodemationAppOptions as t };
202
- //# sourceMappingURL=CodemationAuthoring.types-CT6Kp1vK.d.ts.map
260
+ //# sourceMappingURL=CodemationAuthoring.types-BXwqqy-v.d.ts.map
@@ -1,5 +1,5 @@
1
1
  import "./index-DMedRrli.js";
2
- import { a as defineCodemationApp, i as FriendlyCodemationExecutionConfig, n as DefinePluginOptions, o as definePlugin, r as FriendlyCodemationDatabaseConfig, s as workflow, t as DefineCodemationAppOptions } from "./CodemationAuthoring.types-CT6Kp1vK.js";
2
+ import { a as defineCodemationApp, i as FriendlyCodemationExecutionConfig, n as DefinePluginOptions, o as definePlugin, r as FriendlyCodemationDatabaseConfig, s as workflow, t as DefineCodemationAppOptions } from "./CodemationAuthoring.types-BXwqqy-v.js";
3
3
  import { _ as CodemationEngineExecutionLimitsConfig, b as CodemationSchedulerConfig, c as CodemationPluginContext, d as CodemationAppSchedulerConfig, f as CodemationAppSchedulerKind, g as CodemationDatabaseKind, h as CodemationDatabaseConfig, m as CodemationConfig, n as CodemationRegistrationContextBase, o as CodemationPlugin, p as CodemationApplicationRuntimeConfig, s as CodemationPluginConfig, t as CodemationAppContext, u as CodemationAppDefinition, v as CodemationEventBusConfig, x as CodemationSchedulerKind, y as CodemationEventBusKind } from "./CodemationAppContext-DZt_ZwXH.js";
4
4
  import "./CodemationWhitelabelConfig-D5rYcLlj.js";
5
5
  export { type CodemationAppContext, type CodemationAppDefinition, type CodemationAppSchedulerConfig, type CodemationAppSchedulerKind, type CodemationApplicationRuntimeConfig, type CodemationConfig, type CodemationDatabaseConfig, type CodemationDatabaseKind, type CodemationEngineExecutionLimitsConfig, type CodemationEventBusConfig, type CodemationEventBusKind, type CodemationPlugin, type CodemationPluginConfig, type CodemationPluginContext, type CodemationRegistrationContextBase, type CodemationSchedulerConfig, type CodemationSchedulerKind, type DefineCodemationAppOptions, type DefinePluginOptions, type FriendlyCodemationDatabaseConfig, type FriendlyCodemationExecutionConfig, defineCodemationApp, definePlugin, workflow };
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import "./index-DMedRrli.js";
2
- import { a as defineCodemationApp, i as FriendlyCodemationExecutionConfig, n as DefinePluginOptions, o as definePlugin, r as FriendlyCodemationDatabaseConfig, s as workflow, t as DefineCodemationAppOptions } from "./CodemationAuthoring.types-CT6Kp1vK.js";
2
+ import { a as defineCodemationApp, i as FriendlyCodemationExecutionConfig, n as DefinePluginOptions, o as definePlugin, r as FriendlyCodemationDatabaseConfig, s as workflow, t as DefineCodemationAppOptions } from "./CodemationAuthoring.types-BXwqqy-v.js";
3
3
  import { S as CodemationWorkflowDiscovery, _ as CodemationEngineExecutionLimitsConfig, a as AppPluginLoadSummary, b as CodemationSchedulerConfig, c as CodemationPluginContext, d as CodemationAppSchedulerConfig, f as CodemationAppSchedulerKind, g as CodemationDatabaseKind, h as CodemationDatabaseConfig, l as CodemationPluginPackageMetadata, m as CodemationConfig, n as CodemationRegistrationContextBase, o as CodemationPlugin, p as CodemationApplicationRuntimeConfig, r as AppConfig, s as CodemationPluginConfig, t as CodemationAppContext, u as CodemationAppDefinition, v as CodemationEventBusConfig, w as CodemationClassToken, x as CodemationSchedulerKind, y as CodemationEventBusKind } from "./CodemationAppContext-DZt_ZwXH.js";
4
4
  import { a as CodemationAuthConfig, c as CodemationAuthOidcProviderConfig, i as CodemationLogRule, n as CodemationLogConfig, o as CodemationAuthKind, r as CodemationLogLevelName, s as CodemationAuthOAuthProviderConfig, t as CodemationWhitelabelConfig } from "./CodemationWhitelabelConfig-D5rYcLlj.js";
5
5
  import { a as CodemationFrontendAuthSnapshot, i as CodemationFrontendAuthProviderSnapshot, n as InternalAuthBootstrap, r as FrontendAppConfig, t as PublicFrontendBootstrap } from "./PublicFrontendBootstrap-ci0Vwxrb.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codemation/host",
3
- "version": "0.2.2",
3
+ "version": "0.2.3",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -120,8 +120,8 @@
120
120
  "ws": "^8.19.0",
121
121
  "zxcvbn": "^4.4.2",
122
122
  "@codemation/core": "0.6.0",
123
- "@codemation/eventbus-redis": "0.0.28",
124
- "@codemation/core-nodes": "0.2.0"
123
+ "@codemation/core-nodes": "0.3.0",
124
+ "@codemation/eventbus-redis": "0.0.28"
125
125
  },
126
126
  "devDependencies": {
127
127
  "@playwright/test": "^1.58.2",