@nodaro/shared 3.23.0 → 3.24.0

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nodaro/shared",
3
- "version": "3.23.0",
3
+ "version": "3.24.0",
4
4
  "description": "Shared types, model catalog, wire contracts, and structural vocabularies for the Nodaro platform and SDK.",
5
5
  "type": "module",
6
6
  "license": "Apache-2.0",
@@ -210,6 +210,26 @@ export function clampChars(text: string, max: number): string {
210
210
  return points.length <= max ? text : points.slice(0, max).join("")
211
211
  }
212
212
 
213
+ /**
214
+ * A Save to Collection field held to the record route's limit — the ONE rule
215
+ * both engines apply to a field whose `{Node}` references resolved to more
216
+ * than was typed: a title, text or duplicate key is cut to whole characters
217
+ * (as the store cuts an item's), and a link over the limit is not sent at all
218
+ * (a cut link is a wrong link; the item's own link then wins).
219
+ */
220
+ export function fitCollectionField(key: "title" | "text" | "link" | "dedupeKey", value: string): string | undefined {
221
+ switch (key) {
222
+ case "title":
223
+ return clampChars(value, COLLECTION_RECORD_TITLE_MAX)
224
+ case "text":
225
+ return clampChars(value, COLLECTION_RECORD_TEXT_MAX)
226
+ case "dedupeKey":
227
+ return clampChars(value, COLLECTION_DEDUPE_KEY_MAX)
228
+ case "link":
229
+ return value.length <= COLLECTION_RECORD_URL_MAX ? value : undefined
230
+ }
231
+ }
232
+
213
233
  /**
214
234
  * The key a collection deduplicates on: trimmed, inner whitespace collapsed,
215
235
  * lower-cased, at most 300 characters; null when there is nothing to key on.
@@ -16,10 +16,13 @@
16
16
  * in the frontend fails when an alias points at a handle the node no longer
17
17
  * declares, or when a "legacy" spelling is still a declared handle.
18
18
  *
19
- * NOTE: five ffmpeg-overlapping nodes (merge-video-audio, trim-audio,
20
- * mix-audio, combine-audio, adjust-volume) are deliberately absent — their
21
- * ids shipped through a different migration with the single `in` retained,
22
- * and a second rewrite would silently double-apply.
19
+ * NOTE: the ffmpeg-overlapping nodes (merge-video-audio, mix-audio,
20
+ * combine-audio, adjust-volume, trim-video, …) keep their live `in` target and
21
+ * their `video-out` / `audio-out` pips from the #2809 migration (trim-audio
22
+ * keeps its `in` and renders `audio`): never alias those AWAY, or a second
23
+ * rewrite would move a live edge onto a pip the node does not render. The
24
+ * entries below go the other way (#1877): the id their definitions used to
25
+ * declare (`video` / `audio`) onto the pip that draws.
23
26
  */
24
27
  import { AUDIO_PRODUCER_TYPES, VIDEO_PRODUCER_TYPES } from "./producer-types.js"
25
28
 
@@ -67,6 +70,21 @@ export const LEGACY_SOURCE_HANDLE_ALIASES: Readonly<Record<string, Readonly<Reco
67
70
  // Telegram Trigger: the docs once named six outputs; the component renders
68
71
  // one, `out`, and media rides it by kind on both engines.
69
72
  "telegram-trigger": { text: "out", imageUrl: "out", videoUrl: "out", audioUrl: "out" },
73
+ // #1877 — the definitions now declare the pips these components render. The
74
+ // id they used to declare (what MCP clients and the docs were told) moves
75
+ // onto the pip that draws, so an edge written with it still connects.
76
+ "add-captions": { video: "video-out" },
77
+ "adjust-volume": { audio: "audio-out" },
78
+ "audio-fx": { audio: "audio-out" },
79
+ "combine-audio": { audio: "audio-out" },
80
+ "loop-video": { video: "video-out" },
81
+ "merge-video-audio": { video: "video-out" },
82
+ "mix-audio": { audio: "audio-out" },
83
+ "resize-video": { video: "video-out" },
84
+ "trim-video": { video: "video-out" },
85
+ "save-to-storage": { asset: "out" },
86
+ // (audio-separation's old `audio` is NOT aliased: it could mean any of the
87
+ // seven stems, and a stem is never guessed.)
70
88
  }
71
89
 
72
90
  /** Legacy TARGET handle id → canonical id, per node type. */
@@ -248,29 +266,14 @@ export function classifyLegacyTargetHandle(
248
266
  * node's real outputs: an edge on one draws; an edge on the declared-only id
249
267
  * does not, so the write-time pass moves it onto the one pip that draws. An
250
268
  * entry leaves this table the day its definition is fixed.
269
+ *
270
+ * EMPTY since #1877 was burned down: every definition declares the pips its
271
+ * component renders, and the ids they used to declare are source aliases
272
+ * above. The table and `renderedSourceHandle` stay so a drift that is found
273
+ * later can be recorded here instead of shipping an invisible edge; the guard
274
+ * test fails until it is.
251
275
  */
252
- export const RENDERED_OUTPUT_HANDLES: Readonly<Record<string, readonly string[]>> = {
253
- // The ffmpeg family shipped `video-out` / `audio-out` pips through a
254
- // different migration (single `in` retained) and was left out of the alias
255
- // pass on purpose.
256
- "add-captions": ["video-out"],
257
- "adjust-volume": ["audio-out", "video-out"],
258
- "audio-fx": ["audio-out"],
259
- "combine-audio": ["audio-out"],
260
- "loop-video": ["video-out"],
261
- "merge-video-audio": ["video-out"],
262
- "mix-audio": ["audio-out"],
263
- "resize-video": ["video-out"],
264
- "trim-video": ["video-out"],
265
- // Output nodes: a pass-through `out` pip the definition does not declare.
266
- "save-to-storage": ["out"],
267
- "sub-workflow-output": ["out"],
268
- "webhook-output": ["out"],
269
- // Stem separator: one declared `audio` output, a pip per stem rendered.
270
- "audio-separation": ["bass", "drums", "guitar", "instrumental", "other", "piano", "vocals"],
271
- // Dual-mode revoice: the video pip is rendered but undeclared.
272
- "voice-changer": ["audio", "video"],
273
- }
276
+ export const RENDERED_OUTPUT_HANDLES: Readonly<Record<string, readonly string[]>> = {}
274
277
 
275
278
  /**
276
279
  * The pip that draws for a source handle a node DECLARES but does not render
package/src/index.ts CHANGED
@@ -1020,6 +1020,7 @@ export {
1020
1020
  collectionReadSince,
1021
1021
  collectionCapsForTier,
1022
1022
  clampChars,
1023
+ fitCollectionField,
1023
1024
  normalizeDedupeKey,
1024
1025
  isCollectionUrl,
1025
1026
  isCollectionMedia,