@@ -6,14 +6,8 @@ import zodToJsonSchema from 'zod-to-json-schema';
66import log from '@apify/log' ;
77
88import { ApifyClient } from '../apify-client.js' ;
9- import { ACTOR_README_MAX_LENGTH , ADVANCED_INPUT_KEY , HelperTools } from '../const.js' ;
10- import type {
11- ActorDefinitionPruned ,
12- ActorDefinitionWithDesc ,
13- InternalTool ,
14- ISchemaProperties ,
15- ToolEntry ,
16- } from '../types.js' ;
9+ import { ACTOR_README_MAX_LENGTH , HelperTools } from '../const.js' ;
10+ import type { ActorDefinitionPruned , InternalTool , ISchemaProperties , ToolEntry } from '../types.js' ;
1711import { filterSchemaProperties , shortenProperties } from './utils.js' ;
1812
1913const ajv = new Ajv ( { coerceTypes : 'array' , strict : false } ) ;
@@ -31,7 +25,6 @@ export async function getActorDefinition(
3125 actorIdOrName : string ,
3226 apifyToken : string ,
3327 limit : number = ACTOR_README_MAX_LENGTH ,
34- fullActorSchema = true ,
3528) : Promise < ActorDefinitionPruned | null > {
3629 const client = new ApifyClient ( { token : apifyToken } ) ;
3730 const actorClient = client . actor ( actorIdOrName ) ;
@@ -47,7 +40,7 @@ export async function getActorDefinition(
4740 const buildDetails = await defaultBuildClient . get ( ) ;
4841
4942 if ( buildDetails ?. actorDefinition ) {
50- return processActorDefinition ( actor , buildDetails . actorDefinition , limit , fullActorSchema ) ;
43+ return processActorDefinition ( actor , buildDetails . actorDefinition , limit ) ;
5144 }
5245 return null ;
5346 } catch ( error ) {
@@ -60,7 +53,6 @@ export function processActorDefinition(
6053 actor : Actor ,
6154 definition : ActorDefinition ,
6255 limit : number ,
63- fullActorSchema : boolean ,
6456) : ActorDefinitionPruned {
6557 let input ;
6658 if ( definition ?. input && 'type' in definition . input && 'properties' in definition . input ) {
@@ -69,9 +61,6 @@ export function processActorDefinition(
6961 type : definition . input . type as string ,
7062 properties : definition . input . properties as Record < string , ISchemaProperties > ,
7163 } ;
72- if ( ! fullActorSchema ) {
73- input = separateAdvancedInputs ( input ) ;
74- }
7564 }
7665 return {
7766 id : actor . id ,
@@ -85,33 +74,6 @@ export function processActorDefinition(
8574 } ;
8675}
8776
88- function separateAdvancedInputs ( input : ActorDefinitionWithDesc [ 'input' ] ) : ActorDefinitionPruned [ 'input' ] {
89- if ( ! input || ! input . properties ) {
90- return input ;
91- }
92-
93- const properties = Object . entries ( input . properties ) ;
94- const firstSectionCaptionIndex = properties . findIndex ( ( [ _key , value ] ) => value . sectionCaption ) ;
95- if ( firstSectionCaptionIndex === - 1 ) {
96- // No advanced inputs, return the input as is
97- return input ;
98- }
99-
100- // Separate advanced inputs from the main section
101- const mainInputs = properties . slice ( 0 , firstSectionCaptionIndex ) ;
102- const advancedInputs = properties . slice ( firstSectionCaptionIndex ) ;
103-
104- const propObject = Object . fromEntries ( mainInputs ) ;
105- propObject [ ADVANCED_INPUT_KEY ] = {
106- type : 'object' ,
107- title : 'Advanced Inputs' ,
108- description : 'These inputs are considered advanced and are not required for basic functionality.' ,
109- properties : Object . fromEntries ( advancedInputs ) ,
110- } ;
111-
112- return { ...input , properties : propObject } ;
113- }
114-
11577/** Prune Actor README if it is too long
11678 * If the README is too long
11779 * - We keep the README as it is up to the limit.
0 commit comments