apify-cli 0.19.3-beta.4 → 1.0.0-beta.0

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.
Files changed (231) hide show
  1. package/README.md +87 -63
  2. package/bin/dev.cmd +3 -0
  3. package/bin/dev.js +16 -0
  4. package/bin/run.js +16 -0
  5. package/dist/.tsbuildinfo +1 -0
  6. package/dist/commands/actor/get-input.d.ts +6 -0
  7. package/dist/commands/actor/get-input.d.ts.map +1 -0
  8. package/dist/commands/actor/get-input.js +14 -0
  9. package/dist/commands/actor/get-input.js.map +1 -0
  10. package/dist/commands/actor/get-value.d.ts +9 -0
  11. package/dist/commands/actor/get-value.d.ts.map +1 -0
  12. package/dist/commands/actor/get-value.js +27 -0
  13. package/dist/commands/actor/get-value.js.map +1 -0
  14. package/dist/commands/actor/index.d.ts +6 -0
  15. package/dist/commands/actor/index.d.ts.map +1 -0
  16. package/dist/commands/actor/index.js +13 -0
  17. package/dist/commands/actor/index.js.map +1 -0
  18. package/dist/commands/actor/push-data.d.ts +11 -0
  19. package/dist/commands/actor/push-data.d.ts.map +1 -0
  20. package/dist/commands/actor/push-data.js +56 -0
  21. package/dist/commands/actor/push-data.js.map +1 -0
  22. package/dist/commands/actor/set-value.d.ts +15 -0
  23. package/dist/commands/actor/set-value.d.ts.map +1 -0
  24. package/dist/commands/actor/set-value.js +76 -0
  25. package/dist/commands/actor/set-value.js.map +1 -0
  26. package/dist/commands/call.d.ts +15 -0
  27. package/dist/commands/call.d.ts.map +1 -0
  28. package/dist/commands/call.js +142 -0
  29. package/dist/commands/call.js.map +1 -0
  30. package/dist/commands/check-version.d.ts +11 -0
  31. package/dist/commands/check-version.d.ts.map +1 -0
  32. package/dist/commands/check-version.js +39 -0
  33. package/dist/commands/check-version.js.map +1 -0
  34. package/dist/commands/create.d.ts +14 -0
  35. package/dist/commands/create.d.ts.map +1 -0
  36. package/dist/commands/create.js +181 -0
  37. package/dist/commands/create.js.map +1 -0
  38. package/dist/commands/edit-input-schema.d.ts +11 -0
  39. package/dist/commands/edit-input-schema.d.ts.map +1 -0
  40. package/{src → dist}/commands/edit-input-schema.js +81 -85
  41. package/dist/commands/edit-input-schema.js.map +1 -0
  42. package/dist/commands/info.d.ts +6 -0
  43. package/dist/commands/info.d.ts.map +1 -0
  44. package/dist/commands/info.js +26 -0
  45. package/dist/commands/info.js.map +1 -0
  46. package/dist/commands/init-wrap-scrapy.d.ts +10 -0
  47. package/dist/commands/init-wrap-scrapy.d.ts.map +1 -0
  48. package/dist/commands/init-wrap-scrapy.js +41 -0
  49. package/dist/commands/init-wrap-scrapy.js.map +1 -0
  50. package/dist/commands/init.d.ts +12 -0
  51. package/dist/commands/init.d.ts.map +1 -0
  52. package/dist/commands/init.js +88 -0
  53. package/dist/commands/init.js.map +1 -0
  54. package/dist/commands/login-new.d.ts +10 -0
  55. package/dist/commands/login-new.d.ts.map +1 -0
  56. package/{src → dist}/commands/login-new.js +79 -82
  57. package/dist/commands/login-new.js.map +1 -0
  58. package/dist/commands/login.d.ts +9 -0
  59. package/dist/commands/login.d.ts.map +1 -0
  60. package/dist/commands/login.js +43 -0
  61. package/dist/commands/login.js.map +1 -0
  62. package/dist/commands/logout.d.ts +6 -0
  63. package/dist/commands/logout.d.ts.map +1 -0
  64. package/dist/commands/logout.js +20 -0
  65. package/dist/commands/logout.js.map +1 -0
  66. package/dist/commands/pull.d.ts +12 -0
  67. package/dist/commands/pull.d.ts.map +1 -0
  68. package/dist/commands/pull.js +148 -0
  69. package/dist/commands/pull.js.map +1 -0
  70. package/dist/commands/push.d.ts +16 -0
  71. package/dist/commands/push.d.ts.map +1 -0
  72. package/dist/commands/push.js +242 -0
  73. package/dist/commands/push.js.map +1 -0
  74. package/dist/commands/run.d.ts +12 -0
  75. package/dist/commands/run.d.ts.map +1 -0
  76. package/{src → dist}/commands/run.js +96 -109
  77. package/dist/commands/run.js.map +1 -0
  78. package/dist/commands/secrets/add.d.ts +10 -0
  79. package/dist/commands/secrets/add.d.ts.map +1 -0
  80. package/dist/commands/secrets/add.js +31 -0
  81. package/dist/commands/secrets/add.js.map +1 -0
  82. package/dist/commands/secrets/index.d.ts +6 -0
  83. package/dist/commands/secrets/index.d.ts.map +1 -0
  84. package/dist/commands/secrets/index.js +24 -0
  85. package/dist/commands/secrets/index.js.map +1 -0
  86. package/dist/commands/secrets/rm.d.ts +9 -0
  87. package/dist/commands/secrets/rm.d.ts.map +1 -0
  88. package/dist/commands/secrets/rm.js +27 -0
  89. package/dist/commands/secrets/rm.js.map +1 -0
  90. package/dist/commands/vis.d.ts +9 -0
  91. package/dist/commands/vis.d.ts.map +1 -0
  92. package/dist/commands/vis.js +52 -0
  93. package/dist/commands/vis.js.map +1 -0
  94. package/dist/hooks/init.d.ts +7 -0
  95. package/dist/hooks/init.d.ts.map +1 -0
  96. package/dist/hooks/init.js +17 -0
  97. package/dist/hooks/init.js.map +1 -0
  98. package/dist/index.d.ts +2 -0
  99. package/dist/index.d.ts.map +1 -0
  100. package/dist/index.js +3 -0
  101. package/dist/index.js.map +1 -0
  102. package/dist/lib/actor.d.ts +27 -0
  103. package/dist/lib/actor.d.ts.map +1 -0
  104. package/{src → dist}/lib/actor.js +21 -44
  105. package/dist/lib/actor.js.map +1 -0
  106. package/dist/lib/apify-oclif-help.d.ts +15 -0
  107. package/dist/lib/apify-oclif-help.d.ts.map +1 -0
  108. package/dist/lib/apify-oclif-help.js +19 -0
  109. package/dist/lib/apify-oclif-help.js.map +1 -0
  110. package/dist/lib/apify_command.d.ts +22 -0
  111. package/dist/lib/apify_command.d.ts.map +1 -0
  112. package/dist/lib/apify_command.js +103 -0
  113. package/dist/lib/apify_command.js.map +1 -0
  114. package/dist/lib/community.d.ts +2 -0
  115. package/dist/lib/community.d.ts.map +1 -0
  116. package/dist/lib/community.js +4 -0
  117. package/dist/lib/community.js.map +1 -0
  118. package/dist/lib/consts.d.ts +45 -0
  119. package/dist/lib/consts.d.ts.map +1 -0
  120. package/dist/lib/consts.js +54 -0
  121. package/dist/lib/consts.js.map +1 -0
  122. package/dist/lib/create-utils.d.ts +8 -0
  123. package/dist/lib/create-utils.d.ts.map +1 -0
  124. package/{src → dist}/lib/create-utils.js +74 -113
  125. package/dist/lib/create-utils.js.map +1 -0
  126. package/dist/lib/exec.d.ts +4 -0
  127. package/dist/lib/exec.d.ts.map +1 -0
  128. package/{src → dist}/lib/exec.js +15 -16
  129. package/dist/lib/exec.js.map +1 -0
  130. package/dist/lib/files.d.ts +14 -0
  131. package/dist/lib/files.d.ts.map +1 -0
  132. package/dist/lib/files.js +58 -0
  133. package/dist/lib/files.js.map +1 -0
  134. package/dist/lib/input_schema.d.ts +26 -0
  135. package/dist/lib/input_schema.d.ts.map +1 -0
  136. package/{src → dist}/lib/input_schema.js +34 -55
  137. package/dist/lib/input_schema.js.map +1 -0
  138. package/dist/lib/local_state.d.ts +11 -0
  139. package/dist/lib/local_state.d.ts.map +1 -0
  140. package/dist/lib/local_state.js +27 -0
  141. package/dist/lib/local_state.js.map +1 -0
  142. package/dist/lib/outputs.d.ts +7 -0
  143. package/dist/lib/outputs.d.ts.map +1 -0
  144. package/{src → dist}/lib/outputs.js +8 -15
  145. package/dist/lib/outputs.js.map +1 -0
  146. package/dist/lib/project_analyzer.d.ts +4 -0
  147. package/dist/lib/project_analyzer.d.ts.map +1 -0
  148. package/{src → dist}/lib/project_analyzer.js +6 -11
  149. package/dist/lib/project_analyzer.js.map +1 -0
  150. package/dist/lib/projects/CrawleeAnalyzer.d.ts +4 -0
  151. package/dist/lib/projects/CrawleeAnalyzer.d.ts.map +1 -0
  152. package/{src → dist}/lib/projects/CrawleeAnalyzer.js +7 -24
  153. package/dist/lib/projects/CrawleeAnalyzer.js.map +1 -0
  154. package/dist/lib/projects/OldApifySDKAnalyzer.d.ts +4 -0
  155. package/dist/lib/projects/OldApifySDKAnalyzer.d.ts.map +1 -0
  156. package/{src → dist}/lib/projects/OldApifySDKAnalyzer.js +9 -32
  157. package/dist/lib/projects/OldApifySDKAnalyzer.js.map +1 -0
  158. package/dist/lib/projects/scrapy/ScrapyProjectAnalyzer.d.ts +17 -0
  159. package/dist/lib/projects/scrapy/ScrapyProjectAnalyzer.d.ts.map +1 -0
  160. package/{src/lib/scrapy-wrapper → dist/lib/projects/scrapy}/ScrapyProjectAnalyzer.js +33 -36
  161. package/dist/lib/projects/scrapy/ScrapyProjectAnalyzer.js.map +1 -0
  162. package/dist/lib/projects/scrapy/Spider.d.ts +14 -0
  163. package/dist/lib/projects/scrapy/Spider.d.ts.map +1 -0
  164. package/dist/lib/projects/scrapy/Spider.js +33 -0
  165. package/dist/lib/projects/scrapy/Spider.js.map +1 -0
  166. package/dist/lib/projects/scrapy/SpiderFileAnalyzer.d.ts +7 -0
  167. package/dist/lib/projects/scrapy/SpiderFileAnalyzer.d.ts.map +1 -0
  168. package/dist/lib/projects/scrapy/SpiderFileAnalyzer.js +25 -0
  169. package/dist/lib/projects/scrapy/SpiderFileAnalyzer.js.map +1 -0
  170. package/dist/lib/projects/scrapy/wrapScrapyProject.d.ts +4 -0
  171. package/dist/lib/projects/scrapy/wrapScrapyProject.d.ts.map +1 -0
  172. package/{src/lib/scrapy-wrapper/index.js → dist/lib/projects/scrapy/wrapScrapyProject.js} +43 -73
  173. package/dist/lib/projects/scrapy/wrapScrapyProject.js.map +1 -0
  174. package/dist/lib/projects/shared.d.ts +2 -0
  175. package/dist/lib/projects/shared.d.ts.map +1 -0
  176. package/dist/lib/projects/shared.js +13 -0
  177. package/dist/lib/projects/shared.js.map +1 -0
  178. package/dist/lib/secrets.d.ts +22 -0
  179. package/dist/lib/secrets.d.ts.map +1 -0
  180. package/{src → dist}/lib/secrets.js +32 -40
  181. package/dist/lib/secrets.js.map +1 -0
  182. package/dist/lib/telemetry.d.ts +21 -0
  183. package/dist/lib/telemetry.d.ts.map +1 -0
  184. package/dist/lib/telemetry.js +87 -0
  185. package/dist/lib/telemetry.js.map +1 -0
  186. package/dist/lib/types.d.ts +11 -0
  187. package/dist/lib/types.d.ts.map +1 -0
  188. package/dist/lib/types.js +2 -0
  189. package/dist/lib/types.js.map +1 -0
  190. package/dist/lib/utils.d.ts +106 -0
  191. package/dist/lib/utils.d.ts.map +1 -0
  192. package/{src → dist}/lib/utils.js +235 -347
  193. package/dist/lib/utils.js.map +1 -0
  194. package/dist/lib/version_check.d.ts +14 -0
  195. package/dist/lib/version_check.d.ts.map +1 -0
  196. package/{src → dist}/lib/version_check.js +25 -54
  197. package/dist/lib/version_check.js.map +1 -0
  198. package/oclif.manifest.json +722 -1
  199. package/package.json +137 -113
  200. package/index.js +0 -1
  201. package/src/bin/run +0 -16
  202. package/src/commands/actor/get-input.js +0 -12
  203. package/src/commands/actor/get-value.js +0 -23
  204. package/src/commands/actor/index.js +0 -13
  205. package/src/commands/actor/push-data.js +0 -44
  206. package/src/commands/actor/set-value.js +0 -63
  207. package/src/commands/call.js +0 -131
  208. package/src/commands/check-version.js +0 -28
  209. package/src/commands/create.js +0 -203
  210. package/src/commands/info.js +0 -24
  211. package/src/commands/init-wrap-scrapy.js +0 -34
  212. package/src/commands/init.js +0 -83
  213. package/src/commands/login.js +0 -40
  214. package/src/commands/logout.js +0 -18
  215. package/src/commands/pull.js +0 -154
  216. package/src/commands/push.js +0 -234
  217. package/src/commands/secrets/add.js +0 -28
  218. package/src/commands/secrets/index.js +0 -24
  219. package/src/commands/secrets/rm.js +0 -23
  220. package/src/commands/vis.js +0 -50
  221. package/src/hooks/init.js +0 -16
  222. package/src/lib/apify-oclif-help.js +0 -23
  223. package/src/lib/apify_command.js +0 -82
  224. package/src/lib/community.js +0 -3
  225. package/src/lib/consts.js +0 -69
  226. package/src/lib/files.js +0 -76
  227. package/src/lib/local_state.js +0 -39
  228. package/src/lib/scrapy-wrapper/Spider.js +0 -10
  229. package/src/lib/scrapy-wrapper/SpiderFileAnalyzer.js +0 -26
  230. package/src/lib/telemetry.js +0 -104
  231. /package/{src/bin → bin}/run.cmd +0 -0
