apify 3.7.3-beta.43 → 3.7.3-beta.45

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/actor.d.ts CHANGED
@@ -1361,9 +1361,12 @@ export declare class Actor<Data extends Dictionary = Dictionary> {
1361
1361
  private _openStorage;
1362
1362
  private _ensureActorInit;
1363
1363
  /**
1364
- * Get time remaining from the Actor run timeout. Returns `undefined` if not on an Apify platform or the current
1365
- * run was started without a timeout.
1364
+ * Get time remaining from the Actor run timeout in seconds, rounded up to whole seconds with minimum value of 1 second.
1365
+ *
1366
+ * The API treats a 0 second timeout as no timeout, the minimum acceptable timeout is 1 second.
1367
+ *
1368
+ * Returns `undefined` if not on the Apify platform or the current run was started without a timeout.
1366
1369
  */
1367
- private getRemainingTime;
1370
+ private getRemainingTimeSecs;
1368
1371
  private inferDefaultsFromInputSchema;
1369
1372
  }
package/dist/actor.js CHANGED
@@ -399,7 +399,7 @@ class Actor {
399
399
  * @ignore
400
400
  */
401
401
  async call(actorId, input, options = {}) {
402
- const timeout = options.timeout === 'inherit' ? this.getRemainingTime() : options.timeout;
402
+ const timeout = options.timeout === 'inherit' ? this.getRemainingTimeSecs() : options.timeout;
403
403
  const { token, ...rest } = options;
404
404
  const client = token ? this.newClient({ token }) : this.apifyClient;
405
405
  return client.actor(actorId).call(input, { ...rest, timeout });
@@ -429,7 +429,7 @@ class Actor {
429
429
  * @ignore
430
430
  */
431
431
  async start(actorId, input, options = {}) {
432
- const timeout = options.timeout === 'inherit' ? this.getRemainingTime() : options.timeout;
432
+ const timeout = options.timeout === 'inherit' ? this.getRemainingTimeSecs() : options.timeout;
433
433
  const { token, ...rest } = options;
434
434
  const client = token ? this.newClient({ token }) : this.apifyClient;
435
435
  return client.actor(actorId).start(input, { ...rest, timeout });
@@ -486,7 +486,7 @@ class Actor {
486
486
  * @ignore
487
487
  */
488
488
  async callTask(taskId, input, options = {}) {
489
- const timeout = options.timeout === 'inherit' ? this.getRemainingTime() : options.timeout;
489
+ const timeout = options.timeout === 'inherit' ? this.getRemainingTimeSecs() : options.timeout;
490
490
  const { token, ...rest } = options;
491
491
  const client = token ? this.newClient({ token }) : this.apifyClient;
492
492
  return client.task(taskId).call(input, { ...rest, timeout });
@@ -1690,13 +1690,17 @@ class Actor {
1690
1690
  ].join('\n'));
1691
1691
  }
1692
1692
  /**
1693
- * Get time remaining from the Actor run timeout. Returns `undefined` if not on an Apify platform or the current
1694
- * run was started without a timeout.
1693
+ * Get time remaining from the Actor run timeout in seconds, rounded up to whole seconds with minimum value of 1 second.
1694
+ *
1695
+ * The API treats a 0 second timeout as no timeout, the minimum acceptable timeout is 1 second.
1696
+ *
1697
+ * Returns `undefined` if not on the Apify platform or the current run was started without a timeout.
1695
1698
  */
1696
- getRemainingTime() {
1699
+ getRemainingTimeSecs() {
1697
1700
  const env = this.getEnv();
1701
+ const MINIMUM_API_TIMEOUT_SECS = 1;
1698
1702
  if (this.isAtHome() && env.timeoutAt !== null) {
1699
- return env.timeoutAt.getTime() - Date.now();
1703
+ return Math.max(Math.ceil((env.timeoutAt.getTime() - Date.now()) / 1000), MINIMUM_API_TIMEOUT_SECS);
1700
1704
  }
1701
1705
  log_1.default.warning('Using `inherit` argument is only possible when the Actor is running on the Apify platform and when the ' +
1702
1706
  'timeout for the Actor run is set.');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "apify",
3
- "version": "3.7.3-beta.43",
3
+ "version": "3.7.3-beta.45",
4
4
  "description": "The scalable web crawling and scraping library for JavaScript/Node.js. Enables development of data extraction and web automation jobs (not only) with headless Chrome and Puppeteer.",
5
5
  "engines": {
6
6
  "node": ">=16.0.0"
@@ -87,7 +87,7 @@
87
87
  "husky": "^9.1.7",
88
88
  "lint-staged": "^17.0.0",
89
89
  "oxfmt": "0.59.0",
90
- "oxlint": "1.73.0",
90
+ "oxlint": "1.74.0",
91
91
  "oxlint-tsgolint": "0.22.0",
92
92
  "playwright": "^1.60.0",
93
93
  "puppeteer": "^25.0.0",