scrapely 1.2.3 → 1.2.5

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 (86) hide show
  1. package/README.md +119 -1
  2. package/dist/actor.d.ts +703 -0
  3. package/dist/actor.js +1441 -0
  4. package/dist/browser-configuration.d.ts +58 -0
  5. package/dist/browser-configuration.js +128 -0
  6. package/dist/browser-locations.d.ts +5 -0
  7. package/dist/browser-locations.js +5469 -0
  8. package/dist/charging.d.ts +153 -0
  9. package/dist/charging.js +782 -0
  10. package/dist/charging_client.d.ts +18 -0
  11. package/dist/charging_client.js +49 -0
  12. package/dist/configuration.d.ts +121 -0
  13. package/dist/configuration.js +128 -0
  14. package/dist/crypto/secrets.d.ts +44 -0
  15. package/dist/crypto/secrets.js +164 -0
  16. package/dist/events/events-client.d.ts +59 -0
  17. package/dist/events/events-client.js +120 -0
  18. package/dist/events/scrapely-event-manager.d.ts +13 -0
  19. package/dist/events/scrapely-event-manager.js +61 -0
  20. package/dist/index.d.ts +29 -0
  21. package/dist/index.js +95 -0
  22. package/dist/log-env.d.ts +1 -0
  23. package/dist/log-env.js +12 -0
  24. package/dist/manifest.d.ts +30 -0
  25. package/dist/manifest.js +47 -0
  26. package/dist/patch-browser-pool.d.ts +66 -0
  27. package/dist/patch-browser-pool.js +827 -0
  28. package/dist/proxy-configuration.d.ts +118 -0
  29. package/dist/proxy-configuration.js +88 -0
  30. package/dist/request-list.d.ts +57 -0
  31. package/dist/request-list.js +79 -0
  32. package/dist/runner/docker-manager.d.ts +88 -0
  33. package/dist/runner/docker-manager.js +283 -0
  34. package/dist/runner/index.d.ts +2 -0
  35. package/dist/runner/index.js +7 -0
  36. package/dist/runner/timeout-manager.d.ts +43 -0
  37. package/dist/runner/timeout-manager.js +90 -0
  38. package/dist/scrapely-proxy-configuration.d.ts +99 -0
  39. package/dist/scrapely-proxy-configuration.js +559 -0
  40. package/dist/storage/api-storage-client.d.ts +199 -0
  41. package/dist/storage/api-storage-client.js +910 -0
  42. package/dist/storage/billing-tracker.d.ts +163 -0
  43. package/dist/storage/billing-tracker.js +260 -0
  44. package/dist/storage/dataset-client.d.ts +43 -0
  45. package/dist/storage/dataset-client.js +232 -0
  46. package/dist/storage/dataset-collection-client.d.ts +8 -0
  47. package/dist/storage/dataset-collection-client.js +75 -0
  48. package/dist/storage/dataset-push-script.d.ts +18 -0
  49. package/dist/storage/dataset-push-script.js +38 -0
  50. package/dist/storage/dragonfly-client.d.ts +94 -0
  51. package/dist/storage/dragonfly-client.js +167 -0
  52. package/dist/storage/index.d.ts +11 -0
  53. package/dist/storage/index.js +25 -0
  54. package/dist/storage/key-value-store-client.d.ts +61 -0
  55. package/dist/storage/key-value-store-client.js +306 -0
  56. package/dist/storage/kv-store-collection-client.d.ts +8 -0
  57. package/dist/storage/kv-store-collection-client.js +76 -0
  58. package/dist/storage/kvs-iteration.d.ts +17 -0
  59. package/dist/storage/kvs-iteration.js +126 -0
  60. package/dist/storage/log-manager.d.ts +114 -0
  61. package/dist/storage/log-manager.js +244 -0
  62. package/dist/storage/patch-storage.d.ts +11 -0
  63. package/dist/storage/patch-storage.js +177 -0
  64. package/dist/storage/request-queue-client.d.ts +93 -0
  65. package/dist/storage/request-queue-client.js +522 -0
  66. package/dist/storage/rq-collection-client.d.ts +8 -0
  67. package/dist/storage/rq-collection-client.js +89 -0
  68. package/dist/storage/rq-list-requests.d.ts +59 -0
  69. package/dist/storage/rq-list-requests.js +114 -0
  70. package/dist/storage/rq-lock-script.d.ts +56 -0
  71. package/dist/storage/rq-lock-script.js +127 -0
  72. package/dist/storage/run-metadata.d.ts +98 -0
  73. package/dist/storage/run-metadata.js +256 -0
  74. package/dist/storage/s3-client.d.ts +103 -0
  75. package/dist/storage/s3-client.js +302 -0
  76. package/dist/storage/ttl-manager.d.ts +70 -0
  77. package/dist/storage/ttl-manager.js +115 -0
  78. package/dist/storage/utils.d.ts +3 -0
  79. package/dist/storage/utils.js +19 -0
  80. package/dist/storage-identifiers.d.ts +20 -0
  81. package/dist/storage-identifiers.js +6 -0
  82. package/dist/utils.d.ts +54 -0
  83. package/dist/utils.js +63 -0
  84. package/dist/validator.d.ts +24 -0
  85. package/dist/validator.js +158 -0
  86. package/package.json +90 -9
