ugcinc 3.85.1 → 3.86.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.
@@ -1,5 +1,20 @@
1
- import type { NodeControlConfig, NodeCategory, MediaType, NodePort, NodeTypeEnum, WorkflowDefinition, AutomationTemplate, AutomationRun, ExecutorNode, ExecutionEdge, ApiResponse, AutomationExport, AutomationRunExport, PropertySchema } from './types';
1
+ import type { NodeControlConfig, NodeCategory, MediaType, NodePort, NodeTypeEnum, PortType, WorkflowDefinition, AutomationTemplate, AutomationRun, ExecutorNode, ExecutionEdge, ApiResponse, AutomationExport, AutomationRunExport, PropertySchema } from './types';
2
2
  import { BaseClient } from './base';
3
+ /**
4
+ * Check if two port types are compatible for connection
5
+ * A connection is valid if:
6
+ * 1. The types match exactly, OR
7
+ * 2. The source is an array type and target is 'object', OR
8
+ * 3. The source is a PortType[] and includes the target type, OR
9
+ * 4. The target is a PortType[] and includes the source type, OR
10
+ * 5. Both are PortType[] and have at least one common type
11
+ *
12
+ * Note: Array inputs are strict - they only accept exact matches
13
+ */
14
+ export declare function areTypesCompatible({ sourceType, targetType, }: {
15
+ sourceType: PortType | PortType[];
16
+ targetType: PortType | PortType[];
17
+ }): boolean;
3
18
  export declare class AutomationsClient extends BaseClient {
4
19
  /**
5
20
  * List all automation templates for an organization
@@ -1,10 +1,46 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.AutomationsClient = void 0;
4
+ exports.areTypesCompatible = areTypesCompatible;
4
5
  exports.getAllNodes = getAllNodes;
5
6
  exports.getNodeByType = getNodeByType;
6
7
  exports.getOutputSchema = getOutputSchema;
7
8
  const base_1 = require("./base");
9
+ /**
10
+ * Array types for collections
11
+ */
12
+ const ARRAY_TYPES = ['image[]', 'video[]', 'audio[]', 'text[]', 'object[]', 'account[]', 'social_audio[]', 'boolean[]'];
13
+ /**
14
+ * Check if two port types are compatible for connection
15
+ * A connection is valid if:
16
+ * 1. The types match exactly, OR
17
+ * 2. The source is an array type and target is 'object', OR
18
+ * 3. The source is a PortType[] and includes the target type, OR
19
+ * 4. The target is a PortType[] and includes the source type, OR
20
+ * 5. Both are PortType[] and have at least one common type
21
+ *
22
+ * Note: Array inputs are strict - they only accept exact matches
23
+ */
24
+ function areTypesCompatible({ sourceType, targetType, }) {
25
+ const sourceTypes = Array.isArray(sourceType) ? sourceType : [sourceType];
26
+ const targetTypes = Array.isArray(targetType) ? targetType : [targetType];
27
+ return sourceTypes.some(st => {
28
+ return targetTypes.some(tt => {
29
+ // Exact match
30
+ if (st === tt)
31
+ return true;
32
+ // Object inputs accept any array type (backwards compatibility with for-each, etc.)
33
+ if (tt === 'object' && ARRAY_TYPES.includes(st)) {
34
+ return true;
35
+ }
36
+ // Array inputs are strict - no other compatibility
37
+ if (ARRAY_TYPES.includes(tt)) {
38
+ return false;
39
+ }
40
+ return false;
41
+ });
42
+ });
43
+ }
8
44
  class AutomationsClient extends base_1.BaseClient {
9
45
  /**
10
46
  * List all automation templates for an organization
package/dist/index.d.ts CHANGED
@@ -10,7 +10,7 @@ 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, getOutputSchema } from './automations';
13
+ export { AutomationsClient, getAllNodes, getNodeByType, getOutputSchema, areTypesCompatible } from './automations';
14
14
  export { NodeTypes, isAsyncExecutor, isEditModel, isImageToVideoModel } from './types';
15
15
  export type { PropertySchema } from './automations';
16
16
  export { portId, isValidPortId, portIdToTitle, normalizeToPortId, PortIdSchema } from './port-id';
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.isImageToVideoModel = exports.isEditModel = exports.isAsyncExecutor = exports.NodeTypes = exports.getOutputSchema = 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.isImageToVideoModel = exports.isEditModel = exports.isAsyncExecutor = exports.NodeTypes = exports.areTypesCompatible = 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");
@@ -25,6 +25,7 @@ Object.defineProperty(exports, "AutomationsClient", { enumerable: true, get: fun
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
27
  Object.defineProperty(exports, "getOutputSchema", { enumerable: true, get: function () { return automations_1.getOutputSchema; } });
28
+ Object.defineProperty(exports, "areTypesCompatible", { enumerable: true, get: function () { return automations_1.areTypesCompatible; } });
28
29
  var types_1 = require("./types");
29
30
  Object.defineProperty(exports, "NodeTypes", { enumerable: true, get: function () { return types_1.NodeTypes; } });
30
31
  Object.defineProperty(exports, "isAsyncExecutor", { enumerable: true, get: function () { return types_1.isAsyncExecutor; } });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ugcinc",
3
- "version": "3.85.1",
3
+ "version": "3.86.0",
4
4
  "description": "TypeScript/JavaScript client for the UGC Inc API",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",