apify-client 3.0.0-beta.4 → 3.0.0-beta.41

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 (117) hide show
  1. package/README.md +13 -3
  2. package/dist/apify_api_error.d.ts +62 -21
  3. package/dist/apify_api_error.js +96 -23
  4. package/dist/apify_client.d.ts +125 -10
  5. package/dist/apify_client.js +133 -48
  6. package/dist/base/api_client.d.ts +7 -7
  7. package/dist/base/api_client.js +24 -16
  8. package/dist/base/resource_client.d.ts +23 -9
  9. package/dist/base/resource_client.js +57 -29
  10. package/dist/base/resource_collection_client.d.ts +8 -4
  11. package/dist/base/resource_collection_client.js +26 -15
  12. package/dist/body_parser.d.ts +3 -4
  13. package/dist/body_parser.js +19 -26
  14. package/dist/bundle.js +29 -22
  15. package/dist/bundle.js.map +1 -1
  16. package/dist/generated/api.d.ts +887 -322
  17. package/dist/generated/schemas.d.ts +6717 -0
  18. package/dist/generated/schemas.js +1527 -0
  19. package/dist/http_clients/axios.d.ts +60 -0
  20. package/dist/http_clients/axios.js +117 -0
  21. package/dist/http_clients/base.d.ts +333 -0
  22. package/dist/http_clients/base.js +563 -0
  23. package/dist/http_clients/index.d.ts +4 -0
  24. package/dist/http_clients/index.js +2 -0
  25. package/dist/http_compressors/base.d.ts +40 -0
  26. package/dist/http_compressors/base.js +9 -0
  27. package/dist/http_compressors/brotli.d.ts +33 -0
  28. package/dist/http_compressors/brotli.js +39 -0
  29. package/dist/http_compressors/gzip.d.ts +33 -0
  30. package/dist/http_compressors/gzip.js +39 -0
  31. package/dist/http_compressors/index.d.ts +6 -0
  32. package/dist/http_compressors/index.js +2 -0
  33. package/dist/http_compressors/resolve.d.ts +23 -0
  34. package/dist/http_compressors/resolve.js +27 -0
  35. package/dist/index.d.ts +5 -1
  36. package/dist/index.js +4 -1
  37. package/dist/invalid_response_body_error.d.ts +13 -0
  38. package/dist/invalid_response_body_error.js +17 -0
  39. package/dist/lazy_schema.d.ts +8 -0
  40. package/dist/lazy_schema.js +11 -0
  41. package/dist/models.d.ts +33 -61
  42. package/dist/resource_clients/actor.d.ts +52 -31
  43. package/dist/resource_clients/actor.js +81 -58
  44. package/dist/resource_clients/actor_collection.d.ts +9 -5
  45. package/dist/resource_clients/actor_collection.js +12 -3
  46. package/dist/resource_clients/actor_env_var.d.ts +10 -3
  47. package/dist/resource_clients/actor_env_var.js +17 -6
  48. package/dist/resource_clients/actor_env_var_collection.d.ts +14 -18
  49. package/dist/resource_clients/actor_env_var_collection.js +18 -11
  50. package/dist/resource_clients/actor_version.d.ts +18 -3
  51. package/dist/resource_clients/actor_version.js +20 -9
  52. package/dist/resource_clients/actor_version_collection.d.ts +16 -17
  53. package/dist/resource_clients/actor_version_collection.js +20 -11
  54. package/dist/resource_clients/build.d.ts +18 -6
  55. package/dist/resource_clients/build.js +37 -17
  56. package/dist/resource_clients/build_collection.d.ts +3 -1
  57. package/dist/resource_clients/build_collection.js +5 -1
  58. package/dist/resource_clients/dataset.d.ts +49 -31
  59. package/dist/resource_clients/dataset.js +102 -76
  60. package/dist/resource_clients/dataset_collection.d.ts +6 -2
  61. package/dist/resource_clients/dataset_collection.js +14 -2
  62. package/dist/resource_clients/key_value_store.d.ts +58 -16
  63. package/dist/resource_clients/key_value_store.js +80 -41
  64. package/dist/resource_clients/key_value_store_collection.d.ts +6 -2
  65. package/dist/resource_clients/key_value_store_collection.js +14 -2
  66. package/dist/resource_clients/log.d.ts +11 -19
  67. package/dist/resource_clients/log.js +64 -46
  68. package/dist/resource_clients/request_queue.d.ts +56 -26
  69. package/dist/resource_clients/request_queue.js +197 -116
  70. package/dist/resource_clients/request_queue_collection.d.ts +6 -2
  71. package/dist/resource_clients/request_queue_collection.js +10 -3
  72. package/dist/resource_clients/run.d.ts +53 -18
  73. package/dist/resource_clients/run.js +94 -47
  74. package/dist/resource_clients/run_collection.d.ts +3 -1
  75. package/dist/resource_clients/run_collection.js +5 -1
  76. package/dist/resource_clients/schedule.d.ts +16 -7
  77. package/dist/resource_clients/schedule.js +32 -21
  78. package/dist/resource_clients/schedule_collection.d.ts +6 -2
  79. package/dist/resource_clients/schedule_collection.js +10 -3
  80. package/dist/resource_clients/store_collection.d.ts +3 -1
  81. package/dist/resource_clients/store_collection.js +5 -1
  82. package/dist/resource_clients/task.d.ts +28 -10
  83. package/dist/resource_clients/task.js +71 -46
  84. package/dist/resource_clients/task_collection.d.ts +6 -2
  85. package/dist/resource_clients/task_collection.js +10 -3
  86. package/dist/resource_clients/user.d.ts +17 -8
  87. package/dist/resource_clients/user.js +43 -39
  88. package/dist/resource_clients/webhook.d.ts +14 -5
  89. package/dist/resource_clients/webhook.js +31 -22
  90. package/dist/resource_clients/webhook_collection.d.ts +6 -2
  91. package/dist/resource_clients/webhook_collection.js +10 -3
  92. package/dist/resource_clients/webhook_dispatch.d.ts +4 -1
  93. package/dist/resource_clients/webhook_dispatch.js +8 -2
  94. package/dist/resource_clients/webhook_dispatch_collection.d.ts +3 -1
  95. package/dist/resource_clients/webhook_dispatch_collection.js +5 -1
  96. package/dist/response_validation_error.d.ts +26 -0
  97. package/dist/response_validation_error.js +37 -0
  98. package/dist/runtime/node.d.ts +6 -0
  99. package/dist/runtime/node.js +49 -0
  100. package/dist/runtime/types.d.ts +52 -0
  101. package/dist/runtime/types.js +1 -0
  102. package/dist/runtime/web.d.ts +5 -0
  103. package/dist/runtime/web.js +18 -0
  104. package/dist/schemas.d.ts +15 -0
  105. package/dist/schemas.js +15 -0
  106. package/dist/statistics.d.ts +1 -6
  107. package/dist/statistics.js +2 -2
  108. package/dist/timeouts.d.ts +84 -0
  109. package/dist/timeouts.js +37 -0
  110. package/dist/timezones.d.ts +1 -1
  111. package/dist/utils.d.ts +86 -46
  112. package/dist/utils.js +218 -164
  113. package/package.json +32 -29
  114. package/dist/http_client.d.ts +0 -88
  115. package/dist/http_client.js +0 -255
  116. package/dist/interceptors.d.ts +0 -19
  117. package/dist/interceptors.js +0 -105
