apify 2.3.1-beta.4 → 3.0.0-alpha.10

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 (233) hide show
  1. package/README.md +6 -5
  2. package/actor.d.ts +1092 -0
  3. package/actor.d.ts.map +1 -0
  4. package/actor.js +1221 -0
  5. package/actor.js.map +1 -0
  6. package/index.d.ts +4 -0
  7. package/index.d.ts.map +1 -0
  8. package/index.js +7 -0
  9. package/index.js.map +1 -0
  10. package/index.mjs +7 -0
  11. package/package.json +54 -128
  12. package/platform_event_manager.d.ts +55 -0
  13. package/platform_event_manager.d.ts.map +1 -0
  14. package/platform_event_manager.js +116 -0
  15. package/platform_event_manager.js.map +1 -0
  16. package/proxy_configuration.d.ts +210 -0
  17. package/proxy_configuration.d.ts.map +1 -0
  18. package/proxy_configuration.js +297 -0
  19. package/proxy_configuration.js.map +1 -0
  20. package/tsconfig.build.tsbuildinfo +1 -0
  21. package/utils.d.ts +11 -0
  22. package/utils.d.ts.map +1 -0
  23. package/utils.js +40 -0
  24. package/utils.js.map +1 -0
  25. package/build/actor.d.ts +0 -113
  26. package/build/actor.d.ts.map +0 -1
  27. package/build/actor.js +0 -582
  28. package/build/actor.js.map +0 -1
  29. package/build/apify.d.ts +0 -752
  30. package/build/apify.d.ts.map +0 -1
  31. package/build/apify.js +0 -877
  32. package/build/apify.js.map +0 -1
  33. package/build/autoscaling/autoscaled_pool.d.ts +0 -384
  34. package/build/autoscaling/autoscaled_pool.d.ts.map +0 -1
  35. package/build/autoscaling/autoscaled_pool.js +0 -557
  36. package/build/autoscaling/autoscaled_pool.js.map +0 -1
  37. package/build/autoscaling/snapshotter.d.ts +0 -278
  38. package/build/autoscaling/snapshotter.d.ts.map +0 -1
  39. package/build/autoscaling/snapshotter.js +0 -447
  40. package/build/autoscaling/snapshotter.js.map +0 -1
  41. package/build/autoscaling/system_status.d.ts +0 -224
  42. package/build/autoscaling/system_status.d.ts.map +0 -1
  43. package/build/autoscaling/system_status.js +0 -228
  44. package/build/autoscaling/system_status.js.map +0 -1
  45. package/build/browser_launchers/browser_launcher.d.ts +0 -154
  46. package/build/browser_launchers/browser_launcher.d.ts.map +0 -1
  47. package/build/browser_launchers/browser_launcher.js +0 -160
  48. package/build/browser_launchers/browser_launcher.js.map +0 -1
  49. package/build/browser_launchers/browser_plugin.d.ts +0 -23
  50. package/build/browser_launchers/browser_plugin.d.ts.map +0 -1
  51. package/build/browser_launchers/browser_plugin.js +0 -25
  52. package/build/browser_launchers/browser_plugin.js.map +0 -1
  53. package/build/browser_launchers/playwright_launcher.d.ts +0 -131
  54. package/build/browser_launchers/playwright_launcher.d.ts.map +0 -1
  55. package/build/browser_launchers/playwright_launcher.js +0 -150
  56. package/build/browser_launchers/playwright_launcher.js.map +0 -1
  57. package/build/browser_launchers/puppeteer_launcher.d.ts +0 -153
  58. package/build/browser_launchers/puppeteer_launcher.d.ts.map +0 -1
  59. package/build/browser_launchers/puppeteer_launcher.js +0 -197
  60. package/build/browser_launchers/puppeteer_launcher.js.map +0 -1
  61. package/build/cache_container.d.ts +0 -31
  62. package/build/cache_container.d.ts.map +0 -1
  63. package/build/cache_container.js +0 -48
  64. package/build/cache_container.js.map +0 -1
  65. package/build/configuration.d.ts +0 -226
  66. package/build/configuration.d.ts.map +0 -1
  67. package/build/configuration.js +0 -325
  68. package/build/configuration.js.map +0 -1
  69. package/build/constants.d.ts +0 -37
  70. package/build/constants.d.ts.map +0 -1
  71. package/build/constants.js +0 -41
  72. package/build/constants.js.map +0 -1
  73. package/build/crawlers/basic_crawler.d.ts +0 -443
  74. package/build/crawlers/basic_crawler.d.ts.map +0 -1
  75. package/build/crawlers/basic_crawler.js +0 -664
  76. package/build/crawlers/basic_crawler.js.map +0 -1
  77. package/build/crawlers/browser_crawler.d.ts +0 -512
  78. package/build/crawlers/browser_crawler.d.ts.map +0 -1
  79. package/build/crawlers/browser_crawler.js +0 -540
  80. package/build/crawlers/browser_crawler.js.map +0 -1
  81. package/build/crawlers/cheerio_crawler.d.ts +0 -931
  82. package/build/crawlers/cheerio_crawler.d.ts.map +0 -1
  83. package/build/crawlers/cheerio_crawler.js +0 -913
  84. package/build/crawlers/cheerio_crawler.js.map +0 -1
  85. package/build/crawlers/crawler_extension.d.ts +0 -10
  86. package/build/crawlers/crawler_extension.d.ts.map +0 -1
  87. package/build/crawlers/crawler_extension.js +0 -19
  88. package/build/crawlers/crawler_extension.js.map +0 -1
  89. package/build/crawlers/crawler_utils.d.ts +0 -34
  90. package/build/crawlers/crawler_utils.d.ts.map +0 -1
  91. package/build/crawlers/crawler_utils.js +0 -87
  92. package/build/crawlers/crawler_utils.js.map +0 -1
  93. package/build/crawlers/playwright_crawler.d.ts +0 -448
  94. package/build/crawlers/playwright_crawler.d.ts.map +0 -1
  95. package/build/crawlers/playwright_crawler.js +0 -299
  96. package/build/crawlers/playwright_crawler.js.map +0 -1
  97. package/build/crawlers/puppeteer_crawler.d.ts +0 -425
  98. package/build/crawlers/puppeteer_crawler.d.ts.map +0 -1
  99. package/build/crawlers/puppeteer_crawler.js +0 -299
  100. package/build/crawlers/puppeteer_crawler.js.map +0 -1
  101. package/build/crawlers/statistics.d.ts +0 -185
  102. package/build/crawlers/statistics.d.ts.map +0 -1
  103. package/build/crawlers/statistics.js +0 -331
  104. package/build/crawlers/statistics.js.map +0 -1
  105. package/build/enqueue_links/click_elements.d.ts +0 -179
  106. package/build/enqueue_links/click_elements.d.ts.map +0 -1
  107. package/build/enqueue_links/click_elements.js +0 -434
  108. package/build/enqueue_links/click_elements.js.map +0 -1
  109. package/build/enqueue_links/enqueue_links.d.ts +0 -117
  110. package/build/enqueue_links/enqueue_links.d.ts.map +0 -1
  111. package/build/enqueue_links/enqueue_links.js +0 -163
  112. package/build/enqueue_links/enqueue_links.js.map +0 -1
  113. package/build/enqueue_links/shared.d.ts +0 -42
  114. package/build/enqueue_links/shared.d.ts.map +0 -1
  115. package/build/enqueue_links/shared.js +0 -121
  116. package/build/enqueue_links/shared.js.map +0 -1
  117. package/build/errors.d.ts +0 -29
  118. package/build/errors.d.ts.map +0 -1
  119. package/build/errors.js +0 -38
  120. package/build/errors.js.map +0 -1
  121. package/build/events.d.ts +0 -11
  122. package/build/events.d.ts.map +0 -1
  123. package/build/events.js +0 -147
  124. package/build/events.js.map +0 -1
  125. package/build/index.d.ts +0 -4
  126. package/build/index.d.ts.map +0 -1
  127. package/build/index.js +0 -7
  128. package/build/index.js.map +0 -1
  129. package/build/main.d.ts +0 -179
  130. package/build/main.d.ts.map +0 -1
  131. package/build/main.js +0 -81
  132. package/build/main.js.map +0 -1
  133. package/build/playwright_utils.d.ts +0 -9
  134. package/build/playwright_utils.d.ts.map +0 -1
  135. package/build/playwright_utils.js +0 -90
  136. package/build/playwright_utils.js.map +0 -1
  137. package/build/proxy_configuration.d.ts +0 -411
  138. package/build/proxy_configuration.d.ts.map +0 -1
  139. package/build/proxy_configuration.js +0 -517
  140. package/build/proxy_configuration.js.map +0 -1
  141. package/build/pseudo_url.d.ts +0 -86
  142. package/build/pseudo_url.d.ts.map +0 -1
  143. package/build/pseudo_url.js +0 -153
  144. package/build/pseudo_url.js.map +0 -1
  145. package/build/puppeteer_request_interception.d.ts +0 -8
  146. package/build/puppeteer_request_interception.d.ts.map +0 -1
  147. package/build/puppeteer_request_interception.js +0 -235
  148. package/build/puppeteer_request_interception.js.map +0 -1
  149. package/build/puppeteer_utils.d.ts +0 -250
  150. package/build/puppeteer_utils.d.ts.map +0 -1
  151. package/build/puppeteer_utils.js +0 -551
  152. package/build/puppeteer_utils.js.map +0 -1
  153. package/build/request.d.ts +0 -180
  154. package/build/request.d.ts.map +0 -1
  155. package/build/request.js +0 -261
  156. package/build/request.js.map +0 -1
  157. package/build/request_list.d.ts +0 -581
  158. package/build/request_list.d.ts.map +0 -1
  159. package/build/request_list.js +0 -826
  160. package/build/request_list.js.map +0 -1
  161. package/build/serialization.d.ts +0 -5
  162. package/build/serialization.d.ts.map +0 -1
  163. package/build/serialization.js +0 -139
  164. package/build/serialization.js.map +0 -1
  165. package/build/session_pool/errors.d.ts +0 -11
  166. package/build/session_pool/errors.d.ts.map +0 -1
  167. package/build/session_pool/errors.js +0 -18
  168. package/build/session_pool/errors.js.map +0 -1
  169. package/build/session_pool/events.d.ts +0 -5
  170. package/build/session_pool/events.d.ts.map +0 -1
  171. package/build/session_pool/events.js +0 -6
  172. package/build/session_pool/events.js.map +0 -1
  173. package/build/session_pool/session.d.ts +0 -286
  174. package/build/session_pool/session.d.ts.map +0 -1
  175. package/build/session_pool/session.js +0 -355
  176. package/build/session_pool/session.js.map +0 -1
  177. package/build/session_pool/session_pool.d.ts +0 -280
  178. package/build/session_pool/session_pool.d.ts.map +0 -1
  179. package/build/session_pool/session_pool.js +0 -393
  180. package/build/session_pool/session_pool.js.map +0 -1
  181. package/build/session_pool/session_utils.d.ts +0 -4
  182. package/build/session_pool/session_utils.d.ts.map +0 -1
  183. package/build/session_pool/session_utils.js +0 -24
  184. package/build/session_pool/session_utils.js.map +0 -1
  185. package/build/stealth/hiding_tricks.d.ts +0 -22
  186. package/build/stealth/hiding_tricks.d.ts.map +0 -1
  187. package/build/stealth/hiding_tricks.js +0 -308
  188. package/build/stealth/hiding_tricks.js.map +0 -1
  189. package/build/stealth/stealth.d.ts +0 -56
  190. package/build/stealth/stealth.d.ts.map +0 -1
  191. package/build/stealth/stealth.js +0 -125
  192. package/build/stealth/stealth.js.map +0 -1
  193. package/build/storages/dataset.d.ts +0 -288
  194. package/build/storages/dataset.d.ts.map +0 -1
  195. package/build/storages/dataset.js +0 -480
  196. package/build/storages/dataset.js.map +0 -1
  197. package/build/storages/key_value_store.d.ts +0 -243
  198. package/build/storages/key_value_store.d.ts.map +0 -1
  199. package/build/storages/key_value_store.js +0 -462
  200. package/build/storages/key_value_store.js.map +0 -1
  201. package/build/storages/request_queue.d.ts +0 -318
  202. package/build/storages/request_queue.d.ts.map +0 -1
  203. package/build/storages/request_queue.js +0 -636
  204. package/build/storages/request_queue.js.map +0 -1
  205. package/build/storages/storage_manager.d.ts +0 -87
  206. package/build/storages/storage_manager.d.ts.map +0 -1
  207. package/build/storages/storage_manager.js +0 -150
  208. package/build/storages/storage_manager.js.map +0 -1
  209. package/build/tsconfig.tsbuildinfo +0 -1
  210. package/build/typedefs.d.ts +0 -146
  211. package/build/typedefs.d.ts.map +0 -1
  212. package/build/typedefs.js +0 -88
  213. package/build/typedefs.js.map +0 -1
  214. package/build/utils.d.ts +0 -175
  215. package/build/utils.d.ts.map +0 -1
  216. package/build/utils.js +0 -731
  217. package/build/utils.js.map +0 -1
  218. package/build/utils_log.d.ts +0 -41
  219. package/build/utils_log.d.ts.map +0 -1
  220. package/build/utils_log.js +0 -192
  221. package/build/utils_log.js.map +0 -1
  222. package/build/utils_request.d.ts +0 -77
  223. package/build/utils_request.d.ts.map +0 -1
  224. package/build/utils_request.js +0 -385
  225. package/build/utils_request.js.map +0 -1
  226. package/build/utils_social.d.ts +0 -210
  227. package/build/utils_social.d.ts.map +0 -1
  228. package/build/utils_social.js +0 -787
  229. package/build/utils_social.js.map +0 -1
  230. package/build/validators.d.ts +0 -23
  231. package/build/validators.d.ts.map +0 -1
  232. package/build/validators.js +0 -29
  233. package/build/validators.js.map +0 -1
