ugcinc 4.0.2 → 4.1.1

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 (161) hide show
  1. package/dist/accounts.d.ts +146 -1
  2. package/dist/automations/index.d.ts +174 -0
  3. package/dist/automations/index.js +194 -0
  4. package/dist/automations/nodes/account.d.ts +6 -0
  5. package/dist/automations/nodes/account.js +28 -0
  6. package/dist/automations/nodes/auto-caption.d.ts +23 -0
  7. package/dist/automations/nodes/auto-caption.js +49 -0
  8. package/dist/automations/nodes/auto-post.d.ts +22 -0
  9. package/dist/automations/nodes/auto-post.js +52 -0
  10. package/dist/automations/nodes/branch.d.ts +21 -0
  11. package/dist/automations/nodes/branch.js +46 -0
  12. package/dist/automations/nodes/collect.d.ts +7 -0
  13. package/dist/automations/nodes/collect.js +51 -0
  14. package/dist/automations/nodes/compose-workflow.d.ts +8 -0
  15. package/dist/automations/nodes/compose-workflow.js +61 -0
  16. package/dist/automations/nodes/create-dm.d.ts +35 -0
  17. package/dist/automations/nodes/create-dm.js +86 -0
  18. package/dist/automations/nodes/custom-model.d.ts +18 -0
  19. package/dist/automations/nodes/custom-model.js +52 -0
  20. package/dist/automations/nodes/deduplicate.d.ts +7 -0
  21. package/dist/automations/nodes/deduplicate.js +36 -0
  22. package/dist/automations/nodes/destructure.d.ts +25 -0
  23. package/dist/automations/nodes/destructure.js +65 -0
  24. package/dist/automations/nodes/for-each.d.ts +22 -0
  25. package/dist/automations/nodes/for-each.js +84 -0
  26. package/dist/automations/nodes/generate-image.d.ts +15 -0
  27. package/dist/automations/nodes/generate-image.js +45 -0
  28. package/dist/automations/nodes/generate-video.d.ts +15 -0
  29. package/dist/automations/nodes/generate-video.js +45 -0
  30. package/dist/automations/nodes/if.d.ts +21 -0
  31. package/dist/automations/nodes/if.js +44 -0
  32. package/dist/automations/nodes/image-composer.d.ts +46 -0
  33. package/dist/automations/nodes/image-composer.js +135 -0
  34. package/dist/automations/nodes/index.d.ts +312 -0
  35. package/dist/automations/nodes/index.js +92 -0
  36. package/dist/automations/nodes/internal.d.ts +8 -0
  37. package/dist/automations/nodes/internal.js +10 -0
  38. package/dist/automations/nodes/llm.d.ts +26 -0
  39. package/dist/automations/nodes/llm.js +85 -0
  40. package/dist/automations/nodes/manual-trigger.d.ts +14 -0
  41. package/dist/automations/nodes/manual-trigger.js +32 -0
  42. package/dist/automations/nodes/media.d.ts +13 -0
  43. package/dist/automations/nodes/media.js +40 -0
  44. package/dist/automations/nodes/not.d.ts +5 -0
  45. package/dist/automations/nodes/not.js +35 -0
  46. package/dist/automations/nodes/output.d.ts +16 -0
  47. package/dist/automations/nodes/output.js +32 -0
  48. package/dist/automations/nodes/random-route.d.ts +24 -0
  49. package/dist/automations/nodes/random-route.js +53 -0
  50. package/dist/automations/nodes/random.d.ts +16 -0
  51. package/dist/automations/nodes/random.js +50 -0
  52. package/dist/automations/nodes/recurrence.d.ts +29 -0
  53. package/dist/automations/nodes/recurrence.js +50 -0
  54. package/dist/automations/nodes/save-to-media.d.ts +15 -0
  55. package/dist/automations/nodes/save-to-media.js +31 -0
  56. package/dist/automations/nodes/screenshot-animation.d.ts +6 -0
  57. package/dist/automations/nodes/screenshot-animation.js +36 -0
  58. package/dist/automations/nodes/social-audio.d.ts +7 -0
  59. package/dist/automations/nodes/social-audio.js +30 -0
  60. package/dist/automations/nodes/text.d.ts +6 -0
  61. package/dist/automations/nodes/text.js +41 -0
  62. package/dist/automations/nodes/transcript.d.ts +5 -0
  63. package/dist/automations/nodes/transcript.js +46 -0
  64. package/dist/automations/nodes/types.d.ts +202 -0
  65. package/dist/automations/nodes/types.js +22 -0
  66. package/dist/automations/nodes/video-composer.d.ts +16 -0
  67. package/dist/automations/nodes/video-composer.js +117 -0
  68. package/dist/automations/nodes/video-import.d.ts +9 -0
  69. package/dist/automations/nodes/video-import.js +23 -0
  70. package/dist/automations/types.d.ts +431 -0
  71. package/dist/automations/types.js +29 -0
  72. package/dist/automations.d.ts +5 -33
  73. package/dist/automations.js +6 -647
  74. package/dist/comments.d.ts +26 -1
  75. package/dist/comments.js +3 -0
  76. package/dist/graph-controller.d.ts +211 -0
  77. package/dist/graph-controller.js +656 -0
  78. package/dist/index.d.ts +22 -9
  79. package/dist/index.js +47 -24
  80. package/dist/internal-utils.d.ts +8 -0
  81. package/dist/internal-utils.js +22 -0
  82. package/dist/media.d.ts +135 -1
  83. package/dist/nodes/account.d.ts +7 -0
  84. package/dist/nodes/account.js +29 -0
  85. package/dist/nodes/auto-caption.d.ts +17 -0
  86. package/dist/nodes/auto-caption.js +46 -0
  87. package/dist/nodes/auto-post.d.ts +21 -0
  88. package/dist/nodes/auto-post.js +54 -0
  89. package/dist/nodes/branch.d.ts +12 -0
  90. package/dist/nodes/branch.js +50 -0
  91. package/dist/nodes/collect.d.ts +6 -0
  92. package/dist/nodes/collect.js +56 -0
  93. package/dist/nodes/compose-workflow.d.ts +21 -0
  94. package/dist/nodes/compose-workflow.js +42 -0
  95. package/dist/nodes/create-dm.d.ts +40 -0
  96. package/dist/nodes/create-dm.js +88 -0
  97. package/dist/nodes/custom-model.d.ts +19 -0
  98. package/dist/nodes/custom-model.js +52 -0
  99. package/dist/nodes/deduplicate.d.ts +8 -0
  100. package/dist/nodes/deduplicate.js +36 -0
  101. package/dist/nodes/destructure.d.ts +25 -0
  102. package/dist/nodes/destructure.js +65 -0
  103. package/dist/nodes/for-each.d.ts +23 -0
  104. package/dist/nodes/for-each.js +84 -0
  105. package/dist/nodes/generate-image.d.ts +16 -0
  106. package/dist/nodes/generate-image.js +45 -0
  107. package/dist/nodes/generate-video.d.ts +16 -0
  108. package/dist/nodes/generate-video.js +45 -0
  109. package/dist/nodes/if.d.ts +22 -0
  110. package/dist/nodes/if.js +44 -0
  111. package/dist/nodes/image-composer.d.ts +14 -0
  112. package/dist/nodes/image-composer.js +95 -0
  113. package/dist/nodes/index.d.ts +20 -0
  114. package/dist/nodes/index.js +93 -0
  115. package/dist/nodes/llm.d.ts +27 -0
  116. package/dist/nodes/llm.js +85 -0
  117. package/dist/nodes/manual-trigger.d.ts +16 -0
  118. package/dist/nodes/manual-trigger.js +32 -0
  119. package/dist/nodes/media.d.ts +17 -0
  120. package/dist/nodes/media.js +40 -0
  121. package/dist/nodes/not.d.ts +6 -0
  122. package/dist/nodes/not.js +35 -0
  123. package/dist/nodes/output.d.ts +9 -0
  124. package/dist/nodes/output.js +32 -0
  125. package/dist/nodes/random-route.d.ts +3 -0
  126. package/dist/nodes/random-route.js +50 -0
  127. package/dist/nodes/random.d.ts +3 -0
  128. package/dist/nodes/random.js +48 -0
  129. package/dist/nodes/recurrence.d.ts +3 -0
  130. package/dist/nodes/recurrence.js +45 -0
  131. package/dist/nodes/save-to-media.d.ts +3 -0
  132. package/dist/nodes/save-to-media.js +26 -0
  133. package/dist/nodes/screenshot-animation.d.ts +7 -0
  134. package/dist/nodes/screenshot-animation.js +36 -0
  135. package/dist/nodes/social-audio.d.ts +3 -0
  136. package/dist/nodes/social-audio.js +26 -0
  137. package/dist/nodes/text.d.ts +3 -0
  138. package/dist/nodes/text.js +38 -0
  139. package/dist/nodes/transcript.d.ts +3 -0
  140. package/dist/nodes/transcript.js +42 -0
  141. package/dist/nodes/types.d.ts +146 -0
  142. package/dist/nodes/types.js +22 -0
  143. package/dist/nodes/video-composer.d.ts +3 -0
  144. package/dist/nodes/video-composer.js +67 -0
  145. package/dist/nodes/video-import.d.ts +3 -0
  146. package/dist/nodes/video-import.js +35 -0
  147. package/dist/org.d.ts +13 -1
  148. package/dist/ports.js +3 -9
  149. package/dist/posts.d.ts +88 -1
  150. package/dist/render/compositions/IMessageDmComposition/types.d.ts +24 -24
  151. package/dist/render/compositions/ImageEditorComposition.js +2 -8
  152. package/dist/render/compositions/VideoEditorComposition.js +2 -24
  153. package/dist/render/types/element.d.ts +0 -33
  154. package/dist/render/types/index.d.ts +1 -1
  155. package/dist/render/types/video.d.ts +2 -2
  156. package/dist/render.d.ts +2 -1
  157. package/dist/stats.d.ts +128 -1
  158. package/dist/tasks.d.ts +20 -1
  159. package/dist/types.d.ts +1 -2216
  160. package/dist/types.js +2 -124
  161. package/package.json +1 -1