@@ -1,6 +1,7 @@
1
1
  import type { ApiClientSubResourceOptions } from '../base/api_client.js';
2
2
  import { ResourceClient } from '../base/resource_client.js';
3
3
  import type { Build } from '../models.js';
4
+ import type { TimeoutOptions } from '../timeouts.js';
4
5
  import { LogClient } from './log.js';
5
6
  export type { Build, BuildMeta, BuildOptions, BuildStats, BuildUsage } from '../models.js';
6
7
  /**
@@ -36,6 +37,8 @@ export declare class BuildClient extends ResourceClient {
36
37
  *
37
38
  * @param options - Get options
38
39
  * @param options.waitForFinish - Maximum time to wait (in seconds, max 60s) for the build to finish on the API side before returning. Default is 0 (returns immediately).
40
+ * @param options.timeoutSecs - Timeout for the API request. Default is `'short'`, extended to cover `waitForFinish`
41
+ * when the API is asked to hold the response.
39
42
  * @returns The Build object, or `undefined` if it does not exist
40
43
  * @see https://docs.apify.com/api/v2/actor-build-get
41
44
  *
@@ -55,6 +58,8 @@ export declare class BuildClient extends ResourceClient {
55
58
  *
56
59
  * Stops the build process immediately. The build will have an `ABORTED` status.
57
60
  *
61
+ * @param options - Request options
62
+ * @param options.timeoutSecs - Timeout for the API request. Default is `'short'`.
58
63
  * @returns The updated Build object with `ABORTED` status
59
64
  * @see https://docs.apify.com/api/v2/actor-build-abort-post
60
65
  *
@@ -63,22 +68,26 @@ export declare class BuildClient extends ResourceClient {
63
68
  * await client.build('build-id').abort();
64
69
  * ```
65
70
  */
