ugcinc 4.1.23 → 4.1.25

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.
@@ -28,16 +28,13 @@ const definition = (0, types_1.defineNode)({
28
28
  },
29
29
  ];
30
30
  const outputs = [];
31
+ // Get connected array info for type derivation
32
+ const connectedArray = getConnectedOutput?.('array');
33
+ const connectedSchema = connectedArray?.objectSchema;
31
34
  // Determine base type from connected input
32
35
  let baseType = 'object';
33
- if (getConnectedOutput) {
34
- const connectedOutput = getConnectedOutput('array');
35
- if (connectedOutput?.type && connectedOutput.isArray) {
36
- const connType = connectedOutput.type;
37
- if (!Array.isArray(connType)) {
38
- baseType = connType;
39
- }
40
- }
36
+ if (connectedArray?.type && !Array.isArray(connectedArray.type)) {
37
+ baseType = connectedArray.type;
41
38
  }
42
39
  for (const selection of selections) {
43
40
  // If variable, add input port for index expression
@@ -49,13 +46,35 @@ const definition = (0, types_1.defineNode)({
49
46
  required: true,
50
47
  });
51
48
  }
52
- // Output type depends on index expression:
53
- // - 'single' -> single item (isArray: false)
54
- // - 'range' or 'list' -> array of items (isArray: true)
55
- const outputIsArray = selection.indexExpr.type !== 'single';
49
+ // Derive type and isArray from selection settings + connected schema
50
+ let outputType = baseType;
51
+ let outputIsArray = selection.indexExpr.type !== 'single';
52
+ // If propertyPath is set and we have schema, derive type from property
53
+ if (selection.propertyPath && connectedSchema) {
54
+ const propSchema = connectedSchema.find(f => f.name === selection.propertyPath);
55
+ if (propSchema) {
56
+ if (propSchema.type === 'array') {
57
+ outputType = 'object';
58
+ outputIsArray = true;
59
+ }
60
+ else if (propSchema.type === 'object') {
61
+ outputType = 'object';
62
+ outputIsArray = false;
63
+ }
64
+ else {
65
+ // Primitive type (string -> text, number, boolean)
66
+ outputType = (propSchema.type === 'string' ? 'text' : propSchema.type);
67
+ outputIsArray = false;
68
+ }
69
+ }
70
+ }
71
+ // Variable input means output is always array (unknown indexes at config time)
72
+ if (selection.inputType === 'variable') {
73
+ outputIsArray = true;
74
+ }
56
75
  outputs.push({
57
76
  id: selection.portId,
58
- type: baseType,
77
+ type: outputType,
59
78
  isArray: outputIsArray,
60
79
  required: true,
61
80
  });
@@ -22,9 +22,9 @@ const definition = (0, types_1.defineNode)({
22
22
  const inputPorts = config?.inputPorts ?? [];
23
23
  const exposeItem = config?.exposeItem ?? false;
24
24
  const exposeIndex = config?.exposeIndex ?? false;
25
- // Inputs: array + passthrough inputs
25
+ // Inputs: array (accepts any array type) + passthrough inputs
26
26
  const inputs = [
27
- { id: 'array', type: 'object', isArray: false, required: true },
27
+ { id: 'array', type: ['image', 'video', 'audio', 'text', 'object', 'account', 'boolean', 'number'], isArray: true, required: true },
28
28
  ];
29
29
  for (const port of inputPorts) {
30
30
  inputs.push({
@@ -23,7 +23,7 @@ const definition = (0, types_1.defineNode)({
23
23
  outputMode: 'per-input',
24
24
  selectionMode: null,
25
25
  },
26
- computePorts: ({ config }) => {
26
+ computePorts: ({ config, getConnectedOutput }) => {
27
27
  const booleanInputs = config?.booleanInputs ?? [];
28
28
  const passthroughInputs = config?.passthroughInputs ?? [];
29
29
  const inputs = [];
@@ -35,8 +35,11 @@ const definition = (0, types_1.defineNode)({
35
35
  // Passthrough inputs and true/false outputs
36
36
  for (const passthrough of passthroughInputs) {
37
37
  inputs.push({ id: passthrough.id, type: passthrough.type, isArray: passthrough.isArray, required: true });
38
- outputs.push({ id: `true-${passthrough.id}`, type: passthrough.type, isArray: passthrough.isArray, required: true });
39
- outputs.push({ id: `false-${passthrough.id}`, type: passthrough.type, isArray: passthrough.isArray, required: true });
38
+ // Get schema from connected input to propagate to outputs
39
+ const connectedOutput = getConnectedOutput?.(passthrough.id);
40
+ const objectSchema = connectedOutput?.objectSchema;
41
+ outputs.push({ id: `true-${passthrough.id}`, type: passthrough.type, isArray: passthrough.isArray, required: true, objectSchema });
42
+ outputs.push({ id: `false-${passthrough.id}`, type: passthrough.type, isArray: passthrough.isArray, required: true, objectSchema });
40
43
  }
41
44
  return { inputs, outputs };
42
45
  },
@@ -15,14 +15,20 @@ const definition = (0, types_1.defineNode)({
15
15
  outputMode: null,
16
16
  selectionMode: null,
17
17
  },
18
- computePorts: ({ config }) => {
18
+ computePorts: ({ config, getConnectedOutput }) => {
19
19
  const configInputs = config?.inputs ?? [];
20
- const inputs = configInputs.map(input => ({
21
- id: input.id,
22
- type: input.type,
23
- isArray: input.isArray ?? false,
24
- required: false,
25
- }));
20
+ const inputs = configInputs.map(input => {
21
+ // Get objectSchema from connected output if available
22
+ const connectedOutput = getConnectedOutput?.(input.id);
23
+ const objectSchema = connectedOutput?.objectSchema ?? input.objectSchema;
24
+ return {
25
+ id: input.id,
26
+ type: input.type,
27
+ isArray: input.isArray ?? false,
28
+ required: false,
29
+ objectSchema,
30
+ };
31
+ });
26
32
  return {
27
33
  inputs,
28
34
  outputs: [],
@@ -20,7 +20,7 @@ const definition = (0, types_1.defineNode)({
20
20
  outputMode: 'single',
21
21
  selectionMode: null,
22
22
  },
23
- computePorts: ({ config }) => {
23
+ computePorts: ({ config, getConnectedOutput }) => {
24
24
  const branches = config?.branches ?? [];
25
25
  const passthroughInputs = config?.passthroughInputs ?? [];
26
26
  const inputs = [];
@@ -39,11 +39,15 @@ const definition = (0, types_1.defineNode)({
39
39
  // Output ports: {branch.id}-{passthrough.id} for each combination
40
40
  for (const branch of branches) {
41
41
  for (const passthrough of passthroughInputs) {
42
+ // Get schema from connected input to propagate to outputs
43
+ const connectedOutput = getConnectedOutput?.(passthrough.id);
44
+ const objectSchema = connectedOutput?.objectSchema;
42
45
  outputs.push({
43
46
  id: `${branch.id}-${passthrough.id}`,
44
47
  type: passthrough.type,
45
48
  isArray: passthrough.isArray ?? false,
46
49
  required: true,
50
+ objectSchema,
47
51
  });
48
52
  }
49
53
  }
package/dist/index.d.ts CHANGED
@@ -21,6 +21,7 @@ export { selectFromPool } from './automations/selection';
21
21
  export { portId, isValidPortId, portIdToTitle, normalizeToPortId, PortIdSchema } from './port-id';
22
22
  export type { PortId } from './port-id';
23
23
  export { extractTemplateVariables } from './internal-utils';
24
+ export type { InputType } from './automations/nodes/types';
24
25
  export type { ClientConfig } from './base';
25
26
  export type { Account, AccountStat, AccountTask, EditProfileInfo, GetAccountsParams, GetAccountStatsParams, GetAccountStatusParams, AccountInfoUpdate, UpdateAccountInfoParams, AccountInfoUpdateResult, UpdateAccountInfoResponse, AccountSocialUpdate, UpdateAccountSocialParams, AccountSocialUpdateResult, UpdateAccountSocialResponse, DeleteAccountPostsParams, DeleteAccountPostsResponse, ResetWarmupParams, ResetWarmupResponse, } from './accounts';
26
27
  export type { TaskType, Task, GetTasksParams } from './tasks';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ugcinc",
3
- "version": "4.1.23",
3
+ "version": "4.1.25",
4
4
  "description": "TypeScript/JavaScript client for the UGC Inc API",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",