@browserless.io/browserless 2.17.0-beta-2 → 2.17.1

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.
@@ -129,7 +129,7 @@
129
129
  "type": "string"
130
130
  },
131
131
  "partitionKey": {
132
- "description": "Cookie partition key. The site of the top-level URL the browser was visiting at the\nstart of the request to the endpoint that set the cookie. If not set, the cookie will\nbe set as not partitioned.",
132
+ "description": "Cookie partition key. In Chrome, it matches the top-level site the\npartitioned cookie is available in. In Firefox, it matches the\nsource origin\n(https://w3c.github.io/webdriver-bidi/#type-storage-PartitionKey).",
133
133
  "type": "string"
134
134
  }
135
135
  },
@@ -255,14 +255,14 @@
255
255
  "length": {
256
256
  "type": "number"
257
257
  },
258
- "__@toStringTag@11909": {
258
+ "__@toStringTag@11944": {
259
259
  "type": "string",
260
260
  "const": "Uint8Array"
261
261
  }
262
262
  },
263
263
  "required": [
264
264
  "BYTES_PER_ELEMENT",
265
- "__@toStringTag@11909",
265
+ "__@toStringTag@11944",
266
266
  "buffer",
267
267
  "byteLength",
268
268
  "byteOffset",
@@ -297,13 +297,13 @@
297
297
  "byteLength": {
298
298
  "type": "number"
299
299
  },
300
- "__@toStringTag@11909": {
300
+ "__@toStringTag@11944": {
301
301
  "type": "string"
302
302
  }
303
303
  },
304
304
  "additionalProperties": false,
305
305
  "required": [
306
- "__@toStringTag@11909",
306
+ "__@toStringTag@11944",
307
307
  "byteLength"
308
308
  ]
309
309
  },
@@ -313,18 +313,18 @@
313
313
  "byteLength": {
314
314
  "type": "number"
315
315
  },
316
- "__@species@11948": {
316
+ "__@species@11983": {
317
317
  "$ref": "#/definitions/SharedArrayBuffer"
318
318
  },
319
- "__@toStringTag@11909": {
319
+ "__@toStringTag@11944": {
320
320
  "type": "string",
321
321
  "const": "SharedArrayBuffer"
322
322
  }
323
323
  },
324
324
  "additionalProperties": false,
325
325
  "required": [
326
- "__@species@11948",
327
- "__@toStringTag@11909",
326
+ "__@species@11983",
327
+ "__@toStringTag@11944",
328
328
  "byteLength"
329
329
  ]
330
330
  },
@@ -827,7 +827,7 @@
827
827
  "type": "string"
828
828
  },
829
829
  "partitionKey": {
830
- "description": "Cookie partition key. The site of the top-level URL the browser was visiting at the\nstart of the request to the endpoint that set the cookie. Supported only in Chrome.",
830
+ "description": "Cookie partition key. In Chrome, it is the top-level site the\npartitioned cookie is available in. In Firefox, it matches the\nsource origin\n(https://w3c.github.io/webdriver-bidi/#type-storage-PartitionKey).",
831
831
  "type": "string"
832
832
  },
833
833
  "partitionKeyOpaque": {
@@ -969,7 +969,7 @@
969
969
  },
