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,288 +0,0 @@
1
- export const DATASET_ITERATORS_DEFAULT_LIMIT: 10000;
2
- export const LOCAL_FILENAME_DIGITS: 9;
3
- export function checkAndSerialize(item: any, limitBytes: number, index?: number | undefined): string;
4
- export function chunkBySize(items: Array<string>, limitBytes: number): Array<string>;
5
- /**
6
- * The `Dataset` class represents a store for structured data where each object stored has the same attributes,
7
- * such as online store products or real estate offers. You can imagine it as a table,
8
- * where each object is a row and its attributes are columns.
9
- * Dataset is an append-only storage - you can only add new records to it but you cannot modify or remove existing records.
10
- * Typically it is used to store crawling results.
11
- *
12
- * Do not instantiate this class directly, use the
13
- * {@link Apify#openDataset} function instead.
14
- *
15
- * `Dataset` stores its data either on local disk or in the Apify cloud,
16
- * depending on whether the `APIFY_LOCAL_STORAGE_DIR` or `APIFY_TOKEN` environment variables are set.
17
- *
18
- * If the `APIFY_LOCAL_STORAGE_DIR` environment variable is set, the data is stored in
19
- * the local directory in the following files:
20
- * ```
21
- * {APIFY_LOCAL_STORAGE_DIR}/datasets/{DATASET_ID}/{INDEX}.json
22
- * ```
23
- * Note that `{DATASET_ID}` is the name or ID of the dataset. The default dataset has ID: `default`,
24
- * unless you override it by setting the `APIFY_DEFAULT_DATASET_ID` environment variable.
25
- * Each dataset item is stored as a separate JSON file, where `{INDEX}` is a zero-based index of the item in the dataset.
26
- *
27
- * If the `APIFY_TOKEN` environment variable is set but `APIFY_LOCAL_STORAGE_DIR` not, the data is stored in the
28
- * [Apify Dataset](https://docs.apify.com/storage/dataset)
29
- * cloud storage. Note that you can force usage of the cloud storage also by passing the `forceCloud`
30
- * option to {@link Apify#openDataset} function,
31
- * even if the `APIFY_LOCAL_STORAGE_DIR` variable is set.
32
- *
33
- * **Example usage:**
34
- *
35
- * ```javascript
36
- * // Write a single row to the default dataset
37
- * await Apify.pushData({ col1: 123, col2: 'val2' });
38
- *
39
- * // Open a named dataset
40
- * const dataset = await Apify.openDataset('some-name');
41
- *
42
- * // Write a single row
43
- * await dataset.pushData({ foo: 'bar' });
44
- *
45
- * // Write multiple rows
46
- * await dataset.pushData([
47
- * { foo: 'bar2', col2: 'val2' },
48
- * { col3: 123 },
49
- * ]);
50
- * ```
51
- * @hideconstructor
52
- */
53
- export class Dataset {
54
- /**
55
- * @param {object} options
56
- * @param {string} options.id
57
- * @param {string} [options.name]
58
- * @param {ApifyClient|ApifyStorageLocal} options.client
59
- * @param {boolean} options.isLocal
60
- */
61
- constructor(options: {
62
- id: string;
63
- name?: string | undefined;
64
- client: ApifyClient | ApifyStorageLocal;
65
- isLocal: boolean;
66
- });
67
- id: string;
68
- name: string | undefined;
69
- isLocal: boolean;
70
- client: import("@apify/storage-local/dist/resource_clients/dataset").DatasetClient | import("apify-client").DatasetClient<Record<string | number, unknown>>;
71
- log: import("@apify/log/log").Log;
72
- /**
73
- * Stores an object or an array of objects to the dataset.
74
- * The function returns a promise that resolves when the operation finishes.
75
- * It has no result, but throws on invalid args or other errors.
76
- *
77
- * **IMPORTANT**: Make sure to use the `await` keyword when calling `pushData()`,
78
- * otherwise the actor process might finish before the data is stored!
79
- *
80
- * The size of the data is limited by the receiving API and therefore `pushData()` will only
81
- * allow objects whose JSON representation is smaller than 9MB. When an array is passed,
82
- * none of the included objects
83
- * may be larger than 9MB, but the array itself may be of any size.
84
- *
85
- * The function internally
86
- * chunks the array into separate items and pushes them sequentially.
87
- * The chunking process is stable (keeps order of data), but it does not provide a transaction
88
- * safety mechanism. Therefore, in the event of an uploading error (after several automatic retries),
89
- * the function's Promise will reject and the dataset will be left in a state where some of
90
- * the items have already been saved to the dataset while other items from the source array were not.
91
- * To overcome this limitation, the developer may, for example, read the last item saved in the dataset
92
- * and re-attempt the save of the data from this item onwards to prevent duplicates.
93
- * @param {object|Array<object>} data Object or array of objects containing data to be stored in the default dataset.
94
- * The objects must be serializable to JSON and the JSON representation of each object must be smaller than 9MB.
95
- * @return {Promise<void>}
96
- */
97
- pushData(data: object | Array<object>): Promise<void>;
98
- /**
99
- * Returns {@link DatasetContent} object holding the items in the dataset based on the provided parameters.
100
- *
101
- * If you need to get data in an unparsed format, use the {@link Apify#newClient} function to get a new
102
- * `apify-client` instance and call
103
- * [`datasetClient.downloadItems()`](https://github.com/apify/apify-client-js#DatasetClient+downloadItems)
104
- *
105
- * @param {Object} [options] All `getData()` parameters are passed
106
- * via an options object with the following keys:
107
- * @param {number} [options.offset=0]
108
- * Number of array elements that should be skipped at the start.
109
- * @param {number} [options.limit=250000]
110
- * Maximum number of array elements to return.
111
- * @param {boolean} [options.desc=false]
112
- * If `true` then the objects are sorted by `createdAt` in descending order.
113
- * Otherwise they are sorted in ascending order.
114
- * @param {string[]} [options.fields]
115
- * An array of field names that will be included in the result. If omitted, all fields are included in the results.
116
- * @param {string} [options.unwind]
117
- * Specifies a name of the field in the result objects that will be used to unwind the resulting objects.
118
- * By default, the results are returned as they are.
119
- * @param {boolean} [options.clean=false]
120
- * If `true` then the function returns only non-empty items and skips hidden fields (i.e. fields starting with `#` character).
121
- * Note that the `clean` parameter is a shortcut for `skipHidden: true` and `skipEmpty: true` options.
122
- * @param {boolean} [options.skipHidden=false]
123
- * If `true` then the function doesn't return hidden fields (fields starting with "#" character).
124
- * @param {boolean} [options.skipEmpty=false]
125
- * If `true` then the function doesn't return empty items.
126
- * Note that in this case the returned number of items might be lower than limit parameter and pagination must be done using the `limit` value.
127
- * @return {Promise<DatasetContent>}
128
- */
129
- getData(options?: {
130
- offset?: number | undefined;
131
- limit?: number | undefined;
132
- desc?: boolean | undefined;
133
- fields?: string[] | undefined;
134
- unwind?: string | undefined;
135
- clean?: boolean | undefined;
136
- skipHidden?: boolean | undefined;
137
- skipEmpty?: boolean | undefined;
138
- } | undefined): Promise<DatasetContent>;
139
- /**
140
- * Returns an object containing general information about the dataset.
141
- *
142
- * The function returns the same object as the Apify API Client's
143
- * [getDataset](https://docs.apify.com/api/apify-client-js/latest#ApifyClient-datasets-getDataset)
144
- * function, which in turn calls the
145
- * [Get dataset](https://apify.com/docs/api/v2#/reference/datasets/dataset/get-dataset)
146
- * API endpoint.
147
- *
148
- * **Example:**
149
- * ```
150
- * {
151
- * id: "WkzbQMuFYuamGv3YF",
152
- * name: "my-dataset",
153
- * userId: "wRsJZtadYvn4mBZmm",
154
- * createdAt: new Date("2015-12-12T07:34:14.202Z"),
155
- * modifiedAt: new Date("2015-12-13T08:36:13.202Z"),
156
- * accessedAt: new Date("2015-12-14T08:36:13.202Z"),
157
- * itemCount: 14,
158
- * cleanItemCount: 10
159
- * }
160
- * ```
161
- *
162
- * @returns {Promise<object>}
163
- */
164
- getInfo(): Promise<object>;
165
- /**
166
- * Iterates over dataset items, yielding each in turn to an `iteratee` function.
167
- * Each invocation of `iteratee` is called with two arguments: `(item, index)`.
168
- *
169
- * If the `iteratee` function returns a Promise then it is awaited before the next call.
170
- * If it throws an error, the iteration is aborted and the `forEach` function throws the error.
171
- *
172
- * **Example usage**
173
- * ```javascript
174
- * const dataset = await Apify.openDataset('my-results');
175
- * await dataset.forEach(async (item, index) => {
176
- * console.log(`Item at ${index}: ${JSON.stringify(item)}`);
177
- * });
178
- * ```
179
- *
180
- * @param {DatasetConsumer} iteratee A function that is called for every item in the dataset.
181
- * @param {Object} [options] All `forEach()` parameters are passed
182
- * via an options object with the following keys:
183
- * @param {boolean} [options.desc=false] If `true` then the objects are sorted by `createdAt` in descending order.
184
- * @param {string[]} [options.fields] If provided then returned objects will only contain specified keys.
185
- * @param {string} [options.unwind] If provided then objects will be unwound based on provided field.
186
- * @param {number} [index=0] Specifies the initial index number passed to the `iteratee` function.
187
- * @return {Promise<void>}
188
- */
189
- forEach(iteratee: DatasetConsumer, options?: {
190
- desc?: boolean | undefined;
191
- fields?: string[] | undefined;
192
- unwind?: string | undefined;
193
- } | undefined, index?: number | undefined): Promise<void>;
194
- /**
195
- * Produces a new array of values by mapping each value in list through a transformation function `iteratee()`.
196
- * Each invocation of `iteratee()` is called with two arguments: `(element, index)`.
197
- *
198
- * If `iteratee` returns a `Promise` then it's awaited before a next call.
199
- *
200
- * @param {DatasetMapper} iteratee
201
- * @param {Object} [options] All `map()` parameters are passed
202
- * via an options object with the following keys:
203
- * @param {boolean} [options.desc=false] If `true` then the objects are sorted by createdAt in descending order.
204
- * @param {string[]} [options.fields] If provided then returned objects will only contain specified keys
205
- * @param {string} [options.unwind] If provided then objects will be unwound based on provided field.
206
- * @return {Promise<Array<object>>}
207
- */
208
- map(iteratee: DatasetMapper, options?: {
209
- desc?: boolean | undefined;
210
- fields?: string[] | undefined;
211
- unwind?: string | undefined;
212
- } | undefined): Promise<Array<object>>;
213
- /**
214
- * Reduces a list of values down to a single value.
215
- *
216
- * Memo is the initial state of the reduction, and each successive step of it should be returned by `iteratee()`.
217
- * The `iteratee()` is passed three arguments: the `memo`, then the `value` and `index` of the iteration.
218
- *
219
- * If no `memo` is passed to the initial invocation of reduce, the `iteratee()` is not invoked on the first element of the list.
220
- * The first element is instead passed as the memo in the invocation of the `iteratee()` on the next element in the list.
221
- *
222
- * If `iteratee()` returns a `Promise` then it's awaited before a next call.
223
- *
224
- * @param {DatasetReducer} iteratee
225
- * @param {object} memo Initial state of the reduction.
226
- * @param {Object} [options] All `reduce()` parameters are passed
227
- * via an options object with the following keys:
228
- * @param {boolean} [options.desc=false] If `true` then the objects are sorted by createdAt in descending order.
229
- * @param {string[]} [options.fields] If provided then returned objects will only contain specified keys
230
- * @param {string} [options.unwind] If provided then objects will be unwound based on provided field.
231
- * @return {Promise<object>}
232
- */
233
- reduce(iteratee: DatasetReducer, memo: object, options?: {
234
- desc?: boolean | undefined;
235
- fields?: string[] | undefined;
236
- unwind?: string | undefined;
237
- } | undefined): Promise<object>;
238
- /**
239
- * Removes the dataset either from the Apify cloud storage or from the local directory,
240
- * depending on the mode of operation.
241
- *
242
- * @return {Promise<void>}
243
- */
244
- drop(): Promise<void>;
245
- }
246
- export function openDataset(datasetIdOrName?: string | undefined, options?: {
247
- forceCloud?: boolean | undefined;
248
- config?: Configuration | undefined;
249
- } | undefined): Promise<Dataset>;
250
- export function pushData(item: object): Promise<void>;
251
- export type DatasetContent = {
252
- /**
253
- * Dataset entries based on chosen format parameter.
254
- */
255
- items: Array<object>;
256
- /**
257
- * Total count of entries in the dataset.
258
- */
259
- total: number;
260
- /**
261
- * Position of the first returned entry in the dataset.
262
- */
263
- offset: number;
264
- /**
265
- * Count of dataset entries returned in this set.
266
- */
267
- count: number;
268
- /**
269
- * Maximum number of dataset entries requested.
270
- */
271
- limit: number;
272
- };
273
- /**
274
- * User-function used in the `Dataset.forEach()` API.
275
- */
276
- export type DatasetConsumer = (item: object, index: number) => object;
277
- /**
278
- * User-function used in the `Dataset.map()` API.
279
- */
280
- export type DatasetMapper = (item: object, index: number) => object;
281
- /**
282
- * User-function used in the `Dataset.reduce()` API.
283
- */
284
- export type DatasetReducer = (memo: object, item: object, index: number) => object;
285
- import { ApifyClient } from "apify-client/dist/apify_client";
286
- import { ApifyStorageLocal } from "@apify/storage-local";
287
- import { Configuration } from "../configuration";
288
- //# sourceMappingURL=dataset.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"dataset.d.ts","sourceRoot":"","sources":["../../src/storages/dataset.js"],"names":[],"mappings":"AAcA,oDAAqD;AACrD,sCAAuC;AAchC,yDALI,MAAM,+BAEJ,MAAM,CAuBlB;AAeM,mCALI,MAAM,MAAM,CAAC,cACb,MAAM,GACJ,MAAM,MAAM,CAAC,CA6BzB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+CG;AACH;IACI;;;;;;OAMG;IACH;QAL2B,EAAE,EAAlB,MAAM;QACW,IAAI;QACkB,MAAM,EAA7C,WAAW,GAAC,iBAAiB;QACZ,OAAO,EAAxB,OAAO;OAQjB;IALG,WAAoB;IACpB,yBAAwB;IACxB,iBAA8B;IAC9B,4JAA6C;IAC7C,kCAA2C;IAG/C;;;;;;;;;;;;;;;;;;;;;;;;OAwBG;IACH,eAJW,MAAM,GAAC,MAAM,MAAM,CAAC,GAEnB,QAAQ,IAAI,CAAC,CAsBxB;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA8BG;IACH;;;;;;;;;oBAFY,QAAQ,cAAc,CAAC,CAWlC;IAED;;;;;;;;;;;;;;;;;;;;;;;;OAwBG;IACH,WAFa,QAAQ,MAAM,CAAC,CAI3B;IAED;;;;;;;;;;;;;;;;;;;;;;;OAuBG;IACH,kBATW,eAAe;;;;gDAOd,QAAQ,IAAI,CAAC,CAkBxB;IAED;;;;;;;;;;;;;OAaG;IACH,cARW,aAAa;;;;oBAMZ,QAAQ,MAAM,MAAM,CAAC,CAAC,CAejC;IAED;;;;;;;;;;;;;;;;;;;OAmBG;IACH,iBATW,cAAc,QACd,MAAM;;;;oBAML,QAAQ,MAAM,CAAC,CAqB1B;IAED;;;;;OAKG;IACH,QAFY,QAAQ,IAAI,CAAC,CAMxB;CACJ;AAwBM;;;gBALM,QAAQ,OAAO,CAAC,CAc5B;AA8BM,+BARI,MAAM,GAEJ,QAAQ,IAAI,CAAC,CAUzB;;;;;WAIa,MAAM,MAAM,CAAC;;;;WACb,MAAM;;;;YACN,MAAM;;;;WACN,MAAM;;;;WACN,MAAM;;;;;qCAOT,MAAM,SACN,MAAM,KACJ,MAAM;;;;mCAOR,MAAM,SACN,MAAM,KACJ,MAAM;;;;oCAMR,MAAM,QACN,MAAM,SACN,MAAM,KACJ,MAAM"}