66
- abort(): Promise<Build>;
71
+ abort(options?: TimeoutOptions): Promise<Build>;
67
72
  /**
68
73
  * Deletes the Actor build.
69
74
  *
75
+ * @param options - Request options
76
+ * @param options.timeoutSecs - Timeout for the API request. Default is `'short'`.
70
77
  * @see https://docs.apify.com/api/v2/actor-build-delete
71
78
  * @since Added in 2.8.1
72
79
  */
73
- delete(): Promise<void>;
80
+ delete(options?: TimeoutOptions): Promise<void>;
74
81
  /**
75
82
  * Retrieves the OpenAPI definition for the Actor build.
76
83
  *
84
+ * @param options - Request options
85
+ * @param options.timeoutSecs - Timeout for the API request. Default is `'medium'`.
77
86
  * @returns The OpenAPI definition object.
78
87
  * @see https://docs.apify.com/api/v2/actor-build-openapi-json-get
79
88
  * @since Added in 2.11.2
80
89
  */
81
- getOpenApiDefinition(): Promise<OpenApiDefinition>;
90
+ getOpenApiDefinition(options?: TimeoutOptions): Promise<OpenApiDefinition>;
82
91
  /**
83
92
  * Waits for the Actor build to finish and returns the finished Build object.
84
93
  *
@@ -94,7 +103,8 @@ export declare class BuildClient extends ResourceClient {
94
103
  *
95
104
  * @param options - Wait options
96
105
  * @param options.waitSecs - Maximum time to wait for the build to finish, in seconds. If omitted, waits indefinitely.
97
- * @returns The Build object (finished or still building if timeout was reached)
106
+ * @param options.timeoutSecs - Timeout for each polling API request. Default is `'noTimeout'`.
107
+ * @returns The Build object (finished or still building if the timeout was reached)
98
108
  *
99
109
  * @example
100
110
  * ```javascript
@@ -113,6 +123,8 @@ export declare class BuildClient extends ResourceClient {
113
123
  /**
114
124
  * Returns a client for accessing the log of this Actor build.
115
125
  *
126
+ * A 404 from this client throws an `ApifyApiError`, since the build itself may be what is missing.
127
+ *
116
128
  * @returns A client for accessing the build's log
117
129
  * @see https://docs.apify.com/api/v2/actor-build-log-get
118
130
  *
@@ -129,13 +141,13 @@ export declare class BuildClient extends ResourceClient {
129
141
  /**
130
142
  * Options for getting a Build.
131
143
  */
