@nodaro/shared 3.11.0 → 3.12.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.
Files changed (52) hide show
  1. package/dist/index.cjs +2047 -84
  2. package/dist/index.cjs.map +1 -1
  3. package/dist/index.d.cts +1556 -27
  4. package/dist/index.d.ts +1556 -27
  5. package/dist/index.js +1861 -85
  6. package/dist/index.js.map +1 -1
  7. package/package.json +1 -1
  8. package/src/__tests__/caption-styles.test.ts +207 -0
  9. package/src/__tests__/edl-multicam.test.ts +304 -0
  10. package/src/__tests__/edl.test.ts +822 -0
  11. package/src/__tests__/fan-out-rows.test.ts +208 -0
  12. package/src/__tests__/instagram-scrape.test.ts +66 -0
  13. package/src/__tests__/llm-models.test.ts +48 -11
  14. package/src/__tests__/meta-ads-scrape.test.ts +284 -0
  15. package/src/__tests__/node-runtime-keys.test.ts +15 -0
  16. package/src/__tests__/presentation-utils.test.ts +67 -0
  17. package/src/__tests__/producer-types.test.ts +19 -0
  18. package/src/__tests__/schedule-rules.test.ts +265 -0
  19. package/src/__tests__/speaker-layouts.test.ts +203 -0
  20. package/src/__tests__/transcribe-capabilities.test.ts +104 -0
  21. package/src/__tests__/transcribe-preflight.test.ts +60 -0
  22. package/src/__tests__/trigger-feeds.test.ts +39 -0
  23. package/src/__tests__/video-duration-auto.test.ts +65 -0
  24. package/src/__tests__/video-duration.test.ts +56 -0
  25. package/src/__tests__/video-link.test.ts +137 -0
  26. package/src/__tests__/workflow-export-strip.test.ts +59 -1
  27. package/src/caption-styles.ts +240 -0
  28. package/src/credit-identifiers.ts +31 -0
  29. package/src/edit-plan-contract.ts +96 -0
  30. package/src/edl-multicam.ts +185 -0
  31. package/src/edl.ts +747 -0
  32. package/src/entity-image-handle.ts +24 -1
  33. package/src/fan-out-rows.ts +213 -0
  34. package/src/index.ts +206 -3
  35. package/src/instagram-scrape.ts +204 -0
  36. package/src/llm-models.ts +80 -3
  37. package/src/meta-ads-scrape.ts +463 -0
  38. package/src/model-catalog.ts +48 -5
  39. package/src/model-constants.ts +148 -5
  40. package/src/node-mappable-fields.ts +2 -0
  41. package/src/node-runtime-keys.ts +28 -0
  42. package/src/presentation-utils.ts +49 -0
  43. package/src/producer-types.ts +20 -0
  44. package/src/schedule-rules.ts +484 -0
  45. package/src/speaker-layouts.ts +220 -0
  46. package/src/transcribe-preflight.ts +101 -0
  47. package/src/trigger-feeds.ts +59 -0
  48. package/src/trigger-node-types.ts +20 -0
  49. package/src/video-duration-auto.ts +18 -0
  50. package/src/video-duration.ts +32 -0
  51. package/src/video-link.ts +167 -0
  52. package/src/workflow-export.ts +37 -1
@@ -1,5 +1,6 @@
1
1
  import type { GenericNode, GenericEdge } from "./types.js"
2
2
  import { EXECUTION_DATA_KEYS } from "./node-runtime-keys.js"
3
+ import { SOCIAL_POST_NODE_TYPES } from "./social-post.js"
3
4
 
4
5
  /** A named media variant (expression, pose, angle, etc.) produced during entity generation. */
5
6
  interface AssetVariant {
@@ -192,6 +193,10 @@ const GENERATED_FIELDS: readonly string[] = [
192
193
 
193
194
  /** Per-node-type extra generated fields beyond GENERATED_FIELDS. Unknown types get no extras ([] default). */
194
195
  const NODE_EXTRA_FIELDS: Record<string, string[]> = {
196
+ // A template must never import ARMED: the switch is the importer's to flip
197
+ // (a schedule starts paused), and the rules themselves are config that
198
+ // travels.
199
+ "schedule-trigger": ["active"],
195
200
  character: ["expressions", "poses", "lightingVariations", "angles", "customVariations"],
196
201
  object: ["angles", "materials", "variations", "customVariations"],
197
202
  creature: ["angles", "poses", "variations", "customVariations"],
@@ -216,9 +221,40 @@ const NODE_EXTRA_FIELDS: Record<string, string[]> = {
216
221
  "sub-workflow": ["referencedWorkflowId"],
217
222
  }
218
223
 
224
+ /**
225
+ * Node fields that point at a row the IMPORTER does not own — a stored HTTP
226
+ * credential behind a Webhook Output, a connected social account behind a
227
+ * publisher. The id alone is useless without owning the row (resolution is
228
+ * owner-scoped), so nothing leaks either way; the point is that the imported
229
+ * node lands UNBOUND and the importer picks their own, instead of carrying a
230
+ * dangling pointer at the exporter's account. Applied by every export shape,
231
+ * including the asset bundle that otherwise keeps node data verbatim.
232
+ */
233
+ const UNOWNED_REF_FIELDS: Record<string, readonly string[]> = {
234
+ "webhook-output": ["credentialId"],
235
+ ...Object.fromEntries([...SOCIAL_POST_NODE_TYPES].map((type) => [type, ["connectionId"]])),
236
+ }
237
+
238
+ /** Clear owner-bound references (credential / connection ids). Returns new node objects; inputs are not mutated. */
239
+ export function stripUnownedRefs(nodes: GenericNode[]): GenericNode[] {
240
+ return nodes.map((node) => {
241
+ const fields = UNOWNED_REF_FIELDS[node.type]
242
+ if (!fields || !node.data) return node
243
+ const data = { ...(node.data as Record<string, unknown>) }
244
+ let changed = false
245
+ for (const field of fields) {
246
+ if (field in data) {
247
+ delete data[field]
248
+ changed = true
249
+ }
250
+ }
251
+ return changed ? { ...node, data } : node
252
+ })
253
+ }
254
+
219
255
  /** Strip generated/transient content from nodes for template export. Returns new node objects; inputs are not mutated. */
220
256
  export function stripExportContent(nodes: GenericNode[]): GenericNode[] {
221
- return nodes.map((node) => {
257
+ return stripUnownedRefs(nodes).map((node) => {
222
258
  const data = { ...(node.data as Record<string, unknown>) }
223
259
  for (const field of GENERATED_FIELDS) delete data[field]
224
260
  const extras = NODE_EXTRA_FIELDS[node.type] ?? []