@crawlee/core 4.0.0-beta.158 → 4.0.0-beta.159

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@crawlee/core",
3
- "version": "4.0.0-beta.158",
3
+ "version": "4.0.0-beta.159",
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": ">=22.0.0"
@@ -52,10 +52,10 @@
52
52
  "@apify/log": "^2.5.18",
53
53
  "@apify/timeout": "^0.4.4",
54
54
  "@apify/utilities": "^2.15.5",
55
- "@crawlee/fs-storage": "4.0.0-beta.158",
56
- "@crawlee/http-client": "4.0.0-beta.158",
57
- "@crawlee/types": "4.0.0-beta.158",
58
- "@crawlee/utils": "4.0.0-beta.158",
55
+ "@crawlee/fs-storage": "4.0.0-beta.159",
56
+ "@crawlee/http-client": "4.0.0-beta.159",
57
+ "@crawlee/types": "4.0.0-beta.159",
58
+ "@crawlee/utils": "4.0.0-beta.159",
59
59
  "@sapphire/async-queue": "^1.5.5",
60
60
  "@standard-schema/spec": "^1.0.0",
61
61
  "@vladfrangu/async_event_emitter": "^2.4.6",
@@ -78,5 +78,5 @@
78
78
  }
79
79
  }
80
80
  },
81
- "gitHead": "668c80c7416331155a2f0bb5e02caf19a4886cd9"
81
+ "gitHead": "9f91c03967915be4e9b077a717e0e3494ad0a101"
82
82
  }
@@ -391,6 +391,11 @@ export declare class Dataset<Data extends Dictionary = Dictionary> {
391
391
  * depending on the mode of operation.
392
392
  */
393
393
  drop(): Promise<void>;
394
+ /**
395
+ * Removes all items from the dataset but keeps the dataset itself, along with its
396
+ * {@link Dataset.id|`id`} and {@link Dataset.name|`name`}.
397
+ */
398
+ purge(): Promise<void>;
394
399
  /**
395
400
  * Opens a dataset and returns a promise resolving to an instance of the {@link Dataset} class.
396
401
  *
@@ -542,6 +542,14 @@ export class Dataset {
542
542
  await this.backend.drop();
543
543
  serviceLocator.getStorageInstanceManager().removeFromCache(this);
544
544
  }
545
+ /**
546
+ * Removes all items from the dataset but keeps the dataset itself, along with its
547
+ * {@link Dataset.id|`id`} and {@link Dataset.name|`name`}.
548
+ */
549
+ async purge() {
550
+ rejectOperationInTransaction('Dataset.purge()');
551
+ await this.backend.purge();
552
+ }
545
553
  /**
546
554
  * Opens a dataset and returns a promise resolving to an instance of the {@link Dataset} class.
547
555
  *
@@ -243,6 +243,11 @@ export declare class KeyValueStore {
243
243
  * depending on the mode of operation.
244
244
  */
245
245
  drop(): Promise<void>;
246
+ /**
247
+ * Removes all records from the store but keeps the store itself, along with its
248
+ * {@link KeyValueStore.id|`id`} and {@link KeyValueStore.name|`name`}.
249
+ */
250
+ purge(): Promise<void>;
246
251
  /** @internal */
247
252
  clearCache(): void;
248
253
  /**
@@ -459,6 +459,16 @@ export class KeyValueStore {
459
459
  await this.backend.drop();
460
460
  serviceLocator.getStorageInstanceManager().removeFromCache(this);
461
461
  }
462
+ /**
463
+ * Removes all records from the store but keeps the store itself, along with its
464
+ * {@link KeyValueStore.id|`id`} and {@link KeyValueStore.name|`name`}.
465
+ */
466
+ async purge() {
467
+ rejectOperationInTransaction('KeyValueStore.purge()');
468
+ await this.backend.purge();
469
+ // The auto-saved values this cache holds are no longer in the store.
470
+ this.#cache.clear();
471
+ }
462
472
  /** @internal */
463
473
  clearCache() {
464
474
  rejectOperationInTransaction('KeyValueStore.clearCache()');