ugcinc 3.18.0 → 3.20.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/dist/automations.d.ts +12 -2
- package/dist/automations.js +76 -13
- package/dist/index.d.ts +2 -1
- package/dist/index.js +2 -1
- package/dist/types.d.ts +13 -0
- package/package.json +1 -1
package/dist/automations.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { NodeControlConfig, NodeCategory, MediaType, NodePort, NodeTypeEnum, WorkflowDefinition, AutomationTemplate, AutomationRun, ExecutorNode, ExecutionEdge, ApiResponse, AutomationExport, AutomationRunExport } from './types';
|
|
1
|
+
import type { NodeControlConfig, NodeCategory, MediaType, NodePort, NodeTypeEnum, WorkflowDefinition, AutomationTemplate, AutomationRun, ExecutorNode, ExecutionEdge, ApiResponse, AutomationExport, AutomationRunExport, PropertySchema } from './types';
|
|
2
2
|
import { BaseClient } from './base';
|
|
3
3
|
export declare class AutomationsClient extends BaseClient {
|
|
4
4
|
/**
|
|
@@ -135,4 +135,14 @@ export declare function getAllNodes(): NodeControlConfig[];
|
|
|
135
135
|
* Get a specific node by type
|
|
136
136
|
*/
|
|
137
137
|
export declare function getNodeByType(type: string): NodeControlConfig | undefined;
|
|
138
|
-
|
|
138
|
+
/**
|
|
139
|
+
* Get the schema of array items for a node's output port.
|
|
140
|
+
* Returns null if schema is unknown or the output is not an array.
|
|
141
|
+
*
|
|
142
|
+
* @param nodeType - The type of the node (e.g., 'transcript', 'text-generation')
|
|
143
|
+
* @param nodeConfig - The node's configuration object
|
|
144
|
+
* @param outputPortId - The ID of the output port to get schema for
|
|
145
|
+
* @returns The schema of array items, or null if unknown
|
|
146
|
+
*/
|
|
147
|
+
export declare function getOutputSchema(nodeType: string, nodeConfig: Record<string, unknown> | undefined, outputPortId: string): Record<string, PropertySchema> | null;
|
|
148
|
+
export type { NodeControlConfig, NodeCategory, MediaType, NodePort, NodeTypeEnum, PropertySchema };
|
package/dist/automations.js
CHANGED
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.AutomationsClient = void 0;
|
|
4
4
|
exports.getAllNodes = getAllNodes;
|
|
5
5
|
exports.getNodeByType = getNodeByType;
|
|
6
|
+
exports.getOutputSchema = getOutputSchema;
|
|
6
7
|
const base_1 = require("./base");
|
|
7
8
|
class AutomationsClient extends base_1.BaseClient {
|
|
8
9
|
/**
|
|
@@ -488,19 +489,8 @@ function getAllNodes() {
|
|
|
488
489
|
required: true,
|
|
489
490
|
},
|
|
490
491
|
],
|
|
491
|
-
//
|
|
492
|
-
outputs: [
|
|
493
|
-
{
|
|
494
|
-
id: "item",
|
|
495
|
-
type: "object",
|
|
496
|
-
required: true,
|
|
497
|
-
},
|
|
498
|
-
{
|
|
499
|
-
id: "index",
|
|
500
|
-
type: "text",
|
|
501
|
-
required: false,
|
|
502
|
-
},
|
|
503
|
-
],
|
|
492
|
+
// Dynamic outputs based on forEachConfig (exposeItem, exposeIndex, outputProperties, inputPorts)
|
|
493
|
+
outputs: [],
|
|
504
494
|
},
|
|
505
495
|
// === Transcript ===
|
|
506
496
|
{
|
|
@@ -526,6 +516,11 @@ function getAllNodes() {
|
|
|
526
516
|
id: "segments",
|
|
527
517
|
type: "object",
|
|
528
518
|
required: true,
|
|
519
|
+
itemSchema: {
|
|
520
|
+
text: { type: 'string' },
|
|
521
|
+
start: { type: 'number' },
|
|
522
|
+
end: { type: 'number' },
|
|
523
|
+
},
|
|
529
524
|
},
|
|
530
525
|
],
|
|
531
526
|
},
|
|
@@ -559,3 +554,71 @@ function getAllNodes() {
|
|
|
559
554
|
function getNodeByType(type) {
|
|
560
555
|
return getAllNodes().find(node => node.type === type);
|
|
561
556
|
}
|
|
557
|
+
/**
|
|
558
|
+
* Convert LLM output field type to PropertySchema type
|
|
559
|
+
*/
|
|
560
|
+
function llmTypeToSchemaType(type) {
|
|
561
|
+
if (type === 'string')
|
|
562
|
+
return 'string';
|
|
563
|
+
if (type === 'number')
|
|
564
|
+
return 'number';
|
|
565
|
+
if (type === 'boolean')
|
|
566
|
+
return 'boolean';
|
|
567
|
+
return 'object';
|
|
568
|
+
}
|
|
569
|
+
/**
|
|
570
|
+
* Convert LLM objectSchema to PropertySchema record
|
|
571
|
+
*/
|
|
572
|
+
function llmObjectSchemaToPropertySchema(fields) {
|
|
573
|
+
const result = {};
|
|
574
|
+
for (const field of fields) {
|
|
575
|
+
if (field.type === 'array' && field.items === 'object' && field.objectSchema) {
|
|
576
|
+
// Nested array of objects
|
|
577
|
+
result[field.name] = {
|
|
578
|
+
type: 'object',
|
|
579
|
+
itemSchema: llmObjectSchemaToPropertySchema(field.objectSchema),
|
|
580
|
+
};
|
|
581
|
+
}
|
|
582
|
+
else if (field.type === 'array' && field.items) {
|
|
583
|
+
// Array of primitives
|
|
584
|
+
result[field.name] = {
|
|
585
|
+
type: 'object', // Arrays are represented as 'object' type
|
|
586
|
+
};
|
|
587
|
+
}
|
|
588
|
+
else {
|
|
589
|
+
result[field.name] = {
|
|
590
|
+
type: llmTypeToSchemaType(field.type),
|
|
591
|
+
};
|
|
592
|
+
}
|
|
593
|
+
}
|
|
594
|
+
return result;
|
|
595
|
+
}
|
|
596
|
+
/**
|
|
597
|
+
* Get the schema of array items for a node's output port.
|
|
598
|
+
* Returns null if schema is unknown or the output is not an array.
|
|
599
|
+
*
|
|
600
|
+
* @param nodeType - The type of the node (e.g., 'transcript', 'text-generation')
|
|
601
|
+
* @param nodeConfig - The node's configuration object
|
|
602
|
+
* @param outputPortId - The ID of the output port to get schema for
|
|
603
|
+
* @returns The schema of array items, or null if unknown
|
|
604
|
+
*/
|
|
605
|
+
function getOutputSchema(nodeType, nodeConfig, outputPortId) {
|
|
606
|
+
// First check static node definitions
|
|
607
|
+
const nodeDefinition = getNodeByType(nodeType);
|
|
608
|
+
const outputPort = nodeDefinition?.outputs.find(o => o.id === outputPortId);
|
|
609
|
+
if (outputPort?.itemSchema) {
|
|
610
|
+
return outputPort.itemSchema;
|
|
611
|
+
}
|
|
612
|
+
// For text-generation (LLM) nodes, derive from outputFields config
|
|
613
|
+
if (nodeType === 'text-generation' && nodeConfig) {
|
|
614
|
+
const llmConfig = nodeConfig.llm;
|
|
615
|
+
const outputFields = llmConfig?.outputFields;
|
|
616
|
+
if (outputFields) {
|
|
617
|
+
const field = outputFields.find(f => f.name === outputPortId);
|
|
618
|
+
if (field?.type === 'array' && field.items === 'object' && field.objectSchema) {
|
|
619
|
+
return llmObjectSchemaToPropertySchema(field.objectSchema);
|
|
620
|
+
}
|
|
621
|
+
}
|
|
622
|
+
}
|
|
623
|
+
return null;
|
|
624
|
+
}
|
package/dist/index.d.ts
CHANGED
|
@@ -10,7 +10,8 @@ export { PostsClient } from './posts';
|
|
|
10
10
|
export { StatsClient } from './stats';
|
|
11
11
|
export { OrganizationClient } from './org';
|
|
12
12
|
export { RenderClient } from './render';
|
|
13
|
-
export { AutomationsClient, getAllNodes, getNodeByType } from './automations';
|
|
13
|
+
export { AutomationsClient, getAllNodes, getNodeByType, getOutputSchema } from './automations';
|
|
14
|
+
export type { PropertySchema } from './automations';
|
|
14
15
|
export { portId, isValidPortId, portIdToTitle, normalizeToPortId, PortIdSchema } from './port-id';
|
|
15
16
|
export type { PortId } from './port-id';
|
|
16
17
|
export { MediaClient } from './media';
|
package/dist/index.js
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* Official TypeScript/JavaScript client for the UGC Inc API
|
|
6
6
|
*/
|
|
7
7
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
-
exports.CommentsClient = exports.MediaClient = exports.PortIdSchema = exports.normalizeToPortId = exports.portIdToTitle = exports.isValidPortId = exports.portId = exports.getNodeByType = exports.getAllNodes = exports.AutomationsClient = exports.RenderClient = exports.OrganizationClient = exports.StatsClient = exports.PostsClient = exports.TasksClient = exports.AccountsClient = exports.UGCClient = void 0;
|
|
8
|
+
exports.CommentsClient = exports.MediaClient = exports.PortIdSchema = exports.normalizeToPortId = exports.portIdToTitle = exports.isValidPortId = exports.portId = exports.getOutputSchema = exports.getNodeByType = exports.getAllNodes = exports.AutomationsClient = exports.RenderClient = exports.OrganizationClient = exports.StatsClient = exports.PostsClient = exports.TasksClient = exports.AccountsClient = exports.UGCClient = void 0;
|
|
9
9
|
var client_1 = require("./client");
|
|
10
10
|
Object.defineProperty(exports, "UGCClient", { enumerable: true, get: function () { return client_1.UGCClient; } });
|
|
11
11
|
var accounts_1 = require("./accounts");
|
|
@@ -24,6 +24,7 @@ var automations_1 = require("./automations");
|
|
|
24
24
|
Object.defineProperty(exports, "AutomationsClient", { enumerable: true, get: function () { return automations_1.AutomationsClient; } });
|
|
25
25
|
Object.defineProperty(exports, "getAllNodes", { enumerable: true, get: function () { return automations_1.getAllNodes; } });
|
|
26
26
|
Object.defineProperty(exports, "getNodeByType", { enumerable: true, get: function () { return automations_1.getNodeByType; } });
|
|
27
|
+
Object.defineProperty(exports, "getOutputSchema", { enumerable: true, get: function () { return automations_1.getOutputSchema; } });
|
|
27
28
|
var port_id_1 = require("./port-id");
|
|
28
29
|
Object.defineProperty(exports, "portId", { enumerable: true, get: function () { return port_id_1.portId; } });
|
|
29
30
|
Object.defineProperty(exports, "isValidPortId", { enumerable: true, get: function () { return port_id_1.isValidPortId; } });
|
package/dist/types.d.ts
CHANGED
|
@@ -788,10 +788,19 @@ export interface NodeOutputValues {
|
|
|
788
788
|
_values: unknown[];
|
|
789
789
|
_outputMode: OutputMode;
|
|
790
790
|
}
|
|
791
|
+
/**
|
|
792
|
+
* Schema definition for a property within an array item
|
|
793
|
+
*/
|
|
794
|
+
export interface PropertySchema {
|
|
795
|
+
type: 'string' | 'number' | 'boolean' | 'object';
|
|
796
|
+
itemSchema?: Record<string, PropertySchema>;
|
|
797
|
+
}
|
|
791
798
|
export interface NodePort {
|
|
792
799
|
id: string;
|
|
793
800
|
type: PortType | PortType[];
|
|
794
801
|
required: boolean;
|
|
802
|
+
/** Schema of array items (when this port outputs an array) */
|
|
803
|
+
itemSchema?: Record<string, PropertySchema>;
|
|
795
804
|
}
|
|
796
805
|
/**
|
|
797
806
|
* Functional category for automation nodes
|
|
@@ -1211,6 +1220,10 @@ export interface ForEachNodeConfig {
|
|
|
1211
1220
|
outputProperties?: ForEachOutputProperty[];
|
|
1212
1221
|
/** Input ports for single-value passthrough (Mode 2) */
|
|
1213
1222
|
inputPorts?: ForEachInputPort[];
|
|
1223
|
+
/** Whether to expose the full item object as an output (default: false) */
|
|
1224
|
+
exposeItem?: boolean;
|
|
1225
|
+
/** Whether to expose the iteration index as an output (default: false) */
|
|
1226
|
+
exposeIndex?: boolean;
|
|
1214
1227
|
}
|
|
1215
1228
|
/**
|
|
1216
1229
|
* Supported platforms for video import
|