970
970
  "info": {
971
971
  "title": "Browserless",
972
- "version": "2.17.0-beta-2",
972
+ "version": "2.17.1",
973
973
  "x-logo": {
974
974
  "altText": "browserless logo",
975
975
  "url": "./docs/browserless-logo-inline.svg"
@@ -2740,7 +2740,7 @@
2740
2740
  "type": "string"
2741
2741
  },
2742
2742
  "partitionKey": {
2743
- "description": "Cookie partition key. The site of the top-level URL the browser was visiting at the\nstart of the request to the endpoint that set the cookie. Supported only in Chrome.",
2743
+ "description": "Cookie partition key. In Chrome, it is the top-level site the\npartitioned cookie is available in. In Firefox, it matches the\nsource origin\n(https://w3c.github.io/webdriver-bidi/#type-storage-PartitionKey).",
2744
2744
  "type": "string"
2745
2745
  },
2746
2746
  "partitionKeyOpaque": {
@@ -4908,7 +4908,7 @@
4908
4908
  "type": "string"
4909
4909
  },
4910
4910
  "partitionKey": {
4911
- "description": "Cookie partition key. The site of the top-level URL the browser was visiting at the\nstart of the request to the endpoint that set the cookie. Supported only in Chrome.",
4911
+ "description": "Cookie partition key. In Chrome, it is the top-level site the\npartitioned cookie is available in. In Firefox, it matches the\nsource origin\n(https://w3c.github.io/webdriver-bidi/#type-storage-PartitionKey).",
4912
4912
  "type": "string"
4913
4913
  },
4914
4914
  "partitionKeyOpaque": {
@@ -4382,7 +4382,7 @@
4382
4382
  // node_modules/puppeteer-core/lib/esm/puppeteer/generated/version.js
4383
4383
  init_dirname();
4384
4384
  init_buffer2();
4385
- var packageVersion = "23.0.2";
4385
+ var packageVersion = "23.1.0";
4386
4386
 
4387
4387
  // node_modules/puppeteer-core/lib/esm/puppeteer/util/assert.js
4388
4388
  init_dirname();
@@ -5204,7 +5204,7 @@
5204
5204
  * ```
5205
5205
  */
5206
5206
  async waitForTarget(predicate, options = {}) {
5207
- const { timeout: ms = 3e4 } = options;
5207
+ const { timeout: ms = 3e4, signal } = options;
5208
5208
  return await firstValueFrom(merge(fromEmitterEvent(
5209
5209
  this,
5210
5210
  "targetcreated"
@@ -5213,7 +5213,7 @@
5213
5213
  this,
5214
5214
  "targetchanged"
5215
5215
  /* BrowserEvent.TargetChanged */
5216
- ), from(this.targets())).pipe(filterAsync(predicate), raceWith(timeout(ms))));
5216
+ ), from(this.targets())).pipe(filterAsync(predicate), raceWith(fromAbortSignal(signal), timeout(ms))));
5217
5217
  }
5218
5218
  /**
5219
5219
  * Gets a list of all open {@link Page | pages} inside this {@link Browser}.
@@ -11652,6 +11652,11 @@
11652
11652
  message: `Waiting for \`DeviceRequestPromptDevice\` failed: ${timeout2}ms exceeded`,
11653
11653
  timeout: timeout2
11654
11654
  });
11655
+ if (options.signal) {
11656
+ options.signal.addEventListener("abort", () => {
11657
+ deferred.reject(options.signal?.reason);
11658
+ }, { once: true });
11659
+ }
11655
11660
  const handle = { filter: filter2, promise: deferred };
11656
11661
  this.#waitForDevicePromises.add(handle);
11657
11662
  try {
@@ -11718,6 +11723,11 @@
11718
11723
  message: `Waiting for \`DeviceRequestPrompt\` failed: ${timeout2}ms exceeded`,
11719
11724
  timeout: timeout2
11720
11725
  });
11726
+ if (options.signal) {
11727
+ options.signal.addEventListener("abort", () => {
11728
+ deferred.reject(options.signal?.reason);
11729
+ }, { once: true });
11730
+ }
11721
11731
  this.#deviceRequestPrompDeferreds.add(deferred);
11722
11732
  try {
11723
11733
  const [result] = await Promise.all([
@@ -18150,6 +18160,11 @@ ${sourceUrlComment}
18150
18160
  message: `Waiting for \`FileChooser\` failed: ${timeout2}ms exceeded`,
18151
18161
  timeout: timeout2
18152
18162
  });
18163
+ if (options.signal) {
18164
+ options.signal.addEventListener("abort", () => {
18165
+ deferred.reject(options.signal?.reason);
18166
+ }, { once: true });
18167
+ }
18153
18168
  this.#fileChooserDeferreds.add(deferred);
18154
18169
  let enablePromise;
18155
18170
  if (needsEnable) {
@@ -18274,11 +18289,26 @@ ${sourceUrlComment}
18274
18289
  async deleteCookie(...cookies) {
18275
18290
  const pageURL = this.url();
18276
18291
  for (const cookie of cookies) {
18277
- const item = Object.assign({}, cookie);
18292
+ const item = {
18293
+ ...cookie,
18294
+ // TODO: a breaking change neeeded to change the partition key
18295
+ // type in Puppeteer.
18296
+ partitionKey: cookie.partitionKey ? { topLevelSite: cookie.partitionKey, hasCrossSiteAncestor: false } : void 0
18297
+ };
18278
18298
  if (!cookie.url && pageURL.startsWith("http")) {
18279
18299
  item.url = pageURL;
18280
18300
  }
18281
18301
  await this.#primaryTargetClient.send("Network.deleteCookies", item);
18302
+ if (pageURL.startsWith("http") && !item.partitionKey) {
18303
+ const url = new URL(pageURL);
18304
+ await this.#primaryTargetClient.send("Network.deleteCookies", {
18305
+ ...item,
18306
+ partitionKey: {
18307
+ topLevelSite: url.origin.replace(`:${url.port}`, ""),
18308
+ hasCrossSiteAncestor: false
18309
+ }
18310
+ });
18311
+ }
18282
18312
  }
18283
18313
  }
