apify-cli 0.17.0 → 0.18.0-beta.1

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.
package/README.md CHANGED
@@ -299,7 +299,7 @@ USAGE
299
299
  $ apify actor
300
300
  ```
301
301
 
302
- _See code: [src/commands/actor/index.js](https://github.com/apify/apify-cli/blob/v0.17.0/src/commands/actor/index.js)_
302
+ _See code: [src/commands/actor/index.js](https://github.com/apify/apify-cli/blob/v0.18.0/src/commands/actor/index.js)_
303
303
 
304
304
  ## `apify actor:get-input`
305
305
 
@@ -310,7 +310,7 @@ USAGE
310
310
  $ apify actor:get-input
311
311
  ```
312
312
 
313
- _See code: [src/commands/actor/get-input.js](https://github.com/apify/apify-cli/blob/v0.17.0/src/commands/actor/get-input.js)_
313
+ _See code: [src/commands/actor/get-input.js](https://github.com/apify/apify-cli/blob/v0.18.0/src/commands/actor/get-input.js)_
314
314
 
315
315
  ## `apify actor:get-value KEY`
316
316
 
@@ -324,7 +324,7 @@ ARGUMENTS
324
324
  KEY Key of the record in key-value store
325
325
  ```
326
326
 
327
- _See code: [src/commands/actor/get-value.js](https://github.com/apify/apify-cli/blob/v0.17.0/src/commands/actor/get-value.js)_
327
+ _See code: [src/commands/actor/get-value.js](https://github.com/apify/apify-cli/blob/v0.18.0/src/commands/actor/get-value.js)_
328
328
 
329
329
  ## `apify actor:push-data [ITEM]`
330
330
 
@@ -345,7 +345,7 @@ DESCRIPTION
345
345
  $ cat ./test.json | apify actor:push-data
346
346
  ```
347
347
 
348
- _See code: [src/commands/actor/push-data.js](https://github.com/apify/apify-cli/blob/v0.17.0/src/commands/actor/push-data.js)_
348
+ _See code: [src/commands/actor/push-data.js](https://github.com/apify/apify-cli/blob/v0.18.0/src/commands/actor/push-data.js)_
349
349
 
350
350
  ## `apify actor:set-value KEY [VALUE]`
351
351
 
@@ -375,7 +375,7 @@ DESCRIPTION
375
375
  $ cat ./my-text-file.txt | apify actor:set-value KEY --contentType text/plain
376
376
  ```
377
377
 
378
- _See code: [src/commands/actor/set-value.js](https://github.com/apify/apify-cli/blob/v0.17.0/src/commands/actor/set-value.js)_
378
+ _See code: [src/commands/actor/set-value.js](https://github.com/apify/apify-cli/blob/v0.18.0/src/commands/actor/set-value.js)_
379
379
 
380
380
  ## `apify call [ACTID]`
381
381
 
@@ -400,7 +400,7 @@ DESCRIPTION
400
400
  takes input for the Actor from the default local key-value store by default.
401
401
  ```
402
402
 
403
- _See code: [src/commands/call.js](https://github.com/apify/apify-cli/blob/v0.17.0/src/commands/call.js)_
403
+ _See code: [src/commands/call.js](https://github.com/apify/apify-cli/blob/v0.18.0/src/commands/call.js)_
404
404
 
405
405
  ## `apify create [ACTORNAME]`
406
406
 
@@ -422,7 +422,7 @@ OPTIONS
422
422
  --skip-dependency-install Skip installing actor dependencies.
423
423
  ```
424
424
 
425
- _See code: [src/commands/create.js](https://github.com/apify/apify-cli/blob/v0.17.0/src/commands/create.js)_
425
+ _See code: [src/commands/create.js](https://github.com/apify/apify-cli/blob/v0.18.0/src/commands/create.js)_
426
426
 
427
427
  ## `apify info`
428
428
 
@@ -436,7 +436,7 @@ DESCRIPTION
436
436
  The information is printed to the console.
437
437
  ```
438
438
 
439
- _See code: [src/commands/info.js](https://github.com/apify/apify-cli/blob/v0.17.0/src/commands/info.js)_
439
+ _See code: [src/commands/info.js](https://github.com/apify/apify-cli/blob/v0.18.0/src/commands/info.js)_
440
440
 
441
441
  ## `apify init [ACTORNAME]`
442
442
 
@@ -456,7 +456,7 @@ DESCRIPTION
456
456
  WARNING: The directory at "storage" will be overwritten if it already exists.
457
457
  ```
458
458
 
459
- _See code: [src/commands/init.js](https://github.com/apify/apify-cli/blob/v0.17.0/src/commands/init.js)_
459
+ _See code: [src/commands/init.js](https://github.com/apify/apify-cli/blob/v0.18.0/src/commands/init.js)_
460
460
 
461
461
  ## `apify login`
462
462
 
@@ -474,7 +474,7 @@ DESCRIPTION
474
474
  "apify" commands. To log out, call "apify logout".
475
475
  ```
476
476
 
477
- _See code: [src/commands/login.js](https://github.com/apify/apify-cli/blob/v0.17.0/src/commands/login.js)_
477
+ _See code: [src/commands/login.js](https://github.com/apify/apify-cli/blob/v0.18.0/src/commands/login.js)_
478
478
 
479
479
  ## `apify logout`
480
480
 
@@ -489,7 +489,7 @@ DESCRIPTION
489
489
  call "apify login".
490
490
  ```
491
491
 
492
- _See code: [src/commands/logout.js](https://github.com/apify/apify-cli/blob/v0.17.0/src/commands/logout.js)_
492
+ _See code: [src/commands/logout.js](https://github.com/apify/apify-cli/blob/v0.18.0/src/commands/logout.js)_
493
493
 
494
494
  ## `apify pull [ACTORID]`
495
495
 
@@ -507,7 +507,7 @@ OPTIONS
507
507
  -v, --version=version Actor version number which will be pulled, e.g. 1.2. Default: the highest version
508
508
  ```
509
509
 
510
- _See code: [src/commands/pull.js](https://github.com/apify/apify-cli/blob/v0.17.0/src/commands/pull.js)_
510
+ _See code: [src/commands/pull.js](https://github.com/apify/apify-cli/blob/v0.18.0/src/commands/pull.js)_
511
511
 
512
512
  ## `apify push [ACTORID]`
513
513
 
@@ -545,7 +545,7 @@ DESCRIPTION
545
545
  WARNING: If the target Actor already exists in your Apify account, it will be overwritten!
546
546
  ```
547
547
 
548
- _See code: [src/commands/push.js](https://github.com/apify/apify-cli/blob/v0.17.0/src/commands/push.js)_
548
+ _See code: [src/commands/push.js](https://github.com/apify/apify-cli/blob/v0.18.0/src/commands/push.js)_
549
549
 
550
550
  ## `apify run`
551
551
 
@@ -575,7 +575,7 @@ DESCRIPTION
575
575
  package.json file. You can set up your own main file or environment variables by changing it.
576
576
  ```
577
577
 
578
- _See code: [src/commands/run.js](https://github.com/apify/apify-cli/blob/v0.17.0/src/commands/run.js)_
578
+ _See code: [src/commands/run.js](https://github.com/apify/apify-cli/blob/v0.18.0/src/commands/run.js)_
579
579
 
580
580
  ## `apify secrets`
581
581
 
@@ -603,7 +603,7 @@ DESCRIPTION
603
603
  of the actor.
604
604
  ```
605
605
 
606
- _See code: [src/commands/secrets/index.js](https://github.com/apify/apify-cli/blob/v0.17.0/src/commands/secrets/index.js)_
606
+ _See code: [src/commands/secrets/index.js](https://github.com/apify/apify-cli/blob/v0.18.0/src/commands/secrets/index.js)_
607
607
 
608
608
  ## `apify secrets:add NAME VALUE`
609
609
 
@@ -621,7 +621,7 @@ DESCRIPTION
621
621
  The secrets are stored to a file at ~/.apify
622
622
  ```
623
623
 
624
- _See code: [src/commands/secrets/add.js](https://github.com/apify/apify-cli/blob/v0.17.0/src/commands/secrets/add.js)_
624
+ _See code: [src/commands/secrets/add.js](https://github.com/apify/apify-cli/blob/v0.18.0/src/commands/secrets/add.js)_
625
625
 
626
626
  ## `apify secrets:rm NAME`
627
627
 
@@ -635,7 +635,7 @@ ARGUMENTS
635
635
  NAME Name of the secret
636
636
  ```
637
637
 
638
- _See code: [src/commands/secrets/rm.js](https://github.com/apify/apify-cli/blob/v0.17.0/src/commands/secrets/rm.js)_
638
+ _See code: [src/commands/secrets/rm.js](https://github.com/apify/apify-cli/blob/v0.18.0/src/commands/secrets/rm.js)_
639
639
 
640
640
  ## `apify vis [PATH]`
641
641
 
@@ -659,5 +659,5 @@ DESCRIPTION
659
659
  You can also pass any custom path to your input schema to have it validated instead.
660
660
  ```
661
661
 
662
- _See code: [src/commands/vis.js](https://github.com/apify/apify-cli/blob/v0.17.0/src/commands/vis.js)_
662
+ _See code: [src/commands/vis.js](https://github.com/apify/apify-cli/blob/v0.18.0/src/commands/vis.js)_
663
663
  <!-- commandsstop -->
@@ -1,17 +1,17 @@
1
1
  {
2
2
  "name": "apify-cli",
3
- "version": "0.17.0",
3
+ "version": "0.18.0",
4
4
  "lockfileVersion": 2,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "apify-cli",
9
- "version": "0.17.0",
9
+ "version": "0.18.0",
10
10
  "hasInstallScript": true,
11
11
  "license": "Apache-2.0",
12
12
  "dependencies": {
13
13
  "@apify/actor-templates": "^0.1.3",
14
- "@apify/consts": "^2.7.0",
14
+ "@apify/consts": "^2.20.0",
15
15
  "@apify/input_schema": "^3.3.0",
16
16
  "@apify/utilities": "^2.2.3",
17
17
  "@crawlee/memory-storage": "^3.0.3",
@@ -72,9 +72,9 @@
72
72
  "integrity": "sha512-sEASkPNvZ2ZWqSyUftJYhZo5EyWOqSnuVyQOzNDzvnYqN7Ev/H4f4tHas84BxWRdI8GPsIXLnArg0p4b6QrhJw=="
73
73
  },
74
74
  "node_modules/@apify/consts": {
75
- "version": "2.9.0",
76
- "resolved": "https://registry.npmjs.org/@apify/consts/-/consts-2.9.0.tgz",
77
- "integrity": "sha512-ylMcpzFlYKX0a1vpGf8oHH3nXNUvuoQikQ6Czi3S3uN9pVeXuup+0tNNzSeLNHMnAygxGpOPXGonPZtb7JzJ3Q=="
75
+ "version": "2.20.0",
76
+ "resolved": "https://registry.npmjs.org/@apify/consts/-/consts-2.20.0.tgz",
77
+ "integrity": "sha512-1vvMsSN2WG7b4zMLMj/LI6PIT94XH4Nr15mizEe+qi8xob5Y+g5LxOBR4qQQ1GlunsGBlrXo0v3dWMcVd4lRLQ=="
78
78
  },
79
79
  "node_modules/@apify/eslint-config": {
80
80
  "version": "0.2.4",
@@ -8151,9 +8151,9 @@
8151
8151
  "integrity": "sha512-sEASkPNvZ2ZWqSyUftJYhZo5EyWOqSnuVyQOzNDzvnYqN7Ev/H4f4tHas84BxWRdI8GPsIXLnArg0p4b6QrhJw=="
8152
8152
  },
8153
8153
  "@apify/consts": {
8154
- "version": "2.9.0",
8155
- "resolved": "https://registry.npmjs.org/@apify/consts/-/consts-2.9.0.tgz",
8156
- "integrity": "sha512-ylMcpzFlYKX0a1vpGf8oHH3nXNUvuoQikQ6Czi3S3uN9pVeXuup+0tNNzSeLNHMnAygxGpOPXGonPZtb7JzJ3Q=="
8154
+ "version": "2.20.0",
8155
+ "resolved": "https://registry.npmjs.org/@apify/consts/-/consts-2.20.0.tgz",
8156
+ "integrity": "sha512-1vvMsSN2WG7b4zMLMj/LI6PIT94XH4Nr15mizEe+qi8xob5Y+g5LxOBR4qQQ1GlunsGBlrXo0v3dWMcVd4lRLQ=="
8157
8157
  },
8158
8158
  "@apify/eslint-config": {
8159
8159
  "version": "0.2.4",
@@ -1 +1 @@
1
- {"version":"0.17.0","commands":{"call":{"id":"call","description":"Runs a specific actor remotely on the Apify cloud platform.\nThe Actor is run under your current Apify account. Therefore you need to be logged in by calling \"apify login\". It takes input for the Actor from the default local key-value store by default.","pluginName":"apify-cli","pluginType":"core","aliases":[],"flags":{"build":{"name":"build","type":"option","char":"b","description":"Tag or number of the build to run (e.g. \"latest\" or \"1.2.34\").","required":false},"timeout":{"name":"timeout","type":"option","char":"t","description":"Timeout for the actor run in seconds. Zero value means there is no timeout.","required":false},"memory":{"name":"memory","type":"option","char":"m","description":"Amount of memory allocated for the actor run, in megabytes.","required":false},"wait-for-finish":{"name":"wait-for-finish","type":"option","char":"w","description":"Seconds for waiting to run to finish, if no value passed, it waits forever.","required":false}},"args":[{"name":"actId","description":"Name or ID of the actor to run (e.g. \"apify/hello-world\" or \"E2jjCZBezvAZnX8Rb\"). If not provided, the command runs the remote actor specified in the \".actor/actor.json\" file.","required":false}]},"check-version":{"id":"check-version","description":"Checks that installed Apify CLI version is up to date.","pluginName":"apify-cli","pluginType":"core","hidden":true,"aliases":["cv"],"flags":{"enforce-update":{"name":"enforce-update","type":"boolean","char":"e","description":"[Optional] Enforce version update from NPM","required":false,"allowNo":false}},"args":[]},"create":{"id":"create","description":"Creates a new actor project directory from a selected boilerplate template.","pluginName":"apify-cli","pluginType":"core","aliases":[],"flags":{"template":{"name":"template","type":"option","char":"t","description":"Template for the actor. If not provided, the command will prompt for it.\nVisit https://raw.githubusercontent.com/apify/actor-templates/master/templates/manifest.json to find available template names.","required":false},"skip-dependency-install":{"name":"skip-dependency-install","type":"boolean","description":"Skip installing actor dependencies.","required":false,"allowNo":false},"template-archive-url":{"name":"template-archive-url","type":"option","description":"Actor template archive url. Useful for developing new templates.","hidden":true,"required":false}},"args":[{"name":"actorName","description":"Name of the actor and its directory","required":false}]},"edit-input-schema":{"id":"edit-input-schema","description":"Lets you edit your input schema that would be used on the platform in a visual input schema editor.","pluginName":"apify-cli","pluginType":"core","hidden":true,"aliases":["eis"],"flags":{},"args":[{"name":"path","description":"Optional path to your INPUT_SCHEMA.json file. If not provided default platform location for input schema is used.","required":false}]},"info":{"id":"info","description":"Displays information about the currently active Apify account.\nThe information is printed to the console.","pluginName":"apify-cli","pluginType":"core","aliases":[],"flags":{},"args":[]},"init":{"id":"init","description":"Initializes a new actor project in an existing directory.\nThe command only creates the \".actor/actor.json\" file and the \"storage\" directory in the current directory, but will not touch anything else.\n\nWARNING: The directory at \"storage\" will be overwritten if it already exists.","pluginName":"apify-cli","pluginType":"core","aliases":[],"flags":{},"args":[{"name":"actorName","description":"Name of the actor. If not provided, you will be prompted for it.","required":false}]},"login-new":{"id":"login-new","description":"Logs in to your Apify account using your API token.\nThe API token and other account information is stored in the ~/.apify directory, from where it is read by all other \"apify\" commands. To log out, call \"apify logout\".","pluginName":"apify-cli","pluginType":"core","hidden":true,"aliases":[],"flags":{"token":{"name":"token","type":"option","char":"t","description":"[Optional] Apify API token","required":false}},"args":[]},"login":{"id":"login","description":"Logs in to your Apify account using a provided API token.\nThe API token and other account information is stored in the ~/.apify directory, from where it is read by all other \"apify\" commands. To log out, call \"apify logout\".","pluginName":"apify-cli","pluginType":"core","aliases":[],"flags":{"token":{"name":"token","type":"option","char":"t","description":"[Optional] Apify API token","required":false}},"args":[]},"logout":{"id":"logout","description":"Logs out of your Apify account.\nThe command deletes the API token and all other account information stored in the ~/.apify directory. To log in again, call \"apify login\".","pluginName":"apify-cli","pluginType":"core","aliases":[],"flags":{},"args":[]},"pull":{"id":"pull","description":"Pulls an Actor from the Apify platform to the current directory. If it is defined as Git repository, it will be cloned. If it is defined as Web IDE, it will fetch the files.","pluginName":"apify-cli","pluginType":"core","aliases":[],"flags":{"version":{"name":"version","type":"option","char":"v","description":"Actor version number which will be pulled, e.g. 1.2. Default: the highest version","required":false}},"args":[{"name":"actorId","description":"Name or ID of the actor to run (e.g. \"apify/hello-world\" or \"E2jjCZBezvAZnX8Rb\"). If not provided, the command will update the Actor in the current directory based on its name in \".actor/actor.json\" file.","required":false}]},"push":{"id":"push","description":"Uploads the actor to the Apify platform and builds it there.\nThe Actor settings are read from the \".actor/actor.json\" file in the current directory, but they can be overridden using command-line options.\nNOTE: If the source files are smaller than 3 MB then they are uploaded as \n\"Multiple source files\", otherwise they are uploaded as \"Zip file\".\n\nWARNING: If the target Actor already exists in your Apify account, it will be overwritten!","pluginName":"apify-cli","pluginType":"core","aliases":[],"flags":{"version-number":{"name":"version-number","type":"option","description":"DEPRECATED: Use flag version instead. Actor version number to which the files should be pushed. By default, it is taken from the \".actor/actor.json\" file.","required":false},"version":{"name":"version","type":"option","char":"v","description":"Actor version number to which the files should be pushed. By default, it is taken from the \".actor/actor.json\" file.","required":false},"build-tag":{"name":"build-tag","type":"option","char":"b","description":"Build tag to be applied to the successful Actor build. By default, it is taken from the \".actor/actor.json\" file","required":false},"wait-for-finish":{"name":"wait-for-finish","type":"option","char":"w","description":"Seconds for waiting to build to finish, if no value passed, it waits forever.","required":false},"no-prompt":{"name":"no-prompt","type":"boolean","description":"Do not prompt for opening the actor details in a browser. This will also not open the browser automatically.","required":false,"allowNo":false}},"args":[{"name":"actorId","description":"Name or ID of the Actor to push (e.g. \"apify/hello-world\" or \"E2jjCZBezvAZnX8Rb\"). If not provided, the command will create or modify the actor with the name specified in \".actor/actor.json\" file.","required":false}]},"run":{"id":"run","description":"Runs the actor locally in the current directory.\nIt sets various APIFY_XYZ environment variables in order to provide a working execution environment for the actor. For example, this causes the actor input, as well as all other data in key-value stores, datasets or request queues to be stored in the \"storage\" directory, rather than on the Apify platform.\n\nNOTE: You can override the command's default behavior for Node.js actors by overriding the \"start\" script in the package.json file. You can set up your own main file or environment variables by changing it.","pluginName":"apify-cli","pluginType":"core","aliases":[],"flags":{"purge":{"name":"purge","type":"boolean","char":"p","description":"Shortcut that combines the --purge-queue, --purge-dataset and --purge-key-value-store options.","required":false,"allowNo":false},"purge-queue":{"name":"purge-queue","type":"boolean","description":"Deletes the local directory containing the default request queue before the run starts.","required":false,"allowNo":false},"purge-dataset":{"name":"purge-dataset","type":"boolean","description":"Deletes the local directory containing the default dataset before the run starts.","required":false,"allowNo":false},"purge-key-value-store":{"name":"purge-key-value-store","type":"boolean","description":"Deletes all records from the default key-value store in the local directory before the run starts, except for the \"INPUT\" key.","required":false,"allowNo":false}},"args":[]},"vis":{"id":"vis","description":"Validates input schema and prints errors found.\nThe input schema for the actor is used from these locations in order of preference.\nThe first one found is validated as it would be the one used on the Apify platform.\n1. Directly embedded object in \".actor/actor.json\" under 'input' key\n2. Path to JSON file referenced in \".actor/actor.json\" under 'input' key\n3. JSON file at .actor/INPUT_SCHEMA.json\n4. JSON file at INPUT_SCHEMA.json\n\nYou can also pass any custom path to your input schema to have it validated instead.\n","pluginName":"apify-cli","pluginType":"core","aliases":[],"flags":{},"args":[{"name":"path","description":"Optional path to your INPUT_SCHEMA.json file. If not provided ./INPUT_SCHEMA.json is used.","required":false}]},"actor:get-input":{"id":"actor:get-input","description":"Gets the actor input value from the default key-value store associated with the actor run.","pluginName":"apify-cli","pluginType":"core","aliases":[],"flags":{},"args":[]},"actor:get-value":{"id":"actor:get-value","description":"Gets a value from the default key-value store associated with the actor run.","pluginName":"apify-cli","pluginType":"core","aliases":[],"flags":{},"args":[{"name":"key","description":"Key of the record in key-value store","required":true}]},"actor":{"id":"actor","description":"Commands are designed to be used in actor runs. All commands are in PoC state, do not use in production environments.\n","pluginName":"apify-cli","pluginType":"core","aliases":[],"flags":{},"args":[]},"actor:push-data":{"id":"actor:push-data","description":"Stores an object or an array of objects to the default dataset of the actor run.\nIt is possible to pass data using item argument or stdin.\nPassing data using argument:\n$ apify actor:push-data {\"foo\": \"bar\"}\nPassing data using stdin with pipe:\n$ cat ./test.json | apify actor:push-data\n","pluginName":"apify-cli","pluginType":"core","aliases":[],"flags":{},"args":[{"name":"item","description":"JSON string with one object or array of objects containing data to be stored in the default dataset.","required":false}]},"actor:set-value":{"id":"actor:set-value","description":"Sets or removes record into the default KeyValueStore associated with the actor run.\nIt is possible to pass data using argument or stdin.\nPassing data using argument:\n$ apify actor:set-value KEY my-value\nPassing data using stdin with pipe:\n$ cat ./my-text-file.txt | apify actor:set-value KEY --contentType text/plain\n","pluginName":"apify-cli","pluginType":"core","aliases":[],"flags":{"contentType":{"name":"contentType","type":"option","char":"c","description":"Specifies a custom MIME content type of the record. By default \"application/json\" is used.","required":false}},"args":[{"name":"key","description":"Key of the record in key-value store.","required":true},{"name":"value","description":"Record data, which can be one of the following values:\n- If empty, the record in the key-value store is deleted.\n- If no `contentType` flag is specified, value is expected to be any JSON string value.\n- If options.contentType is set, value is taken as is.","required":false}]},"secrets:add":{"id":"secrets:add","description":"Adds a new secret value.\nThe secrets are stored to a file at ~/.apify","pluginName":"apify-cli","pluginType":"core","aliases":[],"flags":{},"args":[{"name":"name","description":"Name of the secret","required":true},{"name":"value","description":"Value of the secret","required":true}]},"secrets":{"id":"secrets","description":"Manages secret values for actor environment variables.\n\nExample:\n$ apify secrets:add mySecret TopSecretValue123\n\nNow the \"mySecret\" value can be used in an environment variable defined in \".actor/actor.json\" file by adding the \"@\" prefix:\n\n{\n \"actorSpecification\": 1,\n \"name\": \"my_actor\",\n \"environmentVariables\": { \"SECRET_ENV_VAR\": \"@mySecret\" },\n \"version\": \"0.1\n}\n\nWhen the actor is pushed to Apify cloud, the \"SECRET_ENV_VAR\" and its value is stored as a secret environment variable of the actor.","pluginName":"apify-cli","pluginType":"core","aliases":[],"flags":{},"args":[]},"secrets:rm":{"id":"secrets:rm","description":"Removes the secret.","pluginName":"apify-cli","pluginType":"core","aliases":[],"flags":{},"args":[{"name":"name","description":"Name of the secret","required":true}]}}}
1
+ {"version":"0.18.0","commands":{"call":{"id":"call","description":"Runs a specific actor remotely on the Apify cloud platform.\nThe Actor is run under your current Apify account. Therefore you need to be logged in by calling \"apify login\". It takes input for the Actor from the default local key-value store by default.","pluginName":"apify-cli","pluginType":"core","aliases":[],"flags":{"build":{"name":"build","type":"option","char":"b","description":"Tag or number of the build to run (e.g. \"latest\" or \"1.2.34\").","required":false},"timeout":{"name":"timeout","type":"option","char":"t","description":"Timeout for the actor run in seconds. Zero value means there is no timeout.","required":false},"memory":{"name":"memory","type":"option","char":"m","description":"Amount of memory allocated for the actor run, in megabytes.","required":false},"wait-for-finish":{"name":"wait-for-finish","type":"option","char":"w","description":"Seconds for waiting to run to finish, if no value passed, it waits forever.","required":false}},"args":[{"name":"actId","description":"Name or ID of the actor to run (e.g. \"apify/hello-world\" or \"E2jjCZBezvAZnX8Rb\"). If not provided, the command runs the remote actor specified in the \".actor/actor.json\" file.","required":false}]},"check-version":{"id":"check-version","description":"Checks that installed Apify CLI version is up to date.","pluginName":"apify-cli","pluginType":"core","hidden":true,"aliases":["cv"],"flags":{"enforce-update":{"name":"enforce-update","type":"boolean","char":"e","description":"[Optional] Enforce version update from NPM","required":false,"allowNo":false}},"args":[]},"create":{"id":"create","description":"Creates a new actor project directory from a selected boilerplate template.","pluginName":"apify-cli","pluginType":"core","aliases":[],"flags":{"template":{"name":"template","type":"option","char":"t","description":"Template for the actor. If not provided, the command will prompt for it.\nVisit https://raw.githubusercontent.com/apify/actor-templates/master/templates/manifest.json to find available template names.","required":false},"skip-dependency-install":{"name":"skip-dependency-install","type":"boolean","description":"Skip installing actor dependencies.","required":false,"allowNo":false},"template-archive-url":{"name":"template-archive-url","type":"option","description":"Actor template archive url. Useful for developing new templates.","hidden":true,"required":false}},"args":[{"name":"actorName","description":"Name of the actor and its directory","required":false}]},"edit-input-schema":{"id":"edit-input-schema","description":"Lets you edit your input schema that would be used on the platform in a visual input schema editor.","pluginName":"apify-cli","pluginType":"core","hidden":true,"aliases":["eis"],"flags":{},"args":[{"name":"path","description":"Optional path to your INPUT_SCHEMA.json file. If not provided default platform location for input schema is used.","required":false}]},"info":{"id":"info","description":"Displays information about the currently active Apify account.\nThe information is printed to the console.","pluginName":"apify-cli","pluginType":"core","aliases":[],"flags":{},"args":[]},"init":{"id":"init","description":"Initializes a new actor project in an existing directory.\nThe command only creates the \".actor/actor.json\" file and the \"storage\" directory in the current directory, but will not touch anything else.\n\nWARNING: The directory at \"storage\" will be overwritten if it already exists.","pluginName":"apify-cli","pluginType":"core","aliases":[],"flags":{},"args":[{"name":"actorName","description":"Name of the actor. If not provided, you will be prompted for it.","required":false}]},"login-new":{"id":"login-new","description":"Logs in to your Apify account using your API token.\nThe API token and other account information is stored in the ~/.apify directory, from where it is read by all other \"apify\" commands. To log out, call \"apify logout\".","pluginName":"apify-cli","pluginType":"core","hidden":true,"aliases":[],"flags":{"token":{"name":"token","type":"option","char":"t","description":"[Optional] Apify API token","required":false}},"args":[]},"login":{"id":"login","description":"Logs in to your Apify account using a provided API token.\nThe API token and other account information is stored in the ~/.apify directory, from where it is read by all other \"apify\" commands. To log out, call \"apify logout\".","pluginName":"apify-cli","pluginType":"core","aliases":[],"flags":{"token":{"name":"token","type":"option","char":"t","description":"[Optional] Apify API token","required":false}},"args":[]},"logout":{"id":"logout","description":"Logs out of your Apify account.\nThe command deletes the API token and all other account information stored in the ~/.apify directory. To log in again, call \"apify login\".","pluginName":"apify-cli","pluginType":"core","aliases":[],"flags":{},"args":[]},"pull":{"id":"pull","description":"Pulls an Actor from the Apify platform to the current directory. If it is defined as Git repository, it will be cloned. If it is defined as Web IDE, it will fetch the files.","pluginName":"apify-cli","pluginType":"core","aliases":[],"flags":{"version":{"name":"version","type":"option","char":"v","description":"Actor version number which will be pulled, e.g. 1.2. Default: the highest version","required":false}},"args":[{"name":"actorId","description":"Name or ID of the actor to run (e.g. \"apify/hello-world\" or \"E2jjCZBezvAZnX8Rb\"). If not provided, the command will update the Actor in the current directory based on its name in \".actor/actor.json\" file.","required":false}]},"push":{"id":"push","description":"Uploads the actor to the Apify platform and builds it there.\nThe Actor settings are read from the \".actor/actor.json\" file in the current directory, but they can be overridden using command-line options.\nNOTE: If the source files are smaller than 3 MB then they are uploaded as \n\"Multiple source files\", otherwise they are uploaded as \"Zip file\".\n\nWARNING: If the target Actor already exists in your Apify account, it will be overwritten!","pluginName":"apify-cli","pluginType":"core","aliases":[],"flags":{"version-number":{"name":"version-number","type":"option","description":"DEPRECATED: Use flag version instead. Actor version number to which the files should be pushed. By default, it is taken from the \".actor/actor.json\" file.","required":false},"version":{"name":"version","type":"option","char":"v","description":"Actor version number to which the files should be pushed. By default, it is taken from the \".actor/actor.json\" file.","required":false},"build-tag":{"name":"build-tag","type":"option","char":"b","description":"Build tag to be applied to the successful Actor build. By default, it is taken from the \".actor/actor.json\" file","required":false},"wait-for-finish":{"name":"wait-for-finish","type":"option","char":"w","description":"Seconds for waiting to build to finish, if no value passed, it waits forever.","required":false},"no-prompt":{"name":"no-prompt","type":"boolean","description":"Do not prompt for opening the actor details in a browser. This will also not open the browser automatically.","required":false,"allowNo":false}},"args":[{"name":"actorId","description":"Name or ID of the Actor to push (e.g. \"apify/hello-world\" or \"E2jjCZBezvAZnX8Rb\"). If not provided, the command will create or modify the actor with the name specified in \".actor/actor.json\" file.","required":false}]},"run":{"id":"run","description":"Runs the actor locally in the current directory.\nIt sets various APIFY_XYZ environment variables in order to provide a working execution environment for the actor. For example, this causes the actor input, as well as all other data in key-value stores, datasets or request queues to be stored in the \"storage\" directory, rather than on the Apify platform.\n\nNOTE: You can override the command's default behavior for Node.js actors by overriding the \"start\" script in the package.json file. You can set up your own main file or environment variables by changing it.","pluginName":"apify-cli","pluginType":"core","aliases":[],"flags":{"purge":{"name":"purge","type":"boolean","char":"p","description":"Shortcut that combines the --purge-queue, --purge-dataset and --purge-key-value-store options.","required":false,"allowNo":false},"purge-queue":{"name":"purge-queue","type":"boolean","description":"Deletes the local directory containing the default request queue before the run starts.","required":false,"allowNo":false},"purge-dataset":{"name":"purge-dataset","type":"boolean","description":"Deletes the local directory containing the default dataset before the run starts.","required":false,"allowNo":false},"purge-key-value-store":{"name":"purge-key-value-store","type":"boolean","description":"Deletes all records from the default key-value store in the local directory before the run starts, except for the \"INPUT\" key.","required":false,"allowNo":false}},"args":[]},"vis":{"id":"vis","description":"Validates input schema and prints errors found.\nThe input schema for the actor is used from these locations in order of preference.\nThe first one found is validated as it would be the one used on the Apify platform.\n1. Directly embedded object in \".actor/actor.json\" under 'input' key\n2. Path to JSON file referenced in \".actor/actor.json\" under 'input' key\n3. JSON file at .actor/INPUT_SCHEMA.json\n4. JSON file at INPUT_SCHEMA.json\n\nYou can also pass any custom path to your input schema to have it validated instead.\n","pluginName":"apify-cli","pluginType":"core","aliases":[],"flags":{},"args":[{"name":"path","description":"Optional path to your INPUT_SCHEMA.json file. If not provided ./INPUT_SCHEMA.json is used.","required":false}]},"actor:get-input":{"id":"actor:get-input","description":"Gets the actor input value from the default key-value store associated with the actor run.","pluginName":"apify-cli","pluginType":"core","aliases":[],"flags":{},"args":[]},"actor:get-value":{"id":"actor:get-value","description":"Gets a value from the default key-value store associated with the actor run.","pluginName":"apify-cli","pluginType":"core","aliases":[],"flags":{},"args":[{"name":"key","description":"Key of the record in key-value store","required":true}]},"actor":{"id":"actor","description":"Commands are designed to be used in actor runs. All commands are in PoC state, do not use in production environments.\n","pluginName":"apify-cli","pluginType":"core","aliases":[],"flags":{},"args":[]},"actor:push-data":{"id":"actor:push-data","description":"Stores an object or an array of objects to the default dataset of the actor run.\nIt is possible to pass data using item argument or stdin.\nPassing data using argument:\n$ apify actor:push-data {\"foo\": \"bar\"}\nPassing data using stdin with pipe:\n$ cat ./test.json | apify actor:push-data\n","pluginName":"apify-cli","pluginType":"core","aliases":[],"flags":{},"args":[{"name":"item","description":"JSON string with one object or array of objects containing data to be stored in the default dataset.","required":false}]},"actor:set-value":{"id":"actor:set-value","description":"Sets or removes record into the default KeyValueStore associated with the actor run.\nIt is possible to pass data using argument or stdin.\nPassing data using argument:\n$ apify actor:set-value KEY my-value\nPassing data using stdin with pipe:\n$ cat ./my-text-file.txt | apify actor:set-value KEY --contentType text/plain\n","pluginName":"apify-cli","pluginType":"core","aliases":[],"flags":{"contentType":{"name":"contentType","type":"option","char":"c","description":"Specifies a custom MIME content type of the record. By default \"application/json\" is used.","required":false}},"args":[{"name":"key","description":"Key of the record in key-value store.","required":true},{"name":"value","description":"Record data, which can be one of the following values:\n- If empty, the record in the key-value store is deleted.\n- If no `contentType` flag is specified, value is expected to be any JSON string value.\n- If options.contentType is set, value is taken as is.","required":false}]},"secrets:add":{"id":"secrets:add","description":"Adds a new secret value.\nThe secrets are stored to a file at ~/.apify","pluginName":"apify-cli","pluginType":"core","aliases":[],"flags":{},"args":[{"name":"name","description":"Name of the secret","required":true},{"name":"value","description":"Value of the secret","required":true}]},"secrets":{"id":"secrets","description":"Manages secret values for actor environment variables.\n\nExample:\n$ apify secrets:add mySecret TopSecretValue123\n\nNow the \"mySecret\" value can be used in an environment variable defined in \".actor/actor.json\" file by adding the \"@\" prefix:\n\n{\n \"actorSpecification\": 1,\n \"name\": \"my_actor\",\n \"environmentVariables\": { \"SECRET_ENV_VAR\": \"@mySecret\" },\n \"version\": \"0.1\n}\n\nWhen the actor is pushed to Apify cloud, the \"SECRET_ENV_VAR\" and its value is stored as a secret environment variable of the actor.","pluginName":"apify-cli","pluginType":"core","aliases":[],"flags":{},"args":[]},"secrets:rm":{"id":"secrets:rm","description":"Removes the secret.","pluginName":"apify-cli","pluginType":"core","aliases":[],"flags":{},"args":[{"name":"name","description":"Name of the secret","required":true}]}}}
package/package.json CHANGED
@@ -1,114 +1,114 @@
1
1
  {
2
- "name": "apify-cli",
3
- "version": "0.17.0",
4
- "description": "Apify command-line interface helps you create, develop, build and run Apify actors, and manage the Apify cloud platform.",
5
- "main": "index.js",
6
- "scripts": {
7
- "test": "cross-env APIFY_CLI_SKIP_UPDATE_CHECK=1 mocha --timeout 180000 --recursive",
8
- "test-python": "npm run test -- --grep '\\[python\\]'",
9
- "lint": "eslint src test",
10
- "lint:fix": "eslint src test --fix",
11
- "commands-md": "npm run manifest && oclif-dev readme",
12
- "prepare-release": "npm run commands-md && npm run prod-shrinkwrap",
13
- "prod-shrinkwrap": "rm -rf node_modules && npm install --production && npm shrinkwrap",
14
- "manifest": "rm -f oclif.manifest.json && oclif-dev manifest",
15
- "postinstall": "node \"./src/bin/run\" check-version && node ./src/lib/community"
16
- },
17
- "files": [
18
- "src",
19
- "oclif.manifest.json",
20
- "index.js",
21
- "package.json"
22
- ],
23
- "bin": {
24
- "apify": "./src/bin/run"
25
- },
26
- "contributors": [
27
- "Jakub Drobník <jakub.drobnik@apify.com>",
28
- "Jan Curn <jan@apify.com>"
29
- ],
30
- "repository": {
31
- "type": "git",
32
- "url": "git+https://github.com/apify/apify-cli.git"
33
- },
34
- "keywords": [
35
- "apify",
36
- "client",
37
- "node",
38
- "command",
39
- "line",
40
- "bash"
41
- ],
42
- "author": {
43
- "name": "Apify",
44
- "email": "support@apify.com",
45
- "url": "https://www.apify.com"
46
- },
47
- "license": "Apache-2.0",
48
- "bugs": {
49
- "url": "https://github.com/apify/apify-cli/issues"
50
- },
51
- "homepage": "https://github.com/apify/apify-cli#readme",
52
- "engines": {
53
- "node": ">=16.0.0"
54
- },
55
- "dependencies": {
56
- "@apify/actor-templates": "^0.1.3",
57
- "@apify/consts": "^2.7.0",
58
- "@apify/input_schema": "^3.3.0",
59
- "@apify/utilities": "^2.2.3",
60
- "@crawlee/memory-storage": "^3.0.3",
61
- "@oclif/command": "^1.8.16",
62
- "@oclif/config": "^1.18.3",
63
- "@oclif/errors": "^1.3.5",
64
- "@oclif/plugin-commands": "^2.1.0",
65
- "@oclif/plugin-help": "^5.1.12",
66
- "adm-zip": "^0.5.10",
67
- "ajv": "^8.10.0",
68
- "apify-client": "^2.2.0",
69
- "archiver-promise": "^1.0.0",
70
- "axios": "^0.21.1",
71
- "chalk": "^4.1.2",
72
- "computer-name": "^0.1.0",
73
- "cors": "^2.8.5",
74
- "detect-indent": "^6.1.0",
75
- "escape-string-regexp": "^4.0.0",
76
- "express": "^4.18.2",
77
- "globby": "^11.1.0",
78
- "inquirer": "^7.3.3",
79
- "is-ci": "^3.0.1",
80
- "is-online": "^10.0.0",
81
- "istextorbinary": "^6.0.0",
82
- "jju": "^1.4.0",
83
- "load-json-file": "^6.2.0",
84
- "mime": "^2.6.0",
85
- "mixpanel": "^0.17.0",
86
- "open": "^8.4.0",
87
- "ow": "^0.28.1",
88
- "rimraf": "^3.0.2",
89
- "semver": "^7.3.5",
90
- "tiged": "^2.12.4",
91
- "underscore": "^1.13.2",
92
- "write-json-file": "^4.3.0"
93
- },
94
- "devDependencies": {
95
- "@apify/eslint-config": "^0.2.3",
96
- "@oclif/dev-cli": "^1.26.0",
97
- "@oclif/test": "^2.1.0",
98
- "chai": "^4.3.4",
99
- "chai-match": "^1.1.1",
100
- "cross-env": "^7.0.3",
101
- "eslint": "^8.11.0",
102
- "mocha": "^10.0.0",
103
- "sinon": "^9.2.4"
104
- },
105
- "oclif": {
106
- "bin": "apify",
107
- "commands": "./src/commands",
108
- "hooks": {
109
- "init": [
110
- "./src/hooks/init"
111
- ]
112
- }
2
+ "name": "apify-cli",
3
+ "version": "0.18.0-beta.1",
4
+ "description": "Apify command-line interface helps you create, develop, build and run Apify actors, and manage the Apify cloud platform.",
5
+ "main": "index.js",
6
+ "scripts": {
7
+ "test": "cross-env APIFY_CLI_SKIP_UPDATE_CHECK=1 mocha --timeout 180000 --recursive",
8
+ "test-python": "npm run test -- --grep '\\[python\\]'",
9
+ "lint": "eslint src test",
10
+ "lint:fix": "eslint src test --fix",
11
+ "commands-md": "npm run manifest && oclif-dev readme",
12
+ "prepare-release": "npm run commands-md && npm run prod-shrinkwrap",
13
+ "prod-shrinkwrap": "rm -rf node_modules && npm install --production && npm shrinkwrap",
14
+ "manifest": "rm -f oclif.manifest.json && oclif-dev manifest",
15
+ "postinstall": "node \"./src/bin/run\" check-version && node ./src/lib/community"
16
+ },
17
+ "files": [
18
+ "src",
19
+ "oclif.manifest.json",
20
+ "index.js",
21
+ "package.json"
22
+ ],
23
+ "bin": {
24
+ "apify": "./src/bin/run"
25
+ },
26
+ "contributors": [
27
+ "Jakub Drobník <jakub.drobnik@apify.com>",
28
+ "Jan Curn <jan@apify.com>"
29
+ ],
30
+ "repository": {
31
+ "type": "git",
32
+ "url": "git+https://github.com/apify/apify-cli.git"
33
+ },
34
+ "keywords": [
35
+ "apify",
36
+ "client",
37
+ "node",
38
+ "command",
39
+ "line",
40
+ "bash"
41
+ ],
42
+ "author": {
43
+ "name": "Apify",
44
+ "email": "support@apify.com",
45
+ "url": "https://www.apify.com"
46
+ },
47
+ "license": "Apache-2.0",
48
+ "bugs": {
49
+ "url": "https://github.com/apify/apify-cli/issues"
50
+ },
51
+ "homepage": "https://github.com/apify/apify-cli#readme",
52
+ "engines": {
53
+ "node": ">=16.0.0"
54
+ },
55
+ "dependencies": {
56
+ "@apify/actor-templates": "^0.1.3",
57
+ "@apify/consts": "^2.20.0",
58
+ "@apify/input_schema": "^3.3.0",
59
+ "@apify/utilities": "^2.2.3",
60
+ "@crawlee/memory-storage": "^3.0.3",
61
+ "@oclif/command": "^1.8.16",
62
+ "@oclif/config": "^1.18.3",
63
+ "@oclif/errors": "^1.3.5",
64
+ "@oclif/plugin-commands": "^2.1.0",
65
+ "@oclif/plugin-help": "^5.1.12",
66
+ "adm-zip": "^0.5.10",
67
+ "ajv": "^8.10.0",
68
+ "apify-client": "^2.2.0",
69
+ "archiver-promise": "^1.0.0",
70
+ "axios": "^0.21.1",
71
+ "chalk": "^4.1.2",
72
+ "computer-name": "^0.1.0",
73
+ "cors": "^2.8.5",
74
+ "detect-indent": "^6.1.0",
75
+ "escape-string-regexp": "^4.0.0",
76
+ "express": "^4.18.2",
77
+ "globby": "^11.1.0",
78
+ "inquirer": "^7.3.3",
79
+ "is-ci": "^3.0.1",
80
+ "is-online": "^10.0.0",
81
+ "istextorbinary": "^6.0.0",
82
+ "jju": "^1.4.0",
83
+ "load-json-file": "^6.2.0",
84
+ "mime": "^2.6.0",
85
+ "mixpanel": "^0.17.0",
86
+ "open": "^8.4.0",
87
+ "ow": "^0.28.1",
88
+ "rimraf": "^3.0.2",
89
+ "semver": "^7.3.5",
90
+ "tiged": "^2.12.4",
91
+ "underscore": "^1.13.2",
92
+ "write-json-file": "^4.3.0"
93
+ },
94
+ "devDependencies": {
95
+ "@apify/eslint-config": "^0.2.3",
96
+ "@oclif/dev-cli": "^1.26.0",
97
+ "@oclif/test": "^2.1.0",
98
+ "chai": "^4.3.4",
99
+ "chai-match": "^1.1.1",
100
+ "cross-env": "^7.0.3",
101
+ "eslint": "^8.11.0",
102
+ "mocha": "^10.0.0",
103
+ "sinon": "^9.2.4"
104
+ },
105
+ "oclif": {
106
+ "bin": "apify",
107
+ "commands": "./src/commands",
108
+ "hooks": {
109
+ "init": [
110
+ "./src/hooks/init"
111
+ ]
113
112
  }
113
+ }
114
114
  }
@@ -23,7 +23,13 @@ const {
23
23
  detectNpmVersion,
24
24
  } = require('../lib/utils');
25
25
  const { EMPTY_LOCAL_CONFIG, LOCAL_CONFIG_PATH, PYTHON_VENV_PATH, SUPPORTED_NODEJS_VERSION } = require('../lib/consts');
26
- const { httpsGet, ensureValidActorName, getTemplateDefinition, enhanceReadmeWithLocalSuffix } = require('../lib/create-utils');
26
+ const {
27
+ httpsGet,
28
+ ensureValidActorName,
29
+ getTemplateDefinition,
30
+ enhanceReadmeWithLocalSuffix,
31
+ } = require('../lib/create-utils');
32
+ const { createPrefilledInputFileFromInputSchema } = require('../lib/input_schema');
27
33
 
28
34
  class CreateCommand extends ApifyCommand {
29
35
  async run() {
@@ -85,6 +91,9 @@ class CreateCommand extends ApifyCommand {
85
91
  await setLocalConfig(Object.assign(localConfig || EMPTY_LOCAL_CONFIG, { name: actorName }), actFolderDir);
86
92
  await setLocalEnv(actFolderDir);
87
93
 
94
+ // Create prefilled INPUT.json file from the input schema prefills
95
+ await createPrefilledInputFileFromInputSchema(actFolderDir);
96
+
88
97
  const packageJsonPath = path.join(actFolderDir, 'package.json');
89
98
  const requirementsTxtPath = path.join(actFolderDir, 'requirements.txt');
90
99
  const readmePath = path.join(actFolderDir, 'README.md');
@@ -4,6 +4,7 @@ const { ApifyCommand } = require('../lib/apify_command');
4
4
  const outputs = require('../lib/outputs');
5
5
  const { setLocalConfig, setLocalEnv, getLocalConfig, getLocalConfigOrThrow } = require('../lib/utils');
6
6
  const { EMPTY_LOCAL_CONFIG, DEFAULT_LOCAL_STORAGE_DIR, LOCAL_CONFIG_PATH } = require('../lib/consts');
7
+ const { createPrefilledInputFileFromInputSchema } = require('../lib/input_schema');
7
8
 
8
9
  class InitCommand extends ApifyCommand {
9
10
  async run() {
@@ -23,6 +24,8 @@ class InitCommand extends ApifyCommand {
23
24
  await setLocalConfig(Object.assign(localConfig, { name: actorName }), cwd);
24
25
  }
25
26
  await setLocalEnv(cwd);
27
+ // Create prefilled INPUT.json file from the input schema prefills
28
+ await createPrefilledInputFileFromInputSchema(cwd);
26
29
  outputs.success('The Apify actor has been initialized in the current directory.');
27
30
  }
28
31
  }
@@ -2,7 +2,7 @@ const { flags: flagsHelper } = require('@oclif/command');
2
2
  const fs = require('fs');
3
3
  const path = require('path');
4
4
  const loadJson = require('load-json-file');
5
- const { ENV_VARS } = require('@apify/consts');
5
+ const { APIFY_ENV_VARS } = require('@apify/consts');
6
6
  const semver = require('semver');
7
7
  const execWithLog = require('../lib/exec');
8
8
  const { LEGACY_LOCAL_STORAGE_DIR, DEFAULT_LOCAL_STORAGE_DIR, SUPPORTED_NODEJS_VERSION, LANGUAGE } = require('../lib/consts');
@@ -69,11 +69,11 @@ class RunCommand extends ApifyCommand {
69
69
 
70
70
  // Attach env vars from local config files
71
71
  const localEnvVars = {
72
- [ENV_VARS.LOCAL_STORAGE_DIR]: DEFAULT_LOCAL_STORAGE_DIR,
72
+ [APIFY_ENV_VARS.LOCAL_STORAGE_DIR]: DEFAULT_LOCAL_STORAGE_DIR,
73
73
  };
74
- if (proxy && proxy.password) localEnvVars[ENV_VARS.PROXY_PASSWORD] = proxy.password;
75
- if (userId) localEnvVars[ENV_VARS.USER_ID] = userId;
76
- if (token) localEnvVars[ENV_VARS.TOKEN] = token;
74
+ if (proxy && proxy.password) localEnvVars[APIFY_ENV_VARS.PROXY_PASSWORD] = proxy.password;
75
+ if (userId) localEnvVars[APIFY_ENV_VARS.USER_ID] = userId;
76
+ if (token) localEnvVars[APIFY_ENV_VARS.TOKEN] = token;
77
77
  if (localConfig.environmentVariables) {
78
78
  const updatedEnv = replaceSecretsValue(localConfig.environmentVariables);
79
79
  Object.assign(localEnvVars, updatedEnv);
package/src/lib/actor.js CHANGED
@@ -3,7 +3,7 @@ const { pipeline } = require('stream');
3
3
  const { promisify } = require('util');
4
4
  const { default: ow } = require('ow');
5
5
  const { MemoryStorage } = require('@crawlee/memory-storage');
6
- const { ENV_VARS, LOCAL_ENV_VARS, KEY_VALUE_STORE_KEYS } = require('@apify/consts');
6
+ const { ACTOR_ENV_VARS, LOCAL_ACTOR_ENV_VARS, APIFY_ENV_VARS, KEY_VALUE_STORE_KEYS } = require('@apify/consts');
7
7
  const { getLocalUserInfo, getLocalStorageDir, getApifyClientOptions } = require('./utils');
8
8
 
9
9
  const pipelinePromise = promisify(pipeline);
@@ -31,7 +31,7 @@ const getApifyStorageClient = (options = {}, forceCloud = false) => {
31
31
  }
32
32
 
33
33
  // NOTE: Token in env var overrides token in local auth file.
34
- let apifyToken = process.env[ENV_VARS.TOKEN];
34
+ let apifyToken = process.env[APIFY_ENV_VARS.TOKEN];
35
35
  if (!apifyToken) {
36
36
  const localUserInfo = getLocalUserInfo();
37
37
  if (!localUserInfo || !localUserInfo.token) {
@@ -53,15 +53,9 @@ const getApifyStorageClient = (options = {}, forceCloud = false) => {
53
53
  * @return {string}
54
54
  */
55
55
  const getDefaultStorageId = (storeType) => {
56
- const isRunningOnApify = !process.env[ENV_VARS.LOCAL_STORAGE_DIR];
57
- const envVarName = ENV_VARS[`DEFAULT_${storeType}_ID`];
58
- const storeId = process.env[envVarName];
59
- if (isRunningOnApify && !storeId) {
60
- throw new Error(`Default storage ID is not set. You can set it using the environment `
61
- + `variable ${envVarName} or use local storage with setting ${ENV_VARS.LOCAL_STORAGE_DIR} variable.`);
62
- }
56
+ const envVarName = ACTOR_ENV_VARS[`DEFAULT_${storeType}_ID`];
63
57
 
64
- return storeId || LOCAL_ENV_VARS[envVarName];
58
+ return process.env[envVarName] || LOCAL_ACTOR_ENV_VARS[envVarName];
65
59
  };
66
60
 
67
61
  /**
@@ -82,7 +76,7 @@ const outputRecordFromDefaultStore = async (key) => {
82
76
  };
83
77
 
84
78
  const outputInputFromDefaultStore = async () => {
85
- return outputRecordFromDefaultStore(process.env[ENV_VARS.INPUT_KEY] || KEY_VALUE_STORE_KEYS.INPUT);
79
+ return outputRecordFromDefaultStore(process.env[ACTOR_ENV_VARS.INPUT_KEY] || KEY_VALUE_STORE_KEYS.INPUT);
86
80
  };
87
81
 
88
82
  module.exports = {
@@ -4,6 +4,7 @@ const https = require('https');
4
4
  const { pipeline } = require('stream');
5
5
  const { promisify } = require('util');
6
6
  const fs = require('fs');
7
+
7
8
  const { validateActorName } = require('./utils');
8
9
  const {
9
10
  warning,
@@ -1,7 +1,13 @@
1
1
  const fs = require('fs');
2
2
  const path = require('path');
3
+ const Ajv = require('ajv');
4
+ const { validateInputSchema } = require('@apify/input_schema');
5
+ const _ = require('underscore');
6
+ const { KEY_VALUE_STORE_KEYS } = require('@apify/consts');
7
+ const writeJsonFile = require('write-json-file');
3
8
  const { ACTOR_SPECIFICATION_FOLDER } = require('./consts');
4
- const { getLocalConfig, getJsonFileContent } = require('./utils');
9
+ const { getLocalConfig, getJsonFileContent, getLocalKeyValueStorePath } = require('./utils');
10
+ const { warning } = require('./outputs');
5
11
 
6
12
  const DEFAULT_INPUT_SCHEMA_PATHS = [
7
13
  '.actor/INPUT_SCHEMA.json',
@@ -65,6 +71,42 @@ const readInputSchema = async (forcePath) => {
65
71
  };
66
72
  };
67
73
 
74
+ /**
75
+ * Goes to the Actor directory and creates INPUT.json file from the input schema prefills.
76
+ * @param {string} actorFolderDir
77
+ */
78
+ const createPrefilledInputFileFromInputSchema = async (actorFolderDir) => {
79
+ const currentDir = process.cwd();
80
+ let inputFile = {};
81
+ try {
82
+ process.chdir(actorFolderDir);
83
+ const { inputSchema } = await readInputSchema();
84
+
85
+ if (inputSchema) {
86
+ /**
87
+ * TODO: The logic is copied from @apify-packages/actor -> getPrefillFromInputSchema
88
+ * It is not possible to install the package here because it is private
89
+ * We should move it to @apify/input_schema and use it from there.
90
+ */
91
+ const validator = new Ajv({ strict: false });
92
+ validateInputSchema(validator, inputSchema);
93
+
94
+ inputFile = _.mapObject(inputSchema.properties, (fieldSchema) => ((fieldSchema.type === 'boolean' || fieldSchema.editor === 'hidden')
95
+ ? fieldSchema.default
96
+ : fieldSchema.prefill
97
+ ));
98
+ }
99
+ } catch (err) {
100
+ warning(`Could not create default input based on input schema, creating empty input instead. Cause: ${err.message}`);
101
+ } finally {
102
+ const keyValueStorePath = getLocalKeyValueStorePath();
103
+ const inputJsonPath = path.join(actorFolderDir, keyValueStorePath, `${KEY_VALUE_STORE_KEYS.INPUT}.json`);
104
+ await writeJsonFile(inputJsonPath, inputFile);
105
+ process.chdir(currentDir);
106
+ }
107
+ };
108
+
68
109
  module.exports = {
69
110
  readInputSchema,
111
+ createPrefilledInputFileFromInputSchema,
70
112
  };
package/src/lib/utils.js CHANGED
@@ -9,13 +9,14 @@ const loadJson = require('load-json-file');
9
9
  const writeJson = require('write-json-file');
10
10
  const inquirer = require('inquirer');
11
11
  const {
12
- LOCAL_STORAGE_SUBDIRS,
13
- ENV_VARS,
14
- LOCAL_ENV_VARS,
15
- KEY_VALUE_STORE_KEYS,
16
12
  ACT_JOB_TERMINAL_STATUSES,
17
- SOURCE_FILE_FORMATS,
13
+ ACTOR_ENV_VARS,
14
+ LOCAL_ACTOR_ENV_VARS,
18
15
  ACTOR_NAME,
16
+ APIFY_ENV_VARS,
17
+ KEY_VALUE_STORE_KEYS,
18
+ LOCAL_STORAGE_SUBDIRS,
19
+ SOURCE_FILE_FORMATS,
19
20
  } = require('@apify/consts');
20
21
  const https = require('https');
21
22
  const { ApifyClient } = require('apify-client');
@@ -51,25 +52,25 @@ const {
51
52
  const MIGRATED_APIFY_JSON_PROPERTIES = ['name', 'version', 'buildTag'];
52
53
 
53
54
  const getLocalStorageDir = () => {
54
- const envVar = ENV_VARS.LOCAL_STORAGE_DIR;
55
+ const envVar = APIFY_ENV_VARS.LOCAL_STORAGE_DIR;
55
56
 
56
57
  return process.env[envVar] || DEFAULT_LOCAL_STORAGE_DIR;
57
58
  };
58
59
  const getLocalKeyValueStorePath = (storeId) => {
59
- const envVar = ENV_VARS.DEFAULT_KEY_VALUE_STORE_ID;
60
- const storeDir = storeId || process.env[envVar] || LOCAL_ENV_VARS[envVar];
60
+ const envVar = ACTOR_ENV_VARS.DEFAULT_KEY_VALUE_STORE_ID;
61
+ const storeDir = storeId || process.env[envVar] || LOCAL_ACTOR_ENV_VARS[envVar];
61
62
 
62
63
  return path.join(getLocalStorageDir(), LOCAL_STORAGE_SUBDIRS.keyValueStores, storeDir);
63
64
  };
64
65
  const getLocalDatasetPath = (storeId) => {
65
- const envVar = ENV_VARS.DEFAULT_DATASET_ID;
66
- const storeDir = storeId || process.env[envVar] || LOCAL_ENV_VARS[envVar];
66
+ const envVar = ACTOR_ENV_VARS.DEFAULT_DATASET_ID;
67
+ const storeDir = storeId || process.env[envVar] || LOCAL_ACTOR_ENV_VARS[envVar];
67
68
 
68
69
  return path.join(getLocalStorageDir(), LOCAL_STORAGE_SUBDIRS.datasets, storeDir);
69
70
  };
70
71
  const getLocalRequestQueuePath = (storeId) => {
71
- const envVar = ENV_VARS.DEFAULT_REQUEST_QUEUE_ID;
72
- const storeDir = storeId || process.env[envVar] || LOCAL_ENV_VARS[envVar];
72
+ const envVar = ACTOR_ENV_VARS.DEFAULT_REQUEST_QUEUE_ID;
73
+ const storeDir = storeId || process.env[envVar] || LOCAL_ACTOR_ENV_VARS[envVar];
73
74
 
74
75
  return path.join(getLocalStorageDir(), LOCAL_STORAGE_SUBDIRS.requestQueues, storeDir);
75
76
  };
@@ -237,7 +238,6 @@ const GITIGNORE_REQUIRED_CONTENTS = [getLocalStorageDir(), 'node_modules', '.ven
237
238
  const setLocalEnv = async (actDir) => {
238
239
  // Create folders for emulation Apify stores
239
240
  const keyValueStorePath = getLocalKeyValueStorePath();
240
- const inputJsonPath = path.join(actDir, keyValueStorePath, `${KEY_VALUE_STORE_KEYS.INPUT}.json`);
241
241
  ensureFolderExistsSync(actDir, getLocalDatasetPath());
242
242
  ensureFolderExistsSync(actDir, getLocalRequestQueuePath());
243
243
  ensureFolderExistsSync(actDir, keyValueStorePath);
@@ -264,11 +264,6 @@ const setLocalEnv = async (actDir) => {
264
264
  fs.writeFileSync(gitignorePath, `${gitignoreAdditions.join('\n')}\n`, { flag: 'w' });
265
265
  }
266
266
  }
267
-
268
- // Create an empty INPUT.json file if it does not exist.
269
- if (!fs.existsSync(inputJsonPath)) {
270
- writeJson.sync(inputJsonPath, {});
271
- }
272
267
  };
273
268
 
274
269
  /**
@@ -365,14 +360,14 @@ const createActZip = async (zipName, pathsToZip) => {
365
360
  const getLocalInput = () => {
366
361
  const defaultLocalStorePath = getLocalKeyValueStorePath();
367
362
  const files = fs.readdirSync(defaultLocalStorePath);
368
- const inputFileName = files.find((file) => !!file.match(INPUT_FILE_REG_EXP));
363
+ const inputName = files.find((file) => !!file.match(INPUT_FILE_REG_EXP));
369
364
 
370
365
  // No input file
371
- if (!inputFileName) return;
366
+ if (!inputName) return;
372
367
 
373
- const inputFile = fs.readFileSync(path.join(defaultLocalStorePath, inputFileName));
374
- const contentType = mime.getType(inputFileName);
375
- return { body: inputFile, contentType };
368
+ const input = fs.readFileSync(path.join(defaultLocalStorePath, inputName));
369
+ const contentType = mime.getType(inputName);
370
+ return { body: input, contentType };
376
371
  };
377
372
 
378
373
  const purgeDefaultQueue = async () => {