@@ -1,50 +1,13 @@
1
1
  "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.AutomationsClient = void 0;
4
- exports.areTypesCompatible = areTypesCompatible;
5
- exports.getAllNodes = getAllNodes;
6
- exports.getNodeByType = getNodeByType;
7
- exports.getOutputSchema = getOutputSchema;
8
- const types_1 = require("./types");
9
- const base_1 = require("./base");
10
- /**
11
- * Helper to check if a PortType or array of PortTypes is an array
12
- * Used internally to normalize port types for comparison
13
- */
14
- function isPortTypeArray(pt) {
15
- return Array.isArray(pt) && pt.length > 0 && typeof pt[0] === 'object' && 'type' in pt[0];
16
- }
17
2
  /**
18
- * Check if two port types are compatible for connection
19
- * A connection is valid if:
20
- * 1. The types match exactly (same base type and same isArray), OR
21
- * 2. The source is an array type and target is 'object' (non-array), OR
22
- * 3. The source is a PortType[] and includes a compatible type, OR
23
- * 4. The target is a PortType[] and includes a compatible type, OR
24
- * 5. Both are PortType[] and have at least one common compatible type
3
+ * Automations API Client
25
4
  *
26
- * Note: Array inputs are strict - they only accept exact matches
5
+ * Provides methods to interact with the UGC Inc Automations API.
6
+ * For graph logic (validation, port computation, connections), use graph-controller.ts
27
7
  */