@@ -1,146 +0,0 @@
1
- /**
2
- * Represents information about an actor run, as returned by the
3
- * {@link Apifycall } or {@link ApifycallTask } function.
4
- * The object is almost equivalent to the JSON response
5
- * of the
6
- * [Actor run](https://apify.com/docs/api/v2#/reference/actors/run-collection/run-actor)
7
- * Apify API endpoint and extended with certain fields.
8
- * For more details, see
9
- * [Runs.](https://docs.apify.com/actor/run)
10
- */
11
- export type ActorRun = {
12
- /**
13
- * Actor run ID
14
- */
15
- id: string;
16
- /**
17
- * Actor ID
18
- */
19
- actId: string;
20
- /**
21
- * Time when the actor run started
22
- */
23
- startedAt: Date;
24
- /**
25
- * Time when the actor run finished. Contains `null` for running actors.
26
- */
27
- finishedAt: Date;
28
- /**
29
- * Status of the run. For possible values, see
30
- * [Run lifecycle](https://docs.apify.com/actors/running#lifecycle)
31
- * in Apify actor documentation.
32
- */
33
- status: string;
34
- /**
35
- * Actor run meta-data. For example:
36
- * ```
37
- * {
38
- * "origin": "API",
39
- * "clientIp": "1.2.3.4",
40
- * "userAgent": "ApifyClient/0.2.13 (Linux; Node/v8.11.3)"
41
- * }
42
- * ```
43
- */
44
- meta: {
45
- [x: string]: string;
46
- };
47
- /**
48
- * An object containing various actor run statistics. For example:
49
- * ```
50
- * {
51
- * "inputBodyLen": 22,
52
- * "restartCount": 0,
53
- * "workersUsed": 1,
54
- * }
55
- * ```
56
- * Beware that object fields might change in future releases.
57
- */
58
- stats: {
59
- [x: string]: number;
60
- };
61
- /**
62
- * Actor run options. For example:
63
- * ```
64
- * {
65
- * "build": "latest",
66
- * "waitSecs": 0,
67
- * "memoryMbytes": 256,
68
- * "diskMbytes": 512
69
- * }
70
- * ```
71
- */
72
- options: {
73
- [x: string]: any;
74
- };
75
- /**
76
- * ID of the actor build used for the run. For details, see
77
- * [Builds](https://docs.apify.com/actor/build)
78
- * in Apify actor documentation.
79
- */
80
- buildId: string;
81
- /**
82
- * Number of the actor build used for the run. For example, `0.0.10`.
83
- */
84
- buildNumber: string;
85
- /**
86
- * Exit code of the actor run process. It's `null` if actor is still running.
87
- */
88
- exitCode: number;
89
- /**
90
- * ID of the default key-value store associated with the actor run. See {@link KeyValueStore } for details.
91
- */
92
- defaultKeyValueStoreId: string;
93
- /**
94
- * ID of the default dataset associated with the actor run. See {@link Dataset } for details.
95
- */
96
- defaultDatasetId: string;
97
- /**
98
- * ID of the default request queue associated with the actor run. See {@link RequestQueue } for details.
99
- */
100
- defaultRequestQueueId: string;
101
- /**
102
- * URL on which the web server running inside actor run's Docker container can be accessed.
103
- * For more details, see
104
- * [Container web server](https://docs.apify.com/actor/run#container-web-server)
105
- * in Apify actor documentation.
106
- */
107
- containerUrl: string;
108
- /**
109
- * Contains output of the actor run. The value is `null` or `undefined` in case the actor is still running,
110
- * or if you pass `false` to the `fetchOutput` option of {@link Apifycall }.
111
- *
112
- * For example:
113
- * ```
114
- * {
115
- * "contentType": "application/json; charset=utf-8",
116
- * "body": {
117
- * "message": "Hello world!"
118
- * }
119
- * }
120
- * ```
121
- */
122
- output: ({
123
- [x: string]: any;
124
- } | null | undefined);
125
- };
126
- export type DirectNavigationOptions = {
127
- /**
128
- * Maximum operation time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The
129
- * default value can be changed by using the browserContext.setDefaultNavigationTimeout(timeout),
130
- * browserContext.setDefaultTimeout(timeout), page.setDefaultNavigationTimeout(timeout) or
131
- * page.setDefaultTimeout(timeout) methods.
132
- */
133
- timeout?: number | undefined;
134
- /**
135
- * When to consider operation succeeded, defaults to `load`. Events can be either:
136
- * - `'domcontentloaded'` - consider operation to be finished when the `DOMContentLoaded` event is fired.
137
- * - `'load'` - consider operation to be finished when the `load` event is fired.
138
- * - `'networkidle'` - consider operation to be finished when there are no network connections for at least `500` ms.
139
- */
140
- waitUntil?: "domcontentloaded" | "load" | "networkidle" | undefined;
141
- /**
142
- * Referer header value. If provided it will take preference over the referer header value set by page.setExtraHTTPHeaders(headers).
143
- */
144
- referer?: string | undefined;
145
- };
146
- //# sourceMappingURL=typedefs.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"typedefs.d.ts","sourceRoot":"","sources":["../src/typedefs.js"],"names":[],"mappings":";;;;;;;;;;;;;;QAWc,MAAM;;;;WAEN,MAAM;;;;eAEN,IAAI;;;;gBAEJ,IAAI;;;;;;YAEJ,MAAM;;;;;;;;;;;;YAIC,MAAM,GAAE,MAAM;;;;;;;;;;;;;;YASd,MAAM,GAAE,MAAM;;;;;;;;;;;;;;YAUd,MAAM;;;;;;;aAUb,MAAM;;;;iBAIN,MAAM;;;;cAEN,MAAM;;;;4BAEN,MAAM;;;;sBAEN,MAAM;;;;2BAEN,MAAM;;;;;;;kBAEN,MAAM;;;;;;;;;;;;;;;YAKN,CAAC;YAAO,MAAM;QAAK,IAAI,GAAC,SAAS,CAAC"}
package/build/typedefs.js DELETED
@@ -1,88 +0,0 @@
1
- "use strict";
2
- /**
3
- * Represents information about an actor run, as returned by the
4
- * {@link Apify#call} or {@link Apify#callTask} function.
5
- * The object is almost equivalent to the JSON response
6
- * of the
7
- * [Actor run](https://apify.com/docs/api/v2#/reference/actors/run-collection/run-actor)
8
- * Apify API endpoint and extended with certain fields.
9
- * For more details, see
10
- * [Runs.](https://docs.apify.com/actor/run)
11
- *
12
- * @typedef ActorRun
13
- * @property {string} id
14
- * Actor run ID
15
- * @property {string} actId
16
- * Actor ID
17
- * @property {Date} startedAt
18
- * Time when the actor run started
19
- * @property {Date} finishedAt
20
- * Time when the actor run finished. Contains `null` for running actors.
21
- * @property {string} status
22
- * Status of the run. For possible values, see
23
- * [Run lifecycle](https://docs.apify.com/actors/running#lifecycle)
24
- * in Apify actor documentation.
25
- * @property {Object<string, string>} meta
26
- * Actor run meta-data. For example:
27
- * ```
28
- * {
29
- * "origin": "API",
30
- * "clientIp": "1.2.3.4",
31
- * "userAgent": "ApifyClient/0.2.13 (Linux; Node/v8.11.3)"
32
- * }
33
- * ```
34
- * @property {Object<string, number>} stats
35
- * An object containing various actor run statistics. For example:
36
- * ```
37
- * {
38
- * "inputBodyLen": 22,
39
- * "restartCount": 0,
40
- * "workersUsed": 1,
41
- * }
42
- * ```
43
- * Beware that object fields might change in future releases.
44
- * @property {Object<string, *>} options
45
- * Actor run options. For example:
46
- * ```
47
- * {
48
- * "build": "latest",
49
- * "waitSecs": 0,
50
- * "memoryMbytes": 256,
51
- * "diskMbytes": 512
52
- * }
53
- * ```
54
- * @property {string} buildId
55
- * ID of the actor build used for the run. For details, see
56
- * [Builds](https://docs.apify.com/actor/build)
57
- * in Apify actor documentation.
58
- * @property {string} buildNumber
59
- * Number of the actor build used for the run. For example, `0.0.10`.
60
- * @property {number} exitCode
61
- * Exit code of the actor run process. It's `null` if actor is still running.
62
- * @property {string} defaultKeyValueStoreId
63
- * ID of the default key-value store associated with the actor run. See {@link KeyValueStore} for details.
64
- * @property {string} defaultDatasetId
65
- * ID of the default dataset associated with the actor run. See {@link Dataset} for details.
66
- * @property {string} defaultRequestQueueId
67
- * ID of the default request queue associated with the actor run. See {@link RequestQueue} for details.
68
- * @property {string} containerUrl
69
- * URL on which the web server running inside actor run's Docker container can be accessed.
70
- * For more details, see
71
- * [Container web server](https://docs.apify.com/actor/run#container-web-server)
72
- * in Apify actor documentation.
73
- * @property {(Object<string, *>|null|undefined)} output
74
- * Contains output of the actor run. The value is `null` or `undefined` in case the actor is still running,
75
- * or if you pass `false` to the `fetchOutput` option of {@link Apify#call}.
76
- *
77
- * For example:
78
- * ```
79
- * {
80
- * "contentType": "application/json; charset=utf-8",
81
- * "body": {
82
- * "message": "Hello world!"
83
- * }
84
- * }
85
- * ```
86
- */
87
- Object.defineProperty(exports, "__esModule", { value: true });
88
- //# sourceMappingURL=typedefs.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"typedefs.js","sourceRoot":"","sources":["../src/typedefs.js"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoFG"}
package/build/utils.d.ts DELETED
@@ -1,175 +0,0 @@
1
- /// <reference types="node" />
2
- export function newClient(options?: {
3
- token?: string | undefined;
4
- maxRetries?: string | undefined;
5
- minDelayBetweenRetriesMillis?: string | undefined;
6
- } | undefined): ApifyClient;
7
- export function logSystemInfo(): void;
8
- /**
9
- * The default instance of `ApifyClient` used internally
10
- * by the SDK.
11
- *
12
- * @type {*}
13
- * @ignore
14
- */
15
- export const apifyClient: any;
16
- export function addCharsetToContentType(contentType: string): string;
17
- export function isDocker(forceReset: boolean): Promise<boolean>;
18
- export function weightedAvg(arrValues: number[], arrWeights: number[]): number;
19
- export function getMemoryInfo(): Promise<MemoryInfo>;
20
- export function getFirstKey(dict: any): string | undefined;
21
- export function getTypicalChromeExecutablePath(): string;
22
- export function isAtHome(): boolean;
23
- export function sleep(millis: number): Promise<void>;
24
- export function snakeCaseToCamelCase(snakeCaseStr: string): string;
25
- export function printOutdatedSdkWarning(): void;
26
- export function parseContentTypeFromResponse(response: IncomingMessage): {
27
- type: string;
28
- charset: string;
29
- };
30
- export function waitForRunToFinish(options: {
31
- actorId: string;
32
- runId: string;
33
- waitSecs?: string | undefined;
34
- token?: string | undefined;
35
- }): Promise<ActorRun>;
36
- export function purgeLocalStorage(folder?: string | undefined): Promise<void>;
37
- export namespace publicUtils {
38
- export { isDocker };
39
- export { sleep };
40
- export { downloadListOfUrls };
41
- export { extractUrls };
42
- export { htmlToText };
43
- export { URL_NO_COMMAS_REGEX };
44
- export { URL_WITH_COMMAS_REGEX };
45
- export { createRequestDebugInfo };
46
- export { waitForRunToFinish };
47
- export { purgeLocalStorage };
48
- }
49
- /**
50
- * Describes memory usage of an Actor.
51
- */
52
- export type MemoryInfo = {
53
- /**
54
- * Total memory available in the system or container
55
- */
56
- totalBytes: number;
57
- /**
58
- * Amount of free memory in the system or container
59
- */
60
- freeBytes: number;
61
- /**
62
- * Amount of memory used (= totalBytes - freeBytes)
63
- */
64
- usedBytes: number;
65
- /**
66
- * Amount of memory used the current Node.js process
67
- */
68
- mainProcessBytes: number;
69
- /**
70
- * Amount of memory used by child processes of the current Node.js process
71
- */
72
- childProcessesBytes: number;
73
- };
74
- import { ApifyClient } from "apify-client/dist/apify_client";
75
- import { IncomingMessage } from "http";
76
- import { ActorRun } from "./typedefs";
77
- /**
78
- * Returns a promise that resolves to an array of urls parsed from the resource available at the provided url.
79
- * Optionally, custom regular expression and encoding may be provided.
80
- *
81
- * @param {object} options
82
- * @param {string} options.url URL to the file
83
- * @param {string} [options.encoding='utf8'] The encoding of the file.
84
- * @param {string} [options.proxyUrl] The proxy url to be used for the request.
85
- * @param {RegExp} [options.urlRegExp=URL_NO_COMMAS_REGEX]
86
- * Custom regular expression to identify the URLs in the file to extract.
87
- * The regular expression should be case-insensitive and have global flag set (i.e. `/something/gi`).
88
- * @returns {Promise<Array<string>>}
89
- * @memberOf utils
90
- */
91
- declare function downloadListOfUrls(options: {
92
- url: string;
93
- encoding?: string | undefined;
94
- proxyUrl?: string | undefined;
95
- urlRegExp?: RegExp | undefined;
96
- }): Promise<Array<string>>;
97
- /**
98
- * Collects all URLs in an arbitrary string to an array, optionally using a custom regular expression.
99
- * @param {object} options
100
- * @param {string} options.string
101
- * @param {RegExp} [options.urlRegExp=Apify.utils.URL_NO_COMMAS_REGEX]
102
- * @returns {string[]}
103
- * @memberOf utils
104
- */
105
- declare function extractUrls(options: {
106
- string: string;
107
- urlRegExp?: RegExp | undefined;
108
- }): string[];
109
- /**
110
- * The function converts a HTML document to a plain text.
111
- *
112
- * The plain text generated by the function is similar to a text captured
113
- * by pressing Ctrl+A and Ctrl+C on a page when loaded in a web browser.
114
- * The function doesn't aspire to preserve the formatting or to be perfectly correct with respect to HTML specifications.
115
- * However, it attempts to generate newlines and whitespaces in and around HTML elements
116
- * to avoid merging distinct parts of text and thus enable extraction of data from the text (e.g. phone numbers).
117
- *
118
- * **Example usage**
119
- * ```javascript
120
- * const text = htmlToText('<html><body>Some text</body></html>');
121
- * console.log(text);
122
- * ```
123
- *
124
- * Note that the function uses [cheerio](https://www.npmjs.com/package/cheerio) to parse the HTML.
125
- * Optionally, to avoid duplicate parsing of HTML and thus improve performance, you can pass
126
- * an existing Cheerio object to the function instead of the HTML text. The HTML should be parsed
127
- * with the `decodeEntities` option set to `true`. For example:
128
- *
129
- * ```javascript
130
- * const cheerio = require('cheerio');
131
- * const html = '<html><body>Some text</body></html>';
132
- * const text = htmlToText(cheerio.load(html, { decodeEntities: true }));
133
- * ```
134
- * @param {(string|CheerioAPI)} html HTML text or parsed HTML represented using a
135
- * [cheerio](https://www.npmjs.com/package/cheerio) function.
136
- * @return {string} Plain text
137
- * @memberOf utils
138
- * @function
139
- */
140
- declare function htmlToText(html: (string | CheerioAPI)): string;
141
- /**
142
- * Default regular expression to match URLs in a string that may be plain text, JSON, CSV or other. It supports common URL characters
143
- * and does not support URLs containing commas or spaces. The URLs also may contain Unicode letters (not symbols).
144
- * @memberOf utils
145
- */
146
- declare const URL_NO_COMMAS_REGEX: RegExp;
147
- /**
148
- * Regular expression that, in addition to the default regular expression `URL_NO_COMMAS_REGEX`, supports matching commas in URL path and query.
149
- * Note, however, that this may prevent parsing URLs from comma delimited lists, or the URLs may become malformed.
150
- * @memberOf utils
151
- */
152
- declare const URL_WITH_COMMAS_REGEX: RegExp;
153
- /**
154
- * Creates a standardized debug info from request and response. This info is usually added to dataset under the hidden `#debug` field.
155
- *
156
- * @param {(Request|RequestOptions)} request [Apify.Request](https://sdk.apify.com/docs/api/request) object.
157
- * @param {(*|IncomingMessage|PuppeteerResponse)} [response]
158
- * Puppeteer [`Response`](https://pptr.dev/#?product=Puppeteer&version=v1.11.0&show=api-class-response)
159
- * or NodeJS [`http.IncomingMessage`](https://nodejs.org/api/http.html#http_class_http_serverresponse).
160
- * @param {Object<string, *>} [additionalFields] Object containing additional fields to be added.
161
-
162
- * @return {Object<string, *>}
163
- */
164
- declare function createRequestDebugInfo(request: (Request | RequestOptions), response?: (any | IncomingMessage | PuppeteerResponse), additionalFields?: {
165
- [x: string]: any;
166
- } | undefined): {
167
- [x: string]: any;
168
- };
169
- import { CheerioAPI } from "cheerio/lib/load";
170
- import Request from "./request";
171
- import { RequestOptions } from "./request";
172
- // @ts-ignore optional peer dependency
173
- import { HTTPResponse as PuppeteerResponse } from "puppeteer";
174
- export {};
175
- //# sourceMappingURL=utils.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.js"],"names":[],"mappings":";AA+EO;;;;gBAFK,WAAW,CAmBtB;AAKM,sCAON;AAED;;;;;;GAMG;AACH,8BAAuE;AAUhE,qDALI,MAAM,GACJ,MAAM,CAclB;AA6BM,qCAPI,OAAO,GACN,QAAQ,OAAO,CAAC,CAW3B;AAWM,uCANI,MAAM,EAAE,cACR,MAAM,EAAE,GACP,MAAM,CAajB;AA4BM,iCANM,QAAQ,UAAU,CAAC,CA2H/B;AAOM,2DAIN;AAQM,kDAHK,MAAM,CA6BjB;AAWM,4BANM,OAAO,CAM4C;AAsBzD,8BANI,MAAM,GAIL,QAAQ,IAAI,CAAC,CAIxB;AAgLM,mDAJI,MAAM,GACL,MAAM,CAajB;AAOM,gDAQN;AAQM,uDAJI,eAAe,GACd;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAgC5C;AA+BM;IApBoB,OAAO,EAAvB,MAAM;IAEU,KAAK,EAArB,MAAM;IAEW,QAAQ;IAIR,KAAK;IAIpB,QAAQ,QAAQ,CAAC,CA+C7B;AAcM,gEALM,QAAQ,IAAI,CAAC,CAazB;;;;;;;;;;;;;;;;;;;;gBAriBa,MAAM;;;;eACN,MAAM;;;;eACN,MAAM;;;;sBACN,MAAM;;;;yBACN,MAAM;;;;;AAyNpB;;;;;;;;;;;;;GAaG;AACH;IAT2B,GAAG,EAAnB,MAAM;IACW,QAAQ;IACR,QAAQ;IACR,SAAS;IAGxB,QAAQ,MAAM,MAAM,CAAC,CAAC,CAsBlC;AAED;;;;;;;GAOG;AACH;IAL2B,MAAM,EAAtB,MAAM;IACW,SAAS;IACxB,MAAM,EAAE,CAUpB;AAMD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,kCANW,CAAC,MAAM,GAAC,UAAU,CAAC,GAElB,MAAM,CAqDjB;AAxgBD;;;;GAIG;AACH,0CAAoL;AACpL;;;;GAIG;AACH,4CAAuL;AA+fvL;;;;;;;;;;GAUG;AACH,iDARW,CAAC,OAAO,GAAC,cAAc,CAAC,aACxB,CAAC,MAAE,eAAe,GAAC,iBAAiB,CAAC;;;QAK7B,MAAM;EAkBxB"}