18284
18314
  async setCookie(...cookies) {
@@ -4390,7 +4390,7 @@
4390
4390
  // node_modules/puppeteer-core/lib/esm/puppeteer/generated/version.js
4391
4391
  init_dirname();
4392
4392
  init_buffer2();
4393
- var packageVersion = "23.0.2";
4393
+ var packageVersion = "23.1.0";
4394
4394
 
4395
4395
  // node_modules/puppeteer-core/lib/esm/puppeteer/util/assert.js
4396
4396
  init_dirname();
@@ -5212,7 +5212,7 @@
5212
5212
  * ```
5213
5213
  */
5214
5214
  async waitForTarget(predicate, options = {}) {
5215
- const { timeout: ms = 3e4 } = options;
5215
+ const { timeout: ms = 3e4, signal } = options;
5216
5216
  return await firstValueFrom(merge(fromEmitterEvent(
5217
5217
  this,
5218
5218
  "targetcreated"
@@ -5221,7 +5221,7 @@
5221
5221
  this,
5222
5222
  "targetchanged"
5223
5223
  /* BrowserEvent.TargetChanged */
5224
- ), from(this.targets())).pipe(filterAsync(predicate), raceWith(timeout(ms))));
5224
+ ), from(this.targets())).pipe(filterAsync(predicate), raceWith(fromAbortSignal(signal), timeout(ms))));
5225
5225
  }
5226
5226
  /**
5227
5227
  * Gets a list of all open {@link Page | pages} inside this {@link Browser}.
@@ -11660,6 +11660,11 @@
11660
11660
  message: `Waiting for \`DeviceRequestPromptDevice\` failed: ${timeout2}ms exceeded`,
11661
11661
  timeout: timeout2
11662
11662
  });
11663
+ if (options.signal) {
11664
+ options.signal.addEventListener("abort", () => {
11665
+ deferred.reject(options.signal?.reason);
11666
+ }, { once: true });
11667
+ }
11663
11668
  const handle = { filter: filter2, promise: deferred };
11664
11669
  this.#waitForDevicePromises.add(handle);
11665
11670
  try {
@@ -11726,6 +11731,11 @@
11726
11731
  message: `Waiting for \`DeviceRequestPrompt\` failed: ${timeout2}ms exceeded`,
11727
11732
  timeout: timeout2
11728
11733
  });
11734
+ if (options.signal) {
11735
+ options.signal.addEventListener("abort", () => {
11736
+ deferred.reject(options.signal?.reason);
11737
+ }, { once: true });
11738
+ }
11729
11739
  this.#deviceRequestPrompDeferreds.add(deferred);
11730
11740
  try {
11731
11741
  const [result] = await Promise.all([
@@ -18158,6 +18168,11 @@ ${sourceUrlComment}
18158
18168
  message: `Waiting for \`FileChooser\` failed: ${timeout2}ms exceeded`,
18159
18169
  timeout: timeout2
18160
18170
  });
18171
+ if (options.signal) {
18172
+ options.signal.addEventListener("abort", () => {
18173
+ deferred.reject(options.signal?.reason);
18174
+ }, { once: true });
18175
+ }
18161
18176
  this.#fileChooserDeferreds.add(deferred);
18162
18177
  let enablePromise;
18163
18178
  if (needsEnable) {
@@ -18282,11 +18297,26 @@ ${sourceUrlComment}
18282
18297
  async deleteCookie(...cookies) {
18283
18298
  const pageURL = this.url();
18284
18299
  for (const cookie of cookies) {
18285
- const item = Object.assign({}, cookie);
18300
+ const item = {
18301
+ ...cookie,
18302
+ // TODO: a breaking change neeeded to change the partition key
18303
+ // type in Puppeteer.
18304
+ partitionKey: cookie.partitionKey ? { topLevelSite: cookie.partitionKey, hasCrossSiteAncestor: false } : void 0
18305
+ };
18286
18306
  if (!cookie.url && pageURL.startsWith("http")) {
18287
18307
  item.url = pageURL;
18288
18308
  }
18289
18309
  await this.#primaryTargetClient.send("Network.deleteCookies", item);
18310
+ if (pageURL.startsWith("http") && !item.partitionKey) {
18311
+ const url = new URL(pageURL);
18312
+ await this.#primaryTargetClient.send("Network.deleteCookies", {
18313
+ ...item,
18314
+ partitionKey: {
18315
+ topLevelSite: url.origin.replace(`:${url.port}`, ""),
18316
+ hasCrossSiteAncestor: false
18317
+ }
18318
+ });
18319
+ }
18290
18320
  }
18291
18321
  }
18292
18322
  async setCookie(...cookies) {