ugcinc 4.1.60 → 4.1.61

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.
@@ -70,3 +70,8 @@ declare const _default: typeof definition & {
70
70
  };
71
71
  export default _default;
72
72
  export type CustomModelNodeConfig = typeof definition.defaults;
73
+ /**
74
+ * Resolve a path like "images[0].url" from an unknown object.
75
+ * Used for extracting output URLs from fal.ai API responses.
76
+ */
77
+ export declare function resolveUnknownPath(obj: unknown, path: string): unknown;
@@ -4,6 +4,7 @@ exports.mapOpenAPIType = mapOpenAPIType;
4
4
  exports.parseOpenAPIInputs = parseOpenAPIInputs;
5
5
  exports.parseOpenAPIOutputPath = parseOpenAPIOutputPath;
6
6
  exports.getOutputTypeFromCategory = getOutputTypeFromCategory;
7
+ exports.resolveUnknownPath = resolveUnknownPath;
7
8
  const types_1 = require("./types");
8
9
  // =============================================================================
9
10
  // OpenAPI Parsing Functions
@@ -232,3 +233,56 @@ const definition = (0, types_1.defineNode)({
232
233
  },
233
234
  });
234
235
  exports.default = definition;
236
+ // =============================================================================
237
+ // Utility Functions for Custom Model Execution
238
+ // =============================================================================
239
+ /**
240
+ * Resolve a path like "images[0].url" from an unknown object.
241
+ * Used for extracting output URLs from fal.ai API responses.
242
+ */
243
+ function resolveUnknownPath(obj, path) {
244
+ if (!path || path.trim() === '')
245
+ return obj;
246
+ const segments = [];
247
+ let current = '';
248
+ for (const char of path) {
249
+ if (char === '.') {
250
+ if (current)
251
+ segments.push(current);
252
+ current = '';
253
+ }
254
+ else if (char === '[') {
255
+ if (current)
256
+ segments.push(current);
257
+ current = '';
258
+ }
259
+ else if (char === ']') {
260
+ if (current)
261
+ segments.push(current);
262
+ current = '';
263
+ }
264
+ else {
265
+ current += char;
266
+ }
267
+ }
268
+ if (current)
269
+ segments.push(current);
270
+ let result = obj;
271
+ for (const segment of segments) {
272
+ if (result === null || result === undefined)
273
+ return undefined;
274
+ if (typeof result !== 'object')
275
+ return undefined;
276
+ const index = parseInt(segment, 10);
277
+ if (!isNaN(index) && Array.isArray(result)) {
278
+ result = result[index];
279
+ }
280
+ else if (!Array.isArray(result)) {
281
+ result = result[segment];
282
+ }
283
+ else {
284
+ return undefined;
285
+ }
286
+ }
287
+ return result;
288
+ }
package/dist/index.d.ts CHANGED
@@ -44,7 +44,7 @@ export type { CollectNodeConfig, CollectedValues, CollectInputValue } from './au
44
44
  export type { ComposeWorkflowNodeConfig } from './automations/nodes/compose-workflow';
45
45
  export type { CreateDmNodeConfig, CreateDmMessage, DmPlatform, } from './automations/nodes/create-dm';
46
46
  export type { CustomModelNodeConfig, CustomModelOutputType, CustomModelInputParam, CustomModelParamType, OpenAPISchema, OpenAPIProperty, } from './automations/nodes/custom-model';
47
- export { mapOpenAPIType, parseOpenAPIInputs, parseOpenAPIOutputPath, getOutputTypeFromCategory, } from './automations/nodes/custom-model';
47
+ export { mapOpenAPIType, parseOpenAPIInputs, parseOpenAPIOutputPath, getOutputTypeFromCategory, resolveUnknownPath, } from './automations/nodes/custom-model';
48
48
  export type { DeduplicateNodeConfig } from './automations/nodes/deduplicate';
49
49
  export type { DestructureNodeConfig, DestructureNodeInputs, DestructureNodeOutputs, DestructureSelection, IndexExpression, } from './automations/nodes/destructure';
50
50
  export { indexExpressionToIndexes, resolvePath } from './automations/nodes/destructure';
package/dist/index.js CHANGED
@@ -6,7 +6,7 @@
6
6
  */
7
7
  Object.defineProperty(exports, "__esModule", { value: true });