@@ -0,0 +1,163 @@
1
+ /**
2
+ * Interface for billing client - can be implemented by DragonflyClient or server's DragonflyConnection
3
+ * Uses 'any' for redis to avoid type conflicts between different ioredis versions in different packages
4
+ */
5
+ export interface BillingClient {
6
+ redis: any;
7
+ key(...parts: string[]): string;
8
+ }
9
+ /**
10
+ * Tracks storage usage for billing purposes.
11
+ *
12
+ * Storage is tracked in bytes for:
13
+ * - Datasets (items stored)
14
+ * - KV stores (records stored)
15
+ * - Request queues (requests stored)
16
+ * - Logs (log size)
17
+ *
18
+ * This data is used to calculate storage-hour charges like Apify.
19
+ */
20
+ export declare class BillingTracker {
21
+ private client;
22
+ constructor(client: BillingClient);
23
+ /**
24
+ * Get the Redis key for user's billing data.
25
+ * Uses the client's key prefix for proper environment isolation.
26
+ */
27
+ private getBillingKey;
28
+ /**
29
+ * Get the Redis key for run's storage bytes
30
+ */
31
+ private getRunStorageKey;
32
+ /**
33
+ * Track storage bytes for a run.
34
+ * Called when data is written to storage.
35
+ *
36
+ * @param runId - The run producing the storage.
37
+ * @param userId - Owner of the run (used for the user-level billing key).
38
+ * @param bytes - Number of bytes to add.
39
+ * @param ttlSeconds - Optional TTL to set on the per-run billing key (NX — only
40
+ * applied when the key is first created). Pass the same TTL as the run's data
41
+ * so the billing key expires together with the run and never accumulates forever.
42
+ *
43
+ * Fix: all Redis writes are batched into a single pipeline to reduce round-trips
44
+ * from 5 down to 1 and to make the operation safer under concurrent writers.
45
+ */
46
+ trackStorageBytes(runId: string, userId: string, bytes: number, ttlSeconds?: number): Promise<void>;
47
+ /**
48
+ * Reduce the user's running total when a run's storage is released.
49
+ * Should be called from the run cleanup path (e.g. when delete() is invoked on
50
+ * RunMetadataManager or when a run's TTL fires and its data is gone).
51
+ * Clamps the total at 0 to guard against double-release.
52
+ *
53
+ * Note: the read-decrement-clamp sequence is not fully atomic. At MVP scale
54
+ * this is acceptable; a Lua script can be used later if needed.
55
+ */
56
+ releaseStorageBytes(runId: string, userId: string): Promise<void>;
57
+ /**
58
+ * Track read operations for billing.
59
+ */
60
+ trackRead(userId: string, count?: number): Promise<void>;
61
+ /**
62
+ * Track write operations for billing.
63
+ */
64
+ trackWrite(userId: string, count?: number): Promise<void>;
65
+ /**
66
+ * Track list operations for billing (KV store listKeys).
67
+ */
68
+ trackList(userId: string, count?: number): Promise<void>;
69
+ /**
70
+ * Get billing summary for a user.
71
+ * Now includes `storageHourBytes` and `internalTransferBytes` so callers can display accumulated
72
+ * storage-hour usage and internal transfer without having to call separate methods.
73
+ */
74
+ getBillingSummary(userId: string): Promise<BillingSummary>;
75
+ /**
76
+ * Get storage bytes for a specific run.
77
+ */
78
+ getRunStorageBytes(runId: string): Promise<number>;
79
+ /**
80
+ * Calculate storage hours for billing.
81
+ * Storage hours = bytes * hours stored.
82
+ * This is called periodically (e.g., hourly) to record usage.
83
+ */
84
+ recordStorageHour(userId: string, bytes: number): Promise<void>;
85
+ /**
86
+ * Get and reset storage hours (for periodic billing).
87
+ * Returns the total storage-hour-bytes and resets the counters.
88
+ *
89
+ * Note: the read-reset sequence is not fully atomic. Two concurrent billing
90
+ * cron jobs could both read the same non-zero value and both reset it, causing
91
+ * one batch to be silently discarded. At MVP scale a single billing worker is
92
+ * assumed; use a Lua script (HGET+HSET in one round-trip) if concurrency is needed.
93
+ */
94
+ getAndResetStorageHours(userId: string): Promise<{
95
+ storageHourBytes: number;
96
+ storageHourCount: number;
97
+ }>;
98
+ /**
99
+ * Estimate bytes for a dataset item.
100
+ * Rough estimate based on JSON string length.
101
+ */
102
+ static estimateItemBytes(item: any): number;
103
+ /**
104
+ * Estimate bytes for a KV store record.
105
+ */
106
+ static estimateRecordBytes(key: string, value: Buffer | string | object): number;
107
+ /**
108
+ * Estimate bytes for a request queue item.
109
+ */
110
+ static estimateRequestBytes(request: any): number;
111
+ /**
112
+ * Get the Redis key for run's transfer bytes.
113
+ * Uses the client's key prefix for proper environment isolation.
114
+ */
115
+ private getRunTransferKey;
116
+ /**
117
+ * Track internal data transfer for billing.
118
+ * Called when data is read from storage (datasets, KV stores, request queues).
119
+ * Internal transfer = data transferred between actor and Scrapely storage.
120
+ *
121
+ * @param runId - The run that caused the transfer (for per-run attribution)
122
+ * @param userId - The user whose storage was accessed
123
+ * @param bytes - Number of bytes transferred
124
+ */
125
+ trackInternalTransfer(runId: string, userId: string, bytes: number): Promise<void>;
126
+ /**
127
+ * Track external data transfer for billing (egress).
128
+ * Called when data leaves the platform to users via API (e.g., downloading dataset items, fetching KV records).
129
+ * External egress = data going out of our system to the internet.
130
+ *
131
+ * @param runId - The run that caused the transfer (for per-run attribution)
132
+ * @param userId - The user who downloaded the data
133
+ * @param bytes - Number of bytes transferred
134
+ */
135
+ trackExternalTransfer(runId: string, userId: string, bytes: number): Promise<void>;
136
+ /**
137
+ * Get transfer bytes for a specific run.
138
+ */
139
+ getRunTransferBytes(runId: string): Promise<{
140
+ internalTransferBytes: number;
141
+ externalTransferBytes: number;
142
+ }>;
143
+ /**
144
+ * Clear transfer bytes for a specific run (cleanup after billing).
145
+ */
146
+ clearRunTransferBytes(runId: string): Promise<void>;
147
+ }
148
+ export interface BillingSummary {
149
+ userId: string;
150
+ totalStorageBytes: number;
151
+ readCount: number;
152
+ writeCount: number;
153
+ listCount: number;
154
+ /** Accumulated storage-hour bytes since last reset (for periodic billing). */
155
+ storageHourBytes: number;
156
+ /** Number of hourly snapshots recorded since last reset. */
157
+ storageHourCount: number;
158
+ /** Accumulated internal transfer bytes (actor ↔ storage) since last reset. */
159
+ internalTransferBytes: number;
160
+ /** Accumulated external egress bytes (platform → user via API) since last reset. */
161
+ externalTransferBytes: number;
162
+ updatedAt: number | null;
163
+ }
@@ -0,0 +1,260 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.BillingTracker = void 0;
4
+ /**
5
+ * Tracks storage usage for billing purposes.
6
+ *
7
+ * Storage is tracked in bytes for:
8
+ * - Datasets (items stored)
9
+ * - KV stores (records stored)
10
+ * - Request queues (requests stored)
11
+ * - Logs (log size)
12
+ *
13
+ * This data is used to calculate storage-hour charges like Apify.
14
+ */
15
+ class BillingTracker {
16
+ client;
17
+ constructor(client) {
18
+ this.client = client;
19
+ }
20
+ /**
21
+ * Get the Redis key for user's billing data.
22
+ * Uses the client's key prefix for proper environment isolation.
23
+ */
24
+ getBillingKey(userId) {
25
+ return this.client.key('billing', userId);
26
+ }
27
+ /**
28
+ * Get the Redis key for run's storage bytes
29
+ */
30
+ getRunStorageKey(runId) {
31
+ return this.client.key('billing', 'run', runId);
32
+ }
33
+ /**
34
+ * Track storage bytes for a run.
35
+ * Called when data is written to storage.
36
+ *
37
+ * @param runId - The run producing the storage.
38
+ * @param userId - Owner of the run (used for the user-level billing key).
39
+ * @param bytes - Number of bytes to add.
40
+ * @param ttlSeconds - Optional TTL to set on the per-run billing key (NX — only
41
+ * applied when the key is first created). Pass the same TTL as the run's data
42
+ * so the billing key expires together with the run and never accumulates forever.
43
+ *
44
+ * Fix: all Redis writes are batched into a single pipeline to reduce round-trips
45
+ * from 5 down to 1 and to make the operation safer under concurrent writers.
46
+ */
47
+ async trackStorageBytes(runId, userId, bytes, ttlSeconds) {
48
+ const runKey = this.getRunStorageKey(runId);
49
+ const billingKey = this.getBillingKey(userId);
50
+ const now = String(Date.now());
51
+ const pipeline = this.client.redis.pipeline();
52
+ pipeline.hincrby(runKey, 'storageBytes', bytes);
53
+ pipeline.hincrby(billingKey, 'totalStorageBytes', bytes);
54
+ pipeline.hset(runKey, 'updatedAt', now);
55
+ pipeline.hset(billingKey, 'updatedAt', now);
56
+ // Attach a TTL to the per-run billing key so it expires alongside run data.
57
+ // NX ensures we only set it on the first write; subsequent writes don't reset it.
58
+ if (ttlSeconds && ttlSeconds > 0) {
59
+ pipeline.expire(runKey, ttlSeconds, 'NX');
60
+ }
61
+ await pipeline.exec();
62
+ }
63
+ /**
64
+ * Reduce the user's running total when a run's storage is released.
65
+ * Should be called from the run cleanup path (e.g. when delete() is invoked on
66
+ * RunMetadataManager or when a run's TTL fires and its data is gone).
67
+ * Clamps the total at 0 to guard against double-release.
68
+ *
69
+ * Note: the read-decrement-clamp sequence is not fully atomic. At MVP scale
70
+ * this is acceptable; a Lua script can be used later if needed.
71
+ */
72
+ async releaseStorageBytes(runId, userId) {
73
+ const runKey = this.getRunStorageKey(runId);
74
+ const billingKey = this.getBillingKey(userId);
75
+ // Read the bytes that were charged to this run
76
+ const stored = await this.client.redis.hget(runKey, 'storageBytes');
77
+ const bytes = parseInt(stored || '0', 10);
78
+ if (bytes > 0) {
79
+ // Decrement user total, but never go below 0
80
+ await this.client.redis.hincrby(billingKey, 'totalStorageBytes', -bytes);
81
+ // Clamp to 0
82
+ const current = parseInt((await this.client.redis.hget(billingKey, 'totalStorageBytes')) || '0', 10);
83
+ if (current < 0) {
84
+ await this.client.redis.hset(billingKey, 'totalStorageBytes', '0');
85
+ }
86
+ }
87
+ // Remove the per-run billing key entirely
88
+ await this.client.redis.del(runKey);
89
+ }
90
+ /**
91
+ * Track read operations for billing.
92
+ */
93
+ async trackRead(userId, count = 1) {
94
+ const billingKey = this.getBillingKey(userId);
95
+ await this.client.redis.hincrby(billingKey, 'readCount', count);
96
+ }
97
+ /**
98
+ * Track write operations for billing.
99
+ */
100
+ async trackWrite(userId, count = 1) {
101
+ const billingKey = this.getBillingKey(userId);
102
+ await this.client.redis.hincrby(billingKey, 'writeCount', count);
103
+ }
104
+ /**
105
+ * Track list operations for billing (KV store listKeys).
106
+ */
107
+ async trackList(userId, count = 1) {
108
+ const billingKey = this.getBillingKey(userId);
109
+ await this.client.redis.hincrby(billingKey, 'listCount', count);
110
+ }
111
+ /**
112
+ * Get billing summary for a user.
113
+ * Now includes `storageHourBytes` and `internalTransferBytes` so callers can display accumulated
114
+ * storage-hour usage and internal transfer without having to call separate methods.
115
+ */
116
+ async getBillingSummary(userId) {
117
+ const billingKey = this.getBillingKey(userId);
118
+ const data = await this.client.redis.hgetall(billingKey);
119
+ return {
120
+ userId,
121
+ totalStorageBytes: parseInt(data.totalStorageBytes || '0', 10),
122
+ readCount: parseInt(data.readCount || '0', 10),
123
+ writeCount: parseInt(data.writeCount || '0', 10),
124
+ listCount: parseInt(data.listCount || '0', 10),
125
+ storageHourBytes: parseInt(data.storageHourBytes || '0', 10),
126
+ storageHourCount: parseInt(data.storageHourCount || '0', 10),
127
+ internalTransferBytes: parseInt(data.internalTransferBytes || '0', 10),
128
+ externalTransferBytes: parseInt(data.externalTransferBytes || '0', 10),
129
+ updatedAt: data.updatedAt ? parseInt(data.updatedAt, 10) : null,
130
+ };
131
+ }
132
+ /**
133
+ * Get storage bytes for a specific run.
134
+ */
135
+ async getRunStorageBytes(runId) {
136
+ const runKey = this.getRunStorageKey(runId);
137
+ const data = await this.client.redis.hget(runKey, 'storageBytes');
138
+ return parseInt(data || '0', 10);
139
+ }
140
+ /**
141
+ * Calculate storage hours for billing.
142
+ * Storage hours = bytes * hours stored.
143
+ * This is called periodically (e.g., hourly) to record usage.
144
+ */
145
+ async recordStorageHour(userId, bytes) {
146
+ const billingKey = this.getBillingKey(userId);
147
+ const pipeline = this.client.redis.pipeline();
148
+ // This represents: bytes stored for 1 hour
149
+ pipeline.hincrby(billingKey, 'storageHourBytes', bytes);
150
+ pipeline.hincrby(billingKey, 'storageHourCount', 1);
151
+ await pipeline.exec();
152
+ }
153
+ /**
154
+ * Get and reset storage hours (for periodic billing).
155
+ * Returns the total storage-hour-bytes and resets the counters.
156
+ *
157
+ * Note: the read-reset sequence is not fully atomic. Two concurrent billing
158
+ * cron jobs could both read the same non-zero value and both reset it, causing
159
+ * one batch to be silently discarded. At MVP scale a single billing worker is
160
+ * assumed; use a Lua script (HGET+HSET in one round-trip) if concurrency is needed.
161
+ */
162
+ async getAndResetStorageHours(userId) {
163
+ const billingKey = this.getBillingKey(userId);
164
+ const data = await this.client.redis.hgetall(billingKey);
165
+ const result = {
166
+ storageHourBytes: parseInt(data.storageHourBytes || '0', 10),
167
+ storageHourCount: parseInt(data.storageHourCount || '0', 10),
168
+ };
169
+ // Reset the counters
170
+ const pipeline = this.client.redis.pipeline();
171
+ pipeline.hset(billingKey, 'storageHourBytes', '0');
172
+ pipeline.hset(billingKey, 'storageHourCount', '0');
173
+ await pipeline.exec();
174
+ return result;
175
+ }
176
+ /**
177
+ * Estimate bytes for a dataset item.
178
+ * Rough estimate based on JSON string length.
179
+ */
180
+ static estimateItemBytes(item) {
181
+ return Buffer.byteLength(JSON.stringify(item), 'utf-8');
182
+ }
183
+ /**
184
+ * Estimate bytes for a KV store record.
185
+ */
186
+ static estimateRecordBytes(key, value) {
187
+ const keyBytes = Buffer.byteLength(key, 'utf-8');
188
+ let valueBytes;
189
+ if (Buffer.isBuffer(value)) {
190
+ valueBytes = value.length;
191
+ }
192
+ else if (typeof value === 'string') {
193
+ valueBytes = Buffer.byteLength(value, 'utf-8');
194
+ }
195
+ else {
196
+ valueBytes = Buffer.byteLength(JSON.stringify(value), 'utf-8');
197
+ }
198
+ return keyBytes + valueBytes;
199
+ }
200
+ /**
201
+ * Estimate bytes for a request queue item.
202
+ */
203
+ static estimateRequestBytes(request) {
204
+ return Buffer.byteLength(JSON.stringify(request), 'utf-8');
205
+ }
206
+ /**
207
+ * Get the Redis key for run's transfer bytes.
208
+ * Uses the client's key prefix for proper environment isolation.
209
+ */
210
+ getRunTransferKey(runId) {
211
+ return this.client.key('billing', 'run', runId, 'transfer');
212
+ }
213
+ /**
214
+ * Track internal data transfer for billing.
215
+ * Called when data is read from storage (datasets, KV stores, request queues).
216
+ * Internal transfer = data transferred between actor and Scrapely storage.
217
+ *
218
+ * @param runId - The run that caused the transfer (for per-run attribution)
219
+ * @param userId - The user whose storage was accessed
220
+ * @param bytes - Number of bytes transferred
221
+ */
222
+ async trackInternalTransfer(runId, userId, bytes) {
223
+ const runTransferKey = this.getRunTransferKey(runId);
224
+ // Track per-run only (run-scoped billing)
225
+ await this.client.redis.hincrby(runTransferKey, 'internalTransferBytes', bytes);
226
+ }
227
+ /**
228
+ * Track external data transfer for billing (egress).
229
+ * Called when data leaves the platform to users via API (e.g., downloading dataset items, fetching KV records).
230
+ * External egress = data going out of our system to the internet.
231
+ *
232
+ * @param runId - The run that caused the transfer (for per-run attribution)
233
+ * @param userId - The user who downloaded the data
234
+ * @param bytes - Number of bytes transferred
235
+ */
236
+ async trackExternalTransfer(runId, userId, bytes) {
237
+ const runTransferKey = this.getRunTransferKey(runId);
238
+ // Track per-run only (run-scoped billing)
239
+ await this.client.redis.hincrby(runTransferKey, 'externalTransferBytes', bytes);
240
+ }
241
+ /**
242
+ * Get transfer bytes for a specific run.
243
+ */
244
+ async getRunTransferBytes(runId) {
245
+ const runTransferKey = this.getRunTransferKey(runId);
246
+ const data = await this.client.redis.hgetall(runTransferKey);
247
+ return {
248
+ internalTransferBytes: parseInt(data.internalTransferBytes || '0', 10),
249
+ externalTransferBytes: parseInt(data.externalTransferBytes || '0', 10),
250
+ };
251
+ }
252
+ /**
253
+ * Clear transfer bytes for a specific run (cleanup after billing).
254
+ */
255
+ async clearRunTransferBytes(runId) {
256
+ const runTransferKey = this.getRunTransferKey(runId);
257
+ await this.client.redis.del(runTransferKey);
258
+ }
259
+ }
260
+ exports.BillingTracker = BillingTracker;
@@ -0,0 +1,43 @@
1
+ import type { DatasetClient, DatasetClientListOptions, DatasetClientUpdateOptions, DatasetInfo, PaginatedList, Dictionary } from '@crawlee/types';
2
+ /**
3
+ * Extended options for listing dataset items with filtering support.
4
+ * Matches Crawlee's DatasetDataOptions interface.
5
+ */
6
+ interface ExtendedDatasetListOptions extends DatasetClientListOptions {
7
+ /** An array of field names that will be included in the result. */
8
+ fields?: string[];
9
+ /** If true then the function returns only non-empty items and skips hidden fields. */
10
+ clean?: boolean;
11
+ /** If true then the function doesn't return hidden fields (fields starting with "#"). */
12
+ skipHidden?: boolean;
13
+ /** If true then the function doesn't return empty items. */
14
+ skipEmpty?: boolean;
15
+ }
16
+ import type { DragonflyClient } from './dragonfly-client.js';
17
+ export declare class DragonflyDatasetClient<Data extends Dictionary = Dictionary> implements DatasetClient<Data> {
18
+ private client;
19
+ private id;
20
+ private infoKey;
21
+ private itemsKey;
22
+ constructor(client: DragonflyClient, id: string);
23
+ get(): Promise<DatasetInfo | undefined>;
24
+ update(newFields: DatasetClientUpdateOptions): Promise<Partial<DatasetInfo>>;
25
+ delete(): Promise<void>;
26
+ downloadItems(): Promise<Buffer>;
27
+ listItems(options?: ExtendedDatasetListOptions): AsyncIterable<Data> & Promise<PaginatedList<Data>>;
28
+ /**
29
+ * Iterates over dataset entries (index-value pairs) using an async generator.
30
+ * Required by Crawlee's Dataset.entries() method.
31
+ */
32
+ listEntries(options?: ExtendedDatasetListOptions): AsyncIterable<[number, Data]> & Promise<PaginatedList<[number, Data]>>;
33
+ private _listItems;
34
+ /**
35
+ * Apply filtering options to dataset items.
36
+ */
37
+ private _applyFilters;
38
+ pushItems(items: Data | Data[] | string | string[], billingContext?: {
39
+ runId: string;
40
+ userId: string;
41
+ }): Promise<void>;
42
+ }
43
+ export {};