package/package.json CHANGED
@@ -1,116 +1,140 @@
1
1
  {
2
- "name": "apify-cli",
3
- "version": "0.19.3-beta.4",
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 vitest run",
8
- "test-python": "cross-env APIFY_CLI_SKIP_UPDATE_CHECK=1 vitest run -t '.*\\[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.4",
57
- "@apify/consts": "^2.23.0",
58
- "@apify/input_schema": "^3.5.8",
59
- "@apify/utilities": "^2.9.3",
60
- "@crawlee/memory-storage": "^3.5.8",
61
- "@oclif/command": "^1.8.36",
62
- "@oclif/config": "^1.18.17",
63
- "@oclif/core": "^2.15.0",
64
- "@oclif/errors": "^1.3.6",
65
- "@oclif/plugin-commands": "^2.1.0",
66
- "@oclif/plugin-help": "^5.1.12",
67
- "@root/walk": "^1.1.0",
68
- "adm-zip": "^0.5.10",
69
- "ajv": "^8.12.0",
70
- "apify-client": "^2.9.0",
71
- "archiver-promise": "^1.0.0",
72
- "axios": "^1.6.7",
73
- "chalk": "^4.1.2",
74
- "computer-name": "^0.1.0",
75
- "configparser": "^0.3.10",
76
- "cors": "^2.8.5",
77
- "detect-indent": "^6.1.0",
78
- "escape-string-regexp": "^4.0.0",
79
- "express": "^4.18.2",
80
- "globby": "^11.1.0",
81
- "handlebars": "^4.7.8",
82
- "inquirer": "^7.3.3",
83
- "is-ci": "^3.0.1",
84
- "is-online": "^10.0.0",
85
- "istextorbinary": "^8.0.0",
86
- "jju": "^1.4.0",
87
- "load-json-file": "^6.2.0",
88
- "mime": "^3.0.0",
89
- "mixpanel": "^0.18.0",
90
- "open": "^8.4.0",
91
- "ow": "^0.28.2",
92
- "rimraf": "^3.0.2",
93
- "semver": "^7.5.4",
94
- "tiged": "^2.12.5",
95
- "underscore": "^1.13.6",
96
- "write-json-file": "^4.3.0"
97
- },
98
- "devDependencies": {
99
- "@apify/eslint-config": "^0.4.0",
100
- "@oclif/dev-cli": "^1.26.0",
101
- "@oclif/test": "^2.1.0",
102
- "cross-env": "^7.0.3",
103
- "eslint": "^8.53.0",
104
- "vitest": "^1.0.4"
105
- },
106
- "oclif": {
107
- "bin": "apify",
108
- "commands": "./src/commands",
109
- "hooks": {
110
- "init": [
111
- "./src/hooks/init"
112
- ]
2
+ "name": "apify-cli",
3
+ "version": "1.0.0-beta.0",
4
+ "description": "Apify command-line interface (CLI) helps you manage the Apify cloud platform and develop, build, and deploy Apify Actors.",
5
+ "exports": "./dist/index.js",
6
+ "types": "./dist/index.d.ts",
7
+ "type": "module",
8
+ "scripts": {
9
+ "test": "vitest run",
10
+ "test-python": "vitest run -t '.*\\[python\\]'",
11
+ "lint": "eslint src test",
12
+ "lint:fix": "eslint src test --fix",
13
+ "clean": "rimraf dist",
14
+ "build": "npm run clean && tsc",
15
+ "postpack": "rimraf oclif.manifest.json",
16
+ "prepack": "npm run build && oclif manifest && oclif readme",
17
+ "prepare": "npm run build && node ./bin/run.js check-version && node ./dist/lib/community.js"
113
18
  },
114
- "helpClass": "./src/lib/apify-oclif-help"
115
- }
19
+ "files": [
20
+ "dist",
21
+ "oclif.manifest.json",
22
+ "bin"
23
+ ],
24
+ "bin": {
25
+ "apify": "./bin/run.js"
26
+ },
27
+ "contributors": [
28
+ "Jakub Drobník <jakub.drobnik@apify.com>",
29
+ "Jan Curn <jan@apify.com>"
30
+ ],
31
+ "repository": {
32
+ "type": "git",
33
+ "url": "git+https://github.com/apify/apify-cli.git"
34
+ },
35
+ "keywords": [
36
+ "apify",
37
+ "client",
38
+ "node",
39
+ "command",
40
+ "line",
41
+ "bash"
42
+ ],
43
+ "author": {
44
+ "name": "Apify",
45
+ "email": "support@apify.com",
46
+ "url": "https://www.apify.com"
47
+ },
48
+ "license": "Apache-2.0",
49
+ "bugs": {
50
+ "url": "https://github.com/apify/apify-cli/issues"
51
+ },
52
+ "homepage": "https://github.com/apify/apify-cli#readme",
53
+ "engines": {
54
+ "node": ">=16.0.0"
55
+ },
56
+ "dependencies": {
57
+ "@apify/actor-templates": "~0.1.5",
58
+ "@apify/consts": "~2.26.0",
59
+ "@apify/input_schema": "~3.5.15",
60
+ "@apify/utilities": "~2.10.0",
61
+ "@crawlee/memory-storage": "~3.8.1",
62
+ "@oclif/core": "~3.20.0",
63
+ "@oclif/plugin-help": "~6.0.14",
64
+ "@root/walk": "~1.1.0",
65
+ "adm-zip": "~0.5.10",
66
+ "ajv": "~8.12.0",
67
+ "apify-client": "~2.9.3",
68
+ "archiver": "~7.0.0",
69
+ "axios": "~1.6.7",
70
+ "chalk": "~5.3.0",
71
+ "computer-name": "~0.1.0",
72
+ "configparser": "~0.3.10",
73
+ "cors": "~2.8.5",
74
+ "detect-indent": "~7.0.1",
75
+ "escape-string-regexp": "~5.0.0",
76
+ "express": "~4.18.2",
77
+ "globby": "~14.0.1",
78
+ "handlebars": "~4.7.8",
79
+ "inquirer": "~9.2.15",
80
+ "is-ci": "~3.0.1",
81
+ "is-online": "~10.0.0",
82
+ "istextorbinary": "~9.5.0",
83
+ "jju": "~1.4.0",
84
+ "load-json-file": "~7.0.1",
85
+ "mime": "~4.0.1",
86
+ "mixpanel": "~0.18.0",
87
+ "open": "~10.0.4",
88
+ "ow": "~1.1.1",
89
+ "rimraf": "~5.0.5",
90
+ "semver": "~7.6.0",
91
+ "tiged": "~2.12.7",
92
+ "underscore": "~1.13.6",
93
+ "write-json-file": "~5.0.0"
94
+ },
95
+ "devDependencies": {
96
+ "@apify/eslint-config": "^0.4.0",
97
+ "@apify/eslint-config-ts": "^0.4.1",
98
+ "@apify/tsconfig": "^0.1.0",
99
+ "@crawlee/types": "^3.8.1",
100
+ "@oclif/test": "^3.2.1",
101
+ "@types/adm-zip": "^0.5.5",
102
+ "@types/archiver": "^6.0.2",
103
+ "@types/chai": "^4.3.12",
104
+ "@types/cors": "^2.8.17",
105
+ "@types/express": "^4.17.21",
106
+ "@types/inquirer": "^9.0.7",
107
+ "@types/is-ci": "^3.0.4",
108
+ "@types/jju": "^1.4.5",
109
+ "@types/mime": "^3.0.4",
110
+ "@types/node": "^20.11.20",
111
+ "@types/semver": "^7.5.8",
112
+ "@types/underscore": "^1.11.15",
113
+ "@typescript-eslint/eslint-plugin": "^7.0.2",
114
+ "@typescript-eslint/parser": "^7.0.2",
115
+ "chai": "^4.4.1",
116
+ "eslint": "^8.57.0",
117
+ "oclif": "^4.4.18",
118
+ "tsx": "^4.7.1",
119
+ "typescript": "^5.3.3",
120
+ "vitest": "^1.3.1"
121
+ },
122
+ "oclif": {
123
+ "bin": "apify",
124
+ "dirname": "apify",
125
+ "commands": "./dist/commands",
126
+ "plugins": [
127
+ "@oclif/plugin-help"
128
+ ],
129
+ "hooks": {
130
+ "init": [
131
+ "./dist/hooks/init"
132
+ ]
133
+ },
134
+ "helpClass": "./dist/lib/apify-oclif-help"
135
+ },
136
+ "volta": {
137
+ "node": "20.11.1",
138
+ "npm": "10.5.0"
139
+ }
116
140
  }