8
8
  exports.extractWorkflowConfig = exports.generateNodeName = exports.shuffleNodePreview = exports.getPreviewValue = exports.removePreviewForConnection = exports.updatePreviewMapForConnection = exports.computePreviewMap = exports.computeAllNodePreviews = exports.resolveNodePreview = exports.getWorkflowOutputSchema = exports.hasMissingTerminalError = exports.hasMissingTriggerError = exports.getPortErrorsForNode = exports.getErrorNodeIds = exports.validateWorkflow = exports.checkCrossContextViolation = exports.getForEachContext = exports.getConnectedSource = exports.cleanupStaleConnections = exports.removeNodeConnections = exports.removeConnection = exports.addConnection = exports.deriveConnections = exports.createNode = exports.getOutputSchema = exports.getNodeByType = exports.getAllNodes = exports.getInputPreviewValue = exports.computeAllNodePortsWithPreviews = exports.computeAllNodePorts = exports.computePortsWithPreviews = exports.computePortsForNode = exports.areTypesCompatible = exports.submitIMessageDmRenderJob = exports.submitInstagramDmRenderJob = exports.submitAutoCaptionRenderJob = exports.submitScreenshotAnimationRenderJob = exports.submitDeduplicationJob = exports.getRenderJobStatus = exports.submitVideoRenderJob = exports.submitImageRenderJob = exports.CommentsClient = exports.MediaClient = exports.AutomationsClient = exports.OrganizationClient = exports.StatsClient = exports.PostsClient = exports.TasksClient = exports.AccountsClient = exports.UGCClient = void 0;
9
- exports.prepareVideoComposerInput = exports.LLMProviders = exports.IfLogicOperators = exports.resolvePath = exports.indexExpressionToIndexes = exports.getOutputTypeFromCategory = exports.parseOpenAPIOutputPath = exports.parseOpenAPIInputs = exports.mapOpenAPIType = exports.nodeConfigToCaptionStyle = exports.prepareImageComposerInput = exports.processTemplate = exports.extractTemplateVariables = exports.PortIdSchema = exports.normalizeToPortId = exports.portIdToTitle = exports.isValidPortId = exports.portId = exports.selectFromPool = exports.getModelDurations = exports.getModelAspectRatios = exports.ALL_VIDEO_MODELS = exports.isImageToVideoModel = exports.IMAGE_ASPECT_RATIOS = exports.ALL_IMAGE_MODELS = exports.isEditModel = exports.getNodeDefinition = exports.isPortType = exports.formatPortType = exports.isAsyncExecutor = exports.internalNodeTypes = exports.nodeDefinitions = void 0;
9
+ exports.prepareVideoComposerInput = exports.LLMProviders = exports.IfLogicOperators = exports.resolvePath = exports.indexExpressionToIndexes = exports.resolveUnknownPath = exports.getOutputTypeFromCategory = exports.parseOpenAPIOutputPath = exports.parseOpenAPIInputs = exports.mapOpenAPIType = exports.nodeConfigToCaptionStyle = exports.prepareImageComposerInput = exports.processTemplate = exports.extractTemplateVariables = exports.PortIdSchema = exports.normalizeToPortId = exports.portIdToTitle = exports.isValidPortId = exports.portId = exports.selectFromPool = exports.getModelDurations = exports.getModelAspectRatios = exports.ALL_VIDEO_MODELS = exports.isImageToVideoModel = exports.IMAGE_ASPECT_RATIOS = exports.ALL_IMAGE_MODELS = exports.isEditModel = exports.getNodeDefinition = exports.isPortType = exports.formatPortType = exports.isAsyncExecutor = exports.internalNodeTypes = exports.nodeDefinitions = void 0;
10
10
  // =============================================================================
11
11
  // Client Exports
12
12
  // =============================================================================
@@ -129,6 +129,7 @@ Object.defineProperty(exports, "mapOpenAPIType", { enumerable: true, get: functi
129
129
  Object.defineProperty(exports, "parseOpenAPIInputs", { enumerable: true, get: function () { return custom_model_1.parseOpenAPIInputs; } });
130
130
  Object.defineProperty(exports, "parseOpenAPIOutputPath", { enumerable: true, get: function () { return custom_model_1.parseOpenAPIOutputPath; } });
131
131
  Object.defineProperty(exports, "getOutputTypeFromCategory", { enumerable: true, get: function () { return custom_model_1.getOutputTypeFromCategory; } });
132
+ Object.defineProperty(exports, "resolveUnknownPath", { enumerable: true, get: function () { return custom_model_1.resolveUnknownPath; } });
132
133
  var destructure_1 = require("./automations/nodes/destructure");
133
134
  Object.defineProperty(exports, "indexExpressionToIndexes", { enumerable: true, get: function () { return destructure_1.indexExpressionToIndexes; } });
134
135
  Object.defineProperty(exports, "resolvePath", { enumerable: true, get: function () { return destructure_1.resolvePath; } });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ugcinc",
3
- "version": "4.1.60",
3
+ "version": "4.1.61",
4
4
  "description": "TypeScript/JavaScript client for the UGC Inc API",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",