@bonsae/nrg 0.21.0 → 0.21.2

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.
@@ -1253,7 +1253,7 @@ const P = /* @__PURE__ */ E(Ne, [["render", Ce], ["__scopeId", "data-v-724dcae4"
1253
1253
  "validateInput",
1254
1254
  "validateOutputs",
1255
1255
  "outputs",
1256
- "contextModes",
1256
+ "outputContextModes",
1257
1257
  "outputReturnProperties",
1258
1258
  ...ue
1259
1259
  ]);
@@ -1397,7 +1397,6 @@ function localesGenerator(options) {
1397
1397
  },
1398
1398
  contextModes: {
1399
1399
  modes: {
1400
- default: "Default",
1401
1400
  carry: "carry",
1402
1401
  trace: "trace",
1403
1402
  reset: "reset"
@@ -1433,7 +1432,6 @@ function localesGenerator(options) {
1433
1432
  },
1434
1433
  contextModes: {
1435
1434
  modes: {
1436
- default: "Standard",
1437
1435
  carry: "carry",
1438
1436
  trace: "trace",
1439
1437
  reset: "reset"
@@ -1469,7 +1467,6 @@ function localesGenerator(options) {
1469
1467
  },
1470
1468
  contextModes: {
1471
1469
  modes: {
1472
- default: "Predeterminado",
1473
1470
  carry: "carry",
1474
1471
  trace: "trace",
1475
1472
  reset: "reset"
@@ -1505,7 +1502,6 @@ function localesGenerator(options) {
1505
1502
  },
1506
1503
  contextModes: {
1507
1504
  modes: {
1508
- default: "Par d\xE9faut",
1509
1505
  carry: "carry",
1510
1506
  trace: "trace",
1511
1507
  reset: "reset"
@@ -1541,7 +1537,6 @@ function localesGenerator(options) {
1541
1537
  },
1542
1538
  contextModes: {
1543
1539
  modes: {
1544
- default: "\uAE30\uBCF8\uAC12",
1545
1540
  carry: "carry",
1546
1541
  trace: "trace",
1547
1542
  reset: "reset"
@@ -1577,7 +1572,6 @@ function localesGenerator(options) {
1577
1572
  },
1578
1573
  contextModes: {
1579
1574
  modes: {
1580
- default: "Padr\xE3o",
1581
1575
  carry: "carry",
1582
1576
  trace: "trace",
1583
1577
  reset: "reset"
@@ -1613,7 +1607,6 @@ function localesGenerator(options) {
1613
1607
  },
1614
1608
  contextModes: {
1615
1609
  modes: {
1616
- default: "\u041F\u043E \u0443\u043C\u043E\u043B\u0447\u0430\u043D\u0438\u044E",
1617
1610
  carry: "carry",
1618
1611
  trace: "trace",
1619
1612
  reset: "reset"
@@ -1649,7 +1642,6 @@ function localesGenerator(options) {
1649
1642
  },
1650
1643
  contextModes: {
1651
1644
  modes: {
1652
- default: "\u30C7\u30D5\u30A9\u30EB\u30C8",
1653
1645
  carry: "carry",
1654
1646
  trace: "trace",
1655
1647
  reset: "reset"
@@ -1685,7 +1677,6 @@ function localesGenerator(options) {
1685
1677
  },
1686
1678
  contextModes: {
1687
1679
  modes: {
1688
- default: "\u9ED8\u8BA4",
1689
1680
  carry: "carry",
1690
1681
  trace: "trace",
1691
1682
  reset: "reset"
@@ -1721,7 +1712,6 @@ function localesGenerator(options) {
1721
1712
  },
1722
1713
  contextModes: {
1723
1714
  modes: {
1724
- default: "\u9810\u8A2D",
1725
1715
  carry: "carry",
1726
1716
  trace: "trace",
1727
1717
  reset: "reset"
@@ -1939,7 +1929,6 @@ function nodeDefinitionsInliner(serverOutDir, entryPath, iconsDir, componentsDir
1939
1929
  }
1940
1930
  if (defaults && outputsSchema) {
1941
1931
  defaults.validateOutputs = { required: false, value: {} };
1942
- defaults.contextModes = { required: false, value: {} };
1943
1932
  }
1944
1933
  const credentials = getCredentialsFromSchema(credentialsSchema);
1945
1934
  _definitions[type] = {
@@ -1955,6 +1944,9 @@ function nodeDefinitionsInliner(serverOutDir, entryPath, iconsDir, componentsDir
1955
1944
  icon: iconsDir ? resolveIcon(iconsDir, type) : void 0,
1956
1945
  inputs: NodeClass.inputs,
1957
1946
  outputs: NodeClass.outputs,
1947
+ // Resolved server-side (Kind symbol intact) so the editor labels
1948
+ // named output ports without guessing from the serialized schema.
1949
+ outputPortNames: NodeClass.outputPortNames ?? void 0,
1958
1950
  inputSchema,
1959
1951
  outputsSchema
1960
1952
  };
package/types/client.d.ts CHANGED
@@ -101,13 +101,14 @@ export interface NodeRedNode {
101
101
  completePort?: boolean;
102
102
  statusPort?: boolean;
103
103
  /**
104
- * Per-port output settings, indexed by base-output port; injected (empty) when
105
- * the node has an outputsSchema. Read at runtime by IONode.
106
- * `outputReturnProperties` is author-declared (SchemaType.OutputReturnProperties)
107
- * — present only when the node opts into per-port return keys.
104
+ * Per-port output settings, indexed by base-output port. `validateOutputs` is
105
+ * injected (empty) when the node has an outputsSchema; `outputReturnProperties`
106
+ * and `outputContextModes` are author-declared (SchemaType.*) — present only
107
+ * when the node opts into per-port return keys / context modes. Read at
108
+ * runtime by IONode.
108
109
  */
109
110
  validateOutputs?: Record<number, boolean>;
110
- contextModes?: Record<number, "carry" | "trace" | "reset">;
111
+ outputContextModes?: Record<number, "carry" | "trace" | "reset">;
111
112
  outputReturnProperties?: Record<number, string>;
112
113
  [key: string]: any;
113
114
  }
@@ -173,6 +174,13 @@ export interface JsonSchemaObject extends SchemaObject {
173
174
  export interface RuntimeNodeDefinition extends NodeDefinition {
174
175
  defaults?: NodeDefaults;
175
176
  credentials?: NodeCredentials;
177
+ /**
178
+ * Names of the base output ports when `outputsSchema` is a record of named
179
+ * ports, in declaration order; absent for single/positional outputs. Resolved
180
+ * server-side by the inliner so the editor never guesses port names from the
181
+ * serialized schema.
182
+ */
183
+ outputPortNames?: string[];
176
184
  configSchema?: JsonSchemaObject;
177
185
  credentialsSchema?: JsonSchemaObject;
178
186
  inputSchema?: JsonSchemaObject;
package/types/server.d.ts CHANGED
@@ -494,15 +494,23 @@ declare function TypedInput$1<T = unknown>(options?: NrgSchemaOptions): TTypedIn
494
494
  declare function OutputReturnProperties(options?: NrgSchemaOptions & {
495
495
  default?: Record<number, string>;
496
496
  }): import("@sinclair/typebox").TRecord<import("@sinclair/typebox").TNumber, import("@sinclair/typebox").TString>;
497
+ declare function OutputContextModes(options?: NrgSchemaOptions & {
498
+ default?: Record<number, "carry" | "trace" | "reset">;
499
+ }): import("@sinclair/typebox").TRecord<import("@sinclair/typebox").TNumber, import("@sinclair/typebox").TUnion<[
500
+ import("@sinclair/typebox").TLiteral<"carry">,
501
+ import("@sinclair/typebox").TLiteral<"trace">,
502
+ import("@sinclair/typebox").TLiteral<"reset">
503
+ ]>>;
497
504
  /**
498
505
  * Extended TypeBox type builder with NRG-specific schema types.
499
- * Includes all standard TypeBox types plus {@link NodeRef}, {@link TypedInput}
500
- * and {@link OutputReturnProperties}.
506
+ * Includes all standard TypeBox types plus {@link NodeRef}, {@link TypedInput},
507
+ * {@link OutputReturnProperties} and {@link OutputContextModes}.
501
508
  */
502
509
  export declare const SchemaType: import("@sinclair/typebox").JavaScriptTypeBuilder & {
503
510
  NodeRef: typeof NodeRef;
504
511
  TypedInput: typeof TypedInput$1;
505
512
  OutputReturnProperties: typeof OutputReturnProperties;
513
+ OutputContextModes: typeof OutputContextModes;
506
514
  };
507
515
  /**
508
516
  * Creates a validated object schema from a set of properties. Automatically
@@ -614,14 +622,6 @@ declare abstract class Node$1<TConfig = any, TCredentials = any, TSettings = any
614
622
  get credentials(): NodeCredentials<TCredentials> | undefined;
615
623
  get settings(): TSettings;
616
624
  }
617
- type SendOptions = {
618
- /**
619
- * Node-author default for how the outgoing message carries the incoming
620
- * context. The flow author's per-port override (when set) wins; otherwise
621
- * this is used, falling back to `"carry"` when omitted.
622
- */
623
- defaultMode?: ContextMode;
624
- };
625
625
  /**
626
626
  * Controls how an outgoing message carries the incoming message's context:
627
627
  * - `"carry"` (default): keep all incoming keys — including any upstream
@@ -643,14 +643,15 @@ export type ContextMode = "carry" | "trace" | "reset";
643
643
  * Every node has a return key (`"output"` by default): the value passed to
644
644
  * `send()` is merged into the incoming message at that key
645
645
  * (`{ ...msg, [returnKey]: result }`), so upstream properties propagate. By
646
- * default the context is carried without growing; pass
647
- * `{ defaultMode: "trace" }` to also keep the full prior message under `input`
648
- * as a recoverable provenance chain. The return key, output validation, and
649
- * context mode all resolve per output port; declaring
650
- * `outputReturnProperties` in the `configSchema` sets per-port default keys and
651
- * lets the flow author pick a key other than `output` per port — it does not
652
- * change that a return key always exists. `this.send(x)` always means "x is the result", never "x is the
653
- * whole message".
646
+ * default the context is carried without growing; declaring
647
+ * `outputContextModes` in the `configSchema` lets the flow author pick `trace`
648
+ * (keep the full prior message under `input` as a recoverable provenance chain)
649
+ * or `reset` per port. The return key, output validation, and context mode all
650
+ * resolve per output port; declaring `outputReturnProperties` in the
651
+ * `configSchema` sets per-port default keys and lets the flow author pick a key
652
+ * other than `output` per port it does not change that a return key always
653
+ * exists. `this.send(x)` always means "x is the result", never "x is the whole
654
+ * message".
654
655
  *
655
656
  * @example
656
657
  * ```ts
@@ -676,12 +677,20 @@ export declare abstract class IONode<TConfig = any, TCredentials = any, TInput =
676
677
  static readonly validateOutput: boolean;
677
678
  static get inputs(): 0 | 1;
678
679
  static get outputs(): number;
680
+ /**
681
+ * The names of the base output ports when `outputsSchema` is a record of
682
+ * named ports (`{ success, failure }`), in declaration order — otherwise
683
+ * `undefined` (a single schema or a positional array). Resolved here, where
684
+ * TypeBox's `Kind` symbol is intact, so the editor reads the names directly
685
+ * instead of guessing them from a serialized (symbol-stripped) schema.
686
+ */
687
+ static get outputPortNames(): string[] | undefined;
679
688
  readonly config: IONodeConfig<TConfig>;
680
689
  protected readonly context: IONodeContext;
681
690
  constructor(RED: RED, node: NodeRedNode, config: IONodeConfig<TConfig>, credentials: IONodeCredentials<TCredentials>);
682
691
  [WIRE_HANDLERS](nodeRedNode: NodeRedNode, createdPromise: Promise<void>): void;
683
692
  input(msg: TInput): void | Promise<void>;
684
- send(msg: TOutput, options?: SendOptions): void;
693
+ send(msg: TOutput): void;
685
694
  get baseOutputs(): number;
686
695
  get totalOutputs(): number;
687
696
  /**
@@ -694,7 +703,7 @@ export declare abstract class IONode<TConfig = any, TCredentials = any, TInput =
694
703
  * throw an error or call `this.error()` for the error port, and the complete
695
704
  * port is sent automatically on successful input processing.
696
705
  */
697
- sendToPort<P extends (TOutput extends Record<string, Record<string, any>> ? keyof TOutput & string : never) | number>(port: P, msg: P extends keyof TOutput ? TOutput[P] : unknown, options?: SendOptions): void;
706
+ sendToPort<P extends (TOutput extends Record<string, Record<string, any>> ? keyof TOutput & string : never) | number>(port: P, msg: P extends keyof TOutput ? TOutput[P] : unknown): void;
698
707
  status(status: IONodeStatus): void;
699
708
  error(message: string, msg?: any): void;
700
709
  updateWires(wires: string[][]): void;
@@ -713,7 +722,7 @@ type IONodeConfig<TConfig = any> = NodeConfig<TConfig> & Static<typeof IONodeCon
713
722
  /** Per-port return properties, keyed by base-output port index. */
714
723
  outputReturnProperties?: Record<number, string>;
715
724
  /** Per-port context modes, keyed by base-output port index. */
716
- contextModes?: Record<number, "carry" | "trace" | "reset">;
725
+ outputContextModes?: Record<number, "carry" | "trace" | "reset">;
717
726
  };
718
727
  type IONodeCredentials<TCredentials = any> = NodeCredentials<TCredentials>;
719
728
  type IONodeStatus = {
@@ -73,13 +73,14 @@ export interface NodeRedNode {
73
73
  completePort?: boolean;
74
74
  statusPort?: boolean;
75
75
  /**
76
- * Per-port output settings, indexed by base-output port; injected (empty) when
77
- * the node has an outputsSchema. Read at runtime by IONode.
78
- * `outputReturnProperties` is author-declared (SchemaType.OutputReturnProperties)
79
- * — present only when the node opts into per-port return keys.
76
+ * Per-port output settings, indexed by base-output port. `validateOutputs` is
77
+ * injected (empty) when the node has an outputsSchema; `outputReturnProperties`
78
+ * and `outputContextModes` are author-declared (SchemaType.*) — present only
79
+ * when the node opts into per-port return keys / context modes. Read at
80
+ * runtime by IONode.
80
81
  */
81
82
  validateOutputs?: Record<number, boolean>;
82
- contextModes?: Record<number, "carry" | "trace" | "reset">;
83
+ outputContextModes?: Record<number, "carry" | "trace" | "reset">;
83
84
  outputReturnProperties?: Record<number, string>;
84
85
  [key: string]: any;
85
86
  }
@@ -145,6 +146,13 @@ export interface JsonSchemaObject extends SchemaObject {
145
146
  export interface RuntimeNodeDefinition extends NodeDefinition {
146
147
  defaults?: NodeDefaults;
147
148
  credentials?: NodeCredentials;
149
+ /**
150
+ * Names of the base output ports when `outputsSchema` is a record of named
151
+ * ports, in declaration order; absent for single/positional outputs. Resolved
152
+ * server-side by the inliner so the editor never guesses port names from the
153
+ * serialized schema.
154
+ */
155
+ outputPortNames?: string[];
148
156
  configSchema?: JsonSchemaObject;
149
157
  credentialsSchema?: JsonSchemaObject;
150
158
  inputSchema?: JsonSchemaObject;
@@ -85,13 +85,14 @@ interface NodeRedNode {
85
85
  completePort?: boolean;
86
86
  statusPort?: boolean;
87
87
  /**
88
- * Per-port output settings, indexed by base-output port; injected (empty) when
89
- * the node has an outputsSchema. Read at runtime by IONode.
90
- * `outputReturnProperties` is author-declared (SchemaType.OutputReturnProperties)
91
- * — present only when the node opts into per-port return keys.
88
+ * Per-port output settings, indexed by base-output port. `validateOutputs` is
89
+ * injected (empty) when the node has an outputsSchema; `outputReturnProperties`
90
+ * and `outputContextModes` are author-declared (SchemaType.*) — present only
91
+ * when the node opts into per-port return keys / context modes. Read at
92
+ * runtime by IONode.
92
93
  */
93
94
  validateOutputs?: Record<number, boolean>;
94
- contextModes?: Record<number, "carry" | "trace" | "reset">;
95
+ outputContextModes?: Record<number, "carry" | "trace" | "reset">;
95
96
  outputReturnProperties?: Record<number, string>;
96
97
  [key: string]: any;
97
98
  }
@@ -160,13 +160,14 @@ interface NodeRedNode {
160
160
  completePort?: boolean;
161
161
  statusPort?: boolean;
162
162
  /**
163
- * Per-port output settings, indexed by base-output port; injected (empty) when
164
- * the node has an outputsSchema. Read at runtime by IONode.
165
- * `outputReturnProperties` is author-declared (SchemaType.OutputReturnProperties)
166
- * — present only when the node opts into per-port return keys.
163
+ * Per-port output settings, indexed by base-output port. `validateOutputs` is
164
+ * injected (empty) when the node has an outputsSchema; `outputReturnProperties`
165
+ * and `outputContextModes` are author-declared (SchemaType.*) — present only
166
+ * when the node opts into per-port return keys / context modes. Read at
167
+ * runtime by IONode.
167
168
  */
168
169
  validateOutputs?: Record<number, boolean>;
169
- contextModes?: Record<number, "carry" | "trace" | "reset">;
170
+ outputContextModes?: Record<number, "carry" | "trace" | "reset">;
170
171
  outputReturnProperties?: Record<number, string>;
171
172
  [key: string]: any;
172
173
  }
package/vite/index.js CHANGED
@@ -2060,7 +2060,6 @@ function localesGenerator(options) {
2060
2060
  },
2061
2061
  contextModes: {
2062
2062
  modes: {
2063
- default: "Default",
2064
2063
  carry: "carry",
2065
2064
  trace: "trace",
2066
2065
  reset: "reset"
@@ -2096,7 +2095,6 @@ function localesGenerator(options) {
2096
2095
  },
2097
2096
  contextModes: {
2098
2097
  modes: {
2099
- default: "Standard",
2100
2098
  carry: "carry",
2101
2099
  trace: "trace",
2102
2100
  reset: "reset"
@@ -2132,7 +2130,6 @@ function localesGenerator(options) {
2132
2130
  },
2133
2131
  contextModes: {
2134
2132
  modes: {
2135
- default: "Predeterminado",
2136
2133
  carry: "carry",
2137
2134
  trace: "trace",
2138
2135
  reset: "reset"
@@ -2168,7 +2165,6 @@ function localesGenerator(options) {
2168
2165
  },
2169
2166
  contextModes: {
2170
2167
  modes: {
2171
- default: "Par d\xE9faut",
2172
2168
  carry: "carry",
2173
2169
  trace: "trace",
2174
2170
  reset: "reset"
@@ -2204,7 +2200,6 @@ function localesGenerator(options) {
2204
2200
  },
2205
2201
  contextModes: {
2206
2202
  modes: {
2207
- default: "\uAE30\uBCF8\uAC12",
2208
2203
  carry: "carry",
2209
2204
  trace: "trace",
2210
2205
  reset: "reset"
@@ -2240,7 +2235,6 @@ function localesGenerator(options) {
2240
2235
  },
2241
2236
  contextModes: {
2242
2237
  modes: {
2243
- default: "Padr\xE3o",
2244
2238
  carry: "carry",
2245
2239
  trace: "trace",
2246
2240
  reset: "reset"
@@ -2276,7 +2270,6 @@ function localesGenerator(options) {
2276
2270
  },
2277
2271
  contextModes: {
2278
2272
  modes: {
2279
- default: "\u041F\u043E \u0443\u043C\u043E\u043B\u0447\u0430\u043D\u0438\u044E",
2280
2273
  carry: "carry",
2281
2274
  trace: "trace",
2282
2275
  reset: "reset"
@@ -2312,7 +2305,6 @@ function localesGenerator(options) {
2312
2305
  },
2313
2306
  contextModes: {
2314
2307
  modes: {
2315
- default: "\u30C7\u30D5\u30A9\u30EB\u30C8",
2316
2308
  carry: "carry",
2317
2309
  trace: "trace",
2318
2310
  reset: "reset"
@@ -2348,7 +2340,6 @@ function localesGenerator(options) {
2348
2340
  },
2349
2341
  contextModes: {
2350
2342
  modes: {
2351
- default: "\u9ED8\u8BA4",
2352
2343
  carry: "carry",
2353
2344
  trace: "trace",
2354
2345
  reset: "reset"
@@ -2384,7 +2375,6 @@ function localesGenerator(options) {
2384
2375
  },
2385
2376
  contextModes: {
2386
2377
  modes: {
2387
- default: "\u9810\u8A2D",
2388
2378
  carry: "carry",
2389
2379
  trace: "trace",
2390
2380
  reset: "reset"
@@ -2602,7 +2592,6 @@ function nodeDefinitionsInliner(serverOutDir, entryPath, iconsDir, componentsDir
2602
2592
  }
2603
2593
  if (defaults && outputsSchema) {
2604
2594
  defaults.validateOutputs = { required: false, value: {} };
2605
- defaults.contextModes = { required: false, value: {} };
2606
2595
  }
2607
2596
  const credentials = getCredentialsFromSchema(credentialsSchema);
2608
2597
  _definitions[type] = {
@@ -2618,6 +2607,9 @@ function nodeDefinitionsInliner(serverOutDir, entryPath, iconsDir, componentsDir
2618
2607
  icon: iconsDir ? resolveIcon(iconsDir, type) : void 0,
2619
2608
  inputs: NodeClass.inputs,
2620
2609
  outputs: NodeClass.outputs,
2610
+ // Resolved server-side (Kind symbol intact) so the editor labels
2611
+ // named output ports without guessing from the serialized schema.
2612
+ outputPortNames: NodeClass.outputPortNames ?? void 0,
2621
2613
  inputSchema,
2622
2614
  outputsSchema
2623
2615
  };