package/index.js DELETED
@@ -1 +0,0 @@
1
- module.exports = {};
package/src/bin/run DELETED
@@ -1,16 +0,0 @@
1
- #!/usr/bin/env node
2
- /* eslint-disable */
3
- const outputs = require('../lib/outputs');
4
-
5
- (async () => {
6
- try {
7
- await require('@oclif/command').run()
8
- } catch (err) {
9
- const exitCode = (err.oclif && err.oclif.exit !== undefined) ? err.oclif.exit : 1;
10
- if (exitCode !== 0) {
11
- outputs.error(err.message);
12
- if (process.env.DEBUG) console.error(err);
13
- process.exit(exitCode);
14
- }
15
- }
16
- })();
@@ -1,12 +0,0 @@
1
- const { outputInputFromDefaultStore } = require('../../lib/actor');
2
- const { ApifyCommand } = require('../../lib/apify_command');
3
-
4
- class GetInputCommand extends ApifyCommand {
5
- async run() {
6
- await outputInputFromDefaultStore();
7
- }
8
- }
9
-
10
- GetInputCommand.description = 'Gets the actor input value from the default key-value store associated with the actor run.';
11
-
12
- module.exports = GetInputCommand;
@@ -1,23 +0,0 @@
1
- const { outputRecordFromDefaultStore } = require('../../lib/actor');
2
- const { ApifyCommand } = require('../../lib/apify_command');
3
-
4
- class GetValueCommand extends ApifyCommand {
5
- async run() {
6
- const { args } = this.parse(GetValueCommand);
7
- const { key } = args;
8
-
9
- await outputRecordFromDefaultStore(key);
10
- }
11
- }
12
-
13
- GetValueCommand.description = 'Gets a value from the default key-value store associated with the actor run.';
14
-
15
- GetValueCommand.args = [
16
- {
17
- name: 'key',
18
- required: true,
19
- description: 'Key of the record in key-value store',
20
- },
21
- ];
22
-
23
- module.exports = GetValueCommand;
@@ -1,13 +0,0 @@
1
- const { Command } = require('@oclif/command');
2
-
3
- const { showHelpForCommand } = require('../../lib/utils');
4
-
5
- class ActorIndexCommand extends Command {
6
- async run() {
7
- showHelpForCommand('actor');
8
- }
9
- }
10
-
11
- ActorIndexCommand.description = 'Commands are designed to be used in Actor runs. All commands are in PoC state, do not use in production environments.\n';
12
-
13
- module.exports = ActorIndexCommand;
@@ -1,44 +0,0 @@
1
- const { getApifyStorageClient, getDefaultStorageId, APIFY_STORAGE_TYPES } = require('../../lib/actor');
2
- const { ApifyCommand } = require('../../lib/apify_command');
3
-
4
- class PushDataCommand extends ApifyCommand {
5
- async init() {
6
- await super.init();
7
- // Read data from stdin of the command
8
- this.stdin = await this.readStdin(process.stdin);
9
- }
10
-
11
- async run() {
12
- const { args } = this.parse(PushDataCommand);
13
- const { item } = args;
14
-
15
- const apifyClient = getApifyStorageClient();
16
- const defaultStoreId = getDefaultStorageId(APIFY_STORAGE_TYPES.DATASET);
17
- const data = item || this.stdin;
18
- let parsedData;
19
- try {
20
- parsedData = JSON.parse(data);
21
- } catch (err) {
22
- throw new Error(`Failed to parse data as JSON string: ${err.message}`);
23
- }
24
-
25
- await apifyClient.dataset(defaultStoreId).pushItems(parsedData);
26
- }
27
- }
28
-
29
- PushDataCommand.description = 'Stores an object or an array of objects to the default dataset of the actor run.\n'
30
- + 'It is possible to pass data using item argument or stdin.\n'
31
- + 'Passing data using argument:\n'
32
- + '$ apify actor:push-data {"foo": "bar"}\n'
33
- + 'Passing data using stdin with pipe:\n'
34
- + '$ cat ./test.json | apify actor:push-data\n';
35
-
36
- PushDataCommand.args = [
37
- {
38
- name: 'item',
39
- required: false,
40
- description: 'JSON string with one object or array of objects containing data to be stored in the default dataset.',
41
- },
42
- ];
43
-
44
- module.exports = PushDataCommand;
@@ -1,63 +0,0 @@
1
- const { flags: flagsHelper } = require('@oclif/command');
2
-
3
- const { getApifyStorageClient, getDefaultStorageId, APIFY_STORAGE_TYPES } = require('../../lib/actor');
4
- const { ApifyCommand } = require('../../lib/apify_command');
5
-
6
- class SetValueCommand extends ApifyCommand {
7
- async init() {
8
- await super.init();
9
- // Read data from stdin of the command
10
- this.stdin = process.stdin;
11
- }
12
-
13
- async run() {
14
- const { args, flags } = this.parse(SetValueCommand);
15
- const { stdin } = this;
16
- const { key, value } = args;
17
- const { contentType = 'application/json; charset=utf-8' } = flags;
18
-
19
- // NOTE: If user pass value as argument and data on stdin same time. We use the value from argument.
20
- const recordValue = value || stdin;
21
- const apifyClient = await getApifyStorageClient();
22
- const storeClient = apifyClient.keyValueStore(getDefaultStorageId(APIFY_STORAGE_TYPES.KEY_VALUE_STORE));
23
- if (recordValue === undefined || recordValue === null) {
24
- await storeClient.deleteRecord(key);
25
- } else {
26
- await storeClient.setRecord({ key, value: recordValue, contentType });
27
- }
28
- }
29
- }
30
-
31
- SetValueCommand.description = 'Sets or removes record into the default key-value store associated with the Actor run.\n'
32
- + 'It is possible to pass data using argument or stdin.\n'
33
- + 'Passing data using argument:\n'
34
- + '$ apify actor:set-value KEY my-value\n'
35
- + 'Passing data using stdin with pipe:\n'
36
- + '$ cat ./my-text-file.txt | apify actor:set-value KEY --contentType text/plain\n';
37
-
38
- SetValueCommand.args = [
39
- {
40
- name: 'key',
41
- required: true,
42
- description: 'Key of the record in key-value store.',
43
- },
44
- {
45
- // TODO: It can be path of the file where value is store. We can add it in the next version.
46
- name: 'value',
47
- required: false,
48
- description: 'Record data, which can be one of the following values:\n'
49
- + '- If empty, the record in the key-value store is deleted.\n'
50
- + '- If no `contentType` flag is specified, value is expected to be any JSON string value.\n'
51
- + '- If options.contentType is set, value is taken as is.',
52
- },
53
- ];
54
-
55
- SetValueCommand.flags = {
56
- contentType: flagsHelper.string({
57
- char: 'c',
58
- description: 'Specifies a custom MIME content type of the record. By default "application/json" is used.',
59
- required: false,
60
- }),
61
- };
62
-
63
- module.exports = SetValueCommand;
@@ -1,131 +0,0 @@
1
- const { ACT_JOB_STATUSES } = require('@apify/consts');
2
- const { flags: flagsHelper } = require('@oclif/command');
3
- const mime = require('mime');
4
-
5
- const { ApifyCommand } = require('../lib/apify_command');
6
- const { LOCAL_CONFIG_PATH } = require('../lib/consts');
7
- const outputs = require('../lib/outputs');
8
- const { getLocalConfig, getLoggedClientOrThrow,
9
- getLocalUserInfo, getLocalInput, outputJobLog } = require('../lib/utils');
10
-
11
- // TODO: Show full error messages and HTTP codes, this is not great:
12
- // jan:testx$ apify call help
13
- // Run: Calling act help...
14
- // Error: [record-not-found]
15
-
16
- class CallCommand extends ApifyCommand {
17
- async run() {
18
- const { args, flags } = this.parse(CallCommand);
19
- const localConfig = getLocalConfig() || {};
20
- const apifyClient = await getLoggedClientOrThrow();
21
- const userInfo = await getLocalUserInfo();
22
- const usernameOrId = userInfo.username || userInfo.id;
23
-
24
- const forceActorId = args.actorId;
25
- let actorId;
26
- if (forceActorId) {
27
- const actor = await apifyClient.actor(forceActorId).get();
28
- if (!actor) throw new Error(`Cannot find Actor with ID '${forceActorId}' in your account.`);
29
- actorId = actor.username ? `${actor.username}/${actor.name}` : actor.id;
30
- } else {
31
- actorId = `${usernameOrId}/${localConfig.name}`;
32
- const actor = await apifyClient.actor(actorId).get();
33
- if (!actor) {
34
- throw new Error(`Cannot find actor with ID '${actorId}' `
35
- + 'in your account. Call "apify push" to push this actor to Apify platform.');
36
- }
37
- }
38
-
39
- const runOpts = {
40
- waitForFinish: 2, // NOTE: We need to wait some time to Apify open stream and we can create connection
41
- };
42
- const waitForFinishMillis = Number.isNaN(flags.waitForFinish)
43
- ? undefined
44
- : parseInt(flags.waitForFinish, 10) * 1000;
45
-
46
- ['build', 'timeout', 'memory'].forEach((opt) => {
47
- if (flags[opt]) runOpts[opt] = flags[opt];
48
- });
49
-
50
- // Get input for act
51
- const localInput = getLocalInput();
52
-
53
- outputs.run(`Calling actor ${actorId}`);
54
-
55
- let run;
56
- try {
57
- if (localInput) {
58
- // TODO: For some reason we cannot pass json as buffer with right contentType into apify-client.
59
- // It will save malformed JSON which looks like buffer as INPUT.
60
- // We need to fix this in v1 during removing call under actor namespace.
61
- const input = mime.getExtension(localInput.contentType) === 'json' ? JSON.parse(localInput.body.toString('utf-8')) : localInput.body;
62
- run = await apifyClient.actor(actorId).start(input, { ...runOpts, contentType: localInput.contentType });
63
- } else {
64
- run = await apifyClient.actor(actorId).start(null, runOpts);
65
- }
66
- } catch (err) {
67
- // TODO: Better error message in apify-client-js
68
- if (err.type === 'record-not-found') throw new Error(`Actor ${args.actorId} not found!`);
69
- else throw err;
70
- }
71
-
72
- try {
73
- await outputJobLog(run, waitForFinishMillis);
74
- } catch (err) {
75
- outputs.warning('Can not get log:');
76
- console.error(err);
77
- }
78
-
79
- run = await apifyClient.run(run.id).get();
80
-
81
- outputs.link('Actor run detail', `https://console.apify.com/actors/${run.actId}#/runs/${run.id}`);
82
-
83
- if (run.status === ACT_JOB_STATUSES.SUCCEEDED) {
84
- outputs.success('Actor finished.');
85
- } else if (run.status === ACT_JOB_STATUSES.RUNNING) {
86
- outputs.warning('Actor is still running!');
87
- } else {
88
- outputs.error('Actor failed!');
89
- }
90
- }
91
- }
92
-
93
- CallCommand.description = 'Runs a specific actor remotely on the Apify cloud platform.\n'
94
- + 'The Actor is run under your current Apify account. Therefore you need to be logged in by calling "apify login". '
95
- + 'It takes input for the Actor from the default local key-value store by default.';
96
-
97
- CallCommand.flags = {
98
- build: flagsHelper.string({
99
- char: 'b',
100
- description: 'Tag or number of the build to run (e.g. "latest" or "1.2.34").',
101
- required: false,
102
- }),
103
- timeout: flagsHelper.string({
104
- char: 't',
105
- description: 'Timeout for the actor run in seconds. Zero value means there is no timeout.',
106
- required: false,
107
- parse: (input) => parseInt(input, 10),
108
- }),
109
- memory: flagsHelper.string({
110
- char: 'm',
111
- description: 'Amount of memory allocated for the actor run, in megabytes.',
112
- required: false,
113
- parse: (input) => parseInt(input, 10),
114
- }),
115
- 'wait-for-finish': flagsHelper.string({
116
- char: 'w',
117
- description: 'Seconds for waiting to run to finish, if no value passed, it waits forever.',
118
- required: false,
119
- }),
120
- };
121
-
122
- CallCommand.args = [
123
- {
124
- name: 'actorId',
125
- required: false,
126
- description: 'Name or ID of the actor to run (e.g. "apify/hello-world" or "E2jjCZBezvAZnX8Rb"). '
127
- + `If not provided, the command runs the remote actor specified in the "${LOCAL_CONFIG_PATH}" file.`,
128
- },
129
- ];
130
-
131
- module.exports = CallCommand;
@@ -1,28 +0,0 @@
1
- const { flags: flagsHelper } = require('@oclif/command');
2
-
3
- const { ApifyCommand } = require('../lib/apify_command');
4
- const { checkLatestVersion } = require('../lib/version_check');
5
-
6
- class CheckVersionCommand extends ApifyCommand {
7
- async run() {
8
- const { flags } = this.parse(CheckVersionCommand);
9
-
10
- checkLatestVersion(flags.enforceUpdate);
11
- }
12
- }
13
-
14
- CheckVersionCommand.description = 'Checks that installed Apify CLI version is up to date.';
15
-
16
- CheckVersionCommand.flags = {
17
- 'enforce-update': flagsHelper.boolean({
18
- char: 'e',
19
- description: '[Optional] Enforce version update from NPM',
20
- required: false,
21
- }),
22
- };
23
-
24
- CheckVersionCommand.hidden = true;
25
-
26
- CheckVersionCommand.aliases = ['cv'];
27
-
28
- module.exports = CheckVersionCommand;