ugcinc 4.1.53 → 4.1.55
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.
|
@@ -37,3 +37,12 @@ export type DestructureNodeConfig = typeof definition.defaults;
|
|
|
37
37
|
* Convert a structured IndexExpression to an array of indexes.
|
|
38
38
|
*/
|
|
39
39
|
export declare function indexExpressionToIndexes(expr: IndexExpression): number[];
|
|
40
|
+
/**
|
|
41
|
+
* Resolve a path within an object to get a nested value.
|
|
42
|
+
* Supports:
|
|
43
|
+
* - Simple property: "messages" -> obj.messages
|
|
44
|
+
* - Nested property: "data.items" -> obj.data.items
|
|
45
|
+
* - Array index: "[0]" -> obj[0]
|
|
46
|
+
* - Mixed: "acts[0].messages" -> obj.acts[0].messages
|
|
47
|
+
*/
|
|
48
|
+
export declare function resolvePath(obj: PortValue, path: string): PortValue | undefined;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.indexExpressionToIndexes = indexExpressionToIndexes;
|
|
4
|
+
exports.resolvePath = resolvePath;
|
|
4
5
|
const types_1 = require("./types");
|
|
5
6
|
// =============================================================================
|
|
6
7
|
// Node Definition
|
|
@@ -108,9 +109,7 @@ const definition = (0, types_1.defineNode)({
|
|
|
108
109
|
result[selection.portId] = null;
|
|
109
110
|
}
|
|
110
111
|
else if (selection.propertyPath) {
|
|
111
|
-
|
|
112
|
-
// For now, cast to access property - returns undefined if property doesn't exist
|
|
113
|
-
const value = item[selection.propertyPath];
|
|
112
|
+
const value = resolvePath(item, selection.propertyPath);
|
|
114
113
|
result[selection.portId] = value ?? null;
|
|
115
114
|
}
|
|
116
115
|
else {
|
|
@@ -125,8 +124,7 @@ const definition = (0, types_1.defineNode)({
|
|
|
125
124
|
if (item === undefined)
|
|
126
125
|
return undefined;
|
|
127
126
|
if (selection.propertyPath) {
|
|
128
|
-
|
|
129
|
-
return item[selection.propertyPath];
|
|
127
|
+
return resolvePath(item, selection.propertyPath);
|
|
130
128
|
}
|
|
131
129
|
return item;
|
|
132
130
|
})
|
|
@@ -161,3 +159,60 @@ function indexExpressionToIndexes(expr) {
|
|
|
161
159
|
return [];
|
|
162
160
|
}
|
|
163
161
|
}
|
|
162
|
+
/**
|
|
163
|
+
* Resolve a path within an object to get a nested value.
|
|
164
|
+
* Supports:
|
|
165
|
+
* - Simple property: "messages" -> obj.messages
|
|
166
|
+
* - Nested property: "data.items" -> obj.data.items
|
|
167
|
+
* - Array index: "[0]" -> obj[0]
|
|
168
|
+
* - Mixed: "acts[0].messages" -> obj.acts[0].messages
|
|
169
|
+
*/
|
|
170
|
+
function resolvePath(obj, path) {
|
|
171
|
+
if (!path || path.trim() === '')
|
|
172
|
+
return obj;
|
|
173
|
+
// Parse path into segments: "acts[0].messages" -> ["acts", "0", "messages"]
|
|
174
|
+
const segments = [];
|
|
175
|
+
let current = '';
|
|
176
|
+
for (const char of path) {
|
|
177
|
+
if (char === '.') {
|
|
178
|
+
if (current)
|
|
179
|
+
segments.push(current);
|
|
180
|
+
current = '';
|
|
181
|
+
}
|
|
182
|
+
else if (char === '[') {
|
|
183
|
+
if (current)
|
|
184
|
+
segments.push(current);
|
|
185
|
+
current = '';
|
|
186
|
+
}
|
|
187
|
+
else if (char === ']') {
|
|
188
|
+
if (current)
|
|
189
|
+
segments.push(current);
|
|
190
|
+
current = '';
|
|
191
|
+
}
|
|
192
|
+
else {
|
|
193
|
+
current += char;
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
if (current)
|
|
197
|
+
segments.push(current);
|
|
198
|
+
// Navigate through the object
|
|
199
|
+
let result = obj;
|
|
200
|
+
for (const segment of segments) {
|
|
201
|
+
if (result === null || result === undefined)
|
|
202
|
+
return undefined;
|
|
203
|
+
if (typeof result !== 'object')
|
|
204
|
+
return undefined;
|
|
205
|
+
// Check if segment is a number (array index)
|
|
206
|
+
const index = parseInt(segment, 10);
|
|
207
|
+
if (!isNaN(index) && Array.isArray(result)) {
|
|
208
|
+
result = result[index];
|
|
209
|
+
}
|
|
210
|
+
else if (!Array.isArray(result)) {
|
|
211
|
+
result = result[segment];
|
|
212
|
+
}
|
|
213
|
+
else {
|
|
214
|
+
return undefined;
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
return result;
|
|
218
|
+
}
|
package/dist/index.d.ts
CHANGED
|
@@ -45,8 +45,8 @@ export type { ComposeWorkflowNodeConfig } from './automations/nodes/compose-work
|
|
|
45
45
|
export type { CreateDmNodeConfig, CreateDmMessage, DmPlatform, } from './automations/nodes/create-dm';
|
|
46
46
|
export type { CustomModelNodeConfig, CustomModelOutputType, CustomModelInputParam, } from './automations/nodes/custom-model';
|
|
47
47
|
export type { DeduplicateNodeConfig } from './automations/nodes/deduplicate';
|
|
48
|
-
export type { DestructureNodeConfig, DestructureSelection, IndexExpression, } from './automations/nodes/destructure';
|
|
49
|
-
export { indexExpressionToIndexes } from './automations/nodes/destructure';
|
|
48
|
+
export type { DestructureNodeConfig, DestructureNodeInputs, DestructureNodeOutputs, DestructureSelection, IndexExpression, } from './automations/nodes/destructure';
|
|
49
|
+
export { indexExpressionToIndexes, resolvePath } from './automations/nodes/destructure';
|
|
50
50
|
export type { ForEachNodeConfig, ForEachNodeInputs, ForEachNodeOutputs, ForEachOutputProperty, } from './automations/nodes/for-each';
|
|
51
51
|
export type { GenerateImageNodeConfig, ImageGenerationTextModel, ImageGenerationEditModel, ImageGenerationModel, ImageModelProvider, ImageModelOption, AspectRatioOption, } from './automations/nodes/generate-image';
|
|
52
52
|
export type { GenerateVideoNodeConfig, VideoGenerationTextToVideoModel, VideoGenerationImageToVideoModel, VideoGenerationModel, VideoModelProvider, VideoModelTier, VideoAspectRatioOption, VideoDurationOption, VideoModelOption, } from './automations/nodes/generate-video';
|
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.indexExpressionToIndexes = 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.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
|
// =============================================================================
|
|
@@ -126,6 +126,7 @@ var auto_caption_1 = require("./automations/nodes/auto-caption");
|
|
|
126
126
|
Object.defineProperty(exports, "nodeConfigToCaptionStyle", { enumerable: true, get: function () { return auto_caption_1.nodeConfigToCaptionStyle; } });
|
|
127
127
|
var destructure_1 = require("./automations/nodes/destructure");
|
|
128
128
|
Object.defineProperty(exports, "indexExpressionToIndexes", { enumerable: true, get: function () { return destructure_1.indexExpressionToIndexes; } });
|
|
129
|
+
Object.defineProperty(exports, "resolvePath", { enumerable: true, get: function () { return destructure_1.resolvePath; } });
|
|
129
130
|
var if_1 = require("./automations/nodes/if");
|
|
130
131
|
Object.defineProperty(exports, "IfLogicOperators", { enumerable: true, get: function () { return if_1.IfLogicOperators; } });
|
|
131
132
|
var llm_1 = require("./automations/nodes/llm");
|