@codemation/node-example 0.0.21 → 0.0.24

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,26 @@
1
1
  # @codemation/node-example
2
2
 
3
+ ## 0.0.24
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [[`d3a4321`](https://github.com/MadeRelevant/codemation/commit/d3a4321dc178df51dfd61cc6eb872ccca36bbcdb)]:
8
+ - @codemation/core@0.2.3
9
+
10
+ ## 0.0.23
11
+
12
+ ### Patch Changes
13
+
14
+ - Updated dependencies [[`74dc571`](https://github.com/MadeRelevant/codemation/commit/74dc571afb592bd7c05297b25f9f1fb06a46815f), [`74dc571`](https://github.com/MadeRelevant/codemation/commit/74dc571afb592bd7c05297b25f9f1fb06a46815f)]:
15
+ - @codemation/core@0.2.2
16
+
17
+ ## 0.0.22
18
+
19
+ ### Patch Changes
20
+
21
+ - Updated dependencies [[`4989e9c`](https://github.com/MadeRelevant/codemation/commit/4989e9c7d97513c05904d47d2f85794ba716a4d3)]:
22
+ - @codemation/core@0.2.1
23
+
3
24
  ## 0.0.21
4
25
 
5
26
  ### Patch Changes
package/dist/index.d.cts CHANGED
@@ -1,5 +1,6 @@
1
1
  import { ReadableStream } from "node:stream/web";
2
2
  import { InjectionToken as TypeToken } from "tsyringe";
3
+ import { ZodType } from "zod";
3
4
 
4
5
  //#region ../core/src/contracts/retryPolicySpec.types.d.ts
5
6
 
@@ -169,10 +170,60 @@ interface NodeConfigBase {
169
170
  }
170
171
  declare const runnableNodeInputType: unique symbol;
171
172
  declare const runnableNodeOutputType: unique symbol;
172
- interface RunnableNodeConfig<TInputJson$1 = unknown, TOutputJson$1 = unknown> extends NodeConfigBase {
173
+ /** Phantom: JSON shape on the wire from upstream before {@link RunnableNodeConfig.mapInput}. */
174
+ declare const runnableNodeWireType: unique symbol;
175
+ /**
176
+ * Read-only execution slice passed to {@link RunnableNodeConfig.mapInput} (aligned with the engine’s
177
+ * node execution context for `runId`, `data`, etc.). Use **`ctx.data`** to read **any completed** upstream
178
+ * node’s outputs in this run (e.g. `ctx.data.getOutputItems(nodeIdA, "main")` while mapping at D), not only
179
+ * the immediate predecessor’s {@link ItemInputMapperArgs.item}.
180
+ */
181
+ interface ItemInputMapperContext {
182
+ readonly runId: RunId;
183
+ readonly workflowId: WorkflowId;
184
+ /** Node whose activation is being prepared (the consumer of `mapInput`). */
185
+ readonly nodeId: NodeId;
186
+ readonly activationId: NodeActivationId;
187
+ readonly parent?: ParentExecutionRef;
188
+ readonly data: RunDataSnapshot;
189
+ }
190
+ /**
191
+ * Arguments for optional per-item input mapping applied by the engine before Zod validation.
192
+ */
193
+ interface ItemInputMapperArgs<TWireJson$1 = unknown> {
194
+ readonly item: Item<TWireJson$1>;
195
+ readonly itemIndex: number;
196
+ readonly items: Items<TWireJson$1>;
197
+ readonly ctx: ItemInputMapperContext;
198
+ }
199
+ /**
200
+ * Per-item mapper before Zod validation. Uses a **bivariant** method signature so concrete
201
+ * `ItemInputMapper<SpecificWire, TIn>` remains assignable to `RunnableNodeConfig` fields typed as
202
+ * `ItemInputMapper<unknown, unknown>` (same pattern as React-style callbacks).
203
+ */
204
+ type ItemInputMapper<TWireJson$1 = unknown, TInputJson$1 = unknown> = {
205
+ bivarianceHack(args: ItemInputMapperArgs<TWireJson$1>): TInputJson$1 | Promise<TInputJson$1>;
206
+ }["bivarianceHack"];
207
+ /**
208
+ * Runnable node: **`TInputJson`** is the payload after `mapInput` (if any) + Zod validation — what {@link ItemNode}
209
+ * `executeOne` receives. **`TOutputJson`** is emitted `item.json` on outputs. **`TWireJson`** is `item.json` from
210
+ * upstream **before** `mapInput`; it defaults to **`TInputJson`** when there is no mapper or wire differs from execute input.
211
+ */
212
+ interface RunnableNodeConfig<TInputJson$1 = unknown, TOutputJson$1 = unknown, TWireJson$1 = TInputJson$1> extends NodeConfigBase {
173
213
  readonly kind: "node";
174
214
  readonly [runnableNodeInputType]?: TInputJson$1;
175
215
  readonly [runnableNodeOutputType]?: TOutputJson$1;
216
+ readonly [runnableNodeWireType]?: TWireJson$1;
217
+ /**
218
+ * Optional Zod input contract for {@link ItemNode} when not set on the node class.
219
+ * Resolution order: node instance `inputSchema`, then config `inputSchema`, then `z.unknown()`.
220
+ */
221
+ readonly inputSchema?: ZodType<TInputJson$1>;
222
+ /**
223
+ * Optional per-item mapper: engine applies it before validating against the node’s `inputSchema`.
224
+ * When omitted, the engine validates `item.json` directly.
225
+ */
226
+ readonly mapInput?: ItemInputMapper<TWireJson$1, TInputJson$1>;
176
227
  }
177
228
  type PairedItemRef = Readonly<{
178
229
  nodeId: NodeId;
package/dist/index.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  import { ReadableStream } from "node:stream/web";
2
2
  import { InjectionToken as TypeToken } from "tsyringe";
3
+ import { ZodType } from "zod";
3
4
 
4
5
  //#region ../core/src/contracts/retryPolicySpec.types.d.ts
5
6
 
@@ -169,10 +170,60 @@ interface NodeConfigBase {
169
170
  }
170
171
  declare const runnableNodeInputType: unique symbol;
171
172
  declare const runnableNodeOutputType: unique symbol;
172
- interface RunnableNodeConfig<TInputJson$1 = unknown, TOutputJson$1 = unknown> extends NodeConfigBase {
173
+ /** Phantom: JSON shape on the wire from upstream before {@link RunnableNodeConfig.mapInput}. */
174
+ declare const runnableNodeWireType: unique symbol;
175
+ /**
176
+ * Read-only execution slice passed to {@link RunnableNodeConfig.mapInput} (aligned with the engine’s
177
+ * node execution context for `runId`, `data`, etc.). Use **`ctx.data`** to read **any completed** upstream
178
+ * node’s outputs in this run (e.g. `ctx.data.getOutputItems(nodeIdA, "main")` while mapping at D), not only
179
+ * the immediate predecessor’s {@link ItemInputMapperArgs.item}.
180
+ */
181
+ interface ItemInputMapperContext {
182
+ readonly runId: RunId;
183
+ readonly workflowId: WorkflowId;
184
+ /** Node whose activation is being prepared (the consumer of `mapInput`). */
185
+ readonly nodeId: NodeId;
186
+ readonly activationId: NodeActivationId;
187
+ readonly parent?: ParentExecutionRef;
188
+ readonly data: RunDataSnapshot;
189
+ }
190
+ /**
191
+ * Arguments for optional per-item input mapping applied by the engine before Zod validation.
192
+ */
193
+ interface ItemInputMapperArgs<TWireJson$1 = unknown> {
194
+ readonly item: Item<TWireJson$1>;
195
+ readonly itemIndex: number;
196
+ readonly items: Items<TWireJson$1>;
197
+ readonly ctx: ItemInputMapperContext;
198
+ }
199
+ /**
200
+ * Per-item mapper before Zod validation. Uses a **bivariant** method signature so concrete
201
+ * `ItemInputMapper<SpecificWire, TIn>` remains assignable to `RunnableNodeConfig` fields typed as
202
+ * `ItemInputMapper<unknown, unknown>` (same pattern as React-style callbacks).
203
+ */
204
+ type ItemInputMapper<TWireJson$1 = unknown, TInputJson$1 = unknown> = {
205
+ bivarianceHack(args: ItemInputMapperArgs<TWireJson$1>): TInputJson$1 | Promise<TInputJson$1>;
206
+ }["bivarianceHack"];
207
+ /**
208
+ * Runnable node: **`TInputJson`** is the payload after `mapInput` (if any) + Zod validation — what {@link ItemNode}
209
+ * `executeOne` receives. **`TOutputJson`** is emitted `item.json` on outputs. **`TWireJson`** is `item.json` from
210
+ * upstream **before** `mapInput`; it defaults to **`TInputJson`** when there is no mapper or wire differs from execute input.
211
+ */
212
+ interface RunnableNodeConfig<TInputJson$1 = unknown, TOutputJson$1 = unknown, TWireJson$1 = TInputJson$1> extends NodeConfigBase {
173
213
  readonly kind: "node";
174
214
  readonly [runnableNodeInputType]?: TInputJson$1;
175
215
  readonly [runnableNodeOutputType]?: TOutputJson$1;
216
+ readonly [runnableNodeWireType]?: TWireJson$1;
217
+ /**
218
+ * Optional Zod input contract for {@link ItemNode} when not set on the node class.
219
+ * Resolution order: node instance `inputSchema`, then config `inputSchema`, then `z.unknown()`.
220
+ */
221
+ readonly inputSchema?: ZodType<TInputJson$1>;
222
+ /**
223
+ * Optional per-item mapper: engine applies it before validating against the node’s `inputSchema`.
224
+ * When omitted, the engine validates `item.json` directly.
225
+ */
226
+ readonly mapInput?: ItemInputMapper<TWireJson$1, TInputJson$1>;
176
227
  }
177
228
  type PairedItemRef = Readonly<{
178
229
  nodeId: NodeId;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codemation/node-example",
3
- "version": "0.0.21",
3
+ "version": "0.0.24",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -28,7 +28,7 @@
28
28
  }
29
29
  },
30
30
  "dependencies": {
31
- "@codemation/core": "0.2.0"
31
+ "@codemation/core": "0.2.3"
32
32
  },
33
33
  "devDependencies": {
34
34
  "@types/node": "^25.3.5",