132
- export interface BuildClientGetOptions {
144
+ export interface BuildClientGetOptions extends TimeoutOptions {
133
145
  waitForFinish?: number;
134
146
  }
135
147
  /**
136
148
  * Options for waiting for a Build to finish.
137
149
  */
138
- export interface BuildClientWaitForFinishOptions {
150
+ export interface BuildClientWaitForFinishOptions extends TimeoutOptions {
139
151
  /**
140
152
  * Maximum time to wait for the build to finish, in seconds.
141
153
  * If the limit is reached, the returned promise is resolved to a build object that will have
@@ -1,9 +1,11 @@
1
1
  import { z } from 'zod';
2
2
  import { ResourceClient } from '../base/resource_client.js';
3
- import { cast, parseArgument, parseDateFields, pluckData } from '../utils.js';
3
+ import * as schemas from '../schemas.js';
4
+ import { timeoutOptionsSchema, timeoutOptionsShape } from '../timeouts.js';
5
+ import { parseArgument, parseResponse } from '../utils.js';
4
6
  import { LogClient } from './log.js';
5
- const getOptionsSchema = z.strictObject({ waitForFinish: z.number().optional() });
6
- const waitForFinishOptionsSchema = z.strictObject({ waitSecs: z.number().optional() });
7
+ const getOptionsSchema = z.strictObject({ waitForFinish: z.number().optional(), ...timeoutOptionsShape });
8
+ const waitForFinishOptionsSchema = z.strictObject({ waitSecs: z.number().optional(), ...timeoutOptionsShape });
7
9
  /**
8
10
  * Client for managing a specific Actor build.
9
11
  *
@@ -42,6 +44,8 @@ export class BuildClient extends ResourceClient {
42
44
  *
43
45
  * @param options - Get options
44
46
  * @param options.waitForFinish - Maximum time to wait (in seconds, max 60s) for the build to finish on the API side before returning. Default is 0 (returns immediately).
47
+ * @param options.timeoutSecs - Timeout for the API request. Default is `'short'`, extended to cover `waitForFinish`
48
+ * when the API is asked to hold the response.
45
49
  * @returns The Build object, or `undefined` if it does not exist
46
50
  * @see https://docs.apify.com/api/v2/actor-build-get
47
51
  *
@@ -56,14 +60,16 @@ export class BuildClient extends ResourceClient {
56
60
  * ```
57
61
  */
58
62
  async get(options = {}) {
59
- const parsed = parseArgument(options, getOptionsSchema, 'BuildClientGetOptions');
60
- return this._get(parsed);
63
+ const { timeoutSecs, signal, ...params } = parseArgument(options, getOptionsSchema, 'BuildClientGetOptions');
64
+ return this.getResource(schemas.Build(), params, this.timeoutForWaitForFinish(timeoutSecs, 'short', params.waitForFinish), signal);
61
65
  }
62
66
  /**
63
67
  * Aborts the Actor build.
64
68
  *
65
69
  * Stops the build process immediately. The build will have an `ABORTED` status.
66
70
  *
71
+ * @param options - Request options
72
+ * @param options.timeoutSecs - Timeout for the API request. Default is `'short'`.
67
73
  * @returns The updated Build object with `ABORTED` status
68
74
  * @see https://docs.apify.com/api/v2/actor-build-abort-post
69
75
  *
@@ -72,35 +78,46 @@ export class BuildClient extends ResourceClient {
72
78
  * await client.build('build-id').abort();
73
79
  * ```
74
80
  */
75
- async abort() {
81
+ async abort(options = {}) {
82
+ const { timeoutSecs = 'short', signal } = parseArgument(options, timeoutOptionsSchema, 'TimeoutOptions');
76
83
  const response = await this.httpClient.call({
77
- url: this._url('abort'),
84
+ url: this.buildUrl('abort'),
78
85
  method: 'POST',
79
- params: this._params(),
86
+ params: this.buildParams(),
87
+ timeoutSecs,
88
+ signal,
80
89
  });
81
- return cast(parseDateFields(pluckData(response.data)));
90
+ return parseResponse(response, schemas.Build());
82
91
  }
83
92
  /**
84
93
  * Deletes the Actor build.
85
94
  *
95
+ * @param options - Request options
96
+ * @param options.timeoutSecs - Timeout for the API request. Default is `'short'`.
86
97
  * @see https://docs.apify.com/api/v2/actor-build-delete
87
98
  * @since Added in 2.8.1
88
99
  */
89
- async delete() {
90
- return this._delete();
100
+ async delete(options = {}) {
101
+ const { timeoutSecs = 'short', signal } = parseArgument(options, timeoutOptionsSchema, 'TimeoutOptions');
102
+ return this.deleteResource(timeoutSecs, signal);
91
103
  }
92
104
  /**
93
105
  * Retrieves the OpenAPI definition for the Actor build.
94
106
  *
107
+ * @param options - Request options
108
+ * @param options.timeoutSecs - Timeout for the API request. Default is `'medium'`.
95
109
  * @returns The OpenAPI definition object.
96
110
  * @see https://docs.apify.com/api/v2/actor-build-openapi-json-get
97
111
  * @since Added in 2.11.2
98
112
  */
99
- async getOpenApiDefinition() {
113
+ async getOpenApiDefinition(options = {}) {
114
+ const { timeoutSecs = 'medium', signal } = parseArgument(options, timeoutOptionsSchema, 'TimeoutOptions');
100
115
  const response = await this.httpClient.call({
101
- url: this._url('openapi.json'),
116
+ url: this.buildUrl('openapi.json'),
102
117
  method: 'GET',
103
- params: this._params(),
118
+ params: this.buildParams(),
119
+ timeoutSecs,
120
+ signal,
104
121
  });
105
122
  return response.data;
106
123
  }
@@ -119,7 +136,8 @@ export class BuildClient extends ResourceClient {
119
136
  *
120
137
  * @param options - Wait options
121
138
  * @param options.waitSecs - Maximum time to wait for the build to finish, in seconds. If omitted, waits indefinitely.
122
- * @returns The Build object (finished or still building if timeout was reached)
139
+ * @param options.timeoutSecs - Timeout for each polling API request. Default is `'noTimeout'`.
140
+ * @returns The Build object (finished or still building if the timeout was reached)
123
141
  *
124
142
  * @example
125
143
  * ```javascript
@@ -136,11 +154,13 @@ export class BuildClient extends ResourceClient {
136
154
  */
137
155
  async waitForFinish(options = {}) {
138
156
  const parsed = parseArgument(options, waitForFinishOptionsSchema, 'BuildClientWaitForFinishOptions');
139
- return this._waitForFinish(parsed);
157
+ return this.waitForJobFinish(schemas.Build(), parsed);
140
158
  }
141
159
  /**
142
160
  * Returns a client for accessing the log of this Actor build.
143
161
  *
162
+ * A 404 from this client throws an `ApifyApiError`, since the build itself may be what is missing.
163
+ *
144
164
  * @returns A client for accessing the build's log
145
165
  * @see https://docs.apify.com/api/v2/actor-build-log-get
146
166
  *
@@ -153,7 +173,7 @@ export class BuildClient extends ResourceClient {
153
173
  * @since Added in 2.9.0
154
174
  */
155
175
  log() {
156
- return new LogClient(this._subResourceOptions({
176
+ return new LogClient(this.subResourceOptions({
157
177
  resourcePath: 'log',
158
178
  }));
159
179
  }
@@ -1,6 +1,7 @@
1
1
  import type { ApiClientOptionsWithOptionalResourcePath } from '../base/api_client.js';
2
2
  import { ResourceCollectionClient } from '../base/resource_collection_client.js';
3
3
  import type { BuildCollectionClientListItem } from '../models.js';
4
+ import type { TimeoutOptions } from '../timeouts.js';
4
5
  import type { PaginatedIterator, PaginatedList, PaginationOptions } from '../utils.js';
5
6
  export type { BuildCollectionClientListItem } from '../models.js';
6
7
  /**
@@ -46,12 +47,13 @@ export declare class BuildCollectionClient extends ResourceCollectionClient {
46
47
  * ```
47
48
  *
48
49
  * @param options - Pagination and sorting options.
50
+ * @param options.timeoutSecs - Timeout for each API request. Default is `'medium'`.
49
51
  * @returns A paginated iterator of Actor builds.
50
52
  * @see https://docs.apify.com/api/v2/actor-builds-get
51
53
  */
52
54
  list(options?: BuildCollectionClientListOptions): PaginatedIterator<BuildCollectionClientListItem>;
53
55
  }
54
- export interface BuildCollectionClientListOptions extends PaginationOptions {
56
+ export interface BuildCollectionClientListOptions extends PaginationOptions, TimeoutOptions {
55
57
  desc?: boolean;
56
58
  }
57
59
  export type BuildCollectionClientListResult = PaginatedList<BuildCollectionClientListItem>;
@@ -1,9 +1,12 @@
1
1
  import { z } from 'zod';
2
2
  import { ResourceCollectionClient } from '../base/resource_collection_client.js';
3
+ import * as schemas from '../schemas.js';
4
+ import { timeoutOptionsShape } from '../timeouts.js';
3
5
  import { paginationOptionsShape, parseArgument } from '../utils.js';
4
6
  const listOptionsSchema = z.strictObject({
5
7
  ...paginationOptionsShape,
6
8
  desc: z.boolean().optional(),
9
+ ...timeoutOptionsShape,
7
10
  });
8
11
  /**
9
12
  * Client for managing the collection of Actor builds.
@@ -53,11 +56,12 @@ export class BuildCollectionClient extends ResourceCollectionClient {
53
56
  * ```
54
57
  *
55
58
  * @param options - Pagination and sorting options.
59
+ * @param options.timeoutSecs - Timeout for each API request. Default is `'medium'`.
56
60
  * @returns A paginated iterator of Actor builds.
57
61
  * @see https://docs.apify.com/api/v2/actor-builds-get
58
62
  */
59
63
  list(options = {}) {
60
64
  const parsed = parseArgument(options, listOptionsSchema, 'BuildCollectionClientListOptions');
61
- return this._listPaginated(parsed);
65
+ return this.listResourcesPaginated(schemas.ListOfBuilds(), parsed, 'medium');
62
66
  }
63
67
  }
@@ -2,7 +2,20 @@ import type { STORAGE_GENERAL_ACCESS } from '@apify/consts';
2
2
  import type { ApiClientSubResourceOptions } from '../base/api_client.js';
3
3
  import { ResourceClient } from '../base/resource_client.js';
4
4
  import type { Dataset, DatasetStatistics } from '../models.js';
5
+ import type { TimeoutOptions } from '../timeouts.js';
5
6
  import type { PaginatedIterator, PaginationOptions } from '../utils.js';
7
+ /**
8
+ * Supported formats for downloading dataset items.
9
+ */
10
+ export declare enum DownloadItemsFormat {
11
+ JSON = "json",
12
+ JSONL = "jsonl",
13
+ XML = "xml",
14
+ HTML = "html",
15
+ CSV = "csv",
16
+ XLSX = "xlsx",
17
+ RSS = "rss"
18
+ }
6
19
  export type { Dataset, DatasetStatistics, DatasetStats, FieldStatistics } from '../models.js';
7
20
  /**
8
21
  * Client for managing a specific Dataset.
@@ -34,6 +47,7 @@ export type { Dataset, DatasetStatistics, DatasetStats, FieldStatistics } from '
34
47
  * @see https://docs.apify.com/platform/storage/dataset
35
48
  */
36
49
  export declare class DatasetClient<Data extends Record<string | number, any> = Record<string | number, unknown>> extends ResourceClient {
50
+ #private;
37
51
  /**
38
52
  * @hidden
39
53
  */
@@ -41,24 +55,30 @@ export declare class DatasetClient<Data extends Record<string | number, any> = R
41
55
  /**
42
56
  * Gets the dataset object from the Apify API.
43
57
  *
58
+ * @param options - Request options
59
+ * @param options.timeoutSecs - Timeout for the API request. Default is `'short'`.
44
60
  * @returns The Dataset object, or `undefined` if it does not exist
45
61
  * @see https://docs.apify.com/api/v2/dataset-get
46
62
  */
47
- get(): Promise<Dataset | undefined>;
63
+ get(options?: TimeoutOptions): Promise<Dataset | undefined>;
48
64
  /**
49
65
  * Updates the dataset with specified fields.
50
66
  *
51
67
  * @param newFields - Fields to update in the dataset
68
+ * @param options - Request options
69
+ * @param options.timeoutSecs - Timeout for the API request. Default is `'short'`.
52
70
  * @returns The updated Dataset object
53
71
  * @see https://docs.apify.com/api/v2/dataset-put
54
72
  */
55
- update(newFields: DatasetClientUpdateOptions): Promise<Dataset>;
73
+ update(newFields: DatasetClientUpdateOptions, options?: TimeoutOptions): Promise<Dataset>;
56
74
  /**
57
75
  * Deletes the dataset.
58
76
  *
77
+ * @param options - Request options
78
+ * @param options.timeoutSecs - Timeout for the API request. Default is `'short'`.
59
79
  * @see https://docs.apify.com/api/v2/dataset-delete
60
80
  */
61
- delete(): Promise<void>;
81
+ delete(options?: TimeoutOptions): Promise<void>;
62
82
  /**
63
83
  * Lists items in the dataset.
64
84
  *
@@ -79,6 +99,7 @@ export declare class DatasetClient<Data extends Record<string | number, any> = R
79
99
  * @param options.flatten - Array of field names to flatten. Nested objects are converted to dot notation (e.g., `obj.field`).
80
100
  * @param options.unwind - Field name or array of field names to unwind. Each array value creates a separate item.
81
101
  * @param options.view - Name of a predefined view to use for field selection.
102
+ * @param options.timeoutSecs - Timeout for each API request. Default is `'long'`.
82
103
  * @returns A paginated list with `items`, `total` count, `offset`, `count`, and `limit`
83
104
  * @see https://docs.apify.com/api/v2/dataset-items-get
84
105
  *
@@ -121,6 +142,7 @@ export declare class DatasetClient<Data extends Record<string | number, any> = R
121
142
  * @param options.xmlRow - Name of the XML element for each item. Default is `'item'`.
122
143
  * @param options.fields - Array of field names to include in the export.
123
144
  * @param options.omit - Array of field names to exclude from the export.
145
+ * @param options.timeoutSecs - Timeout for the API request. Default is `'long'`.
124
146
  * @returns Buffer containing the serialized data in the specified format
125
147
  * @see https://docs.apify.com/api/v2/dataset-items-get
126
148
  *
@@ -144,17 +166,20 @@ export declare class DatasetClient<Data extends Record<string | number, any> = R
144
166
  * });
145
167
  * ```
146
168
  */
147
- downloadItems(format: DownloadItemsFormat, options?: DatasetClientDownloadItemsOptions): Promise<Buffer>;
169
+ downloadItems(format: `${DownloadItemsFormat}`, options?: DatasetClientDownloadItemsOptions): Promise<Buffer>;
148
170
  /**
149
171
  * Stores one or more items into the dataset.
150
172
  *
151
- * Items can be objects, strings, or arrays thereof. Each item will be stored as a separate
152
- * record in the dataset. Objects are automatically serialized to JSON. If you provide an array,
153
- * all items will be stored in order. This method is idempotent - calling it multiple times
154
- * with the same data will not create duplicates, but will append items each time.
173
+ * Each item will be stored as a separate record in the dataset. Objects are automatically
174
+ * serialized to JSON. If you provide an array, all items will be stored in order. This method
175
+ * is idempotent - calling it multiple times with the same data will not create duplicates, but
176
+ * will append items each time.
155
177
  *
156
- * @param items - A single item (object or string) or an array of items to store.
157
- * Objects are automatically stringified to JSON. Strings are stored as-is.
178
+ * @param items - A single item, an array of items, or a string that is the JSON serialization of
179
+ * either - the API only accepts an object or an array of objects, so a plain string
180
+ * is not a valid item on its own.
181
+ * @param options - Request options
182
+ * @param options.timeoutSecs - Timeout for the API request. Default is `'medium'`.
158
183
  * @see https://docs.apify.com/api/v2/dataset-items-post
159
184
  *
160
185
  * @example
@@ -172,23 +197,22 @@ export declare class DatasetClient<Data extends Record<string | number, any> = R
172
197
  * { url: 'https://test.com', title: 'Test' },
173
198
  * { url: 'https://demo.com', title: 'Demo' }
174
199
  * ]);
175
- *
176
- * // Store string items
177
- * await client.dataset('my-dataset').pushItems(['item1', 'item2', 'item3']);
178
200
  * ```
179
201
  */
180
- pushItems(items: Data | Data[] | string | string[]): Promise<void>;
202
+ pushItems(items: Data | Data[] | string, options?: TimeoutOptions): Promise<void>;
181
203
  /**
182
204
  * Gets statistical information about the dataset.
183
205
  *
184
206
  * Returns statistics for each field in the dataset, including information about
185
207
  * data types, null counts, and value ranges.
186
208
  *
187
- * @returns Dataset statistics, or `undefined` if not available
209
+ * @param options - Request options
210
+ * @param options.timeoutSecs - Timeout for the API request. Default is `'short'`.
211
+ * @returns Dataset statistics
188
212
  * @see https://docs.apify.com/api/v2/dataset-statistics-get
189
213
  * @since Added in 2.11.2
190
214
  */
191
- getStatistics(): Promise<DatasetStatistics | undefined>;
215
+ getStatistics(options?: TimeoutOptions): Promise<DatasetStatistics>;
192
216
  /**
193
217
  * Generates a public URL for accessing dataset items.
194
218
  *
@@ -199,8 +223,10 @@ export declare class DatasetClient<Data extends Record<string | number, any> = R
199
223
  * @param options - URL generation options (extends all options from {@link listItems})
200
224
  * @param options.expiresInSecs - Number of seconds until the signed URL expires. If omitted, the URL never expires.
201
225
  * @param options.fields - Array of field names to include in the response.
226
+ * @param options.format - Format of the items served by the URL. Defaults to `json`.
202
227
  * @param options.limit - Maximum number of items to return.
203
228
  * @param options.offset - Number of items to skip.
229
+ * @param options.timeoutSecs - Timeout for the API request that fetches the dataset. Default is `'long'`.
204
230
  * @returns A public URL string for accessing the dataset items
205
231
  *
206
232
  * @example
@@ -222,7 +248,6 @@ export declare class DatasetClient<Data extends Record<string | number, any> = R
222
248
  * @since Added in 2.13.0
223
249
  */
224
250
  createItemsPublicUrl(options?: DatasetClientCreateItemsUrlOptions): Promise<string>;
225
- private _createPaginationList;
226
251
  }
227
252
  /**
228
253
  * Options for updating a dataset.
@@ -244,7 +269,7 @@ export interface DatasetClientUpdateOptions {
244
269
  * Provides various filtering, pagination, and transformation options to customize
245
270
  * the output format and content of retrieved items.
246
271
  */
247
- export interface DatasetClientListItemOptions extends PaginationOptions {
272
+ export interface DatasetClientListItemOptions extends PaginationOptions, TimeoutOptions {
248
273
  clean?: boolean;
249
274
  desc?: boolean;
250
275
  /**
@@ -268,25 +293,18 @@ export interface DatasetClientListItemOptions extends PaginationOptions {
268
293
  /**
269
294
  * Options for creating a public URL to access dataset items.
270
295
  *
271
- * Extends {@link DatasetClientListItemOptions} with URL expiration control, minus `chunkSize` (it only
296
+ * Extends {@link DatasetClientListItemOptions} with output format and URL expiration control, minus `chunkSize` (it only
272
297
  * sizes a client-side iteration) and `signature` (this method produces one).
273
298
  * @since Added in 2.16.0
274
299
  */
275
300
  export interface DatasetClientCreateItemsUrlOptions extends Omit<DatasetClientListItemOptions, 'chunkSize' | 'signature'> {
301
+ /**
302
+ * Format of the items served by the URL. Defaults to `json`.
303
+ * @since Added in 2.26.0
304
+ */
305
+ format?: `${DownloadItemsFormat}`;
276
306
  expiresInSecs?: number;
277
307
  }
278
- /**
279
- * Supported formats for downloading dataset items.
280
- */
281
- export declare enum DownloadItemsFormat {
282
- JSON = "json",
283
- JSONL = "jsonl",
284
- XML = "xml",
285
- HTML = "html",
286
- CSV = "csv",
287
- XLSX = "xlsx",
288
- RSS = "rss"
289
- }
290
308
  /**
291
309
  * Options for downloading dataset items in a specific format.
292
310
  *