28
- function areTypesCompatible({ sourceType, targetType, }) {
29
- const sourceTypes = isPortTypeArray(sourceType) ? sourceType : [sourceType];
30
- const targetTypes = isPortTypeArray(targetType) ? targetType : [targetType];
31
- return sourceTypes.some(st => {
32
- return targetTypes.some(tt => {
33
- // Exact match (same base type and same isArray)
34
- if (st.type === tt.type && st.isArray === tt.isArray)
35
- return true;
36
- // Object inputs (non-array) accept any array type (backwards compatibility with for-each, etc.)
37
- if (tt.type === 'object' && !tt.isArray && st.isArray) {
38
- return true;
39
- }
40
- // Array inputs are strict - no other compatibility
41
- if (tt.isArray) {
42
- return false;
43
- }
44
- return false;
45
- });
46
- });
47
- }
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ exports.AutomationsClient = void 0;
10
+ const base_1 = require("./base");
48
11
  class AutomationsClient extends base_1.BaseClient {
49
12
  /**
50
13
  * List all automation templates for an organization
@@ -229,607 +192,3 @@ class AutomationsClient extends base_1.BaseClient {
229
192
  }
230
193
  }
231
194
  exports.AutomationsClient = AutomationsClient;
232
- /**
233
- * Get all available automation nodes
234
- */
235
- function getAllNodes() {
236
- return [
237
- // === Trigger nodes ===
238
- {
239
- type: "recurrence",
240
- label: "Recurring",
241
- description: "Run continuously",
242
- category: "Triggers",
243
- nodeCategory: "trigger",
244
- inputs: [],
245
- outputs: [],
246
- isInitializer: true,
247
- },
248
- {
249
- type: "manual-trigger",
250
- label: "Manual Trigger",
251
- description: "Trigger manually",
252
- category: "Triggers",
253
- nodeCategory: "trigger",
254
- inputs: [],
255
- // Dynamic outputs based on manualTriggerConfig.outputs
256
- outputs: [],
257
- isInitializer: true,
258
- },
259
- // === Source nodes ===
260
- {
261
- type: "media",
262
- label: "Media",
263
- description: "Use saved media",
264
- category: "Sources",
265
- nodeCategory: "source",
266
- inputs: [],
267
- outputs: [], // Dynamic based on enabledTypes config
268
- },
269
- {
270
- type: "video-import",
271
- label: "Import Video",
272
- description: "Import videos from YouTube, TikTok, Instagram & more",
273
- category: "Sources",
274
- nodeCategory: "source",
275
- inputs: [
276
- {
277
- id: "url",
278
- type: (0, types_1.portType)({ type: 'text', isArray: false }),
279
- required: true,
280
- },
281
- ],
282
- outputs: [
283
- {
284
- id: "video",
285
- type: (0, types_1.portType)({ type: 'video', isArray: false }),
286
- required: true,
287
- },
288
- ],
289
- },
290
- {
291
- type: "account",
292
- label: "Account",
293
- description: "Select accounts to post from",
294
- category: "Sources",
295
- nodeCategory: "source",
296
- inputs: [],
297
- outputs: [
298
- {
299
- id: "account",
300
- type: (0, types_1.portType)({ type: 'account', isArray: false }),
301
- required: true,
302
- },
303
- ],
304
- },
305
- {
306
- type: "text",
307
- label: "Text",
308
- description: "Use text collections",
309
- category: "Sources",
310
- nodeCategory: "source",
311
- inputs: [], // Dynamic inputs based on template variables
312
- outputs: [
313
- {
314
- id: "text",
315
- type: (0, types_1.portType)({ type: 'text', isArray: false }),
316
- required: true,
317
- },
318
- ],
319
- },
320
- // === Generator nodes ===
321
- {
322
- type: "image-composer",
323
- label: "Image Composer",
324
- description: "Create templated images",
325
- category: "Generation",
326
- nodeCategory: "generator",
327
- inputs: [
328
- {
329
- id: "background",
330
- type: (0, types_1.portType)({ type: 'image', isArray: false }),
331
- required: true,
332
- },
333
- ],
334
- outputs: [
335
- {
336
- id: "output",
337
- type: (0, types_1.portType)({ type: 'image', isArray: false }),
338
- required: true,
339
- },
340
- ],
341
- },
342
- {
343
- type: "video-composer",
344
- label: "Video Composer",
345
- description: "Create templated videos",
346
- category: "Generation",
347
- nodeCategory: "generator",
348
- inputs: [], // Dynamic inputs based on segments in editor config
349
- outputs: [
350
- {
351
- id: "output",
352
- type: (0, types_1.portType)({ type: 'video', isArray: false }),
353
- required: true,
354
- },
355
- ],
356
- },
357
- {
358
- type: "compose-workflow",
359
- label: "Compose Workflow",
360
- description: "Embed other workflows",
361
- category: "Generation",
362
- nodeCategory: "generator",
363
- // Inputs and outputs are dynamic based on the embedded workflow
364
- inputs: [],
365
- outputs: [],
366
- },
367
- {
368
- type: "transcript",
369
- label: "Transcribe",
370
- description: "Transcribe video or audio with timestamps",
371
- category: "Generation",
372
- nodeCategory: "generator",
373
- inputs: [
374
- {
375
- id: "media",
376
- type: [(0, types_1.portType)({ type: 'video', isArray: false }), (0, types_1.portType)({ type: 'audio', isArray: false })],
377
- required: true,
378
- },
379
- ],
380
- outputs: [
381
- {
382
- id: "text",
383
- type: (0, types_1.portType)({ type: 'text', isArray: false }),
384
- required: true,
385
- },
386
- {
387
- id: "segments",
388
- type: (0, types_1.portType)({ type: 'object', isArray: false }),
389
- required: true,
390
- itemSchema: {
391
- text: { type: 'string' },
392
- start: { type: 'number' },
393
- end: { type: 'number' },
394
- },
395
- },
396
- ],
397
- },
398
- {
399
- type: "auto-caption",
400
- label: "Auto Caption",
401
- description: "Add TikTok-style captions to videos",
402
- category: "Generation",
403
- nodeCategory: "generator",
404
- inputs: [
405
- {
406
- id: "video",
407
- type: (0, types_1.portType)({ type: 'video', isArray: false }),
408
- required: true,
409
- },
410
- ],
411
- outputs: [
412
- {
413
- id: "output",
414
- type: (0, types_1.portType)({ type: 'video', isArray: false }),
415
- required: true,
416
- },
417
- ],
418
- },
419
- {
420
- type: "screenshot-animation",
421
- label: "Animate Screenshot",
422
- description: "Create an iPhone screenshot animation from an image",
423
- category: "Generation",
424
- nodeCategory: "generator",
425
- inputs: [
426
- {
427
- id: "image",
428
- type: (0, types_1.portType)({ type: 'image', isArray: false }),
429
- required: true,
430
- },
431
- ],
432
- outputs: [
433
- {
434
- id: "output",
435
- type: (0, types_1.portType)({ type: 'video', isArray: false }),
436
- required: true,
437
- },
438
- ],
439
- },
440
- {
441
- type: "create-dm",
442
- label: "Create DM",
443
- description: "Create fake DM screenshots for iMessage or Instagram",
444
- category: "Generation",
445
- nodeCategory: "generator",
446
- // Dynamic inputs based on createDmConfig:
447
- // - profilePic (image, if profilePicIsVariable)
448
- // - messages (object, if messagesSource === 'input')
449
- // - imageAttachment (image, if imageAttachmentIsVariable)
450
- inputs: [],
451
- outputs: [
452
- {
453
- id: "output",
454
- type: (0, types_1.portType)({ type: 'image', isArray: false }),
455
- required: true,
456
- },
457
- ],
458
- },
459
- {
460
- type: "deduplicate",
461
- label: "Mass Repost",
462
- description: "Make videos unique for safe reposting",
463
- category: "Generation",
464
- nodeCategory: "generator",
465
- inputs: [
466
- {
467
- id: "video",
468
- type: (0, types_1.portType)({ type: 'video', isArray: false }),
469
- required: true,
470
- },
471
- ],
472
- outputs: [
473
- {
474
- id: "output",
475
- type: (0, types_1.portType)({ type: 'video', isArray: false }),
476
- required: true,
477
- },
478
- ],
479
- },
480
- // === AI nodes ===
481
- {
482
- type: "llm",
483
- label: "LLM",
484
- description: "Generate LLM output",
485
- category: "AI Generation",
486
- nodeCategory: "generator",
487
- // Dynamic inputs: extracted from systemPrompt {{variables}} + media refs
488
- inputs: [],
489
- // Dynamic outputs: based on outputFields config
490
- outputs: [],
491
- },
492
- {
493
- type: "generate-video",
494
- label: "Generate Video",
495
- description: "Generate videos with AI",
496
- category: "AI Generation",
497
- nodeCategory: "generator",
498
- inputs: [
499
- {
500
- id: "prompt",
501
- type: (0, types_1.portType)({ type: 'text', isArray: false }),
502
- required: true,
503
- },
504
- // Image input is dynamically added for image-to-video models
505
- ],
506
- outputs: [
507
- {
508
- id: "output",
509
- type: (0, types_1.portType)({ type: 'video', isArray: false }),
510
- required: true,
511
- },
512
- ],
513
- },
514
- {
515
- type: "generate-image",
516
- label: "Generate Image",
517
- description: "Generate images with AI",
518
- category: "AI Generation",
519
- nodeCategory: "generator",
520
- inputs: [
521
- {
522
- id: "prompt",
523
- type: (0, types_1.portType)({ type: 'text', isArray: false }),
524
- required: true,
525
- },
526
- // Image input is dynamically added for edit models
527
- ],
528
- outputs: [
529
- {
530
- id: "output",
531
- type: (0, types_1.portType)({ type: 'image', isArray: false }),
532
- required: true,
533
- },
534
- ],
535
- },
536
- {
537
- type: "custom-model",
538
- label: "Custom Model",
539
- description: "Call any fal.ai model",
540
- category: "AI Generation",
541
- nodeCategory: "generator",
542
- // Dynamic inputs based on selected model's schema
543
- inputs: [],
544
- // Dynamic output based on model's output type
545
- outputs: [],
546
- },
547
- // === Control Flow ===
548
- {
549
- type: "for-each",
550
- label: "For Each",
551
- description: "Iterate over an array, executing downstream nodes for each item",
552
- category: "Control Flow",
553
- nodeCategory: "generator",
554
- inputs: [
555
- {
556
- id: "array",
557
- type: [(0, types_1.portType)({ type: 'image', isArray: true }), (0, types_1.portType)({ type: 'video', isArray: true }), (0, types_1.portType)({ type: 'audio', isArray: true }), (0, types_1.portType)({ type: 'text', isArray: true }), (0, types_1.portType)({ type: 'object', isArray: true })],
558
- required: true,
559
- },
560
- ],
561
- // Dynamic outputs based on forEachConfig (exposeItem, exposeIndex, outputProperties, inputPorts)
562
- outputs: [],
563
- },
564
- {
565
- type: "random",
566
- label: "Random Select",
567
- description: "Randomly select from an array or weighted inputs",
568
- category: "Control Flow",
569
- nodeCategory: "generator",
570
- // Dynamic inputs based on randomConfig.mode:
571
- // - array mode: single 'array' input
572
- // - multi-input mode: dynamic inputs from randomConfig.inputPorts
573
- inputs: [],
574
- // Dynamic outputs based on randomConfig:
575
- // - output (type determined by randomConfig.valueType)
576
- // - index (if randomConfig.exposeIndex is true, array mode only)
577
- outputs: [],
578
- },
579
- {
580
- type: "if",
581
- label: "If",
582
- description: "Conditional branching based on boolean logic",
583
- category: "Control Flow",
584
- nodeCategory: "generator",
585
- // Dynamic inputs based on ifConfig:
586
- // - Boolean inputs from ifConfig.booleanInputs (type: boolean)
587
- // - Passthrough inputs from ifConfig.passthroughInputs (various types)
588
- inputs: [],
589
- // Dynamic outputs: for each passthrough input, creates:
590
- // - true-{id} (same type as input, receives value when condition is true)
591
- // - false-{id} (same type as input, receives value when condition is false)
592
- outputs: [],
593
- },
594
- {
595
- type: "not",
596
- label: "Not",
597
- description: "Invert a boolean value",
598
- category: "Control Flow",
599
- nodeCategory: "generator",
600
- inputs: [
601
- {
602
- id: "input",
603
- type: (0, types_1.portType)({ type: 'boolean', isArray: false }),
604
- required: true,
605
- },
606
- ],
607
- outputs: [
608
- {
609
- id: "output",
610
- type: (0, types_1.portType)({ type: 'boolean', isArray: false }),
611
- required: false,
612
- },
613
- ],
614
- },
615
- {
616
- type: "random-route",
617
- label: "Random Branch",
618
- description: "Route inputs to a randomly selected branch",
619
- category: "Control Flow",
620
- nodeCategory: "generator",
621
- // Dynamic inputs based on randomRouteConfig.passthroughInputs (various types)
622
- inputs: [],
623
- // Dynamic outputs: for each passthrough input and branch, creates:
624
- // - {branch-id}-{passthrough-id} (same type as input)
625
- outputs: [],
626
- },
627
- {
628
- type: "branch",
629
- label: "Branch",
630
- description: "Route inputs based on a key match",
631
- category: "Control Flow",
632
- nodeCategory: "generator",
633
- // Static input: key (text) to match against branch keys
634
- // Dynamic inputs based on branchConfig.passthroughInputs where isVariable is true
635
- inputs: [
636
- {
637
- id: "key",
638
- type: (0, types_1.portType)({ type: 'text', isArray: false }),
639
- required: true,
640
- },
641
- ],
642
- // Dynamic outputs: for each passthrough input and branch, creates:
643
- // - {branch-key}-{passthrough-id} (same type as input)
644
- outputs: [],
645
- },
646
- {
647
- type: "collect",
648
- label: "Collect",
649
- description: "Collect outputs from a for-each loop into an array",
650
- category: "Control Flow",
651
- nodeCategory: "generator",
652
- // Input accepts any type from inside the loop
653
- inputs: [
654
- {
655
- id: "value",
656
- type: [(0, types_1.portType)({ type: 'image', isArray: false }), (0, types_1.portType)({ type: 'video', isArray: false }), (0, types_1.portType)({ type: 'audio', isArray: false }), (0, types_1.portType)({ type: 'text', isArray: false }), (0, types_1.portType)({ type: 'object', isArray: false }), (0, types_1.portType)({ type: 'boolean', isArray: false }), (0, types_1.portType)({ type: 'number', isArray: false })],
657
- required: true,
658
- },
659
- ],
660
- // Output is an array of the input type
661
- outputs: [
662
- {
663
- id: "array",
664
- type: [(0, types_1.portType)({ type: 'image', isArray: true }), (0, types_1.portType)({ type: 'video', isArray: true }), (0, types_1.portType)({ type: 'audio', isArray: true }), (0, types_1.portType)({ type: 'text', isArray: true }), (0, types_1.portType)({ type: 'object', isArray: true })],
665
- required: true,
666
- },
667
- ],
668
- },
669
- {
670
- type: "destructure",
671
- label: "Destructure",
672
- description: "Extract specific elements from an array by index or range",
673
- category: "Control Flow",
674
- nodeCategory: "generator",
675
- // Input is any array type
676
- inputs: [
677
- {
678
- id: "array",
679
- type: [(0, types_1.portType)({ type: 'image', isArray: true }), (0, types_1.portType)({ type: 'video', isArray: true }), (0, types_1.portType)({ type: 'audio', isArray: true }), (0, types_1.portType)({ type: 'text', isArray: true }), (0, types_1.portType)({ type: 'object', isArray: true })],
680
- required: true,
681
- },
682
- ],
683
- // Dynamic outputs based on config.selections
684
- outputs: [],
685
- },
686
- // === Terminal nodes ===
687
- {
688
- type: "auto-post",
689
- label: "Auto Post",
690
- description: "Publish a video or slideshow",
691
- category: "Output",
692
- nodeCategory: "terminal",
693
- // Dynamic inputs based on autoPostConfig.mode:
694
- // - video mode: video (required), account, caption, social-audio
695
- // - slideshow mode: dynamic image inputs from config, account, caption, social-audio
696
- inputs: [
697
- {
698
- id: "account",
699
- type: (0, types_1.portType)({ type: 'account', isArray: false }),
700
- required: true,
701
- },
702
- {
703
- id: "caption",
704
- type: (0, types_1.portType)({ type: 'text', isArray: false }),
705
- required: false,
706
- },
707
- {
708
- id: "social-audio",
709
- type: (0, types_1.portType)({ type: 'social_audio', isArray: false }),
710
- required: false,
711
- },
712
- ],
713
- outputs: [],
714
- },
715
- {
716
- type: "save-to-media",
717
- label: "Save To Media",
718
- description: "Save outputs to media library",
719
- category: "Output",
720
- nodeCategory: "terminal",
721
- // Dynamic inputs based on config
722
- inputs: [],
723
- outputs: [],
724
- },
725
- {
726
- type: "output",
727
- label: "Pass-Through",
728
- description: "Pass data to parent workflow",
729
- category: "Output",
730
- nodeCategory: "terminal",
731
- inputs: [
732
- {
733
- id: "result",
734
- type: [(0, types_1.portType)({ type: 'image', isArray: false }), (0, types_1.portType)({ type: 'video', isArray: false }), (0, types_1.portType)({ type: 'audio', isArray: false }), (0, types_1.portType)({ type: 'text', isArray: false }), (0, types_1.portType)({ type: 'social_audio', isArray: false }), (0, types_1.portType)({ type: 'account', isArray: false }), (0, types_1.portType)({ type: 'boolean', isArray: false }), (0, types_1.portType)({ type: 'object', isArray: false })],
735
- required: true,
736
- },
737
- ],
738
- outputs: [],
739
- },
740
- ];
741
- }
742
- /**
743
- * Get a specific node by type
744
- */
745
- function getNodeByType(type) {
746
- return getAllNodes().find(node => node.type === type);
747
- }
748
- /**
749
- * Convert LLM output field type to PropertySchema type
750
- */
751
- function llmTypeToSchemaType(type) {
752
- if (type === 'string')
753
- return 'string';
754
- if (type === 'number')
755
- return 'number';
756
- if (type === 'boolean')
757
- return 'boolean';
758
- return 'object';
759
- }
760
- /**
761
- * Convert LLM objectSchema to PropertySchema record
762
- */
763
- function llmObjectSchemaToPropertySchema(fields) {
764
- const result = {};
765
- for (const field of fields) {
766
- if (field.type === 'object' && field.objectSchema) {
767
- // Top-level object with nested schema
768
- result[field.name] = {
769
- type: 'object',
770
- itemSchema: llmObjectSchemaToPropertySchema(field.objectSchema),
771
- };
772
- }
773
- else if (field.type === 'array' && field.items === 'object' && field.objectSchema) {
774
- // Nested array of objects
775
- result[field.name] = {
776
- type: 'object',
777
- itemSchema: llmObjectSchemaToPropertySchema(field.objectSchema),
778
- };
779
- }
780
- else if (field.type === 'array' && field.items) {
781
- // Array of primitives
782
- result[field.name] = {
783
- type: 'object', // Arrays are represented as 'object' type
784
- };
785
- }
786
- else {
787
- result[field.name] = {
788
- type: llmTypeToSchemaType(field.type),
789
- };
790
- }
791
- }
792
- return result;
793
- }
794
- /**
795
- * Get the schema of array items for a node's output port.
796
- * Returns null if schema is unknown or the output is not an array.
797
- *
798
- * @param nodeType - The type of the node (e.g., 'transcript', 'llm')
799
- * @param nodeConfig - The node's configuration object
800
- * @param outputPortId - The ID of the output port to get schema for
801
- * @returns The schema of array items, or null if unknown
802
- */
803
- function getOutputSchema(nodeType, nodeConfig, outputPortId) {
804
- // First check static node definitions
805
- const nodeDefinition = getNodeByType(nodeType);
806
- const outputPort = nodeDefinition?.outputs.find(o => o.id === outputPortId);
807
- if (outputPort?.itemSchema) {
808
- return outputPort.itemSchema;
809
- }
810
- // Check resolvedPorts for nodes with dynamic outputs (compose-workflow, for-each, etc.)
811
- if (nodeConfig?.resolvedPorts) {
812
- const resolvedPorts = nodeConfig.resolvedPorts;
813
- const resolvedOutput = resolvedPorts.outputs?.find(o => o.id === outputPortId);
814
- if (resolvedOutput?.itemSchema) {
815
- return resolvedOutput.itemSchema;
816
- }
817
- }
818
- // For LLM nodes, derive from outputFields config
819
- if (nodeType === 'llm' && nodeConfig) {
820
- const llmConfig = nodeConfig.llm;
821
- const outputFields = llmConfig?.outputFields;
822
- if (outputFields) {
823
- const field = outputFields.find(f => f.name === outputPortId);
824
- // Handle top-level object type
825
- if (field?.type === 'object' && field.objectSchema) {
826
- return llmObjectSchemaToPropertySchema(field.objectSchema);
827
- }
828
- // Handle array of objects
829
- if (field?.type === 'array' && field.items === 'object' && field.objectSchema) {
830
- return llmObjectSchemaToPropertySchema(field.objectSchema);
831
- }
832
- }
833
- }
834
- return null;
835
- }
@@ -1,5 +1,30 @@
1
1
  import { BaseClient } from './base';
2
- import type { CreateCommentParams, CreateCommentResponse, GetCommentsParams, Comment, ApiResponse } from './types';
2
+ import type { ApiResponse } from './types';
3
+ export type CommentStatus = 'scheduled' | 'pending' | 'verifying' | 'completed' | 'failed';
4
+ export interface Comment {
5
+ id: string;
6
+ accountId: string;
7
+ postUrl: string;
8
+ commentText: string;
9
+ status: CommentStatus;
10
+ commentUrl?: string | null;
11
+ error?: string | null;
12
+ createdAt?: string;
13
+ completedAt?: string | null;
14
+ }
15
+ export interface CreateCommentParams {
16
+ accountId: string;
17
+ postUrl: string;
18
+ commentText: string;
19
+ }
20
+ export interface CreateCommentResponse {
21
+ commentId: string;
22
+ }
23
+ export interface GetCommentsParams {
24
+ commentIds?: string[];
25
+ accountIds?: string[];
26
+ tag?: string;
27
+ }
3
28
  /**
4
29
  * Client for managing comments
5
30
  */